aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2019-10-08 15:48:26 -0700
committerHaibo Huang <hhb@google.com>2019-11-14 22:14:23 +0000
commit80b4251e302efb18c145a4786249d695397ed42a (patch)
tree12b9dec2513f7caa92e7835bc17ab16ae5635df6
parent189852d8cdfd5863c52ec7aa73affd926c5a3f43 (diff)
parent1e36f51346d95f8b9848e682c2eb986e9cb9b4f4 (diff)
downloadswig-80b4251e302efb18c145a4786249d695397ed42a.tar.gz
Upgrade swig to 'rel-4.0.1'llvm-r383902b
Also run autogen.sh to generate configure files. Exempt-From-Owner-Approval: add myself to owners Change-Id: I391aa20428836ae74dab8c8427627ca4dbc8ecf4
-rw-r--r--.gitignore49
-rw-r--r--.travis.yml369
-rw-r--r--ANNOUNCE20
-rw-r--r--CCache/Makefile.in35
-rw-r--r--CCache/ccache.h4
-rw-r--r--CCache/config.h.in121
-rw-r--r--CCache/config_win32.h.in3
-rwxr-xr-xCCache/configure5175
-rw-r--r--CCache/configure.ac15
-rw-r--r--CCache/snprintf.c3
-rwxr-xr-xCCache/test.sh25
-rw-r--r--CHANGES1669
-rw-r--r--CHANGES.current236
-rw-r--r--COPYRIGHT6
-rw-r--r--Doc/Devel/plan-gsoc-2012.txt341
-rw-r--r--Doc/Devel/runtime.txt4
-rw-r--r--Doc/Devel/tree.html2
-rw-r--r--Doc/Manual/Allegrocl.html116
-rw-r--r--Doc/Manual/Android.html22
-rw-r--r--Doc/Manual/Arguments.html24
-rw-r--r--Doc/Manual/CCache.html40
-rw-r--r--Doc/Manual/CPlusPlus11.html144
-rw-r--r--Doc/Manual/CPlusPlus14.html60
-rw-r--r--Doc/Manual/CPlusPlus17.html109
-rw-r--r--Doc/Manual/CSharp.html274
-rw-r--r--Doc/Manual/Chicken.html40
-rw-r--r--Doc/Manual/Contents.html558
-rw-r--r--Doc/Manual/Contract.html10
-rw-r--r--Doc/Manual/Customization.html38
-rw-r--r--Doc/Manual/D.html58
-rw-r--r--Doc/Manual/Doxygen.html1838
-rw-r--r--Doc/Manual/Extending.html392
-rw-r--r--Doc/Manual/Go.html142
-rw-r--r--Doc/Manual/Guile.html44
-rw-r--r--Doc/Manual/Introduction.html115
-rw-r--r--Doc/Manual/Java.html908
-rw-r--r--Doc/Manual/Javascript.html61
-rw-r--r--Doc/Manual/Library.html173
-rw-r--r--Doc/Manual/Lisp.html246
-rw-r--r--Doc/Manual/Lua.html22
-rw-r--r--Doc/Manual/Makefile6
-rw-r--r--Doc/Manual/Modula3.html40
-rw-r--r--Doc/Manual/Modules.html16
-rw-r--r--Doc/Manual/Mzscheme.html10
-rw-r--r--Doc/Manual/Ocaml.html210
-rw-r--r--Doc/Manual/Octave.html52
-rw-r--r--Doc/Manual/Perl5.html242
-rw-r--r--Doc/Manual/Php.html149
-rw-r--r--Doc/Manual/Pike.html28
-rw-r--r--Doc/Manual/Preface.html7
-rw-r--r--Doc/Manual/Preprocessor.html46
-rw-r--r--Doc/Manual/Python.html1558
-rw-r--r--Doc/Manual/R.html90
-rw-r--r--Doc/Manual/Ruby.html224
-rw-r--r--Doc/Manual/SWIG.html304
-rw-r--r--Doc/Manual/SWIGPlus.html1053
-rw-r--r--Doc/Manual/Scilab.html157
-rw-r--r--Doc/Manual/Sections.html25
-rw-r--r--Doc/Manual/Tcl.html156
-rw-r--r--Doc/Manual/Typemaps.html538
-rw-r--r--Doc/Manual/Varargs.html29
-rw-r--r--Doc/Manual/Warnings.html52
-rw-r--r--Doc/Manual/Windows.html8
-rw-r--r--Doc/Manual/chapters12
-rw-r--r--Doc/Manual/index.html4
-rw-r--r--Doc/Manual/makechap.py4
-rw-r--r--Examples/Makefile.in706
-rw-r--r--Examples/go/callback/gocallback.go2
-rw-r--r--Examples/go/callback/runme.go3
-rw-r--r--Examples/go/class/runme.go3
-rw-r--r--Examples/go/constants/runme.go3
-rw-r--r--Examples/go/director/director.go4
-rw-r--r--Examples/go/director/runme.go3
-rw-r--r--Examples/go/enum/runme.go3
-rw-r--r--Examples/go/extend/runme.go3
-rw-r--r--Examples/go/funcptr/runme.go3
-rw-r--r--Examples/go/multimap/runme.go3
-rw-r--r--Examples/go/pointer/runme.go3
-rw-r--r--Examples/go/reference/runme.go3
-rw-r--r--Examples/go/simple/runme.go3
-rw-r--r--Examples/go/template/runme.go3
-rw-r--r--Examples/go/variables/runme.go3
-rw-r--r--Examples/guile/matrix/runme.scm2
-rw-r--r--Examples/guile/multivalue/example.i4
-rw-r--r--Examples/guile/simple/example.c27
-rw-r--r--Examples/guile/simple/example.i6
-rw-r--r--Examples/guile/simple/runme.scm28
-rw-r--r--Examples/guile/std_vector/example.h5
-rw-r--r--Examples/java/check.list1
-rw-r--r--Examples/java/doxygen/Makefile (renamed from Examples/php5/overloading/Makefile)13
-rw-r--r--Examples/java/doxygen/example.cxx48
-rw-r--r--Examples/java/doxygen/example.dsp162
-rw-r--r--Examples/java/doxygen/example.h107
-rw-r--r--Examples/java/doxygen/example.i17
-rw-r--r--Examples/java/doxygen/runme.java63
-rw-r--r--Examples/java/variables/runme.java2
-rw-r--r--Examples/javascript/check.list1
-rw-r--r--Examples/javascript/enum/runme.js2
-rw-r--r--Examples/javascript/exception/example.h18
-rw-r--r--Examples/javascript/exception/example.i6
-rw-r--r--Examples/javascript/exception/runme.js10
-rw-r--r--Examples/javascript/native/Makefile3
-rw-r--r--Examples/javascript/native/binding.gyp.in9
-rw-r--r--Examples/javascript/native/example.i47
-rw-r--r--Examples/javascript/native/example.js1
-rw-r--r--Examples/javascript/native/index.html31
-rw-r--r--Examples/javascript/native/runme.js3
-rw-r--r--Examples/javascript/variables/runme.js2
-rw-r--r--Examples/lua/arrays/runme.lua2
-rw-r--r--Examples/lua/class/runme.lua2
-rw-r--r--Examples/lua/constants/runme.lua2
-rw-r--r--Examples/lua/dual/dual.cpp2
-rw-r--r--Examples/lua/exception/example.h20
-rw-r--r--Examples/lua/exception/example.i6
-rw-r--r--Examples/lua/exception/runme.lua4
-rw-r--r--Examples/lua/funcptr3/runme.lua2
-rw-r--r--Examples/lua/functest/runme.lua2
-rw-r--r--Examples/lua/functor/runme.lua2
-rw-r--r--Examples/lua/import/runme.lua2
-rw-r--r--Examples/lua/nspace/runme.lua2
-rw-r--r--Examples/lua/owner/runme.lua2
-rw-r--r--Examples/lua/pointer/runme.lua2
-rw-r--r--Examples/lua/simple/runme.lua2
-rw-r--r--Examples/lua/variables/runme.lua8
-rw-r--r--Examples/mzscheme/check.list1
-rw-r--r--Examples/mzscheme/class/Makefile (renamed from Examples/php5/class/Makefile)8
-rw-r--r--Examples/mzscheme/class/example.cxx (renamed from Examples/php5/class/example.cxx)0
-rw-r--r--Examples/mzscheme/class/example.h (renamed from Examples/php5/class/example.h)0
-rw-r--r--Examples/mzscheme/class/example.i (renamed from Examples/php5/class/example.i)0
-rw-r--r--Examples/mzscheme/class/runme.scm60
-rw-r--r--Examples/mzscheme/multimap/Makefile1
-rw-r--r--Examples/mzscheme/multimap/example.c2
-rw-r--r--Examples/mzscheme/multimap/example.i6
-rw-r--r--Examples/mzscheme/multimap/runme.scm2
-rw-r--r--Examples/mzscheme/simple/Makefile1
-rw-r--r--Examples/mzscheme/simple/README1
-rw-r--r--Examples/mzscheme/simple/example.c30
-rw-r--r--Examples/mzscheme/simple/example.i13
-rw-r--r--Examples/mzscheme/simple/runme.scm39
-rw-r--r--Examples/mzscheme/std_vector/Makefile11
-rw-r--r--Examples/mzscheme/std_vector/example.h5
-rw-r--r--Examples/mzscheme/std_vector/runme.scm30
-rw-r--r--Examples/ocaml/argout_ref/Makefile13
-rw-r--r--Examples/ocaml/argout_ref/example.i9
-rw-r--r--Examples/ocaml/argout_ref/example_prog.ml26
-rw-r--r--Examples/ocaml/argout_ref/runme.ml17
-rw-r--r--Examples/ocaml/callback/Makefile35
-rw-r--r--Examples/ocaml/callback/example.c3
-rw-r--r--Examples/ocaml/callback/example.h (renamed from Examples/php5/callback/example.h)4
-rw-r--r--Examples/ocaml/callback/example.i (renamed from Examples/php5/callback/example.i)1
-rw-r--r--Examples/ocaml/callback/runme.ml30
-rw-r--r--Examples/ocaml/check.list13
-rw-r--r--Examples/ocaml/class/Makefile35
-rw-r--r--Examples/ocaml/class/example.c28
-rw-r--r--Examples/ocaml/class/example.h (renamed from Examples/php5/proxy/example.h)23
-rw-r--r--Examples/ocaml/class/example.i (renamed from Examples/php5/enum/example.i)3
-rw-r--r--Examples/ocaml/class/runme.ml57
-rw-r--r--Examples/ocaml/contract/Makefile15
-rw-r--r--Examples/ocaml/contract/runme.ml (renamed from Examples/ocaml/contract/example_prog.ml)7
-rw-r--r--Examples/ocaml/scoped_enum/Makefile15
-rw-r--r--Examples/ocaml/scoped_enum/example_prog.ml4
-rw-r--r--Examples/ocaml/scoped_enum/runme.ml5
-rw-r--r--Examples/ocaml/shapes/Makefile19
-rw-r--r--Examples/ocaml/shapes/runme.ml (renamed from Examples/ocaml/shapes/example_prog.ml)2
-rw-r--r--Examples/ocaml/simple/Makefile15
-rw-r--r--Examples/ocaml/simple/index.html24
-rw-r--r--Examples/ocaml/simple/runme.ml (renamed from Examples/ocaml/simple/example_prog.ml)2
-rw-r--r--Examples/ocaml/std_string/Makefile4
-rw-r--r--Examples/ocaml/std_vector/Makefile4
-rw-r--r--Examples/ocaml/std_vector/example.h5
-rw-r--r--Examples/ocaml/std_vector/runme.ml4
-rw-r--r--Examples/ocaml/stl/Makefile8
-rw-r--r--Examples/ocaml/stl/example.h2
-rw-r--r--Examples/ocaml/stl/example.i2
-rw-r--r--Examples/ocaml/string_from_ptr/Makefile34
-rw-r--r--Examples/ocaml/string_from_ptr/example.i (renamed from Examples/ocaml/string_from_ptr/foolib.i)2
-rw-r--r--Examples/ocaml/string_from_ptr/runme.ml (renamed from Examples/ocaml/string_from_ptr/example_prog.ml)4
-rw-r--r--Examples/ocaml/strings_test/Makefile10
-rw-r--r--Examples/ocaml/strings_test/example.h6
-rw-r--r--Examples/ocaml/strings_test/example.i1
-rw-r--r--Examples/ocaml/strings_test/runme.ml6
-rw-r--r--Examples/octave/extend/runme.m2
-rw-r--r--Examples/octave/module_load/runme.m65
-rw-r--r--Examples/octave/variables/runme.m2
-rw-r--r--Examples/perl5/check.list1
-rw-r--r--Examples/perl5/java/Example.java29
-rw-r--r--Examples/perl5/java/Makefile24
-rw-r--r--Examples/perl5/java/example.i10
-rw-r--r--Examples/perl5/java/runme.pl29
-rw-r--r--Examples/perl5/variables/runme.pl2
-rw-r--r--Examples/php/constants/runme.php14
-rw-r--r--Examples/php/disown/runme.php4
-rw-r--r--Examples/php/enum/Makefile2
-rw-r--r--Examples/php/enum/runme.php20
-rw-r--r--Examples/php/pragmas/example.i3
-rw-r--r--Examples/php/pragmas/include.php2
-rw-r--r--Examples/php/pragmas/runme.php4
-rw-r--r--Examples/php/value/Makefile2
-rw-r--r--Examples/php/value/runme.php18
-rw-r--r--Examples/php/variables/runme.php4
-rw-r--r--Examples/php5/callback/Makefile19
-rw-r--r--Examples/php5/callback/example.cxx4
-rw-r--r--Examples/php5/callback/index.html19
-rw-r--r--Examples/php5/callback/runme.php47
-rw-r--r--Examples/php5/check.list19
-rw-r--r--Examples/php5/class/runme.php60
-rw-r--r--Examples/php5/constants/Makefile20
-rw-r--r--Examples/php5/constants/example.i26
-rw-r--r--Examples/php5/constants/runme.php28
-rw-r--r--Examples/php5/cpointer/Makefile20
-rw-r--r--Examples/php5/cpointer/example.c16
-rw-r--r--Examples/php5/cpointer/example.i31
-rw-r--r--Examples/php5/cpointer/runme.php47
-rw-r--r--Examples/php5/disown/Makefile20
-rw-r--r--Examples/php5/disown/example.cxx51
-rw-r--r--Examples/php5/disown/example.h50
-rw-r--r--Examples/php5/disown/example.i12
-rw-r--r--Examples/php5/disown/runme.php49
-rw-r--r--Examples/php5/enum/Makefile20
-rw-r--r--Examples/php5/enum/example.cxx37
-rw-r--r--Examples/php5/enum/example.h13
-rw-r--r--Examples/php5/enum/runme.php32
-rw-r--r--Examples/php5/extend/Makefile19
-rw-r--r--Examples/php5/extend/example.cxx4
-rw-r--r--Examples/php5/extend/example.h56
-rw-r--r--Examples/php5/extend/example.i15
-rw-r--r--Examples/php5/extend/index.html19
-rw-r--r--Examples/php5/extend/runme.php76
-rw-r--r--Examples/php5/funcptr/Makefile20
-rw-r--r--Examples/php5/funcptr/example.c17
-rw-r--r--Examples/php5/funcptr/example.h7
-rw-r--r--Examples/php5/funcptr/example.i15
-rw-r--r--Examples/php5/funcptr/runme.php24
-rw-r--r--Examples/php5/overloading/example.cxx55
-rw-r--r--Examples/php5/overloading/example.h46
-rw-r--r--Examples/php5/overloading/example.i8
-rw-r--r--Examples/php5/overloading/runme.php58
-rw-r--r--Examples/php5/pointer/Makefile20
-rw-r--r--Examples/php5/pointer/example.c16
-rw-r--r--Examples/php5/pointer/example.i30
-rw-r--r--Examples/php5/pointer/runme.php35
-rw-r--r--Examples/php5/pragmas/Makefile20
-rw-r--r--Examples/php5/pragmas/example.i31
-rw-r--r--Examples/php5/pragmas/include.php7
-rw-r--r--Examples/php5/pragmas/runme.php5
-rw-r--r--Examples/php5/proxy/Makefile20
-rw-r--r--Examples/php5/proxy/example.cxx43
-rw-r--r--Examples/php5/proxy/example.i12
-rw-r--r--Examples/php5/proxy/runme.php68
-rw-r--r--Examples/php5/reference/Makefile20
-rw-r--r--Examples/php5/reference/example.cxx49
-rw-r--r--Examples/php5/reference/example.h22
-rw-r--r--Examples/php5/reference/example.i43
-rw-r--r--Examples/php5/reference/runme.php49
-rw-r--r--Examples/php5/simple/Makefile20
-rw-r--r--Examples/php5/simple/example.c23
-rw-r--r--Examples/php5/simple/example.i8
-rw-r--r--Examples/php5/simple/runme.php25
-rw-r--r--Examples/php5/sync/Makefile20
-rw-r--r--Examples/php5/sync/example.cxx13
-rw-r--r--Examples/php5/sync/example.h9
-rw-r--r--Examples/php5/sync/example.i7
-rw-r--r--Examples/php5/sync/runme.php15
-rw-r--r--Examples/php5/value/Makefile20
-rw-r--r--Examples/php5/value/example.c13
-rw-r--r--Examples/php5/value/example.h8
-rw-r--r--Examples/php5/value/example.i17
-rw-r--r--Examples/php5/value/runme.php43
-rw-r--r--Examples/php5/variables/Makefile20
-rw-r--r--Examples/php5/variables/example.c95
-rw-r--r--Examples/php5/variables/example.h34
-rw-r--r--Examples/php5/variables/example.i44
-rw-r--r--Examples/php5/variables/runme.php96
-rw-r--r--Examples/python/check.list2
-rw-r--r--Examples/python/doxygen/Makefile27
-rw-r--r--Examples/python/doxygen/example.cxx48
-rw-r--r--Examples/python/doxygen/example.dsp152
-rw-r--r--Examples/python/doxygen/example.h107
-rw-r--r--Examples/python/doxygen/example.i17
-rw-r--r--Examples/python/doxygen/runme.py28
-rw-r--r--Examples/python/exception/example.h20
-rw-r--r--Examples/python/exception/example.i6
-rw-r--r--Examples/python/exceptproxy/example.h11
-rw-r--r--Examples/python/exceptproxy/example.i37
-rw-r--r--Examples/python/extend/runme.py2
-rw-r--r--Examples/python/import_packages/Makefile15
-rw-r--r--Examples/python/import_packages/from_init1/runme.py24
-rw-r--r--Examples/python/import_packages/from_init2/runme.py20
-rw-r--r--Examples/python/import_packages/from_init3/runme.py20
-rw-r--r--Examples/python/import_packages/module_is_init/Makefile15
-rw-r--r--Examples/python/import_packages/module_is_init/README18
-rw-r--r--Examples/python/import_packages/module_is_init/pkg1/Makefile20
-rw-r--r--Examples/python/import_packages/module_is_init/pkg1/foo.hpp10
-rw-r--r--Examples/python/import_packages/module_is_init/pkg1/foo.i5
-rw-r--r--Examples/python/import_packages/module_is_init/runme.py26
-rw-r--r--Examples/python/import_packages/namespace_pkg/nonpkg.py19
-rw-r--r--Examples/python/import_packages/namespace_pkg/normal.py20
-rw-r--r--Examples/python/import_packages/namespace_pkg/nstest.py30
-rw-r--r--Examples/python/import_packages/namespace_pkg/runme.py3
-rw-r--r--Examples/python/import_packages/namespace_pkg/split.py22
-rw-r--r--Examples/python/import_packages/namespace_pkg/zipsplit.py22
-rw-r--r--Examples/python/import_packages/relativeimport1/runme.py21
-rw-r--r--Examples/python/import_packages/relativeimport2/runme.py21
-rw-r--r--Examples/python/import_packages/relativeimport3/runme.py21
-rw-r--r--Examples/python/import_packages/same_modnames1/runme.py15
-rw-r--r--Examples/python/import_packages/same_modnames2/runme.py15
-rw-r--r--Examples/python/import_packages/split_modules/Makefile8
-rw-r--r--Examples/python/import_packages/split_modules/README3
-rw-r--r--Examples/python/import_packages/split_modules/vanilla/runme.py14
-rw-r--r--Examples/python/import_packages/split_modules/vanilla_split/Makefile4
-rw-r--r--Examples/python/import_packages/split_modules/vanilla_split/foo.i7
-rw-r--r--Examples/python/import_packages/split_modules/vanilla_split/runme.py14
-rw-r--r--Examples/python/java/Example.java29
-rw-r--r--Examples/python/java/Makefile25
-rw-r--r--Examples/python/java/example.i13
-rw-r--r--Examples/python/java/runme.py16
-rw-r--r--Examples/python/multimap/example.i12
-rw-r--r--Examples/python/operator/example.i1
-rw-r--r--Examples/python/performance/constructor/runme.py2
-rw-r--r--Examples/python/performance/func/runme.py2
-rw-r--r--Examples/python/performance/harness.py6
-rw-r--r--Examples/python/performance/hierarchy/runme.py2
-rw-r--r--Examples/python/performance/hierarchy_operator/runme.py2
-rw-r--r--Examples/python/performance/operator/runme.py2
-rw-r--r--Examples/python/std_vector/example.h5
-rw-r--r--Examples/python/variables/runme.py6
-rw-r--r--Examples/ruby/check.list1
-rw-r--r--Examples/ruby/exceptproxy/Makefile (renamed from Examples/ruby/exception_class/Makefile)0
-rw-r--r--Examples/ruby/exceptproxy/example.h (renamed from Examples/ruby/exception_class/example.h)8
-rw-r--r--Examples/ruby/exceptproxy/example.i (renamed from Examples/ruby/exception_class/example.i)3
-rw-r--r--Examples/ruby/exceptproxy/runme.rb (renamed from Examples/ruby/exception_class/runme.rb)0
-rw-r--r--Examples/ruby/free_function/runme.rb6
-rw-r--r--Examples/ruby/hashargs/example.i4
-rw-r--r--Examples/ruby/java/Example.java29
-rw-r--r--Examples/ruby/java/Makefile24
-rw-r--r--Examples/ruby/java/example.i9
-rw-r--r--Examples/ruby/java/runme.rb18
-rw-r--r--Examples/ruby/std_vector/example.h5
-rw-r--r--Examples/ruby/variables/runme.rb2
-rw-r--r--Examples/scilab/std_list/runme.sci2
-rw-r--r--Examples/scilab/std_vector/example.h5
-rw-r--r--Examples/scilab/variables/runme.sci2
-rw-r--r--Examples/tcl/check.list1
-rw-r--r--Examples/tcl/java/Example.java29
-rw-r--r--Examples/tcl/java/Makefile24
-rw-r--r--Examples/tcl/java/example.i8
-rw-r--r--Examples/tcl/java/runme.tcl15
-rw-r--r--Examples/tcl/std_vector/example.h5
-rw-r--r--Examples/tcl/variables/runme.tcl2
-rw-r--r--Examples/test-suite/README2
-rw-r--r--Examples/test-suite/allprotected.i4
-rw-r--r--Examples/test-suite/autodoc.i44
-rw-r--r--Examples/test-suite/catches.i8
-rw-r--r--Examples/test-suite/class_scope_namespace.i160
-rw-r--r--Examples/test-suite/common.mk104
-rw-r--r--Examples/test-suite/complextest.i47
-rw-r--r--Examples/test-suite/constant_directive.i10
-rw-r--r--Examples/test-suite/constructor_copy.i8
-rw-r--r--Examples/test-suite/cplusplus_throw.i10
-rw-r--r--Examples/test-suite/cpp11_alias_nested_template_scoping.i45
-rw-r--r--Examples/test-suite/cpp11_alignment.i3
-rw-r--r--Examples/test-suite/cpp11_alternate_function_syntax.i23
-rw-r--r--Examples/test-suite/cpp11_constexpr.i19
-rw-r--r--Examples/test-suite/cpp11_default_delete.i14
-rw-r--r--Examples/test-suite/cpp11_directors.i16
-rw-r--r--Examples/test-suite/cpp11_final_directors.i33
-rw-r--r--Examples/test-suite/cpp11_final_override.i12
-rw-r--r--Examples/test-suite/cpp11_hash_tables.i32
-rw-r--r--Examples/test-suite/cpp11_initializer_list.i22
-rw-r--r--Examples/test-suite/cpp11_lambda_functions.i44
-rw-r--r--Examples/test-suite/cpp11_noexcept.i11
-rw-r--r--Examples/test-suite/cpp11_raw_string_literals.i45
-rw-r--r--Examples/test-suite/cpp11_ref_qualifiers.i226
-rw-r--r--Examples/test-suite/cpp11_ref_qualifiers_rvalue_unignore.i15
-rw-r--r--Examples/test-suite/cpp11_ref_qualifiers_typemaps.i74
-rw-r--r--Examples/test-suite/cpp11_rvalue_reference2.i24
-rw-r--r--Examples/test-suite/cpp11_rvalue_reference3.i32
-rw-r--r--Examples/test-suite/cpp11_shared_ptr_const.i57
-rw-r--r--Examples/test-suite/cpp11_shared_ptr_nullptr_in_containers.i50
-rw-r--r--Examples/test-suite/cpp11_shared_ptr_overload.i89
-rw-r--r--Examples/test-suite/cpp11_shared_ptr_upcast.i188
-rw-r--r--Examples/test-suite/cpp11_static_assert.i24
-rw-r--r--Examples/test-suite/cpp11_std_array.i (renamed from Examples/test-suite/cpp11_li_std_array.i)2
-rw-r--r--Examples/test-suite/cpp11_std_unordered_map.i11
-rw-r--r--Examples/test-suite/cpp11_std_unordered_multimap.i7
-rw-r--r--Examples/test-suite/cpp11_std_unordered_multiset.i5
-rw-r--r--Examples/test-suite/cpp11_std_unordered_set.i7
-rw-r--r--Examples/test-suite/cpp11_template_explicit.i15
-rw-r--r--Examples/test-suite/cpp11_template_typedefs.i4
-rw-r--r--Examples/test-suite/cpp11_thread_local.i2
-rw-r--r--Examples/test-suite/cpp11_type_aliasing.i2
-rw-r--r--Examples/test-suite/cpp14_binary_integer_literals.i31
-rw-r--r--Examples/test-suite/cpp17_hex_floating_literals.i43
-rw-r--r--Examples/test-suite/cpp17_nested_namespaces.i199
-rw-r--r--Examples/test-suite/cpp17_nspace_nested_namespaces.i13
-rw-r--r--Examples/test-suite/cpp17_u8_char_literals.i26
-rw-r--r--Examples/test-suite/cpp_broken.i12
-rw-r--r--Examples/test-suite/cpp_namespace.i4
-rw-r--r--Examples/test-suite/cpp_static.i3
-rw-r--r--Examples/test-suite/csharp/Makefile.in11
-rw-r--r--Examples/test-suite/csharp/allprotected_runme.cs14
-rw-r--r--Examples/test-suite/csharp/complextest_runme.cs43
-rw-r--r--Examples/test-suite/csharp/cpp11_std_array_runme.cs (renamed from Examples/test-suite/csharp/cpp11_li_std_array_runme.cs)20
-rw-r--r--Examples/test-suite/csharp/cpp17_nested_namespaces_runme.cs25
-rw-r--r--Examples/test-suite/csharp/cpp17_nspace_nested_namespaces_runme.cs25
-rw-r--r--Examples/test-suite/csharp/csharp_lib_arrays_bool_runme.cs90
-rw-r--r--Examples/test-suite/csharp/director_basic_runme.cs54
-rw-r--r--Examples/test-suite/csharp/director_classes_runme.cs13
-rw-r--r--Examples/test-suite/csharp/director_smartptr_runme.cs29
-rw-r--r--Examples/test-suite/csharp/li_boost_shared_ptr_director_runme.cs111
-rw-r--r--Examples/test-suite/csharp/li_std_auto_ptr_runme.cs7
-rw-r--r--Examples/test-suite/csharp/li_std_list_runme.cs402
-rw-r--r--Examples/test-suite/csharp/li_std_map_runme.cs16
-rw-r--r--Examples/test-suite/csharp/li_std_set_runme.cs105
-rw-r--r--Examples/test-suite/csharp/li_std_vector_runme.cs62
-rw-r--r--Examples/test-suite/csharp/li_std_wstring_runme.cs172
-rw-r--r--Examples/test-suite/csharp/nested_in_template_runme.cs10
-rw-r--r--Examples/test-suite/csharp/nested_inheritance_interface_runme.cs36
-rw-r--r--Examples/test-suite/csharp/preproc_constants_c_runme.cs6
-rw-r--r--Examples/test-suite/csharp/preproc_constants_runme.cs5
-rw-r--r--Examples/test-suite/csharp_exceptions.i34
-rw-r--r--Examples/test-suite/csharp_lib_arrays_bool.i78
-rw-r--r--Examples/test-suite/d/Makefile.in6
-rw-r--r--Examples/test-suite/d/director_classes_runme.1.d13
-rw-r--r--Examples/test-suite/d/director_classes_runme.2.d13
-rw-r--r--Examples/test-suite/d/li_boost_shared_ptr_director_runme.2.d114
-rw-r--r--Examples/test-suite/d/preproc_constants_c_runme.1.d5
-rw-r--r--Examples/test-suite/d/preproc_constants_c_runme.2.d5
-rw-r--r--Examples/test-suite/d/preproc_constants_runme.1.d5
-rw-r--r--Examples/test-suite/d/preproc_constants_runme.2.d5
-rw-r--r--Examples/test-suite/default_arg_expressions.i34
-rw-r--r--Examples/test-suite/default_args.i44
-rw-r--r--Examples/test-suite/default_args_c.i39
-rw-r--r--Examples/test-suite/derived_byvalue.i4
-rw-r--r--Examples/test-suite/destructor_methodmodifiers.i61
-rw-r--r--Examples/test-suite/director_basic.i35
-rw-r--r--Examples/test-suite/director_classes.i8
-rw-r--r--Examples/test-suite/director_exception.i67
-rw-r--r--Examples/test-suite/director_exception_catches.i25
-rw-r--r--Examples/test-suite/director_exception_nothrow.i28
-rw-r--r--Examples/test-suite/director_extend.i2
-rw-r--r--Examples/test-suite/director_overload.i4
-rw-r--r--Examples/test-suite/director_ownership.i72
-rw-r--r--Examples/test-suite/director_property.i4
-rw-r--r--Examples/test-suite/director_smartptr.i8
-rw-r--r--Examples/test-suite/director_thread.i87
-rw-r--r--Examples/test-suite/doxygen_alias.i22
-rw-r--r--Examples/test-suite/doxygen_basic_notranslate.i110
-rw-r--r--Examples/test-suite/doxygen_basic_translate.h5
-rw-r--r--Examples/test-suite/doxygen_basic_translate.i113
-rw-r--r--Examples/test-suite/doxygen_basic_translate_style2.i107
-rw-r--r--Examples/test-suite/doxygen_ignore.i41
-rw-r--r--Examples/test-suite/doxygen_misc_constructs.h94
-rw-r--r--Examples/test-suite/doxygen_misc_constructs.i127
-rw-r--r--Examples/test-suite/doxygen_nested_class.i24
-rw-r--r--Examples/test-suite/doxygen_parsing.i140
-rw-r--r--Examples/test-suite/doxygen_parsing_enums.i40
-rw-r--r--Examples/test-suite/doxygen_parsing_enums_proper.i7
-rw-r--r--Examples/test-suite/doxygen_parsing_enums_simple.i6
-rw-r--r--Examples/test-suite/doxygen_parsing_enums_typesafe.i8
-rw-r--r--Examples/test-suite/doxygen_parsing_enums_typeunsafe.i6
-rw-r--r--Examples/test-suite/doxygen_translate.i266
-rw-r--r--Examples/test-suite/doxygen_translate_all_tags.i413
-rw-r--r--Examples/test-suite/doxygen_translate_links.i67
-rw-r--r--Examples/test-suite/enum_macro.i42
-rw-r--r--Examples/test-suite/errors/Makefile.in29
-rw-r--r--Examples/test-suite/errors/cpp_bad_global_memberptr.i6
-rw-r--r--Examples/test-suite/errors/cpp_bad_global_memberptr.stderr2
-rw-r--r--Examples/test-suite/errors/cpp_class_definition.i26
-rw-r--r--Examples/test-suite/errors/cpp_class_definition.stderr1
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets.i2
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets2.i2
-rw-r--r--Examples/test-suite/errors/cpp_final_destructor.stderr1
-rw-r--r--Examples/test-suite/errors/cpp_invalid_exponents1.i4
-rw-r--r--Examples/test-suite/errors/cpp_invalid_exponents1.stderr2
-rw-r--r--Examples/test-suite/errors/cpp_invalid_exponents2.i4
-rw-r--r--Examples/test-suite/errors/cpp_invalid_exponents2.stderr2
-rw-r--r--Examples/test-suite/errors/cpp_invalid_qualifiers.i43
-rw-r--r--Examples/test-suite/errors/cpp_invalid_qualifiers.stderr20
-rw-r--r--Examples/test-suite/errors/cpp_invalid_template.i9
-rw-r--r--Examples/test-suite/errors/cpp_invalid_template.stderr3
-rw-r--r--Examples/test-suite/errors/cpp_namespace_template_bad.i40
-rw-r--r--Examples/test-suite/errors/cpp_namespace_template_bad.stderr9
-rw-r--r--Examples/test-suite/errors/cpp_nested_namespace_alias.i34
-rw-r--r--Examples/test-suite/errors/cpp_nested_namespace_alias.stderr3
-rw-r--r--Examples/test-suite/errors/cpp_nested_template.stderr2
-rw-r--r--Examples/test-suite/errors/cpp_raw_string_termination.i4
-rw-r--r--Examples/test-suite/errors/cpp_raw_string_termination.stderr2
-rw-r--r--Examples/test-suite/errors/cpp_recursive_typedef.i2
-rw-r--r--Examples/test-suite/errors/cpp_refqualifier.i28
-rw-r--r--Examples/test-suite/errors/cpp_refqualifier.stderr6
-rw-r--r--Examples/test-suite/errors/cpp_shared_ptr.i2
-rw-r--r--Examples/test-suite/errors/cpp_template_duplicate_names.i51
-rw-r--r--Examples/test-suite/errors/cpp_template_duplicate_names.stderr14
-rw-r--r--Examples/test-suite/errors/cpp_template_friend.i2
-rw-r--r--Examples/test-suite/errors/cpp_template_scope.i57
-rw-r--r--Examples/test-suite/errors/cpp_template_scope.stderr11
-rw-r--r--Examples/test-suite/errors/doxygen_unknown_command.i6
-rw-r--r--Examples/test-suite/errors/doxygen_unknown_command.stderr1
-rw-r--r--Examples/test-suite/errors/pp_expressions_bad.i43
-rw-r--r--Examples/test-suite/errors/pp_expressions_bad.stderr19
-rw-r--r--Examples/test-suite/errors/pp_invalid_exponents.i7
-rw-r--r--Examples/test-suite/errors/pp_invalid_exponents.stderr6
-rw-r--r--Examples/test-suite/errors/pp_macro_missing_expression.i2
-rw-r--r--Examples/test-suite/errors/pp_missing_file.i2
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective3.i14
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective3.stderr4
-rw-r--r--Examples/test-suite/exception_order.i17
-rw-r--r--Examples/test-suite/exception_partial_info.i10
-rw-r--r--Examples/test-suite/extend.i4
-rw-r--r--Examples/test-suite/extern_throws.i10
-rw-r--r--Examples/test-suite/features.i4
-rw-r--r--Examples/test-suite/funcptr_cpp.i3
-rw-r--r--Examples/test-suite/functors.i33
-rw-r--r--Examples/test-suite/go/Makefile.in153
-rw-r--r--Examples/test-suite/go/abstract_access_runme.go2
-rw-r--r--Examples/test-suite/go/abstract_typedef2_runme.go2
-rw-r--r--Examples/test-suite/go/abstract_typedef_runme.go2
-rw-r--r--Examples/test-suite/go/abstract_virtual_runme.go2
-rw-r--r--Examples/test-suite/go/argout_runme.go2
-rw-r--r--Examples/test-suite/go/array_member_runme.go2
-rw-r--r--Examples/test-suite/go/arrays_global_runme.go2
-rw-r--r--Examples/test-suite/go/char_binary_runme.go2
-rw-r--r--Examples/test-suite/go/class_ignore_runme.go2
-rw-r--r--Examples/test-suite/go/class_scope_weird_runme.go2
-rw-r--r--Examples/test-suite/go/compactdefaultargs_runme.go2
-rw-r--r--Examples/test-suite/go/constover_runme.go3
-rw-r--r--Examples/test-suite/go/constructor_copy_runme.go2
-rw-r--r--Examples/test-suite/go/contract_runme.go2
-rw-r--r--Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go2
-rw-r--r--Examples/test-suite/go/cpp_enum_runme.go2
-rw-r--r--Examples/test-suite/go/cpp_namespace_runme.go2
-rw-r--r--Examples/test-suite/go/cpp_static_runme.go2
-rw-r--r--Examples/test-suite/go/default_args_runme.go2
-rw-r--r--Examples/test-suite/go/default_constructor_runme.go2
-rw-r--r--Examples/test-suite/go/director_alternating_runme.go2
-rw-r--r--Examples/test-suite/go/director_basic_runme.go2
-rw-r--r--Examples/test-suite/go/director_classic_runme.go2
-rw-r--r--Examples/test-suite/go/director_default_runme.go2
-rw-r--r--Examples/test-suite/go/director_detect_runme.go2
-rw-r--r--Examples/test-suite/go/director_enum_runme.go2
-rw-r--r--Examples/test-suite/go/director_exception_runme.go2
-rw-r--r--Examples/test-suite/go/director_extend_runme.go2
-rw-r--r--Examples/test-suite/go/director_finalizer_runme.go2
-rw-r--r--Examples/test-suite/go/director_frob_runme.go2
-rw-r--r--Examples/test-suite/go/director_nested_runme.go2
-rw-r--r--Examples/test-suite/go/director_profile_runme.go2
-rw-r--r--Examples/test-suite/go/director_protected_runme.go2
-rw-r--r--Examples/test-suite/go/director_string_runme.go2
-rw-r--r--Examples/test-suite/go/director_unroll_runme.go2
-rw-r--r--Examples/test-suite/go/disown_runme.go2
-rw-r--r--Examples/test-suite/go/dynamic_cast_runme.go2
-rw-r--r--Examples/test-suite/go/empty_c_runme.go2
-rw-r--r--Examples/test-suite/go/empty_runme.go2
-rw-r--r--Examples/test-suite/go/enum_template_runme.go2
-rw-r--r--Examples/test-suite/go/enums_runme.go2
-rw-r--r--Examples/test-suite/go/exception_order_runme.go2
-rw-r--r--Examples/test-suite/go/extend_placement_runme.go2
-rw-r--r--Examples/test-suite/go/extend_template_ns_runme.go2
-rw-r--r--Examples/test-suite/go/extend_template_runme.go2
-rw-r--r--Examples/test-suite/go/extend_variable_runme.go2
-rw-r--r--Examples/test-suite/go/extern_c_runme.go2
-rw-r--r--Examples/test-suite/go/friends_runme.go2
-rw-r--r--Examples/test-suite/go/fvirtual_runme.go2
-rw-r--r--Examples/test-suite/go/global_ns_arg_runme.go2
-rw-r--r--Examples/test-suite/go/go_director_inout_runme.go2
-rw-r--r--Examples/test-suite/go/go_inout_runme.go2
-rw-r--r--Examples/test-suite/go/go_subdir_import_runme.go6
-rw-r--r--Examples/test-suite/go/grouping_runme.go2
-rw-r--r--Examples/test-suite/go/import_nomodule_runme.go2
-rw-r--r--Examples/test-suite/go/imports_runme.go4
-rw-r--r--Examples/test-suite/go/inctest_runme.go2
-rw-r--r--Examples/test-suite/go/inherit_member_runme.go2
-rw-r--r--Examples/test-suite/go/inherit_missing_runme.go2
-rw-r--r--Examples/test-suite/go/input_runme.go2
-rw-r--r--Examples/test-suite/go/keyword_rename_c_runme.go2
-rw-r--r--Examples/test-suite/go/keyword_rename_runme.go2
-rw-r--r--Examples/test-suite/go/li_attribute_runme.go2
-rw-r--r--Examples/test-suite/go/li_carrays_cpp_runme.go2
-rw-r--r--Examples/test-suite/go/li_carrays_runme.go2
-rw-r--r--Examples/test-suite/go/li_cdata_cpp_runme.go2
-rw-r--r--Examples/test-suite/go/li_cdata_runme.go2
-rw-r--r--Examples/test-suite/go/li_cmalloc_runme.go2
-rw-r--r--Examples/test-suite/go/li_cpointer_cpp_runme.go2
-rw-r--r--Examples/test-suite/go/li_cpointer_runme.go2
-rw-r--r--Examples/test-suite/go/li_std_map_runme.go2
-rw-r--r--Examples/test-suite/go/li_std_vector_ptr_runme.go2
-rw-r--r--Examples/test-suite/go/member_pointer_runme.go2
-rw-r--r--Examples/test-suite/go/memberin_extend_c_runme.go2
-rw-r--r--Examples/test-suite/go/minherit_runme.go2
-rw-r--r--Examples/test-suite/go/mod_runme.go4
-rw-r--r--Examples/test-suite/go/multi_import_runme.go4
-rw-r--r--Examples/test-suite/go/namespace_class_runme.go2
-rw-r--r--Examples/test-suite/go/namespace_typemap_runme.go2
-rw-r--r--Examples/test-suite/go/namespace_virtual_method_runme.go2
-rw-r--r--Examples/test-suite/go/naturalvar_runme.go2
-rw-r--r--Examples/test-suite/go/nested_workaround_runme.go2
-rw-r--r--Examples/test-suite/go/overload_complicated_runme.go2
-rw-r--r--Examples/test-suite/go/overload_copy_runme.go2
-rw-r--r--Examples/test-suite/go/overload_extend2_runme.go2
-rw-r--r--Examples/test-suite/go/overload_extend_c_runme.go2
-rw-r--r--Examples/test-suite/go/overload_extend_runme.go2
-rw-r--r--Examples/test-suite/go/overload_polymorphic_runme.go2
-rw-r--r--Examples/test-suite/go/overload_rename_runme.go2
-rw-r--r--Examples/test-suite/go/overload_simple_runme.go2
-rw-r--r--Examples/test-suite/go/overload_subtype_runme.go2
-rw-r--r--Examples/test-suite/go/overload_template_fast_runme.go2
-rw-r--r--Examples/test-suite/go/overload_template_runme.go2
-rw-r--r--Examples/test-suite/go/preproc_runme.go2
-rw-r--r--Examples/test-suite/go/primitive_ref_runme.go2
-rw-r--r--Examples/test-suite/go/profiletest_runme.go2
-rw-r--r--Examples/test-suite/go/refcount_runme.go2
-rw-r--r--Examples/test-suite/go/reference_global_vars_runme.go2
-rw-r--r--Examples/test-suite/go/rename_scope_runme.go2
-rw-r--r--Examples/test-suite/go/rename_simple_runme.go2
-rw-r--r--Examples/test-suite/go/rename_strip_encoder_runme.go2
-rw-r--r--Examples/test-suite/go/ret_by_value_runme.go2
-rw-r--r--Examples/test-suite/go/return_const_value_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_extend_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_member_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_multi_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_multi_typedef_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_overload_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_rename_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_simple_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_templatevariables_runme.go2
-rw-r--r--Examples/test-suite/go/smart_pointer_typedef_runme.go2
-rw-r--r--Examples/test-suite/go/sneaky1_runme.go2
-rw-r--r--Examples/test-suite/go/special_variable_macros_runme.go2
-rw-r--r--Examples/test-suite/go/static_const_member_2_runme.go2
-rw-r--r--Examples/test-suite/go/struct_initialization_runme.go2
-rw-r--r--Examples/test-suite/go/struct_rename_runme.go2
-rw-r--r--Examples/test-suite/go/struct_value_runme.go2
-rw-r--r--Examples/test-suite/go/template_default_arg_runme.go2
-rw-r--r--Examples/test-suite/go/template_extend1_runme.go2
-rw-r--r--Examples/test-suite/go/template_extend2_runme.go2
-rw-r--r--Examples/test-suite/go/template_inherit_runme.go2
-rw-r--r--Examples/test-suite/go/template_ns4_runme.go2
-rw-r--r--Examples/test-suite/go/template_ns_runme.go2
-rw-r--r--Examples/test-suite/go/template_opaque_runme.go2
-rw-r--r--Examples/test-suite/go/template_ref_type_runme.go2
-rw-r--r--Examples/test-suite/go/template_rename_runme.go2
-rw-r--r--Examples/test-suite/go/template_static_runme.go2
-rw-r--r--Examples/test-suite/go/template_tbase_template_runme.go2
-rw-r--r--Examples/test-suite/go/template_type_namespace_runme.go2
-rw-r--r--Examples/test-suite/go/template_typedef_cplx3_runme.go2
-rw-r--r--Examples/test-suite/go/template_typedef_cplx4_runme.go2
-rw-r--r--Examples/test-suite/go/threads_exception_runme.go2
-rw-r--r--Examples/test-suite/go/typedef_class_runme.go2
-rw-r--r--Examples/test-suite/go/typedef_funcptr_runme.go29
-rw-r--r--Examples/test-suite/go/typedef_inherit_runme.go2
-rw-r--r--Examples/test-suite/go/typedef_scope_runme.go2
-rw-r--r--Examples/test-suite/go/typemap_namespace_runme.go2
-rw-r--r--Examples/test-suite/go/typemap_ns_using_runme.go2
-rw-r--r--Examples/test-suite/go/typemap_out_optimal_runme.go2
-rw-r--r--Examples/test-suite/go/typename_runme.go2
-rw-r--r--Examples/test-suite/go/unions_runme.go2
-rw-r--r--Examples/test-suite/go/using1_runme.go2
-rw-r--r--Examples/test-suite/go/using2_runme.go2
-rw-r--r--Examples/test-suite/go/using_composition_runme.go2
-rw-r--r--Examples/test-suite/go/using_extend_runme.go2
-rw-r--r--Examples/test-suite/go/using_inherit_runme.go2
-rw-r--r--Examples/test-suite/go/using_private_runme.go2
-rw-r--r--Examples/test-suite/go/using_protected_runme.go2
-rw-r--r--Examples/test-suite/go/varargs_overload_runme.go38
-rw-r--r--Examples/test-suite/go/varargs_runme.go2
-rw-r--r--Examples/test-suite/go/virtual_derivation_runme.go2
-rw-r--r--Examples/test-suite/go/virtual_poly_runme.go2
-rw-r--r--Examples/test-suite/go/voidtest_runme.go2
-rw-r--r--Examples/test-suite/go/wrapmacro_runme.go2
-rw-r--r--Examples/test-suite/go_subdir_import.list2
-rw-r--r--Examples/test-suite/guile/overload_complicated_runme.scm6
-rw-r--r--Examples/test-suite/guile/overload_null_runme.scm53
-rw-r--r--Examples/test-suite/ignore_parameter.i4
-rw-r--r--Examples/test-suite/ignore_template_constructor.i8
-rw-r--r--Examples/test-suite/import_fragments.i18
-rw-r--r--Examples/test-suite/import_fragments_a.i48
-rw-r--r--Examples/test-suite/import_fragments_b.i9
-rw-r--r--Examples/test-suite/intermediary_classname.i15
-rw-r--r--Examples/test-suite/java/CommentParser.java172
-rw-r--r--Examples/test-suite/java/Makefile.in32
-rw-r--r--Examples/test-suite/java/class_scope_namespace_runme.java59
-rw-r--r--Examples/test-suite/java/cpp11_alias_nested_template_scoping_runme.java32
-rw-r--r--Examples/test-suite/java/cpp11_initializer_list_runme.java21
-rw-r--r--Examples/test-suite/java/cpp11_raw_string_literals_runme.java67
-rw-r--r--Examples/test-suite/java/cpp11_ref_qualifiers_runme.java56
-rw-r--r--Examples/test-suite/java/cpp11_ref_qualifiers_rvalue_unignore_runme.java20
-rw-r--r--Examples/test-suite/java/cpp11_ref_qualifiers_typemaps_runme.java39
-rw-r--r--Examples/test-suite/java/cpp11_shared_ptr_overload_runme.java60
-rw-r--r--Examples/test-suite/java/cpp11_std_array_runme.java (renamed from Examples/test-suite/java/cpp11_li_std_array_runme.java)22
-rw-r--r--Examples/test-suite/java/cpp11_std_unordered_map_runme.java122
-rw-r--r--Examples/test-suite/java/cpp11_std_unordered_set_runme.java75
-rw-r--r--Examples/test-suite/java/cpp11_template_typedefs_runme.java19
-rw-r--r--Examples/test-suite/java/cpp17_nested_namespaces_runme.java32
-rw-r--r--Examples/test-suite/java/cpp17_nspace_nested_namespaces_runme.java30
-rw-r--r--Examples/test-suite/java/director_classes_runme.java13
-rw-r--r--Examples/test-suite/java/director_exception_catches_runme.java35
-rw-r--r--Examples/test-suite/java/director_ownership_runme.java42
-rw-r--r--Examples/test-suite/java/director_smartptr_runme.java36
-rw-r--r--Examples/test-suite/java/director_thread_runme.java6
-rw-r--r--Examples/test-suite/java/doxygen_alias_runme.java32
-rw-r--r--Examples/test-suite/java/doxygen_basic_notranslate_runme.java102
-rw-r--r--Examples/test-suite/java/doxygen_basic_translate_runme.java101
-rw-r--r--Examples/test-suite/java/doxygen_basic_translate_style2_runme.java101
-rw-r--r--Examples/test-suite/java/doxygen_ignore_runme.java44
-rw-r--r--Examples/test-suite/java/doxygen_misc_constructs_runme.java200
-rw-r--r--Examples/test-suite/java/doxygen_nested_class_runme.java48
-rw-r--r--Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java66
-rw-r--r--Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java58
-rw-r--r--Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java67
-rw-r--r--Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java66
-rw-r--r--Examples/test-suite/java/doxygen_parsing_runme.java141
-rw-r--r--Examples/test-suite/java/doxygen_translate_all_tags_runme.java159
-rw-r--r--Examples/test-suite/java/doxygen_translate_links_runme.java69
-rw-r--r--Examples/test-suite/java/doxygen_translate_runme.java279
-rw-r--r--Examples/test-suite/java/enum_macro_runme.java24
-rw-r--r--Examples/test-suite/java/java_director_assumeoverride_runme.java2
-rw-r--r--Examples/test-suite/java/java_director_exception_feature_nspace_runme.java13
-rw-r--r--Examples/test-suite/java/java_director_exception_feature_runme.java13
-rw-r--r--Examples/test-suite/java/java_director_typemaps_ptr_runme.java200
-rw-r--r--Examples/test-suite/java/java_director_typemaps_runme.java8
-rw-r--r--Examples/test-suite/java/java_enums_runme.java6
-rw-r--r--Examples/test-suite/java/java_throws_runme.java22
-rw-r--r--Examples/test-suite/java/li_boost_shared_ptr_director_runme.java129
-rw-r--r--Examples/test-suite/java/li_std_list_runme.java180
-rw-r--r--Examples/test-suite/java/li_std_map_runme.java122
-rw-r--r--Examples/test-suite/java/li_std_set_runme.java90
-rw-r--r--Examples/test-suite/java/li_std_vector_runme.java159
-rw-r--r--Examples/test-suite/java/long_long_runme.java6
-rw-r--r--Examples/test-suite/java/member_pointer_const_runme.java60
-rw-r--r--Examples/test-suite/java/member_pointer_runme.java2
-rw-r--r--Examples/test-suite/java/namespace_chase_runme.java26
-rw-r--r--Examples/test-suite/java/namespace_template_runme.java32
-rw-r--r--Examples/test-suite/java/native_directive_runme.java22
-rw-r--r--Examples/test-suite/java/nested_inheritance_interface_runme.java32
-rw-r--r--Examples/test-suite/java/rename1_runme.java4
-rw-r--r--Examples/test-suite/java/rename2_runme.java4
-rw-r--r--Examples/test-suite/java/rename3_runme.java4
-rw-r--r--Examples/test-suite/java/rename4_runme.java4
-rw-r--r--Examples/test-suite/java/template_class_reuse_name_runme.java57
-rw-r--r--Examples/test-suite/java/template_parameters_global_scope_runme.java75
-rw-r--r--Examples/test-suite/java/template_partial_specialization_runme.java4
-rw-r--r--Examples/test-suite/java/template_partial_specialization_typedef_runme.java4
-rw-r--r--Examples/test-suite/java/template_using_directive_and_declaration_forward_runme.java10
-rw-r--r--Examples/test-suite/java/template_using_directive_typedef_runme.java31
-rw-r--r--Examples/test-suite/java/typedef_classforward_same_name_runme.java26
-rw-r--r--Examples/test-suite/java/typedef_funcptr_runme.java34
-rw-r--r--Examples/test-suite/java/typemap_template_parms_runme.java23
-rw-r--r--Examples/test-suite/java_director.i1
-rw-r--r--Examples/test-suite/java_director_assumeoverride.i4
-rw-r--r--Examples/test-suite/java_director_exception_feature.i37
-rw-r--r--Examples/test-suite/java_director_exception_feature_nspace.i35
-rw-r--r--Examples/test-suite/java_director_typemaps.i15
-rw-r--r--Examples/test-suite/java_director_typemaps_ptr.i433
-rw-r--r--Examples/test-suite/java_enums.i15
-rw-r--r--Examples/test-suite/java_throws.i33
-rw-r--r--Examples/test-suite/javascript/Makefile.in8
-rw-r--r--Examples/test-suite/javascript/complextest_runme.js15
-rw-r--r--Examples/test-suite/javascript/native_directive_runme.js9
-rw-r--r--Examples/test-suite/javascript/null_pointer_runme.js2
-rw-r--r--Examples/test-suite/javascript/overload_null_runme.js49
-rw-r--r--Examples/test-suite/javascript/rename1_runme.js4
-rw-r--r--Examples/test-suite/javascript/rename2_runme.js4
-rw-r--r--Examples/test-suite/javascript/rename3_runme.js4
-rw-r--r--Examples/test-suite/javascript/rename4_runme.js4
-rw-r--r--Examples/test-suite/javascript/string_simple_runme.js2
-rw-r--r--Examples/test-suite/keyword_rename.i2
-rw-r--r--Examples/test-suite/li_boost_shared_ptr_bits.i4
-rw-r--r--Examples/test-suite/li_boost_shared_ptr_director.i138
-rw-r--r--Examples/test-suite/li_implicit.i5
-rw-r--r--Examples/test-suite/li_std_auto_ptr.i28
-rw-r--r--Examples/test-suite/li_std_containers_overload.i33
-rw-r--r--Examples/test-suite/li_std_deque.i4
-rw-r--r--Examples/test-suite/li_std_except.i40
-rw-r--r--Examples/test-suite/li_std_except_as_class.i11
-rw-r--r--Examples/test-suite/li_std_list.i58
-rw-r--r--Examples/test-suite/li_std_map.i25
-rw-r--r--Examples/test-suite/li_std_set.i44
-rw-r--r--Examples/test-suite/li_std_string.i31
-rw-r--r--Examples/test-suite/li_std_string_extra.i8
-rw-r--r--Examples/test-suite/li_std_vector.i4
-rw-r--r--Examples/test-suite/li_std_vector_back_reference.i14
-rw-r--r--Examples/test-suite/li_std_vector_extra.i16
-rw-r--r--Examples/test-suite/li_std_vector_ptr.i17
-rw-r--r--Examples/test-suite/li_std_wstring.i69
-rw-r--r--Examples/test-suite/li_std_wstring_inherit.i39
-rw-r--r--Examples/test-suite/lua/Makefile.in6
-rw-r--r--Examples/test-suite/lua/abstract_access_runme.lua2
-rw-r--r--Examples/test-suite/lua/li_std_string_runme.lua4
-rw-r--r--Examples/test-suite/lua/newobject2_runme.lua4
-rw-r--r--Examples/test-suite/lua/overload_complicated_runme.lua6
-rw-r--r--Examples/test-suite/lua/overload_null_runme.lua41
-rw-r--r--Examples/test-suite/member_funcptr_galore.i131
-rw-r--r--Examples/test-suite/member_pointer.i16
-rw-r--r--Examples/test-suite/member_pointer_const.i149
-rw-r--r--Examples/test-suite/minherit2.i4
-rw-r--r--Examples/test-suite/multiple_inheritance_shared_ptr.i6
-rw-r--r--Examples/test-suite/multivalue.i10
-rw-r--r--Examples/test-suite/mzscheme/Makefile.in62
-rw-r--r--Examples/test-suite/mzscheme/name_runme.scm2
-rw-r--r--Examples/test-suite/mzscheme/unions_runme.scm6
-rw-r--r--Examples/test-suite/name_warnings.i4
-rw-r--r--Examples/test-suite/namespace_chase.i36
-rw-r--r--Examples/test-suite/namespace_template.i40
-rw-r--r--Examples/test-suite/native_directive.i102
-rw-r--r--Examples/test-suite/nested.i83
-rw-r--r--Examples/test-suite/nested_in_template.i34
-rw-r--r--Examples/test-suite/nested_inheritance_interface.i20
-rw-r--r--Examples/test-suite/nested_structs.i4
-rw-r--r--Examples/test-suite/nested_template_base.i4
-rw-r--r--Examples/test-suite/newobject3.i25
-rw-r--r--Examples/test-suite/null_pointer.i4
-rw-r--r--Examples/test-suite/ocaml/Makefile.in95
-rw-r--r--Examples/test-suite/ocaml/abstract_access_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/abstract_typedef2_runme.ml4
-rw-r--r--Examples/test-suite/ocaml/abstract_typedef_runme.ml6
-rw-r--r--Examples/test-suite/ocaml/abstract_virtual_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/aggregate_runme.ml15
-rw-r--r--Examples/test-suite/ocaml/allowexcept_runme.ml7
-rw-r--r--Examples/test-suite/ocaml/cast_operator_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/catches_runme.ml39
-rw-r--r--Examples/test-suite/ocaml/char_binary_runme.ml24
-rw-r--r--Examples/test-suite/ocaml/char_constant_runme.ml16
-rw-r--r--Examples/test-suite/ocaml/chartest_runme.ml25
-rw-r--r--Examples/test-suite/ocaml/class_scope_weird_runme.ml6
-rw-r--r--Examples/test-suite/ocaml/constover_runme.ml16
-rw-r--r--Examples/test-suite/ocaml/constructor_rename_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/conversion_runme.ml9
-rw-r--r--Examples/test-suite/ocaml/cpp_nodefault_runme.ml17
-rw-r--r--Examples/test-suite/ocaml/cpp_static_runme.ml17
-rw-r--r--Examples/test-suite/ocaml/default_arg_values_runme.ml17
-rw-r--r--Examples/test-suite/ocaml/default_args_runme.ml58
-rw-r--r--Examples/test-suite/ocaml/director_default_runme.ml25
-rw-r--r--Examples/test-suite/ocaml/director_exception_catches_runme.ml15
-rw-r--r--Examples/test-suite/ocaml/director_exception_nothrow_runme.ml12
-rw-r--r--Examples/test-suite/ocaml/director_exception_runme.ml46
-rw-r--r--Examples/test-suite/ocaml/director_frob_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/director_ignore_runme.ml18
-rw-r--r--Examples/test-suite/ocaml/director_pass_by_value_runme.ml24
-rw-r--r--Examples/test-suite/ocaml/director_unroll_runme.ml15
-rw-r--r--Examples/test-suite/ocaml/dynamic_cast_runme.ml9
-rw-r--r--Examples/test-suite/ocaml/exception_classname_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/exception_order_runme.ml17
-rw-r--r--Examples/test-suite/ocaml/extend_constructor_destructor_runme.ml12
-rw-r--r--Examples/test-suite/ocaml/extend_placement_runme.ml53
-rw-r--r--Examples/test-suite/ocaml/extend_runme.ml26
-rw-r--r--Examples/test-suite/ocaml/extend_special_variables_runme.ml14
-rw-r--r--Examples/test-suite/ocaml/extend_template_runme.ml8
-rw-r--r--Examples/test-suite/ocaml/extend_typedef_class_runme.ml12
-rw-r--r--Examples/test-suite/ocaml/extern_c_runme.ml4
-rw-r--r--Examples/test-suite/ocaml/funcptr_cpp_runme.ml13
-rw-r--r--Examples/test-suite/ocaml/fvirtual_runme.ml10
-rw-r--r--Examples/test-suite/ocaml/global_ns_arg_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/global_vars_runme.ml15
-rw-r--r--Examples/test-suite/ocaml/ignore_parameter_runme.ml20
-rw-r--r--Examples/test-suite/ocaml/inctest_runme.ml7
-rw-r--r--Examples/test-suite/ocaml/inherit_missing_runme.ml10
-rw-r--r--Examples/test-suite/ocaml/inout_runme.ml8
-rw-r--r--Examples/test-suite/ocaml/li_cpointer_cpp_runme.ml10
-rw-r--r--Examples/test-suite/ocaml/li_std_except_runme.ml18
-rw-r--r--Examples/test-suite/ocaml/li_std_vector_runme.ml23
-rw-r--r--Examples/test-suite/ocaml/memberin_extend_runme.ml10
-rw-r--r--Examples/test-suite/ocaml/multivalue_runme.ml8
-rw-r--r--Examples/test-suite/ocaml/namespace_virtual_method_runme.ml4
-rw-r--r--Examples/test-suite/ocaml/newobject2_runme.ml16
-rw-r--r--Examples/test-suite/ocaml/overload_bool_runme.ml26
-rw-r--r--Examples/test-suite/ocaml/overload_extend_runme.ml11
-rw-r--r--Examples/test-suite/ocaml/overload_method_runme.ml11
-rw-r--r--Examples/test-suite/ocaml/overload_numeric_runme.ml14
-rw-r--r--Examples/test-suite/ocaml/overload_polymorphic_runme.ml9
-rw-r--r--Examples/test-suite/ocaml/overload_rename_runme.ml7
-rw-r--r--Examples/test-suite/ocaml/overload_subtype_runme.ml8
-rw-r--r--Examples/test-suite/ocaml/overload_template_runme.ml60
-rw-r--r--Examples/test-suite/ocaml/primitive_ref_runme.ml20
-rw-r--r--Examples/test-suite/ocaml/reference_global_vars_runme.ml57
-rw-r--r--Examples/test-suite/ocaml/rename_predicates_runme.ml40
-rw-r--r--Examples/test-suite/ocaml/sizet_runme.ml10
-rw-r--r--Examples/test-suite/ocaml/special_variable_macros_runme.ml14
-rw-r--r--Examples/test-suite/ocaml/special_variables_runme.ml36
-rw-r--r--Examples/test-suite/ocaml/static_const_member_runme.ml9
-rw-r--r--Examples/test-suite/ocaml/string_simple_runme.ml9
-rw-r--r--Examples/test-suite/ocaml/struct_value_runme.ml11
-rw-r--r--Examples/test-suite/ocaml/swig_exception_runme.ml13
-rw-r--r--Examples/test-suite/ocaml/template_default_arg_overloaded_extend_runme.ml17
-rw-r--r--Examples/test-suite/ocaml/template_default_arg_runme.ml52
-rw-r--r--Examples/test-suite/ocaml/template_extend1_runme.ml8
-rw-r--r--Examples/test-suite/ocaml/template_extend2_runme.ml8
-rw-r--r--Examples/test-suite/ocaml/template_inherit_runme.ml22
-rw-r--r--Examples/test-suite/ocaml/template_opaque_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/template_ref_type_runme.ml6
-rw-r--r--Examples/test-suite/ocaml/template_rename_runme.ml12
-rw-r--r--Examples/test-suite/ocaml/template_tbase_template_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/throw_exception_runme.ml43
-rw-r--r--Examples/test-suite/ocaml/typedef_class_runme.ml13
-rw-r--r--Examples/test-suite/ocaml/typedef_classforward_same_name_runme.ml11
-rw-r--r--Examples/test-suite/ocaml/typedef_inherit_runme.ml11
-rw-r--r--Examples/test-suite/ocaml/typedef_mptr_runme.ml21
-rw-r--r--Examples/test-suite/ocaml/typedef_reference_runme.ml11
-rw-r--r--Examples/test-suite/ocaml/typemap_arrays_runme.ml4
-rw-r--r--Examples/test-suite/ocaml/typemap_delete_runme.ml5
-rw-r--r--Examples/test-suite/ocaml/types_directive_runme.ml14
-rw-r--r--Examples/test-suite/ocaml/unions_runme.ml24
-rw-r--r--Examples/test-suite/ocaml/using1_runme.ml4
-rw-r--r--Examples/test-suite/ocaml/using_extend_runme.ml12
-rw-r--r--Examples/test-suite/ocaml/using_inherit_runme.ml24
-rw-r--r--Examples/test-suite/ocaml/using_pointers_runme.ml10
-rw-r--r--Examples/test-suite/ocaml/using_private_runme.ml10
-rw-r--r--Examples/test-suite/ocaml/using_protected_runme.ml2
-rw-r--r--Examples/test-suite/ocaml/valuewrapper_runme.ml8
-rw-r--r--Examples/test-suite/ocaml/varargs_overload_runme.ml29
-rw-r--r--Examples/test-suite/ocaml/wrapmacro_runme.ml10
-rw-r--r--Examples/test-suite/octave/Makefile.in22
-rw-r--r--Examples/test-suite/octave/complextest_runme.m14
-rw-r--r--Examples/test-suite/octave/li_std_containers_overload_runme.m37
-rw-r--r--Examples/test-suite/octave/li_std_wstring_runme.m95
-rw-r--r--Examples/test-suite/octave/null_pointer_runme.m2
-rw-r--r--Examples/test-suite/octave/octave_cell_deref_runme.m4
-rw-r--r--Examples/test-suite/octave/overload_complicated_runme.m16
-rw-r--r--Examples/test-suite/octave/overload_null_runme.m52
-rw-r--r--Examples/test-suite/octave/return_const_value_runme.m4
-rw-r--r--Examples/test-suite/octave/template_typedef_cplx2_runme.m12
-rw-r--r--Examples/test-suite/octave/template_typedef_cplx_runme.m12
-rw-r--r--Examples/test-suite/octave_cell_deref.i2
-rw-r--r--Examples/test-suite/overload_arrays.i7
-rw-r--r--Examples/test-suite/overload_complicated.i29
-rw-r--r--Examples/test-suite/overload_copy.i4
-rw-r--r--Examples/test-suite/overload_method.i5
-rw-r--r--Examples/test-suite/overload_null.i52
-rw-r--r--Examples/test-suite/overload_simple.i7
-rw-r--r--Examples/test-suite/perl5/README2
-rw-r--r--Examples/test-suite/perl5/director_classes_runme.pl4
-rw-r--r--Examples/test-suite/perl5/global_vars_runme.pl8
-rw-r--r--Examples/test-suite/perl5/overload_null_runme.pl44
-rw-r--r--Examples/test-suite/perl5/run-perl-test.pl2
-rw-r--r--Examples/test-suite/perl5/scilab_multivalue_runme.pl88
-rw-r--r--Examples/test-suite/php/Makefile.in1
-rw-r--r--Examples/test-suite/php/abstract_inherit_ok_runme.php2
-rw-r--r--Examples/test-suite/php/abstract_inherit_runme.php2
-rw-r--r--Examples/test-suite/php/add_link_runme.php8
-rw-r--r--Examples/test-suite/php/argout_runme.php4
-rw-r--r--Examples/test-suite/php/arrayptr_runme.php2
-rw-r--r--Examples/test-suite/php/arrays_global_runme.php18
-rw-r--r--Examples/test-suite/php/arrays_global_twodim_runme.php8
-rw-r--r--Examples/test-suite/php/arrays_runme.php8
-rw-r--r--Examples/test-suite/php/arrays_scope_runme.php6
-rw-r--r--Examples/test-suite/php/casts_runme.php6
-rw-r--r--Examples/test-suite/php/class_ignore_runme.php4
-rw-r--r--Examples/test-suite/php/cpp_basic_runme.php6
-rw-r--r--Examples/test-suite/php/cpp_static_runme.php6
-rw-r--r--Examples/test-suite/php/director_abstract_runme.php4
-rw-r--r--Examples/test-suite/php/director_basic_runme.php6
-rw-r--r--Examples/test-suite/php/director_classic_runme.php4
-rw-r--r--Examples/test-suite/php/director_default_runme.php4
-rw-r--r--Examples/test-suite/php/director_detect_runme.php4
-rw-r--r--Examples/test-suite/php/director_enum_runme.php4
-rw-r--r--Examples/test-suite/php/director_exception_runme.php4
-rw-r--r--Examples/test-suite/php/director_extend_runme.php4
-rw-r--r--Examples/test-suite/php/director_finalizer_runme.php6
-rw-r--r--Examples/test-suite/php/director_frob_runme.php6
-rw-r--r--Examples/test-suite/php/director_nested_runme.php4
-rw-r--r--Examples/test-suite/php/director_profile_runme.php4
-rw-r--r--Examples/test-suite/php/director_protected_runme.php6
-rw-r--r--Examples/test-suite/php/director_stl_runme.php4
-rw-r--r--Examples/test-suite/php/director_string_runme.php6
-rw-r--r--Examples/test-suite/php/director_thread_runme.php6
-rw-r--r--Examples/test-suite/php/director_unroll_runme.php11
-rw-r--r--Examples/test-suite/php/evil_diamond_prop_runme.php2
-rw-r--r--Examples/test-suite/php/exception_order_runme.php6
-rw-r--r--Examples/test-suite/php/grouping_runme.php6
-rw-r--r--Examples/test-suite/php/ignore_parameter_runme.php4
-rw-r--r--Examples/test-suite/php/import_nomodule_runme.php4
-rw-r--r--Examples/test-suite/php/li_carrays_cpp_runme.php6
-rw-r--r--Examples/test-suite/php/li_carrays_runme.php6
-rw-r--r--Examples/test-suite/php/li_factory_runme.php4
-rw-r--r--Examples/test-suite/php/li_std_string_runme.php3
-rw-r--r--Examples/test-suite/php/newobject1_runme.php4
-rw-r--r--Examples/test-suite/php/newobject3_runme.php18
-rw-r--r--Examples/test-suite/php/overload_null_runme.php46
-rw-r--r--Examples/test-suite/php/overload_rename_runme.php2
-rw-r--r--Examples/test-suite/php/php_iterator_runme.php4
-rw-r--r--Examples/test-suite/php/php_pragma_runme.php11
-rw-r--r--Examples/test-suite/php/prefix_runme.php4
-rw-r--r--Examples/test-suite/php/preproc_constants_c_runme.php3
-rw-r--r--Examples/test-suite/php/preproc_constants_runme.php3
-rw-r--r--Examples/test-suite/php/sym_runme.php2
-rw-r--r--Examples/test-suite/php/template_arg_typename_runme.php4
-rw-r--r--Examples/test-suite/php/template_construct_runme.php2
-rw-r--r--Examples/test-suite/php/tests.php74
-rw-r--r--Examples/test-suite/php/threads_exception_runme.php8
-rw-r--r--Examples/test-suite/php/typedef_reference_runme.php2
-rw-r--r--Examples/test-suite/php5/Makefile.in80
-rw-r--r--Examples/test-suite/php5/abstract_inherit_ok_runme.php12
-rw-r--r--Examples/test-suite/php5/abstract_inherit_runme.php14
-rw-r--r--Examples/test-suite/php5/add_link_runme.php22
-rw-r--r--Examples/test-suite/php5/argout_runme.php38
-rw-r--r--Examples/test-suite/php5/arrayptr_runme.php14
-rw-r--r--Examples/test-suite/php5/arrays_global_runme.php19
-rw-r--r--Examples/test-suite/php5/arrays_global_twodim_runme.php22
-rw-r--r--Examples/test-suite/php5/arrays_runme.php18
-rw-r--r--Examples/test-suite/php5/arrays_scope_runme.php16
-rw-r--r--Examples/test-suite/php5/callback_runme.php9
-rw-r--r--Examples/test-suite/php5/casts_runme.php18
-rw-r--r--Examples/test-suite/php5/char_strings_runme.php43
-rw-r--r--Examples/test-suite/php5/class_ignore_runme.php16
-rw-r--r--Examples/test-suite/php5/conversion_namespace_runme.php13
-rw-r--r--Examples/test-suite/php5/conversion_ns_template_runme.php10
-rw-r--r--Examples/test-suite/php5/conversion_runme.php13
-rw-r--r--Examples/test-suite/php5/cpp11_strongly_typed_enumerations_runme.php169
-rw-r--r--Examples/test-suite/php5/cpp_basic_runme.php20
-rw-r--r--Examples/test-suite/php5/cpp_static_runme.php14
-rw-r--r--Examples/test-suite/php5/director_abstract_runme.php62
-rw-r--r--Examples/test-suite/php5/director_basic_runme.php58
-rw-r--r--Examples/test-suite/php5/director_classic_runme.php150
-rw-r--r--Examples/test-suite/php5/director_default_runme.php20
-rw-r--r--Examples/test-suite/php5/director_detect_runme.php55
-rw-r--r--Examples/test-suite/php5/director_enum_runme.php25
-rw-r--r--Examples/test-suite/php5/director_exception_runme.php127
-rw-r--r--Examples/test-suite/php5/director_extend_runme.php24
-rw-r--r--Examples/test-suite/php5/director_finalizer_runme.php61
-rw-r--r--Examples/test-suite/php5/director_frob_runme.php19
-rw-r--r--Examples/test-suite/php5/director_nested_runme.php74
-rw-r--r--Examples/test-suite/php5/director_pass_by_value_runme.php24
-rw-r--r--Examples/test-suite/php5/director_profile_runme.php53
-rw-r--r--Examples/test-suite/php5/director_protected_runme.php70
-rw-r--r--Examples/test-suite/php5/director_stl_runme.php60
-rw-r--r--Examples/test-suite/php5/director_string_runme.php34
-rw-r--r--Examples/test-suite/php5/director_thread_runme.php32
-rw-r--r--Examples/test-suite/php5/director_unroll_runme.php29
-rw-r--r--Examples/test-suite/php5/enum_scope_template_runme.php15
-rw-r--r--Examples/test-suite/php5/evil_diamond_ns_runme.php18
-rw-r--r--Examples/test-suite/php5/evil_diamond_prop_runme.php38
-rw-r--r--Examples/test-suite/php5/evil_diamond_runme.php16
-rw-r--r--Examples/test-suite/php5/exception_order_runme.php39
-rw-r--r--Examples/test-suite/php5/extend_template_ns_runme.php12
-rw-r--r--Examples/test-suite/php5/extend_template_runme.php12
-rw-r--r--Examples/test-suite/php5/grouping_runme.php22
-rw-r--r--Examples/test-suite/php5/ignore_parameter_runme.php38
-rw-r--r--Examples/test-suite/php5/import_nomodule_runme.php20
-rw-r--r--Examples/test-suite/php5/li_carrays_cpp_runme.php22
-rw-r--r--Examples/test-suite/php5/li_carrays_runme.php22
-rw-r--r--Examples/test-suite/php5/li_factory_runme.php22
-rw-r--r--Examples/test-suite/php5/li_std_string_runme.php31
-rw-r--r--Examples/test-suite/php5/li_std_vector_member_var_runme.php30
-rw-r--r--Examples/test-suite/php5/newobject1_runme.php19
-rw-r--r--Examples/test-suite/php5/overload_rename_runme.php19
-rw-r--r--Examples/test-suite/php5/overload_return_type_runme.php13
-rw-r--r--Examples/test-suite/php5/php_iterator_runme.php24
-rw-r--r--Examples/test-suite/php5/pointer_reference_runme.php18
-rw-r--r--Examples/test-suite/php5/prefix_runme.php18
-rw-r--r--Examples/test-suite/php5/preproc_constants_c_runme.php66
-rw-r--r--Examples/test-suite/php5/preproc_constants_runme.php74
-rw-r--r--Examples/test-suite/php5/primitive_ref_runme.php34
-rw-r--r--Examples/test-suite/php5/rename_scope_runme.php16
-rw-r--r--Examples/test-suite/php5/skel.php15
-rw-r--r--Examples/test-suite/php5/smart_pointer_rename_runme.php27
-rw-r--r--Examples/test-suite/php5/swig_exception_runme.php33
-rw-r--r--Examples/test-suite/php5/sym_runme.php22
-rw-r--r--Examples/test-suite/php5/template_arg_typename_runme.php18
-rw-r--r--Examples/test-suite/php5/template_construct_runme.php11
-rw-r--r--Examples/test-suite/php5/tests.php237
-rw-r--r--Examples/test-suite/php5/threads_exception_runme.php43
-rw-r--r--Examples/test-suite/php5/typedef_reference_runme.php13
-rw-r--r--Examples/test-suite/php5/typemap_ns_using_runme.php9
-rw-r--r--Examples/test-suite/php5/using1_runme.php9
-rw-r--r--Examples/test-suite/php5/using2_runme.php9
-rw-r--r--Examples/test-suite/php5/valuewrapper_base_runme.php13
-rw-r--r--Examples/test-suite/php5/virtual_vs_nonvirtual_base_runme.php11
-rw-r--r--Examples/test-suite/php5/wrapmacro_runme.php12
-rw-r--r--Examples/test-suite/php_pragma.i6
-rw-r--r--Examples/test-suite/preproc.i80
-rw-r--r--Examples/test-suite/preproc_constants.i9
-rw-r--r--Examples/test-suite/preproc_gcc_output.h13
-rw-r--r--Examples/test-suite/preproc_gcc_output.i12
-rw-r--r--Examples/test-suite/primitive_types.i36
-rw-r--r--Examples/test-suite/pure_virtual.i4
-rw-r--r--Examples/test-suite/python/Makefile.in98
-rw-r--r--Examples/test-suite/python/argcargvtest_runme.py12
-rw-r--r--Examples/test-suite/python/autodoc_runme.py470
-rw-r--r--Examples/test-suite/python/callback_runme.py4
-rw-r--r--Examples/test-suite/python/char_binary_runme.py20
-rw-r--r--Examples/test-suite/python/comment_verifier.py26
-rw-r--r--Examples/test-suite/python/complextest_runme.py21
-rw-r--r--Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py19
-rw-r--r--Examples/test-suite/python/cpp11_final_directors_runme.py11
-rw-r--r--Examples/test-suite/python/cpp11_hash_tables_runme.py60
-rw-r--r--Examples/test-suite/python/cpp11_raw_string_literals_runme.py27
-rw-r--r--Examples/test-suite/python/cpp11_ref_qualifiers_runme.py45
-rw-r--r--Examples/test-suite/python/cpp11_ref_qualifiers_rvalue_unignore_runme.py4
-rw-r--r--Examples/test-suite/python/cpp11_shared_ptr_overload_runme.py45
-rw-r--r--Examples/test-suite/python/cpp11_std_array_runme.py (renamed from Examples/test-suite/python/cpp11_li_std_array_runme.py)2
-rw-r--r--Examples/test-suite/python/cpp14_binary_integer_literals_runme.py16
-rw-r--r--Examples/test-suite/python/cpp17_hex_floating_literals_runme.py28
-rw-r--r--Examples/test-suite/python/cpp17_nested_namespaces_runme.py18
-rw-r--r--Examples/test-suite/python/cpp17_u8_char_literals_runme.py10
-rw-r--r--Examples/test-suite/python/cpp_static_runme.py51
-rw-r--r--Examples/test-suite/python/default_args_c_runme.py20
-rw-r--r--Examples/test-suite/python/default_args_runme.py76
-rw-r--r--Examples/test-suite/python/director_abstract_runme.py16
-rw-r--r--Examples/test-suite/python/director_exception_runme.py28
-rw-r--r--Examples/test-suite/python/director_smartptr_runme.py19
-rw-r--r--Examples/test-suite/python/doxygen_alias_runme.py10
-rw-r--r--Examples/test-suite/python/doxygen_basic_notranslate_runme.py66
-rw-r--r--Examples/test-suite/python/doxygen_basic_translate_runme.py84
-rw-r--r--Examples/test-suite/python/doxygen_basic_translate_style2_runme.py82
-rw-r--r--Examples/test-suite/python/doxygen_ignore_runme.py17
-rw-r--r--Examples/test-suite/python/doxygen_misc_constructs_runme.py133
-rw-r--r--Examples/test-suite/python/doxygen_parsing_runme.py66
-rw-r--r--Examples/test-suite/python/doxygen_translate_all_tags_runme.py313
-rw-r--r--Examples/test-suite/python/doxygen_translate_links_runme.py38
-rw-r--r--Examples/test-suite/python/doxygen_translate_runme.py260
-rw-r--r--Examples/test-suite/python/funcptr_cpp_runme.py3
-rw-r--r--Examples/test-suite/python/functors_runme.py12
-rw-r--r--Examples/test-suite/python/global_namespace_runme.py41
-rw-r--r--Examples/test-suite/python/ignore_parameter_runme.py23
-rw-r--r--Examples/test-suite/python/implicittest_runme.py25
-rw-r--r--Examples/test-suite/python/keyword_rename_runme.py2
-rw-r--r--Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py9
-rw-r--r--Examples/test-suite/python/li_boost_shared_ptr_director_runme.py80
-rw-r--r--Examples/test-suite/python/li_cstring_runme.py8
-rw-r--r--Examples/test-suite/python/li_cwstring_runme.py8
-rw-r--r--Examples/test-suite/python/li_std_containers_int_runme.py15
-rw-r--r--Examples/test-suite/python/li_std_containers_overload_runme.py29
-rw-r--r--Examples/test-suite/python/li_std_map_runme.py29
-rw-r--r--Examples/test-suite/python/li_std_set_runme.py4
-rw-r--r--Examples/test-suite/python/li_std_string_extra_runme.py24
-rw-r--r--Examples/test-suite/python/li_std_vector_back_reference_runme.py10
-rw-r--r--Examples/test-suite/python/li_std_vector_extra_runme.py10
-rw-r--r--Examples/test-suite/python/li_std_vector_ptr_runme.py10
-rw-r--r--Examples/test-suite/python/li_std_wstring_inherit_runme.py45
-rw-r--r--Examples/test-suite/python/li_std_wstring_runme.py156
-rw-r--r--Examples/test-suite/python/member_pointer_const_runme.py51
-rw-r--r--Examples/test-suite/python/member_pointer_runme.py3
-rw-r--r--Examples/test-suite/python/namespace_class_runme.py16
-rw-r--r--Examples/test-suite/python/nested_in_template_runme.py5
-rw-r--r--Examples/test-suite/python/nested_runme.py20
-rw-r--r--Examples/test-suite/python/operator_overload_runme.py7
-rw-r--r--Examples/test-suite/python/overload_complicated_runme.py14
-rw-r--r--Examples/test-suite/python/overload_null_runme.py44
-rw-r--r--Examples/test-suite/python/overload_template_fast_runme.py9
-rw-r--r--Examples/test-suite/python/preproc_gcc_output_runme.py5
-rw-r--r--Examples/test-suite/python/preproc_runme.py3
-rw-r--r--Examples/test-suite/python/primitive_ref_runme.py2
-rw-r--r--Examples/test-suite/python/primitive_types_runme.py121
-rw-r--r--Examples/test-suite/python/python_abstractbase_runme3.py24
-rw-r--r--Examples/test-suite/python/python_append_runme.py10
-rw-r--r--Examples/test-suite/python/python_builtin_runme.py15
-rw-r--r--Examples/test-suite/python/python_docstring_runme.py2
-rw-r--r--Examples/test-suite/python/python_nondynamic_runme.py100
-rw-r--r--Examples/test-suite/python/python_overload_simple_cast_runme.py8
-rw-r--r--Examples/test-suite/python/python_pickle_runme.py6
-rw-r--r--Examples/test-suite/python/python_pybuf_runme3.py41
-rw-r--r--Examples/test-suite/python/python_pybuffer_runme.py46
-rw-r--r--Examples/test-suite/python/python_pythoncode_runme.py4
-rw-r--r--Examples/test-suite/python/python_richcompare_runme.py52
-rw-r--r--Examples/test-suite/python/python_strict_unicode_runme.py22
-rw-r--r--Examples/test-suite/python/reference_global_vars_runme.py4
-rw-r--r--Examples/test-suite/python/return_const_value_runme.py4
-rw-r--r--Examples/test-suite/python/smart_pointer_member_runme.py8
-rw-r--r--Examples/test-suite/python/std_containers_runme.py26
-rw-r--r--Examples/test-suite/python/swigobject_runme.py4
-rw-r--r--Examples/test-suite/python/template_class_reuse_name_runme.py42
-rw-r--r--Examples/test-suite/python/template_typedef_cplx2_runme.py24
-rw-r--r--Examples/test-suite/python/template_typedef_cplx_runme.py24
-rw-r--r--Examples/test-suite/python/template_using_directive_typedef_runme.py15
-rw-r--r--Examples/test-suite/python/typedef_classforward_same_name_runme.py11
-rw-r--r--Examples/test-suite/python/typedef_funcptr_runme.py20
-rw-r--r--Examples/test-suite/python/typemap_template_typedef_runme.py32
-rw-r--r--Examples/test-suite/python/unicode_strings_runme.py16
-rw-r--r--Examples/test-suite/python/varargs_overload_runme.py32
-rw-r--r--Examples/test-suite/python/varargs_runme.py2
-rw-r--r--Examples/test-suite/python_append.i6
-rw-r--r--Examples/test-suite/python_builtin.i32
-rw-r--r--Examples/test-suite/python_nondynamic.i11
-rw-r--r--Examples/test-suite/python_pybuffer.i (renamed from Examples/test-suite/python_pybuf.i)8
-rw-r--r--Examples/test-suite/python_pythoncode.i30
-rw-r--r--Examples/test-suite/python_varargs_typemap.i5
-rw-r--r--Examples/test-suite/r/Makefile.in16
-rw-r--r--Examples/test-suite/r/enum_thorough_runme.R452
-rw-r--r--Examples/test-suite/r/overload_null_runme.R49
-rw-r--r--Examples/test-suite/r/r_use_isnull_runme.R11
-rw-r--r--Examples/test-suite/r_use_isnull.i34
-rw-r--r--Examples/test-suite/redefined_not.i2
-rw-r--r--Examples/test-suite/register_par.i6
-rw-r--r--Examples/test-suite/rename.h6
-rw-r--r--Examples/test-suite/rename1.i7
-rw-r--r--Examples/test-suite/rename2.i2
-rw-r--r--Examples/test-suite/rename3.i2
-rw-r--r--Examples/test-suite/rename4.i12
-rw-r--r--Examples/test-suite/restrict_cplusplus.i3
-rw-r--r--Examples/test-suite/ruby/Makefile.in24
-rw-r--r--Examples/test-suite/ruby/cpp11_hash_tables_runme.rb61
-rw-r--r--Examples/test-suite/ruby/cpp11_shared_ptr_const_runme.rb9
-rw-r--r--Examples/test-suite/ruby/cpp11_shared_ptr_nullptr_in_containers_runme.rb16
-rw-r--r--Examples/test-suite/ruby/cpp11_shared_ptr_upcast_runme.rb60
-rw-r--r--Examples/test-suite/ruby/cpp11_std_array_runme.rb (renamed from Examples/test-suite/ruby/cpp11_li_std_array_runme.rb)4
-rw-r--r--Examples/test-suite/ruby/director_smartptr_runme.rb24
-rw-r--r--Examples/test-suite/ruby/li_boost_shared_ptr_director_runme.rb103
-rw-r--r--Examples/test-suite/ruby/li_std_containers_overload_runme.rb44
-rw-r--r--Examples/test-suite/ruby/li_std_list_runme.rb8
-rw-r--r--Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb12
-rw-r--r--Examples/test-suite/ruby/li_std_wstring_runme.rb52
-rw-r--r--Examples/test-suite/ruby/newobject1_runme.rb2
-rw-r--r--Examples/test-suite/ruby/newobject2_runme.rb2
-rw-r--r--Examples/test-suite/ruby/overload_null_runme.rb52
-rw-r--r--Examples/test-suite/ruby/ruby_alias_global_function_runme.rb20
-rw-r--r--Examples/test-suite/ruby/ruby_alias_method_runme.rb24
-rw-r--r--Examples/test-suite/ruby/ruby_alias_module_function_runme.rb26
-rw-r--r--Examples/test-suite/ruby/ruby_rdata_runme.rb7
-rw-r--r--Examples/test-suite/ruby/std_containers_runme.rb2
-rw-r--r--Examples/test-suite/ruby/swig_assert.rb22
-rw-r--r--Examples/test-suite/ruby_alias_global_function.i11
-rw-r--r--Examples/test-suite/ruby_alias_method.i26
-rw-r--r--Examples/test-suite/ruby_alias_module_function.i11
-rw-r--r--Examples/test-suite/ruby_rdata.i20
-rw-r--r--Examples/test-suite/schemerunme/reference_global_vars.scm8
-rw-r--r--Examples/test-suite/scilab/Makefile.in2
-rw-r--r--Examples/test-suite/scilab/li_std_container_typemaps_runme.sci4
-rw-r--r--Examples/test-suite/scilab/li_std_deque_runme.sci2
-rw-r--r--Examples/test-suite/scilab/null_pointer_runme.sci2
-rw-r--r--Examples/test-suite/scilab/overload_null_runme.sci45
-rw-r--r--Examples/test-suite/scilab/scilab_li_matrix_runme.sci6
-rw-r--r--Examples/test-suite/scilab/throw_exception_runme.sci10
-rw-r--r--Examples/test-suite/scilab/varargs_overload_runme.sci22
-rw-r--r--Examples/test-suite/simutry.i6
-rw-r--r--Examples/test-suite/smart_pointer_namespace2.i13
-rw-r--r--Examples/test-suite/smart_pointer_overload.i4
-rw-r--r--Examples/test-suite/static_const_member_2.i4
-rw-r--r--Examples/test-suite/std_containers.i4
-rw-r--r--Examples/test-suite/stl_no_default_constructor.i19
-rw-r--r--Examples/test-suite/string_simple.i4
-rw-r--r--Examples/test-suite/tcl/null_pointer_runme.tcl2
-rw-r--r--Examples/test-suite/tcl/overload_null_runme.tcl52
-rw-r--r--Examples/test-suite/template_class_reuse_name.i132
-rw-r--r--Examples/test-suite/template_default_class_parms.i4
-rw-r--r--Examples/test-suite/template_default_class_parms_typedef.i4
-rw-r--r--Examples/test-suite/template_empty_inherit.i34
-rw-r--r--Examples/test-suite/template_nested_typemaps.i33
-rw-r--r--Examples/test-suite/template_opaque.i3
-rw-r--r--Examples/test-suite/template_parameters_global_scope.i133
-rw-r--r--Examples/test-suite/template_partial_specialization.i20
-rw-r--r--Examples/test-suite/template_partial_specialization_typedef.i20
-rw-r--r--Examples/test-suite/template_typedef_class_template.i4
-rw-r--r--Examples/test-suite/template_typedef_cplx5.i2
-rw-r--r--Examples/test-suite/template_typemaps.i4
-rw-r--r--Examples/test-suite/template_typemaps_typedef.i4
-rw-r--r--Examples/test-suite/template_typemaps_typedef2.i4
-rw-r--r--Examples/test-suite/template_using_directive_typedef.i44
-rw-r--r--Examples/test-suite/template_virtual.i2
-rw-r--r--Examples/test-suite/threads_exception.i22
-rw-r--r--Examples/test-suite/throw_exception.i30
-rw-r--r--Examples/test-suite/typedef_classforward_same_name.i15
-rw-r--r--Examples/test-suite/typedef_funcptr.i10
-rw-r--r--Examples/test-suite/typemap_delete.i4
-rw-r--r--Examples/test-suite/typemap_template.i26
-rw-r--r--Examples/test-suite/typemap_template_parms.i41
-rw-r--r--Examples/test-suite/typemap_template_typedef.i66
-rw-r--r--Examples/test-suite/unicode_strings.i2
-rw-r--r--Examples/test-suite/using_pointers.i8
-rw-r--r--Examples/test-suite/valuewrapper_opaque.i4
-rw-r--r--Examples/test-suite/varargs_overload.i44
-rw-r--r--Examples/test-suite/virtual_derivation.i1
-rw-r--r--Examples/test-suite/virtual_poly.i4
-rw-r--r--Lib/allegrocl/allegrocl.swg2
-rw-r--r--Lib/allegrocl/std_list.i28
-rw-r--r--Lib/allkw.swg3
-rw-r--r--Lib/cdata.i15
-rw-r--r--Lib/cffi/cffi.swg2
-rw-r--r--Lib/chicken/chicken.swg24
-rw-r--r--Lib/chicken/chickenrun.swg3
-rw-r--r--Lib/csharp/arrays_csharp.i42
-rw-r--r--Lib/csharp/boost_intrusive_ptr.i27
-rw-r--r--Lib/csharp/boost_shared_ptr.i113
-rw-r--r--Lib/csharp/complex.i5
-rw-r--r--Lib/csharp/csharp.swg36
-rw-r--r--Lib/csharp/csharphead.swg9
-rw-r--r--Lib/csharp/director.swg4
-rw-r--r--Lib/csharp/std_array.i2
-rw-r--r--Lib/csharp/std_complex.i95
-rw-r--r--Lib/csharp/std_list.i519
-rw-r--r--Lib/csharp/std_map.i31
-rw-r--r--Lib/csharp/std_pair.i8
-rw-r--r--Lib/csharp/std_set.i311
-rw-r--r--Lib/csharp/std_vector.i44
-rw-r--r--Lib/csharp/std_wstring.i10
-rw-r--r--Lib/csharp/stl.i2
-rw-r--r--Lib/csharp/wchar.i3
-rw-r--r--Lib/d/boost_shared_ptr.i102
-rw-r--r--Lib/d/dclassgen.swg4
-rw-r--r--Lib/d/director.swg4
-rw-r--r--Lib/d/dmemberfunctionpointers.swg2
-rw-r--r--Lib/d/dprimitives.swg2
-rw-r--r--Lib/d/dswigtype.swg15
-rw-r--r--Lib/d/std_map.i77
-rw-r--r--Lib/d/std_pair.i8
-rw-r--r--Lib/d/std_vector.i32
-rw-r--r--Lib/d/stl.i2
-rw-r--r--Lib/exception.i66
-rw-r--r--Lib/gcj/cni.i39
-rw-r--r--Lib/gcj/cni.swg14
-rw-r--r--Lib/gcj/javaprims.i422
-rw-r--r--Lib/go/director.swg80
-rw-r--r--Lib/go/go.swg11
-rw-r--r--Lib/go/goruntime.swg69
-rw-r--r--Lib/go/std_list.i7
-rw-r--r--Lib/go/std_map.i16
-rw-r--r--Lib/go/std_pair.i6
-rw-r--r--Lib/go/std_vector.i14
-rw-r--r--Lib/go/stl.i1
-rw-r--r--Lib/guile/guile_scm.swg5
-rw-r--r--Lib/guile/guile_scm_run.swg32
-rw-r--r--Lib/guile/guilemain.i5
-rw-r--r--Lib/guile/std_map.i212
-rw-r--r--Lib/guile/std_pair.i20
-rw-r--r--Lib/guile/std_vector.i22
-rw-r--r--Lib/guile/stl.i2
-rw-r--r--Lib/guile/typemaps.i28
-rw-r--r--Lib/intrusive_ptr.i6
-rw-r--r--Lib/java/boost_intrusive_ptr.i91
-rw-r--r--Lib/java/boost_shared_ptr.i154
-rw-r--r--Lib/java/director.swg135
-rw-r--r--Lib/java/java.swg82
-rw-r--r--Lib/java/javahead.swg12
-rw-r--r--Lib/java/std_array.i10
-rw-r--r--Lib/java/std_list.i225
-rw-r--r--Lib/java/std_map.i224
-rw-r--r--Lib/java/std_pair.i7
-rw-r--r--Lib/java/std_set.i203
-rw-r--r--Lib/java/std_unordered_map.i211
-rw-r--r--Lib/java/std_unordered_set.i199
-rw-r--r--Lib/java/std_vector.i224
-rw-r--r--Lib/java/typemaps.i72
-rw-r--r--Lib/java/various.i2
-rw-r--r--Lib/javascript/jsc/javascriptcode.swg2
-rw-r--r--Lib/javascript/jsc/javascriptrun.swg2
-rw-r--r--Lib/javascript/jsc/std_complex.i7
-rw-r--r--Lib/javascript/jsc/std_map.i17
-rw-r--r--Lib/javascript/jsc/std_pair.i6
-rw-r--r--Lib/javascript/jsc/std_vector.i14
-rw-r--r--Lib/javascript/v8/javascriptcode.swg27
-rw-r--r--Lib/javascript/v8/javascriptcomplex.swg2
-rw-r--r--Lib/javascript/v8/javascripthelpers.swg29
-rw-r--r--Lib/javascript/v8/javascriptinit.swg22
-rw-r--r--Lib/javascript/v8/javascriptprimtypes.swg14
-rw-r--r--Lib/javascript/v8/javascriptrun.swg82
-rw-r--r--Lib/javascript/v8/javascriptruntime.swg2
-rw-r--r--Lib/javascript/v8/javascriptstrings.swg8
-rw-r--r--Lib/javascript/v8/std_complex.i7
-rw-r--r--Lib/javascript/v8/std_map.i16
-rw-r--r--Lib/javascript/v8/std_pair.i6
-rw-r--r--Lib/javascript/v8/std_vector.i14
-rw-r--r--Lib/lua/lua.swg2
-rw-r--r--Lib/lua/luarun.swg69
-rw-r--r--Lib/lua/luaruntime.swg5
-rw-r--r--Lib/lua/luatypemaps.swg14
-rw-r--r--Lib/lua/std_map.i16
-rw-r--r--Lib/lua/std_pair.i20
-rw-r--r--Lib/lua/std_string.i2
-rw-r--r--Lib/lua/std_vector.i11
-rw-r--r--Lib/lua/typemaps.i2
-rw-r--r--Lib/modula3/modula3.swg2
-rw-r--r--Lib/mzscheme/mzrun.swg2
-rw-r--r--Lib/mzscheme/mzscheme.swg1
-rw-r--r--Lib/mzscheme/std_map.i228
-rw-r--r--Lib/mzscheme/std_pair.i20
-rw-r--r--Lib/mzscheme/std_vector.i22
-rw-r--r--Lib/mzscheme/stl.i3
-rw-r--r--Lib/mzscheme/typemaps.i13
-rw-r--r--Lib/ocaml/carray.i9
-rw-r--r--Lib/ocaml/class.swg1
-rw-r--r--Lib/ocaml/cstring.i2
-rw-r--r--Lib/ocaml/director.swg6
-rw-r--r--Lib/ocaml/extra-install.list1
-rw-r--r--Lib/ocaml/libswigocaml.h20
-rw-r--r--Lib/ocaml/ocaml.i14
-rw-r--r--Lib/ocaml/ocaml.swg823
-rw-r--r--Lib/ocaml/ocamlkw.swg10
-rw-r--r--Lib/ocaml/ocamlrun.swg607
-rw-r--r--Lib/ocaml/ocamlrundec.swg (renamed from Lib/ocaml/ocamldec.swg)129
-rw-r--r--Lib/ocaml/std_common.i1
-rw-r--r--Lib/ocaml/std_except.i23
-rw-r--r--Lib/ocaml/std_list.i30
-rw-r--r--Lib/ocaml/std_map.i16
-rw-r--r--Lib/ocaml/std_pair.i6
-rw-r--r--Lib/ocaml/std_string.i16
-rw-r--r--Lib/ocaml/std_vector.i13
-rw-r--r--Lib/ocaml/stl.i2
-rw-r--r--Lib/ocaml/swig.ml11
-rw-r--r--Lib/ocaml/swig.mli1
-rw-r--r--Lib/ocaml/typecheck.i73
-rw-r--r--Lib/ocaml/typemaps.i405
-rw-r--r--Lib/octave/boost_shared_ptr.i128
-rw-r--r--Lib/octave/director.swg24
-rw-r--r--Lib/octave/octcontainer.swg18
-rw-r--r--Lib/octave/octiterators.swg2
-rw-r--r--Lib/octave/octprimtypes.swg12
-rw-r--r--Lib/octave/octrun.swg149
-rw-r--r--Lib/octave/octruntime.swg63
-rw-r--r--Lib/octave/octstdcommon.swg23
-rw-r--r--Lib/octave/std_basic_string.i47
-rw-r--r--Lib/octave/std_complex.i7
-rw-r--r--Lib/octave/std_deque.i2
-rw-r--r--Lib/octave/std_list.i2
-rw-r--r--Lib/octave/std_pair.i16
-rw-r--r--Lib/octave/stl.i6
-rw-r--r--Lib/perl5/cni.i12
-rw-r--r--Lib/perl5/jstring.i48
-rw-r--r--Lib/perl5/perlrun.swg13
-rw-r--r--Lib/perl5/perltypemaps.swg8
-rw-r--r--Lib/perl5/std_list.i8
-rw-r--r--Lib/perl5/std_map.i16
-rw-r--r--Lib/perl5/std_pair.i8
-rw-r--r--Lib/perl5/std_vector.i23
-rw-r--r--Lib/perl5/stl.i3
-rw-r--r--Lib/perl5/typemaps.i10
-rw-r--r--Lib/php/const.i3
-rw-r--r--Lib/php/globalvar.i23
-rw-r--r--Lib/php/php.swg28
-rw-r--r--Lib/php/phpinit.swg6
-rw-r--r--Lib/php/phpkw.swg139
-rw-r--r--Lib/php/phprun.swg19
-rw-r--r--Lib/php/std_map.i16
-rw-r--r--Lib/php/std_pair.i6
-rw-r--r--Lib/php/std_vector.i14
-rw-r--r--Lib/php/stl.i2
-rw-r--r--Lib/php/utils.i6
-rw-r--r--Lib/php5/const.i51
-rw-r--r--Lib/php5/director.swg170
-rw-r--r--Lib/php5/factory.i109
-rw-r--r--Lib/php5/globalvar.i361
-rw-r--r--Lib/php5/php.swg529
-rw-r--r--Lib/php5/phpinit.swg25
-rw-r--r--Lib/php5/phpkw.swg866
-rw-r--r--Lib/php5/phppointers.i42
-rw-r--r--Lib/php5/phprun.swg280
-rw-r--r--Lib/php5/std_common.i10
-rw-r--r--Lib/php5/std_deque.i1
-rw-r--r--Lib/php5/std_map.i76
-rw-r--r--Lib/php5/std_pair.i34
-rw-r--r--Lib/php5/std_string.i79
-rw-r--r--Lib/php5/std_vector.i102
-rw-r--r--Lib/php5/stl.i12
-rw-r--r--Lib/php5/typemaps.i322
-rw-r--r--Lib/php5/utils.i114
-rw-r--r--Lib/pike/pike.swg2
-rw-r--r--Lib/python/boost_shared_ptr.i117
-rw-r--r--Lib/python/builtin.swg91
-rw-r--r--Lib/python/cni.i2
-rw-r--r--Lib/python/defarg.swg2
-rw-r--r--Lib/python/director.swg40
-rw-r--r--Lib/python/jstring.i72
-rw-r--r--Lib/python/pyabc.i14
-rw-r--r--Lib/python/pyapi.swg19
-rw-r--r--Lib/python/pybuffer.i54
-rw-r--r--Lib/python/pycontainer.swg86
-rw-r--r--Lib/python/pydocs.swg21
-rw-r--r--Lib/python/pyerrors.swg42
-rw-r--r--Lib/python/pyhead.swg152
-rw-r--r--Lib/python/pyinit.swg147
-rw-r--r--Lib/python/pyiterators.swg75
-rw-r--r--Lib/python/pyname_compat.i3
-rw-r--r--Lib/python/pyrun.swg448
-rw-r--r--Lib/python/pyruntime.swg7
-rw-r--r--Lib/python/pystdcommon.swg23
-rw-r--r--Lib/python/pystrings.swg32
-rw-r--r--Lib/python/pythonkw.swg2
-rw-r--r--Lib/python/pythreads.swg4
-rw-r--r--Lib/python/pytypemaps.swg2
-rw-r--r--Lib/python/pyuserdir.swg5
-rw-r--r--Lib/python/pywstrings.swg24
-rw-r--r--Lib/python/std_basic_string.i74
-rw-r--r--Lib/python/std_complex.i9
-rw-r--r--Lib/python/std_deque.i2
-rw-r--r--Lib/python/std_list.i2
-rw-r--r--Lib/python/std_map.i8
-rw-r--r--Lib/python/std_multimap.i16
-rw-r--r--Lib/python/std_set.i10
-rw-r--r--Lib/python/std_unordered_map.i267
-rw-r--r--Lib/python/std_unordered_multimap.i48
-rw-r--r--Lib/python/std_unordered_multiset.i28
-rw-r--r--Lib/python/std_unordered_set.i39
-rw-r--r--Lib/python/stl.i5
-rw-r--r--Lib/r/boost_shared_ptr.i136
-rw-r--r--Lib/r/r.swg7
-rw-r--r--Lib/r/rrun.swg16
-rw-r--r--Lib/r/rstdcommon.swg18
-rw-r--r--Lib/r/rtype.swg24
-rw-r--r--Lib/r/srun.swg4
-rw-r--r--Lib/r/std_shared_ptr.i2
-rw-r--r--Lib/r/stl.i17
-rw-r--r--Lib/ruby/boost_shared_ptr.i104
-rw-r--r--Lib/ruby/cni.i2
-rw-r--r--Lib/ruby/director.swg37
-rw-r--r--Lib/ruby/jstring.i44
-rw-r--r--Lib/ruby/ruby.swg2
-rw-r--r--Lib/ruby/rubycontainer.swg22
-rw-r--r--Lib/ruby/rubycontainer_extended.swg2
-rw-r--r--Lib/ruby/rubyhead.swg3
-rw-r--r--Lib/ruby/rubyiterators.swg2
-rw-r--r--Lib/ruby/rubyrun.swg17
-rw-r--r--Lib/ruby/rubystdcommon.swg36
-rw-r--r--Lib/ruby/rubystdcommon_forward.swg15
-rw-r--r--Lib/ruby/rubytracking.swg13
-rw-r--r--Lib/ruby/rubyuserdir.swg2
-rw-r--r--Lib/ruby/rubywstrings.swg92
-rw-r--r--Lib/ruby/std_basic_string.i67
-rw-r--r--Lib/ruby/std_complex.i7
-rw-r--r--Lib/ruby/std_deque.i2
-rw-r--r--Lib/ruby/std_list.i3
-rw-r--r--Lib/ruby/std_multimap.i7
-rw-r--r--Lib/ruby/std_multiset.i2
-rw-r--r--Lib/ruby/std_queue.i2
-rw-r--r--Lib/ruby/std_shared_ptr.i139
-rw-r--r--Lib/ruby/std_stack.i2
-rw-r--r--Lib/ruby/std_string.i4
-rw-r--r--Lib/ruby/std_unordered_map.i83
-rw-r--r--Lib/ruby/std_unordered_multimap.i100
-rw-r--r--Lib/ruby/std_unordered_multiset.i50
-rw-r--r--Lib/ruby/std_unordered_set.i50
-rw-r--r--Lib/ruby/std_wstring.i49
-rw-r--r--Lib/ruby/stl.i2
-rw-r--r--Lib/scilab/boost_shared_ptr.i121
-rw-r--r--Lib/scilab/scicontainer.swg7
-rw-r--r--Lib/scilab/sciexception.swg2
-rw-r--r--Lib/scilab/sciiterators.swg2
-rw-r--r--Lib/scilab/scirun.swg107
-rw-r--r--Lib/scilab/sciruntime.swg6
-rw-r--r--Lib/scilab/scistdcommon.swg33
-rw-r--r--Lib/scilab/scitypemaps.swg4
-rw-r--r--Lib/scilab/std_basic_string.i3
-rw-r--r--Lib/scilab/std_map.i20
-rw-r--r--Lib/scilab/std_pair.i6
-rw-r--r--Lib/scilab/std_shared_ptr.i2
-rw-r--r--Lib/scilab/stl.i6
-rw-r--r--Lib/shared_ptr.i4
-rw-r--r--Lib/std/std_alloc.i4
-rw-r--r--Lib/std/std_array.i4
-rw-r--r--Lib/std/std_carray.swg4
-rw-r--r--Lib/std/std_common.i2
-rw-r--r--Lib/std/std_container.i2
-rw-r--r--Lib/std/std_ios.i8
-rw-r--r--Lib/std/std_iostream.i6
-rw-r--r--Lib/std/std_list.i4
-rw-r--r--Lib/std/std_map.i3
-rw-r--r--Lib/std/std_multimap.i3
-rw-r--r--Lib/std/std_multiset.i2
-rw-r--r--Lib/std/std_pair.i16
-rw-r--r--Lib/std/std_queue.i4
-rw-r--r--Lib/std/std_set.i4
-rw-r--r--Lib/std/std_stack.i4
-rw-r--r--Lib/std/std_streambuf.i2
-rw-r--r--Lib/std/std_unordered_map.i27
-rw-r--r--Lib/std/std_unordered_multimap.i25
-rw-r--r--Lib/std/std_unordered_multiset.i39
-rw-r--r--Lib/std/std_unordered_set.i29
-rw-r--r--Lib/std/std_vector.i22
-rw-r--r--Lib/std_except.i2
-rw-r--r--Lib/swig.swg4
-rw-r--r--Lib/swigfragments.swg86
-rw-r--r--Lib/swiginit.swg6
-rw-r--r--Lib/swigrun.swg1
-rw-r--r--Lib/tcl/cni.i2
-rw-r--r--Lib/tcl/jstring.i42
-rw-r--r--Lib/tcl/mactkinit.c8
-rw-r--r--Lib/tcl/std_map.i16
-rw-r--r--Lib/tcl/std_pair.i6
-rw-r--r--Lib/tcl/std_vector.i20
-rw-r--r--Lib/tcl/stl.i1
-rw-r--r--Lib/tcl/tclapi.swg2
-rw-r--r--Lib/tcl/tclrun.swg5
-rw-r--r--Lib/typemaps/fragments.swg77
-rw-r--r--Lib/typemaps/swigmacros.swg11
-rw-r--r--Lib/typemaps/swigtype.swg48
-rw-r--r--Lib/windows.i3
-rw-r--r--METADATA18
-rw-r--r--Makefile.in87
-rw-r--r--OWNERS1
-rw-r--r--README8
-rw-r--r--RELEASENOTES39
-rw-r--r--Source/CParse/cparse.h3
-rw-r--r--Source/CParse/cscanner.c121
-rw-r--r--Source/CParse/parser.y1041
-rw-r--r--Source/CParse/templ.c86
-rw-r--r--Source/CParse/util.c4
-rw-r--r--Source/DOH/base.c19
-rw-r--r--Source/DOH/doh.h11
-rw-r--r--Source/DOH/dohint.h1
-rw-r--r--Source/DOH/file.c97
-rw-r--r--Source/DOH/memory.c4
-rw-r--r--Source/DOH/string.c41
-rw-r--r--Source/Doxygen/doxycommands.h170
-rw-r--r--Source/Doxygen/doxyentity.cxx69
-rw-r--r--Source/Doxygen/doxyentity.h45
-rw-r--r--Source/Doxygen/doxyparser.cxx1439
-rw-r--r--Source/Doxygen/doxyparser.h372
-rw-r--r--Source/Doxygen/doxytranslator.cxx69
-rw-r--r--Source/Doxygen/doxytranslator.h90
-rw-r--r--Source/Doxygen/javadoc.cxx845
-rw-r--r--Source/Doxygen/javadoc.h169
-rw-r--r--Source/Doxygen/pydoc.cxx911
-rw-r--r--Source/Doxygen/pydoc.h203
-rw-r--r--Source/Include/swigconfig.h.in93
-rw-r--r--Source/Include/swigwarn.h15
-rw-r--r--Source/Makefile.am27
-rw-r--r--Source/Makefile.in1408
-rw-r--r--Source/Modules/allegrocl.cxx281
-rw-r--r--Source/Modules/allocate.cxx2
-rw-r--r--Source/Modules/chicken.cxx4
-rw-r--r--Source/Modules/csharp.cxx199
-rw-r--r--Source/Modules/d.cxx94
-rw-r--r--Source/Modules/directors.cxx215
-rw-r--r--Source/Modules/emit.cxx74
-rw-r--r--Source/Modules/go.cxx97
-rw-r--r--Source/Modules/guile.cxx2
-rw-r--r--Source/Modules/interface.cxx14
-rw-r--r--Source/Modules/java.cxx271
-rw-r--r--Source/Modules/javascript.cxx61
-rw-r--r--Source/Modules/lang.cxx81
-rw-r--r--Source/Modules/lua.cxx14
-rw-r--r--Source/Modules/main.cxx92
-rw-r--r--Source/Modules/modula3.cxx8
-rw-r--r--Source/Modules/module.cxx59
-rw-r--r--Source/Modules/mzscheme.cxx24
-rw-r--r--Source/Modules/ocaml.cxx287
-rw-r--r--Source/Modules/octave.cxx76
-rw-r--r--Source/Modules/overload.cxx43
-rw-r--r--Source/Modules/perl5.cxx79
-rw-r--r--Source/Modules/php.cxx142
-rw-r--r--Source/Modules/php5.cxx2858
-rw-r--r--Source/Modules/python.cxx1905
-rw-r--r--Source/Modules/r.cxx1411
-rw-r--r--Source/Modules/ruby.cxx122
-rw-r--r--Source/Modules/scilab.cxx192
-rw-r--r--Source/Modules/swigmain.cxx242
-rw-r--r--Source/Modules/swigmod.h42
-rw-r--r--Source/Modules/tcl8.cxx16
-rw-r--r--Source/Modules/typepass.cxx19
-rw-r--r--Source/Modules/uffi.cxx29
-rw-r--r--Source/Modules/utils.cxx2
-rw-r--r--Source/Preprocessor/cpp.c103
-rw-r--r--Source/Preprocessor/expr.c22
-rw-r--r--Source/Swig/cwrap.c11
-rw-r--r--Source/Swig/error.c19
-rw-r--r--Source/Swig/extend.c4
-rw-r--r--Source/Swig/getopt.c7
-rw-r--r--Source/Swig/misc.c85
-rw-r--r--Source/Swig/naming.c72
-rw-r--r--Source/Swig/parms.c16
-rw-r--r--Source/Swig/scanner.c83
-rw-r--r--Source/Swig/stype.c170
-rw-r--r--Source/Swig/swig.h7
-rw-r--r--Source/Swig/swigparm.h1
-rw-r--r--Source/Swig/swigscan.h2
-rw-r--r--Source/Swig/symbol.c57
-rw-r--r--Source/Swig/tree.c6
-rw-r--r--Source/Swig/typemap.c36
-rw-r--r--Source/Swig/typeobj.c82
-rw-r--r--Source/Swig/typesys.c212
-rw-r--r--TODO68
-rw-r--r--Tools/config/ax_boost_base.m4252
-rw-r--r--Tools/config/ax_compare_version.m48
-rw-r--r--Tools/config/ax_path_generic.m48
-rwxr-xr-xTools/config/compile348
-rwxr-xr-xTools/config/config.guess1480
-rwxr-xr-xTools/config/config.sub1801
-rwxr-xr-xTools/config/depcomp791
-rwxr-xr-xTools/config/install-sh518
-rwxr-xr-xTools/config/missing215
-rwxr-xr-xTools/config/ylwrap247
-rwxr-xr-xTools/mkdist.py129
-rwxr-xr-xTools/mkrelease.py65
-rwxr-xr-xTools/mkwindows.sh11
-rw-r--r--Tools/nuget-install.cmd2
-rwxr-xr-xTools/obs-buildlogs.py6
-rw-r--r--Tools/swig.gdb4
-rwxr-xr-xTools/testflags.py22
-rwxr-xr-xTools/travis-linux-install.sh107
-rwxr-xr-xTools/travis-osx-install.sh23
-rw-r--r--aclocal.m41141
-rw-r--r--appveyor.yml117
-rwxr-xr-xconfigure13300
-rw-r--r--configure.ac732
-rw-r--r--swig.spec.in4
-rw-r--r--vms/aaareadme.txt18
-rw-r--r--vms/build_end.com21
-rw-r--r--vms/build_init.com13
-rw-r--r--vms/build_swig.com1
-rw-r--r--vms/genbuild.py155
-rw-r--r--vms/logicals.com18
-rw-r--r--vms/scripts/build_all.com15
-rw-r--r--vms/scripts/compil_cparse.com98
-rw-r--r--vms/scripts/compil_doh.com106
-rw-r--r--vms/scripts/compil_modules1_1.com132
-rw-r--r--vms/scripts/compil_preprocessor.com94
-rw-r--r--vms/scripts/compil_swig.com122
-rw-r--r--vms/swigconfig.h2
1695 files changed, 75988 insertions, 27830 deletions
diff --git a/.gitignore b/.gitignore
index e94087e29..3e9f81f0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,21 +44,21 @@ pcre
# Generated by autogen.sh
CCache/autom4te.cache/
-CCache/config.h.in
-CCache/configure
-Source/Include/swigconfig.h.in
+#CCache/config.h.in
+#CCache/configure
+#Source/Include/swigconfig.h.in
Source/Include/swigconfig.h.in~
-Source/Makefile.in
-Tools/config/compile
-Tools/config/config.guess
-Tools/config/config.sub
-Tools/config/depcomp
-Tools/config/install-sh
-Tools/config/missing
-Tools/config/ylwrap
-aclocal.m4
+#Source/Makefile.in
+#Tools/config/compile
+#Tools/config/config.guess
+#Tools/config/config.sub
+#Tools/config/depcomp
+##Tools/config/install-sh
+#Tools/config/missing
+#Tools/config/ylwrap
+#aclocal.m4
autom4te.cache/
-configure
+#configure
# Generated by ./configure
CCache/Makefile
@@ -66,6 +66,7 @@ CCache/ccache_swig_config.h
CCache/config.h
CCache/config.log
CCache/config.status
+CCache/config_win32.h
Examples/Makefile
Examples/d/example.mk
Examples/guile/Makefile
@@ -85,6 +86,8 @@ swig.spec
# Build Artifacts
.dirstamp
CCache/ccache-swig
+CCache/ccache-swig.1
+CCache/web/ccache-swig-man.html
Lib/swigwarn.swg
Source/CParse/parser.c
Source/CParse/parser.h
@@ -149,11 +152,24 @@ Examples/guile/*/my-guile
Examples/test-suite/java/*/
Examples/java/*/*.java
!Examples/java/*/runme.java
+Examples/java/doxygen/javadocs
# Javascript
Examples/test-suite/javascript/*/
*.gyp
+# OCaml
+Examples/test-suite/ocaml/*.ml*
+Examples/test-suite/ocaml/*.cm*
+Examples/test-suite/ocaml/*_runme
+!Examples/test-suite/ocaml/*runme.ml
+Examples/ocaml/**/example.ml*
+Examples/ocaml/**/runme
+Examples/ocaml/**/runme_top
+Examples/ocaml/**/*.cm*
+Examples/ocaml/**/swig.ml*
+Examples/ocaml/**/swigp4.ml
+
# Octave
swigexample*.oct
Examples/test-suite/octave/*.oct
@@ -177,11 +193,16 @@ Examples/php/*/example.php
/__pycache__/
Examples/test-suite/python/*.py
!Examples/test-suite/python/*runme.py
-Examples/python/*/example.py
Examples/python/**/bar.py
Examples/python/**/base.py
+Examples/python/**/example.py
Examples/python/**/foo.py
+Examples/python/**/robin.py
+Examples/python/**/runme3.py
Examples/python/**/spam.py
+Examples/python/import_packages/module_is_init/pkg1/__init__.py
+Examples/python/import_packages/namespace_pkg/path4.zip
+Examples/python/doxygen/example.html
# R
Examples/test-suite/r/*.R
diff --git a/.travis.yml b/.travis.yml
index 27237815d..c9cbd7862 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,240 +5,400 @@ matrix:
os: linux
env: SWIGLANG=
sudo: required
- dist: trusty
- - compiler: gcc
- os: linux
- env: SWIGLANG=
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG= SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ env: SWIGLANG= GCC=4.4
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG= SWIG_CC=gcc-6 SWIG_CXX=g++-6
+ env: SWIGLANG= GCC=4.6
sudo: required
- dist: trusty
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=4.7
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=4.8
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=4.9
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=6
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=7
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=8
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=9
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=csharp
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=d
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=go
+ env: SWIGLANG=go VER=1.3
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=go VER=1.5
+ env: SWIGLANG=go VER=1.8
sudo: required
- dist: trusty
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=go VER=1.12
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=guile
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=java
sudo: required
- dist: trusty
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=javascript ENGINE=node VER=0.10
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=javascript ENGINE=node VER=4 CPP11=1
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=javascript ENGINE=node
+ env: SWIGLANG=javascript ENGINE=node VER=6 CPP11=1
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=javascript ENGINE=node VER=8 CPP11=1
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=javascript ENGINE=node VER=10 CPP11=1
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=jsc
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=v8
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=lua
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=lua VER=5.3
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=octave SWIGJOBS=-j2 # 3.8
+ env: SWIGLANG=mzscheme
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.0
+ env: SWIGLANG=ocaml
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.2 CPP11=1
+ env: SWIGLANG=octave SWIGJOBS=-j2
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=perl5
sudo: required
- dist: trusty
- - compiler: gcc
- os: linux
- env: SWIGLANG=php5
- sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=php VER=7.0
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=php VER=7.1
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python VER=2.4
+ env: SWIGLANG=php VER=7.2
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python VER=2.5
+ env: SWIGLANG=php VER=7.3
sudo: required
- dist: trusty
- - compiler: gcc
- os: linux
- env: SWIGLANG=python VER=2.6
- sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python # 2.7
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.2
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.3
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.4
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.5
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin VER=2.6
+ env: SWIGLANG=python PY3=3 VER=3.6
sudo: required
- dist: trusty
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin
sudo: required
- dist: trusty
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES="-builtin -O"
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1 PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.4
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.5
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.5 SWIGOPTPY3=
+ env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.7
sudo: required
- dist: trusty
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES="-builtin -O" PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.7 SWIGOPTPY3=
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-O
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python SWIG_FEATURES=-classic
+ env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.7
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=r
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=ruby VER=1.9.3
+ env: SWIGLANG=ruby VER=1.9
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=ruby VER=2.0.0
+ env: SWIGLANG=ruby VER=2.0
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=ruby VER=2.3.0
+ env: SWIGLANG=ruby VER=2.1
sudo: required
- dist: trusty
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.2
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.3
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.4
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.5
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.6
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=scilab
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=tcl
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=csharp SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ env: SWIGLANG=csharp CPP11=1
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=java SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ env: SWIGLANG=go VER=1.6 CPP11=1
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=python SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ env: SWIGLANG=java CPP11=1
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.4 CPP11=1
sudo: required
dist: trusty
- os: linux
- env: SWIGLANG=csharp SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
+ env: SWIGLANG=python CPP11=1
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=java SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
+ env: SWIGLANG=r CPP11=1 # Note: making 'R CMD SHLIB' use a different compiler is non-trivial
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=python SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
+ env: SWIGLANG=ruby CPP11=1
sudo: required
- dist: trusty
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=tcl CPP11=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=csharp GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=go VER=1.6 GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=ruby GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=tcl GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java GCC=7 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python GCC=7 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=csharp GCC=8 CPP17=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java GCC=8 CPP17=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python GCC=8 CPP17=1 PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=csharp GCC=9 CPP17=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java GCC=9 CPP17=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python GCC=9 CPP17=1 PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
- compiler: gcc
os: osx
env: SWIGLANG=
@@ -262,10 +422,10 @@ matrix:
env: SWIGLANG=lua
- compiler: clang
os: osx
- env: SWIGLANG=perl5
+ env: SWIGLANG=octave SWIGJOBS=-j2
- compiler: clang
os: osx
- env: SWIGLANG=php5
+ env: SWIGLANG=perl5
- compiler: clang
os: osx
env: SWIGLANG=python
@@ -278,39 +438,54 @@ matrix:
- compiler: clang
os: osx
env: SWIGLANG=tcl
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=java CPP17=1
+ osx_image: xcode10.2
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=python PY3=3 CPP17=1
+ osx_image: xcode10.2
allow_failures:
- # Lots of failing tests currently
+ # seg fault in director_basic testcase
- compiler: gcc
os: linux
- env: SWIGLANG=ocaml
+ env: SWIGLANG=php VER=7.2
sudo: required
- dist: trusty
- # Not quite working yet
+ dist: xenial
+ # Sometimes hits the Travis 50 minute time limit
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=octave SWIGJOBS=-j2
+ # Experimental languages
- compiler: gcc
os: linux
- env: SWIGLANG=python SWIG_FEATURES=-O
+ env: SWIGLANG=mzscheme
sudo: required
- dist: trusty
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ocaml
+ sudo: required
+ dist: xenial
+
before_install:
- date -u
- uname -a
- if test "$TRAVIS_OS_NAME" = "linux"; then lscpu && cat /proc/cpuinfo | grep "model name" && cat /proc/meminfo | grep MemTotal; fi
- if test "$TRAVIS_OS_NAME" = "osx"; then sysctl -a | grep brand_string; fi
- # Travis overrides CC environment with compiler predefined values
- - if test -n "$SWIG_CC"; then export CC="$SWIG_CC"; fi
- - if test -n "$SWIG_CXX"; then export CXX="$SWIG_CXX"; fi
+ # Travis overrides CC environment with compiler predefined values
+ - if test -n "$GCC"; then export CC="gcc-$GCC" && export CXX="g++-$GCC"; fi
install:
- if test "$TRAVIS_OS_NAME" = "linux"; then source Tools/travis-linux-install.sh; fi
- if test "$TRAVIS_OS_NAME" = "osx"; then source Tools/travis-osx-install.sh; fi
- - if test -n "$CPP11"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++11 -Wall -Wextra" "CFLAGS=-std=c11 -Wall -Wextra") && export CSTD=c11 && export CPPSTD=c++11; fi
- - if test -n "$CPP14"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++14 -Wall -Wextra" "CFLAGS=-std=c11 -Wall -Wextra") && export CSTD=c11 && export CPPSTD=c++14; fi
- - ls -la $(which $CC)
- - ls -la $(which $CXX)
- - $CC --version
- - $CXX --version
+ - ls -la $(which $CC) $(which $CXX) && $CC --version && $CXX --version
script:
- echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r'
+ - if test -n "$CPP11"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++11 -Wall -Wextra" "CFLAGS=-std=c11 -Wall -Wextra") && export CSTD=c11 && export CPPSTD=c++11; fi
+ - if test -n "$CPP14"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++14 -Wall -Wextra" "CFLAGS=-std=c11 -Wall -Wextra") && export CSTD=c11 && export CPPSTD=c++14; fi
+ - if test -n "$CPP17"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++17 -Wall -Wextra" "CFLAGS=-std=c17 -Wall -Wextra") && export CSTD=c17 && export CPPSTD=c++17; fi
- if test -n "$SWIGLANG"; then CONFIGOPTS+=(--without-alllang --with-$WITHLANG); fi
- echo "${CONFIGOPTS[@]}"
- ./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}"
diff --git a/ANNOUNCE b/ANNOUNCE
index 2c7c5a7ce..495f101c7 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,8 +1,8 @@
-*** ANNOUNCE: SWIG 3.0.12 (27 Jan 2017) ***
+*** ANNOUNCE: SWIG 4.0.1 (21 Aug 2019) ***
http://www.swig.org
-We're pleased to announce SWIG-3.0.12, the latest SWIG release.
+We're pleased to announce SWIG-4.0.1, the latest SWIG release.
What is SWIG?
=============
@@ -10,13 +10,11 @@ What is SWIG?
SWIG is a software development tool that reads C/C++ header files and
generates the wrapper code needed to make C and C++ code accessible
from other programming languages including Perl, Python, Tcl, Ruby,
-PHP, C#, Go, Java, Javascript, Lua, Scheme (Guile, MzScheme, CHICKEN),
-D, Ocaml, Pike, Modula-3, Octave, R, Scilab, Common Lisp (CLISP,
-Allegro CL, CFFI, UFFI). SWIG can also export its parse tree in
-the form of XML and Lisp s-expressions. Major applications of SWIG
-include generation of scripting language extension modules, rapid
-prototyping, testing, and user interface development for large
-C/C++ systems.
+PHP, C#, Go, Java, Javascript, Lua, Scheme (Guile, MzScheme), D,
+Ocaml, Octave, R, Scilab. SWIG can also export its parse tree in
+the form of XML. Major applications of SWIG include generation of
+scripting language extension modules, rapid prototyping, testing,
+and user interface development for large C/C++ systems.
Release Notes
=============
@@ -27,11 +25,11 @@ Availability
============
The release is available for download on Sourceforge at
- http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz
+ http://prdownloads.sourceforge.net/swig/swig-4.0.1.tar.gz
A Windows version is also available at
- http://prdownloads.sourceforge.net/swig/swigwin-3.0.12.zip
+ http://prdownloads.sourceforge.net/swig/swigwin-4.0.1.zip
Please report problems with this release to the swig-devel mailing list,
details at http://www.swig.org/mail.html.
diff --git a/CCache/Makefile.in b/CCache/Makefile.in
index 67fd3f363..d1bb8c526 100644
--- a/CCache/Makefile.in
+++ b/CCache/Makefile.in
@@ -8,6 +8,7 @@ bindir=@bindir@
mandir=@mandir@
INSTALLCMD=@INSTALL@
PACKAGE_NAME=@PACKAGE_NAME@
+PROGRAM_NAME=@PROGRAM_NAME@
# Soft link test can be skipped on systems that don't support soft linking
NOSOFTLINKSTEST=
@@ -17,13 +18,10 @@ SWIG=swig
SWIG_LIB=../$(srcdir)/../Lib
EXEEXT=@EXEEXT@
-# Use standard autoconf approach to transform executable name using --program-prefix and --program-suffix
-transform = @program_transform_name@
-
LIBS= @LIBS@
OBJS= ccache.o mdfour.o hash.o execute.o util.o args.o stats.o \
cleanup.o snprintf.o unify.o
-HEADERS = ccache.h mdfour.h
+HEADERS = ccache.h mdfour.h config.h config_win32.h
all: $(PACKAGE_NAME)$(EXEEXT)
@@ -32,7 +30,7 @@ Makefile: $(srcdir)/Makefile.in ./config.status
$(SHELL) ./config.status
# Note that HTML documentation is actually generated and used from the main SWIG documentation Makefile
-docs: $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/ccache-man.html
+docs: $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html
$(PACKAGE_NAME)$(EXEEXT): $(OBJS) $(HEADERS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
@@ -40,40 +38,43 @@ $(PACKAGE_NAME)$(EXEEXT): $(OBJS) $(HEADERS)
$(srcdir)/$(PACKAGE_NAME).1: $(srcdir)/ccache.yo
-yodl2man -o $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/ccache.yo
-$(srcdir)/web/ccache-man.html: $(srcdir)/ccache.yo
- yodl2html -o $(srcdir)/web/ccache-man.html $(srcdir)/ccache.yo
+$(srcdir)/web/$(PACKAGE_NAME)-man.html: $(srcdir)/ccache.yo
+ yodl2html -o $(srcdir)/web/$(PACKAGE_NAME)-man.html $(srcdir)/ccache.yo
install: $(PACKAGE_NAME)$(EXEEXT)
@echo "Installing $(PACKAGE_NAME)"
- @echo "Installing $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)"
+ @echo "Installing $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT)"
${INSTALLCMD} -d $(DESTDIR)${bindir}
- ${INSTALLCMD} -m 755 $(PACKAGE_NAME)$(EXEEXT) $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)
+ ${INSTALLCMD} -m 755 $(PACKAGE_NAME)$(EXEEXT) $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT)
install-docs: $(srcdir)/$(PACKAGE_NAME).1
- @echo "Installing $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1"
+ @echo "Installing $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1"
${INSTALLCMD} -d $(DESTDIR)${mandir}/man1
- ${INSTALLCMD} -m 644 $(srcdir)/$(PACKAGE_NAME).1 $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1
+ ${INSTALLCMD} -m 644 $(srcdir)/$(PACKAGE_NAME).1 $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1
uninstall: $(PACKAGE_NAME)$(EXEEXT)
- rm -f $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)
+ rm -f $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT)
uninstall-docs: $(srcdir)/$(PACKAGE_NAME).1
- rm -f $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1
+ rm -f $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1
-clean:
+clean: clean-docs
/bin/rm -f $(OBJS) *~ $(PACKAGE_NAME)$(EXEEXT)
+clean-docs:
+ rm -f $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html
+
test: test.sh
- SWIG_LIB='$(SWIG_LIB)' PATH=../..:$$PATH SWIG='$(SWIG)' CC='$(CC)' NOSOFTLINKSTEST='$(NOSOFTLINKSTEST)' $(srcdir)/test.sh
+ SWIG_LIB='$(SWIG_LIB)' PATH=../..:$$PATH SWIG='$(SWIG)' CC='$(CC)' NOSOFTLINKSTEST='$(NOSOFTLINKSTEST)' CCACHE='../$(PACKAGE_NAME)' CCACHE_PROG=$(PROGRAM_NAME) $(srcdir)/test.sh
check: test
distclean: clean
- /bin/rm -f Makefile config.h config.sub config.log build-stamp config.status ccache_swig_config.h
+ /bin/rm -f Makefile config.h config.sub config.log build-stamp config.status ccache_swig_config.h config_win32.h
/bin/rm -rf autom4te.cache
maintainer-clean: distclean
- /bin/rm -f $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/ccache-man.html
+ /bin/rm -f $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html
# FIXME: To fix this, test.sh needs to be able to take ccache from the
diff --git a/CCache/ccache.h b/CCache/ccache.h
index a79d88322..25e786496 100644
--- a/CCache/ccache.h
+++ b/CCache/ccache.h
@@ -6,7 +6,7 @@
#include "config.h"
#else
#include <sys/locking.h>
-#define PACKAGE_NAME "ccache-swig.exe"
+#include "config_win32.h"
#endif
#include <stdio.h>
@@ -51,7 +51,7 @@
#define STATUS_FATAL 4
#define STATUS_NOCACHE 5
-#define MYNAME PACKAGE_NAME
+#define MYNAME PROGRAM_NAME
#define LIMIT_MULTIPLE 0.8
diff --git a/CCache/config.h.in b/CCache/config.h.in
new file mode 100644
index 000000000..5b7748bf1
--- /dev/null
+++ b/CCache/config.h.in
@@ -0,0 +1,121 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you would like to have zlib compression for ccache. */
+#undef ENABLE_ZLIB
+
+/* Define to 1 if you have the `asprintf' function. */
+#undef HAVE_ASPRINTF
+
+/* */
+#undef HAVE_C99_VSNPRINTF
+
+/* */
+#undef HAVE_COMPAR_FN_T
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#undef HAVE_CTYPE_H
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the `getpwuid' function. */
+#undef HAVE_GETPWUID
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mkstemp' function. */
+#undef HAVE_MKSTEMP
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
+/* Define to 1 if you have the `realpath' function. */
+#undef HAVE_REALPATH
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `utimes' function. */
+#undef HAVE_UTIMES
+
+/* Define to 1 if you have the `vasprintf' function. */
+#undef HAVE_VASPRINTF
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define my program name */
+#undef PROGRAM_NAME
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define _GNU_SOURCE so that we get all necessary prototypes */
+#undef _GNU_SOURCE
diff --git a/CCache/config_win32.h.in b/CCache/config_win32.h.in
new file mode 100644
index 000000000..2d5ab97e3
--- /dev/null
+++ b/CCache/config_win32.h.in
@@ -0,0 +1,3 @@
+#if !defined(PROGRAM_NAME)
+#define PROGRAM_NAME "@PROGRAM_NAME@.exe"
+#endif
diff --git a/CCache/configure b/CCache/configure
new file mode 100755
index 000000000..b863aeacd
--- /dev/null
+++ b/CCache/configure
@@ -0,0 +1,5175 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for ccache-swig 0.0.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='ccache-swig'
+PACKAGE_TARNAME='ccache-swig'
+PACKAGE_VERSION='0.0'
+PACKAGE_STRING='ccache-swig 0.0'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+ac_unique_file="ccache.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+EGREP
+GREP
+PROGRAM_NAME
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+runstatedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_zlib
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir runstatedir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures ccache-swig 0.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/ccache-swig]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of ccache-swig 0.0:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-zlib enable zlib support for ccache compression
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+ccache-swig configure 0.0
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by ccache-swig $as_me 0.0, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ # Get version from SWIG in ccache_swig_config.h.in
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring ccache" >&5
+$as_echo "$as_me: Configuring ccache" >&6;}
+
+ac_config_headers="$ac_config_headers config.h"
+
+ac_config_files="$ac_config_files config_win32.h"
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+ # for program_transform_name
+
+
+if test "x$program_prefix" != "xNONE" -a "x$program_prefix" != "x"
+then
+ PROGRAM_NAME="$program_prefix$PACKAGE_NAME"
+else
+ PROGRAM_NAME="$PACKAGE_NAME"
+fi
+if test "x$program_suffix" != "xNONE" -a "x$program_suffix" != "x"
+then
+ PROGRAM_NAME="$PROGRAM_NAME$program_suffix"
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define PROGRAM_NAME "$PROGRAM_NAME"
+_ACEOF
+
+
+
+$as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+
+# If GCC, turn on warnings.
+if test "x$GCC" = "xyes"
+then
+ CFLAGS="$CFLAGS -Wall -W"
+else
+ CFLAGS="$CFLAGS -O"
+fi
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if eval \${$as_ac_Header+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$as_ac_Header=yes"
+else
+ eval "$as_ac_Header=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$as_ac_Header
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_opendir+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_opendir+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if ${ac_cv_header_time+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_time=yes
+else
+ ac_cv_header_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
+$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
+if ${ac_cv_header_sys_wait_h+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+ int s;
+ wait (&s);
+ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_sys_wait_h=yes
+else
+ ac_cv_header_sys_wait_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
+$as_echo "$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in ctype.h strings.h stdlib.h string.h pwd.h sys/time.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_func in realpath snprintf vsnprintf vasprintf asprintf mkstemp
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_func in gethostname getpwuid
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_func in utimes
+do :
+ ac_fn_c_check_func "$LINENO" "utimes" "ac_cv_func_utimes"
+if test "x$ac_cv_func_utimes" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UTIMES 1
+_ACEOF
+
+fi
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compar_fn_t in stdlib.h" >&5
+$as_echo_n "checking for compar_fn_t in stdlib.h... " >&6; }
+if ${ccache_cv_COMPAR_FN_T+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+int
+main ()
+{
+
+void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ccache_cv_COMPAR_FN_T=yes
+else
+ ccache_cv_COMPAR_FN_T=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ccache_cv_COMPAR_FN_T" >&5
+$as_echo "$ccache_cv_COMPAR_FN_T" >&6; }
+if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
+
+$as_echo "#define HAVE_COMPAR_FN_T 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 vsnprintf" >&5
+$as_echo_n "checking for C99 vsnprintf... " >&6; }
+if ${ccache_cv_HAVE_C99_VSNPRINTF+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+if test "$cross_compiling" = yes; then :
+ ccache_cv_HAVE_C99_VSNPRINTF=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <sys/types.h>
+#include <stdarg.h>
+void foo(const char *format, ...) {
+ va_list ap;
+ int len;
+ char buf[5];
+
+ va_start(ap, format);
+ len = vsnprintf(0, 0, format, ap);
+ va_end(ap);
+ if (len != 5) exit(1);
+
+ if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
+
+ exit(0);
+}
+main() { foo("hello"); }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ccache_cv_HAVE_C99_VSNPRINTF=yes
+else
+ ccache_cv_HAVE_C99_VSNPRINTF=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ccache_cv_HAVE_C99_VSNPRINTF" >&5
+$as_echo "$ccache_cv_HAVE_C99_VSNPRINTF" >&6; }
+if test x"$ccache_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
+
+$as_echo "#define HAVE_C99_VSNPRINTF 1" >>confdefs.h
+
+fi
+
+# Check whether --enable-zlib was given.
+if test "${enable_zlib+set}" = set; then :
+ enableval=$enable_zlib;
+else
+ enable_zlib=yes
+fi
+
+
+if test x"$enable_zlib" = x"yes"; then
+ ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzdopen in -lz" >&5
+$as_echo_n "checking for gzdopen in -lz... " >&6; }
+if ${ac_cv_lib_z_gzdopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gzdopen ();
+int
+main ()
+{
+return gzdopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_z_gzdopen=yes
+else
+ ac_cv_lib_z_gzdopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzdopen" >&5
+$as_echo "$ac_cv_lib_z_gzdopen" >&6; }
+if test "x$ac_cv_lib_z_gzdopen" = xyes; then :
+ LIBS="-lz $LIBS"
+
+$as_echo "#define ENABLE_ZLIB 1" >>confdefs.h
+
+fi
+
+fi
+
+
+fi
+
+ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by ccache-swig $as_me 0.0, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Report bugs to the package provider."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+ccache-swig config.status 0.0
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "config_win32.h") CONFIG_FILES="$CONFIG_FILES config_win32.h" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+ ;;
+
+
+ esac
+
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/CCache/configure.ac b/CCache/configure.ac
index dfbf86dbc..e1c761860 100644
--- a/CCache/configure.ac
+++ b/CCache/configure.ac
@@ -7,6 +7,7 @@ AC_CONFIG_SRCDIR([ccache.h])
AC_MSG_NOTICE([Configuring ccache])
AC_CONFIG_HEADER(config.h)
+AC_CONFIG_FILES([config_win32.h])
dnl Checks for programs.
AC_PROG_CC
@@ -14,6 +15,20 @@ AC_PROG_CPP
AC_PROG_INSTALL
AC_ARG_PROGRAM # for program_transform_name
+AC_SUBST(PROGRAM_NAME)
+if test "x$program_prefix" != "xNONE" -a "x$program_prefix" != "x"
+then
+ PROGRAM_NAME="$program_prefix$PACKAGE_NAME"
+else
+ PROGRAM_NAME="$PACKAGE_NAME"
+fi
+if test "x$program_suffix" != "xNONE" -a "x$program_suffix" != "x"
+then
+ PROGRAM_NAME="$PROGRAM_NAME$program_suffix"
+fi
+
+AC_DEFINE_UNQUOTED(PROGRAM_NAME, "$PROGRAM_NAME", [Define my program name])
+
AC_DEFINE([_GNU_SOURCE], 1,
[Define _GNU_SOURCE so that we get all necessary prototypes])
diff --git a/CCache/snprintf.c b/CCache/snprintf.c
index 32187c1a5..9bf8a817b 100644
--- a/CCache/snprintf.c
+++ b/CCache/snprintf.c
@@ -292,6 +292,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
break;
case 'X':
flags |= DP_F_UP;
+ /* FALLTHROUGH */
case 'x':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
@@ -314,6 +315,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
break;
case 'E':
flags |= DP_F_UP;
+ /* FALLTHROUGH */
case 'e':
if (cflags == DP_C_LDOUBLE)
fvalue = va_arg (args, LDOUBLE);
@@ -322,6 +324,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
break;
case 'G':
flags |= DP_F_UP;
+ /* FALLTHROUGH */
case 'g':
if (cflags == DP_C_LDOUBLE)
fvalue = va_arg (args, LDOUBLE);
diff --git a/CCache/test.sh b/CCache/test.sh
index 438e782cd..3c44e859c 100755
--- a/CCache/test.sh
+++ b/CCache/test.sh
@@ -20,7 +20,12 @@ fi
PATH="`echo $PATH | \
sed -e 's!:/usr\(/local\)*/lib\([0-9]\)*/ccache\(/\)*!!g'`"
-CCACHE=../ccache-swig
+if test -n "$CCACHE"; then
+ CCACHE="$CCACHE"
+else
+ CCACHE=../ccache-swig
+fi
+
TESTDIR=test.$$
test_failed() {
@@ -406,6 +411,10 @@ swigtests() {
# main program
rm -rf $TESTDIR
mkdir $TESTDIR
+if test -n "$CCACHE_PROG"; then
+ ln -s $CCACHE $TESTDIR/$CCACHE_PROG
+ CCACHE=./$CCACHE_PROG
+fi
cd $TESTDIR || exit 1
unset CCACHE_DIR
@@ -442,14 +451,16 @@ swigtests
if test -z "$NOSOFTLINKSTEST"; then
testsuite="link"
- ln -s $CCACHE $COMPILER
- CCACHE_COMPILE="./$COMPILER"
+ compilername=`basename $COMPILER`
+ ln -s $CCACHE ./$compilername
+ CCACHE_COMPILE="./$compilername"
basetests
- rm "./$COMPILER"
- ln -s $CCACHE $SWIG
- CCACHE_COMPILE="./$SWIG"
+ rm "./$compilername"
+ compilername=`basename $SWIG`
+ ln -s $CCACHE ./$compilername
+ CCACHE_COMPILE="./$compilername"
swigtests
- rm "./$SWIG"
+ rm "./$compilername"
else
echo "skipping testsuite link"
fi
diff --git a/CHANGES b/CHANGES
index 5884efbf5..7fd6b6da2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,1669 @@ See the RELEASENOTES file for a summary of changes in each release.
Issue # numbers mentioned below can be found on Github. For more details, add
the issue number to the end of the URL: https://github.com/swig/swig/issues/
+Version 4.0.0 (27 Apr 2019)
+===========================
+
+2019-04-24: vadz
+ #1517 Fix crash if "@return" Doxygen tag was used on a node without any return type.
+
+2019-04-24: vadz
+ #1515 Fix parsing of enums with trailing comma when using -doxygen.
+
+2019-04-19: ianlancetaylor
+ [Go] #1055 When generating Go code, make -cgo the default. Add new -no-cgo option
+ to disable the default.
+
+2019-04-19: pbecherer
+ [Tcl] #1508 Fix Visual Studio 2015 and later compilation errors due to snprintf macro
+ definition.
+
+2019-04-09: wsfulton
+ [C#] Fix FxCop warning CA2002 in SWIGPendingException - a lock on a reference of
+ type 'Type'.
+
+2019-03-30: wsfulton
+ [Java, D] Add the parameters typemap attribute to the javadestruct,
+ javadestruct_derived, ddispose, ddispose_derived typemaps to mirror enhanced
+ flexibility in the csdisposing and csdisposing_derived (C#) typemaps. If provided
+ the contents are generated as the delete/dispose method's parameters declaration.
+
+2019-03-30: wsfulton
+ [C#] #421 Fix FxCop warning CA1063 by implementing the recommended Dispose methods for
+ the IDisposable interface. Previously just the Dispose() method was generated.
+ Now the Dispose() and Dispose(bool disposing) methods are generated.
+ Changes are required if custom "csfinalize", "csdestruct" or "csdestruct_derived"
+ typemaps are being used. Details in #421 on Github. SWIG will error out if one of
+ the "csfinalize, "csdestruct" or "csdestruct_derived" typemaps are found. Example
+ error message:
+
+ foo.h:60: Error: A deprecated csfinalize typemap was found for Foo, please remove
+ it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the
+ csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2019-03-25: Liryna
+ [C#] #1143 Add std_list.i for std::list support.
+ The C# std::list<T> wrappers are made to look and feel like a C#
+ System.Collections.Generic.LinkedList<> collection.
+ The IEnumerable<> interface is implemented in the proxy class.
+ The ICollection<> interface can also be implemented to provide enhanced functionality
+ whenever a C++ operator== is available. This is the case for when T is a
+ primitive type or a pointer. If T does define an operator==, then use the
+ SWIG_STD_LIST_ENHANCED macro to obtain this enhanced functionality, for example:
+
+ SWIG_STD_LIST_ENHANCED(SomeNamespace::Klass)
+ %template(ListKlass) std::list<SomeNamespace::Klass>;
+
+2019-03-18: richardbeare
+ [R] #1328 Non-trivial enums are working now. The enum values are now obtained from
+ the C/C++ layer. const reference enums and C++11 enum classes are also now working.
+
+2019-03-14: mochizk
+ [Javascript] #1500 Fix compilation errors due to deprecating V8 API in Node.js.
+ New V8 API is used if node.js >= v10.12, or if V8 >= v7.0.
+
+2019-03-12: vadz
+ [C#] #1495 Add std_set.i for std::set support.
+
+2019-03-11: dirteat,opoplawski
+ [Octave] Fix compilation errors in Octave 5.1.
+
+ error: format not a string literal and no format arguments [-Werror=format-security]
+
+2019-02-28: wsfulton
+ [Java] std::vector improvements for types that do not have a default constructor.
+
+ The std::vector wrappers have been changed to work by default for elements that are
+ not default insertable, i.e. have no default constructor. This has been achieved by
+ not wrapping:
+
+ vector(size_type n);
+
+ Previously the above had to be ignored via %ignore.
+
+ If the above constructor is still required it can be added back in again via %extend:
+
+ %extend std::vector {
+ vector(size_type count) { return new std::vector< T >(count); }
+ }
+
+ Alternatively, the following wrapped constructor could be used as it provides near-enough
+ equivalent functionality:
+
+ vector(jint count, const value_type& value);
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2019-02-25: wsfulton
+ [Python] Fix compile errors wrapping overloaded functions/constructors where a vararg
+ function is declared after a non-vararg function.
+
+2019-02-23: zphensley42
+ Use fully qualified name 'java.lang.Object' instead of 'Object' in generated code to
+ avoid clashes with wrapped C++ classes called 'Object'.
+
+2019-02-23: gtbX
+ [Java] #1035 Add (const char *STRING, size_t LENGTH) typemaps in addition to the non-const
+ typemaps (char *STRING, size_t LENGTH) which does not attempt to write back to the const
+ string.
+
+2019-02-22: tamuratak
+ [Ruby] #984 Add support for RTypedData introduced in Ruby 1.9.3.
+
+2019-02-22: ZackerySpytz
+ #1483 Fix compilation failures when a director class has final methods.
+
+2019-02-21: wsfulton
+ [Java] #1240 Suppress Java 9 deprecation warnings on finalize method.
+
+2019-02-21: ZackerySpytz
+ #1480 Fix some rejections of valid floating-point literals.
+
+2019-02-19: wsfulton
+ #1475 Fix regression parsing gcc preprocessor linemarkers in the form:
+
+ # linenum filename flags
+
+2019-02-18: jakecobb
+ [Python] #945 #1234 Elements in std::vector memory access fix.
+
+ Accessing an element in a std::vector obtains a reference to the element via an
+ iterator pointing to the element in the container. If the vector is garbage collected,
+ the SWIG wrapper containing the pointer to the element becomes invalid. The fix is
+ to obtain a back-reference to the container by the wrapper to the element in the Python
+ layer to prevent the garbage collector from destroying the underlying container.
+
+2019-02-17: wsfulton
+ Fix typemap matching to expand template parameters when the name contains
+ template parameters. In the %typemap below the type is T and the name is X<T>::make
+ and the name now expands correctly to X< int >::make
+
+ template<typename T> struct X {
+ %typemap(out) T X<T>::make "..."
+ T make();
+ };
+
+ %template(Xint) X<int>;
+
+2019-02-16: wsfulton
+ Fix parser error containing multiple #define statements inside an enum.
+
+ The second #define fails to parse:
+
+ enum FooEnum {
+ ENUM1 = 0,
+ ENUM2 = 1,
+
+ #define MACRO_DEF1 "Hello"
+ #define MACRO_DEF2 "World!"
+
+ ENUM3 = 2,
+ ENUM4 = 3,
+ };
+
+ Bug mentioned at https://sourceforge.net/p/swig/patches/333/
+
+2019-02-14: wsfulton
+ Add some missing copy constructors into STL containers.
+
+2019-02-14: bkotzz
+ [Java] #1356 Add STL containers:
+ std::unordered_map
+ std::unordered_set
+ std::set
+
+2019-02-14: bkotzz
+ [Java] #1356 std::map wrappers have been modified. Now the Java proxy class
+ extends java.util.AbstractMap. The std::map container looks and feels much like
+ a java.util.HashMap from Java.
+
+ A few members have changed their names. If the old method signatures are needed,
+ then copy std_map.i from swig-3.0.12 and use that instead. Alternatively,
+ add the old missing methods to the new methods by using the following %proxycode:
+
+ %extend std::map {
+ %proxycode %{
+ // Old API
+ public boolean empty() {
+ return isEmpty();
+ }
+ public void set($typemap(jboxtype, K) key, $typemap(jboxtype, T) x) {
+ put(key, x);
+ }
+ public void del($typemap(jboxtype, K) key) {
+ remove(key);
+ }
+ public boolean has_key($typemap(jboxtype, K) key) {
+ return containsKey(key);
+ }
+ %}
+ }
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2019-02-13: ZackerySpytz
+ #1469 Add support for C++17 hexadecimal floating literals.
+
+2019-02-11: wsfulton
+ [OCaml] #1437 OCaml has been give the 'Experimental' language status. The examples work
+ and most of the test-suite is also working, so it is quite close to being a 'Supported' language.
+
+2019-02-10: ZackerySpytz
+ #1464 Add support for C++14 binary integer literals.
+
+2019-02-10: ZackerySpytz
+ #1450 Add support for C++11 UCS-2 and UCS-4 character literals. Also, add support for
+ C++17 UTF-8 character literals.
+
+2019-02-10: wsfulton
+ [MzScheme] #1437 MzScheme/Racket is now an 'Experimental' language. The examples work
+ and a large portion of the test-suite is also working.
+
+2019-02-10: wsfulton
+ [MzScheme] Destructor wrappers were not being generated.
+
+2019-02-10: wsfulton
+ [MzScheme] Static variable wrappers fixed - $argnum was not expanded.
+
+2019-02-10: sethrj
+ #1452 Fix %apply for anonymous template instantiations
+
+2019-02-09: olly
+ [PHP] Fix access to already released memory during PHP module
+ shutdown, which often didn't cause visible problems, but could
+ result in segmentation faults, bus errors, etc. Fixes #1170,
+ reported by Jitka Plesníková.
+
+2019-02-09: olly
+ [PHP] A renamed constructor is now wrapped as a static method in
+ PHP.
+
+2019-02-08: olly
+ [PHP] Don't generate code which references $r when $r hasn't been
+ defined. This could happen in overloaded methods which returned
+ void and took at least one const std::string& parameter.
+
+2019-02-08: olly
+ [PHP] The generated code is now compatible with PHP 7.3, and the
+ testsuite now runs cleanly with this version too.
+
+2019-02-05: wsfulton
+ #1437 SWIG now classifies the status of target languages into either 'Experimental' or
+ 'Supported'. This status is provided to indicate the level of maturity to expect when using
+ a particular target language as not all target languages are fully developed. Details are
+ in the Introduction.html chapter of the documentation.
+
+2019-02-04: wsfulton
+ [CFFI] #1447 Common Lisp CFFI has been disabled as a target language in SWIG as part of a
+ clean up to remove target languages that have been neglected/not functional.
+
+2019-02-04: wsfulton
+ [Allegrocl] #1447 Allegro Common Lisp has been disabled as a target language in SWIG as part of a
+ clean up to remove target languages that have been neglected/not functional.
+
+2019-02-04: wsfulton
+ [Chicken] #1447 CHICKEN has been disabled as a target language in SWIG as part of a
+ clean up to remove target languages that have been neglected/not functional.
+
+2019-02-04: wsfulton
+ [CLISP] #1447 GNU Common Lisp has been disabled as a target language in SWIG as part of a
+ clean up to remove target languages that have been neglected/not functional.
+
+2019-02-04: wsfulton
+ [S-EXP] #1447 Common Lisp S-Exp has been disabled as a target language in SWIG as part of a
+ clean up to remove target languages that have been neglected/not functional.
+
+2019-02-04: wsfulton
+ [UFFI] #1447 Common Lisp UFFI has been disabled as a target language in SWIG as part of a
+ clean up to remove target languages that have been neglected/not functional.
+
+2019-02-04: wsfulton
+ [Pike] #1447 Pike has been disabled as a target language in SWIG as part of a
+ clean up to remove target languages that have been neglected/not functional.
+
+2019-02-04: wsfulton
+ [Modula3] #1447 Modula3 has been disabled as a target language in SWIG as part of a
+ clean up to remove target languages that have been neglected/not functional.
+
+2019-02-02: ahnolds
+ [Python] Documentation enhancements for Python:
+
+ #728 Fixed the handling of autodoc when using -fastproxy.
+
+ #1367 Added documentation to wrapped member variables using the
+ property(... doc="...") construct.
+
+ Only show a single documentation entry for functions with default arguments when
+ using autodoc.
+
+ Fixed a bug where a cached doxygen docstring could be deleted while still in use,
+ causing swig to segfault.
+
+2019-01-31: olly
+ SWIG now requires a target language to be specified instead of
+ defaulting to wrapping for Tcl. Specifying swig --help without
+ a target language now just shows the generic help. The -nolang
+ option has been removed.
+
+2019-01-28: ZackerySpytz
+ [OCaml] #1429 Remove support for OCaml versions < 3.12.0.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2019-01-22: vadz
+ [Ruby, Octave] #1424 Improve autodoc parameter naming.
+
+2019-01-22: vadz
+ [Python] #1271 #1423 Always include default parameter values in autodoc strings.
+
+2019-01-19: vadz
+ #1272, #1421 When a function's parameter is a keyword, the name of the paramater is
+ no longer simply changed to argN, where N is the argument number. Instead the
+ parameter name is changed to the renaming rules for keywords that normally apply to
+ symbols such as classes/functions etc. Note that unlike other symbol renaming,
+ parameter renaming does not issue a warning when the parameter is renamed. This
+ change only affects languages where the parameter names are actually used, for example,
+ Java function parameter lists in the proxy class or Python documentation comments.
+
+2019-01-18: wsfulton
+ #1420 Fix gdb debugger functions 'swigprint' and 'locswigprint' from swig.gdb to
+ work with newer versions of gdb-8. Fixes errors when debugging SWIG source with gdb:
+
+ (gdb) swigprint n
+ Undefined command: "Printf". Try "help".
+
+2019-01-16: wsfulton
+ Python static method wrapper changes
+
+ - Static method wrappers were using the 'fastproxy' approach by default.
+ This is inconsistent with instance method wrappers. The fastproxy approach
+ is now turned off by default to be consistent with instance methods.
+ Static method wrappers can now also be controlled using the -fastproxy and
+ -olddefs options.
+
+ Example:
+
+ struct Klass {
+ static int statmethod(int a = 2);
+ };
+
+ generates by default:
+
+ class Klass(object):
+ ...
+ @staticmethod
+ def statmethod(a=2):
+ return _example.Klass_statmethod(a)
+
+ instead of the following (which can be restored by using -fastproxy):
+
+ class Klass(object):
+ ...
+ statmethod = staticmethod(_example.Klass_statmethod)
+
+ - Modernise wrappers for static methods to use decorator syntax - @staticmethod.
+
+ - Add missing runtime test for static class methods and using the actual class method.
+
+2019-01-12: ZackerySpytz
+ [OCaml] #1403 #1194 Fix compilation problems for OCaml >= 4.03.0 due to OCaml using
+ int64_t instead of int64.
+
+2019-01-11: ZackerySpytz
+ [OCaml] #1400 Fix the getters and setters of non-static member variables.
+
+2019-01-07: wsfulton
+ #358 Add VOID to windows.i
+
+2019-01-05: wsfulton
+ #948 #1019 #1273 Fix for C++11 raw strings where the delimiters were mistakenly left
+ in the string contents in situations where the string was copied into generated code.
+ For example, %constant, the "docstring" feature and for C#/Java/D constants turned on
+ with %javaconst/%csconst/%dmanifestconst.
+
+2019-01-05: wsfulton
+ [Ruby] #538. Fix Ruby support for %feature("docstring").
+
+2019-01-03: wsfulton
+ #1202 Fix overloading of non-pointer class types in scripting languages when overloaded
+ with a pointer and a NULL scripting language equivalent is used, eg None in Python.
+
+ The implementation changes the SWIGTYPE, SWIGTYPE& and SWIGTYPE&& typecheck typemaps to
+ prevent accepting a conversion to a NULL pointer.
+
+2019-01-03: ZackerySpytz
+ [OCaml] #1386 Fix the OCaml examples and test suite for out-of-source builds.
+
+2019-01-01: wsfulton
+ [Python] #639 remove duplicate proxy method definitions for global function wrappers.
+
+ Global functions previously generated two definitions, eg:
+
+ def foo():
+ return _example.foo()
+ foo = _example.foo
+
+ The first definition is replaced by the second definition and so the second definition
+ is the one used when the method is actually called. Now just the first definition is
+ generated by default and if the -fastproxy command line option is used, just the second
+ definition is generated. The second definition is faster as it avoids the proxy Python
+ method as it calls the low-level C wrapper directly. Using both -fastproxy and -olddefs
+ command line options will restore the previously generated code as it will generate both
+ method definitions.
+
+ With this change, the wrappers for global C/C++ functions and C++ class methods now work
+ in the same way wrt to generating just a proxy method by default and control via
+ -fastproxy/-olddefs options.
+
+2018-12-20: hasinoff,wsfulton
+ [Java] #1334 Set Java thread name to native thread name when using directors.
+
+ Default is to use name "Thread-XXX" and is still works like this by default. However,
+ adding the following will turn on the thread name setting (works for more recent
+ versions of Linux and MacOS):
+
+ %begin %{
+ #define SWIG_JAVA_USE_THREAD_NAME
+ %}
+
+2018-12-20: chlandsi
+ [Python] #1357. Fix overriding __new__ in Python 3.6.
+
+ Fixes SystemError: Objects/tupleobject.c:81: bad argument to internal function"
+
+2018-12-16: wsfulton
+ [Python] #848 #1343 The module import logic has changed to stop obfuscating real ImportError
+ problems. Only one import of the low-level C/C++ module from the pure Python module is
+ attempted now. Previously a second import of the low-level C/C++ module was attempted
+ after an ImportError occurred and was done to support 'split modules'. A 'split module' is
+ a configuration where the pure Python module is a module within a Python package and the
+ low-level C/C++ module is a global Python module. Now a 'split module' configuration is
+ no longer supported by default. This configuration can be supported with a simple
+ customization, such as:
+
+ %module(package="mypackage", moduleimport="import $module") foo
+
+ or if using -builtin:
+
+ %module(package="mypackage", moduleimport="from $module import *") foo
+
+ instead of
+
+ %module(package="mypackage") foo
+
+ See the updated Python chapter titled "Location of modules" in the documentation.
+
+2018-12-11: tlby
+ [Perl] #1374 repair EXTEND() handling in typemaps
+
+2018-12-06: vadz
+ #1359 #1364 Add missing nested class destructor wrapper when the nested class is
+ inside a template. Removes associated bogus 'Illegal destructor name' warning. Only
+ occurred when the nested class' destructor is explicitly specified.
+
+2018-12-04: adr26
+ [Python] #1368 #1369 Access Violation in tp_print caused by mismatched Python/extension
+ CRT usage
+
+ Remove all use of tp_print, as this API uses a FILE*, which can be
+ mismatched when modules are built with different C libraries from
+ the main python executable.
+
+ This change also brings consistent output between Python 2 and 3 for the 'cvar' SWIG
+ object (that contains the global variables) and SWIG packed objects (such as callback
+ constants).
+
+2018-12-04: wsfulton
+ [Python] #1282 Fix running 'python -m' when using 'swig -builtin'
+
+ Similar to the earlier PEP 366 conforming fix for non-builtin.
+
+2018-11-29: adr26
+ [Python] #1360 Leak of SWIG var link object
+
+ Fix reference counting on _SWIG_globals to allow var link to be freed on module unload.
+
+2018-11-28: wsfulton
+ [Python] When using -builtin, the two step C-extension module import is now
+ one step and the wrapped API is only available once and not in an underlying
+ module attribute like it is without -builtin. To understand this, consider a
+ module named 'example' (using: %module example). The C-extension is compiled into
+ a Python module called '_example' and a pure Python module provides the actual
+ API from the module called 'example'. It was previously possible to additionally
+ access the API from the module attribute 'example._example'. The latter was an
+ implementation detail and is no longer available. It shouldn't have been used, but
+ if necessary it can be resurrected using the moduleimport attribute described in the
+ Python chapter of the documentation. If both modules are provided in a Python
+ package, try:
+
+ %module(moduleimport="from . import _example\nfrom ._example import *") example
+ or more generically:
+ %module(moduleimport="from . import $module\nfrom .$module import *") example
+
+ and if both are provided as global modules, try:
+
+ %module(moduleimport="import _example\nfrom _example import *") example
+ or more generically:
+ %module(moduleimport="import $module\nfrom $module import *") example
+
+ The module import code shown will appear in the example.py file.
+
+2018-11-24: vadz
+ #1358 Fix handling of abstract base classes nested inside templates
+
+ Correct detecting of whether a derived class method overrides a pure virtual
+ base class method when both classes are nested inside a template class: this
+ notably didn't work correctly for methods taking parameters of the base class
+ type.
+
+2018-11-22: rupertnash
+ [Python] #1282 Make generated module runnable via python -m (PEP 366 conforming)
+
+ Previously any SWIG generated modules in a package would fail with an ImportError
+ when using 'python -m' for example 'python -m mypkg.mymodule'.
+
+ This fix also allows the SWIG generated module to be placed into a directory and
+ then renamed __init__.py to convert the module into a package again. This ability
+ stopped working in swig-3.0.9. However, only Python 2.7 or 3.3 and later work. If
+ Python 3.2 support is needed, use moduleimport in %module to customise the import
+ code.
+
+2018-11-13: wsfulton
+ #1340 Remove -cppcast and -nocppcast command line options (this was an option
+ available to the scripting language targets).
+
+ The -cppcast option is still turned on by default. The -nocppcast option
+ to turn off the use of c++ casts (const_cast, static_cast etc) has been
+ removed. However, defining SWIG_NO_CPLUSPLUS_CAST will still generate C casts
+ instead of C++ casts for C++ wrappers.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-11-13: wsfulton
+ [Python] #1340 Remove -outputtuple and -nooutputtuple command line options.
+
+ Both the command line and %module options of the same name have been
+ removed. These were undocumented. The -outputtuple option returned a
+ Python tuple instead of a list, mostly typically in the OUTPUT
+ typemap implementations.
+
+ It unclear why a tuple instead of a list return type is needed and
+ hence this option has been removed as part of the simplification of
+ the SWIG Python command line options for SWIG 4.
+
+2018-11-13: wsfulton
+ [Python] #1340 Remove -noproxyimport command line option.
+
+ This option turned off the insertion of Python import statements
+ derived from a %import directive. For example given:
+
+ %module module_b
+ %import "module_a.i"
+
+ then module_b.py will contain:
+
+ import module_a
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-10-29: AlexanderGabriel
+ [PHP] The following PHP7 reserved keywords are now only renamed by
+ SWIG when used as function names in the API being wrapper:
+ __halt_compiler array die echo empty eval exit include include_once
+ isset list print require require_once return unset
+
+2018-10-22: olly,wsfulton
+ [Python] #1261 #1340 Turn on many optimisation options by default and rationalise the
+ number of command line options.
+
+ There were an unnecessary number of command line options and many of these have now
+ been removed in a drive for simplification. Some were needed to support older versions
+ of Python (2.6 and earlier).
+
+ Many of the options could be turned on individually and when using -O. Previously -O
+ resulted in turning on a set of options:
+
+ -modern -fastdispatch -nosafecstrings -fvirtual -noproxydel
+ -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone
+
+ Now -O results in turning on this reduced set:
+
+ -fastdispatch -fastproxy -fvirtual
+
+ The following options are now on by default, a deprecated warning is displayed if they
+ are used:
+ -fastinit Class initialisation code done in C/C++ rather than in Python code.
+ -fastquery Python dictionary used for lookup of types.
+ -fastunpack Faster unpacking of function arguments in C/C++ wrappers.
+ -modern Use Python 2.3 features such as object and property.
+ -modernargs Use Python 2.3 C APIs for unpacking arguments in tuples.
+ -noproxydel Stop generating a proxy __del__ method for backwards compatiblity.
+ -safecstrings No discernable difference
+
+ The following options have been removed altogether:
+ -aliasobj0
+ -buildnone
+ -classptr
+ -new_repr
+ -newrepr
+ -noaliasobj0
+ -nobuildnone
+ -nocastmode
+ -nodirvtable
+ -noextranative
+ -nofastinit
+ -nofastproxy
+ -nofastquery
+ -nomodern
+ -nomodernargs
+ -nooutputtuple
+ -nosafecstrings
+ -old_repr
+ -oldrepr
+ -proxydel
+
+ -new_vwm is no longer supported. Use the -newvwm alias instead.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-10-22: olly
+ [Python] #1261 Remove command line option no longer needed as Python 2.3 and earlier
+ are no longer supported:
+
+ -classic
+
+2018-10-09: wsfulton
+ [D, Go, Guile, Lua, Mzscheme, Ocaml, Perl5, Php, Scilab, Tcl]
+ Allow wrapping of std::map using non-default comparison function.
+
+2018-10-09: vadz
+ [Java] #1274 Allow wrapping of std::map using non-default comparison function.
+
+2018-10-04: wsfulton
+ [Python] #1126 Fix C default arguments with -builtin and -fastunpack and -modernargs.
+ Problem occurred when there is just one (defaulted) parameter in the parameter list.
+
+2018-09-24: wsfulton
+ [Python] #1319 C++11 hash tables implementation is finished now (including for -builtin):
+ std::unordered_map
+ std::unordered_set
+ std::unordered_multimap
+ std::unordered_multiset
+
+2018-09-21: wsfulton
+ [Python] Fix when using -builtin and wrapping std::map, std::set, std::unordered_map or
+ std::unordered_set to ensure __contains__ is called. This is a wrapper for the STL
+ container's find method. Without it, Python will do its own slower sequence search.
+
+2018-09-19: wsfulton
+ [Python] Fix functors (wrapped as __call__) when using -builtin -modern -fastunpack.
+
+2018-09-02: andreas.gaeer,tkrasnukha
+ [Python] #1321 Fix assert in PyTuple_GET_SIZE in debug interpreter builds of python-3.7
+ when calling tp_new.
+
+2018-09-01: ChristopherHogan
+ [Guile] #1288 Fix garbage collection for guile >= 2.0.12.
+
+2018-08-31: wsfulton
+ [Python] #1319 C++11 hash tables support:
+ std::unordered_map
+ std::unordered_set
+ std::unordered_multimap
+ std::unordered_multiset
+ is now compiling and working (sorting using -builtin not fully functional yet though).
+
+2018-08-20: wkalinin
+ #1305 Fix nested structure symbol tables in C mode to fix member name conflicts
+ in different structs with the same nested struct member name.
+
+2018-08-18: wsfulton
+ [Python] #688 Fix makefile recursion when running python test-suite.
+
+2018-08-18: wsfulton
+ [Python] #1310 Re-implement Python -fastproxy option.
+
+ The previous implementation failed with Python 3 and abstract base clases.
+ The new implementation replaces the Python 2 implementation using
+ new.instancemethod with the C API PyMethod_New to match the equivalent Python 3
+ implementation which uses PyInstanceMethod_New.
+
+ The new approach runs slightly faster. See #1310.
+
+2018-08-12: gmazzamuto
+ [Python] #1283 Update pybuffer.i library to use new-style Python buffer C API.
+
+2018-08-12: brianhatwood,wsfulton
+ [Java] #1303 #1304 Fix crash in directors when using OUTPUT and INOUT typemaps in typemaps.i and
+ passing NULL pointers in C++ to director method overloaded and implemented in Java.
+
+2018-08-10: wsfulton
+ [Python] #1293 Improve TypeError message inconsistencies between default and fastdispatch
+ mode when handling overloaded C++ functions. Previously the error message did not always
+ display the possible C/C++ prototypes in fastdispatch mode.
+
+2018-08-02: furylynx,jacobwgillespie,p2k
+ [Javascript] #1290, #968. Add support for NodeJS versions 2-10.
+
+2018-07-31: wsfulton
+ [Python] #1293 Overloaded C++ function wrappers now raise a TypeError instead
+ of NotImplementedError when the types passed are incorrect. This change means
+ there is now consistency with non-overloaded function wrappers which have always
+ raised TypeError when the incorrect types are passed. The error message remains
+ the same and is for example now:
+
+ TypeError: Wrong number or type of arguments for overloaded function 'f'.
+ Possible C/C++ prototypes are:
+ f(int)
+ f(char const *)
+
+ instead of:
+
+ NotImplementedError: Wrong number or type of arguments for overloaded function 'f'.
+ Possible C/C++ prototypes are:
+ f(int)
+ f(char const *)
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-06-23: wsfulton
+ [Python] #718 Fix pythonnondynamic feature for modern classes
+
+ Fixes nondynamic mode when an instance variable is set with the same
+ name as a class variable in a class derived from a SWIG proxy class.
+ This corner case set an instance variable instead of raising an AttributeError.
+
+ Also fix %pythonnondynamic in Python 3 with -modern. The metaclass
+ containing the implementation was previously not being applied in Python 3.
+
+2018-07-17: petrmitrichev,wsfulton
+ [Python] #1275 #1279 Initialize function-local statics (singletons) that call Python
+ code during Python module initialization in order to avoid deadlocks with subsequent
+ multi-threaded usage.
+
+2018-06-15: wsfulton
+ [Python] Fix seg fault using Python 2 when passing a Python string, containing
+ invalid utf-8 content, to a wstring or wchar * parameter. A TypeError is thrown instead, eg:
+
+ %include <std_wstring.i>
+ void instring(const std::wstring& s);
+
+ instring(b"h\xe9llooo") # Python
+
+2018-06-15: wsfulton
+ [Python] Python 3.7 support: Replace use of deprecated PyUnicode_GetSize with
+ PyUnicode_GetLength to remove deprecated warnings compiling the C/C++ wrappers.
+
+2018-06-12: wsfulton
+ [Python] Python 3.7 support: The %pythonabc feature in pyabc.i now uses base classes
+ collections.abc.MutableSequence
+ collections.abc.MutableMapping
+ collections.abc.MutableSet
+ instead of
+ collections.MutableSequence
+ collections.MutableMapping
+ collections.MutableSet
+ as the latter are deprecated in Python 3.7 and are due to be removed in Python 3.8.
+ The classes in collections.abc.* are available from Python 3.3 onwards. If you
+ require support for Python 3.2, then copy the pyabc.i file and modify by removing
+ the few instances of the .abc sub-module.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-06-12: olly,wsfulton
+ [Python] #701 Remove support for Python versions < 2.7 and 3.0 and 3.1.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-06-11: olly
+ [Python] Fix new GCC8 warnings in generated code by avoiding casts
+ between incompatible function types where possible, and by
+ suppressing the warning when it's due to the design of Python's C
+ API. Fixes #1259.
+
+2018-06-08: philippkraft
+ [Python] Stop exposing <CLASS>_swigregister to Python. It's not
+ useful for user Python code to call this, and it just clutters the
+ API unnecessarily. Fixes #1225.
+
+2018-06-07: cmfoil, kabbi, Jamie Kirkpatrick, markok314, vadz, wsfulton, Yann Diorcet
+ #170 Doxygen documentation support added. This allows translation of Doxygen comments
+ into JavaDoc and PyDoc documentation. It is enabled via the -doxygen command line
+ option. See the Doxygen.html chapter in the documentation for further information.
+
+2018-06-07: olly
+ [PHP] We've finally removed support for %pragma(php4) which was
+ deprecated back in 2008. Use %pragma(php) instead, which has been
+ supported since at least 2005.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-06-07: olly
+ [PHP5] Support for PHP5 has been removed. PHP5 is no longer
+ actively supported by the PHP developers and security support for
+ it ends completely at the end of 2018, so it doesn't make sense
+ to include support for it in the upcoming SWIG 4.0.0 release.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-06-06: olly
+ [Lua] Improve configure probes for Lua headers and libs used in testsuite.
+
+2018-05-15: kwwette
+ [Octave] add support for version 4.4
+ - Should not introduce any user-visible incompatibilities
+
+2018-05-15: wsfulton
+ [C#, D, Java] Fix lookup of csconstruct, dconstruct and javaconstruct typemaps.
+ The C++ namespace was previously ignored when looking up the typemap.
+
+2018-05-15: wsfulton
+ [Javascript] Fix generated C++ code when using %nspace on namespaces that are more
+ than two levels deep.
+
+2018-05-14: wsfulton
+ Issue #1251 Add support for C++17 nested namespace definitions,
+ for example:
+ namespace A::B { ... }
+
+2018-05-11: wsfulton
+ [C#, D, Java] Add support so that the %csmethodmodifiers, %dmethodmodifiers,
+ %javamethodmodifiers can modify the method modifiers for the destructor wrappers
+ in the proxy class: dispose, Dispose, delete. With this feature, it is now possible
+ to make a C# proxy class sealed, eg when wrapping a class X, the virtual method modifiers
+ can be removed using:
+
+ %typemap(csclassmodifiers) X "public sealed class"
+ %csmethodmodifiers X::~X "public /*virtual*/";
+
+2018-04-18: olly
+ [Python] Suppress new pycodestyle warning:
+ E252 missing whitespace around parameter equals
+
+2018-04-07: goatshriek
+ [Ruby] #1213 Fix ruby %alias directive for global C/C++ functions.
+
+2018-04-03: olly
+ [Ruby] Fix to pass Qnil instead of NULL to rb_funcall(), which silences GCC
+ -Wconversion-null warning (on by default with recent GCC).
+
+2018-03-09: wsfulton
+ [Java] #1184 Fix swigReleaseOwnership() and swigTakeOwnership() regression
+ for non-director classes. Restores a dynamic_cast which was previously removed.
+
+2018-03-07: llongi
+ Github PR #1166 - Fix preprocessor handling of macros with commas
+ in a // comment.
+
+2018-02-18: JPEWdev
+ Patch #1164 - Add support for a command-line options file, also sometimes
+ called a response file. This is useful if the command-line options exceed
+ the system command-line length limit. To use, put the command-line options
+ into a file, then provide the file name prefixed with @, for example using
+ a file called args.txt:
+
+ swig @args.txt
+
+2018-02-11: wsfulton
+ [Javascript] #1187 Fix compilation error wrapping std::complex via
+ std_complex.i.
+
+2018-01-30: smarchetto
+ [Scilab] add type name argument in SWIG_ptr() function to cast from pointer address to typed pointers
+
+2018-01-16: wsfulton
+ Expressions following a preprocessor directive must now be separated by whitespace
+ or non-numeric characters. This syntax change makes the SWIG preprocessor work like
+ the C preprocessor in this area.
+
+ For example, the following code used be accepted as valid syntax:
+ #if1
+ #define ABC 123
+ #endif
+
+ Now you get an error:
+ example.h:1: Error: Unknown SWIG preprocessor directive: if1 (if this is a block of
+ target language code, delimit it with %{ and %})
+ example.h:3: Error: Extraneous #endif.
+
+ The following is the correct syntax:
+ #if 1
+ #define ABC 123
+ #endif
+
+ The following of course also works:
+ #if(1)
+ #define ABC 123
+ #endif
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2018-01-15: wsfulton
+ Fix issue #1183. Floating point exception evaluating preprocessor expressions
+ resulting in division by zero.
+
+2018-01-14: wsfulton
+ Fix issue #1172. Seg fault parsing invalid exponents in the preprocessor.
+
+2018-01-12: Liryna
+ [C#] Patch #1128. Add ToArray function to std::vector wrappers.
+
+2018-01-12: wsfulton
+ [Java] Fix issue #1156. Add missing throws clause for interfaces when using the
+ %interface family of macros.
+
+2018-01-05: wsfulton
+ Fix default arguments using expressions containing -> syntax error. Problem reported on
+ swig-user mailing list.
+
+2017-12-30: wsfulton
+ [Python] Replace pep8 with pycodestyle for checking the Python code style when
+ running Python tests.
+
+2017-12-30: davedissian
+ Fixed a symbol lookup issue when encountering a typedef of a symbol from the tag
+ namespace to the global namespace when the names are identical, such as 'typedef
+ struct Foo Foo;'.
+
+2017-12-13: wsfulton
+ [Perl] add missing support for directorfree typemaps.
+
+2017-12-13: wsfulton
+ Issue #1167 Fix directorout typemaps which were causing undefined behaviour when
+ returning pointers by reference.
+
+2017-12-08: olly
+ [PHP] Use ZEND_MODULE_GLOBALS_ACCESSOR to access globals so the
+ generated code builds when PHP was built with ZTS enabled.
+
+2017-12-04: wsfulton
+ [Python] Add missing checks for failures in calls to PyUnicode_AsUTF8String. Previously a
+ seg fault could occur when passing invalid UTF8 strings (low surrogates), eg passing
+ u"\udcff" to the C layer (Python 3).
+
+2017-11-24: joequant
+ [R] Fix #1124 and return R_NilValue for null pointers
+
+2017-11-29: wsfulton
+ [Java] director exception handling improvements.
+
+ When a director method throws an exception and it is caught by DirectorException
+ and passed back to Java using Swig::DirectorException::throwException, the Java
+ stack trace now contains the original source line that threw the exception.
+
+ Deprecate Swig::DirectorException::raiseJavaException, please replace usage with
+ Swig::DirectorException::throwException.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2017-10-26: wsfulton
+ Add support for C++11 ref-qualifiers when using directors.
+
+2017-10-26: wsfulton
+ Fix generated code when using directors and methods returning const ref pointers.
+
+2017-10-26: wsfulton
+ [C#, D, Java, Octave, R, Scilab] Port director typemaps to these additional languages.
+ Issue #700.
+
+2017-10-26: radarsat1
+ [Ruby Python] Patch #1029 - Correct handling of null using directors and shared_ptr.
+
+2017-10-10: joequant
+ [R] pass enum expressions to R. This will generate
+ incorrect files when there is an arithmetic expression
+ in the enum, but this is better than silently generating
+ incorrect code
+
+2017-10-09: olly
+ [PHP] Fix incorrect wrapper code generated when there's a
+ combination of overloading, parameters with a default value
+ and %newobject. Fixes https://sourceforge.net/p/swig/bugs/1350/
+
+2017-10-09: olly
+ Remove GCJ support. It isn't in a good state and doesn't seem to
+ be used, and GCC7 dropped GCJ. Closes
+ https://sourceforge.net/p/swig/bugs/823/
+
+2017-10-07: olly
+ Fix preprocessor handling of empty macro arguments to match that of
+ C/C++ compilers. Fixes issue #1111 and
+ https://sourceforge.net/p/swig/bugs/826/
+
+2017-10-06: wsfulton
+ [Python] Issue #1108. Fix platform inconsistency in Python default argument handling.
+ 32 bit and 64 bit compiled versions of SWIG generated different Python files
+ when default arguments were outside the range of 32 bit signed integers.
+ The default arguments specified in Python are now only those that are in the
+ range of a 32 bit signed integer, otherwise the default is obtained from C/C++ code.
+
+2017-10-02: wsfulton
+ [C#] Fix std::complex types passed by value.
+
+2017-10-02: wsfulton
+ [Javascript, Python, Ruby] Issue #732 - Missing type information for std::complex
+ in std_complex.i meant that previously std::complex always had to be fully qualified
+ in order to be wrapped with the appropriate typemaps.
+
+2017-10-01: joequant
+ allow R package names with docs
+ allowing multiple get accessors in R
+ fix smart-pointer and NAMESPACE support
+ constructors now returning smart pointers (if class
+ declared as such)
+ smart-pointer classes deriving from parent smart-pointers
+
+2017-09-29: wsfulton
+ Issue #1100 - Allow an instantiated template to have the same name in the target
+ language as the C++ template name, for example, this is now possible:
+
+ template<typename T> struct X { ... };
+ %template(X) X<int>;
+
+2017-09-23: wsfulton
+ Issue #1098. Fix overloading of shared_ptr with underlying pointer types, eg:
+
+ void m(std::shared_ptr<T> p);
+ void m(T &p);
+ void m(T *p);
+
+ Only the first method is wrapped and the others are ignored/shadowed.
+ The implementation is done via a new attribute in the 'typecheck' typemap called
+ 'equivalent'. If specified, it must contain the equivalent pointer type for overloading
+ and can only be used for the special SWIG_TYPECHECK_POINTER precedence level.
+ The shared_ptr 'typecheck' typemaps have been modified accordingly.
+ Here is a simplified version:
+
+ %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="T *")
+ T,
+ T CONST &,
+ T CONST *,
+ T *CONST&,
+ std::shared_ptr< T >,
+ std::shared_ptr< T > &,
+ std::shared_ptr< T > *,
+ std::shared_ptr< T > *&
+ { ... }
+
+ Overloading with any of these types will result in SWIG ignoring all but the first
+ overloaded method by default. Without the 'equivalent' attribute, wrapping the overloaded
+ methods resulted in types being shadowed (scripting languages) or code that did not
+ compile (statically typed languages).
+
+2017-09-19: futatuki
+ [Python] #1003 Add --with-2to3=/path/to/2to3 option to configure.
+
+2017-09-18: wsfulton
+ Fix type promotion wrapping constant expressions of the form:
+ # define EXPR_MIXED1 (0x80 + 11.1) - 1
+ This was previously an integral type instead of a floating point type.
+
+2017-09-17: wsfulton
+ Fix generated code for constant expressions containing wchar_t L literals such as:
+ # define __WCHAR_MAX (0x7fffffff + L'\0')
+ # define __WCHAR_MIN (-__WCHAR_MAX - 1)
+
+2017-09-10: mlamarre
+ [Python] Patch #1083. Define_DEBUG to 1 to do exactly like Visual Studio
+ /LDd, /MDd or /MTd compiler options.
+
+2017-08-25: wsfulton
+ Issue #1059. Add support for C++11 ref-qualifiers on non-static member functions.
+ Members with lvalue ref-qualifiers such as:
+
+ struct RQ {
+ void m1(int x) &;
+ void m2(int x) const &;
+ };
+
+ are wrapped like any other member function. Member functions with rvalue ref-qualifiers
+ are ignored by default, such as:
+
+ struct RQ {
+ void m3(int x) &&;
+ void m4(int x) const &&;
+ };
+
+ example.i:7: Warning 405: Method with rvalue ref-qualifier m3(int) && ignored.
+ example.i:8: Warning 405: Method with rvalue ref-qualifier m4(int) const && ignored.
+
+ These can be unignored and exposed to the target language, see further documentation in
+ CPlusPlus11.html.
+
+2017-08-16: wsfulton
+ Fix #1063. Add using declarations to templates into typedef table.
+
+ Using declarations to templates were missing in SWIG's internal typedef tables.
+ This led to a few problems, such as, templates that did not instantiate and generated
+ C++ code that did not compile as SWIG did not know what scope the template was
+ in. This happened mostly when a using declaration was used on a template type in a
+ completely unrelated namespace.
+
+2017-08-16: wsfulton
+ Fix type lookup in the presence of using directives and using declarations.
+
+ Fix some cases of type lookup failure via a combination of both using directives and
+ using declarations resulting in C++ code that did not compile as the generated type was
+ not fully qualified for use in the global namespace. Example below:
+
+ namespace Space5 {
+ namespace SubSpace5 {
+ namespace SubSubSpace5 {
+ struct F {};
+ }
+ }
+ using namespace SubSpace5;
+ using SubSubSpace5::F;
+ void func(SubSubSpace5::F f);
+ }
+
+2017-08-16: wsfulton
+ Issue #1051. %template scope enforcement and class definition fixes.
+
+ The scoping rules around %template have been specified and enforced.
+ The %template directive for a class template is the equivalent to an
+ explicit instantiation of a C++ class template. The scope for a valid
+ %template instantiation is now the same as the scope required for a
+ valid explicit instantiation of a C++ template. A definition of the
+ template for the explicit instantiation must be in scope where the
+ instantiation is declared and must not be enclosed within a different
+ namespace.
+
+ For example, a few %template and C++ explicit instantiations of std::vector
+ are shown below:
+
+ // valid
+ namespace std {
+ %template(vin) vector<int>;
+ template class vector<int>;
+ }
+
+ // valid
+ using namespace std;
+ %template(vin) vector<int>;
+ template class vector<int>;
+
+ // valid
+ using std::vector;
+ %template(vin) vector<int>;
+ template class vector<int>;
+
+ // ill-formed
+ namespace unrelated {
+ using std::vector;
+ %template(vin) vector<int>;
+ template class vector<int>;
+ }
+
+ // ill-formed
+ namespace unrelated {
+ using namespace std;
+ %template(vin) vector<int>;
+ template class vector<int>;
+ }
+
+ // ill-formed
+ namespace unrelated {
+ namespace std {
+ %template(vin) vector<int>;
+ template class vector<int>;
+ }
+ }
+
+ // ill-formed
+ namespace unrelated {
+ %template(vin) std::vector<int>;
+ template class std::vector<int>;
+ }
+
+ When the scope is incorrect, an error now occurs such as:
+
+ cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and
+ was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
+
+ Previously SWIG accepted the ill-formed examples above but this led to
+ numerous subtle template scope problems especially in the presence of
+ using declarations and using directives as well as with %feature and %typemap.
+
+ Actually, a valid instantiation is one which conforms to the C++03
+ standard as C++11 made a change to disallow using declarations and
+ using directives to find a template.
+
+ // valid C++03, ill-formed C++11
+ using std::vector;
+ template class vector<int>;
+
+ Similar fixes for defining classes using forward class references have
+ also been put in place. For example:
+
+ namespace Space1 {
+ struct A;
+ }
+ namespace Space2 {
+ struct Space1::A {
+ void x();
+ }
+ }
+
+ will now error out with:
+
+ cpp_class_definition.i:5: Error: 'Space1::A' resolves to 'Space1::A' and
+ was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
+
+ Previously some symbols would have been instantiated in the wrong scope and led
+ to lots of scope problems involving SWIG typemaps, features, renames etc.
+ You will need to correct the scope used in other SWIG directives which do not
+ support 'using declarations' and 'using directives'. For example, if you previously had:
+
+ %rename(Zap) vector<int>::clear;
+ using namespace std;
+ %template(VectorInt) vector<int>;
+
+ Prior versions of SWIG incorrectly instantiated vector<int> in the global namespace
+ and so the %rename matched. Now the template is instantiated in the correct namespace,
+ so is fully qualified as std::vector<int>. The other SWIG directives need correcting as
+ they do not follow 'using declarations' and 'using directives'. Change it to:
+
+ %rename(Zap) std::vector<int>::clear;
+ using namespace std;
+ %template(vin) vector<int>;
+
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2017-08-16: wsfulton
+ Fix scope lookup for template parameters containing unary scope operators.
+
+ Fixes cases like:
+
+ namespace Alloc {
+ template<typename T> struct Rebind {
+ typedef int Integer;
+ };
+ }
+ %template(RebindBucket) Alloc::Rebind< Bucket >;
+ OR
+ %template(RebindBucket) Alloc::Rebind< ::Bucket >;
+
+ Alloc::Rebind< Bucket >::Integer Bucket1();
+ Alloc::Rebind< ::Bucket >::Integer Bucket2();
+ Alloc::Rebind<::template TemplateBucket<double>>::Integer Bucket3();
+
+2017-08-16: wsfulton
+ For templates only, the template parameters are fully resolved when
+ handling typemaps. Without this, it is too hard to have decent rules
+ to apply typemaps when parameter types are typedef'd and template
+ parameters have default values.
+
+ Fixes %clear for typedefs in templates, eg:
+
+ %typemap("in") XXX<int>::Long "..."
+ template typename<T> struct XXX {
+ typedef long Long;
+ };
+ %clear XXX<int>::Long;
+
+ as the typemap was previously incorrectly stored as a typemap for long
+ instead of XXX<int>::Long.
+
+2017-08-05: olly
+ [C++11] Allow static_assert at the top level (and disallow it right
+ after template<T>). Fixes issue 1031 reported by Artem V L.
+
+2017-08-02: wsfulton
+ Fix incorrectly shown warning when an empty template instantiation was used on a
+ class used as a base class and that base class was explicitly ignored with %ignore.
+ Example of the warning which will no longer appear:
+
+ Warning 401: Base class 'Functor< int,int >' has no name as it is an empty
+ template instantiated with '%template()'. Ignored.
+
+2017-07-17: fflexo
+ [Java] #674 Add std_list.i to add support for std::list containers. The Java proxy
+ extends java.util.AbstractSequentialList and makes the C++ std::list container look
+ and feel much like a java.util.LinkedList from Java.
+
+2017-07-07: wsfulton
+ [Python] Fix display of documented template types when using the autodoc
+ feature. For example when wrapping:
+
+ %feature("autodoc");
+ template<typename X> struct T {};
+ %template(TInteger) T<int>;
+
+ the generated documentation contains:
+ """Proxy of C++ T< int > class."""
+ instead of:
+ """Proxy of C++ T<(int)> class."""
+ and
+ """__init__(TInteger self) -> TInteger"""
+ instead of
+ """__init__(T<(int)> self) -> TInteger"""
+
+2017-06-27: nihaln
+ [PHP] Update the OUTPUT Typemap to add return statement to the
+ PHP Wrapper.
+
+2017-06-27: nihaln
+ [PHP] Update the enum and value examples to use the OO wrappers
+ rather than the flat functions produced with -noproxy. There's
+ not been a good reason to use -noproxy for since PHP5 OO wrapping
+ was fixed back in 2005.
+
+2017-06-23: m7thon
+ [Python] fix and improve default argument handling:
+
+ 1. Fix negative octals. Currently not handled correctly by `-py3`
+ (unusual case, but incorrect).
+ 2. Fix arguments of type "octal + something" (e.g. `0640 | 04`).
+ Currently drops everything after the first octal. Nasty!
+ 3. Fix bool arguments "0 + something" (e.g. `0 | 1`) are always
+ "False" (unusual case, but incorrect).
+ 4. Remove special handling of "TRUE" and "FALSE" from
+ `convertValue` since there's no reason these have to match
+ "true" and "false".
+ 5. Remove the Python 2 vs. Python 3 distinction based on the
+ `-py3` flag. Now the same python code is produced for default
+ arguments for Python 2 and Python 3. For this, octal default
+ arguments, e.g. 0644, are now wrapped as `int('644', 8)`. This
+ is required, as Python 2 and Python 3 have incompatible syntax
+ for octal literals.
+
+ Fixes #707
+
+2017-06-21: futatuki
+ #1004 - Fix ccache-swig executable name to respect configure's --program-prefix and
+ --program-suffix values if used.
+
+2017-06-21: tamuratak
+ [Ruby] #911 - Add std::wstring support.
+
+2017-06-19: wsfulton
+ [Python] Fix handling of rich comparisons when wrapping overloaded operators:
+
+ operator< operator<= operator> operator>= operator== operator!=
+
+ Previously a TypeError was always thrown if the type was not correct. NotImplemented
+ is now returned from these wrapped functions if the type being compared with is
+ not correct. The subsequent behaviour varies between different versions of Python
+ and the comparison function being used, but is now consistent with normal Python
+ behaviour. For example, for the first 4 operator overloads above, a TypeError
+ 'unorderable types' is thrown in Python 3, but Python 2 will return True or False.
+ NotImplemented should be returned when the comparison cannot be done, see PEP 207 and
+ https://docs.python.org/3/library/constants.html#NotImplemented
+
+ Note that the bug was only present when overloaded operators did not also have a
+ function overload.
+
+ Fixes SF bug #1208 (3441262) and SF patch #303.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2017-06-17: fabrice102
+ [Go] Fix Go callback example. Fixes github #600, #955, #1000.
+
+2017-06-16: wsfulton
+ Make sure warning and error messages are not split up by other processes writing to
+ stdout at the same time.
+
+2017-06-16: wsfulton
+ [R] Fix wrapping function pointers containing rvalue and lvalue reference parameters.
+
+2017-06-13: olly
+ [Perl] Fix testsuite to work without . in @INC - it was removed in
+ Perl 5.26 for security reasons, and has also been removed from
+ older versions in some distros. Fixes #997 reported by lfam.
+
+2017-06-03: wsfulton
+ Fix %import on a file containing a file scope %fragment forced inclusion to not
+ generate the fragment contents as %import should not result in code being generated.
+ The behaviour is now the same as importing code insertion blocks.
+ Wrapping FileC.i in the following example will result in no generated code, whereas
+ previously "#include <limits.h>" was generated:
+
+ // FileA.i
+ %fragment("<limits.h>", "header") %{
+ #include <limits.h>
+ %}
+
+ %{
+ #include <stdio.h>
+ %}
+ %fragment("<limits.h>");
+
+ // FileC.i
+ %import "FileA.i"
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2017-05-26: Volker Diels-Grabsch, vadz
+ [Java] #842 Extend from java.util.AbstractList<> and implement java.util.RandomAccess for
+ std::vector wrappers. This notably allows to iterate over wrapped vectors in a natural way.
+ Note that boxed types are now used in the Java layer when wrapping vector of C primitive
+ types, for example. This may introduce some subtle incompatibilities due to some
+ differences in how Java converts boxed types and unboxed types. For example,
+
+ int i=0;
+ double d1 = i; // ok
+ Double d2 = i; // error: incompatible types: int cannot be converted to Double
+
+ This can be a problem when calling the add and set functions. A suggested backwards
+ compatible workaround is to use something like (shown for std::vector<double>:
+
+ #if defined(SWIGJAVA)
+ // Add in old api that uses non-boxed types
+ %extend std::vector<double> {
+ %proxycode %{
+ public void add(double x) {
+ add(Double.valueOf(x));
+ }
+ public void set(int i, double val) {
+ set(i, Double.valueOf(val));
+ }
+ %}
+ }
+ #endif
+
+ %include "std_vector.i"
+ %template(VectorDouble) std::vector<double>;
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2017-05-30: davidcl
+ [Scilab] #994 Undefined symbol error when loading in Scilab 6
+
+2017-05-25: asibross
+ [Java] #370 #417 Missing smart pointer handling in Java director extra methods
+ swigReleaseOwnership() and swigTakeOwnership().
+
+2017-05-23: wsfulton
+ [Java] #230 #759 Fix Java shared_ptr and directors for derived classes java compilation
+ error.
+
+ For shared_ptr proxy proxy classes, add a protected method swigSetCMemOwn for modifying
+ the swigCMemOwn and swigCMemOwnDerived member variables which are used by various other
+ methods for controlling memory ownership.
+
+2017-05-21: Sghirate
+ [Java, C#, D] #449 Remove unnecessary use of dynamic_cast in directors to enable
+ non-RTTI compilation.
+
+2017-05-21: wsfulton
+ [Python] #993 Fix handling of default -ve unsigned values, such as:
+ void f(unsigned = -1U);
+
+2017-05-20: jschueller
+ [Python] #991 Fix E731 PEP8 warning: do not assign a lambda expression
+
+2017-05-16: nihal95
+ [PHP] Add %pragma version directive to allow the version of the
+ extension to be set. Patch #970, fixes #360.
+
+2017-05-13: yag00
+ Patch #975 - Add support for noexcept on director methods.
+
+2017-04-27: redbrain
+ Issue #974, Patch #976 - Fix preprocessor handling of macros with commas in a comment.
+
+2017-04-25: jleveque
+ [Lua] #959 - Fix Visual Studio C4244 conversion warnings in Lua wrappers.
+
+2017-04-21: tamuratak
+ [Ruby] #964 - Add shared_ptr director typemaps.
+
+2017-04-20: wsfulton
+ [Ruby] #586, #935 Add assert for invalid NULL type parameter when calling SWIG_Ruby_NewPointerObj.
+
+2017-04-20: tamuratak
+ [Ruby] #930, #937 - Fix containers of std::shared_ptr.
+ Upcasting, const types (eg vector<shared_ptr<const T>>) and NULL/nullptr support added.
+
+2017-04-12: smarchetto
+ [Scilab] New parameter targetversion to specify the Scilab target version (5, 6, ..) for code generation
+ With Scilab 6 target specified, identifier names truncation is disabled (no longer necessary)
+
+2017-03-24: tamuratak
+ [Ruby] Fix #939 - Wrapping std::vector<bool> fix due to incorrect null checks
+ on VALUE obj.
+
+2017-03-17: vadz
+ [C#] #947 Add support for std::complex<T>
+
+2017-03-17: wsfulton
+ [Go] Fix handling of typedef'd function pointers and typedef'd member function pointers
+ such as:
+
+ typedef int (*FnPtr_td)(int, int);
+ int do_op(int x, int y, FnPtr_td op);
+
+2017-03-16: wsfulton
+ Add support for member const function pointers such as:
+
+ int fn(short (Funcs::* parm)(bool)) const;
+
+ Also fix parsing of references/pointers and qualifiers to member
+ pointers such as:
+
+ int fn(short (Funcs::* const parm)(bool));
+ int fn(short (Funcs::* & parm)(bool));
+
+2017-03-10: wsfulton
+ Extend C++11 alternate function syntax parsing to support const and noexcept, such as:
+
+ auto sum1(int x, int y) const -> int { return x + y; }
+ auto sum2(int x, int y) noexcept -> int { return x + y; }
+
+2017-02-29: tamuratak
+ [Ruby] #917 - Add Enumerable module to all container class wrappers. It was missing
+ for std::list, std::multiset, std::unordered_multiset and std::unordered_map.
+
+2017-02-27: assambar
+ [C++11] Extend parser to support throw specifier in combination
+ with override and/or final.
+
+2017-02-10: tamuratak
+ [Ruby] #883 - Add support for C++11 hash tables:
+ std::unordered_map
+ std::unordered_set
+ std::unordered_multimap
+ std::unordered_multiset
+
+2017-02-08: jcsharp
+ [C#] #887 Improve std::vector<T> wrapper constructors -
+ Replace constructor taking ICollection with IEnumerable and also add IEnumerable<T>
+ constructor to avoid the boxing and unboxing overhead of the original constructor,
+ when the type parameter is a value type.
+
+Version 3.0.12 (27 Jan 2017)
+============================
+
+2017-01-27: wsfulton
+ [C#] #882 Fix missing filename in error messages when there is a problem
+ writing out C# files.
+
+2017-01-27: briancaine
+ [Guile] #744 Fix compilation errors in Guile wrappers - regression
+ introduced in swig-3.0.11.
+
+2017-01-24: andrey-starodubtsev
+ [Java] Apply #704 - director typemap improvements.
+ Memory leak fixes, add support for "directorargout" typemap and
+ add director support to typemaps.i.
+
+2017-01-24: wsfulton
+ Enhance %extend to extend a class with template constructors, eg:
+
+ struct Foo {
+ %extend {
+ template<typename T>
+ Foo(int a, T b) {
+ ...
+ }
+ }
+ };
+ %template(Foo) Foo::Foo<double>;
+
+2017-01-22: wsfulton
+ Issue #876 Enhance %extend to extend a class with template methods, eg:
+
+ struct Foo {
+ %extend {
+ template<typename T>
+ void do_stuff(int a, T b) {
+ ...
+ }
+ }
+ };
+ %template(do_stuff_inst) Foo::do_stuff<double>;
+
+ Similarly for static template methods.
+
+2017-01-22: kwwette
+ [Octave] add support for version 4.2
+ - The Octave API now uses some C++11 features. It is recommended to use
+ the mkoctfile program supplied by Octave to compile the SWIG-generated
+ wrapper code, as mkoctfile will ensure the correct C++ compiler/options
+ are used. Otherwise, the value of `mkoctfile -p CXX` should be parsed
+ for any -std=* flags which might be present.
+ - Octave has dropped support for << and >> operators, so SWIG now
+ ignores them.
+ - The Octave error() function now raises C++ exceptions to propagate
+ Octave errors, so %exception directives may need to be modified.
+ For convenience the SWIG_RETHROW_OCTAVE_EXCEPTIONS macro can be used
+ to rethrow any Octave exceptions for Octave itself to handle, e.g.:
+
+ try {
+ $action // may call error()
+ }
+ SWIG_RETHROW_OCTAVE_EXCEPTIONS // error() exceptions are rethrown
+ catch(...) {
+ ... // all other exceptions
+ }
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2017-01-16: wkalinin
+ [C#] Fix #733 regression introduced in swig-3.0.9.
+ Missing virtual function override in C# layer when using %import.
+
+2017-01-16: fschlimb
+ Fix #813 template symbol name lookup bug when typedef names are the same but in different
+ namespaces.
+
+2017-01-15: wsfulton
+ [C# D Java]
+ The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
+ completely freeing them up for users to use without having to replicate the library
+ code that they previously added. The code previously generated by these typemaps
+ has been replaced by the new %proxycode directive. Their use in the library code
+ was fairly minimal:
+
+ C# cstype: std_array.i std_map.i std_vector.i
+ D dtype: std_vector.i
+ Java javatype: arrays_java.i
+
+2017-01-14: wsfulton
+ The %extend directive can now optionally support one of the 'class', 'struct' or 'union'
+ keywords before the identifier name, for example:
+
+ struct X { ... };
+ %extend struct X { ... }
+
+ Previously this had to specified as:
+
+ struct X { ... };
+ %extend X { ... }
+
+2017-01-13: wsfulton
+ [C# D Java] Add new %proxycode directive which is a macro for %insert("proxycode").
+ This is a way of adding pure C#/D/Java code into the appropriate proxy class, eg:
+
+ %extend Proxy2 {
+ %proxycode %{
+ public int proxycode2(int i) {
+ return i+2;
+ }
+ %}
+ }
+
+ %inline %{
+ struct Proxy2 {};
+ %}
+
+ There will then be a pure Java/C#/D method called proxycode2 in the Proxy2 class.
+
+2016-12-31: ajrheading1
+ Issue #860 - Remove use of std::unary_function and std::binary_function
+ which is deprecated in C++11.
+
+2016-12-30: olly
+ [PHP7] Register internal 'swig_runtime_data_type_pointer' constant
+ as "CONST_PERSISTENT" to avoid segmentation fault on module unload.
+ Fixes #859 reported by Timotheus Pokorra. Thanks also to Javier Torres
+ for a minimal reproducer.
+
Version 3.0.11 (29 Dec 2016)
============================
@@ -11477,7 +13140,7 @@ Version 1.3.23 (November 11, 2004)
- Properly qualify type in syntax as 'long(2)' or 'Foo()',
this solve old problem with default args, and probably
other problems around. However, the default arg problem
- was also already solved by William (see bellow).
+ was also already solved by William (see below).
- Fix feature_set and feature_get methods. Before
they look from particular to general and keep the first
@@ -11685,7 +13348,7 @@ Version 1.3.23 (November 11, 2004)
ie, no additional pointer elements are created, and
the original 'foo' and 'A.bar' can be used as parameters.
- In the case of member fucntion however, still you need
+ In the case of member function however, still you need
to use the special variable Class::<fnc_name>_cb_ptr, ie:
foobarm(3, a, A.barm_cb_ptr)
@@ -20988,7 +22651,7 @@ Version 1.3.7 (September 3, 2001)
typedef __name vector<T>;
%enddef
- An a specific instantiation is created in exactly the same way:
+ A specific instantiation is created in exactly the same way:
%template(intvec) vector<int>;
diff --git a/CHANGES.current b/CHANGES.current
index 197ec7731..ab69e0916 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -4,130 +4,142 @@ See the RELEASENOTES file for a summary of changes in each release.
Issue # numbers mentioned below can be found on Github. For more details, add
the issue number to the end of the URL: https://github.com/swig/swig/issues/
-Version 3.0.12 (27 Jan 2017)
-============================
-
-2017-01-27: wsfulton
- [C#] #882 Fix missing filename in error messages when there is a problem
- writing out C# files.
-
-2017-01-27: briancaine
- [Guile] #744 Fix compilation errors in Guile wrappers - regression
- introduced in swig-3.0.11.
-
-2017-01-24: andrey-starodubtsev
- [Java] Apply #704 - director typemap improvements.
- Memory leak fixes, add support for "directorargout" typemap and
- add director support to typemaps.i.
-
-2017-01-24: wsfulton
- Enhance %extend to extend a class with template constructors, eg:
-
- struct Foo {
- %extend {
- template<typename T>
- Foo(int a, T b) {
- ...
- }
- }
- };
- %template(Foo) Foo::Foo<double>;
-
-2017-01-22: wsfulton
- Issue #876 Enhance %extend to extend a class with template methods, eg:
-
- struct Foo {
- %extend {
- template<typename T>
- void do_stuff(int a, T b) {
- ...
- }
- }
- };
- %template(do_stuff_inst) Foo::do_stuff<double>;
-
- Similarly for static template methods.
-
-2017-01-22: kwwette
- [Octave] add support for version 4.2
- - The Octave API now uses some C++11 features. It is recommended to use
- the mkoctfile program supplied by Octave to compile the SWIG-generated
- wrapper code, as mkoctfile will ensure the correct C++ compiler/options
- are used. Otherwise, the value of `mkoctfile -p CXX` should be parsed
- for any -std=* flags which might be present.
- - Octave has dropped support for << and >> operators, so SWIG now
- ignores them.
- - The Octave error() function now raises C++ exceptions to propagate
- Octave errors, so %exception directives may need to be modified.
- For convenience the SWIG_RETHROW_OCTAVE_EXCEPTIONS macro can be used
- to rethrow any Octave exceptions for Octave itself to handle, e.g.:
-
- try {
- $action // may call error()
- }
- SWIG_RETHROW_OCTAVE_EXCEPTIONS // error() exceptions are rethrown
- catch(...) {
- ... // all other exceptions
- }
+Version 4.0.1 (21 Aug 2019)
+===========================
- *** POTENTIAL INCOMPATIBILITY ***
+2019-08-20: TekuConcept
+ [Javascript] #1535 Add %native support to Javascript.
-2017-01-16: wkalinin
- [C#] Fix #733 regression introduced in swig-3.0.9.
- Missing virtual function override in C# layer when using %import.
+2019-08-20: bkotzz
+ [Java] #1616 Add SWIG_JavaIllegalStateException to support throwing
+ java.lang.IllegalStateException from JNI code.
-2017-01-16: fschlimb
- Fix #813 template symbol name lookup bug when typedef names are the same but in different
- namespaces.
+2019-08-19: sjml
+ [Lua] #1596 tostring output changes to show the underlying C/C++ pointer.
-2017-01-15: wsfulton
- [C# D Java]
- The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
- completely freeing them up for users to use without having to replicate the library
- code that they previously added. The code previously generated by these typemaps
- has been replaced by the new %proxycode directive. Their use in the library code
- was fairly minimal:
+2019-08-08: rokups
+ [C#, Java] #1601 Fix invalid code generated for "%constant enum EnumType.
- C# cstype: std_array.i std_map.i std_vector.i
- D dtype: std_vector.i
- Java javatype: arrays_java.i
+2019-08-07: wsfulton
+ [Python] Fix method overloading of methods that take STL containers of different
+ types. The following usage (using std::vector) would fail when using -builtin:
-2017-01-14: wsfulton
- The %extend directive can now optionally support one of the 'class', 'struct' or 'union'
- keywords before the identifier name, for example:
+ %include <std_string.i>
+ %include <std_vector.i>
- struct X { ... };
- %extend struct X { ... }
+ %inline %{
+ struct X {};
+ %}
- Previously this had to specified as:
+ %template(VectorX) std::vector<X>;
+ %template(VectorInt) std::vector<int>;
- struct X { ... };
- %extend X { ... }
+ %inline %{
+ using namespace std;
+ string VectorOverload(vector<X> v);
+ string VectorOverload(vector<int> v);
+ %}
-2017-01-13: wsfulton
- [C# D Java] Add new %proxycode directive which is a macro for %insert("proxycode").
- This is a way of adding pure C#/D/Java code into the appropriate proxy class, eg:
+ The following would incorrectly fail:
- %extend Proxy2 {
- %proxycode %{
- public int proxycode2(int i) {
- return i+2;
- }
- %}
- }
+ s = VectorOverload([1, 2, 3])
- %inline %{
- struct Proxy2 {};
- %}
+ With:
+
+ Traceback (most recent call last):
+ File "runme3.py", line 20, in <module>
+ ret = VectorOverload([1, 2, 3])
+ TypeError: Wrong number or type of arguments for overloaded function 'VectorOverload'.
+ Possible C/C++ prototypes are:
+ VectorOverload(std::vector< Number,std::allocator< Number > >)
+ VectorOverload(std::vector< int,std::allocator< int > >)
+
+ The problem was due to some error handling that was not cleared during typehecking.
+ In this case an error was not cleared when the elements in the list failed the
+ typecheck for converting to X. Only occurs in Python 3+.
+
+ In some combinations of overloaded methods, the following type of error message would
+ occur:
+
+ RuntimeError: in sequence element 0
+
+ The above exception was the direct cause of the following exception:
+
+ Traceback (most recent call last):
+ File "runme3.py", line 23, in <module>
+ check(VectorOverload(v), "vector<X>")
+ SystemError: <built-in function VectorOverload> returned a result with an error set
+
+2019-08-01: wsfulton
+ #1602 Fix regression in 4.0.0 where a template function containing a parameter
+ with the same name as the function name led to the parameter name used in the
+ target language being incorrectly modified.
+
+2019-07-29: wsfulton
+ Remove all generated files on error. Previously generated files were not removed,
+ potentially breaking Makefiles using file dependencies, especially when -Werror
+ (warnings as errors) was used.
+
+2019-07-23: smithx
+ [C#] #1530 #1532 Fix marshalling of std::wstring to C#.
+
+2019-07-18: gicmo
+ [Python] #1587 Python 3.8 support - remove use of deprecated PyObject_GC_UnTrack.
+
+2019-07-18: cher-nov
+ [Python] #1573 Generated Python code uses consistent string quoting style - double
+ quotes.
+
+2019-07-16: geefr
+ [C#] #616 #1576 Fix C# bool INPUT[], bool OUTPUT[], bool INOUT[] typemaps to marshall
+ as 1-byte.
+
+2019-07-12: vadz
+ [C#, Java] #1568 #1583 Fix std::set<> typemaps for primitive types.
+
+2019-07-12: vadz
+ #1566 #1584 Regression in 4.0.0 - fix missing value for first item of enums with
+ trailing comma.
+
+2019-07-11: mcfarljm
+ #1548 #1578 Fix segfault in Doxygen parser parsing empty lines in some commands like
+ \code.
+
+2019-07-09: IsaacPascual
+ [C#, Java] #1570 Fix name of generated C#/Java classes for %interface macros
+ in swiginterface.i when wrapping nested C++ classes.
+
+2019-07-05: wsfulton
+ [Python] #1547 Whitespace fixes in Doxygen translated comments into pydoc comments
+ for Sphinx compatibility.
+
+2019-06-28: wsfulton
+ [MzScheme, OCaml] #1559 $arg and $input were incorrectly substituted in the
+ argout typemap when two or more arguments were present.
+
+2019-06-24: wsfulton
+ [Python, Ruby] #1538 Remove the UnknownExceptionHandler class in order to be
+ C++17 compliant as it uses std::unexpected_handler which was removed in C++17.
+ This class was intended for director exception handling but was never used by
+ SWIG and was never documented.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2019-06-06: bkotzz
+ [Java] #1552 Improve performance in Java std::vector constructor wrapper that takes
+ a native Java array as input.
+
+2019-06-03: olly
+ [Python] Fix regression in implicit_conv handling of tuples,
+ introduced in SWIG 4.0.0. Fixes #1553, reported by Alexandre
+ Duret-Lutz.
- There will then be a pure Java/C#/D method called proxycode2 in the Proxy2 class.
+2019-05-24: wsfulton
+ [Octave] Fix detection of Octave on MacOS.
-2016-12-31: ajrheading1
- Issue #860 - Remove use of std::unary_function and std::binary_function
- which is deprecated in C++11.
+2019-05-24: opoplawski
+ [Octave] #1522 Adapt OCTAVE_LDFLAGS for Octave 5.1.
-2016-12-30: olly
- [PHP7] Register internal 'swig_runtime_data_type_pointer' constant
- as "CONST_PERSISTENT" to avoid segmentation fault on module unload.
- Fixes #859 reported by Timotheus Pokorra. Thanks also to Javier Torres
- for a minimal reproducer.
+2019-05-22: ferdynator
+ [PHP] #1528 Don't add a closing '?>' PHP tag to generated files.
+ PSR-2 says it MUST be omitted for files containing only PHP.
diff --git a/COPYRIGHT b/COPYRIGHT
index c3fbbdebd..e6df73ff8 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -19,6 +19,7 @@ Active SWIG Developers:
Oliver Buchtala (oliver.buchtala@gmail.com) (Javascript)
Neha Narang (narangneha03@gmail.com) (Javascript)
Simon Marchetto (simon.marchetto@scilab-enterprises.com) (Scilab)
+ Zackery Spytz (zspytz@gmail.com) (OCaml, SWIG core)
Past SWIG developers and major contributors include:
Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl)
@@ -28,7 +29,7 @@ Past SWIG developers and major contributors include:
Mikel Bancroft (mikel@franz.com) (Allegro CL)
Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI)
Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby])
- Art Yerkes (ayerkes@speakeasy.net) (Ocaml)
+ Art Yerkes (ayerkes@speakeasy.net) (OCaml)
Lyle Johnson (lyle@users.sourceforge.net) (Ruby)
Charlie Savage (cfis@interserv.com) (Ruby)
Thien-Thi Nguyen (ttn@glug.org) (build/test/misc)
@@ -62,7 +63,8 @@ Past SWIG developers and major contributors include:
John Lenz (Guile, MzScheme updates, Chicken module, runtime system)
Baozeng Ding <sploving1@163.com> (Scilab)
Ian Lance Taylor (Go)
- Vadim Zeitlin (PCRE, Python)
+ Dmitry Kabak (userdima@gmail.com) (Doxygen)
+ Vadim Zeitlin (PCRE, Python, Doxygen)
Stefan Zager (szager@gmail.com) (Python)
Vincent Couvert (Scilab)
Sylvestre Ledru (Scilab)
diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt
new file mode 100644
index 000000000..ac764fb2a
--- /dev/null
+++ b/Doc/Devel/plan-gsoc-2012.txt
@@ -0,0 +1,341 @@
+
+
+
+
+ Project Plan
+ ============
+ SWIG Code Comments
+ Google Summer of Code 2012
+
+
+This document describes goals for the Google Summer of Code 2012,
+SWIG code documentation project.
+
+Author: Marko Klopcic, Dmitry Kabak
+
+
+Introduction
+============
+
+The goal of this project is _not_ to translate _any_ possible Doxygen
+formatted comment to JavaDoc or PyDoc, but to make it possible to
+translate a subset of comment types in C/C++ code to
+JavaDoc and PyDoc. Covering all the Doxygen functionality would be to
+complex for the limited time. However, the code must be flexible so
+that implementing missing features would not require redesign of the
+comment handling code in SWIG.
+
+There will also be a possibility to add untranslated comments to Java
+and Python code (## comments, see Doxygen manual), if the user will
+prefer to use Doxygen on the generated code.
+
+Note:
+'-OK-' tick below means that the item is implemented, committed and
+working.
+
+Abbreviations:
+ JD - JavaDoc
+ PD - PyDoc
+
+
+Functionality
+=============
+
+ Types of comments
+ -----------------
+
+ Note:
+ See 'http://www.stack.nl/~dimitri/doxygen/docblocks.html' for
+ the detailed description of Doxygen syntax and terms used in this
+ section.
+
+ 1. -OK- Only JavaDoc (/** */) and Qt (/*! */) styles of comment blocks
+ will be supported by SWIG translator.
+
+ 2. -OK- The following doc after members will be supported:
+
+ int var; ///< Detailed description after the member
+ //!<
+
+ int var; //!< Brief description after the member
+
+ int var; ///< Brief description after the member
+
+
+ 3. -OK- Only comments before or after declaration/definition will be
+ supported. Comments with structural commands will be ignored
+ (warning will be written). (What about writing them to
+ 'package.info.java' for JD?)
+
+
+ Tags
+ ----
+
+ This section contains all doxygen tags taken from
+ http://www.stack.nl/~dimitri/doxygen/commands.html. If a tag is
+ marked as 'ignored', then the tag is ignored, but the text is copied
+ to the destination documentation. 'Not implemented' means that the
+ tag with it's contents is stripped out of the output.
+
+ Doxygen tags:
+
+ All tags: -OK-
+
+ \a - translated to <i></i> in JD, surrounded with _ in PD
+ \addindex - ignored
+ \addtogroup - ignored
+ \anchor - ignored, not supported by JD and PD
+ \arg - equivalent to \li
+ \attention - ignored
+ \authors, \author - translated to @author in JD, 'Author:' in PD
+ \b - <b></b> in JD, surrounded with __ in PD
+ \brief - ignored
+ \bug - ignored
+ \c - translated to <code></code> in JD, ignored in PD
+ \callgraph - ignored, not supported by JD and PD
+ \callergraph - ignored, not supported by JD and PD
+ \category - ignored, used only in Objective C
+ \cite - translated to <i></i> in JD, single quotes in PD
+ \class - ignored (structural command)
+ \code - translated to {@code ...} in JD, ignored in PD
+ \cond - translated to 'Conditional comment: <condition>'. Later
+ SWIG may support definitions of conditions in config file.
+ \copybrief - ignored. Later SWIG may support this command by
+ performing copy
+ \copydetails - ignored. Later SWIG may support this command by
+ performing copy
+ \copydoc - ignored. Later SWIG may support this command by
+ performing copy
+ \copyright - replaced with text 'Copyright' in PD and PD
+ \date - ignored
+ \def - ignored (structural command)
+ \defgroup - not supported
+ \deprecated - translated to @deprecated in JD, 'Deprecated:' in PD
+ \details - ignored
+ \dir - not supported
+ \dontinclude - not supported
+ \dot - not supported. Later SWIG may call dot and produce the graph image
+ to include in JD and PD
+ \dotfile - see note for \dot
+ \e - equivalent \a
+ \else - see note for \cond
+ \elseif - see note for \cond
+ \em - equivalent to \a
+ \endcode - see note for \code
+ \endcond - translated to 'End of conditional comment: <condition>'. Later
+ SWIG may support definitions of conditions in config file.
+ \enddot - see note for \dot
+ \endhtmlonly - ignored
+ \endif - see note for \cond
+ \endinternal - ignored
+ \endlatexonly - ignored
+ \endlink - see note for \link
+ \endmanonly - ignored
+ \endmsc - see note for \msc
+ \endrtfonly - ignored
+ \endverbatim - see note for \verbatim
+ \endxmlonly - ignored
+ \enum - ignored (structural command)
+ \example - translated to 'Example:' in JD and PD
+ \exception - equivalent to throws, but translates to @exception in JD
+ \extends - not supported
+ \f$ - ignored. Later swig may call LATeX to produce bitmaps with formulas
+ to include in JD and PD
+ \f[ - see note for \f$
+ \f] - see note for \f$
+ \f{ - see note for \f$
+ \f} - see note for \f$
+ \file - ignored (structural command)
+ \fn - ignored (structural command)
+ \headerfile - not supported
+ \hideinitializer - not supported
+ \htmlinclude - not supported
+ \htmlonly - ignored
+ \if - see note for \cond
+ \ifnot - see note for \cond
+ \image - translated to <img/> in JD only when target=HTML, translated to
+ 'Image: filename(Title)'
+ \implements - not supported
+ \include - not supported
+ \includelineno - not supported
+ \ingroup - not supported. Later swig may print group names as plain text
+ in comments like 'Code group: something' in both JD and PD
+ \internal - ignored
+ \invariant - ignored
+ \interface - ignored (structural command)
+ \latexonly - ignored
+ \li - trabslated to <li></li> in JD, ignored in PD
+ \line - not supported
+ \link - translated to {@link ...} in JD, ignored in PD
+ \mainpage - ignored
+ \manonly - ignored
+ \memberof - not supported
+ \msc - not supported. Later SWIG may call dot and produce the graph image
+ to include in JD and PD
+ \mscfile - see note for \msc
+ \n - prints the new line
+ \name - ignored
+ \namespace - included in package-info.java if nspace feature is enabled,
+ otherwise ignored, ignored in PD
+ \nosubgrouping - ignored
+ \note - translated to 'Note:' in both JD and PD
+ \overload - prints 'This is an overloaded member function, provided for
+ convenience. It differs from the above function only in what
+ argument(s) it accepts.' to the output in both JD and PD
+ \p - equivalent to \c
+ \package - is kept same in JD (it is already a JD tag), ignored in PD
+ \page - ignored
+ \par - translated to <p alt='title'></p> in JD, 'Title: ...' in PD
+ \paragraph - ignored
+ \param - translated to @param in JD, special formatting in PD
+ \post - ignored
+ \pre - ignored
+ \private - ignored
+ \privatesection - ignored
+ \property - ignored
+ \protected - ignored
+ \protectedsection - ignored
+ \protocol - ignored (Objective-C tag)
+ \public - ignored
+ \publicsection - ignored
+ \ref - ignored, not supported by JD and PD
+ \related - ignored
+ \relates - ignored
+ \relatedalso - ignored
+ \relatesalso - ignored
+ \remark - translated to 'Remarks:' in both JD and PD
+ \remarks - equivalent to remark
+ \result - translated to @return in JD, 'Return:' in PD
+ \return - equivalent to result
+ \returns - equivalent to result
+ \retval - ignored
+ \rtfonly - ignored
+ \sa - translated to @see in JD, 'See also:' in PD
+ \section - not supported
+ \see - equivalent to \sa
+ \short - equivalent to \brief
+ \showinitializer - not supported
+ \since - translated to @since in JD, 'Since:' in PD
+ \skip - not supported
+ \skipline - not supported
+ \snippet - not supported
+ \struct - ignored (structural command)
+ \subpage - not supported
+ \subsection - not supported
+ \subsubsection - not supported
+ \tableofcontents - not supported
+ \test - ignored
+ \throw - translated to @throws in JD, 'Throws:' in PD
+ \throws - equivalent to \throw
+ \todo - translated to 'TODO:' in both JD and PD
+ \tparam - similar to \arg
+ \typedef - ignored (structural command)
+ \union - ignored (structural command)
+ \until - not supported
+ \var - ignored (structural command)
+ \verbatim - translated to {@literal ...} in JD, ignored in PD
+ \verbinclude - ignored
+ \version - translated to @version in JD, 'Version:' in PD
+ \warning - translated to 'Warning:' in both JD and PD
+ \weakgroup - not supported
+ \xmlonly - ignored
+ \xrefitem - ignored
+ \$ - this and all the others below: these commands insert single char,
+ it is escaped as HTML char in JD, kept as-is in PD
+ \@
+ \\
+ \&
+ \~
+ \<
+ \>
+ \#
+ \%
+ \"
+ \.
+ \::
+
+Optional functionality
+======================
+
+That section describes some complex cases where the current code
+does not behave really well. Like a short to-do list of special cases.
+
+-OK- When translating functions with default parameters in swig to
+java, it creates overloaded functions with all the parameters
+except the default ones. We need to copy the doxygen comment to
+such functions and correct the list of @param tags.
+
+-OK- In doxygen there is a special tags (and even a special option)
+to create links to some code members from the current comment.
+Sometimes it needs a type of parameters specified because of the
+overloaded functions. And the same linking tags are supported in JD,
+but it has a completely different typesystem, so we need to translate
+the types of function parameters in comments also. For example:
+{@link MyClass#doSomething(const std::string &)}
+does not make sense in Java, so the type should be converted.
+{@link MyClass#doSomething(String)}
+
+
+Tests
+=====
+
+The following test cases will be implemented:
+
+-OK- Class comments.
+
+-OK- Struct comments.
+-OK- Enum comments.
+-OK- Function comments.
+-OK- Var comments.
+
+-OK- Class attributes, comment before and after declaration.
+-OK- Class methods, comment of parameters in function
+ comment.
+-OK- Class methods, comment of parameters
+ after parameter declaration.
+
+-OK- Struct attributes, comment before and after declaration.
+-OK- Struct methods, comment of parameters in function
+ comment.
+-OK- Struct methods, comment of parameters
+ after parameter declaration.
+
+-OK- Enum items JD and Qt style, comment before items
+-OK- Enum items JD and Qt style, comment after items
+
+-OK- Class comment, with all supported tags.
+-OK- Class comment, with all doxygen tags, including
+ ignored ones.
+
+The list of all tests, in form of shell commands to make it simple
+to test project by copying the text below into terminal program.
+make doxygen_parsing.cpptest -s
+make doxygen_translate.cpptest -s
+make doxygen_translate_all_tags.cpptest -s
+make doxygen_basic_translate.cpptest -s
+make doxygen_basic_notranslate.cpptest -s
+make doxygen_translate_links.cpptest -s
+make doxygen_tricky_constructs.cpptest -s
+
+
+Refactoring
+===========
+
+All the code in directory _Doxygen_ should be refactored:
+-OK- all methods should be class members
+-OK- most static methods should be normal members
+-OK- replace C arrays of strings and sequential searches with STL data
+ structures and algorithms.
+-OK- use singletons instead of class instantiaion for each comment found.
+
+
+Documentation
+=============
+
+SWIG documentation will contain:
+-OK- command line options
+-OK- list of implemented features (types and placements of comments)
+-OK- list of unimplemented features (types and placements of comments)
+-OK- list of tags and their translations (all Doxygen tags).
+-OK- some amount of debugging and development information
+
diff --git a/Doc/Devel/runtime.txt b/Doc/Devel/runtime.txt
index f88edf767..ae9c83275 100644
--- a/Doc/Devel/runtime.txt
+++ b/Doc/Devel/runtime.txt
@@ -57,7 +57,7 @@ Alternatively, if the language supports modules, a module named
named "type_table" SWIG_TYPE_TABLE_NAME can be created inside it. The most
common approach is to store the mod pointer in some global variable in the
target language, but if the language provides an alternative place to store data
-(like the chicken module), then that is good too.
+then that is good too.
The way the code is set up, SetModule should only be called when GetModule
returns NULL, and if SetModule is called a second time, the behavior is
@@ -105,7 +105,7 @@ Standard Functions
These functions are not required and their API is not formalized, but almost all
language modules implement them for consistency across languages. Throughout
this discussion, I will use LangType to represent the underlying language type
-(C_word in chicken, Scheme_Object * in mzscheme, PyObject * in python, etc)
+(Scheme_Object * in mzscheme, PyObject * in python, etc)
diff --git a/Doc/Devel/tree.html b/Doc/Devel/tree.html
index 73a49ed55..5bb4b6a1e 100644
--- a/Doc/Devel/tree.html
+++ b/Doc/Devel/tree.html
@@ -236,7 +236,7 @@ The following functions can be used to help debug SWIG parse trees.
<blockquote>
Prints the tag-structure of the parse tree to standard output. <tt>node</tt> is the top-level parse tree node. <tt>prefix</tt> is
-a string prefix thats added to the start of each line. Normally, you would specify the empty string or NIL for <tt>prefix</tt>.
+a string prefix that's added to the start of each line. Normally, you would specify the empty string or NIL for <tt>prefix</tt>.
This function is called by the <tt>-debug-tags</tt> option to SWIG.
<pre>
diff --git a/Doc/Manual/Allegrocl.html b/Doc/Manual/Allegrocl.html
index ddb6fba55..4069ecd8b 100644
--- a/Doc/Manual/Allegrocl.html
+++ b/Doc/Manual/Allegrocl.html
@@ -8,7 +8,7 @@
<body bgcolor="#ffffff">
-<H1><a name="Allegrocl">18 SWIG and Allegro Common Lisp</a></H1>
+<H1><a name="Allegrocl">20 SWIG and Allegro Common Lisp</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -129,16 +129,16 @@ It is significant to note that, while this is a vendor-specific
module, we would like to acknowledge the current and ongoing
work by developers in the open source lisp community that are
working on similar interfaces to implementation-independent
-foreign function interfaces (UFFI or CFFI, for example). Such
+foreign function interfaces (CFFI, for example). Such
work can only benefit the lisp community, and we would not
be unhappy to see some enterprising folk use this work to add
to it.
</p>
-<H2><a name="Allegrocl_nn2">18.1 Basics</a></H2>
+<H2><a name="Allegrocl_nn2">20.1 Basics</a></H2>
-<H3><a name="Allegrocl_nn3">18.1.1 Running SWIG</a></H3>
+<H3><a name="Allegrocl_nn3">20.1.1 Running SWIG</a></H3>
<p>
@@ -155,7 +155,7 @@ SWIG directives. SWIG can be furnished with a header file, but an
interface can also be generated without library headers by supplying a
simple text file--called the interface file, which is typically named
with a <tt>.i</tt> extension--containing any foreign declarations of
-identifiers you wish to use. The most common approach is to use a an
+identifiers you wish to use. The most common approach is to use an
interface file with directives to parse the needed headers. A straight
parse of library headers will result in usable code, but SWIG
directives provides much freedom in how a user might tailor the
@@ -360,7 +360,7 @@ need to link in the Allegro shared library. The library you create from
the C++ wrapper will be what you then load into Allegro CL.
</p>
-<H3><a name="Allegrocl_nn4">18.1.2 Command Line Options</a></H3>
+<H3><a name="Allegrocl_nn4">20.1.2 Command Line Options</a></H3>
<p>
@@ -396,7 +396,7 @@ See <a href="#Allegrocl_nn47">Section 17.5 Identifier converter
functions</a> for more details.
</p>
-<H3><a name="Allegrocl_nn5">18.1.3 Inserting user code into generated files</a></H3>
+<H3><a name="Allegrocl_nn5">20.1.3 Inserting user code into generated files</a></H3>
<p>
@@ -436,7 +436,7 @@ Note that the block <tt>%{ ... %}</tt> is effectively a shortcut for
</p>
-<H2><a name="Allegrocl_nn6">18.2 Wrapping Overview</a></H2>
+<H2><a name="Allegrocl_nn6">20.2 Wrapping Overview</a></H2>
<p>
@@ -446,7 +446,7 @@ New users to SWIG are encouraged to read
interested in generating an interface to C++.
</p>
-<H3><a name="Allegrocl_nn7">18.2.1 Function Wrapping</a></H3>
+<H3><a name="Allegrocl_nn7">20.2.1 Function Wrapping</a></H3>
<p>
@@ -499,7 +499,7 @@ interested in generating an interface to C++.
</pre>
</div>
-<H3><a name="Allegrocl_nn8">18.2.2 Foreign Wrappers</a></H3>
+<H3><a name="Allegrocl_nn8">20.2.2 Foreign Wrappers</a></H3>
<p>
@@ -512,7 +512,7 @@ interested in generating an interface to C++.
typemap.
</p>
-<H3><a name="Allegrocl_nn9">18.2.3 FFI Wrappers</a></H3>
+<H3><a name="Allegrocl_nn9">20.2.3 FFI Wrappers</a></H3>
<p>
@@ -593,7 +593,7 @@ char *xxx();
ff:def-foreign-call's.
</p>
-<H3><a name="Allegrocl_nn10">18.2.4 Non-overloaded Defuns</a></H3>
+<H3><a name="Allegrocl_nn10">20.2.4 Non-overloaded Defuns</a></H3>
<p>
@@ -606,11 +606,11 @@ char *xxx();
this function can be manipulated via the <tt>lout</tt> typemap.
</p>
-<H3><a name="Allegrocl_nn11">18.2.5 Overloaded Defuns</a></H3>
+<H3><a name="Allegrocl_nn11">20.2.5 Overloaded Defuns</a></H3>
<p>
- In the case of overloaded functions, mulitple layers are
+ In the case of overloaded functions, multiple layers are
generated. First, all the overloads for a given name are separated
out into groups based on arity, and are wrapped in
defmethods. Each method calls a distinct wrapper function, but are
@@ -622,7 +622,7 @@ char *xxx();
can be manipulated via the <tt>lout</tt> typemap.
</p>
-<H3><a name="Allegrocl_nn12">18.2.6 What about constant and variable access?</a></H3>
+<H3><a name="Allegrocl_nn12">20.2.6 What about constant and variable access?</a></H3>
<p>
@@ -635,7 +635,7 @@ char *xxx();
into the foreign module.
</p>
-<H3><a name="Allegrocl_nn13">18.2.7 Object Wrapping</a></H3>
+<H3><a name="Allegrocl_nn13">20.2.7 Object Wrapping</a></H3>
<p>
@@ -657,7 +657,7 @@ char *xxx();
foreign function interface.
</p>
-<H2><a name="Allegrocl_nn14">18.3 Wrapping Details</a></H2>
+<H2><a name="Allegrocl_nn14">20.3 Wrapping Details</a></H2>
<p>
@@ -665,7 +665,7 @@ char *xxx();
translated into lisp.
</p>
-<H3><a name="Allegrocl_nn15">18.3.1 Namespaces</a></H3>
+<H3><a name="Allegrocl_nn15">20.3.1 Namespaces</a></H3>
<p>
@@ -742,7 +742,7 @@ namespace car {
function such as <tt>(car '(1 2 3)</tt>.
</p>
-<H3><a name="Allegrocl_nn16">18.3.2 Constants</a></H3>
+<H3><a name="Allegrocl_nn16">20.3.2 Constants</a></H3>
@@ -803,7 +803,7 @@ namespace car {
not use the <tt>-nocwrap</tt> command-line option.
</p>
-<H3><a name="Allegrocl_nn17">18.3.3 Variables</a></H3>
+<H3><a name="Allegrocl_nn17">20.3.3 Variables</a></H3>
<p>
@@ -881,7 +881,7 @@ globalvar&gt; (globalvar.nnn::glob_float)
</pre>
</div>
-<H3><a name="Allegrocl_nn18">18.3.4 Enumerations</a></H3>
+<H3><a name="Allegrocl_nn18">20.3.4 Enumerations</a></H3>
<p>
@@ -957,7 +957,7 @@ EXPORT const int ACL_ENUM___FOO3__SWIG_0 = FOO3;
</pre>
</div>
-<H3><a name="Allegrocl_nn19">18.3.5 Arrays</a></H3>
+<H3><a name="Allegrocl_nn19">20.3.5 Arrays</a></H3>
<p>
@@ -1105,10 +1105,10 @@ namespace BAR {
</pre>
</div>
-<H3><a name="Allegrocl_nn20">18.3.6 Classes and Structs and Unions (oh my!)</a></H3>
+<H3><a name="Allegrocl_nn20">20.3.6 Classes and Structs and Unions (oh my!)</a></H3>
-<H4><a name="Allegrocl_nn21">18.3.6.1 CLOS wrapping of</a></H4>
+<H4><a name="Allegrocl_nn21">20.3.6.1 CLOS wrapping of</a></H4>
<p>
@@ -1123,7 +1123,7 @@ namespace BAR {
integer values.
</p>
-<H4><a name="Allegrocl_nn22">18.3.6.2 CLOS Inheritance</a></H4>
+<H4><a name="Allegrocl_nn22">20.3.6.2 CLOS Inheritance</a></H4>
<p>
@@ -1136,7 +1136,7 @@ namespace BAR {
parameter.
</p>
-<H4><a name="Allegrocl_nn23">18.3.6.3 Member fields and functions</a></H4>
+<H4><a name="Allegrocl_nn23">20.3.6.3 Member fields and functions</a></H4>
<p>
@@ -1152,7 +1152,7 @@ namespace BAR {
the interface does nothing for <tt>friend</tt> directives,
</p>
-<H4><a name="Allegrocl_nn24">18.3.6.4 Why not directly access C++ classes using foreign types?</a></H4>
+<H4><a name="Allegrocl_nn24">20.3.6.4 Why not directly access C++ classes using foreign types?</a></H4>
<p>
@@ -1170,11 +1170,11 @@ namespace BAR {
use the more robust wrapper functions.
</p>
-<H3><a name="Allegrocl_nn25">18.3.7 Templates</a></H3>
+<H3><a name="Allegrocl_nn25">20.3.7 Templates</a></H3>
-<H4><a name="Allegrocl_nn26">18.3.7.1 Generating wrapper code for templates</a></H4>
+<H4><a name="Allegrocl_nn26">20.3.7.1 Generating wrapper code for templates</a></H4>
<p>
@@ -1187,7 +1187,7 @@ them. This is done via the
directive.
</p>
-<H4><a name="Allegrocl_nn27">18.3.7.2 Implicit Template instantiation</a></H4>
+<H4><a name="Allegrocl_nn27">20.3.7.2 Implicit Template instantiation</a></H4>
<p>
@@ -1197,7 +1197,7 @@ to include these templated classes in the foreign-type and CLOS
class schema.
</p>
-<H3><a name="Allegrocl_nn28">18.3.8 Typedef, Templates, and Synonym Types</a></H3>
+<H3><a name="Allegrocl_nn28">20.3.8 Typedef, Templates, and Synonym Types</a></H3>
<p>
@@ -1239,7 +1239,7 @@ int zzz(A *inst = 0); /* return inst-&gt;x + inst-&gt;y */
We resolve this issue, by noting synonym relationships between
types while generating the interface. A Primary type is selected
(more on this below) from the candidate list of synonyms. For
- all other synonyms, intead of generating a distinct CLOS class
+ all other synonyms, instead of generating a distinct CLOS class
definition, we generate a form that expands to:
</p>
<div class="targetlang">
@@ -1277,7 +1277,7 @@ synonym&gt;
</pre>
</div>
-<H4><a name="Allegrocl_nn29">18.3.8.1 Choosing a primary type</a></H4>
+<H4><a name="Allegrocl_nn29">20.3.8.1 Choosing a primary type</a></H4>
<p>
@@ -1298,7 +1298,7 @@ synonym&gt;
</li>
</ul>
-<H3><a name="Allegrocl_nn30">18.3.9 Function overloading/Parameter defaulting</a></H3>
+<H3><a name="Allegrocl_nn30">20.3.9 Function overloading/Parameter defaulting</a></H3>
<p>
@@ -1461,7 +1461,7 @@ overload&gt;
</pre>
</div>
-<H3><a name="Allegrocl_nn31">18.3.10 Operator wrapping and Operator overloading</a></H3>
+<H3><a name="Allegrocl_nn31">20.3.10 Operator wrapping and Operator overloading</a></H3>
<p>
@@ -1607,7 +1607,7 @@ opoverload&gt;
</pre>
</div>
-<H3><a name="Allegrocl_nn32">18.3.11 Varargs</a></H3>
+<H3><a name="Allegrocl_nn32">20.3.11 Varargs</a></H3>
<p>
@@ -1628,7 +1628,7 @@ opoverload&gt;
with other ways such functions can be wrapped.
</p>
-<H3><a name="Allegrocl_nn33">18.3.12 C++ Exceptions</a></H3>
+<H3><a name="Allegrocl_nn33">20.3.12 C++ Exceptions</a></H3>
<p>
@@ -1640,7 +1640,7 @@ opoverload&gt;
implemented.
</p>
-<H3><a name="Allegrocl_nn34">18.3.13 Pass by value, pass by reference</a></H3>
+<H3><a name="Allegrocl_nn34">20.3.13 Pass by value, pass by reference</a></H3>
<p>
@@ -1652,7 +1652,7 @@ opoverload&gt;
newly defined types.
</p>
-<H2><a name="Allegrocl_nn35">18.4 Typemaps</a></H2>
+<H2><a name="Allegrocl_nn35">20.4 Typemaps</a></H2>
<p>
@@ -1663,7 +1663,7 @@ opoverload&gt;
on <a href="Typemaps.html#Typemaps">Typemaps</a> for more information.
</p>
-<H3><a name="Allegrocl_nn36">18.4.1 Code Generation in the C++ Wrapper</a></H3>
+<H3><a name="Allegrocl_nn36">20.4.1 Code Generation in the C++ Wrapper</a></H3>
@@ -1693,7 +1693,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H4><a name="Allegrocl_nn37">18.4.1.1 IN Typemap</a></H4>
+<H4><a name="Allegrocl_nn37">20.4.1.1 IN Typemap</a></H4>
<p>
@@ -1728,7 +1728,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H4><a name="Allegrocl_nn38">18.4.1.2 OUT Typemap</a></H4>
+<H4><a name="Allegrocl_nn38">20.4.1.2 OUT Typemap</a></H4>
<p>
@@ -1752,7 +1752,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H4><a name="Allegrocl_nn39">18.4.1.3 CTYPE Typemap</a></H4>
+<H4><a name="Allegrocl_nn39">20.4.1.3 CTYPE Typemap</a></H4>
<p>
@@ -1784,7 +1784,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
these <a href="Typemaps.html#Typemaps_nn25">common typemaps</a> here.
</p>
-<H3><a name="Allegrocl_nn40">18.4.2 Code generation in Lisp wrappers</a></H3>
+<H3><a name="Allegrocl_nn40">20.4.2 Code generation in Lisp wrappers</a></H3>
<p>
@@ -1803,7 +1803,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
<a href="#Allegrocl_nn15">16.3.1 Namespaces</a> for details.
</p>
-<H4><a name="Allegrocl_nn41">18.4.2.1 LIN Typemap</a></H4>
+<H4><a name="Allegrocl_nn41">20.4.2.1 LIN Typemap</a></H4>
<p>
@@ -1846,7 +1846,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H4><a name="Allegrocl_nn42">18.4.2.2 LOUT Typemap</a></H4>
+<H4><a name="Allegrocl_nn42">20.4.2.2 LOUT Typemap</a></H4>
<p>
@@ -1889,7 +1889,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H4><a name="Allegrocl_nn43">18.4.2.3 FFITYPE Typemap</a></H4>
+<H4><a name="Allegrocl_nn43">20.4.2.3 FFITYPE Typemap</a></H4>
@@ -1939,7 +1939,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H4><a name="Allegrocl_nn44">18.4.2.4 LISPTYPE Typemap</a></H4>
+<H4><a name="Allegrocl_nn44">20.4.2.4 LISPTYPE Typemap</a></H4>
<p>
@@ -1959,7 +1959,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H4><a name="Allegrocl_nn45">18.4.2.5 LISPCLASS Typemap</a></H4>
+<H4><a name="Allegrocl_nn45">20.4.2.5 LISPCLASS Typemap</a></H4>
<p>
@@ -1983,7 +1983,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H3><a name="Allegrocl_nn46">18.4.3 Modifying SWIG behavior using typemaps</a></H3>
+<H3><a name="Allegrocl_nn46">20.4.3 Modifying SWIG behavior using typemaps</a></H3>
<p>
@@ -2017,10 +2017,10 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
</pre>
</div>
-<H2><a name="Allegrocl_nn47">18.5 Identifier Converter functions</a></H2>
+<H2><a name="Allegrocl_nn47">20.5 Identifier Converter functions</a></H2>
-<H3><a name="Allegrocl_nn48">18.5.1 Creating symbols in the lisp environment</a></H3>
+<H3><a name="Allegrocl_nn48">20.5.1 Creating symbols in the lisp environment</a></H3>
<p>
@@ -2041,11 +2041,11 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
of arguments.
</p>
-<H3><a name="Allegrocl_nn49">18.5.2 Existing identifier-converter functions</a></H3>
+<H3><a name="Allegrocl_nn49">20.5.2 Existing identifier-converter functions</a></H3>
<p>Two basic identifier routines have been defined.
-<H4><a name="Allegrocl_nn50">18.5.2.1 identifier-convert-null</a></H4>
+<H4><a name="Allegrocl_nn50">20.5.2.1 identifier-convert-null</a></H4>
<p>
@@ -2054,7 +2054,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
strings, from which a symbol will be created.
</p>
-<H4><a name="Allegrocl_nn51">18.5.2.2 identifier-convert-lispify</a></H4>
+<H4><a name="Allegrocl_nn51">20.5.2.2 identifier-convert-lispify</a></H4>
<p>
@@ -2063,7 +2063,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
same symbol transformations.
</p>
-<H4><a name="Allegrocl_nn52">18.5.2.3 Default identifier to symbol conversions</a></H4>
+<H4><a name="Allegrocl_nn52">20.5.2.3 Default identifier to symbol conversions</a></H4>
<p>
@@ -2072,7 +2072,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN)
default naming conventions.
</p>
-<H3><a name="Allegrocl_nn53">18.5.3 Defining your own identifier-converter</a></H3>
+<H3><a name="Allegrocl_nn53">20.5.3 Defining your own identifier-converter</a></H3>
<p>
@@ -2128,7 +2128,7 @@ indicating the number of arguments passed to the routine indicated by
this identifier.
</p>
-<H3><a name="Allegrocl_nn54">18.5.4 Instructing SWIG to use a particular identifier-converter</a></H3>
+<H3><a name="Allegrocl_nn54">20.5.4 Instructing SWIG to use a particular identifier-converter</a></H3>
<p>
diff --git a/Doc/Manual/Android.html b/Doc/Manual/Android.html
index b295b5e04..944a88d65 100644
--- a/Doc/Manual/Android.html
+++ b/Doc/Manual/Android.html
@@ -6,7 +6,7 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF">
-<H1><a name="Android">19 SWIG and Android</a></H1>
+<H1><a name="Android">21 SWIG and Android</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -31,7 +31,7 @@ This chapter describes SWIG's support of Android.
-<H2><a name="Android_overview">19.1 Overview</a></H2>
+<H2><a name="Android_overview">21.1 Overview</a></H2>
<p>
@@ -41,14 +41,14 @@ Everything in the <a href="Java.html#Java">Java chapter</a> applies to generatin
This chapter contains a few Android specific notes and examples.
</p>
-<H2><a name="Android_examples">19.2 Android examples</a></H2>
+<H2><a name="Android_examples">21.2 Android examples</a></H2>
-<H3><a name="Android_examples_intro">19.2.1 Examples introduction</a></H3>
+<H3><a name="Android_examples_intro">21.2.1 Examples introduction</a></H3>
<p>
-The examples require the <a href="http://developer.android.com/sdk/index.html">Android SDK</a> and <a href="http://developer.android.com/tools/sdk/ndk/index.html">Android NDK</a> which can be installed as per instructions in the links.
+The examples require the <a href="https://developer.android.com/sdk/">Android SDK</a> and <a href="https://developer.android.com/ndk/">Android NDK</a> which can be installed as per instructions in the links.
The Eclipse version is not required for these examples as just the command line tools are used (shown for Linux as the host, but Windows will be very similar, if not identical in most places).
Add the SDK tools and NDK tools to your path and create a directory somewhere for your Android projects (adjust PATH as necessary to where you installed the tools):
</p>
@@ -77,7 +77,7 @@ $ android list targets
The following examples are shipped with SWIG under the Examples/android directory and include a Makefile to build and install each example.
</p>
-<H3><a name="Android_example_simple">19.2.2 Simple C example</a></H3>
+<H3><a name="Android_example_simple">21.2.2 Simple C example</a></H3>
<p>
@@ -326,7 +326,7 @@ include $(BUILD_SHARED_LIBRARY)
</div>
<p>
-See the <a href="http://developer.android.com/sdk/ndk/index.html">Android NDK documentation</a> for more on the NDK build system and getting started with the NDK.
+See the <a href="https://developer.android.com/ndk/">Android NDK documentation</a> for more on the NDK build system and getting started with the NDK.
A simple invocation of ndk-build will compile the .c files and generate a shared object/system library. Output will be similar to:
</p>
@@ -399,7 +399,7 @@ Run the app again and this time you will see the output pictured below, showing
<center><img src="android-simple.png" alt="Android screenshot of SwigSimple example"></center>
-<H3><a name="Android_example_class">19.2.3 C++ class example</a></H3>
+<H3><a name="Android_example_class">21.2.3 C++ class example</a></H3>
<p>
@@ -409,7 +409,7 @@ All the steps required to compile and use a simple hierarchy of classes for shap
<p>
First create an Android project called <tt>SwigClass</tt> in a subdirectory called <tt>class</tt>.
-The steps below create and build a the JNI C++ app.
+The steps below create and build the JNI C++ app.
Adjust the <tt>--target</tt> id as mentioned earlier in the <a href="Android.html#Android_examples_intro">Examples introduction</a>.
</p>
@@ -747,7 +747,7 @@ Run the app to see the result of calling the C++ code from Java:
<center><img src="android-class.png" alt="Android screenshot of SwigClass example"></center>
-<H3><a name="Android_examples_other">19.2.4 Other examples</a></H3>
+<H3><a name="Android_examples_other">21.2.4 Other examples</a></H3>
<p>
@@ -759,7 +759,7 @@ Note that the 'extend' example is demonstrates the directors feature.
Normally C++ exception handling and the STL is not available by default in the version of g++ shipped with Android, but this example turns these features on as described in the next section.
</p>
-<H2><a name="Android_stl">19.3 C++ STL</a></H2>
+<H2><a name="Android_stl">21.3 C++ STL</a></H2>
<p>
diff --git a/Doc/Manual/Arguments.html b/Doc/Manual/Arguments.html
index 9dae9fdcd..2828bf4df 100644
--- a/Doc/Manual/Arguments.html
+++ b/Doc/Manual/Arguments.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Arguments">10 Argument Handling</a></H1>
+<H1><a name="Arguments">12 Argument Handling</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -32,7 +32,7 @@
<p>
-In Chapter 3, SWIG's treatment of basic datatypes and pointers was
+In Chapter 5, SWIG's treatment of basic datatypes and pointers was
described. In particular, primitive types such as <tt>int</tt> and
<tt>double</tt> are mapped to corresponding types in the target
language. For everything else, pointers are used to refer to
@@ -43,7 +43,7 @@ return multiple values through the arguments of a function. This chapter
describes some of the techniques for doing this.
</p>
-<H2><a name="Arguments_nn2">10.1 The typemaps.i library</a></H2>
+<H2><a name="Arguments_nn2">12.1 The typemaps.i library</a></H2>
<p>
@@ -51,7 +51,7 @@ This section describes the <tt>typemaps.i</tt> library file--commonly used to
change certain properties of argument conversion.
</p>
-<H3><a name="Arguments_nn3">10.1.1 Introduction</a></H3>
+<H3><a name="Arguments_nn3">12.1.1 Introduction</a></H3>
<p>
@@ -195,7 +195,7 @@ else. To clear a typemap, the <tt>%clear</tt> directive should be used. For e
</pre>
</div>
-<H3><a name="Arguments_nn4">10.1.2 Input parameters</a></H3>
+<H3><a name="Arguments_nn4">12.1.2 Input parameters</a></H3>
<p>
@@ -248,7 +248,7 @@ When the function is used in the scripting language interpreter, it will work li
result = add(3, 4)
</pre></div>
-<H3><a name="Arguments_nn5">10.1.3 Output parameters</a></H3>
+<H3><a name="Arguments_nn5">12.1.3 Output parameters</a></H3>
<p>
@@ -315,7 +315,7 @@ iresult, dresult = foo(3.5, 2)
</pre>
</div>
-<H3><a name="Arguments_nn6">10.1.4 Input/Output parameters</a></H3>
+<H3><a name="Arguments_nn6">12.1.4 Input/Output parameters</a></H3>
<p>
@@ -380,7 +380,7 @@ rather than directly overwriting the value of the original input object.
SWIG. Backwards compatibility is preserved, but deprecated.
</p>
-<H3><a name="Arguments_nn7">10.1.5 Using different names</a></H3>
+<H3><a name="Arguments_nn7">12.1.5 Using different names</a></H3>
<p>
@@ -414,7 +414,7 @@ Typemap declarations are lexically scoped so a typemap takes effect from the poi
file or a matching <tt>%clear</tt> declaration.
</p>
-<H2><a name="Arguments_nn8">10.2 Applying constraints to input values</a></H2>
+<H2><a name="Arguments_nn8">12.2 Applying constraints to input values</a></H2>
<p>
@@ -424,7 +424,7 @@ insure that a value is positive, or that a pointer is non-NULL. This
can be accomplished including the <tt>constraints.i</tt> library file.
</p>
-<H3><a name="Arguments_nn9">10.2.1 Simple constraint example</a></H3>
+<H3><a name="Arguments_nn9">12.2.1 Simple constraint example</a></H3>
<p>
@@ -450,7 +450,7 @@ the arguments violate the constraint condition, a scripting language
exception will be raised. As a result, it is possible to catch bad
values, prevent mysterious program crashes and so on.</p>
-<H3><a name="Arguments_nn10">10.2.2 Constraint methods</a></H3>
+<H3><a name="Arguments_nn10">12.2.2 Constraint methods</a></H3>
<p>
@@ -466,7 +466,7 @@ NONNULL Non-NULL pointer (pointers only).
</pre></div>
-<H3><a name="Arguments_nn11">10.2.3 Applying constraints to new datatypes</a></H3>
+<H3><a name="Arguments_nn11">12.2.3 Applying constraints to new datatypes</a></H3>
<p>
diff --git a/Doc/Manual/CCache.html b/Doc/Manual/CCache.html
index d23b0cb2f..edd435fa1 100644
--- a/Doc/Manual/CCache.html
+++ b/Doc/Manual/CCache.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="CCache">17 Using SWIG with ccache - ccache-swig(1) manpage</a></H1>
+<H1><a name="CCache">20 Using SWIG with ccache - ccache-swig(1) manpage</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -35,7 +35,7 @@
<p>
-<H2><a name="CCache_nn2">17.1 NAME</a></H2>
+<H2><a name="CCache_nn2">20.1 NAME</a></H2>
<p>
@@ -43,7 +43,7 @@
ccache-swig - a fast compiler cache
<p>
-<H2><a name="CCache_nn3">17.2 SYNOPSIS</a></H2>
+<H2><a name="CCache_nn3">20.2 SYNOPSIS</a></H2>
<p>
@@ -53,7 +53,7 @@ ccache-swig &lt;compiler&gt; [COMPILER OPTIONS]
<p>
&lt;compiler&gt; [COMPILER OPTIONS]
<p>
-<H2><a name="CCache_nn4">17.3 DESCRIPTION</a></H2>
+<H2><a name="CCache_nn4">20.3 DESCRIPTION</a></H2>
<p>
@@ -62,7 +62,7 @@ by caching previous compiles and detecting when the same compile is
being done again. ccache-swig is ccache plus support for SWIG. ccache
and ccache-swig are used interchangeably in this document.
<p>
-<H2><a name="CCache_nn5">17.4 OPTIONS SUMMARY</a></H2>
+<H2><a name="CCache_nn5">20.4 OPTIONS SUMMARY</a></H2>
<p>
@@ -82,7 +82,7 @@ Here is a summary of the options to ccache-swig.
</pre>
<p>
-<H2><a name="CCache_nn6">17.5 OPTIONS</a></H2>
+<H2><a name="CCache_nn6">20.5 OPTIONS</a></H2>
<p>
@@ -124,7 +124,7 @@ rounded down to the nearest multiple of 16 kilobytes.
<p>
</dl>
<p>
-<H2><a name="CCache_nn7">17.6 INSTALLATION</a></H2>
+<H2><a name="CCache_nn7">20.6 INSTALLATION</a></H2>
<p>
@@ -156,7 +156,7 @@ This will work as long as /usr/local/bin comes before the path to gcc
Note! Do not use a hard link, use a symbolic link. A hardlink will
cause "interesting" problems.
<p>
-<H2><a name="CCache_nn8">17.7 EXTRA OPTIONS</a></H2>
+<H2><a name="CCache_nn8">20.7 EXTRA OPTIONS</a></H2>
<p>
@@ -176,7 +176,7 @@ file). By using --ccache-skip you can force an option to not be
treated as an input file name and instead be passed along to the
compiler as a command line option.
<p>
-<H2><a name="CCache_nn9">17.8 ENVIRONMENT VARIABLES</a></H2>
+<H2><a name="CCache_nn9">20.8 ENVIRONMENT VARIABLES</a></H2>
<p>
@@ -315,7 +315,7 @@ the use of '#pragma SWIG'.
<p>
</dl>
<p>
-<H2><a name="CCache_nn10">17.9 CACHE SIZE MANAGEMENT</a></H2>
+<H2><a name="CCache_nn10">20.9 CACHE SIZE MANAGEMENT</a></H2>
<p>
@@ -328,7 +328,7 @@ When these limits are reached ccache will reduce the cache to 20%
below the numbers you specified in order to avoid doing the cache
clean operation too often.
<p>
-<H2><a name="CCache_nn11">17.10 CACHE COMPRESSION</a></H2>
+<H2><a name="CCache_nn11">20.10 CACHE COMPRESSION</a></H2>
<p>
@@ -339,7 +339,7 @@ performance slowdown, it significantly increases the number of files
that fit in the cache. You can turn off compression setting the
CCACHE_NOCOMPRESS environment variable.
<p>
-<H2><a name="CCache_nn12">17.11 HOW IT WORKS</a></H2>
+<H2><a name="CCache_nn12">20.11 HOW IT WORKS</a></H2>
<p>
@@ -364,7 +364,7 @@ compiler output that you would get without the cache. If you ever
discover a case where ccache changes the output of your compiler then
please let me know.
<p>
-<H2><a name="CCache_nn13">17.12 USING CCACHE WITH DISTCC</a></H2>
+<H2><a name="CCache_nn13">20.12 USING CCACHE WITH DISTCC</a></H2>
<p>
@@ -378,7 +378,7 @@ option. You just need to set the environment variable CCACHE_PREFIX to
'distcc' and ccache will prefix the command line used with the
compiler with the command 'distcc'.
<p>
-<H2><a name="CCache_nn14">17.13 SHARING A CACHE</a></H2>
+<H2><a name="CCache_nn14">20.13 SHARING A CACHE</a></H2>
<p>
@@ -407,11 +407,11 @@ following conditions need to be met:
versions of ccache that do not support compression.
</ul>
<p>
-<H2><a name="CCache_nn15">17.14 HISTORY</a></H2>
+<H2><a name="CCache_nn15">20.14 HISTORY</a></H2>
<p>
-ccache was inspired by the compilercache shell script script written
+ccache was inspired by the compilercache shell script written
by Erik Thiele and I would like to thank him for an excellent piece of
work. See
<a href="http://www.erikyyy.de/compilercache/">http://www.erikyyy.de/compilercache/</a>
@@ -423,7 +423,7 @@ I wrote ccache because I wanted to get a bit more speed out of a
compiler cache and I wanted to remove some of the limitations of the
shell-script version.
<p>
-<H2><a name="CCache_nn16">17.15 DIFFERENCES FROM COMPILERCACHE</a></H2>
+<H2><a name="CCache_nn16">20.15 DIFFERENCES FROM COMPILERCACHE</a></H2>
<p>
@@ -441,7 +441,7 @@ are:
<li> ccache avoids a double call to cpp on a cache miss
</ul>
<p>
-<H2><a name="CCache_nn17">17.16 CREDITS</a></H2>
+<H2><a name="CCache_nn17">20.16 CREDITS</a></H2>
<p>
@@ -453,12 +453,12 @@ Thanks to the following people for their contributions to ccache
<li> Paul Russell for many suggestions and the debian packaging
</ul>
<p>
-<H2><a name="CCache_nn18">17.17 AUTHOR</a></H2>
+<H2><a name="CCache_nn18">20.17 AUTHOR</a></H2>
<p>
ccache was written by Andrew Tridgell
-<a href="http://samba.org/~tridge/">http://samba.org/~tridge/</a>.
+<a href="https://www.samba.org/~tridge/">https://www.samba.org/~tridge/</a>.
ccache was adapted to create ccache-swig for use with SWIG by William Fulton.
<p>
If you wish to report a problem or make a suggestion then please email
diff --git a/Doc/Manual/CPlusPlus11.html b/Doc/Manual/CPlusPlus11.html
index 4d4261cd7..11335a251 100644
--- a/Doc/Manual/CPlusPlus11.html
+++ b/Doc/Manual/CPlusPlus11.html
@@ -32,6 +32,7 @@
<li><a href="#CPlusPlus11_alias_templates">Type alias and alias templates</a>
<li><a href="#CPlusPlus11_unrestricted_unions">Unrestricted unions</a>
<li><a href="#CPlusPlus11_variadic_templates">Variadic templates</a>
+<li><a href="#CPlusPlus11_new_char_literals">New character literals</a>
<li><a href="#CPlusPlus11_new_string_literals">New string literals</a>
<li><a href="#CPlusPlus11_user_defined_literals">User-defined literals</a>
<li><a href="#CPlusPlus11_thread_local_storage">Thread-local storage</a>
@@ -42,6 +43,7 @@
<li><a href="#CPlusPlus11_noexcept">Exception specifications and noexcept</a>
<li><a href="#CPlusPlus11_alignment">Control and query object alignment</a>
<li><a href="#CPlusPlus11_attributes">Attributes</a>
+<li><a href="#CPlusPlus11_ref_qualifiers">Methods with ref-qualifiers</a>
</ul>
<li><a href="#CPlusPlus11_standard_library_changes">Standard library changes</a>
<ul>
@@ -713,7 +715,24 @@ const int SIZE = sizeof...(ClassName&lt;int, int&gt;);
In the above example <tt>SIZE</tt> is of course wrapped as a constant.
</p>
-<H3><a name="CPlusPlus11_new_string_literals">7.2.19 New string literals</a></H3>
+<H3><a name="CPlusPlus11_new_char_literals">7.2.19 New character literals</a></H3>
+
+
+<p>
+C++11 adds support for UCS-2 and UCS-4 character literals.
+These character literals are preceded by either 'u' or 'U'.
+</p>
+
+<div class="code"><pre>
+char16_t a = u'a';
+char32_t b = U'b';
+</pre></div>
+
+<p>
+<b>Compatibility note:</b> SWIG-4.0.0 was the first version to support these Universal Coded Character Set (UCS) character literals.
+</p>
+
+<H3><a name="CPlusPlus11_new_string_literals">7.2.20 New string literals</a></H3>
<p>SWIG supports wide string and Unicode string constants and raw string literals.</p>
@@ -743,7 +762,7 @@ Note: There is a bug currently where SWIG's preprocessor incorrectly parses an o
inside raw string literals.
</p>
-<H3><a name="CPlusPlus11_user_defined_literals">7.2.20 User-defined literals</a></H3>
+<H3><a name="CPlusPlus11_user_defined_literals">7.2.21 User-defined literals</a></H3>
<p>
@@ -810,7 +829,7 @@ OutputType var2 = 1234_suffix;
OutputType var3 = 3.1416_suffix;
</pre></div>
-<H3><a name="CPlusPlus11_thread_local_storage">7.2.21 Thread-local storage</a></H3>
+<H3><a name="CPlusPlus11_thread_local_storage">7.2.22 Thread-local storage</a></H3>
<p>SWIG correctly parses the <tt>thread_local</tt> keyword. For example, variables
@@ -830,7 +849,7 @@ A variable will be thread local if accessed from different threads from the targ
same way that it will be thread local if accessed from C++ code.
</p>
-<H3><a name="CPlusPlus11_defaulted_deleted">7.2.22 Explicitly defaulted functions and deleted functions</a></H3>
+<H3><a name="CPlusPlus11_defaulted_deleted">7.2.23 Explicitly defaulted functions and deleted functions</a></H3>
<p>SWIG handles explicitly defaulted functions, that is, <tt>= default</tt> added to a function declaration. Deleted definitions, which are also called deleted functions, have <tt>= delete</tt> added to the function declaration.
@@ -868,16 +887,17 @@ This is a C++ compile time check and SWIG does not make any attempt to detect if
so in this case it is entirely possible to pass an int instead of a double to <tt>f</tt> from Java, Python etc.
</p>
-<H3><a name="CPlusPlus11_type_long_long_int">7.2.23 Type long long int</a></H3>
+<H3><a name="CPlusPlus11_type_long_long_int">7.2.24 Type long long int</a></H3>
<p>SWIG correctly parses and uses the new <tt>long long</tt> type already introduced in C99 some time ago.</p>
-<H3><a name="CPlusPlus11_static_assertions">7.2.24 Static assertions</a></H3>
+<H3><a name="CPlusPlus11_static_assertions">7.2.25 Static assertions</a></H3>
<p>
-SWIG correctly parses the new <tt>static_assert</tt> declarations.
+SWIG correctly parses the new <tt>static_assert</tt> declarations (though 3.0.12 and earlier
+had a bug which meant this wasn't accepted at file scope).
This is a C++ compile time directive so there isn't anything useful that SWIG can do with it.
</p>
@@ -888,7 +908,7 @@ struct Check {
};
</pre></div>
-<H3><a name="CPlusPlus11_sizeof">7.2.25 Allow sizeof to work on members of classes without an explicit object</a></H3>
+<H3><a name="CPlusPlus11_sizeof">7.2.26 Allow sizeof to work on members of classes without an explicit object</a></H3>
<p>
@@ -909,7 +929,7 @@ const int SIZE = sizeof(A::member); // does not work with C++03. Okay with C++11
8
</pre></div>
-<H3><a name="CPlusPlus11_noexcept">7.2.26 Exception specifications and noexcept</a></H3>
+<H3><a name="CPlusPlus11_noexcept">7.2.27 Exception specifications and noexcept</a></H3>
<p>
@@ -925,7 +945,7 @@ int noex2(int) noexcept(true);
int noex3(int, bool) noexcept(false);
</pre></div>
-<H3><a name="CPlusPlus11_alignment">7.2.27 Control and query object alignment</a></H3>
+<H3><a name="CPlusPlus11_alignment">7.2.28 Control and query object alignment</a></H3>
<p>
@@ -957,7 +977,7 @@ Use the preprocessor to work around this for now:
</pre></div>
-<H3><a name="CPlusPlus11_attributes">7.2.28 Attributes</a></H3>
+<H3><a name="CPlusPlus11_attributes">7.2.29 Attributes</a></H3>
<p>
@@ -970,6 +990,104 @@ int [[attr1]] i [[attr2, attr3]];
[[noreturn, nothrow]] void f [[noreturn]] ();
</pre></div>
+
+<H3><a name="CPlusPlus11_ref_qualifiers">7.2.30 Methods with ref-qualifiers</a></H3>
+
+
+<p>
+C++11 non-static member functions can be declared with ref-qualifiers.
+Member functions declared with a <tt>&amp;</tt> lvalue ref-qualifiers are wrapped like any other function without ref-qualifiers.
+Member functions declared with a <tt>&amp;&amp;</tt> rvalue ref-qualifiers are ignored by default
+as they are unlikely to be required from non-C++ languages where the concept of <i>rvalue-ness</i>
+for the implied *this pointer does not apply.
+The warning is hidden by default, but can be displayed as described in the section on <a href="Warnings.html#Warnings_nn4">Enabling extra warnings</a>.
+</p>
+
+<p>
+Consider:
+</p>
+
+<div class="code"><pre>
+struct RQ {
+ void m1(int x) &amp;;
+ void m2(int x) &amp;&amp;;
+};
+</pre></div>
+
+<p>
+The only wrapped method will be the lvalue ref-qualified method <tt>m1</tt>
+and if SWIG is run with the <tt>-Wextra</tt> command-line option, the following warning will be issued indicating <tt>m2</tt> is not wrapped:
+</p>
+
+<div class="shell">
+<pre>
+example.i:7: Warning 405: Method with rvalue ref-qualifier m2(int) &amp;&amp; ignored.
+</pre>
+</div>
+
+<p>
+If you unignore the method as follows, wrappers for <tt>m2</tt> will be generated:
+</p>
+
+<div class="code"><pre>
+%feature("ignore", "0") RQ::m2(int x) &amp;&amp;;
+struct RQ {
+ void m1(int x) &amp;;
+ void m2(int x) &amp;&amp;;
+};
+</pre></div>
+
+<p>
+Inspection of the generated C++ code, will show that <tt>std::move</tt> is used on the instance
+of the <tt>RQ *</tt> class:
+</p>
+
+<div class="code"><pre>
+ RQ *arg1 = (RQ *) 0 ;
+ int arg2 ;
+
+ arg1 = ...marshalled from target language...
+ arg2 = ...marshalled from target language...
+
+ std::move(*arg1).m2(arg2);
+</pre></div>
+
+<p>
+This will compile but when run, the move effects may not be what you want.
+As stated earlier, rvalue ref-qualifiers aren't really applicable outside the world of C++.
+However, if you really know what you are doing, full control over the call to the method is
+possible via the low-level "action" feature.
+This feature completely replaces the call to the underlying function, that is, the last line in the snippet of code above.
+</p>
+
+<div class="code"><pre>
+%feature("ignore", "0") RQ::m2(int x) &amp;&amp;;
+%feature("action") RQ::m2(int x) &amp;&amp; %{
+ RQ().m2(arg2);
+%}
+struct RQ {
+ void m1(int x) &amp;;
+ void m2(int x) &amp;&amp;;
+};
+</pre></div>
+
+<p>
+resulting in:
+</p>
+
+<div class="code"><pre>
+ RQ *arg1 = (RQ *) 0 ;
+ int arg2 ;
+
+ arg1 = ...marshalled from target language...
+ arg2 = ...marshalled from target language...
+
+ RQ().m2(arg2);
+</pre></div>
+
+<p>
+<b>Compatibility note:</b> SWIG-4.0.0 was the first version to support ref-qualifiers.
+</p>
<H2><a name="CPlusPlus11_standard_library_changes">7.3 Standard library changes</a></H2>
@@ -994,7 +1112,8 @@ Variadic template support requires further work to provide substantial tuple wra
<p>
The new hash tables in the STL are <tt>unordered_set</tt>, <tt>unordered_multiset</tt>, <tt>unordered_map</tt>, <tt>unordered_multimap</tt>.
-These are not available in SWIG, but in principle should be easily implemented by adapting the current STL containers.
+These are not available in all target languages.
+Any missing support can in principle be easily implemented by adapting the current STL containers.
</p>
<H3><a name="CPlusPlus11_regular_expressions">7.3.4 Regular expressions</a></H3>
@@ -1175,5 +1294,6 @@ Phew, that is a lot of hard work to get a callback working.
You could just go with the more attractive option of just using <tt>double</tt> as the return type in the function declaration instead of <tt>result_of</tt>!
</p>
+
</body>
</html>
diff --git a/Doc/Manual/CPlusPlus14.html b/Doc/Manual/CPlusPlus14.html
new file mode 100644
index 000000000..b162c7818
--- /dev/null
+++ b/Doc/Manual/CPlusPlus14.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>SWIG and C++14</title>
+<link rel="stylesheet" type="text/css" href="style.css">
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+</head>
+
+<body bgcolor="#ffffff">
+<H1><a name="CPlusPlus14">8 SWIG and C++14</a></H1>
+<!-- INDEX -->
+<div class="sectiontoc">
+<ul>
+<li><a href="#CPlusPlus14_introduction">Introduction</a>
+<li><a href="#CPlusPlus14_core_language_changes">Core language changes</a>
+<ul>
+<li><a href="#CPlusPlus14_binary_literals">Binary integer literals</a>
+</ul>
+<li><a href="#CPlusPlus14_standard_library_changes">Standard library changes</a>
+</ul>
+</div>
+<!-- INDEX -->
+
+
+
+<H2><a name="CPlusPlus14_introduction">8.1 Introduction</a></H2>
+
+
+<p>This chapter gives you a brief overview about the SWIG
+implementation of the C++14 standard.
+There isn't much in C++14 that affects SWIG, however, work has only just begun on adding
+C++14 support.
+</p>
+
+<p>
+<b>Compatibility note:</b> SWIG-4.0.0 is the first version to support any C++14 features.
+</p>
+
+<H2><a name="CPlusPlus14_core_language_changes">8.2 Core language changes</a></H2>
+
+
+<H3><a name="CPlusPlus14_binary_literals">8.2.1 Binary integer literals</a></H3>
+
+
+<p>
+C++14 added binary integer literals and SWIG supports these.
+Example:
+</p>
+
+<div class="code">
+<pre>
+int b = 0b101011;
+</pre>
+</div>
+
+<H2><a name="CPlusPlus14_standard_library_changes">8.3 Standard library changes</a></H2>
+
+
+</body>
+</html>
diff --git a/Doc/Manual/CPlusPlus17.html b/Doc/Manual/CPlusPlus17.html
new file mode 100644
index 000000000..a2346660a
--- /dev/null
+++ b/Doc/Manual/CPlusPlus17.html
@@ -0,0 +1,109 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>SWIG and C++17</title>
+<link rel="stylesheet" type="text/css" href="style.css">
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+</head>
+
+<body bgcolor="#ffffff">
+<H1><a name="CPlusPlus17">9 SWIG and C++17</a></H1>
+<!-- INDEX -->
+<div class="sectiontoc">
+<ul>
+<li><a href="#CPlusPlus17_introduction">Introduction</a>
+<li><a href="#CPlusPlus17_core_language_changes">Core language changes</a>
+<ul>
+<li><a href="#CPlusPlus17_nested_namespaces">Nested namespace definitions</a>
+<li><a href="#CPlusPlus17_u8_char_literals">UTF-8 character literals</a>
+<li><a href="#CPlusPlus17_hexadecimal_floating_literals">Hexadecimal floating literals</a>
+</ul>
+<li><a href="#CPlusPlus17_standard_library_changes">Standard library changes</a>
+</ul>
+</div>
+<!-- INDEX -->
+
+
+
+<H2><a name="CPlusPlus17_introduction">9.1 Introduction</a></H2>
+
+
+<p>This chapter gives you a brief overview about the SWIG
+implementation of the C++17 standard.
+There isn't much in C++17 that affects SWIG, however, work has only just begun on adding
+C++17 support.
+</p>
+
+<p>
+<b>Compatibility note:</b> SWIG-4.0.0 is the first version to support any C++17 features.
+</p>
+
+<H2><a name="CPlusPlus17_core_language_changes">9.2 Core language changes</a></H2>
+
+
+<H3><a name="CPlusPlus17_nested_namespaces">9.2.1 Nested namespace definitions</a></H3>
+
+
+<p>
+C++17 offers a more concise syntax for defining namespaces.
+SWIG has support for nested namespace definitions such as:
+</p>
+
+<div class="code">
+<pre>
+namespace A::B::C {
+ ...
+}
+</pre>
+</div>
+
+<p>
+This is the equivalent to the C++98 namespace definitions:
+</p>
+
+<div class="code">
+<pre>
+namespace A {
+ namespace B {
+ namespace C {
+ ...
+ }
+ }
+}
+</pre>
+</div>
+
+<H3><a name="CPlusPlus17_u8_char_literals">9.2.2 UTF-8 character literals</a></H3>
+
+
+<p>
+C++17 added UTF-8 (u8) character literals.
+These are of type char.
+Example:
+</p>
+
+<div class="code">
+<pre>
+char a = u8'a';
+</pre>
+</div>
+
+<H3><a name="CPlusPlus17_hexadecimal_floating_literals">9.2.3 Hexadecimal floating literals</a></H3>
+
+
+<p>
+C++17 added hexadecimal floating literals.
+For example:
+</p>
+
+<div class="code">
+<pre>
+double f = 0xF.68p2;
+</pre>
+</div>
+
+<H2><a name="CPlusPlus17_standard_library_changes">9.3 Standard library changes</a></H2>
+
+
+</body>
+</html>
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html
index 5be63a340..1fc2d211e 100644
--- a/Doc/Manual/CSharp.html
+++ b/Doc/Manual/CSharp.html
@@ -6,7 +6,7 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF">
-<H1><a name="CSharp">20 SWIG and C#</a></H1>
+<H1><a name="CSharp">22 SWIG and C#</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -44,7 +44,8 @@
<li><a href="#CSharp_date_marshalling">Date marshalling using the csin typemap and associated attributes</a>
<li><a href="#CSharp_date_properties">A date example demonstrating marshalling of C# properties</a>
<li><a href="#CSharp_date_pre_post_directors">Date example demonstrating the 'pre' and 'post' typemap attributes for directors</a>
-<li><a href="#CSharp_partial_classes">Turning wrapped classes into partial classes</a>
+<li><a href="#CSharp_partial_classes">Turning proxy classes into partial classes</a>
+<li><a href="#CSharp_sealed_proxy_class">Turning proxy classes into sealed classes</a>
<li><a href="#CSharp_extending_proxy_class">Extending proxy classes with additional C# code</a>
<li><a href="#CSharp_enum_underlying_type">Underlying type for enums</a>
</ul>
@@ -54,7 +55,7 @@
-<H2><a name="CSharp_introduction">20.1 Introduction</a></H2>
+<H2><a name="CSharp_introduction">22.1 Introduction</a></H2>
<p>
@@ -63,18 +64,18 @@ The wrapper code implementation uses C# and the Platform Invoke (PInvoke) interf
The PInvoke interface has been chosen over Microsoft's Managed C++ interface as it is portable to both Microsoft Windows and non-Microsoft platforms.
PInvoke is part of the ECMA/ISO C# specification.
It is also better suited for robust production environments due to the Managed C++ flaw called the
-<a href="http://msdn.microsoft.com/en-us/library/aa290048(VS.71).aspx">Mixed DLL Loading Problem</a>.
+<a href="https://msdn.microsoft.com/en-us/ie/aa290048(v=vs.94)">Mixed DLL Loading Problem</a>.
SWIG C# works equally well on non-Microsoft operating systems such as Linux, Solaris and Apple Mac using
-<a href="http://www.mono-project.com/Main_Page">Mono</a> and <a href="http://www.dotgnu.org/pnet.html">Portable.NET</a>.
+<a href="https://www.mono-project.com/Main_Page/">Mono</a> and <a href="http://www.dotgnu.org/pnet.html">Portable.NET</a>.
</p>
<p>
To get the most out of this chapter an understanding of interop is required.
-The <a href="http://msdn.microsoft.com">Microsoft Developer Network (MSDN)</a> has a good reference guide in a section titled "Interop Marshaling".
-Monodoc, available from the Mono project, has a very useful section titled <a href="http://www.mono-project.com/docs/advanced/pinvoke/">Interop with native libraries</a>.
+The <a href="https://msdn.microsoft.com">Microsoft Developer Network (MSDN)</a> has a good reference guide in a section titled "Interop Marshaling".
+Monodoc, available from the Mono project, has a very useful section titled <a href="https://www.mono-project.com/docs/advanced/pinvoke/">Interop with native libraries</a>.
</p>
-<H3><a name="CSharp_introduction_swig2_compatibility">20.1.1 SWIG 2 Compatibility</a></H3>
+<H3><a name="CSharp_introduction_swig2_compatibility">22.1.1 SWIG 2 Compatibility</a></H3>
<p>
@@ -82,7 +83,7 @@ In order to minimize name collisions between names generated based on input to S
</p>
-<H3><a name="CSharp_commandline">20.1.2 Additional command line options</a></H3>
+<H3><a name="CSharp_commandline">22.1.2 Additional command line options</a></H3>
<p>
@@ -134,7 +135,7 @@ Note that the file extension (.cs) will not be automatically added and needs to
Due to possible compiler limits it is not advisable to use <tt>-outfile</tt> for large projects.
</p>
-<H2><a name="CSharp_differences_java">20.2 Differences to the Java module</a></H2>
+<H2><a name="CSharp_differences_java">22.2 Differences to the Java module</a></H2>
<p>
@@ -231,8 +232,8 @@ javacode -&gt; cscode
javaimports -&gt; csimports
javabody -&gt; csbody
javafinalize -&gt; csfinalize
-javadestruct -&gt; csdestruct
-javadestruct_derived -&gt; csdestruct_derived
+javadestruct -&gt; csdisposing and csdispose
+javadestruct_derived -&gt; csdisposing_derived and csdispose_derived
javainterfacecode -&gt; csinterfacecode
</pre></div>
@@ -555,7 +556,7 @@ Windows users can also get the examples working using a
<a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> environment for automatic configuration of the example makefiles.
Any one of the C# compilers (Mono or Microsoft) can be detected from within a Cygwin or Mingw environment if installed in your path.
-<H2><a name="CSharp_void_pointers">20.3 Void pointers</a></H2>
+<H2><a name="CSharp_void_pointers">22.3 Void pointers</a></H2>
<p>
@@ -573,7 +574,7 @@ void * f(void *v);
</pre>
</div>
-<H2><a name="CSharp_arrays">20.4 C# Arrays</a></H2>
+<H2><a name="CSharp_arrays">22.4 C# Arrays</a></H2>
<p>
@@ -585,7 +586,7 @@ with one of the following three approaches; namely the SWIG C arrays library, P/
pinned arrays.
</p>
-<H3><a name="CSharp_arrays_swig_library">20.4.1 The SWIG C arrays library</a></H3>
+<H3><a name="CSharp_arrays_swig_library">22.4.1 The SWIG C arrays library</a></H3>
<p>
@@ -622,7 +623,7 @@ example.print_array(c.cast()); // Pass to C
</div>
-<H3><a name="CSharp_arrays_pinvoke_default_array_marshalling">20.4.2 Managed arrays using P/Invoke default array marshalling</a></H3>
+<H3><a name="CSharp_arrays_pinvoke_default_array_marshalling">22.4.2 Managed arrays using P/Invoke default array marshalling</a></H3>
<p>
@@ -642,7 +643,7 @@ passing a direct reference as described in the next section.
<p>
For more information on the subject, see the
-<a href="http://msdn.microsoft.com/en-us/library/z6cfh6e6(VS.80).aspx">Default Marshaling for Arrays</a> article
+<a href="https://docs.microsoft.com/en-us/dotnet/framework/interop/default-marshaling-for-arrays">Default Marshaling for Arrays</a> article
on MSDN.
</p>
@@ -677,7 +678,7 @@ As a result, we get the following method in the module class:
<div class="code">
<pre>
public static void myArrayCopy(int[] sourceArray, int[] targetArray, int nitems) {
- examplePINVOKE.myArrayCopy(sourceArray, targetArray, nitems);
+ examplePINVOKE.myArrayCopy(sourceArray, targetArray, nitems);
}
</pre>
</div>
@@ -749,7 +750,7 @@ and intermediary class method
</div>
-<H3><a name="CSharp_arrays_pinning">20.4.3 Managed arrays using pinning</a></H3>
+<H3><a name="CSharp_arrays_pinning">22.4.3 Managed arrays using pinning</a></H3>
<p>
@@ -762,7 +763,7 @@ another thread may produce enough garbage to trigger garbage collection.
</p>
<p>
-For more information, see the <a href="http://msdn.microsoft.com/en-us/library/f58wzh21(VS.80).aspx">fixed statement</a> in the C# language reference.
+For more information, see the <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/fixed-statement">fixed statement</a> in the C# language reference.
</p>
@@ -844,7 +845,7 @@ public static extern void myArrayCopy(global::System.IntPtr jarg1, global::Syste
-<H2><a name="CSharp_exceptions">20.5 C# Exceptions</a></H2>
+<H2><a name="CSharp_exceptions">22.5 C# Exceptions</a></H2>
<p>
@@ -941,7 +942,7 @@ set so should only be used when a C# exception is not created.
</p>
-<H3><a name="CSharp_exception_example_check_typemap">20.5.1 C# exception example using "check" typemap</a></H3>
+<H3><a name="CSharp_exception_example_check_typemap">22.5.1 C# exception example using "check" typemap</a></H3>
<p>
@@ -997,9 +998,9 @@ When the following C# code is executed:
<div class="code">
<pre>
public class runme {
- static void Main() {
- example.positivesonly(-1);
- }
+ static void Main() {
+ example.positivesonly(-1);
+ }
}
</pre>
</div>
@@ -1123,7 +1124,7 @@ method and C# code does not handle pending exceptions via the canthrow attribute
Actually it will issue this warning for any function beginning with <tt>SWIG_CSharpSetPendingException</tt>.
</P>
-<H3><a name="CSharp_exception_example_percent_exception">20.5.2 C# exception example using %exception</a></H3>
+<H3><a name="CSharp_exception_example_percent_exception">22.5.2 C# exception example using %exception</a></H3>
<p>
@@ -1188,7 +1189,7 @@ The managed code generated does check for the pending exception as mentioned ear
</pre>
</div>
-<H3><a name="CSharp_exception_example_exception_specifications">20.5.3 C# exception example using exception specifications</a></H3>
+<H3><a name="CSharp_exception_example_exception_specifications">22.5.3 C# exception example using exception specifications</a></H3>
<p>
@@ -1244,7 +1245,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_evensonly(int jarg1) {
Multiple catch handlers are generated should there be more than one exception specifications declared.
</p>
-<H3><a name="CSharp_custom_application_exception">20.5.4 Custom C# ApplicationException example</a></H3>
+<H3><a name="CSharp_custom_application_exception">22.5.4 Custom C# ApplicationException example</a></H3>
<p>
@@ -1378,7 +1379,7 @@ try {
</pre>
</div>
-<H2><a name="CSharp_directors">20.6 C# Directors</a></H2>
+<H2><a name="CSharp_directors">22.6 C# Directors</a></H2>
<p>
@@ -1391,7 +1392,7 @@ The following sections provide information on the C# director implementation and
However, the <a href="Java.html#Java_directors">Java directors</a> section should also be read in order to gain more insight into directors.
</p>
-<H3><a name="CSharp_directors_example">20.6.1 Directors example</a></H3>
+<H3><a name="CSharp_directors_example">22.6.1 Directors example</a></H3>
<p>
@@ -1512,7 +1513,7 @@ CSharpDerived - UIntMethod(123)
</pre>
</div>
-<H3><a name="CSharp_directors_implementation">20.6.2 Directors implementation</a></H3>
+<H3><a name="CSharp_directors_implementation">22.6.2 Directors implementation</a></H3>
<p>
@@ -1574,9 +1575,9 @@ public class Base : global::System.IDisposable {
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("UIntMethod", swigMethodTypes0))
- swigDelegate0 = new SwigDelegateBase_0(SwigDirectorUIntMethod);
+ swigDelegate0 = new SwigDelegateBase_0(SwigDirectorMethodUIntMethod);
if (SwigDerivedClassHasMethod("BaseBoolMethod", swigMethodTypes1))
- swigDelegate1 = new SwigDelegateBase_1(SwigDirectorBaseBoolMethod);
+ swigDelegate1 = new SwigDelegateBase_1(SwigDirectorMethodBaseBoolMethod);
examplePINVOKE.Base_director_connect(swigCPtr, swigDelegate0, swigDelegate1);
}
@@ -1586,11 +1587,11 @@ public class Base : global::System.IDisposable {
return hasDerivedMethod;
}
- private uint SwigDirectorUIntMethod(uint x) {
+ private uint SwigDirectorMethodUIntMethod(uint x) {
return UIntMethod(x);
}
- private void SwigDirectorBaseBoolMethod(global::System.IntPtr b, bool flag) {
+ private void SwigDirectorMethodBaseBoolMethod(global::System.IntPtr b, bool flag) {
BaseBoolMethod(new Base(b, false), flag);
}
@@ -1619,9 +1620,9 @@ It uses a support method, <tt>SwigDerivedClassHasMethod()</tt>, which simply use
BaseBoolMethod, with the list of required parameter types, exists in a subclass.
If it does not exist, the delegate is not initialised as there is no need for unmanaged code to call back into managed C# code.
However, if there is an overridden method in any subclass, the delegate is required.
-It is then initialised to the <tt>SwigDirectorBaseBoolMethod</tt> which in turn will call <tt>BaseBoolMethod</tt> if invoked.
+It is then initialised to the <tt>SwigDirectorMethodBaseBoolMethod</tt> which in turn will call <tt>BaseBoolMethod</tt> if invoked.
The delegate is not initialised to the <tt>BaseBoolMethod</tt> directly as quite often types will need marshalling from the unmanaged type
-to the managed type in which case an intermediary method (<tt>SwigDirectorBaseBoolMethod</tt>) is required for the marshalling.
+to the managed type in which case an intermediary method (<tt>SwigDirectorMethodBaseBoolMethod</tt>) is required for the marshalling.
In this case, the C# <tt>Base</tt> class needs to be created from the unmanaged <tt>IntPtr</tt> type.
</p>
@@ -1720,7 +1721,7 @@ before SWIG parses the Base class will change all the delegates to <tt>internal<
</pre>
</div>
-<H3><a name="CSharp_director_caveats">20.6.3 Director caveats</a></H3>
+<H3><a name="CSharp_director_caveats">22.6.3 Director caveats</a></H3>
<p>
@@ -1768,11 +1769,11 @@ However, a call from C# to <tt>CSharpDefaults.DefaultMethod()</tt> will of cours
should pass the call on to <tt>CSharpDefaults.DefaultMethod(int)</tt>using the C++ default value, as shown above.
</p>
-<H2><a name="CSharp_multiple_modules">20.7 Multiple modules</a></H2>
+<H2><a name="CSharp_multiple_modules">22.7 Multiple modules</a></H2>
<p>
-When using <a href="Modules.html#Modules">multiple modules</a> it is is possible to compile each SWIG generated wrapper
+When using <a href="Modules.html#Modules">multiple modules</a> it is possible to compile each SWIG generated wrapper
into a different assembly.
However, by default the generated code may not compile if
generated classes in one assembly use generated classes in another assembly.
@@ -1803,7 +1804,7 @@ the <tt>[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrows
if you don't want users to easily stumble upon these so called 'internal workings' of the wrappers.
</p>
-<H2><a name="CSharp_typemap_examples">20.8 C# Typemap examples</a></H2>
+<H2><a name="CSharp_typemap_examples">22.8 C# Typemap examples</a></H2>
This section includes a few examples of typemaps. For more examples, you
@@ -1811,7 +1812,7 @@ might look at the files "<tt>csharp.swg</tt>" and "<tt>typemaps.i</tt>" in
the SWIG library.
-<H3><a name="CSharp_memory_management_member_variables">20.8.1 Memory management when returning references to member variables</a></H3>
+<H3><a name="CSharp_memory_management_member_variables">22.8.1 Memory management when returning references to member variables</a></H3>
<p>
@@ -1827,7 +1828,7 @@ Consider the following C++ code:
<pre>
struct Wheel {
int size;
- Wheel(int sz) : size(sz) {}
+ Wheel(int sz = 0) : size(sz) {}
};
class Bike {
@@ -1846,12 +1847,12 @@ and the following usage from C# after running the code through SWIG:
<div class="code">
<pre>
- Wheel wheel = new Bike(10).getWheel();
- Console.WriteLine("wheel size: " + wheel.size);
- // Simulate a garbage collection
- global::System.GC.Collect();
- global::System.GC.WaitForPendingFinalizers();
- global::System.Console.WriteLine("wheel size: " + wheel.size);
+ Wheel wheel = new Bike(10).getWheel();
+ Console.WriteLine("wheel size: " + wheel.size);
+ // Simulate a garbage collection
+ global::System.GC.Collect();
+ global::System.GC.WaitForPendingFinalizers();
+ global::System.Console.WriteLine("wheel size: " + wheel.size);
</pre>
</div>
@@ -1935,7 +1936,7 @@ public class Bike : global::System.IDisposable {
Note the <tt>addReference</tt> call.
</p>
-<H3><a name="CSharp_memory_management_objects">20.8.2 Memory management for objects passed to the C++ layer</a></H3>
+<H3><a name="CSharp_memory_management_objects">22.8.2 Memory management for objects passed to the C++ layer</a></H3>
<p>
@@ -1980,27 +1981,27 @@ and more or less equivalent usage from C#
<div class="code">
<pre>
- Container container = new Container();
- Element element = new Element(20);
- container.setElement(element);
+ Container container = new Container();
+ Element element = new Element(20);
+ container.setElement(element);
</pre>
</div>
<p>
The C++ code will always print out 20, but the value printed out may not be this in the C# equivalent code.
-In order to understand why, consider a garbage collection occuring...
+In order to understand why, consider a garbage collection occurring...
</p>
<div class="code">
<pre>
- Container container = new Container();
- Element element = new Element(20);
- container.setElement(element);
- Console.WriteLine("element.value: " + container.getElement().value);
- // Simulate a garbage collection
- global::System.GC.Collect();
- global::System.GC.WaitForPendingFinalizers();
- global::System.Console.WriteLine("element.value: " + container.getElement().value);
+ Container container = new Container();
+ Element element = new Element(20);
+ container.setElement(element);
+ Console.WriteLine("element.value: " + container.getElement().value);
+ // Simulate a garbage collection
+ global::System.GC.Collect();
+ global::System.GC.WaitForPendingFinalizers();
+ global::System.Console.WriteLine("element.value: " + container.getElement().value);
</pre>
</div>
@@ -2019,42 +2020,55 @@ public class Container : global::System.IDisposable {
// Ensure that the GC doesn't collect any Element set from C#
// as the underlying C++ class stores a shallow copy
private Element elementReference;
- private global::System.Runtime.InteropServices.HandleRef getCPtrAndAddReference(Element element) {
- elementReference = element;
- return Element.getCPtr(element);
- }
public void setElement(Element e) {
- examplePINVOKE.Container_setElement(swigCPtr, getCPtrAndAddReference(e));
+ examplePINVOKE.Container_setElement(swigCPtr, Element.getCPtr(e));
+ elementReference = e;
}
}
</pre>
</div>
<p>
-The following typemaps will generate the desired code.
-The 'csin' typemap matches the input parameter type for the <tt>setElement</tt> method.
-The 'cscode' typemap simply adds in the specified code into the C# proxy class.
+The following typemaps can be used to generate this code:
</p>
<div class="code">
<pre>
-%typemap(csin) Element *e "getCPtrAndAddReference($csinput)"
-
%typemap(cscode) Container %{
// Ensure that the GC doesn't collect any Element set from C#
// as the underlying C++ class stores a shallow copy
private Element elementReference;
- private global::System.Runtime.InteropServices.HandleRef getCPtrAndAddReference(Element element) {
- elementReference = element;
- return Element.getCPtr(element);
- }
%}
+
+%typemap(csin,
+ post=" elementReference = $csinput;"
+ ) Element *e "Element.getCPtr($csinput)"
</pre>
</div>
+<p>
+The 'cscode' typemap simply adds in the specified code into the C# proxy class.
+The 'csin' typemap matches the input parameter type and name for the <tt>setElement</tt> method and
+the 'post' typemap attribute allows adding code after the PInvoke call.
+The 'post' code is generated into a finally block after the PInvoke call so the resulting code isn't quite
+as mentioned earlier, <tt>setElement</tt> is actually:
+</p>
+
+<div class="code">
+<pre>
+ public void setElement(Element e) {
+ try {
+ examplePINVOKE.Container_setElement(swigCPtr, Element.getCPtr(e));
+ } finally {
+ elementReference = e;
+ }
+ }
+</pre>
+</div>
-<H3><a name="CSharp_date_marshalling">20.8.3 Date marshalling using the csin typemap and associated attributes</a></H3>
+
+<H3><a name="CSharp_date_marshalling">22.8.3 Date marshalling using the csin typemap and associated attributes</a></H3>
<p>
@@ -2127,7 +2141,7 @@ The <tt>CDate &amp;</tt> and <tt>const CDate &amp;</tt> C# code is generated fro
<p>
where '$csclassname' is translated into the proxy class name, <tt>CDate</tt> and '$csinput' is translated into the name of the parameter, eg <tt>dateIn</tt>.
-From C#, the intention is then to call into a modifed API with something like:
+From C#, the intention is then to call into a modified API with something like:
</p>
<div class="code">
@@ -2340,7 +2354,7 @@ public class example {
</pre>
</div>
-<H3><a name="CSharp_date_properties">20.8.4 A date example demonstrating marshalling of C# properties</a></H3>
+<H3><a name="CSharp_date_properties">22.8.4 A date example demonstrating marshalling of C# properties</a></H3>
<p>
@@ -2440,7 +2454,7 @@ Some points to note:
<li>The 'csin' typemap has 'pre', 'post' and 'cshin' attributes, and these are all ignored in the property set. The code in these attributes must instead be replicated within the 'csvarin' typemap. The line creating the <tt>temp$csinput</tt> variable is such an example; it is identical to what is in the 'pre' attribute.
</ul>
-<H3><a name="CSharp_date_pre_post_directors">20.8.5 Date example demonstrating the 'pre' and 'post' typemap attributes for directors</a></H3>
+<H3><a name="CSharp_date_pre_post_directors">22.8.5 Date example demonstrating the 'pre' and 'post' typemap attributes for directors</a></H3>
<p>
@@ -2483,7 +2497,7 @@ The generated proxy class code will then contain the following wrapper for calli
<div class="code"><pre>
...
- private void SwigDirectorsomeCallback(global::System.IntPtr date) {
+ private void SwigDirectorMethodsomeCallback(global::System.IntPtr date) {
System.DateTime tempdate = new System.DateTime();
try {
someCallback(out tempdate);
@@ -2502,7 +2516,7 @@ Pay special attention to the memory management issues, using these attributes.
</p>
-<H3><a name="CSharp_partial_classes">20.8.6 Turning wrapped classes into partial classes</a></H3>
+<H3><a name="CSharp_partial_classes">22.8.6 Turning proxy classes into partial classes</a></H3>
<p>
@@ -2602,7 +2616,97 @@ demonstrating that the class contains methods calling both unmanaged code - <tt>
The following example is an alternative approach to adding managed code to the generated proxy class.
</p>
-<H3><a name="CSharp_extending_proxy_class">20.8.7 Extending proxy classes with additional C# code</a></H3>
+<H3><a name="CSharp_sealed_proxy_class">22.8.7 Turning proxy classes into sealed classes</a></H3>
+
+
+<p>
+The technique in the previous section can be used to make the proxy class a sealed class.
+Consider a C++ class <tt>NotABaseClass</tt> that you don't want to be derived from in C#:
+</p>
+
+<div class="code">
+<pre>
+struct NotABaseClass {
+ NotABaseClass();
+ ~NotABaseClass();
+};
+</pre>
+</div>
+
+<p>
+The default C# proxy class method generated with Dispose method is:
+</p>
+
+<div class="code">
+<pre>
+public class NotABaseClass : global::System.IDisposable {
+ ...
+ public virtual void Dispose() {
+ ...
+ }
+}
+</pre>
+</div>
+
+<p>
+The <tt>csclassmodifiers</tt> typemap can be used to modify the class modifiers and
+the <tt>csmethodmodifiers</tt> feature can be used on the destructor to modify the proxy's <tt>Dispose</tt> method:
+</p>
+
+<div class="code">
+<pre>
+%typemap(csclassmodifiers) NotABaseClass "public sealed class"
+%csmethodmodifiers NotABaseClass::~NotABaseClass "public /*virtual*/";
+</pre>
+</div>
+
+<p>
+The relevant generated code is thus:
+</p>
+
+<div class="code">
+<pre>
+public sealed class NotABaseClass : global::System.IDisposable {
+ ...
+ public /*virtual*/ void Dispose() {
+ ...
+ }
+}
+</pre>
+</div>
+
+<p>
+Any attempt to derive from the <tt>NotABaseClass</tt> in C# will result in a C# compiler error, for example:
+</p>
+
+<div class="code">
+<pre>
+public class Derived : NotABaseClass {
+};
+</pre>
+</div>
+<div class="shell">
+<pre>
+runme.cs(6,14): error CS0509: `Derived': cannot derive from sealed type `NotABaseClass'
+</pre>
+</div>
+
+<p>
+Finally, if you get a warning about use of 'protected' in the generated base class:
+</p>
+
+<div class="shell">
+<pre>
+NotABaseClass.cs(14,18): warning CS0628: `NotABaseClass.swigCMemOwn': new protected member declared in sealed class
+</pre>
+</div>
+
+<p>
+Either suppress the warning or modify the generated code by copying and tweaking the default
+'csbody' typemap code in csharp.swg by modifying swigCMemOwn to not be protected.
+</p>
+
+<H3><a name="CSharp_extending_proxy_class">22.8.8 Extending proxy classes with additional C# code</a></H3>
<p>
@@ -2641,13 +2745,13 @@ public class ExtendMe : global::System.IDisposable {
</pre>
</div>
-<H3><a name="CSharp_enum_underlying_type">20.8.8 Underlying type for enums</a></H3>
+<H3><a name="CSharp_enum_underlying_type">22.8.9 Underlying type for enums</a></H3>
<P>
C# enums use int as the underlying type for each enum item.
If you wish to change the underlying type to something else, then use the <tt>csbase</tt> typemap.
-For example when your C++ code uses a value larget than int, this is necessary as the C# compiler will not compile values which are too large to fit into an int.
+For example when your C++ code uses a value larger than int, this is necessary as the C# compiler will not compile values which are too large to fit into an int.
Here is an example:
</p>
diff --git a/Doc/Manual/Chicken.html b/Doc/Manual/Chicken.html
index b2f434a88..3a80811bd 100644
--- a/Doc/Manual/Chicken.html
+++ b/Doc/Manual/Chicken.html
@@ -8,7 +8,7 @@
<body bgcolor="#ffffff">
-<H1><a name="Chicken">21 SWIG and Chicken</a></H1>
+<H1><a name="Chicken">23 SWIG and Chicken</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -72,7 +72,7 @@
</p>
-<H2><a name="Chicken_nn2">21.1 Preliminaries</a></H2>
+<H2><a name="Chicken_nn2">23.1 Preliminaries</a></H2>
<p>
@@ -89,7 +89,7 @@
directory for the basic steps to run SWIG CHICKEN.
</p>
-<H3><a name="Chicken_nn3">21.1.1 Running SWIG in C mode</a></H3>
+<H3><a name="Chicken_nn3">23.1.1 Running SWIG in C mode</a></H3>
<p>
@@ -122,7 +122,7 @@
object files and linked into your project.
</p>
-<H3><a name="Chicken_nn4">21.1.2 Running SWIG in C++ mode</a></H3>
+<H3><a name="Chicken_nn4">23.1.2 Running SWIG in C++ mode</a></H3>
<p>
@@ -151,10 +151,10 @@
object files and linked into your project.
</p>
-<H2><a name="Chicken_nn5">21.2 Code Generation</a></H2>
+<H2><a name="Chicken_nn5">23.2 Code Generation</a></H2>
-<H3><a name="Chicken_nn6">21.2.1 Naming Conventions</a></H3>
+<H3><a name="Chicken_nn6">23.2.1 Naming Conventions</a></H3>
<p>
@@ -170,7 +170,7 @@
<tt>%rename</tt> SWIG directive in the SWIG interface file.
</p>
-<H3><a name="Chicken_nn7">21.2.2 Modules</a></H3>
+<H3><a name="Chicken_nn7">23.2.2 Modules</a></H3>
<p>
@@ -192,7 +192,7 @@
(uses <i>modulename</i>))</code> CHICKEN Scheme form.
</p>
-<H3><a name="Chicken_nn8">21.2.3 Constants and Variables</a></H3>
+<H3><a name="Chicken_nn8">23.2.3 Constants and Variables</a></H3>
<p>
@@ -229,7 +229,7 @@
for info on how to apply the %feature.
</p>
-<H3><a name="Chicken_nn9">21.2.4 Functions</a></H3>
+<H3><a name="Chicken_nn9">23.2.4 Functions</a></H3>
<p>
@@ -248,7 +248,7 @@
parameters). The return values can then be accessed with <code>(call-with-values)</code>.
</p>
-<H3><a name="Chicken_nn10">21.2.5 Exceptions</a></H3>
+<H3><a name="Chicken_nn10">23.2.5 Exceptions</a></H3>
<p>The SWIG chicken module has support for exceptions thrown from
@@ -290,7 +290,7 @@
</pre></div>
-<H2><a name="Chicken_nn11">21.3 TinyCLOS</a></H2>
+<H2><a name="Chicken_nn11">23.3 TinyCLOS</a></H2>
<p>
@@ -333,7 +333,7 @@
</p>
-<H2><a name="Chicken_nn12">21.4 Linkage</a></H2>
+<H2><a name="Chicken_nn12">23.4 Linkage</a></H2>
<p>
@@ -354,7 +354,7 @@
</p>
-<H3><a name="Chicken_nn13">21.4.1 Static binary or shared library linked at compile time</a></H3>
+<H3><a name="Chicken_nn13">23.4.1 Static binary or shared library linked at compile time</a></H3>
<p>We can easily use csc to build a static binary.</p>
@@ -395,7 +395,7 @@ in which case the test script does not need to be linked with example.so. The t
be run with <tt>csi</tt>.
</p>
-<H3><a name="Chicken_nn14">21.4.2 Building chicken extension libraries</a></H3>
+<H3><a name="Chicken_nn14">23.4.2 Building chicken extension libraries</a></H3>
<p>Building a shared library like in the above section only works if the library
@@ -453,7 +453,7 @@ distributed and used by anyone, even if SWIG is not installed.</p>
<p>See the <tt>Examples/chicken/egg</tt> directory in the SWIG source for an example that builds
two eggs, one using the first method and one using the second method.</p>
-<H3><a name="Chicken_nn15">21.4.3 Linking multiple SWIG modules with TinyCLOS</a></H3>
+<H3><a name="Chicken_nn15">23.4.3 Linking multiple SWIG modules with TinyCLOS</a></H3>
<p>Linking together multiple modules that share type information using the <code>%import</code>
@@ -477,7 +477,7 @@ with <code>(declare (uses ...))</code>.
To create an extension library or an egg, just create a <tt>module_load.scm</tt> file that <code>(declare (uses ...))</code>
all the modules.</p>
-<H2><a name="Chicken_nn16">21.5 Typemaps</a></H2>
+<H2><a name="Chicken_nn16">23.5 Typemaps</a></H2>
<p>
@@ -486,7 +486,7 @@ all the modules.</p>
<code>Lib/chicken/chicken.swg</code>.
</p>
-<H2><a name="Chicken_nn17">21.6 Pointers</a></H2>
+<H2><a name="Chicken_nn17">23.6 Pointers</a></H2>
<p>
@@ -519,7 +519,7 @@ all the modules.</p>
type. flags is either zero or SWIG_POINTER_DISOWN (see below).
</p>
-<H3><a name="Chicken_collection">21.6.1 Garbage collection</a></H3>
+<H3><a name="Chicken_collection">23.6.1 Garbage collection</a></H3>
<p>If the owner flag passed to <code>SWIG_NewPointerObj</code> is 1, <code>NewPointerObj</code> will add a
@@ -550,7 +550,7 @@ all the modules.</p>
must be called manually.
</p>
-<H2><a name="Chicken_nn18">21.7 Unsupported features and known problems</a></H2>
+<H2><a name="Chicken_nn18">23.7 Unsupported features and known problems</a></H2>
<ul>
@@ -560,7 +560,7 @@ all the modules.</p>
<a href="SWIGPlus.html#SWIGPlus_default_args">%feature(compactdefaultargs)</a>.</li>
</ul>
-<H3><a name="Chicken_nn19">21.7.1 TinyCLOS problems with Chicken version &lt;= 1.92</a></H3>
+<H3><a name="Chicken_nn19">23.7.1 TinyCLOS problems with Chicken version &lt;= 1.92</a></H3>
<p>In Chicken versions equal to or below 1.92, TinyCLOS has a limitation such that generic methods do not properly work on methods
diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html
index f196da53c..57aef5b8a 100644
--- a/Doc/Manual/Contents.html
+++ b/Doc/Manual/Contents.html
@@ -46,6 +46,11 @@
<ul>
<li><a href="Introduction.html#Introduction_nn2">What is SWIG?</a>
<li><a href="Introduction.html#Introduction_nn3">Why use SWIG?</a>
+<li><a href="Introduction.html#Introduction_target_languages">Target languages</a>
+<ul>
+<li><a href="Introduction.html#Introduction_supported_status">Supported status</a>
+<li><a href="Introduction.html#Introduction_experimental_status">Experimental status</a>
+</ul>
<li><a href="Introduction.html#Introduction_nn4">A SWIG example</a>
<ul>
<li><a href="Introduction.html#Introduction_nn5">SWIG interface file</a>
@@ -228,7 +233,6 @@
<li><a href="SWIGPlus.html#SWIGPlus_nn12">Static members</a>
<li><a href="SWIGPlus.html#SWIGPlus_member_data">Member data</a>
</ul>
-<li><a href="SWIGPlus.html#SWIGPlus_default_args">Default arguments</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn15">Protection</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn16">Enums and constants</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn17">Friends</a>
@@ -236,16 +240,27 @@
<li><a href="SWIGPlus.html#SWIGPlus_nn19">Pass and return by value</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn20">Inheritance</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn21">A brief discussion of multiple inheritance, pointers, and type checking</a>
-<li><a href="SWIGPlus.html#SWIGPlus_overloaded_methods">Wrapping Overloaded Functions and Methods</a>
+<li><a href="SWIGPlus.html#SWIGPlus_default_args">Default arguments</a>
+<li><a href="SWIGPlus.html#SWIGPlus_overloaded_methods">Overloaded functions and methods</a>
<ul>
<li><a href="SWIGPlus.html#SWIGPlus_nn24">Dispatch function generation</a>
-<li><a href="SWIGPlus.html#SWIGPlus_nn25">Ambiguity in Overloading</a>
-<li><a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
+<li><a href="SWIGPlus.html#SWIGPlus_nn25">Ambiguity in overloading</a>
+<li><a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Renaming and ambiguity resolution</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn27">Comments on overloading</a>
</ul>
-<li><a href="SWIGPlus.html#SWIGPlus_nn28">Wrapping overloaded operators</a>
+<li><a href="SWIGPlus.html#SWIGPlus_nn28">Overloaded operators</a>
<li><a href="SWIGPlus.html#SWIGPlus_class_extension">Class extension</a>
<li><a href="SWIGPlus.html#SWIGPlus_nn30">Templates</a>
+<ul>
+<li><a href="SWIGPlus.html#SWIGPlus_template_directive">The %template directive</a>
+<li><a href="SWIGPlus.html#SWIGPlus_template_functions">Function templates</a>
+<li><a href="SWIGPlus.html#SWIGPlus_template_classes">Default template arguments</a>
+<li><a href="SWIGPlus.html#SWIGPlus_template_class_inheritance">Template base classes</a>
+<li><a href="SWIGPlus.html#SWIGPlus_template_specialization">Template specialization</a>
+<li><a href="SWIGPlus.html#SWIGPlus_template_member">Member templates</a>
+<li><a href="SWIGPlus.html#SWIGPlus_template_scoping">Scoping and templates</a>
+<li><a href="SWIGPlus.html#SWIGPlus_template_more">More on templates</a>
+</ul>
<li><a href="SWIGPlus.html#SWIGPlus_namespaces">Namespaces</a>
<ul>
<li><a href="SWIGPlus.html#SWIGPlus_nspace">The nspace feature for namespaces</a>
@@ -259,6 +274,11 @@
<li><a href="SWIGPlus.html#SWIGPlus_nn35">Using declarations and inheritance</a>
<li><a href="SWIGPlus.html#SWIGPlus_nested_classes">Nested classes</a>
<li><a href="SWIGPlus.html#SWIGPlus_const">A brief rant about const-correctness</a>
+<li><a href="SWIGPlus.html#SWIGPlus_target_language_callbacks">Callbacks to the target language</a>
+<ul>
+<li><a href="SWIGPlus.html#SWIGPlus_director_classes_introduction">Introduction to director classes</a>
+<li><a href="SWIGPlus.html#SWIGPlus_directors_for_function_pointers">Using directors and target language callbacks</a>
+</ul>
<li><a href="SWIGPlus.html#SWIGPlus_nn42">Where to go for more information</a>
</ul>
</div>
@@ -290,6 +310,7 @@
<li><a href="CPlusPlus11.html#CPlusPlus11_alias_templates">Type alias and alias templates</a>
<li><a href="CPlusPlus11.html#CPlusPlus11_unrestricted_unions">Unrestricted unions</a>
<li><a href="CPlusPlus11.html#CPlusPlus11_variadic_templates">Variadic templates</a>
+<li><a href="CPlusPlus11.html#CPlusPlus11_new_char_literals">New character literals</a>
<li><a href="CPlusPlus11.html#CPlusPlus11_new_string_literals">New string literals</a>
<li><a href="CPlusPlus11.html#CPlusPlus11_user_defined_literals">User-defined literals</a>
<li><a href="CPlusPlus11.html#CPlusPlus11_thread_local_storage">Thread-local storage</a>
@@ -300,6 +321,7 @@
<li><a href="CPlusPlus11.html#CPlusPlus11_noexcept">Exception specifications and noexcept</a>
<li><a href="CPlusPlus11.html#CPlusPlus11_alignment">Control and query object alignment</a>
<li><a href="CPlusPlus11.html#CPlusPlus11_attributes">Attributes</a>
+<li><a href="CPlusPlus11.html#CPlusPlus11_ref_qualifiers">Methods with ref-qualifiers</a>
</ul>
<li><a href="CPlusPlus11.html#CPlusPlus11_standard_library_changes">Standard library changes</a>
<ul>
@@ -318,7 +340,39 @@
</div>
<!-- INDEX -->
-<h3><a href="Preprocessor.html#Preprocessor">8 Preprocessing</a></h3>
+<h3><a href="CPlusPlus14.html#CPlusPlus14">8 SWIG and C++14</a></h3>
+
+<!-- INDEX -->
+<div class="sectiontoc">
+<ul>
+<li><a href="CPlusPlus14.html#CPlusPlus14_introduction">Introduction</a>
+<li><a href="CPlusPlus14.html#CPlusPlus14_core_language_changes">Core language changes</a>
+<ul>
+<li><a href="CPlusPlus14.html#CPlusPlus14_binary_literals">Binary integer literals</a>
+</ul>
+<li><a href="CPlusPlus14.html#CPlusPlus14_standard_library_changes">Standard library changes</a>
+</ul>
+</div>
+<!-- INDEX -->
+
+<h3><a href="CPlusPlus17.html#CPlusPlus17">9 SWIG and C++17</a></h3>
+
+<!-- INDEX -->
+<div class="sectiontoc">
+<ul>
+<li><a href="CPlusPlus17.html#CPlusPlus17_introduction">Introduction</a>
+<li><a href="CPlusPlus17.html#CPlusPlus17_core_language_changes">Core language changes</a>
+<ul>
+<li><a href="CPlusPlus17.html#CPlusPlus17_nested_namespaces">Nested namespace definitions</a>
+<li><a href="CPlusPlus17.html#CPlusPlus17_u8_char_literals">UTF-8 character literals</a>
+<li><a href="CPlusPlus17.html#CPlusPlus17_hexadecimal_floating_literals">Hexadecimal floating literals</a>
+</ul>
+<li><a href="CPlusPlus17.html#CPlusPlus17_standard_library_changes">Standard library changes</a>
+</ul>
+</div>
+<!-- INDEX -->
+
+<h3><a href="Preprocessor.html#Preprocessor">10 Preprocessing</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -341,32 +395,39 @@
</div>
<!-- INDEX -->
-<h3><a href="Library.html#Library">9 SWIG library</a></h3>
+<h3><a href="Library.html#Library">11 SWIG library</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="Library.html#Library_nn2">The %include directive and library search path</a>
-<li><a href="Library.html#Library_nn3">C Arrays and Pointers</a>
+<li><a href="Library.html#Library_nn3">C arrays and pointers</a>
<ul>
<li><a href="Library.html#Library_nn4">cpointer.i</a>
<li><a href="Library.html#Library_carrays">carrays.i</a>
<li><a href="Library.html#Library_nn6">cmalloc.i</a>
<li><a href="Library.html#Library_nn7">cdata.i</a>
</ul>
-<li><a href="Library.html#Library_nn8">C String Handling</a>
+<li><a href="Library.html#Library_nn8">C string handling</a>
<ul>
<li><a href="Library.html#Library_nn9">Default string handling</a>
<li><a href="Library.html#Library_nn10">Passing binary data</a>
<li><a href="Library.html#Library_nn11">Using %newobject to release memory</a>
<li><a href="Library.html#Library_nn12">cstring.i</a>
</ul>
-<li><a href="Library.html#Library_stl_cpp_library">STL/C++ Library</a>
+<li><a href="Library.html#Library_stl_cpp_library">STL/C++ library</a>
<ul>
<li><a href="Library.html#Library_std_string">std::string</a>
<li><a href="Library.html#Library_std_vector">std::vector</a>
<li><a href="Library.html#Library_stl_exceptions">STL exceptions</a>
<li><a href="Library.html#Library_std_shared_ptr">shared_ptr smart pointer</a>
+<ul>
+<li><a href="Library.html#Library_shared_ptr_basics">shared_ptr basics</a>
+<li><a href="Library.html#Library_shared_ptr_inheritance">shared_ptr and inheritance</a>
+<li><a href="Library.html#Library_shared_ptr_overloading">shared_ptr and method overloading</a>
+<li><a href="Library.html#Library_shared_ptr_templates">shared_ptr and templates</a>
+<li><a href="Library.html#Library_shared_ptr_directors">shared_ptr and directors</a>
+</ul>
<li><a href="Library.html#Library_std_auto_ptr">auto_ptr smart pointer</a>
</ul>
<li><a href="Library.html#Library_nn16">Utility Libraries</a>
@@ -377,7 +438,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Arguments.html#Arguments">10 Argument Handling</a></h3>
+<h3><a href="Arguments.html#Arguments">12 Argument Handling</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -400,7 +461,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Typemaps.html#Typemaps">11 Typemaps</a></h3>
+<h3><a href="Typemaps.html#Typemaps">13 Typemaps</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -461,7 +522,7 @@
<li><a href="Typemaps.html#Typemaps_nn35">"memberin" typemap</a>
<li><a href="Typemaps.html#Typemaps_nn36">"varin" typemap</a>
<li><a href="Typemaps.html#Typemaps_nn37">"varout" typemap</a>
-<li><a href="Typemaps.html#throws_typemap">"throws" typemap</a>
+<li><a href="Typemaps.html#Typemaps_throws_typemap">"throws" typemap</a>
</ul>
<li><a href="Typemaps.html#Typemaps_nn39">Some typemap examples</a>
<ul>
@@ -483,6 +544,9 @@
<li><a href="Typemaps.html#Typemaps_runtime_type_checker_usage">Usage</a>
</ul>
<li><a href="Typemaps.html#Typemaps_overloading">Typemaps and overloading</a>
+<ul>
+<li><a href="Typemaps.html#Typemaps_typecheck_pointer">SWIG_TYPECHECK_POINTER precedence level and the typecheck typemap</a>
+</ul>
<li><a href="Typemaps.html#Typemaps_nn48">More about %apply and %clear</a>
<li><a href="Typemaps.html#Typemaps_nn47">Passing data between typemaps</a>
<li><a href="Typemaps.html#Typemaps_nn52">C++ "this" pointer</a>
@@ -491,7 +555,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Customization.html#Customization">12 Customization Features</a></h3>
+<h3><a href="Customization.html#Customization">14 Customization Features</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -519,7 +583,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Contract.html#Contract">13 Contracts</a></h3>
+<h3><a href="Contract.html#Contract">15 Contracts</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -532,7 +596,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Varargs.html#Varargs">14 Variable Length Arguments</a></h3>
+<h3><a href="Varargs.html#Varargs">16 Variable Length Arguments</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -550,7 +614,55 @@
</div>
<!-- INDEX -->
-<h3><a href="Warnings.html#Warnings">15 Warning Messages</a></h3>
+<h3><a href="Doxygen.html#Doxygen">17 SWIG and Doxygen Translation</a></h3>
+
+<!-- INDEX -->
+<div class="sectiontoc">
+<ul>
+<li><a href="Doxygen.html#Doxygen_translation_overview">Doxygen translation overview</a>
+<li><a href="Doxygen.html#Doxygen_file_preparation">Preparations</a>
+<ul>
+<li><a href="Doxygen.html#Doxygen_running_swig">Enabling Doxygen translation</a>
+<li><a href="Doxygen.html#Doxygen_features">Doxygen-specific %feature directives</a>
+<ul>
+<li><a href="Doxygen.html#Doxygen_notranslate">doxygen:notranslate</a>
+<li><a href="Doxygen.html#Doxygen_alias">doxygen:alias:&lt;command-name&gt;</a>
+<li><a href="Doxygen.html#Doxygen_ignore">doxygen:ignore:&lt;command-name&gt;</a>
+<li><a href="Doxygen.html#Doxygen_nolinktranslate">doxygen:nolinktranslate</a>
+<li><a href="Doxygen.html#Doxygen_nostripparams">doxygen:nostripparams</a>
+</ul>
+<li><a href="Doxygen.html#Doxygen_additional_options">Additional command line options</a>
+</ul>
+<li><a href="Doxygen.html#Doxygen_to_javadoc">Doxygen to Javadoc</a>
+<ul>
+<li><a href="Doxygen.html#Doxygen_basic_example">Basic example</a>
+<li><a href="Doxygen.html#Doxygen_javadoc_tags">Javadoc tags</a>
+<li><a href="Doxygen.html#Doxygen_unsupported_tags">Unsupported tags</a>
+<li><a href="Doxygen.html#Doxygen_further_details">Further details</a>
+</ul>
+<li><a href="Doxygen.html#Doxygen_to_pydoc">Doxygen to Pydoc</a>
+<ul>
+<li><a href="Doxygen.html#Doxygen_python_basic_example">Basic example</a>
+<li><a href="Doxygen.html#Doxygen_pydoc_tags">Pydoc translator</a>
+<li><a href="Doxygen.html#Doxygen_python_unsupported_tags">Unsupported tags</a>
+<li><a href="Doxygen.html#Doxygen_python_further_details">Further details</a>
+</ul>
+<li><a href="Doxygen.html#Doxygen_troubleshooting">Troubleshooting</a>
+<ul>
+<li><a href="Doxygen.html#troubleshooting_ifndef">Problem with conditional compilation</a>
+</ul>
+<li><a href="Doxygen.html#Doxygen_developer_details">Developer information</a>
+<ul>
+<li><a href="Doxygen.html#Doxygen_translator_design">Doxygen translator design</a>
+<li><a href="Doxygen.html#Doxygen_debugging_commands">Debugging the Doxygen parser and translator</a>
+<li><a href="Doxygen.html#Doxygen_tests">Tests</a>
+</ul>
+<li><a href="Doxygen.html#Doxygen_language_extension">Extending to other languages</a>
+</ul>
+</div>
+<!-- INDEX -->
+
+<h3><a href="Warnings.html#Warnings">18 Warning Messages</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -569,7 +681,8 @@
<li><a href="Warnings.html#Warnings_nn11">Preprocessor (200-299)</a>
<li><a href="Warnings.html#Warnings_nn12">C/C++ Parser (300-399)</a>
<li><a href="Warnings.html#Warnings_nn13">Types and typemaps (400-499) </a>
-<li><a href="Warnings.html#Warnings_nn14">Code generation (500-599)</a>
+<li><a href="Warnings.html#Warnings_nn14">Code generation (500-559)</a>
+<li><a href="Warnings.html#Warnings_doxygen">Doxygen comments (560-599)</a>
<li><a href="Warnings.html#Warnings_nn15">Language module specific (700-899) </a>
<li><a href="Warnings.html#Warnings_nn16">User defined (900-999)</a>
</ul>
@@ -578,7 +691,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Modules.html#Modules">16 Working with Modules</a></h3>
+<h3><a href="Modules.html#Modules">19 Working with Modules</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -594,7 +707,7 @@
</div>
<!-- INDEX -->
-<h3><a href="CCache.html#CCache">17 Using SWIG with ccache - ccache-swig(1) manpage</a></h3>
+<h3><a href="CCache.html#CCache">20 Using SWIG with ccache - ccache-swig(1) manpage</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -620,91 +733,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Allegrocl.html#Allegrocl">18 SWIG and Allegro Common Lisp</a></h3>
-
-<!-- INDEX -->
-<div class="sectiontoc">
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn2">Basics</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn3">Running SWIG</a>
-<li><a href="Allegrocl.html#Allegrocl_nn4">Command Line Options</a>
-<li><a href="Allegrocl.html#Allegrocl_nn5">Inserting user code into generated files</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn6">Wrapping Overview</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn7">Function Wrapping</a>
-<li><a href="Allegrocl.html#Allegrocl_nn8">Foreign Wrappers</a>
-<li><a href="Allegrocl.html#Allegrocl_nn9">FFI Wrappers</a>
-<li><a href="Allegrocl.html#Allegrocl_nn10">Non-overloaded Defuns</a>
-<li><a href="Allegrocl.html#Allegrocl_nn11">Overloaded Defuns</a>
-<li><a href="Allegrocl.html#Allegrocl_nn12">What about constant and variable access?</a>
-<li><a href="Allegrocl.html#Allegrocl_nn13">Object Wrapping</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn14">Wrapping Details</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn15">Namespaces</a>
-<li><a href="Allegrocl.html#Allegrocl_nn16">Constants</a>
-<li><a href="Allegrocl.html#Allegrocl_nn17">Variables</a>
-<li><a href="Allegrocl.html#Allegrocl_nn18">Enumerations</a>
-<li><a href="Allegrocl.html#Allegrocl_nn19">Arrays</a>
-<li><a href="Allegrocl.html#Allegrocl_nn20">Classes and Structs and Unions (oh my!)</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn21">CLOS wrapping of</a>
-<li><a href="Allegrocl.html#Allegrocl_nn22">CLOS Inheritance</a>
-<li><a href="Allegrocl.html#Allegrocl_nn23">Member fields and functions</a>
-<li><a href="Allegrocl.html#Allegrocl_nn24">Why not directly access C++ classes using foreign types?</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn25">Templates</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn26">Generating wrapper code for templates</a>
-<li><a href="Allegrocl.html#Allegrocl_nn27">Implicit Template instantiation</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn28">Typedef, Templates, and Synonym Types</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn29">Choosing a primary type</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn30">Function overloading/Parameter defaulting</a>
-<li><a href="Allegrocl.html#Allegrocl_nn31">Operator wrapping and Operator overloading</a>
-<li><a href="Allegrocl.html#Allegrocl_nn32">Varargs</a>
-<li><a href="Allegrocl.html#Allegrocl_nn33">C++ Exceptions</a>
-<li><a href="Allegrocl.html#Allegrocl_nn34">Pass by value, pass by reference</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn35">Typemaps</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn36">Code Generation in the C++ Wrapper</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn37">IN Typemap</a>
-<li><a href="Allegrocl.html#Allegrocl_nn38">OUT Typemap</a>
-<li><a href="Allegrocl.html#Allegrocl_nn39">CTYPE Typemap</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn40">Code generation in Lisp wrappers</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn41">LIN Typemap</a>
-<li><a href="Allegrocl.html#Allegrocl_nn42">LOUT Typemap</a>
-<li><a href="Allegrocl.html#Allegrocl_nn43">FFITYPE Typemap</a>
-<li><a href="Allegrocl.html#Allegrocl_nn44">LISPTYPE Typemap</a>
-<li><a href="Allegrocl.html#Allegrocl_nn45">LISPCLASS Typemap</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn46">Modifying SWIG behavior using typemaps</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn47">Identifier Converter functions</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn48">Creating symbols in the lisp environment</a>
-<li><a href="Allegrocl.html#Allegrocl_nn49">Existing identifier-converter functions</a>
-<ul>
-<li><a href="Allegrocl.html#Allegrocl_nn50">identifier-convert-null</a>
-<li><a href="Allegrocl.html#Allegrocl_nn51">identifier-convert-lispify</a>
-<li><a href="Allegrocl.html#Allegrocl_nn52">Default identifier to symbol conversions</a>
-</ul>
-<li><a href="Allegrocl.html#Allegrocl_nn53">Defining your own identifier-converter</a>
-<li><a href="Allegrocl.html#Allegrocl_nn54">Instructing SWIG to use a particular identifier-converter</a>
-</ul>
-</ul>
-</div>
-<!-- INDEX -->
-
-<h3><a href="Android.html#Android">19 SWIG and Android</a></h3>
+<h3><a href="Android.html#Android">21 SWIG and Android</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -722,7 +751,7 @@
</div>
<!-- INDEX -->
-<h3><a href="CSharp.html#CSharp">20 SWIG and C#</a></h3>
+<h3><a href="CSharp.html#CSharp">22 SWIG and C#</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -761,7 +790,8 @@
<li><a href="CSharp.html#CSharp_date_marshalling">Date marshalling using the csin typemap and associated attributes</a>
<li><a href="CSharp.html#CSharp_date_properties">A date example demonstrating marshalling of C# properties</a>
<li><a href="CSharp.html#CSharp_date_pre_post_directors">Date example demonstrating the 'pre' and 'post' typemap attributes for directors</a>
-<li><a href="CSharp.html#CSharp_partial_classes">Turning wrapped classes into partial classes</a>
+<li><a href="CSharp.html#CSharp_partial_classes">Turning proxy classes into partial classes</a>
+<li><a href="CSharp.html#CSharp_sealed_proxy_class">Turning proxy classes into sealed classes</a>
<li><a href="CSharp.html#CSharp_extending_proxy_class">Extending proxy classes with additional C# code</a>
<li><a href="CSharp.html#CSharp_enum_underlying_type">Underlying type for enums</a>
</ul>
@@ -769,45 +799,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Chicken.html#Chicken">21 SWIG and Chicken</a></h3>
-
-<!-- INDEX -->
-<div class="sectiontoc">
-<ul>
-<li><a href="Chicken.html#Chicken_nn2">Preliminaries</a>
-<ul>
-<li><a href="Chicken.html#Chicken_nn3">Running SWIG in C mode</a>
-<li><a href="Chicken.html#Chicken_nn4">Running SWIG in C++ mode</a>
-</ul>
-<li><a href="Chicken.html#Chicken_nn5">Code Generation</a>
-<ul>
-<li><a href="Chicken.html#Chicken_nn6">Naming Conventions</a>
-<li><a href="Chicken.html#Chicken_nn7">Modules</a>
-<li><a href="Chicken.html#Chicken_nn8">Constants and Variables</a>
-<li><a href="Chicken.html#Chicken_nn9">Functions</a>
-<li><a href="Chicken.html#Chicken_nn10">Exceptions</a>
-</ul>
-<li><a href="Chicken.html#Chicken_nn11">TinyCLOS</a>
-<li><a href="Chicken.html#Chicken_nn12">Linkage</a>
-<ul>
-<li><a href="Chicken.html#Chicken_nn13">Static binary or shared library linked at compile time</a>
-<li><a href="Chicken.html#Chicken_nn14">Building chicken extension libraries</a>
-<li><a href="Chicken.html#Chicken_nn15">Linking multiple SWIG modules with TinyCLOS</a>
-</ul>
-<li><a href="Chicken.html#Chicken_nn16">Typemaps</a>
-<li><a href="Chicken.html#Chicken_nn17">Pointers</a>
-<ul>
-<li><a href="Chicken.html#Chicken_collection">Garbage collection</a>
-</ul>
-<li><a href="Chicken.html#Chicken_nn18">Unsupported features and known problems</a>
-<ul>
-<li><a href="Chicken.html#Chicken_nn19">TinyCLOS problems with Chicken version &lt;= 1.92</a>
-</ul>
-</ul>
-</div>
-<!-- INDEX -->
-
-<h3><a href="D.html#D">22 SWIG and D</a></h3>
+<h3><a href="D.html#D">23 SWIG and D</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -841,7 +833,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Go.html#Go">23 SWIG and Go</a></h3>
+<h3><a href="Go.html#Go">24 SWIG and Go</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -885,7 +877,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Guile.html#Guile">24 SWIG and Guile</a></h3>
+<h3><a href="Guile.html#Guile">25 SWIG and Guile</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -921,7 +913,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Java.html#Java">25 SWIG and Java</a></h3>
+<h3><a href="Java.html#Java">26 SWIG and Java</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1010,6 +1002,9 @@
<li><a href="Java.html#Java_directors_threading">Director threading issues</a>
<li><a href="Java.html#Java_directors_performance">Director performance tuning</a>
<li><a href="Java.html#Java_exceptions_from_directors">Java exceptions from directors</a>
+<ul>
+<li><a href="Java.html#Java_customizing_director_exceptions">Customizing director exceptions</a>
+</ul>
</ul>
<li><a href="Java.html#Java_allprotected">Accessing protected members</a>
<li><a href="Java.html#Java_common_customization">Common customization features</a>
@@ -1072,7 +1067,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Javascript.html#Javascript">26 SWIG and Javascript</a></h3>
+<h3><a href="Javascript.html#Javascript">27 SWIG and Javascript</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1114,29 +1109,6 @@
</div>
<!-- INDEX -->
-<h3><a href="Lisp.html#Lisp">27 SWIG and Common Lisp</a></h3>
-
-<!-- INDEX -->
-<div class="sectiontoc">
-<ul>
-<li><a href="Lisp.html#Lisp_nn2">Allegro Common Lisp</a>
-<li><a href="Lisp.html#Lisp_nn3">Common Foreign Function Interface(CFFI)</a>
-<ul>
-<li><a href="Lisp.html#Lisp_nn4">Additional Commandline Options </a>
-<li><a href="Lisp.html#Lisp_nn5">Generating CFFI bindings</a>
-<li><a href="Lisp.html#Lisp_nn6">Generating CFFI bindings for C++ code</a>
-<li><a href="Lisp.html#Lisp_nn7">Inserting user code into generated files</a>
-</ul>
-<li><a href="Lisp.html#Lisp_nn8">CLISP</a>
-<ul>
-<li><a href="Lisp.html#Lisp_nn9">Additional Commandline Options </a>
-<li><a href="Lisp.html#Lisp_nn10">Details on CLISP bindings</a>
-</ul>
-<li><a href="Lisp.html#Lisp_nn11">UFFI </a>
-</ul>
-</div>
-<!-- INDEX -->
-
<h3><a href="Lua.html#Lua">28 SWIG and Lua</a></h3>
<!-- INDEX -->
@@ -1205,108 +1177,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Modula3.html#Modula3">29 SWIG and Modula-3</a></h3>
-
-<!-- INDEX -->
-<div class="sectiontoc">
-<ul>
-<li><a href="Modula3.html#Modula3_modula3_overview">Overview</a>
-<ul>
-<li><a href="Modula3.html#Modula3_motivation">Motivation</a>
-</ul>
-<li><a href="Modula3.html#Modula3_conception">Conception</a>
-<ul>
-<li><a href="Modula3.html#Modula3_cinterface">Interfaces to C libraries</a>
-<li><a href="Modula3.html#Modula3_cppinterface">Interfaces to C++ libraries</a>
-</ul>
-<li><a href="Modula3.html#Modula3_preliminaries">Preliminaries</a>
-<ul>
-<li><a href="Modula3.html#Modula3_compilers">Compilers</a>
-<li><a href="Modula3.html#Modula3_commandline">Additional Commandline Options</a>
-</ul>
-<li><a href="Modula3.html#Modula3_typemaps">Modula-3 typemaps</a>
-<ul>
-<li><a href="Modula3.html#Modula3_inoutparam">Inputs and outputs</a>
-<li><a href="Modula3.html#Modula3_ordinals">Subranges, Enumerations, Sets</a>
-<li><a href="Modula3.html#Modula3_class">Objects</a>
-<li><a href="Modula3.html#Modula3_imports">Imports</a>
-<li><a href="Modula3.html#Modula3_exceptions">Exceptions</a>
-<li><a href="Modula3.html#Modula3_typemap_example">Example</a>
-</ul>
-<li><a href="Modula3.html#Modula3_hints">More hints to the generator</a>
-<ul>
-<li><a href="Modula3.html#Modula3_features">Features</a>
-<li><a href="Modula3.html#Modula3_pragmas">Pragmas</a>
-</ul>
-<li><a href="Modula3.html#Modula3_remarks">Remarks</a>
-</ul>
-</div>
-<!-- INDEX -->
-
-<h3><a href="Mzscheme.html#Mzscheme">30 SWIG and MzScheme/Racket</a></h3>
-
-<!-- INDEX -->
-<div class="sectiontoc">
-<ul>
-<li><a href="Mzscheme.html#MzScheme_nn2">Creating native structures</a>
-<li><a href="Mzscheme.html#MzScheme_simple">Simple example</a>
-<li><a href="Mzscheme.html#MzScheme_external_docs">External documentation</a>
-</ul>
-</div>
-<!-- INDEX -->
-
-<h3><a href="Ocaml.html#Ocaml">31 SWIG and Ocaml</a></h3>
-
-<!-- INDEX -->
-<div class="sectiontoc">
-<ul>
-<li><a href="Ocaml.html#Ocaml_nn2">Preliminaries</a>
-<ul>
-<li><a href="Ocaml.html#Ocaml_nn3">Running SWIG</a>
-<li><a href="Ocaml.html#Ocaml_nn4">Compiling the code</a>
-<li><a href="Ocaml.html#Ocaml_nn5">The camlp4 module</a>
-<li><a href="Ocaml.html#Ocaml_nn6">Using your module</a>
-<li><a href="Ocaml.html#Ocaml_nn7">Compilation problems and compiling with C++</a>
-</ul>
-<li><a href="Ocaml.html#Ocaml_nn8">The low-level Ocaml/C interface</a>
-<ul>
-<li><a href="Ocaml.html#Ocaml_nn9">The generated module</a>
-<li><a href="Ocaml.html#Ocaml_nn10">Enums</a>
-<ul>
-<li><a href="Ocaml.html#Ocaml_nn11">Enum typing in Ocaml</a>
-</ul>
-<li><a href="Ocaml.html#Ocaml_nn12">Arrays</a>
-<ul>
-<li><a href="Ocaml.html#Ocaml_nn13">Simple types of bounded arrays</a>
-<li><a href="Ocaml.html#Ocaml_nn14">Complex and unbounded arrays</a>
-<li><a href="Ocaml.html#Ocaml_nn15">Using an object</a>
-<li><a href="Ocaml.html#Ocaml_nn16">Example typemap for a function taking float * and int</a>
-</ul>
-<li><a href="Ocaml.html#Ocaml_nn17">C++ Classes</a>
-<ul>
-<li><a href="Ocaml.html#Ocaml_nn18">STL vector and string Example</a>
-<li><a href="Ocaml.html#Ocaml_nn19">C++ Class Example</a>
-<li><a href="Ocaml.html#Ocaml_nn20">Compiling the example</a>
-<li><a href="Ocaml.html#Ocaml_nn21">Sample Session</a>
-</ul>
-<li><a href="Ocaml.html#Ocaml_nn22">Director Classes</a>
-<ul>
-<li><a href="Ocaml.html#Ocaml_nn23">Director Introduction</a>
-<li><a href="Ocaml.html#Ocaml_nn24">Overriding Methods in Ocaml</a>
-<li><a href="Ocaml.html#Ocaml_nn25">Director Usage Example</a>
-<li><a href="Ocaml.html#Ocaml_nn26">Creating director objects</a>
-<li><a href="Ocaml.html#Ocaml_nn27">Typemaps for directors, directorin, directorout, directorargout</a>
-<li><a href="Ocaml.html#Ocaml_nn28">typemap</a>
-<li><a href="Ocaml.html#Ocaml_nn29">directorout typemap</a>
-<li><a href="Ocaml.html#Ocaml_nn30">directorargout typemap</a>
-</ul>
-<li><a href="Ocaml.html#Ocaml_nn31">Exceptions</a>
-</ul>
-</ul>
-</div>
-<!-- INDEX -->
-
-<h3><a href="Octave.html#Octave">32 SWIG and Octave</a></h3>
+<h3><a href="Octave.html#Octave">29 SWIG and Octave</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1346,7 +1217,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Perl5.html#Perl5">33 SWIG and Perl5</a></h3>
+<h3><a href="Perl5.html#Perl5">30 SWIG and Perl5</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1422,7 +1293,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Php.html#Php">34 SWIG and PHP</a></h3>
+<h3><a href="Php.html#Php">31 SWIG and PHP</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1463,31 +1334,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Pike.html#Pike">35 SWIG and Pike</a></h3>
-
-<!-- INDEX -->
-<div class="sectiontoc">
-<ul>
-<li><a href="Pike.html#Pike_nn2">Preliminaries</a>
-<ul>
-<li><a href="Pike.html#Pike_nn3">Running SWIG</a>
-<li><a href="Pike.html#Pike_nn4">Getting the right header files</a>
-<li><a href="Pike.html#Pike_nn5">Using your module</a>
-</ul>
-<li><a href="Pike.html#Pike_nn6">Basic C/C++ Mapping</a>
-<ul>
-<li><a href="Pike.html#Pike_nn7">Modules</a>
-<li><a href="Pike.html#Pike_nn8">Functions</a>
-<li><a href="Pike.html#Pike_nn9">Global variables</a>
-<li><a href="Pike.html#Pike_nn10">Constants and enumerated types</a>
-<li><a href="Pike.html#Pike_nn11">Constructors and Destructors</a>
-<li><a href="Pike.html#Pike_nn12">Static Members</a>
-</ul>
-</ul>
-</div>
-<!-- INDEX -->
-
-<h3><a href="Python.html#Python">36 SWIG and Python</a></h3>
+<h3><a href="Python.html#Python">32 SWIG and Python</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1502,7 +1349,8 @@
<li><a href="Python.html#Python_nn9">Using your module</a>
<li><a href="Python.html#Python_nn10">Compilation of C++ extensions</a>
<li><a href="Python.html#Python_nn11">Compiling for 64-bit platforms</a>
-<li><a href="Python.html#Python_nn12">Building Python Extensions under Windows</a>
+<li><a href="Python.html#Python_nn12">Building Python extensions under Windows</a>
+<li><a href="Python.html#Python_commandline">Additional Python commandline options</a>
</ul>
<li><a href="Python.html#Python_nn13">A tour of basic C/C++ wrapping</a>
<ul>
@@ -1535,7 +1383,6 @@
<li><a href="Python.html#Python_builtin_overloads">Operator overloads and slots -- use them!</a>
</ul>
<li><a href="Python.html#Python_nn30">Memory management</a>
-<li><a href="Python.html#Python_nn31">Python 2.2 and classic classes</a>
</ul>
<li><a href="Python.html#Python_directors">Cross language polymorphism</a>
<ul>
@@ -1553,6 +1400,10 @@
<li><a href="Python.html#Python_nn42">Adding additional Python code</a>
<li><a href="Python.html#Python_nn43">Class extension with %extend</a>
<li><a href="Python.html#Python_nn44">Exception handling with %exception</a>
+<li><a href="Python.html#Python_optimization">Optimization options</a>
+<ul>
+<li><a href="Python.html#Python_fastproxy">-fastproxy</a>
+</ul>
</ul>
<li><a href="Python.html#Python_nn45">Tips and techniques</a>
<ul>
@@ -1577,6 +1428,7 @@
<li><a href="Python.html#Python_nn62">Mapping Python tuples into small arrays</a>
<li><a href="Python.html#Python_nn63">Mapping sequences to C arrays</a>
<li><a href="Python.html#Python_nn64">Pointer handling</a>
+<li><a href="Python.html#Python_memory_management_member_variables">Memory management when returning references to member variables</a>
</ul>
<li><a href="Python.html#Python_nn65">Docstring Features</a>
<ul>
@@ -1597,12 +1449,13 @@
<li><a href="Python.html#Python_absrelimports">Absolute and relative imports</a>
<li><a href="Python.html#Python_absimport">Enforcing absolute import semantics</a>
<li><a href="Python.html#Python_importfrominit">Importing from __init__.py</a>
-<li><a href="Python.html#Python_implicit_namespace_packages">Implicit Namespace Packages</a>
-<li><a href="Python.html#Python_package_search">Searching for the wrapper module</a>
+<li><a href="Python.html#Python_implicit_namespace_packages">Implicit namespace packages</a>
+<li><a href="Python.html#Python_package_search">Location of modules</a>
<ul>
<li><a href="Python.html#Python_package_search_both_package_modules">Both modules in the same package</a>
-<li><a href="Python.html#Python_package_search_wrapper_split">Split modules</a>
<li><a href="Python.html#Python_package_search_both_global_modules">Both modules are global</a>
+<li><a href="Python.html#Python_package_search_wrapper_split">Split modules custom configuration</a>
+<li><a href="Python.html#Python_custom_module_import">More on customizing the module import code</a>
<li><a href="Python.html#Python_package_search_static">Statically linked C modules</a>
</ul>
</ul>
@@ -1614,11 +1467,16 @@
<li><a href="Python.html#Python_nn77">Byte string output conversion</a>
<li><a href="Python.html#Python_2_unicode">Python 2 Unicode</a>
</ul>
+<li><a href="Python.html#Python_multithreaded">Support for Multithreaded Applications</a>
+<ul>
+<li><a href="Python.html#Python_thread_UI">UI for Enabling Multithreading Support</a>
+<li><a href="Python.html#Python_thread_performance">Multithread Performance</a>
+</ul>
</ul>
</div>
<!-- INDEX -->
-<h3><a href="R.html#R">37 SWIG and R</a></h3>
+<h3><a href="R.html#R">33 SWIG and R</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1634,7 +1492,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Ruby.html#Ruby">38 SWIG and Ruby</a></h3>
+<h3><a href="Ruby.html#Ruby">34 SWIG and Ruby</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1772,7 +1630,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Scilab.html#Scilab">39 SWIG and Scilab</a></h3>
+<h3><a href="Scilab.html#Scilab">35 SWIG and Scilab</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1803,7 +1661,7 @@
</ul>
<li><a href="Scilab.html#Scilab_wrapping_pointers">Pointers</a>
<ul>
-<li><a href="Scilab.html#Scilab_wrapping_pointers_pointer_adresses">Utility functions</a>
+<li><a href="Scilab.html#Scilab_wrapping_pointers_utility_functions">Utility functions</a>
<li><a href="Scilab.html#Scilab_wrapping_pointers_null_pointers">Null pointers:</a>
</ul>
<li><a href="Scilab.html#Scilab_wrapping_structs">Structures</a>
@@ -1841,7 +1699,7 @@
</div>
<!-- INDEX -->
-<h3><a href="Tcl.html#Tcl">40 SWIG and Tcl</a></h3>
+<h3><a href="Tcl.html#Tcl">36 SWIG and Tcl</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1907,7 +1765,74 @@
</div>
<!-- INDEX -->
-<h3><a href="Extending.html#Extending">41 Extending SWIG to support new languages</a></h3>
+<h3><a href="Mzscheme.html#Mzscheme">37 SWIG and MzScheme/Racket</a></h3>
+
+<!-- INDEX -->
+<div class="sectiontoc">
+<ul>
+<li><a href="Mzscheme.html#MzScheme_nn2">Creating native structures</a>
+<li><a href="Mzscheme.html#MzScheme_simple">Simple example</a>
+<li><a href="Mzscheme.html#MzScheme_external_docs">External documentation</a>
+</ul>
+</div>
+<!-- INDEX -->
+
+<h3><a href="Ocaml.html#Ocaml">38 SWIG and OCaml</a></h3>
+
+<!-- INDEX -->
+<div class="sectiontoc">
+<ul>
+<li><a href="Ocaml.html#Ocaml_nn2">Preliminaries</a>
+<ul>
+<li><a href="Ocaml.html#Ocaml_nn3">Running SWIG</a>
+<li><a href="Ocaml.html#Ocaml_nn4">Compiling the code</a>
+<li><a href="Ocaml.html#Ocaml_nn5">The camlp4 module</a>
+<li><a href="Ocaml.html#Ocaml_nn6">Using your module</a>
+<li><a href="Ocaml.html#Ocaml_nn7">Compilation problems and compiling with C++</a>
+</ul>
+<li><a href="Ocaml.html#Ocaml_nn8">The low-level Ocaml/C interface</a>
+<ul>
+<li><a href="Ocaml.html#Ocaml_nn9">The generated module</a>
+<li><a href="Ocaml.html#Ocaml_nn10">Enums</a>
+<ul>
+<li><a href="Ocaml.html#Ocaml_nn11">Enum typing in Ocaml</a>
+</ul>
+<li><a href="Ocaml.html#Ocaml_nn12">Arrays</a>
+<ul>
+<li><a href="Ocaml.html#Ocaml_nn13">Simple types of bounded arrays</a>
+<li><a href="Ocaml.html#Ocaml_nn14">Complex and unbounded arrays</a>
+<li><a href="Ocaml.html#Ocaml_nn15">Using an object</a>
+<li><a href="Ocaml.html#Ocaml_nn16">Example typemap for a function taking float * and int</a>
+</ul>
+<li><a href="Ocaml.html#Ocaml_nn17">C++ Classes</a>
+<ul>
+<li><a href="Ocaml.html#Ocaml_nn18">STL vector and string Example</a>
+<li><a href="Ocaml.html#Ocaml_nn19">C++ Class Example</a>
+<li><a href="Ocaml.html#Ocaml_nn20">Compiling the example</a>
+<li><a href="Ocaml.html#Ocaml_nn21">Sample Session</a>
+</ul>
+<li><a href="Ocaml.html#Ocaml_nn22">Director Classes</a>
+<ul>
+<li><a href="Ocaml.html#Ocaml_nn23">Director Introduction</a>
+<li><a href="Ocaml.html#Ocaml_nn24">Overriding Methods in Ocaml</a>
+<li><a href="Ocaml.html#Ocaml_nn25">Director Usage Example</a>
+<li><a href="Ocaml.html#Ocaml_nn26">Creating director objects</a>
+<li><a href="Ocaml.html#Ocaml_nn27">Typemaps for directors, directorin, directorout, directorargout</a>
+<li><a href="Ocaml.html#Ocaml_nn28">directorin typemap</a>
+<li><a href="Ocaml.html#Ocaml_nn29">directorout typemap</a>
+<li><a href="Ocaml.html#Ocaml_nn30">directorargout typemap</a>
+</ul>
+<li><a href="Ocaml.html#Ocaml_nn31">Exceptions</a>
+</ul>
+<li><a href="Ocaml.html#Ocaml_nn32">Documentation Features</a>
+<ul>
+<li><a href="Ocaml.html#Ocaml_nn33">Module docstring</a>
+</ul>
+</ul>
+</div>
+<!-- INDEX -->
+
+<h3><a href="Extending.html#Extending">39 Extending SWIG to support new languages</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
@@ -1965,8 +1890,13 @@
<li><a href="Extending.html#Extending_running_test_suite">Running the test-suite</a>
</ul>
<li><a href="Extending.html#Extending_nn43">Documentation</a>
-<li><a href="Extending.html#Extending_prerequisites">Prerequisites for adding a new language module to the SWIG distribution</a>
<li><a href="Extending.html#Extending_coding_style_guidelines">Coding style guidelines</a>
+<li><a href="Extending.html#Extending_language_status">Target language status</a>
+<ul>
+<li><a href="Extending.html#Extending_supported_status">Supported status</a>
+<li><a href="Extending.html#Extending_experimental_status">Experimental status</a>
+</ul>
+<li><a href="Extending.html#Extending_prerequisites">Prerequisites for adding a new language module to the SWIG distribution</a>
</ul>
<li><a href="Extending.html#Extending_debugging_options">Debugging Options</a>
<li><a href="Extending.html#Extending_nn46">Guide to parse tree nodes</a>
diff --git a/Doc/Manual/Contract.html b/Doc/Manual/Contract.html
index ef1228cfb..93fb8c003 100644
--- a/Doc/Manual/Contract.html
+++ b/Doc/Manual/Contract.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Contract">13 Contracts</a></H1>
+<H1><a name="Contract">15 Contracts</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -39,7 +39,7 @@ When one of the rules is violated by a script, a runtime exception is
generated rather than having the program continue to execute.
</p>
-<H2><a name="Contract_nn2">13.1 The %contract directive</a></H2>
+<H2><a name="Contract_nn2">15.1 The %contract directive</a></H2>
<p>
@@ -95,7 +95,7 @@ RuntimeError: Contract violation: require: (arg1&gt;=0)
</pre>
</div>
-<H2><a name="Contract_nn3">13.2 %contract and classes</a></H2>
+<H2><a name="Contract_nn3">15.2 %contract and classes</a></H2>
<p>
@@ -174,7 +174,7 @@ specified for the derived class all must hold. In the above example,
this means that both the arguments to <tt>Spam::bar</tt> must be positive.
</p>
-<H2><a name="Contract_nn4">13.3 Constant aggregation and %aggregate_check</a></H2>
+<H2><a name="Contract_nn4">15.3 Constant aggregation and %aggregate_check</a></H2>
<p>
@@ -263,7 +263,7 @@ Regrettably, there is no automatic way to perform similar checks with enums valu
release.
</p>
-<H2><a name="Contract_nn5">13.4 Notes</a></H2>
+<H2><a name="Contract_nn5">15.4 Notes</a></H2>
<p>
diff --git a/Doc/Manual/Customization.html b/Doc/Manual/Customization.html
index 0e5fb2869..328bc2391 100644
--- a/Doc/Manual/Customization.html
+++ b/Doc/Manual/Customization.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Customization">12 Customization Features</a></H1>
+<H1><a name="Customization">14 Customization Features</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -46,7 +46,7 @@ of exception handling is presented. Then, a more general-purpose
customization mechanism known as "features" is described.
</p>
-<H2><a name="Customization_exception">12.1 Exception handling with %exception</a></H2>
+<H2><a name="Customization_exception">14.1 Exception handling with %exception</a></H2>
<p>
@@ -101,7 +101,7 @@ for exception handling. That directive is deprecated--<tt>%exception</tt>
provides the same functionality, but is substantially more flexible.
</p>
-<H3><a name="Customization_nn3">12.1.1 Handling exceptions in C code</a></H3>
+<H3><a name="Customization_nn3">14.1.1 Handling exceptions in C code</a></H3>
<p>
@@ -169,7 +169,7 @@ Each target language has its own approach to creating a runtime error/exception
and for Perl it is the <tt>croak</tt> method shown above.
</p>
-<H3><a name="Customization_nn4">12.1.2 Exception handling with longjmp()</a></H3>
+<H3><a name="Customization_nn4">14.1.2 Exception handling with longjmp()</a></H3>
<p>
@@ -245,7 +245,7 @@ Note: This implementation is only intended to illustrate the general idea. To m
modify it to handle nested <tt>try</tt> declarations.
</p>
-<H3><a name="Customization_nn5">12.1.3 Handling C++ exceptions</a></H3>
+<H3><a name="Customization_nn5">14.1.3 Handling C++ exceptions</a></H3>
<p>
@@ -280,7 +280,7 @@ class OutOfMemory {};
</pre>
</div>
-<H3><a name="Customization_allowexcept">12.1.4 Exception handlers for variables</a></H3>
+<H3><a name="Customization_allowexcept">14.1.4 Exception handlers for variables</a></H3>
<p>
@@ -305,7 +305,7 @@ The <tt>%allowexception</tt> feature works like any other feature and so can be
</pre>
</div>
-<H3><a name="Customization_nn6">12.1.5 Defining different exception handlers</a></H3>
+<H3><a name="Customization_nn6">14.1.5 Defining different exception handlers</a></H3>
<p>
@@ -356,7 +356,7 @@ In this case, the exception handler is only attached to declarations
named "allocate". This would include both global and member
functions. The names supplied to <tt>%exception</tt> follow the same
rules as for <tt>%rename</tt> described in the section on
-<a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>.
+<a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Renaming and ambiguity resolution</a>.
For example, if you wanted to define
an exception handler for a specific class, you might write this:
</p>
@@ -442,7 +442,7 @@ declarations. However, it never really worked that well and the new
%exception directive is much better.
</p>
-<H3><a name="Customization_exception_special_variables">12.1.6 Special variables for %exception</a></H3>
+<H3><a name="Customization_exception_special_variables">14.1.6 Special variables for %exception</a></H3>
<p>
@@ -516,7 +516,7 @@ The special variables are often used in situations where method calls are logged
$action
}
catch (MemoryError) {
- croak("Out of memory in $decl");
+ croak("Out of memory in $decl");
}
}
void log(const char *message);
@@ -545,7 +545,7 @@ Below shows the expansions for the 1st of the overloaded <tt>something</tt> wrap
</pre></div>
-<H3><a name="Customization_nn7">12.1.7 Using The SWIG exception library</a></H3>
+<H3><a name="Customization_nn7">14.1.7 Using The SWIG exception library</a></H3>
<p>
@@ -600,7 +600,7 @@ SWIG_NullReferenceError
The <tt>SWIG_exception()</tt> function can also be used in typemaps.
</p>
-<H2><a name="Customization_ownership">12.2 Object ownership and %newobject</a></H2>
+<H2><a name="Customization_ownership">14.2 Object ownership and %newobject</a></H2>
<p>
@@ -757,7 +757,7 @@ char *strdup(const char *s);
The results might not be what you expect.
</p>
-<H2><a name="Customization_features">12.3 Features and the %feature directive</a></H2>
+<H2><a name="Customization_features">14.3 Features and the %feature directive</a></H2>
<p>
@@ -796,7 +796,7 @@ involving <tt>%feature</tt>:
</div>
<p>
-The name matching rules outlined in the <a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
+The name matching rules outlined in the <a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Renaming and ambiguity resolution</a>
section applies to all <tt>%feature</tt> directives.
In fact the <tt>%rename</tt> directive is just a special form of <tt>%feature</tt>.
The matching rules mean that features are very flexible and can be applied with
@@ -839,7 +839,7 @@ The following are all equivalent:
The syntax in the first variation will generate the <tt>{ }</tt> delimiters used whereas the other variations will not.
</p>
-<H3><a name="Customization_feature_attributes">12.3.1 Feature attributes</a></H3>
+<H3><a name="Customization_feature_attributes">14.3.1 Feature attributes</a></H3>
<p>
@@ -880,7 +880,7 @@ In the following example, <tt>MyExceptionClass</tt> is the name of the Java clas
Further details can be obtained from the <a href="Java.html#Java_exception_handling">Java exception handling</a> section.
</p>
-<H3><a name="Customization_feature_flags">12.3.2 Feature flags</a></H3>
+<H3><a name="Customization_feature_flags">14.3.2 Feature flags</a></H3>
<p>
@@ -978,7 +978,7 @@ in the <tt>swig.swg</tt> Library file. The following shows the alternative synta
The concept of clearing features is discussed next.
</p>
-<H3><a name="Customization_clearing_features">12.3.3 Clearing features</a></H3>
+<H3><a name="Customization_clearing_features">14.3.3 Clearing features</a></H3>
<p>
@@ -1071,7 +1071,7 @@ The three macros below show this for the "except" feature:
</pre>
</div>
-<H3><a name="Customization_features_default_args">12.3.4 Features and default arguments</a></H3>
+<H3><a name="Customization_features_default_args">14.3.4 Features and default arguments</a></H3>
<p>
@@ -1146,7 +1146,7 @@ specifying or not specifying default arguments in a feature is not applicable as
in SWIG-1.3.23 when the approach to wrapping methods with default arguments was changed.
</p>
-<H3><a name="Customization_features_example">12.3.5 Feature example</a></H3>
+<H3><a name="Customization_features_example">14.3.5 Feature example</a></H3>
<p>
diff --git a/Doc/Manual/D.html b/Doc/Manual/D.html
index 45b57e18b..d97267a5b 100644
--- a/Doc/Manual/D.html
+++ b/Doc/Manual/D.html
@@ -6,7 +6,7 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF">
-<H1><a name="D">22 SWIG and D</a></H1>
+<H1><a name="D">23 SWIG and D</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -41,7 +41,7 @@
-<H2><a name="D_introduction">22.1 Introduction</a></H2>
+<H2><a name="D_introduction">23.1 Introduction</a></H2>
<p>From the <a href="http://www.digitalmars.com/d/">D Programming Language</a> web site: <em>D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. [...] The D language is statically typed and compiles directly to machine code.</em> As such, it is not very surprising that D is able to directly <a href="http://www.digitalmars.com/d/1.0/interfaceToC.html">interface with C libraries</a>. Why would a SWIG module for D be needed then in the first place?</p>
@@ -53,10 +53,10 @@
<p>To help addressing these issues, the SWIG C# module has been forked to support D. Is has evolved quite a lot since then, but there are still many similarities, so if you do not find what you are looking for on this page, it might be worth having a look at the chapter on <a href="CSharp.html#CSharp">C#</a> (and also on <a href="Java.html#Java">Java</a>, since the C# module was in turn forked from it).</p>
-<H2><a name="D_command_line_invocation">22.2 Command line invocation</a></H2>
+<H2><a name="D_command_line_invocation">23.2 Command line invocation</a></H2>
-<p>To activate the D module, pass the <tt>-d</tt> option to SWIG at the command line. The same standard command line switches as with any other language module are available, plus the following D specific ones:</p>
+<p>To activate the D module, pass the <tt>-d</tt> option to SWIG at the command line. The same standard command line options as with any other language module are available, plus the following D specific ones:</p>
<dl>
<dt><tt>-d2</tt></dt>
@@ -66,8 +66,8 @@
<dt><a name="D_splitproxy"></a><tt>-splitproxy</tt></dt>
<dd>
- <p>By default, SWIG generates two D modules: the <em>proxy</em> module, named like the source module (either specified via the <tt>%module</tt> directive or via the <tt>module</tt> command line switch), which contains all the proxy classes, functions, enums, etc., and the <em>intermediary</em> module (named like the proxy module, but suffixed with <tt>_im</tt>), which contains all the <tt>extern(C)</tt> function declarations and other private parts only used internally by the proxy module.</p>
- <p>If the split proxy mode is enabled by passing this switch at the command line, all proxy classes and enums are emitted to their own D module instead. The main proxy module only contains free functions and constants in this case.</p>
+ <p>By default, SWIG generates two D modules: the <em>proxy</em> module, named like the source module (either specified via the <tt>%module</tt> directive or via the <tt>module</tt> command line option), which contains all the proxy classes, functions, enums, etc., and the <em>intermediary</em> module (named like the proxy module, but suffixed with <tt>_im</tt>), which contains all the <tt>extern(C)</tt> function declarations and other private parts only used internally by the proxy module.</p>
+ <p>If the split proxy mode is enabled by passing this option at the command line, all proxy classes and enums are emitted to their own D module instead. The main proxy module only contains free functions and constants in this case.</p>
</dd>
<dt><tt>-package &lt;pkg&gt;</tt></dt>
@@ -77,16 +77,16 @@
<dt><tt>-wrapperlibrary &lt;wl&gt;</tt></dt>
<dd>
- <p>The code SWIG generates to dynamically load the C/C++ wrapper layer looks for a library called <tt>$module_wrap</tt> by default. With this switch, you can override the name of the file the wrapper code loads at runtime (the <tt>lib</tt> prefix and the suffix for shared libraries are appended automatically, depending on the OS).</p>
+ <p>The code SWIG generates to dynamically load the C/C++ wrapper layer looks for a library called <tt>$module_wrap</tt> by default. With this option, you can override the name of the file the wrapper code loads at runtime (the <tt>lib</tt> prefix and the suffix for shared libraries are appended automatically, depending on the OS).</p>
<p>This might especially be useful if you want to invoke SWIG several times on separate modules, but compile the resulting code into a single shared library.</p>
</dd>
</dl>
-<H2><a name="D_typemaps">22.3 Typemaps</a></H2>
+<H2><a name="D_typemaps">23.3 Typemaps</a></H2>
-<H3><a name="D_typemap_name_comparison">22.3.1 C# &lt;-&gt; D name comparison</a></H3>
+<H3><a name="D_typemap_name_comparison">23.3.1 C# &lt;-&gt; D name comparison</a></H3>
<p>If you already know the SWIG C# module, you might find the following name comparison table useful:</p>
@@ -107,12 +107,12 @@
csimports &lt;-&gt; dimports
csbody &lt;-&gt; dbody
csfinalize &lt;-&gt; ddestructor
- csdestruct &lt;-&gt; ddispose
- csdestruct_derived &lt;-&gt; ddispose_derived
+ csdisposing &lt;-&gt; ddispose
+ csdisposing_derived &lt;-&gt; ddispose_derived
</pre></div>
-<H3><a name="D_ctype_imtype_dtype">22.3.2 ctype, imtype, dtype</a></H3>
+<H3><a name="D_ctype_imtype_dtype">23.3.2 ctype, imtype, dtype</a></H3>
<p>Mapping of types between the C/C++ library, the C/C++ library wrapper exposing the C functions, the D wrapper module importing these functions and the D proxy code.</p>
@@ -120,7 +120,7 @@
<p>The <tt>ctype</tt> typemap is used to determine the types to use in the C wrapper functions. The types from the <tt>imtype</tt> typemap are used in the extern(C) declarations of these functions in the intermediary D module. The <tt>dtype</tt> typemap contains the D types used in the D proxy module/class.</p>
-<H3><a name="D_in_out_directorin_direcetorout">22.3.3 in, out, directorin, directorout</a></H3>
+<H3><a name="D_in_out_directorin_direcetorout">23.3.3 in, out, directorin, directorout</a></H3>
<p>Used for converting between the types for C/C++ and D when generating the code for the wrapper functions (on the C++ side).</p>
@@ -130,7 +130,7 @@
<p>The <tt>directorin</tt> typemap is used to convert parameters to the type used in the D director callback function, its return value is processed by <tt>directorout</tt> (see below).</p>
-<H3><a name="D_din_dout_ddirectorin_ddirectorout">22.3.4 din, dout, ddirectorin, ddirectorout</a></H3>
+<H3><a name="D_din_dout_ddirectorin_ddirectorout">23.3.4 din, dout, ddirectorin, ddirectorout</a></H3>
<p>Typemaps for code generation in D proxy and type wrapper classes.</p>
@@ -157,13 +157,13 @@
dtype DClass.method(dtype a)</pre></div>
-<H3><a name="D_typecheck_typemaps">22.3.5 typecheck typemaps</a></H3>
+<H3><a name="D_typecheck_typemaps">23.3.5 typecheck typemaps</a></H3>
<p>Because, unlike many scripting languages supported by SWIG, D does not need any dynamic dispatch helper to access an overloaded function, the purpose of these is merely to issue a warning for overloaded C++ functions that cannot be overloaded in D (as more than one C++ type maps to a single D type).</p>
-<H3><a name="D_code_injection_typemaps">22.3.6 Code injection typemaps</a></H3>
+<H3><a name="D_code_injection_typemaps">23.3.6 Code injection typemaps</a></H3>
<p>These typemaps are used for generating the skeleton of proxy classes for C++ types.</p>
@@ -178,7 +178,7 @@
Code can also be injected into the D proxy class using <tt>%proxycode</tt>.
</p>
-<H3><a name="D_special_variables">22.3.7 Special variable macros</a></H3>
+<H3><a name="D_special_variables">23.3.7 Special variable macros</a></H3>
<p>The standard SWIG special variables are available for use within typemaps as described in the <a href="Typemaps.html#Typemaps">Typemaps documentation</a>, for example <tt>$1</tt>, <tt>$input</tt>, <tt>$result</tt> etc.</p>
@@ -280,7 +280,7 @@ class SomeClass : AnInterface, AnotherInterface {
...
}
</pre></div>
- <p>For this to work, <tt>AnInterface</tt> and <tt>AnotherInterface</tt> have to be in scope. If SWIG is not in split proxy mode, this is already the case, but it it is, they have to be added to the import list via the <tt>dimports</tt> typemap. Additionally, the import statement depends on the package SWIG is configured to emit the modules to.</p>
+ <p>For this to work, <tt>AnInterface</tt> and <tt>AnotherInterface</tt> have to be in scope. If SWIG is not in split proxy mode, this is already the case, but if it is, they have to be added to the import list via the <tt>dimports</tt> typemap. Additionally, the import statement depends on the package SWIG is configured to emit the modules to.</p>
<p>The <tt>$importtype</tt> macro helps you to elegantly solve this problem:</p>
<div class="code"><pre>
%typemap(dimports) RemoteMpe %{
@@ -299,7 +299,7 @@ $importtype(AnotherInterface)
</dl>
-<H2><a name="D_features">22.4 D and %feature</a></H2>
+<H2><a name="D_features">23.4 D and %feature</a></H2>
<p>The D module defines a number of directives which modify the <a href="Customization.html#Customization_features">SWIG features</a> set globally or for a specific declaration:</p>
@@ -329,7 +329,7 @@ struct A {
</dl>
-<H2><a name="D_pragmas">22.5 Pragmas</a></H2>
+<H2><a name="D_pragmas">23.5 Pragmas</a></H2>
<p>There are a few SWIG pragmas specific to the D module, which you can use to influence the D code SWIG generates:</p>
@@ -368,7 +368,7 @@ struct A {
</dl>
-<H2><a name="D_exceptions">22.6 D Exceptions</a></H2>
+<H2><a name="D_exceptions">23.6 D Exceptions</a></H2>
<p>Out of the box, C++ exceptions are fundamentally incompatible to their equivalent in the D world and cannot simply be propagated to a calling D method. There is, however, an easy way to solve this problem: Just catch the exception in the C/C++ wrapper layer, pass the contents to D, and make the wrapper code rethrow the exception in the D world.</p>
@@ -378,7 +378,7 @@ struct A {
<p>As this feature is implemented in exactly the same way it is for C#, please see the <a href="CSharp.html#CSharp_exceptions">C# documentation</a> for a more detailed explanation.</p>
-<H2><a name="D_directors">22.7 D Directors</a></H2>
+<H2><a name="D_directors">23.7 D Directors</a></H2>
<p>When the directors feature is activated, SWIG generates extra code on both the C++ and the D side to enable cross-language polymorphism. Essentially, this means that if you subclass a proxy class in D, C++ code can access any overridden virtual methods just as if you created a derived class in C++.</p>
@@ -387,16 +387,16 @@ struct A {
</p>
-<H2><a name="D_other_features">22.8 Other features</a></H2>
+<H2><a name="D_other_features">23.8 Other features</a></H2>
-<H3><a name="D_nspace">22.8.1 Extended namespace support (nspace)</a></H3>
+<H3><a name="D_nspace">23.8.1 Extended namespace support (nspace)</a></H3>
<p>By default, SWIG flattens all C++ namespaces into a single target language namespace, but as for Java and C#, the <a href="SWIGPlus.html#SWIGPlus_nspace"><tt>nspace</tt></a> feature is supported for D. If it is active, C++ namespaces are mapped to D packages/modules. Note, however, that like for the other languages, <em>free</em> variables and functions are not supported yet; currently, they are all allows written to the main proxy D module.</p>
-<H3><a name="D_native_pointer_support">22.8.2 Native pointer support</a></H3>
+<H3><a name="D_native_pointer_support">23.8.2 Native pointer support</a></H3>
<p>Contrary to many of the scripting languages supported by SWIG, D fully supports C-style pointers. The D module thus includes a custom mechanism to wrap C pointers directly as D pointers where applicable, that is, if the type that is pointed to is represented the same in C and D (on the bit-level), dubbed a <em>primitive type</em> below.</p>
@@ -408,7 +408,7 @@ struct A {
<p>To determine if a type should be considered primitive, the <tt>cprimitive</tt> attribute on its <tt>dtype</tt> attribute is used. For example, the <tt>dtype</tt> typemap for <tt>float</tt> has <tt>cprimitive="1"</tt>, so the code from the <tt>nativepointer</tt> attribute is taken into account e.g. for <tt>float **</tt> or the function pointer <tt>float (*)(float *)</tt>.</p>
-<H3><a name="D_operator_overloading">22.8.3 Operator overloading</a></H3>
+<H3><a name="D_operator_overloading">23.8.3 Operator overloading</a></H3>
<p>The D module comes with basic operator overloading support for both D1 and D2. There are, however, a few limitations arising from conceptual differences between C++ and D:</p>
@@ -420,7 +420,7 @@ struct A {
<p>There are also some cases where the operators can be translated to D, but the differences in the implementation details are big enough that a rather involved scheme would be required for automatic wrapping them, which has not been implemented yet. This affects, for example, the array subscript operator, <tt>[]</tt>, in combination with assignments - while <tt>operator []</tt> in C++ simply returns a reference which is then written to, D resorts to a separate <tt>opIndexAssign</tt> method -, or implicit casting (which was introduced in D2 via <tt>alias this</tt>). Despite the lack of automatic support, manually handling these cases should be perfectly possible.</p>
-<H3><a name="D_test_suite">22.8.4 Running the test-suite</a></H3>
+<H3><a name="D_test_suite">23.8.4 Running the test-suite</a></H3>
<p>As with any other language, the SWIG test-suite can be built for D using the <tt>*-d-test-suite</tt> targets of the top-level Makefile. By default, D1 is targeted, to build it with D2, use the optional <tt>D_VERSION</tt> variable, e.g. <tt>make check-d-test-suite D_VERSION=2</tt>.</p>
@@ -428,14 +428,14 @@ struct A {
<p>Note: If you want to use GDC on Linux or another platform which requires you to link <tt>libdl</tt> for dynamically loading the shared library, you might have to add <tt>-ldl</tt> manually to the <tt>d_compile</tt> target in <tt>Examples/Makefile</tt>, because GDC does not currently honor the <tt>pragma(lib, ...)</tt> statement.</p>
-<H2><a name="D_typemap_examples">22.9 D Typemap examples</a></H2>
+<H2><a name="D_typemap_examples">23.9 D Typemap examples</a></H2>
<p>There are no D-specific typemap examples yet. However, with the above <a href="D.html#D_typemap_name_comparison">name comparison table</a>, you should be able to get an idea what can be done by looking at the <a href="CSharp.html#CSharp_typemap_examples">corresponding C# section</a>.</p>
-<H2><a name="D_planned_features">22.10 Work in progress and planned features</a></H2>
+<H2><a name="D_planned_features">23.10 Work in progress and planned features</a></H2>
<p>There are a couple of features which are not implemented yet, but would be very useful and might be added in the near future:</p>
diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html
new file mode 100644
index 000000000..ff025c047
--- /dev/null
+++ b/Doc/Manual/Doxygen.html
@@ -0,0 +1,1838 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>SWIG and Doxygen Translation</title>
+<link rel="stylesheet" type="text/css" href="style.css">
+</head>
+<body bgcolor="#FFFFFF">
+<H1><a name="Doxygen">17 SWIG and Doxygen Translation</a></H1>
+<!-- INDEX -->
+<div class="sectiontoc">
+<ul>
+<li><a href="#Doxygen_translation_overview">Doxygen translation overview</a>
+<li><a href="#Doxygen_file_preparation">Preparations</a>
+<ul>
+<li><a href="#Doxygen_running_swig">Enabling Doxygen translation</a>
+<li><a href="#Doxygen_features">Doxygen-specific %feature directives</a>
+<ul>
+<li><a href="#Doxygen_notranslate">doxygen:notranslate</a>
+<li><a href="#Doxygen_alias">doxygen:alias:&lt;command-name&gt;</a>
+<li><a href="#Doxygen_ignore">doxygen:ignore:&lt;command-name&gt;</a>
+<li><a href="#Doxygen_nolinktranslate">doxygen:nolinktranslate</a>
+<li><a href="#Doxygen_nostripparams">doxygen:nostripparams</a>
+</ul>
+<li><a href="#Doxygen_additional_options">Additional command line options</a>
+</ul>
+<li><a href="#Doxygen_to_javadoc">Doxygen to Javadoc</a>
+<ul>
+<li><a href="#Doxygen_basic_example">Basic example</a>
+<li><a href="#Doxygen_javadoc_tags">Javadoc tags</a>
+<li><a href="#Doxygen_unsupported_tags">Unsupported tags</a>
+<li><a href="#Doxygen_further_details">Further details</a>
+</ul>
+<li><a href="#Doxygen_to_pydoc">Doxygen to Pydoc</a>
+<ul>
+<li><a href="#Doxygen_python_basic_example">Basic example</a>
+<li><a href="#Doxygen_pydoc_tags">Pydoc translator</a>
+<li><a href="#Doxygen_python_unsupported_tags">Unsupported tags</a>
+<li><a href="#Doxygen_python_further_details">Further details</a>
+</ul>
+<li><a href="#Doxygen_troubleshooting">Troubleshooting</a>
+<ul>
+<li><a href="#troubleshooting_ifndef">Problem with conditional compilation</a>
+</ul>
+<li><a href="#Doxygen_developer_details">Developer information</a>
+<ul>
+<li><a href="#Doxygen_translator_design">Doxygen translator design</a>
+<li><a href="#Doxygen_debugging_commands">Debugging the Doxygen parser and translator</a>
+<li><a href="#Doxygen_tests">Tests</a>
+</ul>
+<li><a href="#Doxygen_language_extension">Extending to other languages</a>
+</ul>
+</div>
+<!-- INDEX -->
+
+
+
+<p>
+This chapter describes SWIG's support for translating Doxygen comments
+found in interface and header files into a target language's normal
+documentation language. Currently only Javadoc and Pydoc is
+supported.
+</p>
+
+<H2><a name="Doxygen_translation_overview">17.1 Doxygen translation overview</a></H2>
+
+
+<p>
+The Doxygen Translation module of SWIG adds an extra layer of
+functionality to SWIG, allowing automated translation of <a href=
+"http://www.doxygen.nl/manual/">Doxygen</a> formatted comments
+from input files into a documentation language more suited for the
+target language. Currently this module only translates into Javadoc
+and Pydoc for the SWIG Java and Python modules.
+Other extensions could be added at a later date.
+The Doxygen Translation module originally started as
+a <a href="https://developers.google.com/open-source/gsoc/2008/">Google Summer of
+Code</a> proposal from Summer 2008.
+</p>
+
+<H2><a name="Doxygen_file_preparation">17.2 Preparations</a></H2>
+
+
+<p>
+To make use of the comment translation system, your documentation
+comments must be in properly formatted <a href=
+"http://www.doxygen.nl/manual/">Doxygen.</a> Doxygen comments can be
+present in your main SWIG interface file or any header file that it
+imports. You are advised to be validate that your comments compile
+properly with Doxygen before you try to translate them. Doxygen
+itself is a more comprehensive tool and can provide you better feedback for
+correcting any syntax errors that may be present. Please look at
+Doxygen's <a href=
+"http://www.doxygen.nl/manual/docblocks.html"> Documenting the
+code</a> for the full comment format specifications. However, SWIG's
+Doxygen parser will still report many errors and warnings found
+in comments (like unterminated strings or missing ending tags).
+</p>
+
+<p>
+Currently, the whole subset of Doxygen comment styles is supported
+(See <a href="http://www.doxygen.nl/manual/docblocks.html">
+Documenting the code</a>). Here they are:
+</p>
+
+<div class="code"><pre>
+/**
+ * Javadoc style comment, multiline
+ */
+/*!
+ * QT-style comment, multiline
+ */
+/**
+ Any of the above, but without intermediate *'s
+ */
+/// Single-line comment
+//! Another single-line comment
+</pre></div>
+
+<p>
+Also any of the above with '&lt;' added after comment-starting symbol,
+like <i>/**&lt;, /*!&lt;, ///&lt;, </i> or <i> //!&lt;</i> will be
+treated as a post-comment and will be assigned to the code before the
+comment.
+
+Any number of '*' or '/' within a Doxygen comment is considered to be a
+separator and is not included in the final comment, so you may safely use
+comments like <i>/*********/</i> or <i>//////////</i>.
+</p>
+
+<p>
+Please note, as SWIG parses the input file by itself with strict grammar,
+there is only a limited support for various cases of comment placement
+in the file.
+</p>
+<p>
+Comments can be placed before C/C++ expressions on separate lines:
+</p>
+
+<div class="code"><pre>
+/**
+ * Some comment
+ */
+void someOtherFunction();
+/**
+ * Some comment
+ */
+void someFunction();
+
+class Shape {
+ /*
+ * Calculate the area in cm^2
+ */
+ int getArea();
+}
+</pre></div>
+
+<p>
+After C/C++ expressions at the end of the line:
+</p>
+
+<div class="code"><pre>
+int someVariable = 9; ///&lt; This is a var holding magic number 9
+void doNothing(); ///&lt; This does nothing, nop
+</pre></div>
+
+<p>
+and in some special cases, like function parameter comments:
+</p>
+
+<div class="code"><pre>
+void someFunction(
+ int a ///&lt; Some parameter
+ );
+</pre></div>
+
+<p>
+or enum element comments:
+</p>
+
+<div class="code"><pre>
+enum E_NUMBERS
+{
+ EN_ZERO, ///&lt; The first enum item, gets zero as it's value
+ EN_ONE, ///&lt; The second, EN_ONE=1
+ EN_THREE
+};
+</pre></div>
+
+<p>
+Currently only comments directly before or after the code items
+are supported. Doxygen also supports comments containing structural commands,
+where the comments for a code item are not put directly before or after the code item.
+These structural commands are stripped out by SWIG and are not assigned to anything.
+</p>
+
+<H3><a name="Doxygen_running_swig">17.2.1 Enabling Doxygen translation</a></H3>
+
+
+<p>
+Doxygen comments translation is disabled by default and needs to be explicitly
+enabled using the command line <tt>-doxygen</tt> option for the languages that
+do support it (currently Java and Python).
+</p>
+
+<H3><a name="Doxygen_features">17.2.2 Doxygen-specific %feature directives</a></H3>
+
+
+<p>
+Translation of Doxygen comments is influenced by the following <a
+href="Customization.html#Customization_features">%feature directives</a>:
+</p>
+
+<H4><a name="Doxygen_notranslate">17.2.2.1 doxygen:notranslate</a></H4>
+
+
+<p>
+Turns off translation of Doxygen comments to the target language syntax: the
+original comment will be copied to the output unchanged. This is useful if you
+want to use Doxygen itself to generate documentation for the target language
+instead of the corresponding language tool (<tt>javadoc</tt>, <tt>sphinx</tt>,
+...).
+</p>
+
+
+<H4><a name="Doxygen_alias">17.2.2.2 doxygen:alias:&lt;command-name&gt;</a></H4>
+
+
+<p>
+Specify an alias for a Doxygen command with the given name. This can be useful
+for custom Doxygen commands which can be defined using <tt>ALIASES</tt> option
+for Doxygen itself but which are unknown to SWIG. <tt>"command-name"</tt> is the
+name of the command in the Doxyfile, e.g. if it contains
+</p>
+
+<div class="code"><pre>
+ALIASES = "sideeffect=\par Side Effects:\n"
+</pre></div>
+
+<p>
+Then you could also specify the same expansion for SWIG with:
+</p>
+
+<div class="code"><pre>
+%feature("doxygen:alias:sideeffect") "\par Side Effects:\n"
+</pre></div>
+
+<p>
+Please note that command arguments are not currently supported with this
+feature.
+</p>
+
+<p>
+Notice that it is perfectly possible and potentially useful to define the alias
+expansion differently depending on the target language, e.g. with
+</p>
+
+<div class="code"><pre>
+#ifdef SWIGJAVA
+%feature("doxygen:alias:not_for_java") "This functionality is not available for Java"
+#else
+%feature("doxygen:alias:not_for_java") ""
+#endif
+</pre></div>
+
+<p>
+you could use <tt>@not_for_java</tt> in the documentation comments of all
+functions which can't, for whatever reason, be currently exposed in Java
+wrappers of the C++ API.
+</p>
+
+
+<H4><a name="Doxygen_ignore">17.2.2.3 doxygen:ignore:&lt;command-name&gt;</a></H4>
+
+
+<p>
+This feature makes it possible to just ignore an unknown Doxygen command, instead of
+replacing it with the predefined text that <tt>doxygen:alias</tt> does.
+For example, you could use
+</p>
+
+<div class="code"><pre>
+%feature("doxygen:ignore:transferfull") Fantastic();
+/**
+ A fantastic function.
+
+ @transferfull Command ignored, but anything here is still included.
+ */
+int * Fantastic();
+</pre></div>
+
+<p>
+if you use a custom Doxygen <tt>transferfull</tt> command to indicate that the
+return value ownership is transferred to the caller, as this information doesn't
+make much sense for the other languages without explicit ownership management.
+</p>
+
+<p>
+Doxygen syntax is rather rich and, in addition to simple commands such as
+<tt>@transferfull</tt>, it is also possible to define commands with arguments.
+As explained in <a href="http://www.doxygen.nl/manual/commands.html">Doxygen documentation</a>,
+the arguments can have a range of a single word, everything until the end of
+line or everything until the end of the next paragraph. Currently, only the "end
+of line" case is supported using the <tt>range="line"</tt> argument of the
+feature directive:
+</p>
+
+<div class="code"><pre>
+// Ignore occurrences of
+//
+// @compileroptions Some special C++ compiler options.
+//
+// in Doxygen comments as C++ options are not interesting for the target language
+// developers.
+%feature("doxygen:ignore:compileroptions", range="line") Amazing();
+
+/**
+ An amazing function.
+
+ @compileroptions This function must be compiled with /EHa when using MSVC.
+ */
+void Amazing();
+
+</pre></div>
+
+<p>
+In addition, it is also possible to have custom pairs of begin/end tags,
+similarly to the standard Doxygen <tt>@code/@endcode</tt>, for example. Such
+tags can also be ignored using the special value of <tt>range</tt> starting with
+<tt>end</tt> to indicate that the range is an interval, for example:
+</p>
+
+<div class="code"><pre>
+%feature("doxygen:ignore:forcpponly", range="end"); // same as "end:endforcpponly"
+/**
+ An incredible function.
+
+ @forcpponly
+ This is C++-specific.
+ @endforcpponly
+ */
+void Incredible();
+</pre></div>
+
+<p>
+would ignore everything between <tt>@forcpponly</tt> and <tt>@endforcpponly</tt>
+commands in Doxygen comments. By default, the name of the end command is the
+same as of the start one with "end" prefix, following Doxygen conventions, but
+this can be overridden by providing the end command name after the colon.
+</p>
+<p>
+This example shows how custom tags can be used to bracket anything specific to
+C++ and prevent it from appearing in the target language documentation.
+Conversely, another pair of custom tags could be used to put target language
+specific information in the C++ comments. In this case, only the custom tags
+themselves should be ignored, but their contents should be parsed as usual and
+<tt>contents="parse"</tt> can be used for this:
+</p>
+
+<div class="code"><pre>
+%feature("doxygen:ignore:beginPythonOnly", range="end:endPythonOnly", contents="parse");
+/**
+ A splendid function.
+
+ @beginPythonOnly
+ This is specific to @b Python.
+ @endPythonOnly
+ */
+void Splendid();
+
+</pre></div>
+
+<p>
+Putting everything together, if these directives are in effect:
+</p>
+
+<div class="code"><pre>
+%feature("doxygen:ignore:transferfull");
+%feature("doxygen:ignore:compileroptions", range="line");
+%feature("doxygen:ignore:forcpponly", range="end");
+%feature("doxygen:ignore:beginPythonOnly", range="end:endPythonOnly", contents="parse");
+</pre></div>
+
+<p>
+then the following C++ Doxygen comment:
+</p>
+
+<div class="code"><pre>
+/**
+ A contrived example of ignoring too many commands in one comment.
+
+ @forcpponly
+ This is C++-specific.
+ @endforcpponly
+
+ @beginPythonOnly
+ This is specific to @b Python.
+ @endPythonOnly
+
+ @transferfull Command ignored, but anything here is still included.
+
+ @compileroptions This function must be compiled with /EHa when using MSVC.
+ */
+int * Contrived();
+</pre></div>
+
+<p>
+would be translated to this comment in Python:
+</p>
+
+<div class="code"><pre>
+def func():
+ r"""
+ A contrived example of ignoring too many commands in one comment.
+
+ This is specific to **Python**.
+
+ Command ignored, but anything here is still included.
+ """
+ ...
+</pre></div>
+
+
+<H4><a name="Doxygen_nolinktranslate">17.2.2.4 doxygen:nolinktranslate</a></H4>
+
+
+<p>
+Turn off automatic link-objects translation.
+This is only applicable to Java at the moment.
+</p>
+
+
+<H4><a name="Doxygen_nostripparams">17.2.2.5 doxygen:nostripparams</a></H4>
+
+
+<p>
+Turn off stripping of <tt>@param</tt> and <tt>@tparam</tt>
+Doxygen commands if the parameter is not found in the function signature.
+This is only applicable to Java at the moment.
+</p>
+
+
+<H3><a name="Doxygen_additional_options">17.2.3 Additional command line options</a></H3>
+
+
+<p>
+ALSO TO BE ADDED (Javadoc auto brief?)
+</p>
+
+<H2><a name="Doxygen_to_javadoc">17.3 Doxygen to Javadoc</a></H2>
+
+
+<p>
+If translation is enabled, Javadoc formatted comments should be
+automatically placed in the correct locations in the resulting module
+and proxy files.
+</p>
+
+<H3><a name="Doxygen_basic_example">17.3.1 Basic example</a></H3>
+
+
+<p>
+Here is an example segment from an included header file
+</p>
+<div class="code"><pre>
+/*! This is describing class Shape
+ \author Bob
+ */
+
+class Shape {
+public:
+ Shape() {
+ nshapes++;
+ }
+ virtual ~Shape() {
+ nshapes--;
+ };
+ double x, y; /*!&lt; Important Variables */
+ void move(double dx, double dy); /*!&lt; Moves the Shape */
+ virtual double area(void) = 0; /*!&lt; \return the area */
+ virtual double perimeter(void) = 0; /*!&lt; \return the perimeter */
+ static int nshapes;
+};
+</pre></div>
+
+<p>
+Simply running SWIG should result in the following code being present in Shapes.java
+</p>
+
+<div class="targetlang"><pre>
+
+/**
+ * This is describing class Shape
+ * @author Bob
+ *
+ */
+
+public class Shape {
+
+...
+
+/**
+ * Important Variables
+ */
+ public void setX(double value) {
+ ShapesJNI.Shape_x_set(swigCPtr, this, value);
+ }
+
+/**
+ * Important Variables
+ */
+ public double getX() {
+ return ShapesJNI.Shape_x_get(swigCPtr, this);
+ }
+
+/**
+ * Moves the Shape
+ */
+ public void move(double dx, double dy) {
+ ShapesJNI.Shape_move(swigCPtr, this, dx, dy);
+ }
+
+/**
+ * @return the area
+ */
+ public double area() {
+ return ShapesJNI.Shape_area(swigCPtr, this);
+ }
+
+/**
+ * @return the perimeter
+ */
+ public double perimeter() {
+ return ShapesJNI.Shape_perimeter(swigCPtr, this);
+ }
+}
+
+</pre></div>
+
+<p>
+The code Java-wise should be identical to what would have been
+generated without the doxygen functionality enabled. When the Doxygen Translator
+module encounters a comment that contains nothing useful or a doxygen comment that it cannot
+parse, it will not affect the functionality of the SWIG generated
+code.
+</p>
+
+<p>
+The Javadoc translator will handle most of the tags conversions (see the
+table below). It will also automatically translate link-objects
+params, in \see and \link...\endlink commands. For example,
+'someFunction(std::string)' will be converted to
+'someFunction(String)'. If
+you don't want such behaviour, you could turn this off by using the
+'doxygen:nolinktranslate' feature. Also all '\param' and '\tparam'
+commands are stripped out, if the specified parameter is not present in
+the function. Use 'doxygen:nostripparams' to avoid.
+</p>
+
+<p>
+Javadoc translator features summary
+(see <a href="Customization.html#Customization_features">%feature
+directives</a>):
+</p>
+
+<H3><a name="Doxygen_javadoc_tags">17.3.2 Javadoc tags</a></H3>
+
+
+<p>
+Here is the list of all Doxygen tags and the description of how they are translated to Javadoc
+</p>
+<div class="diagram">
+<table border="0" summary="Java Doxygen tags">
+<tr>
+ <th align="left">Doxygen tags</th>
+</tr>
+<tr>
+<td>\a</td>
+<td>wrapped with &lt;i&gt; html tag</td>
+</tr>
+<tr>
+<td>\arg</td>
+<td>wrapped with &lt;li&gt; html tag</td>
+</tr>
+<tr>
+<td>\author</td>
+<td>translated to @author</td>
+</tr>
+<tr>
+<td>\authors</td>
+<td>translated to @author</td>
+</tr>
+<tr>
+<td>\b</td>
+<td>wrapped with &lt;b&gt; html tag</td>
+</tr>
+<tr>
+<td>\c</td>
+<td>wrapped with &lt;code&gt; html tag</td>
+</tr>
+<tr>
+<td>\cite</td>
+<td>wrapped with &lt;i&gt; html tag</td>
+</tr>
+<tr>
+<td>\code</td>
+<td>translated to {@code ...}</td>
+</tr>
+<tr>
+<td>\cond</td>
+<td>translated to 'Conditional comment: &lt;condition&gt;'</td>
+</tr>
+<tr>
+<td>\copyright</td>
+<td>replaced with 'Copyright:'</td>
+</tr>
+<tr>
+<td>\deprecated</td>
+<td>translated to @deprecated</td>
+</tr>
+<tr>
+<td>\e</td>
+<td>wrapped with &lt;i&gt; html tag</td>
+</tr>
+<tr>
+<td>\else</td>
+<td>replaced with '}Else:{'</td>
+</tr>
+<tr>
+<td>\elseif</td>
+<td>replaced with '}Else if: &lt;condition&gt;{'</td>
+</tr>
+<tr>
+<td>\em</td>
+<td>wrapped with &lt;i&gt; html tag</td>
+</tr>
+<tr>
+<td>\endcode</td>
+<td>see note for \code</td>
+</tr>
+<tr>
+<td>\endcond</td>
+<td>replaced with 'End of conditional comment.'</td>
+</tr>
+<tr>
+<td>\endif</td>
+<td>replaced with '}'</td>
+</tr>
+<tr>
+<td>\endlink</td>
+<td>see note for \link</td>
+</tr>
+<tr>
+<td>\endverbatim</td>
+<td>see note for \verbatim</td>
+</tr>
+<tr>
+<td>\exception</td>
+<td>translated to @exception</td>
+</tr>
+<tr>
+<td>\f$, \f[, \f], \f{, \f}</td>
+<td>LateX formulas are left unchanged</td>
+</tr>
+<tr>
+<td>\if</td>
+<td>replaced with 'If: &lt;condition&gt; {'</td>
+</tr>
+<tr>
+<td>\ifnot</td>
+<td>replaced with 'If not: &lt;condition&gt; {'</td>
+</tr>
+<tr>
+<td>\image</td>
+<td>translated to &lt;img/&gt; html tag only if target=HTML</td>
+</tr>
+<tr>
+<td>\li</td>
+<td>wrapped with &lt;li&gt; html tag</td>
+</tr>
+<tr>
+<td>\link</td>
+<td>translated to {@link ...}</td>
+</tr>
+<tr>
+<td>\n</td>
+<td>replaced with new line char</td>
+</tr>
+<tr>
+<td>\note</td>
+<td>replaced with 'Note:'</td>
+</tr>
+<tr>
+<td>\overload</td>
+<td>prints 'This is an overloaded ...' according to Doxygen docs</td>
+</tr>
+<tr>
+<td>\p</td>
+<td>wrapped with &lt;code&gt; html tag</td>
+</tr>
+<tr>
+<td>\par</td>
+<td>replaced with &lt;p alt='title'&gt;...&lt;/p&gt;</td>
+</tr>
+<tr>
+<td>\param</td>
+<td>translated to @param</td>
+</tr>
+<tr>
+<td>\remark</td>
+<td>replaced with 'Remarks:'</td>
+</tr>
+<tr>
+<td>\remarks</td>
+<td>replaced with 'Remarks:'</td>
+</tr>
+<tr>
+<td>\result</td>
+<td>translated to @return</td>
+</tr>
+<tr>
+<td>\return</td>
+<td>translated to @return</td>
+</tr>
+<tr>
+<td>\returns</td>
+<td>translated to @return</td>
+</tr>
+<tr>
+<td>\sa</td>
+<td>translated to @see</td>
+</tr>
+<tr>
+<td>\see</td>
+<td>translated to @see</td>
+</tr>
+<tr>
+<td>\since</td>
+<td>translated to @since</td>
+</tr>
+<tr>
+<td>\throw</td>
+<td>translated to @throws</td>
+</tr>
+<tr>
+<td>\throws</td>
+<td>translated to @throws</td>
+</tr>
+<tr>
+<td>\todo</td>
+<td>replaced with 'TODO:'</td>
+</tr>
+<tr>
+<td>\tparam</td>
+<td>translated to @param</td>
+</tr>
+<tr>
+<td>\verbatim</td>
+<td>translated to {@literal ...}</td>
+</tr>
+<tr>
+<td>\version</td>
+<td>translated to @version</td>
+</tr>
+<tr>
+<td>\warning</td>
+<td>translated to 'Warning:'</td>
+</tr>
+<tr>
+<td>\$</td>
+<td>prints $ char</td>
+</tr>
+<tr>
+<td>\@</td>
+<td>prints @ char</td>
+</tr>
+<tr>
+<td>\\</td>
+<td>prints \ char</td>
+</tr>
+<tr>
+<td>\&amp;</td>
+<td>prints &amp; char</td>
+</tr>
+<tr>
+<td>\~</td>
+<td>prints ~ char</td>
+</tr>
+<tr>
+<td>\&lt;</td>
+<td>prints &lt; char</td>
+</tr>
+<tr>
+<td>\&gt;</td>
+<td>prints &gt; char</td>
+</tr>
+<tr>
+<td>\#</td>
+<td>prints # char</td>
+</tr>
+<tr>
+<td>\%</td>
+<td>prints % char</td>
+</tr>
+<tr>
+<td>\&quot;</td>
+<td>prints &quot; char</td>
+</tr>
+<tr>
+<td>\.</td>
+<td>prints . char</td>
+</tr>
+<tr>
+<td>\::</td>
+<td>prints ::</td>
+</tr>
+</table>
+</div>
+
+<H3><a name="Doxygen_unsupported_tags">17.3.3 Unsupported tags</a></H3>
+
+
+<p>
+Doxygen has a wealth of tags such as @latexonly that have no
+equivalent in Javadoc (all supported tags are listed in
+<a href="https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html">Javadoc documentation</a>).
+As a result several tags have no
+translation or particular use, such as some linking and section tags.
+These are suppressed with their content just printed out (if the tag has any
+sense, typically text content).
+Here is the list of these tags:
+</p>
+<div class="diagram">
+<table border="0" summary="Unsupported Java Doxygen Tags">
+<tr>
+ <th align="left">Unsupported Doxygen tags</th>
+</tr>
+<tr>
+<td>\addindex</td>
+<td>\addtogroup</td>
+<td>\anchor</td>
+<td>\attention</td>
+</tr>
+<tr>
+<td>\brief</td>
+<td>\bug</td>
+<td>\callgraph</td>
+<td>\callergraph</td>
+</tr>
+<tr>
+<td>\class</td>
+<td>\copybrief</td>
+<td>\copydetails</td>
+<td>\copydoc</td>
+</tr>
+<tr>
+<td>\date</td>
+<td>\def</td>
+<td>\defgroup</td>
+<td>\details</td>
+</tr>
+<tr>
+<td>\dir</td>
+<td>\dontinclude</td>
+<td>\dot</td>
+<td>\dotfile</td>
+</tr>
+<tr>
+<td>\enddot</td>
+<td>\endhtmlonly</td>
+<td>\endinternal</td>
+<td>\endlatexonly</td>
+</tr>
+<tr>
+<td>\endmanonly</td>
+<td>\endmsc</td>
+<td>\endrtfonly</td>
+<td>\endxmlonly</td>
+</tr>
+<tr>
+<td>\enum</td>
+<td>\example</td>
+<td>\extends</td>
+</tr>
+<tr>
+<td>\file</td>
+<td>\fn</td>
+<td>\headerfile</td>
+<td>\hideinitializer</td>
+</tr>
+<tr>
+<td>\htmlinclude</td>
+<td>\htmlonly</td>
+<td>\implements</td>
+<td>\include</td>
+</tr>
+<tr>
+<td>\includelineno</td>
+<td>\ingroup</td>
+<td>\internal</td>
+<td>\invariant</td>
+</tr>
+<tr>
+<td>\interface</td>
+<td>\latexonly</td>
+<td>\line</td>
+<td>\mainpage</td>
+</tr>
+<tr>
+<td>\manonly</td>
+<td>\memberof</td>
+<td>\msc</td>
+<td>\mscfile</td>
+</tr>
+<tr>
+<td>\name</td>
+<td>\namespace</td>
+<td>\nosubgrouping</td>
+<td>\package</td>
+</tr>
+<tr>
+<td>\page</td>
+<td>\paragraph</td>
+<td>\post</td>
+<td>\pre</td>
+</tr>
+<tr>
+<td>\private</td>
+<td>\privatesection</td>
+<td>\property</td>
+<td>\protected</td>
+</tr>
+<tr>
+<td>\protectedsection</td>
+<td>\protocol</td>
+<td>\public</td>
+<td>\publicsection</td>
+</tr>
+<tr>
+<td>\ref</td>
+<td>\related</td>
+<td>\relates</td>
+<td>\relatedalso</td>
+</tr>
+<tr>
+<td>\relatesalso</td>
+<td>\retval</td>
+<td>\rtfonly</td>
+<td>\section</td>
+</tr>
+<tr>
+<td>\short</td>
+<td>\showinitializer</td>
+<td>\skip</td>
+<td>\skipline</td>
+</tr>
+<tr>
+<td>\snippet</td>
+<td>\struct</td>
+<td>\subpage</td>
+<td>\subsection</td>
+</tr>
+<tr>
+<td>\subsubsection</td>
+<td>\tableofcontents</td>
+<td>\test</td>
+<td>\typedef</td>
+</tr>
+<tr>
+<td>\union</td>
+<td>\until</td>
+<td>\var</td>
+<td>\verbinclude</td>
+</tr>
+<tr>
+<td>\weakgroup</td>
+<td>\xmlonly</td>
+<td>\xrefitem</td>
+<td>\category</td>
+</tr>
+</table>
+</div>
+
+<p>
+
+If one of the following Doxygen tags appears as the first tag in a
+comment, the whole comment block is ignored:
+<!-- see parser.y, function isStructuralDoxygen() -->
+
+</p>
+<div class="diagram">
+<table border="0" summary="Ignored Java Doxygen Tags">
+<tr>
+ <th align="left">Ignored Doxygen tags</th>
+</tr>
+<tr>
+<td>\addtogroup</td>
+<td>\callgraph</td>
+<td>\callergraph</td>
+<td>\category</td>
+</tr>
+<tr>
+<td>\class</td>
+<td>\def</td>
+<td>\defgroup</td>
+<td>\dir</td>
+</tr>
+<tr>
+<td>\enum</td>
+<td>\example</td>
+<td>\file</td>
+<td>\fn</td>
+</tr>
+<tr>
+<td>\headerfile</td>
+<td>\hideinitializer</td>
+<td>\interface</td>
+<td>\internal</td>
+</tr>
+<tr>
+<td>\mainpage</td>
+<td>\name</td>
+<td>\namespace</td>
+<td>\nosubgrouping</td>
+</tr>
+<tr>
+<td>\overload</td>
+<td>\package</td>
+<td>\page</td>
+<td>\property</td>
+</tr>
+<tr>
+<td>\protocol</td>
+<td>\relates</td>
+<td>\relatesalso</td>
+<td>\showinitializer</td>
+</tr>
+<tr>
+<td>\struct</td>
+<td>\name</td>
+<td>\namespace</td>
+<td>\nosubgrouping</td>
+</tr>
+<tr>
+<td>\typedef</td>
+<td>\union</td>
+<td>\var</td>
+<td>\weakgroup</td>
+</tr>
+
+</table>
+</div>
+
+
+
+<H3><a name="Doxygen_further_details">17.3.4 Further details</a></H3>
+
+
+<p>
+TO BE ADDED.
+</p>
+
+<H2><a name="Doxygen_to_pydoc">17.4 Doxygen to Pydoc</a></H2>
+
+
+<p>
+If translation is enabled, Pydoc formatted comments should be
+automatically placed in the correct locations in the resulting module
+and proxy files. The problem is that Pydoc has no tag mechanism like
+Doxygen or Javadoc, so most of Doxygen commands are translated by merely
+copying the appropriate command text.
+</p>
+
+<H3><a name="Doxygen_python_basic_example">17.4.1 Basic example</a></H3>
+
+
+<p>
+Here is an example segment from an included header file
+</p>
+<div class="code"><pre>
+/*! This is describing class Shape
+ \author Bob
+ */
+
+class Shape {
+public:
+ Shape() {
+ nshapes++;
+ }
+ virtual ~Shape() {
+ nshapes--;
+ };
+ double x, y; /*!&lt; Important Variables */
+ void move(double dx, double dy); /*!&lt; Moves the Shape */
+ virtual double area(void) = 0; /*!&lt; \return the area */
+ virtual double perimeter(void) = 0; /*!&lt; \return the perimeter */
+ static int nshapes;
+};
+</pre></div>
+
+<p>
+Simply running SWIG should result in the following code being present in Shapes.py
+</p>
+
+<div class="targetlang"><pre>
+
+...
+
+class Shape(_object):
+ """
+ This is describing class Shape
+ Authors:
+ Bob
+
+ """
+
+ ...
+
+ def move(self, *args):
+ """
+ Moves the Shape
+ """
+ return _Shapes.Shape_move(self, *args)
+
+ def area(self):
+ """
+ Return:
+ the area
+ """
+ return _Shapes.Shape_area(self)
+
+ def perimeter(self):
+ """
+ Return:
+ the perimeter
+ """
+ return _Shapes.Shape_perimeter(self)
+</pre></div>
+
+<p>
+If any parameters of a function or a method are documented in the Doxygen comment,
+their description is copied into the generated output using
+<a href="http://sphinx-doc.org/">Sphinx </a> documentation conventions. For example
+</p>
+<div class="code"><pre>
+/**
+ Set a breakpoint at the given location.
+
+ @param filename The full path to the file.
+ @param line_number The line number in the file.
+ */
+bool SetBreakpoint(const char* filename, int line_number);
+</pre></div>
+
+<p>
+would be translated to
+</p>
+
+<div class="targetlang"><pre>
+def SetBreakpoint(filename, line_number):
+ r"""
+ Set a breakpoint at the given location.
+
+ :type filename: string
+ :param filename: The full path to the file.
+ :type line_number: int
+ :param line_number: The line number in the file.
+ """
+</pre></div>
+<p>
+The types used for the parameter documentation come from the "doctype" typemap which
+is defined for all the primitive types and a few others (e.g. <tt>std::string</tt> and
+<tt>shared_ptr&lt;T&gt;</tt>) but for non-primitive types is taken to be just the C++
+name of the type with namespace scope delimiters (<tt>::</tt>) replaced with a dot. To
+change this, you can define your own typemaps for the custom types, e.g:
+</p>
+<div class="code"><pre>
+%typemap(doctype) MyDate "datetime.date";
+</pre></div>
+
+<p>
+Currently Doxygen comments assigned to global variables and static member variables
+are not present in generated code, so they have no comment translated for them.
+</p>
+
+<p>
+ <b>Whitespace and tables</b>
+ Whitespace is preserved when translating comments, so it makes
+ sense to have Doxygen comments formatted in a readable way. This
+ includes tables, where tags &lt;th&gt;, &lt;td&gt; and &lt;/tr&gt;are translated
+ to '|'. The line after line with &lt;th&gt; tags contains dashes.
+ If we take care about whitespace, comments in Python are much more
+ readable. Example:
+
+<div class="code"><pre>
+/**
+ * &lt;table border = '1'&gt;
+ * &lt;caption&gt;Animals&lt;/caption&gt;
+ * &lt;tr&gt;&lt;th&gt; Column 1 &lt;/th&gt;&lt;th&gt; Column 2 &lt;/th&gt;&lt;/tr&gt;
+ * &lt;tr&gt;&lt;td&gt; cow &lt;/td&gt;&lt;td&gt; dog &lt;/td&gt;&lt;/tr&gt;
+ * &lt;tr&gt;&lt;td&gt; cat &lt;/td&gt;&lt;td&gt; mouse &lt;/td&gt;&lt;/tr&gt;
+ * &lt;tr&gt;&lt;td&gt; horse &lt;/td&gt;&lt;td&gt; parrot &lt;/td&gt;&lt;/tr&gt;
+ * &lt;/table&gt;
+ */
+</pre></div>
+<p>
+translates to Python as:
+</p>
+<div class="diagram"><pre>
+ Animals
+ | Column 1 | Column 2 |
+ -----------------------
+ | cow | dog |
+ | cat | mouse |
+ | horse | parrot |
+</pre></div>
+
+<p>
+ <b>Overloaded functions</b>
+Since all the overloaded functions in c++ are wrapped into one Python
+function, Pydoc translator will combine every comment of every
+overloaded function and put it into the comment for the one wrapper function.
+</p>
+<p>
+If you intend to use resulting generated Python file with the Doxygen docs
+generator, rather than Pydoc, you may want to turn off translation
+completely (doxygen:notranslate feature). Then SWIG will just copy
+the comments to the proxy file and reformat them if needed, but all
+the comment content will be left as is. As Doxygen doesn't support
+special commands in Python comments
+(see <a href="http://www.doxygen.nl/manual/docblocks.html#pythonblocks">Doxygen
+docs</a>), you may want to use some tool like doxypy
+(<a href="https://pypi.org/project/doxypy/">doxypy</a>)
+to do the work.
+</p>
+
+<H3><a name="Doxygen_pydoc_tags">17.4.2 Pydoc translator</a></H3>
+
+
+<p>
+Here is the list of all Doxygen tags and the description of how they are translated to Pydoc
+</p>
+<div class="diagram">
+<table border="0" summary="Python Doxygen tags">
+<tr>
+ <th align="left">Doxygen tags</th>
+</tr>
+<tr>
+<td>\a</td>
+<td>wrapped with '_'</td>
+</tr>
+<tr>
+<td>\arg</td>
+<td>prepended with ' --'</td>
+</tr>
+<tr>
+<td>\author</td>
+<td>prints 'Author:'</td>
+</tr>
+<tr>
+<td>\authors</td>
+<td>prints 'Author:'</td>
+</tr>
+<tr>
+<td>\b</td>
+<td>wrapped with '__'</td>
+</tr>
+<tr>
+<td>\cite</td>
+<td>wrapped with single quotes</td>
+</tr>
+<tr>
+<td>\cond</td>
+<td>translated to 'Conditional comment: &lt;condition&gt;'</td>
+</tr>
+<tr>
+<td>\copyright</td>
+<td>prints 'Copyright:'</td>
+</tr>
+<tr>
+<td>\deprecated</td>
+<td>prints 'Deprecated:'</td>
+</tr>
+<tr>
+<td>\e</td>
+<td>wrapped with '_'</td>
+</tr>
+<tr>
+<td>\else</td>
+<td>replaced with '}Else:{'</td>
+</tr>
+<tr>
+<td>\elseif</td>
+<td>replaced with '}Else if: &lt;condition&gt;{'</td>
+</tr>
+<tr>
+<td>\em</td>
+<td>wrapped with '_'</td>
+</tr>
+<tr>
+<td>\endcond</td>
+<td>replaced with 'End of conditional comment.'</td>
+</tr>
+<tr>
+<td>\endif</td>
+<td>replaced with '}'</td>
+</tr>
+<tr>
+<td>\exception</td>
+<td>replaced with 'Throws:'</td>
+</tr>
+<tr>
+<td>\if</td>
+<td>replaced with 'If: &lt;condition&gt; {'</td>
+</tr>
+<tr>
+<td>\ifnot</td>
+<td>replaced with 'If not: &lt;condition&gt; {'</td>
+</tr>
+<tr>
+<td>\li</td>
+<td>prepended with ' --'</td>
+</tr>
+<tr>
+<td>\n</td>
+<td>replaced with new line char</td>
+</tr>
+<tr>
+<td>\note</td>
+<td>replaced with 'Note:'</td>
+</tr>
+<tr>
+<td>\overload</td>
+<td>prints 'This is an overloaded ...' according to Doxygen docs</td>
+</tr>
+<tr>
+<td>\par</td>
+<td>replaced with 'Title: ...'</td>
+</tr>
+<tr>
+<td>\param</td>
+<td>translated to 'Arguments:\n param(type) --description'</td>
+</tr>
+<tr>
+<td>\remark</td>
+<td>replaced with 'Remarks:'</td>
+</tr>
+<tr>
+<td>\remarks</td>
+<td>replaced with 'Remarks:'</td>
+</tr>
+<tr>
+<td>\result</td>
+<td>replaced with 'Result:'</td>
+</tr>
+<tr>
+<td>\return</td>
+<td>replaced with 'Result:'</td>
+</tr>
+<tr>
+<td>\returns</td>
+<td>replaced with 'Result:'</td>
+</tr>
+<tr>
+<td>\sa</td>
+<td>replaced with 'See also:'</td>
+</tr>
+<tr>
+<td>\see</td>
+<td>replaced with 'See also:'</td>
+</tr>
+<tr>
+<td>\since</td>
+<td>replaced with 'Since:'</td>
+</tr>
+<tr>
+<td>\throw</td>
+<td>replaced with 'Throws:'</td>
+</tr>
+<tr>
+<td>\throws</td>
+<td>replaced wih 'Throws:'</td>
+</tr>
+<tr>
+<td>\todo</td>
+<td>replaced with 'TODO:'</td>
+</tr>
+<tr>
+<td>\tparam</td>
+<td>translated to 'Arguments:\n param(type) --description'</td>
+</tr>
+<tr>
+<td>\version</td>
+<td>replaced with 'Version:'</td>
+</tr>
+<tr>
+<td>\warning</td>
+<td>translated to 'Warning:'</td>
+</tr>
+<tr>
+<td>\$</td>
+<td>prints $ char</td>
+</tr>
+<tr>
+<td>\@</td>
+<td>prints @ char</td>
+</tr>
+<tr>
+<td>\\</td>
+<td>prints \ char</td>
+</tr>
+<tr>
+<td>\&amp;</td>
+<td>prints &amp; char</td>
+</tr>
+<tr>
+<td>\~</td>
+<td>prints ~ char</td>
+</tr>
+<tr>
+<td>\&lt;</td>
+<td>prints &lt; char</td>
+</tr>
+<tr>
+<td>\&gt;</td>
+<td>prints &gt; char</td>
+</tr>
+<tr>
+<td>\#</td>
+<td>prints # char</td>
+</tr>
+<tr>
+<td>\%</td>
+<td>prints % char</td>
+</tr>
+<tr>
+<td>\&quot;</td>
+<td>prints &quot; char</td>
+</tr>
+<tr>
+<td>\.</td>
+<td>prints . character</td>
+</tr>
+<tr>
+<td>\::</td>
+<td>prints ::</td>
+</tr>
+</table>
+</div>
+
+<H3><a name="Doxygen_python_unsupported_tags">17.4.3 Unsupported tags</a></H3>
+
+
+<p>
+Doxygen has a wealth of tags such as @latexonly that have no
+equivalent in Pydoc. As a result several tags that have no
+translation (or particular use, such as some linking and section tags)
+are suppressed with their content just printed out (if it has any
+sense, typically text content).
+Here is the list of these tags:
+</p>
+<div class="diagram">
+<table border="0" summary="Unsupported Python Doxygen Tags">
+<tr>
+ <th align="left">Unsupported Doxygen tags</th>
+</tr>
+<tr>
+<td>\addindex</td>
+<td>\addtogroup</td>
+<td>\anchor</td>
+<td>\attention</td>
+</tr>
+<tr>
+<td>\brief</td>
+<td>\bug</td>
+<td>\callgraph</td>
+<td>\callergraph</td>
+</tr>
+<tr>
+<td>\class</td>
+<td>\copybrief</td>
+<td>\copydetails</td>
+<td>\copydoc</td>
+</tr>
+<tr>
+<td>\date</td>
+<td>\def</td>
+<td>\defgroup</td>
+<td>\details</td>
+</tr>
+<tr>
+<td>\dir</td>
+<td>\dontinclude</td>
+<td>\dot</td>
+<td>\dotfile</td>
+</tr>
+<tr>
+<td>\code</td>
+<td>\endcode</td>
+<td>\endverbatim</td>
+<td>\endlink</td>
+</tr>
+<tr>
+<td>\enddot</td>
+<td>\endhtmlonly</td>
+<td>\endinternal</td>
+<td>\endlatexonly</td>
+</tr>
+<tr>
+<td>\endmanonly</td>
+<td>\endmsc</td>
+<td>\endrtfonly</td>
+<td>\endxmlonly</td>
+</tr>
+<tr>
+<td>\enum</td>
+<td>\example</td>
+<td>\extends</td>
+<td>\f$</td>
+</tr>
+<tr>
+<td>\f[</td>
+<td>\f]</td>
+<td>\f{</td>
+<td>\f}</td>
+</tr>
+<tr>
+<td>\file</td>
+<td>\fn</td>
+<td>\headerfile</td>
+<td>\hideinitializer</td>
+</tr>
+<tr>
+<td>\htmlinclude</td>
+<td>\htmlonly</td>
+<td>\implements</td>
+<td>\include</td>
+</tr>
+<tr>
+<td>\image</td>
+<td>\link</td>
+<td>\verbatim</td>
+<td>\p</td>
+</tr>
+<tr>
+<td>\includelineno</td>
+<td>\ingroup</td>
+<td>\internal</td>
+<td>\invariant</td>
+</tr>
+<tr>
+<td>\interface</td>
+<td>\latexonly</td>
+<td>\line</td>
+<td>\mainpage</td>
+</tr>
+<tr>
+<td>\manonly</td>
+<td>\memberof</td>
+<td>\msc</td>
+<td>\mscfile</td>
+</tr>
+<tr>
+<td>\name</td>
+<td>\namespace</td>
+<td>\nosubgrouping</td>
+<td>\package</td>
+</tr>
+<tr>
+<td>\page</td>
+<td>\paragraph</td>
+<td>\post</td>
+<td>\pre</td>
+</tr>
+<tr>
+<td>\private</td>
+<td>\privatesection</td>
+<td>\property</td>
+<td>\protected</td>
+</tr>
+<tr>
+<td>\protectedsection</td>
+<td>\protocol</td>
+<td>\public</td>
+<td>\publicsection</td>
+</tr>
+<tr>
+<td>\ref</td>
+<td>\related</td>
+<td>\relates</td>
+<td>\relatedalso</td>
+</tr>
+<tr>
+<td>\relatesalso</td>
+<td>\retval</td>
+<td>\rtfonly</td>
+<td>\section</td>
+</tr>
+<tr>
+<td>\short</td>
+<td>\showinitializer</td>
+<td>\skip</td>
+<td>\skipline</td>
+</tr>
+<tr>
+<td>\snippet</td>
+<td>\struct</td>
+<td>\subpage</td>
+<td>\subsection</td>
+</tr>
+<tr>
+<td>\subsubsection</td>
+<td>\tableofcontents</td>
+<td>\test</td>
+<td>\typedef</td>
+</tr>
+<tr>
+<td>\union</td>
+<td>\until</td>
+<td>\var</td>
+<td>\verbinclude</td>
+</tr>
+<tr>
+<td>\weakgroup</td>
+<td>\xmlonly</td>
+<td>\xrefitem</td>
+<td>\category</td>
+</tr>
+<tr>
+<td>\c</td>
+</tr>
+</table>
+</div>
+
+<H3><a name="Doxygen_python_further_details">17.4.4 Further details</a></H3>
+
+
+<p>
+TO BE ADDED.
+</p>
+
+<H2><a name="Doxygen_troubleshooting">17.5 Troubleshooting</a></H2>
+
+
+<p>
+When running SWIG with command line option <tt>-doxygen</tt>, it may happen
+that SWIG will fail to parse the code, which is valid C++ code and
+is parsed without problems without the option. The problem is,
+that Doxygen comments are not tokens (the C/C++ compiler actually never
+sees them) and that they can appear anywhere in the code. That's why it is
+practically impossible to handle all corner cases with the parser.
+However, these problems can usually be avoided by minor changes in the
+code or comment. Known problems and solutions are shown in this section.
+</p>
+
+
+<p>
+Recommended approach is to first run SWIG without command line
+option <tt>-doxygen</tt>. When it successfully processes the code,
+include the option and fix problems with Doxygen comments.
+</p>
+
+
+<H3><a name="troubleshooting_ifndef">17.5.1 Problem with conditional compilation</a></H3>
+
+
+<p>
+ Inserting a conditional compilation preprocessor directive between a
+ Doxygen comment and a commented item may break parsing:
+</p>
+
+
+<div class="code"><pre>
+class A {
+ /**
+ * Some func.
+ */
+ <font color='#ff0000'>#ifndef SWIG</font>
+ void myfunc()
+ {
+ }
+ #endif
+};
+</pre></div>
+
+<p>
+ The solution is to move the directive above the comment:
+</p>
+
+<div class="code"><pre>
+class A {
+ <font color='#00d000'>#ifndef SWIG</font>
+ /**
+ * Some func.
+ */
+ void myfunc()
+ {
+ }
+ #endif
+};
+</pre></div>
+
+
+<H2><a name="Doxygen_developer_details">17.6 Developer information</a></H2>
+
+
+<p>
+This section contains information for developers enhancing the Doxygen translator.
+</p>
+
+<H3><a name="Doxygen_translator_design">17.6.1 Doxygen translator design</a></H3>
+
+
+<p>
+If this functionality is turned on, SWIG places all comments found
+into the SWIG parse tree. Nodes contain an additional attribute
+called <tt>doxygen</tt> when a comment is present. Individual nodes
+containing Doxygen with Structural Indicators, such as @file, as their
+first command, are also present in the parse tree. These individual
+"blobs" of Doxygen such as :
+</p>
+<div class="code"><pre>
+/*! This is describing function Foo
+ \param x some random variable
+ \author Bob
+ \return Foo
+ */
+</pre></div>
+
+<p>
+are passed on individually to the Doxygen Translator module. This
+module builds its own private parse tree and hands it to a separate
+class for translation into the target documentation language. For
+example, <tt>JavaDocConverter</tt> is the Javadoc module class.
+</p>
+
+<H3><a name="Doxygen_debugging_commands">17.6.2 Debugging the Doxygen parser and translator</a></H3>
+
+
+<p>
+There are two handy command line options, that enable lots of
+detailed debug information printing.
+</p>
+
+<div class="shell"><pre>
+ -debug-doxygen-parser - Display Doxygen parser module debugging information
+ -debug-doxygen-translator - Display Doxygen translator module debugging information
+</pre></div>
+
+<H3><a name="Doxygen_tests">17.6.3 Tests</a></H3>
+
+
+<p>
+Doxygen tests have been added to the regular SWIG test-suite.
+There are a number of tests beginning <tt>doxygen_</tt> in the Examples/test-suite sub-directory.
+</p>
+
+<p>
+Like any other SWIG test case, the tests are included in Examples/test-suite/common.mk and can be tested with
+commands like <tt>make check-test-suite</tt> or <tt>make check-python-test-suite</tt>.
+To run them individually, type
+<tt>make -s &lt;testname&gt;.cpptest</tt> in the language-specific sub-directory in
+<tt>Examples/test-suite</tt> directory. For example:
+</p>
+
+<div class="shell"><pre>
+ Examples/test-suite/java $ make -s doxygen_parsing.cpptest
+</pre></div>
+
+<p>
+If the test fails, both expected and translated comments are printed to
+std out, but also written to files <i>expected.txt</i>
+and <i>got.txt</i>. Since it is often difficult to find a single
+character difference in several lines of text, we can use some diff
+tool, for example:
+</p>
+
+<div class="shell"><pre>
+ Examples/test-suite/java $ kdiff3 expected.txt got.txt
+</pre></div>
+
+
+<p>
+Runtime tests in Java are implemented using Javadoc doclets. To make that work, you
+should have tools.jar from the JDK in your classpath. Or you should have JAVA_HOME
+environment variable defined and pointing to the JDK location.
+</p>
+<p>
+The Java's comment parsing code (the testing part) is located in commentParser.java.
+It checks the generated code. It is possible
+to run this file as a stand-alone program, with <tt>java commentParser &lt;some java package&gt;</tt>,
+and it will print the list of comments found in the specified directory (in the format it has used
+in the runtime tests). So, when you want to create a new Doxygen test case,
+just copy an existing one and replace the actual comment content (section of entries in
+form 'wantedComments.put(...)' with the output of the above command.
+</p>
+<p>
+Runtime tests in Python are just plain string comparisons of the __doc__
+properties.
+</p>
+
+<H2><a name="Doxygen_language_extension">17.7 Extending to other languages</a></H2>
+
+
+<p>
+In general, an extension to another language requires a fairly deep understanding of the target language module, such as Modules/python.cxx for Python.
+Searching for "doxygen" in the java.cxx module can give you a good idea of the process for placing documentation comments into the correct areas.
+The basic gist is that anywhere a comment may reside on a node, there needs to be a catch for it in front of where that function, class, or other object is written out to a target language file.
+The other half of extension is building a target documentation language comment generator that handles one blob at a time.
+However, this is relatively simple and nowhere near as complex as the wrapper generating modules in SWIG.
+See Source/Doxygen/javadoc.cxx for a good example.
+The target language module passes the Doxygen Translator the blob to translate, and receives back the translated text.
+</p>
+<p>
+<b> What is given to the Doxygen Translator</b>
+</p>
+<div class="code"><pre>
+/*! This is describing function Foo
+ \param x some random variable
+ \author Bob
+ \return Foo
+ */
+</pre></div>
+<p>
+<b> What is received back by java.cxx </b>
+</p>
+<div class="targetlang"><pre>
+/** This is describing function Foo
+ *
+ * @param x some random variable
+ * @author Bob
+ * @return Foo
+ */
+</pre></div>
+<p> Development of the comment translator itself is simplified by the fact that the Doxygen Translator module can easily include a <tt>main</tt> function and thus be developed, compiled, and tested independently of SWIG.
+</p>
+
+</body>
+</html>
diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html
index 80fe77d4d..5a640fbdc 100644
--- a/Doc/Manual/Extending.html
+++ b/Doc/Manual/Extending.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Extending">41 Extending SWIG to support new languages</a></H1>
+<H1><a name="Extending">39 Extending SWIG to support new languages</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -64,8 +64,13 @@
<li><a href="#Extending_running_test_suite">Running the test-suite</a>
</ul>
<li><a href="#Extending_nn43">Documentation</a>
-<li><a href="#Extending_prerequisites">Prerequisites for adding a new language module to the SWIG distribution</a>
<li><a href="#Extending_coding_style_guidelines">Coding style guidelines</a>
+<li><a href="#Extending_language_status">Target language status</a>
+<ul>
+<li><a href="#Extending_supported_status">Supported status</a>
+<li><a href="#Extending_experimental_status">Experimental status</a>
+</ul>
+<li><a href="#Extending_prerequisites">Prerequisites for adding a new language module to the SWIG distribution</a>
</ul>
<li><a href="#Extending_debugging_options">Debugging Options</a>
<li><a href="#Extending_nn46">Guide to parse tree nodes</a>
@@ -76,7 +81,7 @@
-<H2><a name="Extending_nn2">41.1 Introduction</a></H2>
+<H2><a name="Extending_nn2">39.1 Introduction</a></H2>
<p>
@@ -92,7 +97,7 @@ Also, this chapter is not meant to be a hand-holding tutorial. As a starting po
you should probably look at one of SWIG's existing modules.
</p>
-<H2><a name="Extending_nn3">41.2 Prerequisites</a></H2>
+<H2><a name="Extending_nn3">39.2 Prerequisites</a></H2>
<p>
@@ -122,7 +127,7 @@ obvious, but almost all SWIG directives as well as the low-level generation of
wrapper code are driven by C++ datatypes.
</p>
-<H2><a name="Extending_nn4">41.3 The Big Picture</a></H2>
+<H2><a name="Extending_nn4">39.3 The Big Picture</a></H2>
<p>
@@ -159,7 +164,7 @@ role in making the system work. For example, both typemaps and declaration anno
based on pattern matching and interact heavily with the underlying type system.
</p>
-<H2><a name="Extending_nn5">41.4 Execution Model</a></H2>
+<H2><a name="Extending_nn5">39.4 Execution Model</a></H2>
<p>
@@ -204,7 +209,7 @@ latter stage of compilation.
The next few sections briefly describe some of these stages.
</p>
-<H3><a name="Extending_nn6">41.4.1 Preprocessing</a></H3>
+<H3><a name="Extending_nn6">39.4.1 Preprocessing</a></H3>
<p>
@@ -278,14 +283,14 @@ or <tt>perl5.swg</tt>.
</p>
<p>
-As a debugging aide, the text that SWIG feeds to its C++ parser can be
+As a debugging aid, the text that SWIG feeds to its C++ parser can be
obtained by running <tt>swig -E interface.i</tt>. This output
probably isn't too useful in general, but it will show how macros have
been expanded as well as everything else that goes into the low-level
construction of the wrapper code.
</p>
-<H3><a name="Extending_nn7">41.4.2 Parsing</a></H3>
+<H3><a name="Extending_nn7">39.4.2 Parsing</a></H3>
<p>
@@ -386,7 +391,7 @@ returning a <tt>foo</tt> and taking types <tt>a</tt> and <tt>b</tt> as
arguments).
</p>
-<H3><a name="Extending_nn8">41.4.3 Parse Trees</a></H3>
+<H3><a name="Extending_nn8">39.4.3 Parse Trees</a></H3>
<p>
@@ -641,7 +646,7 @@ $ swig -c++ -python -debug-module 4 example.i
</pre>
</div>
-<H3><a name="Extending_nn9">41.4.4 Attribute namespaces</a></H3>
+<H3><a name="Extending_nn9">39.4.4 Attribute namespaces</a></H3>
<p>
@@ -660,7 +665,7 @@ that matches the name of the target language. For example, <tt>python:foo</tt>
<tt>perl:foo</tt>.
</p>
-<H3><a name="Extending_nn10">41.4.5 Symbol Tables</a></H3>
+<H3><a name="Extending_nn10">39.4.5 Symbol Tables</a></H3>
<p>
@@ -729,7 +734,7 @@ For instance, the following example uses <tt>%rename</tt> in reverse to generate
<div class="code">
<pre>
%rename(foo) foo_i(int);
-%rename(foo) foo_d(double;
+%rename(foo) foo_d(double);
void foo_i(int);
void foo_d(double);
@@ -751,7 +756,7 @@ example.i:5. Previous declaration is foo_i(int )
</pre>
</div>
-<H3><a name="Extending_nn11">41.4.6 The %feature directive</a></H3>
+<H3><a name="Extending_nn11">39.4.6 The %feature directive</a></H3>
<p>
@@ -807,7 +812,7 @@ For example, the exception code above is simply
stored without any modifications.
</p>
-<H3><a name="Extending_nn12">41.4.7 Code Generation</a></H3>
+<H3><a name="Extending_nn12">39.4.7 Code Generation</a></H3>
<p>
@@ -929,7 +934,7 @@ public :
The role of these functions is described shortly.
</p>
-<H3><a name="Extending_nn13">41.4.8 SWIG and XML</a></H3>
+<H3><a name="Extending_nn13">39.4.8 SWIG and XML</a></H3>
<p>
@@ -942,7 +947,7 @@ internal data structures, it may be useful to keep XML in the back of
your mind as a model.
</p>
-<H2><a name="Extending_nn14">41.5 Primitive Data Structures</a></H2>
+<H2><a name="Extending_nn14">39.5 Primitive Data Structures</a></H2>
<p>
@@ -988,7 +993,7 @@ typedef Hash Typetab;
</pre>
</div>
-<H3><a name="Extending_nn15">41.5.1 Strings</a></H3>
+<H3><a name="Extending_nn15">39.5.1 Strings</a></H3>
<p>
@@ -1129,7 +1134,7 @@ Returns the number of replacements made (if any).
</div>
-<H3><a name="Extending_nn16">41.5.2 Hashes</a></H3>
+<H3><a name="Extending_nn16">39.5.2 Hashes</a></H3>
<p>
@@ -1206,7 +1211,7 @@ Returns the list of hash table keys.
</div>
-<H3><a name="Extending_nn17">41.5.3 Lists</a></H3>
+<H3><a name="Extending_nn17">39.5.3 Lists</a></H3>
<p>
@@ -1295,7 +1300,7 @@ If <tt>t</tt> is not a standard object, it is assumed to be a <tt>char *</tt>
and is used to create a String object.
</div>
-<H3><a name="Extending_nn18">41.5.4 Common operations</a></H3>
+<H3><a name="Extending_nn18">39.5.4 Common operations</a></H3>
The following operations are applicable to all datatypes.
@@ -1350,7 +1355,7 @@ objects and report errors.
Gets the line number associated with <tt>x</tt>.
</div>
-<H3><a name="Extending_nn19">41.5.5 Iterating over Lists and Hashes</a></H3>
+<H3><a name="Extending_nn19">39.5.5 Iterating over Lists and Hashes</a></H3>
To iterate over the elements of a list or a hash table, the following functions are used:
@@ -1395,7 +1400,7 @@ for (j = First(j); j.item; j= Next(j)) {
</div>
-<H3><a name="Extending_nn20">41.5.6 I/O</a></H3>
+<H3><a name="Extending_nn20">39.5.6 I/O</a></H3>
Special I/O functions are used for all internal I/O. These operations
@@ -1529,7 +1534,7 @@ Printf(f, "%s\n", s);
Similarly, the preprocessor and parser all operate on string-files.
</p>
-<H2><a name="Extending_nn21">41.6 Navigating and manipulating parse trees</a></H2>
+<H2><a name="Extending_nn21">39.6 Navigating and manipulating parse trees</a></H2>
Parse trees are built as collections of hash tables. Each node is a hash table in which
@@ -1576,7 +1581,7 @@ return the node for the first class member.
<div class="indent">
Returns the last child node. You might use this if you wanted to append a new
-node to the of a class.
+node to the children of a class.
</div>
<p>
@@ -1663,7 +1668,7 @@ Deletes a node from the parse tree. Deletion reconnects siblings and properly u
the parent so that sibling nodes are unaffected.
</div>
-<H2><a name="Extending_nn22">41.7 Working with attributes</a></H2>
+<H2><a name="Extending_nn22">39.7 Working with attributes</a></H2>
<p>
@@ -1780,7 +1785,7 @@ the attribute is optional. <tt>Swig_restore()</tt> must always be called after
function.
</div>
-<H2><a name="Extending_nn23">41.8 Type system</a></H2>
+<H2><a name="Extending_nn23">39.8 Type system</a></H2>
<p>
@@ -1789,7 +1794,7 @@ pointers, references, and pointers to members. A detailed discussion of
type theory is impossible here. However, let's cover the highlights.
</p>
-<H3><a name="Extending_nn24">41.8.1 String encoding of types</a></H3>
+<H3><a name="Extending_nn24">39.8.1 String encoding of types</a></H3>
<p>
@@ -1890,7 +1895,7 @@ make the final type, the two parts are just joined together using
string concatenation.
</p>
-<H3><a name="Extending_nn25">41.8.2 Type construction</a></H3>
+<H3><a name="Extending_nn25">39.8.2 Type construction</a></H3>
<p>
@@ -2059,7 +2064,7 @@ Returns the prefix of a type. For example, if <tt>ty</tt> is
<tt>ty</tt> is unmodified.
</div>
-<H3><a name="Extending_nn26">41.8.3 Type tests</a></H3>
+<H3><a name="Extending_nn26">39.8.3 Type tests</a></H3>
<p>
@@ -2146,7 +2151,7 @@ Checks if <tt>ty</tt> is a varargs type.
Checks if <tt>ty</tt> is a templatized type.
</div>
-<H3><a name="Extending_nn27">41.8.4 Typedef and inheritance</a></H3>
+<H3><a name="Extending_nn27">39.8.4 Typedef and inheritance</a></H3>
<p>
@@ -2248,7 +2253,7 @@ Fully reduces <tt>ty</tt> according to typedef rules. Resulting datatype
will consist only of primitive typenames.
</div>
-<H3><a name="Extending_nn28">41.8.5 Lvalues</a></H3>
+<H3><a name="Extending_nn28">39.8.5 Lvalues</a></H3>
<p>
@@ -2285,7 +2290,7 @@ Literal y; // type = 'Literal', ltype='p.char'
</pre>
</div>
-<H3><a name="Extending_nn29">41.8.6 Output functions</a></H3>
+<H3><a name="Extending_nn29">39.8.6 Output functions</a></H3>
<p>
@@ -2347,7 +2352,7 @@ SWIG, but is most commonly associated with type-descriptor objects
that appear in wrappers (e.g., <tt>SWIGTYPE_p_double</tt>).
</div>
-<H2><a name="Extending_nn30">41.9 Parameters</a></H2>
+<H2><a name="Extending_nn30">39.9 Parameters</a></H2>
<p>
@@ -2446,7 +2451,7 @@ included. Used to emit prototypes.
Returns the number of required (non-optional) arguments in <tt>p</tt>.
</div>
-<H2><a name="Extending_nn31">41.10 Writing a Language Module</a></H2>
+<H2><a name="Extending_nn31">39.10 Writing a Language Module</a></H2>
<p>
@@ -2461,7 +2466,7 @@ describes the creation of a minimal Python module. You should be able to extra
this to other languages.
</p>
-<H3><a name="Extending_nn32">41.10.1 Execution model</a></H3>
+<H3><a name="Extending_nn32">39.10.1 Execution model</a></H3>
<p>
@@ -2471,7 +2476,7 @@ the parsing of command line options, all aspects of code generation are controll
different methods of the <tt>Language</tt> that must be defined by your module.
</p>
-<H3><a name="Extending_starting_out">41.10.2 Starting out</a></H3>
+<H3><a name="Extending_starting_out">39.10.2 Starting out</a></H3>
<p>
@@ -2579,7 +2584,7 @@ that activates your module. For example, <tt>swig -python foo.i</tt>. The
messages from your new module should appear.
</p>
-<H3><a name="Extending_nn34">41.10.3 Command line options</a></H3>
+<H3><a name="Extending_nn34">39.10.3 Command line options</a></H3>
<p>
@@ -2592,36 +2597,36 @@ command line options, simply use code similar to this:
<pre>
void Language::main(int argc, char *argv[]) {
for (int i = 1; i &lt; argc; i++) {
- if (argv[i]) {
- if (strcmp(argv[i], "-interface") == 0) {
- if (argv[i+1]) {
- interface = NewString(argv[i+1]);
- Swig_mark_arg(i);
- Swig_mark_arg(i+1);
- i++;
- } else {
- Swig_arg_error();
- }
- } else if (strcmp(argv[i], "-globals") == 0) {
- if (argv[i+1]) {
- global_name = NewString(argv[i+1]);
- Swig_mark_arg(i);
- Swig_mark_arg(i+1);
- i++;
- } else {
- Swig_arg_error();
- }
- } else if ((strcmp(argv[i], "-proxy") == 0)) {
- proxy_flag = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-keyword") == 0) {
- use_kw = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-help") == 0) {
- fputs(usage, stderr);
- }
- ...
+ if (argv[i]) {
+ if (strcmp(argv[i], "-interface") == 0) {
+ if (argv[i+1]) {
+ interface = NewString(argv[i+1]);
+ Swig_mark_arg(i);
+ Swig_mark_arg(i+1);
+ i++;
+ } else {
+ Swig_arg_error();
+ }
+ } else if (strcmp(argv[i], "-globals") == 0) {
+ if (argv[i+1]) {
+ global_name = NewString(argv[i+1]);
+ Swig_mark_arg(i);
+ Swig_mark_arg(i+1);
+ i++;
+ } else {
+ Swig_arg_error();
+ }
+ } else if ((strcmp(argv[i], "-proxy") == 0)) {
+ proxy_flag = 1;
+ Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-keyword") == 0) {
+ use_kw = 1;
+ Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-help") == 0) {
+ fputs(usage, stderr);
}
+ ...
+ }
}
}
</pre>
@@ -2638,7 +2643,7 @@ to mark the option as valid. If you forget to do this, SWIG will terminate wit
unrecognized command line option error.
</p>
-<H3><a name="Extending_nn35">41.10.4 Configuration and preprocessing</a></H3>
+<H3><a name="Extending_nn35">39.10.4 Configuration and preprocessing</a></H3>
<p>
@@ -2687,7 +2692,7 @@ an implementation file <tt>python.cxx</tt> and a configuration file
<tt>python.swg</tt>.
</p>
-<H3><a name="Extending_nn36">41.10.5 Entry point to code generation</a></H3>
+<H3><a name="Extending_nn36">39.10.5 Entry point to code generation</a></H3>
<p>
@@ -2745,7 +2750,7 @@ int Python::top(Node *n) {
</pre>
</div>
-<H3><a name="Extending_nn37">41.10.6 Module I/O and wrapper skeleton</a></H3>
+<H3><a name="Extending_nn37">39.10.6 Module I/O and wrapper skeleton</a></H3>
<!-- please report bugs in this section to mgossage -->
@@ -2893,7 +2898,7 @@ functionWrapper : void Shape_y_set(Shape *self, double y)
</pre>
</div>
-<H3><a name="Extending_nn38">41.10.7 Low-level code generators</a></H3>
+<H3><a name="Extending_nn38">39.10.7 Low-level code generators</a></H3>
<!-- please report bugs in this section to mgossage -->
@@ -3026,7 +3031,7 @@ virtual int functionWrapper(Node *n) {
/* Close the function(error) */
Printv(wrapper-&gt;code, "return ERROR;\n", "}\n", NIL);
- /* final substititions if applicable */
+ /* final substitutions if applicable */
...
/* Dump the function out */
@@ -3047,7 +3052,7 @@ but without the typemaps, there is still work to do.
</p>
-<H3><a name="Extending_configuration_files">41.10.8 Configuration files</a></H3>
+<H3><a name="Extending_configuration_files">39.10.8 Configuration files</a></H3>
<!-- please report bugs in this section to ttn -->
@@ -3164,7 +3169,7 @@ these kinds of problems.
</p>
<dt> <b>Examples/Makefile.in</b>
-<dd> Nothing special here; see comments at top the of this file
+<dd> Nothing special here; see comments at the top of this file
and look to the existing languages for examples.
<dt> <b>Examples/qux99/check.list</b>
@@ -3191,7 +3196,7 @@ politely displays the ignoring language message.
</dl>
-<H3><a name="Extending_nn40">41.10.9 Runtime support</a></H3>
+<H3><a name="Extending_nn40">39.10.9 Runtime support</a></H3>
<p>
@@ -3200,7 +3205,7 @@ Discuss the kinds of functions typically needed for SWIG runtime support (e.g.
the SWIG files that implement those functions.
</p>
-<H3><a name="Extending_nn41">41.10.10 Standard library files</a></H3>
+<H3><a name="Extending_nn41">39.10.10 Standard library files</a></H3>
<p>
@@ -3219,7 +3224,7 @@ The following are the minimum that are usually supported:
Please copy these and modify for any new language.
</p>
-<H3><a name="Extending_nn42">41.10.11 User examples</a></H3>
+<H3><a name="Extending_nn42">39.10.11 User examples</a></H3>
<p>
@@ -3248,7 +3253,7 @@ during this process, see the section on <a href="#Extending_configuration_files"
files</a>.
</p>
-<H3><a name="Extending_test_suite">41.10.12 Test driven development and the test-suite</a></H3>
+<H3><a name="Extending_test_suite">39.10.12 Test driven development and the test-suite</a></H3>
<p>
@@ -3307,7 +3312,7 @@ It is therefore essential that the runtime tests are written in a manner that di
but error/exception out with an error message on stderr on failure.
</p>
-<H4><a name="Extending_running_test_suite">41.10.12.1 Running the test-suite</a></H4>
+<H4><a name="Extending_running_test_suite">39.10.12.1 Running the test-suite</a></H4>
<p>
@@ -3499,7 +3504,7 @@ It can be run in the same way as the other language test-suites, replacing [lang
The test cases used and the way it works is described in <tt>Examples/test-suite/errors/Makefile.in</tt>.
</p>
-<H3><a name="Extending_nn43">41.10.13 Documentation</a></H3>
+<H3><a name="Extending_nn43">39.10.13 Documentation</a></H3>
<p>
@@ -3531,27 +3536,172 @@ Some topics that you'll want to be sure to address include:
if available.
</ul>
-<H3><a name="Extending_prerequisites">41.10.14 Prerequisites for adding a new language module to the SWIG distribution</a></H3>
+<H3><a name="Extending_coding_style_guidelines">39.10.14 Coding style guidelines</a></H3>
+
+
+<p>
+The coding guidelines for the C/C++ source code are pretty much K&amp;R C style.
+The style can be inferred from the existing code base and is
+largely dictated by the <tt>indent</tt> code beautifier tool set to K&amp;R style.
+The code can formatted using the make targets in the Source directory.
+Below is an example of how to format the emit.cxx file:
+</p>
+
+<blockquote>
+<pre>
+$ cd Source
+$ make beautify-file INDENTFILE=Modules/emit.cxx
+</pre>
+</blockquote>
+
+<p>
+Of particular note is indentation is set to 2 spaces and a tab is used instead of 8 spaces.
+The generated C/C++ code should also follow this style as close as possible. However, tabs
+should be avoided as unlike the SWIG developers, users will never have consistent tab settings.
+</p>
+
+
+<H3><a name="Extending_language_status">39.10.15 Target language status</a></H3>
+
+
+<p>
+Target languages are given a status of either 'Supported' or 'Experimental' depending on their maturity as broadly outlined in
+the <a href="Introduction.html#Introduction_target_languages">Target language introduction</a>.
+This section provides more details on how this status is given.
+</p>
+
+<H4><a name="Extending_supported_status">39.10.15.1 Supported status</a></H4>
+
+
+<p>
+A target language is given the 'Supported' status when
+</p>
+
+<ul>
+<li>
+ It is in a mature, well functioning state.
+</li>
+<li>
+ It has its own comprehensive chapter in the documentation.
+ The level of documentation should be comprehensive and match the standard of the other mature modules.
+ Python and Java are good references.</li>
+<li>
+ It passes all of the main SWIG test-suite.
+ The main test-suite is defined by the tests in the C_TEST_CASES, CPP_TEST_CASES and MULTI_CPP_TEST_CASES lists in Examples/test-suite/common.mk.
+ The tests in CPP11_TEST_CASES will also be required in the near future.
+</li>
+<li>
+ The test-suite must also include at least twenty wide-ranging runtime tests.
+ The most mature languages have a few hundred runtime tests.
+ Note that porting runtime tests from another language module is a quick and easy way to achieve this.
+</li>
+<li>
+ It supports the vast majority of SWIG features.
+ Some more advanced features, such as, directors, full nested class support and target language namespaces (nspace) may be unimplemented.
+ A few support libraries may be missing, for example, a small number of STL libraries.</li>
+<li>
+ It provides strong backwards compatibility between releases.
+ Each point release must aim to be fully backwards compatible.
+ A point release version is the 3rd version digit, so each of the x.y.* versions should be backwards compatible.
+ Backwards compatibility breakages can occur in a new major or minor version if absolutely necessary and if documented.
+ A major or minor version is the first or second digit in the three digit version.
+</li>
+<li>
+ Fixing unintended regressions in the Supported languages will be given higher priority over experimental languages by the core SWIG developers.
+</li>
+<li>
+ Examples must be available and run successfully.
+</li>
+<li>
+ The examples and test-suite must be fully functioning on the Travis Continuous Integration platform.
+</li>
+</ul>
+
+<H4><a name="Extending_experimental_status">39.10.15.2 Experimental status</a></H4>
<p>
-If you wish for a new language module to be distributed with SWIG,
-which we encourage for all popular languages, there are a few requirements.
-While we appreciate that getting all aspects of a new language working
-won't happen at the outset, there are a set of minimum requirements before
-a module can be committed into the official Github repository for distribution with future
-versions of SWIG. The following are really a summary of this whole section with
-details being outlined earlier on.
+A target language is given the 'Experimental' status when
+</p>
+
+<ul>
+<li>
+ It is of sub-standard quality, failing to meet the above 'Supported' status.
+</li>
+<li>
+ It is somewhere between the mid to mature stage of development.
+</li>
+<li>
+ It is in need of help to finish development.
+</li>
+</ul>
+
+<p>
+Some minimum requirements and notes about languages with the 'Experimental' status:
+</p>
+
+<ul>
+<li>
+ Will at least implement basic functionality - support wrapping C functions and simple C++ classes and templates.
+</li>
+<li>
+ Have its own documentation chapter containing a reasonable level of detail.
+ The documentation must provide enough basic functionality for a user to get started.
+</li>
+<li>
+ Have fully functional examples of basic functionality (the simple and class examples).
+</li>
+<li>
+ The test-suite must be implemented and include a few runtime tests for both C and C++ test cases.
+</li>
+<li>
+ Failing tests must be put into one of the FAILING_CPP_TESTS or FAILING_C_TESTS lists in the test-suite.
+ This will ensure the test-suite can be superficially made to pass by ignoring failing tests.
+ The number of tests in these lists should be no greater than half of the number of tests in the full test-suite.
+</li>
+<li>
+ The examples and test-suite must also be fully functioning on the Travis Continuous Integration platform.
+ However, experimental languages will be set as 'allow_failures'.
+ This means that pull requests and normal development commits will not break the entire Travis build should an experimental language fail.
+</li>
+<li>
+ Any new failed tests will be fixed on a 'best effort' basis by core developers with no promises made.
+</li>
+<li>
+ If a language module has an official maintainer, then the maintainer will be requested to focus on fixing test-suite regressions and commit to migrating the module to become a 'Supported' module.
+</li>
+<li>
+ If a module does not have an official maintainer, then, as maintenance will be on a 'best efforts' basis by the core maintainers, no guarantees will be provided from one release to the next and regressions may creep in.
+</li>
+<li>
+ Experimental target languages will have a (suppressible) warning explaining the Experimental sub-standard status and encourage users to help improve it.
+</li>
+<li>
+ No backwards compatibility is guaranteed as the module is effectively 'in development'.
+ If a language module has an official maintainer, then a backwards compatibility guarantee may be provided at the maintainer's discretion and should be documented as such.
+</li>
+</ul>
+
+<H3><a name="Extending_prerequisites">39.10.16 Prerequisites for adding a new language module to the SWIG distribution</a></H3>
+
+
+<p>
+New target language modules can be included in SWIG and contributions are encouraged for popular languages.
+In order to be considered for inclusion, a language must at a minimum fit the 'Experimental' status described above.
+</p>
+
+<p>
+Below are some practical steps that should help meet these requirements.
</p>
<ol>
<li>
- Demonstrate basic C code working by porting the "simple" example including
- a runtime test, see for example <tt>Examples/python/simple</tt>.
+ The "simple" example needs to be working to demonstrate basic C code wrappers.
+ Port the example from another language, such as from <tt>Examples/python/simple</tt>.
</li>
<li>
- Demonstrate basic C++ code working by porting the "class" example including
- a runtime test, see for example <tt>Examples/python/class</tt>.
+ The "class" example needs to be working to demonstrate basic C++ code wrappers.
+ Port the example from another language, such as from <tt>Examples/python/class</tt>.
</li>
<li>
Modify <tt>configure.ac</tt>, <tt>Makefile.in</tt> and <tt>Examples/Makefile.in</tt> to run
@@ -3560,21 +3710,27 @@ details being outlined earlier on.
skipping the tests and examples for the new language module.
</li>
<li>
- Get the test-suite running for the new language (<tt>make check-[lang]-test-suite</tt>).
+ Copying an existing language module and adapting the source for it is likely to be the most efficient
+ approach to fully developing a new module as a number of corner cases are covered in the existing implementations.
+ The most advanced scripting languages are Python and Ruby.
+ The most advanced compiled target languages are Java and C#.
+ </li>
+ <li>
+ Get the <a href="#Extending_running_test_suite">test-suite</a> running for the new language (<tt>make check-[lang]-test-suite</tt>).
While the test-suite tests many corner cases,
- we'd expect the majority of it to work by compiling the generated code
- correctly as most of the corner cases are covered in the SWIG core. Get
- at least one C and one C++ runtime test running in the test-suite.
+ we'd expect the majority of it to work without much effort once the generated code is compiling
+ correctly for basic functionality as most of the corner cases are covered in the SWIG core. Aim to first get
+ one C and one C++ runtime test running in the test-suite.
+ Adding further runtime tests should be a lot easier afterwards by porting existing runtime tests from another language module.
</li>
<li>
- Provide a chapter in the html documentation on the basics of using
- the language module.
+ The structure and contents of the html documentation chapter can be copied and adapted from one of the other language modules.
</li>
<li>
- Ensure your source code is formatted according to the <a href="#Extending_coding_style_guidelines">coding style guidelines</a>.
+ Source code can be formatted correctly using the info in the <a href="#Extending_coding_style_guidelines">coding style guidelines</a> section.
</li>
<li>
- Finally, email the SWIG developers with a patch and a demonstration of
+ When ready, post a patch on Github, join the swig-devel mailing list and email the SWIG developers with a demonstration of
commitment to maintaining the language module,
certainly in the short term and ideally long term.
</li>
@@ -3582,37 +3738,15 @@ details being outlined earlier on.
<p>
Once accepted into the official Git repository, development efforts should concentrate on
-getting the entire test-suite to work with plenty of runtime tests.
-Runtime tests should be for existing testcases and new test cases
-should be added should there be an area not already covered by
+getting the entire test-suite to work
+in order to migrate the language module to the 'Supported' status.
+Runtime tests should be added for existing testcases and new test cases
+can be added should there be an area not already covered by
the existing tests.
</p>
-<H3><a name="Extending_coding_style_guidelines">41.10.15 Coding style guidelines</a></H3>
-
-
-<p>
-The coding guidelines for the C/C++ source code are pretty much K&amp;R C style.
-The style can be inferred from the existing code base and is
-largely dictated by the <tt>indent</tt> code beautifier tool set to K&amp;R style.
-The code can formatted using the make targets in the Source directory.
-Below is an example of how to format the emit.cxx file:
-</p>
-
-<blockquote>
-<pre>
-$ cd Source
-$ make beautify-file INDENTFILE=Modules/emit.cxx
-</pre>
-</blockquote>
-
-<p>
-Of particular note is indentation is set to 2 spaces and a tab is used instead of 8 spaces.
-The generated C/C++ code should also follow this style as close as possible. However, tabs
-should be avoided as unlike the SWIG developers, users will never have consistent tab settings.
-</p>
-<H2><a name="Extending_debugging_options">41.11 Debugging Options</a></H2>
+<H2><a name="Extending_debugging_options">39.11 Debugging Options</a></H2>
<p>
@@ -3639,7 +3773,7 @@ There are various command line options which can aid debugging a SWIG interface
The complete list of command line options for SWIG are available by running <tt>swig -help</tt>.
</p>
-<H2><a name="Extending_nn46">41.12 Guide to parse tree nodes</a></H2>
+<H2><a name="Extending_nn46">39.12 Guide to parse tree nodes</a></H2>
<p>
@@ -4047,7 +4181,7 @@ extern "X" { ... } declaration.
</pre>
</div>
-<H2><a name="Extending_further_info">41.13 Further Development Information</a></H2>
+<H2><a name="Extending_further_info">39.13 Further Development Information</a></H2>
<p>
diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html
index f25e9850b..c28cc03e1 100644
--- a/Doc/Manual/Go.html
+++ b/Doc/Manual/Go.html
@@ -6,7 +6,7 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF">
-<H1><a name="Go">23 SWIG and Go</a></H1>
+<H1><a name="Go">24 SWIG and Go</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -57,7 +57,7 @@ the Go programming language
see <a href="http://golang.org/">golang.org</a>.
</p>
-<H2><a name="Go_overview">23.1 Overview</a></H2>
+<H2><a name="Go_overview">24.1 Overview</a></H2>
<p>
@@ -86,7 +86,7 @@ type-safe as well. In case of type issues the build will fail and hence SWIG's
are not used.
</p>
-<H2><a name="Go_examples">23.2 Examples</a></H2>
+<H2><a name="Go_examples">24.2 Examples</a></H2>
<p>
@@ -101,7 +101,7 @@ SWIG interface file extension for backwards compatibility with Go 1.
</p>
-<H2><a name="Go_running_swig">23.3 Running SWIG with Go</a></H2>
+<H2><a name="Go_running_swig">24.3 Running SWIG with Go</a></H2>
<p>
@@ -125,16 +125,15 @@ Go distribution. To generate code for gccgo, you should also use the
</p>
<p>
-When using the <tt>-cgo</tt> option, SWIG will generate files that can be used
-directly by <tt>go build</tt>. Starting with the Go 1.5 distribution the
-<tt>-cgo</tt> option has to be given. Put your SWIG interface file in a
-directory under GOPATH/src, and give it a name that does <b>not</b> end in the
-.swig or .swigcxx extension. Typically the SWIG interface file extension is .i
-in this case.
+By default SWIG will generate files that can be used directly
+by <tt>go build</tt>. This requires Go 1.2 or later. Put your SWIG
+interface file in a directory under GOPATH/src, and give it a name
+that does <b>not</b> end in the .swig or .swigcxx extension.
+Typically the SWIG interface file extension is .i in this case.
</p>
<div class="code"><pre>
-% swig -go -cgo example.i
+% swig -go example.i
% go install
</pre></div>
@@ -144,15 +143,16 @@ usual.
</p>
<p>
-To use SWIG without the <tt>-cgo</tt> option, more steps are required. Recall
-that this only works with Go versions before 1.5. When using Go version 1.2 or
-later, or when using gccgo, the code generated by SWIG can be linked directly
-into the Go program. A typical command sequence when using the Go compiler of
-the Go distribution would look like this:
+SWIG can be used without cgo, via the <tt>-no-cgo</tt> option, but
+more steps are required. This only works with Go versions before 1.5.
+When using Go version 1.2 or later, or when using gccgo, the code
+generated by SWIG can be linked directly into the Go program. A
+typical command sequence when using the Go compiler of the Go
+distribution would look like this:
</p>
<div class="code"><pre>
-% swig -go example.i
+% swig -go -no-cgo example.i
% gcc -c code.c # The C library being wrapped.
% gcc -c example_wrap.c
% go tool 6g example.go
@@ -169,7 +169,7 @@ sequence for this approach would look like this:
</p>
<div class="code"><pre>
-% swig -go -use-shlib example.i
+% swig -go -no-cgo -use-shlib example.i
% gcc -c -fpic example.c
% gcc -c -fpic example_wrap.c
% gcc -shared example.o example_wrap.o -o example.so
@@ -181,7 +181,7 @@ sequence for this approach would look like this:
</pre></div>
-<H3><a name="Go_commandline">23.3.1 Go-specific Commandline Options</a></H3>
+<H3><a name="Go_commandline">24.3.1 Go-specific Commandline Options</a></H3>
<p>
@@ -200,10 +200,15 @@ swig -go -help
<tr>
<td>-cgo</td>
-<td>Generate files to be used as input for the Go cgo tool. This
- option is required for Go 1.5 and later, and works for Go 1.2 and
- later. In the future this option will likely become the
- default.</td>
+<td>Generate files to be used as input for the Go cgo tool. This is
+ the default.</td>
+</tr>
+
+<tr>
+<td>-no-cgo</td>
+<td>Generate files that can be used directly, rather than via the Go
+ cgo tool. This option does not work with Go 1.5 or later. It is
+ required for versions of Go before 1.2.</td>
</tr>
<tr>
@@ -261,18 +266,25 @@ swig -go -help
ignored.</td>
</tr>
+<tr>
+<td>-import-prefix &lt;prefix&gt;</td>
+<td>A prefix to add when turning a %import prefix in the SWIG
+ interface file into an import statement in the Go file. For
+ example, with <code>-import-prefix mymodule</code>, a SWIG
+ interface file <code>%import mypackage</code> will become a Go
+ import statement <code>import "mymodule/mypackage"</code>.</td>
</table>
-<H3><a name="Go_outputs">23.3.2 Generated Wrapper Files</a></H3>
+<H3><a name="Go_outputs">24.3.2 Generated Wrapper Files</a></H3>
<p>There are two different approaches to generating wrapper files,
- controlled by SWIG's <tt>-cgo</tt> option. The <tt>-cgo</tt> option
- works with Go version 1.2 or later. It is required when using Go
- version 1.5 or later.</p>
+ controlled by SWIG's <tt>-no-cgo</tt> option. The <tt>-no-cgo</tt>
+ option only works with version of Go before 1.5. It is required
+ when using versions of Go before 1.2.</p>
-<p>With or without the <tt>-cgo</tt> option, SWIG will generate the
+<p>With or without the <tt>-no-cgo</tt> option, SWIG will generate the
following files when generating wrapper code:</p>
<ul>
@@ -296,8 +308,8 @@ or C++ compiler.
</li>
</ul>
-<p>When neither the <tt>-cgo</tt> nor the <tt>-gccgo</tt> option is
- used, SWIG will also generate an additional file:</p>
+<p>When the <tt>-no-cgo</tt> option is used, and the <tt>-gccgo</tt>
+ option is not used, SWIG will also generate an additional file:</p>
<ul>
<li>
@@ -308,7 +320,7 @@ combined with the compiled MODULE.go using go tool pack.
</ul>
-<H2><a name="Go_basic_tour">23.4 A tour of basic C/C++ wrapping</a></H2>
+<H2><a name="Go_basic_tour">24.4 A tour of basic C/C++ wrapping</a></H2>
<p>
@@ -318,7 +330,7 @@ modifications have to occur. This section briefly covers the
essential aspects of this wrapping.
</p>
-<H3><a name="Go_package">23.4.1 Go Package Name</a></H3>
+<H3><a name="Go_package">24.4.1 Go Package Name</a></H3>
<p>
@@ -328,7 +340,7 @@ directive. You may override this by using SWIG's <tt>-package</tt>
command line option.
</p>
-<H3><a name="Go_names">23.4.2 Go Names</a></H3>
+<H3><a name="Go_names">24.4.2 Go Names</a></H3>
<p>
@@ -360,7 +372,7 @@ followed by that name, and the destructor will be
named <tt>Delete</tt> followed by that name.
</p>
-<H3><a name="Go_constants">23.4.3 Go Constants</a></H3>
+<H3><a name="Go_constants">24.4.3 Go Constants</a></H3>
<p>
@@ -368,7 +380,7 @@ C/C++ constants created via <tt>#define</tt> or the <tt>%constant</tt>
directive become Go constants, declared with a <tt>const</tt>
declaration.
-<H3><a name="Go_enumerations">23.4.4 Go Enumerations</a></H3>
+<H3><a name="Go_enumerations">24.4.4 Go Enumerations</a></H3>
<p>
@@ -378,7 +390,7 @@ usual). The values of the enumeration will become variables in Go;
code should avoid modifying those variables.
</p>
-<H3><a name="Go_classes">23.4.5 Go Classes</a></H3>
+<H3><a name="Go_classes">24.4.5 Go Classes</a></H3>
<p>
@@ -456,7 +468,7 @@ returns a go interface. If the returned pointer can be null, you can check
for this by calling the Swigcptr() method.
</p>
-<H4><a name="Go_class_memory">23.4.5.1 Go Class Memory Management</a></H4>
+<H4><a name="Go_class_memory">24.4.5.1 Go Class Memory Management</a></H4>
<p>
@@ -471,7 +483,7 @@ The most Go idiomatic way to manage the memory for some C++ class is to call
<tt><a href="https://golang.org/doc/effective_go.html#defer">defer</a></tt> of
the <tt>DeleteClassName</tt> call. Using <tt>defer</tt> ensures that the memory
of the C++ object is freed as soon as the function containing the <tt>defer</tt>
-statement returns. Furthemore <tt>defer</tt> works great for short-lived
+statement returns. Furthermore <tt>defer</tt> works great for short-lived
objects and fits nicely C++'s RAII idiom. Example:
</p>
<div class="code">
@@ -512,7 +524,7 @@ func main() {
<p>
Using <tt>defer</tt> has limitations though, especially when it comes to
-long-lived C++ objects whichs lifetimes are hard to predict. For such C++
+long-lived C++ objects whose lifetimes are hard to predict. For such C++
objects a common technique is to store the C++ object into a Go object, and to
use the Go function <tt>runtime.SetFinalizer</tt> to add a finalizer which frees
the C++ object when the Go object is freed. It is strongly recommended to read
@@ -578,7 +590,7 @@ func (o *GoClassName) Close() {
</pre>
</div>
-<H4><a name="Go_class_inheritance">23.4.5.2 Go Class Inheritance</a></H4>
+<H4><a name="Go_class_inheritance">24.4.5.2 Go Class Inheritance</a></H4>
<p>
@@ -590,16 +602,16 @@ Doing the reverse will require an explicit type assertion, which will
be checked dynamically.
</p>
-<H3><a name="Go_templates">23.4.6 Go Templates</a></H3>
+<H3><a name="Go_templates">24.4.6 Go Templates</a></H3>
<p>
In order to use C++ templates in Go, you must tell SWIG to create
-wrappers for a particular template instantation. To do this, use
+wrappers for a particular template instantiation. To do this, use
the <tt>%template</tt> directive.
-<H3><a name="Go_director_classes">23.4.7 Go Director Classes</a></H3>
+<H3><a name="Go_director_classes">24.4.7 Go Director Classes</a></H3>
<p>
@@ -611,13 +623,13 @@ work is necessary.
</p>
<p>
-This subchapter gives a step by step guide how to properly sublass a C++ class
+This subchapter gives a step by step guide how to properly subclass a C++ class
with a Go type. In general it is strongly recommended to follow this guide
completely to avoid common pitfalls with directors in Go.
</p>
-<H4><a name="Go_director_example_cpp_code">23.4.7.1 Example C++ code</a></H4>
+<H4><a name="Go_director_example_cpp_code">24.4.7.1 Example C++ code</a></H4>
<p>
@@ -639,12 +651,12 @@ public:
virtual ~FooBarAbstract() {};
std::string FooBar() {
- return this->Foo() + ", " + this->Bar();
+ return this-&gt;Foo() + ", " + this-&gt;Bar();
};
protected:
virtual std::string Foo() {
- return "Foo";
+ return "Foo";
};
virtual std::string Bar() = 0;
@@ -689,7 +701,7 @@ be found in <a href="#Go_director_foobargo_class">the end of the guide</a>.
</p>
-<H4><a name="Go_director_enable">23.4.7.2 Enable director feature</a></H4>
+<H4><a name="Go_director_enable">24.4.7.2 Enable director feature</a></H4>
<p>
@@ -724,7 +736,7 @@ documentation on directors.
</p>
-<H4><a name="Go_director_ctor_dtor">23.4.7.3 Constructor and destructor</a></H4>
+<H4><a name="Go_director_ctor_dtor">24.4.7.3 Constructor and destructor</a></H4>
<p>
@@ -777,7 +789,7 @@ embedding</a>.
</p>
-<H4><a name="Go_director_overriding">23.4.7.4 Override virtual methods</a></H4>
+<H4><a name="Go_director_overriding">24.4.7.4 Override virtual methods</a></H4>
<p>
@@ -785,10 +797,12 @@ In order to override virtual methods on a C++ class with Go methods the
<tt>NewDirectorClassName</tt> constructor functions receives a
<tt>DirectorInterface</tt> argument. The methods in the <tt>
DirectorInterface</tt> are a subset of the public and protected virtual methods
-of the C++ class. If the <tt>DirectorInterface</tt> contains a method with a
+of the C++ class.
+Virtual methods that have a final specifier are unsurprisingly excluded.
+If the <tt>DirectorInterface</tt> contains a method with a
matching signature to a virtual method of the C++ class then the virtual C++
method will be overwritten with the Go method. As Go doesn't support protected
-methods all overriden protected virtual C++ methods will be public in Go.
+methods all overridden protected virtual C++ methods will be public in Go.
</p>
<p>
@@ -843,7 +857,7 @@ the Go methods.
</p>
-<H4><a name="Go_director_base_methods">23.4.7.5 Call base methods</a></H4>
+<H4><a name="Go_director_base_methods">24.4.7.5 Call base methods</a></H4>
<p>
@@ -880,7 +894,7 @@ be found in <a href="#Go_director_foobargo_class">the end of the guide</a>.
</p>
-<H4><a name="Go_director_subclass">23.4.7.6 Subclass via embedding</a></H4>
+<H4><a name="Go_director_subclass">24.4.7.6 Subclass via embedding</a></H4>
<p>
@@ -941,14 +955,14 @@ methods of the <tt>FooBarAbstract</tt> C++ class by means of embedding. The
public <tt>FooBarGo</tt> interface type includes the <tt>FooBarAbstract</tt>
interface and hence <tt>FooBarGo</tt> can be used as a drop in replacement for
<tt>FooBarAbstract</tt> while the reverse isn't possible and would raise a
-compile time error. Furthemore the constructor and destructor functions <tt>
+compile time error. Furthermore the constructor and destructor functions <tt>
NewFooBarGo</tt> and <tt>DeleteFooBarGo</tt> take care of all the director
specifics and to the user the class appears as any other SWIG wrapped C++
class.
</p>
-<H4><a name="Go_director_finalizer">23.4.7.7 Memory management with runtime.SetFinalizer</a></H4>
+<H4><a name="Go_director_finalizer">24.4.7.7 Memory management with runtime.SetFinalizer</a></H4>
<p>
@@ -1013,7 +1027,7 @@ before using <tt>runtime.SetFinalizer</tt> to know all of its gotchas.
</p>
-<H4><a name="Go_director_foobargo_class">23.4.7.8 Complete FooBarGo example class</a></H4>
+<H4><a name="Go_director_foobargo_class">24.4.7.8 Complete FooBarGo example class</a></H4>
<p>
@@ -1054,7 +1068,7 @@ type overwrittenMethodsOnFooBarAbstract struct {
fb FooBarAbstract
// If additional constructor arguments have been given they are typically
- // stored here so that the overriden methods can use them.
+ // stored here so that the overridden methods can use them.
}
func (om *overwrittenMethodsOnFooBarAbstract) Foo() string {
@@ -1081,7 +1095,7 @@ func NewFooBarGo() FooBarGo {
// The memory of the FooBarAbstract director object instance can be
// automatically freed once the FooBarGo instance is garbage collected by
// uncommenting the following line. Please make sure to understand the
- // runtime.SetFinalizer specific gotchas before doing this. Furthemore
+ // runtime.SetFinalizer specific gotchas before doing this. Furthermore
// DeleteFooBarGo should be deleted if a finalizer is in use or the fooBarGo
// struct needs additional data to prevent double deletion.
// runtime.SetFinalizer(fbgs, FooBarGo.deleteFooBarAbstract)
@@ -1142,7 +1156,7 @@ SWIG/Examples/go/director/</a>.
</p>
-<H3><a name="Go_primitive_type_mappings">23.4.8 Default Go primitive type mappings</a></H3>
+<H3><a name="Go_primitive_type_mappings">24.4.8 Default Go primitive type mappings</a></H3>
<p>
@@ -1249,7 +1263,7 @@ that typemap, or add new values, to control how C/C++ types are mapped
into Go types.
</p>
-<H3><a name="Go_output_arguments">23.4.9 Output arguments</a></H3>
+<H3><a name="Go_output_arguments">24.4.9 Output arguments</a></H3>
<p>Because of limitations in the way output arguments are processed in swig,
@@ -1289,7 +1303,7 @@ fraction := modulename.Modf(5.0, ptr)
</pre>
</div>
<p>Since this is ugly, you may want to wrap the swig-generated API with
-some <a href="#Embedded_go_code">additional functions written in go</a> that
+some <a href="#Go_adding_additional_code">additional functions written in go</a> that
hide the ugly details.</p>
<p>There are no <code>char&nbsp;*OUTPUT</code> typemaps. However you can
@@ -1302,7 +1316,7 @@ void f(char *output);
</pre>
</div>
-<H3><a name="Go_adding_additional_code">23.4.10 Adding additional go code</a></H3>
+<H3><a name="Go_adding_additional_code">24.4.10 Adding additional go code</a></H3>
<p>Often the APIs generated by swig are not very natural in go, especially if
@@ -1397,7 +1411,7 @@ func bar() {
</pre>
</div>
-<H3><a name="Go_typemaps">23.4.11 Go typemaps</a></H3>
+<H3><a name="Go_typemaps">24.4.11 Go typemaps</a></H3>
<p>
diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html
index 6acdd2dc3..31d822599 100644
--- a/Doc/Manual/Guile.html
+++ b/Doc/Manual/Guile.html
@@ -8,7 +8,7 @@
<body bgcolor="#ffffff">
-<H1><a name="Guile">24 SWIG and Guile</a></H1>
+<H1><a name="Guile">25 SWIG and Guile</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -48,7 +48,7 @@
<p>
This section details guile-specific support in SWIG.
-<H2><a name="Guile_nn1">24.1 Supported Guile Versions</a></H2>
+<H2><a name="Guile_nn1">25.1 Supported Guile Versions</a></H2>
<p>
@@ -62,7 +62,7 @@ improved performance. This is currently not tested with swig
so your mileage may vary. To be safe set environment variable
GUILE_AUTO_COMPILE to 0 when using swig generated guile code.
-<H2><a name="Guile_nn2">24.2 Meaning of "Module"</a></H2>
+<H2><a name="Guile_nn2">25.2 Meaning of "Module"</a></H2>
<p>
@@ -70,7 +70,7 @@ There are three different concepts of "module" involved, defined
separately for SWIG, Guile, and Libtool. To avoid horrible confusion,
we explicitly prefix the context, e.g., "guile-module".
-<H2><a name="Guile_nn3">24.3 Old GH Guile API</a></H2>
+<H2><a name="Guile_nn3">25.3 Old GH Guile API</a></H2>
<p>Guile 1.8 and older could be interfaced using two different api's, the SCM
@@ -81,7 +81,7 @@ or the GH API. The GH interface to guile is deprecated. Read more about why in
version of SWIG that can still generate guile GH wrapper code is 2.0.9. Please
use that version if you really need the GH wrapper code.
-<H2><a name="Guile_nn4">24.4 Linkage</a></H2>
+<H2><a name="Guile_nn4">25.4 Linkage</a></H2>
<p>
@@ -89,7 +89,7 @@ Guile support is complicated by a lack of user community cohesiveness,
which manifests in multiple shared-library usage conventions. A set of
policies implementing a usage convention is called a <b>linkage</b>.
-<H3><a name="Guile_nn5">24.4.1 Simple Linkage</a></H3>
+<H3><a name="Guile_nn5">25.4.1 Simple Linkage</a></H3>
<p>
@@ -194,7 +194,7 @@ placed between the <code>define-module</code> form and the
<code>SWIG_init</code> via a preprocessor define to avoid symbol
clashes. For this case, however, passive linkage is available.
-<H3><a name="Guile_nn6">24.4.2 Passive Linkage</a></H3>
+<H3><a name="Guile_nn6">25.4.2 Passive Linkage</a></H3>
<p>Passive linkage is just like simple linkage, but it generates an
@@ -204,7 +204,7 @@ package name (see below).
<p>You should use passive linkage rather than simple linkage when you
are using multiple modules.
-<H3><a name="Guile_nn7">24.4.3 Native Guile Module Linkage</a></H3>
+<H3><a name="Guile_nn7">25.4.3 Native Guile Module Linkage</a></H3>
<p>SWIG can also generate wrapper code that does all the Guile module
@@ -245,7 +245,7 @@ Newer Guile versions have a shorthand procedure for this:
</div>
</ul>
-<H3><a name="Guile_nn8">24.4.4 Old Auto-Loading Guile Module Linkage</a></H3>
+<H3><a name="Guile_nn8">25.4.4 Old Auto-Loading Guile Module Linkage</a></H3>
<p>Guile used to support an autoloading facility for object-code
@@ -271,7 +271,7 @@ option, SWIG generates an exported module initialization function with
an appropriate name.
-<H3><a name="Guile_nn9">24.4.5 Hobbit4D Linkage</a></H3>
+<H3><a name="Guile_nn9">25.4.5 Hobbit4D Linkage</a></H3>
<p>
@@ -296,7 +296,7 @@ my/lib/libfoo.so.X.Y.Z and friends. This scheme is still very
experimental; the (hobbit4d link) conventions are not well understood.
</p>
-<H2><a name="Guile_nn10">24.5 Underscore Folding</a></H2>
+<H2><a name="Guile_nn10">25.5 Underscore Folding</a></H2>
<p>
@@ -308,7 +308,7 @@ complained so far.
<code>%rename</code> to specify the Guile name of the wrapped
functions and variables (see CHANGES).
-<H2><a name="Guile_nn11">24.6 Typemaps</a></H2>
+<H2><a name="Guile_nn11">25.6 Typemaps</a></H2>
<p>
@@ -400,7 +400,7 @@ constant will appear as a scheme variable. See
<a href="Customization.html#Customization_features">Features and the %feature directive</a>
for info on how to apply the %feature.</p>
-<H2><a name="Guile_nn12">24.7 Representation of pointers as smobs</a></H2>
+<H2><a name="Guile_nn12">25.7 Representation of pointers as smobs</a></H2>
<p>
@@ -421,7 +421,7 @@ representing the expected pointer type. See also
If the Scheme object passed was not a SWIG smob representing a compatible
pointer, a <code>wrong-type-arg</code> exception is raised.
-<H3><a name="Guile_nn14">24.7.1 Smobs</a></H3>
+<H3><a name="Guile_nn14">25.7.1 Smobs</a></H3>
<p>
@@ -440,7 +440,7 @@ structure describing this type. If a generated GOOPS module has been loaded, sm
the corresponding GOOPS class.</p>
-<H3><a name="Guile_nn15">24.7.2 Garbage Collection</a></H3>
+<H3><a name="Guile_nn15">25.7.2 Garbage Collection</a></H3>
<p>Garbage collection is a feature of Guile since version 1.6. As SWIG now requires Guile &gt; 1.8,
@@ -454,14 +454,14 @@ is exactly like described in <a href="Customization.html#Customization_ownership
Object ownership and %newobject</a> in the SWIG manual. All typemaps use an $owner var, and
the guile module replaces $owner with 0 or 1 depending on feature:new.</p>
-<H2><a name="Guile_nn16">24.8 Native Guile pointers</a></H2>
+<H2><a name="Guile_nn16">25.8 Native Guile pointers</a></H2>
<p>
In addition to SWIG smob pointers, <a href="https://www.gnu.org/software/guile/manual/html_node/Foreign-Pointers.html">Guile's native pointer type</a> are accepted as arguments to wrapped SWIG functions. This can be useful for passing <a href="https://www.gnu.org/software/guile/manual/html_node/Void-Pointers-and-Byte-Access.html#">pointers to bytevector data</a> to wrapped functions.
</p>
-<H2><a name="Guile_nn17">24.9 Exception Handling</a></H2>
+<H2><a name="Guile_nn17">25.9 Exception Handling</a></H2>
<p>
@@ -487,7 +487,7 @@ mapping:
The default when not specified here is to use "swig-error".
See Lib/exception.i for details.
-<H2><a name="Guile_nn18">24.10 Procedure documentation</a></H2>
+<H2><a name="Guile_nn18">25.10 Procedure documentation</a></H2>
<p>If invoked with the command-line option <code>-procdoc
@@ -522,7 +522,7 @@ like this:
typemap argument <code>doc</code>. See <code>Lib/guile/typemaps.i</code> for
details.
-<H2><a name="Guile_nn19">24.11 Procedures with setters</a></H2>
+<H2><a name="Guile_nn19">25.11 Procedures with setters</a></H2>
<p>For global variables, SWIG creates a single wrapper procedure
@@ -550,7 +550,7 @@ struct members, the procedures <code>(<var>struct</var>-<var>member</var>-get
pointer)</code> and <code>(<var>struct-member</var>-set pointer
value)</code> are <em>not</em> generated.
-<H2><a name="Guile_nn20">24.12 GOOPS Proxy Classes</a></H2>
+<H2><a name="Guile_nn20">25.12 GOOPS Proxy Classes</a></H2>
<p>SWIG can also generate classes and generic functions for use with
@@ -696,7 +696,7 @@ Notice that &lt;Foo&gt; is used before it is defined. The fix is to just put th
<code>%import "foo.h"</code> before the <code>%inline</code> block.
</p>
-<H3><a name="Guile_nn21">24.12.1 Naming Issues</a></H3>
+<H3><a name="Guile_nn21">25.12.1 Naming Issues</a></H3>
<p>As you can see in the example above, there are potential naming conflicts. The default exported
@@ -733,7 +733,7 @@ guile-modules. For example,</p>
(use-modules ((Test) #:renamer (symbol-prefix-proc 'goops:)))
</pre></div>
-<H3><a name="Guile_nn22">24.12.2 Linking</a></H3>
+<H3><a name="Guile_nn22">25.12.2 Linking</a></H3>
<p>The guile-modules generated above all need to be linked together. GOOPS support requires
diff --git a/Doc/Manual/Introduction.html b/Doc/Manual/Introduction.html
index 0140bfa57..8d161b73d 100644
--- a/Doc/Manual/Introduction.html
+++ b/Doc/Manual/Introduction.html
@@ -13,6 +13,11 @@
<ul>
<li><a href="#Introduction_nn2">What is SWIG?</a>
<li><a href="#Introduction_nn3">Why use SWIG?</a>
+<li><a href="#Introduction_target_languages">Target languages</a>
+<ul>
+<li><a href="#Introduction_supported_status">Supported status</a>
+<li><a href="#Introduction_experimental_status">Experimental status</a>
+</ul>
<li><a href="#Introduction_nn4">A SWIG example</a>
<ul>
<li><a href="#Introduction_nn5">SWIG interface file</a>
@@ -144,7 +149,79 @@ it provides a wide variety of customization features that let you change almost
every aspect of the language bindings. This is the main reason why SWIG has such a large
user manual ;-).
-<H2><a name="Introduction_nn4">2.3 A SWIG example</a></H2>
+<H2><a name="Introduction_target_languages">2.3 Target languages</a></H2>
+
+
+<p>
+SWIG in essence is a tool to generate code for making C/C++ code available to various other programming languages.
+These higher level programming languages are the target languages for the SWIG code generator and C or C++ are the input languages.
+A single target language must be specified when SWIG is run.
+This results in generating code for C/C++ and the specified target language to interface with each other.
+SWIG can be invoked multiple times, but with a different target language specified on each invocation.
+This ability to interface C/C++ to many different target languages is one of SWIG's core strengths and features.
+</p>
+
+<p>
+SWIG is very broadly composed of two components.
+A core component creates a parse tree from the input ISO C/C++ and SWIG directives (extensions to the C/C++ standards).
+The parse tree is then passed to a second component, one of the target language modules for generating code specific to a higher level language.
+SWIG supports many different target languages.
+These target languages are given a status of either Supported or Experimental.
+This status is provided to indicate the level of maturity to expect when using a particular target language as not all target languages are fully developed.
+</p>
+
+<p>
+The second part of the SWIG documentation contains a chapter for each target level language.
+Each chapter will state the status (Supported or Experimental) for that language.
+</p>
+
+<H3><a name="Introduction_supported_status">2.3.1 Supported status</a></H3>
+
+
+<p>
+A target language is given the 'Supported' status when
+</p>
+
+<ul>
+<li>It is in a mature, well functioning state.</li>
+<li>It has its own comprehensive chapter in the documentation.</li>
+<li>It passes all of the main SWIG test-suite and has a range of working examples.</li>
+<li>It supports the vast majority of SWIG features.</li>
+<li>It provides strong backwards compatibility between releases.</li>
+</ul>
+
+<p>
+The above is a short summary and further details are outlined in the <a href="Extending.html#Extending_supported_status">Supported status</a> section in the Extending chapter.
+The good news is that all the well-known and most popular languages have this status.
+</p>
+
+<H3><a name="Introduction_experimental_status">2.3.2 Experimental status</a></H3>
+
+
+<p>
+A target language is given the 'Experimental' status when
+</p>
+
+<ul>
+<li>It is of sub-standard quality, failing to meet the above 'Supported' status.</li>
+<li>It is somewhere between the mid to mature stage of development.</li>
+<li>It does not guarantee any backwards compatibility between releases.</li>
+<li>It is in need of help to finish development.</li>
+</ul>
+
+<p>
+Anyone using an experimental target language is strongly urged to assist with development of the target language module if they wish to use it.
+</p>
+<p>
+SWIG displays a warning when an experimental target language is used in order to set expectations and emphasize the experimental status of the target language.
+The usual <a href="Warnings.html#Warnings_suppression">warning suppression</a> techniques can be used if required.
+</p>
+
+<p>
+The above is a short summary and further details are outlined in the <a href="Extending.html#Extending_experimental_status">Experimental status</a> section in the Extending chapter.
+</p>
+
+<H2><a name="Introduction_nn4">2.4 A SWIG example</a></H2>
<p>
@@ -155,7 +232,7 @@ following C code:
<div class="code"><pre>
/* File : example.c */
-double My_variable = 3.0;
+double My_variable = 3.0;
/* Compute factorial of n */
int fact(int n) {
@@ -177,7 +254,7 @@ variable <tt>My_variable</tt> from Tcl. You start by making a SWIG
interface file as shown below (by convention, these files carry a .i
suffix) :
-<H3><a name="Introduction_nn5">2.3.1 SWIG interface file</a></H3>
+<H3><a name="Introduction_nn5">2.4.1 SWIG interface file</a></H3>
<div class="code"><pre>
@@ -196,13 +273,13 @@ extern int my_mod(int n, int m);
</pre></div>
<p>
-The interface file contains ANSI C function prototypes and variable
+The interface file contains ISO C function prototypes and variable
declarations. The <tt>%module</tt> directive defines the name of the
module that will be created by SWIG. The <tt>%{ %}</tt> block
provides a location for inserting additional code, such as C header
files or additional C declarations, into the generated C wrapper code.
-<H3><a name="Introduction_nn6">2.3.2 The swig command</a></H3>
+<H3><a name="Introduction_nn6">2.4.2 The swig command</a></H3>
<p>
@@ -235,7 +312,7 @@ and variables declared in the SWIG interface. A look at the file
<tt>example_wrap.c</tt> reveals a hideous mess. However, you
almost never need to worry about it.
-<H3><a name="Introduction_nn7">2.3.3 Building a Perl5 module</a></H3>
+<H3><a name="Introduction_nn7">2.4.3 Building a Perl5 module</a></H3>
<p>
@@ -261,7 +338,7 @@ unix &gt;
</pre></div>
-<H3><a name="Introduction_nn8">2.3.4 Building a Python module</a></H3>
+<H3><a name="Introduction_nn8">2.4.4 Building a Python module</a></H3>
<p>
@@ -285,7 +362,7 @@ Type "copyright", "credits" or "license" for more information.
7.5
</pre></div>
-<H3><a name="Introduction_nn9">2.3.5 Shortcuts</a></H3>
+<H3><a name="Introduction_nn9">2.4.5 Shortcuts</a></H3>
<p>
@@ -311,7 +388,7 @@ print $example::My_variable + 4.5, "\n";
7.5
</pre></div>
-<H2><a name="Introduction_nn10">2.4 Supported C/C++ language features</a></H2>
+<H2><a name="Introduction_nn10">2.5 Supported C/C++ language features</a></H2>
<p>
@@ -323,7 +400,7 @@ major features include:
<ul>
<li>Full C99 preprocessing.
-<li>All ANSI C and C++ datatypes.
+<li>All ISO C and C++ datatypes.
<li>Functions, variables, and constants.
<li>Classes.
<li>Single and multiple inheritance.
@@ -336,7 +413,9 @@ major features include:
</ul>
<p>
-Most of C++11 is also supported. Details are in the <a href="CPlusPlus11.html#CPlusPlus11">C++11</a> section.
+Most of C++11 is also supported. Details are in the <a href="CPlusPlus11.html#CPlusPlus11">C++11</a> chapter.
+C++14 support is covered in the <a href="CPlusPlus14.html#CPlusPlus14">C++14</a> chapter.
+C++17 support is covered in the <a href="CPlusPlus17.html#CPlusPlus17">C++17</a> chapter.
</p>
<p>
@@ -350,7 +429,7 @@ wrapping simple C++ code. In fact, SWIG is able to handle C++ code that
stresses the very limits of many C++ compilers.
-<H2><a name="Introduction_nn11">2.5 Non-intrusive interface building</a></H2>
+<H2><a name="Introduction_nn11">2.6 Non-intrusive interface building</a></H2>
<p>
@@ -362,7 +441,7 @@ interface and reuse the code in other applications. It is also
possible to support different types of interfaces depending on the application.
</p>
-<H2><a name="Introduction_build_system">2.6 Incorporating SWIG into a build system</a></H2>
+<H2><a name="Introduction_build_system">2.7 Incorporating SWIG into a build system</a></H2>
<p>
@@ -385,13 +464,13 @@ for further information on this and other Autoconf macros.
</p>
<p>
-There is growing support for SWIG in some build tools, for example <a href="http://cmake.org">CMake</a>
+There is growing support for SWIG in some build tools, for example <a href="https://cmake.org">CMake</a>
is a cross-platform, open-source build manager with built in support for SWIG. CMake can detect the SWIG executable
and many of the target language libraries for linking against.
CMake knows how to build shared libraries and loadable modules on many different operating systems.
This allows easy cross platform SWIG development. It can also generate the custom commands necessary for
driving SWIG from IDEs and makefiles. All of this can be done from a single cross platform input file.
-The following example is a CMake input file for creating a python wrapper for the SWIG interface file, example.i:
+The following example is a CMake input file for creating a Python wrapper for the SWIG interface file, example.i:
</p>
<div class="code"><pre>
@@ -420,7 +499,7 @@ which will invoke SWIG and compile the generated C++ files into _example.so (UNI
For other target languages on Windows a dll, instead of a .pyd file, is usually generated.
</p>
-<H2><a name="Introduction_nn12">2.7 Hands off code generation</a></H2>
+<H2><a name="Introduction_nn12">2.8 Hands off code generation</a></H2>
<p>
@@ -433,7 +512,7 @@ it allows others to forget about the low-level implementation
details.
</p>
-<H2><a name="Introduction_nn13">2.8 SWIG and freedom</a></H2>
+<H2><a name="Introduction_nn13">2.9 SWIG and freedom</a></H2>
<p>
@@ -452,7 +531,7 @@ to work with complicated and unusual C/C++ applications.
Ironically, the freedom that SWIG provides is countered by an
extremely conservative approach to code generation. At its core, SWIG
tries to distill even the most advanced C++ code down to a small
-well-defined set of interface building techniques based on ANSI C
+well-defined set of interface building techniques based on ISO C
programming. Because of this, you will find that SWIG interfaces can
be easily compiled by virtually every C/C++ compiler and that they can
be used on any platform. Again, this is an important part of staying out
diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html
index bd259e60d..db5f041e4 100644
--- a/Doc/Manual/Java.html
+++ b/Doc/Manual/Java.html
@@ -6,7 +6,7 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF">
-<H1><a name="Java">25 SWIG and Java</a></H1>
+<H1><a name="Java">26 SWIG and Java</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -94,6 +94,9 @@
<li><a href="#Java_directors_threading">Director threading issues</a>
<li><a href="#Java_directors_performance">Director performance tuning</a>
<li><a href="#Java_exceptions_from_directors">Java exceptions from directors</a>
+<ul>
+<li><a href="#Java_customizing_director_exceptions">Customizing director exceptions</a>
+</ul>
</ul>
<li><a href="#Java_allprotected">Accessing protected members</a>
<li><a href="#Java_common_customization">Common customization features</a>
@@ -164,7 +167,7 @@ It covers most SWIG features, but certain low-level details are covered in less
</p>
-<H2><a name="Java_overview">25.1 Overview</a></H2>
+<H2><a name="Java_overview">26.1 Overview</a></H2>
<p>
@@ -199,7 +202,7 @@ Various customisation tips and techniques using SWIG directives are covered.
The latter sections cover the advanced techniques of using typemaps for complete control of the wrapping process.
</p>
-<H2><a name="Java_preliminaries">25.2 Preliminaries</a></H2>
+<H2><a name="Java_preliminaries">26.2 Preliminaries</a></H2>
<p>
@@ -219,7 +222,7 @@ This is the commonly used method to load JNI code so your system will more than
Android uses Java JNI and also works with SWIG. Please read the <a href="Android.html#Android">Android chapter</a> in conjunction with this one if you are targeting Android.
</p>
-<H3><a name="Java_running_swig">25.2.1 Running SWIG</a></H3>
+<H3><a name="Java_running_swig">26.2.1 Running SWIG</a></H3>
<p>
@@ -278,7 +281,7 @@ The following sections have further practical examples and details on how you mi
compiling and using the generated files.
</p>
-<H3><a name="Java_commandline">25.2.2 Additional Commandline Options</a></H3>
+<H3><a name="Java_commandline">26.2.2 Additional Commandline Options</a></H3>
<p>
@@ -315,7 +318,7 @@ swig -java -help
Their use will become clearer by the time you have finished reading this section on SWIG and Java.
</p>
-<H3><a name="Java_getting_right_headers">25.2.3 Getting the right header files</a></H3>
+<H3><a name="Java_getting_right_headers">26.2.3 Getting the right header files</a></H3>
<p>
@@ -330,7 +333,7 @@ They are usually in directories like this:</p>
<p>
The exact location may vary on your machine, but the above locations are typical. </p>
-<H3><a name="Java_compiling_dynamic">25.2.4 Compiling a dynamic module</a></H3>
+<H3><a name="Java_compiling_dynamic">26.2.4 Compiling a dynamic module</a></H3>
<p>
@@ -365,7 +368,7 @@ The name of the shared library output file is important.
If the name of your SWIG module is "<tt>example</tt>", the name of the corresponding shared library file should be "<tt>libexample.so</tt>" (or equivalent depending on your machine, see <a href="#Java_dynamic_linking_problems">Dynamic linking problems</a> for more information).
The name of the module is specified using the <tt>%module</tt> directive or <tt>-module</tt> command line option.</p>
-<H3><a name="Java_using_module">25.2.5 Using your module</a></H3>
+<H3><a name="Java_using_module">26.2.5 Using your module</a></H3>
<p>
@@ -400,7 +403,7 @@ $
If it doesn't work have a look at the following section which discusses problems loading the shared library.
</p>
-<H3><a name="Java_dynamic_linking_problems">25.2.6 Dynamic linking problems</a></H3>
+<H3><a name="Java_dynamic_linking_problems">26.2.6 Dynamic linking problems</a></H3>
<p>
@@ -474,7 +477,7 @@ Exception in thread "main" java.lang.UnsatisfiedLinkError: exampleJNI.gcd(II)I
<p>
where <tt>gcd</tt> is the missing JNI function that SWIG generated into the wrapper file.
Also make sure you pass all of the required libraries to the linker.
-The <tt>java -verbose:jni</tt> commandline switch is also a great way to get more information on unresolved symbols.
+The <tt>java -verbose:jni</tt> commandline option is also a great way to get more information on unresolved symbols.
One last piece of advice is to beware of the common faux pas of having more than one native library version in your path.
</p>
@@ -487,7 +490,7 @@ The following section also contains some C++ specific linking problems and solut
</p>
-<H3><a name="Java_compilation_problems_cpp">25.2.7 Compilation problems and compiling with C++</a></H3>
+<H3><a name="Java_compilation_problems_cpp">26.2.7 Compilation problems and compiling with C++</a></H3>
<p>
@@ -539,7 +542,7 @@ Finally make sure the version of JDK header files matches the version of Java th
</p>
-<H3><a name="Java_building_windows">25.2.8 Building on Windows</a></H3>
+<H3><a name="Java_building_windows">26.2.8 Building on Windows</a></H3>
<p>
@@ -548,7 +551,7 @@ You will want to produce a DLL that can be loaded by the Java Virtual Machine.
This section covers the process of using SWIG with Microsoft Visual C++ 6 although the procedure may be similar with other compilers.
In order for everything to work, you will need to have a JDK installed on your machine in order to read the JNI header files.</p>
-<H4><a name="Java_visual_studio">25.2.8.1 Running SWIG from Visual Studio</a></H4>
+<H4><a name="Java_visual_studio">26.2.8.1 Running SWIG from Visual Studio</a></H4>
<p>
@@ -587,7 +590,7 @@ To run the native code in the DLL (example.dll), make sure that it is in your pa
If the library fails to load have a look at <a href="#Java_dynamic_linking_problems">Dynamic linking problems</a>.
</p>
-<H4><a name="Java_nmake">25.2.8.2 Using NMAKE</a></H4>
+<H4><a name="Java_nmake">26.2.8.2 Using NMAKE</a></H4>
<p>
@@ -642,11 +645,11 @@ java::
<p>
To build the DLL and compile the java code, run NMAKE (you may need to run <tt>vcvars32</tt> first).
This is a pretty simplistic Makefile, but hopefully its enough to get you started.
-Of course you may want to make changes for it to work for C++ by adding in the -c++ command line switch for swig and replacing .c with .cxx.
+Of course you may want to make changes for it to work for C++ by adding in the -c++ command line option for swig and replacing .c with .cxx.
</p>
-<H2><a name="Java_basic_tour">25.3 A tour of basic C/C++ wrapping</a></H2>
+<H2><a name="Java_basic_tour">26.3 A tour of basic C/C++ wrapping</a></H2>
<p>
@@ -656,7 +659,7 @@ variables are wrapped with JavaBean type getters and setters and so forth.
This section briefly covers the essential aspects of this wrapping.
</p>
-<H3><a name="Java_module_packages_classes">25.3.1 Modules, packages and generated Java classes</a></H3>
+<H3><a name="Java_module_packages_classes">26.3.1 Modules, packages and generated Java classes</a></H3>
<p>
@@ -692,7 +695,7 @@ swig -java -package com.bloggs.swig -outdir com/bloggs/swig example.i
SWIG won't create the directory, so make sure it exists beforehand.
</p>
-<H3><a name="Java_functions">25.3.2 Functions</a></H3>
+<H3><a name="Java_functions">26.3.2 Functions</a></H3>
<p>
@@ -726,7 +729,7 @@ System.out.println(example.fact(4));
</pre></div>
-<H3><a name="Java_global_variables">25.3.3 Global variables</a></H3>
+<H3><a name="Java_global_variables">26.3.3 Global variables</a></H3>
<p>
@@ -813,7 +816,7 @@ extern char *path; // Read-only (due to %immutable)
</div>
-<H3><a name="Java_constants">25.3.4 Constants</a></H3>
+<H3><a name="Java_constants">26.3.4 Constants</a></H3>
<p>
@@ -953,7 +956,7 @@ Or if you decide this practice isn't so bad and your own class implements <tt>ex
</p>
-<H3><a name="Java_enumerations">25.3.5 Enumerations</a></H3>
+<H3><a name="Java_enumerations">26.3.5 Enumerations</a></H3>
<p>
@@ -967,7 +970,7 @@ The final two approaches use simple integers for each enum item.
Before looking at the various approaches for wrapping named C/C++ enums, anonymous enums are considered.
</p>
-<H4><a name="Java_anonymous_enums">25.3.5.1 Anonymous enums</a></H4>
+<H4><a name="Java_anonymous_enums">26.3.5.1 Anonymous enums</a></H4>
<p>
@@ -1030,7 +1033,7 @@ As in the case of constants, you can access them through either the module class
</p>
-<H4><a name="Java_typesafe_enums">25.3.5.2 Typesafe enums</a></H4>
+<H4><a name="Java_typesafe_enums">26.3.5.2 Typesafe enums</a></H4>
<p>
@@ -1110,11 +1113,10 @@ Typesafe enums have their advantages over using plain integers in that they can
However, there are limitations. For example, they cannot be used in switch statements and serialization is an issue.
Please look at the following references for further information:
-http://java.sun.com/developer/Books/shiftintojava/page1.html#replaceenums
<a href="http://java.sun.com/developer/Books/shiftintojava/page1.html#replaceenums">Replace Enums with Classes</a> in <i>Effective Java Programming</i> on the Sun website,
-<a href="http://www.javaworld.com/javaworld/jw-07-1997/jw-07-enumerated.html">Create enumerated constants in Java</a> JavaWorld article,
-<a href="http://www.javaworld.com/javaworld/javatips/jw-javatip133.html">Java Tip 133: More on typesafe enums</a> and
-<a href="http://www.javaworld.com/javaworld/javatips/jw-javatip122.html">Java Tip 122: Beware of Java typesafe enumerations</a> JavaWorld tips.
+<a href="https://www.javaworld.com/article/2076970/create-enumerated-constants-in-java.html">Create enumerated constants in Java</a> JavaWorld article,
+<a href="https://www.javaworld.com/article/2077499/java-tip-133--more-on-typesafe-enums.html">Java Tip 133: More on typesafe enums</a> and
+<a href="https://www.javaworld.com/article/2077487/java-tip-122--beware-of-java-typesafe-enumerations.html">Java Tip 122: Beware of Java typesafe enumerations</a> JavaWorld tips.
</p>
<p>
@@ -1124,7 +1126,7 @@ When upgrading to JDK 1.5 or later, proper Java enums could be used instead, wit
The following section details proper Java enum generation.
</p>
-<H4><a name="Java_proper_enums">25.3.5.3 Proper Java enums</a></H4>
+<H4><a name="Java_proper_enums">26.3.5.3 Proper Java enums</a></H4>
<p>
@@ -1177,7 +1179,7 @@ The additional support methods need not be generated if none of the enum items h
<a href="#Java_simpler_enum_classes">Simpler Java enums for enums without initializers</a> section.
</p>
-<H4><a name="Java_typeunsafe_enums">25.3.5.4 Type unsafe enums</a></H4>
+<H4><a name="Java_typeunsafe_enums">26.3.5.4 Type unsafe enums</a></H4>
<p>
@@ -1225,7 +1227,7 @@ Note that unlike typesafe enums, this approach requires users to mostly use diff
Thus the upgrade path to proper enums provided in JDK 1.5 is more painful.
</p>
-<H4><a name="Java_simple_enums">25.3.5.5 Simple enums</a></H4>
+<H4><a name="Java_simple_enums">26.3.5.5 Simple enums</a></H4>
<p>
@@ -1244,7 +1246,7 @@ SWIG-1.3.21 and earlier versions wrapped all enums using this approach.
The type unsafe approach is preferable to this one and this simple approach is only included for backwards compatibility with these earlier versions of SWIG.
</p>
-<H3><a name="Java_pointers">25.3.6 Pointers</a></H3>
+<H3><a name="Java_pointers">26.3.6 Pointers</a></H3>
<p>
@@ -1332,7 +1334,7 @@ C-style cast may return a bogus result whereas as the C++-style cast will return
a NULL pointer if the conversion can't be performed.
</p>
-<H3><a name="Java_structures">25.3.7 Structures</a></H3>
+<H3><a name="Java_structures">26.3.7 Structures</a></H3>
<p>
@@ -1500,7 +1502,7 @@ x.setA(3); // Modify x.a - this is the same as b.f.a
</div>
-<H3><a name="Java_classes">25.3.8 C++ classes</a></H3>
+<H3><a name="Java_classes">26.3.8 C++ classes</a></H3>
<p>
@@ -1563,7 +1565,7 @@ int bar = Spam.getBar();
</div>
-<H3><a name="Java_inheritance">25.3.9 C++ inheritance</a></H3>
+<H3><a name="Java_inheritance">26.3.9 C++ inheritance</a></H3>
<p>
@@ -1624,7 +1626,7 @@ Note that Java does not support multiple inheritance so any multiple inheritance
A warning is given when multiple inheritance is detected and only the first base class is used.
</p>
-<H3><a name="Java_pointers_refs_arrays">25.3.10 Pointers, references, arrays and pass by value</a></H3>
+<H3><a name="Java_pointers_refs_arrays">26.3.10 Pointers, references, arrays and pass by value</a></H3>
<p>
@@ -1679,7 +1681,7 @@ to hold the result and a pointer is returned (Java will release this memory
when the returned object's finalizer is run by the garbage collector).
</p>
-<H4><a name="Java_null_pointers">25.3.10.1 Null pointers</a></H4>
+<H4><a name="Java_null_pointers">26.3.10.1 Null pointers</a></H4>
<p>
@@ -1703,7 +1705,7 @@ For <tt>spam1</tt> and <tt>spam4</tt> above the Java <tt>null</tt> gets translat
The converse also occurs, that is, NULL pointers are translated into <tt>null</tt> Java objects when returned from a C/C++ function.
</p>
-<H3><a name="Java_overloaded_functions">25.3.11 C++ overloaded functions</a></H3>
+<H3><a name="Java_overloaded_functions">26.3.11 C++ overloaded functions</a></H3>
<p>
@@ -1818,7 +1820,7 @@ void spam(unsigned short); // Ignored
</pre>
</div>
-<H3><a name="Java_default_arguments">25.3.12 C++ default arguments</a></H3>
+<H3><a name="Java_default_arguments">26.3.12 C++ default arguments</a></H3>
<p>
@@ -1861,7 +1863,7 @@ Further details on default arguments and how to restore this approach are given
</p>
-<H3><a name="Java_namespaces">25.3.13 C++ namespaces</a></H3>
+<H3><a name="Java_namespaces">26.3.13 C++ namespaces</a></H3>
<p>
@@ -1951,7 +1953,7 @@ If the resulting use of the nspace feature and hence packages results in a proxy
you will need to open up the visibility for the pointer constructor and <tt>getCPtr</tt> method from the default 'protected' to 'public' with the <tt>SWIG_JAVABODY_PROXY</tt> macro. See <a href="#Java_code_typemaps">Java code typemaps</a>.
</p>
-<H3><a name="Java_templates">25.3.14 C++ templates</a></H3>
+<H3><a name="Java_templates">26.3.14 C++ templates</a></H3>
<p>
@@ -2000,10 +2002,10 @@ Obviously, there is more to template wrapping than shown in this example.
More details can be found in the <a href="SWIGPlus.html#SWIGPlus">SWIG and C++</a> chapter.
</p>
-<H3><a name="Java_smart_pointers">25.3.15 C++ Smart Pointers</a></H3>
+<H3><a name="Java_smart_pointers">26.3.15 C++ Smart Pointers</a></H3>
-<H4><a name="Java_smart_pointers_shared_ptr">25.3.15.1 The shared_ptr Smart Pointer</a></H4>
+<H4><a name="Java_smart_pointers_shared_ptr">26.3.15.1 The shared_ptr Smart Pointer</a></H4>
<p>
@@ -2014,7 +2016,7 @@ in the <a href="Library.html#Library_std_shared_ptr">shared_ptr smart pointer</a
</p>
-<H4><a name="Java_smart_pointers_generic">25.3.15.2 Generic Smart Pointers</a></H4>
+<H4><a name="Java_smart_pointers_generic">26.3.15.2 Generic Smart Pointers</a></H4>
<p>
@@ -2098,7 +2100,7 @@ Foo f = p.__deref__(); // Returns underlying Foo *
</pre>
</div>
-<H2><a name="Java_further_details">25.4 Further details on the generated Java classes</a></H2>
+<H2><a name="Java_further_details">26.4 Further details on the generated Java classes</a></H2>
<p>
@@ -2113,7 +2115,7 @@ Finally enum classes are covered.
First, the crucial intermediary JNI class is considered.
</p>
-<H3><a name="Java_imclass">25.4.1 The intermediary JNI class</a></H3>
+<H3><a name="Java_imclass">26.4.1 The intermediary JNI class</a></H3>
<p>
@@ -2233,7 +2235,7 @@ If <tt>name</tt> is the same as <tt>modulename</tt> then the module class name g
from <tt>modulename</tt> to <tt>modulenameModule</tt>.
</p>
-<H4><a name="Java_imclass_pragmas">25.4.1.1 The intermediary JNI class pragmas</a></H4>
+<H4><a name="Java_imclass_pragmas">26.4.1.1 The intermediary JNI class pragmas</a></H4>
<p>
@@ -2315,7 +2317,7 @@ For example, let's change the intermediary JNI class access to just the default
All the methods in the intermediary JNI class will then not be callable outside of the package as the method modifiers have been changed from public access to default access. This is useful if you want to prevent users calling these low level functions.
</p>
-<H3><a name="Java_module_class">25.4.2 The Java module class</a></H3>
+<H3><a name="Java_module_class">26.4.2 The Java module class</a></H3>
<p>
@@ -2346,7 +2348,7 @@ example.egg(new Foo());
The primary reason for having the module class wrapping the calls in the intermediary JNI class is to implement static type checking. In this case only a <tt>Foo</tt> can be passed to the <tt>egg</tt> function, whereas any <tt>long</tt> can be passed to the <tt>egg</tt> function in the intermediary JNI class.
</p>
-<H4><a name="Java_module_class_pragmas">25.4.2.1 The Java module class pragmas</a></H4>
+<H4><a name="Java_module_class_pragmas">26.4.2.1 The Java module class pragmas</a></H4>
<p>
@@ -2397,7 +2399,7 @@ See <a href="#Java_imclass_pragmas">The intermediary JNI class pragmas</a> secti
</p>
-<H3><a name="Java_proxy_classes">25.4.3 Java proxy classes</a></H3>
+<H3><a name="Java_proxy_classes">26.4.3 Java proxy classes</a></H3>
<p>
@@ -2473,7 +2475,7 @@ int y = f.spam(5, new Foo());
</pre>
</div>
-<H4><a name="Java_memory_management">25.4.3.1 Memory management</a></H4>
+<H4><a name="Java_memory_management">26.4.3.1 Memory management</a></H4>
<p>
@@ -2635,7 +2637,7 @@ and
</p>
-<H4><a name="Java_inheritance_mirroring">25.4.3.2 Inheritance</a></H4>
+<H4><a name="Java_inheritance_mirroring">26.4.3.2 Inheritance</a></H4>
<p>
@@ -2751,7 +2753,7 @@ However, true cross language polymorphism can be achieved using the <a href="#Ja
</p>
-<H4><a name="Java_proxy_classes_gc">25.4.3.3 Proxy classes and garbage collection</a></H4>
+<H4><a name="Java_proxy_classes_gc">26.4.3.3 Proxy classes and garbage collection</a></H4>
<p>
@@ -2760,7 +2762,7 @@ The <tt>finalize()</tt> method calls <tt>delete()</tt> which frees any malloc'd
The idea is for <tt>delete()</tt> to be called when you have finished with the C/C++ object.
Ideally you need not call <tt>delete()</tt>, but rather leave it to the garbage collector to call it from the finalizer.
When a program exits, the garbage collector does not guarantee to call all finalizers.
-An insight into the reasoning behind this can be obtained from <a href="http://www.hpl.hp.com/techreports/2002/HPL-2002-335.html">Hans Boehm's Destructors, Finalizers, and Synchronization</a> paper.
+An insight into the reasoning behind this can be obtained from <a href="https://www.hpl.hp.com/techreports/2002/HPL-2002-335.html">Hans Boehm's Destructors, Finalizers, and Synchronization</a> paper.
Depending on what the finalizers do and which operating system you use, this may or may not be a problem.
</p>
@@ -2784,7 +2786,7 @@ Call the <tt>System.runFinalizersOnExit(true)</tt> or <tt>Runtime.getRuntime().r
This method is inherently unsafe. It may result in finalizers being called on live objects while other threads are concurrently manipulating those objects, resulting in erratic behavior or deadlock.
</i></div>
<p>In many cases you will be lucky and find that it works, but it is not to be advocated.
-Have a look at <a href="http://www.oracle.com/technetwork/java/index.html">Java web site</a> and search for <tt>runFinalizersOnExit</tt>.
+Have a look at <a href="https://www.oracle.com/technetwork/java/index.html">Java web site</a> and search for <tt>runFinalizersOnExit</tt>.
</p></li>
<li><p>
@@ -2834,7 +2836,7 @@ The section on <a href="#Java_typemaps">Java typemaps</a> details how to specify
See the <a href="http://www.devx.com/Java/Article/30192">How to Handle Java Finalization's Memory-Retention Issues</a> article for alternative approaches to managing memory by avoiding finalizers altogether.
</p>
-<H4><a name="Java_pgcpp">25.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling</a></H4>
+<H4><a name="Java_pgcpp">26.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling</a></H4>
<p>
@@ -2956,7 +2958,7 @@ For example:
<b>Compatibility note:</b> The generation of this additional parameter did not occur in versions prior to SWIG-1.3.30.
</p>
-<H4><a name="Java_multithread_libraries">25.4.3.5 Single threaded applications and thread safety</a></H4>
+<H4><a name="Java_multithread_libraries">26.4.3.5 Single threaded applications and thread safety</a></H4>
<p>
@@ -3044,7 +3046,7 @@ for (int i=0; i&lt;100000; i++) {
</pre></div>
-<H3><a name="Java_type_wrapper_classes">25.4.4 Type wrapper classes</a></H3>
+<H3><a name="Java_type_wrapper_classes">26.4.4 Type wrapper classes</a></H3>
<p>
@@ -3131,7 +3133,7 @@ public static void spam(SWIGTYPE_p_int x, SWIGTYPE_p_int y, int z) { ... }
</div>
-<H3><a name="Java_enum_classes">25.4.5 Enum classes</a></H3>
+<H3><a name="Java_enum_classes">26.4.5 Enum classes</a></H3>
<p>
@@ -3140,7 +3142,7 @@ The <a href="#Java_enumerations">Enumerations</a> section discussed these but om
The following sub-sections detail the various types of enum classes that can be generated.
</p>
-<H4><a name="Java_typesafe_enums_classes">25.4.5.1 Typesafe enum classes</a></H4>
+<H4><a name="Java_typesafe_enums_classes">26.4.5.1 Typesafe enum classes</a></H4>
<p>
@@ -3224,7 +3226,7 @@ The <tt>swigValue</tt> method is used for marshalling in the other direction.
The <tt>toString</tt> method is overridden so that the enum name is available.
</p>
-<H4><a name="Java_proper_enums_classes">25.4.5.2 Proper Java enum classes</a></H4>
+<H4><a name="Java_proper_enums_classes">26.4.5.2 Proper Java enum classes</a></H4>
<p>
@@ -3302,7 +3304,7 @@ These needn't be generated if the enum being wrapped does not have any initializ
<a href="#Java_simpler_enum_classes">Simpler Java enums for enums without initializers</a> section describes how typemaps can be used to achieve this.
</p>
-<H4><a name="Java_typeunsafe_enums_classes">25.4.5.3 Type unsafe enum classes</a></H4>
+<H4><a name="Java_typeunsafe_enums_classes">26.4.5.3 Type unsafe enum classes</a></H4>
<p>
@@ -3333,7 +3335,7 @@ public final class Beverage {
</pre>
</div>
-<H3><a name="Java_interfaces">25.4.6 Interfaces</a></H3>
+<H3><a name="Java_interfaces">26.4.6 Interfaces</a></H3>
<p>
@@ -3578,7 +3580,7 @@ typemap which is only used when a class is marked with the <tt>interface</tt> fe
See <a href="Java.html#Java_code_typemaps">Java code typemaps</a> for details.
</p>
-<H2><a name="Java_directors">25.5 Cross language polymorphism using directors</a></H2>
+<H2><a name="Java_directors">26.5 Cross language polymorphism using directors</a></H2>
<p>
@@ -3600,7 +3602,7 @@ The upshot is that C++ classes can be extended in Java and from C++ these extens
Neither C++ code nor Java code needs to know where a particular method is implemented: the combination of proxy classes, director classes, and C wrapper functions transparently takes care of all the cross-language method routing.
</p>
-<H3><a name="Java_enabling_directors">25.5.1 Enabling directors</a></H3>
+<H3><a name="Java_enabling_directors">26.5.1 Enabling directors</a></H3>
<p>
@@ -3626,7 +3628,7 @@ The %feature directive can be applied globally, to specific classes, and to spec
// generate directors for all classes that have virtual methods
%feature("director");
-// generate directors for all virtual methods in class Foo
+// generate directors for the virtual methods in class Foo
%feature("director") Foo;
</pre>
</div>
@@ -3644,7 +3646,7 @@ So for example,
</div>
<p>
-will generate directors for all virtual methods of class Foo except bar().
+will generate directors for the virtual methods of class Foo except bar().
</p>
<p>
@@ -3668,7 +3670,7 @@ public:
</pre>
</div>
-<H3><a name="Java_directors_classes">25.5.2 Director classes</a></H3>
+<H3><a name="Java_directors_classes">26.5.2 Director classes</a></H3>
<p>
@@ -3680,7 +3682,8 @@ The director classes store a pointer to their underlying Java proxy classes.
<p>
For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the original C++ class as the director's base class.
By default, a director class extends all virtual methods in the inheritance chain of its base class (see the preceding section for how to modify this behavior).
-Thus all virtual method calls, whether they originate in C++ or in Java via proxy classes, eventually end up in at the implementation in the director class.
+Virtual methods that have a final specifier are unsurprisingly excluded.
+Thus the virtual method calls, whether they originate in C++ or in Java via proxy classes, eventually end up in at the implementation in the director class.
The job of the director methods is to route these method calls to the appropriate place in the inheritance chain.
By "appropriate place" we mean the method that would have been called if the C++ base class and its Java derived classes were seamlessly integrated.
That seamless integration is exactly what the director classes provide, transparently skipping over all the messy JNI glue code that binds the two languages together.
@@ -3695,7 +3698,7 @@ If the correct implementation is in Java, the Java API is used to call the metho
</p>
-<H3><a name="Java_directors_overhead">25.5.3 Overhead and code bloat</a></H3>
+<H3><a name="Java_directors_overhead">26.5.3 Overhead and code bloat</a></H3>
<p>
@@ -3713,7 +3716,7 @@ This situation can be optimized by selectively enabling director methods (using
</p>
-<H3><a name="Java_directors_example">25.5.4 Simple directors example</a></H3>
+<H3><a name="Java_directors_example">26.5.4 Simple directors example</a></H3>
<p>
@@ -3746,12 +3749,10 @@ Naturally, the SWIG generated C++ code and the generated Java intermediary class
<div class="code">
<pre>
-public class DirectorDerived extends DirectorBase {
- public DirectorDerived() {
- }
-
+class DirectorDerived extends DirectorBase {
+ @Override
public void upcall_method() {
- System.out.println("DirectorDerived::upcall_method() invoked.");
+ System.out.println("DirectorDerived.upcall_method() invoked.");
}
}
</pre>
@@ -3774,11 +3775,11 @@ will result in the following being output:
<div class="code">
<pre>
-DirectorDerived::upcall_method() invoked.
+DirectorDerived.upcall_method() invoked.
</pre>
</div>
-<H3><a name="Java_directors_threading">25.5.5 Director threading issues</a></H3>
+<H3><a name="Java_directors_threading">26.5.5 Director threading issues</a></H3>
<p>
@@ -3798,7 +3799,7 @@ Macros can be defined on the commandline when compiling your C++ code, or altern
</pre>
</div>
-<H3><a name="Java_directors_performance">25.5.6 Director performance tuning</a></H3>
+<H3><a name="Java_directors_performance">26.5.6 Director performance tuning</a></H3>
<p>
@@ -3819,51 +3820,192 @@ However, if all director methods are expected to usually be overridden by Java s
The disadvantage is that invocation of director methods from C++ when Java doesn't actually override the method will require an additional call up into Java and back to C++. As such, this option is only useful when overrides are extremely common and instantiation is frequent enough that its performance is critical.
</p>
-<H3><a name="Java_exceptions_from_directors">25.5.7 Java exceptions from directors</a></H3>
+<H3><a name="Java_exceptions_from_directors">26.5.7 Java exceptions from directors</a></H3>
<p>
With directors routing method calls to Java, and proxies routing them
to C++, the handling of exceptions is an important concern.
-The default behavior from SWIG 3.0
-onwards is to convert the thrown Java exception into a SWIG defined
-<code>DirectorException</code> C++ exception.
-SWIG 2.0 and earlier versions didn't provide any mechanism to handle the Java director method exceptions in C++.
+The default behavior for Java exceptions thrown in a director method overridden in Java is
+to store the thrown Java exception into a SWIG defined
+<code>Swig::DirectorException</code> C++ class exception in the C++ layer and then throw this C++ exception.
</p>
<p>
-Converting Java exceptions into C++ exceptions can be done in two different ways using
+Of course, should this exception be thrown, your C++ code must catch it and handle it before returning back to Java.
+The default generated code <b>does not</b> attempt to handle the C++ exception, but there is a simple way
+to make this all work by catching the C++ exception and extracting the original Java exception by using <tt>%catches</tt> for <tt>Swig::DirectorException</tt>.
+Consider the example shown earlier with a modification to the <tt>upcall_method</tt> Java method to throw a Java exception:
+</p>
+
+<div class="code">
+<pre>
+class DirectorDerived extends DirectorBase {
+ @Override
+ public void upcall_method() {
+ System.out.println("DirectorDerived.upcall_method() invoked.");
+ throw new RuntimeException("There was a problem!");
+ }
+}
+</pre>
+</div>
+
+<p>
+Now, by default, the JVM will abort when <tt>example.callup(director)</tt> is called as the C++
+<tt>Swig::DirectorException</tt> (storing the Java exception) is thrown and not handled by the <tt>callup</tt> method.
+Needless to say this is not very user friendly and so the recommendation is to add the following
+simple <tt>%catches</tt> directive before SWIG parses the <tt>callup</tt> function:
+</p>
+
+<div class="code">
+<pre>
+%catches(Swig::DirectorException) callup;
+</pre>
+</div>
+
+<p>
+Or target all wrapped methods using:
+</p>
+
+<div class="code">
+<pre>
+%catches(Swig::DirectorException);
+</pre>
+</div>
+
+<p>
+This tells SWIG to generate a C++ catch handler using some code from the <a href="Typemaps.html#Typemaps_throws_typemap">throws typemap</a> for <tt>Swig::DirectorException</tt> that SWIG supplies by default, see <a href="SWIGPlus.html#SWIGPlus_catches">Exception handling with %catches</a>.
+This typemap code is written to simply catch the C++ <tt>Swig::DirectorException</tt> class and immediately
+return to Java throwing the original Java exception that it has stored.
+The net result is a stack trace containing the original Java exception including the location that the exception was thrown from.
+</p>
+
+<div class="shell">
+<pre>
+DirectorDerived.upcall_method() invoked.
+Exception in thread "main" java.lang.RuntimeException: There was a problem!
+ at DirectorDerived.upcall_method(runme.java:4)
+ at exampleJNI.SwigDirector_DirectorBase_upcall_method(exampleJNI.java:20)
+ at exampleJNI.callup(Native Method)
+ at example.callup(example.java:12)
+ at runme.main(runme.java:21)
+</pre>
+</div>
+
+<p>
+More on the <tt>Swig::DirectorException</tt> class can be found in the next section which details how to customize the handling of director exceptions.
+</p>
+
+<H4><a name="Java_customizing_director_exceptions">26.5.7.1 Customizing director exceptions</a></H4>
+
+
+<p>
+This section is for advanced customization of director exceptions.
+The recommendation for most users is to use the simple <tt>%catches</tt> directive described above as it should be sufficient for most users needs.
+</p>
+
+<p>
+The conversion of Java exceptions into C++ exceptions can be customized in two different ways using
the <code>director:except</code> <a href="Customization.html#Customization_features">feature</a>.
-In the simplest approach, a code block is attached to each director method to
+In the first approach, a code block is attached to each director method to
handle the mapping of Java exceptions into C++ exceptions.
+The code block is generated just after the call up from the C++ director method into the overloaded method in Java. Its primary function is to check if a Java exception has been thrown and then handle it in C++.
+The example below converts a
+<tt>java.lang.IndexOutOfBoundsException</tt> into a C++ <tt>std::out_of_range</tt> exception and converts a
+user's Java <tt>MyJavaException</tt> into a C++ <tt>MyCppException</tt> exception.
+If the Java exception doesn't match either of these, a fallback <tt>std::runtime_error</tt> C++ exception is thrown.
</p>
<div class="code">
<pre>
-%feature("director:except") MyClass::method(int x) {
+%feature("director:except") MyClass::dirmethod(int x) {
jthrowable $error = jenv-&gt;ExceptionOccurred();
if ($error) {
- jenv-&gt;ExceptionClear();
if (Swig::ExceptionMatches(jenv, $error, "java/lang/IndexOutOfBoundsException"))
throw std::out_of_range(Swig::JavaExceptionMessage(jenv, $error).message());
if (Swig::ExceptionMatches(jenv, $error, "$packagepath/MyJavaException"))
throw MyCppException(Swig::JavaExceptionMessage(jenv, $error).message());
- throw std::runtime_error("Unexpected exception thrown in MyClass::method");
+ throw std::runtime_error("Unexpected exception thrown in MyClass::dirmethod");
}
}
class MyClass {
+public:
/** Throws either a std::out_of_range or MyCppException on error */
- void method(int x);
+ virtual void dirmethod(int x);
+ virtual ~MyClass();
+};
+</pre>
+</div>
+
+<p>
+A few special variables are expanded within the <tt>director:except</tt> feature.
+</p>
+<ul>
+ <li> The special variable <tt>$error</tt> is expanded into a unique variable name (swigerror)
+ and should be used for the assignment of the jthrowable exception that occurred.</li>
+ <li> The special variable <tt>$packagepath</tt> is
+ replaced by the outer package provided for SWIG generation by the -package option. </li>
+ <li> The special variable <tt>$directorthrowshandlers</tt> is not shown above, but is replaced
+ by applicable "directorthrows" typemap contents (covered later in this section). </li>
+ <li> The special variable <tt>$null</tt> is not shown above, but is replaced
+ by a suitable default constructed object for returning from the director method (or nothing if
+ the director method has a void return).
+ </li>
+</ul>
+
+<p>
+Utility functions/classes in director.swg are provided to aid the exception conversion as follows:
+</p>
+
+<div class="code">
+<pre>
+namespace Swig {
+
+ // Helper method to determine if a Java throwable matches a particular Java class type
+ // Note side effect of clearing any pending exceptions
+ bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname);
+
+ // Helper class to extract the exception message from a Java throwable
+ class JavaExceptionMessage {
+ public:
+ JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable);
+
+ // Return a C string of the exception message in the jthrowable passed in the constructor
+ // If no message is available, null_string is return instead
+ const char *message(const char *null_string =
+ "Could not get exception message in JavaExceptionMessage") const;
+ };
+
+ // 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);
+
+ // More general constructor for handling as a java.lang.RuntimeException
+ DirectorException(const char *msg);
+
+ // Return exception message extracted from the Java throwable
+ const char *what() const throw();
+
+ // 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 throwException(JNIEnv *jenv) const;
+
+ // Create and throw the DirectorException
+ static void raise(JNIEnv *jenv, jthrowable throwable) {
+ throw DirectorException(jenv, throwable);
+ }
+ };
+
}
</pre>
</div>
<p>
-This approach allows a flexible mapping of Java exceptions thrown by director methods into
-C++ exceptions expected by a C++ caller. There
-need not be any C++ <em>exception specifications</em> on the C++ method. The
-utility function <code>Swig::ExceptionMatches</code>
+The utility function <code>Swig::ExceptionMatches</code>
and class <code>Swig::JavaExceptionMessage</code> are provided to simplify
writing code for wrappers that use the <code>director:except</code> feature. The
function <code>Swig::ExceptionMatches</code> matches the type of the
@@ -3871,13 +4013,10 @@ function <code>Swig::ExceptionMatches</code> matches the type of the
name, such as <code>"java/lang/IOError"</code>. If the throwable class is the same
type, or derives from the given type, <code>Swig::ExceptionMatches</code> will return true. Care must be taken to
provide the correct fully qualified name, since for wrapped exceptions the
-generated proxy class will have additional package qualification, depending on
+generated proxy class will have an additional package qualification, depending on
the '-package' argument and use of the <a href="#Java_namespaces">nspace
- feature</a>. The special variable <code>$error</code> is expanded by SWIG into a unique variable name and
-should be used for the
-assignment of the exception that occurred. The special variable <code>$packagepath</code> is
-replaced by the outer package provided for SWIG generation by the -package
-option. The utility class <code>Swig::JavaExceptionMessage</code> is a holder
+ feature</a>.
+The utility class <code>Swig::JavaExceptionMessage</code> is a holder
providing access to the message from the thrown Java exception.
The <code>message()</code> method returns the exception message as a <code>const char *</code>,
which is only valid during the lifetime of the holder. Any code using this message
@@ -3885,20 +4024,27 @@ needs to copy it, for example into a std::string or a newly constructed C++ exce
</p>
<p>
-Using the above approach to
+Using the first approach above to
write handlers for a large number of methods will require
-repetitive duplication of the <code>director:except</code> feature code.
-To mitigate this, an alternative approach is provided via typemaps in a
-fashion analagous to
-the <a href="Typemaps.html#throws_typemap">"throws" typemap.</a> The
-"throws" typemap provides an approach to automatically map all the C++
+repetitive duplication of the <code>director:except</code> feature code
+for each director method.
+To mitigate this, a second approach is provided via typemaps in a
+fashion analogous to
+the <a href="Typemaps.html#throws_typemap">"throws" typemap</a>.
+The "throws" typemap provides a way to map all the C++
exceptions listed in a method's defined exceptions (either from
a C++ <em>exception specification</em> or a <code>%catches</code>
feature) into Java exceptions.
The "directorthrows" typemap provides the inverse mapping and should contain
code to convert a suitably matching Java exception into a C++ exception.
+Only use this typemap if you wish to write custom conversions of Java exceptions into C++ exceptions
+and apply them to many different methods.
+The default handling which uses the <code>Swig::DirectorException</code> class should otherwise meet your needs.
+</p>
+
+<p>
The example below converts a Java <code>java.lang.IndexOutOfBoundsException</code> exception
-to the typemap's type, that is <code>std::out_of_range</code>:
+to the typemap's type, that is a <code>std::out_of_range</code> C++ exception:
<div class="code">
<pre>
@@ -3913,7 +4059,7 @@ to the typemap's type, that is <code>std::out_of_range</code>:
<p>
The "directorthrows" typemap is then used in conjunction with the
<code>director:except</code> feature if the <code>$directorthrowshandlers</code> special variable
-is used in the feature code. Consider the following, which also happens to be the default:
+is used in the code block. Consider the following, which also happens to be the default:
</p>
<div class="code">
@@ -3921,31 +4067,41 @@ is used in the feature code. Consider the following, which also happens to be th
%feature("director:except") %{
jthrowable $error = jenv-&gt;ExceptionOccurred();
if ($error) {
- jenv-&gt;ExceptionClear();
$directorthrowshandlers
- throw Swig::DirectorException(jenv, $error);
+ Swig::DirectorException::raise(jenv, $error);
}
%}
</pre>
</div>
-<p>The code generated using the <code>director:except</code> feature
-replaces the <code>$directorthrowshandlers</code> special variable with the code in
-the "directorthrows" typemaps, for each and every exception defined for the method.
-The possible exceptions can be defined either with a C++ exception
+<p>
+where <tt>Swig::DirectorException::raise</tt> is the helper method to throw a C++ <tt>Swig::DirectorException</tt>, see above.
+The code generated from the <code>director:except</code> feature
+has the <code>$directorthrowshandlers</code> special variable replaced with the code in
+the relevant "directorthrows" typemaps, for each and every exception defined for the method.
+The relevant exceptions can be defined either with a C++ exception
specification or <code>%catches</code> as described for the
<a href="Typemaps.html#throws_typemap">"throws" typemap</a>.
</p>
<p>
-Consider the following director method:
+Let's try and put all this together by considering the following director method:
</p>
<div class="code">
<pre>
- ...
+struct X {
virtual void doSomething(int index) throw (std::out_of_range);
...
+};
+
+OR
+
+%catches(std::out_of_range) X::doSomething;
+struct X {
+ virtual void doSomething(int index);
+ ...
+};
</pre>
</div>
@@ -3958,12 +4114,10 @@ the resulting code generated in the director method after calling up to Java wil
<pre>
jthrowable swigerror = jenv-&gt;ExceptionOccurred();
if (swigerror) {
- jenv-&gt;ExceptionClear();
if (Swig::ExceptionMatches(jenv, swigerror, "java/lang/IndexOutOfBoundsException")) {
throw std::out_of_range(Swig::JavaExceptionMessage(jenv, swigerror).message());
}
-
- throw Swig::DirectorException(jenv, swigerror);
+ Swig::DirectorException::raise(jenv, swigerror);
}
</pre>
</div>
@@ -3971,7 +4125,7 @@ if (swigerror) {
<p><em>
Note: Beware of using exception specifications as the SWIG director methods
will be generated with the same exception specifications and if the
-director method throws an exception that is not specified it is likely
+director method throws an exception that is not specified in the exception specifications list it is likely
to terminate your program. See the C++ standard for more details.
Using the %catches feature instead to define the handled exceptions does not suffer
this potential fate.
@@ -3979,8 +4133,9 @@ this potential fate.
<p>Because the default code generation maps any unhandled Java exceptions to
<code>Swig::DirectorException</code>, any director methods that have exception
-specifications may cause program termination. To simply ignore
-unexpected exceptions, the default handling can be changed with:
+specifications may cause program termination as this exception class won't be in the exception specifications list.
+You can avoid throwing <tt>Swig::DirectorException</tt> by changing the default handling for all methods by adding a <tt>director:except</tt> feature without any method name.
+For example, you can just ignore them:
</p>
<div class="code">
@@ -3988,8 +4143,8 @@ unexpected exceptions, the default handling can be changed with:
%feature("director:except") %{
jthrowable $error = jenv-&gt;ExceptionOccurred();
if ($error) {
- jenv-&gt;ExceptionClear();
$directorthrowshandlers
+ jenv-&gt;ExceptionClear();
return $null; // exception is ignored
}
%}
@@ -3999,7 +4154,7 @@ unexpected exceptions, the default handling can be changed with:
<p>Alternatively an exception compatible with the existing director
method exception specifications can be thrown. Assuming that all
methods allow std::runtime_error to be thrown,
-the <code>return&nbsp;$null;</code> could be changed to:
+the <code>return&nbsp;$null</code> line above could be changed to:
</p>
<div class="code">
@@ -4009,125 +4164,297 @@ the <code>return&nbsp;$null;</code> could be changed to:
</div>
<p>In more complex situations, a separate <code>director:except</code> feature
-may need to be attached to specific methods.
+may need to be attached to specific methods by providing a method name to the <tt>director:except</tt> feature.
</p>
-<p>Below is a complete example demonstrating the use
-of the "directorthrows" typemaps. In this example, a
-generic "directorthrows" typemap is appropriate for all three exceptions - all
-take single string constructors. If the exceptions had different constructors,
-it would be necessary to have separate typemaps for each exception type.
+<p>This is all no doubt quite hard to follow without seeing a full example and some code.
+Below is a complete example demonstrating the use
+of most of the exception customizations one can use, that is,
+"directorthrows" and "throws" typemaps, %exception and %catches.
+See the <a href="#Java_exception_handling">Exception handling with %exception and %javaexception</a>
+section for more on converting C++ exceptions to Java exceptions.
+The example also has a user defined C++ exception class called <tt>MyNS::MyException</tt> and this is wrapped as a Java exception.
+The director class being wrapped is <tt>MyClass</tt> and the director method is called <tt>MyClass::dirmethod</tt>.
+A number of <tt>std::cout</tt> calls have been added to help understand code flow.
+You can copy the code below into an interface file and run SWIG on it and examine the generated code.
-<!-- All the DEFINE_ and DECLARE_EXCEPTIONS CAN BE OMITTED to make
- this more succinct. They are included to make this a complete
- example interface that could be generated and built. -->
<div class="code">
<pre>
%module(directors="1") example
%{
- #include &lt;string&gt;
#include &lt;stdexcept&gt;
+ #include &lt;iostream&gt;
%}
-// Define exceptions in header section using std::runtime_error
-%define DEFINE_EXCEPTION(NAME)
-%{
- namespace MyNS {
- struct NAME : public std::runtime_error { NAME(const std::string &amp;what) : runtime_error(what) {} };
+// Generic catch handler for all wrapped methods
+%exception %{
+ try {
+ $action
+ } catch (const std::exception &amp;e) {
+ std::cout &lt;&lt; "Generic std::exception catch handler" &lt;&lt; std::endl;
+ jclass clazz = jenv-&gt;FindClass("java/lang/RuntimeException");
+ jenv-&gt;ThrowNew(clazz, e.what());
+ return $null;
}
%}
-%enddef
-// Expose C++ exceptions as Java Exceptions by changing the Java base class and providing a getMessage()
-%define DECLARE_EXCEPTION(NAME)
-%typemap(javabase) MyNS::NAME "java.lang.Exception";
-%rename(getMessage) MyNS::NAME::what;
+// Expose C++ exception as a Java Exception by changing the Java base class and providing a getMessage()
+%typemap(javabase) MyNS::MyException "java.lang.RuntimeException";
+%rename(getMessage) MyNS::MyException::whatsup;
+
+%inline %{
namespace MyNS {
- struct NAME {
- NAME(const std::string&amp; what);
- const char * what();
+ class MyException {
+ std::string msg;
+ public:
+ MyException(const char *msg) : msg(msg) {}
+ const char * whatsup() const { return msg.c_str(); }
};
}
-%enddef
-
-DEFINE_EXCEPTION(ExceptionA)
-DEFINE_EXCEPTION(ExceptionB)
-DEFINE_EXCEPTION(Unexpected)
-
-// Mark three methods to map director thrown exceptions.
-%feature("director:except") MyClass::meth1(int);
-%feature("director:except") MyClass::meth2;
-%feature("director:except") meth3;
+%}
-%typemap(directorthrows) MyNS::ExceptionA, MyNS::ExceptionB, MyNS::Unexpected %{
- if (Swig::ExceptionMatches(jenv, $error, "$packagepath/$javaclassname"))
+%typemap(directorthrows) MyNS::MyException %{
+ if (Swig::ExceptionMatches(jenv, $error, "$packagepath/MyException")) {
+ std::cout &lt;&lt; "$1_type exception matched (directorthrows typemap)" &lt;&lt; std::endl;
throw $1_type(Swig::JavaExceptionMessage(jenv, $error).message());
+ }
%}
-DECLARE_EXCEPTION(ExceptionA)
-DECLARE_EXCEPTION(ExceptionB)
-DECLARE_EXCEPTION(Unexpected)
+%typemap(throws) MyNS::MyException %{
+ std::cout &lt;&lt; "$1_type caught (throws typemap)" &lt;&lt; std::endl;
+ jclass excep = jenv-&gt;FindClass("MyException");
+ if (excep) {
+ std::cout &lt;&lt; "$1_type class found (throws typemap)" &lt;&lt; std::endl;
+ jenv-&gt;ThrowNew(excep, $1.whatsup());
+ }
+ return $null;
+%}
-%catches(MyNS::ExceptionA, MyNS::ExceptionB, MyNS::Unexpected) MyClass::meth2();
+// These are the exceptions that the director method MyClass::dirmethod will have catch handlers for.
+// Note that this is also a virtual method / director method and the C++ exceptions listed can be
+// thrown after converting them from Java exceptions.
+%catches(MyNS::MyException, Swig::DirectorException) MyClass::dirmethod;
-%inline {
- class MyClass {
- public:
- virtual void meth1(int x) throw(MyNS::ExceptionA, MyNS::ExceptionB) = 0;
- virtual void meth2() = 0; /* throws MyNS::ExceptionA, MyNS::ExceptionB, MyNS::Unexpected */
- virtual void meth3(float x) throw(MyNS::Unexpected) = 0;
- virtual ~MyClass() {}
- };
+// These are the exceptions that call_dirmethod C++ wrapper will have catch handlers for.
+// Note that this is not a virtual method, hence not a director method.
+%catches(MyNS::MyException, Swig::DirectorException) call_dirmethod;
+
+%feature("director") MyClass;
+
+%feature("director:except") MyClass::dirmethod(int x) {
+ jthrowable $error = jenv-&gt;ExceptionOccurred();
+ if ($error) {
+ std::cout &lt;&lt; "Upcall finished, an exception was thrown in Java" &lt;&lt; std::endl;
+ $directorthrowshandlers
+ std::cout &lt;&lt; "Upcall finished, no exception conversion, throwing DirectorException" &lt;&lt; std::endl;
+ Swig::DirectorException::raise(jenv, $error);
+ }
}
+
+%inline %{
+class MyClass {
+public:
+ /** Throws either a std::out_of_range or MyException on error */
+ virtual void dirmethod(int x) {
+ if (x &lt;= 0)
+ throw std::out_of_range("MyClass::dirmethod index is out of range");
+ else if (x == 1)
+ throw MyNS::MyException("MyClass::dirmethod some problem!");
+ }
+ virtual ~MyClass() {}
+ static void call_dirmethod(MyClass&amp; c, int x) {
+ return c.dirmethod(x);
+ }
+};
+%}
</pre>
</div>
<p>
-In this case the three different "directorthrows" typemaps will be used
-to generate the three different exception handlers for
-<code>meth1</code>, <code>meth2</code> and <code>meth3</code>. The generated
-handlers will have "if" blocks for each exception type specified, in
-the exception specification or <code>%catches</code> feature.
+The generated code for the <tt>call_dirmethod</tt> wrapper contains the various exception handlers.
+The outer exception handler is from the <tt>%exception</tt> directive and the others
+are from the "throws" typemaps.
</p>
-<p>Note that the "directorthrows" typemaps are important
-only if it is important for the the exceptions passed through the C++
-layer to be mapped to distinct C++ exceptions. If director methods
-are being called by C++ code that is itself wrapped in a
-SWIG generated Java wrapper and access is always through this wrapper,
-the default <code>Swig::DirectorException</code> class provides enough information
-to reconstruct the original exception. In this case removing the
-<code>$directorthrowshandlers</code> special variable from the
-default <code>director:except</code> feature and simply always
-throwing a <code>Swig::DirectorException</code> will achieve the desired result.
-Along with this a generic exception feature is added to convert any
-caught <code>Swig::DirectorException</code>s back into the underlying
-Java exceptions via the <code>Swig::DirectorException::raiseJavaException</code> method,
-as demonstrated with <code>%javaexception</code> below:
+<div class="code">
+<pre>
+SWIGEXPORT void JNICALL Java_exampleJNI_MyClass_1call_1dirmethod(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
+ ...
+ try {
+ try {
+ MyClass::call_dirmethod(*arg1,arg2);
+ } catch(MyNS::MyException &amp;_e) {
+ std::cout &lt;&lt; "MyNS::MyException caught (throws typemap)" &lt;&lt; std::endl;
+ jclass excep = jenv-&gt;FindClass("MyException");
+ if (excep) {
+ std::cout &lt;&lt; "MyNS::MyException class found (throws typemap)" &lt;&lt; std::endl;
+ jenv-&gt;ThrowNew(excep, (&amp;_e)-&gt;whatsup());
+ }
+ return ;
+
+ } catch(Swig::DirectorException &amp;_e) {
+ (&amp;_e)-&gt;throwException(jenv);
+ return ;
+ }
+ } catch (const std::exception &amp;e) {
+ std::cout &lt;&lt; "Generic std::exception catch handler" &lt;&lt; std::endl;
+ jclass clazz = jenv-&gt;FindClass("java/lang/RuntimeException");
+ jenv-&gt;ThrowNew(clazz, e.what());
+ return ;
+ }
+</pre>
+</div>
+
+<p>
+The director method calling up to Java contains the exception handling code from the "directorthrows" typemaps and <tt>director:except</tt> feature.
</p>
<div class="code">
<pre>
-%javaexception("Exception") MyClass::myMethod %{
- try {
- $action
- } catch (Swig::DirectorException &amp;e) {
- // raise/throw the Java exception that originally caused the DirectorException
- e.raiseJavaException(jenv);
- return $null;
+void SwigDirector_MyClass::dirmethod(int x) {
+ ... [call up to Java using CallStaticVoidMethod]
+ jthrowable swigerror = jenv-&gt;ExceptionOccurred();
+ if (swigerror) {
+ std::cout &lt;&lt; "Upcall finished, an exception was thrown in Java" &lt;&lt; std::endl;
+
+ if (Swig::ExceptionMatches(jenv, swigerror, "MyException")) {
+ std::cout &lt;&lt; "MyNS::MyException exception matched (directorthrows typemap)" &lt;&lt; std::endl;
+ throw MyNS::MyException(Swig::JavaExceptionMessage(jenv, swigerror).message());
+ }
+
+ std::cout &lt;&lt; "Upcall finished, no exception conversion, throwing DirectorException" &lt;&lt; std::endl;
+ Swig::DirectorException::raise(jenv, swigerror);
+ }
+</pre>
+</div>
+
+<p>
+Let's use the following Java class to override the director method.
+</p>
+
+<div class="code">
+<pre>
+class DerivedClass extends MyClass {
+ @Override
+ public void dirmethod(int x) {
+ if (x &lt; 0)
+ throw new IndexOutOfBoundsException("Index is negative");
+ else if (x == 0)
+ throw new MyException("MyException: bad dirmethod");
}
-%}
+}
+public class runme {
+ public static void main(String argv[]) {
+ System.loadLibrary("example");
+ ... code snippets shown below ...
+ }
+}
</pre>
</div>
<p>
-See the <a href="#Java_exception_handling">Exception handling with %exception and %javaexception</a>
-section for more on converting C++ exceptions to Java exceptions.
+Consider the output using the Java code in the four slightly different scenarios below.
+</p>
+
+<p>
+1. Non-director C++ class is used, thus, no upcall to a Java director method is made.
+A <tt>std::out_of_range</tt> exception is thrown, which is derived from <tt>std::exception</tt>,
+and hence caught by the generic exception handler in the <tt>call_dirmethod</tt> wrapper.
+The Java code snippet and resulting output is:
+</p>
+
+
+<div class="code">
+<pre>
+MyClass.call_dirmethod(new MyClass(), 0);
+</pre>
+</div>
+
+<div class="shell">
+<pre>
+Generic std::exception catch handler
+Exception in thread "main" java.lang.RuntimeException: MyClass::dirmethod index is out of range
+ at exampleJNI.MyClass_call_dirmethod(Native Method)
+ at MyClass.call_dirmethod(MyClass.java:57)
+ at runme.main(runme.java:14)
+</pre>
+</div>
+
+<p>
+2. Non-director C++ class again but this time the <tt>MyNS::MyException</tt> class is thrown and caught:
+</p>
+
+<div class="code">
+<pre>
+MyClass.call_dirmethod(new MyClass(), 1);
+</pre>
+</div>
+
+<div class="shell">
+<pre>
+MyNS::MyException caught (throws typemap)
+MyNS::MyException class found (throws typemap)
+Exception in thread "main" MyException: MyClass::dirmethod some problem!
+ at exampleJNI.MyClass_call_dirmethod(Native Method)
+ at MyClass.call_dirmethod(MyClass.java:57)
+ at runme.main(runme.java:15)
+</pre>
+</div>
+
+<p>
+3. The <tt>DerivedClass</tt> director class is used so the upcall to Java occurs, but it throws
+a Java <tt>MyException</tt>, which gets converted into a C++ <tt>MyNS::MyException</tt>, then caught and converted back
+into a Java <tt>MyException</tt>:
+</p>
+
+<div class="code">
+<pre>
+MyClass.call_dirmethod(new DerivedClass(), 0);
+</pre>
+</div>
+
+<div class="shell">
+<pre>
+Upcall finished, an exception was thrown in Java
+MyNS::MyException exception matched (directorthrows typemap)
+MyNS::MyException caught (throws typemap)
+MyNS::MyException class found (throws typemap)
+Exception in thread "main" MyException: MyException: bad dirmethod
+ at exampleJNI.MyClass_call_dirmethod(Native Method)
+ at MyClass.call_dirmethod(MyClass.java:57)
+ at runme.main(runme.java:16)
+</pre>
+</div>
+
+<p>
+4. The director class is used again, but this time the director method throws a Java <tt>IndexOutOfBoundsException</tt> exception which is converted into a C++ <tt>Swig::DirectorException</tt>, thrown and caught again.
+This time the original Java exception is extracted from the <tt>Swig::DirectorException</tt> and rethrown.
+Note that this approach keeps the stack trace information of the original exception, so it has the exact location of where the <tt>IndexOutOfBoundsException</tt> exception was thrown.
+This is arguably an improvement over the approach above that converts from a Java excepton to C++ exception and then back to a new Java exception, losing the location of the original exception.
</p>
-<H2><a name="Java_allprotected">25.6 Accessing protected members</a></H2>
+<div class="code">
+<pre>
+MyClass.call_dirmethod(new DerivedClass(), -1);
+</pre>
+</div>
+
+<div class="shell">
+<pre>
+Upcall finished, an exception was thrown in Java
+Upcall finished, no exception conversion, throwing DirectorException
+Exception in thread "main" java.lang.IndexOutOfBoundsException: Index is negative
+ at DerivedClass.dirmethod(runme.java:5)
+ at exampleJNI.SwigDirector_MyClass_dirmethod(exampleJNI.java:23)
+ at exampleJNI.MyClass_call_dirmethod(Native Method)
+ at MyClass.call_dirmethod(MyClass.java:57)
+ at runme.main(runme.java:17)
+</pre>
+</div>
+
+<H2><a name="Java_allprotected">26.6 Accessing protected members</a></H2>
<p>
@@ -4223,7 +4550,7 @@ class MyProtectedBase extends ProtectedBase
-<H2><a name="Java_common_customization">25.7 Common customization features</a></H2>
+<H2><a name="Java_common_customization">26.7 Common customization features</a></H2>
<p>
@@ -4235,7 +4562,7 @@ be awkward. This section describes some common SWIG features that are used
to improve the interface to existing C/C++ code.
</p>
-<H3><a name="Java_helper_functions">25.7.1 C/C++ helper functions</a></H3>
+<H3><a name="Java_helper_functions">26.7.1 C/C++ helper functions</a></H3>
<p>
@@ -4301,7 +4628,7 @@ hard to implement. It is possible to improve on this using Java code, typemaps,
customization features as covered in later sections, but sometimes helper functions are a quick and easy solution to difficult cases.
</p>
-<H3><a name="Java_class_extension">25.7.2 Class extension with %extend</a></H3>
+<H3><a name="Java_class_extension">26.7.2 Class extension with %extend</a></H3>
<p>
@@ -4323,16 +4650,16 @@ struct Vector {
%extend Vector {
char *toString() {
- static char tmp[1024];
- sprintf(tmp, "Vector(%g, %g, %g)", $self-&gt;x, $self-&gt;y, $self-&gt;z);
- return tmp;
+ static char tmp[1024];
+ sprintf(tmp, "Vector(%g, %g, %g)", $self-&gt;x, $self-&gt;y, $self-&gt;z);
+ return tmp;
}
Vector(double x, double y, double z) {
- Vector *v = (Vector *) malloc(sizeof(Vector));
- v-&gt;x = x;
- v-&gt;y = y;
- v-&gt;z = z;
- return v;
+ Vector *v = (Vector *) malloc(sizeof(Vector));
+ v-&gt;x = x;
+ v-&gt;y = y;
+ v-&gt;z = z;
+ return v;
}
};
</pre>
@@ -4364,7 +4691,7 @@ Vector(2, 3, 4)
in any way---the extensions only show up in the Java interface.
</p>
-<H3><a name="Java_proxycode">25.7.3 Class extension with %proxycode</a></H3>
+<H3><a name="Java_proxycode">26.7.3 Class extension with %proxycode</a></H3>
<p>
@@ -4501,7 +4828,7 @@ public class ValueUnsignedInt {
</pre>
</div>
-<H3><a name="Java_exception_handling">25.7.4 Exception handling with %exception and %javaexception</a></H3>
+<H3><a name="Java_exception_handling">26.7.4 Exception handling with %exception and %javaexception</a></H3>
<p>
@@ -4660,7 +4987,7 @@ to raise exceptions. See the <a href="Library.html#Library">SWIG Library</a> ch
The typemap example <a href="#Java_exception_typemap">Handling C++ exception specifications as Java exceptions</a> provides further exception handling capabilities.
</p>
-<H3><a name="Java_method_access">25.7.5 Method access with %javamethodmodifiers</a></H3>
+<H3><a name="Java_method_access">26.7.5 Method access with %javamethodmodifiers</a></H3>
<p>
@@ -4686,7 +5013,7 @@ protected static void protect_me() {
</pre>
</div>
-<H2><a name="Java_tips_techniques">25.8 Tips and techniques</a></H2>
+<H2><a name="Java_tips_techniques">26.8 Tips and techniques</a></H2>
<p>
@@ -4696,7 +5023,7 @@ strings and arrays. This chapter discusses the common techniques for
solving these problems.
</p>
-<H3><a name="Java_input_output_parameters">25.8.1 Input and output parameters using primitive pointers and references</a></H3>
+<H3><a name="Java_input_output_parameters">26.8.1 Input and output parameters using primitive pointers and references</a></H3>
<p>
@@ -4870,7 +5197,7 @@ void foo(Bar *OUTPUT);
will not have the intended effect since <tt>typemaps.i</tt> does not define an OUTPUT rule for <tt>Bar</tt>.
</p>
-<H3><a name="Java_simple_pointers">25.8.2 Simple pointers</a></H3>
+<H3><a name="Java_simple_pointers">26.8.2 Simple pointers</a></H3>
<p>
@@ -4936,7 +5263,7 @@ System.out.println("3 + 4 = " + result);
See the <a href="Library.html#Library">SWIG Library</a> chapter for further details.
</p>
-<H3><a name="Java_c_arrays">25.8.3 Wrapping C arrays with Java arrays</a></H3>
+<H3><a name="Java_c_arrays">26.8.3 Wrapping C arrays with Java arrays</a></H3>
<p>
@@ -5003,7 +5330,7 @@ Please be aware that the typemaps in this library are not efficient as all the e
There is an alternative approach using the SWIG array library and this is covered in the next section.
</p>
-<H3><a name="Java_unbounded_c_arrays">25.8.4 Unbounded C Arrays</a></H3>
+<H3><a name="Java_unbounded_c_arrays">26.8.4 Unbounded C Arrays</a></H3>
<p>
@@ -5148,7 +5475,7 @@ well suited for applications in which you need to create buffers,
package binary data, etc.
</p>
-<H3><a name="Java_binary_char">25.8.5 Binary data vs Strings</a></H3>
+<H3><a name="Java_binary_char">26.8.5 Binary data vs Strings</a></H3>
<p>
@@ -5192,7 +5519,7 @@ len: 5 data: 68 69 0 6a 6b
</pre></div>
-<H3><a name="Java_heap_allocations">25.8.6 Overriding new and delete to allocate from Java heap</a></H3>
+<H3><a name="Java_heap_allocations">26.8.6 Overriding new and delete to allocate from Java heap</a></H3>
<p>
@@ -5266,7 +5593,7 @@ void * operator new(size_t t) {
throw bad_alloc();
pJalloc-&gt;ref = 0;
return static_cast&lt;void *&gt;(
- static_cast&lt;char *&gt;(static_cast&lt;void *&gt;(pJalloc)) + sizeof(Jalloc));
+ static_cast&lt;char *&gt;(static_cast&lt;void *&gt;(pJalloc)) + sizeof(Jalloc));
}
}
@@ -5309,7 +5636,7 @@ model and use these functions in place of malloc and free in your own
code.
</p>
-<H2><a name="Java_typemaps">25.9 Java typemaps</a></H2>
+<H2><a name="Java_typemaps">26.9 Java typemaps</a></H2>
<p>
@@ -5317,7 +5644,7 @@ This section describes how you can modify SWIG's default wrapping behavior
for various C/C++ datatypes using the <tt>%typemap</tt> directive.
You are advised to be familiar with the material in the "<a href="Typemaps.html#Typemaps">Typemaps</a>" chapter.
While not absolutely essential knowledge, this section assumes some familiarity with the Java Native Interface (JNI).
-JNI documentation can be consulted either online at <a href="http://java.sun.com">Sun's Java web site</a> or from a good JNI book.
+JNI documentation can be consulted either online at <a href="https://www.oracle.com/technetwork/java/index.html">the Java web site</a> or from a good JNI book.
The following two books are recommended:</p>
<ul>
@@ -5330,7 +5657,7 @@ Before proceeding, it should be stressed that typemaps are not a required
part of using SWIG---the default wrapping behavior is enough in most cases.
Typemaps are only used if you want to change some aspect of the generated code.
-<H3><a name="Java_default_primitive_type_mappings">25.9.1 Default primitive type mappings</a></H3>
+<H3><a name="Java_default_primitive_type_mappings">26.9.1 Default primitive type mappings</a></H3>
<p>
@@ -5482,7 +5809,7 @@ However, the mappings allow the full range of values for each C type from Java.
</p>
-<H3><a name="Java_default_non_primitive_typemaps">25.9.2 Default typemaps for non-primitive types</a></H3>
+<H3><a name="Java_default_non_primitive_typemaps">26.9.2 Default typemaps for non-primitive types</a></H3>
<p>
@@ -5497,7 +5824,7 @@ So in summary, the C/C++ pointer to non-primitive types is cast into the 64 bit
The Java type is either the proxy class or type wrapper class.
</p>
-<H3><a name="Java_jvm64">25.9.3 Sixty four bit JVMs</a></H3>
+<H3><a name="Java_jvm64">26.9.3 Sixty four bit JVMs</a></H3>
<p>
@@ -5510,7 +5837,7 @@ Unfortunately it won't of course hold true for JNI code.
</p>
-<H3><a name="Java_what_is_typemap">25.9.4 What is a typemap?</a></H3>
+<H3><a name="Java_what_is_typemap">26.9.4 What is a typemap?</a></H3>
<p>
@@ -5633,7 +5960,7 @@ int c = example.count('e', "Hello World");
</pre>
</div>
-<H3><a name="Java_typemaps_c_to_java_types">25.9.5 Typemaps for mapping C/C++ types to Java types</a></H3>
+<H3><a name="Java_typemaps_c_to_java_types">26.9.5 Typemaps for mapping C/C++ types to Java types</a></H3>
<p>
@@ -5682,6 +6009,17 @@ The most important of these implement the mapping of C/C++ types to Java types:
</tr>
<tr>
+<td>jboxtype</td>
+<td>Java boxed type.
+ These are Java code typemaps to provide the Java boxed type, such as, <tt>Integer</tt> for C type <tt>int</tt>.
+ As autoboxing is only relevant to the Java primitive types, these are only provided for the
+ C types that map to Java primitive types.
+ This typemap is usually only used by C++ STL container wrappers that are wrapped by Java generic
+ types as the boxed type must be used instead of the unboxed/primitive type when declaring a Java generic type.
+ </td>
+</tr>
+
+<tr>
<td>javadirectorin</td>
<td>Conversion from jtype to jstype for director methods.
These are Java code typemaps which transform the type used in the Java intermediary JNI class (as specified in the "jtype" typemap) to
@@ -5902,7 +6240,7 @@ These are listed below:
</table>
-<H3><a name="Java_typemap_attributes">25.9.6 Java typemap attributes</a></H3>
+<H3><a name="Java_typemap_attributes">26.9.6 Java typemap attributes</a></H3>
<p>
@@ -5948,7 +6286,7 @@ The "javain" typemap has the optional 'pre', 'post' and 'pgcppname' attributes.
Note that when the 'pre' or 'post' attributes are specified and the associated type is used in a constructor, a constructor helper function is generated. This is necessary as the Java proxy constructor wrapper makes a call to a support constructor using a <i>this</i> call. In Java the <i>this</i> call must be the first statement in the constructor body. The constructor body thus calls the helper function and the helper function instead makes the JNI call, ensuring the 'pre' code is called before the JNI call is made. There is a <a href="#Java_date_marshalling">Date marshalling</a> example showing 'pre', 'post' and 'pgcppname' attributes in action.
</p>
-<H3><a name="Java_special_variables">25.9.7 Java special variables</a></H3>
+<H3><a name="Java_special_variables">26.9.7 Java special variables</a></H3>
<p>
@@ -6130,7 +6468,7 @@ in that it is not fully qualified with the package name when using the
<a href="SWIGPlus.html#SWIGPlus_nspace">nspace feature</a>.
</p>
-<H3><a name="Java_typemaps_for_c_and_cpp">25.9.8 Typemaps for both C and C++ compilation</a></H3>
+<H3><a name="Java_typemaps_for_c_and_cpp">26.9.8 Typemaps for both C and C++ compilation</a></H3>
<p>
@@ -6167,7 +6505,7 @@ If you do not intend your code to be targeting both C and C++ then your typemaps
</p>
-<H3><a name="Java_code_typemaps">25.9.9 Java code typemaps</a></H3>
+<H3><a name="Java_code_typemaps">26.9.9 Java code typemaps</a></H3>
<p>
@@ -6213,7 +6551,7 @@ As there can only be one "javacode" typemap per class, also consider using the
and offers nearly identical functionality.
</div>
-<p><tt>%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized")</tt> <br></p>
+<p><tt>%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized", parameters="")</tt> <br></p>
<div class="indent">
destructor wrapper - the <tt>delete()</tt> method (proxy classes only),
used for all proxy classes except those which have a base class
@@ -6222,9 +6560,12 @@ used for all proxy classes except those which have a base class
<br>
Note that the <tt>delete()</tt> method name is configurable and is specified by the <tt>methodname</tt> attribute.
The method modifiers are also configurable via the <tt>methodmodifiers</tt> attribute.
+If a <tt>%javamethodmodifiers</tt> is attached to the class' destructor,
+it will be used in preference to the <tt>methodmodifiers</tt> typemap attribute for the class.
+The <tt>delete</tt> method's parameters declaration can be provided in the optional <tt>parameters</tt> typemap attribute.
</div>
-<p><tt>%typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized")</tt></p>
+<p><tt>%typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized", parameters="")</tt></p>
<div class="indent">
destructor wrapper - the <tt>delete()</tt> method (proxy classes only),
same as "javadestruct" but only used for derived proxy classes
@@ -6233,6 +6574,9 @@ same as "javadestruct" but only used for derived proxy classes
<br>
Note that the <tt>delete()</tt> method name is configurable and is specified by the <tt>methodname</tt> attribute.
The method modifiers are also configurable via the <tt>methodmodifiers</tt> attribute.
+If a <tt>%javamethodmodifiers</tt> is attached to the class' destructor,
+it will be used in preference to the <tt>methodmodifiers</tt> typemap attribute for the class.
+The <tt>delete</tt> method's parameters declaration can be provided in the optional <tt>parameters</tt> typemap attribute.
</div>
<p><tt>%typemap(javaimports)</tt></p>
@@ -6459,7 +6803,7 @@ to make the method and constructor public:
</pre>
</div>
-<H3><a name="Java_directors_typemaps">25.9.10 Director specific typemaps</a></H3>
+<H3><a name="Java_directors_typemaps">26.9.10 Director specific typemaps</a></H3>
<p>
@@ -6736,7 +7080,7 @@ The basic strategy here is to provide a default package typemap for the majority
</div>
-<H2><a name="Java_typemap_examples">25.10 Typemap Examples</a></H2>
+<H2><a name="Java_typemap_examples">26.10 Typemap Examples</a></H2>
<p>
@@ -6746,7 +7090,7 @@ the SWIG library.
</p>
-<H3><a name="Java_simpler_enum_classes">25.10.1 Simpler Java enums for enums without initializers</a></H3>
+<H3><a name="Java_simpler_enum_classes">26.10.1 Simpler Java enums for enums without initializers</a></H3>
<p>
@@ -6825,7 +7169,7 @@ This would be done by using the original versions of these typemaps in "enums.sw
</p>
-<H3><a name="Java_exception_typemap">25.10.2 Handling C++ exception specifications as Java exceptions</a></H3>
+<H3><a name="Java_exception_typemap">26.10.2 Handling C++ exception specifications as Java exceptions</a></H3>
<p>
@@ -6950,7 +7294,7 @@ We could alternatively have used <tt>%rename</tt> to rename <tt>what()</tt> into
</p>
-<H3><a name="Java_nan_exception_typemap">25.10.3 NaN Exception - exception handling for a particular type</a></H3>
+<H3><a name="Java_nan_exception_typemap">26.10.3 NaN Exception - exception handling for a particular type</a></H3>
<p>
@@ -7105,7 +7449,7 @@ If we were a martyr to the JNI cause, we could replace the succinct code within
If we had, we would have put it in the "in" typemap which, like all JNI and Java typemaps, also supports the 'throws' attribute.
</p>
-<H3><a name="Java_converting_java_string_arrays">25.10.4 Converting Java String arrays to char ** </a></H3>
+<H3><a name="Java_converting_java_string_arrays">26.10.4 Converting Java String arrays to char ** </a></H3>
<p>
@@ -7217,7 +7561,7 @@ public class runme {
example.print_args(animals);
String args[] = example.get_args();
for (int i=0; i&lt;args.length; i++)
- System.out.println(i + ":" + args[i]);
+ System.out.println(i + ":" + args[i]);
}
}
</pre></div>
@@ -7249,7 +7593,7 @@ Lastly the "jni", "jtype" and "jstype" typemaps are also required to specify
what Java types to use.
</p>
-<H3><a name="Java_expanding_java_object">25.10.5 Expanding a Java object to multiple arguments</a></H3>
+<H3><a name="Java_expanding_java_object">26.10.5 Expanding a Java object to multiple arguments</a></H3>
<p>
@@ -7331,7 +7675,7 @@ example.foo(new String[]{"red", "green", "blue", "white"});
</div>
-<H3><a name="Java_using_typemaps_return_arguments">25.10.6 Using typemaps to return arguments</a></H3>
+<H3><a name="Java_using_typemaps_return_arguments">26.10.6 Using typemaps to return arguments</a></H3>
<p>
@@ -7449,7 +7793,7 @@ $ java runme
1 12.0 340.0
</pre></div>
-<H3><a name="Java_adding_downcasts">25.10.7 Adding Java downcasts to polymorphic return types</a></H3>
+<H3><a name="Java_adding_downcasts">26.10.7 Adding Java downcasts to polymorphic return types</a></H3>
<p>
@@ -7655,7 +7999,7 @@ SWIG usually generates code which constructs the proxy classes using Java code a
Note that the JNI code above uses a number of string lookups to call a constructor, whereas this would not occur using byte compiled Java code.
</p>
-<H3><a name="Java_adding_equals_method">25.10.8 Adding an equals method to the Java classes</a></H3>
+<H3><a name="Java_adding_equals_method">26.10.8 Adding an equals method to the Java classes</a></H3>
<p>
@@ -7699,7 +8043,7 @@ System.out.println("foo1? " + foo1.equals(foo2));
</div>
-<H3><a name="Java_void_pointers">25.10.9 Void pointers and a common Java base class</a></H3>
+<H3><a name="Java_void_pointers">26.10.9 Void pointers and a common Java base class</a></H3>
<p>
@@ -7758,7 +8102,7 @@ This example contains some useful functionality which you may want in your code.
<li> It also has a function which effectively implements a cast from the type of the proxy/type wrapper class to a void pointer. This is necessary for passing a proxy class or a type wrapper class to a function that takes a void pointer.
</ul>
-<H3><a name="Java_struct_pointer_pointer">25.10.10 Struct pointer to pointer</a></H3>
+<H3><a name="Java_struct_pointer_pointer">26.10.10 Struct pointer to pointer</a></H3>
<p>
@@ -7938,7 +8282,7 @@ The C functional interface has been completely morphed into an object-oriented i
the Butler class would behave much like any pure Java class and feel more natural to Java users.
</p>
-<H3><a name="Java_memory_management_member_variables">25.10.11 Memory management when returning references to member variables</a></H3>
+<H3><a name="Java_memory_management_member_variables">26.10.11 Memory management when returning references to member variables</a></H3>
<p>
@@ -7953,7 +8297,7 @@ Consider the following C++ code:
<pre>
struct Wheel {
int size;
- Wheel(int sz) : size(sz) {}
+ Wheel(int sz = 0) : size(sz) {}
};
class Bike {
@@ -8061,7 +8405,7 @@ public class Bike {
Note the <tt>addReference</tt> call.
</p>
-<H3><a name="Java_memory_management_objects">25.10.12 Memory management for objects passed to the C++ layer</a></H3>
+<H3><a name="Java_memory_management_objects">26.10.12 Memory management for objects passed to the C++ layer</a></H3>
<p>
@@ -8113,7 +8457,7 @@ System.out.println("element value: " + container.getElement().getValue());
<p>
The C++ code will always print out 20, but the value printed out may not be this in the Java equivalent code.
-In order to understand why, consider a garbage collection occuring...
+In order to understand why, consider a garbage collection occurring...
</p>
<div class="code">
@@ -8142,42 +8486,54 @@ public class Container {
// Ensure that the GC doesn't collect any Element set from Java
// as the underlying C++ class stores a shallow copy
private Element elementReference;
- private long getCPtrAndAddReference(Element element) {
- elementReference = element;
- return Element.getCPtr(element);
- }
public void setElement(Element e) {
- exampleJNI.Container_setElement(swigCPtr, this, getCPtrAndAddReference(e), e);
+ exampleJNI.Container_setElement(swigCPtr, this, Element.getCPtr(e), e);
+ elementReference = e;
}
}
</pre>
</div>
<p>
-The following typemaps will generate the desired code.
-The 'javain' typemap matches the input parameter type for the <tt>setElement</tt> method.
-The 'javacode' typemap simply adds in the specified code into the Java proxy class.
+The following typemaps can be used to generate this code:
</p>
<div class="code">
<pre>
-%typemap(javain) Element *e "getCPtrAndAddReference($javainput)"
-
%typemap(javacode) Container %{
// Ensure that the GC doesn't collect any element set from Java
// as the underlying C++ class stores a shallow copy
private Element elementReference;
- private long getCPtrAndAddReference(Element element) {
- elementReference = element;
- return Element.getCPtr(element);
- }
%}
+
+%typemap(javain,
+ post=" elementReference = $javainput;"
+ ) Element *e "Element.getCPtr($javainput)"
</pre>
</div>
+<p>
+The 'javacode' typemap simply adds in the specified code into the Java proxy class.
+The 'javain' typemap matches the input parameter type and name for the <tt>setElement</tt> method and
+the 'post' typemap attribute allows adding code after the JNI call.
+The 'post' code is generated into a finally block after the JNI call so the resulting code isn't quite
+as mentioned earlier, <tt>setElement</tt> is actually:
+</p>
+
+<div class="code">
+<pre>
+ public void setElement(Element e) {
+ try {
+ exampleJNI.Container_setElement(swigCPtr, this, Element.getCPtr(e), e);
+ } finally {
+ elementReference = e;
+ }
+ }
+</pre>
+</div>
-<H3><a name="Java_date_marshalling">25.10.13 Date marshalling using the javain typemap and associated attributes</a></H3>
+<H3><a name="Java_date_marshalling">26.10.13 Date marshalling using the javain typemap and associated attributes</a></H3>
<p>
@@ -8243,7 +8599,7 @@ The <tt>CDate &amp;</tt> and <tt>const CDate &amp;</tt> Java code is generated f
<p>
where '$javaclassname' is translated into the proxy class name, <tt>CDate</tt> and '$javainput' is translated into the name of the parameter, eg <tt>dateIn</tt>.
-From Java, the intention is then to call into a modifed API with something like:
+From Java, the intention is then to call into a modified API with something like:
</p>
<div class="code">
@@ -8354,7 +8710,7 @@ A few things to note:
-<H2><a name="Java_directors_faq">25.11 Living with Java Directors</a></H2>
+<H2><a name="Java_directors_faq">26.11 Living with Java Directors</a></H2>
<p>
@@ -8533,10 +8889,10 @@ public abstract class UserVisibleFoo extends Foo {
</li>
</ol>
-<H2><a name="Java_odds_ends">25.12 Odds and ends</a></H2>
+<H2><a name="Java_odds_ends">26.12 Odds and ends</a></H2>
-<H3><a name="Java_javadoc_comments">25.12.1 JavaDoc comments</a></H3>
+<H3><a name="Java_javadoc_comments">26.12.1 JavaDoc comments</a></H3>
<p>
@@ -8592,7 +8948,7 @@ public class Barmy {
-<H3><a name="Java_functional_interface">25.12.2 Functional interface without proxy classes</a></H3>
+<H3><a name="Java_functional_interface">26.12.2 Functional interface without proxy classes</a></H3>
<p>
@@ -8653,7 +9009,7 @@ All destructors have to be called manually for example the <tt>delete_Foo(foo)</
</p>
-<H3><a name="Java_using_own_jni_functions">25.12.3 Using your own JNI functions</a></H3>
+<H3><a name="Java_using_own_jni_functions">26.12.3 Using your own JNI functions</a></H3>
<p>
@@ -8703,7 +9059,7 @@ This directive is only really useful if you want to mix your own hand crafted JN
</p>
-<H3><a name="Java_performance">25.12.4 Performance concerns and hints</a></H3>
+<H3><a name="Java_performance">26.12.4 Performance concerns and hints</a></H3>
<p>
@@ -8724,7 +9080,7 @@ However, you will have to be careful about memory management and make sure that
This method normally calls the C++ destructor or <tt>free()</tt> for C code.
</p>
-<H3><a name="Java_debugging">25.12.5 Debugging</a></H3>
+<H3><a name="Java_debugging">26.12.5 Debugging</a></H3>
<p>
@@ -8746,7 +9102,7 @@ The -verbose:jni and -verbose:gc are also useful options for monitoring code beh
</p>
-<H2><a name="Java_examples">25.13 Java Examples</a></H2>
+<H2><a name="Java_examples">26.13 Java Examples</a></H2>
<p>
diff --git a/Doc/Manual/Javascript.html b/Doc/Manual/Javascript.html
index b1ec37055..0b301377c 100644
--- a/Doc/Manual/Javascript.html
+++ b/Doc/Manual/Javascript.html
@@ -1,13 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-<link rel="stylesheet" type="text/css" href="./style.css">
+<link rel="stylesheet" type="text/css" href="style.css">
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
-<H1><a name="Javascript">26 SWIG and Javascript</a></H1>
+<H1><a name="Javascript">27 SWIG and Javascript</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -52,21 +52,21 @@
<p>This chapter describes SWIG's support of Javascript. It does not cover SWIG basics, but only information that is specific to this module.</p>
-<H2><a name="Javascript_overview">26.1 Overview</a></H2>
+<H2><a name="Javascript_overview">27.1 Overview</a></H2>
<p>Javascript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. Its arguably the most popular language for web development.
-Javascript has gone beyond being a browser-based scripting language and with <a href="http://nodejs.org">node.js</a>, it is also used as a backend development language.</p>
+Javascript has gone beyond being a browser-based scripting language and with <a href="https://nodejs.org">node.js</a>, it is also used as a backend development language.</p>
<p>Native Javascript extensions can be used for applications that embed a web-browser view or that embed a Javascript engine (such as <em>node.js</em>). Extending a general purpose web-browser is not possible as this would be a severe security issue.</p>
-<p>SWIG Javascript currently supports <strong>JavascriptCore</strong>, the Javascript engine used by <code>Safari/Webkit</code>, and <a href="https://developers.google.com/v8"><strong>v8</strong></a>, which is used by <code>Chromium</code> and <code>node.js</code>.</p>
-<p><a href="http://www.webkit.org/">WebKit</a> is a modern browser implementation available as open-source which can be embedded into an application.
+<p>SWIG Javascript currently supports <strong>JavascriptCore</strong>, the Javascript engine used by <code>Safari/Webkit</code>, and <a href="https://v8.dev/"><strong>v8</strong></a>, which is used by <code>Chromium</code> and <code>node.js</code>.</p>
+<p><a href="https://webkit.org/">WebKit</a> is a modern browser implementation available as open-source which can be embedded into an application.
With <a href="https://github.com/rogerwang/node-webkit">node-webkit</a> there is a platform which uses Google's <code>Chromium</code> as Web-Browser widget and <code>node.js</code> for javascript extensions.
</p>
-<H2><a name="Javascript_preliminaries">26.2 Preliminaries</a></H2>
+<H2><a name="Javascript_preliminaries">27.2 Preliminaries</a></H2>
-<H3><a name="Javascript_running_swig">26.2.1 Running SWIG</a></H3>
+<H3><a name="Javascript_running_swig">27.2.1 Running SWIG</a></H3>
<p>Suppose that you defined a SWIG module such as the following:</p>
@@ -101,7 +101,7 @@ that era had a component &gt; 99. For example:</p>
<pre>
$ swig -c++ -javascript -v8 -DV8_VERSION=0x032530 example.i</pre>
</div>
-<p>If you're targetting V8 &gt;= 4.3.0, you would just run swig like so:</p>
+<p>If you're targeting V8 &gt;= 4.3.0, you would just run swig like so:</p>
<div class="shell">
<pre>
$ swig -c++ -javascript -v8 example.i</pre>
@@ -121,7 +121,7 @@ void example_initialize(v8::Handle&lt;v8::Object&gt; exports)</pre>
<b>Note</b>: be aware that <code>v8</code> has a C++ API, and thus, the generated modules must be compiled as C++.
</p>
-<H3><a name="Javascript_running_tests_examples">26.2.2 Running Tests and Examples</a></H3>
+<H3><a name="Javascript_running_tests_examples">27.2.2 Running Tests and Examples</a></H3>
<p>The configuration for tests and examples currently supports Linux and Mac only and not MinGW (Windows) yet.</p>
@@ -153,7 +153,7 @@ $ make check-javascript-test-suite ENGINE=jsc</pre>
$ make check-javascript-examples V8_VERSION=0x032530 ENGINE=v8</pre>
</div>
-<H3><a name="Javascript_known_issues">26.2.3 Known Issues</a></H3>
+<H3><a name="Javascript_known_issues">27.2.3 Known Issues</a></H3>
<p>At the moment, the Javascript generators pass all tests syntactically, i.e., the generated source code compiles. However, there are still remaining runtime issues.</p>
@@ -161,21 +161,20 @@ $ make check-javascript-examples V8_VERSION=0x032530 ENGINE=v8</pre>
<ul>
<li><p>Default optional arguments do not work for all targeted interpreters</p></li>
<li><p>Multiple output arguments do not work for JSC</p></li>
- <li><p>C89 incompatibily: the JSC generator might still generate C89 violating code</p></li>
+ <li><p>C89 incompatibility: the JSC generator might still generate C89 violating code</p></li>
<li><p><code>long long</code> is not supported</p></li>
- <li><p><code>%native</code> is not supported</p></li>
<li><p>Javascript callbacks are not supported</p></li>
<li><p><code>instanceOf</code> does not work under JSC</p></li>
</ul>
<p>The primary development environment has been Linux (Ubuntu 12.04). Windows and Mac OS X have been tested sporadically. Therefore, the generators might have more issues on those platforms. Please report back any problem you observe to help us improving this module quickly.</p>
-<H2><a name="Javascript_integration">26.3 Integration</a></H2>
+<H2><a name="Javascript_integration">27.3 Integration</a></H2>
<p>This chapter gives a short introduction how to use a native Javascript extension: as a <code>node.js</code> module, and as an extension for an embedded Webkit.</p>
-<H3><a name="Javascript_node_extensions">26.3.1 Creating node.js Extensions</a></H3>
+<H3><a name="Javascript_node_extensions">27.3.1 Creating node.js Extensions</a></H3>
<p>To install <code>node.js</code> you can download an installer from their <a href="https://launchpad.net/~chris-lea/+archive/node.js">web-site</a> for Mac OS X and Windows. For Linux you can either build the source yourself and run <code>sudo checkinstall</code> or keep to the (probably stone-age) packaged version. For Ubuntu there is a <a href="https://launchpad.net/~chris-lea/+archive/ubuntu/node.js/">PPA</a> available.</p>
@@ -221,7 +220,7 @@ require("./build/Release/example")</pre>
</div>
<p>A more detailed explanation is given in the <a href="#Javascript_examples">Examples</a> section.</p>
-<H4><a name="Javascript_troubleshooting">26.3.1.1 Troubleshooting</a></H4>
+<H4><a name="Javascript_troubleshooting">27.3.1.1 Troubleshooting</a></H4>
<ul>
@@ -233,12 +232,12 @@ require("./build/Release/example")</pre>
$ sudo apt-get remove gyp</pre>
</div>
-<H3><a name="Javascript_embedded_webkit">26.3.2 Embedded Webkit</a></H3>
+<H3><a name="Javascript_embedded_webkit">27.3.2 Embedded Webkit</a></H3>
<p>Webkit is pre-installed on Mac OS X and available as a library for GTK.</p>
-<H4><a name="Javascript_osx">26.3.2.1 Mac OS X</a></H4>
+<H4><a name="Javascript_osx">27.3.2.1 Mac OS X</a></H4>
<p>There is general information about programming with WebKit on <a href="https://developer.apple.com/library/mac/documentation/cocoa/conceptual/DisplayWebContent/DisplayWebContent.html">Apple Developer Documentation</a>. Details about <code>Cocoa</code> programming are not covered here.</p>
@@ -286,10 +285,10 @@ extern bool example_initialize(JSGlobalContextRef context, JSObjectRef* exports)
@end</pre>
</div>
-<H4><a name="Javascript_gtk">26.3.2.2 GTK</a></H4>
+<H4><a name="Javascript_gtk">27.3.2.2 GTK</a></H4>
-<p>There is general information about programming GTK at <a href="https://developer.gnome.org/gtk2/">GTK documentation</a> and in the <a href="https://developer.gnome.org/gtk-tutorial">GTK tutorial</a>, and for Webkit there is a <a href="http://webkitgtk.org/reference/webkitgtk/stable/index.html">Webkit GTK+ API Reference</a>.</p>
+<p>There is general information about programming GTK at <a href="https://developer.gnome.org/gtk2/">GTK documentation</a> and in the <a href="https://developer.gnome.org/gtk-tutorial/">GTK tutorial</a>, and for Webkit there is a <a href="http://webkitgtk.org/reference/webkitgtk/stable/index.html">Webkit GTK+ API Reference</a>.</p>
<p>An integration of a native extension 'example' would look like this:</p>
<div class="code">
<pre>
@@ -331,7 +330,7 @@ int main(int argc, char* argv[])
}</pre>
</div>
-<H3><a name="Javascript_applications_webkit">26.3.3 Creating Applications with node-webkit</a></H3>
+<H3><a name="Javascript_applications_webkit">27.3.3 Creating Applications with node-webkit</a></H3>
<p>To get started with <code>node-webkit</code> there is a very informative set of <a href="https://github.com/rogerwang/node-webkit/wiki">wiki pages</a>.</p>
@@ -422,12 +421,12 @@ open new windows, and many more things.
};</pre>
</div>
-<H2><a name="Javascript_examples">26.4 Examples</a></H2>
+<H2><a name="Javascript_examples">27.4 Examples</a></H2>
<p>Some basic examples are shown here in more detail.</p>
-<H3><a name="Javascript_simple_example">26.4.1 Simple</a></H3>
+<H3><a name="Javascript_simple_example">27.4.1 Simple</a></H3>
<p>The common example <code>simple</code> looks like this:</p>
@@ -477,7 +476,7 @@ example.Foo = 3.1415926;</pre>
<p><b>Note</b>: ECMAScript 5, the currently implemented Javascript standard, does not have modules. <code>node.js</code> and other implementations provide this mechanism defined by the <a href="http://wiki.commonjs.org/wiki/CommonJS">CommonJS</a> group. For browsers this is provided by <a href="http://browserify.org">Browserify</a>, for instance.</p>
-<H3><a name="Javascript_class_example">26.4.2 Class</a></H3>
+<H3><a name="Javascript_class_example">27.4.2 Class</a></H3>
<p>The common example <code>class</code> defines three classes, <code>Shape</code>, <code>Circle</code>, and <code>Square</code>:</p>
@@ -604,15 +603,15 @@ at ReadStream.EventEmitter.emit (events.js:98:17)
at emitKey (readline.js:1095:12)</pre>
</div>
<p>
-<b>Note</b>: In ECMAScript 5 there is no concept for classes. Instead each function can be used as a constructor function which is executed by the 'new' operator. Furthermore, during construction the key property <code>prototype</code> of the constructor function is used to attach a prototype instance to the created object. A prototype is essentially an object itself that is the first-class delegate of a class used whenever the access to a property of an object fails. The very same prototype instance is shared among all instances of one type. Prototypal inheritance is explained in more detail on in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain">Inheritance and the prototype chain</a>, for instance.
+<b>Note</b>: In ECMAScript 5 there is no concept for classes. Instead each function can be used as a constructor function which is executed by the 'new' operator. Furthermore, during construction the key property <code>prototype</code> of the constructor function is used to attach a prototype instance to the created object. A prototype is essentially an object itself that is the first-class delegate of a class used whenever the access to a property of an object fails. The very same prototype instance is shared among all instances of one type. Prototypal inheritance is explained in more detail on in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain">Inheritance and the prototype chain</a>, for instance.
</p>
-<H2><a name="Javascript_implementation">26.5 Implementation</a></H2>
+<H2><a name="Javascript_implementation">27.5 Implementation</a></H2>
<p>The Javascript Module implementation has taken a very different approach compared to other language modules in order to support different Javascript interpreters.</p>
-<H3><a name="Javascript_source_code">26.5.1 Source Code</a></H3>
+<H3><a name="Javascript_source_code">27.5.1 Source Code</a></H3>
<p>The Javascript module is implemented in <code>Source/Modules/javascript.cxx</code>. It dispatches the code generation to a <code>JSEmitter</code> instance, <code>V8Emitter</code> or <code>JSCEmitter</code>. Additionally there are some helpers: <code>Template</code>, for templated code generation, and <code>JSEmitterState</code>, which is used to manage state information during AST traversal. This rough map shall make it easier to find a way through this huge source file:</p>
@@ -713,7 +712,7 @@ Template::Template(const String *code_) { ... }
...</pre>
</div>
-<H3><a name="Javascript_code_templates">26.5.2 Code Templates</a></H3>
+<H3><a name="Javascript_code_templates">27.5.2 Code Templates</a></H3>
<p>All generated code is created on the basis of code templates. The templates for <em>JavascriptCore</em> can be found in <code>Lib/javascript/jsc/javascriptcode.swg</code>, for <em>v8</em> in <code>Lib/javascript/v8/javascriptcode.swg</code>.</p>
@@ -752,7 +751,7 @@ t_register.replace("$jsparent", state.clazz(NAME_MANGLED))
</div>
<p><code>Template</code> creates a copy of that string and <code>Template::replace</code> uses Swig's <code>Replaceall</code> to replace variables in the template. <code>Template::trim</code> can be used to eliminate leading and trailing whitespaces. <code>Template::print</code> is used to write the final template string to a Swig <code>DOH</code> (based on <code>Printv</code>). All methods allow chaining.</p>
-<H3><a name="Javascript_emitter">26.5.3 Emitter</a></H3>
+<H3><a name="Javascript_emitter">27.5.3 Emitter</a></H3>
<p>The Javascript module delegates code generation to a <code>JSEmitter</code> instance. The following extract shows the essential interface:</p>
@@ -871,7 +870,7 @@ int JAVASCRIPT::classHandler(Node *n) {
</div>
<p>In <code>enterClass</code> the emitter stores state information that is necessary when processing class members. In <code>exitClass</code> the wrapper code for the whole class is generated.</p>
-<H3><a name="Javascript_emitter_states">26.5.4 Emitter states</a></H3>
+<H3><a name="Javascript_emitter_states">27.5.4 Emitter states</a></H3>
<p>For storing information during the AST traversal the emitter provides a <code>JSEmitterState</code> with different slots to store data representing the scopes global, class, function, and variable.</p>
@@ -915,7 +914,7 @@ state.clazz(NAME, Getattr(n, "sym:name"));</pre>
<p>State information can be retrieved using <code>state.clazz(NAME)</code> or with <code>Getattr</code> on <code>state.clazz()</code> which actually returns a <code>Hash</code> instance.</p>
-<H3><a name="Javascript_jsc_exceptions">26.5.5 Handling Exceptions in JavascriptCore</a></H3>
+<H3><a name="Javascript_jsc_exceptions">27.5.5 Handling Exceptions in JavascriptCore</a></H3>
<p>Applications with an embedded JavascriptCore should be able to present detailed exception messages that occur in the Javascript engine. Below is an example derived from code provided by Brian Barnes on how these exception details can be extracted.</p>
diff --git a/Doc/Manual/Library.html b/Doc/Manual/Library.html
index 4bad9a03e..560859234 100644
--- a/Doc/Manual/Library.html
+++ b/Doc/Manual/Library.html
@@ -7,31 +7,38 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Library">9 SWIG library</a></H1>
+<H1><a name="Library">11 SWIG library</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="#Library_nn2">The %include directive and library search path</a>
-<li><a href="#Library_nn3">C Arrays and Pointers</a>
+<li><a href="#Library_nn3">C arrays and pointers</a>
<ul>
<li><a href="#Library_nn4">cpointer.i</a>
<li><a href="#Library_carrays">carrays.i</a>
<li><a href="#Library_nn6">cmalloc.i</a>
<li><a href="#Library_nn7">cdata.i</a>
</ul>
-<li><a href="#Library_nn8">C String Handling</a>
+<li><a href="#Library_nn8">C string handling</a>
<ul>
<li><a href="#Library_nn9">Default string handling</a>
<li><a href="#Library_nn10">Passing binary data</a>
<li><a href="#Library_nn11">Using %newobject to release memory</a>
<li><a href="#Library_nn12">cstring.i</a>
</ul>
-<li><a href="#Library_stl_cpp_library">STL/C++ Library</a>
+<li><a href="#Library_stl_cpp_library">STL/C++ library</a>
<ul>
<li><a href="#Library_std_string">std::string</a>
<li><a href="#Library_std_vector">std::vector</a>
<li><a href="#Library_stl_exceptions">STL exceptions</a>
<li><a href="#Library_std_shared_ptr">shared_ptr smart pointer</a>
+<ul>
+<li><a href="#Library_shared_ptr_basics">shared_ptr basics</a>
+<li><a href="#Library_shared_ptr_inheritance">shared_ptr and inheritance</a>
+<li><a href="#Library_shared_ptr_overloading">shared_ptr and method overloading</a>
+<li><a href="#Library_shared_ptr_templates">shared_ptr and templates</a>
+<li><a href="#Library_shared_ptr_directors">shared_ptr and directors</a>
+</ul>
<li><a href="#Library_std_auto_ptr">auto_ptr smart pointer</a>
</ul>
<li><a href="#Library_nn16">Utility Libraries</a>
@@ -60,7 +67,7 @@ Alternative libraries provide similar functionality. Please read this chapter
carefully if you used the old libraries.
</p>
-<H2><a name="Library_nn2">9.1 The %include directive and library search path</a></H2>
+<H2><a name="Library_nn2">11.1 The %include directive and library search path</a></H2>
<p>
@@ -92,7 +99,7 @@ Set the environment variable to hold an alternative library directory.
The directories that are searched are displayed when using <tt>-verbose</tt> commandline option.
</p>
-<H2><a name="Library_nn3">9.2 C Arrays and Pointers</a></H2>
+<H2><a name="Library_nn3">11.2 C arrays and pointers</a></H2>
<p>
@@ -104,7 +111,7 @@ pointers as class-like objects. Since these functions provide direct access to
memory, their use is potentially unsafe and you should exercise caution.
</p>
-<H3><a name="Library_nn4">9.2.1 cpointer.i</a></H3>
+<H3><a name="Library_nn4">11.2.1 cpointer.i</a></H3>
<p>
@@ -320,7 +327,7 @@ In this example, the function <tt>int_to_uint()</tt> would be used to cast type
<b>Note:</b> When working with simple pointers, typemaps can often be used to provide more seamless operation.
</p>
-<H3><a name="Library_carrays">9.2.2 carrays.i</a></H3>
+<H3><a name="Library_carrays">11.2.2 carrays.i</a></H3>
<p>
@@ -411,13 +418,13 @@ void print_array(double x[10]);
Now, in a scripting language, you might write this:
</p>
-<div class="code">
+<div class="targetlang">
<pre>
-a = new_doubleArray(10) # Create an array
+a = new_doubleArray(10) # Create an array
for i in range(0, 10):
- doubleArray_setitem(a, i, 2*i) # Set a value
-print_array(a) # Pass to C
-delete_doubleArray(a) # Destroy array
+ doubleArray_setitem(a, i, 2 * i) # Set a value
+print_array(a) # Pass to C
+delete_doubleArray(a) # Destroy array
</pre>
</div>
@@ -475,12 +482,12 @@ void print_array(double x[10]);
Allows you to do this:
</p>
-<div class="code">
+<div class="targetlang">
<pre>
import example
c = example.doubleArray(10) # Create double[10]
for i in range(0, 10):
- c[i] = 2*i # Assign values
+ c[i] = 2 * i # Assign values
example.print_array(c) # Pass to C
</pre>
</div>
@@ -496,9 +503,10 @@ you should consider using a special array object rather than a bare pointer.
<p>
<b>Note:</b> <tt>%array_functions()</tt> and <tt>%array_class()</tt> should not be
used with types of <tt>char</tt> or <tt>char *</tt>.
+SWIG's default handling of these types is to handle them as character strings and the two macros do not do enough to change this.
</p>
-<H3><a name="Library_nn6">9.2.3 cmalloc.i</a></H3>
+<H3><a name="Library_nn6">11.2.3 cmalloc.i</a></H3>
<p>
@@ -659,7 +667,7 @@ Now, in a script:
</pre>
</div>
-<H3><a name="Library_nn7">9.2.4 cdata.i</a></H3>
+<H3><a name="Library_nn7">11.2.4 cdata.i</a></H3>
<p>
@@ -761,7 +769,7 @@ char *cdata_<em>name</em>(type* ptr, int nitems)
Clearly they are unsafe.
</p>
-<H2><a name="Library_nn8">9.3 C String Handling</a></H2>
+<H2><a name="Library_nn8">11.3 C string handling</a></H2>
<p>
@@ -781,7 +789,7 @@ morality. The modules in this section provide basic functionality
for manipulating raw C strings.
</p>
-<H3><a name="Library_nn9">9.3.1 Default string handling</a></H3>
+<H3><a name="Library_nn9">11.3.1 Default string handling</a></H3>
<p>
@@ -801,7 +809,7 @@ target language. In other words, if you were using a language like Tcl,
and you wrote this,
</p>
-<div class="code">
+<div class="targetlang">
<pre>
% foo Hello
</pre>
@@ -822,7 +830,7 @@ interpreter and lead to a crash). Furthermore, the default behavior does
not work well with binary data. Instead, strings are assumed to be NULL-terminated.
</p>
-<H3><a name="Library_nn10">9.3.2 Passing binary data</a></H3>
+<H3><a name="Library_nn10">11.3.2 Passing binary data</a></H3>
<p>
@@ -852,7 +860,7 @@ size_t parity(char *str, size_t len, size_t initial);
Now, in the target language, you can use binary string data like this:
</p>
-<div class="code">
+<div class="targetlang">
<pre>
&gt;&gt;&gt; s = "H\x00\x15eg\x09\x20"
&gt;&gt;&gt; parity(s, 0)
@@ -864,7 +872,7 @@ In the wrapper function, the passed string will be expanded to a pointer and len
The <tt>(char *STRING, int LENGTH)</tt> multi-argument typemap is also available in addition to <tt>(char *STRING, size_t LENGTH)</tt>.
</p>
-<H3><a name="Library_nn11">9.3.3 Using %newobject to release memory</a></H3>
+<H3><a name="Library_nn11">11.3.3 Using %newobject to release memory</a></H3>
<p>
@@ -905,7 +913,7 @@ however, you may need to provide your own "newfree" typemap for other types.
See <a href="Customization.html#Customization_ownership">Object ownership and %newobject</a> for more details.
</p>
-<H3><a name="Library_nn12">9.3.4 cstring.i</a></H3>
+<H3><a name="Library_nn12">11.3.4 cstring.i</a></H3>
<p>
@@ -1357,7 +1365,7 @@ to accomplish this in SWIG. This library provides support for a few common tech
</li>
<li>If used in C++, this library uses <tt>new</tt> and <tt>delete []</tt> for memory
-allocation. If using ANSI C, the library uses <tt>malloc()</tt> and <tt>free()</tt>.
+allocation. If using C, the library uses <tt>malloc()</tt> and <tt>free()</tt>.
</li>
<li>Rather than manipulating <tt>char *</tt> directly, you might consider using a special string
@@ -1365,7 +1373,7 @@ structure or class instead.
</li>
</ul>
-<H2><a name="Library_stl_cpp_library">9.4 STL/C++ Library</a></H2>
+<H2><a name="Library_stl_cpp_library">11.4 STL/C++ library</a></H2>
<p>
@@ -1385,16 +1393,24 @@ The following table shows which C++ classes are supported and the equivalent SWI
<td><b>SWIG Interface library file</b></td>
</tr>
+<tr> <td>std::array (C++11)</td> <td>array</td> <td>std_array.i</td> </tr>
<tr> <td>std::auto_ptr</td> <td>memory</td> <td>std_auto_ptr.i</td> </tr>
+<tr> <td>std::complex</td> <td>complex</td> <td>std_complex.i</td> </tr>
<tr> <td>std::deque</td> <td>deque</td> <td>std_deque.i</td> </tr>
<tr> <td>std::list</td> <td>list</td> <td>std_list.i</td> </tr>
<tr> <td>std::map</td> <td>map</td> <td>std_map.i</td> </tr>
+<tr> <td>std::multimap (C++11)</td> <td>multimap</td> <td>std_multimap.i</td> </tr>
+<tr> <td>std::multiset (C++11)</td> <td>multiset</td> <td>std_multiset.i</td> </tr>
<tr> <td>std::pair</td> <td>utility</td> <td>std_pair.i</td> </tr>
<tr> <td>std::set</td> <td>set</td> <td>std_set.i</td> </tr>
<tr> <td>std::string</td> <td>string</td> <td>std_string.i</td> </tr>
+<tr> <td>std::unordered_map (C++11)</td> <td>unordered_map</td> <td>std_unordered_map.i</td> </tr>
+<tr> <td>std::unordered_multimap (C++11)</td> <td>unordered_multimap</td> <td>std_unordered_multimap.i</td> </tr>
+<tr> <td>std::unordered_multiset (C++11)</td> <td>unordered_multiset</td> <td>std_unordered_multiset.i</td> </tr>
+<tr> <td>std::unordered_set (C++11)</td> <td>unordered_set</td> <td>std_unordered_set.i</td> </tr>
<tr> <td>std::vector</td> <td>vector</td> <td>std_vector.i</td> </tr>
-<tr> <td>std::array</td> <td>array (C++11)</td> <td>std_array.i</td> </tr>
-<tr> <td>std::shared_ptr</td> <td>shared_ptr (C++11)</td> <td>std_shared_ptr.i</td> </tr>
+<tr> <td>std::wstring</td> <td>wstring</td> <td>std_wstring.i</td> </tr>
+<tr> <td>std::shared_ptr (C++11)</td> <td>shared_ptr</td> <td>std_shared_ptr.i</td> </tr>
</table>
@@ -1404,7 +1420,7 @@ Please look for the library files in the appropriate language library directory.
</p>
-<H3><a name="Library_std_string">9.4.1 std::string</a></H3>
+<H3><a name="Library_std_string">11.4.1 std::string</a></H3>
<p>
@@ -1460,7 +1476,7 @@ In the target language:
<div class="targetlang">
<pre>
x = my_struct();
-x.foo="Hello World"; # assign with string
+x.foo = "Hello World"; # assign with string
print x.foo; # print as string
</pre>
</div>
@@ -1488,7 +1504,7 @@ void foo(string s, const String &amp;t); // std_string typemaps still applie
</pre>
</div>
-<H3><a name="Library_std_vector">9.4.2 std::vector</a></H3>
+<H3><a name="Library_std_vector">11.4.2 std::vector</a></H3>
<p>
@@ -1565,8 +1581,8 @@ std::vector&lt;double&gt; half(const std::vector&lt;double&gt;&amp; v) {
}
void halve_in_place(std::vector&lt;double&gt;&amp; v) {
- std::transform(v.begin(), v.end(), v.begin(),
- std::bind2nd(std::divides&lt;double&gt;(), 2.0));
+ for (std::vector&lt;double&gt;::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
</pre>
</div>
@@ -1667,7 +1683,7 @@ if you want to make their head explode.
details and the public API exposed to the interpreter vary.
</p>
-<H3><a name="Library_stl_exceptions">9.4.3 STL exceptions</a></H3>
+<H3><a name="Library_stl_exceptions">11.4.3 STL exceptions</a></H3>
<p>
@@ -1717,7 +1733,10 @@ The <tt>%exception</tt> directive can be used by placing the following code befo
Any thrown STL exceptions will then be gracefully handled instead of causing a crash.
</p>
-<H3><a name="Library_std_shared_ptr">9.4.4 shared_ptr smart pointer</a></H3>
+<H3><a name="Library_std_shared_ptr">11.4.4 shared_ptr smart pointer</a></H3>
+
+
+<H4><a name="Library_shared_ptr_basics">11.4.4.1 shared_ptr basics</a></H4>
<p>
@@ -1813,8 +1832,11 @@ System.out.println(val1 + " " + val2);
</pre>
</div>
+<H4><a name="Library_shared_ptr_inheritance">11.4.4.2 shared_ptr and inheritance</a></H4>
+
+
<p>
-This shared_ptr library works quite differently to SWIG's normal, but somewhat limited,
+The shared_ptr library works quite differently to SWIG's normal, but somewhat limited,
<a href="SWIGPlus.html#SWIGPlus_smart_pointers">smart pointer handling</a>.
The shared_ptr library does not generate extra wrappers, just for smart pointer handling, in addition to the proxy class.
The normal proxy class including inheritance relationships is generated as usual.
@@ -1892,7 +1914,7 @@ Adding the missing <tt>%shared_ptr</tt> macros will fix this:
<div class="code">
<pre>
-%include "boost_shared_ptr.i"
+%include &lt;boost_shared_ptr.i&gt;
%shared_ptr(GrandParent);
%shared_ptr(Parent);
%shared_ptr(Child);
@@ -1901,14 +1923,79 @@ Adding the missing <tt>%shared_ptr</tt> macros will fix this:
</pre>
</div>
+<H4><a name="Library_shared_ptr_overloading">11.4.4.3 shared_ptr and method overloading</a></H4>
+
+
+<p>
+A C++ compiler can disambiguate a method overloaded by a shared_ptr and one using the raw underlying type.
+For example, either one of these methods can be called in C++:
+</p>
+
+<div class="code">
+<pre>
+int age(std::shared_ptr&lt;GrandParent&gt; num);
+int age(GrandParent&amp; num);
+</pre>
+</div>
+
+<p>
+When wrapped by SWIG, disambiguation is not possible using the overloaded names as there is just one equivalent type (<tt>GrandParent</tt>) in the target language.
+SWIG will choose to wrap just the first method by default.
+<a href="SWIGPlus.html#SWIGPlus_nn25">Ambiguity in overloading</a> discusses ways to control which method(s) gets wrapped using <tt>%ignore</tt> or <tt>%rename</tt>.
+For the interested reader, SWIG detects that they are equivalent types via the <a href=Typemaps.html#Typemaps_typecheck_pointer>typecheck typemaps</a> in the shared_ptr library.
+</p>
+
+<H4><a name="Library_shared_ptr_templates">11.4.4.4 shared_ptr and templates</a></H4>
+
+
+<p>
+The <tt>%shared_ptr</tt> macro should be used for all the required instantiations
+of the template before each of the <tt>%template</tt> instantiations.
+For example, consider <tt>number.h</tt> containing the following illustrative template:
+</p>
+
+<div class="code">
+<pre>
+#include &lt;memory&gt;
+
+template&lt;int N&gt; struct Number {
+ int num;
+ Number() : num(N) {}
+ static std::shared_ptr&lt;Number&lt;N&gt;&gt; make() { return std::make_shared&lt;Number&lt;N&gt;&gt;(); }
+};
+</pre>
+</div>
+
+<p>
+The SWIG code below shows the required ordering:
+</p>
+
+<div class="code">
+<pre>
+%include &lt;std_shared_ptr.i&gt;
+
+%shared_ptr(Number&lt;10&gt;);
+%shared_ptr(Number&lt;42&gt;);
+
+%{
+ #include "number.h"
+%}
+%include "number.h"
+
+%template(Number10) Number&lt;10&gt;;
+%template(Number42) Number&lt;42&gt;;
+</pre>
+</div>
+
+<H4><a name="Library_shared_ptr_directors">11.4.4.5 shared_ptr and directors</a></H4>
+
+
<p>
-<b>Note:</b> There is somewhat limited support for <tt>%shared_ptr</tt> and the director feature
-and the degrees of success varies among the different target languages.
-Please help to improve this support by providing patches with improvements.
+The languages that support shared_ptr also have support for using shared_ptr with directors.
</p>
-<H3><a name="Library_std_auto_ptr">9.4.5 auto_ptr smart pointer</a></H3>
+<H3><a name="Library_std_auto_ptr">11.4.5 auto_ptr smart pointer</a></H3>
<p>
@@ -1957,10 +2044,10 @@ int value = k.getValue();
</pre>
</div>
-<H2><a name="Library_nn16">9.5 Utility Libraries</a></H2>
+<H2><a name="Library_nn16">11.5 Utility Libraries</a></H2>
-<H3><a name="Library_nn17">9.5.1 exception.i</a></H3>
+<H3><a name="Library_nn17">11.5.1 exception.i</a></H3>
<p>
diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html
index ba42f735c..6eb448a12 100644
--- a/Doc/Manual/Lisp.html
+++ b/Doc/Manual/Lisp.html
@@ -7,11 +7,10 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Lisp">27 SWIG and Common Lisp</a></H1>
+<H1><a name="Lisp">29 SWIG and Common Lisp</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
-<li><a href="#Lisp_nn2">Allegro Common Lisp</a>
<li><a href="#Lisp_nn3">Common Foreign Function Interface(CFFI)</a>
<ul>
<li><a href="#Lisp_nn4">Additional Commandline Options </a>
@@ -19,12 +18,9 @@
<li><a href="#Lisp_nn6">Generating CFFI bindings for C++ code</a>
<li><a href="#Lisp_nn7">Inserting user code into generated files</a>
</ul>
-<li><a href="#Lisp_nn8">CLISP</a>
<ul>
<li><a href="#Lisp_nn9">Additional Commandline Options </a>
-<li><a href="#Lisp_nn10">Details on CLISP bindings</a>
</ul>
-<li><a href="#Lisp_nn11">UFFI </a>
</ul>
</div>
<!-- INDEX -->
@@ -38,26 +34,17 @@
finance, and also common in computer science education.
There are more than 9 different implementations of common lisp which
are available, all have different foreign function
- interfaces. SWIG currently supports only the Allegro Common
- Lisp, Common Foreign Function Interface(CFFI), CLisp and UFFI
- foreign function interfaces.
+ interfaces. SWIG currently supports the
+ Common Foreign Function Interface(CFFI).
</p>
-<H2><a name="Lisp_nn2">27.1 Allegro Common Lisp</a></H2>
-
-<p>
- Allegro Common Lisp support in SWIG has been updated to include
- support for both C and C++. You can read about the interface
- <a href="Allegrocl.html#Allegrocl">here</a>
-</p>
-
-<H2><a name="Lisp_nn3">27.2 Common Foreign Function Interface(CFFI)</a></H2>
+<H2><a name="Lisp_nn3">29.2 Common Foreign Function Interface(CFFI)</a></H2>
<p>
CFFI, the Common Foreign Function Interface, is a portable foreign
- function interface for ANSI Common Lisp systems, similar in
- spirit to UFFI. Unlike UFFI, CFFI requires only a small set of
+ function interface for ANSI Common Lisp systems.
+ CFFI requires only a small set of
low-level functionality from the Lisp implementation, such as
calling a foreign function by name, allocating foreign memory,
and dereferencing pointers.
@@ -78,17 +65,8 @@ swig -cffi -module <i>module-name</i> <i>file-name</i>
files and the various things which you can do with them.
</p>
-<H3><a name="Lisp_nn4">27.2.1 Additional Commandline Options </a></H3>
-
-
-<p>
-The following table list the additional commandline options available for the CLISP module. They can also be seen by using:
-</p>
+<H3><a name="Lisp_nn4">29.2.1 Additional Commandline Options </a></H3>
-<div class="code"><pre>
-swig -cffi -help
-</pre></div>
-<br/>
<table summary="CFFI specific options">
<tr>
@@ -119,12 +97,15 @@ swig -cffi -help
</table>
-<H3><a name="Lisp_nn5">27.2.2 Generating CFFI bindings</a></H3>
+<H3><a name="Lisp_nn5">29.2.2 Generating CFFI bindings</a></H3>
+
+<p>
As we mentioned earlier the ideal way to use SWIG is to use interface
files. To illustrate the use of it, let's assume that we have a
file named <i>test.h</i> with the following C code:
+</p>
<div class="code"><pre>
#define y 5
@@ -155,7 +136,10 @@ void lispsort_double (int n, double * array);
enum color { RED, BLUE, GREEN};
</pre></div>
+<p>
Corresponding to this we will write a simple interface file:
+</p>
+
<div class="code"><pre>
%module test
@@ -163,7 +147,9 @@ Corresponding to this we will write a simple interface file:
</pre></div>
+<p>
The generated SWIG Code will be:
+</p>
<div class="targetlang"><pre>
;;;SWIG wrapper code starts here
@@ -395,7 +381,7 @@ The feature <i>intern_function</i> ensures that all C names are
</pre></div>
-<H3><a name="Lisp_nn6">27.2.3 Generating CFFI bindings for C++ code</a></H3>
+<H3><a name="Lisp_nn6">29.2.3 Generating CFFI bindings for C++ code</a></H3>
<p>This feature to SWIG (for CFFI) is very new and still far from
@@ -430,8 +416,10 @@ Also, while parsing the C++ file and generating C wrapper code SWIG
%include "target/header.h"
</pre></div>
+<p>
Various features which were available for C headers can also be used
here. The target header which we are going to use here is:
+</p>
<div class="code"><pre>
namespace OpenDemo {
class Test
@@ -478,8 +466,10 @@ namespace OpenDemo {
%include "test.cpp"
</pre></div>
+<p>
SWIG generates 3 files, the first one is a C wrap which we don't show,
the second is the plain CFFI wrapper which is as shown below:
+</p>
<div class="targetlang"><pre>
(cffi:defcfun ("_wrap_Test_x_set" Test_x_set) :void
(self :pointer)
@@ -528,11 +518,13 @@ SWIG generates 3 files, the first one is a C wrap which we don't show,
(cffi:defcfun ("_wrap_RandomUnitVectorOnXZPlane" RandomUnitVectorOnXZPlane) :pointer)
</pre></div>
+<p>
The output is pretty good but it fails in disambiguating overloaded
functions such as the constructor, in this case. One way of
resolving this problem is to make the interface use the rename
directiv, but hopefully there are better solutions.
In addition SWIG also generates, a CLOS file
+</p>
<div class="targetlang"><pre>
@@ -568,7 +560,7 @@ If you have any questions, suggestions, patches, etc., related to CFFI
module feel free to contact us on the SWIG mailing list, and
also please add a "[CFFI]" tag in the subject line.
-<H3><a name="Lisp_nn7">27.2.4 Inserting user code into generated files</a></H3>
+<H3><a name="Lisp_nn7">29.2.4 Inserting user code into generated files</a></H3>
<p>
@@ -608,195 +600,5 @@ Note that the block <tt>%{ ... %}</tt> is effectively a shortcut for
</p>
-<H2><a name="Lisp_nn8">27.3 CLISP</a></H2>
-
-
-<p>
-<a href="http://clisp.cons.org">CLISP</a> is a feature-loaded
- implementation of common lisp which is portable across most of the
- operating system environments and hardware. CLISP includes an
- interpreter, a compiler, a debugger, CLOS, MOP, a foreign
- language interface, i18n, regular expressions, a socket
- interface, and more. An X11 interface is available through CLX,
- Garnet and CLUE/CLIO. Command line editing is provided by
- readline. CLISP runs Maxima, ACL2 and many other Common Lisp
- packages.
-</p>
-<p>
- To run the clisp module of SWIG requires very little effort, you
- just need to execute:
-</p>
-<div class="code"><pre>
-swig -clisp -module <i>module-name</i> <i>file-name</i>
-
-</pre></div>
-
-<p>
- Because of the high level nature of the CLISP FFI, the bindings
- generated by SWIG may not be absolutely correct, and you may need
- to modify them. The good thing is that you don't need to complex
- interface file for the CLISP module. The CLISP module tries to
- produce code which is both human readable and easily modifyable.
-</p>
-<H3><a name="Lisp_nn9">27.3.1 Additional Commandline Options </a></H3>
-
-
-<p>
-The following table list the additional commandline options available for the CLISP module. They can also be seen by using:
-</p>
-
-<div class="code"><pre>
-swig -clisp -help
-</pre></div>
-<br/>
-<table summary="CLISP specific options">
-<tr>
-<th>CLISP specific options</th>
-</tr>
-
-<tr>
-<td>-extern-all</td>
-<td>If this option is given then clisp definitions for all the functions<br/>
-and global variables will be created otherwise only definitions for<br/>
-externed functions and variables are created.
-</td>
-</tr>
-
-<tr>
-<td>-generate-typedef</td>
-<td>If this option is given then def-c-type will be used to generate<br/>
-shortcuts according to the typedefs in the input.
-</td>
-</tr>
-
-</table>
-
-<H3><a name="Lisp_nn10">27.3.2 Details on CLISP bindings</a></H3>
-
-
-<p>
-As mentioned earlier the CLISP bindings generated by SWIG may need
-some modifications. The clisp module creates a lisp file with
-the same name as the module name. This
-lisp file contains a 'defpackage' declaration, with the
-package name same as the module name. This package uses the
-'common-lisp' and 'ffi' packages. Also, package exports all
-the functions, structures and variables for which an ffi
-binding was generated.<br/>
-After generating the defpackage statement, the clisp module also
-sets the default language.
-
-<div class="targetlang"><pre>
-(defpackage :test
- (:use :common-lisp :ffi)
- (:export
- :make-bar
- :bar-x
- :bar-y
- :bar-a
- :bar-b
- :bar-z
- :bar-n
- :pointer_func
- :func123
- :make-cfunr
- :lispsort_double
- :test123))
-
-(in-package :test)
-
-(default-foreign-language :stdc)
-</pre></div>
-<p>
-The ffi wrappers for functions and variables are generated as shown
- below. When functions have arguments of type "double * array",
- SWIG doesn't knows whether it is an 'out' argument or it is
- an array which will be passed, so SWIG plays it safe by
- declaring it as an '(array (ffi:c-ptr DOUBLE-FLOAT))'. For
- arguments of type "int **z[100]" where SWIG has more
- information, i.e., it knows that 'z' is an array of pointers to
- pointers of integers, SWIG defines it to be '(z (ffi:c-ptr
- (ffi:c-array (ffi:c-ptr (ffi:c-ptr ffi:int)) 100)))'
-</p>
-<div class="code"><pre>
-extern "C" {
-int pointer_func(void (*ClosureFun)( void* _fun, void* _data, void* _evt ), int y);
-
-int func123(div_t * x, int **z[100], int y[][1000][10]);
-
-void lispsort_double (int n, double * array);
-
-void test123(float x , double y);
-
-}
-</pre></div>
-<div class="targetlang"><pre>
-(ffi:def-call-out pointer_func
- (:name "pointer_func")
- (:arguments (ClosureFun (ffi:c-function (:arguments (arg0 (ffi:c-pointer NIL))
- (arg1 (ffi:c-pointer NIL))
- (arg2 (ffi:c-pointer NIL)))
- (:return-type NIL)))
- (y ffi:int))
- (:return-type ffi:int)
- (:library +library-name+))
-
-(ffi:def-call-out func123
- (:name "func123")
- (:arguments (x (ffi:c-pointer div_t))
- (z (ffi:c-ptr (ffi:c-array (ffi:c-ptr (ffi:c-ptr ffi:int)) 100)))
- (y (ffi:c-ptr (ffi:c-ptr (ffi:c-array ffi:int (1000 10))))))
- (:return-type ffi:int)
- (:library +library-name+))
-
-
-(ffi:def-call-out lispsort_double
- (:name "lispsort_double")
- (:arguments (n ffi:int)
- (array (ffi:c-ptr DOUBLE-FLOAT)))
- (:return-type NIL)
- (:library +library-name+))
-
-(ffi:def-call-out test123
- (:name "test")
- (:arguments (x SINGLE-FLOAT)
- (y DOUBLE-FLOAT))
- (:return-type NIL)
- (:library +library-name+))
-
-</pre></div>
-
-<p>
-The module also handles strutcures and #define constants as shown
- below. SWIG automatically adds the constructors and accessors
- created for the struct to the list of symbols exported by the
- package.
-</p>
-<div class="code"><pre>
-struct bar {
- short x, y;
- char a, b;
- int *z[1000];
- struct bar * n;
-};
-
-#define max 1000
-</pre></div>
-<div class="targetlang"><pre>
-(ffi:def-c-struct bar
- (x :type ffi:short)
- (y :type ffi:short)
- (a :type character)
- (b :type character)
- (z :type (ffi:c-array (ffi:c-ptr ffi:int) 1000))
- (n :type (ffi:c-pointer bar)))
-
-(defconstant max 1000)
-
-</pre></div>
-
-<H2><a name="Lisp_nn11">27.4 UFFI </a></H2>
-
-
</body>
</html>
diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html
index c94fe31dc..6633eaa38 100644
--- a/Doc/Manual/Lua.html
+++ b/Doc/Manual/Lua.html
@@ -77,7 +77,7 @@
<p>
-Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight configuration language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ANSI C and C++). It's also a <em>really</em> tiny language, less than 6000 lines of code, which compiles to &lt;100 kilobytes of binary code. It can be found at <a href="http://www.lua.org">http://www.lua.org</a>
+Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight configuration language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ISO C and C++). It's also a <em>really</em> tiny language, less than 6000 lines of code, which compiles to &lt;100 kilobytes of binary code. It can be found at <a href="http://www.lua.org">http://www.lua.org</a>
</p>
<p>
eLua stands for Embedded Lua (can be thought of as a flavor of Lua) and offers the full implementation of the Lua programming language to the embedded world, extending it with specific features for efficient and portable software embedded development. eLua runs on smaller devices like microcontrollers and provides the full features of the regular Lua desktop version. More information on eLua can be found here: <a href="http://www.eluaproject.net">http://www.eluaproject.net</a>
@@ -984,7 +984,7 @@ There are ways to make this operator appear as part of the class using the <tt>%
Also, be aware that certain operators don't map cleanly to Lua, and some Lua operators don't map cleanly to C++ operators. For instance, overloaded assignment operators don't map to Lua semantics and will be ignored, and C++ doesn't support Lua's concatenation operator (<tt>..</tt>).
</p>
<p>
-In order to keep maximum compatibility within the different languages in SWIG, the Lua bindings uses the same set of operator names as python. Although internally it renames the functions to something else (on order to work with Lua).
+In order to keep maximum compatibility within the different languages in SWIG, the Lua bindings uses the same set of operator names as Python. Although internally it renames the functions to something else (on order to work with Lua).
<p>
The current list of operators which can be overloaded (and the alternative function names) are:<ul>
<li><tt>__add__</tt> operator+
@@ -1008,11 +1008,10 @@ The following operators cannot be overloaded (mainly because they are not suppor
<p>
SWIG also accepts the <tt>__str__()</tt> member function which converts an object to a string. This function should return a const char*, preferably to static memory. This will be used for the <tt>print()</tt> and <tt>tostring()</tt> functions in Lua. Assuming the complex class has a function
</p>
-<div class="code"><pre>const char* __str__()
-{
- static char buffer[255];
- sprintf(buffer, "Complex(%g, %g)", this-&gt;re(), this-&gt;im());
- return buffer;
+<div class="code"><pre>const char* __str__() {
+ static char buffer[255];
+ sprintf(buffer, "Complex(%g, %g)", this-&gt;re(), this-&gt;im());
+ return buffer;
}
</pre></div>
<p>
@@ -1031,11 +1030,10 @@ Complex(10, 12)
<p>
It is also possible to overload the operator<tt>[]</tt>, but currently this cannot be automatically performed. To overload the operator<tt>[]</tt> you need to provide two functions, <tt>__getitem__()</tt> and <tt>__setitem__()</tt>
</p>
-<div class="code"><pre>class Complex
-{
- //....
- double __getitem__(int i)const; // i is the index, returns the data
- void __setitem__(int i, double d); // i is the index, d is the data
+<div class="code"><pre>class Complex {
+ //....
+ double __getitem__(int i)const; // i is the index, returns the data
+ void __setitem__(int i, double d); // i is the index, d is the data
};
</pre></div>
<p>
diff --git a/Doc/Manual/Makefile b/Doc/Manual/Makefile
index ee9a0af34..9505adb91 100644
--- a/Doc/Manual/Makefile
+++ b/Doc/Manual/Makefile
@@ -89,3 +89,9 @@ linkchecker2:
cp *.png linkchecker-tmp
(cd linkchecker-tmp && linkchecker --config=../linkchecker.config -F text --no-warnings SWIGDocumentation.html)
+# Simple check for relative links (there shouldn't be any), they don't translate properly creating the .pdf doc
+# with wkhtmltopdf. For example, href="SWIG.html" needs to be href="SWIG.html#SWIG"
+linkchecker3:
+ @echo "The following list should just contain SWIGDocumentation.html and SWIGDocumentation.pdf,"
+ @echo "as all links should have an anchor (with a #) or be a full url beginning http."
+ grep 'href="' *.html | sed -e 's/.*href="\(.*\)">.*$$/\1/' | grep -v "#" | grep -v "^http" | grep -v "^style.css"
diff --git a/Doc/Manual/Modula3.html b/Doc/Manual/Modula3.html
index 75f3f80ff..fc4ffa03c 100644
--- a/Doc/Manual/Modula3.html
+++ b/Doc/Manual/Modula3.html
@@ -6,7 +6,7 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF">
-<H1><a name="Modula3">29 SWIG and Modula-3</a></H1>
+<H1><a name="Modula3">31 SWIG and Modula-3</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -55,7 +55,7 @@ especially
<a href="Typemaps.html#Typemaps">typemaps</a>.
</p>
-<H2><a name="Modula3_modula3_overview">29.1 Overview</a></H2>
+<H2><a name="Modula3_modula3_overview">31.1 Overview</a></H2>
<p>
@@ -85,7 +85,7 @@ FFTW
</li>
</ol>
-<H3><a name="Modula3_motivation">29.1.1 Motivation</a></H3>
+<H3><a name="Modula3_motivation">31.1.1 Motivation</a></H3>
<p>
@@ -132,10 +132,10 @@ functions), but it doesn't allow you to easily integrate a Modula-3 module into
a C/C++ project.
</p>
-<H2><a name="Modula3_conception">29.2 Conception</a></H2>
+<H2><a name="Modula3_conception">31.2 Conception</a></H2>
-<H3><a name="Modula3_cinterface">29.2.1 Interfaces to C libraries</a></H3>
+<H3><a name="Modula3_cinterface">31.2.1 Interfaces to C libraries</a></H3>
<p>
@@ -284,7 +284,7 @@ and the principal type must be renamed (<tt>%typemap</tt>).
</p>
-<H3><a name="Modula3_cppinterface">29.2.2 Interfaces to C++ libraries</a></H3>
+<H3><a name="Modula3_cppinterface">31.2.2 Interfaces to C++ libraries</a></H3>
<p>
@@ -385,10 +385,10 @@ There is no C++ library I wrote a SWIG interface for,
so I'm not sure if this is possible or sensible, yet.
</p>
-<H2><a name="Modula3_preliminaries">29.3 Preliminaries</a></H2>
+<H2><a name="Modula3_preliminaries">31.3 Preliminaries</a></H2>
-<H3><a name="Modula3_compilers">29.3.1 Compilers</a></H3>
+<H3><a name="Modula3_compilers">31.3.1 Compilers</a></H3>
<p>
@@ -401,7 +401,7 @@ For testing examples I use Critical Mass cm3.
</p>
-<H3><a name="Modula3_commandline">29.3.2 Additional Commandline Options</a></H3>
+<H3><a name="Modula3_commandline">31.3.2 Additional Commandline Options</a></H3>
<p>
@@ -478,10 +478,10 @@ Instead generate templates for some basic typemaps.
</tr>
</table>
-<H2><a name="Modula3_typemaps">29.4 Modula-3 typemaps</a></H2>
+<H2><a name="Modula3_typemaps">31.4 Modula-3 typemaps</a></H2>
-<H3><a name="Modula3_inoutparam">29.4.1 Inputs and outputs</a></H3>
+<H3><a name="Modula3_inoutparam">31.4.1 Inputs and outputs</a></H3>
<p>
@@ -695,7 +695,7 @@ consist of the following parts:
</table>
-<H3><a name="Modula3_ordinals">29.4.2 Subranges, Enumerations, Sets</a></H3>
+<H3><a name="Modula3_ordinals">31.4.2 Subranges, Enumerations, Sets</a></H3>
<p>
@@ -747,7 +747,7 @@ that I'd like to automate.
</p>
-<H3><a name="Modula3_class">29.4.3 Objects</a></H3>
+<H3><a name="Modula3_class">31.4.3 Objects</a></H3>
<p>
@@ -760,7 +760,7 @@ is not really useful, yet.
</p>
-<H3><a name="Modula3_imports">29.4.4 Imports</a></H3>
+<H3><a name="Modula3_imports">31.4.4 Imports</a></H3>
<p>
@@ -793,7 +793,7 @@ IMPORT M3toC;
</pre></div>
-<H3><a name="Modula3_exceptions">29.4.5 Exceptions</a></H3>
+<H3><a name="Modula3_exceptions">31.4.5 Exceptions</a></H3>
<p>
@@ -817,7 +817,7 @@ you should declare
<tt>%typemap("m3wrapinconv:throws") blah * %{OSError.E%}</tt>.
</p>
-<H3><a name="Modula3_typemap_example">29.4.6 Example</a></H3>
+<H3><a name="Modula3_typemap_example">31.4.6 Example</a></H3>
<p>
@@ -864,10 +864,10 @@ where almost everything is generated by a typemap:
</pre></div>
-<H2><a name="Modula3_hints">29.5 More hints to the generator</a></H2>
+<H2><a name="Modula3_hints">31.5 More hints to the generator</a></H2>
-<H3><a name="Modula3_features">29.5.1 Features</a></H3>
+<H3><a name="Modula3_features">31.5.1 Features</a></H3>
<table border summary="Modula-3 features">
@@ -904,7 +904,7 @@ where almost everything is generated by a typemap:
</tr>
</table>
-<H3><a name="Modula3_pragmas">29.5.2 Pragmas</a></H3>
+<H3><a name="Modula3_pragmas">31.5.2 Pragmas</a></H3>
<table border summary="Modula-3 pragmas">
@@ -927,7 +927,7 @@ where almost everything is generated by a typemap:
</tr>
</table>
-<H2><a name="Modula3_remarks">29.6 Remarks</a></H2>
+<H2><a name="Modula3_remarks">31.6 Remarks</a></H2>
<ul>
diff --git a/Doc/Manual/Modules.html b/Doc/Manual/Modules.html
index 2a0ff7985..7efd74e2b 100644
--- a/Doc/Manual/Modules.html
+++ b/Doc/Manual/Modules.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Modules">16 Working with Modules</a></H1>
+<H1><a name="Modules">19 Working with Modules</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -24,7 +24,7 @@
-<H2><a name="Modules_introduction">16.1 Modules Introduction</a></H2>
+<H2><a name="Modules_introduction">19.1 Modules Introduction</a></H2>
<p>
@@ -78,7 +78,7 @@ where you want to create a collection of modules.
Each module in the collection is created via separate invocations of SWIG.
</p>
-<H2><a name="Modules_nn1">16.2 Basics</a></H2>
+<H2><a name="Modules_nn1">19.2 Basics</a></H2>
<p>
@@ -177,7 +177,7 @@ in parallel from multiple threads as SWIG provides no locking - for more on that
issue, read on.
</p>
-<H2><a name="Modules_nn2">16.3 The SWIG runtime code</a></H2>
+<H2><a name="Modules_nn2">19.3 The SWIG runtime code</a></H2>
<p>
@@ -243,7 +243,7 @@ can peacefully coexist. So the type structures are separated by the
is empty. Only modules compiled with the same pair will share type information.
</p>
-<H2><a name="Modules_external_run_time">16.4 External access to the runtime</a></H2>
+<H2><a name="Modules_external_run_time">19.4 External access to the runtime</a></H2>
<p>As described in <a href="Typemaps.html#Typemaps_runtime_type_checker">The run-time type checker</a>,
@@ -282,7 +282,7 @@ SWIG_TYPE_TABLE to be the same as the module whose types you are trying to
access.
</p>
-<H2><a name="Modules_nn4">16.5 A word of caution about static libraries</a></H2>
+<H2><a name="Modules_nn4">19.5 A word of caution about static libraries</a></H2>
<p>
@@ -293,7 +293,7 @@ into it. This is very often <b>NOT</b> what you want and it can lead to unexpect
behavior. When working with dynamically loadable modules, you should try to work exclusively with shared libraries.
</p>
-<H2><a name="Modules_nn5">16.6 References</a></H2>
+<H2><a name="Modules_nn5">19.6 References</a></H2>
<p>
@@ -301,7 +301,7 @@ Due to the complexity of working with shared libraries and multiple modules, it
an outside reference. John Levine's "Linkers and Loaders" is highly recommended.
</p>
-<H2><a name="Modules_nn6">16.7 Reducing the wrapper file size</a></H2>
+<H2><a name="Modules_nn6">19.7 Reducing the wrapper file size</a></H2>
<p>
diff --git a/Doc/Manual/Mzscheme.html b/Doc/Manual/Mzscheme.html
index 385b241aa..aae181ee9 100644
--- a/Doc/Manual/Mzscheme.html
+++ b/Doc/Manual/Mzscheme.html
@@ -8,7 +8,7 @@
<body bgcolor="#ffffff">
-<H1><a name="Mzscheme">30 SWIG and MzScheme/Racket</a></H1>
+<H1><a name="Mzscheme">37 SWIG and MzScheme/Racket</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -24,7 +24,7 @@
<p>
This section contains information on SWIG's support of Racket, formally known as MzScheme.
-<H2><a name="MzScheme_nn2">30.1 Creating native structures</a></H2>
+<H2><a name="MzScheme_nn2">37.1 Creating native structures</a></H2>
<p>
@@ -65,7 +65,7 @@ Then in scheme, you can use regular struct access procedures like
</pre>
</div>
-<H2><a name="MzScheme_simple">30.2 Simple example</a></H2>
+<H2><a name="MzScheme_simple">37.2 Simple example</a></H2>
<p>
@@ -166,11 +166,11 @@ Some points of interest:
<li> The above requests mzc to create an extension using the CGC garbage-collector. The alternative -- the 3m collector -- has generally better performance, but work is still required for SWIG to emit code which is compatible with it.
</ul>
-<H2><a name="MzScheme_external_docs">30.3 External documentation</a></H2>
+<H2><a name="MzScheme_external_docs">37.3 External documentation</a></H2>
<p>
-See the <a href="http://docs.racket-lang.org/inside/index.html">C API</a> for more description of using the mechanism for adding extensions. The main documentation is <a href="http://docs.racket-lang.org/">here</a>.
+See the <a href="https://docs.racket-lang.org/inside/index.html">C API</a> for more description of using the mechanism for adding extensions. The main documentation is <a href="https://docs.racket-lang.org/">here</a>.
</p>
<p>
diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html
index 96c93faeb..92b5260fe 100644
--- a/Doc/Manual/Ocaml.html
+++ b/Doc/Manual/Ocaml.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Ocaml">31 SWIG and Ocaml</a></H1>
+<H1><a name="Ocaml">38 SWIG and OCaml</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -47,12 +47,16 @@
<li><a href="#Ocaml_nn25">Director Usage Example</a>
<li><a href="#Ocaml_nn26">Creating director objects</a>
<li><a href="#Ocaml_nn27">Typemaps for directors, directorin, directorout, directorargout</a>
-<li><a href="#Ocaml_nn28">typemap</a>
+<li><a href="#Ocaml_nn28">directorin typemap</a>
<li><a href="#Ocaml_nn29">directorout typemap</a>
<li><a href="#Ocaml_nn30">directorargout typemap</a>
</ul>
<li><a href="#Ocaml_nn31">Exceptions</a>
</ul>
+<li><a href="#Ocaml_nn32">Documentation Features</a>
+<ul>
+<li><a href="#Ocaml_nn33">Module docstring</a>
+</ul>
</ul>
</div>
<!-- INDEX -->
@@ -84,11 +88,11 @@ If you're not familiar with the Objective Caml language, you can visit
<a href="http://ocaml.org/">The Ocaml Website</a>.
</p>
-<H2><a name="Ocaml_nn2">31.1 Preliminaries</a></H2>
+<H2><a name="Ocaml_nn2">38.1 Preliminaries</a></H2>
<p>
-SWIG 3.0 works with Ocaml 3.08.3 and above. Given the choice,
+SWIG is compatible with OCaml 3.12.0 and above. Given the choice,
you should use the latest stable release. The SWIG Ocaml module has
been tested on Linux (x86, PPC, Sparc) and Cygwin on Windows. The
best way to determine whether your system will work is to compile the
@@ -102,7 +106,7 @@ file Examples/Makefile illustrate how to compile and link SWIG modules that
will be loaded dynamically. This has only been tested on Linux so far.
</p>
-<H3><a name="Ocaml_nn3">31.1.1 Running SWIG</a></H3>
+<H3><a name="Ocaml_nn3">38.1.1 Running SWIG</a></H3>
<p>
@@ -125,7 +129,7 @@ you will compile the file <tt>example_wrap.c</tt> with <tt>ocamlc</tt> or
the resulting .ml and .mli files as well, and do the final link with -custom
(not needed for native link).</p>
-<H3><a name="Ocaml_nn4">31.1.2 Compiling the code</a></H3>
+<H3><a name="Ocaml_nn4">38.1.2 Compiling the code</a></H3>
<p>
@@ -142,7 +146,7 @@ Use <tt>ocamlc</tt> or <tt>ocamlopt</tt> to compile your SWIG interface like:
<div class="code">
<pre>
-% swig -ocaml -co swig.mli ; swig -ocaml co swig.ml
+% swig -ocaml -co swig.mli ; swig -ocaml -co swig.ml
% ocamlc -c swig.mli ; ocamlc -c swig.ml
% ocamlc -c -ccopt "-I/usr/include/foo" example_wrap.c
% ocamlc -c example.mli
@@ -162,7 +166,7 @@ in C++ mode, you must:</p>
</pre>
</div>
-<H3><a name="Ocaml_nn5">31.1.3 The camlp4 module</a></H3>
+<H3><a name="Ocaml_nn5">38.1.3 The camlp4 module</a></H3>
<p>
@@ -238,7 +242,7 @@ let b = C_string (getenv "PATH")
</td></tr>
</table>
-<H3><a name="Ocaml_nn6">31.1.4 Using your module</a></H3>
+<H3><a name="Ocaml_nn6">38.1.4 Using your module</a></H3>
<p>
@@ -252,7 +256,7 @@ option to build your functions into the primitive list. This
option is not needed when you build native code.
</p>
-<H3><a name="Ocaml_nn7">31.1.5 Compilation problems and compiling with C++</a></H3>
+<H3><a name="Ocaml_nn7">38.1.5 Compilation problems and compiling with C++</a></H3>
<p>
@@ -263,7 +267,7 @@ liberal with pointer types may not compile under the C++ compiler.
Most code meant to be compiled as C++ will not have problems.
</p>
-<H2><a name="Ocaml_nn8">31.2 The low-level Ocaml/C interface</a></H2>
+<H2><a name="Ocaml_nn8">38.2 The low-level Ocaml/C interface</a></H2>
<p>
@@ -336,7 +340,7 @@ appended. Upon return to caml space, the fnhelper function
beautifies the result. A list containing a single item degrades to
only that item (i.e. [ C_int 3 ] -&gt; C_int 3), and a list
containing more than one item is wrapped in C_list (i.e. [ C_char
-'a' ; C_char 'b' -&gt; C_list [ C_char 'a' ; C_char b
+'a' ; C_char 'b' ] -&gt; C_list [ C_char 'a' ; C_char 'b'
]). This is in order to make return values easier to handle
when functions have only one return value, such as constructors,
and operators. In addition, string, pointer, and object
@@ -363,7 +367,7 @@ value items pass through directly, but you must make your own type
signature for a function that uses value in this way.
</p>
-<H3><a name="Ocaml_nn9">31.2.1 The generated module</a></H3>
+<H3><a name="Ocaml_nn9">38.2.1 The generated module</a></H3>
<p>
@@ -397,7 +401,7 @@ it describes the output SWIG will generate for class definitions.
</td></tr>
</table>
-<H3><a name="Ocaml_nn10">31.2.2 Enums</a></H3>
+<H3><a name="Ocaml_nn10">38.2.2 Enums</a></H3>
<p>
@@ -460,7 +464,7 @@ val x : Enum_test.c_obj = C_enum `a
</pre>
</div>
-<H4><a name="Ocaml_nn11">31.2.2.1 Enum typing in Ocaml</a></H4>
+<H4><a name="Ocaml_nn11">38.2.2.1 Enum typing in Ocaml</a></H4>
<p>
@@ -473,10 +477,10 @@ functions imported from different modules. You must convert values to master
values using the swig_val function before sharing them with another module.
</p>
-<H3><a name="Ocaml_nn12">31.2.3 Arrays</a></H3>
+<H3><a name="Ocaml_nn12">38.2.3 Arrays</a></H3>
-<H4><a name="Ocaml_nn13">31.2.3.1 Simple types of bounded arrays</a></H4>
+<H4><a name="Ocaml_nn13">38.2.3.1 Simple types of bounded arrays</a></H4>
<p>
@@ -497,7 +501,7 @@ arrays of simple types with known bounds in your code, but this only works
for arrays whose bounds are completely specified.
</p>
-<H4><a name="Ocaml_nn14">31.2.3.2 Complex and unbounded arrays</a></H4>
+<H4><a name="Ocaml_nn14">38.2.3.2 Complex and unbounded arrays</a></H4>
<p>
@@ -510,7 +514,7 @@ SWIG can't predict which of these methods will be used in the array,
so you have to specify it for yourself in the form of a typemap.
</p>
-<H4><a name="Ocaml_nn15">31.2.3.3 Using an object</a></H4>
+<H4><a name="Ocaml_nn15">38.2.3.3 Using an object</a></H4>
<p>
@@ -524,7 +528,7 @@ Consider writing an object when the ending condition of your array is complex,
such as using a required sentinel, etc.
</p>
-<H4><a name="Ocaml_nn16">31.2.3.4 Example typemap for a function taking float * and int</a></H4>
+<H4><a name="Ocaml_nn16">38.2.3.4 Example typemap for a function taking float * and int</a></H4>
<p>
@@ -575,7 +579,7 @@ void printfloats( float *tab, int len );
</pre></td></tr></table>
-<H3><a name="Ocaml_nn17">31.2.4 C++ Classes</a></H3>
+<H3><a name="Ocaml_nn17">38.2.4 C++ Classes</a></H3>
<p>
@@ -618,7 +622,7 @@ the underlying pointer, so using create_[x]_from_ptr alters the
returned value for the same object.
</p>
-<H4><a name="Ocaml_nn18">31.2.4.1 STL vector and string Example</a></H4>
+<H4><a name="Ocaml_nn18">38.2.4.1 STL vector and string Example</a></H4>
<p>
@@ -660,7 +664,7 @@ module.
</p>
<div class="code"><pre>
-bash-2.05a$ ./example_top
+bash-2.05a$ ./runme_top
Objective Caml version 3.06
Camlp4 Parsing version 3.06
@@ -698,7 +702,7 @@ baz
#
</pre></div>
-<H4><a name="Ocaml_nn19">31.2.4.2 C++ Class Example</a></H4>
+<H4><a name="Ocaml_nn19">38.2.4.2 C++ Class Example</a></H4>
<p>
@@ -728,7 +732,7 @@ public:
};
</pre></td></tr></table>
-<H4><a name="Ocaml_nn20">31.2.4.3 Compiling the example</a></H4>
+<H4><a name="Ocaml_nn20">38.2.4.3 Compiling the example</a></H4>
<div class="code"><pre>
@@ -746,7 +750,7 @@ bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
-L$QTPATH/lib -cclib -lqt
</pre></div>
-<H4><a name="Ocaml_nn21">31.2.4.4 Sample Session</a></H4>
+<H4><a name="Ocaml_nn21">38.2.4.4 Sample Session</a></H4>
<div class="code"><pre>
@@ -773,10 +777,10 @@ Assuming you have a working installation of QT, you will see a window
containing the string "hi" in a button.
</p>
-<H3><a name="Ocaml_nn22">31.2.5 Director Classes</a></H3>
+<H3><a name="Ocaml_nn22">38.2.5 Director Classes</a></H3>
-<H4><a name="Ocaml_nn23">31.2.5.1 Director Introduction</a></H4>
+<H4><a name="Ocaml_nn23">38.2.5.1 Director Introduction</a></H4>
<p>
@@ -803,7 +807,7 @@ class foo {
};
</pre></div>
-<H4><a name="Ocaml_nn24">31.2.5.2 Overriding Methods in Ocaml</a></H4>
+<H4><a name="Ocaml_nn24">38.2.5.2 Overriding Methods in Ocaml</a></H4>
<p>
@@ -831,11 +835,11 @@ In this example, I'll examine the objective caml code involved in providing
an overloaded class. This example is contained in Examples/ocaml/shapes.
</p>
-<H4><a name="Ocaml_nn25">31.2.5.3 Director Usage Example</a></H4>
+<H4><a name="Ocaml_nn25">38.2.5.3 Director Usage Example</a></H4>
<table border="1" bgcolor="#dddddd" summary="Director usage example">
-<tr><th><center>example_prog.ml</center>
+<tr><th><center>runme.ml</center>
</th></tr>
<tr><td><pre>
open Swig
@@ -854,13 +858,15 @@ let triangle_class pts ob meth args =
| _ -&gt; raise (Failure "cover needs two double arguments."))
| _ -&gt; (invoke ob) meth args ;;
+...
+
let triangle =
new_derived_object
new_shape
- (triangle_class ((0.0, 0.0), (0.5, 1.0), (1.0, 0.0)))
+ (triangle_class ((0.0, 0.0), (0.5, 1.0), (1.0, 0.6)))
'() ;;
-let _ = _draw_shape_coverage '(triangle, C_int 60, C_int 20) ;;
+let _ = _draw_shape_coverage '(triangle, 60, 20) ;;
</pre></td></tr>
</table>
@@ -890,7 +896,7 @@ in a more effortless style in ocaml, while leaving the "engine" part of the
program in C++.
</p>
-<H4><a name="Ocaml_nn26">31.2.5.4 Creating director objects</a></H4>
+<H4><a name="Ocaml_nn26">38.2.5.4 Creating director objects</a></H4>
<p>
@@ -931,7 +937,7 @@ object from causing a core dump, as long as the object is destroyed
properly.
</p>
-<H4><a name="Ocaml_nn27">31.2.5.5 Typemaps for directors, directorin, directorout, directorargout</a></H4>
+<H4><a name="Ocaml_nn27">38.2.5.5 Typemaps for directors, directorin, directorout, directorargout</a></H4>
<p>
@@ -942,7 +948,7 @@ well as a function return value in the same way you provide function arguments,
and to receive arguments the same way you normally receive function returns.
</p>
-<H4><a name="Ocaml_nn28">31.2.5.6 typemap</a></H4>
+<H4><a name="Ocaml_nn28">38.2.5.6 directorin typemap</a></H4>
<p>
@@ -953,7 +959,7 @@ code receives when you are called. In general, a simple <tt>directorin</tt> typ
can use the same body as a simple <tt>out</tt> typemap.
</p>
-<H4><a name="Ocaml_nn29">31.2.5.7 directorout typemap</a></H4>
+<H4><a name="Ocaml_nn29">38.2.5.7 directorout typemap</a></H4>
<p>
@@ -964,7 +970,7 @@ for the same type, except when there are special requirements for object
ownership, etc.
</p>
-<H4><a name="Ocaml_nn30">31.2.5.8 directorargout typemap</a></H4>
+<H4><a name="Ocaml_nn30">38.2.5.8 directorargout typemap</a></H4>
<p>
@@ -981,14 +987,134 @@ In the event that you don't specify all of the necessary values, integral
values will read zero, and struct or object returns have undefined results.
</p>
-<H3><a name="Ocaml_nn31">31.2.6 Exceptions</a></H3>
+<H3><a name="Ocaml_nn31">38.2.6 Exceptions</a></H3>
+
+
+<p>
+If an error occurs in a C or C++ function, you may want to convert that error into an OCaml
+exception. To do this, you can use the <tt>%exception</tt> directive. The <tt>%exception</tt>
+directive simply lets you rewrite part of the generated wrapper code to include an error check.
+It is detailed in full in the <a href="Customization.html#Customization_exception">Exception handling with %exception</a> section.
+</p>
+
+<p>
+In C, a function often indicates an error by returning a status code (e.g. a negative number
+or a NULL pointer). Here is a simple example of how you might handle that:
+</p>
+
+<div class="code">
+<pre>
+%exception malloc {
+ $action
+ if (result == NULL) {
+ caml_failwith("Not enough memory");
+ }
+}
+void *malloc(size_t nbytes);
+</pre>
+</div>
+
+<p>
+In OCaml:
+</p>
+
+<div class="code">
+<pre>
+# let a = _malloc (C_int 20000000000);;
+Exception: Failure "Not enough memory".
+#
+</pre>
+</div>
+
+<p>
+If a library provides some kind of general error handling framework, you can also use
+that. For example:
+</p>
+
+<div class="code">
+<pre>
+%exception {
+ $action
+ if (err_occurred()) {
+ caml_failwith(err_message());
+ }
+}
+</pre>
+</div>
+
+<p>
+If no declaration name is given to <tt>%exception</tt>, it is applied to all wrapper functions.
+<tt>$action</tt> is a SWIG special variable and is replaced by the C/C++ function call being wrapped.
+</p>
+
+<p>
+C++ exceptions are also easy to handle. We can catch a C++ exception and rethrow it as
+an OCaml exception like this:
+</p>
+
+<div class="code">
+<pre>
+%exception getitem {
+ try {
+ $action
+ } catch (std::out_of_range &amp;e) {
+ caml_failwith(e.what());
+ }
+}
+
+class FooClass {
+ public:
+ int getitem(int index); // Exception handling added
+ ...
+};
+</pre>
+</div>
+
+<p>
+The language-independent <tt>exception.i</tt> library file can also be used
+to raise exceptions. See the <a href="Library.html#Library">SWIG Library</a> chapter.
+</p>
+
+<H2><a name="Ocaml_nn32">38.3 Documentation Features</a></H2>
<p>
-Catching exceptions is now supported using SWIG's %exception feature. A simple
-but not too useful example is provided by the throw_exception testcase in
-Examples/test-suite. You can provide your own exceptions, too.
+The features described in this section can be used to generate documentation
+comments (colloquially referred to as "docstrings") that can be read by
+<a href="https://caml.inria.fr/pub/docs/manual-ocaml/ocamldoc.html">OCamldoc</a>.
</p>
+<H3><a name="Ocaml_nn33">38.3.1 Module docstring</a></H3>
+
+
+<p>
+The first documentation comment of an <tt>mli</tt> file is the comment
+associated with the entire module. SWIG supports this by setting an
+option of the <tt>%module</tt> directive. For example:
+</p>
+
+<div class="code">
+<pre>
+%module(docstring="This is the example module's docstring") example
+</pre>
+</div>
+
+<p>
+When you have more than just a line or so, you can retain the
+readability of the <tt>%module</tt> directive by using a macro. For
+example:
+</p>
+
+<div class="code">
+<pre>
+%define DOCSTRING
+"The `XmlResource` class allows program resources defining menus,
+controls on a panel, etc. to be loaded from an XML file."
+%enddef
+
+%module(docstring=DOCSTRING) xrc
+</pre>
+</div>
+
</body>
</html>
diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html
index 616b28cf8..bd6b08ff9 100644
--- a/Doc/Manual/Octave.html
+++ b/Doc/Manual/Octave.html
@@ -9,7 +9,7 @@
<body bgcolor="#ffffff">
-<H1><a name="Octave">32 SWIG and Octave</a></H1>
+<H1><a name="Octave">29 SWIG and Octave</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -60,7 +60,7 @@ This chapter is intended to give an introduction to using the module. You should
Also, there are a dozen or so examples in the Examples/octave directory, and hundreds in the test suite (Examples/test-suite and Examples/test-suite/octave).
</p>
-<H2><a name="Octave_nn2">32.1 Preliminaries</a></H2>
+<H2><a name="Octave_nn2">29.1 Preliminaries</a></H2>
<p>
@@ -76,7 +76,7 @@ This cannot be guaranteed however, as in recent times new Octave releases have r
The SWIG runtime exports the function <tt>swig_octave_prereq()</tt> for checking the version of Octave.
</p>
-<H2><a name="Octave_nn3">32.2 Running SWIG</a></H2>
+<H2><a name="Octave_nn3">29.2 Running SWIG</a></H2>
<p>
@@ -108,7 +108,7 @@ The <tt>-c++</tt> option is also required when wrapping C++ code:
This creates a C++ source file "example_wrap.cpp". A C++ file is generated even when wrapping C code as Octave is itself written in C++ and requires wrapper code to be in the same language. The generated C++ source file contains the low-level wrappers that need to be compiled and linked with the rest of your C/C++ application (in this case, the gcd implementation) to create an extension module.
</p>
-<H3><a name="Octave_nn4">32.2.1 Command-line options</a></H3>
+<H3><a name="Octave_nn4">29.2.1 Command-line options</a></H3>
<p>
@@ -131,7 +131,7 @@ The special name "." loads C global variables into the module namespace, i.e. al
The <em>-opprefix</em> options sets the prefix of the names of global/friend <a href="#Octave_nn18">operator</a> functions.
</p>
-<H3><a name="Octave_nn5">32.2.2 Compiling a dynamic module</a></H3>
+<H3><a name="Octave_nn5">29.2.2 Compiling a dynamic module</a></H3>
<p>
@@ -158,7 +158,7 @@ $ mkoctfile example_wrap.cpp example.c
<div class="targetlang"><pre>octave:1&gt; swigexample</pre></div>
-<H3><a name="Octave_nn6">32.2.3 Using your module</a></H3>
+<H3><a name="Octave_nn6">29.2.3 Using your module</a></H3>
<p>
@@ -176,10 +176,10 @@ octave:4&gt; swigexample.cvar.Foo=4;
octave:5&gt; swigexample.cvar.Foo
ans = 4 </pre></div>
-<H2><a name="Octave_nn7">32.3 A tour of basic C/C++ wrapping</a></H2>
+<H2><a name="Octave_nn7">29.3 A tour of basic C/C++ wrapping</a></H2>
-<H3><a name="Octave_nn8">32.3.1 Modules</a></H3>
+<H3><a name="Octave_nn8">29.3.1 Modules</a></H3>
<p>
@@ -224,7 +224,7 @@ octave:4&gt; swigexample.gcd(4, 6)
ans = 2
</pre></div>
-<H3><a name="Octave_nn9">32.3.2 Functions</a></H3>
+<H3><a name="Octave_nn9">29.3.2 Functions</a></H3>
<p>
@@ -241,7 +241,7 @@ int fact(int n); </pre></div>
<div class="targetlang"><pre>octave:1&gt; swigexample.fact(4)
24 </pre></div>
-<H3><a name="Octave_nn10">32.3.3 Global variables</a></H3>
+<H3><a name="Octave_nn10">29.3.3 Global variables</a></H3>
<p>
@@ -294,7 +294,7 @@ octave:2&gt; swigexample.PI=3.142;
octave:3&gt; swigexample.PI
ans = 3.1420 </pre></div>
-<H3><a name="Octave_nn11">32.3.4 Constants and enums</a></H3>
+<H3><a name="Octave_nn11">29.3.4 Constants and enums</a></H3>
<p>
@@ -316,7 +316,7 @@ swigexample.SCONST="Hello World"
swigexample.SUNDAY=0
.... </pre></div>
-<H3><a name="Octave_nn12">32.3.5 Pointers</a></H3>
+<H3><a name="Octave_nn12">29.3.5 Pointers</a></H3>
<p>
@@ -363,7 +363,7 @@ octave:2&gt; f=swigexample.fopen("not there", "r");
error: value on right hand side of assignment is undefined
error: evaluating assignment expression near line 2, column 2 </pre></div>
-<H3><a name="Octave_nn13">32.3.6 Structures and C++ classes</a></H3>
+<H3><a name="Octave_nn13">29.3.6 Structures and C++ classes</a></H3>
<p>
@@ -498,7 +498,7 @@ ans = 1
Depending on the ownership setting of a <tt>swig_ref</tt>, it may call C++ destructors when its reference count goes to zero. See the section on memory management below for details.
</p>
-<H3><a name="Octave_nn15">32.3.7 C++ inheritance</a></H3>
+<H3><a name="Octave_nn15">29.3.7 C++ inheritance</a></H3>
<p>
@@ -507,7 +507,7 @@ This information contains the full class hierarchy. When an indexing operation (
the tree is walked to find a match in the current class as well as any of its bases. The lookup is then cached in the <tt>swig_ref</tt>.
</p>
-<H3><a name="Octave_nn17">32.3.8 C++ overloaded functions</a></H3>
+<H3><a name="Octave_nn17">29.3.8 C++ overloaded functions</a></H3>
<p>
@@ -517,7 +517,7 @@ The dispatch function selects which overload to call (if any) based on the passe
<tt>typecheck</tt> typemaps are used to analyze each argument, as well as assign precedence. See the chapter on typemaps for details.
</p>
-<H3><a name="Octave_nn18">32.3.9 C++ operators</a></H3>
+<H3><a name="Octave_nn18">29.3.9 C++ operators</a></H3>
<p>
@@ -621,7 +621,7 @@ On the C++ side, the default mappings are as follows:
Octave can also utilise friend (i.e. non-member) operators with a simple %rename: see the example in the Examples/octave/operator directory.
</p>
-<H3><a name="Octave_nn19">32.3.10 Class extension with %extend</a></H3>
+<H3><a name="Octave_nn19">29.3.10 Class extension with %extend</a></H3>
<p>
@@ -660,7 +660,7 @@ Similarly, Octave can use the <tt>__float__</tt> method to convert an object to
Octave 3.8.0 and later versions will also map unary functions X() to the corresponding <tt>__X__</tt> method, where X includes: abs(), acos(), acosh(), angle(), arg(), asin(), asinh(), atan(), atanh(), cbrt(), ceil(), conj(), cos(), cosh(), dawson(), erf(), erfc(), erfcinv(), erfcx(), erfi(), erfinv(), exp(), expm1(), finite(), fix(), floor(), gamma(), imag(), isalnum(), isalpha(), isascii(), iscntrl(), isdigit(), isgraph(), isinf(), islower(), isna(), isnan(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), lgamma(), log(), log10(), log1p(), log2(), real(), round(), roundb(), signbit(), signum(), sin(), sinh(), sqrt(), tan(), tanh(), toascii(), tolower(), toupper()
</p>
-<H3><a name="Octave_nn20">32.3.11 C++ templates</a></H3>
+<H3><a name="Octave_nn20">29.3.11 C++ templates</a></H3>
<p>
@@ -737,10 +737,10 @@ ans =
</pre></div>
-<H3><a name="Octave_nn21">32.3.12 C++ Smart Pointers</a></H3>
+<H3><a name="Octave_nn21">29.3.12 C++ Smart Pointers</a></H3>
-<H4><a name="Octave_smart_pointers_shared_ptr">32.3.12.1 The shared_ptr Smart Pointer</a></H4>
+<H4><a name="Octave_smart_pointers_shared_ptr">29.3.12.1 The shared_ptr Smart Pointer</a></H4>
<p>
@@ -751,14 +751,14 @@ in the <a href="Library.html#Library_std_shared_ptr">shared_ptr smart pointer</a
</p>
-<H4><a name="Octave_smart_pointers_generic">32.3.12.2 Generic Smart Pointers</a></H4>
+<H4><a name="Octave_smart_pointers_generic">29.3.12.2 Generic Smart Pointers</a></H4>
<p>
C++ smart pointers are fully supported as in other modules.
</p>
-<H3><a name="Octave_nn22">32.3.13 Directors (calling Octave from C++ code)</a></H3>
+<H3><a name="Octave_nn22">29.3.13 Directors (calling Octave from C++ code)</a></H3>
<p>
@@ -839,14 +839,14 @@ c-side routine called
octave-side routine called
</pre></div>
-<H3><a name="Octave_nn23">32.3.14 Threads</a></H3>
+<H3><a name="Octave_nn23">29.3.14 Threads</a></H3>
<p>
The use of threads in wrapped Director code is not supported; i.e., an Octave-side implementation of a C++ class must be called from the Octave interpreter's thread. Anything fancier (apartment/queue model, whatever) is left to the user. Without anything fancier, this amounts to the limitation that Octave must drive the module... like, for example, an optimization package that calls Octave to evaluate an objective function.
</p>
-<H3><a name="Octave_nn24">32.3.15 Memory management</a></H3>
+<H3><a name="Octave_nn24">29.3.15 Memory management</a></H3>
<p>
@@ -880,14 +880,14 @@ The %newobject directive may be used to control this behavior for pointers retur
In the case where one wishes for the C++ side to own an object that was created in Octave (especially a Director object), one can use the __disown() method to invert this logic. Then letting the Octave reference count go to zero will not destroy the object, but destroying the object will invalidate the Octave-side object if it still exists (and call destructors of other C++ bases in the case of multiple inheritance/<tt>subclass()</tt>'ing).
</p>
-<H3><a name="Octave_nn25">32.3.16 STL support</a></H3>
+<H3><a name="Octave_nn25">29.3.16 STL support</a></H3>
<p>
Various STL library files are provided for wrapping STL containers.
</p>
-<H3><a name="Octave_nn26">32.3.17 Matrix typemaps</a></H3>
+<H3><a name="Octave_nn26">29.3.17 Matrix typemaps</a></H3>
<p>
diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html
index 96e9f7517..766ccaede 100644
--- a/Doc/Manual/Perl5.html
+++ b/Doc/Manual/Perl5.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Perl5">33 SWIG and Perl5</a></H1>
+<H1><a name="Perl5">30 SWIG and Perl5</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -97,7 +97,7 @@ later. We're no longer testing regularly with older versions, but
Perl 5.6 seems to mostly work, while older versions don't.
</p>
-<H2><a name="Perl5_nn2">33.1 Overview</a></H2>
+<H2><a name="Perl5_nn2">30.1 Overview</a></H2>
<p>
@@ -118,11 +118,11 @@ described. Advanced customization features, typemaps, and other
options are found near the end of the chapter.
</p>
-<H2><a name="Perl5_nn3">33.2 Preliminaries</a></H2>
+<H2><a name="Perl5_nn3">30.2 Preliminaries</a></H2>
<p>
-To build a Perl5 module, run SWIG using the <tt>-perl</tt> option as
+To build a Perl5 module, run SWIG using the <tt>-perl</tt> or <tt>-perl5</tt> option as
follows:
</p>
@@ -143,7 +143,7 @@ To build the module, you will need to compile the file
<tt>example_wrap.c</tt> and link it with the rest of your program.
</p>
-<H3><a name="Perl5_nn4">33.2.1 Getting the right header files</a></H3>
+<H3><a name="Perl5_nn4">30.2.1 Getting the right header files</a></H3>
<p>
@@ -175,7 +175,7 @@ $ perl -e 'use Config; print "$Config{archlib}\n";'
</pre>
</div>
-<H3><a name="Perl5_nn5">33.2.2 Compiling a dynamic module</a></H3>
+<H3><a name="Perl5_nn5">30.2.2 Compiling a dynamic module</a></H3>
<p>
@@ -208,7 +208,7 @@ the target should be named `<tt>example.so</tt>',
`<tt>example.sl</tt>', or the appropriate dynamic module name on your system.
</p>
-<H3><a name="Perl5_nn6">33.2.3 Building a dynamic module with MakeMaker</a></H3>
+<H3><a name="Perl5_nn6">30.2.3 Building a dynamic module with MakeMaker</a></H3>
<p>
@@ -242,7 +242,7 @@ the preferred approach to compilation. More information about MakeMaker can be
found in "Programming Perl, 2nd ed." by Larry Wall, Tom Christiansen,
and Randal Schwartz.</p>
-<H3><a name="Perl5_nn7">33.2.4 Building a static version of Perl</a></H3>
+<H3><a name="Perl5_nn7">30.2.4 Building a static version of Perl</a></H3>
<p>
@@ -311,7 +311,7 @@ added to it. Depending on your machine, you may need to link with
additional libraries such as <tt>-lsocket, -lnsl, -ldl</tt>, etc.
</p>
-<H3><a name="Perl5_nn8">33.2.5 Using the module</a></H3>
+<H3><a name="Perl5_nn8">30.2.5 Using the module</a></H3>
<p>
@@ -464,7 +464,7 @@ system configuration (this requires root access and you will need to
read the man pages).
</p>
-<H3><a name="Perl5_nn9">33.2.6 Compilation problems and compiling with C++</a></H3>
+<H3><a name="Perl5_nn9">30.2.6 Compilation problems and compiling with C++</a></H3>
<p>
@@ -607,7 +607,7 @@ have to find the macro that conflicts and add an #undef into the .i file. Pleas
any conflicting macros you find to <a href="http://www.swig.org/mail.html">swig-user mailing list</a>.
</p>
-<H3><a name="Perl5_nn10">33.2.7 Compiling for 64-bit platforms</a></H3>
+<H3><a name="Perl5_nn10">30.2.7 Compiling for 64-bit platforms</a></H3>
<p>
@@ -634,7 +634,7 @@ also introduce problems on platforms that support more than one
linking standard (e.g., -o32 and -n32 on Irix).
</p>
-<H2><a name="Perl5_nn11">33.3 Building Perl Extensions under Windows</a></H2>
+<H2><a name="Perl5_nn11">30.3 Building Perl Extensions under Windows</a></H2>
<p>
@@ -645,7 +645,7 @@ section assumes you are using SWIG with Microsoft Visual C++
although the procedure may be similar with other compilers.
</p>
-<H3><a name="Perl5_nn12">33.3.1 Running SWIG from Developer Studio</a></H3>
+<H3><a name="Perl5_nn12">30.3.1 Running SWIG from Developer Studio</a></H3>
<p>
@@ -708,7 +708,7 @@ print "$a\n";
</pre></div>
-<H3><a name="Perl5_nn13">33.3.2 Using other compilers</a></H3>
+<H3><a name="Perl5_nn13">30.3.2 Using other compilers</a></H3>
<p>
@@ -716,7 +716,7 @@ SWIG is known to work with Cygwin and may work with other compilers on Windows.
For general hints and suggestions refer to the <a href="Windows.html#Windows">Windows</a> chapter.
</p>
-<H2><a name="Perl5_nn14">33.4 The low-level interface</a></H2>
+<H2><a name="Perl5_nn14">30.4 The low-level interface</a></H2>
<p>
@@ -726,7 +726,7 @@ can be used to control your application. However, it is also used to
construct more user-friendly proxy classes as described in the next section.
</p>
-<H3><a name="Perl5_nn15">33.4.1 Functions</a></H3>
+<H3><a name="Perl5_nn15">30.4.1 Functions</a></H3>
<p>
@@ -749,7 +749,7 @@ use example;
$a = &amp;example::fact(2);
</pre></div>
-<H3><a name="Perl5_nn16">33.4.2 Global variables</a></H3>
+<H3><a name="Perl5_nn16">30.4.2 Global variables</a></H3>
<p>
@@ -819,7 +819,7 @@ extern char *path; // Declared later in the input
</pre>
</div>
-<H3><a name="Perl5_nn17">33.4.3 Constants</a></H3>
+<H3><a name="Perl5_nn17">30.4.3 Constants</a></H3>
<p>
@@ -859,7 +859,7 @@ print example::FOO, "\n";
</pre>
</div>
-<H3><a name="Perl5_nn18">33.4.4 Pointers</a></H3>
+<H3><a name="Perl5_nn18">30.4.4 Pointers</a></H3>
<p>
@@ -949,7 +949,7 @@ Foo *BarToFoo(Bar *b) {
}
Foo *IncrFoo(Foo *f, int i) {
- return f+i;
+ return f+i;
}
%}
</pre>
@@ -968,7 +968,7 @@ as XS and <tt>xsubpp</tt>. Given the advancement of the SWIG typesystem and the
SWIG and XS, this is no longer supported.
</p>
-<H3><a name="Perl5_nn19">33.4.5 Structures</a></H3>
+<H3><a name="Perl5_nn19">30.4.5 Structures</a></H3>
<p>
@@ -1057,7 +1057,7 @@ produces a single accessor function like this:
<div class="code">
<pre>
int *Foo_x_get(Foo *self) {
- return self-&gt;x;
+ return self-&gt;x;
};
</pre>
</div>
@@ -1092,17 +1092,17 @@ generates accessor functions such as this:
<div class="code">
<pre>
Foo *Bar_f_get(Bar *b) {
- return &amp;b-&gt;f;
+ return &amp;b-&gt;f;
}
void Bar_f_set(Bar *b, Foo *val) {
- b-&gt;f = *val;
+ b-&gt;f = *val;
}
</pre>
</div>
-<H3><a name="Perl5_nn20">33.4.6 C++ classes</a></H3>
+<H3><a name="Perl5_nn20">30.4.6 C++ classes</a></H3>
<p>
@@ -1167,7 +1167,7 @@ provides direct access to C++ objects. A higher level interface using Perl prox
can be built using these low-level accessors. This is described shortly.
</p>
-<H3><a name="Perl5_nn21">33.4.7 C++ classes and type-checking</a></H3>
+<H3><a name="Perl5_nn21">30.4.7 C++ classes and type-checking</a></H3>
<p>
@@ -1203,7 +1203,7 @@ If necessary, the type-checker also adjusts the value of the pointer (as is nece
multiple inheritance is used).
</p>
-<H3><a name="Perl5_nn22">33.4.8 C++ overloaded functions</a></H3>
+<H3><a name="Perl5_nn22">30.4.8 C++ overloaded functions</a></H3>
<p>
@@ -1247,7 +1247,7 @@ example::Spam_foo_d($s, 3.14);
Please refer to the "SWIG Basics" chapter for more information.
</p>
-<H3><a name="Perl5_nn23">33.4.9 Operators</a></H3>
+<H3><a name="Perl5_nn23">30.4.9 Operators</a></H3>
<p>
@@ -1274,7 +1274,7 @@ The following C++ operators are currently supported by the Perl module:
<li>operator or </li>
</ul>
-<H3><a name="Perl5_nn24">33.4.10 Modules and packages</a></H3>
+<H3><a name="Perl5_nn24">30.4.10 Modules and packages</a></H3>
<p>
@@ -1369,7 +1369,7 @@ print Foo::fact(4), "\n"; # Call a function in package FooBar
</pre></div>
-->
-<H2><a name="Perl5_nn25">33.5 Input and output parameters</a></H2>
+<H2><a name="Perl5_nn25">30.5 Input and output parameters</a></H2>
<p>
@@ -1588,7 +1588,7 @@ print "$c\n";
<b>Note:</b> The <tt>REFERENCE</tt> feature is only currently supported for numeric types (integers and floating point).
</p>
-<H2><a name="Perl5_nn26">33.6 Exception handling</a></H2>
+<H2><a name="Perl5_nn26">30.6 Exception handling</a></H2>
<p>
@@ -1633,9 +1633,8 @@ class DoubleArray {
void setitem(int i, double val) {
if ((i &gt;= 0) &amp;&amp; (i &lt; n))
ptr[i] = val;
- else {
+ else
throw RangeError();
- }
}
};
</pre></div>
@@ -1753,7 +1752,7 @@ This is still supported, but it is deprecated. The newer <tt>%exception</tt> di
functionality, but it has additional capabilities that make it more powerful.
</p>
-<H2><a name="Perl5_nn27">33.7 Remapping datatypes with typemaps</a></H2>
+<H2><a name="Perl5_nn27">30.7 Remapping datatypes with typemaps</a></H2>
<p>
@@ -1770,7 +1769,7 @@ Typemaps are only used if you want to change some aspect of the primitive
C-Perl interface.
</p>
-<H3><a name="Perl5_nn28">33.7.1 A simple typemap example</a></H3>
+<H3><a name="Perl5_nn28">30.7.1 A simple typemap example</a></H3>
<p>
@@ -1874,7 +1873,7 @@ example::count("e", "Hello World");
</div>
-<H3><a name="Perl5_nn29">33.7.2 Perl5 typemaps</a></H3>
+<H3><a name="Perl5_nn29">30.7.2 Perl5 typemaps</a></H3>
<p>
@@ -1888,9 +1887,9 @@ like this:
<div class="targetlang">
<pre>
%typemap(out) int {
- $result = sv_newmortal();
- set_setiv($result, (IV) $1);
- argvi++;
+ $result = sv_newmortal();
+ sv_setiv($result, (IV) $1);
+ argvi++;
}
</pre>
</div>
@@ -1979,7 +1978,7 @@ Return of C++ member data (all languages).
Check value of input parameter.
</div>
-<H3><a name="Perl5_nn30">33.7.3 Typemap variables</a></H3>
+<H3><a name="Perl5_nn30">30.7.3 Typemap variables</a></H3>
<p>
@@ -2050,7 +2049,7 @@ properly assigned.
The Perl name of the wrapper function being created.
</div>
-<H3><a name="Perl5_nn31">33.7.4 Useful functions</a></H3>
+<H3><a name="Perl5_nn31">30.7.4 Useful functions</a></H3>
<p>
@@ -2119,7 +2118,7 @@ int sv_isa(SV *, char *0;
</div>
-<H2><a name="Perl5_nn32">33.8 Typemap Examples</a></H2>
+<H2><a name="Perl5_nn32">30.8 Typemap Examples</a></H2>
<p>
@@ -2128,7 +2127,7 @@ might look at the files "<tt>perl5.swg</tt>" and "<tt>typemaps.i</tt>" in
the SWIG library.
</p>
-<H3><a name="Perl5_nn33">33.8.1 Converting a Perl5 array to a char **</a></H3>
+<H3><a name="Perl5_nn33">30.8.1 Converting a Perl5 array to a char **</a></H3>
<p>
@@ -2220,7 +2219,7 @@ print @$b, "\n"; # Print it out
</pre></div>
-<H3><a name="Perl5_nn34">33.8.2 Return values</a></H3>
+<H3><a name="Perl5_nn34">30.8.2 Return values</a></H3>
<p>
@@ -2249,7 +2248,7 @@ can be done using the <tt>EXTEND()</tt> macro as in:
}
</pre></div>
-<H3><a name="Perl5_nn35">33.8.3 Returning values from arguments</a></H3>
+<H3><a name="Perl5_nn35">30.8.3 Returning values from arguments</a></H3>
<p>
@@ -2303,7 +2302,7 @@ print "multout(7, 13) = @r\n";
($x, $y) = multout(7, 13);
</pre></div>
-<H3><a name="Perl5_nn36">33.8.4 Accessing array structure members</a></H3>
+<H3><a name="Perl5_nn36">30.8.4 Accessing array structure members</a></H3>
<p>
@@ -2313,8 +2312,8 @@ Consider the following data structure:
<div class="code"><pre>
#define SIZE 8
typedef struct {
- int values[SIZE];
- ...
+ int values[SIZE];
+ ...
} Foo;
</pre></div>
@@ -2328,10 +2327,10 @@ To make the member writable, a "memberin" typemap can be used.
<div class="code"><pre>
%typemap(memberin) int [SIZE] {
- int i;
- for (i = 0; i &lt; SIZE; i++) {
- $1[i] = $input[i];
- }
+ int i;
+ for (i = 0; i &lt; SIZE; i++) {
+ $1[i] = $input[i];
+ }
}
</pre></div>
@@ -2366,7 +2365,7 @@ the "in" typemap in the previous section would be used to convert an
to copy the converted array into a C data structure.
</p>
-<H3><a name="Perl5_nn37">33.8.5 Turning Perl references into C pointers</a></H3>
+<H3><a name="Perl5_nn37">30.8.5 Turning Perl references into C pointers</a></H3>
<p>
@@ -2431,7 +2430,7 @@ print "$c\n";
</pre></div>
-<H3><a name="Perl5_nn38">33.8.6 Pointer handling</a></H3>
+<H3><a name="Perl5_nn38">30.8.6 Pointer handling</a></H3>
<p>
@@ -2516,7 +2515,7 @@ For example:
</pre>
</div>
-<H2><a name="Perl5_nn39">33.9 Proxy classes</a></H2>
+<H2><a name="Perl5_nn39">30.9 Proxy classes</a></H2>
<p>
@@ -2532,7 +2531,7 @@ to the underlying code. This section describes the implementation
details of the proxy interface.
</p>
-<H3><a name="Perl5_nn40">33.9.1 Preliminaries</a></H3>
+<H3><a name="Perl5_nn40">30.9.1 Preliminaries</a></H3>
<p>
@@ -2554,7 +2553,7 @@ SWIG creates a collection of high-level Perl wrappers. In your scripts, you wil
high level wrappers. The wrappers, in turn, interact with the low-level procedural module.
</p>
-<H3><a name="Perl5_nn41">33.9.2 Structure and class wrappers</a></H3>
+<H3><a name="Perl5_nn41">30.9.2 Structure and class wrappers</a></H3>
<p>
@@ -2600,48 +2599,48 @@ package example::Vector;
%BLESSEDMEMBERS = ();
sub new () {
- my $self = shift;
- my @args = @_;
- $self = vectorc::new_Vector(@args);
- return undef if (!defined($self));
- bless $self, "example::Vector";
- $OWNER{$self} = 1;
- my %retval;
- tie %retval, "example::Vector", $self;
- return bless \%retval, "Vector";
+ my $self = shift;
+ my @args = @_;
+ $self = vectorc::new_Vector(@args);
+ return undef if (!defined($self));
+ bless $self, "example::Vector";
+ $OWNER{$self} = 1;
+ my %retval;
+ tie %retval, "example::Vector", $self;
+ return bless \%retval, "Vector";
}
sub DESTROY {
- return unless $_[0]-&gt;isa('HASH');
- my $self = tied(%{$_[0]});
- delete $ITERATORS{$self};
- if (exists $OWNER{$self}) {
- examplec::delete_Vector($self));
- delete $OWNER{$self};
- }
+ return unless $_[0]-&gt;isa('HASH');
+ my $self = tied(%{$_[0]});
+ delete $ITERATORS{$self};
+ if (exists $OWNER{$self}) {
+ examplec::delete_Vector($self));
+ delete $OWNER{$self};
+ }
}
sub FETCH {
- my ($self, $field) = @_;
- my $member_func = "vectorc::Vector_${field}_get";
- my $val = &amp;$member_func($self);
- if (exists $BLESSEDMEMBERS{$field}) {
- return undef if (!defined($val));
- my %retval;
- tie %retval, $BLESSEDMEMBERS{$field}, $val;
- return bless \%retval, $BLESSEDMEMBERS{$field};
- }
- return $val;
+ my ($self, $field) = @_;
+ my $member_func = "vectorc::Vector_${field}_get";
+ my $val = &amp;$member_func($self);
+ if (exists $BLESSEDMEMBERS{$field}) {
+ return undef if (!defined($val));
+ my %retval;
+ tie %retval, $BLESSEDMEMBERS{$field}, $val;
+ return bless \%retval, $BLESSEDMEMBERS{$field};
+ }
+ return $val;
}
sub STORE {
- my ($self, $field, $newval) = @_;
- my $member_func = "vectorc::Vector_${field}_set";
- if (exists $BLESSEDMEMBERS{$field}) {
- &amp;$member_func($self, tied(%{$newval}));
- } else {
- &amp;$member_func($self, $newval);
- }
+ my ($self, $field, $newval) = @_;
+ my $member_func = "vectorc::Vector_${field}_set";
+ if (exists $BLESSEDMEMBERS{$field}) {
+ &amp;$member_func($self, tied(%{$newval}));
+ } else {
+ &amp;$member_func($self, $newval);
+ }
}
</pre></div>
@@ -2681,7 +2680,7 @@ $v-&gt;DESTROY();
</pre></div>
-<H3><a name="Perl5_nn42">33.9.3 Object Ownership</a></H3>
+<H3><a name="Perl5_nn42">30.9.3 Object Ownership</a></H3>
<p>
@@ -2768,7 +2767,7 @@ counting, garbage collection, or advanced features one might find in
sophisticated languages.
</p>
-<H3><a name="Perl5_nn43">33.9.4 Nested Objects</a></H3>
+<H3><a name="Perl5_nn43">30.9.4 Nested Objects</a></H3>
<p>
@@ -2821,7 +2820,7 @@ $p-&gt;{f}-&gt;{x} = 0.0;
%${$p-&gt;{v}} = ( x=&gt;0, y=&gt;0, z=&gt;0);
</pre></div>
-<H3><a name="Perl5_nn44">33.9.5 Proxy Functions</a></H3>
+<H3><a name="Perl5_nn44">30.9.5 Proxy Functions</a></H3>
<p>
@@ -2842,11 +2841,11 @@ this:
<div class="targetlang"><pre>
sub dot_product {
- my @args = @_;
- $args[0] = tied(%{$args[0]}); # Get the real pointer values
- $args[1] = tied(%{$args[1]});
- my $result = vectorc::dot_product(@args);
- return $result;
+ my @args = @_;
+ $args[0] = tied(%{$args[0]}); # Get the real pointer values
+ $args[1] = tied(%{$args[1]});
+ my $result = vectorc::dot_product(@args);
+ return $result;
}
</pre></div>
@@ -2855,7 +2854,7 @@ This function replaces the original function, but operates in an
identical manner.
</p>
-<H3><a name="Perl5_nn45">33.9.6 Inheritance</a></H3>
+<H3><a name="Perl5_nn45">30.9.6 Inheritance</a></H3>
<p>
@@ -2931,7 +2930,7 @@ particular, inheritance of data members is extremely tricky (and I'm
not even sure if it really works).
</p>
-<H3><a name="Perl5_nn46">33.9.7 Modifying the proxy methods</a></H3>
+<H3><a name="Perl5_nn46">30.9.7 Modifying the proxy methods</a></H3>
<p>
@@ -2959,7 +2958,7 @@ public:
};
</pre></div>
-<H2><a name="Perl5_nn47">33.10 Adding additional Perl code</a></H2>
+<H2><a name="Perl5_nn47">30.10 Adding additional Perl code</a></H2>
<p>
@@ -2985,7 +2984,7 @@ sub set_transform
for (my $j = 0; $j &lt; 4, $j++)
{
mat44_set($a, $i, $j, $x-&gt;[i][j])
- }
+ }
}
example.set_transform($im, $a);
free_mat44($a);
@@ -3010,7 +3009,7 @@ set_transform($im, $a);
</pre>
</div>
-<H2><a name="Perl5_directors">33.11 Cross language polymorphism</a></H2>
+<H2><a name="Perl5_directors">30.11 Cross language polymorphism</a></H2>
<p>
@@ -3044,7 +3043,7 @@ proxy classes, director classes, and C wrapper functions takes care of
all the cross-language method routing transparently.
</p>
-<H3><a name="Perl5_nn48">33.11.1 Enabling directors</a></H3>
+<H3><a name="Perl5_nn48">30.11.1 Enabling directors</a></H3>
<p>
@@ -3071,7 +3070,7 @@ globally, to specific classes, and to specific methods, like this:
// generate directors for all classes that have virtual methods
%feature("director");
-// generate directors for all virtual methods in class Foo
+// generate directors for the virtual methods in class Foo
%feature("director") Foo;
</pre>
</div>
@@ -3089,7 +3088,7 @@ directors for specific classes or methods. So for example,
</div>
<p>
-will generate directors for all virtual methods of class Foo except
+will generate directors for the virtual methods of class Foo except
bar().
</p>
@@ -3104,14 +3103,14 @@ the methods one() and two() (but not three()):
%feature("director") Foo;
class Foo {
public:
- Foo(int foo);
- virtual void one();
- virtual void two();
+ Foo(int foo);
+ virtual void one();
+ virtual void two();
};
class Bar: public Foo {
public:
- virtual void three();
+ virtual void three();
};
</pre>
</div>
@@ -3134,7 +3133,7 @@ sub one {
</div>
-<H3><a name="Perl5_nn49">33.11.2 Director classes</a></H3>
+<H3><a name="Perl5_nn49">30.11.2 Director classes</a></H3>
@@ -3154,7 +3153,8 @@ For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the
original C++ class as the director's base class. By default, a director
class extends all virtual methods in the inheritance chain of its base
class (see the preceding section for how to modify this behavior).
-Thus all virtual method calls, whether they originate in C++ or in
+Virtual methods that have a final specifier are unsurprisingly excluded.
+Thus the virtual method calls, whether they originate in C++ or in
Perl via proxy classes, eventually end up in at the implementation in
the director class. The job of the director methods is to route these
method calls to the appropriate place in the inheritance chain. By
@@ -3214,7 +3214,7 @@ so there is no need for the extra overhead involved with routing the
calls through Perl.
</p>
-<H3><a name="Perl5_nn50">33.11.3 Ownership and object destruction</a></H3>
+<H3><a name="Perl5_nn50">30.11.3 Ownership and object destruction</a></H3>
<p>
@@ -3263,7 +3263,7 @@ sub DESTROY {
</div>
-<H3><a name="Perl5_nn51">33.11.4 Exception unrolling</a></H3>
+<H3><a name="Perl5_nn51">30.11.4 Exception unrolling</a></H3>
<p>
@@ -3279,9 +3279,9 @@ suffice in most cases:
<div class="code">
<pre>
%feature("director:except") {
- if ($error != NULL) {
- throw Swig::DirectorMethodException();
- }
+ if ($error != NULL) {
+ throw Swig::DirectorMethodException();
+ }
}
</pre>
</div>
@@ -3305,8 +3305,8 @@ suitable exception handler:
<div class="code">
<pre>
%exception {
- try { $action }
- catch (Swig::DirectorException &amp;e) { SWIG_fail; }
+ try { $action }
+ catch (Swig::DirectorException &amp;e) { SWIG_fail; }
}
</pre>
</div>
@@ -3319,7 +3319,7 @@ Swig::DirectorMethodException is thrown, Perl will register the
exception as soon as the C wrapper function returns.
</p>
-<H3><a name="Perl5_nn52">33.11.5 Overhead and code bloat</a></H3>
+<H3><a name="Perl5_nn52">30.11.5 Overhead and code bloat</a></H3>
<p>
@@ -3353,7 +3353,7 @@ directive) for only those methods that are likely to be extended in
Perl.
</p>
-<H3><a name="Perl5_nn53">33.11.6 Typemaps</a></H3>
+<H3><a name="Perl5_nn53">30.11.6 Typemaps</a></H3>
<p>
diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html
index 52bedf87f..d0ec0df7f 100644
--- a/Doc/Manual/Php.html
+++ b/Doc/Manual/Php.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Php">34 SWIG and PHP</a></H1>
+<H1><a name="Php">31 SWIG and PHP</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -50,20 +50,13 @@
<p>
-In this chapter, we discuss SWIG's support of PHP. The PHP module
-was extensively rewritten in release 1.3.26, and support for generating
-OO wrappers for PHP5 was added in 1.3.30. The PHP module now supports most
-of the features available in some of the other languages.
+In this chapter, we discuss SWIG's support of PHP. SWIG currently supports
+generating wrappers for PHP7. Support for PHP5 was removed in SWIG 4.0.0
+and support for PHP4 was removed in SWIG 1.3.37.
</p>
<p>
-SWIG supports generating wrappers for PHP5 and PHP7. Support for PHP4 was removed
-in SWIG 1.3.37.
-</p>
-
-<p>
-Currently any PHP5 or PHP7 release should work, but we don't regularly test with
-PHP &lt; 5.3.
+Currently any PHP7 release should work.
</p>
<p>
@@ -77,13 +70,13 @@ your extension into php directly, you will need the complete PHP source tree
available.
</p>
-<H2><a name="Php_nn1">34.1 Generating PHP Extensions</a></H2>
+<H2><a name="Php_nn1">31.1 Generating PHP Extensions</a></H2>
<p>
-To build a PHP extension, run swig using the <tt>-php5</tt> or
-<tt>-php7</tt> option as follows (<tt>-php</tt> is also supported
-and currently is an alias for <tt>-php5</tt>):
+To build a PHP extension, run swig using the <tt>-php7</tt> option as follows
+(<tt>-php</tt> is also supported and currently is an alias for <tt>-php7</tt>
+but prior to SWIG 4.0.0 it was an alias for <tt>-php5</tt>):
</p>
<div class="code"><pre>
@@ -107,9 +100,7 @@ also contain PHP class wrappers.
SWIG can generate PHP extensions from C++ libraries as well when
given the <tt>-c++</tt> option. The support for C++ is discussed in
more detail in <a href="#Php_nn2_6">section 27.2.6</a>. The generated
-C++ wrapper will be called example_wrap.cpp (for PHP5) or
-example_wrap.cxx (for PHP7 where the default has been changed to align
-with SWIG's default for every other language). You can specify a
+C++ wrapper will be called example_wrap.cxx. You can specify a
different extension for the C++ wrapper using <tt>-cppext</tt> -
e.g. if you want example_wrap.cc use <tt>-cppext cc</tt>.
</p>
@@ -128,7 +119,7 @@ and it doesn't play nicely with package system. We don't recommend
this approach, or provide explicit support for it.
</p>
-<H3><a name="Php_nn1_1">34.1.1 Building a loadable extension</a></H3>
+<H3><a name="Php_nn1_1">31.1.1 Building a loadable extension</a></H3>
<p>
@@ -143,7 +134,7 @@ least work for Linux though):
gcc -shared example_wrap.o example.o -o example.so
</pre></div>
-<H3><a name="Php_nn1_3">34.1.2 Using PHP Extensions</a></H3>
+<H3><a name="Php_nn1_3">31.1.2 Using PHP Extensions</a></H3>
<p>
@@ -162,8 +153,8 @@ If the module is in PHP's default extension directory, you can omit the path.
<p>
For some SAPIs (for example, the CLI SAPI) you can instead use the
-<a href="http://php.net/manual/en/function.dl.php">dl() function</a> to load
-an extension at run time, by adding a like like this to the start of each
+<a href="https://www.php.net/manual/en/function.dl.php">dl() function</a> to load
+an extension at run time, by adding a line like this to the start of each
PHP script which uses your extension:
</p>
@@ -172,8 +163,8 @@ PHP script which uses your extension:
</pre></div>
<p>
-But note that this doesn't work when running PHP through a webserver in PHP5.3
-and later - you'll need to use <tt>extension</tt> in <tt>php.ini</tt> as
+But note that <tt>dl()</tt> isn't supported when running PHP through a
+webserver - you'll need to use <tt>extension</tt> in <tt>php.ini</tt> as
described above.
</p>
@@ -191,7 +182,7 @@ This PHP module also defines the PHP classes for the wrapped API, so you'll
almost certainly want to include it anyway.
</p>
-<H2><a name="Php_nn2">34.2 Basic PHP interface</a></H2>
+<H2><a name="Php_nn2">31.2 Basic PHP interface</a></H2>
<p>
@@ -199,10 +190,11 @@ It is important to understand that PHP uses a single global namespace
into which all symbols from extension modules are loaded. It is quite
possible for names of symbols in one extension module to clash with
other symbols unless care is taken to <tt>%rename</tt> them. At present
-SWIG doesn't have support for the namespace feature added in PHP 5.3.
+SWIG doesn't have support for generating wrappers which make use of PHP's
+namespace feature.
</p>
-<H3><a name="Php_nn2_1">34.2.1 Constants</a></H3>
+<H3><a name="Php_nn2_1">31.2.1 Constants</a></H3>
<p>
@@ -239,10 +231,12 @@ echo "E = " . E . "\n";
<p>
There's one peculiarity of how constants work in PHP which it is useful
to note (this is not specific to SWIG though) - if you try to use an undeclared
-constant, PHP will emit a notice and then expand the constant to a string
-version of the constant's name. Unfortunately it is easy to miss the notice
-if you're using PHP in a webserver, as it will probably end up in error.log or
-similar.
+constant, PHP will emit a warning (or a notice in PHP 7.1 and earlier) and then
+expand the constant to a string version of the constant's name. Unfortunately
+it is easy to miss the warning message if you're using PHP in a webserver as
+it will probably end up in error.log or similar. Apparently this will throw
+an Error in a future version of PHP, but until then it's something to be
+aware of.
</p>
<p>
@@ -276,11 +270,10 @@ if(EASY_TO_MISPEL) {
<p>
The mis-spelled constant will become the string 'EASY_TO_MISPEL', which
is treated as true by the if test, when the value of the intended constant
-would be treated as false! Modern versions of PHP will at least issue
-a PHP notice by default when this happens.
+would be treated as false!
</p>
-<H3><a name="Php_nn2_2">34.2.2 Global Variables</a></H3>
+<H3><a name="Php_nn2_2">31.2.2 Global Variables</a></H3>
<p>
@@ -329,7 +322,7 @@ undefined.
At this time SWIG does not support custom accessor methods.
</p>
-<H3><a name="Php_nn2_3">34.2.3 Functions</a></H3>
+<H3><a name="Php_nn2_3">31.2.3 Functions</a></H3>
<p>
@@ -382,7 +375,7 @@ print $s; # The value of $s was not changed.
-->
-<H3><a name="Php_nn2_4">34.2.4 Overloading</a></H3>
+<H3><a name="Php_nn2_4">31.2.4 Overloading</a></H3>
<p>
@@ -390,8 +383,7 @@ Although PHP does not support overloading functions natively, swig
will generate dispatch functions which will use <tt>%typecheck</tt>
typemaps to allow overloading. This dispatch function's operation and
precedence is described in <a
-href="SWIGPlus.html#SWIGPlus_overloaded_methods">Wrapping
-Overloaded Functions and Methods</a>.
+href="SWIGPlus.html#SWIGPlus_overloaded_methods">Overloaded functions and methods</a>.
</p>
<!-- This isn't correct for 1.3.30 and needs rewriting to reflect reality
@@ -438,7 +430,7 @@ taking the integer argument.
</p>
-->
-<H3><a name="Php_nn2_5">34.2.5 Pointers and References</a></H3>
+<H3><a name="Php_nn2_5">31.2.5 Pointers and References</a></H3>
<p>
@@ -527,13 +519,6 @@ named typemap REF.
</p>
<p>
-Prior to SWIG 3.0, the REF typemaps relied on PHP's call-time
-pass-by-reference, which was deprecated in PHP 5.3 and removed in PHP 5.4.
-So if you use these REF typemaps, you should ensure that SWIG&ge;3.0 is
-used to generate wrappers from your interface file.
-</p>
-
-<p>
In case you write your own typemaps, SWIG supports an attribute called
<tt>byref</tt>: if you set that, then SWIG will make sure that the generated
wrapper function will want the input parameter as a reference.
@@ -583,7 +568,7 @@ PHP in a number of ways: by using <tt>unset</tt> on an existing
variable, or assigning <tt>NULL</tt> to a variable.
</p>
-<H3><a name="Php_nn2_6">34.2.6 Structures and C++ classes</a></H3>
+<H3><a name="Php_nn2_6">31.2.6 Structures and C++ classes</a></H3>
<p>
@@ -644,7 +629,7 @@ Would be used in the following way from PHP:
Member variables and methods are accessed using the <tt>-&gt;</tt> operator.
</p>
-<H4><a name="Php_nn2_6_1">34.2.6.1 Using -noproxy</a></H4>
+<H4><a name="Php_nn2_6_1">31.2.6.1 Using -noproxy</a></H4>
<p>
@@ -670,7 +655,7 @@ Complex_im_set($obj, $d);
Complex_im_get($obj);
</pre></div>
-<H4><a name="Php_nn2_6_2">34.2.6.2 Constructors and Destructors</a></H4>
+<H4><a name="Php_nn2_6_2">31.2.6.2 Constructors and Destructors</a></H4>
<p>
@@ -711,7 +696,7 @@ the programmer can either reassign the variable or call
<tt>unset($v)</tt>
</p>
-<H4><a name="Php_nn2_6_3">34.2.6.3 Static Member Variables</a></H4>
+<H4><a name="Php_nn2_6_3">31.2.6.3 Static Member Variables</a></H4>
<p>
@@ -754,7 +739,7 @@ Ko::threats(10);
echo "There have now been " . Ko::threats() . " threats\n";
</pre></div>
-<H4><a name="Php_nn2_6_4">34.2.6.4 Static Member Functions</a></H4>
+<H4><a name="Php_nn2_6_4">31.2.6.4 Static Member Functions</a></H4>
<p>
@@ -776,7 +761,7 @@ Ko::threats();
</pre></div>
-<H4><a name="Php_nn2_6_5">34.2.6.5 Specifying Implemented Interfaces</a></H4>
+<H4><a name="Php_nn2_6_5">31.2.6.5 Specifying Implemented Interfaces</a></H4>
<p>
@@ -794,7 +779,7 @@ so:
If there are multiple interfaces, just list them separated by commas.
</p>
-<H3><a name="Php_nn2_7">34.2.7 PHP Pragmas, Startup and Shutdown code</a></H3>
+<H3><a name="Php_nn2_7">31.2.7 PHP Pragmas, Startup and Shutdown code</a></H3>
<p>
@@ -821,6 +806,15 @@ echo "example.php execution\n";
</pre></div>
<p>
+The <b>version</b> pragma can be used to add version to generated PHP extension module. The version is inserted in the zend_module_entry block.
+</p>
+
+<div class="code"><pre>
+%module example
+%pragma(php) version="1.5"
+</pre></div>
+
+<p>
The <b>include</b> pragma is a short cut to add include statements to
the example.php file.
</p>
@@ -882,7 +876,7 @@ The <tt>%rinit</tt> and <tt>%rshutdown</tt> statements are very similar but inse
into the request init (PHP_RINIT_FUNCTION) and request shutdown (PHP_RSHUTDOWN_FUNCTION) code respectively.
</p>
-<H2><a name="Php_nn3">34.3 Cross language polymorphism</a></H2>
+<H2><a name="Php_nn3">31.3 Cross language polymorphism</a></H2>
<p>
@@ -917,7 +911,7 @@ wrapper functions takes care of all the cross-language method routing
transparently.
</p>
-<H3><a name="Php_nn3_1">34.3.1 Enabling directors</a></H3>
+<H3><a name="Php_nn3_1">31.3.1 Enabling directors</a></H3>
<p>
@@ -944,7 +938,7 @@ globally, to specific classes, and to specific methods, like this:
// generate directors for all classes that have virtual methods
%feature("director");
-// generate directors for all virtual methods in class Foo
+// generate directors for the virtual methods in class Foo
%feature("director") Foo;
</pre>
</div>
@@ -962,7 +956,7 @@ directors for specific classes or methods. So for example,
</div>
<p>
-will generate directors for all virtual methods of class Foo except
+will generate directors for the virtual methods of class Foo except
bar().
</p>
@@ -977,14 +971,14 @@ the methods one() and two() (but not three()):
%feature("director") Foo;
class Foo {
public:
- Foo(int foo);
- virtual void one();
- virtual void two();
+ Foo(int foo);
+ virtual void one();
+ virtual void two();
};
class Bar: public Foo {
public:
- virtual void three();
+ virtual void three();
};
</pre>
</div>
@@ -1006,7 +1000,7 @@ class MyFoo extends Foo {
</div>
-<H3><a name="Php_nn3_2">34.3.2 Director classes</a></H3>
+<H3><a name="Php_nn3_2">31.3.2 Director classes</a></H3>
@@ -1027,7 +1021,8 @@ For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the
original C++ class as the director's base class. By default, a director
class extends all virtual methods in the inheritance chain of its base
class (see the preceding section for how to modify this behavior).
-Thus all virtual method calls, whether they originate in C++ or in
+Virtual methods that have a final specifier are unsurprisingly excluded.
+Thus the virtual method calls, whether they originate in C++ or in
PHP via proxy classes, eventually end up in at the implementation in the
director class. The job of the director methods is to route these method
calls to the appropriate place in the inheritance chain. By "appropriate
@@ -1086,7 +1081,7 @@ so there is no need for the extra overhead involved with routing the
calls through PHP.
</p>
-<H3><a name="Php_nn3_3">34.3.3 Ownership and object destruction</a></H3>
+<H3><a name="Php_nn3_3">31.3.3 Ownership and object destruction</a></H3>
<p>
@@ -1116,12 +1111,12 @@ Here is an example:
<pre>
class Foo {
public:
- ...
+ ...
};
class FooContainer {
public:
- void addFoo(Foo *);
- ...
+ void addFoo(Foo *);
+ ...
};
</pre>
</div>
@@ -1142,7 +1137,7 @@ In this example, we are assuming that FooContainer will take care of
deleting all the Foo pointers it contains at some point.
</p>
-<H3><a name="Php_nn3_4">34.3.4 Exception unrolling</a></H3>
+<H3><a name="Php_nn3_4">31.3.4 Exception unrolling</a></H3>
<p>
@@ -1166,9 +1161,9 @@ should suffice in most cases:
<div class="code">
<pre>
%feature("director:except") {
- if ($error == FAILURE) {
- throw Swig::DirectorMethodException();
- }
+ if ($error == FAILURE) {
+ throw Swig::DirectorMethodException();
+ }
}
</pre>
</div>
@@ -1195,8 +1190,8 @@ suitable exception handler:
<div class="code">
<pre>
%exception {
- try { $action }
- catch (Swig::DirectorException &amp;e) { SWIG_fail; }
+ try { $action }
+ catch (Swig::DirectorException &amp;e) { SWIG_fail; }
}
</pre>
</div>
@@ -1209,7 +1204,7 @@ Swig::DirectorMethodException is thrown, PHP will register the exception
as soon as the C wrapper function returns.
</p>
-<H3><a name="Php_nn3_5">34.3.5 Overhead and code bloat</a></H3>
+<H3><a name="Php_nn3_5">31.3.5 Overhead and code bloat</a></H3>
<p>
@@ -1242,7 +1237,7 @@ optimized by selectively enabling director methods (using the %feature
directive) for only those methods that are likely to be extended in PHP.
</p>
-<H3><a name="Php_nn3_6">34.3.6 Typemaps</a></H3>
+<H3><a name="Php_nn3_6">31.3.6 Typemaps</a></H3>
<p>
@@ -1256,7 +1251,7 @@ need to be supported.
</p>
-<H3><a name="Php_nn3_7">34.3.7 Miscellaneous</a></H3>
+<H3><a name="Php_nn3_7">31.3.7 Miscellaneous</a></H3>
<p> Director typemaps for STL classes are mostly in place, and hence you
diff --git a/Doc/Manual/Pike.html b/Doc/Manual/Pike.html
index 22ab4e2a2..2b8432399 100644
--- a/Doc/Manual/Pike.html
+++ b/Doc/Manual/Pike.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Pike">35 SWIG and Pike</a></H1>
+<H1><a name="Pike">37 SWIG and Pike</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -47,10 +47,10 @@ least, make sure you read the "<a href="SWIG.html#SWIG">SWIG Basics</a>"
chapter.<br>
</p>
-<H2><a name="Pike_nn2">35.1 Preliminaries</a></H2>
+<H2><a name="Pike_nn2">37.1 Preliminaries</a></H2>
-<H3><a name="Pike_nn3">35.1.1 Running SWIG</a></H3>
+<H3><a name="Pike_nn3">37.1.1 Running SWIG</a></H3>
<p>
@@ -95,7 +95,7 @@ can use the <tt>-o</tt> option:
<div class="code">
<pre>$ <b>swig -pike -o pseudonym.c example.i</b><br></pre>
</div>
-<H3><a name="Pike_nn4">35.1.2 Getting the right header files</a></H3>
+<H3><a name="Pike_nn4">37.1.2 Getting the right header files</a></H3>
<p>
@@ -115,7 +115,7 @@ You're looking for files with the names <tt>global.h</tt>, <tt>program.h</tt>
and so on.
</p>
-<H3><a name="Pike_nn5">35.1.3 Using your module</a></H3>
+<H3><a name="Pike_nn5">37.1.3 Using your module</a></H3>
<p>
@@ -130,10 +130,10 @@ Pike v7.4 release 10 running Hilfe v3.5 (Incremental Pike Frontend)
(1) Result: 24
</pre></div>
-<H2><a name="Pike_nn6">35.2 Basic C/C++ Mapping</a></H2>
+<H2><a name="Pike_nn6">37.2 Basic C/C++ Mapping</a></H2>
-<H3><a name="Pike_nn7">35.2.1 Modules</a></H3>
+<H3><a name="Pike_nn7">37.2.1 Modules</a></H3>
<p>
@@ -144,7 +144,7 @@ concerned), SWIG's <tt>%module</tt> directive doesn't really have any
significance.
</p>
-<H3><a name="Pike_nn8">35.2.2 Functions</a></H3>
+<H3><a name="Pike_nn8">37.2.2 Functions</a></H3>
<p>
@@ -169,7 +169,7 @@ exactly as you'd expect it to:
(1) Result: 24
</pre></div>
-<H3><a name="Pike_nn9">35.2.3 Global variables</a></H3>
+<H3><a name="Pike_nn9">37.2.3 Global variables</a></H3>
<p>
@@ -198,7 +198,7 @@ will result in two functions, <tt>Foo_get()</tt> and <tt>Foo_set()</tt>:
(3) Result: 3.141590
</pre></div>
-<H3><a name="Pike_nn10">35.2.4 Constants and enumerated types</a></H3>
+<H3><a name="Pike_nn10">37.2.4 Constants and enumerated types</a></H3>
<p>
@@ -206,7 +206,7 @@ Enumerated types in C/C++ declarations are wrapped as Pike constants,
not as Pike enums.
</p>
-<H3><a name="Pike_nn11">35.2.5 Constructors and Destructors</a></H3>
+<H3><a name="Pike_nn11">37.2.5 Constructors and Destructors</a></H3>
<p>
@@ -214,7 +214,7 @@ Constructors are wrapped as <tt>create()</tt> methods, and destructors are
wrapped as <tt>destroy()</tt> methods, for Pike classes.
</p>
-<H3><a name="Pike_nn12">35.2.6 Static Members</a></H3>
+<H3><a name="Pike_nn12">37.2.6 Static Members</a></H3>
<p>
@@ -230,8 +230,8 @@ For example, given this C++ class declaration:
class Shape
{
public:
- static void print();
- static int nshapes;
+ static void print();
+ static int nshapes;
};
</pre></div>
diff --git a/Doc/Manual/Preface.html b/Doc/Manual/Preface.html
index 3b654a6d2..36a99bd1f 100644
--- a/Doc/Manual/Preface.html
+++ b/Doc/Manual/Preface.html
@@ -69,6 +69,9 @@ over a period of 10 years starting from the year 2000. The final version in the
series was 1.3.40, but in truth the 1.3.x series had been stable for many years.
An official stable version was released along with the decision to make SWIG
license changes and this gave rise to version 2.0.0 in 2010.
+Version 3.0.0 was released in 2014 focusing on adding C++11 support and C++ nested classes.
+Version 4.0.0 was released in 2019 to add in Doxygen support.
+Some target languages were disabled as part of a clean up and others were given a new status of either 'Supported' or 'Experimental'.
</p>
<H2><a name="Preface_license">1.3 SWIG License</a></H2>
@@ -364,7 +367,7 @@ a number of packages to be installed. Full instructions at
<p>
SWIG is known to work on various flavors of OS X. Follow the Unix installation
instructions above. However, as of this writing, there is still great deal of
-inconsistency with how shared libaries are handled by various scripting languages
+inconsistency with how shared libraries are handled by various scripting languages
on OS X.
</p>
@@ -435,7 +438,7 @@ don't intend to use these features in your own programs.
</p>
<p>
-Note: The test-suite currently contains over 500 tests. If you
+Note: The test-suite currently contains over 600 tests. If you
have many different target languages installed and a slow machine, it
might take more than an hour to run the test-suite.
</p>
diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html
index efa0c0f8e..3d1bb453e 100644
--- a/Doc/Manual/Preprocessor.html
+++ b/Doc/Manual/Preprocessor.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Preprocessor">8 Preprocessing</a></H1>
+<H1><a name="Preprocessor">10 Preprocessing</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -38,7 +38,7 @@ However, a number of modifications and enhancements have been made. This
chapter describes some of these modifications.
</p>
-<H2><a name="Preprocessor_nn2">8.1 File inclusion</a></H2>
+<H2><a name="Preprocessor_nn2">10.1 File inclusion</a></H2>
<p>
@@ -64,7 +64,7 @@ By default, the <tt>#include</tt> is ignored unless you run SWIG with the
is that you often don't want SWIG to try and wrap everything included
in standard header system headers and auxiliary files.
-<H2><a name="Preprocessor_nn3">8.2 File imports</a></H2>
+<H2><a name="Preprocessor_nn3">10.2 File imports</a></H2>
<p>
@@ -93,7 +93,7 @@ The <tt>-importall</tt> directive tells SWIG to follow all <tt>#include</tt> sta
as imports. This might be useful if you want to extract type definitions from system
header files without generating any wrappers.
-<H2><a name="Preprocessor_condition_compilation">8.3 Conditional Compilation</a></H2>
+<H2><a name="Preprocessor_condition_compilation">10.3 Conditional Compilation</a></H2>
<p>
@@ -109,10 +109,6 @@ SWIGIMPORTED Defined when SWIG is importing a file with <tt>%
SWIG_VERSION Hexadecimal (binary-coded decimal) number containing SWIG version,
such as 0x010311 (corresponding to SWIG-1.3.11).
-SWIGALLEGROCL Defined when using Allegro CL
-SWIGCFFI Defined when using CFFI
-SWIGCHICKEN Defined when using CHICKEN
-SWIGCLISP Defined when using CLISP
SWIGCSHARP Defined when using C#
SWIGGUILE Defined when using Guile
SWIGJAVA Defined when using Java
@@ -120,20 +116,16 @@ SWIGJAVASCRIPT Defined when using Javascript
SWIG_JAVASCRIPT_JSC Defined when using Javascript for JavascriptCore
SWIG_JAVASCRIPT_V8 Defined when using Javascript for v8 or node.js
SWIGLUA Defined when using Lua
-SWIGMODULA3 Defined when using Modula-3
SWIGMZSCHEME Defined when using Mzscheme
-SWIGOCAML Defined when using Ocaml
+SWIGOCAML Defined when using OCaml
SWIGOCTAVE Defined when using Octave
SWIGPERL Defined when using Perl
-SWIGPHP Defined when using PHP5 or PHP7
-SWIGPHP5 Defined when using PHP5
+SWIGPHP Defined when using PHP (any version)
SWIGPHP7 Defined when using PHP7
-SWIGPIKE Defined when using Pike
SWIGPYTHON Defined when using Python
SWIGR Defined when using R
SWIGRUBY Defined when using Ruby
SWIGSCILAB Defined when using Scilab
-SWIGSEXP Defined when using S-expressions
SWIGTCL Defined when using Tcl
SWIGXML Defined when using XML
</pre></div>
@@ -146,7 +138,7 @@ In addition, SWIG defines the following set of standard C/C++ macros:
<pre>
__LINE__ Current line number
__FILE__ Current file name
-__STDC__ Defined to indicate ANSI C
+__STDC__ Defined to indicate ISO C
__cplusplus Defined when -c++ option used
</pre>
</div>
@@ -159,7 +151,7 @@ SWIG (except for the symbol `<tt>SWIG</tt>' which is only defined
within the SWIG compiler).
</p>
-<H2><a name="Preprocessor_nn5">8.4 Macro Expansion</a></H2>
+<H2><a name="Preprocessor_nn5">10.4 Macro Expansion</a></H2>
<p>
@@ -188,9 +180,9 @@ More complex macros can be defined in the standard way. For example:
<pre>
#define EXTERN extern
#ifdef __STDC__
-#define _ANSI(args) (args)
+#define ISOC_(args) (args)
#else
-#define _ANSI(args) ()
+#define ISOC_(args) ()
#endif
</pre>
</div>
@@ -214,7 +206,7 @@ like <tt>#x</tt>. This is a non-standard SWIG extension.
</li>
</ul>
-<H2><a name="Preprocessor_nn6">8.5 SWIG Macros</a></H2>
+<H2><a name="Preprocessor_nn6">10.5 SWIG Macros</a></H2>
<p>
@@ -260,7 +252,7 @@ many of SWIG's advanced features and libraries are built using this mechanism (s
support).
</p>
-<H2><a name="Preprocessor_nn7">8.6 C99 and GNU Extensions</a></H2>
+<H2><a name="Preprocessor_nn7">10.6 C99 and GNU Extensions</a></H2>
<p>
@@ -316,14 +308,14 @@ interface building. However, they are used internally to implement a number of
SWIG directives and are provided to make SWIG more compatible with C99 code.
</p>
-<H2><a name="Preprocessor_delimiters">8.7 Preprocessing and delimiters</a></H2>
+<H2><a name="Preprocessor_delimiters">10.7 Preprocessing and delimiters</a></H2>
<p>
The preprocessor handles { }, " " and %{ %} delimiters differently.
</p>
-<H3><a name="Preprocessor_nn8">8.7.1 Preprocessing and %{ ... %} &amp; " ... " delimiters</a></H3>
+<H3><a name="Preprocessor_nn8">10.7.1 Preprocessing and %{ ... %} &amp; " ... " delimiters</a></H3>
<p>
@@ -348,7 +340,7 @@ the contents of the <tt>%{ ... %}</tt> block are copied without
modification to the output (including all preprocessor directives).
</p>
-<H3><a name="Preprocessor_nn9">8.7.2 Preprocessing and { ... } delimiters</a></H3>
+<H3><a name="Preprocessor_nn9">10.7.2 Preprocessing and { ... } delimiters</a></H3>
<p>
@@ -390,7 +382,7 @@ to actually go into the wrapper file, prefix the preprocessor directives with <t
SWIG will strip the extra <tt>%</tt> and leave the preprocessor directive in the code.
</p>
-<H2><a name="Preprocessor_typemap_delimiters">8.8 Preprocessor and Typemaps</a></H2>
+<H2><a name="Preprocessor_typemap_delimiters">10.8 Preprocessor and Typemaps</a></H2>
<p>
@@ -461,17 +453,17 @@ would generate
</div>
-<H2><a name="Preprocessor_nn10">8.9 Viewing preprocessor output</a></H2>
+<H2><a name="Preprocessor_nn10">10.9 Viewing preprocessor output</a></H2>
<p>
Like many compilers, SWIG supports a <tt>-E</tt> command line option to display the output from the preprocessor.
-When the <tt>-E</tt> switch is used, SWIG will not generate any wrappers.
+When the <tt>-E</tt> option is used, SWIG will not generate any wrappers.
Instead the results after the preprocessor has run are displayed.
This might be useful as an aid to debugging and viewing the results of macro expansions.
</p>
-<H2><a name="Preprocessor_warning_error">8.10 The #error and #warning directives</a></H2>
+<H2><a name="Preprocessor_warning_error">10.10 The #error and #warning directives</a></H2>
<p>
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index a5b2100ce..ee443be53 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Python">36 SWIG and Python</a></H1>
+<H1><a name="Python">32 SWIG and Python</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -21,7 +21,8 @@
<li><a href="#Python_nn9">Using your module</a>
<li><a href="#Python_nn10">Compilation of C++ extensions</a>
<li><a href="#Python_nn11">Compiling for 64-bit platforms</a>
-<li><a href="#Python_nn12">Building Python Extensions under Windows</a>
+<li><a href="#Python_nn12">Building Python extensions under Windows</a>
+<li><a href="#Python_commandline">Additional Python commandline options</a>
</ul>
<li><a href="#Python_nn13">A tour of basic C/C++ wrapping</a>
<ul>
@@ -54,7 +55,6 @@
<li><a href="#Python_builtin_overloads">Operator overloads and slots -- use them!</a>
</ul>
<li><a href="#Python_nn30">Memory management</a>
-<li><a href="#Python_nn31">Python 2.2 and classic classes</a>
</ul>
<li><a href="#Python_directors">Cross language polymorphism</a>
<ul>
@@ -72,6 +72,10 @@
<li><a href="#Python_nn42">Adding additional Python code</a>
<li><a href="#Python_nn43">Class extension with %extend</a>
<li><a href="#Python_nn44">Exception handling with %exception</a>
+<li><a href="#Python_optimization">Optimization options</a>
+<ul>
+<li><a href="#Python_fastproxy">-fastproxy</a>
+</ul>
</ul>
<li><a href="#Python_nn45">Tips and techniques</a>
<ul>
@@ -96,6 +100,7 @@
<li><a href="#Python_nn62">Mapping Python tuples into small arrays</a>
<li><a href="#Python_nn63">Mapping sequences to C arrays</a>
<li><a href="#Python_nn64">Pointer handling</a>
+<li><a href="#Python_memory_management_member_variables">Memory management when returning references to member variables</a>
</ul>
<li><a href="#Python_nn65">Docstring Features</a>
<ul>
@@ -116,12 +121,13 @@
<li><a href="#Python_absrelimports">Absolute and relative imports</a>
<li><a href="#Python_absimport">Enforcing absolute import semantics</a>
<li><a href="#Python_importfrominit">Importing from __init__.py</a>
-<li><a href="#Python_implicit_namespace_packages">Implicit Namespace Packages</a>
-<li><a href="#Python_package_search">Searching for the wrapper module</a>
+<li><a href="#Python_implicit_namespace_packages">Implicit namespace packages</a>
+<li><a href="#Python_package_search">Location of modules</a>
<ul>
<li><a href="#Python_package_search_both_package_modules">Both modules in the same package</a>
-<li><a href="#Python_package_search_wrapper_split">Split modules</a>
<li><a href="#Python_package_search_both_global_modules">Both modules are global</a>
+<li><a href="#Python_package_search_wrapper_split">Split modules custom configuration</a>
+<li><a href="#Python_custom_module_import">More on customizing the module import code</a>
<li><a href="#Python_package_search_static">Statically linked C modules</a>
</ul>
</ul>
@@ -133,6 +139,11 @@
<li><a href="#Python_nn77">Byte string output conversion</a>
<li><a href="#Python_2_unicode">Python 2 Unicode</a>
</ul>
+<li><a href="#Python_multithreaded">Support for Multithreaded Applications</a>
+<ul>
+<li><a href="#Python_thread_UI">UI for Enabling Multithreading Support</a>
+<li><a href="#Python_thread_performance">Multithread Performance</a>
+</ul>
</ul>
</div>
<!-- INDEX -->
@@ -145,9 +156,9 @@
<p>
This chapter describes SWIG's support of Python. SWIG is compatible
-with most recent Python versions including Python 3.0 and Python 2.6,
-as well as older versions dating back to Python 2.0. For the best results,
-consider using Python 2.3 or newer.
+with all recent Python versions (Python 2.7 and Python &gt;= 3.2). If you
+still need to generate bindings which work with older versions of Python,
+you'll have to use SWIG 3.0.x.
</p>
<p>
@@ -157,12 +168,12 @@ very least, make sure you read the "<a href="SWIG.html#SWIG">SWIG
Basics</a>" chapter.
</p>
-<H2><a name="Python_nn2">36.1 Overview</a></H2>
+<H2><a name="Python_nn2">32.1 Overview</a></H2>
<p>
To build Python extension modules, SWIG uses a layered approach in which
-parts of the extension module are defined in C and other parts are
+parts of the extension module are defined in C and other parts are
defined in Python. The C layer contains low-level wrappers whereas Python code
is used to define high-level features.
</p>
@@ -184,10 +195,10 @@ described followed by a discussion of low-level implementation
details.
</p>
-<H2><a name="Python_nn3">36.2 Preliminaries</a></H2>
+<H2><a name="Python_nn3">32.2 Preliminaries</a></H2>
-<H3><a name="Python_nn4">36.2.1 Running SWIG</a></H3>
+<H3><a name="Python_nn4">32.2.1 Running SWIG</a></H3>
<p>
@@ -210,7 +221,7 @@ int fact(int n);
<p>
The <tt>#define SWIG_FILE_WITH_INIT</tt> line inserts a macro that specifies that the
-resulting C file should be built as a python extension, inserting the module
+resulting C file should be built as a Python extension, inserting the module
<tt>init</tt> code. This <tt>.i</tt> file wraps the following simple C file:
</p>
@@ -221,16 +232,15 @@ resulting C file should be built as a python extension, inserting the module
#include "example.h"
int fact(int n) {
- if (n &lt; 0){ /* This should probably return an error, but this is simpler */
- return 0;
- }
- if (n == 0) {
- return 1;
- }
- else {
- /* testing for overflow would be a good idea here */
- return n * fact(n-1);
- }
+ if (n &lt; 0) { /* This should probably return an error, but this is simpler */
+ return 0;
+ }
+ if (n == 0) {
+ return 1;
+ } else {
+ /* testing for overflow would be a good idea here */
+ return n * fact(n-1);
+ }
}
</pre>
@@ -285,13 +295,13 @@ The following sections have further practical examples and details on
how you might go about compiling and using the generated files.
</p>
-<H3><a name="Python_nn6">36.2.2 Using distutils</a></H3>
+<H3><a name="Python_nn6">32.2.2 Using distutils</a></H3>
<p>
-The preferred approach to building an extension module for python is to compile it with
-distutils, which comes with all recent versions of python
-(<a href="https://docs.python.org/library/distutils.html">Distutils Docs</a>).
+The preferred approach to building an extension module for Python is to compile it with
+distutils, which comes with all recent versions of Python
+(<a href="https://docs.python.org/3/library/distutils.html">Distutils Docs</a>).
</p>
<p>
@@ -300,7 +310,7 @@ flags, headers, etc. for the version of Python it is run with. Distutils will co
extension into a shared object file or DLL (<tt>.so</tt> on Linux, <tt>.pyd</tt> on
Windows, etc). In addition, distutils can handle installing your package into
site-packages, if that is desired. A configuration file (conventionally called: <tt>setup.py</tt>)
-describes the extension (and related python modules). The distutils will
+describes the extension (and related Python modules). The distutils will
then generate all the right compiler directives to build it for you.
</p>
@@ -337,9 +347,9 @@ setup (name = 'example',
In this example, the line: <tt>example_module = Extension(....)</tt> creates an Extension
module object, defining the name as <tt>_example</tt>, and using the source code files:
<tt>example_wrap.c</tt>, generated by swig, and <tt>example.c</tt>, your original c
-source. The swig (and other python extension modules) tradition is for the compiled
-extension to have the name of the python portion, prefixed by an underscore. If the name
-of your python module is "<tt>example.py</tt>", then the name of the corresponding object file
+source. The swig (and other Python extension modules) tradition is for the compiled
+extension to have the name of the Python portion, prefixed by an underscore. If the name
+of your Python module is "<tt>example.py</tt>", then the name of the corresponding object file
will be"<tt>_example.so</tt>"
</p>
@@ -356,11 +366,11 @@ $ python setup.py build_ext --inplace
<p>
And a .so, or .pyd or... will be created for you. It will build a version that matches the
-python that you run the command with. Taking apart the command line:
+Python that you run the command with. Taking apart the command line:
</p>
<ul>
-<li> <tt>python</tt> -- the version of python you want to build for
+<li> <tt>python</tt> -- the version of Python you want to build for
<li> <tt>setup.py</tt> -- the name of your setup script (it can be called anything, but
setup.py is the tradition)
<li> <tt>build_ext</tt> -- telling distutils to build extensions
@@ -369,7 +379,7 @@ python that you run the command with. Taking apart the command line:
</ul>
<p>
-The distutils have many other features, consult the python distutils docs for details.
+The distutils have many other features, consult the Python distutils docs for details.
</p>
<p>
@@ -377,7 +387,7 @@ This same approach works on all platforms if the appropriate compiler is install
can even build extensions to the standard Windows Python using MingGW)
</p>
-<H3><a name="Python_nn7">36.2.3 Hand compiling a dynamic module</a></H3>
+<H3><a name="Python_nn7">32.2.3 Hand compiling a dynamic module</a></H3>
<p>
@@ -395,9 +405,9 @@ $ gcc -shared example.o example_wrap.o -o _example.so
</pre></div>
<p>
-The exact commands for doing this vary from platform to platform.
-However, SWIG tries to guess the right options when it is installed. Therefore,
-you may want to start with one of the examples in the <tt>SWIG/Examples/python</tt>
+The exact commands for doing this vary from platform to platform.
+However, SWIG tries to guess the right options when it is installed. Therefore,
+you may want to start with one of the examples in the <tt>SWIG/Examples/python</tt>
directory. If that doesn't work, you will need to read the man-pages for
your compiler and linker to get the right set of options. You might also
check the <a href="https://github.com/swig/swig/wiki">SWIG Wiki</a> for
@@ -409,7 +419,7 @@ When linking the module, <b>the name of the output file has to match the name
of the module prefixed by an underscore</b>. If the name of your module is "<tt>example</tt>", then the
name of the corresponding object file should be
"<tt>_example.so</tt>" or "<tt>_examplemodule.so</tt>".
-The name of the module is specified using the <tt>%module</tt> directive or the
+The name of the module is specified using the <tt>%module</tt> directive or the
<tt>-module</tt> command line option.
</p>
@@ -425,7 +435,7 @@ module actually consists of two files; <tt>socket.py</tt> and
</p>
-<H3><a name="Python_nn8">36.2.4 Static linking</a></H3>
+<H3><a name="Python_nn8">32.2.4 Static linking</a></H3>
<p>
@@ -433,7 +443,7 @@ An alternative approach to dynamic linking is to rebuild the Python
interpreter with your extension module added to it. In the past,
this approach was sometimes necessary due to limitations in dynamic loading
support on certain machines. However, the situation has improved greatly
-over the last few years and you should not consider this approach
+over the last few years and you should not consider this approach
unless there is really no other option.
</p>
@@ -493,7 +503,7 @@ linking if possible. Some programmers may be inclined
to use static linking in the interest of getting better performance.
However, the performance gained by static linking tends to be rather
minimal in most situations (and quite frankly not worth the extra
-hassle in the opinion of this author).
+hassle in the opinion of this author).
</p>
<p>
@@ -504,7 +514,7 @@ If using static linking, you might want to rely on a different approach
(perhaps using distutils).
</p>
-<H3><a name="Python_nn9">36.2.5 Using your module</a></H3>
+<H3><a name="Python_nn9">32.2.5 Using your module</a></H3>
<p>
@@ -552,13 +562,13 @@ Another possible error is the following:
Traceback (most recent call last):
File "&lt;stdin&gt;", line 1, in ?
ImportError: dynamic module does not define init function (init_example)
-&gt;&gt;&gt;
+&gt;&gt;&gt;
</pre>
</div>
<p>
-This error is almost always caused when a bad name is given to the shared object file.
-For example, if you created a file <tt>example.so</tt> instead of <tt>_example.so</tt> you would
+This error is almost always caused when a bad name is given to the shared object file.
+For example, if you created a file <tt>example.so</tt> instead of <tt>_example.so</tt> you would
get this error. Alternatively, this error could arise if the name of the module is
inconsistent with the module name supplied with the <tt>%module</tt> directive.
Double-check the interface to make sure the module name and the shared object
@@ -584,7 +594,7 @@ This error usually indicates that you forgot to include some object
files or libraries in the linking of the shared library file. Make
sure you compile both the SWIG wrapper file and your original program
into a shared library file. Make sure you pass all of the required libraries
-to the linker.
+to the linker.
</p>
<p>
@@ -619,7 +629,7 @@ problem when you try to use your module:
Traceback (most recent call last):
File "&lt;stdin&gt;", line 1, in ?
ImportError: libfoo.so: cannot open shared object file: No such file or directory
-&gt;&gt;&gt;
+&gt;&gt;&gt;
</pre>
</div>
@@ -642,7 +652,7 @@ $ gcc -shared example.o example_wrap.o -L/home/beazley/projects/lib -lfoo \
<p>
Alternatively, you can set the <tt>LD_LIBRARY_PATH</tt> environment variable to
-include the directory with your shared libraries.
+include the directory with your shared libraries.
If setting <tt>LD_LIBRARY_PATH</tt>, be aware that setting this variable can introduce
a noticeable performance impact on all other applications that you run.
To set it only for Python, you might want to do this instead:
@@ -661,7 +671,7 @@ system configuration (this requires root access and you will need to
read the man pages).
</p>
-<H3><a name="Python_nn10">36.2.6 Compilation of C++ extensions</a></H3>
+<H3><a name="Python_nn10">32.2.6 Compilation of C++ extensions</a></H3>
<p>
@@ -707,7 +717,7 @@ $ CC -G example.o example_wrap.o -L/opt/SUNWspro/lib -o _example.so -lCrun
</pre></div>
<p>
-Of course, the extra libraries to use are completely non-portable---you will
+Of course, the extra libraries to use are completely non-portable---you will
probably need to do some experimentation.
</p>
@@ -715,8 +725,8 @@ probably need to do some experimentation.
Sometimes people have suggested that it is necessary to relink the
Python interpreter using the C++ compiler to make C++ extension modules work.
In the experience of this author, this has never actually appeared to be
-necessary. Relinking the interpreter with C++ really only includes the
-special run-time libraries described above---as long as you link your extension
+necessary. Relinking the interpreter with C++ really only includes the
+special run-time libraries described above---as long as you link your extension
modules with these libraries, it should not be necessary to rebuild Python.
</p>
@@ -753,14 +763,14 @@ erratic program behavior. If working with lots of software components, you
might want to investigate using a more formal standard such as COM.
</p>
-<H3><a name="Python_nn11">36.2.7 Compiling for 64-bit platforms</a></H3>
+<H3><a name="Python_nn11">32.2.7 Compiling for 64-bit platforms</a></H3>
<p>
On platforms that support 64-bit applications (Solaris, Irix, etc.),
special care is required when building extension modules. On these
machines, 64-bit applications are compiled and linked using a different
-set of compiler/linker options. In addition, it is not generally possible to mix
+set of compiler/linker options. In addition, it is not generally possible to mix
32-bit and 64-bit code together in the same application.
</p>
@@ -786,11 +796,11 @@ careful about the libraries you link with or the library path you
use. In general, a Linux distribution will have two set of libraries,
one for native x86_64 programs (under /usr/lib64), and another for 32
bits compatibility (under /usr/lib). Also, the compiler options -m32
-and -m64 allow you to choose the desired binary format for your python
+and -m64 allow you to choose the desired binary format for your Python
extension.
</p>
-<H3><a name="Python_nn12">36.2.8 Building Python Extensions under Windows</a></H3>
+<H3><a name="Python_nn12">32.2.8 Building Python extensions under Windows</a></H3>
<p>
@@ -802,6 +812,7 @@ are built with Visual Studio 2003), the standard <tt>python setup.py
build</tt> should just work.
</p>
+
<p>
As of python2.5, the distutils support building extensions with MingGW out
of the box. Following the instruction here:
@@ -814,10 +825,10 @@ If you need to build it on your own, the following notes are provided:
</p>
<p>
-You will need to create a DLL that can be loaded into the interpreter.
+You will need to create a DLL that can be loaded into the interpreter.
This section briefly describes the use of SWIG with Microsoft Visual
C++. As a starting point, many of SWIG's examples include project
-files (.dsp files) for Visual C++ 6. These can be opened by more
+files (.dsp files) for Visual C++ 6. These can be opened by more
recent versions of Visual Studio.
You might want to take a quick look at these examples in addition to
reading this section.
@@ -852,12 +863,12 @@ settings, select the "Custom Build" option.
"C++:Preprocessor". Add the include directories for your Python
installation under "Additional include directories".
-<li>Define the symbol __WIN32__ under preprocessor options.
+<li>Define the symbol __WIN32__ under preprocessor options.
<li>Finally, select the settings for the entire project and go to
"Link Options". Add the Python library file to your link libraries.
-For example "python21.lib". Also, set the name of the output file to
-match the name of your Python module, ie. _example.pyd - Note that _example.dll also worked with Python-2.4 and earlier.
+For example "python27.lib". Also, set the name of the output file to
+match the name of your Python module, i.e. <tt>_example.pyd</tt>
<li>Build your project.
</ul>
@@ -866,7 +877,7 @@ match the name of your Python module, ie. _example.pyd - Note that _example.dll
If all went well, SWIG will be automatically invoked whenever
you build your project. Any changes made to the interface file will
result in SWIG being automatically executed to produce a new version of
-the wrapper file.
+the wrapper file.
</p>
<p>
@@ -885,9 +896,9 @@ $ python
<p>
If you get an <tt>ImportError</tt> exception when importing the module, you may
have forgotten to include additional library files when you built your module.
-If you get an access violation or some kind of general protection fault
-immediately upon import, you have a more serious problem. This
-is often caused by linking your extension module against the wrong
+If you get an access violation or some kind of general protection fault
+immediately upon import, you have a more serious problem. This
+is often caused by linking your extension module against the wrong
set of Win32 debug or thread libraries. You will have to fiddle around with
the build options of project to try and track this down.
</p>
@@ -919,7 +930,51 @@ SWIG Wiki</a>.
</p>
-<H2><a name="Python_nn13">36.3 A tour of basic C/C++ wrapping</a></H2>
+<H3><a name="Python_commandline">32.2.9 Additional Python commandline options</a></H3>
+
+
+<p>
+The following table lists the additional commandline options available for the Python module. They can also be seen by using:
+</p>
+
+<div class="code"><pre>
+swig -python -help
+</pre></div>
+
+<table summary="Python specific options">
+<tr>
+<th>Python specific options</th>
+</tr>
+
+<tr><td>-builtin </td><td>Create Python built-in types rather than proxy classes, for better performance</td></tr>
+<tr><td>-castmode </td><td>Enable the casting mode, which allows implicit cast between types in Python</td></tr>
+<tr><td>-debug-doxygen-parser </td><td>Display doxygen parser module debugging information</td></tr>
+<tr><td>-debug-doxygen-translator </td><td>Display doxygen translator module debugging information</td></tr>
+<tr><td>-dirvtable </td><td>Generate a pseudo virtual table for directors for faster dispatch</td></tr>
+<tr><td>-doxygen </td><td>Convert C++ doxygen comments to pydoc comments in proxy classes</td></tr>
+<tr><td>-extranative </td><td>Return extra native wrappers for C++ std containers wherever possible</td></tr>
+<tr><td>-fastproxy </td><td>Use fast proxy mechanism for member methods</td></tr>
+<tr><td>-globals &lt;name&gt; </td><td>Set &lt;name&gt; used to access C global variable (default: 'cvar')</td></tr>
+<tr><td>-interface &lt;mod&gt;</td><td>Set low-level C/C++ module name to &lt;mod&gt; (default: module name prefixed by '_')</td></tr>
+<tr><td>-keyword </td><td>Use keyword arguments</td></tr>
+<tr><td>-nofastunpack </td><td>Use traditional UnpackTuple method to parse the argument functions</td></tr>
+<tr><td>-noh </td><td>Don't generate the output header file</td></tr>
+<tr><td>-noproxy </td><td>Don't generate proxy classes</td></tr>
+<tr><td>-nortti </td><td>Disable the use of the native C++ RTTI with directors</td></tr>
+<tr><td>-nothreads </td><td>Disable thread support for the entire interface</td></tr>
+<tr><td>-olddefs </td><td>Keep the old method definitions when using -fastproxy</td></tr>
+<tr><td>-py3 </td><td>Generate code with Python 3 specific features and syntax</td></tr>
+<tr><td>-relativeimport </td><td>Use relative Python imports</td></tr>
+<tr><td>-threads </td><td>Add thread support for all the interface</td></tr>
+<tr><td>-O </td><td>Enable the following optimization options: -fastdispatch -fastproxy -fvirtual</td></tr>
+
+</table>
+
+<p>
+Many of these options are covered later on and their use should become clearer by the time you have finished reading this section on SWIG and Python.
+</p>
+
+<H2><a name="Python_nn13">32.3 A tour of basic C/C++ wrapping</a></H2>
<p>
@@ -928,7 +983,7 @@ to your C/C++ code. Functions are wrapped as functions, classes are wrapped as
This section briefly covers the essential aspects of this wrapping.
</p>
-<H3><a name="Python_nn14">36.3.1 Modules</a></H3>
+<H3><a name="Python_nn14">32.3.1 Modules</a></H3>
<p>
@@ -938,10 +993,10 @@ wrapped into a Python '<tt>example</tt>' module. Underneath the covers,
this module consists of a Python source file <tt>example.py</tt> and a low-level
extension module <tt>_example.so</tt>. When choosing a
module name, make sure you don't use the same name as a built-in
-Python command or standard module name.
+Python command or standard module name.
</p>
-<H3><a name="Python_nn15">36.3.2 Functions</a></H3>
+<H3><a name="Python_nn15">32.3.2 Functions</a></H3>
<p>
@@ -965,7 +1020,7 @@ like you think it does:
&gt;&gt;&gt;
</pre></div>
-<H3><a name="Python_nn16">36.3.3 Global variables</a></H3>
+<H3><a name="Python_nn16">32.3.3 Global variables</a></H3>
<p>
@@ -991,8 +1046,8 @@ then "a" and "b" are both names for the object containing the value
3.4. Thus, there is only one object containing 3.4 and "a"
and "b" are both names that refer to it. This is quite
different than C where a variable name refers to a memory location in which
-a value is stored (and assignment copies data into that location).
-Because of this, there is no direct way to map variable
+a value is stored (and assignment copies data into that location).
+Because of this, there is no direct way to map variable
assignment in C to variable assignment in Python.
</p>
@@ -1038,7 +1093,7 @@ error message. For example:
Traceback (most recent call last):
File "&lt;stdin&gt;", line 1, in ?
TypeError: C variable 'density (double )'
-&gt;&gt;&gt;
+&gt;&gt;&gt;
</pre></div>
<p>
@@ -1103,7 +1158,7 @@ that starts with a leading underscore. SWIG does not create <tt>cvar</tt>
if there are no global variables in a module.
</p>
-<H3><a name="Python_nn17">36.3.4 Constants and enums</a></H3>
+<H3><a name="Python_nn17">32.3.4 Constants and enums</a></H3>
<p>
@@ -1143,7 +1198,7 @@ other object. Unfortunately, there is no easy way for SWIG to
generate code that prevents this. You will just have to be careful.
</p>
-<H3><a name="Python_nn18">36.3.5 Pointers</a></H3>
+<H3><a name="Python_nn18">32.3.5 Pointers</a></H3>
<p>
@@ -1178,7 +1233,7 @@ When wrapped, you will be able to use the functions in a natural way from Python
<p>
If this makes you uneasy, rest assured that there is no
deep magic involved. Underneath the covers, pointers to C/C++ objects are
-simply represented as opaque values using an especial python container object:
+simply represented as opaque values using an especial Python container object:
</p>
<div class="targetlang"><pre>
@@ -1188,7 +1243,7 @@ simply represented as opaque values using an especial python container object:
<p>
This pointer value can be freely passed around to different C functions that
-expect to receive an object of type <tt>FILE *</tt>. The only thing you can't do is
+expect to receive an object of type <tt>FILE *</tt>. The only thing you can't do is
dereference the pointer from Python. Of course, that isn't much of a concern in this example.
</p>
@@ -1206,7 +1261,7 @@ _c0671108_p_FILE
<p>
Also, if you need to pass the raw pointer value to some external
-python library, you can do it by casting the pointer object to an
+Python library, you can do it by casting the pointer object to an
integer:
</p>
@@ -1271,7 +1326,7 @@ Foo *BarToFoo(Bar *b) {
}
Foo *IncrFoo(Foo *f, int i) {
- return f+i;
+ return f+i;
}
%}
</pre>
@@ -1284,7 +1339,7 @@ C-style cast may return a bogus result whereas as the C++-style cast will return
<tt>None</tt> if the conversion can't be performed.
</p>
-<H3><a name="Python_nn19">36.3.6 Structures</a></H3>
+<H3><a name="Python_nn19">32.3.6 Structures</a></H3>
<p>
@@ -1308,8 +1363,8 @@ is used as follows:
&gt;&gt;&gt; v.x = 3.5
&gt;&gt;&gt; v.y = 7.2
&gt;&gt;&gt; print v.x, v.y, v.z
-7.8 -4.5 0.0
-&gt;&gt;&gt;
+3.5 7.2 0.0
+&gt;&gt;&gt;
</pre></div>
<p>
@@ -1368,7 +1423,7 @@ struct Foo {
<p>
When <tt>char *</tt> members of a structure are wrapped, the contents are assumed to be
dynamically allocated using <tt>malloc</tt> or <tt>new</tt> (depending on whether or not
-SWIG is run with the -c++ option). When the structure member is set, the old contents will be
+SWIG is run with the -c++ option). When the structure member is set, the old contents will be
released and a new value created. If this is not the behavior you want, you will have to use
a typemap (described later).
</p>
@@ -1381,7 +1436,7 @@ example, consider this:
<div class="code">
<pre>
struct Bar {
- int x[16];
+ int x[16];
};
</pre>
</div>
@@ -1395,7 +1450,7 @@ If accessed in Python, you will see behavior like this:
&gt;&gt;&gt; b = example.Bar()
&gt;&gt;&gt; print b.x
_801861a4_p_int
-&gt;&gt;&gt;
+&gt;&gt;&gt;
</pre>
</div>
@@ -1460,7 +1515,7 @@ Foo *x = &amp;b-&gt;f; /* Points inside b */
</div>
<p>
-Because the pointer points inside the structure, you can modify the contents and
+Because the pointer points inside the structure, you can modify the contents and
everything works just like you would expect. For example:
</p>
@@ -1468,12 +1523,33 @@ everything works just like you would expect. For example:
<pre>
&gt;&gt;&gt; b = Bar()
&gt;&gt;&gt; b.f.a = 3 # Modify attribute of structure member
-&gt;&gt;&gt; x = b.f
+&gt;&gt;&gt; x = b.f
&gt;&gt;&gt; x.a = 3 # Modifies the same structure
</pre>
</div>
-<H3><a name="Python_nn20">36.3.7 C++ classes</a></H3>
+<p>
+Note that there is a limitation with structs within structs that will cause a problem
+if the outer struct is not a named variable in Python. The following will cause a segfault:
+</p>
+
+<div class="targetlang">
+<pre>
+Bar().f.a = 3
+</pre>
+</div>
+
+<p>
+because the unnamed Python proxy class for <tt>Bar()</tt> has its reference count
+decremented by the Python interpreter after <tt>f</tt> has been obtained from it and
+before <tt>f</tt> is used to obtain <tt>a</tt>.
+This results in the underlying <tt>Bar</tt> instance being deleted, which of course also deletes
+<tt>f</tt> inside it. Hence the pointer to <tt>f</tt> points to deleted
+memory and use of it results in a segfault or some sort of other undefined behaviour.
+</p>
+
+
+<H3><a name="Python_nn20">32.3.7 C++ classes</a></H3>
<p>
@@ -1510,13 +1586,13 @@ you can use it in Python like this:
</pre></div>
<p>
-Class data members are accessed in the same manner as C structures.
+Class data members are accessed in the same manner as C structures.
</p>
<p>
-Static class members present a special problem for Python. Prior to Python-2.2,
+Static class members present a special problem for Python. Prior to Python-2.2,
Python classes had no support for static methods and no version of Python
-supports static member variables in a manner that SWIG can utilize. Therefore,
+supports static member variables in a manner that SWIG can utilize. Therefore,
SWIG generates wrappers that try to work around some of these issues. To illustrate,
suppose you have a class like this:
</p>
@@ -1561,7 +1637,7 @@ they are accessed through <tt>cvar</tt> like this:
</pre>
</div>
-<H3><a name="Python_nn21">36.3.8 C++ inheritance</a></H3>
+<H3><a name="Python_nn21">32.3.8 C++ inheritance</a></H3>
<p>
@@ -1616,7 +1692,7 @@ then the function <tt>spam()</tt> accepts <tt>Foo *</tt> or a pointer to any cla
It is safe to use multiple inheritance with SWIG.
</p>
-<H3><a name="Python_nn22">36.3.9 Pointers, references, values, and arrays</a></H3>
+<H3><a name="Python_nn22">32.3.9 Pointers, references, values, and arrays</a></H3>
<p>
@@ -1669,15 +1745,15 @@ const Foo &amp;spam9();
<p>
then all three functions will return a pointer to some <tt>Foo</tt> object.
-Since the third function (spam8) returns a value, newly allocated memory is used
-to hold the result and a pointer is returned (Python will release this memory
+Since the third function (spam8) returns a value, newly allocated memory is used
+to hold the result and a pointer is returned (Python will release this memory
when the return value is garbage collected). The fourth case (spam9)
-which returns a const reference, in most of the cases will be
+which returns a const reference, in most of the cases will be
treated as a returning value, and it will follow the same
allocation/deallocation process.
</p>
-<H3><a name="Python_nn23">36.3.10 C++ overloaded functions</a></H3>
+<H3><a name="Python_nn23">32.3.10 C++ overloaded functions</a></H3>
<p>
@@ -1711,9 +1787,9 @@ Similarly, if you have a class like this,
<pre>
class Foo {
public:
- Foo();
- Foo(const Foo &amp;);
- ...
+ Foo();
+ Foo(const Foo &amp;);
+ ...
};
</pre>
</div>
@@ -1771,7 +1847,7 @@ To fix this, you either need to ignore or rename one of the methods. For exampl
<pre>
%rename(spam_short) spam(short);
...
-void spam(int);
+void spam(int);
void spam(short); // Accessed as spam_short
</pre>
</div>
@@ -1784,7 +1860,7 @@ or
<pre>
%ignore spam(short);
...
-void spam(int);
+void spam(int);
void spam(short); // Ignored
</pre>
</div>
@@ -1797,10 +1873,10 @@ first declaration takes precedence.
</p>
<p>
-Please refer to the "SWIG and C++" chapter for more information about overloading.
+Please refer to the "SWIG and C++" chapter for more information about overloading.
</p>
-<H3><a name="Python_nn24">36.3.11 C++ operators</a></H3>
+<H3><a name="Python_nn24">32.3.11 C++ operators</a></H3>
<p>
@@ -1823,7 +1899,7 @@ public:
Complex operator-(const Complex &amp;c) const;
Complex operator*(const Complex &amp;c) const;
Complex operator-() const;
-
+
double re() const { return rpart; }
double im() const { return ipart; }
};
@@ -1889,7 +1965,15 @@ Also, be aware that certain operators don't map cleanly to Python. For instance
overloaded assignment operators don't map to Python semantics and will be ignored.
</p>
-<H3><a name="Python_nn25">36.3.12 C++ namespaces</a></H3>
+<p>
+Operator overloading is implemented in the <tt>pyopers.swg</tt> library file.
+In particular overloaded operators are marked with the <tt>python:maybecall</tt> feature, also known as <tt>%pythonmaybecall</tt>.
+This feature forces SWIG to generate code that return an instance of Python's <tt>NotImplemented</tt>
+instead of raising an exception when the comparison fails, that is, on any kind of error.
+This follows the guidelines in <a href="https://www.python.org/dev/peps/pep-0207/">PEP 207 - Rich Comparisons</a> and <a href="https://docs.python.org/3/library/constants.html#NotImplemented">NotImplemented Python constant</a>.
+</p>
+
+<H3><a name="Python_nn25">32.3.12 C++ namespaces</a></H3>
<p>
@@ -1938,11 +2022,11 @@ For example:
%rename(Bar_spam) Bar::spam;
namespace Foo {
- int spam();
+ int spam();
}
namespace Bar {
- int spam();
+ int spam();
}
</pre>
</div>
@@ -1956,7 +2040,7 @@ utilizes thousands of small deeply nested namespaces each with
identical symbol names, well, then you get what you deserve.
</p>
-<H3><a name="Python_nn26">36.3.13 C++ templates</a></H3>
+<H3><a name="Python_nn26">32.3.13 C++ templates</a></H3>
<p>
@@ -2005,15 +2089,15 @@ In Python:
<p>
Obviously, there is more to template wrapping than shown in this example.
-More details can be found in the <a href="SWIGPlus.html#SWIGPlus">SWIG and C++</a> chapter.
+More details can be found in the <a href="SWIGPlus.html#SWIGPlus">SWIG and C++</a> chapter.
Some more complicated
examples will appear later.
</p>
-<H3><a name="Python_nn27">36.3.14 C++ Smart Pointers</a></H3>
+<H3><a name="Python_nn27">32.3.14 C++ Smart Pointers</a></H3>
-<H4><a name="Python_smart_pointers_shared_ptr">36.3.14.1 The shared_ptr Smart Pointer</a></H4>
+<H4><a name="Python_smart_pointers_shared_ptr">32.3.14.1 The shared_ptr Smart Pointer</a></H4>
<p>
@@ -2024,7 +2108,7 @@ in the <a href="Library.html#Library_std_shared_ptr">shared_ptr smart pointer</a
</p>
-<H4><a name="Python_smart_pointers_generic">36.3.14.2 Generic Smart Pointers</a></H4>
+<H4><a name="Python_smart_pointers_generic">32.3.14.2 Generic Smart Pointers</a></H4>
<p>
@@ -2108,7 +2192,7 @@ simply use the <tt>__deref__()</tt> method. For example:
</pre>
</div>
-<H3><a name="Python_nn27a">36.3.15 C++ reference counted objects</a></H3>
+<H3><a name="Python_nn27a">32.3.15 C++ reference counted objects</a></H3>
<p>
@@ -2117,7 +2201,7 @@ Python examples of memory management using referencing counting.
</p>
-<H2><a name="Python_nn28">36.4 Further details on the Python class interface</a></H2>
+<H2><a name="Python_nn28">32.4 Further details on the Python class interface</a></H2>
<p>
@@ -2140,7 +2224,7 @@ the <tt>-builtin</tt> option are in the <a href="#Python_builtin_types">Built-in
section.
</p>
-<H3><a name="Python_nn29">36.4.1 Proxy classes</a></H3>
+<H3><a name="Python_nn29">32.4.1 Proxy classes</a></H3>
<p>
@@ -2153,9 +2237,9 @@ have a class like this
<pre>
class Foo {
public:
- int x;
- int spam(int);
- ...
+ int x;
+ int spam(int);
+ ...
</pre>
</div>
@@ -2166,19 +2250,19 @@ then SWIG transforms it into a set of low-level procedural wrappers. For example
<div class="code">
<pre>
Foo *new_Foo() {
- return new Foo();
+ return new Foo();
}
void delete_Foo(Foo *f) {
- delete f;
+ delete f;
}
int Foo_x_get(Foo *f) {
- return f-&gt;x;
+ return f-&gt;x;
}
void Foo_x_set(Foo *f, int value) {
- f-&gt;x = value;
+ f-&gt;x = value;
}
int Foo_spam(Foo *f, int arg1) {
- return f-&gt;spam(arg1);
+ return f-&gt;spam(arg1);
}
</pre>
</div>
@@ -2188,7 +2272,7 @@ These wrappers can be found in the low-level extension module (e.g., <tt>_exampl
</p>
<p>
-Using these wrappers, SWIG generates a high-level Python proxy class (also known as a shadow class) like this (shown
+Using these wrappers, SWIG generates a high-level Python proxy class (also known as a shadow class) like this (shown
for Python 2.2):
</p>
@@ -2210,7 +2294,7 @@ class Foo(object):
</div>
<p>
-This class merely holds a pointer to the underlying C++ object (<tt>.this</tt>) and dispatches methods and
+This class merely holds a pointer to the underlying C++ object (<tt>.this</tt>) and dispatches methods and
member variable access to that object using the low-level accessor functions. From a user's point of
view, it makes the class work normally:
</p>
@@ -2229,7 +2313,7 @@ you can attach new Python methods to the class and you can even inherit from it
by Python built-in types until Python 2.2).
</p>
-<H3><a name="Python_builtin_types">36.4.2 Built-in Types</a></H3>
+<H3><a name="Python_builtin_types">32.4.2 Built-in Types</a></H3>
<p>
@@ -2239,8 +2323,8 @@ and built-in types, let's take a look at what a wrapped object looks like
under both circumstances.
</p>
-<p>When proxy classes are used, each wrapped object in python is an instance
-of a pure python class. As a reminder, here is what the <tt>__init__</tt> method looks
+<p>When proxy classes are used, each wrapped object in Python is an instance
+of a pure Python class. As a reminder, here is what the <tt>__init__</tt> method looks
like in a proxy class:
</p>
@@ -2254,37 +2338,30 @@ class Foo(object):
</div>
<p>When a <tt>Foo</tt> instance is created, the call to <tt>_example.new_Foo()</tt>
-creates a new C++ <tt>Foo</tt> instance; wraps that C++ instance inside an instance of
-a python built-in type called <tt>SwigPyObject</tt>; and stores the <tt>SwigPyObject</tt>
-instance in the 'this' field of the python Foo object. Did you get all that? So, the
-python <tt>Foo</tt> object is composed of three parts:</p>
+creates a new C++ <tt>Foo</tt> instance; wraps that C++ instance inside an instance of
+a Python built-in type called <tt>SwigPyObject</tt>; and stores the <tt>SwigPyObject</tt>
+instance in the 'this' field of the Python Foo object. Did you get all that? So, the
+Python <tt>Foo</tt> object is composed of three parts:</p>
<ul>
-<li> The python <tt>Foo</tt> instance, which contains...</li>
+<li> The Python <tt>Foo</tt> instance, which contains...</li>
<li> ... an instance of <tt>struct SwigPyObject</tt>, which contains...</li>
<li> ... a C++ <tt>Foo</tt> instance</li>
</ul>
-<p>When <tt>-builtin</tt> is used, the pure python layer is stripped off. Each
-wrapped class is turned into a new python built-in type which inherits from
+<p>When <tt>-builtin</tt> is used, the pure Python layer is stripped off. Each
+wrapped class is turned into a new Python built-in type which inherits from
<tt>SwigPyObject</tt>, and <tt>SwigPyObject</tt> instances are returned directly
-from the wrapped methods. For more information about python built-in extensions,
-please refer to the python documentation:</p>
+from the wrapped methods. For more information about Python built-in extensions,
+please refer to the Python documentation:</p>
-<p><a href="http://docs.python.org/extending/newtypes.html">http://docs.python.org/extending/newtypes.html</a></p>
+<p><a href="https://docs.python.org/3/extending/newtypes.html">https://docs.python.org/3/extending/newtypes.html</a></p>
-<H4><a name="Python_builtin_limitations">36.4.2.1 Limitations</a></H4>
+<H4><a name="Python_builtin_limitations">32.4.2.1 Limitations</a></H4>
<p>Use of the <tt>-builtin</tt> option implies a couple of limitations:
<ul>
- <li><p>python version support:</p>
- <ul>
- <li>Versions 2.5 and up are fully supported</li>
- <li>Versions 2.3 and 2.4 are mostly supported; there are problems with director classes and/or sub-classing a wrapped type in python.</li>
- <li>Versions older than 2.3 are not supported.</li>
- </ul>
- </li>
<li><p>Some legacy syntax is no longer supported; in particular:</p>
<ul>
<li>The functional interface is no longer exposed. For example, you may no longer call <tt>Whizzo.new_CrunchyFrog()</tt>. Instead, you must use <tt>Whizzo.CrunchyFrog()</tt>.</li>
@@ -2292,15 +2369,15 @@ please refer to the python documentation:</p>
They are instead accessed in the idiomatic way (<tt>Dances.FishSlap</tt>).</li>
</ul>
</li>
- <li><p>Wrapped types may not be raised as python exceptions. Here's why: the python internals expect that all sub-classes of Exception will have this struct layout:</p>
+ <li><p>Wrapped types may not be raised as Python exceptions. Here's why: the Python internals expect that all sub-classes of Exception will have this struct layout:</p>
<div class="code">
<pre>
typedef struct {
- PyObject_HEAD
- PyObject *dict;
- PyObject *args;
- PyObject *message;
+ PyObject_HEAD
+ PyObject *dict;
+ PyObject *args;
+ PyObject *message;
} PyBaseExceptionObject;
</pre>
</div>
@@ -2310,12 +2387,12 @@ typedef struct {
<div class="code">
<pre>
typedef struct {
- PyObject_HEAD
- void *ptr;
- swig_type_info *ty;
- int own;
- PyObject *next;
- PyObject *dict;
+ PyObject_HEAD
+ void *ptr;
+ swig_type_info *ty;
+ int own;
+ PyObject *next;
+ PyObject *dict;
} SwigPyObject;
</pre>
</div>
@@ -2326,18 +2403,18 @@ typedef struct {
<pre>
class MyException {
public:
- MyException (const char *msg_);
- ~MyException ();
+ MyException (const char *msg_);
+ ~MyException ();
- const char *what () const;
+ const char *what () const;
private:
- char *msg;
+ char *msg;
};
</pre>
</div>
-<p>... you can define this python class, which may be raised as an exception:</p>
+<p>... you can define this Python class, which may be raised as an exception:</p>
<div class="targetlang">
<pre>
@@ -2352,22 +2429,22 @@ class MyPyException(Exception):
</li>
<li><p>Reverse binary operators (e.g., <tt>__radd__</tt>) are not supported.</p>
<p>To illustrate this point, if you have a wrapped class called <tt>MyString</tt>,
-and you want to use instances of <tt>MyString</tt> interchangeably with native python
+and you want to use instances of <tt>MyString</tt> interchangeably with native Python
strings, you can define an <tt>'operator+ (const char*)'</tt> method :</p>
<div class="code">
<pre>
class MyString {
public:
- MyString (const char *init);
- MyString operator+ (const char *other) const;
- ...
+ MyString (const char *init);
+ MyString operator+ (const char *other) const;
+ ...
};
</pre>
</div>
<p>
-SWIG will automatically create an operator overload in python that will allow this:
+SWIG will automatically create an operator overload in Python that will allow this:
</p>
<div class="targetlang">
@@ -2394,7 +2471,7 @@ episode = "Dead " + mystr
</div>
<p>
-The above code fails, because the first operand -- a native python string --
+The above code fails, because the first operand -- a native Python string --
doesn't know how to add an instance of <tt>MyString</tt> to itself.
</p>
</li>
@@ -2430,7 +2507,7 @@ class Derived : public Base {
<p>The <tt>import "A.i"</tt> statement is required, because module <tt>B</tt> depends on module <tt>A</tt>.</p>
-<p>As long as you obey these requirements, your python code may import the modules in any order :</p>
+<p>As long as you obey these requirements, your Python code may import the modules in any order :</p>
<div class="targetlang"><pre>
import B
@@ -2441,35 +2518,36 @@ assert(issubclass(B.Derived, A.Base))
</li>
</ul>
-<H4><a name="Python_builtin_overloads">36.4.2.2 Operator overloads and slots -- use them!</a></H4>
+<H4><a name="Python_builtin_overloads">32.4.2.2 Operator overloads and slots -- use them!</a></H4>
<p>The entire justification for the <tt>-builtin</tt> option is improved
performance. To that end, the best way to squeeze maximum performance out
of your wrappers is to <b>use operator overloads.</b>
-Named method dispatch is slow in python, even when compared to other scripting languages.
-However, python built-in types have a large number of "slots",
+Named method dispatch is slow in Python, even when compared to other scripting languages.
+However, Python built-in types have a large number of "slots",
analogous to C++ operator overloads, which allow you to short-circuit named method dispatch
for certain common operations.
</p>
-<p>By default, SWIG will translate most C++ arithmetic operator overloads into python
+<p>By default, SWIG will translate most C++ arithmetic operator overloads into Python
slot entries. For example, suppose you have this class:
<div class="code">
<pre>
class Twit {
public:
- Twit operator+ (const Twit&amp; twit) const;
+ Twit operator+ (const Twit&amp; twit) const;
- // Forward to operator+
- Twit add (const Twit&amp; twit) const
- { return *this + twit; }
+ // Forward to operator+
+ Twit add (const Twit&amp; twit) const {
+ return *this + twit;
+ }
};
</pre>
</div>
-<p>SWIG will automatically register <tt>operator+</tt> as a python slot operator for addition. You may write python code like this:</p>
+<p>SWIG will automatically register <tt>operator+</tt> as a Python slot operator for addition. You may write Python code like this:</p>
<div class="targetlang">
<pre>
@@ -2482,24 +2560,24 @@ percival = nigel.add(emily)
</pre>
</div>
-<p>The last two lines of the python code are equivalent,
+<p>The last two lines of the Python code are equivalent,
but <b>the line that uses the '+' operator is much faster</b>.
</p>
<p>In-place operators (e.g., <tt>operator+=</tt>) and comparison operators
-(<tt>operator==, operator&lt;</tt>, etc.) are also converted to python
+(<tt>operator==, operator&lt;</tt>, etc.) are also converted to Python
slot operators. For a complete list of C++ operators that are
-automatically converted to python slot operators, refer to the file
+automatically converted to Python slot operators, refer to the file
<tt>python/pyopers.swig</tt> in the SWIG library.
</p>
<p>
-Read about all of the available python slots here:
-<a href="http://docs.python.org/c-api/typeobj.html">http://docs.python.org/c-api/typeobj.html</a></p>
+Read about all of the available Python slots here:
+<a href="https://docs.python.org/3/c-api/typeobj.html">https://docs.python.org/3/c-api/typeobj.html</a></p>
<p>
-There are two ways to define a python slot function: dispatch to a
+There are two ways to define a Python slot function: dispatch to a
statically defined function; or dispatch to a method defined on the
operand.
</p>
@@ -2545,16 +2623,16 @@ public:
</div>
<p>
-If you examine the generated code, the supplied hash function will now be
+If you examine the generated code, the supplied hash function will now be
the function callback in the tp_hash slot for the builtin type for <tt>MyClass</tt>:
</p>
<div class="code">
<pre>
static PyHeapTypeObject SwigPyBuiltin__MyClass_type = {
- ...
- (hashfunc) myHashFunc, /* tp_hash */
- ...
+ ...
+ (hashfunc) myHashFunc, /* tp_hash */
+ ...
</pre>
</div>
@@ -2586,7 +2664,7 @@ class MyClass {
</div>
<p>
-NOTE: Some python slots use a method signature which does not
+NOTE: Some Python slots use a method signature which does not
match the signature of SWIG-wrapped methods. For those slots,
SWIG will automatically generate a "closure" function to re-marshal
the arguments before dispatching to the wrapped method. Setting
@@ -2600,7 +2678,7 @@ in the file <tt>python/pyopers.swig</tt> in the SWIG library.
</p>
-<H3><a name="Python_nn30">36.4.3 Memory management</a></H3>
+<H3><a name="Python_nn30">32.4.3 Memory management</a></H3>
<p>NOTE: Although this section refers to proxy objects, everything here also applies
@@ -2609,7 +2687,7 @@ when the <tt>-builtin</tt> option is used.</p>
<p>
Associated with proxy object, is an ownership flag <tt>.thisown</tt> The value of this
flag determines who is responsible for deleting the underlying C++ object. If set to 1,
-the Python interpreter will destroy the C++ object when the proxy class is
+the Python interpreter will destroy the C++ object when the proxy class is
garbage collected. If set to 0 (or if the attribute is missing), then the destruction
of the proxy class has no effect on the C++ object.
</p>
@@ -2623,8 +2701,8 @@ ownership of the result. For example:
<pre>
class Foo {
public:
- Foo();
- Foo bar();
+ Foo();
+ Foo bar();
};
</pre>
</div>
@@ -2653,9 +2731,9 @@ they came from. Therefore, the ownership is set to zero. For example:
<pre>
class Foo {
public:
- ...
- Foo *spam();
- ...
+ ...
+ Foo *spam();
+ ...
};
</pre>
</div>
@@ -2694,8 +2772,8 @@ or global variable. For example, consider this interface:
%module example
struct Foo {
- int value;
- Foo *next;
+ int value;
+ Foo *next;
};
Foo *head = 0;
@@ -2712,7 +2790,7 @@ is assigned to a global variable. For example:
&gt;&gt;&gt; f = example.Foo()
&gt;&gt;&gt; f.thisown
1
-&gt;&gt;&gt; example.cvar.head = f
+&gt;&gt;&gt; example.cvar.head = f
&gt;&gt;&gt; f.thisown
0
&gt;&gt;&gt;
@@ -2795,44 +2873,7 @@ It is also possible to deal with situations like this using
typemaps--an advanced topic discussed later.
</p>
-<H3><a name="Python_nn31">36.4.4 Python 2.2 and classic classes</a></H3>
-
-
-<p>
-SWIG makes every attempt to preserve backwards compatibility with
-older versions of Python to the extent that it is possible. However,
-in Python-2.2, an entirely new type of class system was introduced.
-This new-style class system offers many enhancements including static
-member functions, properties (managed attributes), and class methods.
-Details about all of these changes can be found on <a
-href="https://www.python.org">www.python.org</a> and is not repeated here.
-</p>
-
-<p>
-To address differences between Python versions, SWIG currently emits
-dual-mode proxy class wrappers. In Python-2.2 and newer releases,
-these wrappers encapsulate C++ objects in new-style classes that take
-advantage of new features (static methods and properties). However,
-if these very same wrappers are imported into an older version of Python,
-old-style classes are used instead.
-</p>
-
-<p>
-This dual-nature of the wrapper code means that you can create extension
-modules with SWIG and those modules will work with all versions of Python
-ranging from Python-2.0 to the very latest release. Moreover, the wrappers take
-advantage of Python-2.2 features when available.
-</p>
-
-<p>
-For the most part, the interface presented to users is the same regardless
-of what version of Python is used. The only incompatibility lies in the handling
-of static member functions. In Python-2.2, they can be accessed via the
-class itself. In Python-2.1 and earlier, they have to be accessed as a global
-function or through an instance (see the earlier section).
-</p>
-
-<H2><a name="Python_directors">36.5 Cross language polymorphism</a></H2>
+<H2><a name="Python_directors">32.5 Cross language polymorphism</a></H2>
<p>
@@ -2866,7 +2907,7 @@ proxy classes, director classes, and C wrapper functions takes care of
all the cross-language method routing transparently.
</p>
-<H3><a name="Python_nn33">36.5.1 Enabling directors</a></H3>
+<H3><a name="Python_nn33">32.5.1 Enabling directors</a></H3>
<p>
@@ -2883,18 +2924,18 @@ option to the %module directive, like this:
<p>
Without this option no director code will be generated. Second, you
-must use the %feature("director") directive to tell SWIG which classes
-and methods should get directors. The %feature directive can be applied
+must use the %feature("director") directive to tell SWIG which classes
+and methods should get directors. The %feature directive can be applied
globally, to specific classes, and to specific methods, like this:
</p>
<div class="code">
<pre>
// generate directors for all classes that have virtual methods
-%feature("director");
+%feature("director");
-// generate directors for all virtual methods in class Foo
-%feature("director") Foo;
+// generate directors for the virtual methods in class Foo
+%feature("director") Foo;
</pre>
</div>
@@ -2911,12 +2952,12 @@ directors for specific classes or methods. So for example,
</div>
<p>
-will generate directors for all virtual methods of class Foo except
-bar().
+will generate directors for the virtual methods of class Foo except
+bar().
</p>
<p>
-Directors can also be generated implicitly through inheritance.
+Directors can also be generated implicitly through inheritance.
In the following, class Bar will get a director class that handles
the methods one() and two() (but not three()):
</p>
@@ -2926,21 +2967,21 @@ the methods one() and two() (but not three()):
%feature("director") Foo;
class Foo {
public:
- Foo(int foo);
- virtual ~Foo();
- virtual void one();
- virtual void two();
+ Foo(int foo);
+ virtual ~Foo();
+ virtual void one();
+ virtual void two();
};
class Bar: public Foo {
public:
- virtual void three();
+ virtual void three();
};
</pre>
</div>
<p>
-then at the python side you can define
+then at the Python side you can define
</p>
<div class="targetlang">
@@ -2953,15 +2994,12 @@ class MyFoo(mymodule.Foo):
# super().__init__(foo) # Alternative construction for Python3
def one(self):
- print "one from python"
+ print "one from Python"
</pre>
</div>
-<H3><a name="Python_nn34">36.5.2 Director classes</a></H3>
-
-
-
+<H3><a name="Python_nn34">32.5.2 Director classes</a></H3>
<p>
@@ -2980,7 +3018,8 @@ For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the
original C++ class as the director's base class. By default, a director
class extends all virtual methods in the inheritance chain of its base
class (see the preceding section for how to modify this behavior).
-Thus all virtual method calls, whether they originate in C++ or in
+Virtual methods that have a final specifier are unsurprisingly excluded.
+Thus the virtual method calls, whether they originate in C++ or in
Python via proxy classes, eventually end up in at the implementation in
the director class. The job of the director methods is to route these
method calls to the appropriate place in the inheritance chain. By
@@ -3040,7 +3079,7 @@ so there is no need for the extra overhead involved with routing the
calls through Python.
</p>
-<H3><a name="Python_nn35">36.5.3 Ownership and object destruction</a></H3>
+<H3><a name="Python_nn35">32.5.3 Ownership and object destruction</a></H3>
<p>
@@ -3077,12 +3116,12 @@ references. Here is an example:
<pre>
class Foo {
public:
- ...
+ ...
};
class FooContainer {
public:
- void addFoo(Foo *);
- ...
+ void addFoo(Foo *);
+ ...
};
</pre>
</div>
@@ -3107,7 +3146,7 @@ deleting all the Foo pointers it contains at some point. Note that no hard
references to the Foo objects remain in Python.
</p>
-<H3><a name="Python_nn36">36.5.4 Exception unrolling</a></H3>
+<H3><a name="Python_nn36">32.5.4 Exception unrolling</a></H3>
<p>
@@ -3123,9 +3162,9 @@ suffice in most cases:
<div class="code">
<pre>
%feature("director:except") {
- if ($error != NULL) {
- throw Swig::DirectorMethodException();
- }
+ if ($error != NULL) {
+ throw Swig::DirectorMethodException();
+ }
}
</pre>
</div>
@@ -3152,8 +3191,8 @@ suitable exception handler:
<div class="code">
<pre>
%exception {
- try { $action }
- catch (Swig::DirectorException &amp;e) { SWIG_fail; }
+ try { $action }
+ catch (Swig::DirectorException &amp;e) { SWIG_fail; }
}
</pre>
</div>
@@ -3166,7 +3205,7 @@ Swig::DirectorMethodException is thrown, Python will register the
exception as soon as the C wrapper function returns.
</p>
-<H3><a name="Python_nn37">36.5.5 Overhead and code bloat</a></H3>
+<H3><a name="Python_nn37">32.5.5 Overhead and code bloat</a></H3>
<p>
@@ -3200,7 +3239,7 @@ directive) for only those methods that are likely to be extended in
Python.
</p>
-<H3><a name="Python_nn38">36.5.6 Typemaps</a></H3>
+<H3><a name="Python_nn38">32.5.6 Typemaps</a></H3>
<p>
@@ -3214,7 +3253,7 @@ need to be supported.
</p>
-<H3><a name="Python_nn39">36.5.7 Miscellaneous</a></H3>
+<H3><a name="Python_nn39">32.5.7 Miscellaneous</a></H3>
<p>
@@ -3224,13 +3263,13 @@ be able to use std::vector, std::string, etc., as you would any other type.
<p>
<b>Note:</b> The director typemaps for return types based in const
-references, such as
+references, such as
<div class="code">
<pre>
class Foo {
&hellip;
- virtual const int&amp; bar();
+ virtual const int&amp; bar();
&hellip;
};
</pre>
@@ -3248,7 +3287,7 @@ types, wherever possible, for example
<pre>
class Foo {
&hellip;
- virtual int bar();
+ virtual int bar();
&hellip;
};
</pre>
@@ -3261,7 +3300,7 @@ methods that return const references.
</p>
-<H2><a name="Python_nn40">36.6 Common customization features</a></H2>
+<H2><a name="Python_nn40">32.6 Common customization features</a></H2>
<p>
@@ -3274,7 +3313,7 @@ This section describes some common SWIG features that are used to
improve your the interface to an extension module.
</p>
-<H3><a name="Python_nn41">36.6.1 C/C++ helper functions</a></H3>
+<H3><a name="Python_nn41">32.6.1 C/C++ helper functions</a></H3>
<p>
@@ -3355,7 +3394,7 @@ hard to implement. It is possible to clean this up using Python code, typemaps,
customization features as covered in later sections.
</p>
-<H3><a name="Python_nn42">36.6.2 Adding additional Python code</a></H3>
+<H3><a name="Python_nn42">32.6.2 Adding additional Python code</a></H3>
<p>
@@ -3420,7 +3459,9 @@ statements.
</p>
<p>
-The following shows example usage for Python 2.6 to use <tt>print</tt> as it can in Python 3, that is, as a function instead of a statement:
+The following example for Python 2.x shows how to insert code into the
+generated wrapper to enable <tt>print</tt> to be used as a Python3-compatible
+function instead of a statement:
</p>
<div class="code">
@@ -3437,13 +3478,13 @@ print("Loading", "Whizz", "Bang", sep=' ... ')
</div>
<p>
-which can be seen when viewing the first few lines of the generated <tt>.py</tt> file:
+The insert code can be seen at the start of the generated <tt>.py</tt> file:
</p>
<div class="code">
<pre>
# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 2.0.11
+# Version 4.0.0
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
@@ -3469,7 +3510,7 @@ an error for invalid preprocessor directives, so you may have to update
existing interface files to delimit blocks of Python code correctly.</p>
<p>As an alternative to providing a block containing Python code, you can
-include python code from a file. The code is inserted exactly as in the
+include Python code from a file. The code is inserted exactly as in the
file, so this avoids any issues with the SWIG preprocessor. It's a good
approach if you have a non-trivial chunk of Python code to insert. To
use this feature you specify a filename in double quotes, for example:</p>
@@ -3490,7 +3531,7 @@ entirely replace a proxy function you can use
<pre>
%module example
-// Rewrite bar() python code
+// Rewrite bar() Python code
%feature("shadow") Foo::bar(int) %{
def bar(*args):
@@ -3498,16 +3539,16 @@ def bar(*args):
$action
#do something after
%}
-
+
class Foo {
public:
- int bar(int x);
+ int bar(int x);
};
</pre>
</div>
<p> where <tt>$action</tt> will be replaced by the call to
-the C/C++ proper method.
+the C/C++ proper method.
</p>
<p>
@@ -3525,7 +3566,7 @@ proxy, just before the return statement.
<pre>
%module example
-// Add python code to bar()
+// Add Python code to bar()
%feature("pythonprepend") Foo::bar(int) %{
#do something before C++ call
@@ -3533,12 +3574,13 @@ proxy, just before the return statement.
%feature("pythonappend") Foo::bar(int) %{
#do something after C++ call
+ #the 'val' variable holds the return value
%}
-
+
class Foo {
public:
- int bar(int x);
+ int bar(int x);
};
</pre>
</div>
@@ -3554,7 +3596,7 @@ SWIG version 1.3.28 you can use the directive forms
<pre>
%module example
-// Add python code to bar()
+// Add Python code to bar()
%pythonprepend Foo::bar(int) %{
#do something before C++ call
@@ -3562,12 +3604,13 @@ SWIG version 1.3.28 you can use the directive forms
%pythonappend Foo::bar(int) %{
#do something after C++ call
+ #the 'val' variable holds the return value
%}
-
+
class Foo {
public:
- int bar(int x);
+ int bar(int x);
};
</pre>
</div>
@@ -3583,7 +3626,7 @@ as it will then get attached to all the overloaded C++ methods. For example:
<pre>
%module example
-// Add python code to bar()
+// Add Python code to bar()
%pythonprepend Foo::bar %{
#do something before C++ call
@@ -3596,8 +3639,8 @@ as it will then get attached to all the overloaded C++ methods. For example:
class Foo {
public:
- int bar(int x);
- int bar();
+ int bar(int x);
+ int bar();
};
</pre>
</div>
@@ -3607,7 +3650,7 @@ The same applies for overloaded constructors.
</p>
-<H3><a name="Python_nn43">36.6.3 Class extension with %extend</a></H3>
+<H3><a name="Python_nn43">32.6.3 Class extension with %extend</a></H3>
<p>
@@ -3658,7 +3701,7 @@ Vector(2, 3, 4)
</div>
<p>
-<tt>%extend</tt> can be used for many more tasks than this.
+<tt>%extend</tt> can be used for many more tasks than this.
For example, if you wanted to overload a Python operator, you might do this:
</p>
@@ -3687,7 +3730,7 @@ Use it like this:
&gt;&gt;&gt; w = example.Vector(10, 11, 12)
&gt;&gt;&gt; print v+w
Vector(12, 14, 16)
-&gt;&gt;&gt;
+&gt;&gt;&gt;
</pre>
</div>
@@ -3696,7 +3739,7 @@ Vector(12, 14, 16)
in any way---the extensions only show up in the Python interface.
</p>
-<H3><a name="Python_nn44">36.6.4 Exception handling with %exception</a></H3>
+<H3><a name="Python_nn44">32.6.4 Exception handling with %exception</a></H3>
<p>
@@ -3830,7 +3873,143 @@ The language-independent <tt>exception.i</tt> library file can also be used
to raise exceptions. See the <a href="Library.html#Library">SWIG Library</a> chapter.
</p>
-<H2><a name="Python_nn45">36.7 Tips and techniques</a></H2>
+<H3><a name="Python_optimization">32.6.5 Optimization options</a></H3>
+
+
+<H4><a name="Python_fastproxy">32.6.5.1 -fastproxy</a></H4>
+
+
+<p>
+The <tt>-fastproxy</tt> command line option enables faster method calling as the call is made directly into the C/C++ layer rather than going through a method wrapper.
+</p>
+
+<p>
+Consider wrapping a C++ class:
+</p>
+
+<div class="code">
+<pre>
+struct Go {
+ void callme0() {}
+ void callme4(int a, int b, int c, int d) {}
+ void callme8(double a, double b, double c, double d, double e, double f, double g, double i) {}
+};
+</pre>
+</div>
+
+<p>
+The default generated proxy class is:
+</p>
+
+<div class="targetlang">
+<pre>
+class Go(object):
+ def callme0(self):
+ return _example.Go_callme0(self)
+
+ def callme4(self, a, b, c, d):
+ return _example.Go_callme4(self, a, b, c, d)
+
+ def callme8(self, a, b, c, d, e, f, g, i):
+ return _example.Go_callme8(self, a, b, c, d, e, f, g, i)
+ ...
+</pre>
+</div>
+
+<p>
+Each method in the Python class contains a Python proxy method which passes the arguments on to the underlying function in the low-level C/C++ module (_example in this case).
+The generated proxy class when using <tt>-fastproxy</tt> is:
+</p>
+
+<div class="targetlang">
+<pre>
+%module example
+class Go(object):
+ callme0 = _swig_new_instance_method(_example.Go_callme0)
+ callme4 = _swig_new_instance_method(_example.Go_callme4)
+ callme8 = _swig_new_instance_method(_example.Go_callme8)
+ ...
+</pre>
+</div>
+
+<p>
+where <tt>_swig_new_instance_method</tt> adds the method to the proxy class via C API calls for direct access to the underlying function in the low-level C/C++ module.
+Note that for some methods it is not possible to generate the direct access call and so <tt>-fastproxy</tt> is ignored.
+This happens, for example, when adding <a href="#Python_nn42">additional code</a> to Python proxy methods, such as using <tt>%pythonprepend</tt>.
+</p>
+
+<p>
+The overhead calling into C/C++ from Python is reduced slightly using <tt>-fastproxy</tt>.
+Below are some timings in microseconds calling the 3 functions in the example above.
+Also included in the table for comparison is using the <tt>-builtin</tt> option covered in the
+<a href="#Python_builtin_types">Built-in Types</a>.
+</p>
+
+<table summary="Python fastproxy performance">
+ <tr>
+ <th>Method name</th>
+ <th>Default</th>
+ <th>-fastproxy</th>
+ <th>-builtin</th>
+ </tr>
+ <tr>
+ <td>callme0</td>
+ <td>0.15</td>
+ <td>0.09</td>
+ <td>0.07</td>
+ </tr>
+ <tr>
+ <td>callme4</td>
+ <td>0.26</td>
+ <td>0.16</td>
+ <td>0.14</td>
+ </tr>
+ <tr>
+ <td>callme8</td>
+ <td>0.32</td>
+ <td>0.20</td>
+ <td>0.17</td>
+ </tr>
+</table>
+
+<p>
+Although the <tt>-fastproxy</tt> option results in faster code over the default, the generated proxy code is not as user-friendly
+as docstring/doxygen comments and functions with default values are not visible in the generated Python proxy class.
+The <tt>-olddefs</tt> option can rectify this.
+</p>
+
+<p>
+The generated proxy class for the example above when using <tt>-fastproxy -olddefs</tt> is:
+</p>
+
+<div class="targetlang">
+<pre>
+class Go(object):
+ def callme0(self):
+ return _example.Go_callme0(self)
+ callme0 = _swig_new_instance_method(_example.Go_callme0)
+
+ def callme4(self, a, b, c, d):
+ return _example.Go_callme4(self, a, b, c, d)
+ callme4 = _swig_new_instance_method(_example.Go_callme4)
+
+ def callme8(self, a, b, c, d, e, f, g, i):
+ return _example.Go_callme8(self, a, b, c, d, e, f, g, i)
+ callme8 = _swig_new_instance_method(_example.Go_callme8)
+ ...
+</pre>
+</div>
+
+<p>
+The class defines each method in two different ways. The first definition is replaced by the second definition and so the second definition is the one used when the method is called.
+While this possibly provides the best of both worlds, the time to import the module will be slightly slower when the class is defined due to the additional method definitions.
+</p>
+
+<p>
+The command line options mentioned above also apply to wrapped C/C++ global functions, not just class methods.
+</p>
+
+<H2><a name="Python_nn45">32.7 Tips and techniques</a></H2>
<p>
@@ -3840,7 +4019,7 @@ strings, binary data, and arrays. This chapter discusses the common techniques
solving these problems.
</p>
-<H3><a name="Python_nn46">36.7.1 Input and output parameters</a></H3>
+<H3><a name="Python_nn46">32.7.1 Input and output parameters</a></H3>
<p>
@@ -3991,7 +4170,7 @@ int send_message(char *text, int *success);
</div>
<p>
-When used in Python, the function will return multiple values.
+When used in Python, the function will return multiple values.
</p>
<div class="targetlang">
@@ -4053,7 +4232,7 @@ void foo(Bar *OUTPUT);
may not have the intended effect since <tt>typemaps.i</tt> does not define an OUTPUT rule for <tt>Bar</tt>.
</p>
-<H3><a name="Python_nn47">36.7.2 Simple pointers</a></H3>
+<H3><a name="Python_nn47">32.7.2 Simple pointers</a></H3>
<p>
@@ -4122,7 +4301,7 @@ If you replace <tt>%pointer_functions()</tt> by <tt>%pointer_class(type, name)</
See the <a href="Library.html#Library">SWIG Library</a> chapter for further details.
</p>
-<H3><a name="Python_nn48">36.7.3 Unbounded C Arrays</a></H3>
+<H3><a name="Python_nn48">32.7.3 Unbounded C Arrays</a></H3>
<p>
@@ -4132,17 +4311,17 @@ Sometimes a C function expects an array to be passed as a pointer. For example,
<div class="code">
<pre>
int sumitems(int *first, int nitems) {
- int i, sum = 0;
- for (i = 0; i &lt; nitems; i++) {
- sum += first[i];
- }
- return sum;
+ int i, sum = 0;
+ for (i = 0; i &lt; nitems; i++) {
+ sum += first[i];
+ }
+ return sum;
}
</pre>
</div>
<p>
-To wrap this into Python, you need to pass an array pointer as the first argument.
+To wrap this into Python, you need to pass an array pointer as the first argument.
A simple way to do this is to use the <tt>carrays.i</tt> library file. For example:
</p>
@@ -4184,7 +4363,7 @@ well suited for applications in which you need to create buffers,
package binary data, etc.
</p>
-<H3><a name="Python_nn49">36.7.4 String handling</a></H3>
+<H3><a name="Python_nn49">32.7.4 String handling</a></H3>
<p>
@@ -4219,13 +4398,13 @@ using the <tt>cstring.i</tt> library file described in the <a href="Library.html
</p>
<p>
-When functions return a <tt>char *</tt>, it is assumed to be a NULL-terminated string.
+When functions return a <tt>char *</tt>, it is assumed to be a NULL-terminated string.
Data is copied into a new Python string and returned.
</p>
<p>
If your program needs to work with binary data, you can use a typemap
-to expand a Python string into a pointer/length argument pair. As luck would have it,
+to expand a Python string into a pointer/length argument pair. As luck would have it,
just such a typemap is already defined. Just do this:
</p>
@@ -4254,13 +4433,13 @@ also be used to extra binary data from arbitrary pointers.
</p>
-<H3><a name="Python_default_args">36.7.5 Default arguments</a></H3>
+<H3><a name="Python_default_args">32.7.5 Default arguments</a></H3>
<p>
C++ default argument code generation is documented in the main
<a href="SWIGPlus.html#SWIGPlus_default_args">Default arguments</a> section.
-There is also an optional Python specific feature that can be used called the <tt>python:cdefaultargs</tt>
+There is also an optional Python specific feature that can be used called the <tt>python:cdefaultargs</tt>
<a href="Customization.html#Customization_feature_flags">feature flag</a>.
By default, SWIG attempts to convert C++ default argument values
into Python values and generates code into the Python layer containing these values.
@@ -4303,7 +4482,7 @@ class CDA(object):
<p>
Adding the feature:
</p>
-
+
<div class="code">
<pre>
%feature("python:cdefaultargs") CDA::fff;
@@ -4353,7 +4532,7 @@ Versions of SWIG prior to this varied in their ability to convert C++ default va
equivalent Python default argument values.
</p>
-<H2><a name="Python_nn53">36.8 Typemaps</a></H2>
+<H2><a name="Python_nn53">32.8 Typemaps</a></H2>
<p>
@@ -4364,17 +4543,17 @@ as the material in the "<a href="Typemaps.html#Typemaps">Typemaps</a>" chapter.
</p>
<p>
-Before proceeding, it should be stressed that typemaps are not a required
+Before proceeding, it should be stressed that typemaps are not a required
part of using SWIG---the default wrapping behavior is enough in most cases.
Typemaps are only used if you want to change some aspect of the primitive
C-Python interface or if you want to elevate your guru status.
</p>
-<H3><a name="Python_nn54">36.8.1 What is a typemap?</a></H3>
+<H3><a name="Python_nn54">32.8.1 What is a typemap?</a></H3>
<p>
-A typemap is nothing more than a code generation rule that is attached to
+A typemap is nothing more than a code generation rule that is attached to
a specific C datatype. For example, to convert integers from Python to C,
you might define a typemap like this:
</p>
@@ -4486,7 +4665,7 @@ parameter is omitted):
</pre>
</div>
-<H3><a name="Python_nn55">36.8.2 Python typemaps</a></H3>
+<H3><a name="Python_nn55">32.8.2 Python typemaps</a></H3>
<p>
@@ -4506,7 +4685,7 @@ like this:
<p>
A detailed list of available methods can be found in the "<a
-href="Typemaps.html#Typemaps">Typemaps</a>" chapter.
+href="Typemaps.html#Typemaps">Typemaps</a>" chapter.
</p>
<p>
@@ -4517,7 +4696,7 @@ looking at the files in the SWIG library. Just take into account that
in the latest versions of swig (1.3.22+), the library files are not
very pristine clear for the casual reader, as they used to be. The
extensive use of macros and other ugly techniques in the latest
-version produce a very powerful and consistent python typemap library,
+version produce a very powerful and consistent Python typemap library,
but at the cost of simplicity and pedagogic value.
</p>
@@ -4527,7 +4706,7 @@ a look at the SWIG library version 1.3.20 or so.
</p>
-<H3><a name="Python_nn56">36.8.3 Typemap variables</a></H3>
+<H3><a name="Python_nn56">32.8.3 Typemap variables</a></H3>
<p>
@@ -4568,7 +4747,7 @@ A <tt>PyObject *</tt> that holds the result to be returned to Python.
</p>
<div class="indent">
-The parameter name that was matched.
+The parameter name that was matched.
</div>
<p>
@@ -4598,7 +4777,7 @@ properly assigned.
The Python name of the wrapper function being created.
</div>
-<H3><a name="Python_nn57">36.8.4 Useful Python Functions</a></H3>
+<H3><a name="Python_nn57">32.8.4 Useful Python Functions</a></H3>
<p>
@@ -4726,7 +4905,7 @@ write me
</pre>
</div>
-<H2><a name="Python_nn58">36.9 Typemap Examples</a></H2>
+<H2><a name="Python_nn58">32.9 Typemap Examples</a></H2>
<p>
@@ -4735,7 +4914,7 @@ might look at the files "<tt>python.swg</tt>" and "<tt>typemaps.i</tt>" in
the SWIG library.
</p>
-<H3><a name="Python_nn59">36.9.1 Converting Python list to a char ** </a></H3>
+<H3><a name="Python_nn59">32.9.1 Converting Python list to a char ** </a></H3>
<p>
@@ -4812,10 +4991,10 @@ In the example, two different typemaps are used. The "in" typemap is
used to receive an input argument and convert it to a C array. Since dynamic
memory allocation is used to allocate memory for the array, the
"freearg" typemap is used to later release this memory after the execution of
-the C function.
+the C function.
</p>
-<H3><a name="Python_nn60">36.9.2 Expanding a Python object into multiple arguments</a></H3>
+<H3><a name="Python_nn60">32.9.2 Expanding a Python object into multiple arguments</a></H3>
<p>
@@ -4878,7 +5057,7 @@ previous example:
</div>
<p>
-When writing a multiple-argument typemap, each of the types is referenced by a variable such
+When writing a multiple-argument typemap, each of the types is referenced by a variable such
as <tt>$1</tt> or <tt>$2</tt>. The typemap code simply fills in the appropriate values from
the supplied Python object.
</p>
@@ -4927,14 +5106,14 @@ If you don't you'll get an error message along the lines of:
Traceback (most recent call last):
File "runme.py", line 3, in &gt;module&lt;
example.foo(["foo", "bar", "spam", "1"])
-NotImplementedError: Wrong number or type of arguments for overloaded function 'foo'.
+TypeError: Wrong number or type of arguments for overloaded function 'foo'.
Possible C/C++ prototypes are:
foo(int, char **)
foo()
</pre>
</div>
-<H3><a name="Python_nn61">36.9.3 Using typemaps to return arguments</a></H3>
+<H3><a name="Python_nn61">32.9.3 Using typemaps to return arguments</a></H3>
<p>
@@ -4960,7 +5139,7 @@ A typemap can be used to handle this case as follows :
%module outarg
// This tells SWIG to treat an double * argument with name 'OutValue' as
-// an output value. We'll append the value to the current result which
+// an output value. We'll append the value to the current result which
// is guaranteed to be a List object by SWIG.
%typemap(argout) double *OutValue {
@@ -5022,7 +5201,7 @@ function can now be used as follows:
&gt;&gt;&gt;
</pre></div>
-<H3><a name="Python_nn62">36.9.4 Mapping Python tuples into small arrays</a></H3>
+<H3><a name="Python_nn62">32.9.4 Mapping Python tuples into small arrays</a></H3>
<p>
@@ -5071,7 +5250,7 @@ array, such an approach would not be recommended for huge arrays, but
for small structures, this approach works fine.
</p>
-<H3><a name="Python_nn63">36.9.5 Mapping sequences to C arrays</a></H3>
+<H3><a name="Python_nn63">32.9.5 Mapping sequences to C arrays</a></H3>
<p>
@@ -5160,7 +5339,7 @@ static int convert_darray(PyObject *input, double *ptr, int size) {
</pre>
</div>
-<H3><a name="Python_nn64">36.9.6 Pointer handling</a></H3>
+<H3><a name="Python_nn64">32.9.6 Pointer handling</a></H3>
<p>
@@ -5257,9 +5436,168 @@ that has a <tt>this</tt> attribute. In addition,
class object (if applicable).
</p>
+<H3><a name="Python_memory_management_member_variables">32.9.7 Memory management when returning references to member variables</a></H3>
+
+
+<p>
+This example shows how to prevent premature garbage collection of objects when the underlying C++ class returns a pointer or reference to a member variable.
+The example is a direct equivalent to this <a href="Java.html#Java_memory_management_objects">Java equivalent</a>.
+</p>
+
+<p>
+Consider the following C++ code:
+</p>
+
+<div class="code">
+<pre>
+#include &lt;iostream&gt;
+struct Wheel {
+ int size;
+ Wheel(int sz = 0) : size(sz) {}
+ ~Wheel() { std::cout &lt;&lt; "~Wheel" &lt;&lt; std::endl; }
+};
+
+class Bike {
+ Wheel wheel;
+public:
+ Bike(int val) : wheel(val) {}
+ Wheel&amp; getWheel() { return wheel; }
+};
+</pre>
+</div>
+
+<p>
+and the following usage from Python after running the code through SWIG:
+</p>
-<H2><a name="Python_nn65">36.10 Docstring Features</a></H2>
+<div class="code">
+<pre>
+bike = Bike(10)
+wheel = bike.getWheel()
+print("wheel size: {}".format(wheel.size))
+
+del bike # Allow bike to be garbage collected
+print("wheel size: {}".format(wheel.size))
+</pre>
+</div>
+
+<p>
+Don't be surprised that if the resulting output gives strange results such as...
+</p>
+
+<div class="shell">
+<pre>
+wheel size: 10
+~Wheel
+wheel size: 135019664
+</pre>
+</div>
+
+<p>
+What has happened here is the garbage collector has collected the <tt>Bike</tt> instance as it doesn't think it is needed any more.
+The proxy instance, <tt>wheel</tt>, contains a reference to memory that was deleted when the <tt>Bike</tt> instance was collected.
+In order to prevent the garbage collector from collecting the <tt>Bike</tt> instance, a reference to the <tt>Bike</tt> must
+be added to the <tt>wheel</tt> instance.
+</p>
+
+<p>
+You can do this by adding the reference when the <tt>getWheel()</tt> method
+is called using one of three approaches:
+</p>
+
+<p>
+The easier, but less optimized, way is to use the <tt>%pythonappend</tt> directive
+(see <a href="#Python_nn42">Adding additional Python code</a>):
+</p>
+
+<div class="code">
+<pre>
+%pythonappend getWheel %{
+ # val is the Wheel proxy, self is the Bike instance
+ val.__bike_reference = self
+%}
+</pre>
+</div>
+
+<p>
+The code gets appended to the Python code generated for the
+<tt>Bike::getWheel</tt> wrapper function, where we store the <tt>Bike</tt> proxy
+instance onto the <tt>Wheel</tt> proxy instance before it is returned to the
+caller as follows.
+</p>
+
+<div class="targetlang">
+<pre>
+class Bike(object):
+ ...
+ def getWheel(self):
+ val = _example.Bike_getWheel(self)
+
+ # val is the Wheel proxy, self is the Bike instance
+ val.__bike_reference = self
+
+ return val
+</pre>
+</div>
+
+
+<p>
+The second option, which performs better and is required if you use the
+<tt>-builtin</tt> option, is to set the reference in the CPython implementation:
+
+<div class="code">
+<pre>
+%extend Wheel {
+// A reference to the parent class is added to ensure the underlying C++
+// object is not deleted while the item is in use
+%typemap(ret) Wheel&amp; getWheel {
+ PyObject *bike_reference_string = SWIG_Python_str_FromChar("__bike_reference");
+ PyObject_SetAttr($result, bike_reference_string, $self);
+ Py_DecRef(bike_reference_string);
+}
+}
+</pre>
+</div>
+
+<p>
+The third approach, shown below, is an optimization of the above approach and creates the "__bike_reference" Python string object just once.
+While this looks more complex, it is just a small variation on the above typemap plus a support function
+<tt>bike_reference()</tt> in a fragment called <tt>bike_reference_function</tt>.
+The <tt>bike_reference_init</tt> typemap generates code into the "init" section for an initial call to <tt>bike_reference()</tt> when the module
+is initialized and is done to create the "__bike_reference" Python string singleton in a thread-safe manner.
+</p>
+
+<div class="code">
+<pre>
+%fragment("bike_reference_init", "init") {
+ // Thread-safe initialization - initialize during Python module initialization
+ bike_reference();
+}
+
+%fragment("bike_reference_function", "header", fragment="bike_reference_init") {
+
+static PyObject *bike_reference() {
+ static PyObject *bike_reference_string = SWIG_Python_str_FromChar("__bike_reference");
+ return bike_reference_string;
+}
+
+}
+
+%extend Wheel {
+// A reference to the parent class is added to ensure the underlying C++
+// object is not deleted while the item is in use
+%typemap(ret, fragment="bike_reference_function") Wheel&amp; getWheel %{
+ PyObject_SetAttr($result, bike_reference(), $self);
+%}
+}
+</pre>
+</div>
+
+
+
+
+<H2><a name="Python_nn65">32.10 Docstring Features</a></H2>
<p>
@@ -5287,7 +5625,7 @@ of your users much simpler.
</p>
-<H3><a name="Python_nn66">36.10.1 Module docstring</a></H3>
+<H3><a name="Python_nn66">32.10.1 Module docstring</a></H3>
<p>
@@ -5312,7 +5650,7 @@ example:
<div class="code">
<pre>
%define DOCSTRING
-"The `XmlResource` class allows program resources defining menus,
+"The `XmlResource` class allows program resources defining menus,
layout of controls on a panel, etc. to be loaded from an XML file."
%enddef
@@ -5321,7 +5659,7 @@ layout of controls on a panel, etc. to be loaded from an XML file."
</div>
-<H3><a name="Python_nn67">36.10.2 %feature("autodoc")</a></H3>
+<H3><a name="Python_nn67">32.10.2 %feature("autodoc")</a></H3>
<p>
@@ -5349,7 +5687,7 @@ four levels for autodoc controlled by the value given to the
feature, <tt>%feature("autodoc", "<i>level</i>")</tt>.
The four values for <i>level</i> are covered in the following sub-sections.
-<H4><a name="Python_nn68">36.10.2.1 %feature("autodoc", "0")</a></H4>
+<H4><a name="Python_nn68">32.10.2.1 %feature("autodoc", "0")</a></H4>
<p>
@@ -5378,7 +5716,7 @@ def function_name(*args, **kwargs):
</div>
-<H4><a name="Python_nn69">36.10.2.2 %feature("autodoc", "1")</a></H4>
+<H4><a name="Python_nn69">32.10.2.2 %feature("autodoc", "1")</a></H4>
<p>
@@ -5403,7 +5741,7 @@ def function_name(*args, **kwargs):
</div>
-<H4><a name="Python_autodoc2">36.10.2.3 %feature("autodoc", "2")</a></H4>
+<H4><a name="Python_autodoc2">32.10.2.3 %feature("autodoc", "2")</a></H4>
<p>
@@ -5465,7 +5803,7 @@ def function_name(*args, **kwargs):
</pre>
</div>
-<H4><a name="Python_autodoc3">36.10.2.4 %feature("autodoc", "3")</a></H4>
+<H4><a name="Python_autodoc3">32.10.2.4 %feature("autodoc", "3")</a></H4>
<p>
@@ -5491,7 +5829,7 @@ def function_name(*args, **kwargs):
</div>
-<H4><a name="Python_nn70">36.10.2.5 %feature("autodoc", "docstring")</a></H4>
+<H4><a name="Python_nn70">32.10.2.5 %feature("autodoc", "docstring")</a></H4>
<p>
@@ -5510,7 +5848,7 @@ void GetPosition(int* OUTPUT, int* OUTPUT);
</div>
-<H3><a name="Python_nn71">36.10.3 %feature("docstring")</a></H3>
+<H3><a name="Python_nn71">32.10.3 %feature("docstring")</a></H3>
<p>
@@ -5542,7 +5880,7 @@ with more than one line.
</pre>
</div>
-<H2><a name="Python_nn72">36.11 Python Packages</a></H2>
+<H2><a name="Python_nn72">32.11 Python Packages</a></H2>
<p>Python has concepts of modules and packages. Modules are separate units of
@@ -5601,15 +5939,14 @@ Python3 adds another option for packages with
namespace packages). Implicit namespace packages no longer use
__init__.py files. SWIG generated Python modules support implicit
namespace packages. See
-<a href="#Python_implicit_namespace_packages">36.11.5 Implicit Namespace
-Packages</a> for more information.
+<a href="#Python_implicit_namespace_packages">Implicit namespace
+packages</a> for more information.
</p>
<p>
-If you place a SWIG generated module into a Python package then there
-are details concerning the way SWIG
-<a href="#Python_package_search">searches for the wrapper module</a>
-that you may want to familiarize yourself with.
+You can place a SWIG generated module into a Python package or keep as a global module,
+details are covered a little later in
+<a href="#Python_package_search">Location of modules</a>.
</p>
<p>The way Python defines its modules and packages impacts SWIG users. Some
@@ -5617,7 +5954,7 @@ users may need to use special features such as the <tt>package</tt> option in th
<tt>%module</tt> directive or import related command line options. These are
explained in the following sections.</p>
-<H3><a name="Python_modulepackage">36.11.1 Setting the Python package</a></H3>
+<H3><a name="Python_modulepackage">32.11.1 Setting the Python package</a></H3>
<p>
@@ -5671,7 +6008,7 @@ pkg1/pkg2/_foo.so # (shared library built from C/C++ code generated by SWI
</pre>
</div>
-<H3><a name="Python_absrelimports">36.11.2 Absolute and relative imports</a></H3>
+<H3><a name="Python_absrelimports">32.11.2 Absolute and relative imports</a></H3>
<p>Suppose, we have the following hierarchy of files:</p>
@@ -5768,12 +6105,19 @@ class M2(pkg2.mod3.M3): pass
</pre>
</div>
-<p>By default, SWIG would generate <tt>mod2.py</tt> proxy file with
+<p>By default, SWIG will generate <tt>mod2.py</tt> proxy file with
<tt>import</tt> directive as in point 1. This can be changed with the
<tt>-relativeimport</tt> command line option. The <tt>-relativeimport</tt> instructs
-SWIG to organize imports as in point 2 (for Python < 2.7.0) or as in point 4
-for Python 2.7.0 and newer. This is a check done at the time the module is
-imported. In short, if you have
+SWIG to organize imports as in point 4 for Python 2.7.0 and newer.
+</p>
+
+<p>
+<b>Compatibility Note:</b> Versions of SWIG prior to SWIG-4.0.0 supported Python &lt; 2.7.0
+and would organize the imports as in point 2 if an older version of Python was detected at runtime.
+</p>
+
+<p>
+In short, if you have
<tt>mod2.i</tt> and <tt>mod3.i</tt> as above, then without
<tt>-relativeimport</tt> SWIG will write</p>
@@ -5788,13 +6132,8 @@ write</p>
<div class="targetlang">
<pre>
-from sys import version_info
-if version_info &gt;= (2, 7, 0):
- from . import pkg2
- import pkg1.pkg2.mod3
-else:
- import pkg2.mod3
-del version_info
+from . import pkg2
+from .pkg2 import mod3
</pre>
</div>
@@ -5806,7 +6145,7 @@ uses relative imports. Second case is, when one puts import directives in
<tt>__init__.py</tt> to import symbols from submodules or subpackages and the
submodule depends on other submodules (discussed later).</p>
-<H3><a name="Python_absimport">36.11.3 Enforcing absolute import semantics</a></H3>
+<H3><a name="Python_absimport">32.11.3 Enforcing absolute import semantics</a></H3>
<p>As you may know, there is an incompatibility in import semantics (for the
@@ -5832,7 +6171,7 @@ from __future__ import absolute_import
</pre>
</div>
-<p>at the very beginning of his proxy <tt>*.py</tt> file. In SWIG, it may be
+<p>at the very beginning of your proxy <tt>*.py</tt> file. In SWIG, it may be
accomplished with <tt>%pythonbegin</tt> directive as follows:</p>
<div class="code">
@@ -5843,7 +6182,7 @@ from __future__ import absolute_import
</pre>
</div>
-<H3><a name="Python_importfrominit">36.11.4 Importing from __init__.py</a></H3>
+<H3><a name="Python_importfrominit">32.11.4 Importing from __init__.py</a></H3>
<p>Imports in <tt>__init__.py</tt> are handy when you want to populate a
@@ -5953,7 +6292,7 @@ class Bar(pkg3.foo.Foo): pass
effect (note, that the Python 2 case also needs the <tt>-relativeimport</tt>
workaround).</p>
-<H3><a name="Python_implicit_namespace_packages">36.11.5 Implicit Namespace Packages</a></H3>
+<H3><a name="Python_implicit_namespace_packages">32.11.5 Implicit namespace packages</a></H3>
<p> Python 3.3 introduced
@@ -6000,7 +6339,7 @@ packages you can place these files in the following configurations:
</pre>
</div>
-<p> Finally suppose that your pure python code is stored in a .zip file or
+<p> Finally suppose that your pure Python code is stored in a .zip file or
some other way (database, web service connection, etc). Python can load the
robin.py module using a custom importer. But the _robin.so module will need
to be located on a file system. Implicit namespace packages make this
@@ -6031,145 +6370,280 @@ zipimporter requires python-3.5.1 or newer to work with subpackages.
</p>
-<H3><a name="Python_package_search">36.11.6 Searching for the wrapper module</a></H3>
+<H3><a name="Python_package_search">32.11.6 Location of modules</a></H3>
<p>
When SWIG creates wrappers from an interface file, say foo.i, two Python modules are
-created. There is a pure Python module module (foo.py) and C/C++ code which is
-built and linked into a dynamically (or statically) loaded low-level module _foo
-(see the <a href="Python.html#Python_nn3">Preliminaries section</a> for details). So, the interface
+created. There is a pure Python module (foo.py) and C/C++ code which is
+compiled and linked into a dynamically (or statically) loaded low-level module _foo
+(see the <a href="#Python_nn3">Preliminaries section</a> for details). So, the interface
file really defines two Python modules. How these two modules are loaded is
covered next.
</p>
<p>
-The pure Python module needs to load the C/C++ module in order to link
-to the wrapped C/C++ methods. To do this it must make some assumptions
-about what package the C/C++ module may be located in. The approach the
-pure Python module uses to find the C/C++ module is as follows:
+The pure Python module needs to load the C/C++ module in order to call
+the wrapped C/C++ methods. To do this it must make some assumptions
+about the location of the C/C++ module.
+There are two configurations that are supported by default.
</p>
<ol>
- <li><p>The pure Python module, foo.py, tries to load the C/C++ module, _foo, from the same package foo.py is
- located in. The package name is determined from the <tt>__name__</tt>
- attribute given to foo.py by the Python loader that imported
- foo.py. If foo.py is not in a package then _foo is loaded
- as a global module.</p>
+ <li><p>Both modules in the same package</p>
</li>
- <li><p>If the above import of _foo results in an ImportError
- being thrown, then foo.py makes a final attempt to load _foo
- as a global module.</p>
+ <li><p>Both modules are global</p>
</li>
</ol>
<p>
-The Python code implementing the loading logic described above is quite complex to handle multiple
-versions of Python, but it can be replaced with custom code.
-This is not recommended unless you understand the full intricacies of importing Python modules.
-The custom code can be specified by setting the <tt>moduleimport</tt> option of the <tt>%module</tt> directive with the appropriate import code. For example:
+Additional configurations are supported but require custom import code.
+</p>
+
+
+<p>
+The following sub-sections look more closely at the two default configurations as well as some customized configurations.
+An input interface file, foo.i, results in the two modules foo.py and _foo.so for each of the configurations.
+</p>
+
+<H4><a name="Python_package_search_both_package_modules">32.11.6.1 Both modules in the same package</a></H4>
+
+
+<p>
+In this configuration, the pure Python module, foo.py, tries to load the C/C++ module, _foo, from the same package foo.py is
+located in. The package name is determined from the <tt>__package__</tt>
+attribute if available, see <a href="https://www.python.org/dev/peps/pep-0366/">PEP 366</a>. Otherwise it is derived from the <tt>__name__</tt>
+attribute given to foo.py by the Python loader that imported foo.py.
+The interface file for this configuration would contain:
</p>
<div class="code">
<pre>
-%module(moduleimport="import _foo") foo
+%module(package="mypackage") foo
</pre>
</div>
+<p>The location of the files could be as follows:</p>
+<div class="diagram">
+<pre>
+/dir/mypackage/foo.py
+/dir/mypackage/__init__.py
+/dir/mypackage/_foo.so
+</pre>
+</div>
+
+<p>Assuming /dir/ is in PYTHONPATH, the module can be imported using</p>
+
+<div class="targetlang">
+<pre>
+from mypackage import foo
+</pre>
+</div>
+
+
+<H4><a name="Python_package_search_both_global_modules">32.11.6.2 Both modules are global</a></H4>
+
+
<p>
-The special variable <tt>$module</tt> will also be expanded into the low-level C/C++ module name, <tt>_foo</tt> in the case above.
-When you have more than just a line or so then you can retain the easy
-readability of the <tt>%module</tt> directive by using a macro. For
-example:
+In this configuration, there are no packages.
+If foo.py is not in a package, that is, it is a global module, then _foo is loaded
+as a global module.
+The interface file for this configuration would contain:
</p>
<div class="code">
<pre>
-%define MODULEIMPORT
-"
-print 'Loading low-level module $module'
-import $module
-print 'Module has loaded'
-"
-%enddef
+%module foo
+</pre>
+</div>
-%module(moduleimport=MODULEIMPORT) foo
+<p>The location of the files could be as follows:</p>
+<div class="diagram">
+<pre>
+/dir/foo.py
+/dir/_foo.so
</pre>
</div>
+<p>Assuming /dir/ is in PYTHONPATH, the module can be imported using</p>
-<p>
-Now let's consider an example using the SWIG default loading logic.
-Suppose foo.i is compiled into foo.py and _foo.so. Assuming
-/dir is on PYTHONPATH, then the two modules can be installed and used in the
-following ways:
+<div class="targetlang">
+<pre>
+import foo
+</pre>
+</div>
+
+<H4><a name="Python_package_search_wrapper_split">32.11.6.3 Split modules custom configuration</a></H4>
+
+
+<p>In this non-standard 'split module' configuration, the pure Python module is in a package and the low level C/C++ module is global.
+This configuration is not generally recommended and is not supported by default as it needs a custom configuration.
+The module import code customization required is via the <tt>moduleimport</tt> attribute in the <tt>%module</tt> directive.
+The next sub-section elaborates further on this.
+The interface file for this split module configuration would contain:
</p>
+<div class="code">
+<pre>
+%module(package="mypackage", moduleimport="import _foo") foo
+</pre>
+</div>
-<H4><a name="Python_package_search_both_package_modules">36.11.6.1 Both modules in the same package</a></H4>
+<p>
+When using <tt>-builtin</tt>, use the following instead (the reasons are also covered shortly in the next sub-section):
+</p>
+<div class="code">
+<pre>
+%module(package="mypackage", moduleimport="from _foo import *") foo
+</pre>
+</div>
-<p>Both modules are in one package:</p>
+<p>The location of the files could be as follows:</p>
<div class="diagram">
<pre>
-/dir/package/foo.py
-/dir/package/__init__.py
-/dir/package/_foo.so
+/dir/mypackage/foo.py
+/dir/mypackage/__init__.py
+/dir/_foo.so
</pre>
</div>
-<p>And imported with</p>
-<div class="diagram">
+
+<p>Assuming /dir/ is in PYTHONPATH, the module can be imported using</p>
+
+<div class="targetlang">
<pre>
-from package import foo
+from mypackage import foo
</pre>
</div>
+<p>
+<b>Compatibility Note:</b> Versions of SWIG prior to SWIG-4.0.0 supported split modules without the above customization.
+However, this had to be removed as the default import code often led to confusion due to obfuscation of genuine Python <tt>ImportError</tt> problems.
+Using one of the two default configurations is the recommended approach now.
+</p>
-<H4><a name="Python_package_search_wrapper_split">36.11.6.2 Split modules</a></H4>
+<H4><a name="Python_custom_module_import">32.11.6.4 More on customizing the module import code</a></H4>
-<p>The pure python module is in a package and the C/C++ module is global:</p>
-<div class="diagram">
+
+<p>
+The Python code implementing the default import logic is shown below. It supports the two configurations described earlier, that is,
+either both modules are in a package or loading both as global modules.
+The code is generated into the pure Python module, foo.py, and merely imports the low-level _foo module.
+</p>
+
+<div class="targetlang">
<pre>
-/dir/package/foo.py
-/dir/package/__init__.py
-/dir/_foo.so
+if __package__ or '.' in __name__:
+ from . import _foo
+else:
+ import _foo
</pre>
</div>
-<p>And imported with</p>
-<div class="diagram">
+
+<p>
+This import code implementation is non-trivial but it can be replaced with custom code providing opportunities to make it simpler and/or more flexible.
+This is not normally recommended though unless you have a good understanding of the intricacies of importing Python modules.
+The custom code can be specified by setting the <tt>moduleimport</tt> option of the <tt>%module</tt> directive with the appropriate import code. For example:
+</p>
+
+<div class="code">
<pre>
-from package import foo
+%module(moduleimport="import _foo") foo
</pre>
</div>
+<p>
+This will replace the default import logic above and generate the following into the pure Python module, foo.py:
+</p>
-<H4><a name="Python_package_search_both_global_modules">36.11.6.3 Both modules are global</a></H4>
+<div class="targetlang">
+<pre>
+import _foo
+</pre>
+</div>
+<p>
+In fact the above is a simplification customization for the configuration where both modules are global;
+it removes the logic for also handling the modules being in a package.
+</p>
-<p>Both modules are global:</p>
-<div class="diagram">
+<p>
+There is a special variable, <tt>$module</tt>, which is expanded into the low-level C/C++ module name, <tt>_foo</tt> in the case above.
+The identical output would be generated if instead the following had been used:
+</p>
+
+<div class="code">
<pre>
-/dir/foo.py
-/dir/_foo.so
+%module(moduleimport="import $module") foo
</pre>
</div>
-<p>And imported with</p>
-<div class="diagram">
+
+<p>
+When you have many lines you can retain the easy
+readability of the <tt>%module</tt> directive by using a macro. For
+example:
+</p>
+
+<div class="code">
<pre>
-import foo
+%define MODULEIMPORT
+"
+print 'Loading low-level module $module'
+import $module
+print 'Module has loaded'
+"
+%enddef
+
+%module(moduleimport=MODULEIMPORT) foo
+</pre>
+</div>
+
+<p>
+This will of course generate the following into the pure Python module:
+</p>
+
+<div class="targetlang">
+<pre>
+print 'Loading low-level module $module'
+import _foo
+print 'Module has loaded'
+</pre>
+</div>
+
+<p>
+When using the <tt>-builtin</tt> option, the link between the pure Python module and the low-level C/C++ module is slightly different as
+all the objects from the low-level module are imported directly into the pure Python module.
+The default import loading code is thus different:
+</p>
+
+<div class="targetlang">
+<pre>
+if __package__ or '.' in __name__:
+ from ._foo import *
+else:
+ from _foo import *
</pre>
</div>
<p>
-If _foo is statically linked into an embedded Python interpreter, then it may or
-may not be in a Python package. This depends in the exact way the module was
-loaded statically. The above search order will still be used for statically
-loaded modules. So, one may place the module either globally or in a package
-as desired.
+Any customizations must import the code in a similar manner.
+The best way to support both with and without <tt>-builtin</tt> is to make use of the <tt>SWIGPYTHON_BUILTIN</tt> macro which is defined when <tt>-builtin</tt> is specified.
+The following will do this for the <a href="#Python_package_search_wrapper_split">split modules</a> case above.
</p>
-<H4><a name="Python_package_search_static">36.11.6.4 Statically linked C modules</a></H4>
+
+<div class="code">
+<pre>
+#if defined(SWIGPYTHON_BUILTIN) /* defined when using -builtin */
+%module(package="mypackage", moduleimport="from $module import *") foo
+#else
+%module(package="mypackage", moduleimport="import $module") foo
+#endif
+</pre>
+</div>
+
+<H4><a name="Python_package_search_static">32.11.6.5 Statically linked C modules</a></H4>
<p>It is strongly recommended to use dynamically linked modules for the C
@@ -6178,7 +6652,7 @@ If for some reason you still need
to link the C module of the pair of Python modules generated by SWIG into
your interpreter, then this section provides some details on how this impacts
the pure Python modules ability to locate the other part of the pair.
-Please also see the <a href="Python.html#Python_nn8">Static Linking</a> section.
+Please also see the <a href="#Python_nn8">Static Linking</a> section.
</p>
<p>When Python is extended with C code the Python interpreter needs to be
@@ -6195,7 +6669,7 @@ new SWIG C module exists.
which would have normally been called when the shared object was dynamically
loaded. The specific name of this method is not given here because statically
linked modules are not encouraged with SWIG
-(<a href="Python.html#Python_nn8">Static Linking</a>). However one can find this
+(<a href="#Python_nn8">Static Linking</a>). However one can find this
init function in the C file generated by SWIG.
</p>
@@ -6207,8 +6681,8 @@ they treat it affects how the pure Python module will be able to
locate the C module.
</p>
-<p>The details concerning this are covered completly in the documentation
-for Python itself. Links to the relavent sections follow:
+<p>The details concerning this are covered completely in the documentation
+for Python itself. Links to the relevant sections follow:
</p>
<ul>
@@ -6218,21 +6692,21 @@ for Python itself. Links to the relavent sections follow:
<p>There are two keys things to understand. The first is that in
Python 2 the init() function returns void. In Python 3 the init() function
-returns a PyObject * which points to the new module. Secondly, when
+returns a <tt>PyObject *</tt> which points to the new module. Secondly, when
you call the init() method manually, you are the Python importer. So, you
determine which package the C module will be located in.
</p>
<p>So, if you are using Python 3 it is important that you follow what is
described in the Python documentation linked above. In particular, you can't
-simply call the init() function generated by SWIG and cast the PyObject
+simply call the init() function generated by SWIG and cast the <tt>PyObject</tt>
pointer it returns over the side. If you do then Python 3 will have no
idea that your C module exists and the pure Python half of your wrapper will
not be able to find it. You need to register your module with the Python
interpreter as described in the Python docs.
</p>
-<p>With Python 2 things are somewhat more simple. In this case the init function
+<p>With Python 2 things are somewhat more simple. In this case the init() function
returns void. Calling it will register your new C module as a <b>global</b>
module. The pure Python part of the SWIG wrapper will be able to find it
because it tries both the pure Python module it is part of and the global
@@ -6241,17 +6715,15 @@ module then you will either need to refer to the Python documentation on how
to do this (remember you are now the Python importer) or use dynamic linking.
</p>
-<H2><a name="Python_python3support">36.12 Python 3 Support</a></H2>
+<H2><a name="Python_python3support">32.12 Python 3 Support</a></H2>
<p>
-SWIG is able to support Python 3.0. The wrapper code generated by
-SWIG can be compiled with both Python 2.x or 3.0. Further more, by
+SWIG is able to support Python 3.x. The wrapper code generated by
+SWIG can be compiled with both Python 2.x or 3.x. Further more, by
passing the <tt>-py3</tt> command line option to SWIG, wrapper code
with some Python 3 specific features can be generated (see below
-subsections for details of these features). The <tt>-py3</tt> option also
-disables some incompatible features for Python 3, such as
-<tt>-classic</tt>.
+subsections for details of these features).
<p>
There is a list of known-to-be-broken features in Python 3:
@@ -6264,11 +6736,11 @@ There is a list of known-to-be-broken features in Python 3:
</ul>
<p>
-The following are Python 3.0 new features that are currently supported by
+The following are Python 3 new features that are currently supported by
SWIG.
</p>
-<H3><a name="Python_nn74">36.12.1 Function annotation</a></H3>
+<H3><a name="Python_nn74">32.12.1 Function annotation</a></H3>
<p>
@@ -6301,12 +6773,12 @@ For detailed usage of function annotation, see
<a href="https://www.python.org/dev/peps/pep-3107/">PEP 3107</a>.
</p>
-<H3><a name="Python_nn75">36.12.2 Buffer interface</a></H3>
+<H3><a name="Python_nn75">32.12.2 Buffer interface</a></H3>
<p>
-Buffer protocols were revised in Python 3. SWIG also gains a series of
-new typemaps to support buffer interfaces. These typemap macros are
+SWIG has a series of
+typemaps to support buffer interfaces. These typemap macros are
defined in <tt>pybuffer.i</tt>, which must be included in order to use them.
By using these typemaps, your wrapped function will be able to
accept any Python object that exposes a suitable buffer interface.
@@ -6323,15 +6795,15 @@ void get_path(char *s);
<p>
Then you can write a typemap like this: (the following example is
-applied to both Python 3.0 and 2.6, since the <tt>bytearray</tt> type
-is backported to 2.6.
+applied to both Python 2 and 3, since the <tt>bytearray</tt> type
+was backported to 2.6.
</p>
<div class="code"><pre>
%include &lt;pybuffer.i&gt;
%pybuffer_mutable_string(char *str);
-void get_path(char *s);
+void get_path(char *str);
</pre></div>
<p>
@@ -6378,7 +6850,7 @@ In Python:
&gt;&gt;&gt; snprintf(buf, "Hello world!")
&gt;&gt;&gt; print(buf)
bytearray(b'Hello\x00')
-&gt;&gt;&gt;
+&gt;&gt;&gt;
</pre></div>
</div>
@@ -6414,7 +6886,7 @@ bytearray(b'FOO\x00')
<p>
Both <tt>%pybuffer_mutable_binary</tt> and <tt>%pybuffer_mutable_string</tt>
-require the provided buffer to be mutable, eg. they can accept a
+require the provided buffer to be mutable, eg. they can accept a
<tt>bytearray</tt> type but can't accept an immutable <tt>byte</tt>
type.
</p>
@@ -6431,7 +6903,7 @@ type.
This macro maps an object's buffer to a pointer <tt>parm</tt> and a
size <tt>size_parm</tt>. It is similar to
<tt>%pybuffer_mutable_binary</tt>, except the
-<tt>%pybuffer_binary</tt> an accept both mutable and immutable
+<tt>%pybuffer_binary</tt> can accept both mutable and immutable
buffers. As a result, the wrapped function should not modify the buffer.
</p>
@@ -6453,13 +6925,14 @@ modify the buffer.
</div>
-<H3><a name="Python_nn76">36.12.3 Abstract base classes</a></H3>
+<H3><a name="Python_nn76">32.12.3 Abstract base classes</a></H3>
<p>
By including <tt>pyabc.i</tt> and using the <tt>-py3</tt> command
line option when calling SWIG, the proxy classes of the STL containers
-will automatically gain an appropriate abstract base class. For
+will automatically gain an appropriate abstract base class from the
+<tt>collections.abc</tt> module. For
example, the following SWIG interface:
</p>
@@ -6476,8 +6949,8 @@ namespace std {
<p>
will generate a Python proxy class <tt>Mapii</tt> inheriting from
-<tt>collections.MutableMap</tt> and a proxy class <tt>IntList</tt>
-inheriting from <tt>collections.MutableSequence</tt>.
+<tt>collections.abc.MutableMap</tt> and a proxy class <tt>IntList</tt>
+inheriting from <tt>collections.abc.MutableSequence</tt>.
</p>
<p>
@@ -6486,7 +6959,7 @@ used to define an abstract base class for your own C++ class:
</p>
<div class="code"><pre>
-%pythonabc(MySet, collections.MutableSet);
+%pythonabc(MySet, collections.abc.MutableSet);
</pre></div>
<p>
@@ -6494,7 +6967,15 @@ For details of abstract base class, please see
<a href="https://www.python.org/dev/peps/pep-3119/">PEP 3119</a>.
</p>
-<H3><a name="Python_nn77">36.12.4 Byte string output conversion</a></H3>
+<p>
+<b>Compatibility Note:</b> SWIG-4.0.0 changed the base classes to use the
+<tt>collections.abc</tt> module instead of <tt>collections</tt> due to the deprecation
+of the classes in the <tt>collections</tt> module in Python 3.7.
+The <tt>collections.abc</tt> module was introduced in Python 3.3 and hence this feature
+requires Python 3.3 or later.
+</p>
+
+<H3><a name="Python_nn77">32.12.4 Byte string output conversion</a></H3>
<p>
@@ -6511,18 +6992,21 @@ string that cannot be completely decoded as UTF-8:
<div class="code"><pre>
%module example
-%include &lt;std_string.i&gt;
-
%inline %{
-const char* non_utf8_c_str(void) {
- return "h\xe9llo w\xc3\xb6rld";
+const char * non_utf8_c_str(void) {
+ return "h\xe9llo w\xc3\xb6rld";
+}
+
+void instring(const char *s) {
+ ...
}
%}
</pre></div>
<p>
+Note that "\xe9" is an invalid UTF-8 encoding, but "\xc3\xb6" is valid.
When this method is called from Python 3, the return value is the following
text string:
</p>
@@ -6581,6 +7065,20 @@ For more details about the <tt>surrogateescape</tt> error handler, please see
</p>
<p>
+When Python 3 strings are passed to the C/C++ layer, they are expected to be valid UTF8 Unicode strings too.
+For example, when the <tt>instring</tt> method above is wrapped and called, any invalid UTF8 Unicode code strings
+will result in a TypeError because the attempted conversion fails:
+</p>
+
+<div class="targetlang"><pre>
+&gt;&gt;&gt; example.instring('h\xe9llo')
+&gt;&gt;&gt; example.instring('h\udce9llo')
+Traceback (most recent call last):
+ File "&lt;stdin&gt;", line 1, in &lt;module&gt;
+TypeError: in method 'instring', argument 1 of type 'char const *'
+</pre></div>
+
+<p>
In some cases, users may wish to instead handle all byte strings as bytes
objects in Python 3. This can be accomplished by adding
<tt>SWIG_PYTHON_STRICT_BYTE_CHAR</tt> to the generated code:
@@ -6658,7 +7156,7 @@ overloads taking both std::string (as Python bytes) and std::wstring
(as Python unicode).
</p>
-<H3><a name="Python_2_unicode">36.12.5 Python 2 Unicode</a></H3>
+<H3><a name="Python_2_unicode">32.12.5 Python 2 Unicode</a></H3>
<p>
@@ -6730,6 +7228,110 @@ the first is allowing unicode conversion and the second is explicitly
prohibiting it.
</p>
+<H2><a name="Python_multithreaded">32.13 Support for Multithreaded Applications</a></H2>
+
+
+<p>By default, SWIG does not enable support for multithreaded Python applications. More
+specifically, the Python wrappers generated by SWIG will not release the
+ Python's interpreter's Global Interpreter Lock (GIL) when wrapped C/C++ code is
+entered. Hence, while any of the wrapped C/C++ code is executing, the Python interpreter
+will not be able to run any other threads, even if the wrapped C/C++ code is waiting
+ in a blocking call for something like network or disk IO.
+
+ Fortunately, SWIG does have the ability to enable multithreaded support and automatic
+ release of the GIL either for all wrapped code in a module or on a more selective basis. The user
+ interface for this is described in the next section.
+</p>
+
+<H3><a name="Python_thread_UI">32.13.1 UI for Enabling Multithreading Support</a></H3>
+
+
+<p>The user interface is as follows:</p>
+<ol>
+ <li><p>Module thread support can be enabled in two ways:</p>
+ <ul>
+ <li>
+ <p>
+ The <tt>-threads</tt> SWIG Python option at the command line (or in <tt>setup.py</tt>):
+ </p>
+ <div class="shell"><pre>$ swig -python -threads example.i</pre></div>
+ </li>
+ <li>
+ <p>
+ The <tt>threads</tt> module option in the *.i template file:
+ </p>
+ <div class="code"><pre>%module("threads"=1)</pre></div>
+ </li>
+ </ul>
+ </li>
+ <li><p>You can disable thread support for a given method:</p>
+ <div class="code"><pre>%feature("nothread") method;</pre></div>
+ or
+ <div class="code"><pre>%nothread method;</pre></div>
+ </li>
+ <li><p>You can partially disable thread support for a given method:</p>
+ <ul>
+ <li><p>To disable the C++/Python thread protection:</p>
+ <div class="code"><pre>%feature("nothreadblock") method;</pre></div>
+ or
+ <div class="code"><pre>%nothreadblock method;</pre></div>
+ </li>
+ <li>
+ <p>To disable the Python/C++ thread protection</p>
+ <div class="code"><pre>%feature("nothreadallow") method;</pre></div>
+ or
+ <div class="code"><pre>%nothreadallow method;</pre></div>
+ </li>
+ </ul>
+ </li>
+</ol>
+
+<H3><a name="Python_thread_performance">32.13.2 Multithread Performance</a></H3>
+
+
+<p>
+ For the curious about performance, here are some numbers for the profiletest.i test,
+ which is used to check the speed of the wrapped code:
+</p>
+
+<table summary="Python multithread performance">
+ <tr>
+ <th>Thread Mode</th>
+ <th>Execution Time (sec)</th>
+ <th>Comment</th>
+ </tr>
+ <tr>
+ <td>Single Threaded</td>
+ <td>9.6</td>
+ <td>no "-threads" option given</td>
+ </tr>
+ <tr>
+ <td>Fully Multithreaded</td>
+ <td>15.5</td>
+ <td>"-threads" option = 'allow' + 'block'</td>
+ </tr>
+ <tr>
+ <td>No Thread block</td>
+ <td>12.2</td>
+ <td>only 'allow'</td>
+ </tr>
+ <tr>
+ <td>No Thread Allow</td>
+ <td>13.6</td>
+ <td>only block'</td>
+ </tr>
+</table>
+
+<p>
+ Fully threaded code decreases the wrapping performance by
+ around 60%. If that is important to your application, you
+ can tune each method using the different 'nothread',
+ 'nothreadblock' or 'nothreadallow' features as
+ needed. Note that for some methods deactivating the
+ 'thread block' or 'thread allow' code is not an option,
+ so, be careful.
+</p>
+
</body>
</html>
diff --git a/Doc/Manual/R.html b/Doc/Manual/R.html
index 40b96d6c9..373cd7ed9 100644
--- a/Doc/Manual/R.html
+++ b/Doc/Manual/R.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="R">37 SWIG and R</a></H1>
+<H1><a name="R">33 SWIG and R</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -28,13 +28,15 @@
R is a GPL'ed open source statistical and plotting environment.
Information about R can be found at <a
href="http://www.r-project.org/">www.r-project.org</a>.
+</p>
+<p>
The R bindings are under active development. They have been used to
compile and run an R interface to QuantLib running on Mandriva Linux
with gcc. The R bindings also work on Microsoft Windows using Visual C++.
</p>
-<H2><a name="R_nn2">37.1 Bugs</a></H2>
+<H2><a name="R_nn2">33.1 Bugs</a></H2>
<p>
@@ -46,7 +48,7 @@ Currently the following features are not implemented or broken:
<li>C Array wrappings
</ul>
-<H2><a name="R_nn3">37.2 Using R and SWIG</a></H2>
+<H2><a name="R_nn3">33.2 Using R and SWIG</a></H2>
<p>
@@ -113,11 +115,10 @@ cacheMetaData(1)
</pre>
</div>
+<p>
The cacheMetaData(1) will cause R to refresh its object tables.
Without it, inheritance of wrapped objects may fail.
-
-<p>
-These two files can be loaded in any order
+These two files can be loaded in any order.
</p>
<p>
@@ -129,7 +130,7 @@ These two files can be loaded in any order
<li>If you do not set the output file name appropriately, you might see errors like
<div class="shell">
<pre>
-> fact(4)
+&gt; fact(4)
Error in .Call("R_swig_fact", s_arg1, as.logical(.copy), PACKAGE = "example") :
"R_swig_fact" not available for .Call() for package "example"
</pre>
@@ -137,25 +138,29 @@ Error in .Call("R_swig_fact", s_arg1, as.logical(.copy), PACKAGE = "example") :
<li>Make sure the architecture of the shared library(x64 for instance), matches the architecture of the R program you want to load your shared library into
</ul>
-<H2><a name="R_nn4">37.3 Precompiling large R files</a></H2>
+<H2><a name="R_nn4">33.3 Precompiling large R files</a></H2>
+<p>
In cases where the R file is large, one make save a lot of loading
time by precompiling the R wrapper. This can be done by creating the
file makeRData.R which contains the following
+</p>
-<pre>
+<div class="code"><pre>
source('BigFile.R')
save(list=ls(all=TRUE), file="BigFile.RData", compress=TRUE)
q(save="no")
-</pre>
+</pre></div>
+<p>
This will generate a compiled R file called BigFile.RData that
will save a large amount of loading time.
+</p>
-<H2><a name="R_nn5">37.4 General policy</a></H2>
+<H2><a name="R_nn5">33.4 General policy</a></H2>
<p>
@@ -164,7 +169,7 @@ wrapping over the underlying functions and rely on the R type system
to provide R syntax.
</p>
-<H2><a name="R_language_conventions">37.5 Language conventions</a></H2>
+<H2><a name="R_language_conventions">33.5 Language conventions</a></H2>
<p>
@@ -173,7 +178,7 @@ and [ are overloaded to allow for R syntax (one based indices and
slices)
</p>
-<H2><a name="R_nn6">37.6 C++ classes</a></H2>
+<H2><a name="R_nn6">33.6 C++ classes</a></H2>
<p>
@@ -185,13 +190,64 @@ keep track of the pointer object which removes the necessity for a lot
of the proxy class baggage you see in other languages.
</p>
-<H2><a name="R_nn7">37.7 Enumerations</a></H2>
+<H2><a name="R_nn7">33.7 Enumerations</a></H2>
+
+<p>
+R doesn't have a native enumeration type. Enumerations are represented
+as character strings in R, with calls to R functions that convert back
+and forth between integers.
+</p>
+
+<p>
+The details of enumeration names and contents are stored in hidden R
+environments, which are named according the the enumeration name - for
+example, an enumeration colour:
+</p>
+
+<div class="code"><pre>
+enum colour { red=-1, blue, green = 10 };
+</pre></div>
+
+<p>
+will be initialized by the following call in R:
+</p>
+
+<div class="code"><pre>
+defineEnumeration("_colour",
+ .values=c("red" = .Call('R_swig_colour_red_get',FALSE, PACKAGE='enum_thorough'),
+"blue" = .Call('R_swig_colour_blue_get',FALSE, PACKAGE='enum_thorough'),
+"green" = .Call('R_swig_colour_green_get',FALSE, PACKAGE='enum_thorough')))
+</pre></div>
+
+<p>
+which will create an environment named <tt>.__E___colour</tt>. The enumeration
+values are initialised via calls to C/C++ code, allowing complex
+values for enumerations to be used. Calls to the C/C++ code require
+the compiled library to be loaded, so a <tt>delayedAssign</tt> is employed
+within <tt>defineEnumeration</tt> in order to allow the code to be easily used in R
+packages.
+</p>
+
+<p>
+The user typically does not need to access the enumeration lookup
+functions or know the name of the enumeration type used by
+R. Attributes containing the type information are attached by swig to
+functions requiring enumeration arguments or returning enumeration
+values, and those attributes are used to identify and access the
+appropriate environments and thus translate between characters
+and integers.
+</p>
+
+<p>
+The relevant functions, for debugging purposes, are <tt>enumToInteger</tt> and
+<tt>enumFromInteger</tt>.
+</p>
<p>
-enumerations are characters which are then converted back and forth to
-ints before calling the C routines. All of the enumeration code is
-done in R.
+Anonymous enumerations are ignored by the binding generation process,
+leaving no way of accessing the value of anonymous enumerations from R
+code.
</p>
</body>
diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html
index 89de43010..3cfd1292c 100644
--- a/Doc/Manual/Ruby.html
+++ b/Doc/Manual/Ruby.html
@@ -8,7 +8,7 @@
<body bgcolor="#ffffff">
-<H1><a name="Ruby">38 SWIG and Ruby</a></H1>
+<H1><a name="Ruby">34 SWIG and Ruby</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -149,10 +149,10 @@
<p>This chapter describes SWIG's support of Ruby.</p>
-<H2><a name="Ruby_nn2">38.1 Preliminaries</a></H2>
+<H2><a name="Ruby_nn2">34.1 Preliminaries</a></H2>
-<p> SWIG 3.0 is known to work with Ruby versions 1.8 and later.
+<p> SWIG 4.0 is known to work with Ruby versions 1.9 and later.
Given the choice, you should use the latest stable version of Ruby. You
should also determine if your system supports shared libraries and
dynamic loading. SWIG will work with or without dynamic loading, but
@@ -164,7 +164,7 @@ read the "<a href="SWIG.html#SWIG">SWIG Basics</a>"
chapter. It is also assumed that the reader has a basic understanding
of Ruby. </p>
-<H3><a name="Ruby_nn3">38.1.1 Running SWIG</a></H3>
+<H3><a name="Ruby_nn3">34.1.1 Running SWIG</a></H3>
<p> To build a Ruby module, run SWIG using the <tt>-ruby</tt>
@@ -188,7 +188,7 @@ if compiling a C++ extension) that contains all of the code needed to
build a Ruby extension module. To finish building the module, you need
to compile this file and link it with the rest of your program. </p>
-<H3><a name="Ruby_nn4">38.1.2 Getting the right header files</a></H3>
+<H3><a name="Ruby_nn4">34.1.2 Getting the right header files</a></H3>
<p> In order to compile the wrapper code, the compiler needs the <tt>ruby.h</tt>
@@ -202,7 +202,7 @@ the compiler options needed to compile the code is to ask Ruby itself:</p>
</pre>
</div>
-<H3><a name="Ruby_nn5">38.1.3 Compiling a dynamic module</a></H3>
+<H3><a name="Ruby_nn5">34.1.3 Compiling a dynamic module</a></H3>
<p> Ruby extension modules are typically compiled into shared
@@ -275,7 +275,7 @@ manual pages for your compiler and linker to determine the correct set
of options. You might also check the <a href="https://github.com/swig/swig/wiki">SWIG Wiki</a>
for additional information. </p>
-<H3><a name="Ruby_nn6">38.1.4 Using your module</a></H3>
+<H3><a name="Ruby_nn6">34.1.4 Using your module</a></H3>
<p> Ruby <i>module</i> names must be capitalized,
@@ -305,7 +305,7 @@ begins with: </p>
<p> will result in an extension module using the feature name
"example" and Ruby module name "Example". </p>
-<H3><a name="Ruby_nn7">38.1.5 Static linking</a></H3>
+<H3><a name="Ruby_nn7">34.1.5 Static linking</a></H3>
<p> An alternative approach to dynamic linking is to rebuild the
@@ -320,7 +320,7 @@ finding the Ruby source, adding an entry to the <tt>ext/Setup</tt>
file, adding your directory to the list of extensions in the file, and
finally rebuilding Ruby. </p>
-<H3><a name="Ruby_nn8">38.1.6 Compilation of C++ extensions</a></H3>
+<H3><a name="Ruby_nn8">34.1.6 Compilation of C++ extensions</a></H3>
<p> On most machines, C++ extension modules should be linked
@@ -352,7 +352,7 @@ $libs = append_library($libs, "supc++")
create_makefile('example')</pre>
</div>
-<H2><a name="Ruby_nn9">38.2 Building Ruby Extensions under Windows 95/NT</a></H2>
+<H2><a name="Ruby_nn9">34.2 Building Ruby Extensions under Windows 95/NT</a></H2>
<p> Building a SWIG extension to Ruby under Windows 95/NT is
@@ -377,7 +377,7 @@ order to build extensions, you may need to download the source
distribution to the Ruby package, as you will need the Ruby header
files. </p>
-<H3><a name="Ruby_nn10">38.2.1 Running SWIG from Developer Studio</a></H3>
+<H3><a name="Ruby_nn10">34.2.1 Running SWIG from Developer Studio</a></H3>
<p> If you are developing your application within Microsoft
@@ -441,13 +441,13 @@ Foo = 3.0
</pre>
</div>
-<H2><a name="Ruby_nn11">38.3 The Ruby-to-C/C++ Mapping</a></H2>
+<H2><a name="Ruby_nn11">34.3 The Ruby-to-C/C++ Mapping</a></H2>
<p> This section describes the basics of how SWIG maps C or C++
declarations in your SWIG interface files to Ruby constructs. </p>
-<H3><a name="Ruby_nn12">38.3.1 Modules</a></H3>
+<H3><a name="Ruby_nn12">34.3.1 Modules</a></H3>
<p> The SWIG <tt>%module</tt> directive specifies
@@ -519,7 +519,7 @@ option to wrap everything into the global module, take care that the
names of your constants, classes and methods don't conflict with any of
Ruby's built-in names. </p>
-<H3><a name="Ruby_nn13">38.3.2 Functions</a></H3>
+<H3><a name="Ruby_nn13">34.3.2 Functions</a></H3>
<p> Global functions are wrapped as Ruby module methods. For
@@ -553,7 +553,7 @@ irb(main):002:0&gt; <b>Example.fact(4)</b>
24</pre>
</div>
-<H3><a name="Ruby_nn14">38.3.3 Variable Linking</a></H3>
+<H3><a name="Ruby_nn14">34.3.3 Variable Linking</a></H3>
<p> C/C++ global variables are wrapped as a pair of singleton
@@ -615,7 +615,7 @@ directive. For example: </p>
effect until it is explicitly disabled using <tt>%mutable</tt>.
</p>
-<H3><a name="Ruby_nn15">38.3.4 Constants</a></H3>
+<H3><a name="Ruby_nn15">34.3.4 Constants</a></H3>
<p> C/C++ constants are wrapped as module constants initialized
@@ -643,7 +643,7 @@ irb(main):002:0&gt; <b>Example::PI</b>
3.14159</pre>
</div>
-<H3><a name="Ruby_nn16">38.3.5 Pointers</a></H3>
+<H3><a name="Ruby_nn16">34.3.5 Pointers</a></H3>
<p> "Opaque" pointers to arbitrary C/C++ types (i.e. types that
@@ -667,7 +667,7 @@ returns an instance of an internally generated Ruby class: </p>
<p> A <tt>NULL</tt> pointer is always represented by
the Ruby <tt>nil</tt> object. </p>
-<H3><a name="Ruby_nn17">38.3.6 Structures</a></H3>
+<H3><a name="Ruby_nn17">34.3.6 Structures</a></H3>
<p> C/C++ structs are wrapped as Ruby classes, with accessor
@@ -772,7 +772,7 @@ void Bar_f_set(Bar *b, Foo *val) {
}</pre>
</div>
-<H3><a name="Ruby_nn18">38.3.7 C++ classes</a></H3>
+<H3><a name="Ruby_nn18">34.3.7 C++ classes</a></H3>
<p> Like structs, C++ classes are wrapped by creating a new Ruby
@@ -827,7 +827,7 @@ Ale
3</pre>
</div>
-<H3><a name="Ruby_nn19">38.3.8 C++ Inheritance</a></H3>
+<H3><a name="Ruby_nn19">34.3.8 C++ Inheritance</a></H3>
<p> The SWIG type-checker is fully aware of C++ inheritance.
@@ -980,7 +980,7 @@ inherit from both <tt>Base1</tt> and <tt>Base2</tt>
(i.e. they exhibit <a href="http://c2.com/cgi/wiki?DuckTyping">"Duck
Typing"</a>). </p>
-<H3><a name="Ruby_nn20">38.3.9 C++ Overloaded Functions</a></H3>
+<H3><a name="Ruby_nn20">34.3.9 C++ Overloaded Functions</a></H3>
<p> C++ overloaded functions, methods, and constructors are
@@ -1070,7 +1070,7 @@ arises--in this case, the first declaration takes precedence. </p>
<p>Please refer to the <a href="SWIGPlus.html#SWIGPlus">"SWIG
and C++"</a> chapter for more information about overloading. </p>
-<H3><a name="Ruby_nn21">38.3.10 C++ Operators</a></H3>
+<H3><a name="Ruby_nn21">34.3.10 C++ Operators</a></H3>
<p> For the most part, overloaded operators are handled
@@ -1112,7 +1112,7 @@ c = Example.add_complex(a, b)</pre>
is discussed in the <a href="#Ruby_operator_overloading">section
on operator overloading</a>. </p>
-<H3><a name="Ruby_nn22">38.3.11 C++ namespaces</a></H3>
+<H3><a name="Ruby_nn22">34.3.11 C++ namespaces</a></H3>
<p> SWIG is aware of C++ namespaces, but namespace names do not
@@ -1169,7 +1169,7 @@ and create extension modules for each namespace separately. If your
program utilizes thousands of small deeply nested namespaces each with
identical symbol names, well, then you get what you deserve. </p>
-<H3><a name="Ruby_nn23">38.3.12 C++ templates</a></H3>
+<H3><a name="Ruby_nn23">34.3.12 C++ templates</a></H3>
<p> C++ templates don't present a huge problem for SWIG. However,
@@ -1211,7 +1211,7 @@ irb(main):004:0&gt; <b>p.second</b>
4</pre>
</div>
-<H3><a name="Ruby_nn23_1">38.3.13 C++ Standard Template Library (STL)</a></H3>
+<H3><a name="Ruby_nn23_1">34.3.13 C++ Standard Template Library (STL)</a></H3>
<p> On a related note, the standard SWIG library contains a
@@ -1304,7 +1304,7 @@ puts v
shown in these examples. More details can be found in the <a href="SWIGPlus.html#SWIGPlus">SWIG and C++</a>
chapter.</p>
-<H3><a name="Ruby_C_STL_Functors">38.3.14 C++ STL Functors</a></H3>
+<H3><a name="Ruby_C_STL_Functors">34.3.14 C++ STL Functors</a></H3>
<p>Some containers in the STL allow you to modify their default
@@ -1365,7 +1365,7 @@ b
</pre>
</div>
-<H3><a name="Ruby_C_Iterators">38.3.15 C++ STL Iterators</a></H3>
+<H3><a name="Ruby_C_Iterators">34.3.15 C++ STL Iterators</a></H3>
<p>The STL is well known for the use of iterators. There
@@ -1448,10 +1448,10 @@ i
<p>If you'd rather have STL classes without any iterators, you should define <tt>-DSWIG_NO_EXPORT_ITERATOR_METHODS</tt> when running swig.</p>
-<H3><a name="Ruby_nn24">38.3.16 C++ Smart Pointers</a></H3>
+<H3><a name="Ruby_nn24">34.3.16 C++ Smart Pointers</a></H3>
-<H4><a name="Ruby_smart_pointers_shared_ptr">38.3.16.1 The shared_ptr Smart Pointer</a></H4>
+<H4><a name="Ruby_smart_pointers_shared_ptr">34.3.16.1 The shared_ptr Smart Pointer</a></H4>
<p>
@@ -1462,7 +1462,7 @@ in the <a href="Library.html#Library_std_shared_ptr">shared_ptr smart pointer</a
</p>
-<H4><a name="Ruby_smart_pointers_generic">38.3.16.2 Generic Smart Pointers</a></H4>
+<H4><a name="Ruby_smart_pointers_generic">34.3.16.2 Generic Smart Pointers</a></H4>
<p> In certain C++ programs, it is common to use classes that
@@ -1527,7 +1527,7 @@ method. For example: </p>
<pre>irb(main):004:0&gt; <b>f = p.__deref__()</b> # Returns underlying Foo *</pre>
</div>
-<H3><a name="Ruby_nn25">38.3.17 Cross-Language Polymorphism</a></H3>
+<H3><a name="Ruby_nn25">34.3.17 Cross-Language Polymorphism</a></H3>
<p> SWIG's Ruby module supports cross-language polymorphism
@@ -1536,7 +1536,7 @@ module. Rather than duplicate the information presented in the <a href="Python.h
section just notes the differences that you need to be aware of when
using this feature with Ruby. </p>
-<H4><a name="Ruby_nn26">38.3.17.1 Exception Unrolling</a></H4>
+<H4><a name="Ruby_nn26">34.3.17.1 Exception Unrolling</a></H4>
<p> Whenever a C++ director class routes one of its virtual
@@ -1559,7 +1559,7 @@ method is "wrapped" using the <tt>rb_rescue2()</tt>
function from Ruby's C API. If any Ruby exception is raised, it will be
caught here and a C++ exception is raised in its place. </p>
-<H2><a name="Ruby_nn27">38.4 Naming</a></H2>
+<H2><a name="Ruby_nn27">34.4 Naming</a></H2>
<p>Ruby has several common naming conventions. Constants are
@@ -1597,7 +1597,7 @@ generated
by SWIG, it is turned off by default in SWIG 1.3.28. However, it is
planned to become the default option in future releases.</p>
-<H3><a name="Ruby_nn28">38.4.1 Defining Aliases</a></H3>
+<H3><a name="Ruby_nn28">34.4.1 Defining Aliases</a></H3>
<p> It's a fairly common practice in the Ruby built-ins and
@@ -1667,7 +1667,7 @@ matching rules used for other kinds of features apply (see the chapter
on <a href="Customization.html#Customization">"Customization
Features"</a>) for more details).</p>
-<H3><a name="Ruby_nn29">38.4.2 Predicate Methods</a></H3>
+<H3><a name="Ruby_nn29">34.4.2 Predicate Methods</a></H3>
<p> Ruby methods that return a boolean value and end in a
@@ -1716,7 +1716,7 @@ using SWIG's "features" mechanism and so the same name matching rules
used for other kinds of features apply (see the chapter on <a href="Customization.html#Customization">"Customization
Features"</a>) for more details). </p>
-<H3><a name="Ruby_nn30">38.4.3 Bang Methods</a></H3>
+<H3><a name="Ruby_nn30">34.4.3 Bang Methods</a></H3>
<p> Ruby methods that modify an object in-place and end in an
@@ -1748,7 +1748,7 @@ using SWIG's "features" mechanism and so the same name matching rules
used for other kinds of features apply (see the chapter on <a href="Customization.html#Customization">"Customization
Features"</a>) for more details). </p>
-<H3><a name="Ruby_nn31">38.4.4 Getters and Setters</a></H3>
+<H3><a name="Ruby_nn31">34.4.4 Getters and Setters</a></H3>
<p> Often times a C++ library will expose properties through
@@ -1783,7 +1783,7 @@ irb(main):003:0&gt; <b>puts foo.value</b></pre>
%rename("value=") Foo::setValue(int value);</pre>
</div>
-<H2><a name="Ruby_nn32">38.5 Input and output parameters</a></H2>
+<H2><a name="Ruby_nn32">34.5 Input and output parameters</a></H2>
<p> A common problem in some C programs is handling parameters
@@ -1922,10 +1922,10 @@ void get_dimensions(Matrix *m, int *rows, int*columns);</pre>
<pre>r, c = Example.get_dimensions(m)</pre>
</div>
-<H2><a name="Ruby_nn33">38.6 Exception handling </a></H2>
+<H2><a name="Ruby_nn33">34.6 Exception handling </a></H2>
-<H3><a name="Ruby_nn34">38.6.1 Using the %exception directive </a></H3>
+<H3><a name="Ruby_nn34">34.6.1 Using the %exception directive </a></H3>
<p>The SWIG <tt>%exception</tt> directive can be
@@ -2034,7 +2034,7 @@ methods and functions named <tt>getitem</tt> and <tt>setitem</tt>.
limited to C++ exception handling. See the chapter on <a href="Customization.html#Customization">Customization
Features</a> for more examples.</p>
-<H3><a name="Ruby_nn34_2">38.6.2 Handling Ruby Blocks </a></H3>
+<H3><a name="Ruby_nn34_2">34.6.2 Handling Ruby Blocks </a></H3>
<p>One of the highlights of Ruby and most of its standard library
@@ -2101,7 +2101,7 @@ a special in typemap, like:</p>
<p>For more information on typemaps, see <a href="#Ruby_nn37">Typemaps</a>.</p>
-<H3><a name="Ruby_nn35">38.6.3 Raising exceptions </a></H3>
+<H3><a name="Ruby_nn35">34.6.3 Raising exceptions </a></H3>
<p>There are three ways to raise exceptions from C++ code to
@@ -2258,7 +2258,7 @@ function. The first argument passed to <tt>rb_raise()</tt>
is the exception type. You can raise a custom exception type or one of
the built-in Ruby exception types.</p>
-<H3><a name="Ruby_nn36">38.6.4 Exception classes </a></H3>
+<H3><a name="Ruby_nn36">34.6.4 Exception classes </a></H3>
<p>Starting with SWIG 1.3.28, the Ruby module supports the <tt>%exceptionclass</tt>
@@ -2295,7 +2295,7 @@ end </pre>
<p>For another example look at swig/Examples/ruby/exception_class.
</p>
-<H2><a name="Ruby_nn37">38.7 Typemaps</a></H2>
+<H2><a name="Ruby_nn37">34.7 Typemaps</a></H2>
<p> This section describes how you can modify SWIG's default
@@ -2310,7 +2310,7 @@ a required part of using SWIG---the default wrapping behavior is enough
in most cases. Typemaps are only used if you want to change some aspect
of the primitive C-Ruby interface.</p>
-<H3><a name="Ruby_nn38">38.7.1 What is a typemap?</a></H3>
+<H3><a name="Ruby_nn38">34.7.1 What is a typemap?</a></H3>
<p> A typemap is nothing more than a code generation rule that is
@@ -2467,7 +2467,7 @@ to be used as follows (notice how the length parameter is omitted): </p>
2</pre>
</div>
-<H3><a name="Ruby_Typemap_scope">38.7.2 Typemap scope</a></H3>
+<H3><a name="Ruby_Typemap_scope">34.7.2 Typemap scope</a></H3>
<p> Once defined, a typemap remains in effect for all of the
@@ -2513,7 +2513,7 @@ where the class itself is defined. For example:</p>
};</pre>
</div>
-<H3><a name="Ruby_Copying_a_typemap">38.7.3 Copying a typemap</a></H3>
+<H3><a name="Ruby_Copying_a_typemap">34.7.3 Copying a typemap</a></H3>
<p> A typemap is copied by using assignment. For example:</p>
@@ -2555,7 +2555,7 @@ rules as for <tt>
%apply (char *buf, int len) { (char *buffer, int size) }; // Multiple arguments</pre>
</div>
-<H3><a name="Ruby_Deleting_a_typemap">38.7.4 Deleting a typemap</a></H3>
+<H3><a name="Ruby_Deleting_a_typemap">34.7.4 Deleting a typemap</a></H3>
<p> A typemap can be deleted by simply defining no code. For
@@ -2580,7 +2580,7 @@ defined by typemaps, clearing a fundamental type like <tt>int</tt>
will make that type unusable unless you also define a new set of
typemaps immediately after the clear operation.</p>
-<H3><a name="Ruby_Placement_of_typemaps">38.7.5 Placement of typemaps</a></H3>
+<H3><a name="Ruby_Placement_of_typemaps">34.7.5 Placement of typemaps</a></H3>
<p> Typemap declarations can be declared in the global scope,
@@ -2651,13 +2651,13 @@ In this example, this is done using the class declaration <tt>class
string</tt>
.</p>
-<H3><a name="Ruby_nn39">38.7.6 Ruby typemaps</a></H3>
+<H3><a name="Ruby_nn39">34.7.6 Ruby typemaps</a></H3>
<p>The following list details all of the typemap methods that
can be used by the Ruby module: </p>
-<H4><a name="Ruby_in_typemap">38.7.6.1 "in" typemap</a></H4>
+<H4><a name="Ruby_in_typemap">34.7.6.1 "in" typemap</a></H4>
<p>Converts Ruby objects to input
@@ -2724,7 +2724,7 @@ arguments to be specified. For example:</p>
<p> At this time, only zero or one arguments may be converted.</p>
-<H4><a name="Ruby_typecheck_typemap">38.7.6.2 "typecheck" typemap</a></H4>
+<H4><a name="Ruby_typecheck_typemap">34.7.6.2 "typecheck" typemap</a></H4>
<p> The "typecheck" typemap is used to support overloaded
@@ -2746,7 +2746,7 @@ program uses overloaded methods, you should also define a collection of
"typecheck" typemaps. More details about this follow in a later section
on "Typemaps and Overloading."</p>
-<H4><a name="Ruby_out_typemap">38.7.6.3 "out" typemap</a></H4>
+<H4><a name="Ruby_out_typemap">34.7.6.3 "out" typemap</a></H4>
<p>Converts return value of a C function
@@ -2797,7 +2797,7 @@ version of the C datatype matched by the typemap.</td>
</table>
</div>
-<H4><a name="Ruby_arginit_typemap">38.7.6.4 "arginit" typemap</a></H4>
+<H4><a name="Ruby_arginit_typemap">34.7.6.4 "arginit" typemap</a></H4>
<p> The "arginit" typemap is used to set the initial value of a
@@ -2812,7 +2812,7 @@ applications. For example:</p>
}</pre>
</div>
-<H4><a name="Ruby_default_typemap">38.7.6.5 "default" typemap</a></H4>
+<H4><a name="Ruby_default_typemap">34.7.6.5 "default" typemap</a></H4>
<p> The "default" typemap is used to turn an argument into a
@@ -2837,7 +2837,7 @@ arguments that follow must have default values. See the <a href="SWIG.html#SWIG_
Default/optional arguments</a> section for further information on
default argument wrapping.</p>
-<H4><a name="Ruby_check_typemap">38.7.6.6 "check" typemap</a></H4>
+<H4><a name="Ruby_check_typemap">34.7.6.6 "check" typemap</a></H4>
<p> The "check" typemap is used to supply value checking code
@@ -2852,7 +2852,7 @@ arguments have been converted. For example:</p>
}</pre>
</div>
-<H4><a name="Ruby_argout_typemap_">38.7.6.7 "argout" typemap</a></H4>
+<H4><a name="Ruby_argout_typemap_">34.7.6.7 "argout" typemap</a></H4>
<p> The "argout" typemap is used to return values from arguments.
@@ -2906,7 +2906,7 @@ some function like SWIG_Ruby_AppendOutput.</p>
<p> See the <tt>typemaps.i</tt> library for examples.</p>
-<H4><a name="Ruby_freearg_typemap_">38.7.6.8 "freearg" typemap</a></H4>
+<H4><a name="Ruby_freearg_typemap_">34.7.6.8 "freearg" typemap</a></H4>
<p> The "freearg" typemap is used to cleanup argument data. It is
@@ -2933,7 +2933,7 @@ This code is also placed into a special variable <tt>$cleanup</tt>
that may be used in other typemaps whenever a wrapper function needs to
abort prematurely.</p>
-<H4><a name="Ruby_newfree_typemap">38.7.6.9 "newfree" typemap</a></H4>
+<H4><a name="Ruby_newfree_typemap">34.7.6.9 "newfree" typemap</a></H4>
<p> The "newfree" typemap is used in conjunction with the <tt>%newobject</tt>
@@ -2957,7 +2957,7 @@ string *foo();</pre>
<p> See <a href="Customization.html#Customization_ownership">Object
ownership and %newobject</a> for further details.</p>
-<H4><a name="Ruby_memberin_typemap">38.7.6.10 "memberin" typemap</a></H4>
+<H4><a name="Ruby_memberin_typemap">34.7.6.10 "memberin" typemap</a></H4>
<p> The "memberin" typemap is used to copy data from<em> an
@@ -2975,21 +2975,21 @@ example:</p>
already provides a default implementation for arrays, strings, and
other objects.</p>
-<H4><a name="Ruby_varin_typemap">38.7.6.11 "varin" typemap</a></H4>
+<H4><a name="Ruby_varin_typemap">34.7.6.11 "varin" typemap</a></H4>
<p> The "varin" typemap is used to convert objects in the target
language to C for the purposes of assigning to a C/C++ global variable.
This is implementation specific.</p>
-<H4><a name="Ruby_varout_typemap_">38.7.6.12 "varout" typemap</a></H4>
+<H4><a name="Ruby_varout_typemap_">34.7.6.12 "varout" typemap</a></H4>
<p> The "varout" typemap is used to convert a C/C++ object to an
object in the target language when reading a C/C++ global variable.
This is implementation specific.</p>
-<H4><a name="Ruby_throws_typemap">38.7.6.13 "throws" typemap</a></H4>
+<H4><a name="Ruby_throws_typemap">34.7.6.13 "throws" typemap</a></H4>
<p> The "throws" typemap is only used when SWIG parses a C++
@@ -3030,7 +3030,7 @@ specification yet they do throw exceptions, SWIG cannot know how to
deal with them. For a neat way to handle these, see the <a href="Customization.html#Customization_exception">Exception
handling with %exception</a> section.</p>
-<H4><a name="Ruby_directorin_typemap">38.7.6.14 directorin typemap</a></H4>
+<H4><a name="Ruby_directorin_typemap">34.7.6.14 directorin typemap</a></H4>
<p>Converts C++ objects in director
@@ -3089,7 +3089,7 @@ referring to the class itself.</td>
</table>
</div>
-<H4><a name="Ruby_directorout_typemap">38.7.6.15 directorout typemap</a></H4>
+<H4><a name="Ruby_directorout_typemap">34.7.6.15 directorout typemap</a></H4>
<p>Converts Ruby objects in director
@@ -3162,7 +3162,7 @@ exception.
</p>
-<H4><a name="Ruby_directorargout_typemap">38.7.6.16 directorargout typemap</a></H4>
+<H4><a name="Ruby_directorargout_typemap">34.7.6.16 directorargout typemap</a></H4>
<p>Output argument processing in director
@@ -3220,19 +3220,19 @@ referring to the instance of the class itself</td>
</table>
</div>
-<H4><a name="Ruby_ret_typemap">38.7.6.17 ret typemap</a></H4>
+<H4><a name="Ruby_ret_typemap">34.7.6.17 ret typemap</a></H4>
<p>Cleanup of function return values
</p>
-<H4><a name="Ruby_globalin_typemap">38.7.6.18 globalin typemap</a></H4>
+<H4><a name="Ruby_globalin_typemap">34.7.6.18 globalin typemap</a></H4>
<p>Setting of C global variables
</p>
-<H3><a name="Ruby_nn40">38.7.7 Typemap variables</a></H3>
+<H3><a name="Ruby_nn40">34.7.7 Typemap variables</a></H3>
<p>
@@ -3282,7 +3282,7 @@ so that their values can be properly assigned. </div>
<div class="indent">The Ruby name of the wrapper function
being created. </div>
-<H3><a name="Ruby_nn41">38.7.8 Useful Functions</a></H3>
+<H3><a name="Ruby_nn41">34.7.8 Useful Functions</a></H3>
<p> When you write a typemap, you usually have to work directly
@@ -3297,7 +3297,7 @@ stick to the swig functions instead of the native Ruby functions.
That should help you avoid having to rewrite a lot of typemaps
across multiple languages.</p>
-<H4><a name="Ruby_nn42">38.7.8.1 C Datatypes to Ruby Objects</a></H4>
+<H4><a name="Ruby_nn42">34.7.8.1 C Datatypes to Ruby Objects</a></H4>
<div class="diagram">
@@ -3339,11 +3339,11 @@ SWIG_From_float(float)</td>
</table>
</div>
-<H4><a name="Ruby_nn43">38.7.8.2 Ruby Objects to C Datatypes</a></H4>
+<H4><a name="Ruby_nn43">34.7.8.2 Ruby Objects to C Datatypes</a></H4>
<p>Here, while the Ruby versions return the value directly, the SWIG
-versions do not, but return a status value to indicate success (<tt>SWIG_OK</tt>). While more akward to use, this allows you to write typemaps that report more helpful error messages, like:</p>
+versions do not, but return a status value to indicate success (<tt>SWIG_OK</tt>). While more awkward to use, this allows you to write typemaps that report more helpful error messages, like:</p>
<div class="code">
<pre>
@@ -3407,7 +3407,7 @@ versions do not, but return a status value to indicate success (<tt>SWIG_OK</tt>
</table>
</div>
-<H4><a name="Ruby_nn44">38.7.8.3 Macros for VALUE</a></H4>
+<H4><a name="Ruby_nn44">34.7.8.3 Macros for VALUE</a></H4>
<p> <tt>RSTRING_LEN(str)</tt> </p>
@@ -3430,7 +3430,7 @@ versions do not, but return a status value to indicate success (<tt>SWIG_OK</tt>
<div class="indent">pointer to array storage</div>
-<H4><a name="Ruby_nn45">38.7.8.4 Exceptions</a></H4>
+<H4><a name="Ruby_nn45">34.7.8.4 Exceptions</a></H4>
<p> <tt>void rb_raise(VALUE exception, const char *fmt,
@@ -3509,7 +3509,7 @@ message to standard error if Ruby was invoked with the <tt>-w</tt>
flag. The given format string <i>fmt</i> and remaining
arguments are interpreted as with <tt>printf()</tt>. </div>
-<H4><a name="Ruby_nn46">38.7.8.5 Iterators</a></H4>
+<H4><a name="Ruby_nn46">34.7.8.5 Iterators</a></H4>
<p> <tt>void rb_iter_break()</tt> </p>
@@ -3555,14 +3555,14 @@ VALUE), VALUE value)</tt></p>
<div class="indent"> Equivalent to Ruby's <tt>throw</tt>.
</div>
-<H3><a name="Ruby_nn47">38.7.9 Typemap Examples</a></H3>
+<H3><a name="Ruby_nn47">34.7.9 Typemap Examples</a></H3>
<p> This section includes a few examples of typemaps. For more
examples, you might look at the examples in the <tt>Example/ruby</tt>
directory. </p>
-<H3><a name="Ruby_nn48">38.7.10 Converting a Ruby array to a char **</a></H3>
+<H3><a name="Ruby_nn48">34.7.10 Converting a Ruby array to a char **</a></H3>
<p> A common problem in many C programs is the processing of
@@ -3627,7 +3627,7 @@ array. Since dynamic memory allocation is used to allocate memory for
the array, the "freearg" typemap is used to later release this memory
after the execution of the C function. </p>
-<H3><a name="Ruby_nn49">38.7.11 Collecting arguments in a hash</a></H3>
+<H3><a name="Ruby_nn49">34.7.11 Collecting arguments in a hash</a></H3>
<p> Ruby's solution to the "keyword arguments" capability of some
@@ -3704,7 +3704,7 @@ value: </p>
<pre>%typemap(in) (int nattributes, const char **names, const int *values)
(VALUE keys_arr, int i, VALUE key, VALUE val) {
Check_Type($input, T_HASH);
- <b>$1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));</b>
+ <b>$1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));</b>
}</pre>
</div>
@@ -3717,7 +3717,7 @@ the keys and values from the hash: </p>
<pre>%typemap(in) (int nattributes, const char **names, const int *values)
(VALUE keys_arr, int i, VALUE key, VALUE val) {
Check_Type($input, T_HASH);
- $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+ $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
<b>$2 = NULL;
$3 = NULL;
if ($1 &gt; 0) {
@@ -3736,13 +3736,13 @@ of the keys) and then start looping over the elements in that array: </p>
<pre>%typemap(in) (int nattributes, const char **names, const int *values)
(VALUE keys_arr, int i, VALUE key, VALUE val) {
Check_Type($input, T_HASH);
- $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+ $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
$2 = NULL;
$3 = NULL;
if ($1 &gt; 0) {
$2 = (char **) malloc($1*sizeof(char *));
$3 = (int *) malloc($1*sizeof(int));
- <b>keys_arr = rb_funcall($input, rb_intern("keys"), 0, NULL);
+ <b>keys_arr = rb_funcall($input, rb_intern("keys"), 0, Qnil);
for (i = 0; i &lt; $1; i++) {
}</b>
}
@@ -3758,13 +3758,13 @@ corresponding to that key in the hash: </p>
<pre>%typemap(in) (int nattributes, const char **names, const int *values)
(VALUE keys_arr, int i, VALUE key, VALUE val) {
Check_Type($input, T_HASH);
- $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+ $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
$2 = NULL;
$3 = NULL;
if ($1 &gt; 0) {
$2 = (char **) malloc($1*sizeof(char *));
$3 = (int *) malloc($1*sizeof(int));
- keys_arr = rb_funcall($input, rb_intern("keys"), 0, NULL);
+ keys_arr = rb_funcall($input, rb_intern("keys"), 0, Qnil);
for (i = 0; i &lt; $1; i++) {
<b>key = rb_ary_entry(keys_arr, i);
val = rb_hash_aref($input, key);</b>
@@ -3781,13 +3781,13 @@ value is a <tt>Fixnum</tt>: </p>
<pre>%typemap(in) (int nattributes, const char **names, const int *values)
(VALUE keys_arr, int i, VALUE key, VALUE val) {
Check_Type($input, T_HASH);
- $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+ $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
$2 = NULL;
$3 = NULL;
if ($1 &gt; 0) {
$2 = (char **) malloc($1*sizeof(char *));
$3 = (int *) malloc($1*sizeof(int));
- keys_arr = rb_funcall($input, rb_intern("keys"), 0, NULL);
+ keys_arr = rb_funcall($input, rb_intern("keys"), 0, Qnil);
for (i = 0; i &lt; $1; i++) {
key = rb_ary_entry(keys_arr, i);
val = rb_hash_aref($input, key);
@@ -3805,13 +3805,13 @@ equivalents and store them in our local C arrays: </p>
<pre>%typemap(in) (int nattributes, const char **names, const int *values)
(VALUE keys_arr, int i, VALUE key, VALUE val) {
Check_Type($input, T_HASH);
- $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+ $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
$2 = NULL;
$3 = NULL;
if ($1 &gt; 0) {
$2 = (char **) malloc($1*sizeof(char *));
$3 = (int *) malloc($1*sizeof(int));
- keys_arr = rb_funcall($input, rb_intern("keys"), 0, NULL);
+ keys_arr = rb_funcall($input, rb_intern("keys"), 0, Qnil);
for (i = 0; i &lt; $1; i++) {
key = rb_ary_entry(keys_arr, i);
val = rb_hash_aref($input, key);
@@ -3841,7 +3841,7 @@ memory leak. Fortunately, this typemap is a lot easier to write: </p>
program that uses the extension, can be found in the <tt>Examples/ruby/hashargs</tt>
directory of the SWIG distribution. </p>
-<H3><a name="Ruby_nn50">38.7.12 Pointer handling</a></H3>
+<H3><a name="Ruby_nn50">34.7.12 Pointer handling</a></H3>
<p> Occasionally, it might be necessary to convert pointer values
@@ -3900,7 +3900,7 @@ For example: </p>
}</pre>
</div>
-<H4><a name="Ruby_nn51">38.7.12.1 Ruby Datatype Wrapping</a></H4>
+<H4><a name="Ruby_nn51">34.7.12.1 Ruby Datatype Wrapping</a></H4>
<p> <tt>VALUE Data_Wrap_Struct(VALUE class, void
@@ -3927,7 +3927,7 @@ as above. </div>
type <i>c-type</i> from the data object <i>obj</i>
and assigns that pointer to <i>ptr</i>. </div>
-<H3><a name="Ruby_nn52">38.7.13 Example: STL Vector to Ruby Array</a></H3>
+<H3><a name="Ruby_nn52">34.7.13 Example: STL Vector to Ruby Array</a></H3>
<p>Another use for macros and type maps is to create a Ruby array
@@ -4019,7 +4019,7 @@ STL with ruby, you are advised to use the standard swig STL library,
which does much more than this. Refer to the section called
the<a href="#Ruby_nn23_1"> C++ Standard Template Library</a>.
-<H2><a name="Ruby_nn65">38.8 Docstring Features</a></H2>
+<H2><a name="Ruby_nn65">34.8 Docstring Features</a></H2>
<p>
@@ -4053,7 +4053,7 @@ generate ri documentation from a c wrap file, you could do:</p>
$ rdoc -r file_wrap.c
</pre></div>
-<H3><a name="Ruby_nn66">38.8.1 Module docstring</a></H3>
+<H3><a name="Ruby_nn66">34.8.1 Module docstring</a></H3>
<p>
@@ -4083,7 +4083,7 @@ layout of controls on a panel, etc. to be loaded from an XML file."
%module(docstring=DOCSTRING) xrc</pre>
</div>
-<H3><a name="Ruby_nn67">38.8.2 %feature("autodoc")</a></H3>
+<H3><a name="Ruby_nn67">34.8.2 %feature("autodoc")</a></H3>
<p>Since SWIG does know everything about the function it wraps,
@@ -4104,7 +4104,7 @@ several options for autodoc controlled by the value given to the
feature, described below.
</p>
-<H4><a name="Ruby_nn68">38.8.2.1 %feature("autodoc", "0")</a></H4>
+<H4><a name="Ruby_nn68">34.8.2.1 %feature("autodoc", "0")</a></H4>
<p>
@@ -4128,7 +4128,7 @@ Then Ruby code like this will be generated:
...</pre>
</div>
-<H4><a name="Ruby_autodoc1">38.8.2.2 %feature("autodoc", "1")</a></H4>
+<H4><a name="Ruby_autodoc1">34.8.2.2 %feature("autodoc", "1")</a></H4>
<p>
@@ -4148,7 +4148,7 @@ this:
...</pre>
</div>
-<H4><a name="Ruby_autodoc2">38.8.2.3 %feature("autodoc", "2")</a></H4>
+<H4><a name="Ruby_autodoc2">34.8.2.3 %feature("autodoc", "2")</a></H4>
<p>
@@ -4160,7 +4160,7 @@ parameter types with the "2" option will result in Ruby code like
this:
</p>
-<H4><a name="Ruby_feature_autodoc3">38.8.2.4 %feature("autodoc", "3")</a></H4>
+<H4><a name="Ruby_feature_autodoc3">34.8.2.4 %feature("autodoc", "3")</a></H4>
<p>
@@ -4181,7 +4181,7 @@ Parameters:
bar - Bar</pre>
</div>
-<H4><a name="Ruby_nn70">38.8.2.5 %feature("autodoc", "docstring")</a></H4>
+<H4><a name="Ruby_nn70">34.8.2.5 %feature("autodoc", "docstring")</a></H4>
<p>
@@ -4197,7 +4197,7 @@ generated string. For example:
void GetPosition(int* OUTPUT, int* OUTPUT);</pre>
</div>
-<H3><a name="Ruby_nn71">38.8.3 %feature("docstring")</a></H3>
+<H3><a name="Ruby_nn71">34.8.3 %feature("docstring")</a></H3>
<p>
@@ -4208,10 +4208,10 @@ docstring associated with classes, function or methods are output.
If an item already has an autodoc string then it is combined with the
docstring and they are output together. </p>
-<H2><a name="Ruby_nn53">38.9 Advanced Topics</a></H2>
+<H2><a name="Ruby_nn53">34.9 Advanced Topics</a></H2>
-<H3><a name="Ruby_operator_overloading">38.9.1 Operator overloading</a></H3>
+<H3><a name="Ruby_operator_overloading">34.9.1 Operator overloading</a></H3>
<p> SWIG allows operator overloading with, by using the <tt>%extend</tt>
@@ -4392,7 +4392,7 @@ separate method for handling <i>inequality</i> since Ruby
parses the expression <i>a != b</i> as <i>!(a == b)</i>.
</p>
-<H3><a name="Ruby_nn55">38.9.2 Creating Multi-Module Packages</a></H3>
+<H3><a name="Ruby_nn55">34.9.2 Creating Multi-Module Packages</a></H3>
<p> The chapter on <a href="Modules.html#Modules">Working
@@ -4518,7 +4518,7 @@ irb(main):005:0&gt; <b>c.getX()</b>
5.0</pre>
</div>
-<H3><a name="Ruby_nn56">38.9.3 Specifying Mixin Modules</a></H3>
+<H3><a name="Ruby_nn56">34.9.3 Specifying Mixin Modules</a></H3>
<p> The Ruby language doesn't support multiple inheritance, but
@@ -4585,7 +4585,7 @@ matching rules used for other kinds of features apply (see the chapter
on <a href="Customization.html#Customization">"Customization
Features"</a>) for more details). </p>
-<H2><a name="Ruby_nn57">38.10 Memory Management</a></H2>
+<H2><a name="Ruby_nn57">34.10 Memory Management</a></H2>
<p>One of the most common issues in generating SWIG bindings for
@@ -4608,7 +4608,7 @@ to C++ (or vice versa) depending on what function or methods are
invoked. Clearly, developing a SWIG wrapper requires a thorough
understanding of how the underlying library manages memory.</p>
-<H3><a name="Ruby_nn58">38.10.1 Mark and Sweep Garbage Collector </a></H3>
+<H3><a name="Ruby_nn58">34.10.1 Mark and Sweep Garbage Collector </a></H3>
<p>Ruby uses a mark and sweep garbage collector. When the garbage
@@ -4639,7 +4639,7 @@ any memory has been allocated in creating the underlying C struct or
C++ struct, then a "free" function must be defined that deallocates
this memory. </p>
-<H3><a name="Ruby_nn59">38.10.2 Object Ownership</a></H3>
+<H3><a name="Ruby_nn59">34.10.2 Object Ownership</a></H3>
<p>As described above, memory management depends on clearly
@@ -4784,7 +4784,7 @@ public:
<p> This code can be seen in swig/examples/ruby/tracking.</p>
-<H3><a name="Ruby_nn60">38.10.3 Object Tracking</a></H3>
+<H3><a name="Ruby_nn60">34.10.3 Object Tracking</a></H3>
<p>The remaining parts of this section will use the class library
@@ -5010,7 +5010,7 @@ However, if you implement your own free functions (see below) you may
also have to call the <tt>SWIG_RubyRemoveTracking</tt> and <tt>RubyUnlinkObjects</tt>
methods.</p>
-<H3><a name="Ruby_nn61">38.10.4 Mark Functions</a></H3>
+<H3><a name="Ruby_nn61">34.10.4 Mark Functions</a></H3>
<p>With a bit more testing, we see that our class library still
@@ -5139,7 +5139,7 @@ irb(main):016:0&gt;</pre>
<p>This code can be seen in swig/examples/ruby/mark_function.</p>
-<H3><a name="Ruby_nn62">38.10.5 Free Functions</a></H3>
+<H3><a name="Ruby_nn62">34.10.5 Free Functions</a></H3>
<p>By default, SWIG creates a "free" function that is called when
@@ -5307,7 +5307,7 @@ been freed, and thus raises a runtime exception.</p>
<p>This code can be seen in swig/examples/ruby/free_function.</p>
-<H3><a name="Ruby_nn63">38.10.6 Embedded Ruby and the C++ Stack</a></H3>
+<H3><a name="Ruby_nn63">34.10.6 Embedded Ruby and the C++ Stack</a></H3>
<p>As has been said, the Ruby GC runs and marks objects before
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index e5b441fbb..aec48ef03 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -88,7 +88,7 @@
<p>
This chapter describes the basic operation of SWIG, the structure of its
-input files, and how it handles standard ANSI C declarations. C++ support is
+input files, and how it handles standard ISO C declarations. C++ support is
described in the next chapter. However, C++ programmers should still read this
chapter to understand the basics.
Specific details about each target language are described in later
@@ -103,71 +103,156 @@ To run SWIG, use the <tt>swig</tt> command with options and a filename like this
</p>
<div class="shell"><pre>
-swig [ <em>options</em> ] filename
+swig [ options ] filename
</pre></div>
<p>
where <tt>filename</tt> is a SWIG interface file or a C/C++ header file.
-Below is a subset of <em>options</em> that can be used.
+Full help can be seen by running <tt>swig -help</tt>.
+Below is the common set of options that can be used.
Additional options are also defined for each target language. A full list
-can be obtained by typing <tt>swig -help</tt> or <tt>swig
-<em>-&lt;lang&gt;</em> -help</tt> for language <em>&lt;lang&gt;</em> specific options.
+can be obtained by running <tt>swig
+<em>-&lt;lang&gt;</em> -help</tt> for language <em>&lt;lang&gt;</em> specific options,
+for example, <tt>swig -ruby -help</tt> for Ruby.
</p>
<div class="shell"><pre>
--allegrocl Generate ALLEGROCL wrappers
--chicken Generate CHICKEN wrappers
--clisp Generate CLISP wrappers
--cffi Generate CFFI wrappers
--csharp Generate C# wrappers
--d Generate D wrappers
--go Generate Go wrappers
--guile Generate Guile wrappers
--java Generate Java wrappers
--javascript Generate Javascript wrappers
--lua Generate Lua wrappers
--modula3 Generate Modula 3 wrappers
--mzscheme Generate Mzscheme wrappers
--ocaml Generate Ocaml wrappers
--octave Generate Octave wrappers
--perl Generate Perl wrappers
--php5 Generate PHP5 wrappers
--php7 Generate PHP7 wrappers
--pike Generate Pike wrappers
--python Generate Python wrappers
--r Generate R (aka GNU S) wrappers
--ruby Generate Ruby wrappers
--scilab Generate Scilab wrappers
--sexp Generate Lisp S-Expressions wrappers
--tcl Generate Tcl wrappers
--uffi Generate Common Lisp / UFFI wrappers
--xml Generate XML wrappers
-
--c++ Enable C++ processing
--cppext <em>ext</em> Change file extension of C++ generated files to <em>ext</em>
- (default is cxx, except for PHP5 which uses cpp)
--D<em>symbol</em> Define a preprocessor symbol
--Fmicrosoft Display error/warning messages in Microsoft format
--Fstandard Display error/warning messages in commonly used format
--help Display all options
--I<em>dir</em> Add a directory to the file include path
--l<em>ifile</em> Include SWIG library file &lt;ifile&gt;
--module <em>name</em> Set the name of the SWIG module
--o <em>outfile</em> Set name of C/C++ output file to &lt;outfile&gt;
--oh <em>headfile</em> Set name of C++ output header file for directors to &lt;headfile&gt;
--outcurrentdir Set default output dir to current dir instead of input file's path
--outdir <em>dir</em> Set language specific files output directory
--pcreversion Display PCRE version information
--swiglib Report location of SWIG library and exit
--version Display SWIG version number
+Supported Target Language Options
+ -csharp - Generate C# wrappers
+ -d - Generate D wrappers
+ -go - Generate Go wrappers
+ -guile - Generate Guile wrappers
+ -java - Generate Java wrappers
+ -javascript - Generate Javascript wrappers
+ -lua - Generate Lua wrappers
+ -octave - Generate Octave wrappers
+ -perl5 - Generate Perl 5 wrappers
+ -php7 - Generate PHP 7 wrappers
+ -python - Generate Python wrappers
+ -r - Generate R (aka GNU S) wrappers
+ -ruby - Generate Ruby wrappers
+ -scilab - Generate Scilab wrappers
+ -tcl8 - Generate Tcl 8 wrappers
+ -xml - Generate XML wrappers
+
+Experimental Target Language Options
+ -mzscheme - Generate MzScheme/Racket wrappers
+ -ocaml - Generate OCaml wrappers
+
+General Options
+ -addextern - Add extra extern declarations
+ -c++ - Enable C++ processing
+ -co &lt;file&gt; - Check &lt;file&gt; out of the SWIG library
+ -copyctor - Automatically generate copy constructors wherever possible
+ -cpperraswarn - Treat the preprocessor #error statement as #warning (default)
+ -cppext &lt;ext&gt; - Change file extension of generated C++ files to &lt;ext&gt;
+ (default is cxx)
+ -copyright - Display copyright notices
+ -debug-classes - Display information about the classes found in the interface
+ -debug-module &lt;n&gt;- Display module parse tree at stages 1-4, &lt;n&gt; is a csv list of stages
+ -debug-symtabs - Display symbol tables information
+ -debug-symbols - Display target language symbols in the symbol tables
+ -debug-csymbols - Display C symbols in the symbol tables
+ -debug-lsymbols - Display target language layer symbols
+ -debug-tags - Display information about the tags found in the interface
+ -debug-template - Display information for debugging templates
+ -debug-top &lt;n&gt; - Display entire parse tree at stages 1-4, &lt;n&gt; is a csv list of stages
+ -debug-typedef - Display information about the types and typedefs in the interface
+ -debug-typemap - Display typemap debugging information
+ -debug-tmsearch - Display typemap search debugging information
+ -debug-tmused - Display typemaps used debugging information
+ -directors - Turn on director mode for all the classes, mainly for testing
+ -dirprot - Turn on wrapping of protected members for director classes (default)
+ -D&lt;symbol&gt; - Define a symbol &lt;symbol&gt; (for conditional compilation)
+ -E - Preprocess only, does not generate wrapper code
+ -external-runtime [file] - Export the SWIG runtime stack
+ -fakeversion &lt;v&gt;- Make SWIG fake the program version number to &lt;v&gt;
+ -fcompact - Compile in compact mode
+ -features &lt;list&gt;- Set global features, where &lt;list&gt; is a comma separated list of
+ features, eg -features directors,autodoc=1
+ If no explicit value is given to the feature, a default of 1 is used
+ -fastdispatch - Enable fast dispatch mode to produce faster overload dispatcher code
+ -Fmicrosoft - Display error/warning messages in Microsoft format
+ -Fstandard - Display error/warning messages in commonly used format
+ -fvirtual - Compile in virtual elimination mode
+ -help - Display help
+ -I- - Don't search the current directory
+ -I&lt;dir&gt; - Look for SWIG files in directory &lt;dir&gt;
+ -ignoremissing - Ignore missing include files
+ -importall - Follow all #include statements as imports
+ -includeall - Follow all #include statements
+ -l&lt;ifile&gt; - Include SWIG library file &lt;ifile&gt;
+ -macroerrors - Report errors inside macros
+ -makedefault - Create default constructors/destructors (the default)
+ -M - List all dependencies
+ -MD - Is equivalent to `-M -MF &lt;file&gt;', except `-E' is not implied
+ -MF &lt;file&gt; - Generate dependencies into &lt;file&gt; and continue generating wrappers
+ -MM - List dependencies, but omit files in SWIG library
+ -MMD - Like `-MD', but omit files in SWIG library
+ -module &lt;name&gt; - Set module name to &lt;name&gt;
+ -MP - Generate phony targets for all dependencies
+ -MT &lt;target&gt; - Set the target of the rule emitted by dependency generation
+ -nocontract - Turn off contract checking
+ -nocpperraswarn - Do not treat the preprocessor #error statement as #warning
+ -nodefault - Do not generate default constructors nor default destructors
+ -nodefaultctor - Do not generate implicit default constructors
+ -nodefaultdtor - Do not generate implicit default destructors
+ -nodirprot - Do not wrap director protected members
+ -noexcept - Do not wrap exception specifiers
+ -nofastdispatch - Disable fast dispatch mode (default)
+ -nopreprocess - Skip the preprocessor step
+ -notemplatereduce - Disable reduction of the typedefs in templates
+ -O - Enable the optimization options:
+ -fastdispatch -fvirtual
+ -o &lt;outfile&gt; - Set name of C/C++ output file to &lt;outfile&gt;
+ -oh &lt;headfile&gt; - Set name of C++ output header file for directors to &lt;headfile&gt;
+ -outcurrentdir - Set default output dir to current dir instead of input file's path
+ -outdir &lt;dir&gt; - Set language specific files output directory to &lt;dir&gt;
+ -pcreversion - Display PCRE version information
+ -small - Compile in virtual elimination and compact mode
+ -swiglib - Report location of SWIG library and exit
+ -templatereduce - Reduce all the typedefs in templates
+ -v - Run in verbose mode
+ -version - Display SWIG version number
+ -Wall - Remove all warning suppression, also implies -Wextra
+ -Wallkw - Enable keyword warnings for all the supported languages
+ -Werror - Treat warnings as errors
+ -Wextra - Adds the following additional warnings: 202,309,403,405,512,321,322
+ -w&lt;list&gt; - Suppress/add warning messages, eg -w401,+321 - see Warnings.html
+ -xmlout &lt;file&gt; - Write XML version of the parse tree to &lt;file&gt; after normal processing
+</pre></div>
+
+<p>
+Arguments may also be passed in a command-line options file (also known as a
+response file) which is useful if they exceed the system command line length
+limit. To do this, put the arguments in a file, then provide the file name
+prefixed with <tt>@</tt> like so:
+</p>
+<div class="shell"><pre>
+swig @<em>file</em>
</pre></div>
+<p>
+The options read from the file are inserted in place of the file option. If the
+file does not exist, or cannot be read, then the option will be treated
+literally and not removed.
+</p>
+
+<p>
+Options in the file are separated by whitespace. A whitespace character may be
+included in an option by surrounding the entire option in either single or
+double quotes. Any character (including a backslash) may be included by
+prefixing the character to be included with a backslash. The file may itself
+contain additional <tt>@file</tt> options; any such options will be processed
+recursively.
+</p>
+
<H3><a name="SWIG_nn3">5.1.1 Input format</a></H3>
<p>
-As input, SWIG expects a file containing ANSI C/C++ declarations and
+As input, SWIG expects a file containing ISO C/C++ declarations and
special SWIG directives. More often than not, this is a special SWIG
interface file which is usually denoted with a special <tt>.i</tt> or
<tt>.swg</tt> suffix. In certain cases, SWIG can be used directly on
@@ -185,7 +270,7 @@ The most common format of a SWIG interface is as follows:
%{
#include "myheader.h"
%}
-// Now list ANSI C/C++ declarations
+// Now list ISO C/C++ declarations
int foo;
int bar(int x);
...
@@ -389,7 +474,7 @@ For example
/* bar not wrapped unless foo has been defined and
the declaration of bar within foo has already been parsed */
int foo::bar(int) {
- ... whatever ...
+ ... whatever ...
}
</pre>
</div>
@@ -1043,14 +1128,14 @@ expect :</p>
<div class="targetlang"><pre>
# Copy a file
def filecopy(source, target):
- f1 = fopen(source, "r")
- f2 = fopen(target, "w")
- buffer = malloc(8192)
- nbytes = fread(buffer, 8192, 1, f1)
- while (nbytes &gt; 0):
- fwrite(buffer, 8192, 1, f2)
- nbytes = fread(buffer, 8192, 1, f1)
- free(buffer)
+ f1 = fopen(source, "r")
+ f2 = fopen(target, "w")
+ buffer = malloc(8192)
+ nbytes = fread(buffer, 8192, 1, f1)
+ while (nbytes &gt; 0):
+ fwrite(buffer, 8192, 1, f2)
+ nbytes = fread(buffer, 8192, 1, f1)
+ free(buffer)
</pre></div>
<p>
@@ -1236,9 +1321,9 @@ creating a wrapper equivalent to the following:
<div class="code"><pre>
double wrap_dot_product(Vector *a, Vector *b) {
- Vector x = *a;
- Vector y = *b;
- return dot_product(x, y);
+ Vector x = *a;
+ Vector y = *b;
+ return dot_product(x, y);
}
</pre></div>
@@ -1266,12 +1351,12 @@ pointers. As a result, SWIG creates a wrapper like this:
<div class="code"><pre>
Vector *wrap_cross_product(Vector *v1, Vector *v2) {
- Vector x = *v1;
- Vector y = *v2;
- Vector *result;
- result = (Vector *) malloc(sizeof(Vector));
- *(result) = cross(x, y);
- return result;
+ Vector x = *v1;
+ Vector y = *v2;
+ Vector *result;
+ result = (Vector *) malloc(sizeof(Vector));
+ *(result) = cross(x, y);
+ return result;
}
</pre></div>
@@ -1280,10 +1365,10 @@ or if SWIG was run with the <tt>-c++</tt> option:</p>
<div class="code"><pre>
Vector *wrap_cross(Vector *v1, Vector *v2) {
- Vector x = *v1;
- Vector y = *v2;
- Vector *result = new Vector(cross(x, y)); // Uses default copy constructor
- return result;
+ Vector x = *v1;
+ Vector y = *v2;
+ Vector *result = new Vector(cross(x, y)); // Uses default copy constructor
+ return result;
}
</pre></div>
@@ -1737,6 +1822,16 @@ careful about namespaces and your use of modules, you can usually
avoid these problems.</p>
<p>
+When wrapping C code, simple use of identifiers/symbols with <tt>%rename</tt> usually suffices.
+When wrapping C++ code, simple use of simple identifiers/symbols with <tt>%rename</tt> might be too
+limiting when using C++ features such as function overloading, default arguments, namespaces, template specialization etc.
+If you are using the <tt>%rename</tt> directive and C++, make sure you read the
+<a href="SWIGPlus.html#SWIGPlus">SWIG and C++</a> chapter and in particular the section on
+<a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Renaming and ambiguity resolution</a>
+for method overloading and default arguments.
+</p>
+
+<p>
Closely related to <tt>%rename</tt> is the <tt>%ignore</tt> directive. <tt>%ignore</tt> instructs SWIG
to ignore declarations that match a given identifier. For example:
</p>
@@ -2078,7 +2173,7 @@ except those consisting of capital letters only:
<p>
Finally, variants of <tt>%rename</tt> and <tt>%ignore</tt> directives can be used to help
wrap C++ overloaded functions and methods or C++ methods which use default arguments. This is described in the
-<a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a> section in the C++ chapter.
+<a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Renaming and ambiguity resolution</a> section in the C++ chapter.
</p>
@@ -2147,7 +2242,7 @@ used in Tcl as follows :</p>
</pre></div>
<p>
-Although the ANSI C standard does not allow default arguments, default
+Although the ISO C standard does not allow default arguments, default
arguments specified in a SWIG interface work with both C and C++.
</p>
@@ -2167,7 +2262,7 @@ in the C++ chapter for further details.
<p>
Occasionally, a C library may include functions that expect to receive
pointers to functions--possibly to serve as callbacks. SWIG
-provides full support for function pointers provided that the callback
+provides full support for function pointers when the callback
functions are defined in C and not in the target language. For example,
consider a function like this:
</p>
@@ -2311,14 +2406,16 @@ And now, a final note about function pointer support. Although SWIG
does not normally allow callback functions to be written in the target language, this
can be accomplished with the use of typemaps and other advanced SWIG features.
See the <a href="Typemaps.html#Typemaps">Typemaps chapter</a> for more about typemaps
-and individual target language chapters for more on callbacks and the 'director' feature.
+and individual target language chapters for more on callbacks.
+The 'director' feature can be used to make callbacks from C/C++ into the target language,
+see <a href="SWIGPlus.html#SWIGPlus_target_language_callbacks">Callbacks to the target language</a>.
</p>
<H2><a name="SWIG_nn31">5.5 Structures and unions</a></H2>
<p>
-This section describes the behavior of SWIG when processing ANSI C structures and union declarations. Extensions to
+This section describes the behavior of SWIG when processing ISO C structures and union declarations. Extensions to
handle C++ are described in the next section.
</p>
@@ -2368,10 +2465,10 @@ defined in the interface. For example:
<div class="code"><pre>
struct Vector *new_Vector() {
- return (Vector *) calloc(1, sizeof(struct Vector));
+ return (Vector *) calloc(1, sizeof(struct Vector));
}
void delete_Vector(struct Vector *obj) {
- free(obj);
+ free(obj);
}
</pre>
</div>
@@ -2602,10 +2699,10 @@ like this:
<div class="code">
<pre>
WORD Foo_w_get(Foo *f) {
- return f-&gt;w;
+ return f-&gt;w;
}
void Foo_w_set(FOO *f, WORD value) {
- f-&gt;w = value;
+ f-&gt;w = value;
}
</pre>
</div>
@@ -2896,7 +2993,7 @@ instead of a method. To do this, you might write some code like this:
<pre>
// Add a new attribute to Vector
%extend Vector {
- const double magnitude;
+ const double magnitude;
}
// Now supply the implementation of the Vector_magnitude_get function
%{
@@ -3293,11 +3390,27 @@ Vector *new_Vector() {
return (Vector *) malloc(sizeof(Vector));
}
%}
-
</pre></div>
<p>
-The <tt>%inline</tt> directive inserts all of the code that follows
+This is the same as writing:
+</p>
+
+<div class="code"><pre>
+%{
+/* Create a new vector */
+Vector *new_Vector() {
+ return (Vector *) malloc(sizeof(Vector));
+}
+%}
+
+/* Create a new vector */
+Vector *new_Vector() {
+ return (Vector *) malloc(sizeof(Vector));
+}
+</pre></div>
+<p>
+In other words, the <tt>%inline</tt> directive inserts all of the code that follows
verbatim into the header portion of an interface file. The code is
then parsed by both the SWIG preprocessor and parser.
Thus, the above example creates a new command <tt>new_Vector</tt> using only one
@@ -3305,6 +3418,11 @@ declaration. Since the code inside an <tt>%inline %{ ... %}</tt> block
is given to both the C compiler and SWIG, it is illegal to include any
SWIG directives inside a <tt>%{ ... %}</tt> block.</p>
+
+<p>
+<b>Note:</b> The usual SWIG C preprocessor rules apply to code in <tt>%apply</tt> blocks when SWIG parses this code. For example, as mentioned earlier, <a href="SWIG.html#SWIG_nn6">SWIG's C Preprocessor</a> does not follow <tt>#include</tt> directives by default.
+</p>
+
<H3><a name="SWIG_nn44">5.6.4 Initialization blocks</a></H3>
@@ -3320,6 +3438,18 @@ initialization on module loading, you could write this:
%}
</pre></div>
+<p>
+Please note that some language backends (e.g. C# or Java) don't have any
+initialization function, hence you should define a global object performing
+the necessary initialization for them instead:
+</p>
+
+<div class="code"><pre>
+%init %{
+ static struct MyInit { MyInit() { init_variables(); } } myInit;
+%}
+</pre></div>
+
<H2><a name="SWIG_nn45">5.7 An Interface Building Strategy</a></H2>
@@ -3351,7 +3481,7 @@ interface to your program.
SWIG's <tt>%include</tt> directive to process an entire C
source/header file.
-<li>Make sure everything in the interface file uses ANSI C/C++ syntax.
+<li>Make sure everything in the interface file uses ISO C/C++ syntax.
<li>Make sure all necessary `<tt>typedef</tt>' declarations and
type-information is available in the interface file.
diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html
index 3e7860b9b..dc9ae0f7e 100644
--- a/Doc/Manual/SWIGPlus.html
+++ b/Doc/Manual/SWIGPlus.html
@@ -31,7 +31,6 @@
<li><a href="#SWIGPlus_nn12">Static members</a>
<li><a href="#SWIGPlus_member_data">Member data</a>
</ul>
-<li><a href="#SWIGPlus_default_args">Default arguments</a>
<li><a href="#SWIGPlus_nn15">Protection</a>
<li><a href="#SWIGPlus_nn16">Enums and constants</a>
<li><a href="#SWIGPlus_nn17">Friends</a>
@@ -39,16 +38,27 @@
<li><a href="#SWIGPlus_nn19">Pass and return by value</a>
<li><a href="#SWIGPlus_nn20">Inheritance</a>
<li><a href="#SWIGPlus_nn21">A brief discussion of multiple inheritance, pointers, and type checking</a>
-<li><a href="#SWIGPlus_overloaded_methods">Wrapping Overloaded Functions and Methods</a>
+<li><a href="#SWIGPlus_default_args">Default arguments</a>
+<li><a href="#SWIGPlus_overloaded_methods">Overloaded functions and methods</a>
<ul>
<li><a href="#SWIGPlus_nn24">Dispatch function generation</a>
-<li><a href="#SWIGPlus_nn25">Ambiguity in Overloading</a>
-<li><a href="#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a>
+<li><a href="#SWIGPlus_nn25">Ambiguity in overloading</a>
+<li><a href="#SWIGPlus_ambiguity_resolution_renaming">Renaming and ambiguity resolution</a>
<li><a href="#SWIGPlus_nn27">Comments on overloading</a>
</ul>
-<li><a href="#SWIGPlus_nn28">Wrapping overloaded operators</a>
+<li><a href="#SWIGPlus_nn28">Overloaded operators</a>
<li><a href="#SWIGPlus_class_extension">Class extension</a>
<li><a href="#SWIGPlus_nn30">Templates</a>
+<ul>
+<li><a href="#SWIGPlus_template_directive">The %template directive</a>
+<li><a href="#SWIGPlus_template_functions">Function templates</a>
+<li><a href="#SWIGPlus_template_classes">Default template arguments</a>
+<li><a href="#SWIGPlus_template_class_inheritance">Template base classes</a>
+<li><a href="#SWIGPlus_template_specialization">Template specialization</a>
+<li><a href="#SWIGPlus_template_member">Member templates</a>
+<li><a href="#SWIGPlus_template_scoping">Scoping and templates</a>
+<li><a href="#SWIGPlus_template_more">More on templates</a>
+</ul>
<li><a href="#SWIGPlus_namespaces">Namespaces</a>
<ul>
<li><a href="#SWIGPlus_nspace">The nspace feature for namespaces</a>
@@ -62,6 +72,11 @@
<li><a href="#SWIGPlus_nn35">Using declarations and inheritance</a>
<li><a href="#SWIGPlus_nested_classes">Nested classes</a>
<li><a href="#SWIGPlus_const">A brief rant about const-correctness</a>
+<li><a href="#SWIGPlus_target_language_callbacks">Callbacks to the target language</a>
+<ul>
+<li><a href="#SWIGPlus_director_classes_introduction">Introduction to director classes</a>
+<li><a href="#SWIGPlus_directors_for_function_pointers">Using directors and target language callbacks</a>
+</ul>
<li><a href="#SWIGPlus_nn42">Where to go for more information</a>
</ul>
</div>
@@ -70,9 +85,15 @@
<p>
-This chapter describes SWIG's support for wrapping C++. As a prerequisite,
+This chapter describes SWIG's support for wrapping C++.
+It is mostly concerned about C++ as defined by the C++ 98 and 03 standards.
+For additions to the original C++ standard, please read the
+<a href="CPlusPlus11.html#CPlusPlus11">SWIG and C++11</a>,
+<a href="CPlusPlus14.html#CPlusPlus14">SWIG and C++14</a> and
+<a href="CPlusPlus17.html#CPlusPlus17">SWIG and C++17</a> chapters.
+As a prerequisite,
you should first read the chapter <a href="SWIG.html#SWIG">SWIG Basics</a> to see
-how SWIG wraps ANSI C. Support for C++ builds upon ANSI C
+how SWIG wraps ISO C. Support for C++ builds upon ISO C
wrapping and that material will be useful in understanding this chapter.
</p>
@@ -123,7 +144,7 @@ yourself in the foot. You will just have to be careful.
<p>
To wrap C++, SWIG uses a layered approach to code generation.
-At the lowest level, SWIG generates a collection of procedural ANSI-C style
+At the lowest level, SWIG generates a collection of procedural ISO C style
wrappers. These wrappers take care of basic type conversion,
type checking, error handling, and other low-level details of the C++ binding.
These wrappers are also sufficient to bind C++ into any target language
@@ -346,8 +367,8 @@ public:
class Spam {
public:
- Foo *value;
- ...
+ Foo *value;
+ ...
};
</pre>
</div>
@@ -706,7 +727,7 @@ class Foo {
protected:
Foo(); // Not wrapped.
public:
- ...
+ ...
};
</pre>
</div>
@@ -726,7 +747,7 @@ public:
class Grok : public Bar {
public:
- Grok(); // Not wrapped. No implementation of abstract spam().
+ Grok(); // Not wrapped. No implementation of abstract spam().
};
</pre>
</div>
@@ -777,9 +798,9 @@ the normal constructor function. For example, if you have this:
<pre>
class List {
public:
- List();
- List(const List &amp;); // Copy constructor
- ...
+ List();
+ List(const List &amp;); // Copy constructor
+ ...
};
</pre>
</div>
@@ -803,7 +824,7 @@ through a special function like this:
<div class="code">
<pre>
List *copy_List(List *f) {
- return new List(*f);
+ return new List(*f);
}
</pre>
</div>
@@ -832,7 +853,7 @@ However, copy constructor wrappers can be generated if using the <tt>copyctor</t
class List {
public:
- List();
+ List();
};
</pre>
</div>
@@ -851,9 +872,9 @@ could be wrapped, but they had to be renamed. For example:
<pre>
class Foo {
public:
- Foo();
+ Foo();
%name(CopyFoo) Foo(const Foo &amp;);
- ...
+ ...
};
</pre>
</div>
@@ -969,8 +990,8 @@ not primitive types, such as classes. For instance, if you had another class lik
<pre>
class Foo {
public:
- List items;
- ...
+ List items;
+ ...
</pre>
</div>
@@ -982,10 +1003,10 @@ For example:
<div class="code">
<pre>
List *Foo_items_get(Foo *self) {
- return &amp;self-&gt;items;
+ return &amp;self-&gt;items;
}
void Foo_items_set(Foo *self, List *value) {
- self-&gt;items = *value;
+ self-&gt;items = *value;
}
</pre>
</div>
@@ -1007,10 +1028,10 @@ It is the naturalvar feature and can be used to effectively change the way acces
<div class="code">
<pre>
const List &amp;Foo_items_get(Foo *self) {
- return self-&gt;items;
+ return self-&gt;items;
}
void Foo_items_set(Foo *self, const List &amp;value) {
- self-&gt;items = value;
+ self-&gt;items = value;
}
</pre>
</div>
@@ -1094,113 +1115,7 @@ a few problems related to structure wrapping and some of SWIG's
customization features.
</p>
-<H2><a name="SWIGPlus_default_args">6.7 Default arguments</a></H2>
-
-
-<p>
-SWIG will wrap all types of functions that have default arguments. For example member functions:
-</p>
-
-<div class="code">
-<pre>
-class Foo {
-public:
- void bar(int x, int y = 3, int z = 4);
-};
-</pre>
-</div>
-
-<p>
-SWIG handles default arguments by generating an extra overloaded method for each defaulted argument.
-SWIG is effectively handling methods with default arguments as if it was wrapping the equivalent overloaded methods.
-Thus for the example above, it is as if we had instead given the following to SWIG:
-</p>
-
-<div class="code">
-<pre>
-class Foo {
-public:
- void bar(int x, int y, int z);
- void bar(int x, int y);
- void bar(int x);
-};
-</pre>
-</div>
-
-<p>
-The wrappers produced are exactly the same as if the above code was instead fed into SWIG.
-Details of this are covered later in the <a href="#SWIGPlus_overloaded_methods">Wrapping Overloaded Functions and Methods</a> section.
-This approach allows SWIG to wrap all possible default arguments, but can be verbose.
-For example if a method has ten default arguments, then eleven wrapper methods are generated.
-</p>
-
-<p>
-Please see the <a href="Customization.html#Customization_features_default_args">Features and default arguments</a>
-section for more information on using <tt>%feature</tt> with functions with default arguments.
-The <a href="#SWIGPlus_ambiguity_resolution_renaming">Ambiguity resolution and renaming</a> section
-also deals with using <tt>%rename</tt> and <tt>%ignore</tt> on methods with default arguments.
-If you are writing your own typemaps for types used in methods with default arguments, you may also need to write a <tt>typecheck</tt> typemap.
-See the <a href="Typemaps.html#Typemaps_overloading">Typemaps and overloading</a> section for details or otherwise
-use the <tt>compactdefaultargs</tt> feature flag as mentioned below.
-</p>
-
-<p>
-<b>Compatibility note:</b> Versions of SWIG prior to SWIG-1.3.23 wrapped default arguments slightly differently.
-Instead a single wrapper method was generated and the default values were copied into the C++ wrappers
-so that the method being wrapped was then called with all the arguments specified.
-If the size of the wrappers are a concern then this approach to wrapping methods with default arguments
-can be re-activated by using the <tt>compactdefaultargs</tt>
-<a href="Customization.html#Customization_feature_flags">feature flag</a>.
-</p>
-
-<div class="code">
-<pre>
-%feature("compactdefaultargs") Foo::bar;
-class Foo {
-public:
- void bar(int x, int y = 3, int z = 4);
-};
-</pre>
-</div>
-
-
-<p>
-This is great for reducing the size of the wrappers, but the caveat is it does not work for the statically typed languages,
-such as C# and Java,
-which don't have optional arguments in the language,
-Another restriction of this feature is that it cannot handle default arguments that are not public.
-The following example illustrates this:
-</p>
-
-<div class="code">
-<pre>
-class Foo {
-private:
- static const int spam;
-public:
- void bar(int x, int y = spam); // Won't work with %feature("compactdefaultargs") -
- // private default value
-};
-</pre>
-</div>
-
-<p>
-This produces uncompilable wrapper code because default values in C++ are
-evaluated in the same scope as the member function whereas SWIG
-evaluates them in the scope of a wrapper function (meaning that the
-values have to be public).
-</p>
-
-<p>
-The <tt>compactdefaultargs</tt> feature is automatically turned on when wrapping <a href="SWIG.html#SWIG_default_args">C code with default arguments</a>.
-Some target languages will also automatically turn on this feature
-if the keyword arguments feature (kwargs) is specified for either C or C++ functions, and the target language supports kwargs,
-the <tt>compactdefaultargs</tt> feature is also automatically turned on.
-Keyword arguments are a language feature of some scripting languages, for example Ruby and Python.
-SWIG is unable to support kwargs when wrapping overloaded methods, so the default approach cannot be used.
-</p>
-
-<H2><a name="SWIGPlus_nn15">6.8 Protection</a></H2>
+<H2><a name="SWIGPlus_nn15">6.7 Protection</a></H2>
<p>
@@ -1220,7 +1135,7 @@ until you explicitly give a `<tt>public:</tt>' declaration (This is
the same convention used by C++).
</p>
-<H2><a name="SWIGPlus_nn16">6.9 Enums and constants</a></H2>
+<H2><a name="SWIGPlus_nn16">6.8 Enums and constants</a></H2>
<p>
@@ -1250,7 +1165,7 @@ Swig_STOUT = Swig::STOUT
Members declared as <tt>const</tt> are wrapped as read-only members and do not create constants.
</p>
-<H2><a name="SWIGPlus_nn17">6.10 Friends</a></H2>
+<H2><a name="SWIGPlus_nn17">6.9 Friends</a></H2>
<p>
@@ -1278,7 +1193,7 @@ equivalent to one generated for the following declaration
<pre>
class Foo {
public:
- ...
+ ...
};
void blah(Foo *f);
@@ -1311,7 +1226,7 @@ namespace bar {
and a wrapper for the method 'blah' will not be generated.
</p>
-<H2><a name="SWIGPlus_nn18">6.11 References and pointers</a></H2>
+<H2><a name="SWIGPlus_nn18">6.10 References and pointers</a></H2>
<p>
@@ -1411,7 +1326,7 @@ templates and the STL. This was first added in SWIG-1.3.12.
</p>
-<H2><a name="SWIGPlus_nn19">6.12 Pass and return by value</a></H2>
+<H2><a name="SWIGPlus_nn19">6.11 Pass and return by value</a></H2>
<p>
@@ -1485,8 +1400,8 @@ class A;
%feature("valuewrapper") B;
struct B {
- B();
- // ....
+ B();
+ // ....
};
</pre></div>
@@ -1515,7 +1430,7 @@ classes that don't define a default constructor.
It is not used for C++ pointers or references.
</p>
-<H2><a name="SWIGPlus_nn20">6.13 Inheritance</a></H2>
+<H2><a name="SWIGPlus_nn20">6.12 Inheritance</a></H2>
<p>
@@ -1701,7 +1616,7 @@ functions for virtual members that are already defined in a base
class.
</p>
-<H2><a name="SWIGPlus_nn21">6.14 A brief discussion of multiple inheritance, pointers, and type checking</a></H2>
+<H2><a name="SWIGPlus_nn21">6.13 A brief discussion of multiple inheritance, pointers, and type checking</a></H2>
<p>
@@ -1833,7 +1748,113 @@ int y = B_function((B *) pB);
In practice, the pointer is held as an integral number in the target language proxy class.
</p>
-<H2><a name="SWIGPlus_overloaded_methods">6.15 Wrapping Overloaded Functions and Methods</a></H2>
+<H2><a name="SWIGPlus_default_args">6.14 Default arguments</a></H2>
+
+
+<p>
+SWIG will wrap all types of functions that have default arguments. For example member functions:
+</p>
+
+<div class="code">
+<pre>
+class Foo {
+public:
+ void bar(int x, int y = 3, int z = 4);
+};
+</pre>
+</div>
+
+<p>
+SWIG handles default arguments by generating an extra overloaded method for each defaulted argument.
+SWIG is effectively handling methods with default arguments as if it was wrapping the equivalent overloaded methods.
+Thus for the example above, it is as if we had instead given the following to SWIG:
+</p>
+
+<div class="code">
+<pre>
+class Foo {
+public:
+ void bar(int x, int y, int z);
+ void bar(int x, int y);
+ void bar(int x);
+};
+</pre>
+</div>
+
+<p>
+The wrappers produced are exactly the same as if the above code was instead fed into SWIG.
+Details of this are covered in the next section <a href="#SWIGPlus_overloaded_methods">Overloaded functions and methods</a>.
+This approach allows SWIG to wrap all possible default arguments, but can be verbose.
+For example if a method has ten default arguments, then eleven wrapper methods are generated.
+</p>
+
+<p>
+Please see the <a href="Customization.html#Customization_features_default_args">Features and default arguments</a>
+section for more information on using <tt>%feature</tt> with functions with default arguments.
+The <a href="#SWIGPlus_ambiguity_resolution_renaming">Renaming and ambiguity resolution</a> section
+also deals with using <tt>%rename</tt> and <tt>%ignore</tt> on methods with default arguments.
+If you are writing your own typemaps for types used in methods with default arguments, you may also need to write a <tt>typecheck</tt> typemap.
+See the <a href="Typemaps.html#Typemaps_overloading">Typemaps and overloading</a> section for details or otherwise
+use the <tt>compactdefaultargs</tt> feature flag as mentioned below.
+</p>
+
+<p>
+<b>Compatibility note:</b> Versions of SWIG prior to SWIG-1.3.23 wrapped default arguments slightly differently.
+Instead a single wrapper method was generated and the default values were copied into the C++ wrappers
+so that the method being wrapped was then called with all the arguments specified.
+If the size of the wrappers are a concern then this approach to wrapping methods with default arguments
+can be re-activated by using the <tt>compactdefaultargs</tt>
+<a href="Customization.html#Customization_feature_flags">feature flag</a>.
+</p>
+
+<div class="code">
+<pre>
+%feature("compactdefaultargs") Foo::bar;
+class Foo {
+public:
+ void bar(int x, int y = 3, int z = 4);
+};
+</pre>
+</div>
+
+
+<p>
+This is great for reducing the size of the wrappers, but the caveat is it does not work for the statically typed languages,
+such as C# and Java,
+which don't have optional arguments in the language,
+Another restriction of this feature is that it cannot handle default arguments that are not public.
+The following example illustrates this:
+</p>
+
+<div class="code">
+<pre>
+class Foo {
+private:
+ static const int spam;
+public:
+ void bar(int x, int y = spam); // Won't work with %feature("compactdefaultargs") -
+ // private default value
+};
+</pre>
+</div>
+
+<p>
+This produces uncompilable wrapper code because default values in C++ are
+evaluated in the same scope as the member function whereas SWIG
+evaluates them in the scope of a wrapper function (meaning that the
+values have to be public).
+</p>
+
+<p>
+The <tt>compactdefaultargs</tt> feature is automatically turned on when wrapping <a href="SWIG.html#SWIG_default_args">C code with default arguments</a>.
+Some target languages will also automatically turn on this feature
+if the keyword arguments feature (kwargs) is specified for either C or C++ functions, and the target language supports kwargs,
+the <tt>compactdefaultargs</tt> feature is also automatically turned on.
+Keyword arguments are a language feature of some scripting languages, for example Ruby and Python.
+SWIG is unable to support kwargs when wrapping overloaded methods, so the default approach cannot be used.
+</p>
+
+<H2><a name="SWIGPlus_overloaded_methods">6.15 Overloaded functions and methods</a></H2>
<p>
@@ -2021,7 +2042,7 @@ checked in the same order as they appear in this ranking.
If you're still confused, don't worry about it---SWIG is probably doing the right thing.
</p>
-<H3><a name="SWIGPlus_nn25">6.15.2 Ambiguity in Overloading</a></H3>
+<H3><a name="SWIGPlus_nn25">6.15.2 Ambiguity in overloading</a></H3>
<p>
@@ -2139,7 +2160,7 @@ it means that the target language module has not yet implemented support for ove
functions and methods. The only way to fix the problem is to read the next section.
</p>
-<H3><a name="SWIGPlus_ambiguity_resolution_renaming">6.15.3 Ambiguity resolution and renaming</a></H3>
+<H3><a name="SWIGPlus_ambiguity_resolution_renaming">6.15.3 Renaming and ambiguity resolution</a></H3>
<p>
@@ -2399,8 +2420,8 @@ the first renaming rule found on a depth-first traversal of the class hierarchy
is used.
</li>
-<li><p>The name matching rules strictly follow member qualification rules.
-For example, if you have a class like this:</p>
+<li><p>The name matching rules strictly follow member qualifier rules.
+For example, if you have a class and member with a member that is const qualified like this:</p>
<div class="code">
<pre>
@@ -2424,7 +2445,7 @@ the declaration
</div>
<p>
-will not apply as there is no unqualified member <tt>bar()</tt>. The following will apply as
+will not apply as there is no unqualified member <tt>bar()</tt>. The following will apply the rename as
the qualifier matches correctly:
</p>
@@ -2435,6 +2456,26 @@ the qualifier matches correctly:
</div>
<p>
+Similarly for combinations of cv-qualifiers and ref-qualifiers, all the qualifiers must be specified to match correctly:
+</p>
+
+<div class="code">
+<pre>
+%rename(name) Jam::bar(); // will not match
+%rename(name) Jam::bar() &amp;; // will not match
+%rename(name) Jam::bar() const; // will not match
+%rename(name) Jam::bar() const &amp;; // ok, will match
+
+class Jam {
+public:
+ ...
+ void bar() const &amp;;
+ ...
+};
+</pre>
+</div>
+
+<p>
An often overlooked C++ feature is that classes can define two different overloaded members
that differ only in their qualifiers, like this:
</p>
@@ -2466,7 +2507,7 @@ For example we can give them separate names in the target language:
<p>
Similarly, if you
merely wanted to ignore one of the declarations, use <tt>%ignore</tt>
-with the full qualification. For example, the following directive
+with the full qualifier. For example, the following directive
would tell SWIG to ignore the <tt>const</tt> version of <tt>bar()</tt>
above:
</p>
@@ -2532,8 +2573,7 @@ exactly matches the wrapped method:
<p>
The C++ method can then be called from the target language with the new name no matter how many arguments are specified, for example:
<tt>newbar(2, 2.0)</tt>, <tt>newbar(2)</tt> or <tt>newbar()</tt>.
-However, if the <tt>%rename</tt> does not contain the default arguments, it will only apply to the single equivalent target language overloaded method.
-So if instead we have:
+However, if the <tt>%rename</tt> does not contain the default arguments:
</p>
<div class="code">
@@ -2543,8 +2583,23 @@ So if instead we have:
</div>
<p>
+then only one of the three equivalent overloaded methods will be renamed and wrapped as if SWIG parsed:
+</p>
+
+<div class="code">
+<pre>
+void Spam::newbar(int i, double d);
+void Spam::bar(int i);
+void Spam::bar();
+</pre>
+</div>
+
+<p>
The C++ method must then be called from the target language with the new name <tt>newbar(2, 2.0)</tt> when both arguments are supplied
or with the original name as <tt>bar(2)</tt> (one argument) or <tt>bar()</tt> (no arguments).
+</p>
+
+<p>
In fact it is possible to use <tt>%rename</tt> on the equivalent overloaded methods, to rename all the equivalent overloaded methods:
</p>
@@ -2586,7 +2641,7 @@ As a general rule, statically typed languages like Java are able to provide more
than dynamically typed languages like Perl, Python, Ruby, and Tcl.
</p>
-<H2><a name="SWIGPlus_nn28">6.16 Wrapping overloaded operators</a></H2>
+<H2><a name="SWIGPlus_nn28">6.16 Overloaded operators</a></H2>
<p>
@@ -2779,7 +2834,7 @@ into two methods such that additional logic can be packed into the operations; C
<tt>this[type key] { get { ... } set { ... }}</tt>, Python uses
<tt>__getitem__</tt> and <tt>__setitem__</tt>, etc. In C++ if the return
type of <tt>operator[]</tt> is a reference and the method is const, it is often indicative of the <i>setter</i>,
-and and the <i>getter</i> is usually a const function return an object by value.
+and the <i>getter</i> is usually a const function return an object by value.
In the absence of any hard and fast rules and the fact that there may be multiple index operators,
it is up to the user to choose the getter and setter to use by using %rename as shown earlier.
</p>
@@ -2936,63 +2991,76 @@ as <tt>vector&lt;int&gt;</tt>. The wrapper for <tt>foo()</tt> will
accept either variant.
</p>
+<H3><a name="SWIGPlus_template_directive">6.18.1 The %template directive</a></H3>
+
+
<p>
-Starting with SWIG-1.3.7, simple C++ template declarations can also be
-wrapped. SWIG-1.3.12 greatly expands upon the earlier implementation. Before discussing this any further, there are a few things
-you need to know about template wrapping. First, a bare C++ template
+There are a couple of important points about template wrapping.
+First, a bare C++ template
does not define any sort of runnable object-code for which SWIG can
normally create a wrapper. Therefore, in order to wrap a template,
you need to give SWIG information about a particular template
-instantiation (e.g., <tt>vector&lt;int&gt;</tt>,
+instantiation (e.g., <tt>vector&lt;int&gt;</tt>,
<tt>array&lt;double&gt;</tt>, etc.). Second, an instantiation name
such as <tt>vector&lt;int&gt;</tt> is generally not a valid identifier
name in most target languages. Thus, you will need to give the
-template instantiation a more suitable name such as <tt>intvector</tt>
-when creating a wrapper.
+template instantiation a more suitable name such as <tt>intvector</tt>.
</p>
<p>
-To illustrate, consider the following template definition:
+To illustrate, consider the following class template definition:
</p>
<div class="code"><pre>
template&lt;class T&gt; class List {
private:
- T *data;
- int nitems;
- int maxitems;
+ T *data;
+ int nitems;
+ int maxitems;
public:
- List(int max) {
- data = new T [max];
- nitems = 0;
- maxitems = max;
- }
- ~List() {
- delete [] data;
- };
- void append(T obj) {
- if (nitems &lt; maxitems) {
- data[nitems++] = obj;
- }
- }
- int length() {
- return nitems;
- }
- T get(int n) {
- return data[n];
+ List(int max) {
+ data = new T [max];
+ nitems = 0;
+ maxitems = max;
+ }
+ ~List() {
+ delete [] data;
+ };
+ void append(T obj) {
+ if (nitems &lt; maxitems) {
+ data[nitems++] = obj;
}
+ }
+ int length() {
+ return nitems;
+ }
+ T get(int n) {
+ return data[n];
+ }
};
</pre></div>
<p>
-By itself, this template declaration is useless--SWIG simply ignores it
-because it doesn't know how to generate any code until unless a definition of
+By itself, this class template is useless--SWIG simply ignores it
+because it doesn't know how to generate any code unless a definition of
<tt>T</tt> is provided.
+The <tt>%template</tt> directive is required to instantiate the template for use in a target language.
+The directive requires an identifier name for use in the target language plus the template for instantiation.
+The example below instantiates <tt>List&lt;int&gt;</tt> for use as a class named <tt>intList</tt>:
</p>
+<div class="code">
+<pre>
+%template(intList) List&lt;int&gt;;
+</pre>
+</div>
+
<p>
-One way to create wrappers for a specific template instantiation is to simply
-provide an expanded version of the class directly like this:
+The instantiation expands the template code as a C++ compiler would do and then makes it available
+under the given identifier name.
+Essentially it is the same as wrapping the following concept code where
+the class template definition has <tt>T</TT> expanded to <tt>int</tt>
+(note that this is not entirely valid syntax):
</p>
<div class="code">
@@ -3000,60 +3068,112 @@ provide an expanded version of the class directly like this:
%rename(intList) List&lt;int&gt;; // Rename to a suitable identifier
class List&lt;int&gt; {
private:
- int *data;
- int nitems;
- int maxitems;
+ int *data;
+ int nitems;
+ int maxitems;
public:
- List(int max);
- ~List();
- void append(int obj);
- int length();
- int get(int n);
+ List(int max);
+ ~List();
+ void append(int obj);
+ int length();
+ int get(int n);
};
</pre>
</div>
<p>
-The <tt>%rename</tt> directive is needed to give the template class an appropriate identifier
-name in the target language (most languages would not recognize C++ template syntax as a valid
-class name). The rest of the code is the same as what would appear in a normal
-class definition.
+The argument to <tt>%template()</tt> is the name of the instantiation
+in the target language. The name you choose should not conflict with
+any other declarations in the interface file with one exception---it
+is okay for the template name to match that of a typedef declaration.
+For example:
+</p>
+
+<div class="code">
+<pre>
+%template(intList) List&lt;int&gt;;
+...
+typedef List&lt;int&gt; intList; // OK
+</pre>
+</div>
+
+<p>
+The <tt>%template</tt> directive
+must always appear <em>after</em> the definition of the template to be expanded, so the following will work:
</p>
+<div class="code">
+<pre>
+template&lt;class T&gt; class List { ... };
+%template(intList) List&lt;int&gt;;
+</pre>
+</div>
+
<p>
-Since manual expansion of templates gets old in a hurry, the <tt>%template</tt> directive can
-be used to create instantiations of a template class. Semantically, <tt>%template</tt> is
-simply a shortcut---it expands template code in exactly the same way as shown above. Here
-are some examples:
+but if %template is used before the template definition, such as:
</p>
<div class="code">
<pre>
-/* Instantiate a few different versions of the template */
%template(intList) List&lt;int&gt;;
-%template(doubleList) List&lt;double&gt;;
+template&lt;class T&gt; class List { ... };
</pre>
</div>
<p>
-The argument to <tt>%template()</tt> is the name of the instantiation
-in the target language. The name you choose should not conflict with
-any other declarations in the interface file with one exception---it
-is okay for the template name to match that of a typedef declaration.
-For example:
+SWIG will generate an error:
+</p>
+
+<div class="shell">
+<pre>
+example.i:3: Error: Template 'List' undefined.
+</pre>
+</div>
+
+<p>
+Since the type system knows how to handle <tt>typedef</tt>, it is
+generally not necessary to instantiate different versions of a template
+for typenames that are equivalent. For instance, consider this code:
</p>
<div class="code">
<pre>
%template(intList) List&lt;int&gt;;
+typedef int Integer;
...
-typedef List&lt;int&gt; intList; // OK
+void foo(List&lt;Integer&gt; *x);
</pre>
</div>
<p>
-SWIG can also generate wrappers for function templates using a similar technique.
+In this case, <tt>List&lt;Integer&gt;</tt> is exactly the same type as
+<tt>List&lt;int&gt;</tt>. Any use of <tt>List&lt;Integer&gt;</tt> is mapped back to the
+instantiation of <tt>List&lt;int&gt;</tt> created earlier. Therefore, it is
+not necessary to instantiate a new class for the type <tt>Integer</tt> (doing so is
+redundant and will simply result in code bloat).
+</p>
+
+<p>
+The template provided to <tt>%template</tt> for instantiation must be the actual template and not a typedef to a template.
+</p>
+
+<div class="code">
+<pre>
+typedef List&lt;int&gt; ListOfInt;
+
+%template(intList) List&lt;int&gt;; // ok
+%template(intList) ListOfInt; // illegal - Syntax error
+</pre>
+</div>
+
+
+<H3><a name="SWIGPlus_template_functions">6.18.2 Function templates</a></H3>
+
+
+<p>
+SWIG can also generate wrappers for function templates using a similar technique
+to that shown above for class templates.
For example:
</p>
@@ -3074,6 +3194,28 @@ instantiations of the function.
</p>
<p>
+SWIG even supports overloaded templated functions. As usual the <tt>%template</tt> directive
+is used to wrap templated functions. For example:
+</p>
+
+<div class="code">
+<pre>
+template&lt;class T&gt; void foo(T x) { };
+template&lt;class T&gt; void foo(T x, T y) { };
+
+%template(foo) foo&lt;int&gt;;
+</pre>
+</div>
+
+<p>
+This will generate two overloaded wrapper methods, the first will take a single integer as an argument
+and the second will take two integer arguments.
+</p>
+
+<H3><a name="SWIGPlus_template_classes">6.18.3 Default template arguments</a></H3>
+
+
+<p>
The number of arguments supplied to <tt>%template</tt> should match that in the
original template definition. Template default arguments are supported. For example:
</p>
@@ -3110,28 +3252,8 @@ instantiation only once in order to reduce the potential for code
bloat.
</p>
-<p>
-Since the type system knows how to handle <tt>typedef</tt>, it is
-generally not necessary to instantiate different versions of a template
-for typenames that are equivalent. For instance, consider this code:
-</p>
+<H3><a name="SWIGPlus_template_class_inheritance">6.18.4 Template base classes</a></H3>
-<div class="code">
-<pre>
-%template(intList) vector&lt;int&gt;;
-typedef int Integer;
-...
-void foo(vector&lt;Integer&gt; *x);
-</pre>
-</div>
-
-<p>
-In this case, <tt>vector&lt;Integer&gt;</tt> is exactly the same type as
-<tt>vector&lt;int&gt;</tt>. Any use of <tt>Vector&lt;Integer&gt;</tt> is mapped back to the
-instantiation of <tt>vector&lt;int&gt;</tt> created earlier. Therefore, it is
-not necessary to instantiate a new class for the type <tt>Integer</tt> (doing so is
-redundant and will simply result in code bloat).
-</p>
<p>
When a template is instantiated using <tt>%template</tt>, information
@@ -3158,13 +3280,13 @@ nothing is known about <tt>List&lt;int&gt;</tt>, you will get a warning message
<div class="shell">
<pre>
-example.h:42: Warning 401. Nothing known about class 'List&lt;int &gt;'. Ignored.
-example.h:42: Warning 401. Maybe you forgot to instantiate 'List&lt;int &gt;' using %template.
+example.h:42: Warning 401. Nothing known about class 'List&lt; int &gt;'. Ignored.
+example.h:42: Warning 401. Maybe you forgot to instantiate 'List&lt; int &gt;' using %template.
</pre>
</div>
<p>
-If a template class inherits from another template class, you need to
+If a class template inherits from another class template, you need to
make sure that base classes are instantiated before derived classes.
For example:
</p>
@@ -3235,6 +3357,9 @@ TEMPLATE_WRAP(PairStringInt, std::pair&lt;string, int&gt;)
Note the use of a vararg macro for the type T. If this wasn't used, the comma in the templated type in the last example would not be possible.
</p>
+<H3><a name="SWIGPlus_template_specialization">6.18.5 Template specialization</a></H3>
+
+
<p>
The SWIG template mechanism <em>does</em> support specialization. For instance, if you define
a class like this,
@@ -3244,15 +3369,15 @@ a class like this,
<pre>
template&lt;&gt; class List&lt;int&gt; {
private:
- int *data;
- int nitems;
- int maxitems;
+ int *data;
+ int nitems;
+ int maxitems;
public:
- List(int max);
- ~List();
- void append(int obj);
- int length();
- int get(int n);
+ List(int max);
+ ~List();
+ void append(int obj);
+ int length();
+ int get(int n);
};
</pre>
</div>
@@ -3275,15 +3400,15 @@ code defines a template that is applied when the template argument is a pointer.
<pre>
template&lt;class T&gt; class List&lt;T*&gt; {
private:
- T *data;
- int nitems;
- int maxitems;
+ T *data;
+ int nitems;
+ int maxitems;
public:
- List(int max);
- ~List();
- void append(int obj);
- int length();
- T get(int n);
+ List(int max);
+ ~List();
+ void append(T obj);
+ int length();
+ T get(int n);
};
</pre>
</div>
@@ -3322,10 +3447,13 @@ SWIG implements template argument deduction so that the following partial specia
</pre>
</div>
+<H3><a name="SWIGPlus_template_member">6.18.6 Member templates</a></H3>
+
+
<p>
-Member function templates are supported. The underlying principle is the same
+Member templates are supported. The underlying principle is the same
as for normal templates--SWIG can't create a wrapper unless you provide
-more information about types. For example, a class with a member template might
+more information about types. For example, a class with a member function template might
look like this:
</p>
@@ -3400,11 +3528,6 @@ methods to the Foo class.
<p>
-Note: because of the way that templates are handled, the <tt>%template</tt> directive
-must always appear <em>after</em> the definition of the template to be expanded.
-</p>
-
-<p>
Now, if your target language supports overloading, you can even try
</p>
@@ -3424,7 +3547,7 @@ depending on the argument type.
<p>
When used with members, the <tt>%template</tt> directive may be placed in another
-template class. Here is a slightly perverse example:
+class template. Here is a slightly perverse example:
</p>
<div class="code">
@@ -3475,7 +3598,7 @@ template&lt;class T1, class T2&gt; struct pair {
<p>
This declaration is perfectly acceptable to SWIG, but the constructor template will be ignored
unless you explicitly expand it. To do that, you could expand a few versions of the constructor
-in the template class itself. For example:
+in the class template itself. For example:
</p>
<div class="code">
@@ -3536,6 +3659,110 @@ constructor, that will dispatch the proper call depending on the argument
type.
</p>
+<H3><a name="SWIGPlus_template_scoping">6.18.7 Scoping and templates</a></H3>
+
+
+<p>
+The <tt>%template</tt> directive for a class template is the equivalent to an explicit instantiation
+of a C++ class template. The scope for a valid <tt>%template</tt> instantiation is the same
+as the scope required for a valid explicit instantiation of a C++ template.
+A definition of the template for the explicit instantiation must be in scope
+where the instantiation is declared and must not be enclosed within a different namespace.
+</p>
+
+<p>
+For example, a few <tt>%template</tt> instantiations and C++ explicit instantiations are shown below:
+</p>
+
+<div class="code">
+<pre>
+namespace N {
+ template&lt;typename T&gt; class C {};
+}
+
+// valid
+%template(cin) N::C&lt;int&gt;;
+template class N::C&lt;int&gt;;
+
+// valid
+namespace N {
+ %template(cin) C&lt;int&gt;;
+ template class C&lt;int&gt;;
+}
+
+// valid
+using namespace N;
+%template(cin) C&lt;int&gt;;
+template class C&lt;int&gt;;
+
+// valid
+using N::C;
+%template(cin) C&lt;int&gt;;
+template class C&lt;int&gt;;
+
+// ill-formed
+namespace unrelated {
+ using N::C;
+ %template(cin) C&lt;int&gt;;
+ template class C&lt;int&gt;;
+}
+
+// ill-formed
+namespace unrelated {
+ using namespace N;
+ %template(cin) C&lt;int&gt;;
+ template class C&lt;int&gt;;
+}
+
+// ill-formed
+namespace unrelated {
+ namespace N {
+ %template(cin) C&lt;int&gt;;
+ template class C&lt;int&gt;;
+ }
+}
+
+// ill-formed
+namespace unrelated {
+ %template(cin) N::C&lt;int&gt;;
+ template class N::C&lt;int&gt;;
+}
+</pre>
+</div>
+
+<p>
+When the scope is incorrect, such as for the ill-formed examples above, an error occurs:
+</p>
+
+<div class="shell">
+<pre>
+cpp_template_scope.i:34: Error: 'C' resolves to 'N::C' and was incorrectly instantiated
+in scope 'unrelated' instead of within scope 'N'.
+</pre>
+</div>
+
+<p>
+A note for the C++ standard geeks out there; a valid instantiation is one which conforms to
+the C++03 standard as C++11 made a change to disallow using declarations and using directives to find a template.
+</p>
+
+<div class="code">
+<pre>
+// valid C++03, ill-formed C++11
+using N::C;
+template class C&lt;int&gt;;
+</pre>
+</div>
+
+<p>
+<b>Compatibility Note</b>: Versions prior to SWIG-4.0.0 did not error out with incorrectly scoped
+<tt>%template</tt> declarations, but this led to numerous subtle template scope problems.
+</p>
+
+
+<H3><a name="SWIGPlus_template_more">6.18.8 More on templates</a></H3>
+
+
<p>
If all of this isn't quite enough and you really want to make
someone's head explode, SWIG directives such as
@@ -3568,7 +3795,7 @@ instantiation.
</p>
<p>
-It is also possible to separate these declarations from the template class. For example:
+It is also possible to separate these declarations from the class template. For example:
</p>
<div class="code">
@@ -3587,11 +3814,11 @@ It is also possible to separate these declarations from the template class. For
...
template&lt;class T&gt; class List {
- ...
- public:
- List() { }
- T get(int index);
- ...
+ ...
+ public:
+ List() { }
+ T get(int index);
+ ...
};
</pre>
</div>
@@ -3609,33 +3836,14 @@ additional methods to a specific instantiation. For example:
%template(intList) List&lt;int&gt;;
%extend List&lt;int&gt; {
- void blah() {
- printf("Hey, I'm an List&lt;int&gt;!\n");
- }
+ void blah() {
+ printf("Hey, I'm an List&lt;int&gt;!\n");
+ }
};
</pre>
</div>
<p>
-SWIG even supports overloaded templated functions. As usual the <tt>%template</tt> directive
-is used to wrap templated functions. For example:
-</p>
-
-<div class="code">
-<pre>
-template&lt;class T&gt; void foo(T x) { };
-template&lt;class T&gt; void foo(T x, T y) { };
-
-%template(foo) foo&lt;int&gt;;
-</pre>
-</div>
-
-<p>
-This will generate two overloaded wrapper methods, the first will take a single integer as an argument
-and the second will take two integer arguments.
-</p>
-
-<p>
It is even possible to extend a class via <tt>%extend</tt> with template methods, for example:
</p>
@@ -3694,20 +3902,20 @@ For example:
<pre>
template &lt;class T&gt; class OuterTemplateClass {};
-// The nested class OuterClass::InnerClass inherits from the template class
+// The nested class OuterClass::InnerClass inherits from the class template
// OuterTemplateClass&lt;OuterClass::InnerStruct&gt; and thus the template needs
// to be expanded with %template before the OuterClass declaration.
%template(OuterTemplateClass_OuterClass__InnerStruct)
- OuterTemplateClass&lt;OuterClass::InnerStruct&gt;
+ OuterTemplateClass&lt;OuterClass::InnerStruct&gt;
// Don't forget to use %feature("flatnested") for OuterClass::InnerStruct and
// OuterClass::InnerClass if the target language doesn't support nested classes.
class OuterClass {
- public:
- // Forward declarations:
- struct InnerStruct;
- class InnerClass;
+ public:
+ // Forward declarations:
+ struct InnerStruct;
+ class InnerClass;
};
struct OuterClass::InnerStruct {};
@@ -3736,7 +3944,7 @@ introduced a new class name. This name could then be used with other directives
<pre>
%template(vectori) vector&lt;int&gt;;
%extend vectori {
- void somemethod() { }
+ void somemethod() { }
};
</pre>
</div>
@@ -3750,7 +3958,7 @@ as the class name. For example:
<pre>
%template(vectori) vector&lt;int&gt;;
%extend vector&lt;int&gt; {
- void somemethod() { }
+ void somemethod() { }
};
</pre>
</div>
@@ -3915,6 +4123,8 @@ then SWIG simply creates three wrapper functions <tt>bar()</tt>,
<tt>spam()</tt>, and <tt>blah()</tt> in the target language. SWIG
does not prepend the names with a namespace prefix nor are the
functions packaged in any kind of nested scope.
+Note that the default handling of flattening all the namespace scopes in the target language
+can be changed via the <a href="#SWIGPlus_nspace">nspace feature</a>.
</p>
<p>
@@ -4009,7 +4219,7 @@ in a different namespace. For example:
<div class="code">
<pre>
namespace foo {
- template&lt;typename T&gt; T max(T a, T b) { return a &gt; b ? a : b; }
+ template&lt;typename T&gt; T max(T a, T b) { return a &gt; b ? a : b; }
}
using foo::max;
@@ -4018,8 +4228,8 @@ using foo::max;
%template(maxfloat) foo::max&lt;float&gt;; // Okay (qualified name).
namespace bar {
- using namespace foo;
- %template(maxdouble) max&lt;double&gt;; // Okay.
+ using namespace foo;
+ %template(maxdouble) max&lt;double&gt;; // Okay.
}
</pre>
</div>
@@ -4040,7 +4250,7 @@ namespace foo {
typedef int Integer;
class bar {
public:
- ...
+ ...
};
}
@@ -4203,9 +4413,7 @@ namespace foo {
<p>
<b>Note:</b> The flattening of namespaces is only intended to serve as
a basic namespace implementation.
-None of the target language modules are currently programmed
-with any namespace awareness. In the future, language modules may or may not provide
-more advanced namespace support.
+More advanced handling of namespaces is discussed next.
</p>
<H3><a name="SWIGPlus_nspace">6.19.1 The nspace feature for namespaces</a></H3>
@@ -4301,9 +4509,9 @@ In the example below, the generic template type is used to rename to <tt>bbb</tt
<div class="code">
<pre>
-%rename(bbb) Space::ABC::aaa(T t); // will match but with lower precedence than ccc
+%rename(bbb) Space::ABC::aaa(T t); // will match but with lower precedence than ccc
%rename(ccc) Space::ABC&lt;Space::XYZ&gt;::aaa(Space::XYZ t);// will match but with higher precedence
- // than bbb
+ // than bbb
namespace Space {
class XYZ {};
@@ -4381,9 +4589,9 @@ class Error { };
class Foo {
public:
- ...
- void blah() throw(Error);
- ...
+ ...
+ void blah() throw(Error);
+ ...
};
</pre>
</div>
@@ -4408,7 +4616,7 @@ except Error, e:
<p>
Details of how to tailor code for handling the caught C++ exception and converting it into the target language's exception/error handling mechanism
-is outlined in the <a href="Typemaps.html#throws_typemap">"throws" typemap</a> section.
+is outlined in the <a href="Typemaps.html#Typemaps_throws_typemap">"throws" typemap</a> section.
</p>
<p>
@@ -4425,7 +4633,7 @@ The next section details a way of simulating an exception specification or repla
Exceptions are automatically handled for methods with an exception specification.
Similar handling can be achieved for methods without exception specifications through the <tt>%catches</tt> feature.
It is also possible to replace any declared exception specification using the <tt>%catches</tt> feature.
-In fact, <tt>%catches</tt> uses the same <a href="Typemaps.html#throws_typemap">"throws" typemaps</a> that SWIG uses for exception specifications in handling exceptions.
+In fact, <tt>%catches</tt> uses the same <a href="Typemaps.html#Typemaps_throws_typemap">"throws" typemaps</a> that SWIG uses for exception specifications in handling exceptions.
The <tt>%catches</tt> feature must contain a list of possible types that can be thrown.
For each type that is in the list, SWIG will generate a catch handler, in the same way that it would for types declared in the exception specification.
Note that the list can also include the catch all specification "...".
@@ -4445,10 +4653,10 @@ struct Error4 : EBase { };
class Foo {
public:
- ...
- void bar();
- void blah() throw(Error1, Error2, Error3, Error4);
- ...
+ ...
+ void bar();
+ void blah() throw(Error1, Error2, Error3, Error4);
+ ...
};
</pre>
</div>
@@ -4524,7 +4732,7 @@ for member pointers.
<p>
In some C++ programs, objects are often encapsulated by smart-pointers
or proxy classes. This is sometimes done to implement automatic memory management (reference counting) or
-persistence. Typically a smart-pointer is defined by a template class where
+persistence. Typically a smart-pointer is defined by a class template where
the <tt>-&gt;</tt> operator has been overloaded. This class is then wrapped
around some other class. For example:
</p>
@@ -4533,21 +4741,21 @@ around some other class. For example:
<pre>
// Smart-pointer class
template&lt;class T&gt; class SmartPtr {
- T *pointee;
+ T *pointee;
public:
- SmartPtr(T *p) : pointee(p) { ... }
- T *operator-&gt;() {
- return pointee;
- }
- ...
+ SmartPtr(T *p) : pointee(p) { ... }
+ T *operator-&gt;() {
+ return pointee;
+ }
+ ...
};
// Ordinary class
class Foo_Impl {
public:
- int x;
- virtual void bar();
- ...
+ int x;
+ virtual void bar();
+ ...
};
// Smart-pointer wrapper
@@ -4555,13 +4763,13 @@ typedef SmartPtr&lt;Foo_Impl&gt; Foo;
// Create smart pointer Foo
Foo make_Foo() {
- return SmartPtr&lt;Foo_Impl&gt;(new Foo_Impl());
+ return SmartPtr&lt;Foo_Impl&gt;(new Foo_Impl());
}
// Do something with smart pointer Foo
void do_something(Foo f) {
- printf("x = %d\n", f-&gt;x);
- f-&gt;bar();
+ printf("x = %d\n", f-&gt;x);
+ f-&gt;bar();
}
// Call the wrapped smart pointer proxy class in the target language 'Foo'
@@ -4660,13 +4868,13 @@ example, if you have this code</p>
<pre>
class Foo {
public:
- int x;
+ int x;
};
class Bar {
public:
- int x;
- Foo *operator-&gt;();
+ int x;
+ Foo *operator-&gt;();
};
</pre>
</div>
@@ -4829,19 +5037,19 @@ For example:
<p>
where the code passed to the "ref" and "unref" features will be
-executed as needed whenever a new object is passed to python, or when
-python tries to release the proxy object instance, respectively.
+executed as needed whenever a new object is passed to Python, or when
+Python tries to release the proxy object instance, respectively.
</p>
<p>
-On the python side, the use of a reference counted object is no
+On the Python side, the use of a reference counted object is no
different to any other regular instance:
</p>
<div class="targetlang">
<pre>
def create_A():
- a = A() # SWIG ref 'a' - new object is passed to python (count: 1)
+ a = A() # SWIG ref 'a' - new object is passed to Python (count: 1)
b1 = B(a) # C++ ref 'a (count: 2)
if 1 + 1 == 2:
b2 = B(a) # C++ ref 'a' (count: 3)
@@ -4869,8 +5077,8 @@ features:
<p>
In other words, SWIG will not do anything special when a new object
-is passed to python, and it will always 'delete' the underlying object when
-python releases the proxy instance.
+is passed to Python, and it will always 'delete' the underlying object when
+Python releases the proxy instance.
</p>
<p>
@@ -4915,19 +5123,19 @@ base classes. For example:
<pre>
class Foo {
public:
- int blah(int x);
+ int blah(int x);
};
class Bar {
public:
- double blah(double x);
+ double blah(double x);
};
class FooBar : public Foo, public Bar {
public:
- using Foo::blah;
- using Bar::blah;
- char *blah(const char *x);
+ using Foo::blah;
+ using Bar::blah;
+ char *blah(const char *x);
};
</pre>
</div>
@@ -4970,14 +5178,14 @@ you wrap this code in Python, the module works just like you would expect:
<pre>
class Foo {
protected:
- int x;
- int blah(int x);
+ int x;
+ int blah(int x);
};
class Bar : public Foo {
public:
- using Foo::x; // Make x public
- using Foo::blah; // Make blah public
+ using Foo::x; // Make x public
+ using Foo::blah; // Make blah public
};
</pre>
</div>
@@ -5008,14 +5216,14 @@ correctly, you can always change the interface to the following:
class FooBar : public Foo, public Bar {
public:
#ifndef SWIG
- using Foo::blah;
- using Bar::blah;
+ using Foo::blah;
+ using Bar::blah;
#else
- int blah(int x); // explicitly tell SWIG about other declarations
- double blah(double x);
+ int blah(int x); // explicitly tell SWIG about other declarations
+ double blah(double x);
#endif
- char *blah(const char *x);
+ char *blah(const char *x);
};
</pre>
</div>
@@ -5077,7 +5285,7 @@ normal classes.
</p>
<p>
If the target language doesn't support nested classes directly, or the support is not implemented in the
-language module (like for python currently), then the visible nested classes are moved to the same name
+language module (like for Python currently), then the visible nested classes are moved to the same name
space as the containing class (nesting hierarchy is "flattened"). The same behaviour may be turned on for
C# and Java by the %feature ("flatnested"); If there is a class with the same name in the outer namespace
the inner class (or the global one) may be renamed or ignored:
@@ -5188,7 +5396,152 @@ using another tool if maintaining constness is the most important part
of your project.
</p>
-<H2><a name="SWIGPlus_nn42">6.29 Where to go for more information</a></H2>
+<H2><a name="SWIGPlus_target_language_callbacks">6.29 Callbacks to the target language</a></H2>
+
+
+<p>
+C/C++ function pointers are often used for callbacks and this is discussed in the
+<a href="SWIG.html#SWIG_nn30">Pointers to functions and callbacks</a> section.
+The callback techniques described therein provide a way to control callbacks to a C/C++ function but not callbacks into the target language.
+The techniques described below show how the director feature can be used to support callbacks from C/C++ to the target language.
+</p>
+
+<H3><a name="SWIGPlus_director_classes_introduction">6.29.1 Introduction to director classes</a></H3>
+
+
+<p>
+The director feature enables the ability for a target language class to derive from a wrapped C++ class.
+The target language can override virtual methods of a wrapped C++ class, thereby supporting cross-language polymorphism.
+Code can 'call up' from C++ into the target language by simply calling a virtual method overridden in a derived class in the target language.
+The wrapped C++ classes that have this ability are termed 'director' classes.
+The director feature is documented individually in each target language and the reader should locate and read this to obtain a full understanding of directors.
+</p>
+
+<H3><a name="SWIGPlus_directors_for_function_pointers">6.29.2 Using directors and target language callbacks</a></H3>
+
+
+<p>
+SWIG's primary goal is to make it possible to call C/C++ code from a target language, however, the director feature enables the reverse.
+While there isn't simple direct support for calling target language code from C, the director feature makes this possible.
+It does require some work and additional wrapper code to be provided by the user.
+The additional code required must be C++ and not C code and hence may introduce a small dependency on C++ if using a pure C project.
+In a nutshell, the user must create a C++ base class and turn it into a director class.
+A virtual method in the director base class is required.
+SWIG generates the code to call up into the target language when wrapping the director virtual method.
+</p>
+
+<p>
+Let's look at some details next.
+Consider the same function pointer for a callback called <tt>binary_op</tt> from the
+<a href="SWIG.html#SWIG_nn30">Pointers to functions and callbacks</a> section.
+For completeness, the code required for the module and director feature is also shown:
+</p>
+
+<div class="code"><pre>
+%module(directors="1") example
+
+%{
+int binary_op(int a, int b, int (*op)(int, int)) {
+ return op(a, b);
+}
+%}
+</pre></div>
+
+<p>
+The goal is to have a target language function that gets called by <tt>binary_op</tt>.
+The target language function should have the equivalent signature as the C/C++ function pointer <tt>int (*op)(int, int)</tt>.
+As we are using directors, we need a C++ virtual method with this signature, so let's
+define the C++ class and pure virtual method first and make it a director class via the
+director feature:
+</p>
+
+<div class="code"><pre>
+%feature("director") BinaryOp;
+
+%inline %{
+struct BinaryOp {
+ virtual int handle(int a, int b) = 0;
+ virtual ~BinaryOp() {}
+};
+%}
+</pre></div>
+
+<p>
+The following <tt>handler_helper</tt> function and <tt>binary_op_wrapper</tt> function completes the code needed in the
+C++/SWIG layer. The <tt>binary_op_wrapper</tt> function is wrapped by SWIG and is very similar to the <tt>binary_op</tt> function,
+however, it takes a pointer to the director base class <tt>BinaryOp</tt> instead of a C/C++ function pointer.
+</p>
+
+<div class="code"><pre>
+%{
+static BinaryOp *handler_ptr = NULL;
+static int handler_helper(int a, int b) {
+ // Make the call up to the target language when handler_ptr
+ // is an instance of a target language director class
+ return handler_ptr-&gt;handle(a, b);
+}
+// If desired, handler_ptr above could be changed to a thread-local variable in order to make thread-safe
+%}
+
+%inline %{
+int binary_op_wrapper(int a, int b, BinaryOp *handler) {
+ handler_ptr = handler;
+ int result = binary_op(a, b, &amp;handler_helper);
+ handler = NULL;
+ return result;
+}
+%}
+</pre></div>
+
+<p>
+On the target language side, we need to derive a class from <tt>BinaryOp</tt> and override the
+<tt>handle</tt> method. In Python this could be as simple as:
+</p>
+
+<div class="targetlang">
+<pre>
+import example
+
+# PythonBinaryOp class is defined and derived from C++ class BinaryOp
+class PythonBinaryOp(example.BinaryOp):
+
+ # Define Python class 'constructor'
+ def __init__(self):
+ # Call C++ base class constructor
+ example.BinaryOp.__init__(self)
+
+ # Override C++ method: virtual int handle(int a, int b) = 0;
+ def handle(self, a, b):
+ # Return the product
+ return a * b
+</pre>
+</div>
+
+<p>
+For this to work from Python, an instance of the <tt>PythonBinaryOp</tt> class is created
+and then passed to <tt>binary_op_wrapper</tt>. The net result is the <tt>binary_op</tt>
+function will in turn be called which will call <tt>handler_helper</tt> which will call
+the virtual <tt>handle</tt> method, that is, the Python method <tt>handle</tt> in the PythonBinaryOp class. The result will be the product of 10 and 20 and make its way back to Python and hence
+200 will be printed with the following code:
+</p>
+
+<div class="targetlang">
+<pre>
+handler = PythonBinaryOp()
+result = example.binary_op_wrapper(10, 20, handler)
+print result
+</pre>
+</div>
+
+<p>
+This has thus demonstrated a C/C++ function pointer calling back into a target language function.
+The code could be made a little more user friendly by using <tt>%rename</tt> to provide the
+original <tt>binary_op</tt> name from the target language instead of <tt>binary_op_wrapper</tt>.
+A C++ functor base class and Python functor class
+could also be used instead, but these are left as exercises for the reader.
+</p>
+
+<H2><a name="SWIGPlus_nn42">6.30 Where to go for more information</a></H2>
<p>
diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html
index 90bd8bb9a..88ab8043e 100644
--- a/Doc/Manual/Scilab.html
+++ b/Doc/Manual/Scilab.html
@@ -9,7 +9,7 @@
<body bgcolor="#ffffff">
-<H1><a name="Scilab">39 SWIG and Scilab</a></H1>
+<H1><a name="Scilab">35 SWIG and Scilab</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -39,7 +39,7 @@
</ul>
<li><a href="#Scilab_wrapping_pointers">Pointers</a>
<ul>
-<li><a href="#Scilab_wrapping_pointers_pointer_adresses">Utility functions</a>
+<li><a href="#Scilab_wrapping_pointers_utility_functions">Utility functions</a>
<li><a href="#Scilab_wrapping_pointers_null_pointers">Null pointers:</a>
</ul>
<li><a href="#Scilab_wrapping_structs">Structures</a>
@@ -88,11 +88,11 @@ This chapter explains how to use SWIG for Scilab. After this introduction, you s
</p>
-<H2><a name="Scilab_preliminaries">39.1 Preliminaries</a></H2>
+<H2><a name="Scilab_preliminaries">35.1 Preliminaries</a></H2>
<p>
-SWIG for Scilab supports Linux. Other operating sytems haven't been tested.
+SWIG for Scilab supports Linux. Other operating systems haven't been tested.
</p>
<p>
@@ -105,7 +105,7 @@ SWIG for Scilab supports C language. C++ is partially supported. See <a href="#S
</p>
-<H2><a name="Scilab_running_swig">39.2 Running SWIG</a></H2>
+<H2><a name="Scilab_running_swig">35.2 Running SWIG</a></H2>
<p>
@@ -121,15 +121,15 @@ In this example we bind from C a function and a global variable into Scilab. The
double Foo = 3.0;
int fact(int n) {
- if (n &lt; 0) {
- return 0;
- }
- else if (n == 0) {
- return 1;
- }
- else {
- return n * fact(n-1);
- }
+ if (n &lt; 0) {
+ return 0;
+ }
+ else if (n == 0) {
+ return 1;
+ }
+ else {
+ return n * fact(n-1);
+ }
}
%}
</pre></div>
@@ -139,7 +139,7 @@ Note: a code in an <tt>%inline</tt> section is both parsed and wrapped by SWIG,
</p>
-<H3><a name="Scilab_running_swig_generating_module">39.2.1 Generating the module</a></H3>
+<H3><a name="Scilab_running_swig_generating_module">35.2.1 Generating the module</a></H3>
<p>
@@ -182,7 +182,7 @@ The <tt>swig</tt> executable has several other command line options you can use.
</p>
-<H3><a name="Scilab_running_swig_building_module">39.2.2 Building the module</a></H3>
+<H3><a name="Scilab_running_swig_building_module">35.2.2 Building the module</a></H3>
<p>
@@ -202,7 +202,7 @@ $ gcc -shared example_wrap.o -o libexample.so
Note: we supposed in this example that the path to the Scilab include directory is <tt>/usr/local/include/scilab</tt> (which is the case in a Debian environment), this should be changed for another environment.
</p>
-<H3><a name="Scilab_running_swig_loading_module">39.2.3 Loading the module</a></H3>
+<H3><a name="Scilab_running_swig_loading_module">35.2.3 Loading the module</a></H3>
<p>
@@ -226,7 +226,7 @@ Link done.
which means that Scilab has successfully loaded the shared library. The module functions and other symbols are now available in Scilab.
</p>
-<H3><a name="Scilab_running_swig_using_module">39.2.4 Using the module</a></H3>
+<H3><a name="Scilab_running_swig_using_module">35.2.4 Using the module</a></H3>
<p>
@@ -260,7 +260,7 @@ ans =
Note: for conciseness, we assume in the subsequent Scilab code examples that the modules have been beforehand built and loaded in Scilab.
</p>
-<H3><a name="Scilab_running_swig_options">39.2.5 Scilab command line options</a></H3>
+<H3><a name="Scilab_running_swig_options">35.2.5 Scilab command line options</a></H3>
<p>
@@ -304,6 +304,11 @@ The following table lists the Scilab specific command line options in addition t
<td>Generate the gateway XML with the given &lt;gateway_id&gt;</td>
</tr>
+<tr>
+<td><tt>-targetversion</tt></td>
+<td>Generate for Scilab target (major) version</td>
+</tr>
+
</table>
<p>
@@ -315,10 +320,10 @@ $ swig -scilab -help
</pre></div>
-<H2><a name="Scilab_wrapping">39.3 A basic tour of C/C++ wrapping</a></H2>
+<H2><a name="Scilab_wrapping">35.3 A basic tour of C/C++ wrapping</a></H2>
-<H3><a name="Scilab_wrapping_overview">39.3.1 Overview</a></H3>
+<H3><a name="Scilab_wrapping_overview">35.3.1 Overview</a></H3>
<p>
@@ -327,18 +332,22 @@ This means that functions, structs, classes, variables, etc... are interfaced th
There are a few exceptions, such as constants and enumerations, which can be wrapped directly as Scilab variables.
</p>
-<H3><a name="Scilab_wrapping_identifiers">39.3.2 Identifiers</a></H3>
+<H3><a name="Scilab_wrapping_identifiers">35.3.2 Identifiers</a></H3>
<p>
-In Scilab 5.x, identifier names are composed of 24 characters maximum (this limitation should disappear from Scilab 6.0 onwards).
-<br>Thus long function or variable names may be truncated and this can cause ambiguities.
+In Scilab 5.x, identifier names are composed of 24 characters maximum (this limitation disappears from Scilab 6.0 onwards).
+<br>By default, variable, member, and function names longer than 24 characters are truncated, and a warning is produced for each truncation.
</p>
-<p>This happens especially when wrapping structs/classes, for which the wrapped function name is composed of the struct/class name and field names.
+<p>This can cause ambiguities, especially when wrapping structs/classes, for which the wrapped function name is composed of the struct/class name and field names.
In these cases, the <a href="SWIG.html#SWIG_rename_ignore">%rename directive</a> can be used to choose a different Scilab name.
</p>
-<H3><a name="Scilab_wrapping_functions">39.3.3 Functions</a></H3>
+<p>
+Note: truncations can be disabled by specifying the target version 6 of Scilab in the <tt>targetversion</tt> argument (i.e. <tt>-targetversion 6</tt>).
+</p>
+
+<H3><a name="Scilab_wrapping_functions">35.3.3 Functions</a></H3>
<p>
@@ -369,7 +378,7 @@ ans =
24.
</pre></div>
-<H4><a name="Scilab_nn13">39.3.3.1 Argument passing</a></H4>
+<H4><a name="Scilab_nn13">35.3.3.1 Argument passing</a></H4>
<p>
@@ -422,7 +431,7 @@ In Scilab, parameters are passed by value. The output (and inout) parameters are
7.
</pre></div>
-<H4><a name="Scilab_nn14">39.3.3.2 Multiple output arguments</a></H4>
+<H4><a name="Scilab_nn14">35.3.3.2 Multiple output arguments</a></H4>
<p>
@@ -471,7 +480,7 @@ int divide(int n, int d, int *OUTPUT, int *OUTPUT);
</pre></div>
-<H3><a name="Scilab_wrapping_global_variables">39.3.4 Global variables</a></H3>
+<H3><a name="Scilab_wrapping_global_variables">35.3.4 Global variables</a></H3>
<p>
@@ -540,10 +549,10 @@ It works the same:</p>
</pre></div>
-<H3><a name="Scilab_wrapping_constants_and_enums">39.3.5 Constants and enumerations</a></H3>
+<H3><a name="Scilab_wrapping_constants_and_enums">35.3.5 Constants and enumerations</a></H3>
-<H4><a name="Scilab_wrapping_constants">39.3.5.1 Constants</a></H4>
+<H4><a name="Scilab_wrapping_constants">35.3.5.1 Constants</a></H4>
<p>
@@ -684,7 +693,7 @@ are mapped to Scilab variables, with the same name:
3.14
</pre></div>
-<H4><a name="Scilab_wrapping_enums">39.3.5.2 Enumerations</a></H4>
+<H4><a name="Scilab_wrapping_enums">35.3.5.2 Enumerations</a></H4>
<p>
@@ -749,14 +758,14 @@ typedef enum { RED, BLUE, GREEN } color;
</pre></div>
-<H3><a name="Scilab_wrapping_pointers">39.3.6 Pointers</a></H3>
+<H3><a name="Scilab_wrapping_pointers">35.3.6 Pointers</a></H3>
<p>
Pointers are supported by SWIG. A pointer can be returned from a wrapped C/C++ function, stored in a Scilab variable, and used in input argument of another C/C++ function.
</p>
<p>
-Also, thanks to the SWIG runtime which stores informations about types, pointer types are tracked between exchanges Scilab and the native code. Indeed pointer types are stored alongside the pointer adress.
+Also, thanks to the SWIG runtime which stores information about types, pointer types are tracked between exchanges Scilab and the native code. Indeed pointer types are stored alongside the pointer address.
A pointer is mapped to a Scilab structure (<a href="https://help.scilab.org/docs/5.5.2/en_US/tlist.html">tlist</a>), which contains as fields the pointer address and the pointer type (in fact a pointer to the type information structure in the SWIG runtime).
<br>
Why a native pointer is not mapped to a Scilab pointer (type name: "pointer", type ID: 128) ? The big advantage of mapping to a <tt>tlist</tt> is that it exposes a new type for the pointer in Scilab, type which can be acessed in Scilab with the <a href="https://help.scilab.org/docs/5.5.2/en_US/typeof.html">typeof</a> function, and manipulated using the <a href="https://help.scilab.org/docs/5.5.2/en_US/overloading.html">overloading</a> mechanism.
@@ -811,7 +820,7 @@ Note: the type name <tt>_p_FILE</tt> which means "pointer to FILE".
The user of a pointer is responsible for freeing it or, like in the example, closing any resources associated with it (just as is required in a C program).
</p>
-<H4><a name="Scilab_wrapping_pointers_pointer_adresses">39.3.6.1 Utility functions</a></H4>
+<H4><a name="Scilab_wrapping_pointers_utility_functions">35.3.6.1 Utility functions</a></H4>
<p>
@@ -852,7 +861,7 @@ ans =
</pre></div>
-<H4><a name="Scilab_wrapping_pointers_null_pointers">39.3.6.2 Null pointers:</a></H4>
+<H4><a name="Scilab_wrapping_pointers_null_pointers">35.3.6.2 Null pointers:</a></H4>
<p>
@@ -868,7 +877,7 @@ Using the previous <tt>SWIG_this()</tt> and <tt>SWIG_ptr()</tt>, it is possible
</pre></div>
-<H3><a name="Scilab_wrapping_structs">39.3.7 Structures</a></H3>
+<H3><a name="Scilab_wrapping_structs">35.3.7 Structures</a></H3>
<p>
@@ -887,8 +896,8 @@ Let's see it on an example of a struct with two members:
%inline %{
typedef struct {
- int x;
- int arr[4];
+ int x;
+ int arr[4];
} Foo;
%}
@@ -964,7 +973,7 @@ ans =
</pre></div>
<p>
-Note: the pointer to the struct works as described in <a href="Scilab_wrapping_pointers">Pointers</a>. For example, the type of the struct pointer can be get with <tt>typeof</tt>, as following:
+Note: the pointer to the struct works as described in <a href="#Scilab_wrapping_pointers">Pointers</a>. For example, the type of the struct pointer can be get with <tt>typeof</tt>, as following:
</p>
<div class="targetlang"><pre>
@@ -977,7 +986,7 @@ Note: the pointer to the struct works as described in <a href="Scilab_wrapping_p
--&gt; delete_Bar(b);
</pre></div>
-<H3><a name="Scilab_wrapping_cpp_classes">39.3.8 C++ classes</a></H3>
+<H3><a name="Scilab_wrapping_cpp_classes">35.3.8 C++ classes</a></H3>
<p>
@@ -1028,7 +1037,7 @@ ans =
</pre></div>
<p>
-Note: like structs, class pointers are mapped as described in <a href="Scilab_wrapping_pointers">Pointers</a>. Let's give an example which shows that each class pointer type is a new type in Scilab that can be used for example (through <a href="https://help.scilab.org/docs/5.5.2/en_US/overloading.html">overloading</a>) to implement a custom print for the <tt>Point</tt> class:
+Note: like structs, class pointers are mapped as described in <a href="#Scilab_wrapping_pointers">Pointers</a>. Let's give an example which shows that each class pointer type is a new type in Scilab that can be used for example (through <a href="https://help.scilab.org/docs/5.5.2/en_US/overloading.html">overloading</a>) to implement a custom print for the <tt>Point</tt> class:
</p>
<div class="targetlang"><pre>
@@ -1045,7 +1054,7 @@ Note: like structs, class pointers are mapped as described in <a href="Scilab_wr
--&gt; delete_Point(p);
</pre></div>
-<H3><a name="Scilab_wrapping_cpp_inheritance">39.3.9 C++ inheritance</a></H3>
+<H3><a name="Scilab_wrapping_cpp_inheritance">35.3.9 C++ inheritance</a></H3>
<p>
@@ -1120,25 +1129,25 @@ But we can use either use the <tt>get_perimeter()</tt> function of the parent cl
18.84
</pre></div>
-<H3><a name="Scilab_wrapping_cpp_overloading">39.3.10 C++ overloading</a></H3>
+<H3><a name="Scilab_wrapping_cpp_overloading">35.3.10 C++ overloading</a></H3>
<p>
-As explained in <a href="SWIGPlus.html#SWIGPlus_overloaded_methods">6.15</a> SWIG provides support for overloaded functions and constructors.
+As explained in <a href="SWIGPlus.html#SWIGPlus_overloaded_methods">Overloaded functions and methods</a> SWIG provides support for overloaded functions and constructors.
</p>
-<p>As SWIG knows pointer types, the overloading works also with pointer types, here is is an example with a function <tt>magnify</tt> overloaded for the previous classes <tt>Shape</tt> and <tt>Circle</tt>:
+<p>As SWIG knows pointer types, the overloading works also with pointer types, here is an example with a function <tt>magnify</tt> overloaded for the previous classes <tt>Shape</tt> and <tt>Circle</tt>:
</p>
<div class="code"><pre>
%module example
void magnify(Square *square, double factor) {
- square-&gt;size *= factor;
+ square-&gt;size *= factor;
};
void magnify(Circle *circle, double factor) {
- square-&gt;radius *= factor;
+ square-&gt;radius *= factor;
};
</pre></div>
@@ -1160,7 +1169,7 @@ void magnify(Circle *circle, double factor) {
</pre></div>
-<H3><a name="Scilab_wrapping_pointers_references_values_arrays">39.3.11 Pointers, references, values, and arrays</a></H3>
+<H3><a name="Scilab_wrapping_pointers_references_values_arrays">35.3.11 Pointers, references, values, and arrays</a></H3>
<p>
@@ -1218,7 +1227,7 @@ All these functions will return a pointer to an instance of <tt>Foo</tt>.
As the function <tt>spam7</tt> returns a value, new instance of <tt>Foo</tt> has to be allocated, and a pointer on this instance is returned.
</p>
-<H3><a name="Scilab_wrapping_cpp_templates">39.3.12 C++ templates</a></H3>
+<H3><a name="Scilab_wrapping_cpp_templates">35.3.12 C++ templates</a></H3>
<p>
@@ -1277,7 +1286,7 @@ Then in Scilab:
More details on template support can be found in the <a href="SWIGPlus.html#SWIGPlus_nn30">templates</a> documentation.
</p>
-<H3><a name="Scilab_wrapping_cpp_operators">39.3.13 C++ operators</a></H3>
+<H3><a name="Scilab_wrapping_cpp_operators">35.3.13 C++ operators</a></H3>
<p>
@@ -1330,7 +1339,7 @@ private:
</pre></div>
-<H3><a name="Scilab_wrapping_cpp_namespaces">39.3.14 C++ namespaces</a></H3>
+<H3><a name="Scilab_wrapping_cpp_namespaces">35.3.14 C++ namespaces</a></H3>
<p>
@@ -1408,7 +1417,7 @@ Note: the <a href="SWIGPlus.html#SWIGPlus_nspace">nspace</a> feature is not supp
</p>
-<H3><a name="Scilab_wrapping_cpp_exceptions">39.3.15 C++ exceptions</a></H3>
+<H3><a name="Scilab_wrapping_cpp_exceptions">35.3.15 C++ exceptions</a></H3>
<p>
@@ -1432,7 +1441,7 @@ void throw_exception() throw(char const *) {
<div class="targetlang"><pre>
--&gt;throw_exception()
!--error 999
-SWIG/Scilab: Exception (char const *) occured: Bye world !
+SWIG/Scilab: Exception (char const *) occurred: Bye world !
</pre></div>
<p>
@@ -1449,7 +1458,7 @@ It can be used with the <tt>lasterror()</tt> function as following:
--&gt; lasterror()
ans =
- SWIG/Scilab: Exception (char const *) occured: Bye world !
+ SWIG/Scilab: Exception (char const *) occurred: Bye world !
</pre></div>
<p>
@@ -1479,7 +1488,7 @@ void throw_stl_invalid_arg(int i) throw(std::invalid_argument) {
<div class="targetlang"><pre>
--&gt; throw_int();
!--error 999
-SWIG/Scilab: Exception (int) occured: 12
+SWIG/Scilab: Exception (int) occurred: 12
--&gt;throw_stl_invalid_arg(-1);
!--error 999
@@ -1491,17 +1500,17 @@ More complex or custom exception types require specific exception typemaps to be
See the <a href="SWIGPlus.html#SWIGPlus">SWIG C++ documentation</a> for more details.
</p>
-<H3><a name="Scilab_wrapping_cpp_stl">39.3.16 C++ STL</a></H3>
+<H3><a name="Scilab_wrapping_cpp_stl">35.3.16 C++ STL</a></H3>
<p>
The Standard Template Library (STL) is partially supported. See <a href="#Scilab_typemaps_stl">STL</a> for more details.
</p>
-<H2><a name="Scilab_typemaps">39.4 Type mappings and libraries</a></H2>
+<H2><a name="Scilab_typemaps">35.4 Type mappings and libraries</a></H2>
-<H3><a name="Scilab_typemaps_primitive_types">39.4.1 Default primitive type mappings</a></H3>
+<H3><a name="Scilab_typemaps_primitive_types">35.4.1 Default primitive type mappings</a></H3>
<p>
@@ -1552,7 +1561,7 @@ The default behaviour is for SWIG to generate code that will give a runtime erro
-<H3><a name="Scilab_typemaps_arrays">39.4.2 Arrays</a></H3>
+<H3><a name="Scilab_typemaps_arrays">35.4.2 Arrays</a></H3>
<p>
@@ -1607,15 +1616,15 @@ void printArray(int values[], int len) {
[ 0 1 2 3 ]
</pre></div>
-<H3><a name="Scilab_typemaps_pointer-to-pointers">39.4.3 Pointer-to-pointers</a></H3>
+<H3><a name="Scilab_typemaps_pointer-to-pointers">35.4.3 Pointer-to-pointers</a></H3>
<p>
-There are no specific typemaps for pointer-to-pointers, they are are mapped as pointers in Scilab.
+There are no specific typemaps for pointer-to-pointers, they are mapped as pointers in Scilab.
</p>
<p>
-Pointer-to-pointers are sometimes used to implement matrices in C. The following is a an example of this:
+Pointer-to-pointers are sometimes used to implement matrices in C. The following is an example of this:
</p>
@@ -1680,7 +1689,7 @@ void print_matrix(double **M, int nbRows, int nbCols) {
</pre></div>
-<H3><a name="Scilab_typemaps_matrices">39.4.4 Matrices</a></H3>
+<H3><a name="Scilab_typemaps_matrices">35.4.4 Matrices</a></H3>
<p>
@@ -1773,7 +1782,7 @@ The remarks made earlier for arrays also apply here:
<li>There is no control while converting <tt>double</tt> values to integers, <tt>double</tt> values are truncated without any checking or warning.</li>
</ul>
-<H3><a name="Scilab_typemaps_stl">39.4.5 STL</a></H3>
+<H3><a name="Scilab_typemaps_stl">35.4.5 STL</a></H3>
<p>
@@ -1973,7 +1982,7 @@ ans =
--&gt; delete_PersonPtrSet(p);
</pre></div>
-<H2><a name="Scilab_module_initialization">39.5 Module initialization</a></H2>
+<H2><a name="Scilab_module_initialization">35.5 Module initialization</a></H2>
<p>
@@ -1997,7 +2006,7 @@ For example, to initialize the module <tt>example</tt>:
--&gt; example_Init();
</pre></div>
-<H2><a name="Scilab_building_modes">39.6 Building modes</a></H2>
+<H2><a name="Scilab_building_modes">35.6 Building modes</a></H2>
<p>
@@ -2012,7 +2021,7 @@ To produce a dynamic module, when generating the wrapper, there are two possibil
<li>the <tt>builder</tt> mode. In this mode, Scilab is responsible of building.
</ul>
-<H3><a name="Scilab_building_modes_nobuilder_mode">39.6.1 No-builder mode</a></H3>
+<H3><a name="Scilab_building_modes_nobuilder_mode">35.6.1 No-builder mode</a></H3>
<p>
@@ -2025,7 +2034,7 @@ This mode is the best option to use when you have to integrate the module build
</p>
-<H3><a name="Scilab_building_modes_builder_mode">39.6.2 Builder mode</a></H3>
+<H3><a name="Scilab_building_modes_builder_mode">35.6.2 Builder mode</a></H3>
<p>
@@ -2053,7 +2062,7 @@ In this mode, the following SWIG options may be used to setup the build:
Let's give an example how to build a module <tt>example</tt>, composed of two sources, and using a library dependency:
</p>
<ul>
-<li>the sources are <tt>baa1.c</tt> and <tt>baa2.c</tt> (and are stored in in the current directory)</li>
+<li>the sources are <tt>baa1.c</tt> and <tt>baa2.c</tt> (and are stored in the current directory)</li>
<li>the library is <tt>libfoo</tt> in <tt>/opt/foo</tt> (headers stored in <tt>/opt/foo/include</tt>, and shared library in <tt>/opt/foo/lib</tt>)</li>
</ul>
@@ -2065,14 +2074,14 @@ The command is:
$ swig -scilab -builder -buildercflags -I/opt/foo/include -builderldflags "-L/opt/foo/lib -lfoo" -buildersources baa1.cxx, baa2.cxx example.i
</pre></div>
-<H2><a name="Scilab_generated_scripts">39.7 Generated scripts</a></H2>
+<H2><a name="Scilab_generated_scripts">35.7 Generated scripts</a></H2>
<p>
In this part we give some details about the generated Scilab scripts.
</p>
-<H3><a name="Scilab_generated_scripts_builder_script">39.7.1 Builder script</a></H3>
+<H3><a name="Scilab_generated_scripts_builder_script">35.7.1 Builder script</a></H3>
<p>
@@ -2097,7 +2106,7 @@ ilib_build(ilib_name, table, files, libs);
<li><tt><b>table</b></tt>: two column string matrix containing a table of pairs of 'scilab function name', 'C function name'.</li>
</ul>
-<H3><a name="Scilab_generated_scripts_loader_script">39.7.2 Loader script</a></H3>
+<H3><a name="Scilab_generated_scripts_loader_script">35.7.2 Loader script</a></H3>
<p>
@@ -2136,7 +2145,7 @@ clear get_file_path;
</ul>
-<H2><a name="Scilab_other_resources">39.8 Other resources</a></H2>
+<H2><a name="Scilab_other_resources">35.8 Other resources</a></H2>
<ul>
diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html
index 368f306b5..cc5f05e82 100644
--- a/Doc/Manual/Sections.html
+++ b/Doc/Manual/Sections.html
@@ -1,14 +1,14 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-<title>SWIG-3.0 Documentation</title>
+<title>SWIG-4.0 Documentation</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff">
-<H1><a name="Sections">SWIG-3.0 Documentation</a></H1>
+<H1><a name="Sections">SWIG-4.0 Documentation</a></H1>
<p>
-Last update : SWIG-3.0.12 (27 Jan 2017)
+Last update : SWIG-4.0.1 (21 Aug 2019)
</p>
<H2><a name="Sections_Sections">Sections</a></H2>
@@ -22,6 +22,8 @@ Last update : SWIG-3.0.12 (27 Jan 2017)
<li><a href="SWIG.html#SWIG">SWIG Basics</a> (Read this!)</li>
<li><a href="SWIGPlus.html#SWIGPlus">SWIG and C++</a></li>
<li><a href="CPlusPlus11.html#CPlusPlus11">SWIG and C++11</a></li>
+<li><a href="CPlusPlus14.html#CPlusPlus14">SWIG and C++14</a></li>
+<li><a href="CPlusPlus17.html#CPlusPlus17">SWIG and C++17</a></li>
<li><a href="Preprocessor.html#Preprocessor">The SWIG preprocessor</a></li>
<li><a href="Library.html#Library">The SWIG library</a></li>
<li><a href="Arguments.html#Arguments">Argument handling</a></li>
@@ -29,32 +31,26 @@ Last update : SWIG-3.0.12 (27 Jan 2017)
<li><a href="Customization.html#Customization">Customization features</a></li>
<li><a href="Contract.html#Contract">Contracts</a></li>
<li><a href="Varargs.html#Varargs">Variable length arguments</a></li>
+<li><a href="Doxygen.html#Doxygen">Doxygen documentation comments</a></li>
<li><a href="Warnings.html#Warnings">Warning messages</a></li>
<li><a href="Modules.html#Modules">Working with Modules</a></li>
<li><a href="CCache.html#CCache">Using SWIG with ccache</a></li>
</ul>
-<H3><a name="Sections_language_modules">Language Module Documentation</a></H3>
+<H3><a name="Sections_language_modules">Supported Language Modules Documentation</a></H3>
<ul>
-<li><a href="Allegrocl.html#Allegrocl">Allegro Common Lisp support</a></li>
<li><a href="Android.html#Android">Android support</a></li>
<li><a href="CSharp.html#CSharp">C# support</a></li>
-<li><a href="Chicken.html#Chicken">Chicken support</a></li>
<li><a href="D.html#D">D support</a></li>
<li><a href="Go.html#Go">Go support</a></li>
<li><a href="Guile.html#Guile">Guile support</a></li>
<li><a href="Java.html#Java">Java support</a></li>
<li><a href="Javascript.html#Javascript">Javascript support</a></li>
-<li><a href="Lisp.html#Lisp">Common Lisp support</a></li>
<li><a href="Lua.html#Lua">Lua support</a></li>
-<li><a href="Modula3.html#Modula3">Modula3 support</a></li>
-<li><a href="Mzscheme.html#Mzscheme">MzScheme/Racket support</a></li>
-<li><a href="Ocaml.html#Ocaml">Ocaml support</a></li>
<li><a href="Octave.html#Octave">Octave support</a></li>
<li><a href="Perl5.html#Perl5">Perl5 support</a></li>
<li><a href="Php.html#Php">PHP support</a></li>
-<li><a href="Pike.html#Pike">Pike support</a></li>
<li><a href="Python.html#Python">Python support</a></li>
<li><a href="R.html#R">R support</a></li>
<li><a href="Ruby.html#Ruby">Ruby support</a></li>
@@ -62,6 +58,13 @@ Last update : SWIG-3.0.12 (27 Jan 2017)
<li><a href="Tcl.html#Tcl">Tcl support</a></li>
</ul>
+<H3><a name="Sections_experimental_language_modules">Experimental Language Modules Documentation</a></H3>
+
+<ul>
+<li><a href="Mzscheme.html#Mzscheme">MzScheme/Racket support</a></li>
+<li><a href="Ocaml.html#Ocaml">OCaml support</a></li>
+</ul>
+
<H3><a name="Sections_developers_docs">Developer Documentation</a></H3>
<ul>
diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html
index 38d4103e0..ba5ca3852 100644
--- a/Doc/Manual/Tcl.html
+++ b/Doc/Manual/Tcl.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Tcl">40 SWIG and Tcl</a></H1>
+<H1><a name="Tcl">36 SWIG and Tcl</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -84,11 +84,11 @@ Tcl 8.0 or a later release. Earlier releases of SWIG supported Tcl 7.x, but
this is no longer supported.
</p>
-<H2><a name="Tcl_nn2">40.1 Preliminaries</a></H2>
+<H2><a name="Tcl_nn2">36.1 Preliminaries</a></H2>
<p>
-To build a Tcl module, run SWIG using the <tt>-tcl</tt> option :
+To build a Tcl module, run SWIG using the <tt>-tcl</tt> or <tt>-tcl8</tt> option :
</p>
<div class="code"><pre>
@@ -110,7 +110,7 @@ build a Tcl extension module. To finish building the module, you
need to compile this file and link it with the rest of your program.
</p>
-<H3><a name="Tcl_nn3">40.1.1 Getting the right header files</a></H3>
+<H3><a name="Tcl_nn3">36.1.1 Getting the right header files</a></H3>
<p>
@@ -128,7 +128,7 @@ this is the case, you should probably make a symbolic link so that <tt>tcl.h</tt
header file.
</p>
-<H3><a name="Tcl_nn4">40.1.2 Compiling a dynamic module</a></H3>
+<H3><a name="Tcl_nn4">36.1.2 Compiling a dynamic module</a></H3>
<p>
@@ -164,7 +164,7 @@ The name of the module is specified using the <tt>%module</tt> directive or the
<tt>-module</tt> command line option.
</p>
-<H3><a name="Tcl_nn5">40.1.3 Static linking</a></H3>
+<H3><a name="Tcl_nn5">36.1.3 Static linking</a></H3>
<p>
@@ -230,7 +230,7 @@ minimal in most situations (and quite frankly not worth the extra
hassle in the opinion of this author).
</p>
-<H3><a name="Tcl_nn6">40.1.4 Using your module</a></H3>
+<H3><a name="Tcl_nn6">36.1.4 Using your module</a></H3>
<p>
@@ -358,7 +358,7 @@ to the default system configuration (this requires root access and you will need
the man pages).
</p>
-<H3><a name="Tcl_nn7">40.1.5 Compilation of C++ extensions</a></H3>
+<H3><a name="Tcl_nn7">36.1.5 Compilation of C++ extensions</a></H3>
<p>
@@ -441,7 +441,7 @@ erratic program behavior. If working with lots of software components, you
might want to investigate using a more formal standard such as COM.
</p>
-<H3><a name="Tcl_nn8">40.1.6 Compiling for 64-bit platforms</a></H3>
+<H3><a name="Tcl_nn8">36.1.6 Compiling for 64-bit platforms</a></H3>
<p>
@@ -468,7 +468,7 @@ also introduce problems on platforms that support more than one
linking standard (e.g., -o32 and -n32 on Irix).
</p>
-<H3><a name="Tcl_nn9">40.1.7 Setting a package prefix</a></H3>
+<H3><a name="Tcl_nn9">36.1.7 Setting a package prefix</a></H3>
<p>
@@ -487,7 +487,7 @@ option will append the prefix to the name when creating a command and
call it "<tt>Foo_bar</tt>".
</p>
-<H3><a name="Tcl_nn10">40.1.8 Using namespaces</a></H3>
+<H3><a name="Tcl_nn10">36.1.8 Using namespaces</a></H3>
<p>
@@ -509,7 +509,7 @@ When the <tt>-namespace</tt> option is used, objects in the module
are always accessed with the namespace name such as <tt>Foo::bar</tt>.
</p>
-<H2><a name="Tcl_nn11">40.2 Building Tcl/Tk Extensions under Windows 95/NT</a></H2>
+<H2><a name="Tcl_nn11">36.2 Building Tcl/Tk Extensions under Windows 95/NT</a></H2>
<p>
@@ -520,7 +520,7 @@ covers the process of using SWIG with Microsoft Visual C++.
although the procedure may be similar with other compilers.
</p>
-<H3><a name="Tcl_nn12">40.2.1 Running SWIG from Developer Studio</a></H3>
+<H3><a name="Tcl_nn12">36.2.1 Running SWIG from Developer Studio</a></H3>
<p>
@@ -578,7 +578,7 @@ MSDOS &gt; tclsh80
%
</pre></div>
-<H3><a name="Tcl_nn13">40.2.2 Using NMAKE</a></H3>
+<H3><a name="Tcl_nn13">36.2.2 Using NMAKE</a></H3>
<p>
@@ -641,7 +641,7 @@ to get you started. With a little practice, you'll be making lots of
Tcl extensions.
</p>
-<H2><a name="Tcl_nn14">40.3 A tour of basic C/C++ wrapping</a></H2>
+<H2><a name="Tcl_nn14">36.3 A tour of basic C/C++ wrapping</a></H2>
<p>
@@ -652,7 +652,7 @@ classes. This section briefly covers the essential aspects of this
wrapping.
</p>
-<H3><a name="Tcl_nn15">40.3.1 Modules</a></H3>
+<H3><a name="Tcl_nn15">36.3.1 Modules</a></H3>
<p>
@@ -686,7 +686,7 @@ To fix this, supply an extra argument to <tt>load</tt> like this:
</pre>
</div>
-<H3><a name="Tcl_nn16">40.3.2 Functions</a></H3>
+<H3><a name="Tcl_nn16">36.3.2 Functions</a></H3>
<p>
@@ -711,7 +711,7 @@ like you think it does:
%
</pre></div>
-<H3><a name="Tcl_nn17">40.3.3 Global variables</a></H3>
+<H3><a name="Tcl_nn17">36.3.3 Global variables</a></H3>
<p>
@@ -791,7 +791,7 @@ extern char *path; // Read-only (due to %immutable)
</pre>
</div>
-<H3><a name="Tcl_nn18">40.3.4 Constants and enums</a></H3>
+<H3><a name="Tcl_nn18">36.3.4 Constants and enums</a></H3>
<p>
@@ -875,7 +875,7 @@ When an identifier name is given, it is used to perform an implicit hash-table l
conversion. This allows the <tt>global</tt> statement to be omitted.
</p>
-<H3><a name="Tcl_nn19">40.3.5 Pointers</a></H3>
+<H3><a name="Tcl_nn19">36.3.5 Pointers</a></H3>
<p>
@@ -958,7 +958,7 @@ Foo *BarToFoo(Bar *b) {
}
Foo *IncrFoo(Foo *f, int i) {
- return f+i;
+ return f+i;
}
%}
</pre>
@@ -971,7 +971,7 @@ C-style cast may return a bogus result whereas as the C++-style cast will return
<tt>None</tt> if the conversion can't be performed.
</p>
-<H3><a name="Tcl_nn20">40.3.6 Structures</a></H3>
+<H3><a name="Tcl_nn20">36.3.6 Structures</a></H3>
<p>
@@ -1054,7 +1054,7 @@ example, consider this:
<div class="code">
<pre>
struct Bar {
- int x[16];
+ int x[16];
};
</pre>
</div>
@@ -1253,7 +1253,7 @@ Note: Tcl only destroys the underlying object if it has ownership. See the
memory management section that appears shortly.
</p>
-<H3><a name="Tcl_nn21">40.3.7 C++ classes</a></H3>
+<H3><a name="Tcl_nn21">36.3.7 C++ classes</a></H3>
<p>
@@ -1319,7 +1319,7 @@ In Tcl, the static member is accessed as follows:
</pre>
</div>
-<H3><a name="Tcl_nn22">40.3.8 C++ inheritance</a></H3>
+<H3><a name="Tcl_nn22">36.3.8 C++ inheritance</a></H3>
<p>
@@ -1368,7 +1368,7 @@ For instance:
It is safe to use multiple inheritance with SWIG.
</p>
-<H3><a name="Tcl_nn23">40.3.9 Pointers, references, values, and arrays</a></H3>
+<H3><a name="Tcl_nn23">36.3.9 Pointers, references, values, and arrays</a></H3>
<p>
@@ -1422,7 +1422,7 @@ to hold the result and a pointer is returned (Tcl will release this memory
when the return value is garbage collected).
</p>
-<H3><a name="Tcl_nn24">40.3.10 C++ overloaded functions</a></H3>
+<H3><a name="Tcl_nn24">36.3.10 C++ overloaded functions</a></H3>
<p>
@@ -1456,9 +1456,9 @@ Similarly, if you have a class like this,
<pre>
class Foo {
public:
- Foo();
- Foo(const Foo &amp;);
- ...
+ Foo();
+ Foo(const Foo &amp;);
+ ...
};
</pre>
</div>
@@ -1545,7 +1545,7 @@ first declaration takes precedence.
Please refer to the "SWIG and C++" chapter for more information about overloading.
</p>
-<H3><a name="Tcl_nn25">40.3.11 C++ operators</a></H3>
+<H3><a name="Tcl_nn25">36.3.11 C++ operators</a></H3>
<p>
@@ -1647,7 +1647,7 @@ There are ways to make this operator appear as part of the class using the <tt>%
Keep reading.
</p>
-<H3><a name="Tcl_nn26">40.3.12 C++ namespaces</a></H3>
+<H3><a name="Tcl_nn26">36.3.12 C++ namespaces</a></H3>
<p>
@@ -1693,11 +1693,11 @@ For example:
%rename(Bar_spam) Bar::spam;
namespace Foo {
- int spam();
+ int spam();
}
namespace Bar {
- int spam();
+ int spam();
}
</pre>
</div>
@@ -1711,7 +1711,7 @@ utilizes thousands of small deeply nested namespaces each with
identical symbol names, well, then you get what you deserve.
</p>
-<H3><a name="Tcl_nn27">40.3.13 C++ templates</a></H3>
+<H3><a name="Tcl_nn27">36.3.13 C++ templates</a></H3>
<p>
@@ -1763,7 +1763,7 @@ More details can be found in the <a href="SWIGPlus.html#SWIGPlus">SWIG and C++</
examples will appear later.
</p>
-<H3><a name="Tcl_nn28">40.3.14 C++ Smart Pointers</a></H3>
+<H3><a name="Tcl_nn28">36.3.14 C++ Smart Pointers</a></H3>
<p>
@@ -1847,7 +1847,7 @@ simply use the <tt>__deref__()</tt> method. For example:
</pre>
</div>
-<H2><a name="Tcl_nn29">40.4 Further details on the Tcl class interface</a></H2>
+<H2><a name="Tcl_nn29">36.4 Further details on the Tcl class interface</a></H2>
<p>
@@ -1860,7 +1860,7 @@ of low-level details were omitted. This section provides a brief overview
of how the proxy classes work.
</p>
-<H3><a name="Tcl_nn30">40.4.1 Proxy classes</a></H3>
+<H3><a name="Tcl_nn30">36.4.1 Proxy classes</a></H3>
<p>
@@ -1886,19 +1886,19 @@ then SWIG transforms it into a set of low-level procedural wrappers. For example
<div class="code">
<pre>
Foo *new_Foo() {
- return new Foo();
+ return new Foo();
}
void delete_Foo(Foo *f) {
- delete f;
+ delete f;
}
int Foo_x_get(Foo *f) {
- return f-&gt;x;
+ return f-&gt;x;
}
void Foo_x_set(Foo *f, int value) {
- f-&gt;x = value;
+ f-&gt;x = value;
}
int Foo_spam(Foo *f, int arg1) {
- return f-&gt;spam(arg1);
+ return f-&gt;spam(arg1);
}
</pre>
</div>
@@ -1925,7 +1925,7 @@ function. This allows objects to be encapsulated objects that look a lot like
as shown in the last section.
</p>
-<H3><a name="Tcl_nn31">40.4.2 Memory management</a></H3>
+<H3><a name="Tcl_nn31">36.4.2 Memory management</a></H3>
<p>
@@ -1945,8 +1945,8 @@ ownership of the result. For example:
<pre>
class Foo {
public:
- Foo();
- Foo bar();
+ Foo();
+ Foo bar();
};
</pre>
</div>
@@ -1975,9 +1975,9 @@ they came from. Therefore, the ownership is set to zero. For example:
<pre>
class Foo {
public:
- ...
- Foo *spam();
- ...
+ ...
+ Foo *spam();
+ ...
};
</pre>
</div>
@@ -2011,8 +2011,8 @@ or global variable. For example, consider this interface:
%module example
struct Foo {
- int value;
- Foo *next;
+ int value;
+ Foo *next;
};
Foo *head = 0;
@@ -2113,7 +2113,7 @@ typemaps--an advanced topic discussed later.
</p>
-<H2><a name="Tcl_nn32">40.5 Input and output parameters</a></H2>
+<H2><a name="Tcl_nn32">36.5 Input and output parameters</a></H2>
<p>
@@ -2301,7 +2301,7 @@ set c [lindex $dim 1]
</pre>
</div>
-<H2><a name="Tcl_nn33">40.6 Exception handling </a></H2>
+<H2><a name="Tcl_nn33">36.6 Exception handling </a></H2>
<p>
@@ -2435,7 +2435,7 @@ Since SWIG's exception handling is user-definable, you are not limited to C++ ex
See the chapter on "<a href="Customization.html#Customization">Customization Features</a>" for more examples.
</p>
-<H2><a name="Tcl_nn34">40.7 Typemaps</a></H2>
+<H2><a name="Tcl_nn34">36.7 Typemaps</a></H2>
<p>
@@ -2452,7 +2452,7 @@ Typemaps are only used if you want to change some aspect of the primitive
C-Tcl interface.
</p>
-<H3><a name="Tcl_nn35">40.7.1 What is a typemap?</a></H3>
+<H3><a name="Tcl_nn35">36.7.1 What is a typemap?</a></H3>
<p>
@@ -2465,9 +2465,9 @@ you might define a typemap like this:
%module example
%typemap(in) int {
- if (Tcl_GetIntFromObj(interp, $input, &amp;$1) == TCL_ERROR)
- return TCL_ERROR;
- printf("Received an integer : %d\n", $1);
+ if (Tcl_GetIntFromObj(interp, $input, &amp;$1) == TCL_ERROR)
+ return TCL_ERROR;
+ printf("Received an integer : %d\n", $1);
}
%inline %{
extern int fact(int n);
@@ -2572,7 +2572,7 @@ parameter is omitted):
</pre>
</div>
-<H3><a name="Tcl_nn36">40.7.2 Tcl typemaps</a></H3>
+<H3><a name="Tcl_nn36">36.7.2 Tcl typemaps</a></H3>
<p>
@@ -2585,7 +2585,7 @@ like this:
<div class="code">
<pre>
%typemap(out) int {
- Tcl_SetObjResult(interp, Tcl_NewIntObj($1));
+ Tcl_SetObjResult(interp, Tcl_NewIntObj($1));
}
</pre>
</div>
@@ -2710,7 +2710,7 @@ Initialize an argument to a value before any conversions occur.
Examples of these methods will appear shortly.
</p>
-<H3><a name="Tcl_nn37">40.7.3 Typemap variables</a></H3>
+<H3><a name="Tcl_nn37">36.7.3 Typemap variables</a></H3>
<p>
@@ -2781,7 +2781,7 @@ properly assigned.
The Tcl name of the wrapper function being created.
</div>
-<H3><a name="Tcl_nn38">40.7.4 Converting a Tcl list to a char ** </a></H3>
+<H3><a name="Tcl_nn38">36.7.4 Converting a Tcl list to a char ** </a></H3>
<p>
@@ -2843,7 +2843,7 @@ argv[2] = Larry
3
</pre></div>
-<H3><a name="Tcl_nn39">40.7.5 Returning values in arguments</a></H3>
+<H3><a name="Tcl_nn39">36.7.5 Returning values in arguments</a></H3>
<p>
@@ -2885,7 +2885,7 @@ result, a Tcl function using these typemaps will work like this :
%
</pre></div>
-<H3><a name="Tcl_nn40">40.7.6 Useful functions</a></H3>
+<H3><a name="Tcl_nn40">36.7.6 Useful functions</a></H3>
<p>
@@ -2961,7 +2961,7 @@ int Tcl_IsShared(Tcl_Obj *obj);
</pre>
</div>
-<H3><a name="Tcl_nn41">40.7.7 Standard typemaps</a></H3>
+<H3><a name="Tcl_nn41">36.7.7 Standard typemaps</a></H3>
<p>
@@ -3045,7 +3045,7 @@ work)
</pre>
</div>
-<H3><a name="Tcl_nn42">40.7.8 Pointer handling</a></H3>
+<H3><a name="Tcl_nn42">36.7.8 Pointer handling</a></H3>
<p>
@@ -3127,7 +3127,7 @@ For example:
</pre>
</div>
-<H2><a name="Tcl_nn43">40.8 Turning a SWIG module into a Tcl Package.</a></H2>
+<H2><a name="Tcl_nn43">36.8 Turning a SWIG module into a Tcl Package.</a></H2>
<p>
@@ -3199,7 +3199,7 @@ As a final note, most SWIG examples do not yet use the
to use the <tt>load</tt> command instead.
</p>
-<H2><a name="Tcl_nn44">40.9 Building new kinds of Tcl interfaces (in Tcl)</a></H2>
+<H2><a name="Tcl_nn44">36.9 Building new kinds of Tcl interfaces (in Tcl)</a></H2>
<p>
@@ -3215,28 +3215,28 @@ helper functions to access arrays :
%inline %{
double *new_double(int size) {
- return (double *) malloc(size*sizeof(double));
+ return (double *) malloc(size*sizeof(double));
}
void delete_double(double *a) {
- free(a);
+ free(a);
}
double get_double(double *a, int index) {
- return a[index];
+ return a[index];
}
void set_double(double *a, int index, double val) {
- a[index] = val;
+ a[index] = val;
}
int *new_int(int size) {
- return (int *) malloc(size*sizeof(int));
+ return (int *) malloc(size*sizeof(int));
}
void delete_int(int *a) {
- free(a);
+ free(a);
}
int get_int(int *a, int index) {
- return a[index];
+ return a[index];
}
int set_int(int *a, int index, int val) {
- a[index] = val;
+ a[index] = val;
}
%}
@@ -3298,7 +3298,7 @@ danger of blowing something up (although it is easily accomplished
with an out of bounds array access).
</p>
-<H3><a name="Tcl_nn45">40.9.1 Proxy classes</a></H3>
+<H3><a name="Tcl_nn45">36.9.1 Proxy classes</a></H3>
<p>
@@ -3419,7 +3419,7 @@ short, but clever Tcl script can be combined with SWIG to do many
interesting things.
</p>
-<H2><a name="Tcl_nn46">40.10 Tcl/Tk Stubs</a></H2>
+<H2><a name="Tcl_nn46">36.10 Tcl/Tk Stubs</a></H2>
<p>
diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html
index a3a3e09cb..0bacd39f5 100644
--- a/Doc/Manual/Typemaps.html
+++ b/Doc/Manual/Typemaps.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Typemaps">11 Typemaps</a></H1>
+<H1><a name="Typemaps">13 Typemaps</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -67,7 +67,7 @@
<li><a href="#Typemaps_nn35">"memberin" typemap</a>
<li><a href="#Typemaps_nn36">"varin" typemap</a>
<li><a href="#Typemaps_nn37">"varout" typemap</a>
-<li><a href="#throws_typemap">"throws" typemap</a>
+<li><a href="#Typemaps_throws_typemap">"throws" typemap</a>
</ul>
<li><a href="#Typemaps_nn39">Some typemap examples</a>
<ul>
@@ -89,6 +89,9 @@
<li><a href="#Typemaps_runtime_type_checker_usage">Usage</a>
</ul>
<li><a href="#Typemaps_overloading">Typemaps and overloading</a>
+<ul>
+<li><a href="#Typemaps_typecheck_pointer">SWIG_TYPECHECK_POINTER precedence level and the typecheck typemap</a>
+</ul>
<li><a href="#Typemaps_nn48">More about %apply and %clear</a>
<li><a href="#Typemaps_nn47">Passing data between typemaps</a>
<li><a href="#Typemaps_nn52">C++ "this" pointer</a>
@@ -99,7 +102,7 @@
-<H2><a name="Typemaps_nn2">11.1 Introduction</a></H2>
+<H2><a name="Typemaps_nn2">13.1 Introduction</a></H2>
<p>
@@ -116,7 +119,7 @@ to re-read the earlier chapters if you have found your way to this
chapter with only a vague idea of what SWIG already does by default.
</p>
-<H3><a name="Typemaps_nn3">11.1.1 Type conversion</a></H3>
+<H3><a name="Typemaps_nn3">13.1.1 Type conversion</a></H3>
<p>
@@ -209,7 +212,7 @@ to read the extension documentation for your favorite language to know
how it works (an exercise left to the reader).
</p>
-<H3><a name="Typemaps_nn4">11.1.2 Typemaps</a></H3>
+<H3><a name="Typemaps_nn4">13.1.2 Typemaps</a></H3>
<p>
@@ -310,7 +313,7 @@ parts of the generated wrapper functions. Because arbitrary code can be insert
possible to completely change the way in which values are converted.
</p>
-<H3><a name="Typemaps_nn5">11.1.3 Pattern matching</a></H3>
+<H3><a name="Typemaps_nn5">13.1.3 Pattern matching</a></H3>
<p>
@@ -361,7 +364,7 @@ int spam(<b>foo::Number</b> a, <b>foo::Number</b> b);
<p>
In this case, the typemap is still applied to the proper arguments even though typenames don't always
match the text "int". This ability to track types is a critical part of SWIG--in fact, all
-of the target language modules work merely define a set of typemaps for the basic types. Yet, it
+of the target language modules work merely define a family of typemaps for the basic types. Yet, it
is never necessary to write new typemaps for typenames introduced by <tt>typedef</tt>.
</p>
@@ -412,7 +415,7 @@ In this case, a single input object is expanded into a pair of C arguments. Thi
provides a hint to the unusual variable naming scheme involving <tt>$1</tt>, <tt>$2</tt>, and so forth.
</p>
-<H3><a name="Typemaps_nn6">11.1.4 Reusing typemaps</a></H3>
+<H3><a name="Typemaps_nn6">13.1.4 Reusing typemaps</a></H3>
<p>
@@ -428,7 +431,8 @@ be copied and reused. One way to do this is to use assignment like this:
</div>
<p>
-A more general form of copying is found in the <tt>%apply</tt> directive like this:
+There is a more powerful way to copy a family of typemaps though.
+Consider the following family of two typemap methods, "in" and "out" for type <tt>int</tt>:
</p>
<div class="code">
@@ -441,8 +445,29 @@ A more general form of copying is found in the <tt>%apply</tt> directive like th
/* Return an integer value */
...
}
+</pre>
+</div>
+
+<p>
+Each of the two typemap methods could be copied individually for type <tt>size_t</tt> as follows:
+</p>
+
+<div class="code">
+<pre>
+/* Apply all of the int typemaps to size_t */
+%typemap(in) size_t = int;
+%typemap(out) size_t = int;
+</pre>
+</div>
-/* Apply all of the integer typemaps to size_t */
+<p>
+A more powerful form of copying is available from the <tt>%apply</tt> directive.
+The code below is identical to the above:
+</p>
+
+<div class="code">
+<pre>
+/* Apply all of the int typemaps to size_t */
%apply int { size_t };
</pre>
</div>
@@ -468,7 +493,7 @@ typedef int size_t;
then SWIG already knows that the <tt>int</tt> typemaps apply. You don't have to do anything.
</p>
-<H3><a name="Typemaps_nn7">11.1.5 What can be done with typemaps?</a></H3>
+<H3><a name="Typemaps_nn7">13.1.5 What can be done with typemaps?</a></H3>
<p>
@@ -580,7 +605,7 @@ typemaps that expand upon this list. For example, the Java module defines a var
aspects of the Java bindings. Consult language specific documentation for further details.
</p>
-<H3><a name="Typemaps_nn8">11.1.6 What can't be done with typemaps?</a></H3>
+<H3><a name="Typemaps_nn8">13.1.6 What can't be done with typemaps?</a></H3>
<p>
@@ -643,12 +668,12 @@ void wrap_foo(char *s, int x) {
</pre>
</div>
-<H3><a name="Typemaps_aspects">11.1.7 Similarities to Aspect Oriented Programming</a></H3>
+<H3><a name="Typemaps_aspects">13.1.7 Similarities to Aspect Oriented Programming</a></H3>
<p>
-SWIG has parallels to <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">Aspect Oriented Software Development (AOP)</a>.
-The <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming#Terminology">AOP terminology</a> with respect to SWIG typemaps can be viewed as follows:
+SWIG has parallels to <a href="https://en.wikipedia.org/wiki/Aspect-oriented_programming">Aspect Oriented Software Development (AOP)</a>.
+The <a href="https://en.wikipedia.org/wiki/Aspect-oriented_programming#Terminology">AOP terminology</a> with respect to SWIG typemaps can be viewed as follows:
</p>
<ul>
<li> <b>Cross-cutting concerns</b>: The cross-cutting concerns are the modularization of the functionality that the typemaps implement, which is primarily marshalling of types from/to the target language and C/C++.
@@ -661,7 +686,7 @@ SWIG can also be viewed as has having a second set of aspects based around <a hr
Features such as <tt>%exception</tt> are also cross-cutting concerns as they encapsulate code that can be used to add logging or exception handling to any function.
</p>
-<H3><a name="Typemaps_nn9">11.1.8 The rest of this chapter</a></H3>
+<H3><a name="Typemaps_nn9">13.1.8 The rest of this chapter</a></H3>
<p>
@@ -681,14 +706,14 @@ of "The C Programming Language" by Kernighan and Ritchie or
"The C++ Programming Language" by Stroustrup before going any further.
</p>
-<H2><a name="Typemaps_nn10">11.2 Typemap specifications</a></H2>
+<H2><a name="Typemaps_nn10">13.2 Typemap specifications</a></H2>
<p>
This section describes the behavior of the <tt>%typemap</tt> directive itself.
</p>
-<H3><a name="Typemaps_defining">11.2.1 Defining a typemap</a></H3>
+<H3><a name="Typemaps_defining">13.2.1 Defining a typemap</a></H3>
<p>
@@ -801,7 +826,7 @@ Admittedly, it's not the most readable syntax at first glance. However, the pur
individual pieces will become clear.
</p>
-<H3><a name="Typemaps_nn12">11.2.2 Typemap scope</a></H3>
+<H3><a name="Typemaps_nn12">13.2.2 Typemap scope</a></H3>
<p>
@@ -851,7 +876,7 @@ class Foo {
</pre>
</div>
-<H3><a name="Typemaps_nn13">11.2.3 Copying a typemap</a></H3>
+<H3><a name="Typemaps_nn13">13.2.3 Copying a typemap</a></H3>
<p>
@@ -909,40 +934,41 @@ The patterns for <tt>%apply</tt> follow the same rules as for <tt>%typemap</tt>.
</pre>
</div>
-<H3><a name="Typemaps_nn14">11.2.4 Deleting a typemap</a></H3>
+<H3><a name="Typemaps_nn14">13.2.4 Deleting a typemap</a></H3>
<p>
-A typemap can be deleted by simply defining no code. For example:
+A particular typemap can be deleted / cleared by simply defining no code. For example:
</p>
<div class="code">
<pre>
-%typemap(in) int; // Clears typemap for int
-%typemap(in) int, long, short; // Clears typemap for int, long, short
+%typemap(in) int; // Clears the "in" typemap for int
+%typemap(in) int, long, short; // Clears the "in" typemap for int, long, short
%typemap(in) int *output;
</pre>
</div>
<p>
-The <tt>%clear</tt> directive clears all typemaps for a given type.
+The above syntax deletes a typemap for just one typemap method - the "in" method in each of the examples above.
+The <tt>%clear</tt> directive is more powerful and will delete / clear a family of typemaps, that is, all the typemap methods for a given type.
For example:
</p>
<div class="code">
<pre>
-%clear int; // Removes all types for int
+%clear int; // Delete all typemaps ("in", "out", "varin", ...) for int
%clear int *output, long *output;
</pre>
</div>
<p>
<b>Note:</b> Since SWIG's default behavior is defined by typemaps, clearing a fundamental type like
-<tt>int</tt> will make that type unusable unless you also define a new set of typemaps immediately
+<tt>int</tt> will make that type unusable unless you also define a new family of typemaps immediately
after the clear operation.
</p>
-<H3><a name="Typemaps_nn15">11.2.5 Placement of typemaps</a></H3>
+<H3><a name="Typemaps_nn15">13.2.5 Placement of typemaps</a></H3>
<p>
@@ -1022,7 +1048,7 @@ It should be noted that for scoping to work, SWIG has to know that <tt>string</t
within a particular namespace. In this example, this is done using the forward class declaration <tt>class string</tt>.
</p>
-<H2><a name="Typemaps_pattern_matching">11.3 Pattern matching rules</a></H2>
+<H2><a name="Typemaps_pattern_matching">13.3 Pattern matching rules</a></H2>
<p>
@@ -1030,7 +1056,7 @@ The section describes the pattern matching rules by which C/C++ datatypes are as
The matching rules can be observed in practice by using the debugging options also described.
</p>
-<H3><a name="Typemaps_nn17">11.3.1 Basic matching rules</a></H3>
+<H3><a name="Typemaps_nn17">13.3.1 Basic matching rules</a></H3>
<p>
@@ -1129,7 +1155,7 @@ void F(int x[1000]); // int [ANY] rule (typemap 5)
stripped all qualifiers in one step.
</p>
-<H3><a name="Typemaps_typedef_reductions">11.3.2 Typedef reductions matching</a></H3>
+<H3><a name="Typemaps_typedef_reductions">13.3.2 Typedef reductions matching</a></H3>
<p>
@@ -1304,7 +1330,7 @@ void go(Struct aStruct);
</pre>
</div>
-<H3><a name="Typemaps_nn19">11.3.3 Default typemap matching rules</a></H3>
+<H3><a name="Typemaps_nn19">13.3.3 Default typemap matching rules</a></H3>
<p>
@@ -1357,7 +1383,7 @@ Below is a list of the typical default types supplied by language modules, showi
%typemap(in) SWIGTYPE * { ... default pointer handling ... };
%typemap(in) SWIGTYPE *const { ... default pointer const handling ... };
%typemap(in) SWIGTYPE *const&amp; { ... default pointer const reference handling ... };
-%typemap(in) SWIGTYPE[ANY] { ... 1D fixed size arrays handlling ... };
+%typemap(in) SWIGTYPE[ANY] { ... 1D fixed size arrays handling ... };
%typemap(in) SWIGTYPE [] { ... unknown sized array handling ... };
%typemap(in) enum SWIGTYPE { ... default handling for enum values ... };
%typemap(in) const enum SWIGTYPE &amp; { ... default handling for const enum reference values ... };
@@ -1442,7 +1468,7 @@ Finally the best way to view the typemap matching rules in action is via the <a
simpler scheme to match the current C++ class template partial specialization matching rules.
</p>
-<H3><a name="Typemaps_multi_argument_typemaps_patterns">11.3.4 Multi-arguments typemaps</a></H3>
+<H3><a name="Typemaps_multi_argument_typemaps_patterns">13.3.4 Multi-arguments typemaps</a></H3>
<p>
@@ -1472,7 +1498,7 @@ but all subsequent arguments must match exactly.
</p>
-<H3><a name="Typemaps_matching_template_comparison">11.3.5 Matching rules compared to C++ templates</a></H3>
+<H3><a name="Typemaps_matching_template_comparison">13.3.5 Matching rules compared to C++ templates</a></H3>
<p>
@@ -1631,7 +1657,7 @@ are similar to those for specialized template handling.
</p>
-<H3><a name="Typemaps_debugging_search">11.3.6 Debugging typemap pattern matching</a></H3>
+<H3><a name="Typemaps_debugging_search">13.3.6 Debugging typemap pattern matching</a></H3>
<p>
@@ -1844,7 +1870,7 @@ Also the types may be displayed slightly differently - <tt>char const *</tt> and
</li>
</ul>
-<H2><a name="Typemaps_nn21">11.4 Code generation rules</a></H2>
+<H2><a name="Typemaps_nn21">13.4 Code generation rules</a></H2>
<p>
@@ -1852,7 +1878,7 @@ This section describes rules by which typemap code is inserted into
the generated wrapper code.
</p>
-<H3><a name="Typemaps_nn22">11.4.1 Scope</a></H3>
+<H3><a name="Typemaps_nn22">13.4.1 Scope</a></H3>
<p>
@@ -1930,7 +1956,7 @@ a block scope when it is emitted. This sometimes results in a less complicated
Note that only the third of the three typemaps have the typemap code passed through the SWIG preprocessor.
</p>
-<H3><a name="Typemaps_nn23">11.4.2 Declaring new local variables</a></H3>
+<H3><a name="Typemaps_nn23">13.4.2 Declaring new local variables</a></H3>
<p>
@@ -2097,7 +2123,7 @@ each type must have its own local variable declaration.
</div>
-<H3><a name="Typemaps_special_variables">11.4.3 Special variables</a></H3>
+<H3><a name="Typemaps_special_variables">13.4.3 Special variables</a></H3>
<p>
@@ -2349,7 +2375,7 @@ Another approach, which only works for arrays is to use the <tt>$1_basetype</tt>
</pre>
</div>
-<H3><a name="Typemaps_special_variable_macros">11.4.4 Special variable macros</a></H3>
+<H3><a name="Typemaps_special_variable_macros">13.4.4 Special variable macros</a></H3>
<p>
@@ -2361,7 +2387,7 @@ it is done during the SWIG parsing/compilation stages.
The following special variable macros are available across all language modules.
</p>
-<H4><a name="Typemaps_special_macro_descriptor">11.4.4.1 $descriptor(type)</a></H4>
+<H4><a name="Typemaps_special_macro_descriptor">13.4.4.1 $descriptor(type)</a></H4>
<p>
@@ -2372,7 +2398,7 @@ For example, <tt>$descriptor(std::vector&lt;int&gt; *)</tt> will expand into <tt
This macro is mostly used in the scripting target languages and is demonstrated later in the <a href="#Typemaps_runtime_type_checker_usage">Run-time type checker usage</a> section.
</p>
-<H4><a name="Typemaps_special_macro_typemap">11.4.4.2 $typemap(method, typepattern)</a></H4>
+<H4><a name="Typemaps_special_macro_typemap">13.4.4.2 $typemap(method, typepattern)</a></H4>
<p>
@@ -2430,7 +2456,7 @@ The result is the following expansion
</div>
-<H3><a name="Typemaps_special_variable_attributes">11.4.5 Special variables and typemap attributes</a></H3>
+<H3><a name="Typemaps_special_variable_attributes">13.4.5 Special variables and typemap attributes</a></H3>
<p>
@@ -2457,7 +2483,7 @@ is equivalent to the following as <tt>$*1_ltype</tt> expands to <tt>unsigned int
</pre>
</div>
-<H3><a name="Typemaps_special_variables_and_macros">11.4.6 Special variables combined with special variable macros</a></H3>
+<H3><a name="Typemaps_special_variables_and_macros">13.4.6 Special variables combined with special variable macros</a></H3>
<p>
@@ -2499,15 +2525,15 @@ which then expands to:
</div>
-<H2><a name="Typemaps_nn25">11.5 Common typemap methods</a></H2>
+<H2><a name="Typemaps_nn25">13.5 Common typemap methods</a></H2>
<p>
-The set of typemaps recognized by a language module may vary. However,
+The family of typemaps recognized by a language module may vary. However,
the following typemap methods are nearly universal:
</p>
-<H3><a name="Typemaps_nn26">11.5.1 "in" typemap</a></H3>
+<H3><a name="Typemaps_nn26">13.5.1 "in" typemap</a></H3>
<p>
@@ -2567,7 +2593,7 @@ Usually <tt>numinputs</tt> is not specified, whereupon the default value is 1, t
is the same as the old "ignore" typemap.
</p>
-<H3><a name="Typemaps_nn27">11.5.2 "typecheck" typemap</a></H3>
+<H3><a name="Typemaps_nn27">13.5.2 "typecheck" typemap</a></H3>
<p>
@@ -2594,7 +2620,7 @@ If you define new "in" typemaps <em>and</em> your program uses overloaded method
"typecheck" typemaps. More details about this follow in the <a href="#Typemaps_overloading">Typemaps and overloading</a> section.
</p>
-<H3><a name="Typemaps_nn28">11.5.3 "out" typemap</a></H3>
+<H3><a name="Typemaps_nn28">13.5.3 "out" typemap</a></H3>
<p>
@@ -2625,7 +2651,7 @@ $symname - Name of function/method being wrapped
The "out" typemap supports an optional attribute flag called "optimal". This is for code optimisation and is detailed in the <a href="#Typemaps_optimal">Optimal code generation when returning by value</a> section.
</p>
-<H3><a name="Typemaps_nn29">11.5.4 "arginit" typemap</a></H3>
+<H3><a name="Typemaps_nn29">13.5.4 "arginit" typemap</a></H3>
<p>
@@ -2644,7 +2670,7 @@ For example:
</pre>
</div>
-<H3><a name="Typemaps_nn30">11.5.5 "default" typemap</a></H3>
+<H3><a name="Typemaps_nn30">13.5.5 "default" typemap</a></H3>
<p>
@@ -2677,7 +2703,7 @@ See the <a href="SWIG.html#SWIG_default_args">Default/optional arguments</a> sec
for further information on default argument wrapping.
</p>
-<H3><a name="Typemaps_nn31">11.5.6 "check" typemap</a></H3>
+<H3><a name="Typemaps_nn31">13.5.6 "check" typemap</a></H3>
<p>
@@ -2696,7 +2722,7 @@ converted. For example:
</pre>
</div>
-<H3><a name="Typemaps_nn32">11.5.7 "argout" typemap</a></H3>
+<H3><a name="Typemaps_nn32">13.5.7 "argout" typemap</a></H3>
<p>
@@ -2742,7 +2768,7 @@ return values are often appended to return value of the function.
See the <tt>typemaps.i</tt> library file for examples.
</p>
-<H3><a name="Typemaps_nn33">11.5.8 "freearg" typemap</a></H3>
+<H3><a name="Typemaps_nn33">13.5.8 "freearg" typemap</a></H3>
<p>
@@ -2775,7 +2801,7 @@ be used in other typemaps whenever a wrapper function needs to abort
prematurely.
</p>
-<H3><a name="Typemaps_nn34">11.5.9 "newfree" typemap</a></H3>
+<H3><a name="Typemaps_nn34">13.5.9 "newfree" typemap</a></H3>
<p>
@@ -2804,7 +2830,7 @@ string *foo();
See <a href="Customization.html#Customization_ownership">Object ownership and %newobject</a> for further details.
</p>
-<H3><a name="Typemaps_ret">11.5.10 "ret" typemap</a></H3>
+<H3><a name="Typemaps_ret">13.5.10 "ret" typemap</a></H3>
<p>
@@ -2843,7 +2869,7 @@ This approach is an alternative to using the "newfree" typemap and <tt>%newobjec
is no need to list all the functions that require the memory cleanup, it is purely done on types.
</p>
-<H3><a name="Typemaps_nn35">11.5.11 "memberin" typemap</a></H3>
+<H3><a name="Typemaps_nn35">13.5.11 "memberin" typemap</a></H3>
<p>
@@ -2865,7 +2891,7 @@ It is rarely necessary to write "memberin" typemaps---SWIG already provides
a default implementation for arrays, strings, and other objects.
</p>
-<H3><a name="Typemaps_nn36">11.5.12 "varin" typemap</a></H3>
+<H3><a name="Typemaps_nn36">13.5.12 "varin" typemap</a></H3>
<p>
@@ -2873,7 +2899,7 @@ The "varin" typemap is used to convert objects in the target language to C for t
purposes of assigning to a C/C++ global variable. This is implementation specific.
</p>
-<H3><a name="Typemaps_nn37">11.5.13 "varout" typemap</a></H3>
+<H3><a name="Typemaps_nn37">13.5.13 "varout" typemap</a></H3>
<p>
@@ -2881,11 +2907,11 @@ The "varout" typemap is used to convert a C/C++ object to an object in the targe
language when reading a C/C++ global variable. This is implementation specific.
</p>
-<H3><a name="throws_typemap">11.5.14 "throws" typemap</a></H3>
+<H3><a name="Typemaps_throws_typemap">13.5.14 "throws" typemap</a></H3>
<p>
-The "throws" typemap is only used when SWIG parses a C++ method with an exception specification or has the <tt>%catches</tt> feature attached to the method.
+The "throws" typemap is only used when SWIG parses a C++ method with an exception specification or has the <tt>%catches</tt> feature attached to the method (see <a href="SWIGPlus.html#SWIGPlus_catches">Exception handling with %catches</a>).
It provides a default mechanism for handling C++ methods that have declared the exceptions they will throw.
The purpose of this typemap is to convert a C++ exception into an error or exception in the target language.
It is slightly different to the other typemaps as it is based around the exception type rather than the type of a parameter or variable.
@@ -2898,13 +2924,19 @@ For example:
PyErr_SetString(PyExc_RuntimeError, $1);
SWIG_fail;
%}
-void bar() throw (const char *);
+
+// Either an exception specification on the method
+ void bar() throw (const char *);
+
+// Or a %catches feature attached to the method
+ %catches(const char *) bar();
+ void bar();
</pre>
</div>
<p>
-As can be seen from the generated code below, SWIG generates an exception handler
-with the catch block comprising the "throws" typemap content.
+As can be seen from the resulting generated code below, SWIG generates an exception handler
+when wrapping the <tt>bar</tt> function with the catch block comprising the "throws" typemap content.
</p>
<div class="code">
@@ -2912,8 +2944,7 @@ with the catch block comprising the "throws" typemap content.
...
try {
bar();
-}
-catch(char const *_e) {
+} catch(char const *_e) {
PyErr_SetString(PyExc_RuntimeError, _e);
SWIG_fail;
}
@@ -2922,11 +2953,11 @@ catch(char const *_e) {
</div>
<p>
-Note that if your methods do not have an exception specification yet they do throw exceptions, SWIG cannot know how to deal with them.
-For a neat way to handle these, see the <a href="Customization.html#Customization_exception">Exception handling with %exception</a> section.
+Note that if your methods do not have an exception specification but they do throw exceptions and you are not using <tt>%catches</tt>, SWIG cannot know how to deal with them.
+Please also see the <a href="Customization.html#Customization_exception">Exception handling with %exception</a> section for another way to handle exceptions.
</p>
-<H2><a name="Typemaps_nn39">11.6 Some typemap examples</a></H2>
+<H2><a name="Typemaps_nn39">13.6 Some typemap examples</a></H2>
<p>
@@ -2934,7 +2965,7 @@ This section contains a few examples. Consult language module documentation
for more examples.
</p>
-<H3><a name="Typemaps_nn40">11.6.1 Typemaps for arrays</a></H3>
+<H3><a name="Typemaps_nn40">13.6.1 Typemaps for arrays</a></H3>
<p>
@@ -3193,7 +3224,7 @@ Now, you will find that member access is quite nice:
useless and has since been eliminated. To return structure members, simply use the "out" typemap.
</p>
-<H3><a name="Typemaps_nn41">11.6.2 Implementing constraints with typemaps</a></H3>
+<H3><a name="Typemaps_nn41">13.6.2 Implementing constraints with typemaps</a></H3>
<p>
@@ -3241,7 +3272,7 @@ a NULL pointer. As a result, SWIG can often prevent a potential
segmentation faults or other run-time problems by raising an exception
rather than blindly passing values to the underlying C/C++ program.</p>
-<H2><a name="Typemaps_nn43">11.7 Typemaps for multiple target languages</a></H2>
+<H2><a name="Typemaps_nn43">13.7 Typemaps for multiple target languages</a></H2>
<p>
@@ -3271,12 +3302,12 @@ The example above also shows a common approach of issuing a warning for an as ye
<tt>%typemap(ruby, in) int "$1 = NUM2INT($input);"</tt>.
</p>
-<H2><a name="Typemaps_optimal">11.8 Optimal code generation when returning by value</a></H2>
+<H2><a name="Typemaps_optimal">13.8 Optimal code generation when returning by value</a></H2>
<p>
The "out" typemap is the main typemap for return types.
-This typemap supports an optional attribute flag called "optimal", which is for reducing
+This typemap supports an optional attribute flag called "optimal", which is for reducing the number of
temporary variables and the amount of generated code, thereby giving the compiler the opportunity to
use <i>return value optimization</i> for generating faster executing code.
It only really makes a difference when returning objects by value and has some limitations on usage,
@@ -3460,7 +3491,7 @@ example.i:7: Warning 475: optimal attribute usage in the out typemap.
However, it doesn't always get it right, for example when <tt>$1</tt> is within some commented out code.
</p>
-<H2><a name="Typemaps_multi_argument_typemaps">11.9 Multi-argument typemaps</a></H2>
+<H2><a name="Typemaps_multi_argument_typemaps">13.9 Multi-argument typemaps</a></H2>
<p>
@@ -3737,7 +3768,7 @@ with non-consecutive C/C++ arguments; a workaround such as a helper function re-
the arguments to make them consecutive will need to be written.
</p>
-<H2><a name="Typemaps_warnings">11.10 Typemap warnings</a></H2>
+<H2><a name="Typemaps_warnings">13.10 Typemap warnings</a></H2>
<p>
@@ -3746,7 +3777,7 @@ See the information in the <a href="Warnings.html#Warnings_nn5">issuing warnings
</p>
-<H2><a name="Typemaps_fragments">11.11 Typemap fragments</a></H2>
+<H2><a name="Typemaps_fragments">13.11 Typemap fragments</a></H2>
<p>
@@ -3904,9 +3935,9 @@ A fragment can use one or more additional fragments, for example:
<div class="code">
<pre>
-%fragment("&lt;limits.h&gt;", "header") {
- %#include &lt;limits.h&gt;
-}
+%fragment("&lt;limits.h&gt;", "header") %{
+ #include &lt;limits.h&gt;
+%}
%fragment("AsMyClass", "header", fragment="&lt;limits.h&gt;") {
@@ -3989,8 +4020,91 @@ Finally, you can force the inclusion of a fragment at any point in the generated
</div>
<p>
-which is very useful inside a template class, for example.
+which, for example, is very useful inside a template class.
+Another useful case is when using <tt>%extend</tt> inside a class
+where the additional code in the <tt>%extend</tt> block depends on the contents of the fragment.
+</p>
+
+<div class="code">
+<pre>
+%fragment("&lt;limits.h&gt;", "header") %{
+ #include &lt;limits.h&gt;
+%}
+
+struct X {
+ ...
+ %extend {
+ %fragment("&lt;limits.h&gt;");
+ bool check(short val) {
+ if (val &lt; SHRT_MIN /*defined in &lt;limits.h&gt;*/) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+};
+</pre>
+</div>
+
+
+<p>
+Forced inclusion of fragments can be used as a replacement for <a href="SWIG.html#SWIG_nn42">code insertion block</a>, ensuring the
+code block is only generated once.
+Consider the contents of FileA.i below which first uses a code insertion block and then a forced fragment inclusion to generate code:
+</p>
+<div class="code">
+<pre>
+// FileA.i
+%{
+ #include &lt;stdio.h&gt;
+%}
+%fragment("&lt;limits.h&gt;");
+</pre>
+</div>
+
+<p>
+and another file including the above:
+</p>
+
+<div class="code">
+<pre>
+// FileB.i
+%include "FileA.i"
+</pre>
+</div>
+
+<p>
+The resulting code in the wrappers for FileB.i is:
+</p>
+
+<div class="code">
+<pre>
+ #include &lt;stdio.h&gt;
+
+ #include &lt;limits.h&gt;
+</pre>
+</div>
+
+<p>
+A note of caution must be mentioned when using <tt>%fragment</tt> forced inclusion or code insertion blocks with <tt>%import</tt>.
+If <tt>%import</tt> is used instead:
+</p>
+
+<div class="code">
+<pre>
+// FileC.i
+%import "FileA.i"
+</pre>
+</div>
+
+<p>
+then nothing is generated in the resulting code in the wrappers for FileC.i.
+This is because <tt>%import</tt> is for collecting type information and does not result in any code
+being generated, see <a href="Preprocessor.html#Preprocessor_nn3">File Imports</a>.
</p>
+
+
</ol>
<p>
@@ -3999,7 +4113,7 @@ fragment usage unless a desire to really get to grips
with some powerful but tricky macro and fragment usage that is used in parts of the SWIG typemap library.
</p>
-<H3><a name="Typemaps_fragment_type_specialization">11.11.1 Fragment type specialization</a></H3>
+<H3><a name="Typemaps_fragment_type_specialization">13.11.1 Fragment type specialization</a></H3>
<p>
@@ -4032,7 +4146,7 @@ struct A {
</pre>
</div>
-<H3><a name="Typemaps_automatic_specialization">11.11.2 Fragments and automatic typemap specialization</a></H3>
+<H3><a name="Typemaps_automatic_specialization">13.11.2 Fragments and automatic typemap specialization</a></H3>
<p>
@@ -4078,7 +4192,7 @@ The interested (or very brave) reader can take a look at the fragments.swg file
</p>
-<H2><a name="Typemaps_runtime_type_checker">11.12 The run-time type checker</a></H2>
+<H2><a name="Typemaps_runtime_type_checker">13.12 The run-time type checker</a></H2>
<p>
@@ -4104,7 +4218,7 @@ language modules.</li>
<li>Modules can be unloaded from the type system.</li>
</ul>
-<H3><a name="Typemaps_nn45">11.12.1 Implementation</a></H3>
+<H3><a name="Typemaps_nn45">13.12.1 Implementation</a></H3>
<p>
@@ -4298,7 +4412,7 @@ structures rather than creating new ones. These <tt>swig_module_info</tt>
structures are chained together in a circularly linked list.
</p>
-<H3><a name="Typemaps_runtime_type_checker_usage">11.12.2 Usage</a></H3>
+<H3><a name="Typemaps_runtime_type_checker_usage">13.12.2 Usage</a></H3>
<p>This section covers how to use these functions from typemaps. To learn how to
@@ -4394,7 +4508,7 @@ probably just look at the output of SWIG to get a better sense for how types are
managed.
</p>
-<H2><a name="Typemaps_overloading">11.13 Typemaps and overloading</a></H2>
+<H2><a name="Typemaps_overloading">13.13 Typemaps and overloading</a></H2>
<p>
@@ -4516,37 +4630,69 @@ To support dynamic dispatch, SWIG first defines a general purpose type hierarchy
<pre>
Symbolic Name Precedence Value
------------------------------ ------------------
-SWIG_TYPECHECK_POINTER 0
-SWIG_TYPECHECK_VOIDPTR 10
-SWIG_TYPECHECK_BOOL 15
-SWIG_TYPECHECK_UINT8 20
-SWIG_TYPECHECK_INT8 25
-SWIG_TYPECHECK_UINT16 30
-SWIG_TYPECHECK_INT16 35
-SWIG_TYPECHECK_UINT32 40
-SWIG_TYPECHECK_INT32 45
-SWIG_TYPECHECK_UINT64 50
-SWIG_TYPECHECK_INT64 55
-SWIG_TYPECHECK_UINT128 60
-SWIG_TYPECHECK_INT128 65
-SWIG_TYPECHECK_INTEGER 70
-SWIG_TYPECHECK_FLOAT 80
-SWIG_TYPECHECK_DOUBLE 90
-SWIG_TYPECHECK_COMPLEX 100
-SWIG_TYPECHECK_UNICHAR 110
-SWIG_TYPECHECK_UNISTRING 120
-SWIG_TYPECHECK_CHAR 130
-SWIG_TYPECHECK_STRING 140
-SWIG_TYPECHECK_BOOL_ARRAY 1015
-SWIG_TYPECHECK_INT8_ARRAY 1025
-SWIG_TYPECHECK_INT16_ARRAY 1035
-SWIG_TYPECHECK_INT32_ARRAY 1045
-SWIG_TYPECHECK_INT64_ARRAY 1055
-SWIG_TYPECHECK_INT128_ARRAY 1065
-SWIG_TYPECHECK_FLOAT_ARRAY 1080
-SWIG_TYPECHECK_DOUBLE_ARRAY 1090
-SWIG_TYPECHECK_CHAR_ARRAY 1130
-SWIG_TYPECHECK_STRING_ARRAY 1140
+SWIG_TYPECHECK_POINTER 0
+SWIG_TYPECHECK_ITERATOR 5
+SWIG_TYPECHECK_VOIDPTR 10
+SWIG_TYPECHECK_BOOL 15
+SWIG_TYPECHECK_UINT8 20
+SWIG_TYPECHECK_INT8 25
+SWIG_TYPECHECK_UINT16 30
+SWIG_TYPECHECK_INT16 35
+SWIG_TYPECHECK_UINT32 40
+SWIG_TYPECHECK_INT32 45
+SWIG_TYPECHECK_SIZE 47
+SWIG_TYPECHECK_PTRDIFF 48
+SWIG_TYPECHECK_UINT64 50
+SWIG_TYPECHECK_INT64 55
+SWIG_TYPECHECK_UINT128 60
+SWIG_TYPECHECK_INT128 65
+SWIG_TYPECHECK_INTEGER 70
+SWIG_TYPECHECK_FLOAT 80
+SWIG_TYPECHECK_DOUBLE 90
+SWIG_TYPECHECK_CPLXFLT 95
+SWIG_TYPECHECK_CPLXDBL 100
+SWIG_TYPECHECK_COMPLEX 105
+SWIG_TYPECHECK_UNICHAR 110
+SWIG_TYPECHECK_STDUNISTRING 115
+SWIG_TYPECHECK_UNISTRING 120
+SWIG_TYPECHECK_CHAR 130
+SWIG_TYPECHECK_STDSTRING 135
+SWIG_TYPECHECK_STRING 140
+SWIG_TYPECHECK_PAIR 150
+SWIG_TYPECHECK_STDARRAY 155
+SWIG_TYPECHECK_VECTOR 160
+SWIG_TYPECHECK_DEQUE 170
+SWIG_TYPECHECK_LIST 180
+SWIG_TYPECHECK_SET 190
+SWIG_TYPECHECK_MULTISET 200
+SWIG_TYPECHECK_MAP 210
+SWIG_TYPECHECK_MULTIMAP 220
+SWIG_TYPECHECK_STACK 230
+SWIG_TYPECHECK_QUEUE 240
+SWIG_TYPECHECK_BOOL_ARRAY 1015
+SWIG_TYPECHECK_INT8_ARRAY 1025
+SWIG_TYPECHECK_INT16_ARRAY 1035
+SWIG_TYPECHECK_INT32_ARRAY 1045
+SWIG_TYPECHECK_INT64_ARRAY 1055
+SWIG_TYPECHECK_INT128_ARRAY 1065
+SWIG_TYPECHECK_FLOAT_ARRAY 1080
+SWIG_TYPECHECK_DOUBLE_ARRAY 1090
+SWIG_TYPECHECK_CHAR_ARRAY 1130
+SWIG_TYPECHECK_STRING_ARRAY 1140
+SWIG_TYPECHECK_OBJECT_ARRAY 1150
+SWIG_TYPECHECK_BOOL_PTR 2015
+SWIG_TYPECHECK_UINT8_PTR 2020
+SWIG_TYPECHECK_INT8_PTR 2025
+SWIG_TYPECHECK_UINT16_PTR 2030
+SWIG_TYPECHECK_INT16_PTR 2035
+SWIG_TYPECHECK_UINT32_PTR 2040
+SWIG_TYPECHECK_INT32_PTR 2045
+SWIG_TYPECHECK_UINT64_PTR 2050
+SWIG_TYPECHECK_INT64_PTR 2055
+SWIG_TYPECHECK_FLOAT_PTR 2080
+SWIG_TYPECHECK_DOUBLE_PTR 2090
+SWIG_TYPECHECK_CHAR_PTR 2130
+SWIG_TYPECHECK_SWIGOBJECT 5000
</pre>
</div>
@@ -4671,7 +4817,8 @@ then the type is given a precedence higher than any other known precedence level
<div class="shell">
<pre>
-example.i:18: Warning 467: Overloaded method foo(int) not supported (incomplete type checking rule - no precedence level in typecheck typemap for 'int').
+example.i:18: Warning 467: Overloaded method foo(int) not supported (incomplete type
+checking rule - no precedence level in typecheck typemap for 'int').
</pre>
</div>
@@ -4696,17 +4843,119 @@ simply check the type of the first array element and use that to dispatch to the
Subsequent "in" typemaps would then perform more extensive type-checking.
</li>
-<li>Make sure you read the section on overloading in the "<a href="SWIGPlus.html#SWIGPlus">SWIG and C++</a>" chapter.
+<li>Make sure you read the section on <a href="SWIGPlus.html#SWIGPlus_overloaded_methods">overloading</a> in the SWIG and C++ chapter.
</li>
</ul>
-<H2><a name="Typemaps_nn48">11.14 More about %apply and %clear</a></H2>
+<H3><a name="Typemaps_typecheck_pointer">13.13.1 SWIG_TYPECHECK_POINTER precedence level and the typecheck typemap</a></H3>
+
+
+<p>
+When it comes to overloading of a particular type passed by value, pointer or reference (const and non-const),
+a C++ compiler can disambiguate which overloaded function to call.
+However, SWIG effectively treats these as pointers in the target language and thus as equivalent types.
+For example, consider:
+</p>
+
+<div class="code">
+<pre>
+class X { ... };
+void m(X const &amp;c); // equivalent: void m(X *c);
+void m(X &amp;r); // equivalent: void m(X *r);
+void m(X *p); // equivalent: void m(X *p);
+</pre>
+</div>
+
+<p>
+These cannot be disambiguated in the target languages and so SWIG will choose the first method and ignore the subsequent two methods.
+The scripting languages do this by using the overload dispatch mechanism described earlier and warnings indicate this:
+</p>
+
+<div class="shell">
+<pre>
+example.i:6: Warning 509: Overloaded method m(X &amp;) effectively ignored,
+example.i:5: Warning 509: as it is shadowed by m(X const &amp;).
+example.i:7: Warning 509: Overloaded method m(X *) effectively ignored,
+example.i:5: Warning 509: as it is shadowed by m(X const &amp;).
+</pre>
+</div>
+
+<p>
+The statically typed languages like Java and C# automatically ignore all but the first equivalent overloaded methods with warnings:
+</p>
+
+<div class="shell">
+<pre>
+example.i:6: Warning 516: Overloaded method m(X &amp;) ignored,
+example.i:5: Warning 516: using m(X const &amp;) instead.
+example.i:7: Warning 516: Overloaded method m(X *) ignored,
+example.i:5: Warning 516: using m(X const &amp;) instead.
+</pre>
+</div>
+
+<p>
+You can select the overloaded method you would like to wrap by ignoring the other two with <tt>%ignore</tt> or rename two of them with <tt>%rename</tt>
+and this will of course remove the warnings too.
+The problem of ambiguity is also discussed in the C++ chapter on <a href="SWIGPlus.html#SWIGPlus_overloaded_methods">overloading</a>.
+</p>
+
+<p>
+So how does this work with respect to typemaps?
+The typemaps SWIG provides to handle overloading for these three methods are from the SWIGTYPE family.
+As discussed earlier, in <a href="Typemaps.html#Typemaps_nn19">Default typemap matching rules</a>,
+the <tt>SWIGTYPE &amp;</tt> typemaps are used for references and <tt>SWIGTYPE *</tt> typemaps are used for pointers.
+SWIG uses the special <tt>SWIG_TYPECHECK_POINTER</tt> (0) precedence level to handle these types in the "typecheck" typemap:
+</p>
+
+<div class="code">
+<pre>
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) SWIGTYPE &amp; "..."
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) SWIGTYPE * "..."
+</pre>
+</div>
+
+<p>
+When the SWIGTYPE "typecheck" typemaps use the <tt>SWIG_TYPECHECK_POINTER</tt> precedence level,
+SWIG converts the type to a pointer equivalent type and then uses the equivalent type to detect if it can be disambiguated in an overloaded method in the target language.
+In our example above, the equivalent types for <tt>X const &amp;</tt>, <tt>X &amp;</tt> and <tt>X *</tt> are all <tt>X *</tt>.
+As they are the same, they cannot be disambiguated and so just the first overloaded method is chosen.
+</p>
+
+<p>
+The automatic conversion to equivalent types and subsequent type comparison is triggered via the use of the special <tt>SWIG_TYPECHECK_POINTER</tt> precedence level
+and works for types passed by value, pointer and reference.
+Alas, there are more ways to overload a method that also need handling.
+C++ smart pointers are such a type which can be disambiguated by a C++ compiler but not automatically by SWIG.
+SWIG does not automatically know that a smart pointer has an equivalent type, but it can be told manually.
+Just specify the 'equivalent' attribute in the "typecheck" typemap with a pointer to the underlying type.
+</p>
+
+<div class="code">
+<pre>
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="X *") MySmartPtr&lt;X&gt; " ... "
+
+void m(X &amp;r); // equivalent: void m(X *r);
+void m(MySmartPtr&lt;X&gt; s); // equivalent: void m(X *s);
+</pre>
+</div>
+
+<p>
+Now SWIG will detect the two types are equivalent and generate valid code by wrapping just the first overloaded method.
+You can of course choose which method to wrap by ignoring one of them with <tt>%ignore</tt>.
+Otherwise both can be wrapped by removing the overloading name ambiguity by renaming one of them with <tt>%rename</tt>.
+</p>
+
+<p>
+The 'equivalent' attribute is used in the implementation for the <a href="Library.html#Library_std_shared_ptr">shared_ptr smart pointer</a> library.
+</p>
+
+<H2><a name="Typemaps_nn48">13.14 More about %apply and %clear</a></H2>
<p>
In order to implement certain kinds of program behavior, it is sometimes necessary to
-write sets of typemaps. For example, to support output arguments, one often writes
-a set of typemaps like this:
+write a family of typemap methods. For example, to support output arguments, one often writes
+a family of typemaps like this:
</p>
<div class="code">
@@ -4722,7 +4971,7 @@ a set of typemaps like this:
<p>
To make it easier to apply the typemap to different argument types and names, the <tt>%apply</tt> directive
-performs a copy of all typemaps from one type to another. For example, if you specify this,
+performs a copy of all typemaps from a source type to one or more set of target types. For example, if you specify this,
</p>
<div class="code">
@@ -4732,12 +4981,14 @@ performs a copy of all typemaps from one type to another. For example, if you s
</div>
<p>
-then all of the <tt>int *OUTPUT</tt> typemaps are copied to <tt>int *retvalue</tt> and <tt>int32 *output</tt>.
+then all of the <tt>int *OUTPUT</tt> (source) typemap methods are copied to <tt>int *retvalue</tt> and <tt>int32 *output</tt> (the targets).
</p>
<p>
-However, there is a subtle aspect of <tt>%apply</tt> that needs more description. Namely, <tt>%apply</tt> does not
-overwrite a typemap rule if it is already defined for the target datatype. This behavior allows you to do two things:
+However, there is a subtle aspect of <tt>%apply</tt> that needs clarification.
+Namely, if a target contains a typemap method that the source does not,
+the target typemap method remains in place and unchanged.
+This behavior allows you to do two things:
</p>
<ul>
@@ -4745,7 +4996,7 @@ overwrite a typemap rule if it is already defined for the target datatype. Thi
<tt>%apply</tt> to incorporate the remaining pieces.
</li>
-<li>Sets of different typemaps can be applied to the same datatype using repeated <tt>%apply</tt> directives.
+<li>Different typemaps can be applied to the same datatype using repeated <tt>%apply</tt> directives.
</li>
</ul>
@@ -4767,6 +5018,10 @@ For example:
}
}
+%typemap(arginit) int *invalue %{
+ $1 = NULL;
+%}
+
...
%apply int *INPUT { int *invalue };
%apply int *POSITIVE { int *invalue };
@@ -4774,9 +5029,11 @@ For example:
</div>
<p>
-Since <tt>%apply</tt> does not overwrite or replace any existing rules, the only way to reset behavior is to
-use the <tt>%clear</tt> directive. <tt>%clear</tt> removes all typemap rules defined for a specific datatype. For
-example:
+In this example, neither of the two <tt>%apply</tt> directives will overwrite / delete the "arginit" typemap as neither has an "arginit" typemap.
+The result is a family of three relevant typemaps for <tt>int *invalue</tt>.
+Since <tt>%apply</tt> does not overwrite / delete any existing rules, the only way to reset behavior is to
+delete them, such as with the <tt>%clear</tt> directive.
+For example:
</p>
<div class="code">
@@ -4785,8 +5042,19 @@ example:
</pre>
</div>
+<p>
+will delete the typemaps for all the typemap methods; namely "in", "check" and "arginit". Alternatively delete each one individually:
+</p>
+
+<div class="code">
+<pre>
+%typemap(in) int *invalue;
+%typemap(check) int *invalue;
+%typemap(arginit) int *invalue;
+</pre>
+</div>
-<H2><a name="Typemaps_nn47">11.15 Passing data between typemaps</a></H2>
+<H2><a name="Typemaps_nn47">13.15 Passing data between typemaps</a></H2>
<p>
@@ -4823,7 +5091,7 @@ sure that the typemaps sharing information have exactly the same types and names
</p>
-<H2><a name="Typemaps_nn52">11.16 C++ "this" pointer</a></H2>
+<H2><a name="Typemaps_nn52">13.16 C++ "this" pointer</a></H2>
<p>
@@ -4883,7 +5151,7 @@ will also match the typemap. One work around is to create an interface file tha
the method, but gives the argument a name other than <tt>self</tt>.
</p>
-<H2><a name="Typemaps_nn51">11.17 Where to go for more information?</a></H2>
+<H2><a name="Typemaps_nn51">13.17 Where to go for more information?</a></H2>
<p>
diff --git a/Doc/Manual/Varargs.html b/Doc/Manual/Varargs.html
index fb58ee39a..9f20469d2 100644
--- a/Doc/Manual/Varargs.html
+++ b/Doc/Manual/Varargs.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Varargs">14 Variable Length Arguments</a></H1>
+<H1><a name="Varargs">16 Variable Length Arguments</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -43,7 +43,7 @@ added in SWIG-1.3.12. Most other wrapper generation tools have
wisely chosen to avoid this issue.
</p>
-<H2><a name="Varargs_nn2">14.1 Introduction</a></H2>
+<H2><a name="Varargs_nn2">16.1 Introduction</a></H2>
<p>
@@ -140,7 +140,7 @@ List make_list(const char *s, ...) {
</pre>
</div>
-<H2><a name="Varargs_nn3">14.2 The Problem</a></H2>
+<H2><a name="Varargs_nn3">16.2 The Problem</a></H2>
<p>
@@ -233,7 +233,7 @@ can also support real varargs wrapping (with stack-frame manipulation) if you
are willing to get hands dirty. Keep reading.
</p>
-<H2><a name="Varargs_nn4">14.3 Default varargs support</a></H2>
+<H2><a name="Varargs_nn4">16.3 Default varargs support</a></H2>
<p>
@@ -302,7 +302,7 @@ Read on for further solutions.
</p>
-<H2><a name="Varargs_nn5">14.4 Argument replacement using %varargs</a></H2>
+<H2><a name="Varargs_nn5">16.4 Argument replacement using %varargs</a></H2>
<p>
@@ -413,7 +413,7 @@ mixed argument types such as <tt>printf()</tt>. Providing general purpose
wrappers to such functions presents special problems (covered shortly).
</p>
-<H2><a name="Varargs_nn6">14.5 Varargs and typemaps</a></H2>
+<H2><a name="Varargs_nn6">16.5 Varargs and typemaps</a></H2>
<p>
@@ -423,8 +423,8 @@ Variable length arguments may be used in typemap specifications. For example:
<div class="code">
<pre>
%typemap(in) (...) {
- // Get variable length arguments (somehow)
- ...
+ // Get variable length arguments (somehow)
+ ...
}
%typemap(in) (const char *fmt, ...) {
@@ -529,8 +529,11 @@ like this:
SWIG_fail;
}
pystr = PyUnicode_AsUTF8String(pyobj);
+ if (!pystr) {
+ SWIG_fail;
+ }
str = strdup(PyBytes_AsString(pystr));
- Py_XDECREF(pystr);
+ Py_DECREF(pystr);
%#else
if (!PyString_Check(pyobj)) {
PyErr_SetString(PyExc_ValueError, "Expected a string");
@@ -590,7 +593,7 @@ really want to elevate your guru status and increase your job
security, continue to the next section.
</p>
-<H2><a name="Varargs_nn7">14.6 Varargs wrapping with libffi</a></H2>
+<H2><a name="Varargs_nn7">16.6 Varargs wrapping with libffi</a></H2>
<p>
@@ -842,7 +845,7 @@ provide an argument number for the first extra argument. This can be used to in
values. Please consult the chapter on each language module for more details.
</p>
-<H2><a name="Varargs_nn8">14.7 Wrapping of va_list</a></H2>
+<H2><a name="Varargs_nn8">16.7 Wrapping of va_list</a></H2>
<p>
@@ -896,7 +899,7 @@ int my_vprintf(const char *fmt, ...) {
</pre>
</div>
-<H2><a name="Varargs_nn9">14.8 C++ Issues</a></H2>
+<H2><a name="Varargs_nn9">16.8 C++ Issues</a></H2>
<p>
@@ -965,7 +968,7 @@ design or to provide an alternative interface using a helper function than it is
fully general wrapper to a varargs C++ member function.
</p>
-<H2><a name="Varargs_nn10">14.9 Discussion</a></H2>
+<H2><a name="Varargs_nn10">16.9 Discussion</a></H2>
<p>
diff --git a/Doc/Manual/Warnings.html b/Doc/Manual/Warnings.html
index e7b291f21..c63d7de0c 100644
--- a/Doc/Manual/Warnings.html
+++ b/Doc/Manual/Warnings.html
@@ -7,7 +7,7 @@
</head>
<body bgcolor="#ffffff">
-<H1><a name="Warnings">15 Warning Messages</a></H1>
+<H1><a name="Warnings">18 Warning Messages</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@@ -25,7 +25,8 @@
<li><a href="#Warnings_nn11">Preprocessor (200-299)</a>
<li><a href="#Warnings_nn12">C/C++ Parser (300-399)</a>
<li><a href="#Warnings_nn13">Types and typemaps (400-499) </a>
-<li><a href="#Warnings_nn14">Code generation (500-599)</a>
+<li><a href="#Warnings_nn14">Code generation (500-559)</a>
+<li><a href="#Warnings_doxygen">Doxygen comments (560-599)</a>
<li><a href="#Warnings_nn15">Language module specific (700-899) </a>
<li><a href="#Warnings_nn16">User defined (900-999)</a>
</ul>
@@ -36,7 +37,7 @@
-<H2><a name="Warnings_nn2">15.1 Introduction</a></H2>
+<H2><a name="Warnings_nn2">18.1 Introduction</a></H2>
<p>
@@ -56,7 +57,7 @@ where the generated wrapper code will probably compile, but it may not
work like you expect.
</p>
-<H2><a name="Warnings_suppression">15.2 Warning message suppression</a></H2>
+<H2><a name="Warnings_suppression">18.2 Warning message suppression</a></H2>
<p>
@@ -148,7 +149,7 @@ your interface. Ignore the warning messages at your own peril.
</p>
-<H2><a name="Warnings_nn4">15.3 Enabling extra warnings</a></H2>
+<H2><a name="Warnings_nn4">18.3 Enabling extra warnings</a></H2>
<p>
@@ -221,7 +222,7 @@ that is, any warnings suppressed or added in <tt>%warnfilter</tt>, <tt>#pragma S
or the <tt>-w</tt> option.
</p>
-<H2><a name="Warnings_nn5">15.4 Issuing a warning message</a></H2>
+<H2><a name="Warnings_nn5">18.4 Issuing a warning message</a></H2>
<p>
@@ -275,7 +276,7 @@ example.i:24: Warning 901: You are really going to regret this usage of blah * s
</pre>
</div>
-<H2><a name="Warnings_symbolic_symbols">15.5 Symbolic symbols</a></H2>
+<H2><a name="Warnings_symbolic_symbols">18.5 Symbolic symbols</a></H2>
<p>
@@ -310,7 +311,7 @@ or
</pre>
</div>
-<H2><a name="Warnings_nn6">15.6 Commentary</a></H2>
+<H2><a name="Warnings_nn6">18.6 Commentary</a></H2>
<p>
@@ -327,7 +328,7 @@ no obvious recovery. There is no mechanism for suppressing error
messages.
</p>
-<H2><a name="Warnings_nn7">15.7 Warnings as errors</a></H2>
+<H2><a name="Warnings_nn7">18.7 Warnings as errors</a></H2>
<p>
@@ -336,7 +337,7 @@ option. This will cause SWIG to exit with a non successful exit code if a
warning is encountered.
</p>
-<H2><a name="Warnings_nn8">15.8 Message output format</a></H2>
+<H2><a name="Warnings_nn8">18.8 Message output format</a></H2>
<p>
@@ -355,10 +356,10 @@ $ swig -python -Fmicrosoft example.i
example.i(4) : Syntax error in input(1).
</pre></div>
-<H2><a name="Warnings_nn9">15.9 Warning number reference</a></H2>
+<H2><a name="Warnings_nn9">18.9 Warning number reference</a></H2>
-<H3><a name="Warnings_nn10">15.9.1 Deprecated features (100-199)</a></H3>
+<H3><a name="Warnings_nn10">18.9.1 Deprecated features (100-199)</a></H3>
<ul>
@@ -386,7 +387,7 @@ example.i(4) : Syntax error in input(1).
<li>126. The 'nestedworkaround' feature is deprecated.
</ul>
-<H3><a name="Warnings_nn11">15.9.2 Preprocessor (200-299)</a></H3>
+<H3><a name="Warnings_nn11">18.9.2 Preprocessor (200-299)</a></H3>
<ul>
@@ -398,7 +399,7 @@ example.i(4) : Syntax error in input(1).
<li>206. Unexpected tokens after #<em>directive</em> directive.
</ul>
-<H3><a name="Warnings_nn12">15.9.3 C/C++ Parser (300-399)</a></H3>
+<H3><a name="Warnings_nn12">18.9.3 C/C++ Parser (300-399)</a></H3>
<ul>
@@ -475,7 +476,7 @@ example.i(4) : Syntax error in input(1).
<li>395. operator delete[] ignored.
</ul>
-<H3><a name="Warnings_nn13">15.9.4 Types and typemaps (400-499) </a></H3>
+<H3><a name="Warnings_nn13">18.9.4 Types and typemaps (400-499) </a></H3>
<ul>
@@ -506,7 +507,7 @@ example.i(4) : Syntax error in input(1).
-<H3><a name="Warnings_nn14">15.9.5 Code generation (500-599)</a></H3>
+<H3><a name="Warnings_nn14">18.9.5 Code generation (500-559)</a></H3>
<ul>
@@ -533,9 +534,22 @@ example.i(4) : Syntax error in input(1).
<li>521. Illegal destructor name <em>name</em>. Ignored.
<li>522. Use of an illegal constructor name '<em>name</em>' in %extend is deprecated, the constructor name should be '<em>name</em>'.
<li>523. Use of an illegal destructor name '<em>name</em>' in %extend is deprecated, the destructor name should be '<em>name</em>'.
+<li>524. Experimental target language. Target language <em>language</em> specified by <em>lang</em> is an experimental language. Please read about SWIG experimental languages, <em>htmllink</em>.
+<li>525. Destructor <em>declaration</em> is final, <em>name</em> cannot be a director class.
</ul>
-<H3><a name="Warnings_nn15">15.9.6 Language module specific (700-899) </a></H3>
+<H3><a name="Warnings_doxygen">18.9.6 Doxygen comments (560-599)</a></H3>
+
+
+<ul>
+ <li>560: Unknown Doxygen command: <em>command</em>.</li>
+ <li>561: Unexpected end of Doxygen comment encountered.</li>
+ <li>562: Expected Doxygen command: <em>command</em></li>
+ <li>563: Doxygen HTML error for tag <em>tag</em>: <em>error text</em>.</li>
+ <li>564: Error parsing Doxygen command <em>command</em>: <em>error text</em>. Command ignored."</li>
+</ul>
+
+<H3><a name="Warnings_nn15">18.9.7 Language module specific (700-899) </a></H3>
<ul>
@@ -586,14 +600,14 @@ example.i(4) : Syntax error in input(1).
<li>871. Unrecognized pragma <em>pragma</em>. (Php).
</ul>
-<H3><a name="Warnings_nn16">15.9.7 User defined (900-999)</a></H3>
+<H3><a name="Warnings_nn16">18.9.8 User defined (900-999)</a></H3>
<p>
These numbers can be used by your own application.
</p>
-<H2><a name="Warnings_nn17">15.10 History</a></H2>
+<H2><a name="Warnings_nn17">18.10 History</a></H2>
<p>
diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html
index b95105bdd..800e2e420 100644
--- a/Doc/Manual/Windows.html
+++ b/Doc/Manual/Windows.html
@@ -68,7 +68,7 @@ SWIG does not come with the usual Windows type installation program, however it
<p>
-The swigwin distribution contains the SWIG Windows executable, swig.exe, which will run on 32 bit versions of Windows, ie Windows 95 and later.
+The swigwin distribution contains the SWIG Windows 32-bit executable, swig.exe, which will run on both 32-bit and 64-bit versions of Windows.
If you want to build your own swig.exe have a look at <a href="#Windows_swig_exe">Building swig.exe on Windows</a>.
</p>
@@ -149,7 +149,7 @@ PERL5_LIB: D:\nsPerl5.004_04\lib\CORE\perl.lib<br>
<p>
<b><tt>PYTHON_INCLUDE</tt></b> : Set this to the directory that contains Python.h<br>
-<b><tt>PYTHON_LIB</tt></b> : Set this to the python library including path for linking<p>
+<b><tt>PYTHON_LIB</tt></b> : Set this to the Python library including path for linking<p>
Example using Python 2.1.1:<br>
<tt>
PYTHON_INCLUDE: D:\python21\include<br>
@@ -211,7 +211,7 @@ If you do not have access to Visual C++ you will have to set up project files /
<p>
-SWIG can also be compiled and run using <a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> which provides a Unix like front end to Windows and comes free with gcc, an ANSI C/C++ compiler. However, this is not a recommended approach as the prebuilt executable is supplied.
+SWIG can also be compiled and run using <a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> which provides a Unix like front end to Windows and comes free with gcc, an ISO C/C++ compiler. However, this is not a recommended approach as the prebuilt executable is supplied.
</p>
<H3><a name="Windows_swig_exe">3.3.1 Building swig.exe on Windows</a></H3>
@@ -249,7 +249,7 @@ Execute the steps in the order shown and don't use spaces in path names. In fact
<ol>
<li>
Download the following packages from the <a href="http://www.mingw.org/download.shtml">MinGW download page</a>
- or <a href="http://sourceforge.net/projects/mingw/files/">MinGW SourceForge download page</a>.
+ or <a href="https://sourceforge.net/projects/mingw/files/">MinGW SourceForge download page</a>.
Note that at the time of writing, the majority of these are in the Current
release list and some are in the Snapshot or Previous release list.
<ul>
diff --git a/Doc/Manual/chapters b/Doc/Manual/chapters
index d94a8a396..2cb2b18a3 100644
--- a/Doc/Manual/chapters
+++ b/Doc/Manual/chapters
@@ -5,6 +5,8 @@ Scripting.html
SWIG.html
SWIGPlus.html
CPlusPlus11.html
+CPlusPlus14.html
+CPlusPlus17.html
Preprocessor.html
Library.html
Arguments.html
@@ -12,30 +14,26 @@ Typemaps.html
Customization.html
Contract.html
Varargs.html
+Doxygen.html
Warnings.html
Modules.html
CCache.html
-Allegrocl.html
Android.html
CSharp.html
-Chicken.html
D.html
Go.html
Guile.html
Java.html
Javascript.html
-Lisp.html
Lua.html
-Modula3.html
-Mzscheme.html
-Ocaml.html
Octave.html
Perl5.html
Php.html
-Pike.html
Python.html
R.html
Ruby.html
Scilab.html
Tcl.html
+Mzscheme.html
+Ocaml.html
Extending.html
diff --git a/Doc/Manual/index.html b/Doc/Manual/index.html
index 26cc81ea1..e720e70d0 100644
--- a/Doc/Manual/index.html
+++ b/Doc/Manual/index.html
@@ -1,11 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-<title>SWIG-3.0 Documentation</title>
+<title>SWIG-4.0 Documentation</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff">
-<H1><a name="index">SWIG-3.0 Documentation</a></H1>
+<H1><a name="index">SWIG-4.0 Documentation</a></H1>
The SWIG documentation is available in one of the following formats.
<ul>
diff --git a/Doc/Manual/makechap.py b/Doc/Manual/makechap.py
index 61994e2a0..e30d14e0f 100644
--- a/Doc/Manual/makechap.py
+++ b/Doc/Manual/makechap.py
@@ -44,6 +44,8 @@ def getheadingname(m):
def getheadingtext(m, s):
prevheadingtext_newstyle = m.group(2)
prevheadingtext_oldstyle = m.group(3)
+ if prevheadingtext_oldstyle is None or prevheadingtext_newstyle is None:
+ raise RuntimeError("Ill-formed heading in line:\n%s" % s)
if len(prevheadingtext_oldstyle) == 0 and len(prevheadingtext_newstyle) == 0:
raise RuntimeError("No heading text in line:\n%s" % s)
if len(prevheadingtext_oldstyle) > 0 and len(prevheadingtext_newstyle) > 0:
@@ -72,7 +74,7 @@ name = ""
# Regexs for <h1>,... <h5> sections
-h1 = re.compile(r".*?<H1>(<a.*?>\s*[\d\s]*(.*?)</a>)*[\d\s]*(.*?)</H1>", re.IGNORECASE)
+h1 = re.compile(r".*?<H1>(<a.*?>\s*[\d\.\s]*(.*?)</a>)*[\d\.\s]*(.*?)</H1>", re.IGNORECASE)
h2 = re.compile(r".*?<H2>(<a.*?>\s*[\d\.\s]*(.*?)</a>)*[\d\.\s]*(.*?)</H2>", re.IGNORECASE)
h3 = re.compile(r".*?<H3>(<a.*?>\s*[\d\.\s]*(.*?)</a>)*[\d\.\s]*(.*?)</H3>", re.IGNORECASE)
h4 = re.compile(r".*?<H4>(<a.*?>\s*[\d\.\s]*(.*?)</a>)*[\d\.\s]*(.*?)</H4>", re.IGNORECASE)
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 4db8c4c63..6fbca29db 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -282,7 +282,7 @@ perl5_static_cpp: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
perl5_run:
- $(RUNTOOL) $(PERL) $(PERL5_SCRIPT) $(RUNPIPE)
+ $(RUNTOOL) $(PERL) -I. $(PERL5_SCRIPT) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@@ -334,8 +334,8 @@ else
SWIGOPTPY3 = -py3
endif
-PEP8 = @PEP8@
-PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391
+PYCODESTYLE = @PYCODESTYLE@
+PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391
# ----------------------------------------------------------------
# Build a C dynamically loadable module
@@ -386,11 +386,11 @@ else
PYSCRIPT = $(RUNME)3.py
endif
-PY2TO3 = 2to3 `2to3 -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'`
+PY2TO3 = @PY2TO3@ `@PY2TO3@ -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'`
python_run: $(PYSCRIPT)
-ifneq (,$(PEP8))
- $(COMPILETOOL) $(PEP8) $(PEP8_FLAGS) $(PYSCRIPT)
+ifneq (,$(PYCODESTYLE))
+ $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(PYSCRIPT)
endif
env PYTHONPATH=$$PWD $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE)
@@ -463,7 +463,7 @@ octave_cpp: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
octave_run:
- OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(OCTAVE_SCRIPT) $(RUNPIPE)
+ env OCTAVE_PATH= OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(OCTAVE_SCRIPT) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@@ -671,7 +671,7 @@ javascript_build: $(SRCDIR_SRCS)
javascript_build_cpp: $(SRCDIR_SRCS)
ifeq (node,$(JSENGINE))
sed -e 's|$$srcdir|./$(SRCDIR)|g' $(SRCDIR)binding.gyp.in > binding.gyp
- $(NODEGYP) --loglevel=silent configure build 1>>/dev/null
+ MAKEFLAGS= $(NODEGYP) --loglevel=silent configure build 1>>/dev/null
else
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES)
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
@@ -806,45 +806,6 @@ android_clean:
rm -rf obj
##################################################################
-##### MODULA3 ######
-##################################################################
-
-MODULA3_INCLUDE= @MODULA3INC@
-
-# ----------------------------------------------------------------
-# Build a modula3 dynamically loadable module (C)
-# ----------------------------------------------------------------
-
-modula3: $(SRCDIR_SRCS)
- $(SWIG) -modula3 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
-
-modula3_cpp: $(SRCDIR_SRCS)
- $(SWIG) -modula3 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
-
-# -----------------------------------------------------------------
-# Run modula3 example
-# -----------------------------------------------------------------
-
-modula3_run:
- $(RUNTOOL) false $(RUNPIPE)
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-modula3_version:
- echo "Unknown modula3 version"
-
-# -----------------------------------------------------------------
-# Cleaning the modula3 examples
-# -----------------------------------------------------------------
-
-modula3_clean:
- rm -f *_wrap* *.i3 *.m3
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@
-
-##################################################################
##### MZSCHEME ######
##################################################################
@@ -852,7 +813,7 @@ MZSCHEME = mzscheme
MZC = @MZC@
MZDYNOBJ = @MZDYNOBJ@
MZSCHEME_SO = @MZSCHEME_SO@
-MZSCHEME_SCRIPT = $(RUNME).scm
+MZSCHEME_SCRIPT = $(SRCDIR)$(RUNME).scm
# ----------------------------------------------------------------
# Build a C/C++ dynamically loadable module
@@ -860,12 +821,12 @@ MZSCHEME_SCRIPT = $(RUNME).scm
mzscheme: $(SRCDIR_SRCS)
$(SWIG) -mzscheme $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ISRCS) $(SRCDIR_SRCS)
+ $(COMPILETOOL) $(MZC) `echo " $(CPPFLAGS) $(INCLUDES) $(CFLAGS)" | sed 's/ -/ ++ccf -/g'` --cc $(ISRCS) $(SRCDIR_SRCS)
$(COMPILETOOL) $(MZC) --ld $(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS)
mzscheme_cpp: $(SRCDIR_SRCS)
$(SWIG) -mzscheme -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
+ env CFLAGS= $(COMPILETOOL) $(MZC) `echo " $(CPPFLAGS) $(INCLUDES) $(CXXFLAGS)" | sed 's/ -/ ++ccf -/g'` --cc $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(LIBPREFIX)$(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS) $(MZDYNOBJ) $(CPP_DLLIBS)
# -----------------------------------------------------------------
@@ -896,135 +857,88 @@ mzscheme_clean:
##### Ocaml #####
##################################################################
-OCC=@OCAMLC@
-OCAMLDLGEN=@OCAMLDLGEN@
-OCAMLFIND=@OCAMLFIND@
-OCAMLMKTOP=@OCAMLMKTOP@ $(SWIGWHERE)
+OCC=$(COMPILETOOL) @OCAMLC@
+OCC_WITH_PP=env TMPDIR=./localtmp $(OCC)
+# TMPDIR above is a workaround for some ocamlc versions, such as 4.05.0, which always create a temp file of the same name breaking parallel make (seemingly only when -pp is used)
+OCAMLDLGEN=$(COMPILETOOL) @OCAMLDLGEN@
+OCAMLFIND=$(COMPILETOOL) @OCAMLFIND@
+OCAMLMKTOP=$(COMPILETOOL) @OCAMLMKTOP@
NOLINK ?= false
OCAMLPP= -pp "camlp4o ./swigp4.cmo"
OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where`
-OCAMLCORE=\
- rm -rf swig.mli swig.ml swigp4.ml && \
- $(SWIG) -ocaml -co swig.mli 2>/dev/null && \
- $(SWIG) -ocaml -co swig.ml 2>/dev/null && \
- $(SWIG) -ocaml -co swigp4.ml 2>/dev/null && \
- $(OCC) -c swig.mli && \
- $(OCC) -c swig.ml && \
- $(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" \
- -c swigp4.ml
+
+ocaml_core:
+ mkdir -p ./localtmp
+ $(SWIG) -ocaml -co swig.mli 2>/dev/null
+ $(SWIG) -ocaml -co swig.ml 2>/dev/null
+ $(SWIG) -ocaml -co swigp4.ml 2>/dev/null
+ $(OCC) -c swig.mli
+ $(OCC) -c swig.ml
+ $(OCC_WITH_PP) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
ocaml_static: $(SRCDIR_SRCS)
- $(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
- $(OCC) -g -c $(INTERFACE:%.i=%.ml)
- test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
- $(OCC) $(OCAMLPP) -c $(PROGFILE)
- $(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) \
- swig.cmo \
- $(INTERFACE:%.i=%.cmo) \
- $(PROGFILE:%.ml=%.cmo) \
- $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)"
+ $(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
+ test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
+ $(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)"
ocaml_dynamic: $(SRCDIR_SRCS)
- $(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
- $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(CCSHARED) -o $(INTERFACE:%.i=%@SO@) \
- $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(LIBS)
- $(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > \
- $(INTERFACE:%.i=%_dynamic.ml)
+ $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(CCSHARED) -o $(INTERFACE:%.i=%@SO@) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(LIBS)
+ $(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > $(INTERFACE:%.i=%_dynamic.ml)
mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml)
rm $(INTERFACE:%.i=%.mli)
$(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml)
- test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
- $(OCC) $(OCAMLPP) -c $(PROGFILE)
- $(NOLINK) || $(OCAMLFIND) \
- $(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) \
- swig.cmo \
- -package dl -linkpkg \
- $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo)
+ test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
+ $(NOLINK) || $(OCAMLFIND) $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo)
ocaml_static_toplevel: $(SRCDIR_SRCS)
- $(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
- $(OCC) -g -c $(INTERFACE:%.i=%.ml)
- test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
- $(OCC) $(OCAMLPP) -c $(PROGFILE)
- $(NOLINK) || $(OCAMLMKTOP) \
- swig.cmo \
- -I $(OCAMLP4WHERE) camlp4o.cma swigp4.cmo \
- -g -ccopt -g -cclib -g -custom -o $(TARGET)_top \
- $(INTERFACE:%.i=%.cmo) \
- $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)"
+ $(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
+ test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
+ $(NOLINK) || $(OCAMLMKTOP) swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -cclib "$(LIBS)" -g -ccopt -g -cclib -g -custom -o $(RUNME)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS)
ocaml_static_cpp: $(SRCDIR_SRCS)
- $(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
- $(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \
- $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
+ $(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
- $(OCC) -g -c $(INTERFACE:%.i=%.ml)
- test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
- $(OCC) $(OCAMLPP) -c $(PROGFILE)
- $(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(TARGET) \
- swig.cmo \
- $(INTERFACE:%.i=%.cmo) \
- $(PROGFILE:%.ml=%.cmo) \
- $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \
- -cclib "$(LIBS)" -cc '$(CXX) -Wno-write-strings'
+ $(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
+ test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
+ $(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" -cc '$(CXX)'
ocaml_static_cpp_toplevel: $(SRCDIR_SRCS)
- $(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
- $(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \
- $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
+ $(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
- $(OCC) -g -c $(INTERFACE:%.i=%.ml)
- test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
- $(OCC) $(OCAMLPP) -c $(PROGFILE)
- $(NOLINK) || $(OCAMLMKTOP) \
- swig.cmo \
- -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo \
- -g -ccopt -g -cclib -g -custom -o $(TARGET)_top \
- $(INTERFACE:%.i=%.cmo) \
- $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \
- -cclib "$(LIBS)" -cc '$(CXX) -Wno-write-strings'
+ $(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
+ test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
+ $(NOLINK) || $(OCAMLMKTOP) -cc '$(CXX) $(CPPFLAGS)' swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -cclib "$(LIBS)" -g -ccopt -g -cclib -g -custom -o $(RUNME)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS)
ocaml_dynamic_cpp: $(SRCDIR_SRCS)
- $(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
- $(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \
- $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) -ccopt -fPIC
- $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(INTERFACE:%.i=%@SO@) \
- $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \
- $(CPP_DLLIBS) $(LIBS)
- $(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > \
- $(INTERFACE:%.i=%_dynamic.ml)
+ $(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) -ccopt -fPIC
+ $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(INTERFACE:%.i=%@SO@) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(CPP_DLLIBS) $(LIBS)
+ $(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > $(INTERFACE:%.i=%_dynamic.ml)
mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml)
rm $(INTERFACE:%.i=%.mli)
$(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml)
- test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \
- $(OCC) $(OCAMLPP) -c $(PROGFILE)
- $(NOLINK) || $(OCAMLFIND) \
- swig.cmo \
- $(OCC) -cclib -export-dynamic -g -ccopt -g -cclib -g -custom \
- -o $(TARGET) \
- -package dl -linkpkg \
- $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) -cc '$(CXX) -Wno-write-strings'
+ test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
+ $(NOLINK) || $(OCAMLFIND) swig.cmo $(OCC) -cclib -export-dynamic -g -ccopt -g -cclib -g -custom -o $(RUNME) -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) -cc '$(CXX)'
# -----------------------------------------------------------------
# Run ocaml example
# -----------------------------------------------------------------
ocaml_run:
- $(RUNTOOL) ./$(TARGET) $(RUNPIPE)
+ $(RUNTOOL) ./$(RUNME) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@@ -1038,9 +952,10 @@ ocaml_version:
# -----------------------------------------------------------------
ocaml_clean:
- rm -f *_wrap* *~ .~* *.cmo *.cmi $(MLFILE) $(MLFILE)i swig.mli swig.cmi swig.ml swig.cmo swigp4.ml swigp4.cmo
+ rm -f *_wrap* *~ .~* *.cmo *.cmi *.mli $(TARGET).ml $(RUNME) $(RUNME)_top swig.ml swigp4.ml
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@
+ rm -rf ./localtmp
##################################################################
##### RUBY ######
@@ -1116,56 +1031,6 @@ ruby_clean:
rm -f *.@OBJEXT@ *$(RUBY_SO)
##################################################################
-##### PHP5 ######
-##################################################################
-
-PHP5 = @PHP5@
-PHP5_INCLUDE = @PHP5INC@
-PHP5_SO = @PHP5_SO@
-PHP5_SCRIPT = $(SRCDIR)$(RUNME).php
-
-# -------------------------------------------------------------------
-# Build a PHP5 dynamically loadable module (C)
-# -------------------------------------------------------------------
-
-php5: $(SRCDIR_SRCS)
- $(SWIG) -php5 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PHP5_INCLUDE)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP5_SO)
-
-# --------------------------------------------------------------------
-# Build a PHP5 dynamically loadable module (C++)
-# --------------------------------------------------------------------
-
-php5_cpp: $(SRCDIR_SRCS)
- $(SWIG) -php5 -cppext cxx -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP5_INCLUDE)
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP5_SO)
-
-# -----------------------------------------------------------------
-# Running a PHP5 example
-# -----------------------------------------------------------------
-
-php5_run:
- $(RUNTOOL) $(PHP5) -n -q -d extension_dir=. -d safe_mode=Off $(PHP5_SCRIPT) $(RUNPIPE)
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-php5_version:
- $(PHP5) -v | head -n 1
-
-# -----------------------------------------------------------------
-# Cleaning the PHP5 examples
-# -----------------------------------------------------------------
-
-php5_clean:
- rm -f *_wrap* *~ .~* example.php php_example.h
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *$(PHP5_SO)
-
-##################################################################
##### PHP7 ######
##################################################################
@@ -1216,194 +1081,6 @@ php_clean:
rm -f *.@OBJEXT@ *$(PHP_SO)
##################################################################
-##### Pike ######
-##################################################################
-
-# Make sure these locate your Pike installation
-PIKE = pike
-PIKE_CFLAGS = @PIKECCDLFLAGS@ -DHAVE_CONFIG_H
-PIKE_INCLUDE = @PIKEINCLUDE@
-PIKE_LIB = @PIKELIB@
-PIKE_DLNK = @PIKEDYNAMICLINKING@
-PIKE_LIBOPTS = @PIKELINK@ @LIBS@ $(SYSLIBS)
-PIKE_SCRIPT = $(RUNME).pike
-
-# ----------------------------------------------------------------
-# Build a C dynamically loadable module
-# ----------------------------------------------------------------
-
-pike: $(SRCDIR_SRCS)
- $(SWIG) -pike $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(PIKE_CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(PIKE_INCLUDE)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PIKE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
-
-# -----------------------------------------------------------------
-# Build a C++ dynamically loadable module
-# -----------------------------------------------------------------
-
-pike_cpp: $(SRCDIR_SRCS)
- $(SWIG) -c++ -pike $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(PIKE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(PIKE_INCLUDE)
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PIKE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
-
-# -----------------------------------------------------------------
-# Build statically linked Pike interpreter
-#
-# These should only be used in conjunction with the %include embed.i
-# library file
-# -----------------------------------------------------------------
-
-pike_static: $(SRCDIR_SRCS)
- $(SWIG) -pike -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(PIKE_CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \
- $(PIKE_INCLUDE) $(LIBS) -L$(PIKE_LIB) $(PIKE_LIBOPTS) -o $(TARGET)
-
-pike_cpp_static: $(SRCDIR_SRCS)
- $(SWIG) -c++ -pike -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PIKE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \
- $(PIKE_INCLUDE) $(LIBS) -L$(PIKE_LIB) $(PIKE_LIBOPTS) -o $(TARGET)
-
-# -----------------------------------------------------------------
-# Run pike example
-# -----------------------------------------------------------------
-
-pike_run:
- $(RUNTOOL) $(PIKE) $(PIKE_SCRIPT) $(RUNPIPE)
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-pike_version:
- $(PIKE) -v 2>&1 | head -n 1
-
-# -----------------------------------------------------------------
-# Cleaning the Pike examples
-# -----------------------------------------------------------------
-
-pike_clean:
- rm -f *_wrap* *~ .~* mypike@EXEEXT@
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@
-
-
-##################################################################
-##### Chicken ######
-##################################################################
-
-CHICKEN = @CHICKEN@
-CHICKEN_CSC = @CHICKEN_CSC@
-CHICKEN_CSI = @CHICKEN_CSI@
-CHICKEN_LIBOPTS = @CHICKENLIB@ $(SYSLIBS)
-CHICKEN_SHAREDLIBOPTS = @CHICKENSHAREDLIB@ $(SYSLIBS)
-CHICKEN_CFLAGS = @CHICKENOPTS@
-CHICKENOPTS = -quiet
-CHICKEN_MAIN =
-CHICKEN_SCRIPT = $(RUNME).scm
-
-# SWIG produces $(ISRCS) (the C wrapper file)
-# and $(CHICKEN_GENERATED_SCHEME) (the Scheme wrapper file):
-CHICKEN_GENERATED_SCHEME = $(INTERFACE:.i=.scm)
-CHICKEN_COMPILED_SCHEME = $(INTERFACE:.i=_chicken.c)
-CHICKEN_COMPILED_OBJECT = $(CHICKEN_COMPILED_SCHEME:.c=.@OBJEXT@)
-
-# flags for the main chicken sources (only used when compiling statically)
-CHICKEN_COMPILED_MAIN = $(CHICKEN_MAIN:.scm=_chicken.c)
-CHICKEN_COMPILED_MAIN_OBJECT = $(CHICKEN_COMPILED_MAIN:.c=.@OBJEXT@)
-
-# -----------------------------------------------------------------
-# Build a CHICKEN dynamically loadable module
-# -----------------------------------------------------------------
-
-# This is the old way to build chicken, but it does not work correctly with exceptions
-chicken_direct: $(SRCDIR_SRCS)
- $(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH)
- $(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \
- -dynamic -feature chicken-compile-shared \
- -output-file $(CHICKEN_COMPILED_SCHEME)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(CHICKEN_CFLAGS) \
- $(INCLUDES) $(CHICKEN_INCLUDE) $(ISRCS) $(SRCDIR_SRCS) $(CHICKEN_COMPILED_SCHEME)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(CHICKEN_COMPILED_OBJECT) $(OBJS) $(IOBJS) \
- $(LIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(LIBPREFIX)$(TARGET)$(SO)
-
-chicken_direct_cpp: $(SRCDIR_CXXSRCS) $(CHICKSRCS)
- $(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH)
- $(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \
- -dynamic -feature chicken-compile-shared \
- -output-file $(CHICKEN_COMPILED_SCHEME)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(CHICKEN_CFLAGS) \
- $(INCLUDES) $(CHICKEN_INCLUDE) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(CHICKEN_COMPILED_SCHEME)
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(CHICKEN_COMPILED_OBJECT) $(OBJS) $(IOBJS) \
- $(LIBS) $(CPP_DLLIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(LIBPREFIX)$(TARGET)$(SO)
-
-# -----------------------------------------------------------------
-# Build statically linked CHICKEN interpreter
-# -----------------------------------------------------------------
-
-# The following two targets are also used by the test suite
-chicken_static: $(SRCDIR_SRCS) $(CHICKSRCS)
- $(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH)
- $(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \
- -output-file $(CHICKEN_COMPILED_SCHEME)
- $(CHICKEN) $(CHICKEN_MAIN) $(CHICKENOPTS) \
- -output-file $(CHICKEN_MAIN:.scm=_chicken.c)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(CHICKEN_CFLAGS) \
- $(INCLUDES) $(CHICKEN_INCLUDE) $(ISRCS) $(SRCDIR_SRCS) \
- $(CHICKEN_COMPILED_SCHEME) $(CHICKEN_COMPILED_MAIN)
- $(CC) $(CFLAGS) $(LDFLAGS) $(CHICKEN_COMPILED_OBJECT) $(CHICKEN_COMPILED_MAIN_OBJECT) \
- $(OBJS) $(IOBJS) $(LIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(TARGET)
-
-chicken_static_cpp: $(SRCDIR_CXXSRCS) $(CHICKSRCS)
- $(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH)
- $(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \
- -output-file $(CHICKEN_COMPILED_SCHEME)
- $(CHICKEN) $(CHICKEN_MAIN) $(CHICKENOPTS) \
- -output-file $(CHICKEN_MAIN:.scm=_chicken.c)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(CHICKEN_CFLAGS) \
- $(INCLUDES) $(CHICKEN_INCLUDE) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) \
- $(CHICKEN_COMPILED_SCHEME) $(CHICKEN_COMPILED_MAIN)
- $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CHICKEN_COMPILED_OBJECT) $(CHICKEN_COMPILED_MAIN_OBJECT) \
- $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(TARGET)
-
-# ----------------------------------------------------------------
-# Build a shared library using csc
-# ----------------------------------------------------------------
-
-chicken:
- $(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH)
- $(COMPILETOOL) $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCDIR_SRCS) $(ISRCS) -o $(TARGET)$(SO)
-
-chicken_cpp:
- $(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH)
- $(COMPILETOOL) $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCDIR_SRCS) $(ICXXSRCS) $(SRCDIR_CXXSRCS) -o $(TARGET)$(SO)
-
-chicken_externalhdr:
- $(SWIG) -chicken -external-runtime $(TARGET)
-
-# -----------------------------------------------------------------
-# Run CHICKEN example
-# -----------------------------------------------------------------
-
-chicken_run:
- env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CHICKEN_CSI) $(CHICKEN_SCRIPT) $(RUNPIPE)
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-chicken_version:
- $(CHICKEN) -version | grep -i version
-
-# -----------------------------------------------------------------
-# Cleaning the CHICKEN examples
-# -----------------------------------------------------------------
-
-chicken_clean:
- rm -f *_wrap* *~ .~* *_chicken*
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@
-
-##################################################################
##### CSHARP ######
##################################################################
@@ -1417,7 +1094,7 @@ CSHARPCFLAGS = @CSHARPCFLAGS@
CSHARPFLAGS =
CSHARPOPTIONS =
CSHARPSO = @CSHARPSO@
-CSHARP_RUNME = $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$(RUNME).exe
+CSHARP_RUNME = ./$(RUNME).exe
# ----------------------------------------------------------------
# Build a CSharp dynamically loadable module (C)
@@ -1455,7 +1132,7 @@ csharp_compile: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
csharp_run:
- env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARP_RUNME) $(RUNPIPE)
+ env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) $(CSHARP_RUNME) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@@ -1598,42 +1275,6 @@ allegrocl_clean:
rm -f *.@OBJEXT@ *@SO@
##################################################################
-##### CLISP ######
-##################################################################
-
-CLISP = @CLISPBIN@
-CLISP_SCRIPT=$(RUNME).lisp
-
-clisp: $(SRCDIR_SRCS)
- $(SWIG) -clisp $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
-
-clisp_cpp: $(SRCDIR_SRCS)
- $(SWIG) -c++ -clisp $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
-
-# -----------------------------------------------------------------
-# Run CLISP example
-# -----------------------------------------------------------------
-
-clisp_run:
- $(RUNTOOL) $(CLISP) -batch -s $(CLISP_SCRIPT) $(RUNPIPE)
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-clisp_version:
- $(CLISP) --version | head -n 1
-
-# -----------------------------------------------------------------
-# Cleaning the CLISP examples
-# -----------------------------------------------------------------
-
-clisp_clean:
- rm -f *_wrap* *~ .~*
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@
-
-##################################################################
##### CFFI ######
##################################################################
@@ -1674,46 +1315,6 @@ cffi_clean:
rm -f *.@OBJEXT@ *@SO@
##################################################################
-##### UFFI ######
-##################################################################
-
-UFFI = @UFFIBIN@
-UFFI_SCRIPT=$(RUNME).lisp
-
-uffi: $(SRCDIR_SRCS)
- $(SWIG) -uffi $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
-# $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCDIR_SRCS)
-# $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
-
-uffi_cpp: $(SRCDIR_SRCS)
- $(SWIG) -c++ -uffi $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
-# $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES)
-# $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
-
-# -----------------------------------------------------------------
-# Run UFFI example
-# -----------------------------------------------------------------
-
-uffi_run:
- $(RUNTOOL) $(UFFI) -batch -s $(UFFI_SCRIPT) $(RUNPIPE)
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-uffi_version:
- $(UFFI) --version
-
-# -----------------------------------------------------------------
-# Cleaning the UFFI examples
-# -----------------------------------------------------------------
-
-uffi_clean:
- rm -f *_wrap* *~ .~*
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@
-
-##################################################################
##### R ######
##################################################################
@@ -1737,7 +1338,7 @@ r: $(SRCDIR_SRCS)
ifneq ($(SRCDIR_SRCS),)
$(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(R_CFLAGS) $(SRCDIR_SRCS) $(INCLUDES)
endif
- +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) $(OBJS) > /dev/null )
+ +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" PKG_CFLAGS="$(CFLAGS)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) $(OBJS) > /dev/null )
# ----------------------------------------------------------------
# Build a R dynamically loadable module (C++)
@@ -1747,7 +1348,7 @@ r_cpp: $(SRCDIR_CXXSRCS)
ifneq ($(SRCDIR_CXXSRCS),)
$(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(R_CFLAGS) $(SRCDIR_CXXSRCS) $(INCLUDES)
endif
- +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) $(OBJS) > /dev/null )
+ +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" PKG_CXXFLAGS="$(CXXFLAGS)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) $(OBJS) > /dev/null )
# -----------------------------------------------------------------
# Run R example
@@ -1835,79 +1436,41 @@ scilab_clean:
GO = @GO@
GOGCC = @GOGCC@
GCCGO = @GCCGO@
-GO1 = @GO1@
-GO12 = @GO12@
-GO13 = @GO13@
-GO15 = @GO15@
-GOC = @GOC@
GOOPT = @GOOPT@
GCCGOOPT = @GCCGOOPT@
GOVERSIONOPTION = @GOVERSIONOPTION@
GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
-GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) || $(GO15); then echo -pack ; fi`
GOSRCS = $(INTERFACE:.i=.go)
GOCSRCS = $(INTERFACE:.i=_gc.c)
-GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
-GOTOOL = `if $(GO1) ; then echo go tool; fi`
-GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-
GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
-GOPATHDIR = gopath/src/$(INTERFACE:.i=)
-
-GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
-GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
-GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
+GOPATHPARENTDIR = gopath/$(GOMOD)/src
+GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
# ----------------------------------------------------------------
# Build a Go module (C)
# ----------------------------------------------------------------
-go_nocgo: $(SRCDIR_SRCS)
- $(SWIG) -go $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
- $(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
- else \
- $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
- fi
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c -I . $(GOSRCS); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS); \
- $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} $(GOCSRCS); \
- rm -f $(GOPACKAGE); \
- if $(GO13) || $(GO15); then \
- cp $(GOGCOBJS) $(GOPACKAGE); \
- $(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- elif $(GO12); then \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- else \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
- fi; \
- fi
- if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
- fi
-
-go: $(SRCDIR_SRCS)
- $(SWIG) -go -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+$(GOPATHPARENTDIR)/go.mod:
+ @mkdir gopath 2>/dev/null || true
+ @mkdir gopath/$(GOMOD) 2>/dev/null || true
+ @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
+ @mkdir $(GOPATHDIR) 2>/dev/null || true
+ echo "module swigtests" > $(GOPATHDIR)/go.mod
+ echo "" >> $(GOPATHDIR)/go.mod
+ echo "go 1.12" >> $(GOPATHDIR)/go.mod
+ mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod
+
+go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
+ $(SWIG) -go -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
@mkdir gopath 2>/dev/null || true
- @mkdir gopath/src 2>/dev/null || true
- @mkdir gopath/src/$(INTERFACE:.i=) 2>/dev/null || true
- rm -f $(GOPATHDIR)/*
+ @mkdir gopath/$(GOMOD) 2>/dev/null || true
+ @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
+ @mkdir $(GOPATHDIR) 2>/dev/null || true
+ rm -rf $(GOPATHDIR)/*
cp $(ISRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@@ -1916,7 +1479,14 @@ go: $(SRCDIR_SRCS)
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
- GOPATH=`pwd`/gopath; \
+ @if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+ rm -f gopath/$(GOMOD)/src/runme/*; \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+ fi
+ GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
export CGO_CPPFLAGS; \
@@ -1924,82 +1494,29 @@ go: $(SRCDIR_SRCS)
export CGO_CFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
- (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
- cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
+ (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
if $(GOGCC); then \
- cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
- fi
+ cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
+ fi; \
if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE); \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
+ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
# ----------------------------------------------------------------
# Build a Go module (C++)
# ----------------------------------------------------------------
-go_cpp_nocgo: $(SRCDIR_SRCS)
- $(SWIG) -go -c++ $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
- if test -n "$(SRCDIR_CXXSRCS)$(SRCDIR_SRCS)"; then \
- $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_CXXSRCS) $(SRCDIR_SRCS) $(INCLUDES); \
- fi; \
- $(foreach f,$(ICXXSRCS), \
- $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) -o $(addsuffix .@OBJEXT@,$(basename $f)) $f $(INCLUDES); \
- ) \
- else \
- $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
- fi
- if ! $(GOGCC) ; then \
- $(foreach f,$(GOSRCS), \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f \
- ); \
- $(foreach f,$(GOCSRCS), \
- $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} \
- -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f; \
- ) \
- rm -f $(GOPACKAGE); \
- if $(GO13) || $(GO15); then \
- cp $(GOGCOBJS) $(GOPACKAGE); \
- $(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- elif $(GO12); then \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- else \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
- fi; \
- else \
- $(foreach f,$(GOSRCS), \
- $(COMPILETOOL) $(GCCGO) -g -c -I . -o $(addsuffix .@OBJEXT@,$(basename $f)) $f \
- ); \
- fi
- if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
- fi
-
-go_cpp: $(SRCDIR_SRCS)
- $(SWIG) -go -c++ -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
+ $(SWIG) -go -c++ -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
@mkdir gopath 2>/dev/null || true
- @mkdir gopath/src 2>/dev/null || true
- @mkdir gopath/src/$(INTERFACE:.i=) 2>/dev/null || true
- rm -f $(GOPATHDIR)/*
+ @mkdir gopath/$(GOMOD) 2>/dev/null || true
+ @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
+ @mkdir $(GOPATHDIR) 2>/dev/null || true
+ rm -rf $(GOPATHDIR)/*
cp $(ICXXSRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@@ -2011,7 +1528,14 @@ go_cpp: $(SRCDIR_SRCS)
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
- GOPATH=`pwd`/gopath; \
+ @if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+ rm -f gopath/$(GOMOD)/src/runme/*; \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+ fi
+ GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
export CGO_CPPFLAGS; \
@@ -2021,22 +1545,16 @@ go_cpp: $(SRCDIR_SRCS)
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
- (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
- cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
+ (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
if $(GOGCC); then \
- cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
- fi
+ cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
+ fi; \
if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE) -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
+ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
# -----------------------------------------------------------------
diff --git a/Examples/go/callback/gocallback.go b/Examples/go/callback/gocallback.go
index 20fd0627a..881f505e0 100644
--- a/Examples/go/callback/gocallback.go
+++ b/Examples/go/callback/gocallback.go
@@ -36,6 +36,6 @@ func DeleteGoCallback(p GoCallback) {
p.deleteCallback()
}
-func (p *goCallback) Run() {
+func (p *overwrittenMethodsOnCallback) Run() {
fmt.Println("GoCallback.Run")
}
diff --git a/Examples/go/callback/runme.go b/Examples/go/callback/runme.go
index 03ab0c5e2..7c9ffd681 100644
--- a/Examples/go/callback/runme.go
+++ b/Examples/go/callback/runme.go
@@ -1,8 +1,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/class/runme.go b/Examples/go/class/runme.go
index 8d68afb61..a09a18247 100644
--- a/Examples/go/class/runme.go
+++ b/Examples/go/class/runme.go
@@ -3,8 +3,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/constants/runme.go b/Examples/go/constants/runme.go
index 1427997a0..57ef21a8b 100644
--- a/Examples/go/constants/runme.go
+++ b/Examples/go/constants/runme.go
@@ -1,8 +1,9 @@
package main
import (
- "./example"
"fmt"
+
+ "swigtests/example"
)
func main() {
diff --git a/Examples/go/director/director.go b/Examples/go/director/director.go
index 4f99bfc6d..c70606af1 100644
--- a/Examples/go/director/director.go
+++ b/Examples/go/director/director.go
@@ -32,7 +32,7 @@ type overwrittenMethodsOnFooBarAbstract struct {
fb FooBarAbstract
// If additional constructor arguments have been given they are typically
- // stored here so that the overriden methods can use them.
+ // stored here so that the overridden methods can use them.
}
func (om *overwrittenMethodsOnFooBarAbstract) Foo() string {
@@ -59,7 +59,7 @@ func NewFooBarGo() FooBarGo {
// The memory of the FooBarAbstract director object instance can be
// automatically freed once the FooBarGo instance is garbage collected by
// uncommenting the following line. Please make sure to understand the
- // runtime.SetFinalizer specific gotchas before doing this. Furthemore
+ // runtime.SetFinalizer specific gotchas before doing this. Furthermore
// DeleteFooBarGo should be deleted if a finalizer is in use or the fooBarGo
// struct needs additional data to prevent double deletion.
// runtime.SetFinalizer(fbgs, FooBarGo.deleteFooBarAbstract)
diff --git a/Examples/go/director/runme.go b/Examples/go/director/runme.go
index 0d839bc88..e28eccba6 100644
--- a/Examples/go/director/runme.go
+++ b/Examples/go/director/runme.go
@@ -1,9 +1,10 @@
package main
import (
- "./example"
"fmt"
"os"
+
+ "swigtests/example"
)
func Compare(name string, got string, exp string) error {
diff --git a/Examples/go/enum/runme.go b/Examples/go/enum/runme.go
index 99d2651f4..c0642e0b5 100644
--- a/Examples/go/enum/runme.go
+++ b/Examples/go/enum/runme.go
@@ -1,8 +1,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/extend/runme.go b/Examples/go/extend/runme.go
index a56968937..716af52c5 100644
--- a/Examples/go/extend/runme.go
+++ b/Examples/go/extend/runme.go
@@ -3,8 +3,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/funcptr/runme.go b/Examples/go/funcptr/runme.go
index 44dae3c9e..87ec7d495 100644
--- a/Examples/go/funcptr/runme.go
+++ b/Examples/go/funcptr/runme.go
@@ -1,8 +1,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/multimap/runme.go b/Examples/go/multimap/runme.go
index 390205a80..2f8b20568 100644
--- a/Examples/go/multimap/runme.go
+++ b/Examples/go/multimap/runme.go
@@ -1,8 +1,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/pointer/runme.go b/Examples/go/pointer/runme.go
index 1414d341e..73c6b2b3c 100644
--- a/Examples/go/pointer/runme.go
+++ b/Examples/go/pointer/runme.go
@@ -1,8 +1,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/reference/runme.go b/Examples/go/reference/runme.go
index 004a04c2e..7391d9c8b 100644
--- a/Examples/go/reference/runme.go
+++ b/Examples/go/reference/runme.go
@@ -3,8 +3,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/simple/runme.go b/Examples/go/simple/runme.go
index 9eb0ff454..5bc055f2e 100644
--- a/Examples/go/simple/runme.go
+++ b/Examples/go/simple/runme.go
@@ -1,8 +1,9 @@
package main
import (
- "./example"
"fmt"
+
+ "swigtests/example"
)
func main() {
diff --git a/Examples/go/template/runme.go b/Examples/go/template/runme.go
index fca2f1b75..e000b1579 100644
--- a/Examples/go/template/runme.go
+++ b/Examples/go/template/runme.go
@@ -3,8 +3,9 @@
package main
import (
- . "./example"
"fmt"
+
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/variables/runme.go b/Examples/go/variables/runme.go
index 3d9737f5c..85ca8c638 100644
--- a/Examples/go/variables/runme.go
+++ b/Examples/go/variables/runme.go
@@ -3,8 +3,9 @@
package main
import (
- "./example"
"fmt"
+
+ "swigtests/example"
)
func main() {
diff --git a/Examples/guile/matrix/runme.scm b/Examples/guile/matrix/runme.scm
index 1d2332fb0..b898bb485 100644
--- a/Examples/guile/matrix/runme.scm
+++ b/Examples/guile/matrix/runme.scm
@@ -12,7 +12,7 @@
;;; Explanation: The three lines at the beginning of this script are
;;; telling the kernel to load the enhanced guile interpreter named
;;; "matrix"; to execute the function "do-test" (-e option) after loading
-;;; this script (-s option). There are a lot more options wich allow for
+;;; this script (-s option). There are a lot more options which allow for
;;; even finer tuning. SEE ALSO: Section "Guile Scripts" in the "Guile
;;; reference manual -- Part I: Preliminaries".
;;;
diff --git a/Examples/guile/multivalue/example.i b/Examples/guile/multivalue/example.i
index 135389487..0ef710132 100644
--- a/Examples/guile/multivalue/example.i
+++ b/Examples/guile/multivalue/example.i
@@ -15,14 +15,14 @@ back to this behavior, use: */
void divide_l(int a, int b, int *OUTPUT, int *OUTPUT);
-/* Multiple values as vectors. By issueing: */
+/* Multiple values as vectors. By issuing: */
%values_as_vector;
/* vectors instead of lists will be used. */
void divide_v(int a, int b, int *OUTPUT, int *OUTPUT);
/* Multiple values for multiple-value continuations.
- (This is the most elegant way.) By issueing: */
+ (This is the most elegant way.) By issuing: */
%multiple_values;
/* multiple values are passed to the multiple-value
continuation, as created by `call-with-values' or the
diff --git a/Examples/guile/simple/example.c b/Examples/guile/simple/example.c
index dcafc4dc4..1c2af789c 100644
--- a/Examples/guile/simple/example.c
+++ b/Examples/guile/simple/example.c
@@ -1,21 +1,18 @@
-/* Simple example from documentation */
/* File : example.c */
-#include <time.h>
+/* A global variable */
+double Foo = 3.0;
-double My_variable = 3.0;
-
-int fact(int n) {
- if (n <= 1) return 1;
- else return n*fact(n-1);
+/* Compute the greatest common divisor of positive integers */
+int gcd(int x, int y) {
+ int g;
+ g = y;
+ while (x > 0) {
+ g = x;
+ x = y % x;
+ y = g;
+ }
+ return g;
}
-int mod(int n, int m) {
- return (n % m);
-}
-char *get_time() {
- long ltime;
- time(&ltime);
- return ctime(&ltime);
-}
diff --git a/Examples/guile/simple/example.i b/Examples/guile/simple/example.i
index 1a9930a14..4fcea98b2 100644
--- a/Examples/guile/simple/example.i
+++ b/Examples/guile/simple/example.i
@@ -5,10 +5,8 @@
%}
%inline %{
-extern double My_variable;
-extern int fact(int);
-extern int mod(int n, int m);
-extern char *get_time();
+extern int gcd(int x, int y);
+extern double Foo;
%}
%include guile/guilemain.i
diff --git a/Examples/guile/simple/runme.scm b/Examples/guile/simple/runme.scm
index c3fd0b41f..ccd755701 100644
--- a/Examples/guile/simple/runme.scm
+++ b/Examples/guile/simple/runme.scm
@@ -3,24 +3,20 @@
(for-each display args)
(newline))
-(mdisplay-newline (get-time) "My variable = " (My-variable))
+; Call our gcd() function
-(do ((i 0 (1+ i)))
- ((= 14 i))
- (mdisplay-newline i " factorial is " (fact i)))
+(define x 42)
+(define y 105)
+(define g (gcd x y))
+(mdisplay-newline "The gcd of " x " and " y " is " g)
-(define (mods i imax j jmax)
- (if (< i imax)
- (if (< j jmax)
- (begin
- (My-variable (+ (My-variable) (mod i j)))
- (mods i imax (+ j 1) jmax))
- (mods (+ i 1) imax 1 jmax))))
+; Manipulate the Foo global variable
-(mods 1 150 1 150)
+; Output its current value
+(mdisplay-newline "Foo = " (Foo))
-(mdisplay-newline "My-variable = " (My-variable))
-
-(exit (and (= 1932053504 (fact 13))
- (= 745470.0 (My-variable))))
+; Change its value
+(Foo 3.1415926)
+; See if the change took effect
+(mdisplay-newline "Foo = " (Foo))
diff --git a/Examples/guile/std_vector/example.h b/Examples/guile/std_vector/example.h
index 4f0dac70d..52e260d6d 100644
--- a/Examples/guile/std_vector/example.h
+++ b/Examples/guile/std_vector/example.h
@@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
}
void halve_in_place(std::vector<double>& v) {
- // would you believe this is the same as the above?
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
diff --git a/Examples/java/check.list b/Examples/java/check.list
index 825d04a6d..c30550a1c 100644
--- a/Examples/java/check.list
+++ b/Examples/java/check.list
@@ -2,6 +2,7 @@
callback
class
constants
+doxygen
enum
extend
funcptr
diff --git a/Examples/php5/overloading/Makefile b/Examples/java/doxygen/Makefile
index 8346a1dae..9f471746e 100644
--- a/Examples/php5/overloading/Makefile
+++ b/Examples/java/doxygen/Makefile
@@ -4,17 +4,18 @@ SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
-LIBS =
-SWIGOPT =
+SWIGOPT = -doxygen
+JAVASRCS = *.java
check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5_cpp
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean
+ rm -rf javadocs
diff --git a/Examples/java/doxygen/example.cxx b/Examples/java/doxygen/example.cxx
new file mode 100644
index 000000000..ccdb87dfe
--- /dev/null
+++ b/Examples/java/doxygen/example.cxx
@@ -0,0 +1,48 @@
+/* File : example.cxx */
+
+#include "example.h"
+#define M_PI 3.14159265358979323846
+
+/* Move the shape to a new location */
+void Shape::move(double dx, double dy) {
+ x += dx;
+ y += dy;
+}
+
+int Shape::nshapes = 0;
+
+Circle::Circle(double r) : radius(r) {
+ NumCircles++;
+}
+
+double Circle::area() {
+ return M_PI*radius*radius;
+}
+
+double Circle::perimeter() {
+ return 2*M_PI*radius;
+}
+
+Square::Square(double w) : width(w) {
+ NumSquares++;
+}
+
+double Square::area() {
+ return width*width;
+}
+
+double Square::perimeter() {
+ return 4*width;
+}
+
+int NumSquares = 0;
+int NumCircles = 0;
+
+Square MakeSquare(double r) {
+ return Square(r);
+}
+
+Circle MakeCircle(double w) {
+ return Circle(w);
+}
+
diff --git a/Examples/java/doxygen/example.dsp b/Examples/java/doxygen/example.dsp
new file mode 100644
index 000000000..f52544b95
--- /dev/null
+++ b/Examples/java/doxygen/example.dsp
@@ -0,0 +1,162 @@
+# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=example - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "example.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "example - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /out:"example.dll" /pdbtype:sept
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Java compile post-build step
+PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "example - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"example.dll"
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Java compile post-build step
+PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "example - Win32 Debug"
+# Name "example - Win32 Release"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\example.cxx
+# End Source File
+# Begin Source File
+
+SOURCE=.\example_wrap.cxx
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\example.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\example.i
+
+!IF "$(CFG)" == "example - Win32 Debug"
+
+# Begin Custom Build
+InputPath=.\example.i
+InputName=example
+
+"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ echo In order to function correctly, please ensure the following environment variables are correctly set:
+ echo JAVA_INCLUDE: %JAVA_INCLUDE%
+ echo JAVA_BIN: %JAVA_BIN%
+ echo on
+ ..\..\..\swig.exe -c++ -java "$(InputPath)"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "example - Win32 Release"
+
+# Begin Custom Build
+InputPath=.\example.i
+InputName=example
+
+"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ echo In order to function correctly, please ensure the following environment variables are correctly set:
+ echo JAVA_INCLUDE: %JAVA_INCLUDE%
+ echo JAVA_BIN: %JAVA_BIN%
+ echo on
+ ..\..\..\swig.exe -c++ -java "$(InputPath)"
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/Examples/java/doxygen/example.h b/Examples/java/doxygen/example.h
new file mode 100644
index 000000000..203348ae4
--- /dev/null
+++ b/Examples/java/doxygen/example.h
@@ -0,0 +1,107 @@
+/*! \file example.h
+This file provides a simple set of Shape classes. */
+
+/*! Base class for all shapes.
+ \author Bob
+ */
+class Shape {
+public:
+ /*! Default constructor for creating a Shape */
+ Shape() {
+ nshapes++;
+ }
+ /*! Destructor for destroying a Shape */
+ virtual ~Shape() {
+ nshapes--;
+ }
+ double x; /*!< x co-ordinate */
+ double y; /*!< y co-ordinate */
+ void move(double dx, double dy); /*!< Move a shape to a new co-ordinate
+ \param dx x co-ordinate
+ \param dy y co-ordinate */
+ virtual double area() = 0; /*!< \return the area */
+ virtual double perimeter() = 0; /*!< \return the perimeter */
+ static int nshapes; /*!< Number of shapes currently in existence */
+};
+
+/*! A class for representing a circle.
+ \author Jack
+ */
+class Circle : public Shape {
+private:
+ double radius;
+public:
+ /*! Construct a circle
+ * \param r radius of the circle */
+ Circle(double r);
+ /*! Calculate the area of the circle
+ * \return calculated area */
+ virtual double area();
+ /*! Calculate the perimeter of the circle
+ * \return calculated perimeter of the circle */
+ virtual double perimeter();
+};
+
+/// A class for representing a square.
+class Square : public Shape {
+private:
+ double width;
+public:
+ /** Construct a square
+ * \param w width of the square */
+ Square(double w);
+ /** Calculate the area of the square
+ * \return calculated area */
+ virtual double area();
+ /** Calculate the perimeter of the square
+ * \return calculated perimeter of the square */
+ virtual double perimeter();
+};
+
+/// A class for representing a rectangle, templated on the type for the rectangle dimensions
+template<typename T>
+class Rectangle : public Shape {
+private:
+ T height;
+ T width;
+public:
+ /** Construct a rectangle
+ * \param h height of the rectangle
+ * \param w width of the rectangle */
+ Rectangle(T h, T w) : height(h), width(w) {}
+ /** Calculate the area of the rectangle
+ * \return calculated area */
+ virtual double area() { return width*height; }
+ /** Calculate the perimeter of the rectangle
+ * \return calculated perimeter of the rectangle */
+ virtual double perimeter() { return 2*height + 2*width; }
+};
+
+
+/*! Factory function for creating a square
+ * \param r width of the square
+ * \return a fully constructed square */
+Square MakeSquare(double r);
+
+/*! Factory function for creating a circle
+ * \param w radius of the circle
+ * \return a fully constructed circle */
+Circle MakeCircle(double w);
+
+/*! Factory function for creating a rectangle
+ * \param h height of the rectangle
+ * \param w width of the rectangle
+ * \return a fully constructed rectangle */
+template<typename T>
+Rectangle<T> MakeRectangle(T h, T w) {
+ return Rectangle<T>(h, w);
+}
+
+
+
+/*! Total number of circles ever created */
+extern int NumCircles;
+
+/// Total number of squares ever created
+extern int NumSquares;
+
diff --git a/Examples/java/doxygen/example.i b/Examples/java/doxygen/example.i
new file mode 100644
index 000000000..803563dd9
--- /dev/null
+++ b/Examples/java/doxygen/example.i
@@ -0,0 +1,17 @@
+%module example
+
+%{
+#include "example.h"
+%}
+
+%immutable NumSquares;
+%immutable NumCircles;
+
+%include "example.h"
+
+/*! - this instantiation uses type int */
+%template(RectangleInt) Rectangle<int>;
+
+/*! - this instantiation uses type int */
+%template(MakeRectangleInt) MakeRectangle<int>;
+
diff --git a/Examples/java/doxygen/runme.java b/Examples/java/doxygen/runme.java
new file mode 100644
index 000000000..6b7bb3d01
--- /dev/null
+++ b/Examples/java/doxygen/runme.java
@@ -0,0 +1,63 @@
+// This example shows simple usage of the wrapped Shape classes.
+// The main purpose of this example is to show the doxygen comments translation to JavaDoc comments.
+// Users should look at the generated .java files and if javadoc is installed and working on your system,
+// the generated Java docs can be viewed in a browser by opening the javadocs/index.html file.
+
+import java.io.*;
+
+public class runme {
+ static {
+ try {
+ System.loadLibrary("example");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) throws InterruptedException, IOException
+ {
+ System.out.println("Creating some objects:");
+ Circle c = example.MakeCircle(10);
+ System.out.println(" Created circle " + c);
+ Square s = example.MakeSquare(10);
+ System.out.println(" Created square " + s);
+ RectangleInt r = example.MakeRectangleInt(10, 20);
+ System.out.println(" Created rectangle " + r);
+
+ System.out.println("\nHere are some properties of the shapes:");
+ Shape[] shapes = {c, s, r};
+ for (int i=0; i<shapes.length; i++) {
+ System.out.println(" " + shapes[i].toString());
+ System.out.println(" area = " + shapes[i].area());
+ System.out.println(" perimeter = " + shapes[i].perimeter());
+ }
+
+ String command = "javadoc -quiet -public -d javadocs example.java Shape.java Circle.java Square.java RectangleInt.java";
+ System.out.println("\nRunning: " + command);
+ Process p = Runtime.getRuntime().exec(command);
+ int exitCode = p.waitFor();
+ System.out.println("javadoc exited with code " + exitCode);
+
+ BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+
+ String line = null;
+
+ System.out.println("stdout from javadoc:\n");
+ while ((line = stdout.readLine()) != null) {
+ System.out.println(line);
+ }
+
+ System.out.println("\nstderr from javadoc:\n");
+ while ((line = stderr.readLine()) != null) {
+ System.out.println(line);
+ }
+
+ if (exitCode != 0) {
+ System.out.println("No java docs were generated!\n");
+ } else {
+ System.out.println("javadoc ran successfully, open javadocs/index.html in your browser to view the generated java docs.");
+ }
+ }
+}
diff --git a/Examples/java/variables/runme.java b/Examples/java/variables/runme.java
index 361a30fa6..a53cc543c 100644
--- a/Examples/java/variables/runme.java
+++ b/Examples/java/variables/runme.java
@@ -76,7 +76,7 @@ public class runme {
System.out.println( " Trying to set 'status'" );
try {
Method m = example.class.getDeclaredMethod("setStatus", new Class[] {Integer.class});
- m.invoke(example.class, new Object[] {new Integer(0)} );
+ m.invoke(example.class, new Object[] {Integer.valueOf(0)} );
System.out.println( "Hey, what's going on?!?! This shouldn't work" );
}
catch (NoSuchMethodException e) {
diff --git a/Examples/javascript/check.list b/Examples/javascript/check.list
index 9707e77d4..977835755 100644
--- a/Examples/javascript/check.list
+++ b/Examples/javascript/check.list
@@ -3,6 +3,7 @@ constant
enum
exception
functor
+native
nspace
operator
overload
diff --git a/Examples/javascript/enum/runme.js b/Examples/javascript/enum/runme.js
index 851d43c4b..f3264889c 100644
--- a/Examples/javascript/enum/runme.js
+++ b/Examples/javascript/enum/runme.js
@@ -30,5 +30,5 @@ f.enum_test(example.Foo.LUDICROUS);
// enum value BLUE of enum color is accessed as property of cconst
console.log("example.BLUE= " + example.BLUE);
-// enum value LUDICROUS of enum Foo::speed is accessed as as property of cconst
+// enum value LUDICROUS of enum Foo::speed is accessed as property of cconst
console.log("example.speed.LUDICROUS= " + example.Foo.LUDICROUS);
diff --git a/Examples/javascript/exception/example.h b/Examples/javascript/exception/example.h
index 7cf917d01..bc744cda7 100644
--- a/Examples/javascript/exception/example.h
+++ b/Examples/javascript/exception/example.h
@@ -16,30 +16,26 @@ public:
char msg[256];
};
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
class Test {
public:
- int simple() throw(int) {
+ int simple() {
throw(37);
return 1;
}
- int message() throw(const char *) {
+ int message() {
throw("I died.");
return 1;
}
- int hosed() throw(Exc) {
+ int hosed() {
throw(Exc(42,"Hosed"));
return 1;
}
- int unknown() throw(A*) {
+ int unknown() {
static A a;
throw &a;
return 1;
}
- int multi(int x) throw(int, const char *, Exc) {
+ int multi(int x) {
if (x == 1) throw(37);
if (x == 2) throw("Bleah!");
if (x == 3) throw(Exc(42,"No-go-diggy-die"));
@@ -47,7 +43,3 @@ public:
}
};
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
diff --git a/Examples/javascript/exception/example.i b/Examples/javascript/exception/example.i
index 08672c3a8..ca1084452 100644
--- a/Examples/javascript/exception/example.i
+++ b/Examples/javascript/exception/example.i
@@ -7,6 +7,12 @@
%include "std_string.i"
+%catches(int) Test::simple();
+%catches(const char *) Test::message();
+%catches(Exc) Test::hosed();
+%catches(A*) Test::unknown();
+%catches(int, const char *, Exc) Test::multi(int x);
+
/* Let's just grab the original header file here */
%include "example.h"
diff --git a/Examples/javascript/exception/runme.js b/Examples/javascript/exception/runme.js
index 43ce66d6d..1001a7111 100644
--- a/Examples/javascript/exception/runme.js
+++ b/Examples/javascript/exception/runme.js
@@ -10,7 +10,7 @@ try{
if(error == -1) {
console.log("t.unknown() didn't throw");
} else {
- console.log("successfully catched throw in Test::unknown().");
+ console.log("successfully caught throw in Test::unknown().");
}
}
@@ -22,7 +22,7 @@ catch(error){
if(error == -1) {
console.log("t.simple() did not throw");
} else {
- console.log("successfully catched throw in Test::simple().");
+ console.log("successfully caught throw in Test::simple().");
}
}
@@ -33,7 +33,7 @@ try{
if(error == -1) {
console.log("t.message() did not throw");
} else {
- console.log("successfully catched throw in Test::message().");
+ console.log("successfully caught throw in Test::message().");
}
}
@@ -45,7 +45,7 @@ catch(error){
if(error == -1) {
console.log("t.hosed() did not throw");
} else {
- console.log("successfully catched throw in Test::hosed().");
+ console.log("successfully caught throw in Test::hosed().");
}
}
@@ -58,7 +58,7 @@ for (var i=1; i<4; i++) {
if(error == -1) {
console.log("t.multi(" + i + ") did not throw");
} else {
- console.log("successfully catched throw in Test::multi().");
+ console.log("successfully caught throw in Test::multi().");
}
}
}
diff --git a/Examples/javascript/native/Makefile b/Examples/javascript/native/Makefile
new file mode 100644
index 000000000..0402f8d09
--- /dev/null
+++ b/Examples/javascript/native/Makefile
@@ -0,0 +1,3 @@
+SRCS =
+
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/native/binding.gyp.in b/Examples/javascript/native/binding.gyp.in
new file mode 100644
index 000000000..59779aef4
--- /dev/null
+++ b/Examples/javascript/native/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/native/example.i b/Examples/javascript/native/example.i
new file mode 100644
index 000000000..8c6160060
--- /dev/null
+++ b/Examples/javascript/native/example.i
@@ -0,0 +1,47 @@
+/* File : example.i */
+%module example
+
+// placeholder() used to help SWIG generate "SWIG_From_int" call
+%{
+ int placeholder();
+%}
+int placeholder() { return 0; }
+
+// actual demo code
+%wrapper
+%{
+#ifdef SWIG_V8_VERSION /* Engine: Node || V8 */
+
+ static SwigV8ReturnValue JavaScript_do_work(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+ const int MY_MAGIC_NUMBER = 5;
+ v8::Handle<v8::Value> jsresult =
+ SWIG_From_int(static_cast< int >(MY_MAGIC_NUMBER));
+ if (args.Length() != 0)
+ SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+ SWIGV8_RETURN(jsresult);
+ fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+ }
+
+#else /* Engine: JavaScriptCore */
+
+ static JSValueRef JavaScript_do_work(JSContextRef context,
+ JSObjectRef function, JSObjectRef thisObject, size_t argc,
+ const JSValueRef argv[], JSValueRef* exception) {
+ const int MY_MAGIC_NUMBER = 5;
+ JSValueRef jsresult =
+ SWIG_From_int SWIG_JSC_FROM_CALL_ARGS(
+ static_cast< int >(MY_MAGIC_NUMBER));
+ if (argc != 0)
+ SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+ return jsresult;
+ fail:
+ return JSValueMakeUndefined(context);
+ }
+
+#endif
+%}
+
+
+%native(magicNumber) void JavaScript_do_work();
diff --git a/Examples/javascript/native/example.js b/Examples/javascript/native/example.js
new file mode 100644
index 000000000..2e7f83a06
--- /dev/null
+++ b/Examples/javascript/native/example.js
@@ -0,0 +1 @@
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/native/index.html b/Examples/javascript/native/index.html
new file mode 100644
index 000000000..7c7d6b071
--- /dev/null
+++ b/Examples/javascript/native/index.html
@@ -0,0 +1,31 @@
+<html>
+<head>
+<title>SWIG:Examples:javascript:native</title>
+</head>
+
+<body bgcolor="#ffffff">
+
+
+<tt>SWIG/Examples/javascript/native/</tt>
+<hr>
+
+<H2>Manually wrapped callback function in JavaScript</H2>
+
+<p>
+This example demonstrates how to manually add callback feature support to a SWIG module.
+</p>
+
+<ul>
+<li><a href="example.i">example.i</a>. Interface file containing the API function and async behind-the-scenes functions.
+<li><a href="runme.java">runme.js</a>. Sample JavaScript program showing the API function being called with a callback function parameter.
+</ul>
+
+<h2>Notes</h2>
+
+The V8 code queues the callback request for processing using the UV interface. An async function callback is invoked when the system is ready to process the next request. When the async function finishes, a completion function callback is invoked to finalize the request. Here the callback function parameter is invoked.
+<br/><br/>
+UV request queueing is only necessary for operations that would take a really long or otherwise unpredictable amount of time (async operations). A callback parameter could also be invoked immediately within the API function.
+
+<hr>
+</body>
+</html>
diff --git a/Examples/javascript/native/runme.js b/Examples/javascript/native/runme.js
new file mode 100644
index 000000000..b5e14d037
--- /dev/null
+++ b/Examples/javascript/native/runme.js
@@ -0,0 +1,3 @@
+var example = require("example");
+
+console.log("My magic number is: ", example.magicNumber());
diff --git a/Examples/javascript/variables/runme.js b/Examples/javascript/variables/runme.js
index a2b5f791c..36ddc5fe9 100644
--- a/Examples/javascript/variables/runme.js
+++ b/Examples/javascript/variables/runme.js
@@ -44,7 +44,7 @@ example.print_vars();
console.log("\nNow I'm going to try and modify some read only variables");
-console.log("Tring to set 'path'");
+console.log("Trying to set 'path'");
try{
example.path = "Whoa!";
console.log("Hey, what's going on?!?! This shouldn't work");
diff --git a/Examples/lua/arrays/runme.lua b/Examples/lua/arrays/runme.lua
index d0aa99813..daba2267f 100644
--- a/Examples/lua/arrays/runme.lua
+++ b/Examples/lua/arrays/runme.lua
@@ -1,6 +1,6 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/class/runme.lua b/Examples/lua/class/runme.lua
index 5d140defe..50ac35d6d 100644
--- a/Examples/lua/class/runme.lua
+++ b/Examples/lua/class/runme.lua
@@ -5,7 +5,7 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/constants/runme.lua b/Examples/lua/constants/runme.lua
index 751e7d623..ad6bd45d2 100644
--- a/Examples/lua/constants/runme.lua
+++ b/Examples/lua/constants/runme.lua
@@ -2,7 +2,7 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/dual/dual.cpp b/Examples/lua/dual/dual.cpp
index 2108a7275..d2b3c75c4 100644
--- a/Examples/lua/dual/dual.cpp
+++ b/Examples/lua/dual/dual.cpp
@@ -16,7 +16,7 @@ and check to see if types Foo and Bar are registered with it
(Bar should be & Foo should not)
Note: Though both the modules exist and are loaded, they are not linked together,
-as they are connected to seperate lua interpreters.
+as they are connected to separate lua interpreters.
When the third lua state loads both example.i and example2.i,
the two modules are now linked together, and all can now find
diff --git a/Examples/lua/exception/example.h b/Examples/lua/exception/example.h
index 251ef1132..bc744cda7 100644
--- a/Examples/lua/exception/example.h
+++ b/Examples/lua/exception/example.h
@@ -1,6 +1,6 @@
/* File : example.h */
-#include <string>
+#include <string.h>
#ifndef SWIG
struct A {
};
@@ -16,30 +16,26 @@ public:
char msg[256];
};
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
class Test {
public:
- int simple() throw(int&) {
+ int simple() {
throw(37);
return 1;
}
- int message() throw(const char *) {
+ int message() {
throw("I died.");
return 1;
}
- int hosed() throw(Exc) {
+ int hosed() {
throw(Exc(42,"Hosed"));
return 1;
}
- int unknown() throw(A*) {
+ int unknown() {
static A a;
throw &a;
return 1;
}
- int multi(int x) throw(int, const char *, Exc) {
+ int multi(int x) {
if (x == 1) throw(37);
if (x == 2) throw("Bleah!");
if (x == 3) throw(Exc(42,"No-go-diggy-die"));
@@ -47,7 +43,3 @@ public:
}
};
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
diff --git a/Examples/lua/exception/example.i b/Examples/lua/exception/example.i
index 6187f8eff..a6b43837d 100644
--- a/Examples/lua/exception/example.i
+++ b/Examples/lua/exception/example.i
@@ -12,6 +12,12 @@
// note: only works if Exc is copyable
%apply SWIGTYPE EXCEPTION_BY_VAL {Exc};
+%catches(int) Test::simple();
+%catches(const char *) Test::message();
+%catches(Exc) Test::hosed();
+%catches(A*) Test::unknown();
+%catches(int, const char *, Exc) Test::multi(int x);
+
/* Let's just grab the original header file here */
%include "example.h"
diff --git a/Examples/lua/exception/runme.lua b/Examples/lua/exception/runme.lua
index a798efca7..adb2516c4 100644
--- a/Examples/lua/exception/runme.lua
+++ b/Examples/lua/exception/runme.lua
@@ -2,7 +2,7 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
@@ -48,7 +48,7 @@ else
end
-- this is a rather strange way to perform the multiple catch of exceptions
-print "calling t:mutli()"
+print "calling t:multi()"
for i=1,3 do
ok,res=pcall(function() t:multi(i) end)
if ok then
diff --git a/Examples/lua/funcptr3/runme.lua b/Examples/lua/funcptr3/runme.lua
index b78c504ef..3cd58520f 100644
--- a/Examples/lua/funcptr3/runme.lua
+++ b/Examples/lua/funcptr3/runme.lua
@@ -1,6 +1,6 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/functest/runme.lua b/Examples/lua/functest/runme.lua
index 65b3cc215..773ab5dd6 100644
--- a/Examples/lua/functest/runme.lua
+++ b/Examples/lua/functest/runme.lua
@@ -1,6 +1,6 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/functor/runme.lua b/Examples/lua/functor/runme.lua
index adf124ac6..d6f4d08c7 100644
--- a/Examples/lua/functor/runme.lua
+++ b/Examples/lua/functor/runme.lua
@@ -1,7 +1,7 @@
-- Operator overloading example
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/import/runme.lua b/Examples/lua/import/runme.lua
index 9cd7ae06c..7057b7bbd 100644
--- a/Examples/lua/import/runme.lua
+++ b/Examples/lua/import/runme.lua
@@ -3,7 +3,7 @@
print("Testing the %import directive")
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
function loadit(a)
lib=loadlib(a..'.dll','luaopen_'..a) or loadlib(a..'.so','luaopen_'..a)
assert(lib)()
diff --git a/Examples/lua/nspace/runme.lua b/Examples/lua/nspace/runme.lua
index 876814052..a894cf849 100644
--- a/Examples/lua/nspace/runme.lua
+++ b/Examples/lua/nspace/runme.lua
@@ -5,7 +5,7 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/owner/runme.lua b/Examples/lua/owner/runme.lua
index 847645448..4d953cba6 100644
--- a/Examples/lua/owner/runme.lua
+++ b/Examples/lua/owner/runme.lua
@@ -1,7 +1,7 @@
-- Operator overloading example
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/pointer/runme.lua b/Examples/lua/pointer/runme.lua
index 8deee67e6..2906cc663 100644
--- a/Examples/lua/pointer/runme.lua
+++ b/Examples/lua/pointer/runme.lua
@@ -1,6 +1,6 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/simple/runme.lua b/Examples/lua/simple/runme.lua
index 1e5a139c8..5f2e95c2f 100644
--- a/Examples/lua/simple/runme.lua
+++ b/Examples/lua/simple/runme.lua
@@ -1,6 +1,6 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
diff --git a/Examples/lua/variables/runme.lua b/Examples/lua/variables/runme.lua
index 05b2d3fbf..826845e90 100644
--- a/Examples/lua/variables/runme.lua
+++ b/Examples/lua/variables/runme.lua
@@ -1,6 +1,6 @@
---- importing ----
if string.sub(_VERSION,1,7)=='Lua 5.0' then
- -- lua5.0 doesnt have a nice way to do this
+ -- lua5.0 doesn't have a nice way to do this
lib=loadlib('example.dll','luaopen_example') or loadlib('example.so','luaopen_example')
assert(lib)()
else
@@ -54,9 +54,9 @@ example.print_vars()
print "\nNow I'm going to try and modify some read only variables";
-print " Tring to set 'path' to 'Whoa!'";
+print " Trying to set 'path' to 'Whoa!'";
if pcall(function() example.path = "Whoa!" end)==true then
- print " Thats funny, it didn't give an error!"
+ print " That's funny, it didn't give an error!"
else
print " It gave an error, as it should"
end
@@ -64,7 +64,7 @@ print(" Just checking the value: path =", example.path)
print " Trying to set 'status' to '0'";
if pcall(function() example.status = 0 end)==true then
- print " Thats funny, it didn't give an error!"
+ print " That's funny, it didn't give an error!"
else
print " It gave an error, as it should"
end
diff --git a/Examples/mzscheme/check.list b/Examples/mzscheme/check.list
index f9e4f11c7..d2554c41c 100644
--- a/Examples/mzscheme/check.list
+++ b/Examples/mzscheme/check.list
@@ -1,4 +1,5 @@
# see top-level Makefile.in
+class
multimap
simple
std_vector
diff --git a/Examples/php5/class/Makefile b/Examples/mzscheme/class/Makefile
index 8346a1dae..0b36a60d7 100644
--- a/Examples/php5/class/Makefile
+++ b/Examples/mzscheme/class/Makefile
@@ -4,17 +4,15 @@ SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
-LIBS =
SWIGOPT =
check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run
build:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5_cpp
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme_cpp
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
diff --git a/Examples/php5/class/example.cxx b/Examples/mzscheme/class/example.cxx
index 046304519..046304519 100644
--- a/Examples/php5/class/example.cxx
+++ b/Examples/mzscheme/class/example.cxx
diff --git a/Examples/php5/class/example.h b/Examples/mzscheme/class/example.h
index 0dff185b2..0dff185b2 100644
--- a/Examples/php5/class/example.h
+++ b/Examples/mzscheme/class/example.h
diff --git a/Examples/php5/class/example.i b/Examples/mzscheme/class/example.i
index fbdf7249f..fbdf7249f 100644
--- a/Examples/php5/class/example.i
+++ b/Examples/mzscheme/class/example.i
diff --git a/Examples/mzscheme/class/runme.scm b/Examples/mzscheme/class/runme.scm
new file mode 100644
index 000000000..dea0b75bc
--- /dev/null
+++ b/Examples/mzscheme/class/runme.scm
@@ -0,0 +1,60 @@
+; file: runme.scm
+
+; This file illustrates the proxy class C++ interface generated
+; by SWIG.
+
+(load-extension "example.so")
+
+; Convenience wrapper around the display function
+; (which only accepts one argument at the time)
+
+(define (mdisplay-newline . args)
+ (for-each display args)
+ (newline))
+
+; ----- Object creation -----
+
+(mdisplay-newline "Creating some objects:")
+(define c (new-Circle 10))
+(mdisplay-newline " Created circle " c)
+(define s (new-Square 10))
+(mdisplay-newline " Created square " s)
+
+; ----- Access a static member -----
+
+(mdisplay-newline "\nA total of " (Shape-nshapes) " shapes were created")
+
+; ----- Member data access -----
+
+; Set the location of the object
+
+(Shape-x-set c 20)
+(Shape-y-set c 30)
+
+(Shape-x-set s -10)
+(Shape-y-set s 5)
+
+(mdisplay-newline "\nHere is their current position:")
+(mdisplay-newline " Circle = (" (Shape-x-get c) "," (Shape-y-get c) ")")
+(mdisplay-newline " Square = (" (Shape-x-get s) "," (Shape-y-get s) ")")
+
+; ----- Call some methods -----
+
+(mdisplay-newline "\nHere are some properties of the shapes:")
+(define (shape-props o)
+ (mdisplay-newline " " o)
+ (mdisplay-newline " area = " (Shape-area o))
+ (mdisplay-newline " perimeter = " (Shape-perimeter o)))
+(for-each shape-props (list c s))
+
+(mdisplay-newline "\nGuess I'll clean up now")
+
+; Note: this invokes the virtual destructor
+(delete-Shape c)
+(delete-Shape s)
+
+(define s 3)
+(mdisplay-newline (Shape-nshapes) " shapes remain")
+(mdisplay-newline "Goodbye")
+
+(exit 0)
diff --git a/Examples/mzscheme/multimap/Makefile b/Examples/mzscheme/multimap/Makefile
index 713ee43a7..eccd59d82 100644
--- a/Examples/mzscheme/multimap/Makefile
+++ b/Examples/mzscheme/multimap/Makefile
@@ -13,5 +13,6 @@ build:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme
+
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
diff --git a/Examples/mzscheme/multimap/example.c b/Examples/mzscheme/multimap/example.c
index b8360fa8a..e945042ab 100644
--- a/Examples/mzscheme/multimap/example.c
+++ b/Examples/mzscheme/multimap/example.c
@@ -27,7 +27,7 @@ int gcdmain(int argc, char *argv[]) {
return 0;
}
-int count(char *bytes, int len, char c) {
+int charcount(char *bytes, int len, char c) {
int i;
int count = 0;
for (i = 0; i < len; i++) {
diff --git a/Examples/mzscheme/multimap/example.i b/Examples/mzscheme/multimap/example.i
index 515948abc..db4be3d16 100644
--- a/Examples/mzscheme/multimap/example.i
+++ b/Examples/mzscheme/multimap/example.i
@@ -4,7 +4,7 @@
%{
extern int gcd(int x, int y);
extern int gcdmain(int argc, char *argv[]);
-extern int count(char *bytes, int len, char c);
+extern int charcount(char *bytes, int len, char c);
extern void capitalize (char *str, int len);
extern void circle (double cx, double cy);
extern int squareCubed (int n, int *OUTPUT);
@@ -50,7 +50,7 @@ extern int gcdmain(int argc, char *argv[]);
$2 = SCHEME_STRLEN_VAL($input);
}
-extern int count(char *bytes, int len, char c);
+extern int charcount(char *bytes, int len, char c);
/* This example shows how to wrap a function that mutates a string */
@@ -68,7 +68,7 @@ extern int count(char *bytes, int len, char c);
%typemap(argout) (char *str, int len) {
Scheme_Object *s;
- s = scheme_make_sized_string($1,$2,1);
+ s = scheme_make_sized_string($1,$2);
SWIG_APPEND_VALUE(s);
free($1);
}
diff --git a/Examples/mzscheme/multimap/runme.scm b/Examples/mzscheme/multimap/runme.scm
index f1e626f43..6d2c9cce3 100644
--- a/Examples/mzscheme/multimap/runme.scm
+++ b/Examples/mzscheme/multimap/runme.scm
@@ -20,7 +20,7 @@
(gcdmain #("gcdmain" "42" "105"))
-(display (count "Hello World" #\l))
+(display (charcount "Hello World" #\l))
(newline)
(display (capitalize "hello world"))
diff --git a/Examples/mzscheme/simple/Makefile b/Examples/mzscheme/simple/Makefile
index 713ee43a7..eccd59d82 100644
--- a/Examples/mzscheme/simple/Makefile
+++ b/Examples/mzscheme/simple/Makefile
@@ -13,5 +13,6 @@ build:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme
+
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
diff --git a/Examples/mzscheme/simple/README b/Examples/mzscheme/simple/README
deleted file mode 100644
index 07e8da069..000000000
--- a/Examples/mzscheme/simple/README
+++ /dev/null
@@ -1 +0,0 @@
-Simple example from users manual.
diff --git a/Examples/mzscheme/simple/example.c b/Examples/mzscheme/simple/example.c
index f2b074781..1c2af789c 100644
--- a/Examples/mzscheme/simple/example.c
+++ b/Examples/mzscheme/simple/example.c
@@ -1,24 +1,18 @@
-/* Simple example from documentation */
/* File : example.c */
-#include <time.h>
+/* A global variable */
+double Foo = 3.0;
-double My_variable = 3.0;
-
-/* Compute factorial of n */
-int fact(int n) {
- if (n <= 1) return 1;
- else return n*fact(n-1);
-}
-
-/* Compute n mod m */
-int my_mod(int n, int m) {
- return (n % m);
+/* Compute the greatest common divisor of positive integers */
+int gcd(int x, int y) {
+ int g;
+ g = y;
+ while (x > 0) {
+ g = x;
+ x = y % x;
+ y = g;
+ }
+ return g;
}
-char *get_time() {
- long ltime;
- time(&ltime);
- return ctime(&ltime);
-}
diff --git a/Examples/mzscheme/simple/example.i b/Examples/mzscheme/simple/example.i
index 5b3e95580..24093b9bf 100644
--- a/Examples/mzscheme/simple/example.i
+++ b/Examples/mzscheme/simple/example.i
@@ -1,16 +1,7 @@
/* File : example.i */
%module example
-%{
-/* Put headers and other declarations here */
-%}
-
-%include typemaps.i
-
-%rename(mod) my_mod;
%inline %{
-extern double My_variable;
-extern int fact(int);
-extern int my_mod(int n, int m);
-extern char *get_time();
+extern int gcd(int x, int y);
+extern double Foo;
%}
diff --git a/Examples/mzscheme/simple/runme.scm b/Examples/mzscheme/simple/runme.scm
index a98e31fd5..88d32d6fc 100644
--- a/Examples/mzscheme/simple/runme.scm
+++ b/Examples/mzscheme/simple/runme.scm
@@ -2,23 +2,30 @@
(load-extension "example.so")
-(display (get-time))
+; Call our gcd() function
-(printf "My-variable = ~a~n" (my-variable))
+(define x 42)
+(define y 105)
+(define g (gcd x y))
+(display "The gcd of ")
+(display x)
+(display " and ")
+(display y)
+(display " is ")
+(display g)
+(newline)
-(let loop ((i 0))
- (when (< i 14) (begin (display i)
- (display " factorial is ")
- (display (fact i))
- (newline)
- (loop (+ i 1)))))
+; Manipulate the Foo global variable
-(let loop ((i 1))
- (when (< i 250)
- (begin
- (let loopi ((j 1))
- (when (< j 250) (begin (my-variable (+ (my-variable) (mod i j)))
- (loopi (+ j 1)))))
- (loop (+ i 1)))))
+; Output its current value
+(display "Foo = ")
+(display (Foo))
+(newline)
-(printf "My-variable = ~a~n" (my-variable))
+; Change its value
+(Foo 3.1415926)
+
+; See if the change took effect
+(display "Foo = ")
+(display (Foo))
+(newline)
diff --git a/Examples/mzscheme/std_vector/Makefile b/Examples/mzscheme/std_vector/Makefile
index 96f5e80cf..8057465b3 100644
--- a/Examples/mzscheme/std_vector/Makefile
+++ b/Examples/mzscheme/std_vector/Makefile
@@ -1,21 +1,18 @@
TOP = ../..
SWIGEXE = $(TOP)/../swig
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
+CXXSRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
-GPP = `which g++`
-MZC = test -n "/usr/bin/mzc" && /usr/bin/mzc
-
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run
build:
- $(SWIGEXE) -mzscheme -c++ $(SWIGOPT) $(INTERFACE)
- $(MZC) --compiler $(GPP) ++ccf "-I." --cc example_wrap.cxx
- $(MZC) --linker $(GPP) --ld $(TARGET).so example_wrap.o
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme_cpp
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
diff --git a/Examples/mzscheme/std_vector/example.h b/Examples/mzscheme/std_vector/example.h
index 4f0dac70d..52e260d6d 100644
--- a/Examples/mzscheme/std_vector/example.h
+++ b/Examples/mzscheme/std_vector/example.h
@@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
}
void halve_in_place(std::vector<double>& v) {
- // would you believe this is the same as the above?
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
diff --git a/Examples/mzscheme/std_vector/runme.scm b/Examples/mzscheme/std_vector/runme.scm
index 67351f128..7af9d168e 100644
--- a/Examples/mzscheme/std_vector/runme.scm
+++ b/Examples/mzscheme/std_vector/runme.scm
@@ -9,16 +9,17 @@
(if (< i size)
(begin
(proc v i)
- (with-vector-item v (+ i 1)))))
+ (with-vector-item v (+ i 1)))
+ (void)))
(with-vector-item v 0)))
-(define (with-intvector v proc)
- (with-vector v proc intvector-length))
-(define (with-doublevector v proc)
- (with-vector v proc doublevector-length))
+(define (with-IntVector v proc)
+ (with-vector v proc IntVector-length))
+(define (with-DoubleVector v proc)
+ (with-vector v proc DoubleVector-length))
-(define (print-doublevector v)
- (with-doublevector v (lambda (v i) (display (doublevector-ref v i))
+(define (print-DoubleVector v)
+ (with-DoubleVector v (lambda (v i) (display (DoubleVector-ref v i))
(display " ")))
(newline))
@@ -29,11 +30,11 @@
(newline)
; ... or a wrapped std::vector<int>
-(define v (new-intvector 4))
-(with-intvector v (lambda (v i) (intvector-set! v i (+ i 1))))
+(define v (new-IntVector 4))
+(with-IntVector v (lambda (v i) (IntVector-set! v i (+ i 1))))
(display (average v))
(newline)
-(delete-intvector v)
+(delete-IntVector v)
; half will return a Scheme vector.
; Call it with a Scheme vector...
@@ -42,13 +43,12 @@
(newline)
; ... or a wrapped std::vector<double>
-(define v (new-doublevector))
-(map (lambda (i) (doublevector-push! v i)) '(1 2 3 4))
+(define v (new-DoubleVector))
+(map (lambda (i) (DoubleVector-push! v i)) '(1 2 3 4))
(display (half v))
(newline)
; now halve a wrapped std::vector<double> in place
(halve-in-place v)
-(print-doublevector v)
-(delete-doublevector v)
-
+(print-DoubleVector v)
+(delete-DoubleVector v)
diff --git a/Examples/ocaml/argout_ref/Makefile b/Examples/ocaml/argout_ref/Makefile
index 8b7fc959e..09370940f 100644
--- a/Examples/ocaml/argout_ref/Makefile
+++ b/Examples/ocaml/argout_ref/Makefile
@@ -4,8 +4,7 @@ SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
-MLFILE = example.ml
-PROGFILE = example_prog.ml
+PROGFILE = runme.ml
OBJS = example.o
check: build
@@ -16,16 +15,20 @@ build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic_cpp
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean
diff --git a/Examples/ocaml/argout_ref/example.i b/Examples/ocaml/argout_ref/example.i
index 5ea6777fb..a3e6bf8a6 100644
--- a/Examples/ocaml/argout_ref/example.i
+++ b/Examples/ocaml/argout_ref/example.i
@@ -1,8 +1,13 @@
/* File : example.i */
%module example
+%typemap(argout) (const int &x, const int &y) {
+ swig_result = caml_list_append(swig_result, caml_val_int(*$1));
+ swig_result = caml_list_append(swig_result, caml_val_int(*$2));
+}
+
%{
-extern "C" void factor(int &x, int &y);
+extern "C" void factor(const int &x, const int &y);
%}
-extern "C" void factor(int &x, int &y);
+extern "C" void factor(const int &x, const int &y);
diff --git a/Examples/ocaml/argout_ref/example_prog.ml b/Examples/ocaml/argout_ref/example_prog.ml
deleted file mode 100644
index c6de34597..000000000
--- a/Examples/ocaml/argout_ref/example_prog.ml
+++ /dev/null
@@ -1,26 +0,0 @@
-(* example_prog.ml *)
-
-open Swig
-open Example
-
-exception BadReturn
-
-let _ = if Array.length Sys.argv < 3 then
- begin
- print_endline
- ("Usage: " ^ Sys.argv.(0) ^ " n1 n2\n" ^
- " Displays the least factors of the numbers that have the same\n" ^
- " relationship, 16 12 -> 4 3\n") ;
- exit 0
- end
-
-let x = int_of_string Sys.argv.(1)
-let y = int_of_string Sys.argv.(2)
-let (xf,yf) = match _factor '((x to int),(y to int)) with
- C_list [ C_int a ; C_int b ] -> a,b
- | _ -> raise BadReturn
-let _ = print_endline
- ("Factorization of " ^ (string_of_int x) ^
- " and " ^ (string_of_int y) ^
- " is " ^ (string_of_int xf) ^
- " and " ^ (string_of_int yf))
diff --git a/Examples/ocaml/argout_ref/runme.ml b/Examples/ocaml/argout_ref/runme.ml
new file mode 100644
index 000000000..cb9a94255
--- /dev/null
+++ b/Examples/ocaml/argout_ref/runme.ml
@@ -0,0 +1,17 @@
+(* runme.ml *)
+
+open Swig
+open Example
+
+exception BadReturn
+
+let x = if Array.length Sys.argv > 1 then int_of_string Sys.argv.(1) else 16
+let y = if Array.length Sys.argv > 2 then int_of_string Sys.argv.(2) else 12
+let (xf,yf) = match _factor '((x to int),(y to int)) with
+ C_list [ C_int a ; C_int b ] -> a,b
+ | _ -> raise BadReturn
+let _ = print_endline
+ ("Factorization of " ^ (string_of_int x) ^
+ " and " ^ (string_of_int y) ^
+ " is " ^ (string_of_int xf) ^
+ " and " ^ (string_of_int yf))
diff --git a/Examples/ocaml/callback/Makefile b/Examples/ocaml/callback/Makefile
new file mode 100644
index 000000000..b81b5ac1b
--- /dev/null
+++ b/Examples/ocaml/callback/Makefile
@@ -0,0 +1,35 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SWIGOPT =
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+PROGFILE = runme.ml
+OBJS = example.o
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run
+
+build: static
+
+static:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ ocaml_static_cpp
+
+toplevel:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ ocaml_static_cpp_toplevel
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean
diff --git a/Examples/ocaml/callback/example.c b/Examples/ocaml/callback/example.c
new file mode 100644
index 000000000..4ead01f58
--- /dev/null
+++ b/Examples/ocaml/callback/example.c
@@ -0,0 +1,3 @@
+/* File : example.c */
+
+#include "example.h"
diff --git a/Examples/php5/callback/example.h b/Examples/ocaml/callback/example.h
index 2a0194999..12d888595 100644
--- a/Examples/php5/callback/example.h
+++ b/Examples/ocaml/callback/example.h
@@ -4,13 +4,12 @@
class Callback {
public:
- virtual ~Callback() { std::cout << "Callback::~Callback()" << std:: endl; }
+ virtual ~Callback() { std::cout << "Callback::~Callback()" << std::endl; }
virtual void run() { std::cout << "Callback::run()" << std::endl; }
};
class Caller {
-private:
Callback *_callback;
public:
Caller(): _callback(0) {}
@@ -19,4 +18,3 @@ public:
void setCallback(Callback *cb) { delCallback(); _callback = cb; }
void call() { if (_callback) _callback->run(); }
};
-
diff --git a/Examples/php5/callback/example.i b/Examples/ocaml/callback/example.i
index cf61ef9d2..584da73d9 100644
--- a/Examples/php5/callback/example.i
+++ b/Examples/ocaml/callback/example.i
@@ -4,7 +4,6 @@
#include "example.h"
%}
-/* turn on director wrapping Callback */
%feature("director") Callback;
%include "example.h"
diff --git a/Examples/ocaml/callback/runme.ml b/Examples/ocaml/callback/runme.ml
new file mode 100644
index 000000000..ddc974984
--- /dev/null
+++ b/Examples/ocaml/callback/runme.ml
@@ -0,0 +1,30 @@
+(* file: runme.ml
+
+This file illustrates cross-language polymorphism using directors. *)
+
+open Swig
+open Example
+
+let new_OCamlCallback ob meth args =
+ match meth with
+ | "run" -> print_endline "OCamlCallback.run()"; C_void
+ | _ -> (invoke ob) meth args
+
+let caller = new_Caller '()
+
+let _ = print_endline "Adding and calling a normal C++ callback"
+let _ = print_endline "----------------------------------------"
+
+let callback = new_Callback '()
+let _ = caller -> "setCallback" (callback)
+let _ = caller -> "call" ()
+let _ = caller -> "delCallback" ()
+
+let _ = print_endline "\nAdding and calling an OCaml callback"
+let _ = print_endline "------------------------------------"
+
+let callback = new_derived_object new_Callback (new_OCamlCallback) '()
+let _ = caller -> "setCallback" (callback)
+let _ = caller -> "call" ()
+let _ = caller -> "delCallback" ()
+let _ = print_endline "\nOCaml exit"
diff --git a/Examples/ocaml/check.list b/Examples/ocaml/check.list
index cbdf270f0..cab5a6545 100644
--- a/Examples/ocaml/check.list
+++ b/Examples/ocaml/check.list
@@ -1,10 +1,13 @@
# see top-level Makefile.in
-simple
-std_string
-std_vector
-stl
argout_ref
-shapes
+callback
+class
contract
scoped_enum
+shapes
+simple
+#std_string
+std_vector
+stl
string_from_ptr
+strings_test
diff --git a/Examples/ocaml/class/Makefile b/Examples/ocaml/class/Makefile
new file mode 100644
index 000000000..b81b5ac1b
--- /dev/null
+++ b/Examples/ocaml/class/Makefile
@@ -0,0 +1,35 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SWIGOPT =
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+PROGFILE = runme.ml
+OBJS = example.o
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run
+
+build: static
+
+static:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ ocaml_static_cpp
+
+toplevel:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ ocaml_static_cpp_toplevel
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean
diff --git a/Examples/ocaml/class/example.c b/Examples/ocaml/class/example.c
new file mode 100644
index 000000000..3bac43244
--- /dev/null
+++ b/Examples/ocaml/class/example.c
@@ -0,0 +1,28 @@
+/* File : example.c */
+
+#include "example.h"
+#define M_PI 3.14159265358979323846
+
+/* Move the shape to a new location */
+void Shape::move(double dx, double dy) {
+ x += dx;
+ y += dy;
+}
+
+int Shape::nshapes = 0;
+
+double Circle::area() {
+ return M_PI*radius*radius;
+}
+
+double Circle::perimeter() {
+ return 2*M_PI*radius;
+}
+
+double Square::area() {
+ return width*width;
+}
+
+double Square::perimeter() {
+ return 4*width;
+}
diff --git a/Examples/php5/proxy/example.h b/Examples/ocaml/class/example.h
index 0683f07f3..0dff185b2 100644
--- a/Examples/php5/proxy/example.h
+++ b/Examples/ocaml/class/example.h
@@ -1,7 +1,5 @@
/* File : example.h */
-#include <stdio.h>
-
class Shape {
public:
Shape() {
@@ -10,12 +8,11 @@ public:
virtual ~Shape() {
nshapes--;
}
- double x, y;
+ double x, y;
void move(double dx, double dy);
- virtual double area(void) = 0;
- virtual double perimeter(void) = 0;
+ virtual double area() = 0;
+ virtual double perimeter() = 0;
static int nshapes;
- static int get_nshapes();
};
class Circle : public Shape {
@@ -23,10 +20,8 @@ private:
double radius;
public:
Circle(double r) : radius(r) { }
- ~Circle() { }
- void set_radius( double r );
- virtual double area(void);
- virtual double perimeter(void);
+ virtual double area();
+ virtual double perimeter();
};
class Square : public Shape {
@@ -34,10 +29,6 @@ private:
double width;
public:
Square(double w) : width(w) { }
- ~Square() { }
- virtual double area(void);
- virtual double perimeter(void);
+ virtual double area();
+ virtual double perimeter();
};
-
-Circle *CircleFactory( double r );
-
diff --git a/Examples/php5/enum/example.i b/Examples/ocaml/class/example.i
index abf254731..fbdf7249f 100644
--- a/Examples/php5/enum/example.i
+++ b/Examples/ocaml/class/example.i
@@ -5,8 +5,5 @@
#include "example.h"
%}
-
/* Let's just grab the original header file here */
-
%include "example.h"
-
diff --git a/Examples/ocaml/class/runme.ml b/Examples/ocaml/class/runme.ml
new file mode 100644
index 000000000..5e7b1f26c
--- /dev/null
+++ b/Examples/ocaml/class/runme.ml
@@ -0,0 +1,57 @@
+(* file: runme.ml
+
+ This file illustrates the proxy class C++ interface generated
+ by SWIG. *)
+
+open Swig
+open Example
+
+let repr o =
+ Printf.sprintf "<%s at %#x>" (o -> ":classof" () as string) (o -> "&" () as int)
+
+(* ----- Object creation ----- *)
+
+let _ = print_endline "Creating some objects:"
+let c = new_Circle '(10)
+let _ = Printf.printf " Created circle %s\n" (repr c)
+let s = new_Square '(10)
+let _ = Printf.printf " Created square %s\n" (repr s)
+
+(* ----- Access a static member ----- *)
+
+let _ = Printf.printf "\nA total of %d shapes were created\n" (_Shape_nshapes '() as int)
+
+(* ----- Member data access ----- *)
+
+(* Set the location of the object *)
+
+let _ = c -> "[x]" (20)
+let _ = c -> "[y]" (30)
+
+(* Temp var to work around a swigp4 bug (it doesn't properly handle "-" in some cases). *)
+let arg = (-10. to float)
+let _ = s -> "[x]" (arg)
+let _ = s -> "[y]" (5)
+
+let _ = print_endline "\nHere is their current position:"
+let _ = Printf.printf " Circle = (%f, %f)\n" (c -> "[x]" () as float) (c -> "[y]" () as float)
+let _ = Printf.printf " Square = (%f, %f)\n" (s -> "[x]" () as float) (s -> "[y]" () as float)
+
+(* ----- Call some methods ----- *)
+
+let _ = print_endline "\nHere are some properties of the shapes:"
+
+let _ = List.iter (fun o ->
+ Printf.printf " %s\n" (repr o);
+ Printf.printf " area = %f\n" (o -> area () as float);
+ Printf.printf " perimeter = %f\n" (o -> perimeter () as float)
+ ) [c; s]
+
+let _ = print_endline "\nGuess I'll clean up now"
+
+(* Note: this invokes the virtual destructor *)
+let _ = c -> "~" ()
+let _ = s -> "~" ()
+
+let _ = Printf.printf "%d shapes remain\n" (_Shape_nshapes '() as int)
+let _ = print_endline "Goodbye"
diff --git a/Examples/ocaml/contract/Makefile b/Examples/ocaml/contract/Makefile
index c77e6dcc4..8148de142 100644
--- a/Examples/ocaml/contract/Makefile
+++ b/Examples/ocaml/contract/Makefile
@@ -4,8 +4,7 @@ SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
-MLFILE = example.ml
-PROGFILE = example_prog.ml
+PROGFILE = runme.ml
OBJS =
check: build
@@ -16,23 +15,27 @@ build: static
dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static
toplevel:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_toplevel
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean
diff --git a/Examples/ocaml/contract/example_prog.ml b/Examples/ocaml/contract/runme.ml
index 748109c2b..a77eed701 100644
--- a/Examples/ocaml/contract/example_prog.ml
+++ b/Examples/ocaml/contract/runme.ml
@@ -4,4 +4,9 @@ open Example
let _ = print_endline "This won't throw."
let _ = Printf.printf "Cos 1.0 is %f\n" (_cos '(1.0) as float)
let _ = print_endline "This will throw."
-let _ = Printf.printf "Cos 5.0 is %f\n" (_cos '(5.0) as float)
+let _ =
+ try
+ Printf.printf "Cos 5.0 is %f\n" (_cos '(5.0) as float)
+ with Failure s ->
+ print_endline s ;
+ print_endline "Exception thrown."
diff --git a/Examples/ocaml/scoped_enum/Makefile b/Examples/ocaml/scoped_enum/Makefile
index 9655c98e6..cfed474ef 100644
--- a/Examples/ocaml/scoped_enum/Makefile
+++ b/Examples/ocaml/scoped_enum/Makefile
@@ -4,8 +4,7 @@ SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
-MLFILE = example.ml
-PROGFILE = example_prog.ml
+PROGFILE = runme.ml
OBJS =
check: build
@@ -16,23 +15,27 @@ build: static
dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic_cpp
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
toplevel:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp_toplevel
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean
diff --git a/Examples/ocaml/scoped_enum/example_prog.ml b/Examples/ocaml/scoped_enum/example_prog.ml
deleted file mode 100644
index e19bb3454..000000000
--- a/Examples/ocaml/scoped_enum/example_prog.ml
+++ /dev/null
@@ -1,4 +0,0 @@
-open Swig
-open Example
-
-let _ = _f (match Sys.argv.(1) with "Tag1" -> ``Tag1 | _ -> ``Tag2)
diff --git a/Examples/ocaml/scoped_enum/runme.ml b/Examples/ocaml/scoped_enum/runme.ml
new file mode 100644
index 000000000..f70b6e1f8
--- /dev/null
+++ b/Examples/ocaml/scoped_enum/runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Example
+
+let arg = if Array.length Sys.argv > 1 then Sys.argv.(1) else "Tag1"
+let _ = _f (match arg with "Tag1" -> ``Tag1 | _ -> ``Tag2)
diff --git a/Examples/ocaml/shapes/Makefile b/Examples/ocaml/shapes/Makefile
index b291d07e8..eab86d298 100644
--- a/Examples/ocaml/shapes/Makefile
+++ b/Examples/ocaml/shapes/Makefile
@@ -5,35 +5,38 @@ SWIGOPT =
SRCS = example.c
TARGET = example
INTERFACE = example.i
-MLFILE = example.ml
-PROGFILE = example_prog.ml
+PROGFILE = runme.ml
OBJS = example.o
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run
-build: static static_top
+build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
-static_top:
+toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp_toplevel
dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)'
- MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic_cpp
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean
diff --git a/Examples/ocaml/shapes/example_prog.ml b/Examples/ocaml/shapes/runme.ml
index b9e35158a..a7a2f9374 100644
--- a/Examples/ocaml/shapes/example_prog.ml
+++ b/Examples/ocaml/shapes/runme.ml
@@ -1,4 +1,4 @@
-(* example_prog.ml *)
+(* runme.ml *)
open Swig ;;
open Example ;;
diff --git a/Examples/ocaml/simple/Makefile b/Examples/ocaml/simple/Makefile
index 88fef7435..27fdb20f5 100644
--- a/Examples/ocaml/simple/Makefile
+++ b/Examples/ocaml/simple/Makefile
@@ -4,8 +4,7 @@ SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
-MLFILE = example.ml
-PROGFILE = example_prog.ml
+PROGFILE = runme.ml
OBJS = example.o
check: build
@@ -16,23 +15,27 @@ build: static
dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static
toplevel:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_toplevel
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean
diff --git a/Examples/ocaml/simple/index.html b/Examples/ocaml/simple/index.html
index dace471a3..9ae997be5 100644
--- a/Examples/ocaml/simple/index.html
+++ b/Examples/ocaml/simple/index.html
@@ -1,18 +1,18 @@
<html>
<head>
-<title>SWIG:Examples:python:simple</title>
+<title>SWIG:Examples:ocaml:simple</title>
</head>
<body bgcolor="#ffffff">
-<tt>SWIG/Examples/python/simple/</tt>
+<tt>SWIG/Examples/ocaml/simple/</tt>
<hr>
-<H2>Simple Python Example</H2>
+<H2>Simple Ocaml Example</H2>
<p>
-This example illustrates how you can hook Python to a very simple C program containing
+This example illustrates how you can hook Ocaml to a very simple C program containing
a function and a global variable.
<h2>The C Code</h2>
@@ -57,7 +57,7 @@ extern double Foo;
<h2>Compilation</h2>
<ol>
-<li><tt>swig -python <a href="example.i">example.i</a></tt>
+<li><tt>swig -ocaml <a href="example.i">example.i</a></tt>
<p>
<li>Compile <tt><a href="example_wrap.c">example_wrap.c</a></tt> and <tt><a href="example.c">example.c</a></tt>
to create the extension <tt>examplemodule.so</tt>.
@@ -65,29 +65,29 @@ to create the extension <tt>examplemodule.so</tt>.
<h2>Using the extension</h2>
-Click <a href="example.py">here</a> to see a script that calls our C functions from Python.
+Click <a href="example.ml">here</a> to see a script that calls our C functions from Ocaml.
<h2>Key points</h2>
<ul>
-<li>Use the <tt>import</tt> statement to load your extension module from Python. For example:
+<li>Use the <tt>open</tt> statement to load your extension module from Ocaml. For example:
<blockquote>
<pre>
-import example
+open Example
</pre>
</blockquote>
-<li>C functions work just like Python functions. For example:
+<li>C functions work just like Ocaml functions. For example:
<blockquote>
<pre>
-g = example.gcd(42,105)
+let g = _gcd '(x,y) as int
</pre>
</blockquote>
-<li>C global variables are accessed through a special variable called 'cvar'. For example:
+<li>C global variable Foo is wrapped as _Foo in ocaml. For example:
<blockquote>
<pre>
-a = example.cvar.Foo
+let _ = Printf.printf "Foo = %f\n" (_Foo '() as float)
</pre>
</blockquote>
</ul>
diff --git a/Examples/ocaml/simple/example_prog.ml b/Examples/ocaml/simple/runme.ml
index cc3b973d8..4f7a407ef 100644
--- a/Examples/ocaml/simple/example_prog.ml
+++ b/Examples/ocaml/simple/runme.ml
@@ -1,4 +1,4 @@
-(* example_prog.ml *)
+(* runme.ml *)
open Swig
open Example
diff --git a/Examples/ocaml/std_string/Makefile b/Examples/ocaml/std_string/Makefile
index 099b1fcee..655465692 100644
--- a/Examples/ocaml/std_string/Makefile
+++ b/Examples/ocaml/std_string/Makefile
@@ -15,6 +15,10 @@ static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
dynamic:
diff --git a/Examples/ocaml/std_vector/Makefile b/Examples/ocaml/std_vector/Makefile
index 099b1fcee..655465692 100644
--- a/Examples/ocaml/std_vector/Makefile
+++ b/Examples/ocaml/std_vector/Makefile
@@ -15,6 +15,10 @@ static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
dynamic:
diff --git a/Examples/ocaml/std_vector/example.h b/Examples/ocaml/std_vector/example.h
index b75359243..d968f6953 100644
--- a/Examples/ocaml/std_vector/example.h
+++ b/Examples/ocaml/std_vector/example.h
@@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
}
void halve_in_place(std::vector<double>& v) {
- // would you believe this is the same as the above?
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
diff --git a/Examples/ocaml/std_vector/runme.ml b/Examples/ocaml/std_vector/runme.ml
index feb70dd5e..0f5519b6f 100644
--- a/Examples/ocaml/std_vector/runme.ml
+++ b/Examples/ocaml/std_vector/runme.ml
@@ -14,7 +14,7 @@ let print_DoubleVector v =
(fun v i ->
print_float ((v '[i to int]) as float) ;
print_string " ") ;
- print_endline
+ print_endline ""
end
(* Call average with a Ocaml array... *)
@@ -27,7 +27,7 @@ let rec fill_dv v x =
fill_dv v (x *. x)
end
let _ = fill_dv v 0.999
-let _ = print_DoubleVector v ; print_endline ""
+let _ = print_DoubleVector v
let u = new_IntVector '()
let _ = for i = 1 to 4 do
u -> push_back ((i to int))
diff --git a/Examples/ocaml/stl/Makefile b/Examples/ocaml/stl/Makefile
index 912dd9f8d..363311d95 100644
--- a/Examples/ocaml/stl/Makefile
+++ b/Examples/ocaml/stl/Makefile
@@ -15,19 +15,17 @@ static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- ocaml_static_cpp
-
-director:
+ ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- ocaml_static_cpp_director
+ ocaml_static_cpp
dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- ocaml_static_cpp
+ ocaml_dynamic_cpp
toplevel:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
diff --git a/Examples/ocaml/stl/example.h b/Examples/ocaml/stl/example.h
index df5762bfc..da1d50e22 100644
--- a/Examples/ocaml/stl/example.h
+++ b/Examples/ocaml/stl/example.h
@@ -8,7 +8,7 @@
using std::string;
-double vec_write(std::vector<string> v) {
+void vec_write(std::vector<string> v) {
int n = 0;
for( std::vector<string>::iterator i = v.begin();
i != v.end();
diff --git a/Examples/ocaml/stl/example.i b/Examples/ocaml/stl/example.i
index 19a80a605..214ac47a5 100644
--- a/Examples/ocaml/stl/example.i
+++ b/Examples/ocaml/stl/example.i
@@ -7,6 +7,4 @@
#define ENABLE_STRING_VECTOR
%include stl.i
-%feature("director");
-
%include example.h
diff --git a/Examples/ocaml/string_from_ptr/Makefile b/Examples/ocaml/string_from_ptr/Makefile
index f9b027802..5ab5c44a9 100644
--- a/Examples/ocaml/string_from_ptr/Makefile
+++ b/Examples/ocaml/string_from_ptr/Makefile
@@ -1,39 +1,41 @@
TOP = ../..
SWIGEXE = $(TOP)/../swig
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SWIGOPT = -c++
SRCS =
TARGET = example
-INTERFACE = foolib.i
-MLFILE = foolib.ml
-PROGFILE = example_prog.ml
+INTERFACE = example.i
+PROGFILE = runme.ml
OBJS =
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run
-build: static static_top
+build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
- ocaml_static_cpp
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ ocaml_static
-static_top:
+toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
- ocaml_static_cpp_toplevel
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ ocaml_static_toplevel
dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)'
- MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
- ocaml_dynamic_cpp
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)'
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ ocaml_dynamic
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean
diff --git a/Examples/ocaml/string_from_ptr/foolib.i b/Examples/ocaml/string_from_ptr/example.i
index 86e0880eb..d66487940 100644
--- a/Examples/ocaml/string_from_ptr/foolib.i
+++ b/Examples/ocaml/string_from_ptr/example.i
@@ -1,4 +1,4 @@
-%module foolib
+%module example
%{
static int foo( char **buf ) {
*buf = "string from c";
diff --git a/Examples/ocaml/string_from_ptr/example_prog.ml b/Examples/ocaml/string_from_ptr/runme.ml
index 8069dc228..039762017 100644
--- a/Examples/ocaml/string_from_ptr/example_prog.ml
+++ b/Examples/ocaml/string_from_ptr/runme.ml
@@ -1,7 +1,5 @@
-(* foo_program.ml -- the program using foolib *)
-
open Swig (* Give access to the swig library *)
-open Foolib (* This is the name of your swig output *)
+open Example (* This is the name of your swig output *)
let results = _foo '() (* Function names are prefixed with _ in order to make
them lex as identifiers in ocaml. Consider that
diff --git a/Examples/ocaml/strings_test/Makefile b/Examples/ocaml/strings_test/Makefile
index 24e2e6cca..38cf234da 100644
--- a/Examples/ocaml/strings_test/Makefile
+++ b/Examples/ocaml/strings_test/Makefile
@@ -9,21 +9,25 @@ PROGFILE = runme.ml
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run
-build: static top
+build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ ocaml_core
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- ocaml_static_cpp
+ ocaml_dynamic_cpp
-top:
+toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
diff --git a/Examples/ocaml/strings_test/example.h b/Examples/ocaml/strings_test/example.h
index 959404b5d..9dbc881a8 100644
--- a/Examples/ocaml/strings_test/example.h
+++ b/Examples/ocaml/strings_test/example.h
@@ -19,7 +19,7 @@ void takes_char_ptr( char *p ) {
cout << "takes_char_ptr( \"" << p << "\" );" << endl;
}
-char *gives_char_ptr() {
+const char *gives_const_char_ptr() {
return "foo";
}
@@ -28,8 +28,8 @@ void takes_and_gives_std_string( std::string &inout ) {
inout.insert( inout.end(), ']' );
}
-void takes_and_gives_char_ptr( char *&inout ) {
- char *pout = strchr( inout, '.' );
+void takes_and_gives_const_char_ptr( const char *&inout ) {
+ const char *pout = strchr( inout, '.' );
if( pout ) inout = pout + 1;
else inout = "foo";
}
diff --git a/Examples/ocaml/strings_test/example.i b/Examples/ocaml/strings_test/example.i
index be9eabfbc..d360715c1 100644
--- a/Examples/ocaml/strings_test/example.i
+++ b/Examples/ocaml/strings_test/example.i
@@ -11,4 +11,5 @@ using std::string;
#include "example.h"
%}
+%include "std_string.i"
%include example.h
diff --git a/Examples/ocaml/strings_test/runme.ml b/Examples/ocaml/strings_test/runme.ml
index 0eb56379c..727bc025e 100644
--- a/Examples/ocaml/strings_test/runme.ml
+++ b/Examples/ocaml/strings_test/runme.ml
@@ -8,10 +8,10 @@ let _ = print_endline
("_gives_std_string <<" ^ (get_string (_gives_std_string C_void)) ^ " >>")
let _ = _takes_char_ptr (C_string "bar")
let _ = print_endline
- ("_gives_char_ptr << " ^ (get_string (_gives_char_ptr C_void)) ^ " >>")
+ ("_gives_const_char_ptr << " ^ (get_string (_gives_const_char_ptr C_void)) ^ " >>")
let _ = print_endline
("_takes_and_gives_std_string << " ^
(get_string (_takes_and_gives_std_string (C_string "foo"))) ^ " >>")
let _ = print_endline
- ("_takes_and_gives_char_ptr << " ^
- (get_string (_takes_and_gives_char_ptr (C_string "bar.bar"))) ^ " >>")
+ ("_takes_and_gives_const_char_ptr << " ^
+ (get_string (_takes_and_gives_const_char_ptr (C_string "bar.bar"))) ^ " >>")
diff --git a/Examples/octave/extend/runme.m b/Examples/octave/extend/runme.m
index bc73184a8..c88a7c151 100644
--- a/Examples/octave/extend/runme.m
+++ b/Examples/octave/extend/runme.m
@@ -14,7 +14,7 @@ CEO=@(name) subclass(swigexample.Manager(name),'getPosition',@(self) "CEO");
# Create an instance of our employee extension class, CEO. The calls to
# getName() and getPosition() are standard, the call to getTitle() uses
-# the director wrappers to call CEO.getPosition. e = CEO("Alice")
+# the director wrappers to call CEO.getPosition.
e = CEO("Alice");
printf("%s is a %s\n",e.getName(),e.getPosition());
diff --git a/Examples/octave/module_load/runme.m b/Examples/octave/module_load/runme.m
index 0e327efcd..beab1213b 100644
--- a/Examples/octave/module_load/runme.m
+++ b/Examples/octave/module_load/runme.m
@@ -5,63 +5,73 @@ endif
# load module
clear all;
+assert(exist("swigexample") == 3);
swigexample;
+assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
-assert(exist("swigexample","var"));
clear all
+assert(exist("swigexample") == 3);
swigexample;
+assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
-assert(exist("swigexample","var"));
clear all
# load module in a function globally before base context
clear all;
-function testme
+function testme_1
+ assert(exist("swigexample") == 3);
swigexample;
+ assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
- assert(exist("swigexample","var"));
endfunction
-testme
-testme
+testme_1
+testme_1
+assert(exist("swigexample") == 3);
swigexample;
+assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
-assert(exist("swigexample","var"));
clear all
-function testme
+function testme_2
+ assert(exist("swigexample") == 3);
swigexample;
+ assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
- assert(exist("swigexample","var"));
endfunction
-testme
-testme
+testme_2
+testme_2
+assert(exist("swigexample") == 3);
swigexample;
+assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
-assert(exist("swigexample","var"));
clear all
# load module in a function globally after base context
clear all;
+assert(exist("swigexample") == 3);
swigexample;
+assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
-assert(exist("swigexample","var"));
-function testme
+function testme_3
+ assert(exist("swigexample") == 3);
swigexample;
+ assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
- assert(exist("swigexample","var"));
endfunction
-testme
-testme
+testme_3
+testme_3
clear all
+assert(exist("swigexample") == 3);
swigexample;
+assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
-assert(exist("swigexample","var"));
-function testme
+function testme_4
+ assert(exist("swigexample") == 3);
swigexample;
+ assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
- assert(exist("swigexample","var"));
endfunction
-testme
-testme
+testme_4
+testme_4
clear all
# octave 3.0.5 randomly crashes on the remaining tests
@@ -71,13 +81,16 @@ endif
# load module with no cvar
clear all;
+who;
+assert(exist("swigexample2") == 3);
swigexample2;
+assert(isglobal("swigexample2"));
assert(swigexample2.ivar == ifunc);
-assert(exist("swigexample2","var"));
-assert(!isglobal("cvar"))
+assert(!exist("cvar", "var"));
clear all
+assert(exist("swigexample2") == 3);
swigexample2;
+assert(isglobal("swigexample2"));
assert(swigexample2.ivar == ifunc);
-assert(exist("swigexample2","var"));
-assert(!isglobal("cvar"))
+assert(!exist("cvar", "var"));
clear all
diff --git a/Examples/octave/variables/runme.m b/Examples/octave/variables/runme.m
index 71ac72f29..df4cad77c 100644
--- a/Examples/octave/variables/runme.m
+++ b/Examples/octave/variables/runme.m
@@ -51,7 +51,7 @@ swigexample.print_vars();
printf("\nNow I'm going to try and modify some read only variables\n");
-printf(" Tring to set 'path'\n");
+printf(" Trying to set 'path'\n");
try
swigexample.cvar.path = "Whoa!";
printf("Hey, what's going on?!?! This shouldn't work\n");
diff --git a/Examples/perl5/check.list b/Examples/perl5/check.list
index dda849311..78d45fc0b 100644
--- a/Examples/perl5/check.list
+++ b/Examples/perl5/check.list
@@ -6,7 +6,6 @@ constants2
extend
funcptr
import
-java
multimap
multiple_inheritance
pointer
diff --git a/Examples/perl5/java/Example.java b/Examples/perl5/java/Example.java
deleted file mode 100644
index 91ddb1ac5..000000000
--- a/Examples/perl5/java/Example.java
+++ /dev/null
@@ -1,29 +0,0 @@
-public class Example {
- public int mPublicInt;
-
- public Example() {
- mPublicInt = 0;
- }
-
- public Example(int IntVal) {
- mPublicInt = IntVal;
- }
-
-
- public int Add(int a, int b) {
- return (a+b);
- }
-
- public float Add(float a, float b) {
- return (a+b);
- }
-
- public String Add(String a, String b) {
- return (a+b);
- }
-
- public Example Add(Example a, Example b) {
- return new Example(a.mPublicInt + b.mPublicInt);
- }
-}
-
diff --git a/Examples/perl5/java/Makefile b/Examples/perl5/java/Makefile
deleted file mode 100644
index 7c133235f..000000000
--- a/Examples/perl5/java/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS =
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
-
-build: Example.class Example.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- CXXSHARED="gcj -fpic -shared Example.class" PERL5_CCFLAGS='' PERL5_EXP='' LIBS="-lstdc++" perl5_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean
- rm -f *.class Example.h
-
-Example.class Example.h: $(SRCDIR)Example.java
- gcj -d . -fPIC -C -c -g $(SRCDIR)Example.java
- gcjh Example.class
diff --git a/Examples/perl5/java/example.i b/Examples/perl5/java/example.i
deleted file mode 100644
index a82abb267..000000000
--- a/Examples/perl5/java/example.i
+++ /dev/null
@@ -1,10 +0,0 @@
-%module example
-
-%include <cni.i>
-
-%{
-#include "Example.h"
-%}
-
-
-%include Example.h
diff --git a/Examples/perl5/java/runme.pl b/Examples/perl5/java/runme.pl
deleted file mode 100644
index 56ad6e408..000000000
--- a/Examples/perl5/java/runme.pl
+++ /dev/null
@@ -1,29 +0,0 @@
-use example;
-
-example::JvCreateJavaVM(undef);
-example::JvAttachCurrentThread(undef, undef);
-
-$e1 = new example::Example(1);
-print $e1->{mPublicInt},"\n";
-
-$e2 = new example::Example(2);
-print $e2->{mPublicInt},"\n";
-
-$i = $e1->Add(1,2);
-print $i,"\n";
-
-$d = $e2->Add(1.0,2.0);
-print $d,"\n";
-
-$d = $e2->Add("1","2");
-print $d,"\n";
-
-$e3 = $e1->Add($e1,$e2);
-print $e3->{mPublicInt},"\n";
-
-
-$s = $e2->Add("a","b");
-print $s,"\n";
-
-
-example::JvDetachCurrentThread()
diff --git a/Examples/perl5/variables/runme.pl b/Examples/perl5/variables/runme.pl
index 76e3dc8bc..2c3484db7 100644
--- a/Examples/perl5/variables/runme.pl
+++ b/Examples/perl5/variables/runme.pl
@@ -65,7 +65,7 @@ if (!$@) {
}
print " get error for 'status'\n";
-print " Tring to set 'path'\n";
+print " Trying to set 'path'\n";
eval { $example::path = "Whoa!";};
if (!$@) {
die("path");
diff --git a/Examples/php/constants/runme.php b/Examples/php/constants/runme.php
index cea06485f..91c597a40 100644
--- a/Examples/php/constants/runme.php
+++ b/Examples/php/constants/runme.php
@@ -12,16 +12,12 @@ print "EXPR = " . EXPR . " (should be 48.5484)\n";
print "iconst = " . iconst . " (should be 37)\n";
print "fconst = " . fconst . " (should be 3.14)\n";
-if (EXTERN!="EXTERN") {
- print "EXTERN = " . EXTERN . " (Arg! This shouldn't print anything)\n";
-} else {
- print "EXTERN defaults to 'EXTERN', it probably isn't defined (good)\n";
+$c = get_defined_constants();
+if (array_key_exists("EXTERN", $c)) {
+ print "EXTERN = " . $c["EXTERN"] . " (Arg! This shouldn't print anything)\n";
}
-
-if (FOO!="FOO") {
- print "FOO = " . FOO . "(Arg! This shouldn't print anything)\n";
-} else {
- print "FOO defaults to 'FOO', it probably isn't defined (good)\n";
+if (array_key_exists("FOO", $c)) {
+ print "FOO = " . $c["FOO"] . " (Arg! This shouldn't print anything)\n";
}
diff --git a/Examples/php/disown/runme.php b/Examples/php/disown/runme.php
index d90b03a9d..a70d7b061 100644
--- a/Examples/php/disown/runme.php
+++ b/Examples/php/disown/runme.php
@@ -26,7 +26,7 @@ $container->addShape($s);
print "\nA total of " . Shape::nshapes() . " shapes were created\n";
# ----- Delete by the old references -----
-# This should not truely delete the shapes because they are now owned
+# This should not truly delete the shapes because they are now owned
# by the ShapeContainer.
print "Delete the old references.";
@@ -38,7 +38,7 @@ $s = NULL;
print "\nA total of " . Shape::nshapes() . " shapes remain\n";
# ----- Delete by the container -----
-# This should truely delete the shapes
+# This should truly delete the shapes
print "Delete the container.";
$container = NULL;
diff --git a/Examples/php/enum/Makefile b/Examples/php/enum/Makefile
index 4483f781e..063a0645f 100644
--- a/Examples/php/enum/Makefile
+++ b/Examples/php/enum/Makefile
@@ -5,7 +5,7 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
LIBS =
-SWIGOPT = -noproxy
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
diff --git a/Examples/php/enum/runme.php b/Examples/php/enum/runme.php
index 55b0bc4c3..813476645 100644
--- a/Examples/php/enum/runme.php
+++ b/Examples/php/enum/runme.php
@@ -11,22 +11,22 @@ print " BLUE =" . BLUE;
print " GREEN =" . GREEN;
print "\n*** Foo::speed ***";
-print " Foo_IMPULSE =" . Foo_IMPULSE;
-print " Foo_WARP =" . Foo_WARP;
-print " Foo_LUDICROUS =" . Foo_LUDICROUS;
+print " Foo::IMPULSE =" . Foo::IMPULSE;
+print " Foo::WARP =" . Foo::WARP;
+print " Foo::LUDICROUS =" . Foo::LUDICROUS;
print "\nTesting use of enums with functions\n";
-enum_test(RED, Foo_IMPULSE);
-enum_test(BLUE, Foo_WARP);
-enum_test(GREEN, Foo_LUDICROUS);
+enum_test(RED, Foo::IMPULSE);
+enum_test(BLUE, Foo::WARP);
+enum_test(GREEN, Foo::LUDICROUS);
enum_test(1234,5678);
print "\nTesting use of enum with class method\n";
-$f = new_Foo();
+$f = new Foo();
-Foo_enum_test($f,Foo_IMPULSE);
-Foo_enum_test($f,Foo_WARP);
-Foo_enum_test($f,Foo_LUDICROUS);
+$f->enum_test(Foo::IMPULSE);
+$f->enum_test(Foo::WARP);
+$f->enum_test(Foo::LUDICROUS);
?>
diff --git a/Examples/php/pragmas/example.i b/Examples/php/pragmas/example.i
index c7e8bf303..ea9590b6f 100644
--- a/Examples/php/pragmas/example.i
+++ b/Examples/php/pragmas/example.i
@@ -25,7 +25,8 @@
%pragma(php) code="
# This code is inserted into example.php
-echo \"this was php code\\n\";
+echo \"This was php code\\n\";
"
+%pragma(php) version="1.5"
%pragma(php) phpinfo="php_info_print_table_start();"
diff --git a/Examples/php/pragmas/include.php b/Examples/php/pragmas/include.php
index e19880a06..11d985d66 100644
--- a/Examples/php/pragmas/include.php
+++ b/Examples/php/pragmas/include.php
@@ -1,7 +1,7 @@
<?php
# This code is inserted into example.php
-echo "this is include.php\n";
+echo "This is include.php\n";
?>
diff --git a/Examples/php/pragmas/runme.php b/Examples/php/pragmas/runme.php
index 538548b6f..7b2c179cb 100644
--- a/Examples/php/pragmas/runme.php
+++ b/Examples/php/pragmas/runme.php
@@ -1,5 +1,9 @@
<?php
+# For finding include.php
+set_include_path(realpath(dirname(__FILE__)) . PATH_SEPARATOR . get_include_path());
+
require "example.php";
+echo "Version - " . ((new ReflectionExtension('example'))->getVersion()) . "\n";
?>
diff --git a/Examples/php/value/Makefile b/Examples/php/value/Makefile
index 28fc3a127..47e5ed9f9 100644
--- a/Examples/php/value/Makefile
+++ b/Examples/php/value/Makefile
@@ -5,7 +5,7 @@ SRCS = example.c
TARGET = example
INTERFACE = example.i
LIBS =
-SWIGOPT = -noproxy
+SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
diff --git a/Examples/php/value/runme.php b/Examples/php/value/runme.php
index 49115376c..569c87cf5 100644
--- a/Examples/php/value/runme.php
+++ b/Examples/php/value/runme.php
@@ -3,15 +3,15 @@
require "example.php";
- $v = new_vector();
- vector_x_set($v,1.0);
- vector_y_set($v,2.0);
- vector_z_set($v,3.0);
+ $v = new Vector();
+ $v->x = 1.0;
+ $v->y = 2.0;
+ $v->z = 3.0;
- $w = new_vector();
- vector_x_set($w,10.0);
- vector_y_set($w,11.0);
- vector_z_set($w,12.0);
+ $w = new Vector();
+ $w->x = 10.0;
+ $w->y = 11.0;
+ $w->z = 12.0;
echo "I just created the following vector\n";
vector_print($v);
@@ -25,7 +25,7 @@
echo "\nNow I'm going to add the vectors together\n";
- $r = new_vector();
+ $r = new Vector();
vector_add($v, $w, $r);
vector_print($r);
diff --git a/Examples/php/variables/runme.php b/Examples/php/variables/runme.php
index bbfeb610b..14f27f389 100644
--- a/Examples/php/variables/runme.php
+++ b/Examples/php/variables/runme.php
@@ -26,10 +26,10 @@
echo "pt = ".pt_get(), point_print(pt_get()) , "\n";
/* Try to set the values of some global variables */
-$a = "42.14";
+ $a = "42.14";
ivar_set($a);
-echo "a = $a\n";
+ echo "a = $a\n";
svar_set(-31000);
lvar_set(65537);
uivar_set(123456);
diff --git a/Examples/php5/callback/Makefile b/Examples/php5/callback/Makefile
deleted file mode 100644
index 3a34106c3..000000000
--- a/Examples/php5/callback/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php5_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/callback/example.cxx b/Examples/php5/callback/example.cxx
deleted file mode 100644
index 450d75608..000000000
--- a/Examples/php5/callback/example.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-/* File : example.cxx */
-
-#include "example.h"
-
diff --git a/Examples/php5/callback/index.html b/Examples/php5/callback/index.html
deleted file mode 100644
index 2a6cbdff9..000000000
--- a/Examples/php5/callback/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<html>
-<head>
-<title>SWIG:Examples:php5:callback</title>
-</head>
-
-<body bgcolor="#ffffff">
-
-
-<tt>SWIG/Examples/php5/callback/</tt>
-<hr>
-
-<H2>Implementing C++ callbacks in PHP5</H2>
-
-<p>
-This example illustrates how to use directors to implement C++ callbacks in PHP5.
-
-<hr>
-</body>
-</html>
diff --git a/Examples/php5/callback/runme.php b/Examples/php5/callback/runme.php
deleted file mode 100644
index 2be71994f..000000000
--- a/Examples/php5/callback/runme.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-# This file illustrates the cross language polymorphism using directors.
-
-require("example.php");
-
-# Class, which overwrites Callback::run().
-
-class PhpCallback extends Callback {
- function run() {
- print "PhpCallback.run()\n";
- }
-};
-
-# Create an Caller instance
-
-$caller = new Caller();
-
-# Add a simple C++ callback (caller owns the callback, so
-# we disown it first by clearing the .thisown flag).
-
-print "Adding and calling a normal C++ callback\n";
-print "----------------------------------------\n";
-
-$callback = new Callback();
-$callback->thisown = 0;
-$caller->setCallback($callback);
-$caller->call();
-$caller->delCallback();
-
-print "\n";
-print "Adding and calling a PHP callback\n";
-print "------------------------------------\n";
-
-# Add a PHP callback.
-
-$callback = new PhpCallback();
-$callback->thisown = 0;
-$caller->setCallback($callback);
-$caller->call();
-$caller->delCallback();
-
-# All done.
-
-print "php exit\n";
-
-?>
diff --git a/Examples/php5/check.list b/Examples/php5/check.list
deleted file mode 100644
index fef3feba6..000000000
--- a/Examples/php5/check.list
+++ /dev/null
@@ -1,19 +0,0 @@
-# see top-level Makefile.in
-# (see also top-level configure.ac kludge)
-callback
-class
-constants
-cpointer
-disown
-enum
-extend
-funcptr
-overloading
-pointer
-pragmas
-proxy
-reference
-simple
-sync
-value
-variables
diff --git a/Examples/php5/class/runme.php b/Examples/php5/class/runme.php
deleted file mode 100644
index 99c253b46..000000000
--- a/Examples/php5/class/runme.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-# This example illustrates how member variables are wrapped.
-
-require("example.php");
-
-# ----- Object creation -----
-
-print "Creating some objects:\n";
-$c = new Circle(10);
-print " Created circle\n";
-$s = new Square(10);
-print " Created square\n";
-
-# ----- Access a static member -----
-
-print "\nA total of " . Shape::nshapes() . " shapes were created\n";
-
-# ----- Member data access -----
-
-# Set the location of the object.
-# Note: methods in the base class Shape are used since
-# x and y are defined there.
-
-$c->x = 20;
-$c->y = 30;
-$s->x = -10;
-$s->y = 5;
-
-print "\nHere is their current position:\n";
-print " Circle = ({$c->x},{$c->y})\n";
-print " Square = ({$s->x},{$s->y})\n";
-
-# ----- Call some methods -----
-
-# Notice how the Shape_area() and Shape_perimeter() functions really
-# invoke the appropriate virtual method on each object.
-print "\nHere are some properties of the shapes:\n";
-foreach (array($c,$s) as $o) {
- print " ". get_class($o) . "\n";
- print " area = {$o->area()}\n";
- print " perimeter = {$o->perimeter()}\n";
-}
-
-# ----- Delete everything -----
-
-print "\nGuess I'll clean up now\n";
-
-# Note: this invokes the virtual destructor
-$c = NULL;
-$s = NULL;
-
-# and don't forget the $o from the for loop above. It still refers to
-# the square.
-$o = NULL;
-
-print Shape::nshapes() . " shapes remain\n";
-print "Goodbye\n";
-
-?>
diff --git a/Examples/php5/constants/Makefile b/Examples/php5/constants/Makefile
deleted file mode 100644
index f9557fa89..000000000
--- a/Examples/php5/constants/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/constants/example.i b/Examples/php5/constants/example.i
deleted file mode 100644
index 0098a893a..000000000
--- a/Examples/php5/constants/example.i
+++ /dev/null
@@ -1,26 +0,0 @@
-/* File : example.i */
-%module example
-
-/* A few preprocessor macros */
-
-#define ICONST 42
-#define FCONST 2.1828
-#define CCONST 'x'
-#define CCONST2 '\n'
-#define SCONST "Hello World"
-#define SCONST2 "\"Hello World\""
-
-/* This should work just fine */
-#define EXPR ICONST + 3*(FCONST)
-
-/* This shouldn't do anything */
-#define EXTERN extern
-
-/* Neither should this (BAR isn't defined) */
-#define FOO (ICONST + BAR)
-
-/* The following statements also produce constants */
-%constant int iconst = 37;
-%constant double fconst = 3.14;
-
-
diff --git a/Examples/php5/constants/runme.php b/Examples/php5/constants/runme.php
deleted file mode 100644
index cea06485f..000000000
--- a/Examples/php5/constants/runme.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-require "example.php";
-
-print "ICONST = " . ICONST . " (should be 42)\n";
-print "FCONST = " . FCONST . " (should be 2.1828)\n";
-print "CCONST = " . CCONST . " (should be 'x')\n";
-print "CCONST2 = " . CCONST2 . " (this should be on a new line)\n";
-print "SCONST = " . SCONST . " (should be 'Hello World')\n";
-print "SCONST2 = " . SCONST2 . " (should be '\"Hello World\"')\n";
-print "EXPR = " . EXPR . " (should be 48.5484)\n";
-print "iconst = " . iconst . " (should be 37)\n";
-print "fconst = " . fconst . " (should be 3.14)\n";
-
-if (EXTERN!="EXTERN") {
- print "EXTERN = " . EXTERN . " (Arg! This shouldn't print anything)\n";
-} else {
- print "EXTERN defaults to 'EXTERN', it probably isn't defined (good)\n";
-}
-
-if (FOO!="FOO") {
- print "FOO = " . FOO . "(Arg! This shouldn't print anything)\n";
-} else {
- print "FOO defaults to 'FOO', it probably isn't defined (good)\n";
-}
-
-
-?>
diff --git a/Examples/php5/cpointer/Makefile b/Examples/php5/cpointer/Makefile
deleted file mode 100644
index 92085788a..000000000
--- a/Examples/php5/cpointer/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS = example.c
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/cpointer/example.c b/Examples/php5/cpointer/example.c
deleted file mode 100644
index 04dd08df0..000000000
--- a/Examples/php5/cpointer/example.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* File : example.c */
-
-void add(int *x, int *y, int *result) {
- *result = *x + *y;
-}
-
-void sub(int *x, int *y, int *result) {
- *result = *x - *y;
-}
-
-int divide(int n, int d, int *r) {
- int q;
- q = n/d;
- *r = n - q*d;
- return q;
-}
diff --git a/Examples/php5/cpointer/example.i b/Examples/php5/cpointer/example.i
deleted file mode 100644
index c61d92858..000000000
--- a/Examples/php5/cpointer/example.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-extern void add(int *, int *, int *);
-extern void sub(int *, int *, int *);
-%}
-
-/* This example illustrates a couple of different techniques
- for manipulating C pointers */
-
-/* First we'll use the pointer library */
-extern void add(int *x, int *y, int *result);
-
-%include cpointer.i
-%pointer_functions(int, intp);
-
-/* Next we'll use some typemaps */
-
-%include typemaps.i
-extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
-
-/* Next we'll use typemaps and the %apply directive */
-
-//%apply int *OUTPUT { int *r };
-//extern int divide(int n, int d, int *r);
-
-
-
-
-
diff --git a/Examples/php5/cpointer/runme.php b/Examples/php5/cpointer/runme.php
deleted file mode 100644
index 22e8a681a..000000000
--- a/Examples/php5/cpointer/runme.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
- require "example.php";
-
- # First create some objects using the pointer library.
-
- print "Testing the pointer library\n";
-
- $a = example::new_intp();
- $b = example::new_intp();
- $c = example::new_intp();
- example::intp_assign($a,37);
- example::intp_assign($b,42);
-
- print " a = $a\n";
- print " b = $b\n";
- print " c = $c\n";
-
- # Call the add() function wuth some pointers
- example::add($a,$b,$c);
-
- # Now get the result
- $r = example::intp_value($c);
-
- print " 37 + 42 = $r\n";
-
- # Clean up the pointers
- example::delete_intp($a);
- example::delete_intp($b);
- example::delete_intp($c);
-
- # Now try the typemap library
- # This should be much easier. Now how it is no longer
- # necessary to manufacture pointers.
-
- print "Trying the typemap library\n";
- $r = example::sub(37,42);
- print " 37 - 42 = $r\n";
-
- # Now try the version with multiple return values
- # print "Testing multiple return values\n";
- # $a = example::divide(42,37);
- # $q = $a[0]
- # $r = $a[1]
- # print " 42/37 = $q remainder $r\n";
-
-?>
diff --git a/Examples/php5/disown/Makefile b/Examples/php5/disown/Makefile
deleted file mode 100644
index 8346a1dae..000000000
--- a/Examples/php5/disown/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/disown/example.cxx b/Examples/php5/disown/example.cxx
deleted file mode 100644
index 6393735e9..000000000
--- a/Examples/php5/disown/example.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* File : example.c */
-
-#include "example.h"
-#include <math.h>
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-
-int Shape::get_nshapes() {
- return nshapes;
-}
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
- x += dx;
- y += dy;
-}
-
-int Shape::nshapes = 0;
-
-void Circle::set_radius( double r ) {
- radius = r;
-}
-
-double Circle::area(void) {
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter(void) {
- return 2*M_PI*radius;
-}
-
-double Square::area(void) {
- return width*width;
-}
-
-double Square::perimeter(void) {
- return 4*width;
-}
-
-ShapeContainer::~ShapeContainer() {
- iterator i=shapes.begin();
- for( iterator i = shapes.begin(); i != shapes.end(); ++i ) {
- delete *i;
- }
-}
-
-void
-ShapeContainer::addShape( Shape *s ) {
- shapes.push_back( s );
-}
diff --git a/Examples/php5/disown/example.h b/Examples/php5/disown/example.h
deleted file mode 100644
index e9f96743f..000000000
--- a/Examples/php5/disown/example.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* File : example.h */
-
-#include <vector>
-
-class Shape {
-public:
- Shape() {
- nshapes++;
- }
- virtual ~Shape() {
- nshapes--;
- }
- double x, y;
- void move(double dx, double dy);
- virtual double area(void) = 0;
- virtual double perimeter(void) = 0;
- static int nshapes;
- static int get_nshapes();
-};
-
-class Circle : public Shape {
-private:
- double radius;
-public:
- Circle(double r) : radius(r) { }
- ~Circle() { }
- void set_radius( double r );
- virtual double area(void);
- virtual double perimeter(void);
-};
-
-class Square : public Shape {
-private:
- double width;
-public:
- Square(double w) : width(w) { }
- ~Square() { }
- virtual double area(void);
- virtual double perimeter(void);
-};
-
-class ShapeContainer {
-private:
- typedef std::vector<Shape*>::iterator iterator;
- std::vector<Shape*> shapes;
-public:
- ShapeContainer() : shapes() {}
- ~ShapeContainer();
- void addShape( Shape *s );
-};
diff --git a/Examples/php5/disown/example.i b/Examples/php5/disown/example.i
deleted file mode 100644
index 599f162c5..000000000
--- a/Examples/php5/disown/example.i
+++ /dev/null
@@ -1,12 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-%apply SWIGTYPE *DISOWN {(Shape *s)};
-
-/* Let's just grab the original header file here */
-%include "example.h"
-
diff --git a/Examples/php5/disown/runme.php b/Examples/php5/disown/runme.php
deleted file mode 100644
index d90b03a9d..000000000
--- a/Examples/php5/disown/runme.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-# This file illustrates the low-level C++ interface
-# created by SWIG. In this case, all of our C++ classes
-# get converted into function calls.
-
-require("example.php");
-
-# ----- Object creation -----
-
-print "Creating some objects:\n";
-$c = new Circle(10);
-print " Created circle \$c\n";
-$s = new Square(10);
-print " Created square \$s\n";
-
-# ----- Create the ShapeContainer ----
-
-$container = new ShapeContainer();
-
-$container->addShape($c);
-$container->addShape($s);
-
-# ----- Access a static member -----
-
-print "\nA total of " . Shape::nshapes() . " shapes were created\n";
-
-# ----- Delete by the old references -----
-# This should not truely delete the shapes because they are now owned
-# by the ShapeContainer.
-
-print "Delete the old references.";
-
-# Note: this invokes the virtual destructor
-$c = NULL;
-$s = NULL;
-
-print "\nA total of " . Shape::nshapes() . " shapes remain\n";
-
-# ----- Delete by the container -----
-# This should truely delete the shapes
-
-print "Delete the container.";
-$container = NULL;
-print "\nA total of " . Shape::nshapes() . " shapes remain\n";
-
-print "Goodbye\n";
-
-?>
diff --git a/Examples/php5/enum/Makefile b/Examples/php5/enum/Makefile
deleted file mode 100644
index dc59a6c9b..000000000
--- a/Examples/php5/enum/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT = -noproxy
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/enum/example.cxx b/Examples/php5/enum/example.cxx
deleted file mode 100644
index df7bb6328..000000000
--- a/Examples/php5/enum/example.cxx
+++ /dev/null
@@ -1,37 +0,0 @@
-/* File : example.cxx */
-
-#include "example.h"
-#include <stdio.h>
-
-void Foo::enum_test(speed s) {
- if (s == IMPULSE) {
- printf("IMPULSE speed\n");
- } else if (s == WARP) {
- printf("WARP speed\n");
- } else if (s == LUDICROUS) {
- printf("LUDICROUS speed\n");
- } else {
- printf("Unknown speed\n");
- }
-}
-
-void enum_test(color c, Foo::speed s) {
- if (c == RED) {
- printf("color = RED, ");
- } else if (c == BLUE) {
- printf("color = BLUE, ");
- } else if (c == GREEN) {
- printf("color = GREEN, ");
- } else {
- printf("color = Unknown color!, ");
- }
- if (s == Foo::IMPULSE) {
- printf("speed = IMPULSE speed\n");
- } else if (s == Foo::WARP) {
- printf("speed = WARP speed\n");
- } else if (s == Foo::LUDICROUS) {
- printf("speed = LUDICROUS speed\n");
- } else {
- printf("speed = Unknown speed!\n");
- }
-}
diff --git a/Examples/php5/enum/example.h b/Examples/php5/enum/example.h
deleted file mode 100644
index 525d62afc..000000000
--- a/Examples/php5/enum/example.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* File : example.h */
-
-enum color { RED, BLUE, GREEN };
-
-class Foo {
- public:
- Foo() { }
- enum speed { IMPULSE, WARP, LUDICROUS };
- void enum_test(speed s);
-};
-
-void enum_test(color c, Foo::speed s);
-
diff --git a/Examples/php5/enum/runme.php b/Examples/php5/enum/runme.php
deleted file mode 100644
index 55b0bc4c3..000000000
--- a/Examples/php5/enum/runme.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-require "example.php";
-
-# ----- Object creation -----
-
-# Print out the value of some enums
-print "*** color ***";
-print " RED =" . RED;
-print " BLUE =" . BLUE;
-print " GREEN =" . GREEN;
-
-print "\n*** Foo::speed ***";
-print " Foo_IMPULSE =" . Foo_IMPULSE;
-print " Foo_WARP =" . Foo_WARP;
-print " Foo_LUDICROUS =" . Foo_LUDICROUS;
-
-print "\nTesting use of enums with functions\n";
-
-enum_test(RED, Foo_IMPULSE);
-enum_test(BLUE, Foo_WARP);
-enum_test(GREEN, Foo_LUDICROUS);
-enum_test(1234,5678);
-
-print "\nTesting use of enum with class method\n";
-$f = new_Foo();
-
-Foo_enum_test($f,Foo_IMPULSE);
-Foo_enum_test($f,Foo_WARP);
-Foo_enum_test($f,Foo_LUDICROUS);
-
-?>
diff --git a/Examples/php5/extend/Makefile b/Examples/php5/extend/Makefile
deleted file mode 100644
index 3a34106c3..000000000
--- a/Examples/php5/extend/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php5_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/extend/example.cxx b/Examples/php5/extend/example.cxx
deleted file mode 100644
index 450d75608..000000000
--- a/Examples/php5/extend/example.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-/* File : example.cxx */
-
-#include "example.h"
-
diff --git a/Examples/php5/extend/example.h b/Examples/php5/extend/example.h
deleted file mode 100644
index ca1aed28f..000000000
--- a/Examples/php5/extend/example.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* File : example.h */
-
-#include <cstdio>
-#include <iostream>
-#include <vector>
-#include <string>
-#include <cmath>
-
-class Employee {
-private:
- std::string name;
-public:
- Employee(const char* n): name(n) {}
- virtual std::string getTitle() { return getPosition() + " " + getName(); }
- virtual std::string getName() { return name; }
- virtual std::string getPosition() const { return "Employee"; }
- virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); }
-};
-
-
-class Manager: public Employee {
-public:
- Manager(const char* n): Employee(n) {}
- virtual std::string getPosition() const { return "Manager"; }
-};
-
-
-class EmployeeList {
- std::vector<Employee*> list;
-public:
- EmployeeList() {
- list.push_back(new Employee("Bob"));
- list.push_back(new Employee("Jane"));
- list.push_back(new Manager("Ted"));
- }
- void addEmployee(Employee *p) {
- list.push_back(p);
- std::cout << "New employee added. Current employees are:" << std::endl;
- std::vector<Employee*>::iterator i;
- for (i=list.begin(); i!=list.end(); i++) {
- std::cout << " " << (*i)->getTitle() << std::endl;
- }
- }
- const Employee *get_item(int i) {
- return list[i];
- }
- ~EmployeeList() {
- std::vector<Employee*>::iterator i;
- std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl;
- for (i=list.begin(); i!=list.end(); i++) {
- delete *i;
- }
- std::cout << "~EmployeeList empty." << std::endl;
- }
-};
-
diff --git a/Examples/php5/extend/example.i b/Examples/php5/extend/example.i
deleted file mode 100644
index c8ec32e09..000000000
--- a/Examples/php5/extend/example.i
+++ /dev/null
@@ -1,15 +0,0 @@
-/* File : example.i */
-%module(directors="1") example
-%{
-#include "example.h"
-%}
-
-%include "std_vector.i"
-%include "std_string.i"
-
-/* turn on director wrapping for Manager */
-%feature("director") Employee;
-%feature("director") Manager;
-
-%include "example.h"
-
diff --git a/Examples/php5/extend/index.html b/Examples/php5/extend/index.html
deleted file mode 100644
index 32c6a4913..000000000
--- a/Examples/php5/extend/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<html>
-<head>
-<title>SWIG:Examples:php:extend</title>
-</head>
-
-<body bgcolor="#ffffff">
-
-
-<tt>SWIG/Examples/php/extend/</tt>
-<hr>
-
-<H2>Extending a simple C++ class in PHP</H2>
-
-<p>
-This example illustrates the extending of a C++ class with cross language polymorphism.
-
-<hr>
-</body>
-</html>
diff --git a/Examples/php5/extend/runme.php b/Examples/php5/extend/runme.php
deleted file mode 100644
index 158683142..000000000
--- a/Examples/php5/extend/runme.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-# This file illustrates the cross language polymorphism using directors.
-
-require("example.php");
-
-# CEO class, which overrides Employee::getPosition().
-
-class CEO extends Manager {
- function getPosition() {
- return "CEO";
- }
-}
-
-# Create an instance of our employee extension class, CEO. The calls to
-# getName() and getPosition() are standard, the call to getTitle() uses
-# the director wrappers to call CEO.getPosition.
-
-$e = new CEO("Alice");
-print $e->getName() . " is a " . $e->getPosition() . "\n";
-printf("Just call her \"%s\"\n", $e->getTitle());
-print "----------------------\n";
-
-# Create a new EmployeeList instance. This class does not have a C++
-# director wrapper, but can be used freely with other classes that do.
-
-$list = new EmployeeList();
-
-# EmployeeList owns its items, so we must surrender ownership of objects
-# we add. This involves first clearing the ->disown member to tell the
-# C++ director to start reference counting.
-
-$e->thisown = 0;
-$list->addEmployee($e);
-print "----------------------\n";
-
-# Now we access the first four items in list (three are C++ objects that
-# EmployeeList's constructor adds, the last is our CEO). The virtual
-# methods of all these instances are treated the same. For items 0, 1, and
-# 2, both all methods resolve in C++. For item 3, our CEO, getTitle calls
-# getPosition which resolves in PHP. The call to getPosition is
-# slightly different, however, from the e.getPosition() call above, since
-# now the object reference has been "laundered" by passing through
-# EmployeeList as an Employee*. Previously, PHP resolved the call
-# immediately in CEO, but now PHP thinks the object is an instance of
-# class Employee (actually EmployeePtr). So the call passes through the
-# Employee proxy class and on to the C wrappers and C++ director,
-# eventually ending up back at the CEO implementation of getPosition().
-# The call to getTitle() for item 3 runs the C++ Employee::getTitle()
-# method, which in turn calls getPosition(). This virtual method call
-# passes down through the C++ director class to the PHP implementation
-# in CEO. All this routing takes place transparently.
-
-print "(position, title) for items 0-3:\n";
-
-printf(" %s, \"%s\"\n", $list->get_item(0)->getPosition(), $list->get_item(0)->getTitle());
-printf(" %s, \"%s\"\n", $list->get_item(1)->getPosition(), $list->get_item(1)->getTitle());
-printf(" %s, \"%s\"\n", $list->get_item(2)->getPosition(), $list->get_item(2)->getTitle());
-printf(" %s, \"%s\"\n", $list->get_item(3)->getPosition(), $list->get_item(3)->getTitle());
-print "----------------------\n";
-
-# Time to delete the EmployeeList, which will delete all the Employee*
-# items it contains. The last item is our CEO, which gets destroyed as its
-# reference count goes to zero. The PHP destructor runs, and is still
-# able to call the getName() method since the underlying C++ object still
-# exists. After this destructor runs the remaining C++ destructors run as
-# usual to destroy the object.
-
-unset($list);
-print "----------------------\n";
-
-# All done.
-
-print "php exit\n";
-
-?>
diff --git a/Examples/php5/funcptr/Makefile b/Examples/php5/funcptr/Makefile
deleted file mode 100644
index 92085788a..000000000
--- a/Examples/php5/funcptr/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS = example.c
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/funcptr/example.c b/Examples/php5/funcptr/example.c
deleted file mode 100644
index 99583b72e..000000000
--- a/Examples/php5/funcptr/example.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* File : example.c */
-
-int do_op(int a, int b, int (*op)(int,int)) {
- return (*op)(a,b);
-}
-
-int add(int a, int b) {
- return a+b;
-}
-
-int sub(int a, int b) {
- return a-b;
-}
-
-int mul(int a, int b) {
- return a*b;
-}
diff --git a/Examples/php5/funcptr/example.h b/Examples/php5/funcptr/example.h
deleted file mode 100644
index 58989db79..000000000
--- a/Examples/php5/funcptr/example.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* file: example.h */
-
-extern int do_op(int,int, int (*op)(int,int));
-extern int add(int,int);
-extern int sub(int,int);
-extern int mul(int,int);
-
diff --git a/Examples/php5/funcptr/example.i b/Examples/php5/funcptr/example.i
deleted file mode 100644
index 39390da27..000000000
--- a/Examples/php5/funcptr/example.i
+++ /dev/null
@@ -1,15 +0,0 @@
-/* File : example.i */
-%module example
-%{
-#include "example.h"
-%}
-
-/* Wrap a function taking a pointer to a function */
-extern int do_op(int a, int b, int (*op)(int, int));
-
-/* Now install a bunch of "ops" as constants */
-%constant int (*ADD)(int,int) = add;
-%constant int (*SUB)(int,int) = sub;
-%constant int (*MUL)(int,int) = mul;
-
-
diff --git a/Examples/php5/funcptr/runme.php b/Examples/php5/funcptr/runme.php
deleted file mode 100644
index 712d4147c..000000000
--- a/Examples/php5/funcptr/runme.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-require "example.php";
-
-$a = 37;
-$b = 42;
-
-# Now call our C function with a bunch of callbacks
-
-print "Trying some C callback functions\n";
-print " a = $a\n";
-print " b = $b\n";
-print " ADD(a,b) = ". do_op($a,$b,ADD)."\n";
-print " SUB(a,b) = ". do_op($a,$b,SUB)."\n";
-print " MUL(a,b) = ". do_op($a,$b,MUL)."\n";
-
-print "Here is what the C callback function objects look like in php\n";
-print "Using swig style string pointers as we need them registered as constants\n";
-print " ADD = " . ADD . "\n";
-print " SUB = " . SUB . "\n";
-print " MUL = " . MUL . "\n";
-
-?>
-
diff --git a/Examples/php5/overloading/example.cxx b/Examples/php5/overloading/example.cxx
deleted file mode 100644
index 2f684f05c..000000000
--- a/Examples/php5/overloading/example.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* File : example.c */
-
-#include "example.h"
-#include <math.h>
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-
-int Shape::get_nshapes() {
- return nshapes;
-}
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
- x += dx;
- y += dy;
-}
-
-int Shape::nshapes = 0;
-
-double Circle::area(void) {
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter(void) {
- return 2*M_PI*radius;
-}
-
-double Square::area(void) {
- return width*width;
-}
-
-double Square::perimeter(void) {
- return 4*width;
-}
-
-const char *overloaded(int i) {
- return "Overloaded with int";
-}
-
-const char *overloaded(double d) {
- return "Overloaded with double";
-}
-
-const char *overloaded(const char * str) {
- return "Overloaded with char *";
-}
-
-const char *overloaded( const Circle& ) {
- return "Overloaded with Circle";
-}
-
-const char *overloaded( const Shape& ) {
- return "Overloaded with Shape";
-}
diff --git a/Examples/php5/overloading/example.h b/Examples/php5/overloading/example.h
deleted file mode 100644
index 01d71dd70..000000000
--- a/Examples/php5/overloading/example.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* File : example.h */
-
-#include <stdio.h>
-
-class Shape {
-public:
- Shape() {
- nshapes++;
- }
- virtual ~Shape() {
- nshapes--;
- }
- double x, y;
- void move(double dx, double dy);
- virtual double area(void) = 0;
- virtual double perimeter(void) = 0;
- static int nshapes;
- static int get_nshapes();
-};
-
-class Circle : public Shape {
-private:
- double radius;
-public:
- Circle(double r) : radius(r) { }
- ~Circle() { }
- virtual double area(void);
- virtual double perimeter(void);
-};
-
-class Square : public Shape {
-private:
- double width;
-public:
- Square(double w) : width(w) { }
- ~Square() { }
- virtual double area(void);
- virtual double perimeter(void);
-};
-
-const char *overloaded( int i );
-const char *overloaded( double d );
-const char *overloaded( const char * str );
-const char *overloaded( const Circle& );
-const char *overloaded( const Shape& );
-
diff --git a/Examples/php5/overloading/example.i b/Examples/php5/overloading/example.i
deleted file mode 100644
index 950d2549d..000000000
--- a/Examples/php5/overloading/example.i
+++ /dev/null
@@ -1,8 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-%include "example.h"
diff --git a/Examples/php5/overloading/runme.php b/Examples/php5/overloading/runme.php
deleted file mode 100644
index 56d515138..000000000
--- a/Examples/php5/overloading/runme.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-# This file illustrates the low-level C++ interface
-# created by SWIG. In this case, all of our C++ classes
-# get converted into function calls.
-
-include("example.php");
-
-# ----- Object creation -----
-
-print "Creating some objects:\n";
-$c = new Circle(10);
-print " Created circle \$c\n";
-$s = new Square(10);
-print " Created square \$s\n";
-
-# ----- Access a static member -----
-
-print "\nA total of " . Shape::nshapes() . " shapes were created\n";
-
-# ----- Member data access -----
-
-# Set the location of the object.
-# Note: methods in the base class Shape are used since
-# x and y are defined there.
-
-$c->x = 20;
-$c->y = 30;
-$s->x = -10;
-$s->y = 5;
-
-print "\nHere is their current position:\n";
-print " Circle = (" . $c->x . "," . $c->y . ")\n";
-print " Square = (" . $s->x . "," . $s->y . ")\n";
-
-# ----- Call some methods -----
-
-print "\nCall some overloaded methods:\n";
-foreach (array(1, 2.1, "quick brown fox", $c, $s) as $o) {
- print " overloaded = " . overloaded($o) . "\n";
-}
-
-# Need to unset($o) or else we hang on to a reference to the Square object.
-unset($o);
-
-# ----- Delete everything -----
-
-print "\nGuess I'll clean up now\n";
-
-# Note: this invokes the virtual destructor
-unset($c);
-$s = 42;
-
-print Shape::nshapes() . " shapes remain\n";
-
-print "Goodbye\n";
-
-?>
diff --git a/Examples/php5/pointer/Makefile b/Examples/php5/pointer/Makefile
deleted file mode 100644
index 92085788a..000000000
--- a/Examples/php5/pointer/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS = example.c
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/pointer/example.c b/Examples/php5/pointer/example.c
deleted file mode 100644
index 3326dec3e..000000000
--- a/Examples/php5/pointer/example.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* File : example.c */
-
-void add(double *x, double *y, double *result) {
- *result = *x + *y;
-}
-
-void sub(int *x, int *y, int *result) {
- *result = *x - *y;
-}
-
-int divide(int n, int d, int *r) {
- int q;
- q = n/d;
- *r = n - q*d;
- return q;
-}
diff --git a/Examples/php5/pointer/example.i b/Examples/php5/pointer/example.i
deleted file mode 100644
index 1f0059406..000000000
--- a/Examples/php5/pointer/example.i
+++ /dev/null
@@ -1,30 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-extern void add(double *, double *, double *);
-extern void sub(int *, int *, int *);
-extern int divide(int, int, int *);
-%}
-
-/* This example illustrates a couple of different techniques
- for manipulating C pointers */
-
-%include phppointers.i
-/* First we'll use the pointer library */
-extern void add(double *REF, double *REF, double *REF);
-
-/* Next we'll use some typemaps */
-
-%include typemaps.i
-extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
-
-/* Next we'll use typemaps and the %apply directive */
-
-//%apply int *OUTPUT { int *r };
-//extern int divide(int n, int d, int *r);
-
-
-
-
-
diff --git a/Examples/php5/pointer/runme.php b/Examples/php5/pointer/runme.php
deleted file mode 100644
index e79b23810..000000000
--- a/Examples/php5/pointer/runme.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
- require "example.php";
-
- # First create some objects using the pointer library.
-
- print "Testing the pointer library\n";
-
- $a = 37.145;
- $b = 42.555;
- $c = ""; // $c must be defined and not null.
-
- print " a = $a\n";
- print " b = $b\n";
- print " c = $c\n";
-
- # Call the add() function wuth some pointers
- add($a,$b,$c);
-
- print " $a + $b = $c\n";
-
- # Now try the typemap library
- # This should be much easier. Now how it is no longer
- # necessary to manufacture pointers.
-
- print "Trying the typemap library\n";
- $r = sub(37,42);
- print " 37 - 42 = $r\n";
-
- # Now try the version with multiple return values
- # print "Testing multiple return values\n";
- # ($q,$r) = divide(42,37);
- # print " 42/37 = $q remainder $r\n";
-
-?>
diff --git a/Examples/php5/pragmas/Makefile b/Examples/php5/pragmas/Makefile
deleted file mode 100644
index f9557fa89..000000000
--- a/Examples/php5/pragmas/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/pragmas/example.i b/Examples/php5/pragmas/example.i
deleted file mode 100644
index c7e8bf303..000000000
--- a/Examples/php5/pragmas/example.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* File : example.i */
-%module example
-
-%init{
- zend_printf("This was %%init\n");
-}
-
-%minit{
- zend_printf("This was %%minit\n");
-}
-
-%mshutdown{
- zend_printf("This was %%shutdown\n");
-}
-
-%rinit{
- zend_printf("This was %%rinit\n");
-}
-
-%rshutdown{
- zend_printf("This was %%rshutdown\n");
-}
-
-%pragma(php) include="include.php";
-
-%pragma(php) code="
-# This code is inserted into example.php
-echo \"this was php code\\n\";
-"
-
-%pragma(php) phpinfo="php_info_print_table_start();"
diff --git a/Examples/php5/pragmas/include.php b/Examples/php5/pragmas/include.php
deleted file mode 100644
index e19880a06..000000000
--- a/Examples/php5/pragmas/include.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-# This code is inserted into example.php
-echo "this is include.php\n";
-
-
-?>
diff --git a/Examples/php5/pragmas/runme.php b/Examples/php5/pragmas/runme.php
deleted file mode 100644
index 538548b6f..000000000
--- a/Examples/php5/pragmas/runme.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-require "example.php";
-
-?>
diff --git a/Examples/php5/proxy/Makefile b/Examples/php5/proxy/Makefile
deleted file mode 100644
index 8346a1dae..000000000
--- a/Examples/php5/proxy/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/proxy/example.cxx b/Examples/php5/proxy/example.cxx
deleted file mode 100644
index 94e4a7888..000000000
--- a/Examples/php5/proxy/example.cxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* File : example.c */
-
-#include "example.h"
-#include <math.h>
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-
-int Shape::get_nshapes() {
- return nshapes;
-}
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
- x += dx;
- y += dy;
-}
-
-int Shape::nshapes = 0;
-
-void Circle::set_radius( double r ) {
- radius = r;
-}
-
-double Circle::area(void) {
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter(void) {
- return 2*M_PI*radius;
-}
-
-double Square::area(void) {
- return width*width;
-}
-
-double Square::perimeter(void) {
- return 4*width;
-}
-
-Circle *CircleFactory( double r ) {
- return new Circle(r);
-}
diff --git a/Examples/php5/proxy/example.i b/Examples/php5/proxy/example.i
deleted file mode 100644
index ce73746d0..000000000
--- a/Examples/php5/proxy/example.i
+++ /dev/null
@@ -1,12 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/* Let's just grab the original header file here */
-
-%newobject CircleFactory;
-%include "example.h"
-
diff --git a/Examples/php5/proxy/runme.php b/Examples/php5/proxy/runme.php
deleted file mode 100644
index e70ab229f..000000000
--- a/Examples/php5/proxy/runme.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-# This file illustrates the low-level C++ interface
-# created by SWIG. In this case, all of our C++ classes
-# get converted into function calls.
-
-include("example.php");
-
-# ----- Object creation -----
-
-print "Creating some objects:\n";
-$c = example::CircleFactory(10);
-print " Created circle \$c with area ". $c->area() ."\n";
-$s = new Square(10);
-print " Created square \$s\n";
-
-# ----- Access a static member -----
-
-print "\nA total of " . Shape::nshapes() . " shapes were created\n";
-
-# ----- Member data access -----
-
-# Set the location of the object.
-# Note: methods in the base class Shape are used since
-# x and y are defined there.
-
-$c->x = 20;
-$c->y = 30;
-$s->x = -10;
-$s->y = 5;
-
-print "\nHere is their current position:\n";
-print " Circle = (" . $c->x . "," . $c->y . ")\n";
-print " Square = (" . $s->x . "," . $s->y . ")\n";
-
-# ----- Call some methods -----
-
-print "\nHere are some properties of the shapes:\n";
-foreach (array($c,$s) as $o) {
- print " ".get_class($o)." \$o\n";
- print " x = " . $o->x . "\n";
- print " y = " . $o->y . "\n";
- print " area = " . $o->area() . "\n";
- print " perimeter = " . $o->perimeter() . "\n";
- }
-
-# Need to unset($o) or else we hang on to a reference to the Square object.
-unset($o);
-
-# ----- Delete everything -----
-
-print "\nGuess I'll clean up now\n";
-
-# Note: this invokes the virtual destructor
-unset($c);
-$s = 42;
-
-print Shape::nshapes() . " shapes remain\n";
-
-print "Manually setting nshapes\n";
-
-Shape::nshapes(42);
-
-print Shape::get_nshapes() ." == 42\n";
-
-print "Goodbye\n";
-
-?>
diff --git a/Examples/php5/reference/Makefile b/Examples/php5/reference/Makefile
deleted file mode 100644
index 8346a1dae..000000000
--- a/Examples/php5/reference/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/reference/example.cxx b/Examples/php5/reference/example.cxx
deleted file mode 100644
index 7ead7fbf6..000000000
--- a/Examples/php5/reference/example.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/* File : example.cxx */
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-#include "example.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-Vector operator+(const Vector &a, const Vector &b) {
- Vector r;
- r.x = a.x + b.x;
- r.y = a.y + b.y;
- r.z = a.z + b.z;
- return r;
-}
-
-char *Vector::as_string() {
- static char temp[512];
- sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
- return temp;
-}
-
-VectorArray::VectorArray(int size) {
- items = new Vector[size];
- maxsize = size;
- printf("VectorArray new: self=%p\n", (void *)this);
-}
-
-VectorArray::~VectorArray() {
- printf("VectorArray delete: self=%p\n", (void *)this);
- delete [] items;
-}
-
-Vector &VectorArray::operator[](int index) {
- printf("VectorArray: read[%d] self=%p\n", index, (void *)this);
- if ((index < 0) || (index >= maxsize)) {
- printf("Panic! Array index out of bounds.\n");
- exit(1);
- }
- return items[index];
-}
-
-int VectorArray::size() {
- printf("VectorArray: size %d self=%p\n", maxsize, (void *)this);
- return maxsize;
-}
diff --git a/Examples/php5/reference/example.h b/Examples/php5/reference/example.h
deleted file mode 100644
index 353b88835..000000000
--- a/Examples/php5/reference/example.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* File : example.h */
-
-class Vector {
-private:
- double x,y,z;
-public:
- Vector() : x(0), y(0), z(0) { }
- Vector(double x, double y, double z) : x(x), y(y), z(z) { }
- friend Vector operator+(const Vector &a, const Vector &b);
- char *as_string();
-};
-
-class VectorArray {
-private:
- Vector *items;
- int maxsize;
-public:
- VectorArray(int maxsize);
- ~VectorArray();
- Vector &operator[](int);
- int size();
-};
diff --git a/Examples/php5/reference/example.i b/Examples/php5/reference/example.i
deleted file mode 100644
index df1459921..000000000
--- a/Examples/php5/reference/example.i
+++ /dev/null
@@ -1,43 +0,0 @@
-/* File : example.i */
-
-/* This file has a few "typical" uses of C++ references. */
-
-%module example
-
-%{
-#include "example.h"
-%}
-
-class Vector {
-public:
- Vector(double x, double y, double z);
- ~Vector();
- char *as_string();
-};
-
-/* This helper function calls an overloaded operator */
-%inline %{
-Vector addv(Vector &a, Vector &b) {
- return a+b;
-}
-%}
-
-/* Wrapper around an array of vectors class */
-
-class VectorArray {
-public:
- VectorArray(int maxsize);
- ~VectorArray();
- int size();
-
- /* This wrapper provides an alternative to the [] operator */
- %extend {
- Vector &get(int index) {
- printf("VectorArray extended get: %p %d\n", (void *)$self, index);
- return (*$self)[index];
- }
- void set(int index, Vector &a) {
- (*$self)[index] = a;
- }
- }
-};
diff --git a/Examples/php5/reference/runme.php b/Examples/php5/reference/runme.php
deleted file mode 100644
index 5d264ee43..000000000
--- a/Examples/php5/reference/runme.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-# This file illustrates the manipulation of C++ references in PHP.
-
-require "example.php";
-
-# ----- Object creation -----
-
-print "Creating some objects:\n";
-$a = new Vector(3, 4, 5);
-$b = new Vector(10, 11, 12);
-
-print " Created a: {$a->as_string()}\n";
-print " Created b: {$b->as_string()}\n";
-
-# ----- Call an overloaded operator -----
-
-# This calls the wrapper we placed around
-#
-# operator+(const Vector &a, const Vector &)
-#
-# It returns a new allocated object.
-
-print "Adding a+b\n";
-$c = example::addv($a, $b);
-print " a+b ={$c->as_string()}\n";
-
-# ----- Create a vector array -----
-
-print "Creating an array of vectors\n";
-$va = new VectorArray(10);
-
-print " va: size={$va->size()}\n";
-
-# ----- Set some values in the array -----
-
-# These operators copy the value of $a and $b to the vector array
-$va->set(0, $a);
-$va->set(1, $b);
-$va->set(2, addv($a, $b));
-
-# Get some values from the array
-
-print "Getting some array values\n";
-for ($i = 0; $i < 5; $i++) {
- print " va[$i] = {$va->get($i)->as_string()}\n";
-}
-
-?>
diff --git a/Examples/php5/simple/Makefile b/Examples/php5/simple/Makefile
deleted file mode 100644
index 92085788a..000000000
--- a/Examples/php5/simple/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS = example.c
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/simple/example.c b/Examples/php5/simple/example.c
deleted file mode 100644
index 2fe275632..000000000
--- a/Examples/php5/simple/example.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* File : example.c */
-#include <stdio.h>
-
-/* A global variable */
-double Foo = 3.0;
-
-void print_Foo() {
- printf("In C, Foo = %f\n",Foo);
-}
-
-/* Compute the greatest common divisor of positive integers */
-int gcd(int x, int y) {
- int g;
- g = y;
- while (x > 0) {
- g = x;
- x = y % x;
- y = g;
- }
- return g;
-}
-
-
diff --git a/Examples/php5/simple/example.i b/Examples/php5/simple/example.i
deleted file mode 100644
index 9d4e22aa9..000000000
--- a/Examples/php5/simple/example.i
+++ /dev/null
@@ -1,8 +0,0 @@
-/* File : example.i */
-%module example
-
-%inline %{
-extern int gcd(int x, int y);
-extern double Foo;
-void print_Foo();
-%}
diff --git a/Examples/php5/simple/runme.php b/Examples/php5/simple/runme.php
deleted file mode 100644
index 0e96fe800..000000000
--- a/Examples/php5/simple/runme.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-require "example.php";
-
-# Call our gcd() function
-
-$x = "42 aaa";
-$y = 105;
-$g = gcd($x,$y);
-print "The gcd of $x and $y is $g\n";
-
-# Manipulate the Foo global variable
-
-# Output its current value
-print "Foo = " . Foo_get() . "\n";
-
-# Change its value
-Foo_set(3.1415926);
-
-# See if the change took effect ( this isn't a good example for php, see
-# manual for why. )
-print "Foo = " . Foo_get() . "\n";
-print_Foo();
-
-?>
diff --git a/Examples/php5/sync/Makefile b/Examples/php5/sync/Makefile
deleted file mode 100644
index 8346a1dae..000000000
--- a/Examples/php5/sync/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/sync/example.cxx b/Examples/php5/sync/example.cxx
deleted file mode 100644
index 0942279b2..000000000
--- a/Examples/php5/sync/example.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "example.h"
-#include <stdio.h>
-
-int x = 42;
-char *s = (char *)"Test";
-
-void Sync::printer(void) {
-
- printf("The value of global s is %s\n", s);
- printf("The value of global x is %d\n", x);
- printf("The value of class s is %s\n", s);
- printf("The value of class x is %d\n", x);
-}
diff --git a/Examples/php5/sync/example.h b/Examples/php5/sync/example.h
deleted file mode 100644
index d67ec21dc..000000000
--- a/Examples/php5/sync/example.h
+++ /dev/null
@@ -1,9 +0,0 @@
-extern char *s;
-extern int x;
-
-class Sync {
- public:
- int x;
- char *s;
- void printer(void);
-};
diff --git a/Examples/php5/sync/example.i b/Examples/php5/sync/example.i
deleted file mode 100644
index 17ff87cf3..000000000
--- a/Examples/php5/sync/example.i
+++ /dev/null
@@ -1,7 +0,0 @@
-%module example
-
-%{
-#include "example.h"
-%}
-
-%include "example.h"
diff --git a/Examples/php5/sync/runme.php b/Examples/php5/sync/runme.php
deleted file mode 100644
index a7c43474f..000000000
--- a/Examples/php5/sync/runme.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?
-
-// Load module and PHP classes.
-include("example.php");
-
-echo "Got new object\n";
-echo "Got string $s and value $x \n";
-
-$s = new Sync();
-echo "Got new object\n";
-
-$s->printer();
-
-?>
-
diff --git a/Examples/php5/value/Makefile b/Examples/php5/value/Makefile
deleted file mode 100644
index b0b5e20ac..000000000
--- a/Examples/php5/value/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS = example.c
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT = -noproxy
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/value/example.c b/Examples/php5/value/example.c
deleted file mode 100644
index 3c402a214..000000000
--- a/Examples/php5/value/example.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* File : example.c */
-
-#include "example.h"
-
-double dot_product(Vector a, Vector b) {
- return (a.x*b.x + a.y*b.y + a.z*b.z);
-}
-
-void vector_add(Vector a, Vector b, Vector* result) {
- result->x = a.x + b.x;
- result->y = a.y + b.y;
- result->z = a.z + b.z;
-}
diff --git a/Examples/php5/value/example.h b/Examples/php5/value/example.h
deleted file mode 100644
index f55752a5f..000000000
--- a/Examples/php5/value/example.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* File : example.h */
-
-typedef struct {
- double x, y, z;
-} Vector;
-
-double dot_product(Vector a, Vector b);
-void vector_add(Vector a, Vector b, Vector* result);
diff --git a/Examples/php5/value/example.i b/Examples/php5/value/example.i
deleted file mode 100644
index 20a453468..000000000
--- a/Examples/php5/value/example.i
+++ /dev/null
@@ -1,17 +0,0 @@
-// Tests SWIG's handling of pass-by-value for complex datatypes
-%module example
-
-%{
-#include "example.h"
-%}
-
-%include "example.h"
-
-/* Some helper functions for our interface */
-%inline %{
-
-void vector_print(Vector *v) {
- printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z);
-}
-%}
-
diff --git a/Examples/php5/value/runme.php b/Examples/php5/value/runme.php
deleted file mode 100644
index 49115376c..000000000
--- a/Examples/php5/value/runme.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
- require "example.php";
-
-
- $v = new_vector();
- vector_x_set($v,1.0);
- vector_y_set($v,2.0);
- vector_z_set($v,3.0);
-
- $w = new_vector();
- vector_x_set($w,10.0);
- vector_y_set($w,11.0);
- vector_z_set($w,12.0);
-
- echo "I just created the following vector\n";
- vector_print($v);
- vector_print($w);
-
- echo "\nNow I'm going to compute the dot product\n";
-
- $d = dot_product($v, $w);
-
- echo "dot product = $d (should be 68)\n";
-
- echo "\nNow I'm going to add the vectors together\n";
-
- $r = new_vector();
- vector_add($v, $w, $r);
-
- vector_print($r);
-
- echo "The value should be (11,13,15)\n";
-
- echo "\nNow I'm going to clean up the return result\n";
-
-# free($r);
-
- echo "Good\n";
-
-?>
-
-
diff --git a/Examples/php5/variables/Makefile b/Examples/php5/variables/Makefile
deleted file mode 100644
index 92085788a..000000000
--- a/Examples/php5/variables/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS = example.c
-TARGET = example
-INTERFACE = example.i
-LIBS =
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- php5
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php5_clean
diff --git a/Examples/php5/variables/example.c b/Examples/php5/variables/example.c
deleted file mode 100644
index d4c6d026d..000000000
--- a/Examples/php5/variables/example.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* File : example.c */
-
-/* I'm a file containing some C global variables */
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "example.h"
-
-int ivar = 0;
-short svar = 0;
-long lvar = 0;
-unsigned int uivar = 0;
-unsigned short usvar = 0;
-unsigned long ulvar = 0;
-signed char scvar = 0;
-unsigned char ucvar = 0;
-char cvar = 0;
-float fvar = 0;
-double dvar = 0;
-char *strvar = 0;
-const char cstrvar[] = "Goodbye";
-int *iptrvar = 0;
-char name[5] = "Dave";
-char path[256] = "/home/beazley";
-
-
-/* Global variables involving a structure */
-Point *ptptr = 0;
-Point pt = { 10, 20 };
-
-/* A variable that we will make read-only in the interface */
-int status = 1;
-
-/* A debugging function to print out their values */
-
-void print_vars() {
- printf("ivar = %d\n", ivar);
- printf("svar = %d\n", svar);
- printf("lvar = %ld\n", lvar);
- printf("uivar = %u\n", uivar);
- printf("usvar = %u\n", usvar);
- printf("ulvar = %lu\n", ulvar);
- printf("scvar = %d\n", scvar);
- printf("ucvar = %u\n", ucvar);
- printf("fvar = %g\n", fvar);
- printf("dvar = %g\n", dvar);
- printf("cvar = %c\n", cvar);
- printf("strvar = %s\n", strvar ? strvar : "(null)");
- printf("cstrvar = %s\n", cstrvar);
- printf("iptrvar = %p\n", (void *)iptrvar);
- printf("name = %c%c%c%c%c\n", name[0],name[1],name[2],name[3],name[4]);
- printf("ptptr = %p %s\n", (void *)ptptr, Point_print( ptptr ) );
- printf("pt = (%d, %d)\n", pt.x, pt.y);
- printf("status = %d\n", status);
-}
-
-/* A function to create an integer (to test iptrvar) */
-
-int *new_int(int value) {
- int *ip = (int *) malloc(sizeof(int));
- *ip = value;
- return ip;
-}
-
-int value_int(int *value) {
- return *value;
-}
-
-/* A function to create a point */
-
-Point *new_Point(int x, int y) {
- Point *p = (Point *) malloc(sizeof(Point));
- p->x = x;
- p->y = y;
- return p;
-}
-
-char * Point_print(Point *p) {
- static char buffer[256];
- if (p) {
- sprintf(buffer,"(%d,%d)", p->x,p->y);
- } else {
- sprintf(buffer,"null");
- }
- return buffer;
-}
-
-void pt_print() {
- printf("(%d, %d)\n", pt.x, pt.y);
-}
diff --git a/Examples/php5/variables/example.h b/Examples/php5/variables/example.h
deleted file mode 100644
index 3b3659ce5..000000000
--- a/Examples/php5/variables/example.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* File: example.h */
-
-typedef struct {
- int x,y;
-} Point;
-
-/* Some global variable declarations */
-extern int ivar;
-extern short svar;
-extern long lvar;
-extern unsigned int uivar;
-extern unsigned short usvar;
-extern unsigned long ulvar;
-extern signed char scvar;
-extern unsigned char ucvar;
-extern char cvar;
-extern float fvar;
-extern double dvar;
-extern char *strvar;
-extern const char cstrvar[];
-extern int *iptrvar;
-extern char name[5];
-
-extern Point *ptptr;
-extern Point pt;
-
-extern int status;
-extern char path[256];
-
-extern void print_vars();
-extern int *new_int(int value);
-extern Point *new_Point(int x, int y);
-extern char *Point_print(Point *p);
-extern void pt_print();
diff --git a/Examples/php5/variables/example.i b/Examples/php5/variables/example.i
deleted file mode 100644
index 3edbb72d7..000000000
--- a/Examples/php5/variables/example.i
+++ /dev/null
@@ -1,44 +0,0 @@
-/* File : example.i */
-%module example
-%{
-#include "example.h"
-%}
-
-/* Some global variable declarations */
-extern int ivar;
-extern short svar;
-extern long lvar;
-extern unsigned int uivar;
-extern unsigned short usvar;
-extern unsigned long ulvar;
-extern signed char scvar;
-extern unsigned char ucvar;
-extern char cvar;
-extern float fvar;
-extern double dvar;
-extern char *strvar;
-extern const char cstrvar[];
-extern int *iptrvar;
-extern char name[5];
-
-extern Point *ptptr;
-extern Point pt;
-
-/* Some read-only variables */
-
-%immutable;
-extern int status;
-extern char path[256];
-%mutable;
-
-/* Some helper functions to make it easier to test */
-extern void print_vars();
-extern int *new_int(int value);
-
-extern Point *new_Point(int x, int y);
-extern char *Point_print(Point *p);
-extern void pt_print();
-
-
-
-
diff --git a/Examples/php5/variables/runme.php b/Examples/php5/variables/runme.php
deleted file mode 100644
index bbfeb610b..000000000
--- a/Examples/php5/variables/runme.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
- require "example.php";
- echo "\nVariables (values printed from C)\n";
-
- print_vars();
-
- echo "Variables (values printed from PHP)\n";
-
- echo "ivar = ".ivar_get()."\n";
- echo "svar = ".svar_get()."\n";
- echo "lvar = ".lvar_get()."\n";
- echo "uivar = ".uivar_get()."\n";
- echo "usvar = ".usvar_get()."\n";
- echo "ulvar = ".ulvar_get()."\n";
- echo "scvar = ".scvar_get()."\n";
- echo "ucvar = ".ucvar_get()."\n";
- echo "cvar = ".cvar_get()."\n";
- echo "fvar = ".fvar_get()."\n";
- echo "dvar = ".dvar_get()."\n";
- echo "strvar = ".strvar_get()."\n";
- echo "cstrvar = ".cstrvar_get()."\n";
- echo "iptrvar = ".iptrvar_get()."\n";
- echo "name = \"".name_get()."\"\n";
- echo "ptptr = ".ptptr_get() , point_print(ptptr_get()) , "\n";
- echo "pt = ".pt_get(), point_print(pt_get()) , "\n";
-
- /* Try to set the values of some global variables */
-$a = "42.14";
-
- ivar_set($a);
-echo "a = $a\n";
- svar_set(-31000);
- lvar_set(65537);
- uivar_set(123456);
- usvar_set(61000);
- ulvar_set(654321);
- scvar_set(-13);
- ucvar_set(251);
- cvar_set("S");
- fvar_set(3.14159);
- dvar_set(2.1828);
- strvar_set("Hello World");
- iptrvar_set(new_int(37));
- ptptr_set(new_point(37,42));
- name_set("B");
-
- echo "Variables (values printed from PHP)\n";
-
- echo "ivar = ".ivar_get()."\n";
- echo "svar = ".svar_get()."\n";
- echo "lvar = ".lvar_get()."\n";
- echo "uivar = ".uivar_get()."\n";
- echo "usvar = ".usvar_get()."\n";
- echo "ulvar = ".ulvar_get()."\n";
- echo "scvar = ".scvar_get()."\n";
- echo "ucvar = ".ucvar_get()."\n";
- echo "cvar = ".cvar_get()."\n";
- echo "fvar = ".fvar_get()."\n";
- echo "dvar = ".dvar_get()."\n";
- echo "strvar = ".strvar_get()."\n";
- echo "cstrvar = ".cstrvar_get()."\n";
- echo "iptrvar = ".iptrvar_get()."\n";
- echo "name = ".name_get()."\n";
- echo "ptptr = ".ptptr_get() , point_print(ptptr_get()) , "\n";
- echo "pt = ".pt_get(), point_print(pt_get()) , "\n";
-
- echo "\nVariables (values printed from C)\n";
-
- print_vars();
-
- echo "\nI'm going to try and update a structure variable.\n";
-
- pt_set(ptptr_get());
-
- echo "The new value is \n";
-
- pt_print();
-
- echo "You should see the value", point_print(ptptr_get()), "\n";
-
- echo "\nNow I'm going to try and modify some read only variables\n";
-
- echo "Trying to set 'path'\n";
-
- //path_set("Whoa!");
- echo "Path = ".path_get()."\n";
-
- echo "Trying to set 'status'\n";
-
- /* And this */
- //status_set(0);
- echo "Status = ".status_get()."\n";
-
-?>
-
diff --git a/Examples/python/check.list b/Examples/python/check.list
index a43a5fca0..0798b5f7e 100644
--- a/Examples/python/check.list
+++ b/Examples/python/check.list
@@ -4,6 +4,7 @@ class
constants
contract
docstrings
+doxygen
enum
exception
exceptproxy
@@ -14,7 +15,6 @@ functor
import
import_template
import_packages
-java
#libffi
multimap
operator
diff --git a/Examples/python/doxygen/Makefile b/Examples/python/doxygen/Makefile
new file mode 100644
index 000000000..1a0e3d7c5
--- /dev/null
+++ b/Examples/python/doxygen/Makefile
@@ -0,0 +1,27 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+CXXSRCS = example.cxx
+TARGET = example
+INTERFACE = example.i
+LIBS = -lm
+SWIGOPT = -doxygen
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
+
+static:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' \
+ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean
+ rm -f example.html
diff --git a/Examples/python/doxygen/example.cxx b/Examples/python/doxygen/example.cxx
new file mode 100644
index 000000000..ccdb87dfe
--- /dev/null
+++ b/Examples/python/doxygen/example.cxx
@@ -0,0 +1,48 @@
+/* File : example.cxx */
+
+#include "example.h"
+#define M_PI 3.14159265358979323846
+
+/* Move the shape to a new location */
+void Shape::move(double dx, double dy) {
+ x += dx;
+ y += dy;
+}
+
+int Shape::nshapes = 0;
+
+Circle::Circle(double r) : radius(r) {
+ NumCircles++;
+}
+
+double Circle::area() {
+ return M_PI*radius*radius;
+}
+
+double Circle::perimeter() {
+ return 2*M_PI*radius;
+}
+
+Square::Square(double w) : width(w) {
+ NumSquares++;
+}
+
+double Square::area() {
+ return width*width;
+}
+
+double Square::perimeter() {
+ return 4*width;
+}
+
+int NumSquares = 0;
+int NumCircles = 0;
+
+Square MakeSquare(double r) {
+ return Square(r);
+}
+
+Circle MakeCircle(double w) {
+ return Circle(w);
+}
+
diff --git a/Examples/python/doxygen/example.dsp b/Examples/python/doxygen/example.dsp
new file mode 100644
index 000000000..95ad8f173
--- /dev/null
+++ b/Examples/python/doxygen/example.dsp
@@ -0,0 +1,152 @@
+# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=example - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "example.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "example - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib "$(PYTHON_LIB)" /nologo /dll /debug /machine:I386 /out:"_example.pyd" /pdbtype:sept
+
+!ELSEIF "$(CFG)" == "example - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib "$(PYTHON_LIB)" /nologo /dll /machine:I386 /out:"_example.pyd"
+
+!ENDIF
+
+# Begin Target
+
+# Name "example - Win32 Debug"
+# Name "example - Win32 Release"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\example.cxx
+# End Source File
+# Begin Source File
+
+SOURCE=.\example_wrap.cxx
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\example.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\example.i
+
+!IF "$(CFG)" == "example - Win32 Debug"
+
+# Begin Custom Build
+InputPath=.\example.i
+InputName=example
+
+"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ echo In order to function correctly, please ensure the following environment variables are correctly set:
+ echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
+ echo PYTHON_LIB: %PYTHON_LIB%
+ echo on
+ ..\..\..\swig.exe -c++ -python "$(InputPath)"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "example - Win32 Release"
+
+# Begin Custom Build
+InputPath=.\example.i
+InputName=example
+
+"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ echo In order to function correctly, please ensure the following environment variables are correctly set:
+ echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
+ echo PYTHON_LIB: %PYTHON_LIB%
+ echo on
+ ..\..\..\swig.exe -c++ -python "$(InputPath)"
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
diff --git a/Examples/python/doxygen/example.h b/Examples/python/doxygen/example.h
new file mode 100644
index 000000000..203348ae4
--- /dev/null
+++ b/Examples/python/doxygen/example.h
@@ -0,0 +1,107 @@
+/*! \file example.h
+This file provides a simple set of Shape classes. */
+
+/*! Base class for all shapes.
+ \author Bob
+ */
+class Shape {
+public:
+ /*! Default constructor for creating a Shape */
+ Shape() {
+ nshapes++;
+ }
+ /*! Destructor for destroying a Shape */
+ virtual ~Shape() {
+ nshapes--;
+ }
+ double x; /*!< x co-ordinate */
+ double y; /*!< y co-ordinate */
+ void move(double dx, double dy); /*!< Move a shape to a new co-ordinate
+ \param dx x co-ordinate
+ \param dy y co-ordinate */
+ virtual double area() = 0; /*!< \return the area */
+ virtual double perimeter() = 0; /*!< \return the perimeter */
+ static int nshapes; /*!< Number of shapes currently in existence */
+};
+
+/*! A class for representing a circle.
+ \author Jack
+ */
+class Circle : public Shape {
+private:
+ double radius;
+public:
+ /*! Construct a circle
+ * \param r radius of the circle */
+ Circle(double r);
+ /*! Calculate the area of the circle
+ * \return calculated area */
+ virtual double area();
+ /*! Calculate the perimeter of the circle
+ * \return calculated perimeter of the circle */
+ virtual double perimeter();
+};
+
+/// A class for representing a square.
+class Square : public Shape {
+private:
+ double width;
+public:
+ /** Construct a square
+ * \param w width of the square */
+ Square(double w);
+ /** Calculate the area of the square
+ * \return calculated area */
+ virtual double area();
+ /** Calculate the perimeter of the square
+ * \return calculated perimeter of the square */
+ virtual double perimeter();
+};
+
+/// A class for representing a rectangle, templated on the type for the rectangle dimensions
+template<typename T>
+class Rectangle : public Shape {
+private:
+ T height;
+ T width;
+public:
+ /** Construct a rectangle
+ * \param h height of the rectangle
+ * \param w width of the rectangle */
+ Rectangle(T h, T w) : height(h), width(w) {}
+ /** Calculate the area of the rectangle
+ * \return calculated area */
+ virtual double area() { return width*height; }
+ /** Calculate the perimeter of the rectangle
+ * \return calculated perimeter of the rectangle */
+ virtual double perimeter() { return 2*height + 2*width; }
+};
+
+
+/*! Factory function for creating a square
+ * \param r width of the square
+ * \return a fully constructed square */
+Square MakeSquare(double r);
+
+/*! Factory function for creating a circle
+ * \param w radius of the circle
+ * \return a fully constructed circle */
+Circle MakeCircle(double w);
+
+/*! Factory function for creating a rectangle
+ * \param h height of the rectangle
+ * \param w width of the rectangle
+ * \return a fully constructed rectangle */
+template<typename T>
+Rectangle<T> MakeRectangle(T h, T w) {
+ return Rectangle<T>(h, w);
+}
+
+
+
+/*! Total number of circles ever created */
+extern int NumCircles;
+
+/// Total number of squares ever created
+extern int NumSquares;
+
diff --git a/Examples/python/doxygen/example.i b/Examples/python/doxygen/example.i
new file mode 100644
index 000000000..803563dd9
--- /dev/null
+++ b/Examples/python/doxygen/example.i
@@ -0,0 +1,17 @@
+%module example
+
+%{
+#include "example.h"
+%}
+
+%immutable NumSquares;
+%immutable NumCircles;
+
+%include "example.h"
+
+/*! - this instantiation uses type int */
+%template(RectangleInt) Rectangle<int>;
+
+/*! - this instantiation uses type int */
+%template(MakeRectangleInt) MakeRectangle<int>;
+
diff --git a/Examples/python/doxygen/runme.py b/Examples/python/doxygen/runme.py
new file mode 100644
index 000000000..e23528874
--- /dev/null
+++ b/Examples/python/doxygen/runme.py
@@ -0,0 +1,28 @@
+# This example shows simple usage of the wrapped Shape classes.
+# The main purpose of this example is to show the doxygen comments translation to PyDoc comments.
+# Users should look at the generated example.py file.
+# The generated PyDoc can be viewed in a browser by opening the example.html file.
+
+import example
+
+print "Creating some objects:"
+c = example.MakeCircle(10)
+print " Created circle", c
+s = example.MakeSquare(10)
+print " Created square", s
+r = example.MakeRectangleInt(10, 20)
+print " Created rectangle", r
+
+print "\nHere are some properties of the shapes:"
+for o in [c, s, r]:
+ print " ", o
+ print " area = ", o.area()
+ print " perimeter = ", o.perimeter()
+
+print "\nRunning pydoc, this is the equivalent to executing: pydoc -w ./example.py"
+
+import pydoc
+
+pydoc.writedoc("example")
+
+print "Open example.html in your browser to view the generated python docs"
diff --git a/Examples/python/exception/example.h b/Examples/python/exception/example.h
index 8f9a977b0..bc744cda7 100644
--- a/Examples/python/exception/example.h
+++ b/Examples/python/exception/example.h
@@ -1,6 +1,6 @@
/* File : example.h */
-#include <string>
+#include <string.h>
#ifndef SWIG
struct A {
};
@@ -16,30 +16,26 @@ public:
char msg[256];
};
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
class Test {
public:
- int simple() throw(int) {
+ int simple() {
throw(37);
return 1;
}
- int message() throw(const char *) {
+ int message() {
throw("I died.");
return 1;
}
- int hosed() throw(Exc) {
+ int hosed() {
throw(Exc(42,"Hosed"));
return 1;
}
- int unknown() throw(A*) {
+ int unknown() {
static A a;
throw &a;
return 1;
}
- int multi(int x) throw(int, const char *, Exc) {
+ int multi(int x) {
if (x == 1) throw(37);
if (x == 2) throw("Bleah!");
if (x == 3) throw(Exc(42,"No-go-diggy-die"));
@@ -47,7 +43,3 @@ public:
}
};
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
diff --git a/Examples/python/exception/example.i b/Examples/python/exception/example.i
index 817c5221c..3a3a6548f 100644
--- a/Examples/python/exception/example.i
+++ b/Examples/python/exception/example.i
@@ -7,6 +7,12 @@
%include "std_string.i"
+%catches(int) Test::simple();
+%catches(const char *) Test::message();
+%catches(Exc) Test::hosed();
+%catches(A*) Test::unknown();
+%catches(int, const char *, Exc) Test::multi(int x);
+
/* Let's just grab the original header file here */
%include "example.h"
diff --git a/Examples/python/exceptproxy/example.h b/Examples/python/exceptproxy/example.h
index ec7107a5e..3ee6d765d 100644
--- a/Examples/python/exceptproxy/example.h
+++ b/Examples/python/exceptproxy/example.h
@@ -8,10 +8,6 @@ class FullError {
FullError(int m) : maxsize(m) { }
};
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
template<typename T> class Queue {
int maxsize;
T *items;
@@ -27,7 +23,7 @@ template<typename T> class Queue {
~Queue() {
delete [] items;
}
- void enqueue(T x) throw(FullError) {
+ void enqueue(T x) {
if (nitems == maxsize) {
throw FullError(maxsize);
}
@@ -47,8 +43,3 @@ template<typename T> class Queue {
}
};
-
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
diff --git a/Examples/python/exceptproxy/example.i b/Examples/python/exceptproxy/example.i
index 0a46afbb6..4ad960845 100644
--- a/Examples/python/exceptproxy/example.i
+++ b/Examples/python/exceptproxy/example.i
@@ -20,29 +20,12 @@
the header file, the enqueue method throws FullError and
the dequeue method throws EmptyError. Since we don't
want to define an exception handler for everything, we
- simply write a handler each method individually.
+ simply write a handler for each method individually.
Note: the *::enqueue syntax means that we simply define
the handler for any class with this method defined.
*/
-/*
- First we need to 'disable' the default swig throw mechanism for the
- FullError class. We do this by rethrowing the exception.
-
- Note that this is necessary since the class appears in a throw
- declaration:
-
-
- void enqueue(T x) throw(FullError);
-
- hence, swig recognizes it as an exception class and it will generate
- the necessary code to catch it and rethrow it to the python side.
-
-*/
-%typemap(throws) FullError "(void)$1; throw;";
-
-
%exception *::enqueue {
try {
$action
@@ -76,15 +59,15 @@
*/
/*
- Now, the EmpytError doesn't appear in a throw declaration, and hence
- we need to 'mark' it as an exception class. In python, classes that
- are used as exception are 'special', and need to be wrapped as
- 'classic' ones.
-
- This is a python issue, and if you don't mark the class, you will
- see 'interesting' behaviours at the python side.
-
-
+ Python classes that are used as exceptions need to be subclasses of the
+ "Exception" class, and so SWIG needs to know which wrapped classes may be
+ used in this way. You can explicitly tell SWIG this by using
+ %exceptionclass. SWIG will implicitly set this feature for classes which
+ appear in a throw declaration, but it's not a problem to explicitly
+ mark such classes as well.
+
+ This is a Python requirement - if you fail to mark such classes with
+ %exceptionclass you may see 'interesting' behaviour on the Python side.
*/
%exceptionclass EmptyError;
%exceptionclass FullError;
diff --git a/Examples/python/extend/runme.py b/Examples/python/extend/runme.py
index 2bb38fadc..e97358b99 100644
--- a/Examples/python/extend/runme.py
+++ b/Examples/python/extend/runme.py
@@ -18,7 +18,7 @@ class CEO(example.Manager):
# Create an instance of our employee extension class, CEO. The calls to
# getName() and getPosition() are standard, the call to getTitle() uses
-# the director wrappers to call CEO.getPosition. e = CEO("Alice")
+# the director wrappers to call CEO.getPosition.
e = CEO("Alice")
print e.getName(), "is a", e.getPosition()
diff --git a/Examples/python/import_packages/Makefile b/Examples/python/import_packages/Makefile
index f428d6f5c..c7f9a830b 100644
--- a/Examples/python/import_packages/Makefile
+++ b/Examples/python/import_packages/Makefile
@@ -8,11 +8,12 @@ import_packages_subdirs = \
from_init1 \
from_init2 \
from_init3 \
+ module_is_init \
relativeimport1 \
relativeimport2 \
relativeimport3 \
split_modules \
- namespace_pkg
+ namespace_pkg \
check: build
@@ -21,19 +22,19 @@ check: build
mkdir -p `dirname $$file`; \
cp "${SRCDIR}$$file" "$$file" || exit 1; \
done; \
- fi; \
+ fi
for s in $(import_packages_subdirs); do \
- (cd $$s && $(MAKE) check); \
+ (cd $$s && $(MAKE) check) || exit 1; \
done
build:
for s in $(import_packages_subdirs); do \
- (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build); \
+ (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build) || exit 1; \
done
static:
for s in $(import_packages_subdirs); do \
- (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static); \
+ (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static) || exit 1; \
done
clean:
@@ -42,7 +43,7 @@ clean:
for file in `cd $(SRCDIR) && find . -type f -name "*.py"`; do \
rm -f "$$file" || exit 1; \
done; \
- fi; \
+ fi
for s in $(import_packages_subdirs); do \
- (cd $$s && $(MAKE) clean); \
+ (cd $$s && $(MAKE) clean) || exit 1; \
done
diff --git a/Examples/python/import_packages/from_init1/runme.py b/Examples/python/import_packages/from_init1/runme.py
index dda397487..a663a136b 100644
--- a/Examples/python/import_packages/from_init1/runme.py
+++ b/Examples/python/import_packages/from_init1/runme.py
@@ -1,13 +1,35 @@
-import sys
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+if sys.version_info < (2, 5):
+ print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ sys.exit(0)
+
if sys.version_info < (3, 0):
import py2.pkg2
print " Finished importing py2.pkg2"
+ commandline = sys.executable + " -m py2.pkg2.bar"
+ run_except_on_windows(commandline)
+ commandline = sys.executable + " -m py2.pkg2.foo"
+ run_except_on_windows(commandline)
else:
import py3.pkg2
print " Finished importing py3.pkg2"
+ # commandline = sys.executable + " -m py3.pkg2.bar"
+ # run_except_on_windows(commandline)
+ # commandline = sys.executable + " -m py3.pkg2.foo"
+ # run_except_on_windows(commandline)
+
+# TODO: Commented out code above results in (from python-3.6 onwards):
+# RuntimeWarning: 'py3.pkg2.bar' found in sys.modules after import of package 'py3.pkg2', but prior to execution of 'py3.pkg2.bar'; this may result in unpredictable behaviour
diff --git a/Examples/python/import_packages/from_init2/runme.py b/Examples/python/import_packages/from_init2/runme.py
index dda397487..3c7b12693 100644
--- a/Examples/python/import_packages/from_init2/runme.py
+++ b/Examples/python/import_packages/from_init2/runme.py
@@ -1,13 +1,31 @@
-import sys
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+if sys.version_info < (2, 5):
+ print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ sys.exit(0)
+
if sys.version_info < (3, 0):
import py2.pkg2
print " Finished importing py2.pkg2"
+ commandline = sys.executable + " -m py2.pkg2.bar"
+ run_except_on_windows(commandline)
else:
import py3.pkg2
print " Finished importing py3.pkg2"
+ # commandline = sys.executable + " -m py3.pkg2.bar"
+ # run_except_on_windows(commandline)
+
+# TODO: Commented out code above results in (from python-3.6 onwards):
+# RuntimeWarning: 'py3.pkg2.bar' found in sys.modules after import of package 'py3.pkg2', but prior to execution of 'py3.pkg2.bar'; this may result in unpredictable behaviour
diff --git a/Examples/python/import_packages/from_init3/runme.py b/Examples/python/import_packages/from_init3/runme.py
index dda397487..3c7b12693 100644
--- a/Examples/python/import_packages/from_init3/runme.py
+++ b/Examples/python/import_packages/from_init3/runme.py
@@ -1,13 +1,31 @@
-import sys
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+if sys.version_info < (2, 5):
+ print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ sys.exit(0)
+
if sys.version_info < (3, 0):
import py2.pkg2
print " Finished importing py2.pkg2"
+ commandline = sys.executable + " -m py2.pkg2.bar"
+ run_except_on_windows(commandline)
else:
import py3.pkg2
print " Finished importing py3.pkg2"
+ # commandline = sys.executable + " -m py3.pkg2.bar"
+ # run_except_on_windows(commandline)
+
+# TODO: Commented out code above results in (from python-3.6 onwards):
+# RuntimeWarning: 'py3.pkg2.bar' found in sys.modules after import of package 'py3.pkg2', but prior to execution of 'py3.pkg2.bar'; this may result in unpredictable behaviour
diff --git a/Examples/python/import_packages/module_is_init/Makefile b/Examples/python/import_packages/module_is_init/Makefile
new file mode 100644
index 000000000..43763aa4b
--- /dev/null
+++ b/Examples/python/import_packages/module_is_init/Makefile
@@ -0,0 +1,15 @@
+TOP = ../../..
+LIBS =
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
+
+build:
+ cd pkg1 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+
+static:
+ cd pkg1 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
+ cd pkg1 && $(MAKE) clean
diff --git a/Examples/python/import_packages/module_is_init/README b/Examples/python/import_packages/module_is_init/README
new file mode 100644
index 000000000..ee7391cda
--- /dev/null
+++ b/Examples/python/import_packages/module_is_init/README
@@ -0,0 +1,18 @@
+This example tests renaming the generated SWIG pure Python module to __init__.py
+to turn the module into a Python package.
+
+Use 'python runme.py' to run the test.
+
+Overview:
+---------
+
+SWIG generates a pure Python module foo.py from the input interface file foo.i.
+The foo.py file is generated within the pkg1 directory and is then renamed __init__.py.
+This results in everything in the SWIG generated module being available in the Python
+pkg1 package.
+
+This approach of turning the SWIG generated module into a package worked in versions
+of SWIG up to swig-3.0.8, but stopped working from swig-3.0.9 until it was
+re-instated in swig-4.0.0. However, Python 2.7 or 3.3 and later are needed to
+work out of the box. Python 3.2 does not work as this version of Python does
+not set __package__ in __init__.py.
diff --git a/Examples/python/import_packages/module_is_init/pkg1/Makefile b/Examples/python/import_packages/module_is_init/pkg1/Makefile
new file mode 100644
index 000000000..d9d83ed0a
--- /dev/null
+++ b/Examples/python/import_packages/module_is_init/pkg1/Makefile
@@ -0,0 +1,20 @@
+TOP = ../../../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SWIGOPT =
+LIBS =
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ mv foo.py __init__.py
+
+static:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
+ rm -f __init__.py
diff --git a/Examples/python/import_packages/module_is_init/pkg1/foo.hpp b/Examples/python/import_packages/module_is_init/pkg1/foo.hpp
new file mode 100644
index 000000000..01c462266
--- /dev/null
+++ b/Examples/python/import_packages/module_is_init/pkg1/foo.hpp
@@ -0,0 +1,10 @@
+
+int foofunction(int i) {
+ return i *= 10;
+}
+
+struct FooClass {
+ int foomethod(int i) {
+ return i += 5;
+ }
+};
diff --git a/Examples/python/import_packages/module_is_init/pkg1/foo.i b/Examples/python/import_packages/module_is_init/pkg1/foo.i
new file mode 100644
index 000000000..f8d71380c
--- /dev/null
+++ b/Examples/python/import_packages/module_is_init/pkg1/foo.i
@@ -0,0 +1,5 @@
+%module foo
+%{
+#include "./foo.hpp"
+%}
+%include "./foo.hpp"
diff --git a/Examples/python/import_packages/module_is_init/runme.py b/Examples/python/import_packages/module_is_init/runme.py
new file mode 100644
index 000000000..b5e646e85
--- /dev/null
+++ b/Examples/python/import_packages/module_is_init/runme.py
@@ -0,0 +1,26 @@
+import os.path
+import sys
+
+# Test import of a SWIG generated module renamed as the package's __init__.py
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - module renamed as __init__.py"
+
+if sys.version_info >= (3, 0, 0) and sys.version_info < (3, 3, 0):
+ print " Not importing as Python version is >= 3.0 and < 3.3"
+ # Package detection does not work in these versions.
+ # Can be fixed by using this in the interface file:
+ # %module(moduleimport="from . import $module") foo # without -builtin
+ # %module(moduleimport="from .$module import *") foo # with -builtin
+ sys.exit(0)
+
+import pkg1
+print " Finished importing pkg1"
+
+if pkg1.foofunction(123) != 1230:
+ raise RuntimeError("foofunction failed")
+
+fc = pkg1.FooClass()
+if fc.foomethod(1) != 6:
+ raise RuntimeError("foomethod failed")
+
+print " Finished testing pkg1"
diff --git a/Examples/python/import_packages/namespace_pkg/nonpkg.py b/Examples/python/import_packages/namespace_pkg/nonpkg.py
index acf0aedbd..52be74db4 100644
--- a/Examples/python/import_packages/namespace_pkg/nonpkg.py
+++ b/Examples/python/import_packages/namespace_pkg/nonpkg.py
@@ -1,5 +1,22 @@
+import os
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
+
+print(" Starting subtest " + os.path.basename(__file__))
+
# import robin as a module in the global namespace
import robin
+print(" Finished importing robin")
+
+if not(robin.run() == "AWAY!"):
+ raise RuntimeError("test failed")
-assert(robin.run() == "AWAY!")
+commandline = sys.executable + " -m robin"
+run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/namespace_pkg/normal.py b/Examples/python/import_packages/namespace_pkg/normal.py
index fc26c0216..0eb8f517c 100644
--- a/Examples/python/import_packages/namespace_pkg/normal.py
+++ b/Examples/python/import_packages/namespace_pkg/normal.py
@@ -1,7 +1,23 @@
+import os
+import subprocess
import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
+
+print(" Starting subtest " + os.path.basename(__file__))
+
# Package brave found under one path
-sys.path.insert(0, 'path1')
+sys.path.insert(0, "path1")
from brave import robin
+print(" Finished from brave import robin")
+
+if not(robin.run() == "AWAY!"):
+ raise RuntimeError("test failed")
-assert(robin.run() == "AWAY!")
+commandline = sys.executable + " -m brave.robin"
+run_except_on_windows(commandline, env = {"PYTHONPATH": "path1"})
diff --git a/Examples/python/import_packages/namespace_pkg/nstest.py b/Examples/python/import_packages/namespace_pkg/nstest.py
index 9b075ad8c..4d618a6ad 100644
--- a/Examples/python/import_packages/namespace_pkg/nstest.py
+++ b/Examples/python/import_packages/namespace_pkg/nstest.py
@@ -1,11 +1,17 @@
import sys
import os
import shutil
+import subprocess
import zipfile
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
def copyMods():
- dirs = ['path1', 'path2', 'path3']
+ dirs = ["path1", "path2", "path3"]
# Clean out any old package paths
for d in dirs:
@@ -14,20 +20,20 @@ def copyMods():
for d in dirs:
os.mkdir(d)
- os.mkdir(os.path.join(d, 'brave'))
+ os.mkdir(os.path.join(d, "brave"))
- shutil.copy('robin.py', os.path.join('path1', 'brave'))
- os.system('cp _robin.* ' + os.path.join('path1', 'brave'))
+ shutil.copy("robin.py", os.path.join("path1", "brave"))
+ subprocess.check_call("cp _robin.* " + os.path.join("path1", "brave"), shell=True)
- shutil.copy('robin.py', os.path.join('path2', 'brave'))
- os.system('cp _robin.* ' + os.path.join('path3', 'brave'))
+ shutil.copy("robin.py", os.path.join("path2", "brave"))
+ subprocess.check_call("cp _robin.* " + os.path.join("path3", "brave"), shell=True)
mkzip()
def mkzip():
zf = zipfile.ZipFile("path4.zip", "w")
- zf.writestr("brave/", b'')
- zf.write('robin.py', 'brave/robin.py')
+ zf.writestr("brave/", b"")
+ zf.write("robin.py", "brave/robin.py")
zf.close()
@@ -35,10 +41,10 @@ def main():
copyMods()
# Run each test with a separate interpreter
- os.system(sys.executable + " nonpkg.py")
- os.system(sys.executable + " normal.py")
- os.system(sys.executable + " split.py")
- os.system(sys.executable + " zipsplit.py")
+ run_except_on_windows(sys.executable + " nonpkg.py")
+ run_except_on_windows(sys.executable + " normal.py")
+ run_except_on_windows(sys.executable + " split.py")
+ run_except_on_windows(sys.executable + " zipsplit.py")
if __name__ == "__main__":
diff --git a/Examples/python/import_packages/namespace_pkg/runme.py b/Examples/python/import_packages/namespace_pkg/runme.py
index 9c22d36fb..d2af05619 100644
--- a/Examples/python/import_packages/namespace_pkg/runme.py
+++ b/Examples/python/import_packages/namespace_pkg/runme.py
@@ -1,7 +1,8 @@
# These examples rely on namespace packages. Don't
# run them for old python interpreters.
-import sys
import os.path
+import subprocess
+import sys
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - namespace packages"
diff --git a/Examples/python/import_packages/namespace_pkg/split.py b/Examples/python/import_packages/namespace_pkg/split.py
index 1b66c2d49..9d786dc07 100644
--- a/Examples/python/import_packages/namespace_pkg/split.py
+++ b/Examples/python/import_packages/namespace_pkg/split.py
@@ -1,9 +1,25 @@
+import os
+import subprocess
import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
+
+print(" Starting subtest " + os.path.basename(__file__))
+
# Package brave split into two paths.
# path2/brave/robin.py and path3/brave/_robin.so
-sys.path.insert(0, 'path2')
-sys.path.insert(0, 'path3')
+sys.path.insert(0, "path2")
+sys.path.insert(0, "path3")
from brave import robin
+print(" Finished from brave import robin")
+
+if not(robin.run() == "AWAY!"):
+ raise RuntimeError("test failed")
-assert(robin.run() == "AWAY!")
+commandline = sys.executable + " -m brave.robin"
+run_except_on_windows(commandline , env = {"PYTHONPATH": "path2:path3"})
diff --git a/Examples/python/import_packages/namespace_pkg/zipsplit.py b/Examples/python/import_packages/namespace_pkg/zipsplit.py
index 9e35559e3..30434f9c0 100644
--- a/Examples/python/import_packages/namespace_pkg/zipsplit.py
+++ b/Examples/python/import_packages/namespace_pkg/zipsplit.py
@@ -1,9 +1,25 @@
+import os
+import subprocess
import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
+
+print(" Starting subtest " + os.path.basename(__file__))
+
# Package brave split into two paths.
# brave/robin.py (in path4.zip) and path3/brave/_robin.so
-sys.path.insert(0, 'path4.zip')
-sys.path.insert(0, 'path3')
+sys.path.insert(0, "path4.zip")
+sys.path.insert(0, "path3")
from brave import robin
+print(" Finished from brave import robin")
+
+if not(robin.run() == "AWAY!"):
+ raise RuntimeError("test failed")
-assert(robin.run() == "AWAY!")
+commandline = sys.executable + " -m brave.robin"
+run_except_on_windows(commandline, env = {"PYTHONPATH": "path3:path4.zip"})
diff --git a/Examples/python/import_packages/relativeimport1/runme.py b/Examples/python/import_packages/relativeimport1/runme.py
index 997476b1d..87101ea46 100644
--- a/Examples/python/import_packages/relativeimport1/runme.py
+++ b/Examples/python/import_packages/relativeimport1/runme.py
@@ -1,13 +1,32 @@
-import sys
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) with -relativeimport"
+if sys.version_info < (2, 5):
+ print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ sys.exit(0)
+
if sys.version_info < (3, 0):
import py2.pkg2.bar
print " Finished importing py2.pkg2.bar"
+ commandline = sys.executable + " -m py2.pkg2.bar"
+ run_except_on_windows(commandline)
+ commandline = sys.executable + " -m py2.pkg2.pkg3.foo"
+ run_except_on_windows(commandline)
else:
import py3.pkg2.bar
print " Finished importing py3.pkg2.bar"
+ commandline = sys.executable + " -m py3.pkg2.bar"
+ run_except_on_windows(commandline)
+ commandline = sys.executable + " -m py3.pkg2.pkg3.foo"
+ run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/relativeimport2/runme.py b/Examples/python/import_packages/relativeimport2/runme.py
index 9789afc18..f5b55782f 100644
--- a/Examples/python/import_packages/relativeimport2/runme.py
+++ b/Examples/python/import_packages/relativeimport2/runme.py
@@ -1,13 +1,32 @@
-import sys
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+if sys.version_info < (2, 5):
+ print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ sys.exit(0)
+
if sys.version_info < (3, 0):
import py2.pkg2.bar
print " Finished importing py2.pkg2.bar"
+ commandline = sys.executable + " -m py2.pkg2.bar"
+ run_except_on_windows(commandline)
+ commandline = sys.executable + " -m py2.pkg2.pkg3.pkg4.foo"
+ run_except_on_windows(commandline)
else:
import py3.pkg2.bar
print " Finished importing py3.pkg2.bar"
+ commandline = sys.executable + " -m py3.pkg2.bar"
+ run_except_on_windows(commandline)
+ commandline = sys.executable + " -m py3.pkg2.pkg3.pkg4.foo"
+ run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/relativeimport3/runme.py b/Examples/python/import_packages/relativeimport3/runme.py
index 997476b1d..87101ea46 100644
--- a/Examples/python/import_packages/relativeimport3/runme.py
+++ b/Examples/python/import_packages/relativeimport3/runme.py
@@ -1,13 +1,32 @@
-import sys
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) with -relativeimport"
+if sys.version_info < (2, 5):
+ print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ sys.exit(0)
+
if sys.version_info < (3, 0):
import py2.pkg2.bar
print " Finished importing py2.pkg2.bar"
+ commandline = sys.executable + " -m py2.pkg2.bar"
+ run_except_on_windows(commandline)
+ commandline = sys.executable + " -m py2.pkg2.pkg3.foo"
+ run_except_on_windows(commandline)
else:
import py3.pkg2.bar
print " Finished importing py3.pkg2.bar"
+ commandline = sys.executable + " -m py3.pkg2.bar"
+ run_except_on_windows(commandline)
+ commandline = sys.executable + " -m py3.pkg2.pkg3.foo"
+ run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py
index 3c3c00c1a..a64551bfd 100644
--- a/Examples/python/import_packages/same_modnames1/runme.py
+++ b/Examples/python/import_packages/same_modnames1/runme.py
@@ -1,4 +1,12 @@
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
# Test import of same modules from different packages
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
@@ -10,10 +18,9 @@ print " Finished importing pkg2.foo"
var2 = pkg2.foo.Pkg2_Foo()
classname = str(type(var2))
-# Check for an old-style class if swig was run in -classic mode
-if classname == "<type 'instance'>":
- classname = str(var2.__class__)
-
if classname.find("pkg2.foo.Pkg2_Foo") == -1:
raise RuntimeError("failed type checking: " + classname)
print " Successfully created object pkg2.foo.Pkg2_Foo"
+
+commandline = sys.executable + " -m pkg2.foo"
+run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/same_modnames2/runme.py b/Examples/python/import_packages/same_modnames2/runme.py
index 38daad0a3..c2cf2744c 100644
--- a/Examples/python/import_packages/same_modnames2/runme.py
+++ b/Examples/python/import_packages/same_modnames2/runme.py
@@ -1,4 +1,12 @@
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
@@ -9,10 +17,9 @@ print " Finished importing pkg1.pkg2.foo"
var2 = pkg1.pkg2.foo.Pkg2_Foo()
classname = str(type(var2))
-# Check for an old-style class if swig was run in -classic mode
-if classname == "<type 'instance'>":
- classname = str(var2.__class__)
-
if classname.find("pkg1.pkg2.foo.Pkg2_Foo") == -1:
raise RuntimeError("failed type checking: " + classname)
print " Successfully created object pkg1.pkg2.foo.Pkg2_Foo"
+
+commandline = sys.executable + " -m pkg1.pkg2.foo"
+run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/split_modules/Makefile b/Examples/python/import_packages/split_modules/Makefile
index 65d635bb7..9eaaabd32 100644
--- a/Examples/python/import_packages/split_modules/Makefile
+++ b/Examples/python/import_packages/split_modules/Makefile
@@ -6,21 +6,21 @@ subdirs = vanilla vanilla_split
check: build
for s in $(subdirs); do \
- (cd $$s && $(MAKE) check); \
+ (cd $$s && $(MAKE) check) || exit 1; \
done
build:
for s in $(subdirs); do \
- (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build); \
+ (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build) || exit 1; \
done
static:
for s in $(subdirs); do \
- (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static); \
+ (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static) || exit 1; \
done
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
for s in $(subdirs); do \
- (cd $$s && $(MAKE) clean); \
+ (cd $$s && $(MAKE) clean) || exit 1; \
done
diff --git a/Examples/python/import_packages/split_modules/README b/Examples/python/import_packages/split_modules/README
index 0cb543e8a..d2ca15e7a 100644
--- a/Examples/python/import_packages/split_modules/README
+++ b/Examples/python/import_packages/split_modules/README
@@ -2,6 +2,9 @@
between two packages. Specifically the pure python part is part of a package
and the C/C++ part is not in any package at all. Historically SWIG has
supported this sort of thing.
+From SWIG 4.0.0 onwards, split modules are not supported by default.
+The %module directive needs to be customised with the moduleimport attribute
+in order to import the a global C/C++ module.
vanilla # "plane Jane" module both halves in pkg1
vanilla_split # python 1/2 in pkg1 C 1/2 in global namespace
diff --git a/Examples/python/import_packages/split_modules/vanilla/runme.py b/Examples/python/import_packages/split_modules/vanilla/runme.py
index a188364f1..79d79b4c3 100644
--- a/Examples/python/import_packages/split_modules/vanilla/runme.py
+++ b/Examples/python/import_packages/split_modules/vanilla/runme.py
@@ -1,4 +1,12 @@
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - split modules"
@@ -7,4 +15,8 @@ import pkg1.foo
print " Finished importing pkg1.foo"
-assert(pkg1.foo.count() == 3)
+if not(pkg1.foo.count() == 3):
+ raise RuntimeError("test failed")
+
+commandline = sys.executable + " -m pkg1.foo"
+run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/split_modules/vanilla_split/Makefile b/Examples/python/import_packages/split_modules/vanilla_split/Makefile
index c322b5aec..5d1c3521c 100644
--- a/Examples/python/import_packages/split_modules/vanilla_split/Makefile
+++ b/Examples/python/import_packages/split_modules/vanilla_split/Makefile
@@ -19,4 +19,6 @@ static:
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
- cd pkg1 && $(MAKE) -f $(TOP)/../Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
+ if test -d pkg1; then \
+ cd pkg1 && $(MAKE) -f $(TOP)/../Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean; \
+ fi
diff --git a/Examples/python/import_packages/split_modules/vanilla_split/foo.i b/Examples/python/import_packages/split_modules/vanilla_split/foo.i
index 60ce16ec3..81ad43a5b 100644
--- a/Examples/python/import_packages/split_modules/vanilla_split/foo.i
+++ b/Examples/python/import_packages/split_modules/vanilla_split/foo.i
@@ -1,4 +1,9 @@
-%module(package="pkg1") foo
+#if defined(SWIGPYTHON_BUILTIN) /* defined when using -builtin */
+%module(package="pkg1", moduleimport="from $module import *") foo
+#else
+%module(package="pkg1", moduleimport="import $module") foo
+#endif
+
%{
static unsigned count(void)
{
diff --git a/Examples/python/import_packages/split_modules/vanilla_split/runme.py b/Examples/python/import_packages/split_modules/vanilla_split/runme.py
index a188364f1..79d79b4c3 100644
--- a/Examples/python/import_packages/split_modules/vanilla_split/runme.py
+++ b/Examples/python/import_packages/split_modules/vanilla_split/runme.py
@@ -1,4 +1,12 @@
import os.path
+import subprocess
+import sys
+
+def run_except_on_windows(commandline, env=None):
+ if os.name != "nt" and sys.platform != "cygwin":
+ # Strange failures on windows/cygin/mingw
+ subprocess.check_call(commandline, env=env, shell=True)
+ print(" Finished running: " + commandline)
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - split modules"
@@ -7,4 +15,8 @@ import pkg1.foo
print " Finished importing pkg1.foo"
-assert(pkg1.foo.count() == 3)
+if not(pkg1.foo.count() == 3):
+ raise RuntimeError("test failed")
+
+commandline = sys.executable + " -m pkg1.foo"
+run_except_on_windows(commandline)
diff --git a/Examples/python/java/Example.java b/Examples/python/java/Example.java
deleted file mode 100644
index 91ddb1ac5..000000000
--- a/Examples/python/java/Example.java
+++ /dev/null
@@ -1,29 +0,0 @@
-public class Example {
- public int mPublicInt;
-
- public Example() {
- mPublicInt = 0;
- }
-
- public Example(int IntVal) {
- mPublicInt = IntVal;
- }
-
-
- public int Add(int a, int b) {
- return (a+b);
- }
-
- public float Add(float a, float b) {
- return (a+b);
- }
-
- public String Add(String a, String b) {
- return (a+b);
- }
-
- public Example Add(Example a, Example b) {
- return new Example(a.mPublicInt + b.mPublicInt);
- }
-}
-
diff --git a/Examples/python/java/Makefile b/Examples/python/java/Makefile
deleted file mode 100644
index 7c75e6b91..000000000
--- a/Examples/python/java/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS =
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
-
-build: Example.class Example.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- CXXSHARED="gcj -fpic -shared Example.class" DEFS='' LIBS="-lstdc++" python_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
- rm -f $(TARGET).py
- rm -f *.class Example.h
-
-Example.class Example.h: $(SRCDIR)Example.java
- gcj -d . -fPIC -C -c -g $(SRCDIR)Example.java
- gcjh Example.class
diff --git a/Examples/python/java/example.i b/Examples/python/java/example.i
deleted file mode 100644
index 80e08870f..000000000
--- a/Examples/python/java/example.i
+++ /dev/null
@@ -1,13 +0,0 @@
-%module example
-%include <cni.i>
-
-%{
-#include "Example.h"
-%}
-
-
-%include Example.h
-
-%extend Example {
- ~Example() {}
-}
diff --git a/Examples/python/java/runme.py b/Examples/python/java/runme.py
deleted file mode 100644
index 641ba27dd..000000000
--- a/Examples/python/java/runme.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from example import *
-
-JvCreateJavaVM(None)
-JvAttachCurrentThread(None, None)
-
-e1 = Example(1)
-e2 = Example(2)
-
-print e1.Add(1, 2)
-print e1.Add(1.0, 2.0)
-e3 = e1.Add(e1, e2)
-print e3.mPublicInt
-
-print e1.Add("1", "2")
-
-JvDetachCurrentThread()
diff --git a/Examples/python/multimap/example.i b/Examples/python/multimap/example.i
index 66c0f74c6..3ff5d52c0 100644
--- a/Examples/python/multimap/example.i
+++ b/Examples/python/multimap/example.i
@@ -39,7 +39,11 @@ extern int gcd(int x, int y);
%#if PY_VERSION_HEX >= 0x03000000
{
PyObject *utf8str = PyUnicode_AsUTF8String(s);
- const char *cstr = PyBytes_AsString(utf8str);
+ const char *cstr;
+ if (!utf8str) {
+ SWIG_fail;
+ }
+ cstr = PyBytes_AsString(utf8str);
$2[i] = strdup(cstr);
Py_DECREF(utf8str);
}
@@ -72,6 +76,9 @@ extern int gcdmain(int argc, char *argv[]);
SWIG_fail;
}
utf8str = PyUnicode_AsUTF8String($input);
+ if (!utf8str) {
+ SWIG_fail;
+ }
PyBytes_AsStringAndSize(utf8str, &cstr, &len);
$1 = strncpy((char *)malloc(len+1), cstr, (size_t)len);
$2 = (int)len;
@@ -105,6 +112,9 @@ extern int count(char *bytes, int len, char c);
char *cstr;
Py_ssize_t len;
PyObject *utf8str = PyUnicode_AsUTF8String($input);
+ if (!utf8str) {
+ SWIG_fail;
+ }
PyBytes_AsStringAndSize(utf8str, &cstr, &len);
$1 = strncpy((char *)malloc(len+1), cstr, (size_t)len);
$2 = (int)len;
diff --git a/Examples/python/operator/example.i b/Examples/python/operator/example.i
index e37e76b3e..1e4b7ce34 100644
--- a/Examples/python/operator/example.i
+++ b/Examples/python/operator/example.i
@@ -17,6 +17,7 @@
%include "example.h"
/* An output method that turns a complex into a short string */
+%feature("python:slot", "tp_str", functype="reprfunc") Complex::__str__; // For -builtin option to use __str__ in the tp_str slot
%extend Complex {
char *__str__() {
static char temp[512];
diff --git a/Examples/python/performance/constructor/runme.py b/Examples/python/performance/constructor/runme.py
index 1771fba7b..b00cd456c 100644
--- a/Examples/python/performance/constructor/runme.py
+++ b/Examples/python/performance/constructor/runme.py
@@ -1,5 +1,5 @@
import sys
-sys.path.append('..')
+sys.path.append("..")
import harness
diff --git a/Examples/python/performance/func/runme.py b/Examples/python/performance/func/runme.py
index 760a8ab6d..3b142791c 100644
--- a/Examples/python/performance/func/runme.py
+++ b/Examples/python/performance/func/runme.py
@@ -1,5 +1,5 @@
import sys
-sys.path.append('..')
+sys.path.append("..")
import harness
diff --git a/Examples/python/performance/harness.py b/Examples/python/performance/harness.py
index c3d38b4fb..3468faaad 100644
--- a/Examples/python/performance/harness.py
+++ b/Examples/python/performance/harness.py
@@ -17,16 +17,16 @@ def run(proc):
except IndexError:
proc = Popen(
- [sys.executable, 'runme.py', 'Simple_baseline'], stdout=PIPE)
+ [sys.executable, "runme.py", "Simple_baseline"], stdout=PIPE)
(stdout, stderr) = proc.communicate()
print stdout
proc = Popen(
- [sys.executable, 'runme.py', 'Simple_optimized'], stdout=PIPE)
+ [sys.executable, "runme.py", "Simple_optimized"], stdout=PIPE)
(stdout, stderr) = proc.communicate()
print stdout
proc = Popen(
- [sys.executable, 'runme.py', 'Simple_builtin'], stdout=PIPE)
+ [sys.executable, "runme.py", "Simple_builtin"], stdout=PIPE)
(stdout, stderr) = proc.communicate()
print stdout
diff --git a/Examples/python/performance/hierarchy/runme.py b/Examples/python/performance/hierarchy/runme.py
index 8255cdc86..389958284 100644
--- a/Examples/python/performance/hierarchy/runme.py
+++ b/Examples/python/performance/hierarchy/runme.py
@@ -1,5 +1,5 @@
import sys
-sys.path.append('..')
+sys.path.append("..")
import harness
diff --git a/Examples/python/performance/hierarchy_operator/runme.py b/Examples/python/performance/hierarchy_operator/runme.py
index eabfae864..48241d48b 100644
--- a/Examples/python/performance/hierarchy_operator/runme.py
+++ b/Examples/python/performance/hierarchy_operator/runme.py
@@ -1,5 +1,5 @@
import sys
-sys.path.append('..')
+sys.path.append("..")
import harness
diff --git a/Examples/python/performance/operator/runme.py b/Examples/python/performance/operator/runme.py
index d75ae404c..798dd8bf9 100644
--- a/Examples/python/performance/operator/runme.py
+++ b/Examples/python/performance/operator/runme.py
@@ -1,5 +1,5 @@
import sys
-sys.path.append('..')
+sys.path.append("..")
import harness
diff --git a/Examples/python/std_vector/example.h b/Examples/python/std_vector/example.h
index 4f0dac70d..52e260d6d 100644
--- a/Examples/python/std_vector/example.h
+++ b/Examples/python/std_vector/example.h
@@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
}
void halve_in_place(std::vector<double>& v) {
- // would you believe this is the same as the above?
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
diff --git a/Examples/python/variables/runme.py b/Examples/python/variables/runme.py
index 3388a0eba..4d34e92dd 100644
--- a/Examples/python/variables/runme.py
+++ b/Examples/python/variables/runme.py
@@ -48,18 +48,18 @@ example.print_vars()
print "\nNow I'm going to try and modify some read only variables"
-print " Tring to set 'path'"
+print " Trying to set 'path'"
try:
example.cvar.path = "Whoa!"
print "Hey, what's going on?!?! This shouldn't work"
-except:
+except Exception:
print "Good."
print " Trying to set 'status'"
try:
example.cvar.status = 0
print "Hey, what's going on?!?! This shouldn't work"
-except:
+except Exception:
print "Good."
diff --git a/Examples/ruby/check.list b/Examples/ruby/check.list
index 2e581fb82..bdc2736ad 100644
--- a/Examples/ruby/check.list
+++ b/Examples/ruby/check.list
@@ -9,7 +9,6 @@ functor
hashargs
import
import_template
-java
mark_function
multimap
operator
diff --git a/Examples/ruby/exception_class/Makefile b/Examples/ruby/exceptproxy/Makefile
index 2d4518e11..2d4518e11 100644
--- a/Examples/ruby/exception_class/Makefile
+++ b/Examples/ruby/exceptproxy/Makefile
diff --git a/Examples/ruby/exception_class/example.h b/Examples/ruby/exceptproxy/example.h
index 9facde4bd..3ee6d765d 100644
--- a/Examples/ruby/exception_class/example.h
+++ b/Examples/ruby/exceptproxy/example.h
@@ -23,7 +23,7 @@ template<typename T> class Queue {
~Queue() {
delete [] items;
}
- void enqueue(T x) throw(FullError) {
+ void enqueue(T x) {
if (nitems == maxsize) {
throw FullError(maxsize);
}
@@ -43,9 +43,3 @@ template<typename T> class Queue {
}
};
-
-
-
-
-
-
diff --git a/Examples/ruby/exception_class/example.i b/Examples/ruby/exceptproxy/example.i
index 5094b7a60..ad0c23acb 100644
--- a/Examples/ruby/exception_class/example.i
+++ b/Examples/ruby/exceptproxy/example.i
@@ -14,9 +14,10 @@
%}
-/* The EmpytError doesn't appear in a throw declaration, and hence
+/* The EmptyError doesn't appear in a throw declaration, and hence
we need to tell SWIG that the dequeue method throws it. This can
now be done via the %catchs feature. */
+%catches(FullError) *::enqueue;
%catches(EmptyError) *::dequeue();
diff --git a/Examples/ruby/exception_class/runme.rb b/Examples/ruby/exceptproxy/runme.rb
index c198c1406..c198c1406 100644
--- a/Examples/ruby/exception_class/runme.rb
+++ b/Examples/ruby/exceptproxy/runme.rb
diff --git a/Examples/ruby/free_function/runme.rb b/Examples/ruby/free_function/runme.rb
index a517ed454..cf405d4cc 100644
--- a/Examples/ruby/free_function/runme.rb
+++ b/Examples/ruby/free_function/runme.rb
@@ -39,7 +39,11 @@ GC.start
# C++ object
ok = false
begin
- puts tiger2.get_name
+ # Let's stress the GC a bit, a single pass might not be enough.
+ 10.times {
+ GC.start
+ puts tiger2.get_name
+ }
rescue ObjectPreviouslyDeleted => error
ok = true
end
diff --git a/Examples/ruby/hashargs/example.i b/Examples/ruby/hashargs/example.i
index 10e209e5f..4c3f3070b 100644
--- a/Examples/ruby/hashargs/example.i
+++ b/Examples/ruby/hashargs/example.i
@@ -2,13 +2,13 @@
%typemap(in) (int nattributes, const char **names, const int *values) (VALUE keys_ary, int i, VALUE key, VALUE val) {
Check_Type($input, T_HASH);
- $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+ $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
$2 = NULL;
$3 = NULL;
if ($1 > 0) {
$2 = (char **) malloc($1*sizeof(char *));
$3 = (int *) malloc($1*sizeof(int));
- keys_ary = rb_funcall($input, rb_intern("keys"), 0, NULL);
+ keys_ary = rb_funcall($input, rb_intern("keys"), 0, Qnil);
for (i = 0; i < $1; i++) {
key = rb_ary_entry(keys_ary, i);
val = rb_hash_aref($input, key);
diff --git a/Examples/ruby/java/Example.java b/Examples/ruby/java/Example.java
deleted file mode 100644
index 91ddb1ac5..000000000
--- a/Examples/ruby/java/Example.java
+++ /dev/null
@@ -1,29 +0,0 @@
-public class Example {
- public int mPublicInt;
-
- public Example() {
- mPublicInt = 0;
- }
-
- public Example(int IntVal) {
- mPublicInt = IntVal;
- }
-
-
- public int Add(int a, int b) {
- return (a+b);
- }
-
- public float Add(float a, float b) {
- return (a+b);
- }
-
- public String Add(String a, String b) {
- return (a+b);
- }
-
- public Example Add(Example a, Example b) {
- return new Example(a.mPublicInt + b.mPublicInt);
- }
-}
-
diff --git a/Examples/ruby/java/Makefile b/Examples/ruby/java/Makefile
deleted file mode 100644
index bec5e1844..000000000
--- a/Examples/ruby/java/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS =
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
-
-build: Example.class Example.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- CXXSHARED="gcj -fpic -shared Example.class" LIBS="-lstdc++" DEFS='' ruby_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean
- rm -f *.class Example.h
-
-Example.class Example.h: $(SRCDIR)Example.java
- gcj -d . -fPIC -C -c -g $(SRCDIR)Example.java
- gcjh Example.class
diff --git a/Examples/ruby/java/example.i b/Examples/ruby/java/example.i
deleted file mode 100644
index 13d5b5e70..000000000
--- a/Examples/ruby/java/example.i
+++ /dev/null
@@ -1,9 +0,0 @@
-%module example
-%include <cni.i>
-
-%{
-#include "Example.h"
-%}
-
-
-%include Example.h
diff --git a/Examples/ruby/java/runme.rb b/Examples/ruby/java/runme.rb
deleted file mode 100644
index fc018b70c..000000000
--- a/Examples/ruby/java/runme.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'example'
-
-Example.JvCreateJavaVM(nil)
-Example.JvAttachCurrentThread(nil, nil)
-
-e1 = Example::Example.new(1)
-e2 = Example::Example.new(2)
-
-print e1.Add(1,2),"\n"
-print e1.Add(1.0,2.0),"\n"
-e3 = e1.Add(e1,e2)
-print e3.mPublicInt,"\n"
-
-
-print e1.Add("1","2"),"\n"
-
-Example.JvDetachCurrentThread()
-
diff --git a/Examples/ruby/std_vector/example.h b/Examples/ruby/std_vector/example.h
index 4f0dac70d..52e260d6d 100644
--- a/Examples/ruby/std_vector/example.h
+++ b/Examples/ruby/std_vector/example.h
@@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
}
void halve_in_place(std::vector<double>& v) {
- // would you believe this is the same as the above?
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
diff --git a/Examples/ruby/variables/runme.rb b/Examples/ruby/variables/runme.rb
index 38531c833..b748384ce 100644
--- a/Examples/ruby/variables/runme.rb
+++ b/Examples/ruby/variables/runme.rb
@@ -48,7 +48,7 @@ Example.print_vars()
puts "\nNow I'm going to try and modify some read only variables";
-puts " Tring to set 'path'";
+puts " Trying to set 'path'";
begin
Example.path = "Whoa!"
puts "Hey, what's going on?!?! This shouldn't work"
diff --git a/Examples/scilab/std_list/runme.sci b/Examples/scilab/std_list/runme.sci
index e4c04b029..6075d7ac7 100644
--- a/Examples/scilab/std_list/runme.sci
+++ b/Examples/scilab/std_list/runme.sci
@@ -7,7 +7,7 @@ if ierr <> 0 then
end
example_Init();
-// This example shows how to use C++ fonctions with STL lists arguments
+// This example shows how to use C++ functions with STL lists arguments
// Here, STL lists are converted from/to Scilab matrices (SWIG_SCILAB_EXTRA_NATIVE_CONTAINERS is not defined)
// integer lists
diff --git a/Examples/scilab/std_vector/example.h b/Examples/scilab/std_vector/example.h
index 4f0dac70d..52e260d6d 100644
--- a/Examples/scilab/std_vector/example.h
+++ b/Examples/scilab/std_vector/example.h
@@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
}
void halve_in_place(std::vector<double>& v) {
- // would you believe this is the same as the above?
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
diff --git a/Examples/scilab/variables/runme.sci b/Examples/scilab/variables/runme.sci
index 98d76cfa0..1ef077467 100644
--- a/Examples/scilab/variables/runme.sci
+++ b/Examples/scilab/variables/runme.sci
@@ -49,7 +49,7 @@ print_vars()
// Immutable variables
printf("\nNow I''m going to try and modify some read only variables\n");
-printf(" Tring to set ''path''\n");
+printf(" Trying to set ''path''\n");
try
path_set("Whoa!");
printf("Hey, what''s going on?!?! This shouldn''t work\n");
diff --git a/Examples/tcl/check.list b/Examples/tcl/check.list
index 8e7a8a9d7..31d26261b 100644
--- a/Examples/tcl/check.list
+++ b/Examples/tcl/check.list
@@ -5,7 +5,6 @@ contract
enum
funcptr
import
-java
multimap
operator
pointer
diff --git a/Examples/tcl/java/Example.java b/Examples/tcl/java/Example.java
deleted file mode 100644
index 91ddb1ac5..000000000
--- a/Examples/tcl/java/Example.java
+++ /dev/null
@@ -1,29 +0,0 @@
-public class Example {
- public int mPublicInt;
-
- public Example() {
- mPublicInt = 0;
- }
-
- public Example(int IntVal) {
- mPublicInt = IntVal;
- }
-
-
- public int Add(int a, int b) {
- return (a+b);
- }
-
- public float Add(float a, float b) {
- return (a+b);
- }
-
- public String Add(String a, String b) {
- return (a+b);
- }
-
- public Example Add(Example a, Example b) {
- return new Example(a.mPublicInt + b.mPublicInt);
- }
-}
-
diff --git a/Examples/tcl/java/Makefile b/Examples/tcl/java/Makefile
deleted file mode 100644
index e4dfc536b..000000000
--- a/Examples/tcl/java/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS =
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
-
-build: Example.class Example.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
- TCLCXXSHARED="gcj -fpic -shared Example.class " LIBS="-lstdc++" DEFS='' tcl_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean
- rm -f *.class Example.h
-
-Example.class Example.h: $(SRCDIR)Example.java
- gcj -d . -fPIC -C -c -g $(SRCDIR)Example.java
- gcjh Example.class
diff --git a/Examples/tcl/java/example.i b/Examples/tcl/java/example.i
deleted file mode 100644
index b69d83f8d..000000000
--- a/Examples/tcl/java/example.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module example
-%include <cni.i>
-
-%{
-#include "Example.h"
-%}
-
-%include Example.h
diff --git a/Examples/tcl/java/runme.tcl b/Examples/tcl/java/runme.tcl
deleted file mode 100644
index 6caf0079f..000000000
--- a/Examples/tcl/java/runme.tcl
+++ /dev/null
@@ -1,15 +0,0 @@
-catch { load ./example[info sharedlibextension] example}
-
-JvCreateJavaVM NULL
-JvAttachCurrentThread NULL NULL
-Example e1 1
-Example e2 2
-
-puts "[e1 cget -mPublicInt]"
-puts "[e2 cget -mPublicInt]"
-
-puts "[e2 Add 1 2]"
-puts "[e2 Add 1.0 2.0]"
-puts "[e2 Add '1' '2']"
-
-JvDetachCurrentThread
diff --git a/Examples/tcl/std_vector/example.h b/Examples/tcl/std_vector/example.h
index 4f0dac70d..52e260d6d 100644
--- a/Examples/tcl/std_vector/example.h
+++ b/Examples/tcl/std_vector/example.h
@@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
}
void halve_in_place(std::vector<double>& v) {
- // would you believe this is the same as the above?
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
diff --git a/Examples/tcl/variables/runme.tcl b/Examples/tcl/variables/runme.tcl
index b9e2fd418..71aec38b8 100644
--- a/Examples/tcl/variables/runme.tcl
+++ b/Examples/tcl/variables/runme.tcl
@@ -48,7 +48,7 @@ print_vars
puts "\nNow I'm going to try and modify some read only variables";
-puts " Tring to set 'path'";
+puts " Trying to set 'path'";
if { [catch {
set path "Whoa!"
puts "Hey, what's going on?!?! This shouldn't work"
diff --git a/Examples/test-suite/README b/Examples/test-suite/README
index aac7636c6..3b7cea477 100644
--- a/Examples/test-suite/README
+++ b/Examples/test-suite/README
@@ -47,6 +47,6 @@ testdir/README file.
Further Documentation
---------------------
-There is documentation about the test-suite and how to use use it in
+There is documentation about the test-suite and how to use it in
the SWIG documentation - Doc/Manual/Extending.html#Extending_test_suite.
diff --git a/Examples/test-suite/allprotected.i b/Examples/test-suite/allprotected.i
index 086cfb245..e9b4eb341 100644
--- a/Examples/test-suite/allprotected.i
+++ b/Examples/test-suite/allprotected.i
@@ -79,5 +79,9 @@ protected:
};
int ProtectedBase::staticMemberVariable = 10;
+class ProtectedDerived : public ProtectedBase {
+public:
+ ProtectedDerived(const char *s) : ProtectedBase(s) {}
+};
%}
diff --git a/Examples/test-suite/autodoc.i b/Examples/test-suite/autodoc.i
index a2d9f5b4e..9f4365ee1 100644
--- a/Examples/test-suite/autodoc.i
+++ b/Examples/test-suite/autodoc.i
@@ -1,5 +1,7 @@
%module(docstring="hello.") autodoc
+%warnfilter(SWIGWARN_PARSE_KEYWORD) inout;
+
%feature("autodoc");
// special typemap and its docs
@@ -74,6 +76,10 @@
%feature("autodoc","1") D::D(int a, int b, Hola h); // names + types
%feature("autodoc","2") E::E(int a, int b, Hola h); // extended
%feature("autodoc","3") F::F(int a, int b, Hola h); // extended + types
+%feature("autodoc","0") C::~C(); // names
+%feature("autodoc","1") D::~D(); // names + types
+%feature("autodoc","2") E::~E(); // extended
+%feature("autodoc","3") F::~F(); // extended + types
%inline {
@@ -133,6 +139,14 @@ typedef int Integer;
void banana(S *a, const struct tagS *b, int c, Integer d) {}
%}
+// Check docs for a template type
+%inline %{
+template<typename X> struct T {
+ T inout(T t) { return t; }
+};
+%}
+%template(TInteger) T<int>;
+
%inline %{
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
@@ -140,4 +154,32 @@ bool is_python_builtin() { return true; }
bool is_python_builtin() { return false; }
#endif
%}
-
+
+// Autodoc language keywords
+%feature(autodoc,1) process;
+%feature(autodoc,1) process2;
+%feature("compactdefaultargs") process;
+%feature("compactdefaultargs") process2;
+%inline %{
+int process(int from, int in, int var) { return from; }
+int process2(int from = 0, int _in = 1, int var = 2) { return from; }
+%}
+
+%feature(autodoc,1) process3;
+%feature(autodoc,1) process4;
+%feature("kwargs") process3;
+%feature("kwargs") process4;
+%inline %{
+int process3(int from, int _in, int var) { return from; }
+int process4(int from = 0, int _in = 1, int var = 2) { return from; }
+%}
+
+// Autodoc for methods with default arguments not directly representable in
+// target language.
+%feature(autodoc,0) process_complex_defval;
+%feature("compactdefaultargs") process_complex_defval;
+%inline %{
+const int PROCESS_DEFAULT_VALUE = 17;
+typedef long int some_type;
+int process_complex_defval(int val = PROCESS_DEFAULT_VALUE, int factor = some_type(-1)) { return val*factor; }
+%}
diff --git a/Examples/test-suite/catches.i b/Examples/test-suite/catches.i
index 8f09ae24c..89cf43f8d 100644
--- a/Examples/test-suite/catches.i
+++ b/Examples/test-suite/catches.i
@@ -1,9 +1,9 @@
%module catches
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW3(T1, T2, T3) throw(T1, T2, T3)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW3(T1, T2, T3)
%}
%include <exception.i> // for throws(...) typemap
@@ -23,7 +23,7 @@ void test_catches(int i) {
throw ThreeException();
}
}
-void test_exception_specification(int i) throw(int, const char *, const ThreeException&) {
+void test_exception_specification(int i) TESTCASE_THROW3(int, const char *, const ThreeException&) {
test_catches(i);
}
void test_catches_all(int i) {
diff --git a/Examples/test-suite/class_scope_namespace.i b/Examples/test-suite/class_scope_namespace.i
new file mode 100644
index 000000000..47d918157
--- /dev/null
+++ b/Examples/test-suite/class_scope_namespace.i
@@ -0,0 +1,160 @@
+// Test a mix of forward class declarations, class definitions, using declarations and using directives.
+
+%module class_scope_namespace
+
+%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) H::HH;
+%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Space8::I_::II;
+
+%inline %{
+struct A;
+namespace Space1 {
+ namespace SubSpace1 {
+ struct A {
+ void aa(Space1::SubSpace1::A, SubSpace1::A, A) {}
+ };
+ void aaa(Space1::SubSpace1::A, SubSpace1::A, A) {}
+ }
+}
+
+namespace Space2 {
+ struct B;
+}
+using Space2::B;
+#ifdef __clang__
+namespace Space2 {
+ struct B {
+ void bb(Space2::B, B) {}
+ };
+}
+#else
+struct B {
+ void bb(Space2::B, B) {}
+};
+#endif
+void bbb(Space2::B, B) {}
+
+namespace Space3 {
+ namespace SubSpace3 {
+ struct C;
+ struct D;
+ }
+}
+struct C;
+struct D;
+namespace Space3 {
+ struct C;
+ struct SubSpace3::C {
+ void cc(Space3::SubSpace3::C, SubSpace3::C) {}
+ };
+ using SubSpace3::D;
+ struct SubSpace3::D {
+ void dd(Space3::SubSpace3::D, SubSpace3::D, D) {}
+ };
+ void ccc(Space3::SubSpace3::C, SubSpace3::C) {}
+ void ddd(Space3::SubSpace3::D, SubSpace3::D, D) {}
+}
+
+namespace Space4 {
+ namespace SubSpace4 {
+ struct E;
+ }
+}
+using namespace Space4;
+using SubSpace4::E;
+// Was added to incorrect namespace in swig-3.0.12
+struct SubSpace4::E {
+ void ee(Space4::SubSpace4::E, SubSpace4::E, E) {}
+};
+void eee(Space4::SubSpace4::E, SubSpace4::E, E) {}
+
+namespace Space5 {
+ namespace SubSpace5 {
+ namespace SubSubSpace5 {
+ struct F;
+ }
+ }
+}
+namespace Space5 {
+ using namespace SubSpace5;
+ using SubSubSpace5::F;
+ // Was added to incorrect namespace in swig-3.0.12
+ struct SubSubSpace5::F {
+ void ff(Space5::SubSpace5::SubSubSpace5::F, SubSpace5::SubSubSpace5::F, SubSubSpace5::F, F) {}
+ };
+ void fff(Space5::SubSpace5::SubSubSpace5::F, SubSpace5::SubSubSpace5::F, SubSubSpace5::F, F) {}
+}
+
+namespace Space6 {
+ struct G;
+ namespace SubSpace6 {
+ struct G;
+ }
+}
+namespace Space6 {
+ struct SubSpace6::G {
+ void gg(Space6::SubSpace6::G, SubSpace6::G) {}
+ };
+ void ggg(Space6::SubSpace6::G, SubSpace6::G) {}
+}
+
+struct HH;
+struct H {
+ struct HH {
+ void hh(H::HH) {}
+ };
+};
+void hhh(H::HH) {}
+
+namespace Space8 {
+ struct II;
+ struct I_ {
+ struct II {
+ void ii(Space8::I_::II, I_::II) {}
+ };
+ };
+ void iii(Space8::I_::II, I_::II) {}
+}
+
+struct J;
+namespace Space9 {
+ namespace SubSpace9 {
+ struct J {
+ void jj(Space9::SubSpace9::J, SubSpace9::J, J) {}
+ };
+ void jjj(Space9::SubSpace9::J, SubSpace9::J, J) {}
+ }
+}
+
+namespace Space10 {
+ struct K;
+}
+namespace Space10 {
+ namespace SubSpace10 {
+ struct K {
+ void kk(Space10::SubSpace10::K, SubSpace10::K, K) {}
+ };
+ void kkk(Space10::SubSpace10::K, SubSpace10::K, K) {}
+ }
+}
+
+namespace OtherSpace {
+ struct L;
+ struct M;
+}
+using OtherSpace::L;
+namespace Space11 {
+ using OtherSpace::M;
+ namespace SubSpace11 {
+ struct L {
+ void ll(Space11::SubSpace11::L, SubSpace11::L, L) {}
+ };
+ void lll(Space11::SubSpace11::L, SubSpace11::L, L) {}
+ struct M {
+ void mm(Space11::SubSpace11::M, SubSpace11::M, M) {}
+ };
+ void mmm(Space11::SubSpace11::M, SubSpace11::M, M) {}
+ }
+}
+
+%}
+
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 8d97b4bf9..5f7792810 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -83,13 +83,11 @@ Makefile: $(srcdir)/Makefile.in ../../../config.status
# Broken C++ test cases. (Can be run individually using: make testcase.cpptest)
CPP_TEST_BROKEN += \
constants \
- cpp_broken \
director_nested_class \
exception_partial_info \
extend_variable \
li_boost_shared_ptr_template \
nested_private \
- overload_complicated \
rename_camel \
template_default_pointer \
template_private_assignment \
@@ -99,7 +97,7 @@ CPP_TEST_BROKEN += \
# Broken C test cases. (Can be run individually using: make testcase.ctest)
C_TEST_BROKEN += \
- tag_no_clash_with_variable
+ tag_no_clash_with_variable \
# C++ test cases. (Can be run individually using: make testcase.cpptest)
CPP_TEST_CASES += \
@@ -136,6 +134,7 @@ CPP_TEST_CASES += \
char_binary \
char_strings \
chartest \
+ class_scope_namespace \
class_forward \
class_ignore \
class_scope_weird \
@@ -162,13 +161,20 @@ CPP_TEST_CASES += \
cpp_nodefault \
cpp_static \
cpp_typedef \
+ cpp14_binary_integer_literals \
+ cpp17_hex_floating_literals \
+ cpp17_nested_namespaces \
+ cpp17_nspace_nested_namespaces \
+ cpp17_u8_char_literals \
curiously_recurring_template_pattern \
default_args \
+ default_arg_expressions \
default_arg_values \
default_constructor \
defvalue_constructor \
derived_byvalue \
derived_nested \
+ destructor_methodmodifiers \
destructor_reprotected \
director_abstract \
director_alternating \
@@ -181,6 +187,8 @@ CPP_TEST_CASES += \
director_detect \
director_enum \
director_exception \
+ director_exception_catches \
+ director_exception_nothrow \
director_extend \
director_finalizer \
director_frob \
@@ -192,6 +200,7 @@ CPP_TEST_CASES += \
director_nspace_director_name_collision \
director_overload \
director_overload2 \
+ director_ownership \
director_pass_by_value \
director_primitives \
director_property \
@@ -239,6 +248,7 @@ CPP_TEST_CASES += \
friends \
friends_template \
funcptr_cpp \
+ functors \
fvirtual \
global_namespace \
global_ns_arg \
@@ -246,6 +256,7 @@ CPP_TEST_CASES += \
global_vars \
grouping \
ignore_parameter \
+ import_fragments \
import_nomodule \
inherit \
inherit_member \
@@ -262,9 +273,10 @@ CPP_TEST_CASES += \
li_attribute \
li_attribute_template \
li_boost_shared_ptr \
+ li_boost_shared_ptr_attribute \
li_boost_shared_ptr_bits \
+ li_boost_shared_ptr_director \
li_boost_shared_ptr_template \
- li_boost_shared_ptr_attribute \
li_carrays_cpp \
li_cdata_cpp \
li_cpointer_cpp \
@@ -278,6 +290,7 @@ CPP_TEST_CASES += \
memberin_extend \
member_funcptr_galore \
member_pointer \
+ member_pointer_const \
member_template \
minherit \
minherit2 \
@@ -289,6 +302,7 @@ CPP_TEST_CASES += \
multiple_inheritance_shared_ptr \
name_cxx \
name_warnings \
+ namespace_chase \
namespace_class \
namespace_enum \
namespace_extend \
@@ -302,6 +316,7 @@ CPP_TEST_CASES += \
namespace_virtual_method \
nspace \
nspace_extend \
+ native_directive \
naturalvar \
naturalvar_more \
naturalvar_onoff \
@@ -309,10 +324,13 @@ CPP_TEST_CASES += \
nested_directors \
nested_comment \
nested_ignore \
+ nested_inheritance_interface \
+ nested_in_template \
nested_scope \
nested_template_base \
nested_workaround \
newobject1 \
+ newobject3 \
null_pointer \
operator_overload \
operator_overload_break \
@@ -321,10 +339,12 @@ CPP_TEST_CASES += \
ordering \
overload_arrays \
overload_bool \
+ overload_complicated \
overload_copy \
overload_extend \
overload_method \
overload_numeric \
+ overload_null \
overload_polymorphic \
overload_rename \
overload_return_type \
@@ -343,7 +363,6 @@ CPP_TEST_CASES += \
redefined_not \
refcount \
reference_global_vars \
- register_par \
rename1 \
rename2 \
rename3 \
@@ -389,6 +408,7 @@ CPP_TEST_CASES += \
static_array_member \
static_const_member \
static_const_member_2 \
+ stl_no_default_constructor \
string_constants \
struct_initialization_cpp \
struct_value \
@@ -401,6 +421,7 @@ CPP_TEST_CASES += \
template_basic \
template_base_template \
template_classes \
+ template_class_reuse_name \
template_const_ref \
template_construct \
template_templated_constructors \
@@ -416,6 +437,7 @@ CPP_TEST_CASES += \
template_default_inherit \
template_default_qualify \
template_default_vw \
+ template_empty_inherit \
template_enum \
template_enum_ns_inherit \
template_enum_typedef \
@@ -432,6 +454,7 @@ CPP_TEST_CASES += \
template_methods \
template_namespace_forward_declaration \
template_using_directive_and_declaration_forward \
+ template_using_directive_typedef \
template_nested \
template_nested_typemaps \
template_ns \
@@ -442,6 +465,7 @@ CPP_TEST_CASES += \
template_ns_enum2 \
template_ns_inherit \
template_ns_scope \
+ template_parameters_global_scope \
template_partial_arg \
template_partial_specialization \
template_partial_specialization_typedef \
@@ -479,6 +503,7 @@ CPP_TEST_CASES += \
throw_exception \
typedef_array_member \
typedef_class \
+ typedef_classforward_same_name \
typedef_funcptr \
typedef_inherit \
typedef_mptr \
@@ -499,6 +524,8 @@ CPP_TEST_CASES += \
typemap_numinputs \
typemap_template \
typemap_template_parm_typedef \
+ typemap_template_parms \
+ typemap_template_typedef \
typemap_out_optimal \
typemap_qualifier_strip \
typemap_variables \
@@ -527,14 +554,16 @@ CPP_TEST_CASES += \
varargs_overload \
variable_replacement \
virtual_destructor \
+ virtual_derivation \
virtual_poly \
virtual_vs_nonvirtual_base \
voidtest \
wallkw \
- wrapmacro
+ wrapmacro \
# C++11 test cases.
-CPP11_TEST_CASES = \
+CPP11_TEST_CASES += \
+ cpp11_alias_nested_template_scoping \
cpp11_alignment \
cpp11_alternate_function_syntax \
cpp11_constexpr \
@@ -542,23 +571,28 @@ CPP11_TEST_CASES = \
cpp11_default_delete \
cpp11_delegating_constructors \
cpp11_director_enums \
+ cpp11_directors \
cpp11_explicit_conversion_operators \
+ cpp11_final_directors \
cpp11_final_override \
cpp11_function_objects \
cpp11_inheriting_constructors \
cpp11_initializer_list \
cpp11_initializer_list_extend \
cpp11_lambda_functions \
- cpp11_li_std_array \
cpp11_noexcept \
cpp11_null_pointer_constant \
cpp11_raw_string_literals \
+ cpp11_ref_qualifiers \
+ cpp11_ref_qualifiers_rvalue_unignore \
+ cpp11_ref_qualifiers_typemaps \
cpp11_result_of \
cpp11_rvalue_reference \
cpp11_rvalue_reference2 \
cpp11_rvalue_reference3 \
cpp11_sizeof_object \
cpp11_static_assert \
+ cpp11_std_array \
cpp11_strongly_typed_enumerations \
cpp11_thread_local \
cpp11_template_double_brackets \
@@ -572,10 +606,35 @@ CPP11_TEST_CASES = \
# Broken C++11 test cases.
CPP11_TEST_BROKEN = \
-# cpp11_hash_tables \ # not fully implemented yet
# cpp11_variadic_templates \ # Broken for some languages (such as Java)
# cpp11_reference_wrapper \ # No typemaps
+# Doxygen support test cases: can only be used with languages supporting
+# Doxygen comment translation, currently only Python and Java.
+python_HAS_DOXYGEN := 1
+java_HAS_DOXYGEN := 1
+
+$(eval HAS_DOXYGEN := $($(LANGUAGE)_HAS_DOXYGEN))
+
+ifdef HAS_DOXYGEN
+DOXYGEN_TEST_CASES += \
+ doxygen_alias \
+ doxygen_basic_notranslate \
+ doxygen_basic_translate \
+ doxygen_basic_translate_style2 \
+ doxygen_ignore \
+ doxygen_misc_constructs \
+ doxygen_nested_class \
+ doxygen_parsing \
+ doxygen_parsing_enums \
+ doxygen_translate \
+ doxygen_translate_all_tags \
+ doxygen_translate_links \
+
+$(DOXYGEN_TEST_CASES:=.cpptest): SWIGOPT += -doxygen
+
+CPP_TEST_CASES += $(DOXYGEN_TEST_CASES)
+endif
#
# Put all the heavy STD/STL cases here, where they can be skipped if needed
@@ -584,6 +643,7 @@ CPP_STD_TEST_CASES += \
director_string \
ignore_template_constructor \
li_std_combinations \
+ li_std_containers_overload \
li_std_deque \
li_std_except \
li_std_except_as_class \
@@ -592,15 +652,15 @@ CPP_STD_TEST_CASES += \
li_std_pair_using \
li_std_string \
li_std_vector \
+ li_std_vector_back_reference \
li_std_vector_enum \
li_std_vector_member_var\
li_std_vector_ptr \
+ li_std_wstring \
smart_pointer_inherit \
template_typedef_fnc \
template_type_namespace \
- template_opaque
-# li_std_list
-
+ template_opaque \
ifndef SKIP_CPP_STD_CASES
CPP_TEST_CASES += ${CPP_STD_TEST_CASES}
@@ -619,6 +679,7 @@ C_TEST_CASES += \
char_constant \
const_const \
constant_expr \
+ default_args_c \
empty_c \
enums \
enum_forward \
@@ -652,8 +713,10 @@ C_TEST_CASES += \
preproc \
preproc_constants_c \
preproc_defined \
+ preproc_gcc_output \
preproc_include \
preproc_line_file \
+ register_par \
ret_by_value \
simple_array \
sizeof_pointer \
@@ -661,21 +724,22 @@ C_TEST_CASES += \
string_simple \
struct_rename \
struct_initialization \
+ typedef_classforward_same_name \
typedef_struct \
typemap_subst \
union_parameter \
- unions
+ unions \
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest)
MULTI_CPP_TEST_CASES += \
clientdata_prop \
- imports \
import_stl \
- packageoption \
+ imports \
mod \
+ multi_import \
+ packageoption \
template_typedef_import \
- multi_import
# Custom tests - tests with additional commandline options
wallkw.cpptest: SWIGOPT += -Wallkw
@@ -724,6 +788,10 @@ check-cpp: $(CPP_TEST_CASES:=.cpptest)
check-cpp11: $(CPP11_TEST_CASES:=.cpptest)
+ifdef HAS_DOXYGEN
+check-doxygen: $(DOXYGEN_TEST_CASES:=.cpptest)
+endif
+
check-failing-test = \
$(MAKE) -s $1.$2 >/dev/null 2>/dev/null && echo "Failing test $1 passed."
@@ -764,7 +832,7 @@ swig_and_compile_external = \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$*_wrap_hdr.h' \
- $(LANGUAGE)$(VARIANT)_externalhdr; \
+ $(LANGUAGE)$(VARIANT)_externalhdr && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS) $*_external.cxx' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
@@ -778,7 +846,7 @@ setup = \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
- fi;
+ fi
diff --git a/Examples/test-suite/complextest.i b/Examples/test-suite/complextest.i
index 64c751a82..592512b45 100644
--- a/Examples/test-suite/complextest.i
+++ b/Examples/test-suite/complextest.i
@@ -14,26 +14,53 @@
%template(VectorStdCplx) std::vector<std::complex<double> >;
#endif
-%inline
+%inline
{
- std::complex<double> Conj(const std::complex<double>& a)
+ std::complex<double> Conj(std::complex<double> a)
{
return std::conj(a);
- }
+ }
- std::complex<float> Conjf(const std::complex<float>& a)
+ std::complex<float> Conjf(std::complex<float> a)
{
return std::conj(a);
- }
+ }
-#if 1
- std::vector<std::complex<double> > Copy_h(const std::vector<std::complex<double> >& a)
+ std::vector<std::complex<double> > CopyHalf(std::vector<std::complex<double> > a)
{
std::vector<std::complex<double> > b(a.size()/2);
std::copy(a.begin(), a.begin()+a.size()/2, b.begin());
return b;
- }
-#endif
+ }
+
+ using namespace std;
+
+ struct ComplexPair
+ {
+ std::complex<double> z1;
+ complex<double> z2;
+ };
+
+ const complex<double>& Conj2(const complex<double>& a)
+ {
+ static complex<double> ret;
+ ret = std::conj(a);
+ return ret;
+ }
+
+ const complex<float>& Conjf2(const complex<float>& a)
+ {
+ static complex<float> ret;
+ ret = std::conj(a);
+ return ret;
+ }
+
+ const vector<complex<double> >& CopyHalfRef(const vector<complex<double> >& a)
+ {
+ static vector<complex<double> > b;
+ b = CopyHalf(a);
+ return b;
+ }
}
@@ -43,7 +70,7 @@
%{
%}
-%inline
+%inline
{
complex Conj(complex a)
{
diff --git a/Examples/test-suite/constant_directive.i b/Examples/test-suite/constant_directive.i
index 89f13cecc..3e4775df1 100644
--- a/Examples/test-suite/constant_directive.i
+++ b/Examples/test-suite/constant_directive.i
@@ -2,6 +2,10 @@
// %constant and struct
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%inline %{
#if defined(_MSC_VER)
#pragma warning(disable : 4190) // warning C4190: 'result' has C-linkage specified, but returns UDT 'Type1' which is incompatible with C
@@ -10,6 +14,11 @@ struct Type1 {
Type1(int val = 0) : val(val) {}
int val;
};
+enum EnumType
+{
+ EnumValue
+};
+EnumType enumValue = EnumValue;
/* Typedefs for const Type and its pointer */
typedef const Type1 Type1Const;
typedef const Type1* Type1Cptr;
@@ -42,3 +51,4 @@ Type1 getType1Instance() { return Type1(111); }
%constant Type1Cfptr TYPE1CFPTR1DEF_CONSTANT1 = getType1Instance;
/* Regular constant */
%constant int TYPE_INT = 0;
+%constant enum EnumType newValue = enumValue;
diff --git a/Examples/test-suite/constructor_copy.i b/Examples/test-suite/constructor_copy.i
index 7dcd05e8b..222c12f32 100644
--- a/Examples/test-suite/constructor_copy.i
+++ b/Examples/test-suite/constructor_copy.i
@@ -73,12 +73,18 @@ public:
%include "std_vector.i"
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT) || defined(SWIGSCILAB)
+#if defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT) || defined(SWIGSCILAB)
#define SWIG_GOOD_VECTOR
%ignore std::vector<Space::Flow>::vector(size_type);
%ignore std::vector<Space::Flow>::resize(size_type);
#endif
+#if defined(SWIGJAVA)
+#define SWIG_GOOD_VECTOR
+%ignore std::vector<Space::Flow>::vector(jint);
+%ignore std::vector<Space::Flow>::resize(jint);
+#endif
+
#if defined(SWIGTCL) || defined(SWIGPERL)
#define SWIG_GOOD_VECTOR
/* here, for languages with bad declaration */
diff --git a/Examples/test-suite/cplusplus_throw.i b/Examples/test-suite/cplusplus_throw.i
index 3b11c48ca..72ae62938 100644
--- a/Examples/test-suite/cplusplus_throw.i
+++ b/Examples/test-suite/cplusplus_throw.i
@@ -5,10 +5,10 @@
%module cplusplus_throw
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW1(T1)
%}
%nodefaultctor;
@@ -20,8 +20,8 @@ class Foo { };
class Bar {
public:
void baz() const { };
- void foo() throw (Foo) { };
- void bazfoo() const throw (int) { };
+ void foo() TESTCASE_THROW1(Foo) { };
+ void bazfoo() const TESTCASE_THROW1(int) { };
};
%}
diff --git a/Examples/test-suite/cpp11_alias_nested_template_scoping.i b/Examples/test-suite/cpp11_alias_nested_template_scoping.i
new file mode 100644
index 000000000..72814aa88
--- /dev/null
+++ b/Examples/test-suite/cpp11_alias_nested_template_scoping.i
@@ -0,0 +1,45 @@
+%module cpp11_alias_nested_template_scoping
+
+// Test to check a template parameter type is expanded when the template parameter
+// is used twice in a type name. Expansion was
+// Y< short >::YYY< T >::value_type >
+// instead of
+// Y< short >::YYY< short >::value_type >
+
+#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
+%feature("flatnested") ZZZ;
+#endif
+
+%inline %{
+template<typename T> struct Y {
+ typedef T value_type;
+ typedef Y YY;
+ template<typename T2> using YYY = Y<T2>;
+ template<typename T2> struct ZZZ {
+ typedef T2 another_type;
+ };
+ value_type create1() const { return T(); }
+ typename Y::value_type create2() const { return T(); }
+ typename Y<T>::value_type create3() const { return T(); }
+ typename YY::value_type create4() const { return T(); }
+ typename Y<T>::YY::value_type create5() const { return T(); }
+ Y<T>::YYY<T>::value_type create6() const { return T(); }
+ typename Y<T>::template ZZZ<T>::another_type create7() const { return T(); }
+
+ // With global scope prefix
+ typename ::Y<T>::value_type create13() const { return T(); }
+
+ typename ::Y<T>::YY::value_type create15() const { return T(); }
+ ::Y<T>::YYY<T>::value_type create16() const { return T(); }
+ typename ::Y<T>::template ZZZ<T>::another_type create17() const { return T(); }
+};
+%}
+
+%extend Y {
+%template() YYY<short>;
+%template() ZZZ<short>;
+};
+// Use above workaround instead of below (which currently gives syntax error)
+// %template() Y<short>::YYY<short>;
+
+%template(Yshort) Y<short>;
diff --git a/Examples/test-suite/cpp11_alignment.i b/Examples/test-suite/cpp11_alignment.i
index fb25c4ebb..135f63641 100644
--- a/Examples/test-suite/cpp11_alignment.i
+++ b/Examples/test-suite/cpp11_alignment.i
@@ -4,7 +4,8 @@
struct A {
int member;
};
-const int align1 = alignof(A::member);
+const int align1 = alignof(int);
+const int align2 = alignof(int *);
%}
%{
diff --git a/Examples/test-suite/cpp11_alternate_function_syntax.i b/Examples/test-suite/cpp11_alternate_function_syntax.i
index 227a1c8c8..b3ecabc8c 100644
--- a/Examples/test-suite/cpp11_alternate_function_syntax.i
+++ b/Examples/test-suite/cpp11_alternate_function_syntax.i
@@ -6,13 +6,26 @@
struct SomeStruct {
int addNormal(int x, int y);
auto addAlternate(int x, int y) -> int;
+ auto addAlternateConst(int x, int y) const -> int;
+ auto addAlternateNoExcept(int x, int y) noexcept -> int;
+ auto addAlternateConstNoExcept(int x, int y) const noexcept -> int;
+ auto addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int)) -> int;
+ auto addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int;
+
+ virtual auto addFinal(int x, int y) const noexcept -> int final { return x + y; }
+ virtual ~SomeStruct() = default;
};
-auto SomeStruct::addAlternate(int x, int y) -> int {
- return x + y;
+int SomeStruct::addNormal(int x, int y) { return x + y; }
+auto SomeStruct::addAlternate(int x, int y) -> int { return x + y; }
+auto SomeStruct::addAlternateConst(int x, int y) const -> int { return x + y; }
+auto SomeStruct::addAlternateNoExcept(int x, int y) noexcept -> int { return x + y; }
+auto SomeStruct::addAlternateConstNoExcept(int x, int y) const noexcept -> int { return x + y; }
+auto SomeStruct::addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int)) -> int {
+ return 100*x + (this->*mp)(x, x);
}
-
-int SomeStruct::addNormal(int x, int y) {
- return x + y;
+auto SomeStruct::addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int {
+ return 1000*x + (this->*mp)(x, x);
}
+
%}
diff --git a/Examples/test-suite/cpp11_constexpr.i b/Examples/test-suite/cpp11_constexpr.i
index d91107cc6..420db4f83 100644
--- a/Examples/test-suite/cpp11_constexpr.i
+++ b/Examples/test-suite/cpp11_constexpr.i
@@ -3,11 +3,26 @@
*/
%module cpp11_constexpr
+
+%{
+#if defined(__clang__)
+#pragma clang diagnostic push
+// Suppress: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior
+// For MMM() and NNN()
+#pragma clang diagnostic ignored "-Wconstexpr-not-const"
+#endif
+%}
+
%inline %{
+#ifdef SWIG
+#define SWIGTESTCONST const
+#else
+#define SWIGTESTCONST
+#endif
constexpr int AAA = 10;
constexpr const int BBB = 20;
constexpr int CCC() { return 30; }
-constexpr const int DDD() { return 40; }
+constexpr SWIGTESTCONST int DDD() { return 40; }
constexpr int XXX() { return 10; }
constexpr int YYY = XXX() + 100;
@@ -17,7 +32,7 @@ struct ConstExpressions {
static constexpr int KKK = 200;
static const int LLL = 300;
constexpr int MMM() { return 400; }
- constexpr const int NNN() { return 500; }
+ constexpr SWIGTESTCONST int NNN() { return 500; }
// Regression tests for support added in SWIG 3.0.4:
static constexpr const int JJJ1 = 101;
constexpr static int KKK1 = 201;
diff --git a/Examples/test-suite/cpp11_default_delete.i b/Examples/test-suite/cpp11_default_delete.i
index 79c02cddc..0c20fb7ee 100644
--- a/Examples/test-suite/cpp11_default_delete.i
+++ b/Examples/test-suite/cpp11_default_delete.i
@@ -17,20 +17,26 @@ public:
};
struct A1 {
- void func(int i) {}
+ void funk(int i) {}
A1() = default;
~A1() = default;
- void func(double i) = delete; /* Don't cast double to int. Compiler returns an error */
+ void funk(double i) = delete; /* Don't cast double to int. Compiler returns an error */
private:
A1(const A1&);
};
A1::A1(const A1&) = default;
struct A2 {
- void func(int i) {}
+ void funk(int i) {}
+
+// Workaround clang 10.0.1 -std=c++17 linker error (oddly for Java and not Python):
+// Undefined symbols for architecture x86_64:"___cxa_deleted_virtual", referenced from: vtable for A2
+#if !(defined(__clang__) && __cplusplus >= 201703L)
virtual void fff(int) = delete;
+#endif
+
virtual ~A2() = default;
- template<class T> void func(T) = delete;
+ template<class T> void funk(T) = delete;
};
struct trivial {
diff --git a/Examples/test-suite/cpp11_directors.i b/Examples/test-suite/cpp11_directors.i
new file mode 100644
index 000000000..3d1fbea25
--- /dev/null
+++ b/Examples/test-suite/cpp11_directors.i
@@ -0,0 +1,16 @@
+%module(directors="1") cpp11_directors
+%feature("director");
+
+%inline %{
+
+class Foo {
+ public:
+ virtual ~Foo() noexcept {}
+ virtual int ping() noexcept = 0;
+ virtual int pong() noexcept = 0;
+ virtual int pang() const& noexcept = 0;
+ virtual int peng() & noexcept = 0;
+ virtual int pung() & = 0;
+};
+
+%}
diff --git a/Examples/test-suite/cpp11_final_directors.i b/Examples/test-suite/cpp11_final_directors.i
new file mode 100644
index 000000000..b58111adb
--- /dev/null
+++ b/Examples/test-suite/cpp11_final_directors.i
@@ -0,0 +1,33 @@
+%module(directors="1") cpp11_final_directors
+
+%director Derived;
+
+// Check SWIG will not wrap these classes as directors where the destructors are final
+%director BaseFinalDestructor;
+%director BaseFinalDestructor2;
+
+%warnfilter(SWIGWARN_LANG_DIRECTOR_FINAL) BaseFinalDestructor::~BaseFinalDestructor;
+%warnfilter(SWIGWARN_LANG_DIRECTOR_FINAL) BaseFinalDestructor2::~BaseFinalDestructor2;
+
+%inline %{
+struct Base {
+ virtual void basemeth() final {}
+ virtual ~Base() {}
+};
+
+struct Derived : Base {
+ virtual int derivedmeth() final { return 1; }
+ virtual int meth() { return 2; }
+ virtual ~Derived() {}
+};
+
+struct BaseFinalDestructor {
+ virtual void basefinalmeth() final {}
+ virtual ~BaseFinalDestructor() final {}
+};
+
+struct BaseFinalDestructor2 {
+ virtual void basefinalmeth() {}
+ virtual ~BaseFinalDestructor2() final {}
+};
+%}
diff --git a/Examples/test-suite/cpp11_final_override.i b/Examples/test-suite/cpp11_final_override.i
index f691f8770..8d275b322 100644
--- a/Examples/test-suite/cpp11_final_override.i
+++ b/Examples/test-suite/cpp11_final_override.i
@@ -6,6 +6,12 @@
%warnfilter(SWIGWARN_PARSE_KEYWORD) final; // 'final' is a java keyword, renaming to '_final'
%warnfilter(SWIGWARN_PARSE_KEYWORD) override; // 'override' is a C# keyword, renaming to '_override'
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+%{
+#define TESTCASE_THROW1(T1)
+%}
+
%inline %{
struct Base {
@@ -16,6 +22,8 @@ struct Base {
virtual void finaloverride2() {}
virtual void finaloverride3() {}
virtual void finaloverride4() const {}
+ virtual void finaloverride5() {}
+ virtual void finaloverride6() const {}
virtual ~Base() {}
};
@@ -31,6 +39,8 @@ struct Derived /*final*/ : Base {
virtual void finaloverride2() override final {}
virtual void finaloverride3() noexcept override final {}
virtual void finaloverride4() const noexcept override final {}
+ virtual void finaloverride5() TESTCASE_THROW1(int) override final {}
+ virtual void finaloverride6() const TESTCASE_THROW1(int) override final {}
virtual ~Derived() override final {}
};
void Derived::override2() const noexcept {}
@@ -78,6 +88,7 @@ struct Destructors4 : Base {
struct FinalOverrideMethods {
virtual void final() {}
virtual void override(int) {}
+ virtual ~FinalOverrideMethods() = default;
};
struct FinalOverrideVariables {
int final;
@@ -126,3 +137,4 @@ void DerivedNoVirtualStruct::cd() {}
void DerivedNoVirtualStruct::ef() {}
DerivedNoVirtualStruct::~DerivedNoVirtualStruct() {}
%}
+
diff --git a/Examples/test-suite/cpp11_hash_tables.i b/Examples/test-suite/cpp11_hash_tables.i
index 4f68cbac5..0c671aa5d 100644
--- a/Examples/test-suite/cpp11_hash_tables.i
+++ b/Examples/test-suite/cpp11_hash_tables.i
@@ -4,19 +4,27 @@
%inline %{
#include <set>
-//#include <map>
+#include <map>
#include <unordered_set>
-//#include <unordered_map>
+#include <unordered_map>
%}
%include "std_set.i"
-//%include "std_map.i"
+%include "std_multiset.i"
+%include "std_map.i"
+%include "std_multimap.i"
%include "std_unordered_set.i"
-//%include "std_unordered_map.i"
+%include "std_unordered_multiset.i"
+%include "std_unordered_map.i"
+%include "std_unordered_multimap.i"
%template (SetInt) std::set<int>;
-//%template (MapIntInt) std::map<int, int>;
+%template (MultiSetInt) std::multiset<int>;
+%template (MapIntInt) std::map<int, int>;
+%template (MultiMapIntInt) std::multimap<int, int>;
%template (UnorderedSetInt) std::unordered_set<int>;
-//%template (UnorderedMapIntInt) std::unordered_map<int, int>;
+%template (UnorderedMultiSetInt) std::unordered_multiset<int>;
+%template (UnorderedMapIntInt) std::unordered_map<int, int>;
+%template (UnorderedMultiMapIntInt) std::unordered_multimap<int, int>;
%inline %{
using namespace std;
@@ -25,19 +33,19 @@ class MyClass {
public:
set<int> getSet() { return _set; }
void addSet(int elt) { _set.insert(_set.begin(), elt); }
-// map<int, int> getMap() { return _map; }
-// void addMap(int elt1, int elt2) { _map.insert(make_pair(elt1, elt2)); }
+ map<int, int> getMap() { return _map; }
+ void addMap(int elt1, int elt2) { _map.insert(make_pair(elt1, elt2)); }
unordered_set<int> getUnorderedSet() { return _unordered_set; }
void addUnorderedSet(int elt) { _unordered_set.insert(_unordered_set.begin(), elt); }
-// unordered_map<int, int> getUnorderedMap() { return _unordered_map; }
-// void addUnorderedMap(int elt1, int elt2) { _unordered_map.insert(make_pair(elt1, elt2)); }
+ unordered_map<int, int> getUnorderedMap() { return _unordered_map; }
+ void addUnorderedMap(int elt1, int elt2) { _unordered_map.insert(make_pair(elt1, elt2)); }
private:
set<int> _set;
-// map<int, int> _map;
+ map<int, int> _map;
unordered_set<int> _unordered_set;
-// unordered_map<int, int> _unordered_map;
+ unordered_map<int, int> _unordered_map;
};
%}
diff --git a/Examples/test-suite/cpp11_initializer_list.i b/Examples/test-suite/cpp11_initializer_list.i
index 58d2ecc50..b309576c1 100644
--- a/Examples/test-suite/cpp11_initializer_list.i
+++ b/Examples/test-suite/cpp11_initializer_list.i
@@ -6,12 +6,21 @@
%ignore A::A(std::initializer_list<int>);
%ignore B::method;
-%typemap(in) std::initializer_list<const char *> {
+%typemap(in) std::initializer_list<const char *> %{
$1 = {"Ab", "Fab"};
-}
+%}
+
+%begin %{
+#if __GNUC__ >= 9
+/* warning: ‘new’ of initializer_list does not extend the lifetime of the underlying array [-Winit-list-lifetime] */
+/* incorrect warning for C::C(std::initializer_list<const char *>) */
+#pragma GCC diagnostic ignored "-Winit-list-lifetime"
+#endif
+%}
%inline %{
#include <initializer_list>
+#include <string>
class A {
public:
@@ -26,9 +35,16 @@ public:
void method(std::initializer_list<int> init) {}
};
class C {
+ std::string joined;
public:
- C(std::initializer_list<const char *>) {}
+ C(std::initializer_list<const char *> init) {
+ for (auto& val : init)
+ joined += val;
+ }
C() {}
+ const char * get_joined_string() {
+ return joined.c_str();
+ }
};
%}
diff --git a/Examples/test-suite/cpp11_lambda_functions.i b/Examples/test-suite/cpp11_lambda_functions.i
index 161e08c65..3d7d76d60 100644
--- a/Examples/test-suite/cpp11_lambda_functions.i
+++ b/Examples/test-suite/cpp11_lambda_functions.i
@@ -26,6 +26,14 @@
%warnfilter(SWIGWARN_CPP11_LAMBDA) Space1::lambda19;
%warnfilter(SWIGWARN_CPP11_LAMBDA) Space1::Space2::lambda20;
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW0() throw()
+#define TESTCASE_THROW1(T1) throw(T1)
+%{
+#define TESTCASE_THROW0()
+#define TESTCASE_THROW1(T1)
+%}
+
%inline %{
/* Defined lambda function with return value. */
auto lambda1 = [](int x, int y) -> int { return x+y; };
@@ -35,14 +43,17 @@ auto lambda1 = [](int x, int y) -> int { return x+y; };
single statement "return expr;". */
auto lambda2 = [](int x, int y) { return x+y; };
-auto lambda3 = [&](int x, int y) { return x+y; };
-auto lambda4 = [=](int x, int y) { return x+y; };
int thing = 0;
#ifdef SWIG
-// Not strictly correct as captured variables should have non-automatic storage duration, ie shouldn't capture globals. gcc-4.7 warns about this, but we check that SWIG can parse this anyway.
+// This is not strictly legal: non-local lambda expression cannot have a capture-default
+// gcc-4.7 warns about this and gcc-9 gives an error, but we check that SWIG can parse this anyway.
+auto lambda3 = [&](int x, int y) { return x+y; };
+auto lambda4 = [=](int x, int y) { return x+y; };
auto lambda5 = [=,&thing]() { return thing; };
#else
-auto lambda5 = [=]() { return thing; };
+auto lambda3 = [](int x, int y) { return x+y; };
+auto lambda4 = [](int x, int y) { return x+y; };
+auto lambda5 = []() { return thing; };
#endif
void fn() {
@@ -51,22 +62,27 @@ void fn() {
}
auto lambda6 = [] (int a, int b) mutable { return a + b; };
auto lambda7 = [] (int x, int y) -> int { return x+y; };
-auto lambda8 = [] (int x, int y) throw() -> int { return x+y; };
-auto lambda9 = [] (int x, int y) mutable throw() -> int { return x+y; };
-auto lambda10 = [] (int x, int y) throw(int) { return x+y; };
-auto lambda11 = [] (int x, int y) mutable throw(int) { return x+y; };
+auto lambda8 = [] (int x, int y) TESTCASE_THROW0() -> int { return x+y; };
+auto lambda9 = [] (int x, int y) mutable TESTCASE_THROW0() -> int { return x+y; };
+auto lambda10 = [] (int x, int y) TESTCASE_THROW1(int) { return x+y; };
+auto lambda11 = [] (int x, int y) mutable TESTCASE_THROW1(int) { return x+y; };
auto lambda12 = [] (int a, int b) { return a + b; }(1, 2);
auto lambda13 = [] (int a, int b) mutable { return a + b; }(1, 2);
-auto lambda14 = [] () throw () {};
-auto lambda15 = [] () mutable throw () {};
+auto lambda14 = [] () TESTCASE_THROW0() {};
+auto lambda15 = [] () mutable TESTCASE_THROW0() {};
auto lambda16 = [] { return thing; };
auto lambda17 = [] { return thing; }();
-constexpr auto lambda18 = [] (int x, int y) mutable throw(int) { return x+y; };
+#if defined(SWIG) || (defined(__cplusplus) && __cplusplus >= 201703L)
+#define CONSTEXPR constexpr
+#else
+#define CONSTEXPR
+#endif
+CONSTEXPR auto lambda18 = [] (int x, int y) mutable TESTCASE_THROW1(int) { return x+y; };
namespace Space1 {
- constexpr auto lambda19 = [] (int x, int y) mutable throw(int) { return x+y; };
+ CONSTEXPR auto lambda19 = [] (int x, int y) mutable TESTCASE_THROW1(int) { return x+y; };
namespace Space2 {
- constexpr auto lambda20 = [] (int x, int y) mutable throw(int) { return x+y; };
+ CONSTEXPR auto lambda20 = [] (int x, int y) mutable TESTCASE_THROW1(int) { return x+y; };
}
}
@@ -102,6 +118,6 @@ int runLambdaInline() {
// TODO
int(*lambda101notauto)(int, int) = [] (int a, int b) { return a + b; };
int lambda102 = [] (int a, int b) mutable { return a + b; }(1, 2);
-void lambda_init(int = ([=]{ return 0; })());
+void lambda_init(int = ([]{ return 0; })());
%}
diff --git a/Examples/test-suite/cpp11_noexcept.i b/Examples/test-suite/cpp11_noexcept.i
index ef96fd8a7..8aa0baa5a 100644
--- a/Examples/test-suite/cpp11_noexcept.i
+++ b/Examples/test-suite/cpp11_noexcept.i
@@ -3,9 +3,13 @@
%ignore NoExceptClass(NoExceptClass&&);
%rename(Assignment) NoExceptClass::operator=;
+%{
+extern "C" void global_noexcept(int, bool) noexcept {}
+%}
%inline %{
extern "C" void global_noexcept(int, bool) noexcept;
+extern "C" void global_noexcept2(int, bool) noexcept {}
struct NoExceptClass {
static const bool VeryTrue = true;
@@ -14,7 +18,7 @@ struct NoExceptClass {
NoExceptClass(const NoExceptClass&) noexcept {}
NoExceptClass(NoExceptClass&&) noexcept {}
NoExceptClass& operator=(const NoExceptClass&) noexcept { return *this; }
- ~NoExceptClass() noexcept {}
+ virtual ~NoExceptClass() noexcept {}
void noex0() noexcept {}
void noex1() noexcept(sizeof(int) == 4) {}
@@ -27,8 +31,13 @@ struct NoExceptClass {
void noo1() const noexcept {}
static void noo2() noexcept {}
virtual void noo3() const noexcept {}
+
+// Workaround clang 10.0.1 -std=c++17 linker error (oddly for Java and not Python):
+// Undefined symbols for architecture x86_64: "___cxa_deleted_virtual", referenced from: vtable for NoExceptClass
+#if !(defined(__clang__) && __cplusplus >= 201703L)
virtual void noo4() const noexcept = delete;
virtual void noo5() const throw() = delete;
+#endif
};
struct NoExceptAbstract {
diff --git a/Examples/test-suite/cpp11_raw_string_literals.i b/Examples/test-suite/cpp11_raw_string_literals.i
index 6fd13a0d0..b50b768b9 100644
--- a/Examples/test-suite/cpp11_raw_string_literals.i
+++ b/Examples/test-suite/cpp11_raw_string_literals.i
@@ -17,7 +17,9 @@
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) hh;
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ii;
+#if defined(SWIGTCL) || defined(SWIGCSHARP) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGPYTHON) || defined(SWIGJAVA)
%include <std_wstring.i>
+#endif
%inline %{
#include <iostream>
@@ -45,6 +47,9 @@ wstring aa = L"Wide string";
const char *bb = u8"UTF-8 string";
const char16_t *cc = u"UTF-16 string";
const char32_t *dd = U"UTF-32 string";
+// New char literals
+char16_t char16_t_char = u'a';
+char32_t char32_t_char = U'b';
%}
/* Raw string literals */
@@ -57,3 +62,43 @@ const char16_t *hh = uR"XXX(I'm a "raw UTF-16" \ string.)XXX";
const char32_t *ii = UR"XXX(I'm a "raw UTF-32" \ string.)XXX";
%}
+// Constants
+#if defined(SWIGJAVA)
+%javaconst(1);
+#elif SWIGCSHARP
+%csconst(1);
+#elif SWIGD
+%dmanifestconst;
+#endif
+
+%inline %{
+#define jj ")I'm an \"ascii\" \\ string constant."
+#define kk R"XXX()I'm an "ascii" \ string constant.)XXX";
+%}
+
+%constant mm = R"XXX()I'm an "ascii" \ string constant with multiple
+
+lines.)XXX";
+
+// docstring feature
+%feature("docstring") RawStringDoc::WW "Single line documentation comment"
+%feature("docstring") RawStringDoc::XX %{
+Multi-line
+documentation
+comment
+%}
+%feature("docstring") RawStringDoc::YY R"RRR(Single line "raw string" documentation comment)RRR"
+%feature("docstring") RawStringDoc::ZZ R"FOO(Documentation comment
+
+as a "raw string"
+on multiple lines including a \ backslash)FOO"
+
+%inline %{
+struct RawStringDoc {
+ void WW() {}
+ void XX() {}
+ void YY() {}
+ void ZZ() {}
+};
+%}
+
diff --git a/Examples/test-suite/cpp11_ref_qualifiers.i b/Examples/test-suite/cpp11_ref_qualifiers.i
new file mode 100644
index 000000000..e37136770
--- /dev/null
+++ b/Examples/test-suite/cpp11_ref_qualifiers.i
@@ -0,0 +1,226 @@
+%module cpp11_ref_qualifiers
+
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ccextra2;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ccextra3;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc2;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc3;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc5;
+
+%include <std_string.i>
+
+%ignore Host::h() const &;
+
+// Basic testing
+%inline %{
+using std::string;
+class Host {
+ string s;
+public:
+ string h1() & { return string(); }
+ string h2() const & { return string(); }
+ string h3() && { return std::move(string()); }
+ string h4() const && { return std::move(string()); }
+ string h5() const { return string(); }
+ string h6() volatile const & { return string(); }
+ string h7() const volatile & { return string(); }
+ string h8() volatile const && { return std::move(string()); }
+ string h9() const volatile && { return std::move(string()); }
+
+ string h() & { return string(); }
+ string h() const & { return string(); }
+ string h() && { return std::move(string()); }
+ string h() const && { return std::move(string()); }
+};
+%}
+
+// %feature testing
+%feature("except") F1() & %{ result = "F1"; %}
+%feature("except") F2 %{ result = "F2"; %}
+%feature("except") F3 %{ result = "F3"; %}
+%feature("except") F3() %{ _should_not_be_used_ %}
+
+%feature("except") C1(int i) const & %{ result = "C1"; %}
+%feature("except") C2 %{ result = "C2"; %}
+%feature("except") C3 %{ result = "C3"; %}
+%feature("except") C3(int i) %{ _should_not_be_used_ %}
+
+%inline %{
+struct Features {
+ string F1() & { return string(); }
+ string F2() & { return string(); }
+ string F3() & { return string(); }
+
+ string C1(int i) const & { return string(); }
+ string C2(int i) const & { return string(); }
+ string C3(int i) const & { return string(); }
+};
+%}
+
+// %rename testing
+%rename(RR1) R1;
+%rename(RR2) R2() &;
+%rename(RR3) R3;
+%rename(RR3Bad) R3();
+
+%rename(SS1) S1;
+%rename(SS2) S2(int i) const &;
+%rename(SS3) S3;
+%rename(SS3Bad) S3(int i);
+%rename(SS3BadConst) S3(int i) const;
+%rename(SS3BadLValue) S3(int i) &;
+
+%inline %{
+struct Renames {
+ string R1() & { return string(); }
+ string R2() & { return string(); }
+ string R3() & { return string(); }
+
+ string S1(int i) const & { return string(); }
+ string S2(int i) const & { return string(); }
+ string S3(int i) const & { return string(); }
+};
+%}
+
+// Conversion operators
+%rename(StringConvertCopy) operator string() &;
+%rename(StringConvertMove) operator string() &&;
+%feature("ignore", "0") operator string() &&; // unignore as it is ignored by default
+
+%inline %{
+struct ConversionOperators {
+ virtual operator string() & { return string(); }
+ virtual operator string() && { return std::move(string()); }
+ virtual ~ConversionOperators() {}
+};
+struct ConversionOperators2 {
+ virtual operator string() && { return std::move(string()); }
+ virtual ~ConversionOperators2() {}
+};
+%}
+
+%inline %{
+struct Funcs {
+ short FF(bool) { return 0; }
+ short CC(bool) const & { return 0; }
+};
+
+class MemberFuncPtrs
+{
+public:
+ // member ref-qualified function pointers, unnamed parameters
+ int aaa1(short (Funcs::*)(bool) &) const;
+ int aaa2(short (Funcs::* const *&)(bool) &) const;
+ int aaa3(short (Funcs::* *&)(bool) &) const;
+ int aaa4(short (Funcs::* *const&)(bool) &) const;
+ int aaa5(short (Funcs::* &)(bool) &) const;
+ int aaa6(short (Funcs::* const)(bool) &) const;
+ int aaa7(short (Funcs::* const&)(bool) &) const;
+
+ int aaa8(short (Funcs::* const&)(bool) &&) const;
+
+ // member cv-qualified and ref-qualified function pointers, unnamed parameters
+ int bbb1(short (Funcs::*)(bool) const &) const;
+ int bbb2(short (Funcs::* const *&)(bool) const &) const;
+ int bbb3(short (Funcs::* *&)(bool) const &) const;
+ int bbb4(short (Funcs::* *const&)(bool) const &) const;
+ int bbb5(short (Funcs::* &)(bool) const &) const;
+ int bbb6(short (Funcs::* const)(bool) const &) const;
+ int bbb7(short (Funcs::* const&)(bool) const &) const;
+
+ int bbb8(short (Funcs::*)(bool) const &&) const;
+
+ // member ref-qualified function pointers, named parameters
+ int qqq1(short (Funcs::* qq1)(bool) &) const;
+ int qqq2(short (Funcs::* const *& qq2)(bool) &) const;
+ int qqq3(short (Funcs::* *& qq3)(bool) &) const;
+ int qqq4(short (Funcs::* *const& qq4)(bool) &) const;
+ int qqq5(short (Funcs::* & qq5)(bool) &) const;
+ int qqq6(short (Funcs::* const qq6)(bool) &) const;
+ int qqq7(short (Funcs::* const& qq7)(bool) &) const;
+
+ int qqq8(short (Funcs::* const& qq8)(bool) &&) const;
+
+ // member cv-qualified and ref-qualified function pointers, named parameters
+ int rrr1(short (Funcs::* rr1)(bool) const &) const;
+ int rrr2(short (Funcs::* const *& rr2)(bool) const &) const;
+ int rrr3(short (Funcs::* *& rr3)(bool) const &) const;
+ int rrr4(short (Funcs::* *const& rr4)(bool) const &) const;
+ int rrr5(short (Funcs::* & rr5)(bool) const &) const;
+ int rrr6(short (Funcs::* const rr6)(bool) const &) const;
+ int rrr7(short (Funcs::* const& rr7)(bool) const &) const;
+
+ int rrr8(short (Funcs::* rr1)(bool) const &&) const;
+};
+
+// member ref-qualified function pointers, unnamed parameters
+int MemberFuncPtrs::aaa1(short (Funcs::*)(bool) &) const { return 0; }
+int MemberFuncPtrs::aaa2(short (Funcs::* const *&)(bool) &) const { return 0; }
+int MemberFuncPtrs::aaa3(short (Funcs::* *&)(bool) &) const { return 0; }
+int MemberFuncPtrs::aaa4(short (Funcs::* *const&)(bool) &) const { return 0; }
+int MemberFuncPtrs::aaa5(short (Funcs::* &)(bool) &) const { return 0; }
+int MemberFuncPtrs::aaa6(short (Funcs::* const)(bool) &) const { return 0; }
+int MemberFuncPtrs::aaa7(short (Funcs::* const&)(bool) &) const { return 0; }
+
+int MemberFuncPtrs::aaa8(short (Funcs::* const&)(bool) &&) const { return 0; }
+
+// member cv-qualified and ref-qualified function pointers, unnamed parameters
+int MemberFuncPtrs::bbb1(short (Funcs::*)(bool) const &) const { return 0; }
+int MemberFuncPtrs::bbb2(short (Funcs::* const *&)(bool) const &) const { return 0; }
+int MemberFuncPtrs::bbb3(short (Funcs::* *&)(bool) const &) const { return 0; }
+int MemberFuncPtrs::bbb4(short (Funcs::* *const&)(bool) const &) const { return 0; }
+int MemberFuncPtrs::bbb5(short (Funcs::* &)(bool) const &) const { return 0; }
+int MemberFuncPtrs::bbb6(short (Funcs::* const)(bool) const &) const { return 0; }
+int MemberFuncPtrs::bbb7(short (Funcs::* const&)(bool) const &) const { return 0; }
+
+int MemberFuncPtrs::bbb8(short (Funcs::*)(bool) const &&) const { return 0; }
+
+// member ref-qualified function pointers, named parameters
+int MemberFuncPtrs::qqq1(short (Funcs::* qq1)(bool) &) const { return 0; }
+int MemberFuncPtrs::qqq2(short (Funcs::* const *& qq2)(bool) &) const { return 0; }
+int MemberFuncPtrs::qqq3(short (Funcs::* *& qq3)(bool) &) const { return 0; }
+int MemberFuncPtrs::qqq4(short (Funcs::* *const& qq4)(bool) &) const { return 0; }
+int MemberFuncPtrs::qqq5(short (Funcs::* & qq5)(bool) &) const { return 0; }
+int MemberFuncPtrs::qqq6(short (Funcs::* const qq6)(bool) &) const { return 0; }
+int MemberFuncPtrs::qqq7(short (Funcs::* const& qq7)(bool) &) const { return 0; }
+
+int MemberFuncPtrs::qqq8(short (Funcs::* const& qq8)(bool) &&) const { return 0; }
+
+// member cv-qualified and ref-qualified function pointers, named parameters
+int MemberFuncPtrs::rrr1(short (Funcs::* rr1)(bool) const &) const { return 0; }
+int MemberFuncPtrs::rrr2(short (Funcs::* const *& rr2)(bool) const &) const { return 0; }
+int MemberFuncPtrs::rrr3(short (Funcs::* *& rr3)(bool) const &) const { return 0; }
+int MemberFuncPtrs::rrr4(short (Funcs::* *const& rr4)(bool) const &) const { return 0; }
+int MemberFuncPtrs::rrr5(short (Funcs::* & rr5)(bool) const &) const { return 0; }
+int MemberFuncPtrs::rrr6(short (Funcs::* const rr6)(bool) const &) const { return 0; }
+int MemberFuncPtrs::rrr7(short (Funcs::* const& rr7)(bool) const &) const { return 0; }
+
+int MemberFuncPtrs::rrr8(short (Funcs::* rr1)(bool) const &&) const { return 0; }
+
+// member cv-qualified and ref-qualified pointer variables
+short (Funcs::* cc1)(bool) const & = &Funcs::CC;
+
+short (Funcs::* const * ccextra2)(bool) const & = &cc1;
+short (Funcs::* * ccextra3)(bool) const & = &cc1;
+short (Funcs::* *const ccextra4)(bool) const & = &cc1;
+
+short (Funcs::* const *& cc2)(bool) const & = ccextra2;
+short (Funcs::* *& cc3)(bool) const & = ccextra3;
+short (Funcs::* *const& cc4)(bool) const & = ccextra4;
+short (Funcs::* & cc5)(bool) const & = cc1;
+short (Funcs::* const cc6)(bool) const & = &Funcs::CC;
+short (Funcs::* const& cc7)(bool) const & = cc1;
+%}
+
+%inline %{
+
+struct Funktions {
+ int addByValue(const int &a, int b) const & { return a+b; }
+ int * addByPointer(const int &a, int b) const & { static int val; val = a+b; return &val; }
+ int & addByReference(const int &a, int b) const & { static int val; val = a+b; return val; }
+};
+
+int call1(int (Funktions::*d)(const int &, int) const &, int a, int b) { Funktions f; return (f.*d)(a, b); }
+//int call2(int * (Funktions::*d)(const int &, int) const &, int a, int b) { Funktions f; return *(f.*d)(a, b); }
+//int call3(int & (Funktions::*d)(const int &, int) const &, int a, int b) { Funktions f; return (f.*d)(a, b); }
+%}
+%constant int (Funktions::*ADD_BY_VALUE)(const int &, int) const & = &Funktions::addByValue;
diff --git a/Examples/test-suite/cpp11_ref_qualifiers_rvalue_unignore.i b/Examples/test-suite/cpp11_ref_qualifiers_rvalue_unignore.i
new file mode 100644
index 000000000..2f5fadfc6
--- /dev/null
+++ b/Examples/test-suite/cpp11_ref_qualifiers_rvalue_unignore.i
@@ -0,0 +1,15 @@
+%module cpp11_ref_qualifiers_rvalue_unignore
+
+// This is a minimal test that does not include any C++ headers to make sure the required
+// <memory> header is generated from a fragment for the generated std::move call
+
+// m1 and m2 are ignored by default, unignore them
+%feature("ignore", "0") RefQualifier::m1() &&;
+%feature("ignore", "0") RefQualifier::m2() const &&;
+
+%inline %{
+struct RefQualifier {
+ void m1() && {}
+ void m2() const && {}
+};
+%}
diff --git a/Examples/test-suite/cpp11_ref_qualifiers_typemaps.i b/Examples/test-suite/cpp11_ref_qualifiers_typemaps.i
new file mode 100644
index 000000000..0e1c3fe53
--- /dev/null
+++ b/Examples/test-suite/cpp11_ref_qualifiers_typemaps.i
@@ -0,0 +1,74 @@
+%module cpp11_ref_qualifiers_typemaps
+
+%typemap(in) SWIGTYPE (CLASS::*) %{
+ _this_will_fail_to_compile_if_used_
+%}
+
+// typemaps to completely ignore the input parm and override it
+%typemap(in) short (Funcs::*ff)(bool) const %{ $1 = &Funcs::FFF2; %}
+%typemap(in) short (Funcs::*cc)(bool) & %{ $1 = &Funcs::CCC5; %}
+%typemap(in) short (Funcs::*gg)(bool) const & %{ $1 = &Funcs::GGG8; %}
+%typemap(in) short (Funcs::*hh)(bool) && %{ $1 = &Funcs::HHH11; %}
+
+%typemap(in) short (Funcs::*)(bool) const %{ $1 = &Funcs::FFF3; %}
+%typemap(in) short (Funcs::*)(bool) & %{ $1 = &Funcs::CCC6; %}
+%typemap(in) short (Funcs::*)(bool) const & %{ $1 = &Funcs::GGG9; %}
+%typemap(in) short (Funcs::*)(bool) && %{ $1 = &Funcs::HHH12; %}
+
+%inline %{
+struct Funcs {
+ short FFF1(bool) const { return 1; }
+ short FFF2(bool) const { return 2; }
+ short FFF3(bool) const { return 3; }
+ short CCC4(bool) & { return 4; }
+ short CCC5(bool) & { return 5; }
+ short CCC6(bool) & { return 6; }
+ short GGG7(bool) const & { return 7; }
+ short GGG8(bool) const & { return 8; }
+ short GGG9(bool) const & { return 9; }
+ short HHH10(bool) && { return 10; }
+ short HHH11(bool) && { return 11; }
+ short HHH12(bool) && { return 12; }
+};
+struct TypemapsNamedParms
+{
+ short fff(short (Funcs::*ff)(bool) const) {
+ Funcs funcs;
+ return (funcs.*ff)(true);
+ }
+ short ccc(short (Funcs::*cc)(bool) &) {
+ Funcs funcs;
+ return (funcs.*cc)(true);
+ }
+ short ggg(short (Funcs::*gg)(bool) const &) {
+ Funcs funcs;
+ return (funcs.*gg)(true);
+ }
+ short hhh(short (Funcs::*hh)(bool) &&) {
+ return (Funcs().*hh)(true);
+ }
+};
+struct TypemapsUnnamedParms
+{
+ short fff(short (Funcs::*f)(bool) const) {
+ Funcs funcs;
+ return (funcs.*f)(true);
+ }
+ short ccc(short (Funcs::*c)(bool) &) {
+ Funcs funcs;
+ return (funcs.*c)(true);
+ }
+ short ggg(short (Funcs::*g)(bool) const &) {
+ Funcs funcs;
+ return (funcs.*g)(true);
+ }
+ short hhh(short (Funcs::*h)(bool) &&) {
+ return (Funcs().*h)(true);
+ }
+};
+%}
+
+%constant short (Funcs::*FF1_MFP)(bool) const = &Funcs::FFF1;
+%constant short (Funcs::*CC4_MFP)(bool) & = &Funcs::CCC4;
+%constant short (Funcs::*GG7_MFP)(bool) const & = &Funcs::GGG7;
+%constant short (Funcs::*HH10_MFP)(bool) && = &Funcs::HHH10;
diff --git a/Examples/test-suite/cpp11_rvalue_reference2.i b/Examples/test-suite/cpp11_rvalue_reference2.i
index 6718a3941..a2a0020f5 100644
--- a/Examples/test-suite/cpp11_rvalue_reference2.i
+++ b/Examples/test-suite/cpp11_rvalue_reference2.i
@@ -23,7 +23,7 @@ struct Thingy {
int val;
int &lvalref;
int &&rvalref;
- Thingy(int v) : val(v), lvalref(val), rvalref(22) {}
+ Thingy(int v, int &&rvalv) : val(v), lvalref(val), rvalref(std::move(rvalv)) {}
void refIn(long &i) {}
void rvalueIn(long &&i) {}
short && rvalueInOut(short &&i) { return std::move(i); }
@@ -31,8 +31,8 @@ struct Thingy {
// test both primitive and user defined rvalue reference default arguments and compactdefaultargs
void compactDefaultArgs(const bool &&b = (const bool &&)PublicGlobalTrue, const UserDef &&u = (const UserDef &&)PublicUserDef) {}
void privateDefaultArgs(const bool &&b = (const bool &&)PrivateTrue) {}
- operator int &&() { return std::move(0); }
- Thingy(const Thingy& rhs) : val(rhs.val), lvalref(rhs.lvalref), rvalref(copy_int(rhs.rvalref)) {}
+ operator int &&() { return std::move(val); }
+ Thingy(const Thingy& rhs) : val(rhs.val), lvalref(rhs.lvalref), rvalref(std::move(rhs.rvalref)) {}
Thingy& operator=(const Thingy& rhs) {
val = rhs.val;
lvalref = rhs.lvalref;
@@ -41,23 +41,25 @@ struct Thingy {
}
private:
static const bool PrivateTrue;
- int copy_int(int& i) { return i; }
Thingy();
};
const bool Thingy::PrivateTrue = true;
short && globalRvalueInOut(short &&i) { return std::move(i); }
-Thingy &&globalrrval = Thingy(55);
+int glob = 123;
-short && func(short &&i) { return std::move(i); }
-Thingy getit() { return Thingy(22); }
+Thingy &&globalrrval = Thingy(55, std::move(glob));
+
+short && funk(short &&i) { return std::move(i); }
+Thingy getit() { return Thingy(22, std::move(glob)); }
void rvalrefFunction1(int &&v = (int &&)5) {}
-void rvalrefFunctionBYVAL(short (Thingy::*memFunc)(short)) {}
-void rvalrefFunctionLVALUE(short &(Thingy::*memFunc)(short &)) {}
-void rvalrefFunction2(short && (Thingy::*memFunc)(short &&)) {}
-void rvalrefFunction3(short && (*memFunc)(short &&)) {}
+void rvalrefFunctionBYVAL(short (Thingy::*fptr)(short)) {}
+void rvalrefFunctionPTR(short * (*fptr)(short *)) {}
+void rvalrefFunctionLVALUE(short & (Thingy::*fptr)(short &)) {}
+void rvalrefFunction2(short && (Thingy::*fptr)(short &&)) {}
+void rvalrefFunction3(short && (*fptr)(short &&)) {}
template <typename T> struct RemoveReference {
typedef T type;
diff --git a/Examples/test-suite/cpp11_rvalue_reference3.i b/Examples/test-suite/cpp11_rvalue_reference3.i
index c65309945..8ebf45366 100644
--- a/Examples/test-suite/cpp11_rvalue_reference3.i
+++ b/Examples/test-suite/cpp11_rvalue_reference3.i
@@ -26,12 +26,18 @@ void takeit5(Thing const*const&& t) {}
struct Containing {
Thing && member_rvalue_ref;
- Thing *&& member_rvalue_ref_ptr1 = 0;
- Thing const*&& member_rvalue_ref_ptr2 = 0;
- Thing *const&& member_rvalue_ref_ptr3 = 0;
- Thing const*const &&member_rvalue_ref_ptr4 = 0;
+ Thing *&& member_rvalue_ref_ptr1;
+ Thing const*&& member_rvalue_ref_ptr2;
+ Thing *const&& member_rvalue_ref_ptr3;
+ Thing const*const &&member_rvalue_ref_ptr4;
- Containing() : member_rvalue_ref(Thing()) {}
+ Containing(Thing&&r, Thing*&& r1, Thing const*&& r2, Thing *const&& r3, Thing const*const && r4) :
+ member_rvalue_ref(std::move(r)),
+ member_rvalue_ref_ptr1(std::move(r1)),
+ member_rvalue_ref_ptr2(std::move(r2)),
+ member_rvalue_ref_ptr3(std::move(r3)),
+ member_rvalue_ref_ptr4(std::move(r4))
+ {}
};
%}
@@ -57,11 +63,17 @@ void int_takeit5(int const*const&& t) {}
struct IntContaining {
int && member_rvalue_ref;
- int *&& member_rvalue_ref_ptr1 = 0;
- int const*&& member_rvalue_ref_ptr2 = 0;
- int *const&& member_rvalue_ref_ptr3 = 0;
- int const*const &&member_rvalue_ref_ptr4 = 0;
+ int *&& member_rvalue_ref_ptr1;
+ int const*&& member_rvalue_ref_ptr2;
+ int *const&& member_rvalue_ref_ptr3;
+ int const*const &&member_rvalue_ref_ptr4;
- IntContaining() : member_rvalue_ref(55) {}
+ IntContaining(int&& r, int*&& r1, int const*&& r2, int *const&& r3, int const*const && r4) :
+ member_rvalue_ref(std::move(r)),
+ member_rvalue_ref_ptr1(std::move(r1)),
+ member_rvalue_ref_ptr2(std::move(r2)),
+ member_rvalue_ref_ptr3(std::move(r3)),
+ member_rvalue_ref_ptr4(std::move(r4))
+ {}
};
%}
diff --git a/Examples/test-suite/cpp11_shared_ptr_const.i b/Examples/test-suite/cpp11_shared_ptr_const.i
new file mode 100644
index 000000000..5e38123b4
--- /dev/null
+++ b/Examples/test-suite/cpp11_shared_ptr_const.i
@@ -0,0 +1,57 @@
+%module cpp11_shared_ptr_const
+
+%{
+
+#include <memory>
+#include <vector>
+
+class Foo
+{
+ int m;
+public:
+ Foo(int i) : m(i) {}
+ int get_m() { return m;}
+};
+
+std::shared_ptr<Foo> foo(Foo v) {
+ return std::shared_ptr<Foo>(new Foo(v));
+}
+
+std::shared_ptr<const Foo> const_foo(Foo v) {
+ return std::shared_ptr<const Foo>(new Foo(v));
+}
+
+std::vector<std::shared_ptr<Foo> > foo_vec(Foo v) {
+ std::vector<std::shared_ptr<Foo> > result;
+ result.push_back( std::shared_ptr<Foo>(new Foo(v)) );
+ return result;
+}
+
+std::vector<std::shared_ptr<const Foo> > const_foo_vec(Foo v) {
+ std::vector<std::shared_ptr<const Foo> > result;
+ result.push_back( std::shared_ptr<Foo>(new Foo(v)) );
+ return result;
+}
+
+%}
+
+%include <std_shared_ptr.i>
+%include <std_vector.i>
+
+%shared_ptr(Foo);
+
+%template (FooVector) std::vector<std::shared_ptr<Foo> >;
+%template (FooConstVector) std::vector<std::shared_ptr<Foo const> >;
+
+class Foo
+{
+ int m;
+public:
+ Foo(int i);
+ int get_m();
+};
+std::shared_ptr<Foo> foo(Foo v);
+std::shared_ptr<const Foo> const_foo(Foo v);
+std::vector<std::shared_ptr<Foo> > foo_vec(Foo v) const;
+std::vector<std::shared_ptr<const Foo> > const_foo_vec(Foo v) const;
+
diff --git a/Examples/test-suite/cpp11_shared_ptr_nullptr_in_containers.i b/Examples/test-suite/cpp11_shared_ptr_nullptr_in_containers.i
new file mode 100644
index 000000000..2167dfb73
--- /dev/null
+++ b/Examples/test-suite/cpp11_shared_ptr_nullptr_in_containers.i
@@ -0,0 +1,50 @@
+%module cpp11_shared_ptr_nullptr_in_containers
+
+%{
+#include <memory>
+#include <vector>
+
+class C;
+%}
+
+%include <std_shared_ptr.i>
+%include <std_vector.i>
+
+%shared_ptr(C)
+
+%inline %{
+
+class C {
+ int m;
+public:
+ C() : m(-1) {}
+ C(int i) : m(i) {}
+ int get_m() { return m; }
+};
+
+%}
+
+%template() std::vector<std::shared_ptr<C> >;
+
+%inline %{
+
+ std::vector<std::shared_ptr<C> > ret_vec_c_shared_ptr() {
+ std::vector<std::shared_ptr<C> > ret(3);
+ ret[0] = std::shared_ptr<C>(new C(0));
+ ret[2] = std::shared_ptr<C>(new C(2));
+ return ret;
+ }
+
+ std::vector<std::shared_ptr<C> > ret_arg_vec(const std::vector<std::shared_ptr<C> >& v) {
+ return v;
+ }
+
+ bool is_last_null(const std::vector<std::shared_ptr<C> >& v) {
+ if( v.back() ) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+%}
diff --git a/Examples/test-suite/cpp11_shared_ptr_overload.i b/Examples/test-suite/cpp11_shared_ptr_overload.i
new file mode 100644
index 000000000..ab84fda9a
--- /dev/null
+++ b/Examples/test-suite/cpp11_shared_ptr_overload.i
@@ -0,0 +1,89 @@
+%module cpp11_shared_ptr_overload
+
+// Tests to ensure valid overloading in C++ between shared_ptr and other types result in code that compiles
+// and all but the 1st overloaded method are automatically ignored/shadowed.
+// Tests the 'equivalent' attribute in the 'typecheck' typemap.
+
+%include <std_string.i>
+%include <std_shared_ptr.i>
+
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) UseA(std::shared_ptr<MyType> mytype);
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) UseB(int, std::shared_ptr<MyType> mytype);
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) UseC(int, std::shared_ptr<MyType> mytype, std::shared_ptr<MyType>);
+
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) UseX(MyType &mytype);
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) UseY(int, MyType &mytype);
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) UseZ(int, MyType &mytype, std::shared_ptr<MyType>);
+
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) Combo1;
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) Combo2;
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) Combo3;
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) Combo4;
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) Combo5;
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) Combo6;
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED,SWIGWARN_LANG_OVERLOAD_SHADOW) Combo7;
+
+%shared_ptr(MyType);
+
+%inline %{
+#include <memory>
+#include <string>
+struct MyType {
+ std::string val;
+ MyType(std::string val = std::string()) : val(val) {}
+};
+
+// ref
+std::string UseA(MyType &mytype) { return mytype.val + " ref"; }
+std::string UseA(std::shared_ptr<MyType> mytype) { return mytype->val + " sharedptr"; }
+
+std::string UseB(int, MyType &mytype) { return mytype.val + " ref"; }
+std::string UseB(int, std::shared_ptr<MyType> mytype) { return mytype->val + " sharedptr"; }
+
+std::string UseC(int, MyType &mytype, std::shared_ptr<MyType>) { return mytype.val + " ref"; }
+std::string UseC(int, std::shared_ptr<MyType> mytype, std::shared_ptr<MyType>) { return mytype->val + " sharedptr"; }
+
+// sharedptr
+std::string UseX(std::shared_ptr<MyType> mytype) { return mytype->val + " sharedptr"; }
+std::string UseX(MyType &mytype) { return mytype.val + " ref"; }
+
+std::string UseY(int, std::shared_ptr<MyType> mytype) { return mytype->val + " sharedptr"; }
+std::string UseY(int, MyType &mytype) { return mytype.val + " ref"; }
+
+std::string UseZ(int, std::shared_ptr<MyType> mytype, std::shared_ptr<MyType>) { return mytype->val + " sharedptr"; }
+std::string UseZ(int, MyType &mytype, std::shared_ptr<MyType>) { return mytype.val + " ref"; }
+
+// Combo1-4
+std::string Combo1(MyType mytype) { return mytype.val + "Combo1"; }
+std::string Combo1(MyType *mytype) { return ""; }
+std::string Combo1(std::shared_ptr<MyType> mytype) { return ""; }
+std::string Combo1(std::shared_ptr<MyType>* mytype) { return ""; }
+
+std::string Combo2(MyType *mytype) { return mytype->val + "Combo2"; }
+std::string Combo2(std::shared_ptr<MyType> mytype) { return ""; }
+std::string Combo2(std::shared_ptr<MyType>* mytype) { return ""; }
+std::string Combo2(MyType mytype) { return ""; }
+
+std::string Combo3(std::shared_ptr<MyType> mytype) { return mytype->val + "Combo3"; }
+std::string Combo3(std::shared_ptr<MyType>* mytype) { return ""; }
+std::string Combo3(MyType mytype) { return ""; }
+std::string Combo3(MyType *mytype) { return ""; }
+
+std::string Combo4(std::shared_ptr<MyType>* mytype) { return (*mytype)->val + "Combo4"; }
+std::string Combo4(MyType mytype) { return ""; }
+std::string Combo4(MyType *mytype) { return ""; }
+std::string Combo4(std::shared_ptr<MyType> mytype) { return ""; }
+
+// Combo5-7
+std::string Combo5(MyType &mytype) { return mytype.val + "Combo5"; }
+std::string Combo5(MyType *mytype) { return ""; }
+std::string Combo5(std::shared_ptr<MyType> mytype) { return ""; }
+
+std::string Combo6(MyType *mytype) { return mytype->val + "Combo6"; }
+std::string Combo6(std::shared_ptr<MyType> mytype) { return ""; }
+std::string Combo6(MyType &mytype) { return ""; }
+
+std::string Combo7(std::shared_ptr<MyType> mytype) { return mytype->val + "Combo7"; }
+std::string Combo7(MyType &mytype) { return ""; }
+std::string Combo7(MyType *mytype) { return ""; }
+%}
diff --git a/Examples/test-suite/cpp11_shared_ptr_upcast.i b/Examples/test-suite/cpp11_shared_ptr_upcast.i
new file mode 100644
index 000000000..9d85f43d4
--- /dev/null
+++ b/Examples/test-suite/cpp11_shared_ptr_upcast.i
@@ -0,0 +1,188 @@
+%module cpp11_shared_ptr_upcast
+
+%{
+#include <set>
+#include <map>
+#include <memory>
+#include <unordered_set>
+#include <unordered_map>
+#include <vector>
+%}
+
+%include <std_vector.i>
+%include <std_map.i>
+%include <std_shared_ptr.i>
+
+%{
+
+class Base {
+ int m;
+public:
+ Base() : m(-1) {}
+ Base(int i) : m(i) {}
+ int get_m() { return m; }
+};
+
+class Derived : public Base {
+ int n;
+public:
+ Derived() : n(-2) {}
+ Derived(int i) : n(i) {}
+ int get_n() { return n; }
+};
+
+typedef std::shared_ptr<Base> BasePtr;
+typedef std::shared_ptr<Derived> DerivedPtr;
+
+// non-overloaded
+int derived_num1(DerivedPtr v) {
+ return v == nullptr ? 999 : (*v).get_n();
+}
+
+int derived_num2(std::vector<DerivedPtr> v) {
+ return v[0] == nullptr ? 999 : (*v[0]).get_n();
+}
+
+int derived_num3(std::map<int, DerivedPtr> v) {
+ return v[0] == nullptr ? 999 : (*v[0]).get_n();
+}
+
+int base_num1(BasePtr v) {
+ return v == nullptr ? 999 : (*v).get_m();
+}
+
+int base_num2(std::vector<BasePtr > v) {
+ return v[0] == nullptr ? 999 : (*v[0]).get_m();
+}
+
+int base_num3(std::map<int, BasePtr > v) {
+ return v[0] == nullptr ? 999 : (*v[0]).get_m();
+}
+
+// overloaded
+int derived_num(DerivedPtr v) {
+ return derived_num1(v);
+}
+
+int derived_num(std::vector<DerivedPtr> v) {
+ return derived_num2(v);
+}
+
+int derived_num(std::map<int, DerivedPtr> v) {
+ return derived_num3(v);
+}
+
+int base_num(BasePtr v) {
+ return base_num1(v);
+}
+
+int base_num(std::vector<BasePtr > v) {
+ return base_num2(v);
+}
+
+int base_num(std::map<int, BasePtr > v) {
+ return base_num3(v);
+}
+%}
+
+
+%shared_ptr(Base);
+%shared_ptr(Derived);
+
+%template(BaseList) std::vector<std::shared_ptr<Base> >;
+%template(DerivedList) std::vector<std::shared_ptr<Derived> >;
+
+%template(BaseMap) std::map<int, std::shared_ptr<Base> >;
+%template(DerivedMap) std::map<int, std::shared_ptr<Derived> >;
+
+class Base {
+ int m;
+public:
+ Base();
+ int get_m();
+};
+
+class Derived : public Base {
+ int n;
+public:
+ Derived();
+ Derived(int i);
+ int get_n();
+};
+
+typedef std::shared_ptr<Base> BasePtr;
+typedef std::shared_ptr<Derived> DerivedPtr;
+
+// non-overloaded
+int derived_num1(DerivedPtr);
+int derived_num2(std::vector<std::shared_ptr<Derived> > v);
+int derived_num3(std::map<int, DerivedPtr> v);
+int base_num1(BasePtr);
+int base_num2(std::vector<std::shared_ptr<Base> > v);
+int base_num3(std::map<int, BasePtr > v);
+
+// overloaded
+int derived_num(DerivedPtr);
+int derived_num(std::vector<std::shared_ptr<Derived> > v);
+int derived_num(std::map<int, DerivedPtr> v);
+int base_num(BasePtr);
+int base_num(std::vector<std::shared_ptr<Base> > v);
+int base_num(std::map<int, BasePtr > v);
+
+// ptr to shared_ptr
+%shared_ptr(Base2);
+%shared_ptr(Derived2)
+
+%inline %{
+class Base2 {
+ int m;
+public:
+ Base2() : m(-1) {}
+ Base2(int i) : m(i) {}
+ int get_m() { return m; }
+};
+
+
+class Derived2 : public Base2 {
+ int n;
+public:
+ Derived2() : n(0) {}
+ Derived2(int i) : n(i) {}
+ int get_n_2() { return n; }
+};
+%}
+
+%template(Base2List) std::vector<std::shared_ptr<Base2> * >;
+%template(Base2Map) std::map<int, std::shared_ptr<Base2> * >;
+
+%template(Derived2List) std::vector<std::shared_ptr<Derived2> * >;
+%template(Derived2Map) std::map<int, std::shared_ptr<Derived2> * >;
+
+%inline %{
+typedef std::shared_ptr<Derived2> * Derived2Ptr;
+typedef std::shared_ptr<Base2> * Base2Ptr;
+
+int base2_num1(Base2Ptr v) {
+ return v == nullptr ? 999 : *v == nullptr ? 888 : (*v)->get_m();
+}
+
+int base2_num2(std::vector<Base2Ptr> v) {
+ return v[0] == nullptr ? 999 : *v[0] == nullptr ? 888 : (*v[0])->get_m();
+}
+
+int base2_num3(std::map<int, Base2Ptr> v) {
+ return v[0] == nullptr ? 999 : *v[0] == nullptr ? 888 : (*v[0])->get_m();
+}
+
+int derived2_num1(Derived2Ptr v) {
+ return v == nullptr ? 999 : *v == nullptr ? 888 : (*v)->get_n_2();
+}
+
+int derived2_num2(std::vector<Derived2Ptr> v) {
+ return v[0] == nullptr ? 999 : *v[0] == nullptr ? 888 : (*v[0])->get_n_2();
+}
+
+int derived2_num3(std::map<int, Derived2Ptr> v) {
+ return v[0] == nullptr ? 999 : *v[0] == nullptr ? 888 : (*v[0])->get_n_2();
+}
+%}
diff --git a/Examples/test-suite/cpp11_static_assert.i b/Examples/test-suite/cpp11_static_assert.i
index 8d616f96c..7ca452d85 100644
--- a/Examples/test-suite/cpp11_static_assert.i
+++ b/Examples/test-suite/cpp11_static_assert.i
@@ -1,12 +1,32 @@
-/* This test case checks whether SWIG correctly parses and ignores the
- keywords "static_assert()" inside the class or struct.
+/* This test case checks whether SWIG correctly parses and ignores
+ "static_assert()" in various places.
*/
%module cpp11_static_assert
%inline %{
+static_assert(sizeof(int) >= 2, "What? int size is invalid!");
+
+namespace dummy {
+// C++17 allows the message to be omitted, so check that works too.
+// But only show the C++17 version to SWIG, as the compiler may
+// lack C++17 support.
+#ifdef SWIG
+static_assert(sizeof(int) >= sizeof(short));
+#else
+static_assert(sizeof(int) >= sizeof(short), "blah");
+#endif
+}
+
template <typename T>
struct Check1 {
static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ Check1() {
+#ifdef SWIG
+ static_assert(true);
+#else
+ static_assert(true, "true");
+#endif
+ }
};
template <typename T>
diff --git a/Examples/test-suite/cpp11_li_std_array.i b/Examples/test-suite/cpp11_std_array.i
index dedd6483a..3d4771551 100644
--- a/Examples/test-suite/cpp11_li_std_array.i
+++ b/Examples/test-suite/cpp11_std_array.i
@@ -1,4 +1,4 @@
-%module cpp11_li_std_array
+%module cpp11_std_array
#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGJAVA) || defined(SWIGCSHARP)
diff --git a/Examples/test-suite/cpp11_std_unordered_map.i b/Examples/test-suite/cpp11_std_unordered_map.i
new file mode 100644
index 000000000..4bdec9c7c
--- /dev/null
+++ b/Examples/test-suite/cpp11_std_unordered_map.i
@@ -0,0 +1,11 @@
+%module cpp11_std_unordered_map
+
+%include <std_string.i>
+%include <std_unordered_map.i>
+
+%template(UnorderedMapIntInt) std::unordered_map<int, int>;
+%template(UnorderedMapStringInt) std::unordered_map<std::string, int>;
+
+%inline %{
+std::unordered_map<std::string, int, std::hash< std::string >,std::equal_to< std::string >,std::allocator< std::pair< std::string const,int > > > inout(std::unordered_map<std::string, int> m) { return m; }
+%}
diff --git a/Examples/test-suite/cpp11_std_unordered_multimap.i b/Examples/test-suite/cpp11_std_unordered_multimap.i
new file mode 100644
index 000000000..8556b26b5
--- /dev/null
+++ b/Examples/test-suite/cpp11_std_unordered_multimap.i
@@ -0,0 +1,7 @@
+%module cpp11_std_unordered_multimap
+
+%include <std_pair.i>
+%include <std_unordered_multimap.i>
+
+%template(PairIntInt) std::pair<int,int>;
+%template(UnorderedMultiMapIntInt) std::unordered_multimap<int, int>;
diff --git a/Examples/test-suite/cpp11_std_unordered_multiset.i b/Examples/test-suite/cpp11_std_unordered_multiset.i
new file mode 100644
index 000000000..c9907425e
--- /dev/null
+++ b/Examples/test-suite/cpp11_std_unordered_multiset.i
@@ -0,0 +1,5 @@
+%module cpp11_std_unordered_multiset
+
+%include <std_unordered_multiset.i>
+
+%template(UnorderedMultiSetInt) std::unordered_multiset<int>;
diff --git a/Examples/test-suite/cpp11_std_unordered_set.i b/Examples/test-suite/cpp11_std_unordered_set.i
new file mode 100644
index 000000000..c2b8174bb
--- /dev/null
+++ b/Examples/test-suite/cpp11_std_unordered_set.i
@@ -0,0 +1,7 @@
+%module cpp11_std_unordered_set
+
+%include <std_string.i>
+%include <std_unordered_set.i>
+
+%template(UnorderedSetInt) std::unordered_set<int>;
+%template(UnorderedSetString) std::unordered_set<std::string>;
diff --git a/Examples/test-suite/cpp11_template_explicit.i b/Examples/test-suite/cpp11_template_explicit.i
index f8fca4fae..71752f822 100644
--- a/Examples/test-suite/cpp11_template_explicit.i
+++ b/Examples/test-suite/cpp11_template_explicit.i
@@ -8,7 +8,8 @@
%inline %{
-template<typename T> struct Temper {
+template<typename T> class Temper {
+public:
T val;
};
@@ -18,14 +19,20 @@ public:
int memberFunction() { return 100; }
};
+class B {
+public:
+ short member;
+ short memberFunction() { return 100; }
+};
+
template class Temper<A>;
-extern template class Temper<A>;
+extern template class Temper<B>;
template class Temper<A*>;
-extern template class Temper<A*>;
+extern template class Temper<B*>;
template class Temper<int>;
-extern template class Temper<int>;
+extern template class Temper<short>;
%}
%template(TemperInt) Temper<int>;
diff --git a/Examples/test-suite/cpp11_template_typedefs.i b/Examples/test-suite/cpp11_template_typedefs.i
index 02cb8ac30..5f1f2e6f9 100644
--- a/Examples/test-suite/cpp11_template_typedefs.i
+++ b/Examples/test-suite/cpp11_template_typedefs.i
@@ -15,7 +15,7 @@ public:
using type2_t = T2;
T1 a;
T2 b;
- constexpr int get_n() { return N; }
+ constexpr int get_n() const { return N; }
};
// Specialization for T1=const char*, T2=bool
@@ -26,7 +26,7 @@ public:
using type2_t = bool;
type1_t a;
type2_t b;
- constexpr int get_n() { return 3 * N; }
+ constexpr int get_n() const { return 3 * N; }
};
// alias templates
diff --git a/Examples/test-suite/cpp11_thread_local.i b/Examples/test-suite/cpp11_thread_local.i
index 6a1019824..21f21859b 100644
--- a/Examples/test-suite/cpp11_thread_local.i
+++ b/Examples/test-suite/cpp11_thread_local.i
@@ -20,8 +20,10 @@ extern "C++" thread_local int ecpptval;
thread_local int ThreadLocals::stval = 11;
thread_local int ThreadLocals::tsval = 22;
+#if !defined(_MSC_VER)
thread_local const int ThreadLocals::stcval88;
thread_local const int ThreadLocals::tscval99;
+#endif
%}
%{
diff --git a/Examples/test-suite/cpp11_type_aliasing.i b/Examples/test-suite/cpp11_type_aliasing.i
index 2f6ea3aa7..abc1642c4 100644
--- a/Examples/test-suite/cpp11_type_aliasing.i
+++ b/Examples/test-suite/cpp11_type_aliasing.i
@@ -108,5 +108,5 @@ PairSubclass::data_t plus1(PairSubclass::const_ref_data_t x) { return x + 1; }
using callback_t = int(*)(int);
callback_t get_callback() { return mult2; }
-int call(callback_t func, int param) { return func(param); }
+int call(callback_t funk, int param) { return funk(param); }
%}
diff --git a/Examples/test-suite/cpp14_binary_integer_literals.i b/Examples/test-suite/cpp14_binary_integer_literals.i
new file mode 100644
index 000000000..9c696b5a5
--- /dev/null
+++ b/Examples/test-suite/cpp14_binary_integer_literals.i
@@ -0,0 +1,31 @@
+%module cpp14_binary_integer_literals
+
+// Tests are designed so that code compiles with C++98 compilers
+
+%{
+#if __cplusplus >= 201402L
+#define CPP14 1
+#endif
+%}
+
+int b1 = 0b1;
+int b2 = 0b10;
+long b3 = 0b11l;
+unsigned long b4 = 0b100ul;
+unsigned long b5 = 0B101UL;
+
+%{
+#if defined(CPP14)
+int b1 = 0b1;
+int b2 = 0b10;
+long b3 = 0b11l;
+unsigned long b4 = 0b100ul;
+unsigned long b5 = 0B101UL;
+#else
+int b1 = 1;
+int b2 = 2;
+long b3 = 3;
+unsigned long b4 = 4;
+unsigned long b5 = 5;
+#endif
+%}
diff --git a/Examples/test-suite/cpp17_hex_floating_literals.i b/Examples/test-suite/cpp17_hex_floating_literals.i
new file mode 100644
index 000000000..dfc1dc0cf
--- /dev/null
+++ b/Examples/test-suite/cpp17_hex_floating_literals.i
@@ -0,0 +1,43 @@
+%module cpp17_hex_floating_literals
+
+// Tests are designed so that code compiles with C++98 compilers
+
+%{
+#if __cplusplus >= 201703L
+#define CPP17 1
+#endif
+%}
+
+double f1 = 0x.0p1;
+double f2 = 0x0.p1;
+double f3 = 0x0.0p-1;
+double f4 = 0xf.p-1;
+double f5 = 0xA.0p1;
+double f6 = 0x0.10P+10;
+double f7 = 0xb2F.p2;
+float f8 = 0x1234AP1F;
+float f9 = 0x45A1.D1A2p+10f;
+
+%{
+#if defined(CPP17)
+double f1 = 0x.0p1;
+double f2 = 0x0.p1;
+double f3 = 0x0.0p-1;
+double f4 = 0xf.p-1;
+double f5 = 0xA.0p1;
+double f6 = 0x0.10P+10;
+double f7 = 0xb2F.p2;
+float f8 = 0x1234AP1F;
+float f9 = 0x45A1.D1A2p+10f;
+#else
+double f1 = 0.;
+double f2 = 0.;
+double f3 = 0.;
+double f4 = 7.5;
+double f5 = 20.;
+double f6 = 64.;
+double f7 = 11452.;
+float f8 = 149140.f;
+float f9 = 18253638.f;
+#endif
+%}
diff --git a/Examples/test-suite/cpp17_nested_namespaces.i b/Examples/test-suite/cpp17_nested_namespaces.i
new file mode 100644
index 000000000..b9ec9bd5a
--- /dev/null
+++ b/Examples/test-suite/cpp17_nested_namespaces.i
@@ -0,0 +1,199 @@
+%module cpp17_nested_namespaces
+// Tests c++17 style nested namespaces
+// Tests are designed so that code compiles with C++98 compilers
+
+#define CPP17 1
+%{
+#if __cplusplus >= 201703L
+#define CPP17 1
+#endif
+%}
+
+%inline %{
+// Tests with namespaces already defined using C++98 style (non-nested) namespaces
+namespace A1 {
+ struct A1Struct {
+ void A1Method() {}
+ };
+ namespace B1 {
+ struct B1Struct {
+ void B1Method() {}
+ };
+ }
+}
+#if defined(CPP17)
+namespace A1::B1 {
+#else
+namespace A1 {
+ namespace B1 {
+#endif
+ A1Struct createA1Struct() { return ::A1::A1Struct(); }
+ B1Struct createB1Struct() { return ::A1::B1::B1Struct(); }
+#if !defined(CPP17)
+ }
+}
+#else
+}
+#endif
+
+namespace A1 {
+ namespace B1 {
+ namespace C1 {
+ struct C1Struct {
+ void C1Method() {}
+ };
+ }
+ }
+}
+
+#if defined(CPP17)
+namespace A1::B1::C1 {
+#else
+namespace A1 {
+ namespace B1 {
+ namespace C1 {
+#endif
+ C1Struct createC1Struct() { return ::A1::B1::C1::C1Struct(); }
+#if !defined(CPP17)
+ }
+ }
+}
+#else
+}
+#endif
+%}
+
+%inline %{
+// Tests with namespaces already defined using C++17 style (nested) namespaces
+#if defined(CPP17)
+namespace A2::B2 {
+#else
+namespace A2 {
+ namespace B2 {
+#endif
+ struct B2Struct {
+ void B2Method() {}
+ };
+#if !defined(CPP17)
+ }
+}
+#else
+}
+#endif
+
+#if defined(CPP17)
+namespace A2::B2 {
+#else
+namespace A2 {
+ namespace B2 {
+#endif
+ B2Struct createB2Struct() { return ::A2::B2::B2Struct(); }
+#if !defined(CPP17)
+ }
+}
+#else
+}
+#endif
+
+#if defined(CPP17)
+namespace A2::B2::C2 {
+#else
+namespace A2 {
+ namespace B2 {
+ namespace C2 {
+#endif
+ struct C2Struct {
+ void C2Method() {}
+ };
+#if !defined(CPP17)
+ }
+ }
+}
+#else
+}
+#endif
+
+#if defined(CPP17)
+namespace A2::B2::C2 {
+#else
+namespace A2 {
+ namespace B2 {
+ namespace C2 {
+#endif
+ C2Struct createC2Struct() { return ::A2::B2::C2::C2Struct(); }
+#if !defined(CPP17)
+ }
+ }
+}
+#else
+}
+#endif
+%}
+
+
+%inline %{
+// Tests with namespaces already defined using C++17 style (nested) namespaces to 3 levels
+#if defined(CPP17)
+namespace A3::B3::C3 {
+#else
+namespace A3 {
+ namespace B3 {
+ namespace C3 {
+#endif
+ struct C3Struct {
+ void C3Method() {}
+ };
+#if !defined(CPP17)
+ }
+ }
+}
+#else
+}
+#endif
+
+#if defined(CPP17)
+namespace A3::B3::C3 {
+#else
+namespace A3 {
+ namespace B3 {
+ namespace C3 {
+#endif
+ C3Struct createC3Struct() { return ::A3::B3::C3::C3Struct(); }
+#if !defined(CPP17)
+ }
+ }
+}
+#else
+}
+#endif
+
+#if defined(CPP17)
+namespace A3::B3 {
+#else
+namespace A3 {
+ namespace B3 {
+#endif
+ struct B3Struct {
+ void B3Method() {}
+ };
+#if !defined(CPP17)
+ }
+}
+#else
+}
+#endif
+
+#if defined(CPP17)
+namespace A3::B3 {
+#else
+namespace A3 {
+ namespace B3 {
+#endif
+ B3Struct createB3Struct() { return ::A3::B3::B3Struct(); }
+#if !defined(CPP17)
+ }
+}
+#else
+}
+#endif
+%}
diff --git a/Examples/test-suite/cpp17_nspace_nested_namespaces.i b/Examples/test-suite/cpp17_nspace_nested_namespaces.i
new file mode 100644
index 000000000..a88878de9
--- /dev/null
+++ b/Examples/test-suite/cpp17_nspace_nested_namespaces.i
@@ -0,0 +1,13 @@
+%module cpp17_nspace_nested_namespaces
+
+#if defined(SWIGJAVA)
+SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
+#endif
+
+// nspace feature only supported by these languages
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
+%nspace;
+#endif
+
+
+%include "cpp17_nested_namespaces.i"
diff --git a/Examples/test-suite/cpp17_u8_char_literals.i b/Examples/test-suite/cpp17_u8_char_literals.i
new file mode 100644
index 000000000..1aae1b231
--- /dev/null
+++ b/Examples/test-suite/cpp17_u8_char_literals.i
@@ -0,0 +1,26 @@
+%module cpp17_u8_char_literals
+
+// Tests are designed so that code compiles with C++98 compilers
+
+%{
+#if __cplusplus >= 201703L
+#define CPP17 1
+#endif
+%}
+
+// UTF-8 character literals will (apparently) have type char8_t in C++20.
+char a = u8'a';
+char u = u8'u';
+char u8 = u8'8';
+
+%{
+#if defined(CPP17)
+char a = u8'a';
+char u = u8'u';
+char u8 = u8'8';
+#else
+char a = 'a';
+char u = 'u';
+char u8 = '8';
+#endif
+%}
diff --git a/Examples/test-suite/cpp_broken.i b/Examples/test-suite/cpp_broken.i
deleted file mode 100644
index 84d6122e5..000000000
--- a/Examples/test-suite/cpp_broken.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%module cpp_broken
-
-
-// bug #940318
-%inline %{
-typedef enum {
-eZero = 0
-#define ONE 1
-} EFoo;
-%}
-
-
diff --git a/Examples/test-suite/cpp_namespace.i b/Examples/test-suite/cpp_namespace.i
index d7bf95e9f..a415917db 100644
--- a/Examples/test-suite/cpp_namespace.i
+++ b/Examples/test-suite/cpp_namespace.i
@@ -2,6 +2,10 @@
%module cpp_namespace
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%inline %{
typedef int Bad;
diff --git a/Examples/test-suite/cpp_static.i b/Examples/test-suite/cpp_static.i
index 1f8ca1282..9ffe55837 100644
--- a/Examples/test-suite/cpp_static.i
+++ b/Examples/test-suite/cpp_static.i
@@ -10,6 +10,7 @@ Tests Sourceforge bug #444748.
class StaticMemberTest {
public:
static int static_int;
+ static int grab_int() { return static_int; }
};
class StaticFunctionTest {
@@ -28,10 +29,12 @@ int StaticMemberTest::static_int = 99;
%inline %{
struct StaticBase {
static int statty;
+ static int grab_statty_base() { return statty; }
virtual ~StaticBase() {}
};
struct StaticDerived : StaticBase {
static int statty;
+ static int grab_statty_derived() { return statty; }
};
%}
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index 0c799c7d9..8272864d5 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -13,11 +13,13 @@ top_srcdir = ../@top_srcdir@
top_builddir = ../@top_builddir@
CPP_TEST_CASES = \
+ complextest \
csharp_attributes \
csharp_swig2_compatibility \
csharp_exceptions \
csharp_features \
csharp_lib_arrays \
+ csharp_lib_arrays_bool \
csharp_namespace_system_collision \
csharp_prepost \
csharp_typemaps \
@@ -25,9 +27,14 @@ CPP_TEST_CASES = \
enum_thorough_typesafe \
exception_partial_info \
intermediary_classname \
- li_boost_intrusive_ptr
+ li_boost_intrusive_ptr \
+ li_std_list \
CPP11_TEST_CASES = \
+ cpp11_shared_ptr_const \
+ cpp11_shared_ptr_nullptr_in_containers \
+ cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_upcast \
cpp11_strongly_typed_enumerations_simple \
include $(srcdir)/../common.mk
@@ -40,7 +47,9 @@ CSHARPFLAGSSPECIAL =
# Custom tests - tests with additional commandline options
intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname
+complextest.cpptest: CSHARPFLAGSSPECIAL = -r:System.Numerics.dll
csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
+csharp_lib_arrays_bool.cpptest: CSHARPFLAGSSPECIAL = -unsafe
csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP
# Rules for the different types of tests
diff --git a/Examples/test-suite/csharp/allprotected_runme.cs b/Examples/test-suite/csharp/allprotected_runme.cs
index 99a791d58..6b04feb25 100644
--- a/Examples/test-suite/csharp/allprotected_runme.cs
+++ b/Examples/test-suite/csharp/allprotected_runme.cs
@@ -13,6 +13,20 @@ public class runme
{
MyProtectedBase mpb = new MyProtectedBase("MyProtectedBase");
mpb.accessProtected();
+ try {
+ // C++ destructor is protected
+ mpb.Dispose();
+ throw new Exception("failed to catch MethodAccessException");
+ } catch (MethodAccessException) {
+ // Exception message: C++ destructor does not have public access
+ }
+ ProtectedDerived pd = new ProtectedDerived("ProtectedDerived");
+ // Destroying via the ProtectedDerived's destructor should work
+ pd.Dispose();
+
+ ProtectedBase pb = new ProtectedDerived("ProtectedDerived");
+ // ProtectedDerived's destructor should be called via the Dispose(disposing) virtual call
+ pb.Dispose();
}
}
diff --git a/Examples/test-suite/csharp/complextest_runme.cs b/Examples/test-suite/csharp/complextest_runme.cs
new file mode 100644
index 000000000..e7af9c106
--- /dev/null
+++ b/Examples/test-suite/csharp/complextest_runme.cs
@@ -0,0 +1,43 @@
+// This is the complex runtime testcase. It checks that the C++ std::complex type works.
+// It requires .NET 4.0 as the previous versions didn't have System.Numerics.Complex type.
+
+using System;
+using System.Numerics;
+
+using complextestNamespace;
+
+public class complextest_runme {
+
+ public static void Main() {
+ var a = new Complex(-1, 2);
+ if ( complextest.Conj(a) != Complex.Conjugate(a) )
+ throw new Exception("std::complex<double> test failed");
+
+ if ( complextest.Conjf(a) != Complex.Conjugate(a) )
+ throw new Exception("std::complex<float> test failed");
+
+ if ( complextest.Conj2(a) != Complex.Conjugate(a) )
+ throw new Exception("std::complex<double> test failed");
+
+ if ( complextest.Conjf2(a) != Complex.Conjugate(a) )
+ throw new Exception("std::complex<float> test failed");
+
+ var vec = new VectorStdCplx();
+ vec.Add(new Complex(1, 2));
+ vec.Add(new Complex(2, 3));
+ vec.Add(new Complex(4, 3));
+ vec.Add(new Complex(1, 0));
+
+ if ( complextest.CopyHalf(vec).Count != 2 )
+ throw new Exception("CopyHalf test failed");
+
+ if ( complextest.CopyHalfRef(vec).Count != 2 )
+ throw new Exception("CopyHalfRef test failed");
+
+ var p = new ComplexPair();
+ p.z1 = new Complex(0, 1);
+ p.z2 = new Complex(0, -1);
+ if ( Complex.Conjugate(p.z2) != p.z1 )
+ throw new Exception("vector<complex> test failed");
+ }
+}
diff --git a/Examples/test-suite/csharp/cpp11_li_std_array_runme.cs b/Examples/test-suite/csharp/cpp11_std_array_runme.cs
index d0c956ad3..ee7c5ee24 100644
--- a/Examples/test-suite/csharp/cpp11_li_std_array_runme.cs
+++ b/Examples/test-suite/csharp/cpp11_std_array_runme.cs
@@ -1,8 +1,8 @@
// This test tests all the methods in the C# collection wrapper
using System;
-using cpp11_li_std_arrayNamespace;
+using cpp11_std_arrayNamespace;
-public class cpp11_li_std_array_runme
+public class cpp11_std_array_runme
{
private static ArrayInt6 ToArray6(int[] a)
{
@@ -37,24 +37,24 @@ public class cpp11_li_std_array_runme
compareContainers(ai, vals);
// Check return
- compareContainers(cpp11_li_std_array.arrayOutVal(), new int[] { -2, -1, 0, 0, 1, 2 });
- compareContainers(cpp11_li_std_array.arrayOutConstRef(), new int[] { -2, -1, 0, 0, 1, 2 });
- compareContainers(cpp11_li_std_array.arrayOutRef(), new int[] { -2, -1, 0, 0, 1, 2 });
- compareContainers(cpp11_li_std_array.arrayOutPtr(), new int[] { -2, -1, 0, 0, 1, 2 });
+ compareContainers(cpp11_std_array.arrayOutVal(), new int[] { -2, -1, 0, 0, 1, 2 });
+ compareContainers(cpp11_std_array.arrayOutConstRef(), new int[] { -2, -1, 0, 0, 1, 2 });
+ compareContainers(cpp11_std_array.arrayOutRef(), new int[] { -2, -1, 0, 0, 1, 2 });
+ compareContainers(cpp11_std_array.arrayOutPtr(), new int[] { -2, -1, 0, 0, 1, 2 });
// Check passing arguments
- ai = cpp11_li_std_array.arrayInVal(ToArray6(new int[] { 9, 8, 7, 6, 5, 4 }));
+ ai = cpp11_std_array.arrayInVal(ToArray6(new int[] { 9, 8, 7, 6, 5, 4 }));
compareContainers(ai, new int[] { 90, 80, 70, 60, 50, 40 });
- ai = cpp11_li_std_array.arrayInConstRef(ToArray6(new int[] { 9, 8, 7, 6, 5, 4 }));
+ ai = cpp11_std_array.arrayInConstRef(ToArray6(new int[] { 9, 8, 7, 6, 5, 4 }));
compareContainers(ai, new int[] { 90, 80, 70, 60, 50, 40 });
ai = new ArrayInt6(ToArray6(new int[] { 9, 8, 7, 6, 5, 4 }));
- cpp11_li_std_array.arrayInRef(ai);
+ cpp11_std_array.arrayInRef(ai);
compareContainers(ai, new int[] { 90, 80, 70, 60, 50, 40 });
ai = new ArrayInt6(ToArray6(new int[] { 9, 8, 7, 6, 5, 4 }));
- cpp11_li_std_array.arrayInPtr(ai);
+ cpp11_std_array.arrayInPtr(ai);
compareContainers(ai, new int[] { 90, 80, 70, 60, 50, 40 });
// fill
diff --git a/Examples/test-suite/csharp/cpp17_nested_namespaces_runme.cs b/Examples/test-suite/csharp/cpp17_nested_namespaces_runme.cs
new file mode 100644
index 000000000..8707b4e20
--- /dev/null
+++ b/Examples/test-suite/csharp/cpp17_nested_namespaces_runme.cs
@@ -0,0 +1,25 @@
+using System;
+using cpp17_nested_namespacesNamespace;
+
+public class cpp17_nested_namespaces_runme
+{
+ static void Main()
+ {
+ new A1Struct().A1Method();
+ new B1Struct().B1Method();
+ new C1Struct().C1Method();
+ cpp17_nested_namespaces.createA1Struct().A1Method();
+ cpp17_nested_namespaces.createB1Struct().B1Method();
+ cpp17_nested_namespaces.createC1Struct().C1Method();
+
+ new B2Struct().B2Method();
+ new C2Struct().C2Method();
+ cpp17_nested_namespaces.createB2Struct().B2Method();
+ cpp17_nested_namespaces.createC2Struct().C2Method();
+
+ new B3Struct().B3Method();
+ new C3Struct().C3Method();
+ cpp17_nested_namespaces.createB3Struct().B3Method();
+ cpp17_nested_namespaces.createC3Struct().C3Method();
+ }
+}
diff --git a/Examples/test-suite/csharp/cpp17_nspace_nested_namespaces_runme.cs b/Examples/test-suite/csharp/cpp17_nspace_nested_namespaces_runme.cs
new file mode 100644
index 000000000..61a8287f4
--- /dev/null
+++ b/Examples/test-suite/csharp/cpp17_nspace_nested_namespaces_runme.cs
@@ -0,0 +1,25 @@
+using System;
+using cpp17_nspace_nested_namespacesNamespace;
+
+public class cpp17_nspace_nested_namespaces_runme
+{
+ static void Main()
+ {
+ new cpp17_nspace_nested_namespacesNamespace.A1.A1Struct().A1Method();
+ new cpp17_nspace_nested_namespacesNamespace.A1.B1.B1Struct().B1Method();
+ new cpp17_nspace_nested_namespacesNamespace.A1.B1.C1.C1Struct().C1Method();
+ cpp17_nspace_nested_namespaces.createA1Struct().A1Method();
+ cpp17_nspace_nested_namespaces.createB1Struct().B1Method();
+ cpp17_nspace_nested_namespaces.createC1Struct().C1Method();
+
+ new cpp17_nspace_nested_namespacesNamespace.A2.B2.B2Struct().B2Method();
+ new cpp17_nspace_nested_namespacesNamespace.A2.B2.C2.C2Struct().C2Method();
+ cpp17_nspace_nested_namespaces.createB2Struct().B2Method();
+ cpp17_nspace_nested_namespaces.createC2Struct().C2Method();
+
+ new cpp17_nspace_nested_namespacesNamespace.A3.B3.B3Struct().B3Method();
+ new cpp17_nspace_nested_namespacesNamespace.A3.B3.C3.C3Struct().C3Method();
+ cpp17_nspace_nested_namespaces.createB3Struct().B3Method();
+ cpp17_nspace_nested_namespaces.createC3Struct().C3Method();
+ }
+}
diff --git a/Examples/test-suite/csharp/csharp_lib_arrays_bool_runme.cs b/Examples/test-suite/csharp/csharp_lib_arrays_bool_runme.cs
new file mode 100644
index 000000000..3b19b576f
--- /dev/null
+++ b/Examples/test-suite/csharp/csharp_lib_arrays_bool_runme.cs
@@ -0,0 +1,90 @@
+using System;
+using csharp_lib_arrays_boolNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ {
+ bool[] source = { true, false, false, true, false, true, true, false };
+ bool[] target = new bool[ source.Length ];
+
+ csharp_lib_arrays_bool.myArrayCopyUsingFixedArraysBool( source, target, target.Length );
+ CompareArrays(source, target, "bool[] INPUT/OUTPUT Fixed");
+ }
+
+ {
+ bool[] source = { true, false, false, true, false, true, true, false };
+ bool[] target = { false, true, true, false, true, false, false, true };
+
+ csharp_lib_arrays_bool.myArraySwapUsingFixedArraysBool( source, target, target.Length );
+
+ for (int i=0; i<target.Length; ++i)
+ target[i] = !target[i];
+
+ CompareArrays(source, target, "bool[] INOUT");
+ }
+
+ if( runtimeIsMono() )
+ {
+// Console.Error.WriteLine("Tests are running on mono, failing bool[] tests skipped");
+// See Mono bug report https://github.com/mono/mono/issues/15592
+ return;
+ }
+
+ {
+ bool[] source = { true, false, false, true, false, true, true, false };
+ bool[] target = new bool[ source.Length ];
+
+ if( !csharp_lib_arrays_bool.checkBoolArrayCorrect( source, source.Length ) )
+ {
+ throw new Exception("bool[] INPUT incorrect");
+ }
+
+ csharp_lib_arrays_bool.myArrayCopyBool( source, target, target.Length );
+ CompareArrays(source, target, "bool[] INPUT/OUTPUT");
+ }
+
+ {
+ bool[] source = { true, false, false, true, false, true, true, false };
+ bool[] target = { false, true, true, false, true, false, false, true };
+
+ csharp_lib_arrays_bool.myArraySwapBool( source, target, target.Length );
+
+ for (int i=0; i<target.Length; ++i)
+ target[i] = !target[i];
+
+ CompareArrays(source, target, "bool[] INOUT");
+ }
+ }
+
+ static void CompareArrays<T>( T[] a, T[] b, string testName )
+ {
+ if (a.Length != b.Length)
+ throw new Exception("size mismatch");
+
+ for(int i=0; i<a.Length; ++i) {
+ if (a[i].Equals(b[i]) == false) {
+ Console.Error.WriteLine("C# Array mismatch: " + testName);
+ Console.Error.WriteLine("a:");
+ PrintArray(a);
+ Console.Error.WriteLine("b:");
+ PrintArray(b);
+ throw new Exception("element mismatch");
+ }
+ }
+ }
+
+ static void PrintArray<T>( T[] a )
+ {
+ foreach ( T i in a )
+ Console.Error.Write( "{0} ", i );
+ Console.Error.WriteLine();
+ }
+
+ static bool runtimeIsMono()
+ {
+ return Type.GetType ("Mono.Runtime") != null;
+ }
+}
+
diff --git a/Examples/test-suite/csharp/director_basic_runme.cs b/Examples/test-suite/csharp/director_basic_runme.cs
index b9916108c..de299b145 100644
--- a/Examples/test-suite/csharp/director_basic_runme.cs
+++ b/Examples/test-suite/csharp/director_basic_runme.cs
@@ -48,6 +48,36 @@ public class runme
if (myNewBar == null)
throw new Exception("non-null pointer marshalling problem");
myNewBar.x = 10;
+
+ // Low level implementation check
+// my.testSwigDerivedClassHasMethod();
+
+ // These should not call the C# implementations as they are not overridden
+ int v;
+ v = MyClass.call_nonVirtual(my);
+ if (v != 100) throw new Exception("call_nonVirtual broken() " + v);
+
+ v = MyClass.call_nonOverride(my);
+ if (v != 101) throw new Exception("call_nonOverride broken() " + v);
+
+ // A mix of overridden and non-overridden
+ MyClassEnd myend = new MyClassEnd();
+ MyClass mc = myend;
+
+ v = mc.nonVirtual();
+ if (v != 202) throw new Exception("mc.nonVirtual() broken " + v);
+
+ v = MyClass.call_nonVirtual(mc);
+ if (v != 202) throw new Exception("call_nonVirtual(mc) broken " + v);
+
+ v = MyClass.call_nonVirtual(myend);
+ if (v != 202) throw new Exception("call_nonVirtual(myend) broken" + v);
+
+ v = MyClass.call_nonOverride(mc);
+ if (v != 101) throw new Exception("call_nonOverride(mc) broken" + v);
+
+ v = MyClass.call_nonOverride(myend);
+ if (v != 101) throw new Exception("call_nonOverride(myend) broken" + v);
}
}
}
@@ -69,6 +99,30 @@ class MyOverriddenClass : MyClass {
throw new Exception("null not received as expected");
return b;
}
+
+ public new bool nonVirtual() {
+ throw new Exception("non-virtual overrides virtual method");
+ }
+
+ public new virtual bool nonOverride() {
+ throw new Exception("non-override overrides virtual method");
+ }
+}
+
+class MyClassMiddle : MyClass {
+ public override int nonVirtual() {
+ return 202;
+ }
+}
+
+class MyClassEnd : MyClassMiddle {
+ public new bool nonVirtual() {
+ throw new Exception("non-virtual overrides virtual method");
+ }
+
+ public new virtual bool nonOverride() {
+ throw new Exception("non-override overrides virtual method");
+ }
}
}
diff --git a/Examples/test-suite/csharp/director_classes_runme.cs b/Examples/test-suite/csharp/director_classes_runme.cs
index 112561464..700492fb1 100644
--- a/Examples/test-suite/csharp/director_classes_runme.cs
+++ b/Examples/test-suite/csharp/director_classes_runme.cs
@@ -16,6 +16,7 @@ Expected output if PrintDebug enabled:
Base - Val(444.555)
Base - Ref(444.555)
Base - Ptr(444.555)
+Base - ConstPtrRef(444.555)
Base - FullyOverloaded(int 10)
Base - FullyOverloaded(bool 1)
Base - SemiOverloaded(int -678)
@@ -26,6 +27,7 @@ Base - DefaultParms(10, 1.1)
Derived - Val(444.555)
Derived - Ref(444.555)
Derived - Ptr(444.555)
+Derived - ConstPtrRef(444.555)
Derived - FullyOverloaded(int 10)
Derived - FullyOverloaded(bool 1)
Derived - SemiOverloaded(int -678)
@@ -36,6 +38,7 @@ Derived - DefaultParms(10, 1.1)
CSharpDerived - Val(444.555)
CSharpDerived - Ref(444.555)
CSharpDerived - Ptr(444.555)
+CSharpDerived - ConstPtrRef(444.555)
CSharpDerived - FullyOverloaded(int 10)
CSharpDerived - FullyOverloaded(bool True)
CSharpDerived - SemiOverloaded(-678)
@@ -59,7 +62,7 @@ public class runme
void run()
{
- if (director_classes.PrintDebug) Console.WriteLine("------------ Start ------------ ");
+ if (director_classes.PrintDebug) Console.WriteLine("------------ Start ------------");
Caller myCaller = new Caller();
@@ -85,7 +88,7 @@ public class runme
makeCalls(myCaller, myBase);
}
- if (director_classes.PrintDebug) Console.WriteLine("------------ Finish ------------ ");
+ if (director_classes.PrintDebug) Console.WriteLine("------------ Finish ------------");
}
void makeCalls(Caller myCaller, Base myBase)
@@ -99,6 +102,7 @@ public class runme
if (myCaller.ValCall(dh).val != dh.val) throw new Exception("failed");
if (myCaller.RefCall(dh).val != dh.val) throw new Exception("failed");
if (myCaller.PtrCall(dh).val != dh.val) throw new Exception("failed");
+ if (myCaller.ConstPtrRefCall(dh).val != dh.val) throw new Exception("failed");
// Fully overloaded method test (all methods in base class are overloaded)
if (NAMESPACE + myCaller.FullyOverloadedCall(10) != myBase.GetType() + "::FullyOverloaded(int)") throw new Exception("failed");
@@ -142,6 +146,11 @@ public class CSharpDerived : Base
if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - Ptr({0})", x.val);
return x;
}
+ public override DoubleHolder ConstPtrRef(DoubleHolder x)
+ {
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - ConstPtrRef({0})", x.val);
+ return x;
+ }
public override String FullyOverloaded(int x)
{
if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - FullyOverloaded(int {0})", x);
diff --git a/Examples/test-suite/csharp/director_smartptr_runme.cs b/Examples/test-suite/csharp/director_smartptr_runme.cs
index 559dff7a0..33037a1da 100644
--- a/Examples/test-suite/csharp/director_smartptr_runme.cs
+++ b/Examples/test-suite/csharp/director_smartptr_runme.cs
@@ -26,6 +26,29 @@ public class runme
}
}
+ private class director_smartptr_MyBarFooDerived : FooDerived
+ {
+ public override string ping()
+ {
+ return "director_smartptr_MyBarFooDerived.ping()";
+ }
+
+ public override string pong()
+ {
+ return "director_smartptr_MyBarFooDerived.pong();" + ping();
+ }
+
+ public override string upcall(FooBar fooBarPtr)
+ {
+ return "overrideDerived;" + fooBarPtr.FooBarDo();
+ }
+
+ public override Foo makeFoo()
+ {
+ return new Foo();
+ }
+ }
+
private static void check(string got, string expected)
{
if (got != expected)
@@ -49,5 +72,11 @@ public class runme
Foo myFoo2 = new Foo().makeFoo();
check(myFoo2.pong(), "Foo::pong();Foo::ping()");
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
+
+ FooDerived myBarFooDerived = new director_smartptr_MyBarFooDerived();
+ check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()");
+ check(FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()");
+ check(FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()");
+
}
}
diff --git a/Examples/test-suite/csharp/li_boost_shared_ptr_director_runme.cs b/Examples/test-suite/csharp/li_boost_shared_ptr_director_runme.cs
new file mode 100644
index 000000000..0a03b7f10
--- /dev/null
+++ b/Examples/test-suite/csharp/li_boost_shared_ptr_director_runme.cs
@@ -0,0 +1,111 @@
+using System;
+using li_boost_shared_ptr_directorNamespace;
+
+public class li_boost_shared_ptr_director_runme {
+
+ private static void check(int got, int expected) {
+ if (got != expected)
+ throw new Exception("Failed, got: " + got + " expected: " + expected);
+ }
+
+ public static void Main() {
+ Derived a = new Derived(false);
+ Derived b = new Derived(true);
+
+ check(li_boost_shared_ptr_director.call_ret_c_shared_ptr(a), 1);
+ check(li_boost_shared_ptr_director.call_ret_c_shared_ptr(b), -1);
+ check(li_boost_shared_ptr_director.call_ret_c_by_value(a), 1);
+
+ check(li_boost_shared_ptr_director.call_ret_c_shared_ptr(a), 1);
+ check(li_boost_shared_ptr_director.call_ret_c_shared_ptr(b), -1);
+ check(li_boost_shared_ptr_director.call_ret_c_by_value(a), 1);
+
+ check(li_boost_shared_ptr_director.call_take_c_by_value(a), 5);
+ check(li_boost_shared_ptr_director.call_take_c_by_ref(a), 6);
+ check(li_boost_shared_ptr_director.call_take_c_by_pointer(a), 7);
+ check(li_boost_shared_ptr_director.call_take_c_by_pointer_ref(a), 8);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_value(a), 9);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_ref(a), 10);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_pointer(a), 11);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_pointer_ref(a), 12);
+
+ check(li_boost_shared_ptr_director.call_take_c_by_pointer_with_null(a), -2);
+ check(li_boost_shared_ptr_director.call_take_c_by_pointer_ref_with_null(a), -3);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_value_with_null(a), -4);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_ref_with_null(a), -5);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_pointer_with_null(a), -6);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_pointer_ref_with_null(a), -7);
+ }
+
+}
+
+class Derived : Base {
+
+ private bool return_none;
+
+ public Derived(bool flag) : base() {
+ this.return_none = flag;
+ }
+
+ public override C ret_c_shared_ptr() {
+ if (this.return_none)
+ return null;
+ else
+ return new C();
+ }
+
+ public override C ret_c_by_value() {
+ return new C();
+ }
+
+ public override int take_c_by_value(C c) {
+ return c.get_m();
+ }
+
+ public override int take_c_by_ref(C c) {
+ return c.get_m();
+ }
+
+ public override int take_c_by_pointer(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -2;
+ }
+
+ public override int take_c_by_pointer_ref(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -3;
+ }
+
+ public override int take_c_shared_ptr_by_value(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -4;
+ }
+
+ public override int take_c_shared_ptr_by_ref(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -5;
+ }
+
+ public override int take_c_shared_ptr_by_pointer(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -6;
+ }
+
+ public override int take_c_shared_ptr_by_pointer_ref(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -7;
+ }
+
+}
diff --git a/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs b/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs
index 1f66042a6..863b86701 100644
--- a/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs
+++ b/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs
@@ -19,6 +19,13 @@ public class li_std_auto_ptr_runme {
if (Klass.getTotal_count() != 2)
throw new Exception("number of objects should be 2");
+ using (Klass k3 = li_std_auto_ptr.makeKlassAutoPtr("second")) {
+ if (Klass.getTotal_count() != 3)
+ throw new Exception("number of objects should be 3");
+ }
+ if (Klass.getTotal_count() != 2)
+ throw new Exception("number of objects should be 2");
+
k1 = null;
{
int countdown = 500;
diff --git a/Examples/test-suite/csharp/li_std_list_runme.cs b/Examples/test-suite/csharp/li_std_list_runme.cs
new file mode 100644
index 000000000..1a5b1562d
--- /dev/null
+++ b/Examples/test-suite/csharp/li_std_list_runme.cs
@@ -0,0 +1,402 @@
+using System;
+using li_std_listNamespace;
+
+public class li_std_list_runme {
+ private static readonly int collectionSize = 20;
+
+ public static void Main() {
+ // Setup a list of int
+ IntList list = new IntList();
+ IntList.IntListNode node;
+
+ for (int i = 0; i < 20; i++) {
+ int nb = i * 10;
+ list.Add(nb);
+ }
+
+ // Count property test
+ if (list.Count != collectionSize)
+ throw new Exception("Count test failed");
+
+ // IsReadOnly property test
+ if (list.IsReadOnly)
+ throw new Exception("IsReadOnly test failed");
+
+ // Contains method test
+ if (!list.Contains(0))
+ throw new Exception("Contains method test 1 failed");
+ if (!list.Contains(2 * 10))
+ throw new Exception("Contains method test 2 failed");
+ if (!list.Contains(19 * 10))
+ throw new Exception("Contains method test 3 failed");
+ if (list.Contains(20 * 10))
+ throw new Exception("Contains method test 4 failed");
+
+ // Nodes comparison method overload
+ {
+ IntList.IntListNode temp = new IntList.IntListNode(3);
+ if (list.First == temp)
+ throw new Exception("== overload method test (1) failed");
+ temp = new IntList.IntListNode(0);
+ if (list.First == temp)
+ throw new Exception("== overload method test (2) failed");
+ IntList.IntListNode temp2 = new IntList.IntListNode(0);
+ if (temp == temp2)
+ throw new Exception("== overload method test (3) failed");
+ if (!(list.First == list.First))
+ throw new Exception("== overload method test (4) failed");
+ if (list.First != list.First)
+ throw new Exception("!= overload method test (1) failed");
+ if (!(temp != temp2))
+ throw new Exception("!= overload method test (2) failed");
+ if (list.First.Equals(temp))
+ throw new Exception("Equals method test failed");
+ if (list.First.GetHashCode() == temp.GetHashCode())
+ throw new Exception("GetHashCode method test (1) failed");
+ if (list.First.GetHashCode() == list.First.GetHashCode())
+ throw new Exception("GetHashCode method test (2) failed");
+
+ }
+
+ // Getter test
+ {
+ if (list.First == null)
+ throw new Exception("First getter test (1) failed");
+ if (list.Last == null)
+ throw new Exception("Last getter test (1) failed");
+ if (list.Last.Next != null)
+ throw new Exception("Next getter test (1) failed");
+ if (list.First.Next == null)
+ throw new Exception("Next getter test (2) failed");
+ if (list.First.Previous != null)
+ throw new Exception("Previous getter test (1) failed");
+ if (list.Last.Previous == null)
+ throw new Exception("Previous getter test (2) failed");
+ }
+
+ // AddFirst method test
+ node = list.AddFirst(34);
+ if (list.First.Value != 34 || node.Value != 34 || node != list.First)
+ throw new Exception("AddFirst method test failed");
+ try {
+ list.AddFirst(null);
+ } catch (ArgumentNullException) {
+ try {
+ list.AddFirst(list.First);
+ } catch (InvalidOperationException) {
+ }
+ }
+
+ // RemoveFirst method test
+ int tmp = list.First.Value;
+ list.RemoveFirst();
+ if (list.First.Value == tmp || list.First.Value != 0 * 10)
+ throw new Exception("RemoveFirst method test failed");
+
+ // AddLast method test
+ node = list.AddLast(8);
+ if (list.Last.Value != 8 || node.Value != 8 || node != list.Last)
+ throw new Exception("AddLast method test failed");
+ try {
+ list.AddLast(null);
+ } catch (ArgumentNullException) {
+ try {
+ list.AddLast(list.First);
+ } catch (InvalidOperationException) {
+ }
+ }
+
+ // RemoveLast method test
+ int tmp2 = list.Last.Value;
+ list.RemoveLast();
+ if (list.Last.Value == tmp2 || list.Last.Value != (list.Count - 1) * 10)
+ throw new Exception("RemoveLast method test failed");
+
+ // AddBefore method test
+ node = list.AddBefore(list.Last, 17);
+ if (list.Last.Previous.Value != 17 || node.Value != 17 || node != list.Last.Previous)
+ throw new Exception("AddBefore method test (1) failed");
+ try {
+ node = null;
+ list.AddBefore(list.Last, node);
+ throw new Exception("AddBefore method test (2) failed");
+ } catch (ArgumentNullException) {
+ try {
+ node = new IntList.IntListNode(1);
+ list.AddBefore(null, node);
+ throw new Exception("AddBefore method test (3) failed");
+ } catch (ArgumentNullException) {
+ try {
+ list.AddBefore(list.Last, list.First);
+ } catch (InvalidOperationException) {
+ }
+ }
+ }
+
+ // AddAfter method test
+ node = list.AddAfter(list.First, 47);
+ if (list.First.Next.Value != 47 || node.Value != 47 || node != list.First.Next)
+ throw new Exception("AddAfter method test (1) failed");
+ try {
+ node = null;
+ list.AddAfter(list.First.Next, node);
+ throw new Exception("AddAfter method test (2) failed");
+ } catch (ArgumentNullException) {
+ try {
+ list.AddAfter(list.First, list.Last);
+ } catch (InvalidOperationException) {
+ }
+ }
+
+ // Find method test
+ node = list.Find(0);
+ if (node == null || node.Value != 0)
+ throw new Exception("Find method test (1) failed");
+ node = list.Find(47);
+ if (node == null || node.Value != 47)
+ throw new Exception("Find method test (2) failed");
+ node = list.Find(190);
+ if (node == null || node.Value != 190)
+ throw new Exception("Find method test (3) failed");
+ node = list.Find(-3);
+ if (node != null)
+ throw new Exception("Find method test (4) failed");
+
+ // Remove method test
+ if (!list.Remove(17) || list.Contains(17) || list.Last.Previous.Value == 17)
+ throw new Exception("Remove method test (1) failed");
+ if (!list.Remove(47) || list.Contains(47) || list.First.Next.Value == 47)
+ throw new Exception("Remove method test (2) failed");
+ if (!list.Remove(0) || list.Contains(0) || list.First.Value == 0)
+ throw new Exception("Remove method test (3) failed");
+ if (!list.Remove(190) || list.Contains(190) || list.Last.Value == 190)
+ throw new Exception("Remove method test (4) failed");
+ try {
+ node = null;
+ list.Remove(node);
+ throw new Exception("Remove method test (5) failed");
+ } catch (ArgumentNullException) {
+ try {
+ node = new IntList.IntListNode(4);
+ list.Remove(node);
+ throw new Exception("Remove method test (5) failed");
+ } catch (InvalidOperationException) {
+ }
+ }
+
+ // ICollection constructor test
+ {
+ int[] intArray = new int[] { 0, 11, 22, 33, 44, 55, 33 };
+ IntList il = new IntList(intArray);
+ if (intArray.Length != il.Count)
+ throw new Exception("ICollection constructor length check failed: " + intArray.Length + "-" + il.Count);
+ node = il.First;
+ for (int i = 0; i < intArray.Length; i++) {
+ if (intArray[i] != node.Value)
+ throw new Exception("ICollection constructor failed, index:" + i);
+ node = node.Next;
+ }
+ try {
+ new IntList((System.Collections.ICollection)null);
+ throw new Exception("ICollection constructor null test failed");
+ } catch (ArgumentNullException) {
+ }
+ }
+
+ // Enumerator test
+ {
+ node = list.First;
+ System.Collections.IEnumerator myEnumerator = list.GetEnumerator();
+ while (myEnumerator.MoveNext()) {
+ if ((int)myEnumerator.Current != node.Value)
+ throw new Exception("Enumerator (1) test failed");
+ node = node.Next;
+ }
+ }
+ {
+ node = list.First;
+ System.Collections.Generic.IEnumerator<int> myEnumerator = list.GetEnumerator();
+ while (myEnumerator.MoveNext()) {
+ if (myEnumerator.Current != node.Value)
+ throw new Exception("Enumerator (2) test failed");
+ node = node.Next;
+ }
+ }
+ {
+ node = list.First;
+ IntList.IntListEnumerator myEnumerator = list.GetEnumerator();
+ while (myEnumerator.MoveNext()) {
+ if (myEnumerator.Current != node.Value)
+ throw new Exception("Enumerator (3) test failed");
+ node = node.Next;
+ }
+ }
+ {
+ node = list.First;
+ foreach (var elem in list) {
+ if (elem != node.Value)
+ throw new Exception("Enumerator (4) test failed");
+ node = node.Next;
+ }
+ }
+
+ // CopyTo method test
+ {
+ int[] outputarray = new int[collectionSize - 2];
+ list.CopyTo(outputarray, 0);
+ int index = 0;
+ IntList.IntListNode temp = list.First;
+ foreach (int val in outputarray) {
+ if (temp.Value != val) {
+ throw new Exception("CopyTo method test (1) failed, index:" + index);
+ }
+ index++;
+ temp = temp.Next;
+ }
+ }
+ {
+ DoubleList inputlist = new DoubleList();
+ int arrayLen = 10;
+ for (int i = 0; i < arrayLen; i++) {
+ double num = i * 10.1;
+ inputlist.Add(num);
+ }
+ double[] outputarray = new double[arrayLen];
+ inputlist.CopyTo(outputarray, 0);
+ DoubleList.DoubleListNode temp = inputlist.First;
+ for (int i = 0; i < arrayLen; i++) {
+ if (outputarray[i] != temp.Value)
+ throw new Exception("CopyTo method test (2) failed, index:" + i);
+ temp = temp.Next;
+ }
+ }
+ {
+ StructList inputlist = new StructList();
+ int arrayLen = 10;
+ for (int i = 0; i < arrayLen; i++)
+ inputlist.Add(new Struct(i / 10.0));
+ Struct[] outputarray = new Struct[arrayLen];
+ inputlist.CopyTo(outputarray, 0);
+ StructList.StructListNode temp = inputlist.First;
+ for (int i = 0; i < arrayLen; i++) {
+ if (outputarray[i].num != temp.Value.num)
+ throw new Exception("CopyTo method test (3) failed, index:" + i);
+ temp = temp.Next;
+ }
+ foreach (Struct s in inputlist) {
+ s.num += 20.0;
+ }
+ temp = inputlist.First;
+ for (int i = 0; i < arrayLen; i++) {
+ if (outputarray[i].num != temp.Value.num)
+ throw new Exception("CopyTo method test (4) failed, index:" + i);
+ temp = temp.Next;
+ }
+ }
+ try {
+ list.CopyTo(null, 0);
+ throw new Exception("CopyTo method test (5) failed");
+ } catch (ArgumentNullException) {
+ }
+
+ // Clear() test
+ list.Clear();
+ if (list.Count != 0)
+ throw new Exception("Clear method failed");
+
+ // Finally test the methods being wrapped
+ {
+ IntList il = new IntList();
+ for (int i = 0; i < 4; i++) {
+ il.Add(i);
+ }
+
+ double x = li_std_list.average(il);
+ x += li_std_list.average(new IntList(new int[] { 1, 2, 3, 4 }));
+
+ DoubleList dlist = new DoubleList();
+ for (int i = 0; i < 10; i++) {
+ dlist.Add(i / 2.0);
+ }
+ li_std_list.halve_in_place(dlist);
+ }
+
+ // Dispose()
+ {
+ using (StructList ls = new StructList(new Struct[] { new Struct(0.0), new Struct(11.1) }))
+ using (DoubleList ld = new DoubleList(new double[] { 0.0, 11.1 })) { }
+ }
+
+ // More wrapped methods
+ {
+ FloatList l0 = li_std_list.listreal(new FloatList());
+ float flo = 123.456f;
+ l0.Add(flo);
+ flo = l0.First.Value;
+
+ IntList l1 = li_std_list.listint(new IntList());
+ IntPtrList l2 = li_std_list.listintptr(new IntPtrList());
+ IntConstPtrList l3 = li_std_list.listintconstptr(new IntConstPtrList());
+
+ l1.Add(123);
+ l2.Clear();
+ l3.Clear();
+
+ StructList l4 = li_std_list.liststruct(new StructList());
+ StructPtrList l5 = li_std_list.liststructptr(new StructPtrList());
+ StructConstPtrList l6 = li_std_list.liststructconstptr(new StructConstPtrList());
+
+ l4.Add(new Struct(123));
+ l5.Add(new Struct(123));
+ l6.Add(new Struct(123));
+ }
+
+ // Test lists of pointers
+ {
+ StructPtrList inputlist = new StructPtrList();
+ int arrayLen = 10;
+ for (int i = 0; i < arrayLen; i++) {
+ inputlist.Add(new Struct(i / 10.0));
+ }
+ Struct[] outputarray = new Struct[arrayLen];
+ inputlist.CopyTo(outputarray, 0);
+ StructPtrList.StructPtrListNode temp = inputlist.First;
+ for (int i = 0; i < arrayLen; i++) {
+ if (outputarray[i].num != temp.Value.num)
+ throw new Exception("StructPtrList test (1) failed, i:" + i);
+ temp = temp.Next;
+ }
+ foreach (Struct s in inputlist) {
+ s.num += 20.0;
+ }
+ for (int i = 0; i < arrayLen; i++) {
+ if (outputarray[i].num != 20.0 + i / 10.0)
+ throw new Exception("StructPtrList test (2) failed (a deep copy was incorrectly made), i:" + i);
+ }
+ }
+
+ // Test lists of const pointers
+ {
+ StructConstPtrList inputlist = new StructConstPtrList();
+ int arrayLen = 10;
+ for (int i = 0; i < arrayLen; i++) {
+ inputlist.Add(new Struct(i / 10.0));
+ }
+ Struct[] outputarray = new Struct[arrayLen];
+ inputlist.CopyTo(outputarray, 0);
+ StructConstPtrList.StructConstPtrListNode temp = inputlist.First;
+ for (int i = 0; i < arrayLen; i++) {
+ if (outputarray[i].num != temp.Value.num)
+ throw new Exception("StructConstPtrList test (1) failed, i:" + i);
+ temp = temp.Next;
+ }
+ foreach (Struct s in inputlist) {
+ s.num += 20.0;
+ }
+ for (int i = 0; i < arrayLen; i++) {
+ if (outputarray[i].num != 20.0 + i / 10.0)
+ throw new Exception("StructConstPtrList test (2) failed (a deep copy was incorrectly made), i:" + i);
+ }
+ }
+ }
+}
diff --git a/Examples/test-suite/csharp/li_std_map_runme.cs b/Examples/test-suite/csharp/li_std_map_runme.cs
index 0fe1ab5cd..51510c9fc 100644
--- a/Examples/test-suite/csharp/li_std_map_runme.cs
+++ b/Examples/test-suite/csharp/li_std_map_runme.cs
@@ -18,7 +18,7 @@ public class li_std_map_runme {
public static void Main()
{
- // Set up an int int map
+ // Set up an string to int map
StringIntMap simap = new StringIntMap();
for (int i = 0; i < collectionSize; i++)
{
@@ -240,6 +240,20 @@ public class li_std_map_runme {
throw new Exception("Key test (2) on complex key map failed");
}
+ // Custom compare function
+ {
+ StringLengthNumberMap slmap = new StringLengthNumberMap();
+ li_std_map.populate(slmap);
+
+ string keys = string.Join(" ", new List<string>(slmap.Keys));
+ if (keys != "a aa zzz xxxx aaaaa")
+ throw new Exception("Keys are wrong or in wrong order: " + keys);
+
+ string values = string.Join(" ", new List<int>(slmap.Values));
+ if (values != "1 2 3 4 5")
+ throw new Exception("Values are wrong or in wrong order: " + values);
+ }
+
// All done
}
}
diff --git a/Examples/test-suite/csharp/li_std_set_runme.cs b/Examples/test-suite/csharp/li_std_set_runme.cs
new file mode 100644
index 000000000..e9cd2c271
--- /dev/null
+++ b/Examples/test-suite/csharp/li_std_set_runme.cs
@@ -0,0 +1,105 @@
+using System;
+using System.Collections.Generic;
+using li_std_setNamespace;
+
+public class runme
+{
+ static void checkThat(bool mustBeTrue, string message)
+ {
+ if (!mustBeTrue)
+ throw new Exception("Test that the set " + message + " failed");
+ }
+
+ static void Main()
+ {
+ StringSet ss = new StringSet();
+
+ // Check the interface methods first.
+ ISet<string> s = ss;
+
+ checkThat(s.Count == 0, "is initially empty");
+ checkThat(!s.Contains("key"), "doesn't contain inexistent element");
+ checkThat(!s.Remove("key"), "returns false when removing inexistent element");
+
+ checkThat(s.Add("key"), "returns true when adding a new element");
+ checkThat(!s.Add("key"), "returns false when adding an existing element");
+ checkThat(s.Contains("key"), "contains the just added element");
+ checkThat(s.Remove("key"), "returns true when removing an existing element");
+ checkThat(s.Count == 0, "is empty again");
+
+ checkThat(s.Add("key1"), "Add(key1) returns true");
+ checkThat(s.Add("key2"), "Add(key2) returns true");
+ checkThat(s.Add("key3"), "Add(key3) returns true");
+
+ // Also check a different interface, providing a different Add() (sic!).
+ ICollection<string> coll = ss;
+ coll.Add("key");
+ checkThat(ss.Count == 4, "contains 4 elements");
+
+ // Now use object-specific methods, mimicking HashSet<>.
+ string val;
+ checkThat(ss.TryGetValue("key1", out val), "could retrieve existing item");
+ checkThat(val.Equals("key1"), "value was returned correctly by TryGetValue()");
+ checkThat(!ss.TryGetValue("no-such-key", out val), "couldn't retrieve inexistent item");
+ checkThat(val == null, "value was reset after failed TryGetValue()");
+
+ IList<string> list = new List<string>();
+ foreach (string str in ss) {
+ list.Add(str);
+ }
+ checkThat(list.Count == 4, "copy contains 4 elements");
+
+ ss.Clear();
+ checkThat(ss.Count == 0, "is empty after Clear()");
+
+ // Check set-theoretic methods.
+ checkThat(new StringSet().SetEquals(new StringSet()), "SetEquals() works for empty sets");
+ checkThat(new StringSet{"foo"}.SetEquals(new StringSet{"foo"}), "SetEquals() works for non-empty sets");
+ checkThat(!new StringSet{"foo"}.SetEquals(new[] {"bar"}), "SetEquals() doesn't always return true");
+
+ ss = new StringSet{"foo", "bar", "baz"};
+ ss.ExceptWith(new[] {"baz", "quux"});
+ checkThat(ss.SetEquals(new[] {"foo", "bar"}), "ExceptWith works");
+
+ ss = new StringSet{"foo", "bar", "baz"};
+ ss.IntersectWith(new[] {"baz", "quux"});
+ checkThat(ss.SetEquals(new[] {"baz"}), "IntersectWith works");
+
+ checkThat(ss.IsProperSubsetOf(new[] {"bar", "baz"}), "IsProperSubsetOf works");
+ checkThat(!ss.IsProperSubsetOf(new[] {"baz"}), "!IsProperSubsetOf works");
+ checkThat(ss.IsSubsetOf(new[] {"bar", "baz"}), "IsSubsetOf works");
+ checkThat(!ss.IsSubsetOf(new[] {"bar"}), "!IsSubsetOf works");
+
+ ss = new StringSet{"foo", "bar", "baz"};
+ checkThat(ss.IsProperSupersetOf(new[] {"bar"}), "IsProperSupersetOf works");
+ checkThat(!ss.IsProperSupersetOf(new[] {"quux"}), "IsProperSupersetOf works");
+ checkThat(ss.IsSupersetOf(new[] {"foo", "bar", "baz"}), "IsProperSupersetOf works");
+ checkThat(!ss.IsSupersetOf(new[] {"foo", "bar", "baz", "quux"}), "IsProperSupersetOf works");
+
+ checkThat(ss.Overlaps(new[] {"foo"}), "Overlaps works");
+ checkThat(!ss.Overlaps(new[] {"moo"}), "!Overlaps works");
+
+ ss.SymmetricExceptWith(new[] {"baz", "quux"});
+ checkThat(ss.SetEquals(new[] {"foo", "bar", "quux"}), "SymmetricExceptWith works");
+
+ ss = new StringSet{"foo", "bar", "baz"};
+ ss.UnionWith(new[] {"baz", "quux"});
+ checkThat(ss.SetEquals(new[] {"foo", "bar", "baz", "quux"}), "UnionWith works");
+
+ // Check a set of another type.
+ FooSet fooSet = new FooSet();
+ ISet<Foo> fooISet = fooSet;
+ checkThat(fooISet.Count == 0, "is initially empty");
+ checkThat(fooISet.Add(new Foo(17)), "added successfully");
+ checkThat(fooISet.Count == 1, "is not empty any more");
+
+ // And a set of primitive type.
+ IntSet intSet = new IntSet();
+ checkThat(intSet.Count == 0, "is initially empty");
+ checkThat(intSet.Add(17), "17 added successfully");
+ checkThat(!intSet.Add(17), "17 not added again");
+ checkThat(intSet.Count == 1, "not empty any more");
+ checkThat(intSet.Add(289), "289 added successfully");
+ checkThat(intSet.Count == 2, "even less empty now");
+ }
+}
diff --git a/Examples/test-suite/csharp/li_std_vector_runme.cs b/Examples/test-suite/csharp/li_std_vector_runme.cs
index fa8700d89..0c6211ca5 100644
--- a/Examples/test-suite/csharp/li_std_vector_runme.cs
+++ b/Examples/test-suite/csharp/li_std_vector_runme.cs
@@ -121,7 +121,7 @@ public class li_std_vector_runme {
throw new Exception("Contains test 4 failed");
{
- // ICollection constructor
+ // IEnumerable constructor
double[] doubleArray = new double[] { 0.0, 11.1, 22.2, 33.3, 44.4, 55.5, 33.3 };
DoubleVector dv = new DoubleVector(doubleArray);
if (doubleArray.Length != dv.Count)
@@ -177,6 +177,17 @@ public class li_std_vector_runme {
if (doubleArray[i] != dvCopy[i])
throw new Exception("Copy constructor failed, index:" + i);
}
+ if (dvCopy.Count != doubleArray.Length)
+ throw new Exception("Copy constructor lengths mismatch");
+
+ // ToArray test
+ double[] dvArray = dv.ToArray();
+ for (int i=0; i<doubleArray.Length; i++) {
+ if (doubleArray[i] != dvArray[i])
+ throw new Exception("ToArray failed, index:" + i);
+ }
+ if (dvArray.Length != doubleArray.Length)
+ throw new Exception("ToArray lengths mismatch");
}
{
// Repeat() test
@@ -619,6 +630,55 @@ public class li_std_vector_runme {
}
}
+ // Test construction
+ {
+ string[] one_two_three = new string[] { "one", "two", "three" };
+
+ // Test construction from array
+ {
+ string[] collection = one_two_three;
+ check123(new StringVector(collection));
+ }
+
+ // Test construction from IEnumerable
+ {
+ global::System.Collections.IEnumerable collection = one_two_three;
+ check123(new StringVector(collection));
+ }
+
+ // Test construction from IEnumerable<>
+ {
+ global::System.Collections.Generic.IEnumerable<string> collection = one_two_three;
+ check123(new StringVector(collection));
+ }
+
+ // Test construction from IList<>
+ {
+ global::System.Collections.Generic.IList<string> collection = one_two_three;
+ check123(new StringVector(collection));
+ }
+
+ // Test construction from ICollection
+ {
+ global::System.Collections.ICollection collection = one_two_three;
+ check123(new StringVector(collection));
+ }
+
+ // Test construction from ICollection<>
+ {
+ global::System.Collections.Generic.ICollection<string> collection = new global::System.Collections.Generic.List<string>(one_two_three);
+ check123(new StringVector(collection));
+ }
+ }
+
+ }
+
+ private static void check123(StringVector stringv) {
+ string concatenated = "";
+ foreach (string s in stringv)
+ concatenated = concatenated + s;
+ if (concatenated != "onetwothree")
+ throw new Exception("concatenated string failed: " + concatenated);
}
}
diff --git a/Examples/test-suite/csharp/li_std_wstring_runme.cs b/Examples/test-suite/csharp/li_std_wstring_runme.cs
index fe663a3e0..8b7ba1b30 100644
--- a/Examples/test-suite/csharp/li_std_wstring_runme.cs
+++ b/Examples/test-suite/csharp/li_std_wstring_runme.cs
@@ -3,74 +3,116 @@ using li_std_wstringNamespace;
public class runme
{
- static void Main()
+ static private void check_equal(char a, char b)
{
- char y='h';
-
- if (li_std_wstring.test_wcvalue(y) != y)
- throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue(y));
-
- if (li_std_wstring.test_wcvalue_w() != 'W')
- throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue_w());
-
- string x="hello";
-
- if (li_std_wstring.test_ccvalue(x) != x)
- throw new Exception("bad string mapping");
-
- if (li_std_wstring.test_cvalue(x) != x)
- throw new Exception("bad string mapping");
-
-
- if (li_std_wstring.test_value(x) != x)
- throw new Exception("bad string mapping: " + x + li_std_wstring.test_value(x));
-
- if (li_std_wstring.test_const_reference(x) != x)
- throw new Exception("bad string mapping");
-
-
- string s = "he";
- s = s + "llo";
-
- if (s != x)
- throw new Exception("bad string mapping: " + s + x);
-
- if (li_std_wstring.test_value(s) != x)
- throw new Exception("bad string mapping");
-
- if (li_std_wstring.test_const_reference(s) != x)
- throw new Exception("bad string mapping");
-
- string a = s;
-
- if (li_std_wstring.test_value(a) != x)
- throw new Exception("bad string mapping");
-
- if (li_std_wstring.test_const_reference(a) != x)
- throw new Exception("bad string mapping");
-
- string b = " world";
-
- if (a + b != "hello world")
- throw new Exception("bad string mapping");
-
- if (a + " world" != "hello world")
- throw new Exception("bad string mapping");
-
- if ("hello" + b != "hello world")
- throw new Exception("bad string mapping");
-
- s = "hello world";
-
- B myB = new B("hi");
+ if (a != b)
+ throw new Exception("char failed '" + a + "' != '" + b + "'");
+ }
- myB.name = "hello";
- if (myB.name != "hello")
- throw new Exception("bad string mapping");
+ static private void check_equal(string a, string b)
+ {
+ if (a != b)
+ throw new Exception("string failed '" + a + "' != '" + b + "'");
+ }
- myB.a = "hello";
- if (myB.a != "hello")
- throw new Exception("bad string mapping");
+ static void Main()
+ {
+ char h = 'h';
+ check_equal(li_std_wstring.test_wcvalue(h), h);
+
+ string x = "abc";
+ check_equal(li_std_wstring.test_ccvalue(x), x);
+ check_equal(li_std_wstring.test_cvalue(x), x);
+
+ check_equal(li_std_wstring.test_wchar_overload(x), x);
+ check_equal(li_std_wstring.test_wchar_overload(), null);
+
+ li_std_wstring.test_pointer(null);
+ li_std_wstring.test_const_pointer(null);
+
+ try {
+ li_std_wstring.test_value(null);
+ throw new Exception("NULL check failed");
+ } catch (ArgumentNullException) {
+ }
+
+ try {
+ li_std_wstring.test_reference(null);
+ throw new Exception("NULL check failed");
+ } catch (ArgumentNullException e) {
+ if (!e.Message.Contains("type is null"))
+ throw new Exception("Missing text " + e);
+ }
+ try {
+ li_std_wstring.test_const_reference(null);
+ throw new Exception("NULL check failed");
+ } catch (ArgumentNullException e) {
+ if (!e.Message.Contains("null wstring"))
+ throw new Exception("Missing text " + e);
+ }
+
+ x = "hello";
+ check_equal(li_std_wstring.test_const_reference(x), x);
+
+ /* Postpone, tricky, std::wstring portability problem.
+ * std::wstring is 2 bytes on Windows, 4 bytes on Linux, LPWSTR is 2 bytes.
+ * .NET marshalling should work on Windows but not Linux.
+ string s = "abc";
+ if (!li_std_wstring.test_equal_abc(s))
+ throw new Exception("Not equal " + s);
+ */
+
+ try {
+ li_std_wstring.test_throw();
+ } catch (Exception e) {
+ check_equal(e.Message, "throwing test_throw");
+ }
+
+ x = "abc\0def";
+ // Unlike other languages, embedded NULL in std::string not supported
+ // check_equal(li_std_wstring.test_value(x), x);
+ check_equal(li_std_wstring.test_value(x), "abc");
+ check_equal(li_std_wstring.test_ccvalue(x), "abc");
+ check_equal(li_std_wstring.test_wchar_overload(x), "abc");
+
+ {
+ // Unicode strings
+ string[] test_strings = {
+ "JP: 日本語", "DE: Kröpeliner Straße" , "RU: Война и мир", "EN: War and Peace"
+ };
+
+ foreach (string expected in test_strings)
+ {
+ string received = li_std_wstring.test_value(expected);
+ check_equal(received, expected);
+ }
+
+ foreach (string expected in test_strings)
+ {
+ string received = li_std_wstring.test_const_reference(expected);
+ check_equal(received, expected);
+ }
+
+ foreach (string expected in test_strings)
+ {
+ string received = li_std_wstring.test_ccvalue(expected);
+ check_equal(received, expected);
+ }
+
+ /* Not working for Japanese and Russian characters on Windows, okay on Linux
+ * Is fixed by adding CharSet=CharSet.Unicode to the DllImport, so change to:
+ * [global::System.Runtime.InteropServices.DllImport("li_std_wstring", CharSet=global::System.Runtime.InteropServices.CharSet.Unicode, EntryPoint="CSharp_li_std_wstringNamespace_test_wcvalue")]
+ * Needs a SWIG code change to support this
+ foreach (string test_string in test_strings)
+ {
+ foreach (char expected in test_string)
+ {
+ char received = li_std_wstring.test_wcvalue(expected);
+ check_equal(received, expected);
+ }
+ }
+ */
+ }
}
}
diff --git a/Examples/test-suite/csharp/nested_in_template_runme.cs b/Examples/test-suite/csharp/nested_in_template_runme.cs
new file mode 100644
index 000000000..e57e03999
--- /dev/null
+++ b/Examples/test-suite/csharp/nested_in_template_runme.cs
@@ -0,0 +1,10 @@
+using System;
+using nested_in_templateNamespace;
+
+public class runme {
+ static void Main() {
+ var cd = new OuterTemplate1.ConcreteDerived(88);
+ if (cd.m_value != 88)
+ throw new Exception("ConcreteDerived not created correctly");
+ }
+}
diff --git a/Examples/test-suite/csharp/nested_inheritance_interface_runme.cs b/Examples/test-suite/csharp/nested_inheritance_interface_runme.cs
new file mode 100644
index 000000000..810b7db6d
--- /dev/null
+++ b/Examples/test-suite/csharp/nested_inheritance_interface_runme.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using nested_inheritance_interfaceNamespace;
+
+public class nested_inheritance_interface_runme {
+
+ static string SortArrayToString(string[] types) {
+ Array.Sort<string>(types);
+ return string.Join(" ", types);
+ }
+
+ static string SortArrayToString(Type[] types) {
+ List<string> stypes = new List<string>();
+ foreach (Type t in types)
+ stypes.Add(t.Name);
+ return SortArrayToString(stypes.ToArray());
+ }
+
+ private static void takeIA(IASwigInterface ia) {
+ }
+
+ public static void Main() {
+ Type[] BNInterfaces = typeof(B.N).GetInterfaces();
+ string expectedInterfacesString = "IASwigInterface IDisposable";
+ string actualInterfacesString = SortArrayToString(BNInterfaces);
+ if (expectedInterfacesString != actualInterfacesString)
+ throw new Exception("Expected interfaces for " + typeof(B.N).Name + ": \n" + expectedInterfacesString + "\n" + "Actual interfaces: \n" + actualInterfacesString);
+
+ if (!typeof(IASwigInterface).IsInterface)
+ throw new Exception(typeof(IASwigInterface).Name + " should be an interface but is not");
+
+ // overloaded methods check
+ B.N d = new B.N();
+ takeIA(d);
+ }
+}
diff --git a/Examples/test-suite/csharp/preproc_constants_c_runme.cs b/Examples/test-suite/csharp/preproc_constants_c_runme.cs
index 76c684d85..5966d5266 100644
--- a/Examples/test-suite/csharp/preproc_constants_c_runme.cs
+++ b/Examples/test-suite/csharp/preproc_constants_c_runme.cs
@@ -36,7 +36,7 @@ public class runme {
assert( typeof(string) == preproc_constants_c.CONST_STRING2.GetType() );
assert( typeof(int) == preproc_constants_c.INT_AND_BOOL.GetType() );
-// assert( typeof(int) == preproc_constants_c.INT_AND_CHAR.GetType() );
+ assert( typeof(int) == preproc_constants_c.INT_AND_CHAR.GetType() );
assert( typeof(int) == preproc_constants_c.INT_AND_INT.GetType() );
assert( typeof(uint) == preproc_constants_c.INT_AND_UINT.GetType() );
assert( typeof(int) == preproc_constants_c.INT_AND_LONG.GetType() );
@@ -61,7 +61,9 @@ public class runme {
assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() );
assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() );
assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() );
-
+ assert( typeof(double) == preproc_constants_c.EXPR_MIXED1.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MAX.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MIN.GetType() );
}
static void assert(bool assertion) {
if (!assertion)
diff --git a/Examples/test-suite/csharp/preproc_constants_runme.cs b/Examples/test-suite/csharp/preproc_constants_runme.cs
index 9fae5914a..6af8f20a4 100644
--- a/Examples/test-suite/csharp/preproc_constants_runme.cs
+++ b/Examples/test-suite/csharp/preproc_constants_runme.cs
@@ -35,7 +35,7 @@ public class runme {
assert( typeof(string) == preproc_constants.CONST_STRING2.GetType() );
assert( typeof(int) == preproc_constants.INT_AND_BOOL.GetType() );
-// assert( typeof(int) == preproc_constants.INT_AND_CHAR.GetType() );
+ assert( typeof(int) == preproc_constants.INT_AND_CHAR.GetType() );
assert( typeof(int) == preproc_constants.INT_AND_INT.GetType() );
assert( typeof(uint) == preproc_constants.INT_AND_UINT.GetType() );
assert( typeof(int) == preproc_constants.INT_AND_LONG.GetType() );
@@ -60,6 +60,9 @@ public class runme {
assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() );
assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() );
assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() );
+ assert( typeof(double) == preproc_constants.EXPR_MIXED1.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_WCHAR_MAX.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_WCHAR_MIN.GetType() );
}
static void assert(bool assertion) {
diff --git a/Examples/test-suite/csharp_exceptions.i b/Examples/test-suite/csharp_exceptions.i
index e5b4d495b..71581480e 100644
--- a/Examples/test-suite/csharp_exceptions.i
+++ b/Examples/test-suite/csharp_exceptions.i
@@ -1,5 +1,11 @@
%module csharp_exceptions
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+%{
+#define TESTCASE_THROW1(T1)
+%}
+
%include <exception.i>
%inline %{
@@ -36,21 +42,16 @@
}
%inline %{
-
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
// %exception tests
void ThrowByValue() { throw Ex("ThrowByValue"); }
void ThrowByReference() { throw Ex("ThrowByReference"); }
// %csnothrowexception
void NoThrowException() { throw Ex("NoThrowException"); }
// exception specifications
-void ExceptionSpecificationValue() throw(Ex) { throw Ex("ExceptionSpecificationValue"); }
-void ExceptionSpecificationReference() throw(Ex&) { throw Ex("ExceptionSpecificationReference"); }
-void ExceptionSpecificationString() throw(const char *) { throw "ExceptionSpecificationString"; }
-void ExceptionSpecificationInteger() throw(int) { throw 20; }
+void ExceptionSpecificationValue() TESTCASE_THROW1(Ex) { throw Ex("ExceptionSpecificationValue"); }
+void ExceptionSpecificationReference() TESTCASE_THROW1(Ex&) { throw Ex("ExceptionSpecificationReference"); }
+void ExceptionSpecificationString() TESTCASE_THROW1(const char *) { throw "ExceptionSpecificationString"; }
+void ExceptionSpecificationInteger() TESTCASE_THROW1(int) { throw 20; }
%}
// test exceptions in the default typemaps
@@ -64,15 +65,15 @@ void NullValue(Ex e) {}
// enums
%inline %{
enum TestEnum {TestEnumItem};
-void ExceptionSpecificationEnumValue() throw(TestEnum) { throw TestEnumItem; }
-void ExceptionSpecificationEnumReference() throw(TestEnum&) { throw TestEnumItem; }
+void ExceptionSpecificationEnumValue() TESTCASE_THROW1(TestEnum) { throw TestEnumItem; }
+void ExceptionSpecificationEnumReference() TESTCASE_THROW1(TestEnum&) { throw TestEnumItem; }
%}
// std::string
%include <std_string.i>
%inline %{
-void ExceptionSpecificationStdStringValue() throw(std::string) { throw std::string("ExceptionSpecificationStdStringValue"); }
-void ExceptionSpecificationStdStringReference() throw(const std::string&) { throw std::string("ExceptionSpecificationStdStringReference"); }
+void ExceptionSpecificationStdStringValue() TESTCASE_THROW1(std::string) { throw std::string("ExceptionSpecificationStdStringValue"); }
+void ExceptionSpecificationStdStringReference() TESTCASE_THROW1(const std::string&) { throw std::string("ExceptionSpecificationStdStringReference"); }
void NullStdStringValue(std::string s) {}
void NullStdStringReference(std::string &s) {}
%}
@@ -104,12 +105,8 @@ void MemoryLeakCheck() {
%inline %{
struct constructor {
constructor(std::string s) {}
- constructor() throw(int) { throw 10; }
+ constructor() TESTCASE_THROW1(int) { throw 10; }
};
-
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
%}
// test exception pending in the csout typemaps
@@ -239,3 +236,4 @@ struct ThrowsClass {
%inline %{
void InnerExceptionTest() { throw Ex("My InnerException message"); }
%}
+
diff --git a/Examples/test-suite/csharp_lib_arrays_bool.i b/Examples/test-suite/csharp_lib_arrays_bool.i
new file mode 100644
index 000000000..58cee9d80
--- /dev/null
+++ b/Examples/test-suite/csharp_lib_arrays_bool.i
@@ -0,0 +1,78 @@
+%module csharp_lib_arrays_bool
+
+%include "arrays_csharp.i"
+
+%apply bool INPUT[] { bool* sourceArray }
+%apply bool OUTPUT[] { bool* targetArray }
+
+%apply bool INOUT[] { bool* array1 }
+%apply bool INOUT[] { bool* array2 }
+
+%inline %{
+#include <iostream>
+
+/* copy the contents of the first array to the second */
+void myArrayCopyBool( bool* sourceArray, bool* targetArray, int nitems ) {
+ int i;
+ for ( i = 0; i < nitems; i++ ) {
+ targetArray[ i ] = sourceArray[ i ];
+ }
+}
+
+/* swap the contents of the two arrays */
+void myArraySwapBool( bool* array1, bool* array2, int nitems ) {
+ int i;
+ bool temp;
+ for ( i = 0; i < nitems; i++ ) {
+ temp = array1[ i ];
+ array1[ i ] = array2[ i ];
+ array2[ i ] = temp;
+ }
+}
+
+bool checkBoolArrayCorrect( bool* sourceArray, int sourceArraySize ) {
+ if( sourceArraySize != 8 ) {
+ std::cout << "checkBoolArrayCorrect: Expected array with 8 elements" << std::endl;
+ return false;
+ }
+ return sourceArray[0] == true &&
+ sourceArray[1] == false &&
+ sourceArray[2] == false &&
+ sourceArray[3] == true &&
+ sourceArray[4] == false &&
+ sourceArray[5] == true &&
+ sourceArray[6] == true &&
+ sourceArray[7] == false;
+}
+%}
+
+%clear bool* sourceArray;
+%clear bool* targetArray;
+
+%clear bool* array1;
+%clear bool* array2;
+
+// Below replicates the above array handling but this time using the pinned (fixed) array typemaps
+%csmethodmodifiers myArrayCopyUsingFixedArraysBool "public unsafe";
+%csmethodmodifiers myArraySwapUsingFixedArraysBool "public unsafe";
+
+%apply bool FIXED[] { bool* sourceArray }
+%apply bool FIXED[] { bool* targetArray }
+
+%inline %{
+void myArrayCopyUsingFixedArraysBool( bool *sourceArray, bool* targetArray, int nitems ) {
+ myArrayCopyBool(sourceArray, targetArray, nitems);
+}
+%}
+
+%apply bool FIXED[] { bool* array1 }
+%apply bool FIXED[] { bool* array2 }
+
+%inline %{
+void myArraySwapUsingFixedArraysBool( bool* array1, bool* array2, int nitems ) {
+ myArraySwapBool(array1, array2, nitems);
+}
+%}
+
+
+
diff --git a/Examples/test-suite/d/Makefile.in b/Examples/test-suite/d/Makefile.in
index 3333df110..a20cfb4e3 100644
--- a/Examples/test-suite/d/Makefile.in
+++ b/Examples/test-suite/d/Makefile.in
@@ -24,6 +24,12 @@ CPP_TEST_CASES = \
d_nativepointers \
exception_partial_info
+CPP11_TEST_CASES = \
+ cpp11_shared_ptr_const \
+ cpp11_shared_ptr_nullptr_in_containers \
+ cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_upcast \
+
include $(srcdir)/../common.mk
# Overridden variables here
diff --git a/Examples/test-suite/d/director_classes_runme.1.d b/Examples/test-suite/d/director_classes_runme.1.d
index 9c34db82a..e753f5f6d 100644
--- a/Examples/test-suite/d/director_classes_runme.1.d
+++ b/Examples/test-suite/d/director_classes_runme.1.d
@@ -18,6 +18,7 @@
* Base - Val(444.555)
* Base - Ref(444.555)
* Base - Ptr(444.555)
+ * Base - ConstPtrRef(444.555)
* Base - FullyOverloaded(int 10)
* Base - FullyOverloaded(bool 1)
* Base - SemiOverloaded(int -678)
@@ -28,6 +29,7 @@
* Derived - Val(444.555)
* Derived - Ref(444.555)
* Derived - Ptr(444.555)
+ * Derived - ConstPtrRef(444.555)
* Derived - FullyOverloaded(int 10)
* Derived - FullyOverloaded(bool 1)
* Derived - SemiOverloaded(int -678)
@@ -38,6 +40,7 @@
* DDerived - Val(444.555)
* DDerived - Ref(444.555)
* DDerived - Ptr(444.555)
+ * DDerived - ConstPtrRef(444.555)
* DDerived - FullyOverloaded(int 10)
* DDerived - FullyOverloaded(bool True)
* DDerived - SemiOverloaded(-678)
@@ -57,7 +60,7 @@ import director_classes.Derived;
import director_classes.DoubleHolder;
void main() {
- if (PrintDebug) Stdout.formatln("------------ Start ------------ ");
+ if (PrintDebug) Stdout.formatln("------------ Start ------------");
auto myCaller = new Caller();
@@ -83,7 +86,7 @@ void main() {
makeCalls(myCaller, myBase);
}
- if (PrintDebug) Stdout.formatln("------------ Finish ------------ ");
+ if (PrintDebug) Stdout.formatln("------------ Finish ------------");
}
void makeCalls(Caller myCaller, Base myBase) {
@@ -96,6 +99,7 @@ void makeCalls(Caller myCaller, Base myBase) {
if (myCaller.ValCall(dh).val != dh.val) throw new Exception("[1] failed");
if (myCaller.RefCall(dh).val != dh.val) throw new Exception("[2] failed");
if (myCaller.PtrCall(dh).val != dh.val) throw new Exception("[3] failed");
+ if (myCaller.ConstPtrRefCall(dh).val != dh.val) throw new Exception("[3] failed");
// Fully overloaded method test (all methods in base class are overloaded)
if (myCaller.FullyOverloadedCall(10) != myBaseType ~ "::FullyOverloaded(int)") throw new Exception("[4] failed");
@@ -136,6 +140,11 @@ public class DDerived : Base {
return x;
}
+ public override DoubleHolder ConstPtrRef(DoubleHolder x) {
+ if (PrintDebug) Stdout.formatln("DDerived - ConstPtrRef({0:d3})", x.val);
+ return x;
+ }
+
public override char[] FullyOverloaded(int x) {
if (PrintDebug) Stdout.formatln("DDerived - FullyOverloaded(int {0})", x);
return "DDerived::FullyOverloaded(int)";
diff --git a/Examples/test-suite/d/director_classes_runme.2.d b/Examples/test-suite/d/director_classes_runme.2.d
index 98e27b3cd..b16fa5461 100644
--- a/Examples/test-suite/d/director_classes_runme.2.d
+++ b/Examples/test-suite/d/director_classes_runme.2.d
@@ -18,6 +18,7 @@
* Base - Val(444.555)
* Base - Ref(444.555)
* Base - Ptr(444.555)
+ * Base - ConstPtrRef(444.555)
* Base - FullyOverloaded(int 10)
* Base - FullyOverloaded(bool 1)
* Base - SemiOverloaded(int -678)
@@ -28,6 +29,7 @@
* Derived - Val(444.555)
* Derived - Ref(444.555)
* Derived - Ptr(444.555)
+ * Derived - ConstPtrRef(444.555)
* Derived - FullyOverloaded(int 10)
* Derived - FullyOverloaded(bool 1)
* Derived - SemiOverloaded(int -678)
@@ -38,6 +40,7 @@
* DDerived - Val(444.555)
* DDerived - Ref(444.555)
* DDerived - Ptr(444.555)
+ * DDerived - ConstPtrRef(444.555)
* DDerived - FullyOverloaded(int 10)
* DDerived - FullyOverloaded(bool true)
* DDerived - SemiOverloaded(-678)
@@ -58,7 +61,7 @@ import director_classes.Derived;
import director_classes.DoubleHolder;
void main() {
- if (PrintDebug) writeln("------------ Start ------------ ");
+ if (PrintDebug) writeln("------------ Start ------------");
auto myCaller = new Caller();
@@ -84,7 +87,7 @@ void main() {
makeCalls(myCaller, myBase);
}
- if (PrintDebug) writeln("------------ Finish ------------ ");
+ if (PrintDebug) writeln("------------ Finish ------------");
}
void makeCalls(Caller myCaller, Base myBase) {
@@ -97,6 +100,7 @@ void makeCalls(Caller myCaller, Base myBase) {
enforce(myCaller.ValCall(dh).val == dh.val, "[1] failed");
enforce(myCaller.RefCall(dh).val == dh.val, "[2] failed");
enforce(myCaller.PtrCall(dh).val == dh.val, "[3] failed");
+ enforce(myCaller.ConstPtrRefCall(dh).val == dh.val, "[3] failed");
// Fully overloaded method test (all methods in base class are overloaded)
enforce(myCaller.FullyOverloadedCall(10) == myBaseType ~ "::FullyOverloaded(int)", "[4] failed");
@@ -137,6 +141,11 @@ public class DDerived : Base {
return x;
}
+ public override DoubleHolder ConstPtrRef(DoubleHolder x) {
+ if (PrintDebug) writefln("DDerived - ConstPtrRef(%s)", x.val);
+ return x;
+ }
+
public override string FullyOverloaded(int x) {
if (PrintDebug) writefln("DDerived - FullyOverloaded(int %s)", x);
return "DDerived::FullyOverloaded(int)";
diff --git a/Examples/test-suite/d/li_boost_shared_ptr_director_runme.2.d b/Examples/test-suite/d/li_boost_shared_ptr_director_runme.2.d
new file mode 100644
index 000000000..fbcb03fa6
--- /dev/null
+++ b/Examples/test-suite/d/li_boost_shared_ptr_director_runme.2.d
@@ -0,0 +1,114 @@
+module li_boost_shared_ptr_director_runme;
+
+import std.conv;
+import std.exception;
+import std.stdio;
+import std.string;
+import li_boost_shared_ptr_director.li_boost_shared_ptr_director;
+import li_boost_shared_ptr_director.Base;
+import li_boost_shared_ptr_director.C;
+
+void check(int got, int expected) {
+ enforce(got == expected, "Failed. got: " ~ to!string(got) ~ " Expected: " ~ to!string(expected));
+}
+
+void main() {
+ Derived a = new Derived(false);
+ Derived b = new Derived(true);
+
+ check(call_ret_c_shared_ptr(a), 1);
+ check(call_ret_c_shared_ptr(b), -1);
+ check(call_ret_c_by_value(a), 1);
+
+ check(call_ret_c_shared_ptr(a), 1);
+ check(call_ret_c_shared_ptr(b), -1);
+ check(call_ret_c_by_value(a), 1);
+
+ check(call_take_c_by_value(a), 5);
+ check(call_take_c_by_ref(a), 6);
+ check(call_take_c_by_pointer(a), 7);
+ check(call_take_c_by_pointer_ref(a), 8);
+ check(call_take_c_shared_ptr_by_value(a), 9);
+ check(call_take_c_shared_ptr_by_ref(a), 10);
+ check(call_take_c_shared_ptr_by_pointer(a), 11);
+ check(call_take_c_shared_ptr_by_pointer_ref(a), 12);
+
+ check(call_take_c_by_pointer_with_null(a), -2);
+ check(call_take_c_by_pointer_ref_with_null(a), -3);
+ check(call_take_c_shared_ptr_by_value_with_null(a), -4);
+ check(call_take_c_shared_ptr_by_ref_with_null(a), -5);
+ check(call_take_c_shared_ptr_by_pointer_with_null(a), -6);
+ check(call_take_c_shared_ptr_by_pointer_ref_with_null(a), -7);
+}
+
+public class Derived : Base {
+
+ private bool return_none;
+
+ public this(bool flag) {
+ super();
+ this.return_none = flag;
+ }
+
+ public override C ret_c_shared_ptr() {
+ if (this.return_none)
+ return null;
+ else
+ return new C();
+ }
+
+ public override C ret_c_by_value() {
+ return new C();
+ }
+
+ public override int take_c_by_value(C c) {
+ return c.get_m();
+ }
+
+ public override int take_c_by_ref(C c) {
+ return c.get_m();
+ }
+
+ public override int take_c_by_pointer(C c) {
+ if (c !is null)
+ return c.get_m();
+ else
+ return -2;
+ }
+
+ public override int take_c_by_pointer_ref(C c) {
+ if (c !is null)
+ return c.get_m();
+ else
+ return -3;
+ }
+
+ public override int take_c_shared_ptr_by_value(C c) {
+ if (c !is null)
+ return c.get_m();
+ else
+ return -4;
+ }
+
+ public override int take_c_shared_ptr_by_ref(C c) {
+ if (c !is null)
+ return c.get_m();
+ else
+ return -5;
+ }
+
+ public override int take_c_shared_ptr_by_pointer(C c) {
+ if (c !is null)
+ return c.get_m();
+ else
+ return -6;
+ }
+
+ public override int take_c_shared_ptr_by_pointer_ref(C c) {
+ if (c !is null)
+ return c.get_m();
+ else
+ return -7;
+ }
+
+}
diff --git a/Examples/test-suite/d/preproc_constants_c_runme.1.d b/Examples/test-suite/d/preproc_constants_c_runme.1.d
index d846c71ac..a6c2f3d10 100644
--- a/Examples/test-suite/d/preproc_constants_c_runme.1.d
+++ b/Examples/test-suite/d/preproc_constants_c_runme.1.d
@@ -36,7 +36,7 @@ void main() {
static assert(is(char[] == typeof(CONST_STRING2())));
static assert(is(int == typeof(INT_AND_BOOL())));
-// static assert(is(int == typeof(INT_AND_CHAR())));
+ static assert(is(int == typeof(INT_AND_CHAR())));
static assert(is(int == typeof(INT_AND_INT())));
static assert(is(uint == typeof(INT_AND_UINT())));
static assert(is(c_long == typeof(INT_AND_LONG())));
@@ -61,4 +61,7 @@ void main() {
static assert(is(int == typeof(EXPR_LAND())));
static assert(is(int == typeof(EXPR_LOR())));
static assert(is(double == typeof(EXPR_CONDITIONAL())));
+ static assert(is(double == typeof(EXPR_MIXED1())));
+ static assert(is(int == typeof(EXPR_WCHAR_MAX())));
+ static assert(is(int == typeof(EXPR_WCHAR_MIN())));
}
diff --git a/Examples/test-suite/d/preproc_constants_c_runme.2.d b/Examples/test-suite/d/preproc_constants_c_runme.2.d
index 9bdbb9372..786cb48cc 100644
--- a/Examples/test-suite/d/preproc_constants_c_runme.2.d
+++ b/Examples/test-suite/d/preproc_constants_c_runme.2.d
@@ -36,7 +36,7 @@ void main() {
static assert(is(string == typeof(CONST_STRING2())));
static assert(is(int == typeof(INT_AND_BOOL())));
-// static assert(is(int == typeof(INT_AND_CHAR())));
+ static assert(is(int == typeof(INT_AND_CHAR())));
static assert(is(int == typeof(INT_AND_INT())));
static assert(is(uint == typeof(INT_AND_UINT())));
static assert(is(c_long == typeof(INT_AND_LONG())));
@@ -61,4 +61,7 @@ void main() {
static assert(is(int == typeof(EXPR_LAND())));
static assert(is(int == typeof(EXPR_LOR())));
static assert(is(double == typeof(EXPR_CONDITIONAL())));
+ static assert(is(double == typeof(EXPR_MIXED1())));
+ static assert(is(int == typeof(EXPR_WCHAR_MAX())));
+ static assert(is(int == typeof(EXPR_WCHAR_MIN())));
}
diff --git a/Examples/test-suite/d/preproc_constants_runme.1.d b/Examples/test-suite/d/preproc_constants_runme.1.d
index 009405fc7..85fa918e4 100644
--- a/Examples/test-suite/d/preproc_constants_runme.1.d
+++ b/Examples/test-suite/d/preproc_constants_runme.1.d
@@ -35,7 +35,7 @@ void main() {
static assert(is(char[] == typeof(CONST_STRING2())));
static assert(is(int == typeof(INT_AND_BOOL())));
-// static assert(is(int == typeof(INT_AND_CHAR())));
+ static assert(is(int == typeof(INT_AND_CHAR())));
static assert(is(int == typeof(INT_AND_INT())));
static assert(is(uint == typeof(INT_AND_UINT())));
static assert(is(c_long == typeof(INT_AND_LONG())));
@@ -60,4 +60,7 @@ void main() {
static assert(is(bool == typeof(EXPR_LAND())));
static assert(is(bool == typeof(EXPR_LOR())));
static assert(is(double == typeof(EXPR_CONDITIONAL())));
+ static assert(is(double == typeof(EXPR_MIXED1())));
+ static assert(is(int == typeof(EXPR_WCHAR_MAX())));
+ static assert(is(int == typeof(EXPR_WCHAR_MIN())));
}
diff --git a/Examples/test-suite/d/preproc_constants_runme.2.d b/Examples/test-suite/d/preproc_constants_runme.2.d
index 2d92ef052..c81e53160 100644
--- a/Examples/test-suite/d/preproc_constants_runme.2.d
+++ b/Examples/test-suite/d/preproc_constants_runme.2.d
@@ -35,7 +35,7 @@ void main() {
static assert(is(string == typeof(CONST_STRING2())));
static assert(is(int == typeof(INT_AND_BOOL())));
-// static assert(is(int == typeof(INT_AND_CHAR())));
+ static assert(is(int == typeof(INT_AND_CHAR())));
static assert(is(int == typeof(INT_AND_INT())));
static assert(is(uint == typeof(INT_AND_UINT())));
static assert(is(c_long == typeof(INT_AND_LONG())));
@@ -60,4 +60,7 @@ void main() {
static assert(is(bool == typeof(EXPR_LAND())));
static assert(is(bool == typeof(EXPR_LOR())));
static assert(is(double == typeof(EXPR_CONDITIONAL())));
+ static assert(is(double == typeof(EXPR_MIXED1())));
+ static assert(is(int == typeof(EXPR_WCHAR_MAX())));
+ static assert(is(int == typeof(EXPR_WCHAR_MIN())));
}
diff --git a/Examples/test-suite/default_arg_expressions.i b/Examples/test-suite/default_arg_expressions.i
new file mode 100644
index 000000000..d83dc05bc
--- /dev/null
+++ b/Examples/test-suite/default_arg_expressions.i
@@ -0,0 +1,34 @@
+%module default_arg_expressions
+
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ptr;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) UsdGeomTokensPtr;
+%immutable UsdGeomTokens;
+
+%inline %{
+struct Numbers {
+ int val;
+ int *ptr;
+ Numbers() : val(), ptr(&val) {}
+};
+struct TfToken {
+ Numbers val;
+ Numbers *ptr;
+ TfToken() : val(), ptr(&val) {}
+};
+struct Tokens {
+ const TfToken face;
+ const TfToken *pface;
+ Tokens() : face(), pface(&face) {}
+};
+static Tokens UsdGeomTokens;
+static Tokens *UsdGeomTokensPtr = &UsdGeomTokens;
+void CreateMaterialBindSubset1(const Tokens &elementType = UsdGeomTokens) {}
+void CreateMaterialBindSubset2(int num = UsdGeomTokensPtr->pface->val.val) {}
+void CreateMaterialBindSubset3(int num = UsdGeomTokensPtr->pface->ptr->val) {}
+void CreateMaterialBindSubset4(int num = UsdGeomTokensPtr->face.val.val) {}
+//void CreateMaterialBindSubset5(int num = UsdGeomTokens.face.val.val) {}
+%}
diff --git a/Examples/test-suite/default_args.i b/Examples/test-suite/default_args.i
index 02d860765..6b680f561 100644
--- a/Examples/test-suite/default_args.i
+++ b/Examples/test-suite/default_args.i
@@ -2,26 +2,51 @@
%module default_args
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%{
#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+ #pragma warning(disable: 4146) // unary minus operator applied to unsigned type, result still unsigned
#endif
%}
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
+%{
+#define TESTCASE_THROW1(T1)
+#define TESTCASE_THROW2(T1, T2)
+%}
+
%include <std_string.i>
%inline %{
#include <string>
// All kinds of numbers: hex, octal (which pose special problems to Python), negative...
- void trickyvalue1(int first, int pos = -1) {}
- void trickyvalue2(int first, unsigned rgb = 0xabcdef) {}
- void trickyvalue3(int first, int mode = 0644) {}
+
+ class TrickyInPython {
+ public:
+ int value_m1(int first, int pos = -1) { return pos; }
+ unsigned value_0xabcdef(int first, unsigned rgb = 0xabcdef) { return rgb; }
+ int value_0644(int first, int mode = 0644) { return mode; }
+ int value_perm(int first, int mode = 0640 | 0004) { return mode; }
+ int value_m01(int first, int val = -01) { return val; }
+ bool booltest2(bool x = 0 | 1) { return x; }
+ int max_32bit_int1(int a = 0x7FFFFFFF) { return a; }
+ int max_32bit_int2(int a = 2147483647) { return a; }
+ int min_32bit_int1(int a = -0x80000000) { return a; }
+ long long too_big_32bit_int1(long long a = 0x80000000) { return a; }
+ long long too_big_32bit_int2(long long a = 2147483648LL) { return a; }
+ long long too_small_32bit_int1(long long a = -0x80000001) { return a; }
+ long long too_small_32bit_int2(long long a = -2147483649LL) { return a; }
+ };
void doublevalue1(int first, double num = 0.0e-1) {}
void doublevalue2(int first, double num = -0.0E2) {}
- // Long long arguments are not handled at Python level currently but still work.
void seek(long long offset = 0LL) {}
void seek2(unsigned long long offset = 0ULL) {}
void seek3(long offset = 0L) {}
@@ -152,6 +177,9 @@
int double_if_handle_is_null(int n, MyHandle h = 0) { return h ? n : 2*n; }
int double_if_dbl_ptr_is_null(int n, double* null_by_default)
{ return null_by_default ? n : 2*n; }
+
+ void defaulted1(unsigned offset = -1U) {} // minus unsigned!
+ void defaulted2(int offset = -1U) {} // minus unsigned!
};
int Foo::bar = 1;
int Foo::spam = 2;
@@ -182,18 +210,18 @@
// Default parameters with exception specifications
%inline %{
-void exceptionspec(int a = -1) throw (int, const char*) {
+void exceptionspec(int a = -1) TESTCASE_THROW2(int, const char*) {
if (a == -1)
throw "ciao";
else
throw a;
}
struct Except {
- Except(bool throwException, int a = -1) throw (int) {
+ Except(bool throwException, int a = -1) TESTCASE_THROW1(int) {
if (throwException)
throw a;
}
- void exspec(int a = 0) throw (int, const char*) {
+ void exspec(int a = 0) TESTCASE_THROW2(int, const char*) {
::exceptionspec(a);
}
};
diff --git a/Examples/test-suite/default_args_c.i b/Examples/test-suite/default_args_c.i
index e0c0af056..f507aa797 100644
--- a/Examples/test-suite/default_args_c.i
+++ b/Examples/test-suite/default_args_c.i
@@ -1,5 +1,13 @@
%module default_args_c
+%{
+#if defined(__clang__)
+#pragma clang diagnostic push
+// Suppress: use of logical '||' with constant operand
+#pragma clang diagnostic ignored "-Wconstant-logical-operand"
+#endif
+%}
+
/* Default arguments for C code */
int foo1(int x = 42 || 3);
int foo43(int x = 42 | 3);
@@ -12,3 +20,34 @@ int foo43(int x) {
return x;
}
%}
+
+%inline %{
+struct FooStruct {
+ int num;
+};
+%}
+%extend FooStruct {
+ void no_arg() {}
+ void one_req(int *required) {}
+ void one_opt(int *optional = NULL) {}
+ void two_arg(int *required, int *optional = NULL) {}
+}
+
+%inline %{
+struct StaticStruct {
+ int snum;
+};
+%}
+%extend StaticStruct {
+ static void no_arg() {}
+ static void one_req(int *required) {}
+ static void one_opt(int *optional = NULL) {}
+ static void two_arg(int *required, int *optional = NULL) {}
+}
+
+%{
+void global_opts1(int *optional) {}
+void global_opts2(int *required, int *optional) {}
+%}
+void global_opts1(int *optional = NULL) {}
+void global_opts2(int *required, int *optional = NULL) {}
diff --git a/Examples/test-suite/derived_byvalue.i b/Examples/test-suite/derived_byvalue.i
index a251a8fc6..21de809a5 100644
--- a/Examples/test-suite/derived_byvalue.i
+++ b/Examples/test-suite/derived_byvalue.i
@@ -1,5 +1,9 @@
%module derived_byvalue
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%inline %{
struct Foo {
diff --git a/Examples/test-suite/destructor_methodmodifiers.i b/Examples/test-suite/destructor_methodmodifiers.i
new file mode 100644
index 000000000..93db7f2cc
--- /dev/null
+++ b/Examples/test-suite/destructor_methodmodifiers.i
@@ -0,0 +1,61 @@
+%module destructor_methodmodifiers
+
+// This test changes the proxy classes so that they cannot be inherited from in the target language
+// Previously the %csmethodmodifiers, %dmethodmodifiers, %javamethodmodifiers on destructors were ignored
+// Now they can control the dispose/Dispose/delete method modifiers
+
+#if defined(SWIGCSHARP)
+
+// remove all use of protected and virtual keywords
+%typemap(csclassmodifiers) NotForDeriving1, NotForDeriving2 "public sealed class"
+%csmethodmodifiers NotForDeriving1::~NotForDeriving1 "public /*not virtual nor override*/";
+%csmethodmodifiers NotForDeriving2::~NotForDeriving2 "public /*not virtual nor override*/";
+
+// remove protected keyword to remove compiler warning
+%typemap(csbody) NotForDeriving1, NotForDeriving2 %{
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ private /*protected*/ bool swigCMemOwn;
+
+ internal $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ }
+
+ internal 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;
+ }
+%}
+
+#elif defined(SWIGD)
+
+%typemap(dclassmodifiers) NotForDeriving1, NotForDeriving2 "final class"
+%dmethodmodifiers NotForDeriving1::~NotForDeriving1 "public final";
+%dmethodmodifiers NotForDeriving2::~NotForDeriving2 "public final";
+
+#elif defined(SWIGJAVA)
+
+%typemap(javaclassmodifiers) NotForDeriving1, NotForDeriving2 "public final class"
+%javamethodmodifiers NotForDeriving1::~NotForDeriving1 "public synchronized final";
+%javamethodmodifiers NotForDeriving2::~NotForDeriving2 "public synchronized final";
+
+#endif
+
+%inline %{
+//#include <iostream>
+struct NotForDeriving1 {
+ void notvirtual() {}
+ ~NotForDeriving1() {
+// std::cout << "~NotForDeriving1 called" << std::endl;
+ }
+};
+struct NotForDeriving2 {
+ void notvirtual() {}
+#if defined(SWIG)
+%extend {
+ ~NotForDeriving2() {
+// std::cout << "~NotForDeriving2 called" << std::endl;
+ }
+}
+#endif
+};
+%}
diff --git a/Examples/test-suite/director_basic.i b/Examples/test-suite/director_basic.i
index 4c258b097..07d627589 100644
--- a/Examples/test-suite/director_basic.i
+++ b/Examples/test-suite/director_basic.i
@@ -1,5 +1,9 @@
%module(directors="1") director_basic
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) MyClass::pmethod;
%{
@@ -65,6 +69,14 @@
%}
+ %typemap(cscode) MyClass %{
+ public void testSwigDerivedClassHasMethod() {
+ if (SwigDerivedClassHasMethod("nonVirtual", swigMethodTypes3))
+ throw new global::System.Exception("non-overriding non-virtual method would be when connecting director");
+ if (SwigDerivedClassHasMethod("nonOverride", swigMethodTypes4))
+ throw new global::System.Exception("non-overriding virtual method would be when connecting director");
+ }
+ %}
%feature("director") MyClass;
@@ -121,6 +133,29 @@ public:
static Bar * call_pmethod(MyClass *myclass, Bar *b) {
return myclass->pmethod(b);
}
+
+ virtual int nonVirtual()
+ {
+ return 100;
+ }
+
+ virtual int nonOverride()
+ {
+ return 101;
+ }
+
+ static int call_nonVirtual(MyClass *myclass)
+ {
+ return myclass->nonVirtual();
+ }
+
+ static int call_nonOverride(MyClass *myclass)
+ {
+ return myclass->nonOverride();
+ }
+
+ // Collisions with generated method names
+ virtual void Connect() { }
};
template<class T>
diff --git a/Examples/test-suite/director_classes.i b/Examples/test-suite/director_classes.i
index 98c29e88c..52342bfc8 100644
--- a/Examples/test-suite/director_classes.i
+++ b/Examples/test-suite/director_classes.i
@@ -3,6 +3,11 @@
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) Base::Ref;
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) Base::Ptr;
+%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) Base::ConstPtrRef;
+
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
%module(directors="1") director_classes
@@ -43,6 +48,7 @@ public:
virtual DoubleHolder Val(DoubleHolder x) { if (PrintDebug) std::cout << "Base - Val(" << x.val << ")" << std::endl; return x; }
virtual DoubleHolder& Ref(DoubleHolder& x) { if (PrintDebug) std::cout << "Base - Ref(" << x.val << ")" << std::endl; return x; }
virtual DoubleHolder* Ptr(DoubleHolder* x) { if (PrintDebug) std::cout << "Base - Ptr(" << x->val << ")" << std::endl; return x; }
+ virtual DoubleHolder *const& ConstPtrRef(DoubleHolder *const& cprx) { if (PrintDebug) std::cout << "Base - ConstPtrRef(" << cprx->val << ")" << std::endl; return cprx; }
virtual std::string FullyOverloaded(int x) { if (PrintDebug) std::cout << "Base - FullyOverloaded(int " << x << ")" << std::endl; return "Base::FullyOverloaded(int)"; }
virtual std::string FullyOverloaded(bool x) { if (PrintDebug) std::cout << "Base - FullyOverloaded(bool " << x << ")" << std::endl; return "Base::FullyOverloaded(bool)"; }
@@ -68,6 +74,7 @@ public:
virtual DoubleHolder Val(DoubleHolder x) { if (PrintDebug) std::cout << "Derived - Val(" << x.val << ")" << std::endl; return x; }
virtual DoubleHolder& Ref(DoubleHolder& x) { if (PrintDebug) std::cout << "Derived - Ref(" << x.val << ")" << std::endl; return x; }
virtual DoubleHolder* Ptr(DoubleHolder* x) { if (PrintDebug) std::cout << "Derived - Ptr(" << x->val << ")" << std::endl; return x; }
+ virtual DoubleHolder *const& ConstPtrRef(DoubleHolder *const& cprx) { if (PrintDebug) std::cout << "Derived - ConstPtrRef(" << cprx->val << ")" << std::endl; return cprx; }
virtual std::string FullyOverloaded(int x) { if (PrintDebug) std::cout << "Derived - FullyOverloaded(int " << x << ")" << std::endl; return "Derived::FullyOverloaded(int)"; }
virtual std::string FullyOverloaded(bool x) { if (PrintDebug) std::cout << "Derived - FullyOverloaded(bool " << x << ")" << std::endl; return "Derived::FullyOverloaded(bool)"; }
@@ -99,6 +106,7 @@ public:
DoubleHolder ValCall(DoubleHolder x) { return m_base->Val(x); }
DoubleHolder& RefCall(DoubleHolder& x) { return m_base->Ref(x); }
DoubleHolder* PtrCall(DoubleHolder* x) { return m_base->Ptr(x); }
+ DoubleHolder *const& ConstPtrRefCall(DoubleHolder *const& cprx) { return m_base->ConstPtrRef(cprx); }
std::string FullyOverloadedCall(int x) { return m_base->FullyOverloaded(x); }
std::string FullyOverloadedCall(bool x) { return m_base->FullyOverloaded(x); }
std::string SemiOverloadedCall(int x) { return m_base->SemiOverloaded(x); }
diff --git a/Examples/test-suite/director_exception.i b/Examples/test-suite/director_exception.i
index abe23b381..71366bef0 100644
--- a/Examples/test-suite/director_exception.i
+++ b/Examples/test-suite/director_exception.i
@@ -3,27 +3,17 @@
%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) return_const_char_star;
%{
-
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
#include <string>
-
// define dummy director exception classes to prevent spurious errors
// in target languages that do not support directors.
#ifndef SWIG_DIRECTORS
namespace Swig {
-class DirectorException {};
-class DirectorMethodException: public Swig::DirectorException {};
+ class DirectorException {};
+ class DirectorMethodException: public Swig::DirectorException {};
}
- #ifndef SWIG_fail
- #define SWIG_fail
- #endif
#endif /* !SWIG_DIRECTORS */
-
%}
%include "std_string.i"
@@ -31,14 +21,14 @@ class DirectorMethodException: public Swig::DirectorException {};
#ifdef SWIGPHP
%feature("director:except") {
- if ($error == FAILURE) {
- throw Swig::DirectorMethodException();
- }
+ if ($error == FAILURE) {
+ Swig::DirectorMethodException::raise("$symname");
+ }
}
%exception {
- try { $action }
- catch (Swig::DirectorException &) { SWIG_fail; }
+ try { $action }
+ catch (Swig::DirectorException &) { SWIG_fail; }
}
#endif
@@ -46,14 +36,14 @@ class DirectorMethodException: public Swig::DirectorException {};
#ifdef SWIGPYTHON
%feature("director:except") {
- if ($error != NULL) {
- throw Swig::DirectorMethodException();
- }
+ if ($error != NULL) {
+ Swig::DirectorMethodException::raise("$symname");
+ }
}
%exception {
- try { $action }
- catch (Swig::DirectorException &) { SWIG_fail; }
+ try { $action }
+ catch (Swig::DirectorException &) { SWIG_fail; }
}
#endif
@@ -71,12 +61,12 @@ class DirectorMethodException: public Swig::DirectorException {};
// Change back to old 2.0 default behavior
%feature("director:except") {
- jthrowable $error = jenv->ExceptionOccurred();
- if ($error) {
- // Dont clear exception, still be active when return to java execution
- // Essentially ignore exception occurred -- old behavior.
- return $null;
- }
+ jthrowable $error = jenv->ExceptionOccurred();
+ if ($error) {
+ // Dont clear exception, still be active when return to java execution
+ // Essentially ignore exception occurred -- old behavior.
+ return $null;
+ }
}
#endif
@@ -84,7 +74,7 @@ class DirectorMethodException: public Swig::DirectorException {};
#ifdef SWIGRUBY
%feature("director:except") {
- throw Swig::DirectorMethodException($error);
+ Swig::DirectorMethodException::raise($error);
}
%exception {
@@ -125,6 +115,18 @@ Foo *launder(Foo *f) {
%feature("director") Bar;
%feature("director") ReturnAllTypes;
+%{
+// throw is deprecated in C++11 and invalid in C++17 and later
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#define throw(TYPE1, TYPE2, TYPE3)
+#else
+#define throw(TYPE1, TYPE2, TYPE3) throw(TYPE1, TYPE2, TYPE3)
+#if defined(_MSC_VER)
+ #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+#endif
+#endif
+%}
+
%inline %{
struct Exception1
{
@@ -137,16 +139,15 @@ Foo *launder(Foo *f) {
class Base
{
public:
- virtual ~Base() throw () {}
+ virtual ~Base() {}
};
class Bar : public Base
{
public:
- virtual std::string ping() throw (Exception1, Exception2&) { return "Bar::ping()"; }
- virtual std::string pong() throw (Unknown1, int, Unknown2&) { return "Bar::pong();" + ping(); }
- virtual std::string pang() throw () { return "Bar::pang()"; }
+ virtual std::string ping() throw(Exception1, Exception2&, double) { return "Bar::ping()"; }
+ virtual std::string pong() throw(Unknown1, int, Unknown2&) { return "Bar::pong();" + ping(); }
};
// Class to allow regression testing SWIG/PHP not checking if an exception
diff --git a/Examples/test-suite/director_exception_catches.i b/Examples/test-suite/director_exception_catches.i
new file mode 100644
index 000000000..ad183665f
--- /dev/null
+++ b/Examples/test-suite/director_exception_catches.i
@@ -0,0 +1,25 @@
+%module(directors="1") director_exception_catches
+
+%include <std_string.i>
+%feature("director") BaseClass;
+
+%{
+// define dummy director exception classes to prevent spurious errors
+// in target languages that do not support directors.
+
+#ifndef SWIG_DIRECTORS
+namespace Swig {
+ class DirectorException {};
+}
+#endif /* !SWIG_DIRECTORS */
+%}
+
+%catches(Swig::DirectorException) BaseClass::call_description;
+
+%inline %{
+struct BaseClass {
+ virtual std::string description() const = 0;
+ static std::string call_description(BaseClass& bc) { return bc.description(); }
+ virtual ~BaseClass() {}
+};
+%}
diff --git a/Examples/test-suite/director_exception_nothrow.i b/Examples/test-suite/director_exception_nothrow.i
new file mode 100644
index 000000000..8a072617f
--- /dev/null
+++ b/Examples/test-suite/director_exception_nothrow.i
@@ -0,0 +1,28 @@
+%module(directors="1") director_exception_nothrow
+
+%include "std_string.i"
+
+%feature("director") Bar;
+
+%{
+#if defined(_MSC_VER)
+ #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+#endif
+%}
+
+%inline %{
+#include <string>
+
+class Base
+{
+public:
+ virtual ~Base() throw() {}
+};
+
+
+class Bar : public Base
+{
+public:
+ virtual std::string pang() throw() { return "Bar::pang()"; }
+};
+%}
diff --git a/Examples/test-suite/director_extend.i b/Examples/test-suite/director_extend.i
index cec930a42..60a9d4cf0 100644
--- a/Examples/test-suite/director_extend.i
+++ b/Examples/test-suite/director_extend.i
@@ -25,7 +25,7 @@ namespace Swig {
size_t ExceptionMethod()
{
// Check positioning of director code in wrapper file
-// Below is what we really want to test, but director exceptions vary too much across across all languages
+// Below is what we really want to test, but director exceptions vary too much across all languages
// throw Swig::DirectorException("DirectorException was not in scope!!");
// Instead check definition of Director class as that is defined in the same place as DirectorException (director.swg)
size_t size = sizeof(Swig::Director);
diff --git a/Examples/test-suite/director_overload.i b/Examples/test-suite/director_overload.i
index 55bdf2caa..604ffe5ca 100644
--- a/Examples/test-suite/director_overload.i
+++ b/Examples/test-suite/director_overload.i
@@ -1,5 +1,9 @@
%module(directors="1") director_overload
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%feature("director");
#ifdef SWIGPYTHON
diff --git a/Examples/test-suite/director_ownership.i b/Examples/test-suite/director_ownership.i
new file mode 100644
index 000000000..48e909758
--- /dev/null
+++ b/Examples/test-suite/director_ownership.i
@@ -0,0 +1,72 @@
+%module(directors="1") director_ownership
+
+// Github issue #1184
+
+%include "std_string.i"
+
+%feature("director") example::ContentBase;
+%feature("director") example::ContentDerived;
+
+%newobject example::make_content;
+
+%inline %{
+#include <string>
+
+namespace example
+{
+
+class ContentBase
+{
+public:
+ ContentBase() {}
+ virtual ~ContentBase() {}
+ virtual std::string get_name() const = 0;
+};
+
+
+class ContentDerived: public ContentBase
+{
+public:
+ ContentDerived():ContentBase() { m_name = "ContentDerived"; }
+ virtual ~ContentDerived() {}
+ virtual std::string get_name() const { return m_name; }
+
+private:
+ std::string m_name;
+};
+
+
+class Container
+{
+public:
+ Container() { m_content = 0; }
+ ~Container()
+ {
+ clear_content();
+ }
+ // the container takes the ownership of the content
+ void set_content(ContentBase* content)
+ {
+ clear_content();
+ m_content = content;
+ }
+ ContentBase* get_content() { return m_content; }
+
+private:
+ void clear_content()
+ {
+ if(m_content)
+ {
+ delete m_content;
+ m_content = 0;
+ }
+ }
+
+private:
+ ContentBase* m_content;
+};
+
+static ContentBase* make_content() { return new ContentDerived(); }
+
+} // namespace example
+%}
diff --git a/Examples/test-suite/director_property.i b/Examples/test-suite/director_property.i
index da37ca4ae..d64e0c439 100644
--- a/Examples/test-suite/director_property.i
+++ b/Examples/test-suite/director_property.i
@@ -2,6 +2,10 @@
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) MyClass::pmethod;
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%{
#include <string>
diff --git a/Examples/test-suite/director_smartptr.i b/Examples/test-suite/director_smartptr.i
index 9d0be80f0..d016af17e 100644
--- a/Examples/test-suite/director_smartptr.i
+++ b/Examples/test-suite/director_smartptr.i
@@ -44,7 +44,6 @@ public:
%include <boost_shared_ptr.i>
%shared_ptr(Foo)
-
%feature("director") Foo;
class FooBar {
@@ -72,5 +71,12 @@ public:
static Foo* get_self(Foo *self_);
};
+%shared_ptr(FooDerived)
+%feature("director") FooDerived;
+
+%inline %{
+struct FooDerived : Foo {
+};
+%}
#endif
diff --git a/Examples/test-suite/director_thread.i b/Examples/test-suite/director_thread.i
index 2732eb907..c4564737f 100644
--- a/Examples/test-suite/director_thread.i
+++ b/Examples/test-suite/director_thread.i
@@ -7,29 +7,51 @@
%module(directors="1") director_thread
#endif
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
+%begin %{
+#define SWIG_JAVA_USE_THREAD_NAME
+//#define DEBUG_DIRECTOR_THREAD_NAME
+%}
+
%{
#ifdef _WIN32
#include <windows.h>
#include <process.h>
+#include <stdio.h>
#else
#include <pthread.h>
+#include <errno.h>
+#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#endif
-#include <iostream>
+#include <assert.h>
+#include "swig_examples_lock.h"
class Foo;
extern "C" {
#ifdef _WIN32
- unsigned int __stdcall working(void* t);
- unsigned int thread_id(0);
+ static unsigned int __stdcall working(void* t);
+ static HANDLE thread_handle = 0;
#else
void* working(void* t);
- pthread_t thread;
+ static pthread_t thread;
#endif
+
static int thread_terminate = 0;
-
+ static SwigExamples::CriticalSection critical_section;
+ int get_thread_terminate() {
+ SwigExamples::Lock lock(critical_section);
+ return thread_terminate;
+ }
+ void set_thread_terminate(int value) {
+ SwigExamples::Lock lock(critical_section);
+ thread_terminate = value;
+ }
}
%}
@@ -55,9 +77,10 @@ extern "C" {
}
void stop() {
- thread_terminate = 1;
+ set_thread_terminate(1);
%#ifdef _WIN32
- /*TODO(bhy) what to do for win32? */
+ WaitForSingleObject(thread_handle, INFINITE);
+ CloseHandle(thread_handle);
%#else
pthread_join(thread, NULL);
%#endif
@@ -65,13 +88,49 @@ extern "C" {
void run() {
%#ifdef _WIN32
- _beginthreadex(NULL,0,working,this,0,&thread_id);
+ unsigned int thread_id = 0;
+ thread_handle = (HANDLE)_beginthreadex(NULL,0,working,this,0,&thread_id);
+ if (thread_handle == 0) {
+ fprintf(stderr, "_beginthreadex failed in run()\n");
+ assert(0);
+ }
%#else
- pthread_create(&thread,NULL,working,this);
+ int create = pthread_create(&thread,NULL,working,this);
+ if (create != 0) {
+ errno = create;
+ perror("pthread_create in run()");
+ assert(0);
+ }
%#endif
MilliSecondSleep(500);
}
-
+
+ void setThreadName() {
+%#ifdef _WIN32
+%#else
+
+%#ifdef __APPLE__
+ int setname = pthread_setname_np("MyThreadName");
+%#else
+ int setname = pthread_setname_np(pthread_self(), "MyThreadName");
+%#endif
+
+ if (setname != 0) {
+ errno = setname;
+ perror("calling pthread_setname_np in setThreadName()");
+ assert(0);
+ }
+%#endif
+ }
+
+ static bool namedThread() {
+%#ifdef _WIN32
+ return false;
+%#else
+ return true;
+%#endif
+ }
+
virtual void do_foo() {
val += 1;
}
@@ -87,15 +146,11 @@ extern "C" {
#endif
{
Foo* f = static_cast<Foo*>(t);
- while ( ! thread_terminate ) {
+ f->setThreadName();
+ while (!get_thread_terminate()) {
MilliSecondSleep(50);
f->do_foo();
}
-#ifdef _WIN32
- /* TODO(bhy) what's the corresponding of pthread_exit in win32? */
-#else
- pthread_exit(0);
-#endif
return 0;
}
}
diff --git a/Examples/test-suite/doxygen_alias.i b/Examples/test-suite/doxygen_alias.i
new file mode 100644
index 000000000..79cb7964b
--- /dev/null
+++ b/Examples/test-suite/doxygen_alias.i
@@ -0,0 +1,22 @@
+%module doxygen_alias
+
+#ifdef SWIGJAVA
+%feature("doxygen:alias:nullptr") "null"
+#elif defined(SWIGPYTHON)
+%feature("doxygen:alias:nullptr") "None"
+#else
+%feature("doxygen:alias:nullptr") "NULL"
+#endif
+
+%inline %{
+
+class Something {};
+
+/**
+ A function returning something.
+
+ @returns A new object which may be @nullptr.
+ */
+Something* make_something() { return 0; }
+
+%}
diff --git a/Examples/test-suite/doxygen_basic_notranslate.i b/Examples/test-suite/doxygen_basic_notranslate.i
new file mode 100644
index 000000000..e62be5437
--- /dev/null
+++ b/Examples/test-suite/doxygen_basic_notranslate.i
@@ -0,0 +1,110 @@
+%module doxygen_basic_notranslate
+
+%include "doxygen_basic_translate.h"
+%feature("doxygen:notranslate") function;
+%feature("doxygen:notranslate") function1;
+%feature("doxygen:notranslate") function2;
+%feature("doxygen:notranslate") function3;
+%feature("doxygen:notranslate") function4;
+%feature("doxygen:notranslate") function5;
+%feature("doxygen:notranslate") function6;
+%feature("doxygen:notranslate") function7;
+
+%inline %{
+
+/**
+ * \brief
+ * Brief description.
+ *
+ * The comment text
+ * \author Some author
+ * \return Some number
+ * \sa function2
+ */
+int function()
+{
+ return 0;
+}
+
+/** Single line comment */
+void function1()
+{
+}
+
+/**
+ * A test of a very very very very very very very very very very very very very very very very
+ * very very very very very long comment string.
+ */
+void function2()
+{
+}
+
+/**
+ * A test for overloaded functions
+ * This is function \b one
+ */
+void function3(int a)
+{
+}
+
+/**
+ * A test for overloaded functions
+ * This is function \b two
+ */
+void function3(int a, int b)
+{
+}
+
+/**
+ * A test of some mixed tag usage
+ * \if CONDITION
+ * This \a code fragment shows us something \.
+ * \par Minuses:
+ * \arg it's senseless
+ * \arg it's stupid
+ * \arg it's null
+ *
+ * \warning This may not work as expected
+ *
+ * \code
+ * int main() { while(true); }
+ * \endcode
+ * \endif
+ */
+void function4()
+{
+}
+
+
+void function5(int a)
+{
+}
+/**< This is a post comment. */
+
+/**
+ * Test for default args
+ * @param a Some parameter, default is 42
+ */
+void function6(int a=42)
+{
+}
+
+class Shape
+{
+public:
+ typedef Shape* superType;
+};
+
+/**
+ * Test for a parameter with difficult type
+ * (mostly for python)
+ * @param a Very strange param
+ */
+void function7(Shape::superType *a[10])
+{
+}
+
+/**
+ * Comment at the end of file should be ignored.
+ */
+%}
diff --git a/Examples/test-suite/doxygen_basic_translate.h b/Examples/test-suite/doxygen_basic_translate.h
new file mode 100644
index 000000000..7b2b3f58a
--- /dev/null
+++ b/Examples/test-suite/doxygen_basic_translate.h
@@ -0,0 +1,5 @@
+
+/**
+ * This file contains only doxygen comment without a declaration -
+ * it should be ignored by SWIG and must not trigger syntax error.
+ */
diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i
new file mode 100644
index 000000000..da4d80909
--- /dev/null
+++ b/Examples/test-suite/doxygen_basic_translate.i
@@ -0,0 +1,113 @@
+%module doxygen_basic_translate
+
+%include "doxygen_basic_translate.h"
+
+%inline %{
+
+/**
+ * \brief
+ * Brief description.
+ *
+ * The comment text.
+ *
+ * \author Some author
+ *
+ * \return Some number
+ *
+ * \sa function2
+ */
+int function()
+{
+ return 0;
+}
+
+/**
+ * A test of a very very very very very very very very very very very very very very very very
+ * very very very very very long comment string.
+ */
+void function2()
+{
+}
+
+/**
+ * A test for overloaded functions
+ * This is function \b one
+ */
+void function3(int a)
+{
+}
+
+/**
+ * A test for overloaded functions
+ * This is function \b two
+ */
+void function3(int a, int b)
+{
+}
+
+/**
+ * A test of some mixed tag usage
+ * \if CONDITION
+ * This \a code fragment shows us something \.
+ * \par Minuses:
+ * \arg it's senseless
+ * \arg it's stupid
+ * \arg it's null
+ *
+ * \warning This may not work as expected
+ * \code
+ * int main() { while(true); }
+ *
+ * // Test blank line in code block
+ * \endcode
+ * \endif
+ */
+void function4()
+{
+}
+
+
+void function5(int a)
+{
+}
+/**< This is a post comment. */
+
+/**
+ * Test for default args
+ * @param a Some parameter, default is 42
+ */
+void function6(int a=42)
+{
+}
+
+class Shape
+{
+public:
+ typedef Shape* superType;
+};
+
+/**
+ * Test for a parameter with difficult type
+ * (mostly for python)
+ * @param a Very strange param
+ */
+void function7(Shape::superType *a[10])
+{
+}
+
+/**
+ Multiple parameters test.
+
+ @param y Vertical coordinate.
+ @param x Horizontal coordinate.
+ @return Arc tangent of @c y/x.
+ */
+double Atan2(double y, double x)
+{
+ return 0;
+}
+
+/**
+ * Comment at the end of file should be ignored.
+ */
+%}
diff --git a/Examples/test-suite/doxygen_basic_translate_style2.i b/Examples/test-suite/doxygen_basic_translate_style2.i
new file mode 100644
index 000000000..32e3cfcbe
--- /dev/null
+++ b/Examples/test-suite/doxygen_basic_translate_style2.i
@@ -0,0 +1,107 @@
+%module doxygen_basic_translate_style2
+
+%include "doxygen_basic_translate.h"
+
+// This test demonstrates a doxygen comment style that starts on the
+// first line and so uses extra spacing in subsequent lines.
+
+%inline %{
+
+/** \brief
+ * Brief description.
+ *
+ * The comment text.
+ *
+ * \author Some author
+ *
+ * \return Some number
+ *
+ * \sa function2
+ */
+int function()
+{
+ return 0;
+}
+
+/** A test of a very very very very very very very very very very very very very very very very
+ * very very very very very long comment string.
+ */
+void function2()
+{
+}
+
+/** A test for overloaded functions
+ * This is function \b one
+ */
+void function3(int a)
+{
+}
+
+/** A test for overloaded functions
+ * This is function \b two
+ */
+void function3(int a, int b)
+{
+}
+
+/** A test of some mixed tag usage
+ * \if CONDITION
+ * This \a code fragment shows us something \.
+ * \par Minuses:
+ * \arg it's senseless
+ * \arg it's stupid
+ * \arg it's null
+ *
+ * \warning This may not work as expected
+ * \code
+ * int main() { while(true); }
+ *
+ * // Test blank line in code block
+ * \endcode
+ * \endif
+ */
+void function4()
+{
+}
+
+
+void function5(int a)
+{
+}
+/**< This is a post comment. */
+
+/** Test for default args
+ * @param a Some parameter, default is 42
+ */
+void function6(int a=42)
+{
+}
+
+class Shape
+{
+public:
+ typedef Shape* superType;
+};
+
+/** Test for a parameter with difficult type
+ * (mostly for python)
+ * @param a Very strange param
+ */
+void function7(Shape::superType *a[10])
+{
+}
+
+/** Multiple parameters test.
+ *
+ * @param y Vertical coordinate.
+ * @param x Horizontal coordinate.
+ * @return Arc tangent of @c y/x.
+ */
+double Atan2(double y, double x)
+{
+ return 0;
+}
+
+/** Comment at the end of file should be ignored.
+ */
+%}
diff --git a/Examples/test-suite/doxygen_ignore.i b/Examples/test-suite/doxygen_ignore.i
new file mode 100644
index 000000000..8e5449f43
--- /dev/null
+++ b/Examples/test-suite/doxygen_ignore.i
@@ -0,0 +1,41 @@
+%module doxygen_ignore
+
+%feature("doxygen:ignore:transferfull");
+%feature("doxygen:ignore:compileroptions", range="line");
+%feature("doxygen:ignore:forcpponly", range="end");
+
+#ifdef SWIGJAVA
+%feature("doxygen:ignore:beginJavaOnly", range="end:endJavaOnly", contents="parse");
+%feature("doxygen:ignore:beginPythonOnly", range="end:endPythonOnly");
+#elif defined(SWIGPYTHON)
+%feature("doxygen:ignore:beginJavaOnly", range="end:endJavaOnly");
+%feature("doxygen:ignore:beginPythonOnly", range="end:endPythonOnly", contents="parse");
+#else
+%feature("doxygen:ignore:beginJavaOnly", range="end:endJavaOnly");
+%feature("doxygen:ignore:beginPythonOnly", range="end:endPythonOnly");
+#endif
+
+%inline %{
+
+/**
+ A contrived example of ignoring too many commands in one comment.
+
+ @forcpponly
+ This is C++-specific.
+ @endforcpponly
+
+ @beginJavaOnly
+ This is specific to @e Java.
+ @endJavaOnly
+
+ @beginPythonOnly
+ This is specific to @b Python.
+ @endPythonOnly
+
+ @transferfull Command ignored, but anything here is still included.
+
+ @compileroptions This function must be compiled with /EHa when using MSVC.
+ */
+int * func() { return 0; }
+
+%}
diff --git a/Examples/test-suite/doxygen_misc_constructs.h b/Examples/test-suite/doxygen_misc_constructs.h
new file mode 100644
index 000000000..d677dc3d3
--- /dev/null
+++ b/Examples/test-suite/doxygen_misc_constructs.h
@@ -0,0 +1,94 @@
+/*
+ * This file contains comments which demonstrate details about Doxygen processing,
+ * so they can be emulated in SWIG doxy comment translation
+ */
+
+
+
+/**This comment without space after '*' is valid in Doxygen.
+ *
+ */
+void isNoSpaceValidA()
+{}
+
+/**.This comment without space after '*' is valid in Doxygen.
+ *
+ */
+void isNoSpaceValidB()
+{}
+
+
+/***This is not Doxygen comment.
+ *
+ */
+void isNoSpaceValidC()
+{}
+
+
+/**
+ * Backslash following\c word is a valid doxygen command. Output contains
+ * 'followingword' with 'word' in code font.
+ */
+void backslashA()
+{}
+
+// Output of escaped symbols below in doxygen generated HTML:
+// Rendered: Escaped symbols: $ @ \ & < > # % " \. :: @text ::text
+// HTML source: Escaped symbols: $ @ \ &amp; &lt; &gt; # % " \. :: @text ::text
+
+
+/**
+ * Doxy command without trailing \cspace space is ignored - nothing appears
+ * on output. Standalone \ and '\' get to output.
+ * Standalone @ and '@' get to output.
+ * Commands "in quoted \b strings are treated as plain text".
+ * Commands not recognized by Doxygen \blah @blah are ignored.
+ * Backslashes in DOS paths d:\xyz\qwe\myfile and words
+ * following them do not appear on output, we must quote them with
+ * double quotes: "d:\xyz\qwe\myfile", "@something". Single quotes do not help:
+ * 'd:\xyz\qwe\myfile'. Escaping works: d:\\xyz\\qwe\\myfile. Unix
+ * paths of course have no such problems: /xyz/qwe/myfile
+ * Commands for escaped symbols:
+ * \$ \@ \\ \& \~ \< \> \# \% \" \. \:: \@text \::text
+ */
+void backslashB()
+{}
+
+/**
+ * Backslash e at end of \e line froze SWIG \e
+ * with old comment parser.
+ *
+ * @see MyClass::fun(char,
+ * float)
+ */
+void backslashC()
+{}
+
+/**
+ * The next line contains expression:
+ * <pre>
+ * ['retVal < 10', 'g_counter == 23 && g_mode & 3']
+ *</pre>
+ *
+ * Both words should be emphasized \b isystem.connect.
+ * But not the last period. For \b example, comma should not be emphasized.
+ * Similar \b for: double colon.
+ *
+ * Spaces at the start of line should be taken into account:
+ * @param id used as prefix in log
+ * statements. The default value is empty string, which is OK if
+ * there is only one app. instance. Example:
+ * <pre>
+ * ctrl.setBP("func1");
+ * </pre>
+ * If we set the id to \c main_, we get:
+ * <pre>
+ * main_ctrl.setBP("func1");
+ * </pre>
+ *
+ * @param fileName name of the log file
+ */
+void cycle(int id, char *fileName)
+{}
+
+
diff --git a/Examples/test-suite/doxygen_misc_constructs.i b/Examples/test-suite/doxygen_misc_constructs.i
new file mode 100644
index 000000000..c1b3eea31
--- /dev/null
+++ b/Examples/test-suite/doxygen_misc_constructs.i
@@ -0,0 +1,127 @@
+// This file contains tests for situations, which do not normally
+// appear in the code, but must nevertheless be handled correctly.
+
+%module doxygen_misc_constructs
+
+%warnfilter(SWIGWARN_DOXYGEN_UNKNOWN_COMMAND) backslashB;
+
+%inline %{
+
+ // Tag '@endink' must be recognized even if it is not
+ // followed by whitespace.
+
+ /** Tag endlink must be recognized also when followed by nonspace character.
+ *
+ * @link Connection::getId() @endlink<br> */
+
+ char g_counter;
+
+
+ /**
+ Tag endlink must be recognized also when it is the last token
+ in the comment.
+
+ @link Connection::getId() @endlink<br>
+ @link debugIdeTraceProfilerCoverageSample.py Python example. @endlink
+ */
+ int g_zipCode;
+
+
+ // Parameter 'isReportSize' must appear in comment of the overload, which
+ // has it. Empty line before link must be preserved.
+ /**
+ * Returns address of file line.
+ *
+ * @param fileName name of the file, where the source line is located
+ * @param line line number
+ * @param isGetSize if set, for every object location both address and size are returned
+ *
+ * @link Connection::getId() @endlink <br>
+ */
+ void getAddress(int &fileName,
+ int line,
+ bool isGetSize = false) {}
+
+ // The first comment must be ignored.
+ /**
+ * \defgroup icFacade isystem.connect Facade
+ *
+ * This page shows the core classes, which can be used to control
+ * all aspects of winIDEA, for example: debugging, analyzers, IO module, ...
+ */
+
+ /**
+ * This class contains information for connection to winIDEA. Its methods
+ * return reference to self, so we can use it like this:
+ * <pre>
+ * CConnectionConfig config = new CConnectionConfig();
+ * config.discoveryPort(5534).dllPath("C:\\myWinIDEA\\connect.dll").id("main");
+ * </pre>
+ *
+ * All parameters are optional. Set only what is required, default values are
+ * used for unspecified parameters.
+ * <p>
+ *
+ * @link advancedWinIDEALaunching.py Python example.@endlink <br>
+ */
+ class CConnectionConfig
+ {
+ };
+
+ // Text after '\c' must be kept unchanged in Python.
+ /**
+ * Determines how long the \c isystem.connect should wait for running
+ * instances to respond. Only one of \c lfWaitXXX flags from IConnect::ELaunchFlags
+ * may be specified.
+ */
+ int waitTime(long waitTime) {return 33;}
+
+
+ // Line with tag \ingroup must not appear in translated comment:
+ /** \ingroup icFacade
+ *
+ * This function returns connection id.
+ */
+ int getConnection() {return 3;}
+
+ // the following must produce no comment in wrapper
+ /*******************************************************************/
+ char getFirstLetter() {return 'a';}
+
+
+ /**
+ * Class description.
+ */
+ class ClassWithNestedEnum {
+ public:
+ /**
+ * Enum description.
+ */
+ typedef enum {ONE, ///< desc of one
+ TWO, ///< desc of two
+ THREE ///< desc of three
+ } ENested;
+
+ };
+
+ /// @return This is a bad place for this tag, but it should be ignored.
+ struct StructWithReturnComment {};
+
+ /**
+ An example of a list in a documentation comment.
+
+ - The first item of the list.
+ - The second list item, on
+ several indented lines,
+ showing that the indentation
+ is preserved.
+ - And the final list item after it.
+
+ And this is not a list item any more.
+ */
+ void showList() { }
+
+ #include "doxygen_misc_constructs.h"
+
+%}
+ %include "doxygen_misc_constructs.h"
diff --git a/Examples/test-suite/doxygen_nested_class.i b/Examples/test-suite/doxygen_nested_class.i
new file mode 100644
index 000000000..55575e34f
--- /dev/null
+++ b/Examples/test-suite/doxygen_nested_class.i
@@ -0,0 +1,24 @@
+%module doxygen_nested_class
+
+%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) DoxOuter::DoxInner;
+
+%inline %{
+
+struct DoxOuter {
+ /** DoxOuter constructor */
+ DoxOuter() {}
+ /** DoxInner class description */
+ struct DoxInner {
+ /** DoxInner constructor */
+ DoxInner() {}
+ /** doxInt variable */
+ int doxInt;
+ /** doxShort const variable */
+ static const short doxShort = 1;
+ /** doxMethod description */
+ void doxMethod() {}
+ /** doxStaticMethod description */
+ static void doxStaticMethod() {}
+ };
+};
+%}
diff --git a/Examples/test-suite/doxygen_parsing.i b/Examples/test-suite/doxygen_parsing.i
new file mode 100644
index 000000000..40f37a4c2
--- /dev/null
+++ b/Examples/test-suite/doxygen_parsing.i
@@ -0,0 +1,140 @@
+%module doxygen_parsing
+
+%inline %{
+
+/**
+ * The class comment
+ */
+class SomeClass
+{
+};
+
+/**
+ * The function comment
+ */
+void someFunction()
+{
+}
+
+/**
+ * The enum comment
+ */
+enum SomeEnum
+{
+ SOME_ENUM_ITEM
+};
+
+/**
+ * The struct comment
+ */
+struct SomeStruct
+{
+};
+
+/**
+ * The var comment
+ */
+int someVar=42;
+
+/**
+ * The constant comment
+ */
+#define CONSTANT_VALUE 4242
+
+/// SomeAnotherClass description
+class SomeAnotherClass
+{
+public:
+ /// First overloaded constructor.
+ SomeAnotherClass(int) { }
+
+ /// Second overloaded constructor.
+ SomeAnotherClass(const char*) { }
+
+
+ /**
+ * The class attribute comment
+ */
+ int classAttr;
+
+ int classAttr2; ///< The class attribute post-comment
+
+ int classAttr3; ///< The class attribute post-comment
+ //!< with details
+
+ /**
+ * The class method comment.
+ *
+ * \link SomeAnotherClass#classMethodExtended(int, int) a link text \endlink
+ */
+ void classMethod()
+ {
+ }
+
+ /**
+ * The class method with parameter
+ */
+ void classMethodExtended(
+ int a, ///< Parameter a
+ int b ///< Parameter b
+ )
+ {
+ }
+
+ /**
+ * The class method with parameter
+ *
+ * @param a Parameter a
+ * @param b Parameter b
+ */
+ void classMethodExtended2(int a, int b)
+ {
+ }
+};
+
+struct SomeAnotherStruct
+{
+ /**
+ * The struct attribute comment
+ */
+ int structAttr;
+
+ int structAttr2; ///< The struct attribute post-comment
+
+ int structAttr3; ///< The struct attribute post-comment
+ //!< with details
+
+ /**
+ * The struct method comment
+ */
+ void structMethod()
+ {
+ }
+
+ /**
+ * The struct method with parameter
+ */
+ void structMethodExtended(
+ int a, ///< Parameter a
+ int b ///< Parameter b
+ )
+ {
+ }
+
+ /**
+ * The struct method with parameter
+ *
+ * @param a Parameter a
+ * @param b Parameter b
+ */
+ void structMethodExtended2(int a, int b)
+ {
+ }
+};
+
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+%}
diff --git a/Examples/test-suite/doxygen_parsing_enums.i b/Examples/test-suite/doxygen_parsing_enums.i
new file mode 100644
index 000000000..b7a39871f
--- /dev/null
+++ b/Examples/test-suite/doxygen_parsing_enums.i
@@ -0,0 +1,40 @@
+%module doxygen_parsing_enums
+
+%inline %{
+
+
+ /**
+ * Testing comments before enum items
+ */
+ enum SomeAnotherEnum
+ {
+ /**
+ * The comment for the first item
+ */
+ SOME_ITEM_1,
+ /**
+ * The comment for the second item
+ */
+ SOME_ITEM_2,
+ /**
+ * The comment for the third item
+ */
+ SOME_ITEM_3
+ };
+
+ /**
+ * Testing comments after enum items
+ */
+ enum SomeAnotherEnum2
+ {
+ SOME_ITEM_10, ///< Post comment for the first item
+ SOME_ITEM_20, ///< Post comment for the second item
+ SOME_ITEM_30 ///< Post comment for the third item
+ };
+
+ enum SomeEnumWithTrailingComma
+ {
+ SOME_ITEM_100, ///< Post comment after comma.
+ SOME_ITEM_200, ///< Post comment after last comma.
+ };
+%}
diff --git a/Examples/test-suite/doxygen_parsing_enums_proper.i b/Examples/test-suite/doxygen_parsing_enums_proper.i
new file mode 100644
index 000000000..1a69a84f1
--- /dev/null
+++ b/Examples/test-suite/doxygen_parsing_enums_proper.i
@@ -0,0 +1,7 @@
+%module "doxygen_parsing_enums_proper"
+
+// Test enum commenting using the proper enums in the target language
+%include "enums.swg"
+
+%include "doxygen_parsing_enums.i"
+
diff --git a/Examples/test-suite/doxygen_parsing_enums_simple.i b/Examples/test-suite/doxygen_parsing_enums_simple.i
new file mode 100644
index 000000000..823a27584
--- /dev/null
+++ b/Examples/test-suite/doxygen_parsing_enums_simple.i
@@ -0,0 +1,6 @@
+%module "doxygen_parsing_enums_simple"
+
+// Test enum commenting using simple constants (SWIG-1.3.21 and earlier default enum wrapping for C# and Java)
+%include "enumsimple.swg"
+
+%include "doxygen_parsing_enums.i" \ No newline at end of file
diff --git a/Examples/test-suite/doxygen_parsing_enums_typesafe.i b/Examples/test-suite/doxygen_parsing_enums_typesafe.i
new file mode 100644
index 000000000..25e355ee2
--- /dev/null
+++ b/Examples/test-suite/doxygen_parsing_enums_typesafe.i
@@ -0,0 +1,8 @@
+%module "doxygen_parsing_enums_typesafe"
+
+// Test enum commenting using the typesafe enum pattern in the target language
+%include "enumtypesafe.swg"
+
+#define SWIG_TEST_NOCSCONST // For C# typesafe enums
+
+%include "doxygen_parsing_enums.i" \ No newline at end of file
diff --git a/Examples/test-suite/doxygen_parsing_enums_typeunsafe.i b/Examples/test-suite/doxygen_parsing_enums_typeunsafe.i
new file mode 100644
index 000000000..e001035df
--- /dev/null
+++ b/Examples/test-suite/doxygen_parsing_enums_typeunsafe.i
@@ -0,0 +1,6 @@
+%module "doxygen_parsing_enums_typeunsafe"
+
+// Test enum commenting using a type unsafe enum pattern (constant integers in a class for the enum type)
+%include "enumtypeunsafe.swg"
+
+%include "doxygen_parsing_enums.i" \ No newline at end of file
diff --git a/Examples/test-suite/doxygen_translate.i b/Examples/test-suite/doxygen_translate.i
new file mode 100644
index 000000000..bb0af1c14
--- /dev/null
+++ b/Examples/test-suite/doxygen_translate.i
@@ -0,0 +1,266 @@
+%module doxygen_translate
+
+#if defined(SWIGJAVA)
+%javamethodmodifiers function "@Deprecated\npublic"
+#endif
+
+%inline %{
+
+/**
+ * \a Hello
+ *
+ * \arg some list item
+ *
+ * \authors lots of them
+ *
+ * \author Zubr
+ *
+ * \b boldword
+ *
+ * \c codeword
+ *
+ * \cite citationword
+ *
+ * \code some test code \endcode
+ *
+ * \cond SOMECONDITION
+ * Some conditional comment
+ * \endcond
+ *
+ * \copyright some copyright
+ *
+ * \deprecated Now use another function
+ *
+ * \e italicword
+ *
+ * \example someFile.txt
+ * Some details on using the example
+ *
+ * \exception SuperError
+ *
+ * \if ANOTHERCONDITION
+ * First part of comment
+ * \if SECONDCONDITION
+ * Nested condition text
+ * \elseif THIRDCONDITION
+ * The third condition text
+ * \else
+ * The last text block
+ * \endif
+ * \else
+ * Second part of comment
+ * \if CONDITION
+ * Second part extended
+ * \endif
+ * \endif
+ *
+ * \ifnot SOMECONDITION
+ * This is printed if not
+ * \endif
+ *
+ * \image html testImage.bmp "Hello, world!" width=10cm
+ *
+ * <ul>
+ *
+ * \li Some unordered list
+ * \li With lots of items
+ * \li lots of lots of items
+ *
+ * </ul>
+ *
+ * \link someMember Some description follows \endlink
+ *
+ * \n \n \n
+ *
+ * \note Here
+ * is the note!
+ *
+ * \overload
+ *
+ * \p someword
+ *
+ * \package superPackage
+ *
+ * \par The paragraph title
+ * The paragraph text.
+ * Maybe even multiline
+ *
+ * \param a the first param
+ *
+ * \remark Some remark text
+ *
+ * \remarks Another remarks section
+ *
+ * \result Whatever
+ *
+ * \return it
+ *
+ * \returns may return
+ *
+ * \sa someOtherMethod
+ *
+ * \see function
+ *
+ * \since version 0.0.0.1
+ *
+ * \throw superException
+ *
+ * \throws RuntimeError
+ *
+ * \todo Some very important task
+ *
+ * \tparam b B is mentioned again...
+ *
+ * \verbatim
+ * very long
+ * text with tags <sometag>
+ * \endverbatim
+ *
+ * \version 0.0.0.2
+ *
+ * \warning This is senseless!
+ *
+ * Here goes test of symbols:
+ * \$ \@ \\ \& \~ \< \> \# \% \" \. \::
+ *
+ * And here goes simple text
+ */
+int function(int a, float b)
+{
+ return 0;
+}
+
+/**
+ * Test for html tags. See Doxygen doc for list of tags recognized by Doxygen.
+ *
+ * <a href="http://acme.com/index.html">This is link</a>
+ * <b>bold</b>
+ * <BLOCKQUOTE cite="http://www.worldwildlife.org/who/index.html">
+ * Quotation block.
+ * </BLOCKQUOTE>
+ * <br>
+ * <center>center</center>
+ * <code>this is code</code>
+ *
+ * <DL>
+ * <DT>Starts an item title.</DT>
+ * <DD>Starts an item description.</dd>
+ * </dl>
+ *
+ * <DFN>Starts a piece of text displayed in a typewriter font.
+ * </DFN>
+ * <DIV>Starts a section with a specific style (HTML only)
+ * </DIV>
+ * <EM>Starts a piece of text displayed in an italic font.</EM>
+ *
+ * <FORM>'Form' does not generate any output.
+ * </FORM>
+ * <HR>
+ * <H1>Heading 1
+ * </H1>
+ * <H2>Heading 2
+ * </H2>
+ * <H3>Heading 3
+ * </H3>
+ * <I>Starts a piece of text displayed in an italic font.</I>
+ * <INPUT>Input tag.
+ * <IMG src="slika.png">
+ * <META>Meta tag.
+ * <MULTICOL>Multicol is ignored by doxygen.
+ * </MULTICOL>
+ *
+ * <OL>
+ * <LI>List item 1.</LI>
+ * <LI>List item 2.</LI>
+ * </OL>
+ *
+ * <P>Starts a new paragraph.
+ * </P>
+ * <PRE>Starts a preformatted fragment.
+ * </PRE>
+ * <SMALL>Starts a section of text displayed in a smaller font.
+ * </SMALL>
+ * <SPAN>Starts an inline text fragment with a specific style.</SPAN>
+ * <STRONG>Starts a section of bold text.</STRONG>
+ * <SUB>Starts a piece of text displayed in subscript.</SUB>
+ * <SUP>Starts a piece of text displayed in superscript.</SUP>
+ *
+ * <table border = '1'>
+ * <caption>Animals</caption>
+ * <tr><th> Column 1 </th><th> Column 2 </th></tr>
+ * <tr><td> cow </td><td> dog </td></tr>
+ * <tr><td> cat </td><td> mouse </td></tr>
+ * <tr><td> horse </td><td> parrot </td></tr>
+ * </table>
+ *
+ * <TT>Starts a piece of text displayed in a typewriter font.
+ * </TT>
+ * <KBD>Starts a piece of text displayed in a typewriter font.
+ * </KBD>
+ *
+ * <UL>
+ * <LI>List item 1.</LI>
+ * <LI>List item 2.</LI>
+ * <LI>List item 3.</LI>
+ * </UL>
+ *
+ * <VAR>Starts a piece of text displayed in an italic font.</VAR>
+ *
+ * \htmlonly
+ * <u>underlined \b bold text - doxy commands are ignored inside 'htmlonly' section </u>
+ * \endhtmlonly
+ */
+void htmlFunction(int a, float b)
+{
+}
+
+/**
+ * The meaning of flags:
+ *
+ * @param byFlags bits marking required items:
+ * <table>
+ * <tr><th> Size in bits</th><th> Items Required </th></tr>
+ * <tr><td> 1 - 8 </td><td> 1 </td></tr>
+ * <tr><td> 9 - 16 </td><td> 2 </td></tr>
+ * <tr><td> 17 - 32 </td><td> 4 </td></tr>
+ * </table>
+ * Almost all combinations of above flags are supported by
+ * \c htmlTable... functions.
+ */
+void htmlTableFunction(int byFlags)
+{
+}
+
+
+/**
+ * All entities are treated as commands &copy; &trade; &reg;
+ * should work also&lt;in text
+ * &gt;
+ * &amp;
+ * &apos;
+ * &quot;
+ * &lsquo;
+ * &rsquo;
+ * &ldquo;
+ * &rdquo;
+ * &ndash;
+ * &mdash;
+ * &nbsp;
+ * &times;
+ * &minus;
+ * &sdot;
+ * &sim;
+ * &le;
+ * &ge;
+ * &larr;
+ * &rarr;
+ * Not an &text; html entity - ignored by Doxygen.
+ * Not an &text html entity - ampersand is replaced with entity.
+ */
+void htmlEntitiesFunction(int a, float b)
+{
+}
+
+
+
+%}
diff --git a/Examples/test-suite/doxygen_translate_all_tags.i b/Examples/test-suite/doxygen_translate_all_tags.i
new file mode 100644
index 000000000..8da683d52
--- /dev/null
+++ b/Examples/test-suite/doxygen_translate_all_tags.i
@@ -0,0 +1,413 @@
+%module doxygen_translate_all_tags
+
+#if defined(SWIGJAVA)
+%javamethodmodifiers func02 "@Deprecated\npublic"
+#endif
+
+%inline %{
+
+/**
+ * \a Hello
+ *
+ * \addindex SomeLatexIndex
+ *
+ * \addtogroup someGroup "Some title"
+ *
+ * \anchor theAnchor
+ *
+ * \arg some list item
+ *
+ * \attention This is attention!
+ * You were warned!
+ *
+ * \authors lots of them
+ * \author Zubr
+ *
+ * \b boldword
+ *
+ * \brief Some brief description,
+ * extended to many lines.
+ *
+ * \bug Not everything works right now...
+ * \c codeword
+ *
+ * \callgraph
+ * \callergraph
+ * \category someCategory headerFile.h headerName
+ *
+ * \cite citationword
+ * \class someClass headerFile.h headerName
+ * \code some test code \endcode
+ *
+ * Code immediately following text. Pydoc translation must add an
+ * empty line before:
+ * \code more test code \endcode
+ */
+void func01(int a)
+{
+}
+
+
+/**
+ * \cond SOMECONDITION
+ * Some conditional comment
+ * \endcond
+ *
+ * \copybrief someClass::someMethod
+ *
+ * \copydetails someClass::someMethod2
+ *
+ * \copydoc someClass::someMethod3
+ *
+ * \copyright some copyright
+ *
+ * \date 1970 - 2012
+ *
+ * \def someDefine
+ *
+ * \defgroup someGroup Some titles
+ *
+ * \deprecated Now use another function
+ *
+ * \details This is very large
+ * and detailed description of some thing
+ */
+void func02(int a)
+{
+}
+
+
+/**
+ * Comment for \b func03().
+ *
+ * \dir /somePath/someFolder
+ *
+ * \dontinclude someFile.h
+ *
+ * \dot
+ * digraph example {
+ * node [shape=record, fontname=Helvetica, fontsize=10];
+ * b [ label="class B" URL="\ref B"];
+ * c [ label="class C" URL="\ref C"];
+ * b -> c [ arrowhead="open", style="dashed" ];
+ * }
+ * \enddot
+ *
+ * \dotfile dotFile.dot "The caption"
+ *
+ * \e italicword
+ *
+ * \em emphazedWord
+ *
+ * \enum someEnum
+ *
+ * \example someFile.txt
+ * Some details on using the example
+ */
+void func03(int a)
+{
+}
+
+
+/**
+ *
+ * \exception SuperError
+ *
+ * \extends someOtherFunction
+ *
+ * \f$ \sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \f$
+ *
+ * \f[
+ * \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
+ * \f]
+ *
+ * \f{
+ * \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
+ * \f}
+ *
+ * Math immediately following text. Pydoc translation must add an
+ * empty line before:
+ * \f[
+ * \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
+ * \f]
+ *
+ * \file file.h
+ *
+ * \fn someFn
+ *
+ * \headerfile someHeader.h "Header name"
+ *
+ * \hideinitializer
+ *
+ * \htmlinclude htmlFile.htm
+ *
+ * \htmlonly
+ * This will only appear in hmtl
+ * \endhtmlonly
+ */
+void func04(int a)
+{
+}
+
+
+/**
+ * \if ANOTHERCONDITION
+ * First part of comment
+ * \if SECONDCONDITION
+ * Nested condition text
+ * \elseif THIRDCONDITION
+ * The third condition text
+ * \else
+ * The last text block
+ * \endif
+ * \else
+ * Second part of comment
+ * \if CONDITION
+ * Second part extended
+ * \endif
+ * \endif
+ *
+ * \ifnot SOMECONDITION
+ * This is printed if not
+ * \endif
+ *
+ * \image html testImage.bmp "Hello, world!" asd=10qwe
+ *
+ * \implements someFunction
+ *
+ * \include header.h
+ *
+ * \includelineno header2.h
+ *
+ * \ingroup someGroup anotherGroup
+ *
+ * \internal
+ *
+ * \invariant Some text
+ * describing invariant.
+ */
+void func05(int a)
+{
+}
+
+
+/**
+ * Comment for \b func06().
+ *
+ * \interface someInterface someHeader.h "Header name"
+ *
+ * \latexonly
+ * This will only appear in LATeX
+ * \endlatexonly
+ *
+ * <ul>
+ *
+ * \li Some unordered list
+ * \li With lots of items
+ * \li lots of lots of items
+ *
+ * </ul>
+ *
+ * \line example
+ *
+ * \link someMember Some description follows \endlink
+ *
+ * \mainpage Some title
+ *
+ * \manonly
+ * This will only appear in man
+ * \endmanonly
+ *
+ * \memberof someThing
+ *
+ * \msc
+ * Sender,Receiver;
+ * Sender->Receiver [label="Command()", URL="\ref Receiver::Command()"];
+ * Sender<-Receiver [label="Ack()", URL="\ref Ack()", ID="1"];
+ * \endmsc
+ *
+ * \mscfile mscFile.msc "The caption"
+ *
+ * \n \n \n
+ */
+void func06(int a)
+{
+}
+
+
+/**
+ * Comment for \b func07().
+ *
+ * \name someHeader.h
+ *
+ * \namespace someNamespace
+ *
+ * \nosubgrouping
+ *
+ * \note Here
+ * is the note!
+ *
+ * \overload
+ *
+ * \p someword
+ *
+ * \package superPackage
+ *
+ * \page somePage The title
+ *
+ * \par The paragraph title
+ * The paragraph text.
+ * Maybe even multiline
+ *
+ * \paragraph someParagraph Paragraph title
+ *
+ * \param a the first param
+ *
+ * \post Some description
+ *
+ * \pre Some description
+ *
+ * \private
+ *
+ * \privatesection
+ *
+ * \property someVar
+ */
+void func07(int a)
+{
+}
+
+
+/**
+ * \protected
+ *
+ * \protectedsection
+ *
+ * \anchor someAnchor
+ * Text after anchor.
+ * \protocol someProtocol header.h "Header name"
+ *
+ * \public
+ *
+ * \publicsection
+ *
+ * \ref someAnchor "Anchor description"
+ *
+ * \ref someAnchor not quoted text is not part of ref tag
+ *
+ * \ref someAnchor
+ *
+ * \related toSomething
+ *
+ * \relates toSomethingElse
+ *
+ * \relatedalso someName
+ *
+ * \relatesalso someName
+ *
+ * \remark Some remark text
+ *
+ * \remarks Another remarks section
+ *
+ * \result Whatever
+ *
+ * \return it
+ *
+ * \returns may return
+ *
+ * \retval someValue Some description
+ */
+void func08(int a)
+{
+}
+
+
+/**
+ * \rtfonly
+ * This will only appear in RTF
+ * \endrtfonly
+ *
+ * \sa someOtherMethod
+ *
+ * \section someSection Some title
+ *
+ * \see function
+ *
+ * \short Same as
+ * brief description
+ *
+ * \showinitializer
+ *
+ * \since version 0.0.0.1
+ *
+ * \skip somePattern
+ *
+ * \skipline someLine
+ *
+ * \snippet example.h Some snippet
+ *
+ * \struct someStruct
+ *
+ * \subpage someSubpage "Some description"
+ *
+ * \subsection someSubsection Some title
+ *
+ * \subsubsection someSubsection Some title
+ *
+ * \tableofcontents
+ *
+ * \test Some
+ * description of the
+ * test case
+ *
+ * \throw superException
+ *
+ * \throws RuntimeError
+ */
+void func09(int a)
+{
+}
+
+
+/**
+ * \todo Some very important task
+ *
+ * \tparam b B is mentioned again...
+ *
+ * \typedef someTypedef
+ *
+ * \union someUnion
+ *
+ * \until somePattern
+ *
+ * \var someVar
+ *
+ * \verbatim
+ * very long
+ * text with tags <sometag>
+ * \endverbatim
+ *
+ * \verbinclude someFile.h
+ *
+ * \version 0.0.0.2
+ *
+ * \warning This is senseless!
+ *
+ * \weakgroup someGroup Some title
+ *
+ * \xmlonly
+ * This will only appear in XML
+ * \endxmlonly
+ *
+ * \xrefitem todo "Todo" "Todo List"
+ *
+ * Here goes test of symbols:
+ * \$ \@ \\ \& \~ \< \> \# \% \" \. \::
+ *
+ * And here goes simple text
+ */
+void func10(int a, float b)
+{
+}
+
+%}
diff --git a/Examples/test-suite/doxygen_translate_links.i b/Examples/test-suite/doxygen_translate_links.i
new file mode 100644
index 000000000..769a4f4e7
--- /dev/null
+++ b/Examples/test-suite/doxygen_translate_links.i
@@ -0,0 +1,67 @@
+
+
+%module doxygen_translate_links
+%include "std_string.i"
+
+%inline %{
+
+class Shape
+{
+public:
+ typedef Shape* superType;
+};
+
+/**
+ * Testing typenames converting in \@ link
+ *
+ * \link superFunc(int,std::string)
+ * Test for std_string member
+ * \endlink
+ *
+ * \link superFunc(int,long,void*)
+ * Test for simple types
+ * \endlink
+ *
+ * \link superFunc(Shape::superType*)
+ * Test for custom types
+ * \endlink
+ *
+ * \link superFunc(int**[13])
+ * Test for complex types
+ * \endlink
+ *
+ * same works for 'See also:' links:
+ *
+ * \sa superFunc(int,std::string)
+ * \sa superFunc(int,long,void*)
+ * \sa superFunc(Shape::superType*)
+ * \sa superFunc(int**[13])
+ *
+ * some failing params:
+ *
+ * \sa superFunc()
+ * \sa superFunc()
+ * \sa superFunc()
+ *
+ */
+void function()
+{
+}
+
+void superFunc(int, std::string)
+{
+}
+
+void superFunc(int, long, void *)
+{
+}
+
+void superFunc(Shape::superType *)
+{
+}
+
+void superFunc(int **arr[13])
+{
+}
+
+%}
diff --git a/Examples/test-suite/enum_macro.i b/Examples/test-suite/enum_macro.i
index c058cdf72..a5e8a2461 100644
--- a/Examples/test-suite/enum_macro.i
+++ b/Examples/test-suite/enum_macro.i
@@ -97,3 +97,45 @@ enum Greeks13
#define GREEK13 -13
};
+/* Multiple macros */
+
+%inline %{
+enum Greeks14
+{
+#define GREEK14a -14
+#define GREEK14b -140
+ theta14,
+};
+
+enum Greeks15
+{
+ alpha15 = 150,
+ beta15 = 151,
+#define GREEK15a -150
+#define GREEK15b -151
+ theta15 = 152,
+ delta15 = 153
+};
+
+enum Greeks16
+{
+ alpha16 = 160,
+ beta16 = 161,
+#define GREEK16a -160
+#define GREEK16b -161
+#define GREEK16c -162
+ theta16 = 162,
+ delta16 = 163
+};
+
+enum Greeks17
+{
+ alpha17 = 170,
+ beta17 = 171,
+ theta17 = 172,
+ delta17 = 173
+#define GREEK17a -170
+#define GREEK17b -171
+#define GREEK17c -172
+};
+%}
diff --git a/Examples/test-suite/errors/Makefile.in b/Examples/test-suite/errors/Makefile.in
index cf7889a1d..7137a6862 100644
--- a/Examples/test-suite/errors/Makefile.in
+++ b/Examples/test-suite/errors/Makefile.in
@@ -24,15 +24,32 @@ SWIG_LIB_SET = @SWIG_LIB_SET@
SWIGINVOKE = $(SWIG_LIB_SET) $(SWIGTOOL) $(SWIGEXE)
# All .i files with prefix 'cpp_' will be treated as C++ input and remaining .i files as C input
-ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i)))
-CPP_ERROR_TEST_CASES := $(filter cpp_%, $(ALL_ERROR_TEST_CASES))
-C_ERROR_TEST_CASES := $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES))
+ALL_ERROR_TEST_CASES := $(sort $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i))))
+CPP_ERROR_TEST_CASES := $(sort $(filter cpp_%, $(ALL_ERROR_TEST_CASES)))
+C_ERROR_TEST_CASES := $(sort $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES)))
+DOXYGEN_ERROR_TEST_CASES := $(sort $(filter doxygen_%, $(C_ERROR_TEST_CASES)))
+C_ERROR_TEST_CASES := $(sort $(filter-out $(DOXYGEN_ERROR_TEST_CASES), $(C_ERROR_TEST_CASES)))
+
+# Always use C++ for Doxygen tests, there doesn't seem to be any need to
+# distinguish between C and C++ Doxygen tests.
+DOXYGEN_ERROR_TEST_CASES := $(DOXYGEN_ERROR_TEST_CASES:=.cpptest)
ERROR_TEST_CASES := $(CPP_ERROR_TEST_CASES:=.cpptest) \
- $(C_ERROR_TEST_CASES:=.ctest)
+ $(C_ERROR_TEST_CASES:=.ctest) \
+ $(DOXYGEN_ERROR_TEST_CASES)
include $(srcdir)/../common.mk
+# This is tricky: we need to let common.mk define SWIGOPT before appending to
+# it, if we do it before including it, its defining of SWIGOPT would override
+# whatever we do here.
+$(DOXYGEN_ERROR_TEST_CASES): SWIGOPT += -doxygen
+
+# Unique module names are obtained from the .i file name (required for parallel make).
+# Note: -module overrides %module in the .i file.
+MODULE_OPTION=-module $*
+nomodule.ctest: MODULE_OPTION =
+
# Portable dos2unix / todos for stripping CR
TODOS = tr -d '\r'
#TODOS = sed -e 's/\r$$//' # On Mac OS X behaves as if written 's/r$$//'
@@ -43,12 +60,12 @@ STRIP_SRCDIR = sed -e 's|\\|/|g' -e 's|^$(SRCDIR)||'
# Rules for the different types of tests
%.cpptest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ -$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.ctest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIGINVOKE) -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ -$(SWIGINVOKE) -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.clean:
diff --git a/Examples/test-suite/errors/cpp_bad_global_memberptr.i b/Examples/test-suite/errors/cpp_bad_global_memberptr.i
new file mode 100644
index 000000000..f0d95cfed
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_bad_global_memberptr.i
@@ -0,0 +1,6 @@
+%module xxx
+
+struct Funcs {};
+
+short (Funcs::* *)(bool) = 0;
+short (Funcs::* const*)(bool) = 0;
diff --git a/Examples/test-suite/errors/cpp_bad_global_memberptr.stderr b/Examples/test-suite/errors/cpp_bad_global_memberptr.stderr
new file mode 100644
index 000000000..ac3f9cbe0
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_bad_global_memberptr.stderr
@@ -0,0 +1,2 @@
+cpp_bad_global_memberptr.i:5: Error: Missing symbol name for global declaration
+cpp_bad_global_memberptr.i:6: Error: Missing symbol name for global declaration
diff --git a/Examples/test-suite/errors/cpp_class_definition.i b/Examples/test-suite/errors/cpp_class_definition.i
new file mode 100644
index 000000000..8381e75cc
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_class_definition.i
@@ -0,0 +1,26 @@
+%module xxx
+
+// This should error but doesn't
+#if 0
+namespace OtherSpace {
+ struct L;
+}
+namespace Space11 {
+ namespace SubSpace11 {
+ using OtherSpace::L;
+ struct L {
+ void ll();
+ };
+ }
+}
+#endif
+
+namespace Space1 {
+ struct A;
+}
+namespace Space2 {
+ struct Space1::A {
+ void x();
+ };
+}
+
diff --git a/Examples/test-suite/errors/cpp_class_definition.stderr b/Examples/test-suite/errors/cpp_class_definition.stderr
new file mode 100644
index 000000000..2c4102842
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_class_definition.stderr
@@ -0,0 +1 @@
+cpp_class_definition.i:22: Error: 'Space1::A' resolves to 'Space1::A' and was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.i b/Examples/test-suite/errors/cpp_extra_brackets.i
index 32cf7f72d..81fdb29c4 100644
--- a/Examples/test-suite/errors/cpp_extra_brackets.i
+++ b/Examples/test-suite/errors/cpp_extra_brackets.i
@@ -1,4 +1,4 @@
-%module cpp_extra_brackets
+%module xxx
// Extra brackets was segfaulting in SWIG-3.0.0
struct ABC {
diff --git a/Examples/test-suite/errors/cpp_extra_brackets2.i b/Examples/test-suite/errors/cpp_extra_brackets2.i
index 17a5d5918..194dea435 100644
--- a/Examples/test-suite/errors/cpp_extra_brackets2.i
+++ b/Examples/test-suite/errors/cpp_extra_brackets2.i
@@ -1,4 +1,4 @@
-%module cpp_extra_brackets
+%module xxx
// Extra brackets was segfaulting in SWIG-3.0.0
struct ABC {
diff --git a/Examples/test-suite/errors/cpp_final_destructor.stderr b/Examples/test-suite/errors/cpp_final_destructor.stderr
new file mode 100644
index 000000000..d8c509d0c
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_final_destructor.stderr
@@ -0,0 +1 @@
+cpp_final_destructor.i:7: Warning 525: Destructor BaseFinal::~BaseFinal() is final, BaseFinal cannot be a director class.
diff --git a/Examples/test-suite/errors/cpp_invalid_exponents1.i b/Examples/test-suite/errors/cpp_invalid_exponents1.i
new file mode 100644
index 000000000..1ff2c3603
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_invalid_exponents1.i
@@ -0,0 +1,4 @@
+%module xxx
+
+void bad(double nn = 5e);
+
diff --git a/Examples/test-suite/errors/cpp_invalid_exponents1.stderr b/Examples/test-suite/errors/cpp_invalid_exponents1.stderr
new file mode 100644
index 000000000..6096114be
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_invalid_exponents1.stderr
@@ -0,0 +1,2 @@
+cpp_invalid_exponents1.i:3: Error: Exponent does not have any digits
+cpp_invalid_exponents1.i:3: Error: Syntax error in input(1).
diff --git a/Examples/test-suite/errors/cpp_invalid_exponents2.i b/Examples/test-suite/errors/cpp_invalid_exponents2.i
new file mode 100644
index 000000000..2e074872a
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_invalid_exponents2.i
@@ -0,0 +1,4 @@
+%module xxx
+
+void bad(double nn = 6.6e);
+
diff --git a/Examples/test-suite/errors/cpp_invalid_exponents2.stderr b/Examples/test-suite/errors/cpp_invalid_exponents2.stderr
new file mode 100644
index 000000000..e7d1bf07d
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_invalid_exponents2.stderr
@@ -0,0 +1,2 @@
+cpp_invalid_exponents2.i:3: Error: Exponent does not have any digits
+cpp_invalid_exponents2.i:3: Error: Syntax error in input(1).
diff --git a/Examples/test-suite/errors/cpp_invalid_qualifiers.i b/Examples/test-suite/errors/cpp_invalid_qualifiers.i
new file mode 100644
index 000000000..d0723dff6
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_invalid_qualifiers.i
@@ -0,0 +1,43 @@
+%module xxx
+
+// Constructors, destructors and static methods cannot have qualifiers
+struct A {
+ ~A() const;
+};
+struct B {
+ virtual ~B() const;
+};
+struct C {
+ ~C() &;
+};
+struct D {
+ virtual ~D() &;
+};
+struct E {
+ ~E() &&;
+};
+struct F {
+ virtual ~F() &&;
+};
+
+struct J {
+ J() const;
+ J(int) const;
+};
+struct K {
+ K() &;
+ K(int) &;
+};
+struct L {
+ L() &&;
+ L(int) &&;
+};
+
+struct M {
+ static void m1() const;
+ static void m2() &;
+ thread_local static void m3() &&;
+ static auto m4() const -> int;
+ static auto m5() & -> int;
+ static auto m6() && -> int;
+};
diff --git a/Examples/test-suite/errors/cpp_invalid_qualifiers.stderr b/Examples/test-suite/errors/cpp_invalid_qualifiers.stderr
new file mode 100644
index 000000000..7b3e442eb
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_invalid_qualifiers.stderr
@@ -0,0 +1,20 @@
+cpp_invalid_qualifiers.i:5: Error: Destructor ~A() const cannot have a qualifier.
+cpp_invalid_qualifiers.i:8: Error: Destructor ~B() const cannot have a qualifier.
+cpp_invalid_qualifiers.i:11: Error: Destructor ~C() & cannot have a qualifier.
+cpp_invalid_qualifiers.i:14: Error: Destructor ~D() & cannot have a qualifier.
+cpp_invalid_qualifiers.i:17: Error: Destructor ~E() && cannot have a qualifier.
+cpp_invalid_qualifiers.i:20: Error: Destructor ~F() && cannot have a qualifier.
+cpp_invalid_qualifiers.i:24: Error: Constructor cannot have a qualifier.
+cpp_invalid_qualifiers.i:25: Error: Constructor cannot have a qualifier.
+cpp_invalid_qualifiers.i:28: Error: Constructor cannot have a qualifier.
+cpp_invalid_qualifiers.i:29: Error: Constructor cannot have a qualifier.
+cpp_invalid_qualifiers.i:32: Error: Constructor cannot have a qualifier.
+cpp_invalid_qualifiers.i:33: Error: Constructor cannot have a qualifier.
+cpp_invalid_qualifiers.i:37: Error: Static function m1() const cannot have a qualifier.
+cpp_invalid_qualifiers.i:38: Error: Static function m2() & cannot have a qualifier.
+cpp_invalid_qualifiers.i:39: Error: Static function m3() && cannot have a qualifier.
+cpp_invalid_qualifiers.i:39: Warning 405: Method with rvalue ref-qualifier m3() && ignored.
+cpp_invalid_qualifiers.i:40: Error: Static function m4() const cannot have a qualifier.
+cpp_invalid_qualifiers.i:41: Error: Static function m5() & cannot have a qualifier.
+cpp_invalid_qualifiers.i:42: Error: Static function m6() && cannot have a qualifier.
+cpp_invalid_qualifiers.i:42: Warning 405: Method with rvalue ref-qualifier m6() && ignored.
diff --git a/Examples/test-suite/errors/cpp_invalid_template.i b/Examples/test-suite/errors/cpp_invalid_template.i
new file mode 100644
index 000000000..45ad73908
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_invalid_template.i
@@ -0,0 +1,9 @@
+%module xxx
+
+%template(abc) SSS::AAA<int>;
+
+namespace UUU {
+ struct JJJ;
+}
+
+%template(xxx) UUU::JJJ<int>;
diff --git a/Examples/test-suite/errors/cpp_invalid_template.stderr b/Examples/test-suite/errors/cpp_invalid_template.stderr
new file mode 100644
index 000000000..f6bfaaf7d
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_invalid_template.stderr
@@ -0,0 +1,3 @@
+cpp_invalid_template.i:3: Error: Undefined scope 'SSS'
+cpp_invalid_template.i:3: Error: Template 'SSS::AAA' undefined.
+cpp_invalid_template.i:9: Error: 'JJJ' is not defined as a template. (classforward)
diff --git a/Examples/test-suite/errors/cpp_namespace_template_bad.i b/Examples/test-suite/errors/cpp_namespace_template_bad.i
new file mode 100644
index 000000000..f41918f8e
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_namespace_template_bad.i
@@ -0,0 +1,40 @@
+%module xxx
+
+namespace test {
+ template<typename T> T max(T a, T b) { return (a > b) ? a : b; }
+ template<typename T> class vector {
+ public:
+ vector() { }
+ ~vector() { }
+ };
+}
+
+namespace test2 {
+ using namespace test;
+ %template(maxshort) max<short>;
+ %template(vectorshort) vector<short>;
+}
+
+namespace test3 {
+ using test::max;
+ using test::vector;
+ %template(maxlong) max<long>;
+ %template(vectorlong) vector<long>;
+}
+
+namespace test4 {
+ using namespace test;
+ typedef int Integer;
+}
+
+namespace test4 {
+ %template(maxInteger) max<Integer>;
+ %template(vectorInteger) vector<Integer>;
+}
+
+using namespace test;
+namespace test5 {
+ %template(maxdouble) max<double>;
+ %template(vectordouble) vector<double>;
+}
+
diff --git a/Examples/test-suite/errors/cpp_namespace_template_bad.stderr b/Examples/test-suite/errors/cpp_namespace_template_bad.stderr
new file mode 100644
index 000000000..5965d529c
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_namespace_template_bad.stderr
@@ -0,0 +1,9 @@
+cpp_namespace_template_bad.i:14: Error: 'max' resolves to 'test::max' and was incorrectly instantiated in scope 'test2' instead of within scope 'test'.
+cpp_namespace_template_bad.i:15: Error: 'vector' resolves to 'test::vector' and was incorrectly instantiated in scope 'test2' instead of within scope 'test'.
+cpp_namespace_template_bad.i:21: Error: 'max' resolves to 'test::max' and was incorrectly instantiated in scope 'test3' instead of within scope 'test'.
+cpp_namespace_template_bad.i:22: Error: 'vector' resolves to 'test::vector' and was incorrectly instantiated in scope 'test3' instead of within scope 'test'.
+cpp_namespace_template_bad.i:31: Error: 'max' resolves to 'test::max' and was incorrectly instantiated in scope 'test4' instead of within scope 'test'.
+cpp_namespace_template_bad.i:32: Error: 'vector' resolves to 'test::vector' and was incorrectly instantiated in scope 'test4' instead of within scope 'test'.
+cpp_namespace_template_bad.i:37: Error: 'max' resolves to 'test::max' and was incorrectly instantiated in scope 'test5' instead of within scope 'test'.
+cpp_namespace_template_bad.i:37: Error: Template 'max' undefined.
+cpp_namespace_template_bad.i:38: Error: 'vector' resolves to 'test::vector' and was incorrectly instantiated in scope 'test5' instead of within scope 'test'.
diff --git a/Examples/test-suite/errors/cpp_nested_namespace_alias.i b/Examples/test-suite/errors/cpp_nested_namespace_alias.i
new file mode 100644
index 000000000..058d34441
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_nested_namespace_alias.i
@@ -0,0 +1,34 @@
+%module xxx
+
+// C++17 nested namespaces
+
+namespace A
+{
+ namespace B
+ {
+ void ab1();
+ }
+}
+namespace A::B
+{
+ void ab2();
+}
+namespace AAlias = A;
+namespace AAlias::B
+{
+ void ab3();
+}
+namespace A
+{
+ namespace BAlias = B;
+ void ab4();
+}
+namespace A::BAlias
+{
+ void ab5();
+}
+namespace ABAlias = A::B;
+namespace ABAlias
+{
+ void ab6();
+}
diff --git a/Examples/test-suite/errors/cpp_nested_namespace_alias.stderr b/Examples/test-suite/errors/cpp_nested_namespace_alias.stderr
new file mode 100644
index 000000000..2506a3a2c
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_nested_namespace_alias.stderr
@@ -0,0 +1,3 @@
+cpp_nested_namespace_alias.i:18: Warning 308: Namespace alias 'AAlias' not allowed here. Assuming 'A'
+cpp_nested_namespace_alias.i:27: Warning 308: Namespace alias 'BAlias' not allowed here. Assuming 'B'
+cpp_nested_namespace_alias.i:32: Warning 308: Namespace alias 'ABAlias' not allowed here. Assuming 'B'
diff --git a/Examples/test-suite/errors/cpp_nested_template.stderr b/Examples/test-suite/errors/cpp_nested_template.stderr
index 9e46cff74..363a260f6 100644
--- a/Examples/test-suite/errors/cpp_nested_template.stderr
+++ b/Examples/test-suite/errors/cpp_nested_template.stderr
@@ -1,2 +1,4 @@
+cpp_nested_template.i:9: Error: 'Temply' resolves to '::Temply' and was incorrectly instantiated in scope 'A' instead of within scope ''.
cpp_nested_template.i:9: Warning 324: Named nested template instantiations not supported. Processing as if no name was given to %template().
+cpp_nested_template.i:18: Error: 'Temply' resolves to '::Temply' and was incorrectly instantiated in scope 'B' instead of within scope ''.
cpp_nested_template.i:18: Warning 324: Named nested template instantiations not supported. Processing as if no name was given to %template().
diff --git a/Examples/test-suite/errors/cpp_raw_string_termination.i b/Examples/test-suite/errors/cpp_raw_string_termination.i
new file mode 100644
index 000000000..3858b1f1e
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_raw_string_termination.i
@@ -0,0 +1,4 @@
+%module xxx
+
+%feature("docstring") func2 R"ABC(Calculate :math:`D^\nu \rho(x)`.)AB";
+void func2(double* foo, int bar, char** baz);
diff --git a/Examples/test-suite/errors/cpp_raw_string_termination.stderr b/Examples/test-suite/errors/cpp_raw_string_termination.stderr
new file mode 100644
index 000000000..37dd512e0
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_raw_string_termination.stderr
@@ -0,0 +1,2 @@
+cpp_raw_string_termination.i:3: Error: Unterminated raw string, started with R"ABC( is not terminated by )ABC"
+cpp_raw_string_termination.i:3: Error: Syntax error in input(1).
diff --git a/Examples/test-suite/errors/cpp_recursive_typedef.i b/Examples/test-suite/errors/cpp_recursive_typedef.i
index 3d65a8817..82d9f7a4a 100644
--- a/Examples/test-suite/errors/cpp_recursive_typedef.i
+++ b/Examples/test-suite/errors/cpp_recursive_typedef.i
@@ -1,4 +1,4 @@
-%module cpp_recursive_typedef
+%module xxx
typedef std::set<pds> pds;
diff --git a/Examples/test-suite/errors/cpp_refqualifier.i b/Examples/test-suite/errors/cpp_refqualifier.i
new file mode 100644
index 000000000..3980a812c
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_refqualifier.i
@@ -0,0 +1,28 @@
+%module xxx
+
+%ignore Host::h_ignored;
+%ignore Host::i_ignored() &&;
+%ignore Host::j_ignored() const &&;
+
+class Host {
+public:
+ void h1() &;
+ void h2() const &;
+ void h3() &&;
+ void h4() const &&;
+
+ void h() &;
+ void h() const &;
+ void h() &&;
+ void h() const &&;
+
+ void h_ignored() &&;
+ void i_ignored() &&;
+ void i_ignored() &&;
+};
+
+%feature("ignore", "0") Unignore::k_unignored() const &&;
+
+struct Unignore {
+ void k_unignored() const &&;
+};
diff --git a/Examples/test-suite/errors/cpp_refqualifier.stderr b/Examples/test-suite/errors/cpp_refqualifier.stderr
new file mode 100644
index 000000000..ea2cd220a
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_refqualifier.stderr
@@ -0,0 +1,6 @@
+cpp_refqualifier.i:11: Warning 405: Method with rvalue ref-qualifier h3() && ignored.
+cpp_refqualifier.i:12: Warning 405: Method with rvalue ref-qualifier h4() const && ignored.
+cpp_refqualifier.i:16: Warning 405: Method with rvalue ref-qualifier h() && ignored.
+cpp_refqualifier.i:17: Warning 405: Method with rvalue ref-qualifier h() const && ignored.
+cpp_refqualifier.i:15: Warning 512: Overloaded method Host::h() const & ignored,
+cpp_refqualifier.i:14: Warning 512: using non-const method Host::h() & instead.
diff --git a/Examples/test-suite/errors/cpp_shared_ptr.i b/Examples/test-suite/errors/cpp_shared_ptr.i
index edbd0cf87..bdcd30f71 100644
--- a/Examples/test-suite/errors/cpp_shared_ptr.i
+++ b/Examples/test-suite/errors/cpp_shared_ptr.i
@@ -1,4 +1,4 @@
-%module cpp_shared_ptr
+%module xxx
%include <boost_shared_ptr.i>
diff --git a/Examples/test-suite/errors/cpp_template_duplicate_names.i b/Examples/test-suite/errors/cpp_template_duplicate_names.i
new file mode 100644
index 000000000..96076967b
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_duplicate_names.i
@@ -0,0 +1,51 @@
+%module xxx
+
+// From test-suite/template_class_reuse.i test
+
+%{
+namespace Space {
+ template <bool B> struct Duplicate1 { void f(){}; };
+}
+%}
+
+// %warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate1;
+namespace Space {
+ template <bool B> struct Duplicate1 { void f(){}; };
+ template <bool B> struct Duplicate1 { void f(){}; };
+}
+
+
+// %warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate2;
+%inline %{
+namespace Space {
+ template <int I> struct Duplicate2 { void n(){}; };
+}
+%}
+%template(Duplicate2_0) Space::Duplicate2<0>;
+%template(Duplicate2_0) Space::Duplicate2<0>;
+
+
+// %warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate3;
+%inline %{
+namespace Space {
+ template <int I> struct Duplicate3 { void n(){}; };
+}
+%}
+%template(Duplicate3) Space::Duplicate3<0>;
+%template(Duplicate3) Space::Duplicate3<0>;
+
+
+%{
+namespace Space {
+ template <bool B> struct Duplicate4 { void f(){}; };
+}
+%}
+
+// %warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate4;
+namespace Space {
+ template <bool B> struct Duplicate4 { void f(){}; };
+ template <bool B> struct Duplicate4 { void f(){}; };
+}
+%template(Duplicate4) Space::Duplicate4<0>;
+%template(Duplicate4) Space::Duplicate4<0>;
+
diff --git a/Examples/test-suite/errors/cpp_template_duplicate_names.stderr b/Examples/test-suite/errors/cpp_template_duplicate_names.stderr
new file mode 100644
index 000000000..9856ff563
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_duplicate_names.stderr
@@ -0,0 +1,14 @@
+cpp_template_duplicate_names.i:14: Warning 302: Identifier 'Duplicate1' redefined (ignored),
+cpp_template_duplicate_names.i:13: Warning 302: previous definition of 'Duplicate1'.
+cpp_template_duplicate_names.i:14: Warning 302: Identifier 'Duplicate1' redefined (ignored),
+cpp_template_duplicate_names.i:13: Warning 302: previous definition of 'Duplicate1'.
+cpp_template_duplicate_names.i:25: Warning 302: Identifier 'Duplicate2_0' redefined (ignored) (Renamed from 'Duplicate2< 0 >'),
+cpp_template_duplicate_names.i:24: Warning 302: previous definition of 'Duplicate2_0' (Renamed from 'Duplicate2< 0 >').
+cpp_template_duplicate_names.i:35: Warning 302: Identifier 'Duplicate3' redefined (ignored) (Renamed from 'Duplicate3< 0 >'),
+cpp_template_duplicate_names.i:31: Warning 302: previous definition of 'Duplicate3'.
+cpp_template_duplicate_names.i:47: Warning 302: Identifier 'Duplicate4' redefined (ignored),
+cpp_template_duplicate_names.i:46: Warning 302: previous definition of 'Duplicate4'.
+cpp_template_duplicate_names.i:47: Warning 302: Identifier 'Duplicate4' redefined (ignored),
+cpp_template_duplicate_names.i:46: Warning 302: previous definition of 'Duplicate4'.
+cpp_template_duplicate_names.i:50: Warning 302: Identifier 'Duplicate4' redefined (ignored) (Renamed from 'Duplicate4< 0 >'),
+cpp_template_duplicate_names.i:46: Warning 302: previous definition of 'Duplicate4'.
diff --git a/Examples/test-suite/errors/cpp_template_friend.i b/Examples/test-suite/errors/cpp_template_friend.i
index c9d1c9d5d..3b8d85eff 100644
--- a/Examples/test-suite/errors/cpp_template_friend.i
+++ b/Examples/test-suite/errors/cpp_template_friend.i
@@ -1,4 +1,4 @@
-%module cpp_template_friend
+%module xxx
template<typename T> T template_friend1(T);
template<typename T> T template_friend1(T);
diff --git a/Examples/test-suite/errors/cpp_template_scope.i b/Examples/test-suite/errors/cpp_template_scope.i
new file mode 100644
index 000000000..ec0f0a577
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_scope.i
@@ -0,0 +1,57 @@
+%module xxx
+
+namespace std {
+ template<typename T> class vector {};
+}
+
+struct S1 {};
+struct S2 {};
+struct S3 {};
+struct S4 {};
+struct S5 {};
+struct S6 {};
+struct S7 {};
+
+// valid
+namespace std {
+ %template(vi1) vector<S1>;
+ template class vector<S1>;
+}
+
+// valid
+using namespace std;
+%template(vi2) vector<S2>;
+template class vector<S2>;
+
+// valid
+using std::vector;
+%template(vi3) vector<S3>;
+template class vector<S3>;
+
+// ill-formed
+namespace unrelated {
+ using std::vector;
+ %template(vi4) vector<S4>;
+ template class vector<S4>;
+}
+
+// ill-formed
+namespace unrelated {
+ using namespace std;
+ %template(vi5) vector<S5>;
+ template class vector<S5>;
+}
+
+// ill-formed
+namespace unrelated {
+ namespace std {
+ %template(vi6) vector<S6>;
+ template class vector<S6>;
+ }
+}
+
+// ill-formed
+namespace unrelated {
+ %template(vi7) std::vector<S7>;
+ template class std::vector<S7>;
+}
diff --git a/Examples/test-suite/errors/cpp_template_scope.stderr b/Examples/test-suite/errors/cpp_template_scope.stderr
new file mode 100644
index 000000000..e47630268
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_scope.stderr
@@ -0,0 +1,11 @@
+cpp_template_scope.i:18: Warning 320: Explicit template instantiation ignored.
+cpp_template_scope.i:24: Warning 320: Explicit template instantiation ignored.
+cpp_template_scope.i:29: Warning 320: Explicit template instantiation ignored.
+cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
+cpp_template_scope.i:35: Warning 320: Explicit template instantiation ignored.
+cpp_template_scope.i:41: Error: 'vector' resolves to 'std::vector' and was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
+cpp_template_scope.i:42: Warning 320: Explicit template instantiation ignored.
+cpp_template_scope.i:48: Error: 'vector' resolves to 'std::vector' and was incorrectly instantiated in scope 'unrelated::std' instead of within scope 'std'.
+cpp_template_scope.i:49: Warning 320: Explicit template instantiation ignored.
+cpp_template_scope.i:55: Error: 'std::vector' resolves to 'std::vector' and was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
+cpp_template_scope.i:56: Warning 320: Explicit template instantiation ignored.
diff --git a/Examples/test-suite/errors/doxygen_unknown_command.i b/Examples/test-suite/errors/doxygen_unknown_command.i
new file mode 100644
index 000000000..0f32ee966
--- /dev/null
+++ b/Examples/test-suite/errors/doxygen_unknown_command.i
@@ -0,0 +1,6 @@
+%module xxx
+
+/**
+ There is an \unknown Doxygen comment here.
+ */
+void foo();
diff --git a/Examples/test-suite/errors/doxygen_unknown_command.stderr b/Examples/test-suite/errors/doxygen_unknown_command.stderr
new file mode 100644
index 000000000..e5c32cc4b
--- /dev/null
+++ b/Examples/test-suite/errors/doxygen_unknown_command.stderr
@@ -0,0 +1 @@
+doxygen_unknown_command.i:4: Warning 560: Unknown Doxygen command: unknown.
diff --git a/Examples/test-suite/errors/pp_expressions_bad.i b/Examples/test-suite/errors/pp_expressions_bad.i
new file mode 100644
index 000000000..454437f95
--- /dev/null
+++ b/Examples/test-suite/errors/pp_expressions_bad.i
@@ -0,0 +1,43 @@
+%module xxx
+/* Note: needs -Wextra to see these warnings */
+
+/* Divide by zero */
+#define ZERO 0
+
+#if 1%ZERO
+#endif
+#if 2/ZERO
+#endif
+
+#if 1%(5-5)
+#endif
+#if 2/(55-55)
+#endif
+
+/* Floating point */
+#if 1.2
+#endif
+
+#if 2e3
+#endif
+
+#if 0
+#elif 8.8
+#endif
+
+/* Missing whitespace after preproc directive */
+#if123
+#endif
+
+#if456e
+#endif
+
+#if 0
+#warning This should not warn
+#elif1
+#warning This should also not warn
+#endif
+
+#if(1)
+#warning Warning okay: #if(1)
+#endif
diff --git a/Examples/test-suite/errors/pp_expressions_bad.stderr b/Examples/test-suite/errors/pp_expressions_bad.stderr
new file mode 100644
index 000000000..84104c6a8
--- /dev/null
+++ b/Examples/test-suite/errors/pp_expressions_bad.stderr
@@ -0,0 +1,19 @@
+pp_expressions_bad.i:7: Warning 202: Could not evaluate expression '1%ZERO'
+pp_expressions_bad.i:7: Warning 202: Error: 'Modulo by zero in expression'
+pp_expressions_bad.i:9: Warning 202: Could not evaluate expression '2/ZERO'
+pp_expressions_bad.i:9: Warning 202: Error: 'Division by zero in expression'
+pp_expressions_bad.i:12: Warning 202: Could not evaluate expression '1%(5-5)'
+pp_expressions_bad.i:12: Warning 202: Error: 'Modulo by zero in expression'
+pp_expressions_bad.i:14: Warning 202: Could not evaluate expression '2/(55-55)'
+pp_expressions_bad.i:14: Warning 202: Error: 'Division by zero in expression'
+pp_expressions_bad.i:18: Warning 202: Could not evaluate expression '1.2'
+pp_expressions_bad.i:18: Warning 202: Error: 'Floating point constant in preprocessor expression'
+pp_expressions_bad.i:21: Warning 202: Could not evaluate expression '2e3'
+pp_expressions_bad.i:21: Warning 202: Error: 'Floating point constant in preprocessor expression'
+pp_expressions_bad.i:25: Warning 202: Could not evaluate expression '8.8'
+pp_expressions_bad.i:25: Warning 202: Error: 'Floating point constant in preprocessor expression'
+pp_expressions_bad.i:29: Error: Unknown SWIG preprocessor directive: if123 (if this is a block of target language code, delimit it with %{ and %})
+pp_expressions_bad.i:30: Error: Extraneous #endif.
+pp_expressions_bad.i:32: Error: Unknown SWIG preprocessor directive: if456e (if this is a block of target language code, delimit it with %{ and %})
+pp_expressions_bad.i:33: Error: Extraneous #endif.
+pp_expressions_bad.i:42: Warning 204: CPP #warning, "Warning okay: #if(1)".
diff --git a/Examples/test-suite/errors/pp_invalid_exponents.i b/Examples/test-suite/errors/pp_invalid_exponents.i
new file mode 100644
index 000000000..73dcdb145
--- /dev/null
+++ b/Examples/test-suite/errors/pp_invalid_exponents.i
@@ -0,0 +1,7 @@
+%module xxx
+
+#if 123e
+#endif
+
+#if 456.e
+#endif
diff --git a/Examples/test-suite/errors/pp_invalid_exponents.stderr b/Examples/test-suite/errors/pp_invalid_exponents.stderr
new file mode 100644
index 000000000..735a31ceb
--- /dev/null
+++ b/Examples/test-suite/errors/pp_invalid_exponents.stderr
@@ -0,0 +1,6 @@
+:EOF: Error: Exponent does not have any digits
+pp_invalid_exponents.i:3: Warning 202: Could not evaluate expression '123e'
+pp_invalid_exponents.i:3: Warning 202: Error: 'Syntax error'
+:EOF: Error: Exponent does not have any digits
+pp_invalid_exponents.i:6: Warning 202: Could not evaluate expression '456.e'
+pp_invalid_exponents.i:6: Warning 202: Error: 'Syntax error'
diff --git a/Examples/test-suite/errors/pp_macro_missing_expression.i b/Examples/test-suite/errors/pp_macro_missing_expression.i
index 2c7c9855d..a93a76f2e 100644
--- a/Examples/test-suite/errors/pp_macro_missing_expression.i
+++ b/Examples/test-suite/errors/pp_macro_missing_expression.i
@@ -1,4 +1,4 @@
-// Test "Missing identifier for ..." errrors
+// Test "Missing identifier for ..." errors
%module xxx
#ifdef
diff --git a/Examples/test-suite/errors/pp_missing_file.i b/Examples/test-suite/errors/pp_missing_file.i
index 5e3f0ea27..366f159cc 100644
--- a/Examples/test-suite/errors/pp_missing_file.i
+++ b/Examples/test-suite/errors/pp_missing_file.i
@@ -1,3 +1,3 @@
-%module test
+%module xxx
%include "missing_filename.i"
diff --git a/Examples/test-suite/errors/pp_unknowndirective3.i b/Examples/test-suite/errors/pp_unknowndirective3.i
new file mode 100644
index 000000000..77dfd5bb5
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unknowndirective3.i
@@ -0,0 +1,14 @@
+%module xxx
+
+// Testing is_digits detecting gcc linemarkers
+
+// These are valid
+# 1 "/usr/include/stdc-predef.h" 1 3 4
+# 123 "header1.h"
+
+// These are invalid
+#a1 'a.h'
+#1b 'b.h'
+#1c1 'c.h'
+#d1d 'd.h'
+
diff --git a/Examples/test-suite/errors/pp_unknowndirective3.stderr b/Examples/test-suite/errors/pp_unknowndirective3.stderr
new file mode 100644
index 000000000..35bff8a80
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unknowndirective3.stderr
@@ -0,0 +1,4 @@
+pp_unknowndirective3.i:10: Error: Unknown SWIG preprocessor directive: a1 (if this is a block of target language code, delimit it with %{ and %})
+pp_unknowndirective3.i:11: Error: Unknown SWIG preprocessor directive: 1b (if this is a block of target language code, delimit it with %{ and %})
+pp_unknowndirective3.i:12: Error: Unknown SWIG preprocessor directive: 1c1 (if this is a block of target language code, delimit it with %{ and %})
+pp_unknowndirective3.i:13: Error: Unknown SWIG preprocessor directive: d1d (if this is a block of target language code, delimit it with %{ and %})
diff --git a/Examples/test-suite/exception_order.i b/Examples/test-suite/exception_order.i
index 02674fef9..e2411634b 100644
--- a/Examples/test-suite/exception_order.i
+++ b/Examples/test-suite/exception_order.i
@@ -12,10 +12,10 @@
%include "exception.i"
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW1(T1)
%}
/*
@@ -99,16 +99,16 @@
int efoovar;
/* caught by the user's throw definition */
- int foo() throw(E1)
+ int foo() TESTCASE_THROW1(E1)
{
throw E1();
- return 0;
+ return 0;
}
-
- int bar() throw(E2)
+
+ int bar() TESTCASE_THROW1(E2)
{
throw E2();
- return 0;
+ return 0;
}
/* caught by %postexception */
@@ -146,3 +146,4 @@ bool is_python_builtin() { return false; }
%template(ET_i) ET<int>;
%template(ET_d) ET<double>;
+
diff --git a/Examples/test-suite/exception_partial_info.i b/Examples/test-suite/exception_partial_info.i
index 47b046735..3ac465cf6 100644
--- a/Examples/test-suite/exception_partial_info.i
+++ b/Examples/test-suite/exception_partial_info.i
@@ -2,10 +2,10 @@
// This produced compilable code for Tcl, Python in 1.3.27, fails in 1.3.29
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW1(T1)
%}
%{
@@ -36,8 +36,8 @@ class ex2 : public myException
class Impl
{
public:
- void f1() throw (myException) { ex1 e; throw e; }
- void f2() throw (myException) { ex2 e; throw e; }
+ void f1() TESTCASE_THROW1(myException) { ex1 e; throw e; }
+ void f2() TESTCASE_THROW1(myException) { ex2 e; throw e; }
};
%}
diff --git a/Examples/test-suite/extend.i b/Examples/test-suite/extend.i
index 29e258f5b..ab0c651a5 100644
--- a/Examples/test-suite/extend.i
+++ b/Examples/test-suite/extend.i
@@ -1,5 +1,9 @@
%module extend
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%extend Base {
~Base() {
delete $self;
diff --git a/Examples/test-suite/extern_throws.i b/Examples/test-suite/extern_throws.i
index eab26244e..92ece4158 100644
--- a/Examples/test-suite/extern_throws.i
+++ b/Examples/test-suite/extern_throws.i
@@ -1,18 +1,18 @@
%module extern_throws
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW1(T1)
%}
%inline %{
#include <exception>
-extern int get() throw(std::exception);
+extern int get() TESTCASE_THROW1(std::exception);
%}
%{
-int get() throw(std::exception) { return 0; }
+int get() TESTCASE_THROW1(std::exception) { return 0; }
%}
diff --git a/Examples/test-suite/features.i b/Examples/test-suite/features.i
index 2ccbe725a..a8b56527d 100644
--- a/Examples/test-suite/features.i
+++ b/Examples/test-suite/features.i
@@ -2,6 +2,10 @@
%warnfilter(SWIGWARN_LANG_IDENTIFIER,SWIGWARN_IGNORE_OPERATOR_PLUSEQ);
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
// This testcase checks that %feature is working for templates and non user supplied constructors/destructors and is just generally working
// If the default %exception is used it will not compile. It shouldn't get used.
diff --git a/Examples/test-suite/funcptr_cpp.i b/Examples/test-suite/funcptr_cpp.i
index b63749dc1..d8ec8de4d 100644
--- a/Examples/test-suite/funcptr_cpp.i
+++ b/Examples/test-suite/funcptr_cpp.i
@@ -15,6 +15,9 @@ int & addByReference(const int &a, int b) { static int val; val = a+b; return va
int call1(int (*d)(const int &, int), int a, int b) { return d(a, b); }
int call2(int * (*d)(const int &, int), int a, int b) { return *d(a, b); }
int call3(int & (*d)(const int &, int), int a, int b) { return d(a, b); }
+int call4(int & (*d)(int &, int *), int a, int b) { return d(a, &b); }
+int call5(int & (*d)(int &, int const * const), int a, int b) { return d(a, &b); }
+int callconst1(int (* const d)(const int &, int), int a, int b) { return d(a, b); }
%}
%constant int (*ADD_BY_VALUE)(const int &, int) = addByValue;
diff --git a/Examples/test-suite/functors.i b/Examples/test-suite/functors.i
new file mode 100644
index 000000000..363123000
--- /dev/null
+++ b/Examples/test-suite/functors.i
@@ -0,0 +1,33 @@
+%module functors
+
+// Rename operator() only if the language does not already do this by default
+#if defined(SWIGCSHARP) || defined(SWIGGO) || defined(SWIGGUILE) || defined(SWIGJAVA) || defined(SWIGJAVASCRIPT) || defined(SWIGPHP) || defined(SWIGSCILAB) || defined(SWIGTCL)
+%rename(Funktor) operator();
+#endif
+
+%inline %{
+class Functor0 {
+ int num;
+public:
+ Functor0(int num) : num(num) {}
+ int operator()() { return -num; }
+ int operate() { return this->operator()(); }
+};
+
+class Functor1 {
+ int num;
+public:
+ Functor1(int num) : num(num) {}
+ int operator()(int x) { return num + x; }
+ int operate(int x) { return this->operator()(x); }
+};
+
+class Functor2 {
+ int num;
+public:
+ Functor2(int num) : num(num) {}
+ int operator()(int x, int x2) { return num + x + x2; }
+ int operate(int x, int x2) { return this->operator()(x, x2); }
+};
+%}
+
diff --git a/Examples/test-suite/go/Makefile.in b/Examples/test-suite/go/Makefile.in
index 01989b0d3..8283327d6 100644
--- a/Examples/test-suite/go/Makefile.in
+++ b/Examples/test-suite/go/Makefile.in
@@ -6,24 +6,10 @@ LANGUAGE = go
GO = @GO@
GOGCC = @GOGCC@
GCCGO = @GCCGO@
-GO1 = @GO1@
-GO12 = @GO12@
-GO13 = @GO13@
-GO15 = @GO15@
-GOC = @GOC@
GOVERSIONOPTION = @GOVERSIONOPTION@
host = @host@
SCRIPTSUFFIX = _runme.go
-GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1); then echo tool $(GOC:c=g); fi`
-GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
-GOTOOL = `if $(GO1) ; then echo go tool; fi`
-GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-
-GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
-
-OSXOLDGOLINKFLAGS = `if [ -n "\`$(GO) $(GOVERSIONOPTION) | grep -E 'go1($|.0|.1|.2|.3)'\`" ] && [ -n "\`echo $(host) | grep darwin\`" ]; then echo "-Wl,-U,__cgo_topofstack"; fi`
-
SO = @SO@
srcdir = @srcdir@
@@ -49,31 +35,26 @@ INCLUDES = -I$(abs_top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase_cpp)
- if ! $(GO15); then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
- TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
- $(LANGUAGE)$(VARIANT)_cpp_nocgo && \
- $(run_testcase_cpp); \
- fi
%.ctest:
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
- if ! $(GO15); then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CSRCS='$(CSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
- TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
- $(LANGUAGE)$(VARIANT)_nocgo && \
- $(run_testcase); \
- fi
%.multicpptest:
$(setup)
- +$(swig_and_compile_multi_cpp)
+ mkdir -p gopath/$*/src 2>/dev/null || true
+ if ! test -d gopath/$*/src/swigtests; then \
+ (cd gopath/$*/src && ln -s . swigtests); \
+ fi
+ +for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
+ GOMOD="$*" \
+ $(LANGUAGE)$(VARIANT)_cpp; \
+ done
$(run_multi_testcase)
li_windows.cpptest:
@@ -82,85 +63,108 @@ li_windows.cpptest:
multi_import.multicpptest:
$(setup)
+ mkdir -p gopath/multi_import/src 2>/dev/null || true
+ if ! test -d gopath/multi_import/src/swigtests; then \
+ (cd gopath/multi_import/src && ln -s . swigtests); \
+ fi
for f in multi_import_b multi_import_a; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
+ GOMOD="multi_import" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
$(run_multi_testcase)
go_subdir_import.multicpptest:
$(setup)
- mkdir -p testdir/go_subdir_import/
- mkdir -p gopath/src/testdir/go_subdir_import/
+ mkdir -p gopath/go_subdir_import/src 2>/dev/null || true
+ if ! test -d gopath/go_subdir_import/src/swigtests; then \
+ (cd gopath/go_subdir_import/src && ln -s . swigtests); \
+ fi
+ mkdir -p testdir/go_subdir_import 2>/dev/null || true
+ mkdir -p gopath/go_subdir_import/src/testdir/go_subdir_import 2>/dev/null || true
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INTERFACEPATH='$(SRCDIR)$(INTERFACEDIR)go_subdir_import_b.i' \
INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT) -outdir .' NOLINK=true \
TARGET='$(TARGETPREFIX)go_subdir_import_b$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' \
INTERFACE='testdir/go_subdir_import/go_subdir_import_b.i' \
+ GOMOD="go_subdir_import" \
$(LANGUAGE)$(VARIANT)_cpp;
for f in testdir/go_subdir_import/go_subdir_import_c go_subdir_import_a ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
+ GOMOD="go_subdir_import" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
- if $(GOGCC); then \
- cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a gopath/src/testdir/go_subdir_import/go_subdir_import_b.gox; \
- cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a .; \
- cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a gopath/src/testdir/go_subdir_import/go_subdir_import_c.gox; \
- cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a testdir/go_subdir_import/; \
- fi
$(run_multi_testcase)
# Runs the testcase.
run_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- fi && \
+ GOPATH=`pwd`/gopath/; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ mkdir gopath/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
+ cp gopath/src/$*/* gopath/src/swigtests/$*/; \
+ mkdir gopath/src/$*/runme 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
+ (cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
+ cp gopath/src/$*/runme/runme $*_runme; \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
run_testcase_cpp = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- fi && \
+ GOPATH=`pwd`/gopath/; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ mkdir gopath/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
+ cp gopath/src/$*/* gopath/src/swigtests/$*/; \
+ mkdir gopath/src/$*/runme 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
+ (cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
+ cp gopath/src/$*/runme/runme $*_runme; \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
run_multi_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I . -I gopath/src $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
- $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.a; done` -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- fi && \
+ files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
+ mkdir gopath/$*/src/$* 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
+ GOPATH="`pwd`/gopath/$*"; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ (cd gopath/$*/src/$* && \
+ $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
@@ -182,12 +186,3 @@ clean:
rm -f import_stl_a.go import_stl_a.gox
rm -f import_stl_b.go import_stl_b.gox
rm -rf gopath
-
-cvsignore:
- @echo '*_gc.c *_wrap.* *.so *.dll *.exp *.lib'
- @echo Makefile
- @echo mod_a.go mod_b.go imports_a.go imports_b.go
- @echo clientdata_prop_a.go clientdata_prop_b.go
- @echo multi_import_a.go multi_import_b.go
- @echo packageoption_a.go packageoption_b.go packageoption_c.go
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.go; done
diff --git a/Examples/test-suite/go/abstract_access_runme.go b/Examples/test-suite/go/abstract_access_runme.go
index a2cfeda92..0a0e56fef 100644
--- a/Examples/test-suite/go/abstract_access_runme.go
+++ b/Examples/test-suite/go/abstract_access_runme.go
@@ -1,6 +1,6 @@
package main
-import "./abstract_access"
+import "swigtests/abstract_access"
func main() {
d := abstract_access.NewD()
diff --git a/Examples/test-suite/go/abstract_typedef2_runme.go b/Examples/test-suite/go/abstract_typedef2_runme.go
index ef760e45d..5e2ed1e7a 100644
--- a/Examples/test-suite/go/abstract_typedef2_runme.go
+++ b/Examples/test-suite/go/abstract_typedef2_runme.go
@@ -1,6 +1,6 @@
package main
-import "./abstract_typedef2"
+import "swigtests/abstract_typedef2"
func main() {
abstract_typedef2.NewA_UF()
diff --git a/Examples/test-suite/go/abstract_typedef_runme.go b/Examples/test-suite/go/abstract_typedef_runme.go
index 99ff94ded..1ad49f59d 100644
--- a/Examples/test-suite/go/abstract_typedef_runme.go
+++ b/Examples/test-suite/go/abstract_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import "./abstract_typedef"
+import "swigtests/abstract_typedef"
func main() {
e := abstract_typedef.NewEngine()
diff --git a/Examples/test-suite/go/abstract_virtual_runme.go b/Examples/test-suite/go/abstract_virtual_runme.go
index b87cf9b5c..d333d50b3 100644
--- a/Examples/test-suite/go/abstract_virtual_runme.go
+++ b/Examples/test-suite/go/abstract_virtual_runme.go
@@ -1,6 +1,6 @@
package main
-import "./abstract_virtual"
+import "swigtests/abstract_virtual"
func main() {
abstract_virtual.NewD()
diff --git a/Examples/test-suite/go/argout_runme.go b/Examples/test-suite/go/argout_runme.go
index 5f7017e73..b2edf54b6 100644
--- a/Examples/test-suite/go/argout_runme.go
+++ b/Examples/test-suite/go/argout_runme.go
@@ -1,6 +1,6 @@
package main
-import wrap "./argout"
+import wrap "swigtests/argout"
func main() {
ip := wrap.New_intp()
diff --git a/Examples/test-suite/go/array_member_runme.go b/Examples/test-suite/go/array_member_runme.go
index d8a8fac2b..d8c3896ee 100644
--- a/Examples/test-suite/go/array_member_runme.go
+++ b/Examples/test-suite/go/array_member_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./array_member"
+import . "swigtests/array_member"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/arrays_global_runme.go b/Examples/test-suite/go/arrays_global_runme.go
index 0ff40090c..9c4a9e57a 100644
--- a/Examples/test-suite/go/arrays_global_runme.go
+++ b/Examples/test-suite/go/arrays_global_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./arrays_global"
+import . "swigtests/arrays_global"
func main() {
SetArray_i(GetArray_const_i())
diff --git a/Examples/test-suite/go/char_binary_runme.go b/Examples/test-suite/go/char_binary_runme.go
index 50f2e121d..3c8c2d72d 100644
--- a/Examples/test-suite/go/char_binary_runme.go
+++ b/Examples/test-suite/go/char_binary_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./char_binary"
+import . "swigtests/char_binary"
func main() {
t := NewTest()
diff --git a/Examples/test-suite/go/class_ignore_runme.go b/Examples/test-suite/go/class_ignore_runme.go
index 82e52eff5..11cf81d91 100644
--- a/Examples/test-suite/go/class_ignore_runme.go
+++ b/Examples/test-suite/go/class_ignore_runme.go
@@ -1,6 +1,6 @@
package main
-import "./class_ignore"
+import "swigtests/class_ignore"
func main() {
a := class_ignore.NewBar()
diff --git a/Examples/test-suite/go/class_scope_weird_runme.go b/Examples/test-suite/go/class_scope_weird_runme.go
index 332586f31..477699061 100644
--- a/Examples/test-suite/go/class_scope_weird_runme.go
+++ b/Examples/test-suite/go/class_scope_weird_runme.go
@@ -1,6 +1,6 @@
package main
-import "./class_scope_weird"
+import "swigtests/class_scope_weird"
func main() {
f := class_scope_weird.NewFoo()
diff --git a/Examples/test-suite/go/compactdefaultargs_runme.go b/Examples/test-suite/go/compactdefaultargs_runme.go
index 46f3ff3f9..c9e90087f 100644
--- a/Examples/test-suite/go/compactdefaultargs_runme.go
+++ b/Examples/test-suite/go/compactdefaultargs_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./compactdefaultargs"
+import . "swigtests/compactdefaultargs"
func main() {
defaults1 := NewDefaults1(1000)
diff --git a/Examples/test-suite/go/constover_runme.go b/Examples/test-suite/go/constover_runme.go
index f961e01b5..51d965e7f 100644
--- a/Examples/test-suite/go/constover_runme.go
+++ b/Examples/test-suite/go/constover_runme.go
@@ -1,9 +1,10 @@
package main
import (
- "./constover"
"fmt"
"os"
+
+ "swigtests/constover"
)
func main() {
diff --git a/Examples/test-suite/go/constructor_copy_runme.go b/Examples/test-suite/go/constructor_copy_runme.go
index d9b77a9db..ca4725549 100644
--- a/Examples/test-suite/go/constructor_copy_runme.go
+++ b/Examples/test-suite/go/constructor_copy_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./constructor_copy"
+import . "swigtests/constructor_copy"
func main() {
f1 := NewFoo1(3)
diff --git a/Examples/test-suite/go/contract_runme.go b/Examples/test-suite/go/contract_runme.go
index b20a1a64f..7c9d0979e 100644
--- a/Examples/test-suite/go/contract_runme.go
+++ b/Examples/test-suite/go/contract_runme.go
@@ -1,6 +1,6 @@
package main
-import "./contract"
+import "swigtests/contract"
func main() {
contract.Test_preassert(1, 2)
diff --git a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
index f4b84b1ee..926b6f756 100644
--- a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
+++ b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "./cpp11_strongly_typed_enumerations"
+import . "swigtests/cpp11_strongly_typed_enumerations"
func enumCheck(actual int, expected int) int {
if actual != expected {
diff --git a/Examples/test-suite/go/cpp_enum_runme.go b/Examples/test-suite/go/cpp_enum_runme.go
index 7d7db953d..9b8930a44 100644
--- a/Examples/test-suite/go/cpp_enum_runme.go
+++ b/Examples/test-suite/go/cpp_enum_runme.go
@@ -1,6 +1,6 @@
package main
-import "./cpp_enum"
+import "swigtests/cpp_enum"
func main() {
f := cpp_enum.NewFoo()
diff --git a/Examples/test-suite/go/cpp_namespace_runme.go b/Examples/test-suite/go/cpp_namespace_runme.go
index 8482b043f..71affc57d 100644
--- a/Examples/test-suite/go/cpp_namespace_runme.go
+++ b/Examples/test-suite/go/cpp_namespace_runme.go
@@ -1,7 +1,7 @@
// Note: This example assumes that namespaces are flattened
package main
-import "./cpp_namespace"
+import "swigtests/cpp_namespace"
func main() {
n := cpp_namespace.Fact(4)
diff --git a/Examples/test-suite/go/cpp_static_runme.go b/Examples/test-suite/go/cpp_static_runme.go
index ead433466..d482298eb 100644
--- a/Examples/test-suite/go/cpp_static_runme.go
+++ b/Examples/test-suite/go/cpp_static_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./cpp_static"
+import . "swigtests/cpp_static"
func main() {
StaticFunctionTestStatic_func()
diff --git a/Examples/test-suite/go/default_args_runme.go b/Examples/test-suite/go/default_args_runme.go
index 38243ac44..5b6f404e3 100644
--- a/Examples/test-suite/go/default_args_runme.go
+++ b/Examples/test-suite/go/default_args_runme.go
@@ -1,6 +1,6 @@
package main
-import "./default_args"
+import "swigtests/default_args"
func main() {
if default_args.StaticsStaticmethod() != 60 {
diff --git a/Examples/test-suite/go/default_constructor_runme.go b/Examples/test-suite/go/default_constructor_runme.go
index 40a5a6e49..90d960143 100644
--- a/Examples/test-suite/go/default_constructor_runme.go
+++ b/Examples/test-suite/go/default_constructor_runme.go
@@ -1,6 +1,6 @@
package main
-import dc "./default_constructor"
+import dc "swigtests/default_constructor"
func main() {
a := dc.NewA()
diff --git a/Examples/test-suite/go/director_alternating_runme.go b/Examples/test-suite/go/director_alternating_runme.go
index 10f6774a3..2df31db82 100644
--- a/Examples/test-suite/go/director_alternating_runme.go
+++ b/Examples/test-suite/go/director_alternating_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./director_alternating"
+import . "swigtests/director_alternating"
func main() {
id := GetBar().Id()
diff --git a/Examples/test-suite/go/director_basic_runme.go b/Examples/test-suite/go/director_basic_runme.go
index 0ce780bbd..c308f2520 100644
--- a/Examples/test-suite/go/director_basic_runme.go
+++ b/Examples/test-suite/go/director_basic_runme.go
@@ -1,6 +1,6 @@
package main
-import "./director_basic"
+import "swigtests/director_basic"
type GoFoo struct{}
diff --git a/Examples/test-suite/go/director_classic_runme.go b/Examples/test-suite/go/director_classic_runme.go
index 45e89eac5..d8acc1337 100644
--- a/Examples/test-suite/go/director_classic_runme.go
+++ b/Examples/test-suite/go/director_classic_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "./director_classic"
+import . "swigtests/director_classic"
type TargetLangPerson struct{} // From Person
func (p *TargetLangPerson) Id() string {
diff --git a/Examples/test-suite/go/director_default_runme.go b/Examples/test-suite/go/director_default_runme.go
index 2f963b239..557d5c54b 100644
--- a/Examples/test-suite/go/director_default_runme.go
+++ b/Examples/test-suite/go/director_default_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./director_default"
+import . "swigtests/director_default"
func main() {
NewFoo()
diff --git a/Examples/test-suite/go/director_detect_runme.go b/Examples/test-suite/go/director_detect_runme.go
index 9f1ad94a9..f82a0c04a 100644
--- a/Examples/test-suite/go/director_detect_runme.go
+++ b/Examples/test-suite/go/director_detect_runme.go
@@ -1,6 +1,6 @@
package main
-import "./director_detect"
+import "swigtests/director_detect"
type MyBar struct {
val int
diff --git a/Examples/test-suite/go/director_enum_runme.go b/Examples/test-suite/go/director_enum_runme.go
index 5653fda40..3e67417b2 100644
--- a/Examples/test-suite/go/director_enum_runme.go
+++ b/Examples/test-suite/go/director_enum_runme.go
@@ -1,6 +1,6 @@
package main
-import "./director_enum"
+import "swigtests/director_enum"
type MyFoo struct{} // From director_enum.Foo
func (p *MyFoo) Say_hi(val director_enum.EnumDirectorHello) director_enum.EnumDirectorHello {
diff --git a/Examples/test-suite/go/director_exception_runme.go b/Examples/test-suite/go/director_exception_runme.go
index 29df3e40b..167d75193 100644
--- a/Examples/test-suite/go/director_exception_runme.go
+++ b/Examples/test-suite/go/director_exception_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./director_exception"
+import . "swigtests/director_exception"
type Exception struct {
msg string
diff --git a/Examples/test-suite/go/director_extend_runme.go b/Examples/test-suite/go/director_extend_runme.go
index 70e2ab41b..adfb6ddb7 100644
--- a/Examples/test-suite/go/director_extend_runme.go
+++ b/Examples/test-suite/go/director_extend_runme.go
@@ -5,7 +5,7 @@
package main
-import . "./director_extend"
+import . "swigtests/director_extend"
func main() {
m := NewSpObject()
diff --git a/Examples/test-suite/go/director_finalizer_runme.go b/Examples/test-suite/go/director_finalizer_runme.go
index 96fcf860e..5cd9d95e0 100644
--- a/Examples/test-suite/go/director_finalizer_runme.go
+++ b/Examples/test-suite/go/director_finalizer_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./director_finalizer"
+import . "swigtests/director_finalizer"
type MyFoo struct{} // From Foo
func DeleteMyFoo(p Foo) {
diff --git a/Examples/test-suite/go/director_frob_runme.go b/Examples/test-suite/go/director_frob_runme.go
index a6afedf69..7354fa76b 100644
--- a/Examples/test-suite/go/director_frob_runme.go
+++ b/Examples/test-suite/go/director_frob_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./director_frob"
+import . "swigtests/director_frob"
func main() {
foo := NewBravo()
diff --git a/Examples/test-suite/go/director_nested_runme.go b/Examples/test-suite/go/director_nested_runme.go
index 2d3bc77e1..b04893582 100644
--- a/Examples/test-suite/go/director_nested_runme.go
+++ b/Examples/test-suite/go/director_nested_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./director_nested"
+import . "swigtests/director_nested"
type A struct{} // From FooBar_int
func (p *A) Do_step() string {
diff --git a/Examples/test-suite/go/director_profile_runme.go b/Examples/test-suite/go/director_profile_runme.go
index 87edcbe26..da0ea219b 100644
--- a/Examples/test-suite/go/director_profile_runme.go
+++ b/Examples/test-suite/go/director_profile_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "./director_profile"
+import "swigtests/director_profile"
type MyB struct{} // From director_profile.B
func (p *MyB) Vfi(a int) int {
diff --git a/Examples/test-suite/go/director_protected_runme.go b/Examples/test-suite/go/director_protected_runme.go
index 24adfe7bd..0012ccdb2 100644
--- a/Examples/test-suite/go/director_protected_runme.go
+++ b/Examples/test-suite/go/director_protected_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./director_protected"
+import . "swigtests/director_protected"
type FooBar struct{} // From Bar
func (p *FooBar) Ping() string {
diff --git a/Examples/test-suite/go/director_string_runme.go b/Examples/test-suite/go/director_string_runme.go
index c5201ab96..0c73b6a29 100644
--- a/Examples/test-suite/go/director_string_runme.go
+++ b/Examples/test-suite/go/director_string_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./director_string"
+import . "swigtests/director_string"
type B struct { // From A
abi A
diff --git a/Examples/test-suite/go/director_unroll_runme.go b/Examples/test-suite/go/director_unroll_runme.go
index 6d2894a72..560034c8a 100644
--- a/Examples/test-suite/go/director_unroll_runme.go
+++ b/Examples/test-suite/go/director_unroll_runme.go
@@ -1,6 +1,6 @@
package main
-import "./director_unroll"
+import "swigtests/director_unroll"
type MyFoo struct{} // From director_unroll.Foo
func (p *MyFoo) Ping() string {
diff --git a/Examples/test-suite/go/disown_runme.go b/Examples/test-suite/go/disown_runme.go
index 3e853de59..ba072a888 100644
--- a/Examples/test-suite/go/disown_runme.go
+++ b/Examples/test-suite/go/disown_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./disown"
+import . "swigtests/disown"
func main() {
a := NewA()
diff --git a/Examples/test-suite/go/dynamic_cast_runme.go b/Examples/test-suite/go/dynamic_cast_runme.go
index 476734805..213bc0ce5 100644
--- a/Examples/test-suite/go/dynamic_cast_runme.go
+++ b/Examples/test-suite/go/dynamic_cast_runme.go
@@ -1,6 +1,6 @@
package main
-import "./dynamic_cast"
+import "swigtests/dynamic_cast"
func main() {
f := dynamic_cast.NewFoo()
diff --git a/Examples/test-suite/go/empty_c_runme.go b/Examples/test-suite/go/empty_c_runme.go
index 831a56118..f093103f6 100644
--- a/Examples/test-suite/go/empty_c_runme.go
+++ b/Examples/test-suite/go/empty_c_runme.go
@@ -1,6 +1,6 @@
package main
-import _ "./empty_c"
+import _ "swigtests/empty_c"
func main() {
}
diff --git a/Examples/test-suite/go/empty_runme.go b/Examples/test-suite/go/empty_runme.go
index f74285cb0..03f423b8b 100644
--- a/Examples/test-suite/go/empty_runme.go
+++ b/Examples/test-suite/go/empty_runme.go
@@ -1,6 +1,6 @@
package main
-import _ "./empty"
+import _ "swigtests/empty"
func main() {
}
diff --git a/Examples/test-suite/go/enum_template_runme.go b/Examples/test-suite/go/enum_template_runme.go
index 269fe7d5b..7f43eab68 100644
--- a/Examples/test-suite/go/enum_template_runme.go
+++ b/Examples/test-suite/go/enum_template_runme.go
@@ -1,6 +1,6 @@
package main
-import "./enum_template"
+import "swigtests/enum_template"
func main() {
if enum_template.MakeETest() != 1 {
diff --git a/Examples/test-suite/go/enums_runme.go b/Examples/test-suite/go/enums_runme.go
index ab193f74b..4a879a048 100644
--- a/Examples/test-suite/go/enums_runme.go
+++ b/Examples/test-suite/go/enums_runme.go
@@ -1,6 +1,6 @@
package main
-import "./enums"
+import "swigtests/enums"
func main() {
enums.Bar2(1)
diff --git a/Examples/test-suite/go/exception_order_runme.go b/Examples/test-suite/go/exception_order_runme.go
index 626a826f8..ee67712fc 100644
--- a/Examples/test-suite/go/exception_order_runme.go
+++ b/Examples/test-suite/go/exception_order_runme.go
@@ -1,7 +1,7 @@
package main
import "strings"
-import . "./exception_order"
+import . "swigtests/exception_order"
func main() {
a := NewA()
diff --git a/Examples/test-suite/go/extend_placement_runme.go b/Examples/test-suite/go/extend_placement_runme.go
index efa776e31..879589679 100644
--- a/Examples/test-suite/go/extend_placement_runme.go
+++ b/Examples/test-suite/go/extend_placement_runme.go
@@ -1,6 +1,6 @@
package main
-import "./extend_placement"
+import "swigtests/extend_placement"
func main() {
foo := extend_placement.NewFoo()
diff --git a/Examples/test-suite/go/extend_template_ns_runme.go b/Examples/test-suite/go/extend_template_ns_runme.go
index 164a31b26..b1dd43a78 100644
--- a/Examples/test-suite/go/extend_template_ns_runme.go
+++ b/Examples/test-suite/go/extend_template_ns_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./extend_template_ns"
+import . "swigtests/extend_template_ns"
func main() {
f := NewFoo_One()
diff --git a/Examples/test-suite/go/extend_template_runme.go b/Examples/test-suite/go/extend_template_runme.go
index 5adb4b3c2..4a6b7099b 100644
--- a/Examples/test-suite/go/extend_template_runme.go
+++ b/Examples/test-suite/go/extend_template_runme.go
@@ -1,6 +1,6 @@
package main
-import "./extend_template"
+import "swigtests/extend_template"
func main() {
f := extend_template.NewFoo_0()
diff --git a/Examples/test-suite/go/extend_variable_runme.go b/Examples/test-suite/go/extend_variable_runme.go
index c6428c467..278bffed6 100644
--- a/Examples/test-suite/go/extend_variable_runme.go
+++ b/Examples/test-suite/go/extend_variable_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./extend_variable"
+import . "swigtests/extend_variable"
func main() {
if FooBar != 42 {
diff --git a/Examples/test-suite/go/extern_c_runme.go b/Examples/test-suite/go/extern_c_runme.go
index 0fb5b21cc..1cbfd9d80 100644
--- a/Examples/test-suite/go/extern_c_runme.go
+++ b/Examples/test-suite/go/extern_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "./extern_c"
+import "swigtests/extern_c"
func main() {
extern_c.RealFunction(2)
diff --git a/Examples/test-suite/go/friends_runme.go b/Examples/test-suite/go/friends_runme.go
index 9f223fcac..b6b9e93f3 100644
--- a/Examples/test-suite/go/friends_runme.go
+++ b/Examples/test-suite/go/friends_runme.go
@@ -1,6 +1,6 @@
package main
-import "./friends"
+import "swigtests/friends"
func main() {
a := friends.NewA(2)
diff --git a/Examples/test-suite/go/fvirtual_runme.go b/Examples/test-suite/go/fvirtual_runme.go
index 8810d5cbb..01b94f419 100644
--- a/Examples/test-suite/go/fvirtual_runme.go
+++ b/Examples/test-suite/go/fvirtual_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./fvirtual"
+import . "swigtests/fvirtual"
func main() {
sw := NewNodeSwitch()
diff --git a/Examples/test-suite/go/global_ns_arg_runme.go b/Examples/test-suite/go/global_ns_arg_runme.go
index ece779c9c..aeacd91a3 100644
--- a/Examples/test-suite/go/global_ns_arg_runme.go
+++ b/Examples/test-suite/go/global_ns_arg_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./global_ns_arg"
+import . "swigtests/global_ns_arg"
func main() {
Foo(1)
diff --git a/Examples/test-suite/go/go_director_inout_runme.go b/Examples/test-suite/go/go_director_inout_runme.go
index 9b9df318e..171b3c223 100644
--- a/Examples/test-suite/go/go_director_inout_runme.go
+++ b/Examples/test-suite/go/go_director_inout_runme.go
@@ -1,7 +1,7 @@
package main
import (
- wrap "./go_director_inout"
+ wrap "swigtests/go_director_inout"
)
type GoMyClass struct {}
diff --git a/Examples/test-suite/go/go_inout_runme.go b/Examples/test-suite/go/go_inout_runme.go
index 9aa0cd0c5..2dc5b9908 100644
--- a/Examples/test-suite/go/go_inout_runme.go
+++ b/Examples/test-suite/go/go_inout_runme.go
@@ -5,7 +5,7 @@ import (
"fmt"
"reflect"
- "./go_inout"
+ "swigtests/go_inout"
)
type S struct {
diff --git a/Examples/test-suite/go/go_subdir_import_runme.go b/Examples/test-suite/go/go_subdir_import_runme.go
index f90a6eb54..a040c993f 100644
--- a/Examples/test-suite/go/go_subdir_import_runme.go
+++ b/Examples/test-suite/go/go_subdir_import_runme.go
@@ -1,9 +1,9 @@
package main
import (
- "go_subdir_import_a"
- "testdir/go_subdir_import/go_subdir_import_b"
- "testdir/go_subdir_import/go_subdir_import_c"
+ "swigtests/go_subdir_import_a"
+ "swigtests/testdir/go_subdir_import/go_subdir_import_b"
+ "swigtests/testdir/go_subdir_import/go_subdir_import_c"
)
func main() {
diff --git a/Examples/test-suite/go/grouping_runme.go b/Examples/test-suite/go/grouping_runme.go
index c63d6fb12..d5f347579 100644
--- a/Examples/test-suite/go/grouping_runme.go
+++ b/Examples/test-suite/go/grouping_runme.go
@@ -1,6 +1,6 @@
package main
-import "./grouping"
+import "swigtests/grouping"
func main() {
x := grouping.Test1(42)
diff --git a/Examples/test-suite/go/import_nomodule_runme.go b/Examples/test-suite/go/import_nomodule_runme.go
index a6bbd7de5..23680159d 100644
--- a/Examples/test-suite/go/import_nomodule_runme.go
+++ b/Examples/test-suite/go/import_nomodule_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./import_nomodule"
+import . "swigtests/import_nomodule"
func main() {
f := Create_Foo()
diff --git a/Examples/test-suite/go/imports_runme.go b/Examples/test-suite/go/imports_runme.go
index 896036cbf..a67ae407b 100644
--- a/Examples/test-suite/go/imports_runme.go
+++ b/Examples/test-suite/go/imports_runme.go
@@ -2,8 +2,8 @@
package main
-import "imports_b"
-import "imports_a"
+import "swigtests/imports_b"
+import "swigtests/imports_a"
func main() {
x := imports_b.NewB()
diff --git a/Examples/test-suite/go/inctest_runme.go b/Examples/test-suite/go/inctest_runme.go
index f8a2c116c..490721e75 100644
--- a/Examples/test-suite/go/inctest_runme.go
+++ b/Examples/test-suite/go/inctest_runme.go
@@ -1,6 +1,6 @@
package main
-import "./inctest"
+import "swigtests/inctest"
func main() {
inctest.NewA()
diff --git a/Examples/test-suite/go/inherit_member_runme.go b/Examples/test-suite/go/inherit_member_runme.go
index 599a0eb56..10dabad96 100644
--- a/Examples/test-suite/go/inherit_member_runme.go
+++ b/Examples/test-suite/go/inherit_member_runme.go
@@ -1,6 +1,6 @@
package main
-import wrap "./inherit_member"
+import wrap "swigtests/inherit_member"
func main() {
s := wrap.NewChild()
diff --git a/Examples/test-suite/go/inherit_missing_runme.go b/Examples/test-suite/go/inherit_missing_runme.go
index ba9a2a516..b4706e974 100644
--- a/Examples/test-suite/go/inherit_missing_runme.go
+++ b/Examples/test-suite/go/inherit_missing_runme.go
@@ -1,6 +1,6 @@
package main
-import "./inherit_missing"
+import "swigtests/inherit_missing"
func main() {
a := inherit_missing.New_Foo()
diff --git a/Examples/test-suite/go/input_runme.go b/Examples/test-suite/go/input_runme.go
index 207bdaa28..c5eb9e45d 100644
--- a/Examples/test-suite/go/input_runme.go
+++ b/Examples/test-suite/go/input_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./input"
+import . "swigtests/input"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/keyword_rename_c_runme.go b/Examples/test-suite/go/keyword_rename_c_runme.go
index 425e38a26..28f6ddd12 100644
--- a/Examples/test-suite/go/keyword_rename_c_runme.go
+++ b/Examples/test-suite/go/keyword_rename_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "./keyword_rename_c"
+import "swigtests/keyword_rename_c"
func main() {
keyword_rename_c.Xgo(1)
diff --git a/Examples/test-suite/go/keyword_rename_runme.go b/Examples/test-suite/go/keyword_rename_runme.go
index e36bc5968..f93c7ab14 100644
--- a/Examples/test-suite/go/keyword_rename_runme.go
+++ b/Examples/test-suite/go/keyword_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "./keyword_rename"
+import "swigtests/keyword_rename"
func main() {
keyword_rename.Xgo(1)
diff --git a/Examples/test-suite/go/li_attribute_runme.go b/Examples/test-suite/go/li_attribute_runme.go
index 5d2c3d0c3..0702b898f 100644
--- a/Examples/test-suite/go/li_attribute_runme.go
+++ b/Examples/test-suite/go/li_attribute_runme.go
@@ -1,6 +1,6 @@
package main
-import "./li_attribute"
+import "swigtests/li_attribute"
func main() {
aa := li_attribute.NewA(1, 2, 3)
diff --git a/Examples/test-suite/go/li_carrays_cpp_runme.go b/Examples/test-suite/go/li_carrays_cpp_runme.go
index 7ee0a4103..a96291c7b 100644
--- a/Examples/test-suite/go/li_carrays_cpp_runme.go
+++ b/Examples/test-suite/go/li_carrays_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./li_carrays_cpp"
+import . "swigtests/li_carrays_cpp"
func main() {
d := NewDoubleArray(10)
diff --git a/Examples/test-suite/go/li_carrays_runme.go b/Examples/test-suite/go/li_carrays_runme.go
index 0cbe92cd8..eefc6ad72 100644
--- a/Examples/test-suite/go/li_carrays_runme.go
+++ b/Examples/test-suite/go/li_carrays_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./li_carrays"
+import . "swigtests/li_carrays"
func main() {
d := NewDoubleArray(10)
diff --git a/Examples/test-suite/go/li_cdata_cpp_runme.go b/Examples/test-suite/go/li_cdata_cpp_runme.go
index 42a0ebd08..5849c50d4 100644
--- a/Examples/test-suite/go/li_cdata_cpp_runme.go
+++ b/Examples/test-suite/go/li_cdata_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./li_cdata_cpp"
+import . "swigtests/li_cdata_cpp"
func main() {
s := "ABC abc"
diff --git a/Examples/test-suite/go/li_cdata_runme.go b/Examples/test-suite/go/li_cdata_runme.go
index f71a3a2c3..0c3e591ce 100644
--- a/Examples/test-suite/go/li_cdata_runme.go
+++ b/Examples/test-suite/go/li_cdata_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./li_cdata"
+import . "swigtests/li_cdata"
func main() {
s := "ABC abc"
diff --git a/Examples/test-suite/go/li_cmalloc_runme.go b/Examples/test-suite/go/li_cmalloc_runme.go
index 45f47b45f..fb1b009c3 100644
--- a/Examples/test-suite/go/li_cmalloc_runme.go
+++ b/Examples/test-suite/go/li_cmalloc_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./li_cmalloc"
+import . "swigtests/li_cmalloc"
func main() {
p := Malloc_int()
diff --git a/Examples/test-suite/go/li_cpointer_cpp_runme.go b/Examples/test-suite/go/li_cpointer_cpp_runme.go
index e2f5a59d1..f422b2310 100644
--- a/Examples/test-suite/go/li_cpointer_cpp_runme.go
+++ b/Examples/test-suite/go/li_cpointer_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./li_cpointer_cpp"
+import . "swigtests/li_cpointer_cpp"
func main() {
p := New_intp()
diff --git a/Examples/test-suite/go/li_cpointer_runme.go b/Examples/test-suite/go/li_cpointer_runme.go
index 57493b122..1a83bc62f 100644
--- a/Examples/test-suite/go/li_cpointer_runme.go
+++ b/Examples/test-suite/go/li_cpointer_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./li_cpointer"
+import . "swigtests/li_cpointer"
func main() {
p := New_intp()
diff --git a/Examples/test-suite/go/li_std_map_runme.go b/Examples/test-suite/go/li_std_map_runme.go
index 66e74dd60..019ac6e30 100644
--- a/Examples/test-suite/go/li_std_map_runme.go
+++ b/Examples/test-suite/go/li_std_map_runme.go
@@ -1,6 +1,6 @@
package main
-import "./li_std_map"
+import "swigtests/li_std_map"
func main() {
a1 := li_std_map.NewA(3)
diff --git a/Examples/test-suite/go/li_std_vector_ptr_runme.go b/Examples/test-suite/go/li_std_vector_ptr_runme.go
index a9f7fe91c..9a62d3796 100644
--- a/Examples/test-suite/go/li_std_vector_ptr_runme.go
+++ b/Examples/test-suite/go/li_std_vector_ptr_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./li_std_vector_ptr"
+import . "swigtests/li_std_vector_ptr"
import "fmt"
func check(val1 int, val2 int) {
diff --git a/Examples/test-suite/go/member_pointer_runme.go b/Examples/test-suite/go/member_pointer_runme.go
index 9a55bc4b9..02789382e 100644
--- a/Examples/test-suite/go/member_pointer_runme.go
+++ b/Examples/test-suite/go/member_pointer_runme.go
@@ -3,7 +3,7 @@
package main
import "fmt"
-import . "./member_pointer"
+import . "swigtests/member_pointer"
func check(what string, expected float64, actual float64) {
if expected != actual {
diff --git a/Examples/test-suite/go/memberin_extend_c_runme.go b/Examples/test-suite/go/memberin_extend_c_runme.go
index ec8b11e60..696f08abb 100644
--- a/Examples/test-suite/go/memberin_extend_c_runme.go
+++ b/Examples/test-suite/go/memberin_extend_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "./memberin_extend_c"
+import "swigtests/memberin_extend_c"
func main() {
t := memberin_extend_c.NewPerson()
diff --git a/Examples/test-suite/go/minherit_runme.go b/Examples/test-suite/go/minherit_runme.go
index c69fe92c1..f1504af31 100644
--- a/Examples/test-suite/go/minherit_runme.go
+++ b/Examples/test-suite/go/minherit_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "./minherit"
+import "swigtests/minherit"
func main() {
a := minherit.NewFoo()
diff --git a/Examples/test-suite/go/mod_runme.go b/Examples/test-suite/go/mod_runme.go
index 581c83918..8d894db8d 100644
--- a/Examples/test-suite/go/mod_runme.go
+++ b/Examples/test-suite/go/mod_runme.go
@@ -1,7 +1,7 @@
package main
-import "mod_a"
-import "mod_b"
+import "swigtests/mod_a"
+import "swigtests/mod_b"
func main() {
c := mod_b.NewC()
diff --git a/Examples/test-suite/go/multi_import_runme.go b/Examples/test-suite/go/multi_import_runme.go
index 973af1e7b..f30913c6d 100644
--- a/Examples/test-suite/go/multi_import_runme.go
+++ b/Examples/test-suite/go/multi_import_runme.go
@@ -1,7 +1,7 @@
package main
-import "multi_import_a"
-import "multi_import_b"
+import "swigtests/multi_import_a"
+import "swigtests/multi_import_b"
func main() {
x := multi_import_b.NewXXX()
diff --git a/Examples/test-suite/go/namespace_class_runme.go b/Examples/test-suite/go/namespace_class_runme.go
index 2ed5567f7..435ee868a 100644
--- a/Examples/test-suite/go/namespace_class_runme.go
+++ b/Examples/test-suite/go/namespace_class_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./namespace_class"
+import . "swigtests/namespace_class"
func main() {
EulerT3DToFrame(1, 1, 1)
diff --git a/Examples/test-suite/go/namespace_typemap_runme.go b/Examples/test-suite/go/namespace_typemap_runme.go
index 056da1567..6da43331b 100644
--- a/Examples/test-suite/go/namespace_typemap_runme.go
+++ b/Examples/test-suite/go/namespace_typemap_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./namespace_typemap"
+import . "swigtests/namespace_typemap"
func main() {
if Stest1("hello") != "hello" {
diff --git a/Examples/test-suite/go/namespace_virtual_method_runme.go b/Examples/test-suite/go/namespace_virtual_method_runme.go
index 3f8e774c6..7ac4d3304 100644
--- a/Examples/test-suite/go/namespace_virtual_method_runme.go
+++ b/Examples/test-suite/go/namespace_virtual_method_runme.go
@@ -1,6 +1,6 @@
package main
-import "./namespace_virtual_method"
+import "swigtests/namespace_virtual_method"
func main() {
_ = namespace_virtual_method.NewSpam()
diff --git a/Examples/test-suite/go/naturalvar_runme.go b/Examples/test-suite/go/naturalvar_runme.go
index e3723e6ab..458745ec4 100644
--- a/Examples/test-suite/go/naturalvar_runme.go
+++ b/Examples/test-suite/go/naturalvar_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./naturalvar"
+import . "swigtests/naturalvar"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/nested_workaround_runme.go b/Examples/test-suite/go/nested_workaround_runme.go
index 5737aaaf7..f42b48764 100644
--- a/Examples/test-suite/go/nested_workaround_runme.go
+++ b/Examples/test-suite/go/nested_workaround_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./nested_workaround"
+import . "swigtests/nested_workaround"
func main() {
inner := NewInner(5)
diff --git a/Examples/test-suite/go/overload_complicated_runme.go b/Examples/test-suite/go/overload_complicated_runme.go
index e3911c218..c238d974f 100644
--- a/Examples/test-suite/go/overload_complicated_runme.go
+++ b/Examples/test-suite/go/overload_complicated_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./overload_complicated"
+import . "swigtests/overload_complicated"
func main() {
var pInt *int
diff --git a/Examples/test-suite/go/overload_copy_runme.go b/Examples/test-suite/go/overload_copy_runme.go
index d35ff70b1..9815d76ef 100644
--- a/Examples/test-suite/go/overload_copy_runme.go
+++ b/Examples/test-suite/go/overload_copy_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./overload_copy"
+import . "swigtests/overload_copy"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/overload_extend2_runme.go b/Examples/test-suite/go/overload_extend2_runme.go
index 121506734..d549098ba 100644
--- a/Examples/test-suite/go/overload_extend2_runme.go
+++ b/Examples/test-suite/go/overload_extend2_runme.go
@@ -1,6 +1,6 @@
package main
-import "./overload_extend2"
+import "swigtests/overload_extend2"
func main() {
f := overload_extend2.NewFoo()
diff --git a/Examples/test-suite/go/overload_extend_c_runme.go b/Examples/test-suite/go/overload_extend_c_runme.go
index e00f0b945..93b91d9e1 100644
--- a/Examples/test-suite/go/overload_extend_c_runme.go
+++ b/Examples/test-suite/go/overload_extend_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "./overload_extend_c"
+import "swigtests/overload_extend_c"
func main() {
f := overload_extend_c.NewFoo()
diff --git a/Examples/test-suite/go/overload_extend_runme.go b/Examples/test-suite/go/overload_extend_runme.go
index 1ba541f13..c1435f376 100644
--- a/Examples/test-suite/go/overload_extend_runme.go
+++ b/Examples/test-suite/go/overload_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import "./overload_extend"
+import "swigtests/overload_extend"
func main() {
f := overload_extend.NewFoo()
diff --git a/Examples/test-suite/go/overload_polymorphic_runme.go b/Examples/test-suite/go/overload_polymorphic_runme.go
index 46f837f49..6a4301f46 100644
--- a/Examples/test-suite/go/overload_polymorphic_runme.go
+++ b/Examples/test-suite/go/overload_polymorphic_runme.go
@@ -1,6 +1,6 @@
package main
-import "./overload_polymorphic"
+import "swigtests/overload_polymorphic"
func main(){
t := overload_polymorphic.NewDerived()
diff --git a/Examples/test-suite/go/overload_rename_runme.go b/Examples/test-suite/go/overload_rename_runme.go
index dca5843c3..982b1786a 100644
--- a/Examples/test-suite/go/overload_rename_runme.go
+++ b/Examples/test-suite/go/overload_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "./overload_rename"
+import "swigtests/overload_rename"
func main() {
_ = overload_rename.NewFoo(float32(1))
diff --git a/Examples/test-suite/go/overload_simple_runme.go b/Examples/test-suite/go/overload_simple_runme.go
index 5f6d0558b..23a80bf69 100644
--- a/Examples/test-suite/go/overload_simple_runme.go
+++ b/Examples/test-suite/go/overload_simple_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./overload_simple"
+import . "swigtests/overload_simple"
func main() {
if Foo(3) != "foo:int" {
diff --git a/Examples/test-suite/go/overload_subtype_runme.go b/Examples/test-suite/go/overload_subtype_runme.go
index dc56d1ca7..09f7a83f4 100644
--- a/Examples/test-suite/go/overload_subtype_runme.go
+++ b/Examples/test-suite/go/overload_subtype_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./overload_subtype"
+import . "swigtests/overload_subtype"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/overload_template_fast_runme.go b/Examples/test-suite/go/overload_template_fast_runme.go
index b80cb7dd4..3b348f366 100644
--- a/Examples/test-suite/go/overload_template_fast_runme.go
+++ b/Examples/test-suite/go/overload_template_fast_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./overload_template_fast"
+import . "swigtests/overload_template_fast"
func main() {
_ = Foo()
diff --git a/Examples/test-suite/go/overload_template_runme.go b/Examples/test-suite/go/overload_template_runme.go
index 53e1def1b..b85afb4d1 100644
--- a/Examples/test-suite/go/overload_template_runme.go
+++ b/Examples/test-suite/go/overload_template_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./overload_template"
+import . "swigtests/overload_template"
func main() {
_ = Foo()
diff --git a/Examples/test-suite/go/preproc_runme.go b/Examples/test-suite/go/preproc_runme.go
index a15062241..878305463 100644
--- a/Examples/test-suite/go/preproc_runme.go
+++ b/Examples/test-suite/go/preproc_runme.go
@@ -1,6 +1,6 @@
package main
-import "./preproc"
+import "swigtests/preproc"
func main() {
if preproc.GetEndif() != 1 {
diff --git a/Examples/test-suite/go/primitive_ref_runme.go b/Examples/test-suite/go/primitive_ref_runme.go
index 973806955..8dcf9f5a9 100644
--- a/Examples/test-suite/go/primitive_ref_runme.go
+++ b/Examples/test-suite/go/primitive_ref_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./primitive_ref"
+import . "swigtests/primitive_ref"
func main() {
if Ref_int(3) != 3 {
diff --git a/Examples/test-suite/go/profiletest_runme.go b/Examples/test-suite/go/profiletest_runme.go
index 30b6cee69..68509f550 100644
--- a/Examples/test-suite/go/profiletest_runme.go
+++ b/Examples/test-suite/go/profiletest_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "./profiletest"
+import "swigtests/profiletest"
func main() {
a := profiletest.NewA()
diff --git a/Examples/test-suite/go/refcount_runme.go b/Examples/test-suite/go/refcount_runme.go
index fdb271cc6..76e30dda3 100644
--- a/Examples/test-suite/go/refcount_runme.go
+++ b/Examples/test-suite/go/refcount_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./refcount"
+import . "swigtests/refcount"
// very innocent example
diff --git a/Examples/test-suite/go/reference_global_vars_runme.go b/Examples/test-suite/go/reference_global_vars_runme.go
index b8cbb304a..f8c125854 100644
--- a/Examples/test-suite/go/reference_global_vars_runme.go
+++ b/Examples/test-suite/go/reference_global_vars_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./reference_global_vars"
+import . "swigtests/reference_global_vars"
func main() {
// const class reference variable
diff --git a/Examples/test-suite/go/rename_scope_runme.go b/Examples/test-suite/go/rename_scope_runme.go
index 995f8c64d..4ad7549ad 100644
--- a/Examples/test-suite/go/rename_scope_runme.go
+++ b/Examples/test-suite/go/rename_scope_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./rename_scope"
+import . "swigtests/rename_scope"
func main() {
a := NewNatural_UP()
diff --git a/Examples/test-suite/go/rename_simple_runme.go b/Examples/test-suite/go/rename_simple_runme.go
index a63023bd1..efe1edc7b 100644
--- a/Examples/test-suite/go/rename_simple_runme.go
+++ b/Examples/test-suite/go/rename_simple_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "./rename_simple"
+import . "swigtests/rename_simple"
func main() {
s := NewNewStruct()
diff --git a/Examples/test-suite/go/rename_strip_encoder_runme.go b/Examples/test-suite/go/rename_strip_encoder_runme.go
index 1d0bcb660..74a0dbaaf 100644
--- a/Examples/test-suite/go/rename_strip_encoder_runme.go
+++ b/Examples/test-suite/go/rename_strip_encoder_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./rename_strip_encoder"
+import . "swigtests/rename_strip_encoder"
func main() {
_ = NewSomeWidget()
diff --git a/Examples/test-suite/go/ret_by_value_runme.go b/Examples/test-suite/go/ret_by_value_runme.go
index 44743d2b7..345868dcd 100644
--- a/Examples/test-suite/go/ret_by_value_runme.go
+++ b/Examples/test-suite/go/ret_by_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "./ret_by_value"
+import "swigtests/ret_by_value"
func main() {
a := ret_by_value.Get_test()
diff --git a/Examples/test-suite/go/return_const_value_runme.go b/Examples/test-suite/go/return_const_value_runme.go
index 790921b74..fc6baa240 100644
--- a/Examples/test-suite/go/return_const_value_runme.go
+++ b/Examples/test-suite/go/return_const_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "./return_const_value"
+import "swigtests/return_const_value"
func main() {
p := return_const_value.Foo_ptrGetPtr()
diff --git a/Examples/test-suite/go/smart_pointer_extend_runme.go b/Examples/test-suite/go/smart_pointer_extend_runme.go
index ee5ce0538..f91c9ac99 100644
--- a/Examples/test-suite/go/smart_pointer_extend_runme.go
+++ b/Examples/test-suite/go/smart_pointer_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./smart_pointer_extend"
+import . "swigtests/smart_pointer_extend"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_member_runme.go b/Examples/test-suite/go/smart_pointer_member_runme.go
index bf09fe5fc..ca2ac2c76 100644
--- a/Examples/test-suite/go/smart_pointer_member_runme.go
+++ b/Examples/test-suite/go/smart_pointer_member_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "./smart_pointer_member"
+import . "swigtests/smart_pointer_member"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_multi_runme.go b/Examples/test-suite/go/smart_pointer_multi_runme.go
index d1a5f92f4..a8ec39f54 100644
--- a/Examples/test-suite/go/smart_pointer_multi_runme.go
+++ b/Examples/test-suite/go/smart_pointer_multi_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./smart_pointer_multi"
+import . "swigtests/smart_pointer_multi"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go b/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
index f71740bbb..6bfd21ef6 100644
--- a/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
+++ b/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./smart_pointer_multi_typedef"
+import . "swigtests/smart_pointer_multi_typedef"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_overload_runme.go b/Examples/test-suite/go/smart_pointer_overload_runme.go
index 5ffeae17c..c28ce6100 100644
--- a/Examples/test-suite/go/smart_pointer_overload_runme.go
+++ b/Examples/test-suite/go/smart_pointer_overload_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./smart_pointer_overload"
+import . "swigtests/smart_pointer_overload"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_rename_runme.go b/Examples/test-suite/go/smart_pointer_rename_runme.go
index 678c305c8..22c0eb1e9 100644
--- a/Examples/test-suite/go/smart_pointer_rename_runme.go
+++ b/Examples/test-suite/go/smart_pointer_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./smart_pointer_rename"
+import . "swigtests/smart_pointer_rename"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_simple_runme.go b/Examples/test-suite/go/smart_pointer_simple_runme.go
index 328654225..8a14dcf9b 100644
--- a/Examples/test-suite/go/smart_pointer_simple_runme.go
+++ b/Examples/test-suite/go/smart_pointer_simple_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./smart_pointer_simple"
+import . "swigtests/smart_pointer_simple"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_templatevariables_runme.go b/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
index bf58ba52c..8f7102d43 100644
--- a/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
+++ b/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./smart_pointer_templatevariables"
+import . "swigtests/smart_pointer_templatevariables"
func main() {
d := NewDiffImContainerPtr_D(Create(1234, 5678))
diff --git a/Examples/test-suite/go/smart_pointer_typedef_runme.go b/Examples/test-suite/go/smart_pointer_typedef_runme.go
index a67a0ccda..5468a2926 100644
--- a/Examples/test-suite/go/smart_pointer_typedef_runme.go
+++ b/Examples/test-suite/go/smart_pointer_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./smart_pointer_typedef"
+import . "swigtests/smart_pointer_typedef"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/sneaky1_runme.go b/Examples/test-suite/go/sneaky1_runme.go
index ee38ae21b..c17f0ffc6 100644
--- a/Examples/test-suite/go/sneaky1_runme.go
+++ b/Examples/test-suite/go/sneaky1_runme.go
@@ -1,6 +1,6 @@
package main
-import "./sneaky1"
+import "swigtests/sneaky1"
func main() {
_ = sneaky1.Add(3, 4)
diff --git a/Examples/test-suite/go/special_variable_macros_runme.go b/Examples/test-suite/go/special_variable_macros_runme.go
index c4f687ea9..597c48748 100644
--- a/Examples/test-suite/go/special_variable_macros_runme.go
+++ b/Examples/test-suite/go/special_variable_macros_runme.go
@@ -1,6 +1,6 @@
package main
-import "./special_variable_macros"
+import "swigtests/special_variable_macros"
func main() {
name := special_variable_macros.NewName()
diff --git a/Examples/test-suite/go/static_const_member_2_runme.go b/Examples/test-suite/go/static_const_member_2_runme.go
index 0d345c3d6..7586eb404 100644
--- a/Examples/test-suite/go/static_const_member_2_runme.go
+++ b/Examples/test-suite/go/static_const_member_2_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./static_const_member_2"
+import . "swigtests/static_const_member_2"
func main() {
_ = NewTest_int()
diff --git a/Examples/test-suite/go/struct_initialization_runme.go b/Examples/test-suite/go/struct_initialization_runme.go
index 58ac25010..d5eb4e968 100644
--- a/Examples/test-suite/go/struct_initialization_runme.go
+++ b/Examples/test-suite/go/struct_initialization_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./struct_initialization"
+import . "swigtests/struct_initialization"
func main() {
if GetInstanceC1().GetX() != 10 {
diff --git a/Examples/test-suite/go/struct_rename_runme.go b/Examples/test-suite/go/struct_rename_runme.go
index 845dac5be..6d619e090 100644
--- a/Examples/test-suite/go/struct_rename_runme.go
+++ b/Examples/test-suite/go/struct_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "./struct_rename"
+import "swigtests/struct_rename"
func main() {
_ = struct_rename.NewBar()
diff --git a/Examples/test-suite/go/struct_value_runme.go b/Examples/test-suite/go/struct_value_runme.go
index d0b60bd23..c43a67a88 100644
--- a/Examples/test-suite/go/struct_value_runme.go
+++ b/Examples/test-suite/go/struct_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "./struct_value"
+import "swigtests/struct_value"
func main() {
b := struct_value.NewBar()
diff --git a/Examples/test-suite/go/template_default_arg_runme.go b/Examples/test-suite/go/template_default_arg_runme.go
index 3d9346b05..9558c7496 100644
--- a/Examples/test-suite/go/template_default_arg_runme.go
+++ b/Examples/test-suite/go/template_default_arg_runme.go
@@ -1,6 +1,6 @@
package main
-import "./template_default_arg"
+import "swigtests/template_default_arg"
func main() {
helloInt := template_default_arg.NewHello_int()
diff --git a/Examples/test-suite/go/template_extend1_runme.go b/Examples/test-suite/go/template_extend1_runme.go
index 5d6d376f5..f2469ab15 100644
--- a/Examples/test-suite/go/template_extend1_runme.go
+++ b/Examples/test-suite/go/template_extend1_runme.go
@@ -1,6 +1,6 @@
package main
-import "./template_extend1"
+import "swigtests/template_extend1"
func main() {
a := template_extend1.NewLBaz()
diff --git a/Examples/test-suite/go/template_extend2_runme.go b/Examples/test-suite/go/template_extend2_runme.go
index 312410e27..c3669bc95 100644
--- a/Examples/test-suite/go/template_extend2_runme.go
+++ b/Examples/test-suite/go/template_extend2_runme.go
@@ -1,6 +1,6 @@
package main
-import "./template_extend2"
+import "swigtests/template_extend2"
func main() {
a := template_extend2.NewLBaz()
diff --git a/Examples/test-suite/go/template_inherit_runme.go b/Examples/test-suite/go/template_inherit_runme.go
index c0aca77c4..10071b128 100644
--- a/Examples/test-suite/go/template_inherit_runme.go
+++ b/Examples/test-suite/go/template_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./template_inherit"
+import . "swigtests/template_inherit"
func main() {
a := NewFooInt()
diff --git a/Examples/test-suite/go/template_ns4_runme.go b/Examples/test-suite/go/template_ns4_runme.go
index 4caf8f587..c1b356b3f 100644
--- a/Examples/test-suite/go/template_ns4_runme.go
+++ b/Examples/test-suite/go/template_ns4_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./template_ns4"
+import . "swigtests/template_ns4"
func main() {
d := Make_Class_DD()
diff --git a/Examples/test-suite/go/template_ns_runme.go b/Examples/test-suite/go/template_ns_runme.go
index 6385eccf9..e77c17bf7 100644
--- a/Examples/test-suite/go/template_ns_runme.go
+++ b/Examples/test-suite/go/template_ns_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./template_ns"
+import . "swigtests/template_ns"
func main() {
p1 := NewPairii(2, 3)
diff --git a/Examples/test-suite/go/template_opaque_runme.go b/Examples/test-suite/go/template_opaque_runme.go
index 201f7ba16..b3bf61043 100644
--- a/Examples/test-suite/go/template_opaque_runme.go
+++ b/Examples/test-suite/go/template_opaque_runme.go
@@ -1,6 +1,6 @@
package main
-import "./template_opaque"
+import "swigtests/template_opaque"
func main() {
v := template_opaque.NewOpaqueVectorType(int64(10))
diff --git a/Examples/test-suite/go/template_ref_type_runme.go b/Examples/test-suite/go/template_ref_type_runme.go
index e4bf626fb..516b6c721 100644
--- a/Examples/test-suite/go/template_ref_type_runme.go
+++ b/Examples/test-suite/go/template_ref_type_runme.go
@@ -1,6 +1,6 @@
package main
-import "./template_ref_type"
+import "swigtests/template_ref_type"
func main() {
xr := template_ref_type.NewXC()
diff --git a/Examples/test-suite/go/template_rename_runme.go b/Examples/test-suite/go/template_rename_runme.go
index 757ac7355..08cf3fb48 100644
--- a/Examples/test-suite/go/template_rename_runme.go
+++ b/Examples/test-suite/go/template_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "./template_rename"
+import "swigtests/template_rename"
func main() {
i := template_rename.NewIFoo()
diff --git a/Examples/test-suite/go/template_static_runme.go b/Examples/test-suite/go/template_static_runme.go
index 7fa50760a..205813dbf 100644
--- a/Examples/test-suite/go/template_static_runme.go
+++ b/Examples/test-suite/go/template_static_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./template_static"
+import . "swigtests/template_static"
func main() {
FooBar_double(1)
diff --git a/Examples/test-suite/go/template_tbase_template_runme.go b/Examples/test-suite/go/template_tbase_template_runme.go
index 9a52e2fac..a4832439f 100644
--- a/Examples/test-suite/go/template_tbase_template_runme.go
+++ b/Examples/test-suite/go/template_tbase_template_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./template_tbase_template"
+import . "swigtests/template_tbase_template"
func main() {
a := Make_Class_dd()
diff --git a/Examples/test-suite/go/template_type_namespace_runme.go b/Examples/test-suite/go/template_type_namespace_runme.go
index a3712ff59..562fae78d 100644
--- a/Examples/test-suite/go/template_type_namespace_runme.go
+++ b/Examples/test-suite/go/template_type_namespace_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./template_type_namespace"
+import . "swigtests/template_type_namespace"
func main() {
if Foo().Get(0) == "" {
diff --git a/Examples/test-suite/go/template_typedef_cplx3_runme.go b/Examples/test-suite/go/template_typedef_cplx3_runme.go
index d616777e0..52a9bc7f6 100644
--- a/Examples/test-suite/go/template_typedef_cplx3_runme.go
+++ b/Examples/test-suite/go/template_typedef_cplx3_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./template_typedef_cplx3"
+import . "swigtests/template_typedef_cplx3"
func main() {
// this is OK
diff --git a/Examples/test-suite/go/template_typedef_cplx4_runme.go b/Examples/test-suite/go/template_typedef_cplx4_runme.go
index 3e536d6f2..84347e404 100644
--- a/Examples/test-suite/go/template_typedef_cplx4_runme.go
+++ b/Examples/test-suite/go/template_typedef_cplx4_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./template_typedef_cplx4"
+import . "swigtests/template_typedef_cplx4"
func main() {
// this is OK
diff --git a/Examples/test-suite/go/threads_exception_runme.go b/Examples/test-suite/go/threads_exception_runme.go
index 742a827bd..b554f0e28 100644
--- a/Examples/test-suite/go/threads_exception_runme.go
+++ b/Examples/test-suite/go/threads_exception_runme.go
@@ -1,7 +1,7 @@
package main
import "strings"
-import "./threads_exception"
+import "swigtests/threads_exception"
func main() {
t := threads_exception.NewTest()
diff --git a/Examples/test-suite/go/typedef_class_runme.go b/Examples/test-suite/go/typedef_class_runme.go
index ec25162de..157a91745 100644
--- a/Examples/test-suite/go/typedef_class_runme.go
+++ b/Examples/test-suite/go/typedef_class_runme.go
@@ -1,6 +1,6 @@
package main
-import "./typedef_class"
+import "swigtests/typedef_class"
func main() {
a := typedef_class.NewRealA()
diff --git a/Examples/test-suite/go/typedef_funcptr_runme.go b/Examples/test-suite/go/typedef_funcptr_runme.go
new file mode 100644
index 000000000..f76f088af
--- /dev/null
+++ b/Examples/test-suite/go/typedef_funcptr_runme.go
@@ -0,0 +1,29 @@
+package main
+
+import . "swigtests/typedef_funcptr"
+
+func main() {
+ a := 100
+ b := 10
+
+ if Do_op(a,b,Addf) != 110 {
+ panic(0)
+ }
+ if Do_op(a,b,Subf) != 90 {
+ panic(0)
+ }
+
+ if Do_op_typedef_int(a,b,Addf) != 110 {
+ panic(0)
+ }
+ if Do_op_typedef_int(a,b,Subf) != 90 {
+ panic(0)
+ }
+
+ if Do_op_typedef_Integer(a,b,Addf) != 110 {
+ panic(0)
+ }
+ if Do_op_typedef_Integer(a,b,Subf) != 90 {
+ panic(0)
+ }
+}
diff --git a/Examples/test-suite/go/typedef_inherit_runme.go b/Examples/test-suite/go/typedef_inherit_runme.go
index 49097999c..f2dbb3263 100644
--- a/Examples/test-suite/go/typedef_inherit_runme.go
+++ b/Examples/test-suite/go/typedef_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import "./typedef_inherit"
+import "swigtests/typedef_inherit"
func main() {
a := typedef_inherit.NewFoo()
diff --git a/Examples/test-suite/go/typedef_scope_runme.go b/Examples/test-suite/go/typedef_scope_runme.go
index 1c4314427..9c845bb69 100644
--- a/Examples/test-suite/go/typedef_scope_runme.go
+++ b/Examples/test-suite/go/typedef_scope_runme.go
@@ -1,6 +1,6 @@
package main
-import "./typedef_scope"
+import "swigtests/typedef_scope"
func main() {
b := typedef_scope.NewBar()
diff --git a/Examples/test-suite/go/typemap_namespace_runme.go b/Examples/test-suite/go/typemap_namespace_runme.go
index 45184fd1e..f0860803e 100644
--- a/Examples/test-suite/go/typemap_namespace_runme.go
+++ b/Examples/test-suite/go/typemap_namespace_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./typemap_namespace"
+import . "swigtests/typemap_namespace"
func main() {
if Test1("hello") != "hello" {
diff --git a/Examples/test-suite/go/typemap_ns_using_runme.go b/Examples/test-suite/go/typemap_ns_using_runme.go
index 877e44b3a..00e1131d6 100644
--- a/Examples/test-suite/go/typemap_ns_using_runme.go
+++ b/Examples/test-suite/go/typemap_ns_using_runme.go
@@ -1,6 +1,6 @@
package main
-import "./typemap_ns_using"
+import "swigtests/typemap_ns_using"
func main() {
if typemap_ns_using.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/typemap_out_optimal_runme.go b/Examples/test-suite/go/typemap_out_optimal_runme.go
index 7cbd0ad9b..0cccd97a6 100644
--- a/Examples/test-suite/go/typemap_out_optimal_runme.go
+++ b/Examples/test-suite/go/typemap_out_optimal_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./typemap_out_optimal"
+import . "swigtests/typemap_out_optimal"
func main() {
SetXXDebug(false)
diff --git a/Examples/test-suite/go/typename_runme.go b/Examples/test-suite/go/typename_runme.go
index 0bc15f11a..1e1696d0a 100644
--- a/Examples/test-suite/go/typename_runme.go
+++ b/Examples/test-suite/go/typename_runme.go
@@ -1,6 +1,6 @@
package main
-import "./typename"
+import "swigtests/typename"
func main() {
f := typename.NewFoo()
diff --git a/Examples/test-suite/go/unions_runme.go b/Examples/test-suite/go/unions_runme.go
index ba9c27b17..6e2981192 100644
--- a/Examples/test-suite/go/unions_runme.go
+++ b/Examples/test-suite/go/unions_runme.go
@@ -3,7 +3,7 @@
package main
-import "./unions"
+import "swigtests/unions"
func main() {
// Create new instances of SmallStruct and BigStruct for later use
diff --git a/Examples/test-suite/go/using1_runme.go b/Examples/test-suite/go/using1_runme.go
index 8cc571288..09cc381cc 100644
--- a/Examples/test-suite/go/using1_runme.go
+++ b/Examples/test-suite/go/using1_runme.go
@@ -1,6 +1,6 @@
package main
-import "./using1"
+import "swigtests/using1"
func main() {
if using1.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/using2_runme.go b/Examples/test-suite/go/using2_runme.go
index f679b0c40..8109037f9 100644
--- a/Examples/test-suite/go/using2_runme.go
+++ b/Examples/test-suite/go/using2_runme.go
@@ -1,6 +1,6 @@
package main
-import "./using2"
+import "swigtests/using2"
func main() {
if using2.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/using_composition_runme.go b/Examples/test-suite/go/using_composition_runme.go
index 47e245719..7ef09fef9 100644
--- a/Examples/test-suite/go/using_composition_runme.go
+++ b/Examples/test-suite/go/using_composition_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./using_composition"
+import . "swigtests/using_composition"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_extend_runme.go b/Examples/test-suite/go/using_extend_runme.go
index 830c958e5..dac300ba4 100644
--- a/Examples/test-suite/go/using_extend_runme.go
+++ b/Examples/test-suite/go/using_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./using_extend"
+import . "swigtests/using_extend"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_inherit_runme.go b/Examples/test-suite/go/using_inherit_runme.go
index db29efb64..c8755902f 100644
--- a/Examples/test-suite/go/using_inherit_runme.go
+++ b/Examples/test-suite/go/using_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./using_inherit"
+import . "swigtests/using_inherit"
func main() {
b := NewBar()
diff --git a/Examples/test-suite/go/using_private_runme.go b/Examples/test-suite/go/using_private_runme.go
index d683ef856..4c86ef514 100644
--- a/Examples/test-suite/go/using_private_runme.go
+++ b/Examples/test-suite/go/using_private_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./using_private"
+import . "swigtests/using_private"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_protected_runme.go b/Examples/test-suite/go/using_protected_runme.go
index 65edb5001..431081827 100644
--- a/Examples/test-suite/go/using_protected_runme.go
+++ b/Examples/test-suite/go/using_protected_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./using_protected"
+import . "swigtests/using_protected"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/varargs_overload_runme.go b/Examples/test-suite/go/varargs_overload_runme.go
index 52fc1b0e9..50a430894 100644
--- a/Examples/test-suite/go/varargs_overload_runme.go
+++ b/Examples/test-suite/go/varargs_overload_runme.go
@@ -1,6 +1,6 @@
package main
-import "./varargs_overload"
+import "swigtests/varargs_overload"
func main() {
if varargs_overload.Vararg_over1("Hello") != "Hello" {
@@ -35,4 +35,40 @@ func main() {
if varargs_overload.Vararg_over4("Hello", 123) != "Hello" {
panic(8)
}
+
+
+ // Same as above but non-vararg function declared first
+
+ if varargs_overload.Vararg_over6("Hello") != "Hello" {
+ panic(0)
+ }
+ if varargs_overload.Vararg_over6(2) != "2" {
+ panic(1)
+ }
+
+ if varargs_overload.Vararg_over7("Hello") != "Hello" {
+ panic(2)
+ }
+ if varargs_overload.Vararg_over7(2, 2.2) != "2 2.2" {
+ panic(3)
+ }
+
+ if varargs_overload.Vararg_over8("Hello") != "Hello" {
+ panic(4)
+ }
+ if varargs_overload.Vararg_over8(2, 2.2, "hey") != "2 2.2 hey" {
+ panic(5)
+ }
+
+ if varargs_overload.Vararg_over9("Hello") != "Hello" {
+ panic(6)
+ }
+
+ if varargs_overload.Vararg_over9(123) != "123" {
+ panic(7)
+ }
+
+ if varargs_overload.Vararg_over9("Hello", 123) != "Hello" {
+ panic(8)
+ }
}
diff --git a/Examples/test-suite/go/varargs_runme.go b/Examples/test-suite/go/varargs_runme.go
index 4009c3ed3..eb2fa94aa 100644
--- a/Examples/test-suite/go/varargs_runme.go
+++ b/Examples/test-suite/go/varargs_runme.go
@@ -1,6 +1,6 @@
package main
-import "./varargs"
+import "swigtests/varargs"
func main() {
if varargs.Test("Hello") != "Hello" {
diff --git a/Examples/test-suite/go/virtual_derivation_runme.go b/Examples/test-suite/go/virtual_derivation_runme.go
index 48a7033a2..21135308c 100644
--- a/Examples/test-suite/go/virtual_derivation_runme.go
+++ b/Examples/test-suite/go/virtual_derivation_runme.go
@@ -1,6 +1,6 @@
package main
-import . "./virtual_derivation"
+import . "swigtests/virtual_derivation"
// very innocent example
diff --git a/Examples/test-suite/go/virtual_poly_runme.go b/Examples/test-suite/go/virtual_poly_runme.go
index 487b371ba..9973f24c7 100644
--- a/Examples/test-suite/go/virtual_poly_runme.go
+++ b/Examples/test-suite/go/virtual_poly_runme.go
@@ -1,6 +1,6 @@
package main
-import "./virtual_poly"
+import "swigtests/virtual_poly"
func main() {
d := virtual_poly.NewNDouble(3.5)
diff --git a/Examples/test-suite/go/voidtest_runme.go b/Examples/test-suite/go/voidtest_runme.go
index 0a685f081..35c5289fd 100644
--- a/Examples/test-suite/go/voidtest_runme.go
+++ b/Examples/test-suite/go/voidtest_runme.go
@@ -1,6 +1,6 @@
package main
-import "./voidtest"
+import "swigtests/voidtest"
func main() {
voidtest.Globalfunc()
diff --git a/Examples/test-suite/go/wrapmacro_runme.go b/Examples/test-suite/go/wrapmacro_runme.go
index dc7e7bf5b..d792d4ffe 100644
--- a/Examples/test-suite/go/wrapmacro_runme.go
+++ b/Examples/test-suite/go/wrapmacro_runme.go
@@ -1,6 +1,6 @@
package main
-import "./wrapmacro"
+import "swigtests/wrapmacro"
func main() {
a := 2
diff --git a/Examples/test-suite/go_subdir_import.list b/Examples/test-suite/go_subdir_import.list
index e117d32fa..074c795b3 100644
--- a/Examples/test-suite/go_subdir_import.list
+++ b/Examples/test-suite/go_subdir_import.list
@@ -1,3 +1,3 @@
testdir/go_subdir_import/go_subdir_import_c
-go_subdir_import_b
+testdir/go_subdir_import/go_subdir_import_b
go_subdir_import_a
diff --git a/Examples/test-suite/guile/overload_complicated_runme.scm b/Examples/test-suite/guile/overload_complicated_runme.scm
index a38fb8afe..0630d4ecc 100644
--- a/Examples/test-suite/guile/overload_complicated_runme.scm
+++ b/Examples/test-suite/guile/overload_complicated_runme.scm
@@ -14,8 +14,8 @@
(check (=~ (foo 1 2 "bar" 4) 15))
;; Check second method
-(check (=~ (foo 1 2) 4811.4))
-(check (=~ (foo 1 2 3.2) 4797.2))
-(check (=~ (foo 1 2 3.2 #\Q) 4798.2))
+(check (=~ (foo 1 2) 118))
+(check (=~ (foo 1 2 3.2) 104))
+(check (=~ (foo 1 2 3.2 #\Q) 4798))
(exit 0)
diff --git a/Examples/test-suite/guile/overload_null_runme.scm b/Examples/test-suite/guile/overload_null_runme.scm
new file mode 100644
index 000000000..f764d9c20
--- /dev/null
+++ b/Examples/test-suite/guile/overload_null_runme.scm
@@ -0,0 +1,53 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_overload_null_module" (dynamic-link "./liboverload_null"))
+
+(define-macro (check form)
+ `(if (not ,form)
+ (error "Check failed: " ',form)))
+
+(define (=~ a b)
+ (< (abs (- a b)) 1e-8))
+
+(define o (new-Overload))
+(define x (new-X))
+
+(check (=~ 1 (Overload-byval1 o x)))
+(check (=~ 2 (Overload-byval1 o #nil)))
+
+(check (=~ 3 (Overload-byval2 o #nil)))
+(check (=~ 4 (Overload-byval2 o x)))
+
+(check (=~ 5 (Overload-byref1 o x)))
+(check (=~ 6 (Overload-byref1 o #nil)))
+
+(check (=~ 7 (Overload-byref2 o #nil)))
+(check (=~ 8 (Overload-byref2 o x)))
+
+(check (=~ 9 (Overload-byconstref1 o x)))
+(check (=~ 10 (Overload-byconstref1 o #nil)))
+
+(check (=~ 11 (Overload-byconstref2 o #nil)))
+(check (=~ 12 (Overload-byconstref2 o x)))
+
+; const pointer references
+; No SWIGTYPE *const& typemaps for Guile yet
+;(check (=~ 13 (Overload-byval1cpr o x)))
+;(check (=~ 14 (Overload-byval1cpr o #nil)))
+
+;(check (=~ 15 (Overload-byval2cpr o #nil)))
+;(check (=~ 16 (Overload-byval2cpr o x)))
+
+; forward class declaration
+(check (=~ 17 (Overload-byval1forwardptr o x)))
+(check (=~ 18 (Overload-byval1forwardptr o #nil)))
+
+(check (=~ 19 (Overload-byval2forwardptr o #nil)))
+(check (=~ 20 (Overload-byval2forwardptr o x)))
+
+(check (=~ 21 (Overload-byval1forwardref o x)))
+
+(check (=~ 22 (Overload-byval2forwardref o x)))
+
+(exit 0)
diff --git a/Examples/test-suite/ignore_parameter.i b/Examples/test-suite/ignore_parameter.i
index bc0892c3a..604ee3b84 100644
--- a/Examples/test-suite/ignore_parameter.i
+++ b/Examples/test-suite/ignore_parameter.i
@@ -8,12 +8,15 @@
%typemap(freearg) char* a ""; // ensure freearg is not generated (needed for Java at least)
+%ignore unignorable;
+
%inline %{
// global function tests
char* jaguar(char* a, int b, double c) { return a; }
int lotus(char* aa, int bb, double cc) { return bb; }
double tvr(char* aaa, int bbb, double ccc) { return ccc; }
int ferrari(int bb) { return bb; }
+int fiat(int unignorable) { return unignorable; }
// member function tests
struct SportsCars {
@@ -21,6 +24,7 @@ struct SportsCars {
int astonmartin(char* aa, int bb, double cc) { return bb; }
double bugatti(char* aaa, int bbb, double ccc) { return ccc; }
int lamborghini(int bb) { return bb; }
+ int maseratti(int unignorable) { return unignorable; }
};
// constructor tests
diff --git a/Examples/test-suite/ignore_template_constructor.i b/Examples/test-suite/ignore_template_constructor.i
index 31a5505fb..bdffbec3e 100644
--- a/Examples/test-suite/ignore_template_constructor.i
+++ b/Examples/test-suite/ignore_template_constructor.i
@@ -1,12 +1,18 @@
%module ignore_template_constructor
%include std_vector.i
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGPERL) || defined(SWIGRUBY)
+#if defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGPERL) || defined(SWIGRUBY)
#define SWIG_GOOD_VECTOR
%ignore std::vector<Flow>::vector(size_type);
%ignore std::vector<Flow>::resize(size_type);
#endif
+#if defined(SWIGJAVA)
+#define SWIG_GOOD_VECTOR
+%ignore std::vector<Flow>::vector(jint);
+%ignore std::vector<Flow>::resize(jint);
+#endif
+
#if defined(SWIGTCL) || defined(SWIGPERL)
#define SWIG_GOOD_VECTOR
/* here, for languages with bad declaration */
diff --git a/Examples/test-suite/import_fragments.i b/Examples/test-suite/import_fragments.i
new file mode 100644
index 000000000..26b87cdb2
--- /dev/null
+++ b/Examples/test-suite/import_fragments.i
@@ -0,0 +1,18 @@
+%module import_fragments
+
+// Check %fragments forced inclusion does not result in code generation when using %import
+%import "import_fragments_a.i"
+
+%{
+template<typename T>
+struct TemplateA4 {};
+%}
+
+%template(TemplateA4Int) TemplateA4<int>;
+
+%inline %{
+int getImport4() {
+ // Requires the ImportA4 fragment to be generated in order to compile
+ return ImportA4;
+}
+%}
diff --git a/Examples/test-suite/import_fragments_a.i b/Examples/test-suite/import_fragments_a.i
new file mode 100644
index 000000000..1babea95f
--- /dev/null
+++ b/Examples/test-suite/import_fragments_a.i
@@ -0,0 +1,48 @@
+#if !defined(SWIGGO)
+// Prevent Go from generating a Go module import - this test is not set up as true multiple modules
+%module import_fragments_a
+#endif
+
+%fragment("ImportA1", "header") %{
+ImportA1_this_will_not_compile;
+%}
+%fragment("ImportA2", "header") %{
+ImportA2_this_will_not_compile;
+%}
+%fragment("ImportA3", "header") %{
+ImportA3_this_will_not_compile;
+%}
+%fragment("ImportA4", "header") %{
+static int ImportA4 = 99;
+%}
+%fragment("ImportA5", "header") %{
+ImportA5_this_will_not_compile;
+%}
+
+%fragment("ImportA1");
+
+%{
+Import_will_not_compile;
+%}
+
+struct StructA {
+ %fragment("ImportA2");
+};
+
+template<typename T>
+struct TemplateA3 {
+ %fragment("ImportA3");
+};
+
+template<typename T>
+struct TemplateA4 {
+ %fragment("ImportA4");
+};
+
+template<typename T>
+struct TemplateA5 {
+ %fragment("ImportA5");
+};
+%template(TemplateA5Double) TemplateA5<double>;
+
+%include "import_fragments_b.i"
diff --git a/Examples/test-suite/import_fragments_b.i b/Examples/test-suite/import_fragments_b.i
new file mode 100644
index 000000000..615db4796
--- /dev/null
+++ b/Examples/test-suite/import_fragments_b.i
@@ -0,0 +1,9 @@
+%module import_fragments_b
+
+%fragment("ImportB", "header") %{
+ImportB_this_will_not_compile;
+%}
+
+%fragment("ImportB");
+
+
diff --git a/Examples/test-suite/intermediary_classname.i b/Examples/test-suite/intermediary_classname.i
index 94858a5fb..585967ad4 100644
--- a/Examples/test-suite/intermediary_classname.i
+++ b/Examples/test-suite/intermediary_classname.i
@@ -4,6 +4,12 @@
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR);
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
+%{
+#define TESTCASE_THROW2(T1, T2)
+%}
+
// change the access to the intermediary class for testing purposes
%pragma(java) jniclassclassmodifiers="public class";
%pragma(csharp) imclassclassmodifiers="public class";
@@ -41,10 +47,6 @@ template<class T> class vector {
void testconst(const T x) { }
};
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
class Base {
public:
Base() : mVectInt(0) {}
@@ -65,11 +67,8 @@ public:
virtual Base& m1(Base &b) { return b; }
virtual Base* m2(Base *b) { return b; }
// virtual Base m3(Base b) { return b; }
- void throwspec() throw (int, Base) {}
+ void throwspec() TESTCASE_THROW2(int, Base) {}
};
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
%}
%template(maxint) maximum<int>;
diff --git a/Examples/test-suite/java/CommentParser.java b/Examples/test-suite/java/CommentParser.java
new file mode 100644
index 000000000..7dc6d591d
--- /dev/null
+++ b/Examples/test-suite/java/CommentParser.java
@@ -0,0 +1,172 @@
+
+import com.sun.javadoc.*;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.Map;
+import java.util.Set;
+import java.util.Iterator;
+import java.io.BufferedWriter;
+import java.io.OutputStreamWriter;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+
+public class CommentParser {
+ private static Map<String, String> m_parsedComments = new HashMap<String, String>();
+
+ public static boolean start(RootDoc root) {
+
+ /*
+ * This method is called by 'javadoc' and gets the whole parsed java
+ * file, we get comments and store them
+ */
+
+ for (ClassDoc classDoc : root.classes()) {
+
+ if (classDoc.getRawCommentText().length() > 0)
+ m_parsedComments.put(classDoc.qualifiedName(), classDoc.getRawCommentText());
+
+ for (FieldDoc f : classDoc.enumConstants()) {
+ if (f.getRawCommentText().length() > 0)
+ m_parsedComments.put(f.qualifiedName(), f.getRawCommentText());
+ }
+ for (FieldDoc f : classDoc.fields()) {
+ if (f.getRawCommentText().length() > 0)
+ m_parsedComments.put(f.qualifiedName(), f.getRawCommentText());
+ }
+ for (ConstructorDoc c : classDoc.constructors()) {
+ if (c.getRawCommentText().length() > 0)
+ m_parsedComments.put(c.toString(), c.getRawCommentText());
+ }
+ for (MethodDoc m : classDoc.methods()) {
+ if (m.getRawCommentText().length() > 0)
+ m_parsedComments.put(m.toString(), m.getRawCommentText());
+ }
+ }
+ return true;
+ }
+
+
+ public int check(Map<String, String> wantedComments) {
+ int errorCount=0;
+ Iterator<Entry<String, String>> it = m_parsedComments.entrySet().iterator();
+
+ while (it.hasNext()) {
+
+ Entry<String, String> e = (Entry<String, String>) it.next();
+ String actualStr = e.getValue();
+ String wantedStr = wantedComments.get(e.getKey());
+ // this may be weird, but I don't know any more effective solution
+ actualStr = actualStr.replace(" ", "");
+ actualStr = actualStr.replaceAll("\t", "");
+ actualStr = actualStr.replace("\n", "");
+
+ // Removing of <br> is temporary solution, since adding of
+ // <br> tag requires changes in all tests. However, <br>
+ // tag should be added more selectively and when this is
+ // implemented, tests should be updated.
+ actualStr = actualStr.replace("<br>", "");
+
+ if (wantedStr != null) {
+ wantedStr = wantedStr.replace(" ", "");
+ wantedStr = wantedStr.replace("\t", "");
+ wantedStr = wantedStr.replace("\n", "");
+ wantedStr = wantedStr.replace("<br>", "");
+ }
+ /* The following lines replace multiple whitespaces with a single one.
+ Although this would be more exact testing, it would also require
+ more work on test maintenance.
+ actualStr = actualStr.replace('\t', ' ');
+ actualStr = actualStr.replaceAll(" +", " ");
+ // actualStr = actualStr.replace("\n", "");
+ if (wantedStr != null) {
+ wantedStr = wantedStr.replace('\t', ' ');
+ wantedStr = wantedStr.replaceAll(" +", " ");
+ // wantedStr = wantedStr.replace("\n", "");
+ } */
+
+ if (!actualStr.equals(wantedStr)) {
+ System.out.println("\n\n////////////////////////////////////////////////////////////////////////");
+ System.out.println("Documentation comments for '" + e.getKey() + "' do not match!");
+ String expectedFileName = "expected.txt";
+ String gotFileName = "got.txt";
+ System.out.println("Output is also saved to files '" + expectedFileName +
+ "' and '" + gotFileName + "'");
+ // here we print original strings, for nicer output
+ System.out.println("\n\n---\nexpected:\n" + wantedComments.get(e.getKey()));
+ System.out.println("\n\n---\ngot:\n" + e.getValue());
+
+ try {
+ // write expected string to file
+ BufferedWriter expectedFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(expectedFileName)));
+ expectedFile.write(wantedComments.get(e.getKey()));
+ expectedFile.close();
+
+ // write translated string to file
+ BufferedWriter gotFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(gotFileName)));
+ gotFile.write(e.getValue().replace("<br>", ""));
+ gotFile.close();
+ } catch (IOException ex) {
+ System.out.println("Error when writing output to file: " + ex);
+ }
+
+ errorCount++;
+ }
+ }
+
+ if (m_parsedComments.size() != wantedComments.size()) {
+ System.out.println("Mismatch in the number of comments!\n Expected: " +
+ wantedComments.size() + "\n Parsed: " +
+ m_parsedComments.size());
+ System.out.println("Expected keys: ");
+ printKeys(wantedComments);
+ System.out.println("Parsed keys: ");
+ printKeys(m_parsedComments);
+
+ errorCount++;
+ }
+
+ return errorCount > 0 ? 1 : 0;
+ }
+
+
+ private void printKeys(Map<String, String> map) {
+
+ Set<String> keys = map.keySet();
+ for (String key : keys) {
+ System.out.println(" " + key);
+ }
+ }
+
+
+ public static void printCommentListForJavaSource() {
+
+ Iterator< Entry<String, String> > it = m_parsedComments.entrySet().iterator();
+
+ while (it.hasNext()) {
+
+ Entry<String, String> e = (Entry<String, String>) it.next();
+ String commentText = e.getValue();
+ commentText = commentText.replace("\\", "\\\\");
+ commentText = commentText.replace("\"", "\\\"");
+ commentText = commentText.replace("\n", "\\n\" +\n\t\t\"");
+ System.out.format("wantedComments.put(\"%s\",\n\t\t\"%s\");\n", e.getKey(), commentText);
+ }
+ }
+
+
+ public static void main(String argv[]) {
+
+ if (argv.length<1) {
+ System.out.format("Usage:\n\tCommentParser <package to parse>\n");
+ System.exit(1);
+ }
+
+ com.sun.tools.javadoc.Main.execute("The comment parser program",
+ "CommentParser", new String[]{"-quiet", argv[0]});
+
+ // if we are run as standalone app, print the list of found comments as it would appear in java source
+
+ printCommentListForJavaSource();
+ }
+}
diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in
index d63a25879..2e788fa07 100644
--- a/Examples/test-suite/java/Makefile.in
+++ b/Examples/test-suite/java/Makefile.in
@@ -6,6 +6,8 @@ LANGUAGE = java
JAVA = @JAVA@
JAVAC = @JAVAC@
JAVAFLAGS = @JAVAFLAGS@
+JAVA_CLASSPATH_SEP = @JAVA_CLASSPATH_SEP@
+JAVA_TOOLS_JAR = @JAVA_TOOLS_JAR@
SCRIPTSUFFIX = _runme.java
srcdir = @srcdir@
@@ -29,6 +31,7 @@ CPP_TEST_CASES = \
java_director_exception_feature_nspace \
java_director_ptrclass \
java_director_typemaps \
+ java_director_typemaps_ptr \
java_enums \
java_jnitypes \
java_lib_arrays_dimensionless \
@@ -40,11 +43,26 @@ CPP_TEST_CASES = \
java_throws \
java_typemaps_proxy \
java_typemaps_typewrapper \
+ li_std_list \
+ li_std_map \
+ li_std_set \
# li_boost_intrusive_ptr
CPP11_TEST_CASES = \
+ cpp11_shared_ptr_const \
+ cpp11_shared_ptr_nullptr_in_containers \
+ cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_upcast \
+ cpp11_std_unordered_map \
+ cpp11_std_unordered_set \
cpp11_strongly_typed_enumerations_simple \
+DOXYGEN_TEST_CASES := \
+ doxygen_parsing_enums_simple \
+ doxygen_parsing_enums_proper \
+ doxygen_parsing_enums_typesafe \
+ doxygen_parsing_enums_typeunsafe \
+
include $(srcdir)/../common.mk
# Overridden variables here
@@ -54,6 +72,7 @@ JAVA_PACKAGEOPT = -package $(JAVA_PACKAGE)
SWIGOPT += $(JAVA_PACKAGEOPT)
# Custom tests - tests with additional commandline options
+cpp17_nspace_nested_namespaces.%: JAVA_PACKAGE = $*Package
director_nspace.%: JAVA_PACKAGE = $*Package
director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package
java_director_exception_feature_nspace.%: JAVA_PACKAGE = $*Package
@@ -89,14 +108,23 @@ setup = \
mkdir $(JAVA_PACKAGE); \
fi
+# Doxygen test cases need to be compiled together with the CommentParser class
+# which depends on com.sun.javadoc package which is located in this JAR.
+CommentParser.class:
+ $(COMPILETOOL) $(JAVAC) -classpath $(JAVA_CLASSPATH) -d . $(srcdir)/CommentParser.java
+
+JAVA_CLASSPATH := .
+$(DOXYGEN_TEST_CASES:=.cpptest): JAVA_CLASSPATH := "$(JAVA_TOOLS_JAR)$(JAVA_CLASSPATH_SEP)."
+$(DOXYGEN_TEST_CASES:=.cpptest): CommentParser.class
+
# Compiles java files then runs the testcase. A testcase is only run if
# a file is found which has _runme.java appended after the testcase name.
# Note Java uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows, SHLIB_PATH on HPUX and DYLD_LIBRARY_PATH on Mac OS X.
run_testcase = \
cd $(JAVA_PACKAGE) && $(COMPILETOOL) $(JAVAC) -classpath . `find . -name "*.java"` && cd .. && \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- $(COMPILETOOL) $(JAVAC) -classpath . -d . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- env LD_LIBRARY_PATH="$(JAVA_PACKAGE):$$LD_LIBRARY_PATH" PATH="$(JAVA_PACKAGE):$$PATH" SHLIB_PATH="$(JAVA_PACKAGE):$$SHLIB_PATH" DYLD_LIBRARY_PATH="$(JAVA_PACKAGE):$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) $(JAVAFLAGS) -classpath . $*_runme; \
+ $(COMPILETOOL) $(JAVAC) -classpath $(JAVA_CLASSPATH) -d . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ env LD_LIBRARY_PATH="$(JAVA_PACKAGE):$$LD_LIBRARY_PATH" PATH="$(JAVA_PACKAGE):$$PATH" SHLIB_PATH="$(JAVA_PACKAGE):$$SHLIB_PATH" DYLD_LIBRARY_PATH="$(JAVA_PACKAGE):$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) $(JAVAFLAGS) -classpath $(JAVA_CLASSPATH) $*_runme; \
fi
# Clean: remove testcase directories
diff --git a/Examples/test-suite/java/class_scope_namespace_runme.java b/Examples/test-suite/java/class_scope_namespace_runme.java
new file mode 100644
index 000000000..e55393e2b
--- /dev/null
+++ b/Examples/test-suite/java/class_scope_namespace_runme.java
@@ -0,0 +1,59 @@
+
+import class_scope_namespace.*;
+
+public class class_scope_namespace_runme {
+
+ static {
+ try {
+ System.loadLibrary("class_scope_namespace");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ A a = new A();
+ B b = new B();
+ C c = new C();
+ D d = new D();
+ E e = new E();
+ F f = new F();
+ G g = new G();
+ H.HH h = new H.HH();
+ I_.II i = new I_.II();
+ J j = new J();
+ K k = new K();
+ L l = new L();
+ M m = new M();
+
+ a.aa(a, a, a);
+ b.bb(b, b);
+ c.cc(c, c);
+ d.dd(d, d, d);
+ e.ee(e, e, e);
+ f.ff(f, f, f, f);
+ g.gg(g, g);
+ h.hh(h);
+ i.ii(i, i);
+ j.jj(j, j, j);
+ k.kk(k, k, k);
+ l.ll(l, l, l);
+ m.mm(m, m, m);
+
+ class_scope_namespace.aaa(a, a, a);
+ class_scope_namespace.bbb(b, b);
+ class_scope_namespace.ccc(c, c);
+ class_scope_namespace.ddd(d, d, d);
+ class_scope_namespace.eee(e, e, e);
+ class_scope_namespace.fff(f, f, f, f);
+ class_scope_namespace.ggg(g, g);
+ class_scope_namespace.hhh(h);
+ class_scope_namespace.iii(i, i);
+ class_scope_namespace.jjj(j, j, j);
+ class_scope_namespace.kkk(k, k, k);
+ class_scope_namespace.lll(l, l, l);
+ class_scope_namespace.mmm(m, m, m);
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_alias_nested_template_scoping_runme.java b/Examples/test-suite/java/cpp11_alias_nested_template_scoping_runme.java
new file mode 100644
index 000000000..7afa83a0f
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_alias_nested_template_scoping_runme.java
@@ -0,0 +1,32 @@
+
+import cpp11_alias_nested_template_scoping.*;
+
+public class cpp11_alias_nested_template_scoping_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_alias_nested_template_scoping");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Yshort ys = new Yshort();
+ short val = 0;
+ val = ys.create1();
+ val = ys.create2();
+ val = ys.create3();
+ val = ys.create4();
+ val = ys.create5();
+ val = ys.create6();
+ val = ys.create7();
+
+ val = ys.create13();
+
+ val = ys.create15();
+ val = ys.create16();
+ val = ys.create17();
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_initializer_list_runme.java b/Examples/test-suite/java/cpp11_initializer_list_runme.java
new file mode 100644
index 000000000..0318c9e90
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_initializer_list_runme.java
@@ -0,0 +1,21 @@
+
+import cpp11_initializer_list.*;
+
+public class cpp11_initializer_list_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_initializer_list");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ C c = new C(null);
+ String joined = c.get_joined_string();
+ if (!joined.equals("AbFab"))
+ throw new RuntimeException("Wrong joined string " + joined);
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_raw_string_literals_runme.java b/Examples/test-suite/java/cpp11_raw_string_literals_runme.java
new file mode 100644
index 000000000..396c0ba06
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_raw_string_literals_runme.java
@@ -0,0 +1,67 @@
+import cpp11_raw_string_literals.*;
+
+public class cpp11_raw_string_literals_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_raw_string_literals");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ if (cpp11_raw_string_literals.getL() != 100)
+ throw new RuntimeException("failed!");
+
+ if (cpp11_raw_string_literals.getU8() != 100)
+ throw new RuntimeException("failed!");
+
+ if (cpp11_raw_string_literals.getU() != 100)
+ throw new RuntimeException("failed!");
+
+ if (UStruct.U != 100)
+ throw new RuntimeException("failed!");
+
+
+ if (cpp11_raw_string_literals.getR() != 100)
+ throw new RuntimeException("failed!");
+
+ if (cpp11_raw_string_literals.getLR() != 100)
+ throw new RuntimeException("failed!");
+
+ if (cpp11_raw_string_literals.getU8R() != 100)
+ throw new RuntimeException("failed!");
+
+ if (cpp11_raw_string_literals.getUR() != 100)
+ throw new RuntimeException("failed!");
+
+ if (URStruct.UR != 100)
+ throw new RuntimeException("failed!");
+
+
+ if (!cpp11_raw_string_literals.getAa().equals("Wide string"))
+ throw new RuntimeException("failed!");
+
+ if (!cpp11_raw_string_literals.getBb().equals("UTF-8 string"))
+ throw new RuntimeException("failed!");
+
+ if (!cpp11_raw_string_literals.getXx().equals(")I'm an \"ascii\" \\ string."))
+ throw new RuntimeException("failed!");
+
+ if (!cpp11_raw_string_literals.getEe().equals(")I'm an \"ascii\" \\ string."))
+ throw new RuntimeException("failed!");
+
+ if (!cpp11_raw_string_literals.getFf().equals("I'm a \"raw wide\" \\ string."))
+ throw new RuntimeException("failed!");
+
+ if (!cpp11_raw_string_literals.getGg().equals("I'm a \"raw UTF-8\" \\ string."))
+ throw new RuntimeException("failed!");
+
+
+
+ if (!cpp11_raw_string_literalsConstants.mm.equals(")I'm an \"ascii\" \\ string constant with multiple\n\nlines."))
+ throw new RuntimeException("failed!");
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_ref_qualifiers_runme.java b/Examples/test-suite/java/cpp11_ref_qualifiers_runme.java
new file mode 100644
index 000000000..4755f8d1f
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_ref_qualifiers_runme.java
@@ -0,0 +1,56 @@
+
+import cpp11_ref_qualifiers.*;
+
+public class cpp11_ref_qualifiers_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_ref_qualifiers");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Host h = new Host();
+
+ // Basic testing
+ h.h1();
+ h.h2();
+ h.h6();
+ h.h7();
+
+ h.h();
+
+ // %feature testing
+ Features f = new Features();
+ if (!f.F1().equals("F1")) throw new RuntimeException("Fail");
+ if (!f.F2().equals("F2")) throw new RuntimeException("Fail");
+ if (!f.F3().equals("F3")) throw new RuntimeException("Fail");
+
+ if (!f.C1(0).equals("C1")) throw new RuntimeException("Fail");
+ if (!f.C2(0).equals("C2")) throw new RuntimeException("Fail");
+ if (!f.C3(0).equals("C3")) throw new RuntimeException("Fail");
+
+ // %rename testing
+ Renames r = new Renames();
+ r.RR1();
+ r.RR2();
+ r.RR3();
+
+ r.SS1(0);
+ r.SS2(0);
+ r.SS3(0);
+
+ // Conversion operators
+ String s = null;
+ ConversionOperators co = new ConversionOperators();
+ s = co.StringConvertCopy();
+ s = co.StringConvertMove();
+
+ ConversionOperators2 co2 = new ConversionOperators2();
+ s = co2.StringConvertMove();
+ }
+}
+
diff --git a/Examples/test-suite/java/cpp11_ref_qualifiers_rvalue_unignore_runme.java b/Examples/test-suite/java/cpp11_ref_qualifiers_rvalue_unignore_runme.java
new file mode 100644
index 000000000..bbbe6f788
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_ref_qualifiers_rvalue_unignore_runme.java
@@ -0,0 +1,20 @@
+
+import cpp11_ref_qualifiers_rvalue_unignore.*;
+
+public class cpp11_ref_qualifiers_rvalue_unignore_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_ref_qualifiers_rvalue_unignore");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ new RefQualifier().m1();
+ new RefQualifier().m2();
+ }
+}
+
diff --git a/Examples/test-suite/java/cpp11_ref_qualifiers_typemaps_runme.java b/Examples/test-suite/java/cpp11_ref_qualifiers_typemaps_runme.java
new file mode 100644
index 000000000..8c6a21b15
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_ref_qualifiers_typemaps_runme.java
@@ -0,0 +1,39 @@
+import cpp11_ref_qualifiers_typemaps.*;
+
+public class cpp11_ref_qualifiers_typemaps_runme {
+ static {
+ try {
+ System.loadLibrary("cpp11_ref_qualifiers_typemaps");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ {
+ TypemapsNamedParms tm = new TypemapsNamedParms();
+ if (tm.fff(cpp11_ref_qualifiers_typemaps.FF1_MFP) != 2)
+ throw new RuntimeException("failed");
+ if (tm.ccc(cpp11_ref_qualifiers_typemaps.CC4_MFP) != 5)
+ throw new RuntimeException("failed");
+ if (tm.ggg(cpp11_ref_qualifiers_typemaps.GG7_MFP) != 8)
+ throw new RuntimeException("failed");
+ if (tm.hhh(cpp11_ref_qualifiers_typemaps.HH10_MFP) != 11)
+ throw new RuntimeException("failed");
+ }
+ {
+ TypemapsUnnamedParms tm = new TypemapsUnnamedParms();
+ if (tm.fff(cpp11_ref_qualifiers_typemaps.FF1_MFP) != 3)
+ throw new RuntimeException("failed");
+ if (tm.ccc(cpp11_ref_qualifiers_typemaps.CC4_MFP) != 6)
+ throw new RuntimeException("failed");
+ if (tm.ggg(cpp11_ref_qualifiers_typemaps.GG7_MFP) != 9)
+ throw new RuntimeException("failed");
+ if (tm.hhh(cpp11_ref_qualifiers_typemaps.HH10_MFP) != 12)
+ throw new RuntimeException("failed");
+ }
+ }
+}
+
diff --git a/Examples/test-suite/java/cpp11_shared_ptr_overload_runme.java b/Examples/test-suite/java/cpp11_shared_ptr_overload_runme.java
new file mode 100644
index 000000000..27dfe1830
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_shared_ptr_overload_runme.java
@@ -0,0 +1,60 @@
+import cpp11_shared_ptr_overload.*;
+
+public class cpp11_shared_ptr_overload_runme {
+ static {
+ try {
+ System.loadLibrary("cpp11_shared_ptr_overload");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ String ret = null;
+
+ // ref
+ ret = cpp11_shared_ptr_overload.UseA(new MyType("123"));
+ if (!ret.equals("123 ref")) throw new RuntimeException("UseA fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.UseB(0, new MyType("123"));
+ if (!ret.equals("123 ref")) throw new RuntimeException("UseB fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.UseC(0, new MyType("123"), new MyType("456"));
+ if (!ret.equals("123 ref")) throw new RuntimeException("UseC fail:" + ret);
+
+ // sharedptr
+ ret = cpp11_shared_ptr_overload.UseX(new MyType("123"));
+ if (!ret.equals("123 sharedptr")) throw new RuntimeException("UseX fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.UseY(0, new MyType("123"));
+ if (!ret.equals("123 sharedptr")) throw new RuntimeException("UseY fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.UseZ(0, new MyType("123"), new MyType("456"));
+ if (!ret.equals("123 sharedptr")) throw new RuntimeException("UseZ fail:" + ret);
+
+ // Combo1-4
+ ret = cpp11_shared_ptr_overload.Combo1(new MyType("XXX"));
+ if (!ret.equals("XXXCombo1")) throw new RuntimeException("Combo1 fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.Combo2(new MyType("XXX"));
+ if (!ret.equals("XXXCombo2")) throw new RuntimeException("Combo2 fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.Combo3(new MyType("XXX"));
+ if (!ret.equals("XXXCombo3")) throw new RuntimeException("Combo3 fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.Combo4(new MyType("XXX"));
+ if (!ret.equals("XXXCombo4")) throw new RuntimeException("Combo4 fail:" + ret);
+
+ // Combo5-7
+ ret = cpp11_shared_ptr_overload.Combo5(new MyType("XXX"));
+ if (!ret.equals("XXXCombo5")) throw new RuntimeException("Combo5 fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.Combo6(new MyType("XXX"));
+ if (!ret.equals("XXXCombo6")) throw new RuntimeException("Combo6 fail:" + ret);
+
+ ret = cpp11_shared_ptr_overload.Combo7(new MyType("XXX"));
+ if (!ret.equals("XXXCombo7")) throw new RuntimeException("Combo7 fail:" + ret);
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_li_std_array_runme.java b/Examples/test-suite/java/cpp11_std_array_runme.java
index 2e2a20138..58fdc176b 100644
--- a/Examples/test-suite/java/cpp11_li_std_array_runme.java
+++ b/Examples/test-suite/java/cpp11_std_array_runme.java
@@ -1,10 +1,10 @@
-import cpp11_li_std_array.*;
+import cpp11_std_array.*;
-public class cpp11_li_std_array_runme {
+public class cpp11_std_array_runme {
static {
try {
- System.loadLibrary("cpp11_li_std_array");
+ System.loadLibrary("cpp11_std_array");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
@@ -43,24 +43,24 @@ public class cpp11_li_std_array_runme {
compareContainers(ai, vals);
// Check return
- compareContainers(cpp11_li_std_array.arrayOutVal(), new int[] {-2, -1, 0, 0, 1, 2});
- compareContainers(cpp11_li_std_array.arrayOutConstRef(), new int[] {-2, -1, 0, 0, 1, 2});
- compareContainers(cpp11_li_std_array.arrayOutRef(), new int[] {-2, -1, 0, 0, 1, 2});
- compareContainers(cpp11_li_std_array.arrayOutPtr(), new int[] {-2, -1, 0, 0, 1, 2});
+ compareContainers(cpp11_std_array.arrayOutVal(), new int[] {-2, -1, 0, 0, 1, 2});
+ compareContainers(cpp11_std_array.arrayOutConstRef(), new int[] {-2, -1, 0, 0, 1, 2});
+ compareContainers(cpp11_std_array.arrayOutRef(), new int[] {-2, -1, 0, 0, 1, 2});
+ compareContainers(cpp11_std_array.arrayOutPtr(), new int[] {-2, -1, 0, 0, 1, 2});
// Check passing arguments
- ai = cpp11_li_std_array.arrayInVal(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
+ ai = cpp11_std_array.arrayInVal(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
compareContainers(ai, new int[] {90, 80, 70, 60, 50, 40});
- ai = cpp11_li_std_array.arrayInConstRef(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
+ ai = cpp11_std_array.arrayInConstRef(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
compareContainers(ai, new int[] {90, 80, 70, 60, 50, 40});
ai = new ArrayInt6(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
- cpp11_li_std_array.arrayInRef(ai);
+ cpp11_std_array.arrayInRef(ai);
compareContainers(ai, new int[] {90, 80, 70, 60, 50, 40});
ai = new ArrayInt6(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
- cpp11_li_std_array.arrayInPtr(ai);
+ cpp11_std_array.arrayInPtr(ai);
compareContainers(ai, new int[] {90, 80, 70, 60, 50, 40});
// fill
diff --git a/Examples/test-suite/java/cpp11_std_unordered_map_runme.java b/Examples/test-suite/java/cpp11_std_unordered_map_runme.java
new file mode 100644
index 000000000..79f683378
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_std_unordered_map_runme.java
@@ -0,0 +1,122 @@
+import cpp11_std_unordered_map.*;
+
+public class cpp11_std_unordered_map_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_std_unordered_map");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void checkThat(boolean mustBeTrue) throws Throwable {
+ if (!mustBeTrue) {
+ // Index [2], since this function is one hop away from main, and [1] is the current method.
+ throw new RuntimeException("Test failed at line number " + Thread.currentThread().getStackTrace()[2].getLineNumber());
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ java.util.AbstractMap<String, Integer> sim = new UnorderedMapStringInt();
+ java.util.AbstractMap<Integer, Integer> iim = new UnorderedMapIntInt();
+
+ checkThat(sim.isEmpty());
+ checkThat(iim.isEmpty());
+ checkThat(sim.size() == 0);
+ checkThat(iim.size() == 0);
+
+ checkThat(sim.get("key") == null);
+ checkThat(iim.get(1) == null);
+
+ checkThat(!sim.containsKey("key"));
+ checkThat(!iim.containsKey(1));
+
+ checkThat(sim.put("key", 2) == null);
+ checkThat(iim.put(1, 2) == null);
+
+ checkThat(sim.size() == 1);
+ checkThat(iim.size() == 1);
+ checkThat(!sim.isEmpty());
+ checkThat(!iim.isEmpty());
+
+ checkThat(sim.get("key") == 2);
+ checkThat(iim.get(1) == 2);
+
+ checkThat(sim.remove("key") == 2);
+ checkThat(iim.remove(1) == 2);
+
+ checkThat(sim.isEmpty());
+ checkThat(iim.isEmpty());
+ checkThat(sim.size() == 0);
+ checkThat(iim.size() == 0);
+
+ checkThat(sim.get("key") == null);
+ checkThat(iim.get(1) == null);
+
+ checkThat(sim.remove("key") == null);
+ checkThat(iim.remove(1) == null);
+
+ checkThat(sim.put("key", 2) == null);
+ checkThat(iim.put(1, 2) == null);
+
+ sim.clear();
+ iim.clear();
+ checkThat(sim.isEmpty());
+ checkThat(iim.isEmpty());
+
+ checkThat(sim.put("key1", 1) == null);
+ checkThat(iim.put(1, 1) == null);
+ checkThat(sim.put("key2", 2) == null);
+ checkThat(iim.put(2, 2) == null);
+
+ checkThat(sim.size() == 2);
+ checkThat(iim.size() == 2);
+ checkThat(sim.get("key1") == 1);
+ checkThat(iim.get(1) == 1);
+ checkThat(sim.get("key2") == 2);
+ checkThat(iim.get(2) == 2);
+
+ checkThat(sim.put("key1", 3) == 1);
+ checkThat(iim.put(1, 3) == 1);
+
+ checkThat(sim.size() == 2);
+ checkThat(iim.size() == 2);
+ checkThat(sim.get("key1") == 3);
+ checkThat(iim.get(1) == 3);
+
+ java.util.Set<java.util.Map.Entry<String, Integer>> sim_es = sim.entrySet();
+ java.util.Map<String, Integer> sim_default = new java.util.HashMap<String, Integer>();
+ sim_default.put("key1", 3);
+ sim_default.put("key2", 2);
+ java.util.Set<java.util.Map.Entry<String, Integer>> sim_es_default = sim_default.entrySet();
+ checkThat(sim_es.size() == sim_es_default.size());
+ for (java.util.Map.Entry<String, Integer> entry : sim_es) {
+ checkThat(sim_es_default.contains(entry));
+ checkThat(sim_default.containsKey(entry.getKey()));
+ checkThat(sim_default.containsValue(entry.getValue()));
+
+ Integer oldValue = entry.getValue();
+ entry.setValue(oldValue + 1);
+ checkThat(sim.get(entry.getKey()) == (oldValue + 1));
+ }
+
+ java.util.Set<java.util.Map.Entry<Integer, Integer>> iim_es = iim.entrySet();
+ java.util.Map<Integer, Integer> iim_default = new java.util.HashMap<Integer, Integer>();
+ iim_default.put(1, 3);
+ iim_default.put(2, 2);
+ java.util.Set<java.util.Map.Entry<Integer, Integer>> iim_es_default = iim_default.entrySet();
+ checkThat(iim_es.size() == iim_es_default.size());
+ for (java.util.Map.Entry<Integer, Integer> entry : iim_es) {
+ checkThat(iim_es_default.contains(entry));
+ checkThat(iim_default.containsKey(entry.getKey()));
+ checkThat(iim_default.containsValue(entry.getValue()));
+
+ Integer oldValue = entry.getValue();
+ entry.setValue(oldValue + 1);
+ checkThat(iim.get(entry.getKey()) == (oldValue + 1));
+ }
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_std_unordered_set_runme.java b/Examples/test-suite/java/cpp11_std_unordered_set_runme.java
new file mode 100644
index 000000000..9d64ab240
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_std_unordered_set_runme.java
@@ -0,0 +1,75 @@
+import cpp11_std_unordered_set.*;
+
+public class cpp11_std_unordered_set_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_std_unordered_set");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void checkThat(boolean mustBeTrue) throws Throwable {
+ if (!mustBeTrue) {
+ // Index [2], since this function is one hop away from main, and [1] is the current method.
+ throw new RuntimeException("Test failed at line number " + Thread.currentThread().getStackTrace()[2].getLineNumber());
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ java.util.AbstractSet<String> ss = new UnorderedSetString();
+
+ checkThat(ss.isEmpty());
+ checkThat(!ss.contains("key"));
+ checkThat(!ss.remove("key"));
+
+ checkThat(ss.add("key"));
+ checkThat(!ss.add("key"));
+ checkThat(ss.contains("key"));
+ checkThat(ss.remove("key"));
+ checkThat(ss.isEmpty());
+ checkThat(ss.size() == 0);
+
+ checkThat(ss.add("key1"));
+ checkThat(ss.add("key2"));
+ checkThat(ss.add("key3"));
+ checkThat(ss.size() == 3);
+
+ ss.clear();
+ checkThat(ss.isEmpty());
+ checkThat(ss.size() == 0);
+
+ checkThat(ss.addAll(java.util.Arrays.asList("one", "two", "three")));
+ checkThat(ss.size() == 3);
+ checkThat(ss.contains("one"));
+ checkThat(!ss.contains("four"));
+
+ checkThat(ss.containsAll(java.util.Arrays.asList("one", "two", "three")));
+ checkThat(ss.containsAll(java.util.Arrays.asList("one", "two")));
+ checkThat(!ss.containsAll(java.util.Arrays.asList("one", "two", "four")));
+ checkThat(!ss.containsAll(java.util.Arrays.asList("one", "two", "three", "four")));
+
+ checkThat(!ss.addAll(java.util.Arrays.asList("one", "two", "three")));
+
+ java.util.Set<String> found = new java.util.HashSet<String>();
+ java.util.Iterator<String> itr = ss.iterator();
+ while (itr.hasNext()) {
+ found.add(itr.next());
+ }
+
+ checkThat(ss.containsAll(found));
+ checkThat(found.containsAll(ss));
+
+ java.util.AbstractSet<String> ss2 = new UnorderedSetString(ss);
+ checkThat(ss2.containsAll(ss));
+ checkThat(ss.containsAll(ss2));
+
+ checkThat(!ss.removeAll(java.util.Arrays.asList("five", "four")));
+ checkThat(ss.removeAll(found));
+ checkThat(ss.isEmpty());
+ checkThat(ss.size() == 0);
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_template_typedefs_runme.java b/Examples/test-suite/java/cpp11_template_typedefs_runme.java
new file mode 100644
index 000000000..473e7cf07
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_template_typedefs_runme.java
@@ -0,0 +1,19 @@
+import cpp11_template_typedefs.*;
+
+public class cpp11_template_typedefs_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_template_typedefs");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ int alloc1 = cpp11_template_typedefs.get_bucket_allocator1();
+ int alloc2 = cpp11_template_typedefs.get_bucket_allocator2();
+ }
+}
+
diff --git a/Examples/test-suite/java/cpp17_nested_namespaces_runme.java b/Examples/test-suite/java/cpp17_nested_namespaces_runme.java
new file mode 100644
index 000000000..ac29dee19
--- /dev/null
+++ b/Examples/test-suite/java/cpp17_nested_namespaces_runme.java
@@ -0,0 +1,32 @@
+import cpp17_nested_namespaces.*;
+
+public class cpp17_nested_namespaces_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp17_nested_namespaces");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ new A1Struct().A1Method();
+ new B1Struct().B1Method();
+ new C1Struct().C1Method();
+ cpp17_nested_namespaces.createA1Struct().A1Method();
+ cpp17_nested_namespaces.createB1Struct().B1Method();
+ cpp17_nested_namespaces.createC1Struct().C1Method();
+
+ new B2Struct().B2Method();
+ new C2Struct().C2Method();
+ cpp17_nested_namespaces.createB2Struct().B2Method();
+ cpp17_nested_namespaces.createC2Struct().C2Method();
+
+ new B3Struct().B3Method();
+ new C3Struct().C3Method();
+ cpp17_nested_namespaces.createB3Struct().B3Method();
+ cpp17_nested_namespaces.createC3Struct().C3Method();
+ }
+}
diff --git a/Examples/test-suite/java/cpp17_nspace_nested_namespaces_runme.java b/Examples/test-suite/java/cpp17_nspace_nested_namespaces_runme.java
new file mode 100644
index 000000000..e603484ab
--- /dev/null
+++ b/Examples/test-suite/java/cpp17_nspace_nested_namespaces_runme.java
@@ -0,0 +1,30 @@
+public class cpp17_nspace_nested_namespaces_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp17_nspace_nested_namespaces");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ new cpp17_nspace_nested_namespacesPackage.A1.A1Struct().A1Method();
+ new cpp17_nspace_nested_namespacesPackage.A1.B1.B1Struct().B1Method();
+ new cpp17_nspace_nested_namespacesPackage.A1.B1.C1.C1Struct().C1Method();
+ cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createA1Struct().A1Method();
+ cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB1Struct().B1Method();
+ cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC1Struct().C1Method();
+
+ new cpp17_nspace_nested_namespacesPackage.A2.B2.B2Struct().B2Method();
+ new cpp17_nspace_nested_namespacesPackage.A2.B2.C2.C2Struct().C2Method();
+ cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB2Struct().B2Method();
+ cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC2Struct().C2Method();
+
+ new cpp17_nspace_nested_namespacesPackage.A3.B3.B3Struct().B3Method();
+ new cpp17_nspace_nested_namespacesPackage.A3.B3.C3.C3Struct().C3Method();
+ cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB3Struct().B3Method();
+ cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC3Struct().C3Method();
+ }
+}
diff --git a/Examples/test-suite/java/director_classes_runme.java b/Examples/test-suite/java/director_classes_runme.java
index 5fbb9ea35..5992b5dd9 100644
--- a/Examples/test-suite/java/director_classes_runme.java
+++ b/Examples/test-suite/java/director_classes_runme.java
@@ -16,6 +16,7 @@ Expected output if PrintDebug enabled:
Base - Val(444.555)
Base - Ref(444.555)
Base - Ptr(444.555)
+Base - ConstPtrRef(444.555)
Base - FullyOverloaded(int 10)
Base - FullyOverloaded(bool 1)
Base - SemiOverloaded(int -678)
@@ -26,6 +27,7 @@ Base - DefaultParms(10, 1.1)
Derived - Val(444.555)
Derived - Ref(444.555)
Derived - Ptr(444.555)
+Derived - ConstPtrRef(444.555)
Derived - FullyOverloaded(int 10)
Derived - FullyOverloaded(bool 1)
Derived - SemiOverloaded(int -678)
@@ -36,6 +38,7 @@ Derived - DefaultParms(10, 1.1)
JavaDerived - Val(444.555)
JavaDerived - Ref(444.555)
JavaDerived - Ptr(444.555)
+JavaDerived - ConstPtrRef(444.555)
JavaDerived - FullyOverloaded(int 10)
JavaDerived - FullyOverloaded(bool True)
JavaDerived - SemiOverloaded(-678)
@@ -67,7 +70,7 @@ public class director_classes_runme {
void run()
{
- if (director_classes.getPrintDebug()) System.out.println("------------ Start ------------ ");
+ if (director_classes.getPrintDebug()) System.out.println("------------ Start ------------");
Caller myCaller = new Caller();
@@ -96,7 +99,7 @@ public class director_classes_runme {
myBase.delete();
}
- if (director_classes.getPrintDebug()) System.out.println("------------ Finish ------------ ");
+ if (director_classes.getPrintDebug()) System.out.println("------------ Finish ------------");
}
void makeCalls(Caller myCaller, Base myBase)
@@ -111,6 +114,7 @@ public class director_classes_runme {
if (myCaller.ValCall(dh).getVal() != dh.getVal()) throw new RuntimeException("failed");
if (myCaller.RefCall(dh).getVal() != dh.getVal()) throw new RuntimeException("failed");
if (myCaller.PtrCall(dh).getVal() != dh.getVal()) throw new RuntimeException("failed");
+ if (myCaller.ConstPtrRefCall(dh).getVal() != dh.getVal()) throw new RuntimeException("failed");
// Fully overloaded method test (all methods in base class are overloaded)
if (!myCaller.FullyOverloadedCall(10).equals(baseSimpleName + "::FullyOverloaded(int)")) {
@@ -170,6 +174,11 @@ class JavaDerived extends Base
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - Ptr(" + x.getVal() + ")");
return x;
}
+ public DoubleHolder ConstPtrRef(DoubleHolder x)
+ {
+ if (director_classes.getPrintDebug()) System.out.println("JavaDerived - ConstPtrRef(" + x.getVal() + ")");
+ return x;
+ }
public String FullyOverloaded(int x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - FullyOverloaded(int " + x + ")");
diff --git a/Examples/test-suite/java/director_exception_catches_runme.java b/Examples/test-suite/java/director_exception_catches_runme.java
new file mode 100644
index 000000000..c6fed192d
--- /dev/null
+++ b/Examples/test-suite/java/director_exception_catches_runme.java
@@ -0,0 +1,35 @@
+
+import director_exception_catches.*;
+
+public class director_exception_catches_runme {
+
+ static {
+ try {
+ System.loadLibrary("director_exception_catches");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ BaseClass b = new director_exception_catches_MyClass();
+
+ try {
+ String s = BaseClass.call_description(b);
+ throw new RuntimeException("Failed to catch exception");
+ } catch (NullPointerException e) {
+ if (!e.getMessage().startsWith("Testing exception thrown in BaseClass.description"))
+ throw new RuntimeException("Unexpected exception message: " + e.getMessage());
+ }
+ }
+}
+
+class director_exception_catches_MyClass extends BaseClass {
+ @Override
+ public String description() {
+ throw new NullPointerException("Testing exception thrown in BaseClass.description");
+ }
+}
+
diff --git a/Examples/test-suite/java/director_ownership_runme.java b/Examples/test-suite/java/director_ownership_runme.java
new file mode 100644
index 000000000..c038f56a4
--- /dev/null
+++ b/Examples/test-suite/java/director_ownership_runme.java
@@ -0,0 +1,42 @@
+import director_ownership.*;
+
+public class director_ownership_runme {
+
+ static {
+ try {
+ System.loadLibrary("director_ownership");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void set_content_and_release(Container container, ContentBase content) {
+ content.swigReleaseOwnership();
+ container.set_content(content);
+ }
+
+ public static void main(String argv[]) {
+
+ Container container = new Container();
+
+ // make a content in java (cMemoryOwn true)
+ ContentBase content_java = new ContentDerived();
+
+ // make a content in c++ (cMemoryOwn true)
+ ContentBase content_cpp = director_ownership.make_content();
+
+ set_content_and_release(container, content_java);
+ if (!container.get_content().get_name().equals("ContentDerived"))
+ throw new RuntimeException("did not get ContentDerived");
+
+ // when swigReleaseOwnership() is called on content_cpp, swig tries a static_cast to director and calls the method
+ // director->swig_java_change_ownership. The content created in c++ native library is not a director, therefore a
+ // segfault may occur.
+ // With a check done using dynamic_cast this issue could be avoided.
+ set_content_and_release(container, content_cpp);
+ if (!container.get_content().get_name().equals("ContentDerived"))
+ throw new RuntimeException("did not get ContentDerived");
+ }
+}
+
diff --git a/Examples/test-suite/java/director_smartptr_runme.java b/Examples/test-suite/java/director_smartptr_runme.java
index 710ece710..53d68f995 100644
--- a/Examples/test-suite/java/director_smartptr_runme.java
+++ b/Examples/test-suite/java/director_smartptr_runme.java
@@ -33,6 +33,19 @@ public class director_smartptr_runme {
director_smartptr.Foo myFoo2 = new director_smartptr.Foo().makeFoo();
check(myFoo2.pong(), "Foo::pong();Foo::ping()");
check(director_smartptr.Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
+
+ director_smartptr.FooDerived myBarFooDerived = new director_smartptr_MyBarFooDerived();
+ check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()");
+ check(director_smartptr.FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()");
+ check(director_smartptr.FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()");
+
+ director_smartptr.Foo myFoo3 = myBarFoo.makeFoo();
+ myFoo3.swigReleaseOwnership();
+ myFoo3.swigTakeOwnership();
+ director_smartptr.FooDerived myBarFooDerived2 = new director_smartptr_MyBarFooDerived();
+ myBarFooDerived2.swigReleaseOwnership();
+ myBarFooDerived2.swigTakeOwnership();
+
}
}
@@ -58,3 +71,26 @@ class director_smartptr_MyBarFoo extends director_smartptr.Foo {
return new director_smartptr.Foo();
}
}
+
+class director_smartptr_MyBarFooDerived extends director_smartptr.FooDerived {
+
+ @Override
+ public String ping() {
+ return "director_smartptr_MyBarFooDerived.ping()";
+ }
+
+ @Override
+ public String pong() {
+ return "director_smartptr_MyBarFooDerived.pong();" + ping();
+ }
+
+ @Override
+ public String upcall(director_smartptr.FooBar fooBarPtr) {
+ return "overrideDerived;" + fooBarPtr.FooBarDo();
+ }
+
+ @Override
+ public director_smartptr.Foo makeFoo() {
+ return new director_smartptr.Foo();
+ }
+}
diff --git a/Examples/test-suite/java/director_thread_runme.java b/Examples/test-suite/java/director_thread_runme.java
index c67d4104f..9bc4a93b5 100644
--- a/Examples/test-suite/java/director_thread_runme.java
+++ b/Examples/test-suite/java/director_thread_runme.java
@@ -30,6 +30,12 @@ class director_thread_Derived extends Foo {
}
public void do_foo() {
+ // Not all operating systems can name threads, so only test on those that can
+ if (Foo.namedThread()) {
+ String threadName = Thread.currentThread().getName();
+ if (!threadName.equals("MyThreadName"))
+ throw new RuntimeException("Unexpected thread name: " + threadName);
+ }
setVal(getVal() - 1);
}
}
diff --git a/Examples/test-suite/java/doxygen_alias_runme.java b/Examples/test-suite/java/doxygen_alias_runme.java
new file mode 100644
index 000000000..e21ed6d19
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_alias_runme.java
@@ -0,0 +1,32 @@
+
+import doxygen_alias.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_alias_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_alias");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_alias runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_alias"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+ wantedComments.put("doxygen_alias.doxygen_alias.make_something()",
+ " A function returning something.<br>\n" +
+ " <br>\n" +
+ " @return A new object which may be null.\n" +
+ "");
+
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_basic_notranslate_runme.java b/Examples/test-suite/java/doxygen_basic_notranslate_runme.java
new file mode 100644
index 000000000..e3d9b0279
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_basic_notranslate_runme.java
@@ -0,0 +1,102 @@
+
+import doxygen_basic_notranslate.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_basic_notranslate_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_basic_notranslate");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_basic_notranslate runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_basic_notranslate"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function3(int)",
+ " \n" +
+ " A test for overloaded functions\n" +
+ " This is function \\b one\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function4()",
+ " \n" +
+ " A test of some mixed tag usage\n" +
+ " \\if CONDITION\n" +
+ " This \\a code fragment shows us something \\.\n" +
+ " \\par Minuses:\n" +
+ " \\arg it's senseless\n" +
+ " \\arg it's stupid\n" +
+ " \\arg it's null\n" +
+ " \n" +
+ " \\warning This may not work as expected\n" +
+ " \n" +
+ " \\code\n" +
+ " int main() { while(true); }\n" +
+ " \\endcode\n" +
+ " \\endif\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function()",
+ " \n" +
+ " \\brief\n" +
+ " Brief description.\n" +
+ " \n" +
+ " The comment text\n" +
+ " \\author Some author\n" +
+ " \\return Some number\n" +
+ " \\sa function2\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function5(int)",
+ " This is a post comment. ");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function7(doxygen_basic_notranslate.SWIGTYPE_p_p_p_Shape)",
+ " \n" +
+ " Test for a parameter with difficult type\n" +
+ " (mostly for python)\n" +
+ " @param a Very strange param\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function3(int, int)",
+ " \n" +
+ " A test for overloaded functions\n" +
+ " This is function \\b two\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function6(int)",
+ " \n" +
+ " Test for default args\n" +
+ " @param a Some parameter, default is 42\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function6()",
+ " \n" +
+ " Test for default args\n" +
+ " @param a Some parameter, default is 42\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function1()",
+ " Single line comment ");
+ wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function2()",
+ " \n" +
+ " A test of a very very very very very very very very very very very very very very very very\n" +
+ " very very very very very long comment string.\n" +
+ " \n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java
new file mode 100644
index 000000000..ab343b560
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java
@@ -0,0 +1,101 @@
+
+import doxygen_basic_translate.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_basic_translate_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_basic_translate");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_basic_translate runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_basic_translate"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function()",
+ " \n" +
+ " Brief description.\n" +
+ " \n" +
+ " The comment text.\n" +
+ " @author Some author\n" +
+ " @return Some number\n" +
+ " @see function2\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function2()",
+ " A test of a very very very very very very very very very very very very very very very very \n" +
+ " very very very very very long comment string. \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function4()",
+ " A test of some mixed tag usage \n" +
+ " If: CONDITION {\n" +
+ " This <i>code </i>fragment shows us something . \n" +
+ " <p alt=\"Minuses: \">\n" +
+ " <li>it's senseless \n" +
+ " </li><li>it's stupid \n" +
+ " </li><li>it's null \n" +
+ " \n" +
+ " </li></p>Warning: This may not work as expected \n" +
+ " \n" +
+ " {@code \n" +
+ "int main() { while(true); } \n" +
+ "\n" +
+ "// Test blank line in code block \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function3(int)",
+ " A test for overloaded functions \n" +
+ " This is function <b>one </b>\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function5(int)",
+ " This is a post comment. \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function6(int)",
+ " Test for default args \n" +
+ " @param a Some parameter, default is 42" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function6()",
+ " Test for default args \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function7(doxygen_basic_translate.SWIGTYPE_p_p_p_Shape)",
+ " Test for a parameter with difficult type \n" +
+ " (mostly for python) \n" +
+ " @param a Very strange param \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function3(int, int)",
+ " A test for overloaded functions \n" +
+ " This is function <b>two </b>\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.Atan2(double, double)",
+ " Multiple parameters test.\n" +
+ " \n" +
+ " @param y Vertical coordinate.\n" +
+ " @param x Horizontal coordinate.\n" +
+ " @return Arc tangent of <code>y/x</code>.\n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java b/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
new file mode 100644
index 000000000..05e51cff8
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
@@ -0,0 +1,101 @@
+
+import doxygen_basic_translate_style2.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_basic_translate_style2_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_basic_translate_style2");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_basic_translate_style2 runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_basic_translate_style2"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function()",
+ " \n" +
+ " Brief description.\n" +
+ " \n" +
+ " The comment text.\n" +
+ " @author Some author\n" +
+ " @return Some number\n" +
+ " @see function2\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function2()",
+ " A test of a very very very very very very very very very very very very very very very very \n" +
+ " very very very very very long comment string. \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function4()",
+ " A test of some mixed tag usage \n" +
+ " If: CONDITION {\n" +
+ " This <i>code </i>fragment shows us something . \n" +
+ " <p alt=\"Minuses: \">\n" +
+ " <li>it's senseless \n" +
+ " </li><li>it's stupid \n" +
+ " </li><li>it's null \n" +
+ " \n" +
+ " </li></p>Warning: This may not work as expected \n" +
+ " \n" +
+ " {@code \n" +
+ "int main() { while(true); } \n" +
+ "\n" +
+ "// Test blank line in code block \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function3(int)",
+ " A test for overloaded functions \n" +
+ " This is function <b>one </b>\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function5(int)",
+ " This is a post comment. \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function6(int)",
+ " Test for default args \n" +
+ " @param a Some parameter, default is 42" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function6()",
+ " Test for default args \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function7(doxygen_basic_translate_style2.SWIGTYPE_p_p_p_Shape)",
+ " Test for a parameter with difficult type \n" +
+ " (mostly for python) \n" +
+ " @param a Very strange param \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.function3(int, int)",
+ " A test for overloaded functions \n" +
+ " This is function <b>two </b>\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style2.doxygen_basic_translate_style2.Atan2(double, double)",
+ " Multiple parameters test.\n" +
+ " \n" +
+ " @param y Vertical coordinate.\n" +
+ " @param x Horizontal coordinate.\n" +
+ " @return Arc tangent of <code>y/x</code>.\n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_ignore_runme.java b/Examples/test-suite/java/doxygen_ignore_runme.java
new file mode 100644
index 000000000..6250ce525
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_ignore_runme.java
@@ -0,0 +1,44 @@
+
+import doxygen_ignore.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_ignore_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_ignore");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_ignore runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_ignore"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+ wantedComments.put("doxygen_ignore.doxygen_ignore.func()",
+ " A contrived example of ignoring too many commands in one comment.<br>\n" +
+ " <br>\n" +
+ " <br>\n" +
+ " <br>\n" +
+ " <br>\n" +
+ " This is specific to <i>Java</i>.<br>\n" +
+ " <br>\n" +
+ " <br>\n" +
+ " <br>\n" +
+ " <br>\n" +
+ " Command ignored, but anything here is still included.<br>\n" +
+ " <br>\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "");
+
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_misc_constructs_runme.java b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
new file mode 100644
index 000000000..5d95bd565
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
@@ -0,0 +1,200 @@
+
+import doxygen_misc_constructs.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_misc_constructs_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_misc_constructs");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_misc_constructs runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_misc_constructs"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getConnection()",
+ "\n" +
+ "\n" +
+ " This function returns connection id.\n" +
+ "\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getAddress(doxygen_misc_constructs.SWIGTYPE_p_int, int)",
+ " Returns address of file line.\n" +
+ " \n" +
+ " @param fileName name of the file, where the source line is located\n" +
+ " @param line line number\n" +
+ " {@link Connection::getId() }<br>\n" +
+ "\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getG_zipCode()",
+ " Tag endlink must be recognized also when it is the last token\n" +
+ " in the comment.\n" +
+ " \n" +
+ " {@link Connection::getId() }<br>\n" +
+ " {@link debugIdeTraceProfilerCoverageSample.py Python example. }\n" +
+ "\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.setG_zipCode(int)",
+ " Tag endlink must be recognized also when it is the last token\n" +
+ " in the comment.\n" +
+ "\n" +
+ " {@link Connection::getId() }<br>\n" +
+ " {@link debugIdeTraceProfilerCoverageSample.py Python example. }\n" +
+ "\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getG_counter()",
+ " Tag endlink must be recognized also when followed by nonspace character.\n" +
+ "\n" +
+ " {@link Connection::getId() }<br>\n" +
+ "\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.waitTime(int)",
+ " Determines how long the <code>isystem.connect</code> should wait for running\n" +
+ " instances to respond. Only one of <code>lfWaitXXX</code> flags from IConnect::ELaunchFlags\n" +
+ " may be specified.\n" +
+ "\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.CConnectionConfig",
+ " This class contains information for connection to winIDEA. Its methods\n" +
+ " return reference to self, so we can use it like this:\n" +
+ " <pre>\n" +
+ " CConnectionConfig config = new CConnectionConfig();\n" +
+ " config.discoveryPort(5534).dllPath(\"C:\\\\myWinIDEA\\\\connect.dll\").id(\"main\");\n" +
+ " </pre>\n" +
+ "\n" +
+ " All parameters are optional. Set only what is required, default values are\n" +
+ " used for unspecified parameters.\n" +
+ " <p>\n" +
+ "\n" +
+ " {@link advancedWinIDEALaunching.py Python example. }<br>\n" +
+ "\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getAddress(doxygen_misc_constructs.SWIGTYPE_p_int, int, boolean)",
+ " Returns address of file line.\n" +
+ "\n" +
+ " @param fileName name of the file, where the source line is located\n" +
+ " @param line line number\n" +
+ " @param isGetSize if set, for every object location both address and size are returned\n" +
+ "\n" +
+ " {@link Connection::getId() }<br>\n" +
+ "\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.setG_counter(char)",
+ " Tag endlink must be recognized also when followed by nonspace character.\n" +
+ "\n" +
+ " {@link Connection::getId() }<br>\n" +
+ "\n" +
+ "");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum",
+ " Class description.\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested",
+ " Enum description.\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.ONE",
+ " desc of one\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.TWO",
+ " desc of two\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.THREE",
+ " desc of three\n");
+
+ wantedComments.put("doxygen_misc_constructs.StructWithReturnComment",
+ " @return This is a bad place for this tag, but it should be ignored.");
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.showList()",
+" An example of a list in a documentation comment.<br>\n" +
+" <br>\n" +
+" - The first item of the list.<br>\n" +
+" - The second list item, on<br>\n" +
+" several indented lines,<br>\n" +
+" showing that the indentation<br>\n" +
+" is preserved.<br>\n" +
+" - And the final list item after it.<br>\n" +
+" <br>\n" +
+" And this is not a list item any more.\n" +
+ "");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.isNoSpaceValidA()",
+ " This comment without space after '*' is valid in Doxygen.\n" +
+ "\n" +
+ "");
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.isNoSpaceValidB()",
+ " .This comment without space after '*' is valid in Doxygen.\n" +
+ "\n" +
+ "");
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashA()",
+ " Backslash following<code>word</code> is a valid doxygen command. Output contains\n" +
+ " 'followingword' with 'word' in code font.\n" +
+ "\n" +
+ "");
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashB()",
+ " Doxy command without trailing space is ignored - nothing appears\n" +
+ " on output. Standalone \\ and '\\' get to output.\n" +
+ " Standalone @ and '@' get to output.\n" +
+ " Commands \"in quoted \\b strings are treated as plain text\".\n" +
+ " Commands not recognized by Doxygen are ignored.\n" +
+ " Backslashes in DOS paths d:and words\n" +
+ " following them do not appear on output, we must quote them with\n" +
+ " double quotes: \"d:\\xyz\\qwe\\myfile\", \"@something\". Single quotes do not help:\n" +
+ " 'd:'. Escaping works: d:\\xyz\\qwe\\myfile. Unix\n" +
+ " paths of course have no such problems: /xyz/qwe/myfile\n" +
+ " Commands for escaped symbols:\n" +
+ " $ @ \\ &amp; ~ &lt; &gt; # % &quot; . :: @text ::text" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashC()",
+ " Backslash e at end of <i>line</i> froze SWIG\n" +
+ " <i>with</i> old comment parser.\n" +
+ " @see MyClass#fun(char,float)\n" +
+ "");
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.cycle(int, java.lang.String)",
+ " The next line contains expression:\n" +
+ " <pre>\n" +
+ " ['retVal &lt; 10', 'g_counter == 23 &amp;&amp; g_mode &amp; 3']\n" +
+ " </pre>\n" +
+ "\n" +
+ " Both words should be emphasized <b>isystem.connect</b>.\n" +
+ " But not the last period. For <b>example</b>, comma should not be emphasized.\n" +
+ " Similar <b>for</b>: double colon.\n" +
+ "\n" +
+ " Spaces at the start of line should be taken into account:\n" +
+ " @param id used as prefix in log\n" +
+ " statements. The default value is empty string, which is OK if\n" +
+ " there is only one app. instance. Example:\n" +
+ " <pre>\n" +
+ " ctrl.setBP(\"func1\");\n" +
+ " </pre>\n" +
+ " If we set the id to <code>main_</code>, we get:\n" +
+ " <pre>\n" +
+ " main_ctrl.setBP(\"func1\");\n" +
+ " </pre>\n" +
+ "\n" +
+ " @param fileName name of the log file\n");
+
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_nested_class_runme.java b/Examples/test-suite/java/doxygen_nested_class_runme.java
new file mode 100644
index 000000000..3ffa796f0
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_nested_class_runme.java
@@ -0,0 +1,48 @@
+import doxygen_nested_class.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_nested_class_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_nested_class");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_nested_class runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_nested_class"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_nested_class.DoxOuter()",
+ " DoxOuter constructor ");
+ wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner",
+ " DoxInner class description ");
+ wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner()",
+ " DoxInner constructor ");
+ wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.setDoxInt(int)",
+ " doxInt variable ");
+ wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.getDoxInt()",
+ " doxInt variable ");
+ wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.doxMethod()",
+ " doxMethod description ");
+ wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.doxStaticMethod()",
+ " doxStaticMethod description ");
+ wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.doxShort",
+ " doxShort const variable ");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java
new file mode 100644
index 000000000..ef1f06af5
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java
@@ -0,0 +1,66 @@
+
+import doxygen_parsing_enums_proper.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_parsing_enums_proper_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_parsing_enums_proper");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_proper runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_parsing_enums_proper"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_10",
+ "Post comment for the first item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_1",
+ " The comment for the first item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum",
+ " Testing comments before enum items \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_30",
+ "Post comment for the third item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2",
+ " Testing comments after enum items \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_3",
+ " The comment for the third item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_2",
+ " The comment for the second item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_20",
+ "Post comment for the second item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeEnumWithTrailingComma.SOME_ITEM_100",
+ "Post comment after comma.");
+ wantedComments.put("doxygen_parsing_enums_proper.SomeEnumWithTrailingComma.SOME_ITEM_200",
+ "Post comment after last comma.");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java
new file mode 100644
index 000000000..85ec0cb55
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java
@@ -0,0 +1,58 @@
+
+import doxygen_parsing_enums_simple.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_parsing_enums_simple_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_parsing_enums_simple");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_simple runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_parsing_enums_simple"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_30",
+ "Post comment for the third item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_3",
+ " The comment for the third item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_2",
+ " The comment for the second item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_10",
+ "Post comment for the first item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_20",
+ "Post comment for the second item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_1",
+ " The comment for the first item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_100",
+ "Post comment after comma.");
+ wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_200",
+ "Post comment after last comma.");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java
new file mode 100644
index 000000000..4e5f4b489
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java
@@ -0,0 +1,67 @@
+
+import doxygen_parsing_enums_typesafe.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_parsing_enums_typesafe_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_parsing_enums_typesafe");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typesafe runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_parsing_enums_typesafe"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_1",
+ " The comment for the first item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2",
+ " Testing comments after enum items \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_2",
+ " The comment for the second item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_20",
+ "Post comment for the second item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum",
+ " Testing comments before enum items \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_10",
+ "Post comment for the first item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_3",
+ " The comment for the third item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_30",
+ "Post comment for the third item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeEnumWithTrailingComma.SOME_ITEM_100",
+ "Post comment after comma.");
+ wantedComments.put("doxygen_parsing_enums_typesafe.SomeEnumWithTrailingComma.SOME_ITEM_200",
+ "Post comment after last comma.");
+
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java
new file mode 100644
index 000000000..428649196
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java
@@ -0,0 +1,66 @@
+
+import doxygen_parsing_enums_typeunsafe.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_parsing_enums_typeunsafe_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_parsing_enums_typeunsafe");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typeunsafe runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_parsing_enums_typeunsafe"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_2",
+ " The comment for the second item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_3",
+ " The comment for the third item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_1",
+ " The comment for the first item \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_20",
+ "Post comment for the second item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum",
+ " Testing comments before enum items \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2",
+ " Testing comments after enum items \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_30",
+ "Post comment for the third item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_10",
+ "Post comment for the first item \n" +
+ "");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeEnumWithTrailingComma.SOME_ITEM_100",
+ "Post comment after comma.");
+ wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeEnumWithTrailingComma.SOME_ITEM_200",
+ "Post comment after last comma.");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java
new file mode 100644
index 000000000..d58b1f486
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_parsing_runme.java
@@ -0,0 +1,141 @@
+
+import doxygen_parsing.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_parsing_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_parsing");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_parsing runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_parsing"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_parsing.SomeAnotherClass",
+ " SomeAnotherClass description");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass(int)",
+ " First overloaded constructor.");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass(java.lang.String)",
+ " Second overloaded constructor.");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr()",
+ " The class attribute comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr3(int)",
+ "The class attribute post-comment with details \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr3(int)",
+ "The struct attribute post-comment with details \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethodExtended2(int, int)",
+ " The class method with parameter \n" +
+ " \n" +
+ " @param a Parameter a \n" +
+ " @param b Parameter b \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeStruct",
+ " The struct comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.doxygen_parsing.setSomeVar(int)",
+ " The var comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethod()",
+ " The struct method comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.doxygen_parsing.someFunction()",
+ " The function comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethodExtended(int, int)",
+ " The class method with parameter \n" +
+ " \n" +
+ " @param a Parameter a \n" +
+ " @param b Parameter b \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr(int)",
+ " The class attribute comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethodExtended(int, int)",
+ " The struct method with parameter \n" +
+ " \n" +
+ " @param a Parameter a \n" +
+ " @param b Parameter b \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr()",
+ " The struct attribute comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeClass",
+ " The class comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr3()",
+ "The struct attribute post-comment with details \n" +
+ "");
+ wantedComments.put("doxygen_parsing.doxygen_parsing.getSomeVar()",
+ " The var comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr2(int)",
+ "The struct attribute post-comment \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr2()",
+ "The class attribute post-comment \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr2()",
+ "The struct attribute post-comment \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr(int)",
+ " The struct attribute comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeEnum",
+ " The enum comment \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr3()",
+ "The class attribute post-comment with details \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethod()",
+ " The class method comment.<br>\n" +
+ " <br>\n" +
+ " {@link SomeAnotherClass#classMethodExtended(int,int) a link text }\n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethodExtended2(int, int)",
+ " The struct method with parameter \n" +
+ " \n" +
+ " @param a Parameter a \n" +
+ " @param b Parameter b \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr2(int)",
+ "The class attribute post-comment \n" +
+ "");
+ wantedComments.put("doxygen_parsing.doxygen_parsingConstants.CONSTANT_VALUE",
+ "The constant comment \n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
new file mode 100644
index 000000000..d5c533f4e
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
@@ -0,0 +1,159 @@
+
+import doxygen_translate_all_tags.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_translate_all_tags_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_translate_all_tags");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_translate_all_tags runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_translate_all_tags"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func01(int)",
+ " <i>Hello </i>\n\n\n" +
+ " <a id=\"theAnchor\"></a>\n\n\n" +
+ " <li>some list item</li>\n\n" +
+ " This is attention!\n" +
+ " You were warned!\n" +
+ " @author lots of them\n" +
+ " @author Zubr\n\n" +
+ " <b>boldword</b>\n\n" +
+ " Some brief description,\n" +
+ " extended to many lines.\n\n" +
+ " Not everything works right now...\n" +
+ " <code>codeword</code>\n\n\n\n\n\n" +
+ " <i>citationword</i>\n" +
+ " {@code some test code }\n\n" +
+ " Code immediately following text. Pydoc translation must add an\n" +
+ " empty line before:\n" +
+ " {@code more test code }");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func02(int)",
+ " Conditional comment: SOMECONDITION \n" +
+ " Some conditional comment \n" +
+ " End of conditional comment.\n" +
+ " Copyright: some copyright \n" +
+ " 1970 - 2012 \n" +
+ " @deprecated Now use another function \n" +
+ " This is very large \n" +
+ " and detailed description of some thing \n");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func03(int)",
+ " Comment for <b>func03()</b>.\n" +
+ " <i>italicword </i>\n" +
+ " <i>emphazedWord </i>\n" +
+ " @ example someFile.txt\n" +
+ " Some details on using the example");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func04(int)",
+ " @exception SuperError \n" +
+ " \\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n" +
+ " \\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n" +
+ " \\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n\n" +
+ "Math immediately following text. Pydoc translation must add an\n" +
+ "empty line before:\n\n" +
+ " \\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\n" +
+ " This will only appear in hmtl \n");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func05(int)",
+ " If: ANOTHERCONDITION {\n" +
+ " First part of comment \n" +
+ " If: SECONDCONDITION {\n" +
+ " Nested condition text \n" +
+ " }Else if: THIRDCONDITION {\n" +
+ " The third condition text \n" +
+ " }Else: {The last text block \n" +
+ " }\n" +
+ " }Else: {Second part of comment \n" +
+ " If: CONDITION {\n" +
+ " Second part extended \n" +
+ " }\n" +
+ " }\n" +
+ " If not: SOMECONDITION {\n" +
+ " This is printed if not \n" +
+ " }\n" +
+ " <img src=testImage.bmp alt=\"Hello, world!\" />\n" +
+ " Some text \n" +
+ " describing invariant. \n");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func06(int)",
+ " Comment for <b>func06()</b>.\n" +
+ " This will only appear in LATeX \n" +
+ " <ul> \n" +
+ " <li>Some unordered list \n" +
+ " </li><li>With lots of items \n" +
+ " </li><li>lots of lots of items \n" +
+ " </li></ul> \n" +
+ " {@link someMember Some description follows }\n" +
+ " This will only appear in man\n");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func07(int)",
+ " Comment for <b>func07()</b>.\n" +
+ " Note: Here \n" +
+ " is the note! \n" +
+ " This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.\n" +
+ " <code>someword </code>\n" +
+ " @package superPackage \n" +
+ " <p alt=\"The paragraph title \">\n" +
+ " The paragraph text. \n" +
+ " Maybe even multiline \n" +
+ " </p>\n" +
+ " @param a the first param\n");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func08(int)",
+ "<a id=\"someAnchor\"></a>\n" +
+ "Text after anchor.\n" +
+ "<a href=\"#someAnchor\">Anchor description</a>\n" +
+ "<a href=\"#someAnchor\">someAnchor</a> not quoted text is not part of ref tag\n" +
+ "<a href=\"#someAnchor\">someAnchor</a>\n" +
+ " Remarks: Some remark text \n" +
+ " Remarks: Another remarks section \n" +
+ " @return Whatever \n" +
+ " @return it \n" +
+ " @return may return \n");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func09(int)",
+ " This will only appear in RTF \n" +
+ " @see someOtherMethod \n" +
+ " @see function \n" +
+ " Same as \n" +
+ " brief description \n" +
+ " @since version 0.0.0.1 \n" +
+ " @throws superException \n" +
+ " @throws RuntimeError \n");
+
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func10(int, float)",
+ " TODO: Some very important task \n" +
+ " @param b B is mentioned again... \n" +
+ " {@literal \n" +
+ "very long \n" +
+ "text with tags <sometag> \n" +
+ " }\n" +
+ " @version 0.0.0.2 \n" +
+ " Warning: This is senseless! \n" +
+ " This will only appear in XML \n" +
+ " Here goes test of symbols: \n" +
+ " $ @ \\ &amp; ~ &lt; &gt; # % &quot; . :: \n" +
+ " And here goes simple text \n" +
+ "");
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_translate_links_runme.java b/Examples/test-suite/java/doxygen_translate_links_runme.java
new file mode 100644
index 000000000..6d74e16fe
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_translate_links_runme.java
@@ -0,0 +1,69 @@
+
+import doxygen_translate_links.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+
+public class doxygen_translate_links_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_translate_links");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_translate_links runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_translate_links"});
+
+ HashMap<String, String> wantedComments = new HashMap<String, String>();
+
+
+ wantedComments.put("doxygen_translate_links.doxygen_translate_links.function()",
+ " \n" +
+ " Testing typenames converting in @ link \n" +
+ " \n" +
+ " {@link superFunc(int,String) \n" +
+ " Test for std_string member \n" +
+ " }\n" +
+ " \n" +
+ " {@link superFunc(int,int,SWIGTYPE_p_void) \n" +
+ " Test for simple types \n" +
+ " }\n" +
+ " \n" +
+ " {@link superFunc(SWIGTYPE_p_p_Shape) \n" +
+ " Test for custom types \n" +
+ " }\n" +
+ " \n" +
+ " {@link superFunc(SWIGTYPE_p_p_p_int) \n" +
+ " Test for complex types \n" +
+ " }\n" +
+ " \n" +
+ " same works for 'See also:' links: \n" +
+ " \n" +
+ " @see superFunc(int,String)\n" +
+ " @see superFunc(int,int,SWIGTYPE_p_void)\n" +
+ " @see superFunc(SWIGTYPE_p_p_Shape)\n" +
+ " @see superFunc(SWIGTYPE_p_p_p_int)\n" +
+ " \n" +
+ " some failing params: \n" +
+ " \n" +
+ " @see superFunc() \n" +
+ " @see superFunc() \n" +
+ " @see superFunc() \n" +
+ " \n" +
+ " \n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+} \ No newline at end of file
diff --git a/Examples/test-suite/java/doxygen_translate_runme.java b/Examples/test-suite/java/doxygen_translate_runme.java
new file mode 100644
index 000000000..55e5d23d3
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_translate_runme.java
@@ -0,0 +1,279 @@
+
+import doxygen_translate.*;
+import com.sun.javadoc.*;
+import java.util.HashMap;
+import java.util.Map;
+
+public class doxygen_translate_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_translate");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ /*
+ Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
+ and calls the start() method of that class with parsed information.
+ */
+ CommentParser parser = new CommentParser();
+ com.sun.tools.javadoc.Main.execute("doxygen_translate runtime test",
+ "CommentParser",
+ new String[]{"-quiet", "doxygen_translate"});
+
+ Map<String, String> wantedComments = new HashMap<String, String>();
+
+ wantedComments.put("doxygen_translate.doxygen_translate.function(int, float)",
+ " <i>Hello </i>\n" +
+ " \n" +
+ " <li>some list item</li>\n" +
+ " \n" +
+ " @author lots of them \n" +
+ " \n" +
+ " @author Zubr \n" +
+ " \n" +
+ " <b>boldword </b>\n" +
+ " \n" +
+ " <code>codeword </code>\n" +
+ " \n" +
+ " <i>citationword </i>\n" +
+ " \n" +
+ " {@code some test code }\n" +
+ " \n" +
+ " Conditional comment: SOMECONDITION \n" +
+ " Some conditional comment \n" +
+ " End of conditional comment.\n" +
+ " \n" +
+ " Copyright: some copyright \n" +
+ " \n" +
+ " @deprecated Now use another function \n" +
+ " \n" +
+ " <i>italicword </i>\n" +
+ " \n" +
+ " @ example someFile.txt\n" +
+ " Some details on using the example\n" +
+ " \n" +
+ " @exception SuperError \n" +
+ " \n" +
+ " If: ANOTHERCONDITION {\n" +
+ " First part of comment \n" +
+ " If: SECONDCONDITION {\n" +
+ " Nested condition text}\n" +
+ " Else if: THIRDCONDITION {\n" +
+ " The third condition text}\n" +
+ " Else: {The last text block}}\n" +
+ " \n" +
+ " Else: {Second part of comment \n" +
+ " If: CONDITION {\n" +
+ " Second part extended}}\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " If not: SOMECONDITION {\n" +
+ " This is printed if not}\n" +
+ " \n" +
+ " \n" +
+ " <img src=testImage.bmp alt=\"Hello, world!\"/>\n" +
+ " \n" +
+ " <ul> \n" +
+ " \n" +
+ " <li>Some unordered list</li>\n" +
+ " <li>With lots of items</li>\n" +
+ " <li>lots of lots of items</li>\n" +
+ " \n" +
+ " </ul> \n" +
+ " \n" +
+ " {@link someMember Some description follows }\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " Note: Here \n" +
+ " is the note! \n" +
+ " \n" +
+ " This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.\n" +
+ " \n" +
+ " <code>someword </code>\n" +
+ " \n" +
+ " @package superPackage \n" +
+ " \n" +
+ " <p alt=\"The paragraph title \">\n" +
+ " The paragraph text. \n" +
+ " Maybe even multiline</p>\n" +
+ " \n" +
+ " @param a the first param \n" +
+ " \n" +
+ " Remarks: Some remark text \n" +
+ " \n" +
+ " Remarks: Another remarks section \n" +
+ " \n" +
+ " @return Whatever \n" +
+ " \n" +
+ " @return it \n" +
+ " \n" +
+ " @return may return \n" +
+ " \n" +
+ " @see someOtherMethod \n" +
+ " \n" +
+ " @see function \n" +
+ " \n" +
+ " @since version 0.0.0.1 \n" +
+ " \n" +
+ " @throws superException \n" +
+ " \n" +
+ " @throws RuntimeError \n" +
+ " \n" +
+ " TODO: Some very important task \n" +
+ " \n" +
+ " @param b B is mentioned again... \n" +
+ " \n" +
+ " {@literal \n" +
+ "very long \n" +
+ "text with tags <sometag> \n" +
+ " }\n" +
+ " \n" +
+ " @version 0.0.0.2 \n" +
+ " \n" +
+ " Warning: This is senseless! \n" +
+ " \n" +
+ " Here goes test of symbols: \n" +
+ " $ @ \\ &amp; ~ &lt; &gt; # % &quot; . :: \n" +
+ " \n" +
+ " And here goes simple text \n" +
+ " \n" +
+ "");
+
+ wantedComments.put("doxygen_translate.doxygen_translate.htmlFunction(int, float)",
+ " Test for html tags. See Doxygen doc for list of tags recognized by Doxygen. \n" +
+ " \n" +
+ " <a href=\"http://acme.com/index.html\">This is link</a> \n" +
+ " <b>bold</b> \n" +
+ " <blockquote cite=\"http://www.worldwildlife.org/who/index.html\"> \n" +
+ " Quotation block. \n" +
+ " </blockquote> \n" +
+ " <br> \n" +
+ " <center>center</center> \n" +
+ " <code>this is code</code> \n" +
+ "\n" +
+ " <dl>\n" +
+ " <dt>Starts an item title.</dt>\n" +
+ " <dd>Starts an item description.</dd>\n" +
+ " </dl>\n" +
+ "\n" +
+ " <dfn> Starts a piece of text displayed in a typewriter font. \n" +
+ " </dfn> \n" +
+ " <div> Starts a section with a specific style (HTML only) \n" +
+ " </div> \n" +
+ " <em> Starts a piece of text displayed in an italic font.</em> \n" +
+ "\n" +
+ " <form> 'Form' does not generate any output. \n" +
+ " </form> \n" +
+ " <hr> \n" +
+ " <h1> Heading 1 \n" +
+ " </h1> \n" +
+ " <h2> Heading 2 \n" +
+ " </h2> \n" +
+ " <h3> Heading 3 \n" +
+ " </h3> \n" +
+ " <i>Starts a piece of text displayed in an italic font.</i> \n" +
+ " <input>Input tag. \n" +
+ " \n" +
+ " <img src=\"slika.png\"> \n" +
+ " <meta>Meta tag. \n" +
+ " <multicol>Multicol is ignored by doxygen. \n" +
+ " </multicol> \n" +
+ " \n" +
+ " <ol> \n" +
+ " <li>List item 1.</li> \n" +
+ " <li>List item 2.</li> \n" +
+ " </ol> \n" +
+ " \n" +
+ " <p> Starts a new paragraph. \n" +
+ " </p> \n" +
+ " <pre> Starts a preformatted fragment. \n" +
+ " </pre> \n" +
+ " <small> Starts a section of text displayed in a smaller font. \n" +
+ " </small> \n" +
+ " <span> Starts an inline text fragment with a specific style.</span> \n" +
+ " \n" +
+ " <strong> Starts a section of bold text.</strong> \n" +
+ " <sub> Starts a piece of text displayed in subscript.</sub> \n" +
+ " <sup> Starts a piece of text displayed in superscript.</sup> \n" +
+ " \n" +
+ " <table border = '1'> \n" +
+ " <caption>Animals</caption> \n" +
+ " <tr><th> Column 1 </th><th> Column 2 </th></tr> \n" +
+ " <tr><td> cow </td><td> dog </td></tr> \n" +
+ " <tr><td> cat </td><td> mouse </td></tr> \n" +
+ " <tr><td> horse </td><td> parrot </td></tr> \n" +
+ " </table> \n" +
+ " \n" +
+ " <tt> Starts a piece of text displayed in a typewriter font. \n" +
+ " </tt> \n" +
+ " <kbd> Starts a piece of text displayed in a typewriter font. \n" +
+ " </kbd> \n" +
+ " \n" +
+ " <ul>\n" +
+ " <li>List item 1.</li>\n" +
+ " <li>List item 2.</li>\n" +
+ " <li>List item 3.</li>\n" +
+ " </ul>\n" +
+ " \n" +
+ " <var> Starts a piece of text displayed in an italic font.</var> \n" +
+ " \n" +
+ "\n" +
+ "<u>underlined \\b bold text - doxy commands are ignored inside 'htmlonly' section </u>\n" +
+ "\n" +
+ "");
+
+ wantedComments.put("doxygen_translate.doxygen_translate.htmlTableFunction(int)",
+ "The meaning of flags:\n" +
+ "\n" +
+ " @param byFlags bits marking required items:\n" +
+ " <table>\n" +
+ " <tr><th> Size in bits</th><th> Items Required </th></tr>\n" +
+ " <tr><td> 1 - 8 </td><td> 1 </td></tr>\n" +
+ " <tr><td> 9 - 16 </td><td> 2 </td></tr>\n" +
+ " <tr><td> 17 - 32 </td><td> 4 </td></tr>\n" +
+ " </table>\n" +
+ " Almost all combinations of above flags are supported by\n" +
+ " <code>htmlTable...</code> functions.\n" +
+ "");
+
+
+ wantedComments.put("doxygen_translate.doxygen_translate.htmlEntitiesFunction(int, float)",
+ "All entities are treated as commands &copy; &trade; &reg;\n" +
+ "should work also&lt;in text \n" +
+ "&gt; \n" +
+ "&amp; \n" +
+ "&apos; \n" +
+ "&quot; \n" +
+ "&lsquo; \n" +
+ "&rsquo; \n" +
+ "&ldquo; \n" +
+ "&rdquo; \n" +
+ "&ndash; \n" +
+ "&mdash; \n" +
+ "&nbsp; \n" +
+ "&times; \n" +
+ "&minus; \n" +
+ "&sdot; \n" +
+ "&sim; \n" +
+ "&le; \n" +
+ "&ge; \n" +
+ "&larr; \n" +
+ "&rarr; \n" +
+ "Not an html entity - ignored by Doxygen. \n" +
+ "Not an &amp;text html entity - ampersand is replaced with entity.\n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(parser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/enum_macro_runme.java b/Examples/test-suite/java/enum_macro_runme.java
index 4ac7409ee..c05793347 100644
--- a/Examples/test-suite/java/enum_macro_runme.java
+++ b/Examples/test-suite/java/enum_macro_runme.java
@@ -88,6 +88,30 @@ public class enum_macro_runme {
{
Greeks13 a = null;
}
+ {
+ Greeks15 a = Greeks15.alpha15;
+ a = Greeks15.beta15;
+ a = Greeks15.theta15;
+ a = Greeks15.delta15;
+ if (a.swigValue() != 153)
+ throw new RuntimeException("Greeks15");
+ }
+ {
+ Greeks16 a = Greeks16.alpha16;
+ a = Greeks16.beta16;
+ a = Greeks16.theta16;
+ a = Greeks16.delta16;
+ if (a.swigValue() != 163)
+ throw new RuntimeException("Greeks16");
+ }
+ {
+ Greeks17 a = Greeks17.alpha17;
+ a = Greeks17.beta17;
+ a = Greeks17.theta17;
+ a = Greeks17.delta17;
+ if (a.swigValue() != 173)
+ throw new RuntimeException("Greeks17");
+ }
}
}
diff --git a/Examples/test-suite/java/java_director_assumeoverride_runme.java b/Examples/test-suite/java/java_director_assumeoverride_runme.java
index e876a79c9..6c4d6918e 100644
--- a/Examples/test-suite/java/java_director_assumeoverride_runme.java
+++ b/Examples/test-suite/java/java_director_assumeoverride_runme.java
@@ -18,7 +18,7 @@ public class java_director_assumeoverride_runme {
public static void main(String argv[]) {
OverrideMe overrideMe = new MyOverrideMe();
- // MyOverrideMe doesn't actually override func(), but because assumeoverride
+ // MyOverrideMe doesn't actually override funk(), but because assumeoverride
// was set to true, the C++ side will believe it was overridden.
if (!java_director_assumeoverride.isFuncOverridden(overrideMe)) {
throw new RuntimeException ( "isFuncOverridden()" );
diff --git a/Examples/test-suite/java/java_director_exception_feature_nspace_runme.java b/Examples/test-suite/java/java_director_exception_feature_nspace_runme.java
index ea7da5c1a..884b04c6e 100644
--- a/Examples/test-suite/java/java_director_exception_feature_nspace_runme.java
+++ b/Examples/test-suite/java/java_director_exception_feature_nspace_runme.java
@@ -126,19 +126,28 @@ public class java_director_exception_feature_nspace_runme {
try { b.genericpong(1); fail("No exception thrown in genericpong(1)"); }
catch (MyJavaException1 e) {
failif( ! java_director_exception_feature_nspace_Consts.GENERICPONGEXCP1.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
+ StackTraceElement[] st = e.getStackTrace();
+ failif( st.length != 5, "Stack length is only " + st.length);
+ failif( ! st[0].toString().startsWith("java_director_exception_feature_nspace_MyFooDirectorImpl.genericpong(java_director_exception_feature_nspace_runme.java:"), "Incorrect top of stack: " + st[0]);
}
try { b.genericpong(2); fail("No exception thrown in genericpong(2)");}
catch (java_director_exception_feature_nspace_NewCheckedException e) {
failif( ! java_director_exception_feature_nspace_Consts.GENERICPONGEXCP2.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
+ StackTraceElement[] st = e.getStackTrace();
+ failif( st.length != 5, "Stack length is only " + st.length);
+ failif( ! st[0].toString().startsWith("java_director_exception_feature_nspace_MyFooDirectorImpl.genericpong(java_director_exception_feature_nspace_runme.java:"), "Incorrect top of stack: " + st[0]);
}
try { b.genericpong(3); fail("No exception thrown in genericpong(3)");}
catch (java_director_exception_feature_nspace_NewUncheckedException e) {
failif( ! java_director_exception_feature_nspace_Consts.GENERICPONGEXCP3.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
+ StackTraceElement[] st = e.getStackTrace();
+ failif( st.length != 5, "Stack length is only " + st.length);
+ failif( ! st[0].toString().startsWith("java_director_exception_feature_nspace_MyFooDirectorImpl.genericpong(java_director_exception_feature_nspace_runme.java:"), "Incorrect top of stack: " + st[0]);
}
try { b.genericpong(4); fail("No exception thrown in genericpong(4)");}
catch (RuntimeException e) {
- failif ( e.getClass() != RuntimeException.class, "Exception " + e + " is not exactly RumtimeException");
- failif( ! java_director_exception_feature_nspace_Consts.GENERICPONGEXCP4.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
+ failif ( e.getClass() != RuntimeException.class, "Exception " + e + " is not exactly RuntimeException");
+ failif( ! "Unspecified DirectorException message".equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
}
}
catch (Exception e) {
diff --git a/Examples/test-suite/java/java_director_exception_feature_runme.java b/Examples/test-suite/java/java_director_exception_feature_runme.java
index 2e919c18a..d9763c992 100644
--- a/Examples/test-suite/java/java_director_exception_feature_runme.java
+++ b/Examples/test-suite/java/java_director_exception_feature_runme.java
@@ -127,19 +127,28 @@ public class java_director_exception_feature_runme {
try { b.genericpong(1); fail("No exception thrown in genericpong(1)"); }
catch (MyJavaException1 e) {
failif( ! java_director_exception_feature_Consts.GENERICPONGEXCP1.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
+ StackTraceElement[] st = e.getStackTrace();
+ failif( st.length != 5, "Stack length is only " + st.length);
+ failif( ! st[0].toString().startsWith("java_director_exception_feature_MyFooDirectorImpl.genericpong(java_director_exception_feature_runme.java:"), "Incorrect top of stack: " + st[0]);
}
try { b.genericpong(2); fail("No exception thrown in genericpong(2)");}
catch (NewCheckedException e) {
failif( ! java_director_exception_feature_Consts.GENERICPONGEXCP2.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
+ StackTraceElement[] st = e.getStackTrace();
+ failif( st.length != 5, "Stack length is only " + st.length);
+ failif( ! st[0].toString().startsWith("java_director_exception_feature_MyFooDirectorImpl.genericpong(java_director_exception_feature_runme.java:"), "Incorrect top of stack: " + st[0]);
}
try { b.genericpong(3); fail("No exception thrown in genericpong(3)");}
catch (NewUncheckedException e) {
failif( ! java_director_exception_feature_Consts.GENERICPONGEXCP3.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
+ StackTraceElement[] st = e.getStackTrace();
+ failif( st.length != 5, "Stack length is only " + st.length);
+ failif( ! st[0].toString().startsWith("java_director_exception_feature_MyFooDirectorImpl.genericpong(java_director_exception_feature_runme.java:"), "Incorrect top of stack: " + st[0]);
}
try { b.genericpong(4); fail("No exception thrown in genericpong(4)");}
catch (RuntimeException e) {
- failif ( e.getClass() != RuntimeException.class, "Exception " + e + " is not exactly RumtimeException");
- failif( ! java_director_exception_feature_Consts.GENERICPONGEXCP4.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
+ failif ( e.getClass() != RuntimeException.class, "Exception " + e + " is not exactly RuntimeException");
+ failif( ! "Unspecified DirectorException message".equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
}
}
diff --git a/Examples/test-suite/java/java_director_typemaps_ptr_runme.java b/Examples/test-suite/java/java_director_typemaps_ptr_runme.java
new file mode 100644
index 000000000..c387270cd
--- /dev/null
+++ b/Examples/test-suite/java/java_director_typemaps_ptr_runme.java
@@ -0,0 +1,200 @@
+// Test director pointer typemaps in typemaps.i - similar to java_director_typemaps.i testcase
+
+import java_director_typemaps_ptr.*;
+import java.math.BigInteger;
+
+public class java_director_typemaps_ptr_runme {
+
+ static {
+ try {
+ System.loadLibrary("java_director_typemaps_ptr");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+
+ public static void main(String argv[]) {
+ java_director_typemaps_ptr_MyQuux myquux = new java_director_typemaps_ptr_MyQuux();
+ Quux quux = myquux;
+ quux.etest();
+ myquux.testing_nulls = true;
+ quux.nulltest();
+ }
+}
+
+class java_director_typemaps_ptr_MyQuux extends Quux {
+ public java_director_typemaps_ptr_MyQuux() {
+ super();
+ }
+ public boolean testing_nulls = false;
+
+ public void director_method_output(
+ boolean[] bool_arg,
+
+ byte[] signed_char_arg,
+ short[] unsigned_char_arg,
+
+ short[] short_arg,
+ int[] unsigned_short_arg,
+
+ int[] int_arg,
+ long[] unsigned_int_arg,
+
+ int[] long_arg,
+ long[] unsigned_long_arg,
+
+ long[] long_long_arg,
+ // BigInteger[] unsigned_long_long_arg,
+
+ float[] float_arg,
+ double[] double_arg)
+ {
+ if (testing_nulls) {
+ if (bool_arg != null) throw new RuntimeException("not null bool_arg");
+ if (signed_char_arg != null) throw new RuntimeException("not null signed_char_arg");
+ if (unsigned_char_arg != null) throw new RuntimeException("not null unsigned_char_arg");
+ if (short_arg != null) throw new RuntimeException("not null short_arg");
+ if (unsigned_short_arg != null) throw new RuntimeException("not null unsigned_short_arg");
+ if (int_arg != null) throw new RuntimeException("not null int_arg");
+ if (unsigned_int_arg != null) throw new RuntimeException("not null unsigned_int_arg");
+ if (long_arg != null) throw new RuntimeException("not null long_arg");
+ if (unsigned_long_arg != null) throw new RuntimeException("not null unsigned_long_arg");
+ if (long_long_arg != null) throw new RuntimeException("not null long_long_arg");
+ // if (unsigned_long_long_arg != null) throw new RuntimeException("not null unsigned_long_long_arg");
+ if (float_arg != null) throw new RuntimeException("not null float_arg");
+ if (double_arg != null) throw new RuntimeException("not null double_arg");
+ }
+ if (bool_arg != null) bool_arg[0] = true;
+ if (signed_char_arg != null) signed_char_arg[0] = 1;
+ if (unsigned_char_arg != null) unsigned_char_arg[0] = 2;
+ if (short_arg != null) short_arg[0] = 3;
+ if (unsigned_short_arg != null) unsigned_short_arg[0] = 4;
+ if (int_arg != null) int_arg[0] = 5;
+ if (unsigned_int_arg != null) unsigned_int_arg[0] = 6;
+ if (long_arg != null) long_arg[0] = 7;
+ if (unsigned_long_arg != null) unsigned_long_arg[0] = 8;
+ if (long_long_arg != null) long_long_arg[0] = 9;
+ // if (unsigned_long_long_arg != null) unsigned_long_long_arg[0] = 10;
+ if (float_arg != null) float_arg[0] = 11;
+ if (double_arg != null) double_arg[0] = 12;
+ }
+
+ public void director_method_inout(
+ boolean[] bool_arg,
+
+ byte[] signed_char_arg,
+ short[] unsigned_char_arg,
+
+ short[] short_arg,
+ int[] unsigned_short_arg,
+
+ int[] int_arg,
+ long[] unsigned_int_arg,
+
+ int[] long_arg,
+ long[] unsigned_long_arg,
+
+ long[] long_long_arg,
+ // BigInteger[] unsigned_long_long_arg,
+
+ float[] float_arg,
+ double[] double_arg)
+ {
+ if (testing_nulls) {
+ if (bool_arg != null) throw new RuntimeException("not null bool_arg");
+ if (signed_char_arg != null) throw new RuntimeException("not null signed_char_arg");
+ if (unsigned_char_arg != null) throw new RuntimeException("not null unsigned_char_arg");
+ if (short_arg != null) throw new RuntimeException("not null short_arg");
+ if (unsigned_short_arg != null) throw new RuntimeException("not null unsigned_short_arg");
+ if (int_arg != null) throw new RuntimeException("not null int_arg");
+ if (unsigned_int_arg != null) throw new RuntimeException("not null unsigned_int_arg");
+ if (long_arg != null) throw new RuntimeException("not null long_arg");
+ if (unsigned_long_arg != null) throw new RuntimeException("not null unsigned_long_arg");
+ if (long_long_arg != null) throw new RuntimeException("not null long_long_arg");
+ // if (unsigned_long_long_arg != null) throw new RuntimeException("not null unsigned_long_long_arg");
+ if (float_arg != null) throw new RuntimeException("not null float_arg");
+ if (double_arg != null) throw new RuntimeException("not null double_arg");
+ } else {
+ if (bool_arg[0]) throw new RuntimeException("unexpected value for bool_arg");
+ if (signed_char_arg[0] != 101) throw new RuntimeException("unexpected value for signed_char_arg");
+ if (unsigned_char_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_char_arg");
+ if (short_arg[0] != 101) throw new RuntimeException("unexpected value for short_arg");
+ if (unsigned_short_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_short_arg");
+ if (int_arg[0] != 101) throw new RuntimeException("unexpected value for int_arg");
+ if (unsigned_int_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_int_arg");
+ if (long_arg[0] != 101) throw new RuntimeException("unexpected value for long_arg");
+ if (unsigned_long_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_long_arg");
+ if (long_long_arg[0] != 101) throw new RuntimeException("unexpected value for long_long_arg");
+ // if (unsigned_long_long_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_long_long_arg");
+ if (float_arg[0] != 101) throw new RuntimeException("unexpected value for float_arg");
+ if (double_arg[0] != 101) throw new RuntimeException("unexpected value for double_arg");
+ }
+
+ if (bool_arg != null) bool_arg[0] = false;
+ if (signed_char_arg != null) signed_char_arg[0] = 11;
+ if (unsigned_char_arg != null) unsigned_char_arg[0] = 12;
+ if (short_arg != null) short_arg[0] = 13;
+ if (unsigned_short_arg != null) unsigned_short_arg[0] = 14;
+ if (int_arg != null) int_arg[0] = 15;
+ if (unsigned_int_arg != null) unsigned_int_arg[0] = 16;
+ if (long_arg != null) long_arg[0] = 17;
+ if (unsigned_long_arg != null) unsigned_long_arg[0] = 18;
+ if (long_long_arg != null) long_long_arg[0] = 19;
+ // if (unsigned_long_long_arg != null) unsigned_long_long_arg[0] = 110;
+ if (float_arg != null) float_arg[0] = 111;
+ if (double_arg != null) double_arg[0] = 112;
+ }
+
+ public void director_method_nameless_args(
+ boolean[] bool_arg,
+
+ byte[] signed_char_arg,
+ short[] unsigned_char_arg,
+
+ short[] short_arg,
+ int[] unsigned_short_arg,
+
+ int[] int_arg,
+ long[] unsigned_int_arg,
+
+ int[] long_arg,
+ long[] unsigned_long_arg,
+
+ long[] long_long_arg,
+ // BigInteger[] unsigned_long_long_arg,
+
+ float[] float_arg,
+ double[] double_arg)
+ {
+ if (testing_nulls) {
+ if (bool_arg != null) throw new RuntimeException("not null bool_arg");
+ if (signed_char_arg != null) throw new RuntimeException("not null signed_char_arg");
+ if (unsigned_char_arg != null) throw new RuntimeException("not null unsigned_char_arg");
+ if (short_arg != null) throw new RuntimeException("not null short_arg");
+ if (unsigned_short_arg != null) throw new RuntimeException("not null unsigned_short_arg");
+ if (int_arg != null) throw new RuntimeException("not null int_arg");
+ if (unsigned_int_arg != null) throw new RuntimeException("not null unsigned_int_arg");
+ if (long_arg != null) throw new RuntimeException("not null long_arg");
+ if (unsigned_long_arg != null) throw new RuntimeException("not null unsigned_long_arg");
+ if (long_long_arg != null) throw new RuntimeException("not null long_long_arg");
+ // if (unsigned_long_long_arg != null) throw new RuntimeException("not null unsigned_long_long_arg");
+ if (float_arg != null) throw new RuntimeException("not null float_arg");
+ if (double_arg != null) throw new RuntimeException("not null double_arg");
+ }
+ if (bool_arg != null) bool_arg[0] = true;
+ if (signed_char_arg != null) signed_char_arg[0] = 12;
+ if (unsigned_char_arg != null) unsigned_char_arg[0] = 13;
+ if (short_arg != null) short_arg[0] = 14;
+ if (unsigned_short_arg != null) unsigned_short_arg[0] = 15;
+ if (int_arg != null) int_arg[0] = 16;
+ if (unsigned_int_arg != null) unsigned_int_arg[0] = 17;
+ if (long_arg != null) long_arg[0] = 18;
+ if (unsigned_long_arg != null) unsigned_long_arg[0] = 19;
+ if (long_long_arg != null) long_long_arg[0] = 20;
+ // if (unsigned_long_long_arg != null) unsigned_long_long_arg[0] = 111;
+ if (float_arg != null) float_arg[0] = 112;
+ if (double_arg != null) double_arg[0] = 113;
+ }
+}
diff --git a/Examples/test-suite/java/java_director_typemaps_runme.java b/Examples/test-suite/java/java_director_typemaps_runme.java
index e07826410..a6ab1df39 100644
--- a/Examples/test-suite/java/java_director_typemaps_runme.java
+++ b/Examples/test-suite/java/java_director_typemaps_runme.java
@@ -1,4 +1,4 @@
-// tests for java/typemaps.i used for directors
+// Test director reference typemaps in typemaps.i - similar to java_director_typemaps_ptr.i testcase
import java_director_typemaps.*;
import java.math.BigInteger;
@@ -26,7 +26,7 @@ class java_director_typemaps_MyQuux extends Quux {
super();
}
- public void director_method_bool_output(
+ public void director_method_output(
boolean[] bool_arg,
byte[] signed_char_arg,
@@ -62,7 +62,7 @@ class java_director_typemaps_MyQuux extends Quux {
double_arg[0] = 12;
}
- public void director_method_bool_inout(
+ public void director_method_inout(
boolean[] bool_arg,
byte[] signed_char_arg,
@@ -113,7 +113,7 @@ class java_director_typemaps_MyQuux extends Quux {
double_arg[0] = 112;
}
- public void director_method_bool_nameless_args(
+ public void director_method_nameless_args(
boolean[] bool_arg,
byte[] signed_char_arg,
diff --git a/Examples/test-suite/java/java_enums_runme.java b/Examples/test-suite/java/java_enums_runme.java
index bc7d41636..754d391fa 100644
--- a/Examples/test-suite/java/java_enums_runme.java
+++ b/Examples/test-suite/java/java_enums_runme.java
@@ -13,6 +13,12 @@ public class java_enums_runme implements stuff {
public static void main(String argv[])
{
+ if (WithTrailingComma.Second != 1)
+ throw new RuntimeException("Incorrect value for Second");
+
+ if (WithTrailingCommaAndIgnoredFirstItem.SecondNonIgnoredOne != 2)
+ throw new RuntimeException("Incorrect value for SecondNonIgnoredOne");
+
int number = 200;
// Switch statement will only compile if these enums are initialised
diff --git a/Examples/test-suite/java/java_throws_runme.java b/Examples/test-suite/java/java_throws_runme.java
index 0365b69ed..16eab7cad 100644
--- a/Examples/test-suite/java/java_throws_runme.java
+++ b/Examples/test-suite/java/java_throws_runme.java
@@ -93,6 +93,28 @@ public class java_throws_runme {
if (!pass)
throw new RuntimeException("Test 6 failed");
+ // Interface function
+ pass = false;
+ try {
+ InterfaceTestImpl iti = new InterfaceTestImpl();
+ iti.imethod(true);
+ }
+ catch (MyException e) { pass = true; }
+
+ if (!pass)
+ throw new RuntimeException("Test interface 1 failed");
+
+ pass = false;
+ try {
+ InterfaceTestImpl iti = new InterfaceTestImpl();
+ iti.imethod(false);
+ pass = true;
+ }
+ catch (MyException e) { pass = false; }
+
+ if (!pass)
+ throw new RuntimeException("Test interface 2 failed");
+
// Global function
pass = false;
try {
diff --git a/Examples/test-suite/java/li_boost_shared_ptr_director_runme.java b/Examples/test-suite/java/li_boost_shared_ptr_director_runme.java
new file mode 100644
index 000000000..9349c622b
--- /dev/null
+++ b/Examples/test-suite/java/li_boost_shared_ptr_director_runme.java
@@ -0,0 +1,129 @@
+import li_boost_shared_ptr_director.*;
+
+public class li_boost_shared_ptr_director_runme {
+
+ static {
+ try {
+ System.loadLibrary("li_boost_shared_ptr_director");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ private static void check(int got, int expected) {
+ if (got != expected)
+ throw new RuntimeException("Failed, got: " + got + " expected: " + expected);
+ }
+
+ public static void main(String argv[]) {
+ li_boost_shared_ptr_director_Derived a = new li_boost_shared_ptr_director_Derived(false);
+ li_boost_shared_ptr_director_Derived b = new li_boost_shared_ptr_director_Derived(true);
+
+ check(li_boost_shared_ptr_director.call_ret_c_shared_ptr(a), 1);
+ check(li_boost_shared_ptr_director.call_ret_c_shared_ptr(b), -1);
+ check(li_boost_shared_ptr_director.call_ret_c_by_value(a), 1);
+
+ check(li_boost_shared_ptr_director.call_ret_c_shared_ptr(a), 1);
+ check(li_boost_shared_ptr_director.call_ret_c_shared_ptr(b), -1);
+ check(li_boost_shared_ptr_director.call_ret_c_by_value(a), 1);
+
+ check(li_boost_shared_ptr_director.call_take_c_by_value(a), 5);
+ check(li_boost_shared_ptr_director.call_take_c_by_ref(a), 6);
+ check(li_boost_shared_ptr_director.call_take_c_by_pointer(a), 7);
+ check(li_boost_shared_ptr_director.call_take_c_by_pointer_ref(a), 8);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_value(a), 9);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_ref(a), 10);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_pointer(a), 11);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_pointer_ref(a), 12);
+
+ check(li_boost_shared_ptr_director.call_take_c_by_pointer_with_null(a), -2);
+ check(li_boost_shared_ptr_director.call_take_c_by_pointer_ref_with_null(a), -3);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_value_with_null(a), -4);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_ref_with_null(a), -5);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_pointer_with_null(a), -6);
+ check(li_boost_shared_ptr_director.call_take_c_shared_ptr_by_pointer_ref_with_null(a), -7);
+ }
+}
+
+class li_boost_shared_ptr_director_Derived extends Base {
+
+ private boolean return_none;
+
+ li_boost_shared_ptr_director_Derived(boolean flag) {
+ super();
+ this.return_none = flag;
+ }
+
+ @Override
+ public C ret_c_shared_ptr() {
+ if (this.return_none)
+ return null;
+ else
+ return new C();
+ }
+
+ @Override
+ public C ret_c_by_value() {
+ return new C();
+ }
+
+ @Override
+ public int take_c_by_value(C c) {
+ return c.get_m();
+ }
+
+ @Override
+ public int take_c_by_ref(C c) {
+ return c.get_m();
+ }
+
+ @Override
+ public int take_c_by_pointer(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -2;
+ }
+
+ @Override
+ public int take_c_by_pointer_ref(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -3;
+ }
+
+ @Override
+ public int take_c_shared_ptr_by_value(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -4;
+ }
+
+ @Override
+ public int take_c_shared_ptr_by_ref(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -5;
+ }
+
+ @Override
+ public int take_c_shared_ptr_by_pointer(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -6;
+ }
+
+ @Override
+ public int take_c_shared_ptr_by_pointer_ref(C c) {
+ if (c != null)
+ return c.get_m();
+ else
+ return -7;
+ }
+
+}
diff --git a/Examples/test-suite/java/li_std_list_runme.java b/Examples/test-suite/java/li_std_list_runme.java
new file mode 100644
index 000000000..96412fdaf
--- /dev/null
+++ b/Examples/test-suite/java/li_std_list_runme.java
@@ -0,0 +1,180 @@
+import li_std_list.*;
+
+public class li_std_list_runme {
+
+ static {
+ try {
+ System.loadLibrary("li_std_list");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ IntList v1 = new IntList();
+ DoubleList v2 = new DoubleList();
+
+ if (!v1.isEmpty()) throw new RuntimeException("v1 test (1) failed");
+ if (v1.size() != 0) throw new RuntimeException("v1 test (2) failed");
+ if (!v1.add(123)) throw new RuntimeException("v1 test (3) failed");
+ if (v1.size() != 1) throw new RuntimeException("v1 test (4) failed");
+ if (v1.isEmpty()) throw new RuntimeException("v1 test (5) failed");
+
+ int sum = 0;
+ for (int n : v1) {
+ if (n != 123) throw new RuntimeException("v1 loop test failed");
+ sum += n;
+ }
+ if (sum != 123) throw new RuntimeException("v1 sum test failed");
+ if (v1.get(0) != 123) throw new RuntimeException("v1 test failed");
+ v1.clear();
+ if (!v1.isEmpty()) throw new RuntimeException("v1 test clear failed");
+ v1.add(123);
+
+ if (v1.set(0, 456) != 123) throw new RuntimeException("v1 test (6) failed");
+ if (v1.size() != 1) throw new RuntimeException("v1 test (7) failed");
+ if (v1.get(0) != 456) throw new RuntimeException("v1 test (8) failed");
+
+ java.util.Iterator<Integer> v1_iterator = v1.iterator();
+ if (!v1_iterator.hasNext()) throw new RuntimeException("v1 test (9) failed");
+ if (v1_iterator.next() != 456) throw new RuntimeException("v1 test (10) failed");
+ if (v1_iterator.hasNext()) throw new RuntimeException("v1 test (11) failed");
+ try {
+ v1_iterator.next();
+ throw new RuntimeException("v1 test (12) failed");
+ } catch (java.util.NoSuchElementException e) {
+ }
+
+ if (v1.remove(Integer.valueOf(123))) throw new RuntimeException("v1 test (13) failed");
+ if (!v1.remove(Integer.valueOf(456))) throw new RuntimeException("v1 test (14) failed");
+ if (!v1.isEmpty()) throw new RuntimeException("v1 test (15) failed");
+ if (v1.size() != 0) throw new RuntimeException("v1 test (16) failed");
+ if (v1.remove(Integer.valueOf(456))) throw new RuntimeException("v1 test (17) failed");
+
+ if (new IntList(3, 0).size() != 3) throw new RuntimeException("constructor initial size test failed");
+ for (int n : new IntList(10, 999))
+ if (n != 999) throw new RuntimeException("constructor initialization with value failed");
+ for (int n : new IntList(new IntList(10, 999)))
+ if (n != 999) throw new RuntimeException("copy constructor initialization with value failed");
+
+ StructList v4 = new StructList();
+ StructPtrList v5 = new StructPtrList();
+ StructConstPtrList v6 = new StructConstPtrList();
+
+ v4.add(new Struct(12));
+ v5.add(new Struct(34));
+ v6.add(new Struct(56));
+
+ if (v4.get(0).getNum() != 12) throw new RuntimeException("v4 test failed");
+ if (v5.get(0).getNum() != 34) throw new RuntimeException("v5 test failed");
+ if (v6.get(0).getNum() != 56) throw new RuntimeException("v6 test failed");
+
+ for (Struct s : v4) {
+ if (s.getNum() != 12) throw new RuntimeException("v4 loop test failed");
+ }
+ for (Struct s : v5) {
+ if (s.getNum() != 34) throw new RuntimeException("v5 loop test failed");
+ }
+ for (Struct s : v6) {
+ if (s.getNum() != 56) throw new RuntimeException("v6 loop test failed");
+ }
+
+ StructList v7 = li_std_list.CopyContainerStruct(new StructList());
+ v7.add(new Struct(1));
+ v7.add(new Struct(23));
+ v7.add(new Struct(456));
+ v7.add(new Struct(7890));
+ if (v7.size() != 4) throw new RuntimeException("v7 test (1) failed");
+ {
+ double[] a7 = {1, 23, 456, 7890};
+ int i7 = 0;
+ for (Struct s7 : v7) {
+ if (s7.getNum() != a7[i7]) throw new RuntimeException("v7 test (2) failed");
+ i7++;
+ }
+ if (i7 != a7.length) throw new RuntimeException("v7 test (3) failed");
+ }
+ if (v7.remove(2).getNum() != 456) throw new RuntimeException("v7 test (4) failed");
+ {
+ double[] a7 = {1, 23, 7890};
+ int i7 = 0;
+ for (Struct s7 : v7) {
+ if (s7.getNum() != a7[i7]) throw new RuntimeException("v7 test (5) failed");
+ i7++;
+ }
+ if (i7 != a7.length) throw new RuntimeException("v7 test (6) failed");
+ }
+ v7.add(1, new Struct(123));
+ {
+ double[] a7 = {1, 123, 23, 7890};
+ int i7 = 0;
+ for (Struct s7 : v7) {
+ if (s7.getNum() != a7[i7]) throw new RuntimeException("v7 test (7) failed");
+ i7++;
+ }
+ if (i7 != a7.length) throw new RuntimeException("v7 test (8) failed");
+ }
+
+ BoolList v8 = new BoolList();
+ if (!v8.add(true)) throw new RuntimeException("v8 test (1) failed");;
+ if (v8.get(0) != true) throw new RuntimeException("v8 test (2) failed");;
+ if (v8.set(0, false) != true) throw new RuntimeException("v8 test (3) failed");;
+ if (v8.set(0, false) != false) throw new RuntimeException("v8 test (4) failed");;
+ if (v8.size() != 1) throw new RuntimeException("v8 test (5) failed");;
+
+ java.util.ArrayList<Boolean> bl = new java.util.ArrayList<Boolean>(java.util.Arrays.asList(true, false, true, false));
+ BoolList bv = new BoolList(java.util.Arrays.asList(true, false, true, false));
+ BoolList bv2 = new BoolList(bl);
+ java.util.ArrayList<Boolean> bl2 = new java.util.ArrayList<Boolean>(bv);
+ boolean bbb1 = bv.get(0);
+ Boolean bbb2 = bv.get(0);
+
+ IntList v9 = new IntList(java.util.Arrays.asList(10, 20, 30, 40));
+ v9.add(50);
+ v9.add(60);
+ v9.add(70);
+ if (v9.size() != 7) throw new RuntimeException("v9 test (1) failed");
+ if (!v9.remove(Integer.valueOf(60))) throw new RuntimeException("v9 test (2) failed");
+ if (v9.size() != 6) throw new RuntimeException("v9 test (3) failed");
+ v9.addFirst(-10);
+ v9.addLast(80);
+ if (v9.size() != 8) throw new RuntimeException("v9 test (4) failed");
+ if (v9.get(0) != -10) throw new RuntimeException("v9 test (5) failed");;
+ if (v9.get(v9.size()-1) != 80) throw new RuntimeException("v9 test (6) failed");;
+ v9.removeFirst();
+ if (v9.get(0) != 10) throw new RuntimeException("v9 test (7) failed");;
+ v9.removeLast();
+ if (v9.size() != 6) throw new RuntimeException("v9 test (8) failed");
+ if (v9.get(v9.size()-1) != 70) throw new RuntimeException("v9 test (9) failed");;
+
+ IntList v10 = new IntList(java.util.Arrays.asList(10, 20, 30, 40, 50));
+ v10.subList(1, 4).clear(); // Recommended way to call protected method removeRange(1,3)
+ if (v10.size() != 2) throw new RuntimeException("v10 test (1) failed");
+ if (v10.get(0) != 10) throw new RuntimeException("v10 test (2) failed");
+ if (v10.get(1) != 50) throw new RuntimeException("v10 test (3) failed");
+ v10.addAll(1, java.util.Arrays.asList(22, 33));
+ if (v10.size() != 4) throw new RuntimeException("v10 test (4) failed");
+ if (v10.get(1) != 22) throw new RuntimeException("v10 test (5) failed");
+ if (v10.get(2) != 33) throw new RuntimeException("v10 test (6) failed");
+
+ v10.add(v10.size(), 55);
+ if (v10.size() != 5) throw new RuntimeException("v10 test (7) failed");
+ if (v10.get(4) != 55) throw new RuntimeException("v10 test (8) failed");
+
+ IntList v11 = new IntList(java.util.Arrays.asList(11, 22, 33, 44));
+ v11.listIterator(0);
+ v11.listIterator(v11.size());
+ try {
+ v11.listIterator(v11.size() + 1);
+ throw new RuntimeException("v11 test (1) failed");
+ } catch (IndexOutOfBoundsException e) {
+ }
+ try {
+ v11.listIterator(-1);
+ throw new RuntimeException("v11 test (2) failed");
+ } catch (IndexOutOfBoundsException e) {
+ }
+ }
+}
diff --git a/Examples/test-suite/java/li_std_map_runme.java b/Examples/test-suite/java/li_std_map_runme.java
new file mode 100644
index 000000000..7ad4370cc
--- /dev/null
+++ b/Examples/test-suite/java/li_std_map_runme.java
@@ -0,0 +1,122 @@
+import li_std_map.*;
+
+public class li_std_map_runme {
+
+ static {
+ try {
+ System.loadLibrary("li_std_map");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void checkThat(boolean mustBeTrue) throws Throwable {
+ if (!mustBeTrue) {
+ // Index [2], since this function is one hop away from main, and [1] is the current method.
+ throw new RuntimeException("Test failed at line number " + Thread.currentThread().getStackTrace()[2].getLineNumber());
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ java.util.AbstractMap<String, Integer> sim = new StringIntMap();
+ java.util.AbstractMap<Integer, Integer> iim = new IntIntMap();
+
+ checkThat(sim.isEmpty());
+ checkThat(iim.isEmpty());
+ checkThat(sim.size() == 0);
+ checkThat(iim.size() == 0);
+
+ checkThat(sim.get("key") == null);
+ checkThat(iim.get(1) == null);
+
+ checkThat(!sim.containsKey("key"));
+ checkThat(!iim.containsKey(1));
+
+ checkThat(sim.put("key", 2) == null);
+ checkThat(iim.put(1, 2) == null);
+
+ checkThat(sim.size() == 1);
+ checkThat(iim.size() == 1);
+ checkThat(!sim.isEmpty());
+ checkThat(!iim.isEmpty());
+
+ checkThat(sim.get("key") == 2);
+ checkThat(iim.get(1) == 2);
+
+ checkThat(sim.remove("key") == 2);
+ checkThat(iim.remove(1) == 2);
+
+ checkThat(sim.isEmpty());
+ checkThat(iim.isEmpty());
+ checkThat(sim.size() == 0);
+ checkThat(iim.size() == 0);
+
+ checkThat(sim.get("key") == null);
+ checkThat(iim.get(1) == null);
+
+ checkThat(sim.remove("key") == null);
+ checkThat(iim.remove(1) == null);
+
+ checkThat(sim.put("key", 2) == null);
+ checkThat(iim.put(1, 2) == null);
+
+ sim.clear();
+ iim.clear();
+ checkThat(sim.isEmpty());
+ checkThat(iim.isEmpty());
+
+ checkThat(sim.put("key1", 1) == null);
+ checkThat(iim.put(1, 1) == null);
+ checkThat(sim.put("key2", 2) == null);
+ checkThat(iim.put(2, 2) == null);
+
+ checkThat(sim.size() == 2);
+ checkThat(iim.size() == 2);
+ checkThat(sim.get("key1") == 1);
+ checkThat(iim.get(1) == 1);
+ checkThat(sim.get("key2") == 2);
+ checkThat(iim.get(2) == 2);
+
+ checkThat(sim.put("key1", 3) == 1);
+ checkThat(iim.put(1, 3) == 1);
+
+ checkThat(sim.size() == 2);
+ checkThat(iim.size() == 2);
+ checkThat(sim.get("key1") == 3);
+ checkThat(iim.get(1) == 3);
+
+ java.util.Set<java.util.Map.Entry<String, Integer>> sim_es = sim.entrySet();
+ java.util.Map<String, Integer> sim_default = new java.util.HashMap<String, Integer>();
+ sim_default.put("key1", 3);
+ sim_default.put("key2", 2);
+ java.util.Set<java.util.Map.Entry<String, Integer>> sim_es_default = sim_default.entrySet();
+ checkThat(sim_es.size() == sim_es_default.size());
+ for (java.util.Map.Entry<String, Integer> entry : sim_es) {
+ checkThat(sim_es_default.contains(entry));
+ checkThat(sim_default.containsKey(entry.getKey()));
+ checkThat(sim_default.containsValue(entry.getValue()));
+
+ Integer oldValue = entry.getValue();
+ entry.setValue(oldValue + 1);
+ checkThat(sim.get(entry.getKey()) == (oldValue + 1));
+ }
+
+ java.util.Set<java.util.Map.Entry<Integer, Integer>> iim_es = iim.entrySet();
+ java.util.Map<Integer, Integer> iim_default = new java.util.HashMap<Integer, Integer>();
+ iim_default.put(1, 3);
+ iim_default.put(2, 2);
+ java.util.Set<java.util.Map.Entry<Integer, Integer>> iim_es_default = iim_default.entrySet();
+ checkThat(iim_es.size() == iim_es_default.size());
+ for (java.util.Map.Entry<Integer, Integer> entry : iim_es) {
+ checkThat(iim_es_default.contains(entry));
+ checkThat(iim_default.containsKey(entry.getKey()));
+ checkThat(iim_default.containsValue(entry.getValue()));
+
+ Integer oldValue = entry.getValue();
+ entry.setValue(oldValue + 1);
+ checkThat(iim.get(entry.getKey()) == (oldValue + 1));
+ }
+ }
+}
diff --git a/Examples/test-suite/java/li_std_set_runme.java b/Examples/test-suite/java/li_std_set_runme.java
new file mode 100644
index 000000000..0e013eba1
--- /dev/null
+++ b/Examples/test-suite/java/li_std_set_runme.java
@@ -0,0 +1,90 @@
+import li_std_set.*;
+
+public class li_std_set_runme {
+
+ static {
+ try {
+ System.loadLibrary("li_std_set");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void checkThat(boolean mustBeTrue) throws Throwable {
+ if (!mustBeTrue) {
+ // Index [2], since this function is one hop away from main, and [1] is the current method.
+ throw new RuntimeException("Test failed at line number " + Thread.currentThread().getStackTrace()[2].getLineNumber());
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ java.util.AbstractSet<String> ss = new StringSet();
+
+ checkThat(ss.isEmpty());
+ checkThat(!ss.contains("key"));
+ checkThat(!ss.remove("key"));
+
+ checkThat(ss.add("key"));
+ checkThat(!ss.add("key"));
+ checkThat(ss.contains("key"));
+ checkThat(ss.remove("key"));
+ checkThat(ss.isEmpty());
+ checkThat(ss.size() == 0);
+
+ checkThat(ss.add("key1"));
+ checkThat(ss.add("key2"));
+ checkThat(ss.add("key3"));
+ checkThat(ss.size() == 3);
+
+ ss.clear();
+ checkThat(ss.isEmpty());
+ checkThat(ss.size() == 0);
+
+ checkThat(ss.addAll(java.util.Arrays.asList("one", "two", "three")));
+ checkThat(ss.size() == 3);
+ checkThat(ss.contains("one"));
+ checkThat(!ss.contains("four"));
+
+ checkThat(ss.containsAll(java.util.Arrays.asList("one", "two", "three")));
+ checkThat(ss.containsAll(java.util.Arrays.asList("one", "two")));
+ checkThat(!ss.containsAll(java.util.Arrays.asList("one", "two", "four")));
+ checkThat(!ss.containsAll(java.util.Arrays.asList("one", "two", "three", "four")));
+
+ checkThat(!ss.addAll(java.util.Arrays.asList("one", "two", "three")));
+
+ java.util.Set<String> found = new java.util.HashSet<String>();
+ java.util.Iterator<String> itr = ss.iterator();
+ while (itr.hasNext()) {
+ found.add(itr.next());
+ }
+
+ checkThat(ss.containsAll(found));
+ checkThat(found.containsAll(ss));
+
+ java.util.AbstractSet<String> ss2 = new StringSet(ss);
+ checkThat(ss2.containsAll(ss));
+ checkThat(ss.containsAll(ss2));
+
+ checkThat(!ss.removeAll(java.util.Arrays.asList("five", "four")));
+ checkThat(ss.removeAll(found));
+ checkThat(ss.isEmpty());
+ checkThat(ss.size() == 0);
+
+ // Check a set of another type.
+ java.util.AbstractSet<Foo> fooSet = new FooSet();
+ checkThat(fooSet.isEmpty());
+ checkThat(fooSet.add(new Foo(17)));
+ checkThat(fooSet.size() == 1);
+
+ // And a set of primitive type.
+ java.util.AbstractSet<Integer> intSet = new IntSet();
+ checkThat(intSet.isEmpty());
+ checkThat(intSet.add(17));
+ checkThat(!intSet.add(17));
+ checkThat(intSet.size() == 1);
+ checkThat(intSet.add(289));
+ checkThat(intSet.size() == 2);
+ }
+}
diff --git a/Examples/test-suite/java/li_std_vector_runme.java b/Examples/test-suite/java/li_std_vector_runme.java
index b422655a4..d4c0c95c7 100644
--- a/Examples/test-suite/java/li_std_vector_runme.java
+++ b/Examples/test-suite/java/li_std_vector_runme.java
@@ -4,21 +4,68 @@ public class li_std_vector_runme {
static {
try {
- System.loadLibrary("li_std_vector");
+ System.loadLibrary("li_std_vector");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
+ public static void checkThat(boolean mustBeTrue) throws Throwable {
+ if (!mustBeTrue) {
+ // Index [2], since this function is one hop away from main, and [1] is the current method.
+ throw new RuntimeException("Test failed at line number " + Thread.currentThread().getStackTrace()[2].getLineNumber());
+ }
+ }
+
public static void main(String argv[]) throws Throwable
{
IntVector v1 = li_std_vector.vecintptr(new IntVector());
IntPtrVector v2 = li_std_vector.vecintptr(new IntPtrVector());
IntConstPtrVector v3 = li_std_vector.vecintconstptr(new IntConstPtrVector());
+ checkThat(v1.isEmpty());
+ checkThat(v1.size() == 0);
+ checkThat(v1.add(123));
+ checkThat(v1.size() == 1);
+ checkThat(!v1.isEmpty());
+
+ int sum = 0;
+ for (int n : v1) {
+ checkThat(n == 123);
+ sum += n;
+ }
+ checkThat(sum == 123);
+ checkThat(v1.get(0) == 123);
+ v1.clear();
+ checkThat(v1.isEmpty());
v1.add(123);
- if (v1.get(0) != 123) throw new RuntimeException("v1 test failed");
+
+ checkThat(v1.set(0, 456) == 123);
+ checkThat(v1.size() == 1);
+ checkThat(v1.get(0) == 456);
+
+ java.util.Iterator<Integer> v1_iterator = v1.iterator();
+ checkThat(v1_iterator.hasNext());
+ checkThat(v1_iterator.next() == 456);
+ checkThat(!v1_iterator.hasNext());
+ try {
+ v1_iterator.next();
+ checkThat(false);
+ } catch (java.util.NoSuchElementException e) {
+ }
+
+ checkThat(!v1.remove(Integer.valueOf(123)));
+ checkThat(v1.remove(Integer.valueOf(456)));
+ checkThat(v1.isEmpty());
+ checkThat(v1.size() == 0);
+ checkThat(!v1.remove(Integer.valueOf(456)));
+
+ checkThat(new IntVector(3, 0).size() == 3);
+ for (int n : new IntVector(10, 999))
+ checkThat(n == 999);
+ for (int n : new IntVector(new IntVector(10, 999)))
+ checkThat(n == 999);
StructVector v4 = li_std_vector.vecstruct(new StructVector());
StructPtrVector v5 = li_std_vector.vecstructptr(new StructPtrVector());
@@ -28,9 +75,109 @@ public class li_std_vector_runme {
v5.add(new Struct(34));
v6.add(new Struct(56));
- Struct s = null;
- if (v4.get(0).getNum() != 12) throw new RuntimeException("v4 test failed");
- if (v5.get(0).getNum() != 34) throw new RuntimeException("v5 test failed");
- if (v6.get(0).getNum() != 56) throw new RuntimeException("v6 test failed");
+ checkThat(v4.get(0).getNum() == 12);
+ checkThat(v5.get(0).getNum() == 34);
+ checkThat(v6.get(0).getNum() == 56);
+
+ for (Struct s : v4) {
+ checkThat(s.getNum() == 12);
+ }
+ for (Struct s : v5) {
+ checkThat(s.getNum() == 34);
+ }
+ for (Struct s : v6) {
+ checkThat(s.getNum() == 56);
+ }
+
+ StructVector v7 = li_std_vector.vecstruct(new StructVector());
+ v7.add(new Struct(1));
+ v7.add(new Struct(23));
+ v7.add(new Struct(456));
+ v7.add(new Struct(7890));
+ checkThat(v7.size() == 4);
+ {
+ double[] a7 = {1, 23, 456, 7890};
+ int i7 = 0;
+ for (Struct s7 : v7) {
+ checkThat(s7.getNum() == a7[i7]);
+ i7++;
+ }
+ checkThat(i7 == a7.length);
+ }
+ checkThat(v7.remove(2).getNum() == 456);
+ {
+ double[] a7 = {1, 23, 7890};
+ int i7 = 0;
+ for (Struct s7 : v7) {
+ checkThat(s7.getNum() == a7[i7]);
+ i7++;
+ }
+ checkThat(i7 == a7.length);
+ }
+ v7.add(1, new Struct(123));
+ {
+ double[] a7 = {1, 123, 23, 7890};
+ int i7 = 0;
+ for (Struct s7 : v7) {
+ checkThat(s7.getNum() == a7[i7]);
+ i7++;
+ }
+ checkThat(i7 == a7.length);
+ }
+
+ BoolVector v8 = new BoolVector();
+ checkThat(v8.add(true));
+ checkThat(v8.get(0) == true);
+ checkThat(v8.set(0, false) == true);
+ checkThat(v8.set(0, false) == false);
+ checkThat(v8.size() == 1);
+
+ java.util.ArrayList<Boolean> bl = new java.util.ArrayList<Boolean>(java.util.Arrays.asList(true, false, true, false));
+ BoolVector bv = new BoolVector(java.util.Arrays.asList(true, false, true, false));
+ BoolVector bv2 = new BoolVector(bl);
+ java.util.ArrayList<Boolean> bl2 = new java.util.ArrayList<Boolean>(bv);
+ boolean bbb1 = bv.get(0);
+ Boolean bbb2 = bv.get(0);
+
+ IntVector v9 = new IntVector(java.util.Arrays.asList(10, 20, 30, 40));
+ v9.add(50);
+ v9.add(60);
+ v9.add(70);
+ checkThat(v9.size() == 7);
+ checkThat(v9.remove(Integer.valueOf(60)));
+ checkThat(v9.size() == 6);
+
+ IntVector v10 = new IntVector(java.util.Arrays.asList(10, 20, 30, 40, 50));
+ v10.subList(1, 4).clear(); // Recommended way to call protected method removeRange(1,3)
+ checkThat(v10.size() == 2);
+ checkThat(v10.get(0) == 10);
+ checkThat(v10.get(1) == 50);
+ v10.addAll(1, java.util.Arrays.asList(22, 33));
+ checkThat(v10.size() == 4);
+ checkThat(v10.get(1) == 22);
+ checkThat(v10.get(2) == 33);
+
+ v10.add(v10.size(), 55);
+ checkThat(v10.size() == 5);
+ checkThat(v10.get(4) == 55);
+
+ IntVector v11 = new IntVector(java.util.Arrays.asList(11, 22, 33, 44));
+ v11.listIterator(0);
+ v11.listIterator(v11.size());
+ try {
+ v11.listIterator(v11.size() + 1);
+ checkThat(false);
+ } catch (IndexOutOfBoundsException e) {
+ }
+ try {
+ v11.listIterator(-1);
+ checkThat(false);
+ } catch (IndexOutOfBoundsException e) {
+ }
+
+ IntVector arrayInit = new IntVector(new int[]{1, 2, 3, 4, 5});
+ checkThat(arrayInit.size() == 5);
+ checkThat(arrayInit.get(0) == 1);
+ checkThat(arrayInit.get(4) == 5);
}
}
diff --git a/Examples/test-suite/java/long_long_runme.java b/Examples/test-suite/java/long_long_runme.java
index 76aa0705d..65a0e79b3 100644
--- a/Examples/test-suite/java/long_long_runme.java
+++ b/Examples/test-suite/java/long_long_runme.java
@@ -84,14 +84,14 @@ public class long_long_runme {
ArrayList<BigInteger> bigIntegers = new ArrayList<BigInteger>();
for (int i=0; i<nums.length; ++i) {
- BigInteger bi = new BigInteger(new Long(nums[i]).toString());
+ BigInteger bi = new BigInteger(Long.valueOf(nums[i]).toString());
bigIntegers.add(bi);
}
{
- BigInteger bi = new BigInteger(new Long(Long.MAX_VALUE).toString());
+ BigInteger bi = new BigInteger(Long.valueOf(Long.MAX_VALUE).toString());
bigIntegers.add(bi.add(BigInteger.ONE));
- bi = new BigInteger(new Long(Long.MIN_VALUE).toString());
+ bi = new BigInteger(Long.valueOf(Long.MIN_VALUE).toString());
bigIntegers.add(bi.subtract(BigInteger.ONE));
}
diff --git a/Examples/test-suite/java/member_pointer_const_runme.java b/Examples/test-suite/java/member_pointer_const_runme.java
new file mode 100644
index 000000000..89735d3eb
--- /dev/null
+++ b/Examples/test-suite/java/member_pointer_const_runme.java
@@ -0,0 +1,60 @@
+import member_pointer_const.*;
+
+public class member_pointer_const_runme {
+
+ static {
+ try {
+ System.loadLibrary("member_pointer_const");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static SWIGTYPE_m_Shape__f_void__double memberPtr = null;
+
+ public static void main(String argv[]) {
+ // Get the pointers
+
+ SWIGTYPE_m_Shape__f_void__double area_pt = member_pointer_const.areapt();
+ SWIGTYPE_m_Shape__f_void__double perim_pt = member_pointer_const.perimeterpt();
+
+ // Create some objects
+
+ Square s = new Square(10);
+
+ // Do some calculations
+
+ check( "Square area ", 100.0, member_pointer_const.do_op(s,area_pt) );
+ check( "Square perim", 40.0, member_pointer_const.do_op(s,perim_pt) );
+
+ memberPtr = member_pointer_const.getAreavar();
+ memberPtr = member_pointer_const.getPerimetervar();
+
+ // Try the variables
+ check( "Square area ", 100.0, member_pointer_const.do_op(s,member_pointer_const.getAreavar()) );
+ check( "Square perim", 40.0, member_pointer_const.do_op(s,member_pointer_const.getPerimetervar()) );
+
+ // Modify one of the variables
+ member_pointer_const.setAreavar(perim_pt);
+
+ check( "Square perimeter", 40.0, member_pointer_const.do_op(s,member_pointer_const.getAreavar()) );
+
+ // Try the constants
+
+ memberPtr = member_pointer_const.AREAPT;
+ memberPtr = member_pointer_const.PERIMPT;
+ memberPtr = member_pointer_const.NULLPT;
+
+ check( "Square area ", 100.0, member_pointer_const.do_op(s,member_pointer_const.AREAPT) );
+ check( "Square perim", 40.0, member_pointer_const.do_op(s,member_pointer_const.PERIMPT) );
+
+ // Typedefs
+ check( "Square perim", 40.0, member_pointer_const.do_op_td(s,perim_pt) );
+ }
+
+ private static void check(String what, double expected, double actual) {
+ if (expected != actual)
+ throw new RuntimeException("Failed: " + what + " Expected: " + expected + " Actual: " + actual);
+ }
+}
diff --git a/Examples/test-suite/java/member_pointer_runme.java b/Examples/test-suite/java/member_pointer_runme.java
index f8dcfbcb8..d0520a99c 100644
--- a/Examples/test-suite/java/member_pointer_runme.java
+++ b/Examples/test-suite/java/member_pointer_runme.java
@@ -49,6 +49,8 @@ public class member_pointer_runme {
check( "Square area ", 100.0, member_pointer.do_op(s,member_pointer.AREAPT) );
check( "Square perim", 40.0, member_pointer.do_op(s,member_pointer.PERIMPT) );
+ // Typedefs
+ check( "Square perim", 40.0, member_pointer.do_op_td(s,perim_pt) );
}
private static void check(String what, double expected, double actual) {
diff --git a/Examples/test-suite/java/namespace_chase_runme.java b/Examples/test-suite/java/namespace_chase_runme.java
new file mode 100644
index 000000000..9b4898bd0
--- /dev/null
+++ b/Examples/test-suite/java/namespace_chase_runme.java
@@ -0,0 +1,26 @@
+
+import namespace_chase.*;
+
+public class namespace_chase_runme {
+
+ static {
+ try {
+ System.loadLibrary("namespace_chase");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ Struct1A s1a = new Struct1A();
+ Struct1B s1b = new Struct1B();
+ Struct1C s1c = new Struct1C();
+
+ namespace_chase.sss3a(s1a, s1b, s1c);
+ namespace_chase.sss3b(s1a, s1b, s1c);
+ // needs fixing
+// namespace_chase.sss3c(s1a, s1b, s1c);
+ }
+}
diff --git a/Examples/test-suite/java/namespace_template_runme.java b/Examples/test-suite/java/namespace_template_runme.java
new file mode 100644
index 000000000..c0c7ba135
--- /dev/null
+++ b/Examples/test-suite/java/namespace_template_runme.java
@@ -0,0 +1,32 @@
+
+import namespace_template.*;
+
+public class namespace_template_runme {
+
+ static {
+ try {
+ System.loadLibrary("namespace_template");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ vectorchar vc = new vectorchar();
+ vectorshort vs = new vectorshort();
+ vectorint vi = new vectorint();
+ vectorlong vl = new vectorlong();
+
+ vc.blah((char)10);
+ vs.blah((short)10);
+ vi.blah(10);
+ vl.blah(10);
+
+ vc.vectoruse(vc, vc);
+ vs.vectoruse(vs, vs);
+ vi.vectoruse(vi, vi);
+ vl.vectoruse(vl, vl);
+ }
+}
+
diff --git a/Examples/test-suite/java/native_directive_runme.java b/Examples/test-suite/java/native_directive_runme.java
new file mode 100644
index 000000000..fc83ba2d0
--- /dev/null
+++ b/Examples/test-suite/java/native_directive_runme.java
@@ -0,0 +1,22 @@
+import native_directive.*;
+
+public class native_directive_runme {
+
+ static {
+ try {
+ System.loadLibrary("native_directive");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ String s = "abc.DEF-123";
+ if (native_directive.CountAlphas(s) != 6)
+ throw new RuntimeException("CountAlphas failed");
+ if (native_directive.CountAlphaCharacters(s) != 6)
+ throw new RuntimeException("CountAlphaCharacters failed");
+ }
+}
+
diff --git a/Examples/test-suite/java/nested_inheritance_interface_runme.java b/Examples/test-suite/java/nested_inheritance_interface_runme.java
new file mode 100644
index 000000000..8436ec294
--- /dev/null
+++ b/Examples/test-suite/java/nested_inheritance_interface_runme.java
@@ -0,0 +1,32 @@
+import nested_inheritance_interface.*;
+import java.util.Arrays;
+
+public class nested_inheritance_interface_runme {
+
+ static {
+ try {
+ System.loadLibrary("nested_inheritance_interface");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ private static void takeIA(IASwigInterface ia) {
+ }
+
+ public static void main(String argv[]) {
+ Class[] BNInterfaces = B.N.class.getInterfaces();
+ String expectedInterfacesString = "[interface nested_inheritance_interface.IASwigInterface]";
+ String actualInterfacesString = Arrays.toString(BNInterfaces);
+ if (!expectedInterfacesString.equals(actualInterfacesString))
+ throw new RuntimeException("Expected interfaces for " + B.N.class.getName() + ": \n" + expectedInterfacesString + "\n" + "Actual interfaces: \n" + actualInterfacesString);
+
+ if (!IASwigInterface.class.isInterface())
+ throw new RuntimeException(IASwigInterface.class.getName() + " should be an interface but is not");
+
+ // overloaded methods check
+ B.N d = new B.N();
+ takeIA(d);
+ }
+}
diff --git a/Examples/test-suite/java/rename1_runme.java b/Examples/test-suite/java/rename1_runme.java
index 058de41fd..c04baf81f 100644
--- a/Examples/test-suite/java/rename1_runme.java
+++ b/Examples/test-suite/java/rename1_runme.java
@@ -24,7 +24,6 @@ public class rename1_runme {
xyz.tMethod2(0);
xyz.tMethodNotXYZ2(notxyz);
xyz.opNotXYZ2();
- xyz.opXYZ2();
}
{
XYZDouble xyz = new XYZDouble();
@@ -36,7 +35,6 @@ public class rename1_runme {
xyz.tMethod1(0);
xyz.tMethodNotXYZ1(notxyz);
xyz.opNotXYZ1();
- xyz.opXYZ1();
}
{
XYZKlass xyz = new XYZKlass();
@@ -48,7 +46,6 @@ public class rename1_runme {
xyz.tMethod3(new Klass());
xyz.tMethodNotXYZ3(notxyz);
xyz.opNotXYZ3();
- xyz.opXYZ3();
}
{
XYZEnu xyz = new XYZEnu();
@@ -60,7 +57,6 @@ public class rename1_runme {
xyz.tMethod4(Enu.En1);
xyz.tMethodNotXYZ4(notxyz);
xyz.opNotXYZ4();
- xyz.opXYZ4();
}
{
ABC abc = new ABC();
diff --git a/Examples/test-suite/java/rename2_runme.java b/Examples/test-suite/java/rename2_runme.java
index b6a62dd1e..b97cc59ed 100644
--- a/Examples/test-suite/java/rename2_runme.java
+++ b/Examples/test-suite/java/rename2_runme.java
@@ -24,7 +24,6 @@ public class rename2_runme {
xyz.tMethod2(0);
xyz.tMethodNotXYZ2(notxyz);
xyz.opNotXYZ2();
- xyz.opXYZ2();
}
{
XYZDouble xyz = new XYZDouble();
@@ -36,7 +35,6 @@ public class rename2_runme {
xyz.tMethod1(0);
xyz.tMethodNotXYZ1(notxyz);
xyz.opNotXYZ1();
- xyz.opXYZ1();
}
{
XYZKlass xyz = new XYZKlass();
@@ -48,7 +46,6 @@ public class rename2_runme {
xyz.tMethod3(new Klass());
xyz.tMethodNotXYZ3(notxyz);
xyz.opNotXYZ3();
- xyz.opXYZ3();
}
{
XYZEnu xyz = new XYZEnu();
@@ -60,7 +57,6 @@ public class rename2_runme {
xyz.tMethod4(Enu.En1);
xyz.tMethodNotXYZ4(notxyz);
xyz.opNotXYZ4();
- xyz.opXYZ4();
}
{
ABC abc = new ABC();
diff --git a/Examples/test-suite/java/rename3_runme.java b/Examples/test-suite/java/rename3_runme.java
index e1b090af8..222d54899 100644
--- a/Examples/test-suite/java/rename3_runme.java
+++ b/Examples/test-suite/java/rename3_runme.java
@@ -24,7 +24,6 @@ public class rename3_runme {
xyz.tMethod2(0);
xyz.tMethodNotXYZ2(notxyz);
xyz.opNotXYZ2();
- xyz.opXYZ2();
}
{
XYZDouble xyz = new XYZDouble();
@@ -36,7 +35,6 @@ public class rename3_runme {
xyz.tMethod1(0);
xyz.tMethodNotXYZ1(notxyz);
xyz.opNotXYZ1();
- xyz.opXYZ1();
}
{
XYZKlass xyz = new XYZKlass();
@@ -48,7 +46,6 @@ public class rename3_runme {
xyz.tMethod3(new Klass());
xyz.tMethodNotXYZ3(notxyz);
xyz.opNotXYZ3();
- xyz.opXYZ3();
}
{
XYZEnu xyz = new XYZEnu();
@@ -60,7 +57,6 @@ public class rename3_runme {
xyz.tMethod4(Enu.En1);
xyz.tMethodNotXYZ4(notxyz);
xyz.opNotXYZ4();
- xyz.opXYZ4();
}
{
ABC abc = new ABC();
diff --git a/Examples/test-suite/java/rename4_runme.java b/Examples/test-suite/java/rename4_runme.java
index 69f909e9e..ef92dd300 100644
--- a/Examples/test-suite/java/rename4_runme.java
+++ b/Examples/test-suite/java/rename4_runme.java
@@ -24,7 +24,6 @@ public class rename4_runme {
xyz.tMethod2(0);
xyz.tMethodNotXYZ2(notxyz);
xyz.opNotXYZ2();
- xyz.opXYZ2();
}
{
XYZDouble xyz = new XYZDouble();
@@ -36,7 +35,6 @@ public class rename4_runme {
xyz.tMethod1(0);
xyz.tMethodNotXYZ1(notxyz);
xyz.opNotXYZ1();
- xyz.opXYZ1();
}
{
XYZKlass xyz = new XYZKlass();
@@ -48,7 +46,6 @@ public class rename4_runme {
xyz.tMethod3(new Klass());
xyz.tMethodNotXYZ3(notxyz);
xyz.opNotXYZ3();
- xyz.opXYZ3();
}
{
XYZEnu xyz = new XYZEnu();
@@ -60,7 +57,6 @@ public class rename4_runme {
xyz.tMethod4(Enu.En1);
xyz.tMethodNotXYZ4(notxyz);
xyz.opNotXYZ4();
- xyz.opXYZ4();
}
{
ABC abc = new ABC();
diff --git a/Examples/test-suite/java/template_class_reuse_name_runme.java b/Examples/test-suite/java/template_class_reuse_name_runme.java
new file mode 100644
index 000000000..cda91d00d
--- /dev/null
+++ b/Examples/test-suite/java/template_class_reuse_name_runme.java
@@ -0,0 +1,57 @@
+import template_class_reuse_name.*;
+
+public class template_class_reuse_name_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_class_reuse_name");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ new Bool1().tt();
+ new Bool1False().ff();
+
+ new Bool2().tt();
+ new Bool2False().ff();
+
+ new Bool3().tt();
+ new Bool3False().ff();
+
+ new Bool4().tt();
+ new Bool4False().ff();
+
+
+ new BoolForward1().tt();
+ new BoolForward1False().ff();
+
+ new BoolForward2().tt();
+ new BoolForward2False().ff();
+
+ new BoolForward3().tt();
+ new BoolForward3False().ff();
+
+ new BoolForward4().tt();
+ new BoolForward4False().ff();
+
+
+ new IntBool1().tt();
+ new IntBool1False().ff();
+
+ new IntBool2().tt();
+ new IntBool2False().ff();
+
+ new IntBool3().tt();
+ new IntBool3False().ff();
+
+ new IntBool4().tt();
+ new IntBool4False().ff();
+
+ new Duplicate2_0().n();
+ new Duplicate3().n();
+ }
+}
diff --git a/Examples/test-suite/java/template_parameters_global_scope_runme.java b/Examples/test-suite/java/template_parameters_global_scope_runme.java
new file mode 100644
index 000000000..a536fe476
--- /dev/null
+++ b/Examples/test-suite/java/template_parameters_global_scope_runme.java
@@ -0,0 +1,75 @@
+import template_parameters_global_scope.*;
+
+public class template_parameters_global_scope_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_parameters_global_scope");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ int alloc = 0;
+
+ // Check 1
+ alloc = template_parameters_global_scope.Bucket1();
+ alloc = template_parameters_global_scope.Bucket2();
+ alloc = template_parameters_global_scope.Bucket3();
+ alloc = template_parameters_global_scope.Bucket4();
+ alloc = template_parameters_global_scope.Bucket5();
+ alloc = template_parameters_global_scope.Bucket6();
+
+ // Check 2
+ alloc = template_parameters_global_scope.Spade1();
+ alloc = template_parameters_global_scope.Spade2();
+ alloc = template_parameters_global_scope.Spade3();
+ alloc = template_parameters_global_scope.Spade4();
+ alloc = template_parameters_global_scope.Spade5();
+ alloc = template_parameters_global_scope.Spade6();
+
+ // Check 3
+ alloc = template_parameters_global_scope.Ball1();
+ alloc = template_parameters_global_scope.Ball2();
+ alloc = template_parameters_global_scope.Ball3();
+ alloc = template_parameters_global_scope.Ball4();
+ alloc = template_parameters_global_scope.Ball5();
+ alloc = template_parameters_global_scope.Ball6();
+
+ // Check 4
+ alloc = template_parameters_global_scope.Bat1();
+ alloc = template_parameters_global_scope.Bat2();
+ alloc = template_parameters_global_scope.Bat3();
+ alloc = template_parameters_global_scope.Bat4();
+ alloc = template_parameters_global_scope.Bat5();
+ alloc = template_parameters_global_scope.Bat6();
+
+ // Check 5
+ alloc = template_parameters_global_scope.Chair1();
+ alloc = template_parameters_global_scope.Chair2();
+ alloc = template_parameters_global_scope.Chair3();
+ alloc = template_parameters_global_scope.Chair4();
+ alloc = template_parameters_global_scope.Chair5();
+ alloc = template_parameters_global_scope.Chair6();
+
+ // Check 6
+ alloc = template_parameters_global_scope.Table1();
+ alloc = template_parameters_global_scope.Table2();
+ alloc = template_parameters_global_scope.Table3();
+ alloc = template_parameters_global_scope.Table4();
+ alloc = template_parameters_global_scope.Table5();
+ alloc = template_parameters_global_scope.Table6();
+
+ /*
+ alloc = template_parameters_global_scope.rejig1();
+ alloc = template_parameters_global_scope.rejig2();
+ alloc = template_parameters_global_scope.rejig3();
+ alloc = template_parameters_global_scope.rejig4();
+ alloc = template_parameters_global_scope.rejig5();
+ alloc = template_parameters_global_scope.rejig6();
+ */
+ }
+}
diff --git a/Examples/test-suite/java/template_partial_specialization_runme.java b/Examples/test-suite/java/template_partial_specialization_runme.java
index ef8c4e80e..097c33d86 100644
--- a/Examples/test-suite/java/template_partial_specialization_runme.java
+++ b/Examples/test-suite/java/template_partial_specialization_runme.java
@@ -23,10 +23,10 @@ public class template_partial_specialization_runme {
new G().g();
new H().h();
- new I().i();
new J().j();
new K().k();
- new L().l();
+ new M().m();
+ new N().n();
new BB().b();
new BBB().b();
diff --git a/Examples/test-suite/java/template_partial_specialization_typedef_runme.java b/Examples/test-suite/java/template_partial_specialization_typedef_runme.java
index 6ae95eb6a..04653cdc0 100644
--- a/Examples/test-suite/java/template_partial_specialization_typedef_runme.java
+++ b/Examples/test-suite/java/template_partial_specialization_typedef_runme.java
@@ -23,10 +23,10 @@ public class template_partial_specialization_typedef_runme {
new G().g();
new H().h();
- new I().i();
new J().j();
new K().k();
- new L().l();
+ new M().m();
+ new N().n();
new BB().b();
new BBB().b();
diff --git a/Examples/test-suite/java/template_using_directive_and_declaration_forward_runme.java b/Examples/test-suite/java/template_using_directive_and_declaration_forward_runme.java
index 080945e02..3aab5fa8f 100644
--- a/Examples/test-suite/java/template_using_directive_and_declaration_forward_runme.java
+++ b/Examples/test-suite/java/template_using_directive_and_declaration_forward_runme.java
@@ -19,32 +19,32 @@ public class template_using_directive_and_declaration_forward_runme {
template_using_directive_and_declaration_forward.useit1b(new Thing1Int());
template_using_directive_and_declaration_forward.useit1c(new Thing1Int());
-//BROKEN template_using_directive_and_declaration_forward.useit2(new Thing2Int());
+ template_using_directive_and_declaration_forward.useit2(new Thing2Int());
template_using_directive_and_declaration_forward.useit2a(new Thing2Int());
template_using_directive_and_declaration_forward.useit2b(new Thing2Int());
template_using_directive_and_declaration_forward.useit2c(new Thing2Int());
template_using_directive_and_declaration_forward.useit2d(new Thing2Int());
-//BROKEN template_using_directive_and_declaration_forward.useit3(new Thing3Int());
+ template_using_directive_and_declaration_forward.useit3(new Thing3Int());
template_using_directive_and_declaration_forward.useit3a(new Thing3Int());
template_using_directive_and_declaration_forward.useit3b(new Thing3Int());
template_using_directive_and_declaration_forward.useit3c(new Thing3Int());
template_using_directive_and_declaration_forward.useit3d(new Thing3Int());
-//BROKEN template_using_directive_and_declaration_forward.useit4(new Thing4Int());
+ template_using_directive_and_declaration_forward.useit4(new Thing4Int());
template_using_directive_and_declaration_forward.useit4a(new Thing4Int());
template_using_directive_and_declaration_forward.useit4b(new Thing4Int());
template_using_directive_and_declaration_forward.useit4c(new Thing4Int());
template_using_directive_and_declaration_forward.useit4d(new Thing4Int());
-//BROKEN template_using_directive_and_declaration_forward.useit5(new Thing5Int());
+ template_using_directive_and_declaration_forward.useit5(new Thing5Int());
template_using_directive_and_declaration_forward.useit5a(new Thing5Int());
template_using_directive_and_declaration_forward.useit5b(new Thing5Int());
template_using_directive_and_declaration_forward.useit5c(new Thing5Int());
template_using_directive_and_declaration_forward.useit5d(new Thing5Int());
-//BROKEN template_using_directive_and_declaration_forward.useit7(new Thing7Int());
+ template_using_directive_and_declaration_forward.useit7(new Thing7Int());
template_using_directive_and_declaration_forward.useit7a(new Thing7Int());
template_using_directive_and_declaration_forward.useit7b(new Thing7Int());
template_using_directive_and_declaration_forward.useit7c(new Thing7Int());
diff --git a/Examples/test-suite/java/template_using_directive_typedef_runme.java b/Examples/test-suite/java/template_using_directive_typedef_runme.java
new file mode 100644
index 000000000..bec077399
--- /dev/null
+++ b/Examples/test-suite/java/template_using_directive_typedef_runme.java
@@ -0,0 +1,31 @@
+
+import template_using_directive_typedef.*;
+
+public class template_using_directive_typedef_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_using_directive_typedef");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Vector_Obj vo = new Vector_Obj();
+
+ Holder h = new Holder();
+ h.holder_use1(vo, vo, vo);
+ h.holder_use2(vo, vo, vo);
+ h.holder_use3(vo, vo, vo);
+
+ template_using_directive_typedef.tns_holder_use(vo, vo);
+ template_using_directive_typedef.tns_use(vo, vo, vo);
+ template_using_directive_typedef.global_holder_use(vo);
+ template_using_directive_typedef.global_use(vo, vo, vo);
+ template_using_directive_typedef.ns1_holder_use(vo);
+ template_using_directive_typedef.ns2_holder_use(vo, vo, vo, vo);
+ }
+}
+
diff --git a/Examples/test-suite/java/typedef_classforward_same_name_runme.java b/Examples/test-suite/java/typedef_classforward_same_name_runme.java
new file mode 100644
index 000000000..86e713d14
--- /dev/null
+++ b/Examples/test-suite/java/typedef_classforward_same_name_runme.java
@@ -0,0 +1,26 @@
+
+import typedef_classforward_same_name.*;
+
+public class typedef_classforward_same_name_runme {
+
+ static {
+ try {
+ System.loadLibrary("typedef_classforward_same_name");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Foo foo = new Foo();
+ foo.setX(5);
+ if (typedef_classforward_same_name.extractFoo(foo) != 5)
+ throw new RuntimeException("unexpected value");
+
+ Boo boo = new Boo();
+ boo.setX(5);
+ if (typedef_classforward_same_name.extractBoo(boo) != 5)
+ throw new RuntimeException("unexpected value");
+ }
+}
diff --git a/Examples/test-suite/java/typedef_funcptr_runme.java b/Examples/test-suite/java/typedef_funcptr_runme.java
new file mode 100644
index 000000000..0dd44cecd
--- /dev/null
+++ b/Examples/test-suite/java/typedef_funcptr_runme.java
@@ -0,0 +1,34 @@
+
+import typedef_funcptr.*;
+
+public class typedef_funcptr_runme {
+
+ static {
+ try {
+ System.loadLibrary("typedef_funcptr");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ int a = 100;
+ int b = 10;
+
+ if (typedef_funcptr.do_op(a,b,typedef_funcptr.addf) != 110)
+ throw new RuntimeException("addf failed");
+ if (typedef_funcptr.do_op(a,b,typedef_funcptr.subf) != 90)
+ throw new RuntimeException("subf failed");
+
+ if (typedef_funcptr.do_op_typedef_int(a,b,typedef_funcptr.addf) != 110)
+ throw new RuntimeException("addf failed");
+ if (typedef_funcptr.do_op_typedef_int(a,b,typedef_funcptr.subf) != 90)
+ throw new RuntimeException("subf failed");
+
+ if (typedef_funcptr.do_op_typedef_Integer(a,b,typedef_funcptr.addf) != 110)
+ throw new RuntimeException("addf failed");
+ if (typedef_funcptr.do_op_typedef_Integer(a,b,typedef_funcptr.subf) != 90)
+ throw new RuntimeException("subf failed");
+ }
+}
diff --git a/Examples/test-suite/java/typemap_template_parms_runme.java b/Examples/test-suite/java/typemap_template_parms_runme.java
new file mode 100644
index 000000000..3957ed6d3
--- /dev/null
+++ b/Examples/test-suite/java/typemap_template_parms_runme.java
@@ -0,0 +1,23 @@
+import typemap_template_parms.*;
+
+public class typemap_template_parms_runme {
+
+ static {
+ try {
+ System.loadLibrary("typemap_template_parms");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Xint xint = new Xint();
+ int i = 0;
+ i = xint.bake();
+ i = xint.make();
+ i = xint.lake();
+ i = xint.rake();
+ i = xint.take();
+ }
+}
diff --git a/Examples/test-suite/java_director.i b/Examples/test-suite/java_director.i
index 03d733d6a..6b2cb6dfe 100644
--- a/Examples/test-suite/java_director.i
+++ b/Examples/test-suite/java_director.i
@@ -7,6 +7,7 @@
%module(directors="1") java_director
%typemap(javafinalize) SWIGTYPE %{
+ @SuppressWarnings("deprecation")
protected void finalize() {
// System.out.println("Finalizing " + this);
delete();
diff --git a/Examples/test-suite/java_director_assumeoverride.i b/Examples/test-suite/java_director_assumeoverride.i
index cddebb4d7..f0eb37049 100644
--- a/Examples/test-suite/java_director_assumeoverride.i
+++ b/Examples/test-suite/java_director_assumeoverride.i
@@ -4,7 +4,7 @@
class OverrideMe {
public:
virtual ~OverrideMe() {}
- virtual void func() {};
+ virtual void funk() {};
};
#include "java_director_assumeoverride_wrap.h"
@@ -23,7 +23,7 @@ bool isFuncOverridden(OverrideMe* f) {
class OverrideMe {
public:
virtual ~OverrideMe();
- virtual void func();
+ virtual void funk();
};
bool isFuncOverridden(OverrideMe* f);
diff --git a/Examples/test-suite/java_director_exception_feature.i b/Examples/test-suite/java_director_exception_feature.i
index d6f1e3f55..7978ac2a1 100644
--- a/Examples/test-suite/java_director_exception_feature.i
+++ b/Examples/test-suite/java_director_exception_feature.i
@@ -4,18 +4,11 @@
%warnfilter(SWIGWARN_TYPEMAP_DIRECTORTHROWS_UNDEF) MyNS::Foo::directorthrows_warning;
-%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
-#include <string>
-%}
-
%include <std_string.i>
// DEFINE exceptions in header section using std::runtime_error
%{
+ #include <string>
#include <exception>
#include <iostream>
@@ -39,7 +32,6 @@
%feature("director:except") MyNS::Foo::ping {
jthrowable $error = jenv->ExceptionOccurred();
if ($error) {
- jenv->ExceptionClear(); // clear java exception since mapping to c++ exception
if (Swig::ExceptionMatches(jenv,$error,"$packagepath/MyJavaException1")) {
throw 1;
} else if (Swig::ExceptionMatches(jenv,$error,"$packagepath/MyJavaException2")) {
@@ -68,7 +60,6 @@
%feature("director:except") MyNS::Foo::pong %{
jthrowable $error = jenv->ExceptionOccurred();
if ($error) {
- jenv->ExceptionClear();
$directorthrowshandlers
throw ::MyNS::Unexpected(Swig::JavaExceptionMessage(jenv,$error).message());
}
@@ -118,7 +109,10 @@
%feature("director:except") MyNS::Foo::genericpong {
jthrowable $error = jenv->ExceptionOccurred();
if ($error) {
- jenv->ExceptionClear();
+ if (Swig::ExceptionMatches(jenv,$error,"UnconstructableException")) {
+ // Purposefully test NULL
+ throw Swig::DirectorException(jenv, NULL);
+ }
throw Swig::DirectorException(jenv,$error);
}
}
@@ -128,9 +122,10 @@
%}
%feature ("except",throws="Exception") MyNS::Bar::genericpong %{
- try { $action }
- catch (Swig::DirectorException & direxcp) {
- direxcp.raiseJavaException(jenv); // jenv always available in JNI code
+ try {
+ $action
+ } catch (Swig::DirectorException & direxcp) {
+ direxcp.throwException(jenv); // jenv always available in JNI code
return $null;
}
%}
@@ -170,6 +165,18 @@ namespace MyNS {
%catches(MyNS::Exception1,MyNS::Exception2,MyNS::Unexpected) MyNS::Foo::pong;
%catches(MyNS::Exception1,MyNS::Exception2,MyNS::Unexpected) MyNS::Bar::pong;
+%{
+// throw is deprecated in C++11 and invalid in C++17 and later
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#define throw(TYPE1, TYPE2)
+#else
+#define throw(TYPE1, TYPE2) throw(TYPE1, TYPE2)
+#if defined(_MSC_VER)
+ #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+#endif
+#endif
+%}
+
%inline %{
namespace MyNS {
@@ -182,7 +189,7 @@ public:
virtual std::string ping(int excp) throw(int,MyNS::Exception2) = 0;
virtual std::string pong(int excp) /* throws MyNS::Exception1 MyNS::Exception2 MyNS::Unexpected) */ = 0;
virtual std::string genericpong(int excp) /* unspecified throws - exception is always DirectorException in C++, translated back to whatever thrown in java */ = 0;
- virtual std::string directorthrows_warning(int excp) throw(double) { return std::string(); }
+ virtual std::string directorthrows_warning(int excp) throw(int,double) { return std::string(); }
};
// Make a bar from a foo, so a call to Java Bar
diff --git a/Examples/test-suite/java_director_exception_feature_nspace.i b/Examples/test-suite/java_director_exception_feature_nspace.i
index 264c2a938..b52c1acf4 100644
--- a/Examples/test-suite/java_director_exception_feature_nspace.i
+++ b/Examples/test-suite/java_director_exception_feature_nspace.i
@@ -11,18 +11,11 @@
#define PACKAGESLASH "java_director_exception_feature_nspacePackage/"
%}
-%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
-#include <string>
-%}
-
%include <std_string.i>
// DEFINE exceptions in header section using std::runtime_error
%{
+ #include <string>
#include <exception>
#include <iostream>
@@ -46,7 +39,6 @@
%feature("director:except") MyNS::Foo::ping {
jthrowable $error = jenv->ExceptionOccurred();
if ($error) {
- jenv->ExceptionClear(); // clear java exception since mapping to c++ exception
if (Swig::ExceptionMatches(jenv,$error,"$packagepath/MyNS/MyJavaException1")) {
throw 1;
} else if (Swig::ExceptionMatches(jenv,$error,"$packagepath/MyNS/MyJavaException2")) {
@@ -75,7 +67,6 @@
%feature("director:except") MyNS::Foo::pong %{
jthrowable $error = jenv->ExceptionOccurred();
if ($error) {
- jenv->ExceptionClear();
$directorthrowshandlers
throw ::MyNS::Unexpected(Swig::JavaExceptionMessage(jenv,$error).message());
}
@@ -125,7 +116,10 @@
%feature("director:except") MyNS::Foo::genericpong {
jthrowable $error = jenv->ExceptionOccurred();
if ($error) {
- jenv->ExceptionClear();
+ if (Swig::ExceptionMatches(jenv,$error,"java_director_exception_feature_nspace_UnconstructibleException")) {
+ // Purposefully test NULL
+ throw Swig::DirectorException(jenv, NULL);
+ }
throw Swig::DirectorException(jenv,$error);
}
}
@@ -135,9 +129,10 @@
%}
%feature ("except",throws="Exception") MyNS::Bar::genericpong %{
- try { $action }
- catch (Swig::DirectorException & direxcp) {
- direxcp.raiseJavaException(jenv); // jenv always available in JNI code
+ try {
+ $action
+ } catch (Swig::DirectorException & direxcp) {
+ direxcp.throwException(jenv); // jenv always available in JNI code
return $null;
}
%}
@@ -177,6 +172,18 @@ namespace MyNS {
%catches(MyNS::Exception1,MyNS::Exception2,MyNS::Unexpected) MyNS::Foo::pong;
%catches(MyNS::Exception1,MyNS::Exception2,MyNS::Unexpected) MyNS::Bar::pong;
+%{
+// throw is deprecated in C++11 and invalid in C++17 and later
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#define throw(TYPE1, TYPE2)
+#else
+#define throw(TYPE1, TYPE2) throw(TYPE1, TYPE2)
+#if defined(_MSC_VER)
+ #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+#endif
+#endif
+%}
+
%inline %{
namespace MyNS {
diff --git a/Examples/test-suite/java_director_typemaps.i b/Examples/test-suite/java_director_typemaps.i
index 8d86c59a4..2ffdeae89 100644
--- a/Examples/test-suite/java_director_typemaps.i
+++ b/Examples/test-suite/java_director_typemaps.i
@@ -1,4 +1,5 @@
%module(directors="1") java_director_typemaps
+// Test director reference typemaps in typemaps.i - similar to java_director_typemaps_ptr.i testcase
%feature("director", assumeoverride=1) Quux;
@@ -75,7 +76,7 @@ public:
Quux() {}
virtual ~Quux() {}
- virtual void director_method_bool_output(
+ virtual void director_method_output(
bool& boolarg_output,
signed char& signed_chararg_output,
@@ -117,7 +118,7 @@ public:
doublearg_output = 50;
}
- virtual void director_method_bool_inout(
+ virtual void director_method_inout(
bool& boolarg_inout,
signed char& signed_chararg_inout,
@@ -159,7 +160,7 @@ public:
doublearg_inout = 50;
}
- virtual void director_method_bool_nameless_args(
+ virtual void director_method_nameless_args(
bool& ,
signed char& ,
@@ -185,7 +186,7 @@ public:
void etest() {
bool boolarg_inout = false;
- signed char signed_chararg_inout = 150;
+ signed char signed_chararg_inout = 111;
unsigned char unsigned_chararg_inout = 150;
short shortarg_inout = 150;
@@ -203,7 +204,7 @@ public:
float floatarg_inout = 150;
double doublearg_inout = 150;
- director_method_bool_output(
+ director_method_output(
boolarg_inout,
signed_chararg_inout,
@@ -263,7 +264,7 @@ public:
floatarg_inout = 101;
doublearg_inout = 101;
- director_method_bool_inout(
+ director_method_inout(
boolarg_inout,
signed_chararg_inout,
@@ -303,7 +304,7 @@ public:
verify(floatarg_inout == 111);
verify(doublearg_inout == 112);
- director_method_bool_nameless_args(
+ director_method_nameless_args(
boolarg_inout,
signed_chararg_inout,
diff --git a/Examples/test-suite/java_director_typemaps_ptr.i b/Examples/test-suite/java_director_typemaps_ptr.i
new file mode 100644
index 000000000..578001ac1
--- /dev/null
+++ b/Examples/test-suite/java_director_typemaps_ptr.i
@@ -0,0 +1,433 @@
+%module(directors="1") java_director_typemaps
+// Test director pointer typemaps in typemaps.i - similar to java_director_typemaps.i testcase
+
+%feature("director", assumeoverride=1) Quux;
+
+%include <typemaps.i>
+
+%apply bool* OUTPUT {bool*};
+
+%apply signed char* OUTPUT {signed char*};
+%apply unsigned char* OUTPUT {unsigned char*};
+
+%apply short* OUTPUT {short*};
+%apply unsigned short* OUTPUT {unsigned short*};
+
+%apply int* OUTPUT {int*};
+%apply unsigned int* OUTPUT {unsigned int*};
+
+%apply long* OUTPUT {long*};
+%apply unsigned long* OUTPUT {unsigned long*};
+
+%apply long long* OUTPUT {long long*};
+// %apply unsigned long long* OUTPUT {unsigned long long*};
+
+%apply float* OUTPUT {float*};
+%apply double* OUTPUT {double*};
+
+%apply bool* OUTPUT {bool* boolarg_output};
+
+%apply signed char* OUTPUT {signed char* signed_chararg_output};
+%apply unsigned char* OUTPUT {unsigned char* unsigned_chararg_output};
+
+%apply short* OUTPUT {short* shortarg_output};
+%apply unsigned short* OUTPUT {unsigned short* unsigned_shortarg_output};
+
+%apply int* OUTPUT {int* intarg_output};
+%apply unsigned int* OUTPUT {unsigned int* unsigned_intarg_output};
+
+%apply long* OUTPUT {long* longarg_output};
+%apply unsigned long* OUTPUT {unsigned long* unsigned_longarg_output};
+
+%apply long long* OUTPUT {long long* long_longarg_output};
+// %apply unsigned long long* OUTPUT {unsigned long long* unsigned_long_longarg_output};
+
+%apply float* OUTPUT {float* floatarg_output};
+%apply double* OUTPUT {double* doublearg_output};
+
+%apply bool* INOUT {bool* boolarg_inout};
+
+%apply signed char* INOUT {signed char* signed_chararg_inout};
+%apply unsigned char* INOUT {unsigned char* unsigned_chararg_inout};
+
+%apply short* INOUT {short* shortarg_inout};
+%apply unsigned short* INOUT {unsigned short* unsigned_shortarg_inout};
+
+%apply int* INOUT {int* intarg_inout};
+%apply unsigned int* INOUT {unsigned int* unsigned_intarg_inout};
+
+%apply long* INOUT {long* longarg_inout};
+%apply unsigned long* INOUT {unsigned long* unsigned_longarg_inout};
+
+%apply long long* INOUT {long long* long_longarg_inout};
+// %apply unsigned long long* INOUT {unsigned long long* unsigned_long_longarg_inout};
+
+%apply float* INOUT {float* floatarg_inout};
+%apply double* INOUT {double* doublearg_inout};
+
+%{
+#include <stdexcept>
+#define verify(ok) if (!(ok)) throw std::runtime_error(# ok);
+%}
+%inline %{
+
+class Quux {
+public:
+ Quux() {}
+ virtual ~Quux() {}
+
+ virtual void director_method_output(
+ bool* boolarg_output,
+
+ signed char* signed_chararg_output,
+ unsigned char* unsigned_chararg_output,
+
+ short* shortarg_output,
+ unsigned short* unsigned_shortarg_output,
+
+ int* intarg_output,
+ unsigned int* unsigned_intarg_output,
+
+ long* longarg_output,
+ unsigned long* unsigned_longarg_output,
+
+ long long* long_longarg_output,
+ // unsigned long long* unsigned_long_longarg_output,
+
+ float* floatarg_output,
+ double* doublearg_output)
+ {
+ if (boolarg_output) *boolarg_output = false;
+
+ if (signed_chararg_output) *signed_chararg_output = 50;
+ if (unsigned_chararg_output) *unsigned_chararg_output = 50;
+
+ if (shortarg_output) *shortarg_output = 50;
+ if (unsigned_shortarg_output) *unsigned_shortarg_output = 50;
+
+ if (intarg_output) *intarg_output = 50;
+ if (unsigned_intarg_output) *unsigned_intarg_output = 50;
+
+ if (longarg_output) *longarg_output = 50;
+ if (unsigned_longarg_output) *unsigned_longarg_output = 50;
+
+ if (long_longarg_output) *long_longarg_output = 50;
+ // if (unsigned_long_longarg_output) *unsigned_long_longarg_output = 50;
+
+ if (floatarg_output) *floatarg_output = 50;
+ if (doublearg_output) *doublearg_output = 50;
+ }
+
+ virtual void director_method_inout(
+ bool* boolarg_inout,
+
+ signed char* signed_chararg_inout,
+ unsigned char* unsigned_chararg_inout,
+
+ short* shortarg_inout,
+ unsigned short* unsigned_shortarg_inout,
+
+ int* intarg_inout,
+ unsigned int* unsigned_intarg_inout,
+
+ long* longarg_inout,
+ unsigned long* unsigned_longarg_inout,
+
+ long long* long_longarg_inout,
+ // unsigned long long* unsigned_long_longarg_inout,
+
+ float* floatarg_inout,
+ double* doublearg_inout)
+ {
+ if (boolarg_inout) *boolarg_inout = false;
+
+ if (signed_chararg_inout) *signed_chararg_inout = 50;
+ if (unsigned_chararg_inout) *unsigned_chararg_inout = 50;
+
+ if (shortarg_inout) *shortarg_inout = 50;
+ if (unsigned_shortarg_inout) *unsigned_shortarg_inout = 50;
+
+ if (intarg_inout) *intarg_inout = 50;
+ if (unsigned_intarg_inout) *unsigned_intarg_inout = 50;
+
+ if (longarg_inout) *longarg_inout = 50;
+ if (unsigned_longarg_inout) *unsigned_longarg_inout = 50;
+
+ if (long_longarg_inout) *long_longarg_inout = 50;
+ // if (unsigned_long_longarg_inout) *unsigned_long_longarg_inout = 50;
+
+ if (floatarg_inout) *floatarg_inout = 50;
+ if (doublearg_inout) *doublearg_inout = 50;
+ }
+
+ virtual void director_method_nameless_args(
+ bool* ,
+
+ signed char* ,
+ unsigned char* ,
+
+ short* ,
+ unsigned short* ,
+
+ int* ,
+ unsigned int* ,
+
+ long* ,
+ unsigned long* ,
+
+ long long* ,
+ // unsigned long long* ,
+
+ float* ,
+ double*)
+ {
+ }
+
+ void etest() {
+ bool boolarg_inout = false;
+
+ signed char signed_chararg_inout = 111;
+ unsigned char unsigned_chararg_inout = 150;
+
+ short shortarg_inout = 150;
+ unsigned short unsigned_shortarg_inout = 150;
+
+ int intarg_inout = 150;
+ unsigned int unsigned_intarg_inout = 150;
+
+ long longarg_inout = 150;
+ unsigned long unsigned_longarg_inout = 150;
+
+ long long long_longarg_inout = 150;
+ // unsigned long long unsigned_long_longarg_inout = 150;
+
+ float floatarg_inout = 150;
+ double doublearg_inout = 150;
+
+ director_method_output(
+ &boolarg_inout,
+
+ &signed_chararg_inout,
+ &unsigned_chararg_inout,
+
+ &shortarg_inout,
+ &unsigned_shortarg_inout,
+
+ &intarg_inout,
+ &unsigned_intarg_inout,
+
+ &longarg_inout,
+ &unsigned_longarg_inout,
+
+ &long_longarg_inout,
+ // &unsigned_long_longarg_inout,
+
+ &floatarg_inout,
+ &doublearg_inout);
+
+ verify(boolarg_inout == true);
+ verify(signed_chararg_inout == 1);
+ verify(unsigned_chararg_inout == 2);
+
+ verify(shortarg_inout == 3);
+ verify(unsigned_shortarg_inout == 4);
+
+ verify(intarg_inout == 5);
+ verify(unsigned_intarg_inout == 6);
+
+ verify(longarg_inout == 7);
+ verify(unsigned_longarg_inout == 8);
+
+ verify(long_longarg_inout == 9);
+ // verify(unsigned_long_longarg_inout == 10);
+
+ verify(floatarg_inout == 11);
+ verify(doublearg_inout == 12);
+
+ boolarg_inout = false;
+
+ signed_chararg_inout = 101;
+ unsigned_chararg_inout = 101;
+
+ shortarg_inout = 101;
+ unsigned_shortarg_inout = 101;
+
+ intarg_inout = 101;
+ unsigned_intarg_inout = 101;
+
+ longarg_inout = 101;
+ unsigned_longarg_inout = 101;
+
+ long_longarg_inout = 101;
+ // unsigned_long_longarg_inout = 101;
+
+ floatarg_inout = 101;
+ doublearg_inout = 101;
+
+ director_method_inout(
+ &boolarg_inout,
+
+ &signed_chararg_inout,
+ &unsigned_chararg_inout,
+
+ &shortarg_inout,
+ &unsigned_shortarg_inout,
+
+ &intarg_inout,
+ &unsigned_intarg_inout,
+
+ &longarg_inout,
+ &unsigned_longarg_inout,
+
+ &long_longarg_inout,
+ // &unsigned_long_longarg_inout,
+
+ &floatarg_inout,
+ &doublearg_inout);
+
+ verify(boolarg_inout == false);
+ verify(signed_chararg_inout == 11);
+ verify(unsigned_chararg_inout == 12);
+
+ verify(shortarg_inout == 13);
+ verify(unsigned_shortarg_inout == 14);
+
+ verify(intarg_inout == 15);
+ verify(unsigned_intarg_inout == 16);
+
+ verify(longarg_inout == 17);
+ verify(unsigned_longarg_inout == 18);
+
+ verify(long_longarg_inout == 19);
+ // verify(unsigned_long_longarg_inout == 110);
+
+ verify(floatarg_inout == 111);
+ verify(doublearg_inout == 112);
+
+ director_method_nameless_args(
+ &boolarg_inout,
+
+ &signed_chararg_inout,
+ &unsigned_chararg_inout,
+
+ &shortarg_inout,
+ &unsigned_shortarg_inout,
+
+ &intarg_inout,
+ &unsigned_intarg_inout,
+
+ &longarg_inout,
+ &unsigned_longarg_inout,
+
+ &long_longarg_inout,
+ // &unsigned_long_longarg_inout,
+
+ &floatarg_inout,
+ &doublearg_inout);
+
+ verify(boolarg_inout == true);
+ verify(signed_chararg_inout == 12);
+ verify(unsigned_chararg_inout == 13);
+
+ verify(shortarg_inout == 14);
+ verify(unsigned_shortarg_inout == 15);
+
+ verify(intarg_inout == 16);
+ verify(unsigned_intarg_inout == 17);
+
+ verify(longarg_inout == 18);
+ verify(unsigned_longarg_inout == 19);
+
+ verify(long_longarg_inout == 20);
+ // verify(unsigned_long_longarg_inout == 111);
+
+ verify(floatarg_inout == 112);
+ verify(doublearg_inout == 113);
+ }
+
+ void nulltest() {
+ director_method_output(
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ // NULL,
+
+ NULL,
+ NULL);
+
+ director_method_inout(
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ // NULL,
+
+ NULL,
+ NULL);
+
+ director_method_nameless_args(
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ // NULL,
+
+ NULL,
+ NULL);
+ }
+};
+%}
+
+%clear bool*;
+
+%clear signed char*;
+%clear unsigned char*;
+
+%clear short*;
+%clear unsigned short*;
+
+%clear int*;
+%clear unsigned int*;
+
+%clear long*;
+%clear unsigned long*;
+
+%clear long long*;
+// %clear unsigned long long*;
+
+%clear float*;
+%clear double*;
diff --git a/Examples/test-suite/java_enums.i b/Examples/test-suite/java_enums.i
index 855913d06..cad492652 100644
--- a/Examples/test-suite/java_enums.i
+++ b/Examples/test-suite/java_enums.i
@@ -18,6 +18,21 @@ import java.io.*; // For Serializable
// Set default Java const code generation
%javaconst(1);
+// Test enums with trailing comma after the last item.
+enum WithTrailingComma
+{
+ First,
+ Second,
+};
+
+%ignore ReallyFirstOneIsIgnored;
+enum WithTrailingCommaAndIgnoredFirstItem
+{
+ ReallyFirstOneIsIgnored,
+ FirstNonIgnoredOne,
+ SecondNonIgnoredOne,
+};
+
// Change the default generation so that these enums are generated into an interface instead of a class
%typemap(javaclassmodifiers) enum stuff "public interface"
diff --git a/Examples/test-suite/java_throws.i b/Examples/test-suite/java_throws.i
index 48a0eeabc..6cd47b448 100644
--- a/Examples/test-suite/java_throws.i
+++ b/Examples/test-suite/java_throws.i
@@ -2,6 +2,12 @@
%module java_throws
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+%{
+#define TESTCASE_THROW1(T1)
+%}
+
// Exceptions are chosen at random but are ones which have to have a try catch block to compile
%typemap(in, throws=" ClassNotFoundException") int num {
$1 = (int)$input;
@@ -39,13 +45,7 @@ short full_of_exceptions(int num) {
return $null;
}
%inline %{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-bool throw_spec_function(int value) throw (int) { throw (int)0; }
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+bool throw_spec_function(int value) TESTCASE_THROW1(int) { throw (int)0; }
%}
%catches(int) catches_function(int value);
@@ -126,6 +126,24 @@ JAVAEXCEPTION(FeatureTest::staticMethod)
};
%}
+%include <swiginterface.i>
+%interface_impl(InterfaceTest);
+JAVAEXCEPTION(imethod)
+
+%inline %{
+ struct InterfaceTest {
+ virtual void imethod(bool raise) = 0;
+ virtual ~InterfaceTest() {}
+ };
+
+ struct InterfaceTestImpl : InterfaceTest {
+ void imethod(bool raise) {
+ if (raise)
+ throw MyException("raise message");
+ }
+ };
+%}
+
// Mixing except feature and typemaps when both generate a class for the throws clause
%typemap(in, throws="ClassNotFoundException") int both {
$1 = (int)$input;
@@ -165,6 +183,7 @@ try {
// Need to handle the checked exception in NoExceptTest.delete()
%typemap(javafinalize) SWIGTYPE %{
+ @SuppressWarnings("deprecation")
protected void finalize() {
try {
delete();
diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
index b430f236f..8127415f1 100644
--- a/Examples/test-suite/javascript/Makefile.in
+++ b/Examples/test-suite/javascript/Makefile.in
@@ -66,14 +66,14 @@ ifeq (node,$(JSENGINE))
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='-javascript $(SWIGOPT) -o $*_wrap.cxx $(srcdir)/../$*.i' swiginvoke && \
- $(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
+ MAKEFLAGS= $(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
swig_and_compile_cpp = \
$(setup_node) && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='-c++ -javascript $(SWIGOPT) $(srcdir)/../$*.i' swiginvoke && \
- $(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
+ MAKEFLAGS= $(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
run_testcase = \
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
@@ -83,12 +83,12 @@ ifeq (node,$(JSENGINE))
%.ctest:
$(_setup)
- $(swig_and_compile_c)
+ +$(swig_and_compile_c)
$(run_testcase)
%.cpptest:
$(_setup)
- $(swig_and_compile_cpp)
+ +$(swig_and_compile_cpp)
$(run_testcase)
%.multicpptest:
diff --git a/Examples/test-suite/javascript/complextest_runme.js b/Examples/test-suite/javascript/complextest_runme.js
index b87d6bffa..1d9825f3b 100644
--- a/Examples/test-suite/javascript/complextest_runme.js
+++ b/Examples/test-suite/javascript/complextest_runme.js
@@ -8,8 +8,16 @@ a_c = complextest.Conj(a);
if (a_c.toString() != expected.toString())
throw "Error in Conj(a)";
-a_c_f = complextest.Conjf(a);
-if (a_c_f.toString() != expected.toString())
+a_c = complextest.Conjf(a);
+if (a_c.toString() != expected.toString())
+ throw "Error in Conjf(a)";
+
+a_c = complextest.Conj2(a);
+if (a_c.toString() != expected.toString())
+ throw "Error in Conj(a)";
+
+a_c = complextest.Conjf2(a);
+if (a_c.toString() != expected.toString())
throw "Error in Conjf(a)";
v = new complextest.VectorStdCplx();
@@ -19,4 +27,5 @@ v.add([4,3]);
v.add(1);
// TODO: how to check validity?
-complextest.Copy_h(v);
+complextest.CopyHalf(v);
+complextest.CopyHalfRef(v);
diff --git a/Examples/test-suite/javascript/native_directive_runme.js b/Examples/test-suite/javascript/native_directive_runme.js
new file mode 100644
index 000000000..5c1d69cf1
--- /dev/null
+++ b/Examples/test-suite/javascript/native_directive_runme.js
@@ -0,0 +1,9 @@
+var native_directive = require("native_directive");
+
+(function main() {
+ var s = "abc.DEF-123";
+ if (native_directive.CountAlphas(s) !== 6)
+ throw "CountAlphas failed";
+ if (native_directive.CountAlphaCharacters(s) !== 6)
+ throw "CountAlphaCharacters failed";
+})();
diff --git a/Examples/test-suite/javascript/null_pointer_runme.js b/Examples/test-suite/javascript/null_pointer_runme.js
index 7c0d61244..8a9b61186 100644
--- a/Examples/test-suite/javascript/null_pointer_runme.js
+++ b/Examples/test-suite/javascript/null_pointer_runme.js
@@ -1,6 +1,6 @@
var null_pointer = require("null_pointer");
-if (!null_pointer.func(null)) {
+if (!null_pointer.funk(null)) {
throw new Error("Javascript 'null' should be converted into NULL.");
}
diff --git a/Examples/test-suite/javascript/overload_null_runme.js b/Examples/test-suite/javascript/overload_null_runme.js
new file mode 100644
index 000000000..f1e35cac7
--- /dev/null
+++ b/Examples/test-suite/javascript/overload_null_runme.js
@@ -0,0 +1,49 @@
+// There are no typecheck typemaps in Javascript yet, so most of this test
+// does not actually worked - the check functions have thus been commented out.
+var overload_null = require("overload_null");
+
+var check = function(expected, actual) {
+ if (expected !== actual) {
+ throw new Error(a + " does not equal " + b);
+ }
+};
+
+
+var o = new overload_null.Overload();
+var x = new overload_null.X();
+
+check(1, o.byval1(x));
+// check(2, o.byval1(null));
+
+// check(3, o.byval2(null));
+check(4, o.byval2(x));
+
+check(5, o.byref1(x));
+// check(6, o.byref1(null));
+
+// check(7, o.byref2(null));
+check(8, o.byref2(x));
+
+check(9, o.byconstref1(x));
+// check(10, o.byconstref1(null));
+
+// check(11, o.byconstref2(null));
+check(12, o.byconstref2(x));
+
+// const pointer references
+check(13, o.byval1cpr(x));
+// check(14, o.byval1cpr(null));
+
+// check(15, o.byval2cpr(null));
+check(16, o.byval2cpr(x));
+
+// forward class declaration
+check(17, o.byval1forwardptr(x));
+// check(18, o.byval1forwardptr(null));
+
+// check(19, o.byval2forwardptr(null));
+check(20, o.byval2forwardptr(x));
+
+check(21, o.byval1forwardref(x));
+
+check(22, o.byval2forwardref(x));
diff --git a/Examples/test-suite/javascript/rename1_runme.js b/Examples/test-suite/javascript/rename1_runme.js
index 68ecc11b6..7b2ac37b6 100644
--- a/Examples/test-suite/javascript/rename1_runme.js
+++ b/Examples/test-suite/javascript/rename1_runme.js
@@ -10,7 +10,6 @@ function part1() {
xyz.tMethod2(0);
xyz.tMethodNotXYZ2(notxyz);
xyz.opNotXYZ2();
- xyz.opXYZ2();
}
function part2() {
@@ -23,7 +22,6 @@ function part2() {
xyz.tMethod1(0);
xyz.tMethodNotXYZ1(notxyz);
xyz.opNotXYZ1();
- xyz.opXYZ1();
}
function part3(){
@@ -36,7 +34,6 @@ function part3(){
xyz.tMethod3(new rename.Klass());
xyz.tMethodNotXYZ3(notxyz);
xyz.opNotXYZ3();
- xyz.opXYZ3();
}
function part4() {
@@ -49,7 +46,6 @@ function part4() {
xyz.tMethod4(rename.En1);
xyz.tMethodNotXYZ4(notxyz);
xyz.opNotXYZ4();
- xyz.opXYZ4();
}
function part5() {
diff --git a/Examples/test-suite/javascript/rename2_runme.js b/Examples/test-suite/javascript/rename2_runme.js
index 99f478596..040c798bb 100644
--- a/Examples/test-suite/javascript/rename2_runme.js
+++ b/Examples/test-suite/javascript/rename2_runme.js
@@ -10,7 +10,6 @@ function part1() {
xyz.tMethod2(0);
xyz.tMethodNotXYZ2(notxyz);
xyz.opNotXYZ2();
- xyz.opXYZ2();
}
function part2() {
@@ -23,7 +22,6 @@ function part2() {
xyz.tMethod1(0);
xyz.tMethodNotXYZ1(notxyz);
xyz.opNotXYZ1();
- xyz.opXYZ1();
}
function part3(){
@@ -36,7 +34,6 @@ function part3(){
xyz.tMethod3(new rename.Klass());
xyz.tMethodNotXYZ3(notxyz);
xyz.opNotXYZ3();
- xyz.opXYZ3();
}
function part4() {
@@ -49,7 +46,6 @@ function part4() {
xyz.tMethod4(rename.En1);
xyz.tMethodNotXYZ4(notxyz);
xyz.opNotXYZ4();
- xyz.opXYZ4();
}
function part5() {
diff --git a/Examples/test-suite/javascript/rename3_runme.js b/Examples/test-suite/javascript/rename3_runme.js
index 237029fbb..fb9393b03 100644
--- a/Examples/test-suite/javascript/rename3_runme.js
+++ b/Examples/test-suite/javascript/rename3_runme.js
@@ -10,7 +10,6 @@ function part1() {
xyz.tMethod2(0);
xyz.tMethodNotXYZ2(notxyz);
xyz.opNotXYZ2();
- xyz.opXYZ2();
}
function part2() {
@@ -23,7 +22,6 @@ function part2() {
xyz.tMethod1(0);
xyz.tMethodNotXYZ1(notxyz);
xyz.opNotXYZ1();
- xyz.opXYZ1();
}
function part3(){
@@ -36,7 +34,6 @@ function part3(){
xyz.tMethod3(new rename.Klass());
xyz.tMethodNotXYZ3(notxyz);
xyz.opNotXYZ3();
- xyz.opXYZ3();
}
function part4() {
@@ -49,7 +46,6 @@ function part4() {
xyz.tMethod4(rename.En1);
xyz.tMethodNotXYZ4(notxyz);
xyz.opNotXYZ4();
- xyz.opXYZ4();
}
function part5() {
diff --git a/Examples/test-suite/javascript/rename4_runme.js b/Examples/test-suite/javascript/rename4_runme.js
index fed50dceb..1c3d8e77f 100644
--- a/Examples/test-suite/javascript/rename4_runme.js
+++ b/Examples/test-suite/javascript/rename4_runme.js
@@ -10,7 +10,6 @@ function part1() {
xyz.tMethod2(0);
xyz.tMethodNotXYZ2(notxyz);
xyz.opNotXYZ2();
- xyz.opXYZ2();
}
function part2() {
@@ -23,7 +22,6 @@ function part2() {
xyz.tMethod1(0);
xyz.tMethodNotXYZ1(notxyz);
xyz.opNotXYZ1();
- xyz.opXYZ1();
}
function part3(){
@@ -36,7 +34,6 @@ function part3(){
xyz.tMethod3(new rename.Klass());
xyz.tMethodNotXYZ3(notxyz);
xyz.opNotXYZ3();
- xyz.opXYZ3();
}
function part4() {
@@ -49,7 +46,6 @@ function part4() {
xyz.tMethod4(rename.En1);
xyz.tMethodNotXYZ4(notxyz);
xyz.opNotXYZ4();
- xyz.opXYZ4();
}
function part5() {
diff --git a/Examples/test-suite/javascript/string_simple_runme.js b/Examples/test-suite/javascript/string_simple_runme.js
index 39ae84e9e..71fbb7bd0 100644
--- a/Examples/test-suite/javascript/string_simple_runme.js
+++ b/Examples/test-suite/javascript/string_simple_runme.js
@@ -3,7 +3,7 @@ var string_simple = require("string_simple");
// Test unicode string
var str = "olé";
-var copy = string_simple.copy_string(str);
+var copy = string_simple.copy_str(str);
if (str !== copy) {
throw "Error: copy is not equal: original="+str+", copy="+copy;
diff --git a/Examples/test-suite/keyword_rename.i b/Examples/test-suite/keyword_rename.i
index 46c3338b3..23c01087d 100644
--- a/Examples/test-suite/keyword_rename.i
+++ b/Examples/test-suite/keyword_rename.i
@@ -4,6 +4,8 @@
%module keyword_rename
+%feature("kwargs");
+
#pragma SWIG nowarn=SWIGWARN_PARSE_KEYWORD
%inline %{
diff --git a/Examples/test-suite/li_boost_shared_ptr_bits.i b/Examples/test-suite/li_boost_shared_ptr_bits.i
index b61fd2aa6..7cf84010e 100644
--- a/Examples/test-suite/li_boost_shared_ptr_bits.i
+++ b/Examples/test-suite/li_boost_shared_ptr_bits.i
@@ -4,6 +4,10 @@
#define SHARED_PTR_WRAPPERS_IMPLEMENTED
#endif
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
#if defined(SHARED_PTR_WRAPPERS_IMPLEMENTED)
%include <boost_shared_ptr.i>
diff --git a/Examples/test-suite/li_boost_shared_ptr_director.i b/Examples/test-suite/li_boost_shared_ptr_director.i
new file mode 100644
index 000000000..b2d9fc131
--- /dev/null
+++ b/Examples/test-suite/li_boost_shared_ptr_director.i
@@ -0,0 +1,138 @@
+%module(directors="1") "li_boost_shared_ptr_director"
+
+%{
+#include <boost/shared_ptr.hpp>
+%}
+
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGR)
+#define SHARED_PTR_WRAPPERS_IMPLEMENTED
+#endif
+
+#if defined(SHARED_PTR_WRAPPERS_IMPLEMENTED)
+
+%include <boost_shared_ptr.i>
+%shared_ptr(C);
+%feature("director") Base;
+
+%inline %{
+struct C {
+ C() : m(1) {}
+ C(int n) : m(n) {}
+ int get_m() { return m; }
+private:
+ int m;
+};
+
+struct Base {
+ Base() {}
+ virtual boost::shared_ptr<C> ret_c_shared_ptr() = 0;
+ virtual C ret_c_by_value() = 0;
+ virtual int take_c_by_value(C c) = 0;
+ virtual int take_c_by_ref(C& c) = 0;
+ virtual int take_c_by_pointer(C* c) = 0;
+ virtual int take_c_by_pointer_ref(C*const& c) = 0;
+ virtual int take_c_shared_ptr_by_value(boost::shared_ptr<C> c) = 0;
+ virtual int take_c_shared_ptr_by_ref(boost::shared_ptr<C>& c) = 0;
+ virtual int take_c_shared_ptr_by_pointer(boost::shared_ptr<C>* c) = 0;
+ virtual int take_c_shared_ptr_by_pointer_ref(boost::shared_ptr<C>*const&c) = 0;
+ virtual int take_many_args(
+ C v1, C v2,
+ C &r1, C &r2,
+ C *p1, C *p2,
+ C *const& cr1, C *const& cr2,
+ boost::shared_ptr<C> sv1, boost::shared_ptr<C> sv2,
+ boost::shared_ptr<C> &sr1, boost::shared_ptr<C> &sr2,
+ boost::shared_ptr<C> *sp1, boost::shared_ptr<C> *sp2,
+ boost::shared_ptr<C> *const& spr1, boost::shared_ptr<C> *const& spr2
+ ) = 0;
+ virtual ~Base() {}
+};
+
+int call_ret_c_shared_ptr(Base* b) {
+ boost::shared_ptr<C> ptr = b->ret_c_shared_ptr();
+ if (ptr) {
+ return ptr->get_m();
+ } else {
+ return -1;
+ }
+}
+
+int call_ret_c_by_value(Base* b) {
+ C c = b->ret_c_by_value();
+ return c.get_m();
+}
+
+int call_take_c_by_value(Base* b) {
+ C c(5);
+ return b->take_c_by_value(c);
+}
+
+int call_take_c_by_ref(Base* b) {
+ C c(6);
+ return b->take_c_by_ref(c);
+}
+
+int call_take_c_by_pointer(Base* b) {
+ C c(7);
+ return b->take_c_by_pointer(&c);
+}
+
+int call_take_c_by_pointer_ref(Base* b) {
+ C c(8);
+ C* p(&c);
+ return b->take_c_by_pointer_ref(p);
+}
+
+int call_take_c_by_pointer_with_null(Base* b) {
+ C* p = NULL;
+ return b->take_c_by_pointer(p);
+}
+
+int call_take_c_by_pointer_ref_with_null(Base* b) {
+ C* p = NULL;
+ return b->take_c_by_pointer_ref(p);
+}
+
+int call_take_c_shared_ptr_by_value(Base* b) {
+ boost::shared_ptr<C> ptr(new C(9));
+ return b->take_c_shared_ptr_by_value(ptr);
+}
+
+int call_take_c_shared_ptr_by_value_with_null(Base* b) {
+ boost::shared_ptr<C> ptr;
+ return b->take_c_shared_ptr_by_value(ptr);
+}
+
+int call_take_c_shared_ptr_by_ref(Base* b) {
+ boost::shared_ptr<C> ptr(new C(10));
+ return b->take_c_shared_ptr_by_ref(ptr);
+}
+
+int call_take_c_shared_ptr_by_ref_with_null(Base* b) {
+ boost::shared_ptr<C> ptr;
+ return b->take_c_shared_ptr_by_ref(ptr);
+}
+
+int call_take_c_shared_ptr_by_pointer(Base* b) {
+ boost::shared_ptr<C> ptr(new C(11));
+ return b->take_c_shared_ptr_by_pointer(&ptr);
+}
+
+int call_take_c_shared_ptr_by_pointer_with_null(Base* b) {
+ boost::shared_ptr<C> ptr;
+ return b->take_c_shared_ptr_by_pointer(&ptr);
+}
+
+int call_take_c_shared_ptr_by_pointer_ref(Base* b) {
+ boost::shared_ptr<C> *ptr = new boost::shared_ptr<C>(new C(12));
+ return b->take_c_shared_ptr_by_pointer_ref(ptr);
+}
+
+int call_take_c_shared_ptr_by_pointer_ref_with_null(Base* b) {
+ boost::shared_ptr<C> *ptr = new boost::shared_ptr<C>();
+ return b->take_c_shared_ptr_by_pointer_ref(ptr);
+}
+
+%}
+
+#endif
diff --git a/Examples/test-suite/li_implicit.i b/Examples/test-suite/li_implicit.i
index 0ce10dd6e..9f3ea318b 100644
--- a/Examples/test-suite/li_implicit.i
+++ b/Examples/test-suite/li_implicit.i
@@ -1,4 +1,7 @@
-%module("nocastmode") li_implicit
+%module li_implicit
+
+// Tests nocastmode
+
#pragma SWIG nowarn=SWIGWARN_PP_CPP_WARNING
%include implicit.i
diff --git a/Examples/test-suite/li_std_auto_ptr.i b/Examples/test-suite/li_std_auto_ptr.i
index 5fdc5fa35..5bde387a3 100644
--- a/Examples/test-suite/li_std_auto_ptr.i
+++ b/Examples/test-suite/li_std_auto_ptr.i
@@ -4,6 +4,12 @@
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // auto_ptr deprecation
#endif
+
+#if defined(__clang__)
+#pragma clang diagnostic push
+// Suppress 'auto_ptr<>' is deprecated
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
%}
#if defined(SWIGCSHARP) || defined(SWIGJAVA) || defined(SWIGPYTHON)
@@ -12,11 +18,29 @@
%auto_ptr(Klass)
-%inline %{
-
+%{
+#if __cplusplus < 201703L
#include <memory>
+#else
+// Simple std::auto_ptr implementation for testing after its removal in C++17
+namespace std {
+ template <class T> class auto_ptr {
+ T *ptr;
+ public:
+ auto_ptr(T *ptr = 0) : ptr(ptr) {}
+ auto_ptr(auto_ptr&& a) : ptr(a.ptr) { a.ptr = 0;}
+ ~auto_ptr() { delete ptr; }
+ T *release() { T *p = ptr; ptr = 0; return p; }
+ auto_ptr& operator=(auto_ptr&& a) { if (&a != this) { delete ptr; ptr = a.ptr; a.ptr = 0; } return *this; }
+ };
+}
+#endif
+
#include <string>
#include "swig_examples_lock.h"
+%}
+
+%inline %{
class Klass {
public:
diff --git a/Examples/test-suite/li_std_containers_overload.i b/Examples/test-suite/li_std_containers_overload.i
new file mode 100644
index 000000000..5e7c28e37
--- /dev/null
+++ b/Examples/test-suite/li_std_containers_overload.i
@@ -0,0 +1,33 @@
+%module li_std_containers_overload
+
+// Suppress warning that ought not to appear, but there is no easy fix
+%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) VectorOverload;
+
+%include <std_string.i>
+%include <std_vector.i>
+
+%inline %{
+struct X {};
+struct Y {};
+%}
+
+%template(VectorX) std::vector<X>;
+%template(VectorY) std::vector<Y>;
+%template(VectorString) std::vector<std::string>;
+%template(VectorInt) std::vector<int>;
+
+%inline %{
+using namespace std;
+string VectorOverload(vector<X> v) {
+ return "vector<X>";
+}
+string VectorOverload(vector<Y> v) {
+ return "vector<Y>";
+}
+string VectorOverload(vector<string> v) {
+ return "vector<string>";
+}
+string VectorOverload(vector<int> v) {
+ return "vector<int>";
+}
+%}
diff --git a/Examples/test-suite/li_std_deque.i b/Examples/test-suite/li_std_deque.i
index 152bc86c1..c2f4a7f45 100644
--- a/Examples/test-suite/li_std_deque.i
+++ b/Examples/test-suite/li_std_deque.i
@@ -36,8 +36,8 @@ std::deque<float> half(const std::deque<float>& v) {
}
void halve_in_place(std::deque<double>& v) {
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::deque<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
%}
diff --git a/Examples/test-suite/li_std_except.i b/Examples/test-suite/li_std_except.i
index b79d36bc1..60bce999d 100644
--- a/Examples/test-suite/li_std_except.i
+++ b/Examples/test-suite/li_std_except.i
@@ -2,13 +2,12 @@
%include <std_except.i>
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW1(T1)
%}
-
%inline %{
struct E1 : public std::exception
{
@@ -19,22 +18,23 @@
};
struct Test {
- int foo1() throw(std::bad_exception) { return 0; }
- int foo2() throw(std::logic_error) { return 0; }
- int foo3() throw(E1) { return 0; }
- int foo4() throw(E2) { return 0; }
+ int foo1() TESTCASE_THROW1(std::bad_exception) { return 0; }
+ int foo2() TESTCASE_THROW1(std::logic_error) { return 0; }
+ int foo3() TESTCASE_THROW1(E1) { return 0; }
+ int foo4() TESTCASE_THROW1(E2) { return 0; }
// all the STL exceptions...
- void throw_bad_cast() throw(std::bad_cast) { throw std::bad_cast(); }
- void throw_bad_exception() throw(std::bad_exception) { throw std::bad_exception(); }
- void throw_domain_error() throw(std::domain_error) { throw std::domain_error("oops"); }
- void throw_exception() throw(std::exception) { throw std::exception(); }
- void throw_invalid_argument() throw(std::invalid_argument) { throw std::invalid_argument("oops"); }
- void throw_length_error() throw(std::length_error) { throw std::length_error("oops"); }
- void throw_logic_error() throw(std::logic_error) { throw std::logic_error("oops"); }
- void throw_out_of_range() throw(std::out_of_range) { throw std::out_of_range("oops"); }
- void throw_overflow_error() throw(std::overflow_error) { throw std::overflow_error("oops"); }
- void throw_range_error() throw(std::range_error) { throw std::range_error("oops"); }
- void throw_runtime_error() throw(std::runtime_error) { throw std::runtime_error("oops"); }
- void throw_underflow_error() throw(std::underflow_error) { throw std::underflow_error("oops"); }
+ void throw_bad_cast() TESTCASE_THROW1(std::bad_cast) { throw std::bad_cast(); }
+ void throw_bad_exception() TESTCASE_THROW1(std::bad_exception) { throw std::bad_exception(); }
+ void throw_domain_error() TESTCASE_THROW1(std::domain_error) { throw std::domain_error("oops"); }
+ void throw_exception() TESTCASE_THROW1(std::exception) { throw std::exception(); }
+ void throw_invalid_argument() TESTCASE_THROW1(std::invalid_argument) { throw std::invalid_argument("oops"); }
+ void throw_length_error() TESTCASE_THROW1(std::length_error) { throw std::length_error("oops"); }
+ void throw_logic_error() TESTCASE_THROW1(std::logic_error) { throw std::logic_error("oops"); }
+ void throw_out_of_range() TESTCASE_THROW1(std::out_of_range) { throw std::out_of_range("oops"); }
+ void throw_overflow_error() TESTCASE_THROW1(std::overflow_error) { throw std::overflow_error("oops"); }
+ void throw_range_error() TESTCASE_THROW1(std::range_error) { throw std::range_error("oops"); }
+ void throw_runtime_error() TESTCASE_THROW1(std::runtime_error) { throw std::runtime_error("oops"); }
+ void throw_underflow_error() TESTCASE_THROW1(std::underflow_error) { throw std::underflow_error("oops"); }
};
%}
+
diff --git a/Examples/test-suite/li_std_except_as_class.i b/Examples/test-suite/li_std_except_as_class.i
index 01ed1f07c..3d9706c80 100644
--- a/Examples/test-suite/li_std_except_as_class.i
+++ b/Examples/test-suite/li_std_except_as_class.i
@@ -5,23 +5,23 @@
* if there were also functions throwing 'std::logic_error' and
* 'std::exception' then the bug would not be fully replicated */
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW2(T1, T2)
%}
%{
#include <exception>
#include <stdexcept>
-void test_domain_error() throw(std::domain_error)
+void test_domain_error() TESTCASE_THROW2(std::domain_error, int)
{ throw std::domain_error("std::domain_error"); }
%}
%include <std_string.i>
#define SWIG_STD_EXCEPTIONS_AS_CLASSES
%include <std_except.i>
-void test_domain_error() throw(std::domain_error)
+void test_domain_error() TESTCASE_THROW2(std::domain_error, int)
{ throw std::domain_error("std::domain_error"); }
%inline %{
@@ -31,3 +31,4 @@ bool is_python_builtin() { return true; }
bool is_python_builtin() { return false; }
#endif
%}
+
diff --git a/Examples/test-suite/li_std_list.i b/Examples/test-suite/li_std_list.i
index bae475eea..2ed5b9ad7 100644
--- a/Examples/test-suite/li_std_list.i
+++ b/Examples/test-suite/li_std_list.i
@@ -1,6 +1,7 @@
%module li_std_list
%include "std_list.i"
+%include "std_string.i"
%{
#include <algorithm>
@@ -8,19 +9,18 @@
#include <numeric>
%}
-namespace std {
- %template(IntList) list<int>;
-}
-
+%template(BoolList) std::list<bool>;
+%template(CharList) std::list<char>;
+%template(ShortList) std::list<short>;
+%template(IntList) std::list<int>;
+%template(LongList) std::list<long>;
+%template(UCharList) std::list<unsigned char>;
+%template(UIntList) std::list<unsigned int>;
+%template(UShortList) std::list<unsigned short>;
+%template(ULongList) std::list<unsigned long>;
+%template(FloatList) std::list<float>;
%template(DoubleList) std::list<double>;
-
-%inline %{
-typedef float Real;
-%}
-
-namespace std {
- %template(RealList) list<Real>;
-}
+%template(StringList) std::list<std::string>;
%inline %{
@@ -30,17 +30,43 @@ double average(std::list<int> v) {
void halve_in_place(std::list<double>& v) {
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::list<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
struct Struct {
double num;
Struct() : num(0.0) {}
Struct(double d) : num(d) {}
-// bool operator==(const Struct &other) { return (num == other.num); }
};
-%}
+const std::list<Struct> & CopyContainerStruct(const std::list<Struct> & container) { return container; }
+const std::list<Struct *> & CopyContainerStructPtr(const std::list<Struct *> & container) { return container; }
+const std::list<const Struct *> & CopyContainerStructConstPtr(const std::list<const Struct *> & container) { return container; }
+
+const std::list<float> & listreal(const std::list<float> & list) { return list; }
+
+const std::list<int> & listint(const std::list<int> & list) { return list; }
+const std::list<int *> & listintptr(const std::list<int *> & list) { return list; }
+const std::list<const int *> & listintconstptr(const std::list<const int *> & list) { return list; }
+
+const std::list<Struct> & liststruct(const std::list<Struct> & list) { return list; }
+const std::list<Struct *> & liststructptr(const std::list<Struct *> & list) { return list; }
+const std::list<const Struct *> & liststructconstptr(const std::list<const Struct *> & list) { return list; }
+enum Fruit {
+ APPLE,
+ BANANNA,
+ PEAR,
+ KIWI,
+};
+%}
+#if !defined(SWIGR)
+%template(IntPtrList) std::list<int *>;
+%template(IntConstPtrList) std::list<const int *>;
+#endif
+%template(StructList) std::list<Struct>;
+%template(StructPtrList) std::list<Struct *>;
+%template(StructConstPtrList) std::list<const Struct *>;
+%template(FruitList) std::list<enum Fruit>;
diff --git a/Examples/test-suite/li_std_map.i b/Examples/test-suite/li_std_map.i
index bf24c35e1..161ec6aca 100644
--- a/Examples/test-suite/li_std_map.i
+++ b/Examples/test-suite/li_std_map.i
@@ -1,6 +1,10 @@
%module("templatereduce") li_std_map
%feature("trackobjects");
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%inline %{
namespace another {
struct map {
@@ -117,4 +121,25 @@ namespace std {
}
}
+%ignore LengthCompare::operator();
+%inline %{
+struct LengthCompare {
+ bool operator() (std::string s1, std::string s2) const {
+ return s1.size() < s2.size();
+ }
+};
+%}
+
+// A map sorted by string lengths
+%template(StringLengthNumberMap) std::map< std::string, int, LengthCompare >;
+%inline %{
+std::map< std::string, int, LengthCompare > MyMap;
+void populate(std::map< std::string, int, LengthCompare >&m) {
+ m["aa"] = 2;
+ m["xxxx"] = 4;
+ m["a"] = 1;
+ m["aaaaa"] = 5;
+ m["zzz"] = 3;
+}
+%}
diff --git a/Examples/test-suite/li_std_set.i b/Examples/test-suite/li_std_set.i
index 2dcc2f17c..507272d8d 100644
--- a/Examples/test-suite/li_std_set.i
+++ b/Examples/test-suite/li_std_set.i
@@ -1,5 +1,5 @@
/*
- * a test of set containers.
+ * a test of set containers.
* Languages should define swig::LANGUAGE_OBJ to be
* an entity of their native pointer type which can be
* included in a STL container.
@@ -13,22 +13,42 @@
%include <std_string.i>
%include <std_set.i>
-%include <std_multiset.i>
%include <std_vector.i>
-%template(set_string) std::set<std::string>;
-%template(set_int) std::multiset<int>;
-
-
-%template(v_int) std::vector<int>;
-
-
-
+// Use language macros since Java and C# don't have multiset support (yet)
+// and uses different naming conventions.
+#if defined(SWIGRUBY) || defined(SWIGPYTHON)
+ %include <std_multiset.i>
+ %template(set_int) std::multiset<int>;
+ %template(v_int) std::vector<int>;
+ %template(set_string) std::set<std::string>;
+#elif defined(SWIGJAVA) || defined(SWIGCSHARP)
+ // This operator is only defined because it's needed to store objects of
+ // type Foo in std::set in C++, we don't need to wrap it.
+ %ignore operator<;
+ %inline %{
+ struct Foo
+ {
+ explicit Foo(int n) : n(n) {}
+
+ int n;
+
+ friend bool operator<(Foo foo1, Foo foo2)
+ {
+ return foo1.n < foo2.n;
+ }
+ };
+ %}
+
+ %template(IntSet) std::set<int>;
+ %template(StringSet) std::set<std::string>;
+ %template(FooSet) std::set<Foo>;
+#endif
#if defined(SWIGRUBY)
-%template(LanguageSet) std::set<swig::LANGUAGE_OBJ>;
+%template(LanguageSet) std::set<swig::LANGUAGE_OBJ>;
#endif
#if defined(SWIGPYTHON)
-%template(pyset) std::set<swig::SwigPtr_PyObject>;
+%template(pyset) std::set<swig::SwigPtr_PyObject>;
#endif
diff --git a/Examples/test-suite/li_std_string.i b/Examples/test-suite/li_std_string.i
index a1a55ed85..47a9090b7 100644
--- a/Examples/test-suite/li_std_string.i
+++ b/Examples/test-suite/li_std_string.i
@@ -6,6 +6,11 @@
%apply std::string& INOUT { std::string &inout }
#endif
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+%{
+#define TESTCASE_THROW1(T1)
+%}
%inline %{
@@ -17,6 +22,12 @@ const std::string& test_const_reference(const std::string &x) {
return x;
}
+void test_const_reference_returning_void(const std::string &) {
+}
+
+void test_const_reference_returning_void(const std::string &, int) {
+}
+
void test_pointer(std::string *x) {
}
@@ -49,32 +60,23 @@ void test_reference_inout(std::string &inout) {
inout += inout;
}
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
-void test_throw() throw(std::string){
+void test_throw() TESTCASE_THROW1(std::string){
static std::string x = "test_throw message";
throw x;
}
-void test_const_reference_throw() throw(const std::string &){
+void test_const_reference_throw() TESTCASE_THROW1(const std::string &){
static std::string x = "test_const_reference_throw message";
throw x;
}
-void test_pointer_throw() throw(std::string *) {
+void test_pointer_throw() TESTCASE_THROW1(std::string *) {
throw new std::string("foo");
}
-void test_const_pointer_throw() throw(const std::string *) {
+void test_const_pointer_throw() TESTCASE_THROW1(const std::string *) {
throw new std::string("foo");
}
-
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
%}
/* Old way, now std::string is a %naturalvar by default
@@ -154,6 +156,5 @@ public:
const char *get_null(const char *a) {
return a == 0 ? a : "non-null";
}
-
-
%}
+
diff --git a/Examples/test-suite/li_std_string_extra.i b/Examples/test-suite/li_std_string_extra.i
index 6bef12ff4..1fc2225ca 100644
--- a/Examples/test-suite/li_std_string_extra.i
+++ b/Examples/test-suite/li_std_string_extra.i
@@ -49,6 +49,14 @@ std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_
return x;
}
+std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_basic_overload(std::basic_string<char,std::char_traits<char>,std::allocator<char> > x) {
+ return x;
+}
+
+std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_basic_overload(int) {
+ return "int";
+}
+
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else
diff --git a/Examples/test-suite/li_std_vector.i b/Examples/test-suite/li_std_vector.i
index ada146cc4..33fb79720 100644
--- a/Examples/test-suite/li_std_vector.i
+++ b/Examples/test-suite/li_std_vector.i
@@ -48,8 +48,8 @@ std::vector<Real> half(const std::vector<Real>& v) {
}
void halve_in_place(std::vector<double>& v) {
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
struct Struct {
diff --git a/Examples/test-suite/li_std_vector_back_reference.i b/Examples/test-suite/li_std_vector_back_reference.i
new file mode 100644
index 000000000..be41f4740
--- /dev/null
+++ b/Examples/test-suite/li_std_vector_back_reference.i
@@ -0,0 +1,14 @@
+%module li_std_vector_back_reference
+
+%include <std_vector.i>
+
+%inline %{
+// #include <iostream>
+struct Wheel {
+ int size;
+ Wheel(int sz = 0) : size(sz) {}
+// ~Wheel() { std::cout << "~Wheel" << std::endl; }
+};
+%}
+
+%template(VectorWheel) std::vector<Wheel>;
diff --git a/Examples/test-suite/li_std_vector_extra.i b/Examples/test-suite/li_std_vector_extra.i
index 531898a0e..70b776b37 100644
--- a/Examples/test-suite/li_std_vector_extra.i
+++ b/Examples/test-suite/li_std_vector_extra.i
@@ -12,17 +12,6 @@
#include <algorithm>
#include <functional>
#include <numeric>
-
-
-#if defined(__clang__)
-// Suppress:
-// warning: destination for this 'memset' call is a pointer to dynamic class
-// 'Test::B'; vtable pointer will be overwritten [-Wdynamic-class-memaccess]
-// memset(v_def,0,sizeof(Type));
-// Better generated code is probably needed though
-#pragma clang diagnostic ignored "-Wdynamic-class-memaccess"
-#endif
-
%}
namespace std {
@@ -73,8 +62,8 @@ std::vector<Real> half(const std::vector<Real>& v) {
}
void halve_in_place(std::vector<double>& v) {
- std::transform(v.begin(),v.end(),v.begin(),
- std::bind2nd(std::divides<double>(),2.0));
+ for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
+ *it /= 2.0;
}
%}
@@ -140,6 +129,7 @@ std::vector<std::string> vecStr(std::vector<std::string> v) {
double *makeDoublePtr(double v) { return new double(v); }
int extractInt(int *p) { return *p; }
short extractConstShort(const short *p) { return *p; }
+ short extractConstShort2(std::vector<const short *>::value_type p) { return *p; }
%}
%template(pyvector) std::vector<swig::SwigPtr_PyObject>;
diff --git a/Examples/test-suite/li_std_vector_ptr.i b/Examples/test-suite/li_std_vector_ptr.i
index 4d6794717..dcf1128e0 100644
--- a/Examples/test-suite/li_std_vector_ptr.i
+++ b/Examples/test-suite/li_std_vector_ptr.i
@@ -5,12 +5,29 @@
%template(IntPtrVector) std::vector<int *>;
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%inline %{
#include <iostream>
using namespace std;
int* makeIntPtr(int v) {
return new int(v);
}
+std::vector<int *>::value_type makeIntPtr2(int v) {
+ return new int(v);
+}
+int getIntValue(int *p) {
+ return *p;
+}
+int getIntValue2(std::vector<int *>::const_reference p) {
+ return *p;
+}
+int getIntValue3(std::vector<int *>::reference p) {
+ return *p;
+}
+
double* makeDoublePtr(double v) {
return new double(v);
}
diff --git a/Examples/test-suite/li_std_wstring.i b/Examples/test-suite/li_std_wstring.i
index 80f860338..55d45383e 100644
--- a/Examples/test-suite/li_std_wstring.i
+++ b/Examples/test-suite/li_std_wstring.i
@@ -1,29 +1,18 @@
%module li_std_wstring
-%include <std_basic_string.i>
-%include <std_wstring.i>
+// The languages below are yet to provide std_wstring.i
+#if !(defined(SWIGD) || defined(SWIGGO) || defined(SWIGGUILE) || defined(SWIGJAVASCRIPT) || defined(SWIGLUA) || defined(SWIGMZSCHEME) || defined(SWIGOCAML) || defined(SWIGOCTAVE) || defined(SWIGPERL) || defined(SWIGPHP) || defined(SWIGR) || defined(SWIGSCILAB))
-%inline %{
+%include <std_wstring.i>
-struct A : std::wstring
-{
- A(const std::wstring& s) : std::wstring(s)
- {
- }
-};
-
-struct B
-{
- B(const std::wstring& s) : cname(0), name(s), a(s)
- {
- }
-
- char *cname;
- std::wstring name;
- A a;
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+%{
+#define TESTCASE_THROW1(T1)
+%}
-};
-
+%inline %{
+#include <string>
wchar_t test_wcvalue(wchar_t x) {
return x;
@@ -57,47 +46,31 @@ const std::wstring& test_const_reference(const std::wstring &x) {
void test_pointer(std::wstring *x) {
}
-std::wstring *test_pointer_out() {
- static std::wstring x = L"x";
- return &x;
-}
-
void test_const_pointer(const std::wstring *x) {
}
-const std::wstring *test_const_pointer_out() {
- static std::wstring x = L"x";
- return &x;
-}
-
void test_reference(std::wstring &x) {
}
-std::wstring& test_reference_out() {
- static std::wstring x = L"x";
- return x;
+bool test_equal_abc(const std::wstring &s) {
+ return L"abc" == s;
}
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
-void test_throw() throw(std::wstring){
- static std::wstring x = L"x";
+void test_throw() TESTCASE_THROW1(std::wstring){
+ static std::wstring x = L"throwing test_throw";
throw x;
}
-#if defined(_MSC_VER)
- #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+const char * non_utf8_c_str() {
+ return "h\xe9llo";
+}
-#ifdef SWIGPYTHON_BUILTIN
-bool is_python_builtin() { return true; }
-#else
-bool is_python_builtin() { return false; }
-#endif
+size_t size_wstring(const std::wstring& s) {
+ return s.size();
+}
%}
+#endif
diff --git a/Examples/test-suite/li_std_wstring_inherit.i b/Examples/test-suite/li_std_wstring_inherit.i
new file mode 100644
index 000000000..54c6bd8c4
--- /dev/null
+++ b/Examples/test-suite/li_std_wstring_inherit.i
@@ -0,0 +1,39 @@
+%module li_std_wstring_inherit
+%include <std_basic_string.i>
+%include <std_wstring.i>
+
+
+%inline %{
+
+struct A : std::wstring
+{
+ A(const std::wstring& s) : std::wstring(s)
+ {
+ }
+};
+
+struct B
+{
+ B(const std::wstring& s) : cname(0), name(s), a(s)
+ {
+ }
+
+ char *cname;
+ std::wstring name;
+ A a;
+
+};
+
+std::wstring test_value(std::wstring x) {
+ return x;
+}
+
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+
+%}
+
+
diff --git a/Examples/test-suite/lua/Makefile.in b/Examples/test-suite/lua/Makefile.in
index 7a77bbb9e..63b8692b1 100644
--- a/Examples/test-suite/lua/Makefile.in
+++ b/Examples/test-suite/lua/Makefile.in
@@ -58,9 +58,3 @@ run_testcase = \
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' lua_clean
-
-cvsignore:
- @echo '*wrap* *.so *.dll *.exp *.lib'
- @echo Makefile
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.lua; done
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.lua CVS/Entries ; then echo $${i}_runme.lua; fi; done
diff --git a/Examples/test-suite/lua/abstract_access_runme.lua b/Examples/test-suite/lua/abstract_access_runme.lua
index c1d836136..70467ee2b 100644
--- a/Examples/test-suite/lua/abstract_access_runme.lua
+++ b/Examples/test-suite/lua/abstract_access_runme.lua
@@ -6,7 +6,7 @@ local env = _ENV -- Lua 5.2
if not env then env = getfenv () end -- Lua 5.1
setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
--- trying to instantiate pure virual classes
+-- trying to instantiate pure virtual classes
-- should fail
assert(pcall(abstract_access.A)==false)
assert(pcall(abstract_access.B)==false)
diff --git a/Examples/test-suite/lua/li_std_string_runme.lua b/Examples/test-suite/lua/li_std_string_runme.lua
index 956bea0fc..a36bf7ef6 100644
--- a/Examples/test-suite/lua/li_std_string_runme.lua
+++ b/Examples/test-suite/lua/li_std_string_runme.lua
@@ -32,8 +32,8 @@ assert(is_std_string(cobj) and cobj:c_str()=="x") -- check type & value
test_const_pointer(cobj)
--- this shouldnt work, but it does
--- swig doesnt appear to diff between const object ptrs & object ptrs very well
+-- this shouldn't work, but it does
+-- swig doesn't appear to diff between const object ptrs & object ptrs very well
test_pointer(cobj) -- this wants an non const object (give it a const one!)
-- refs are also wrappered as ptrs (unless the correct typemaps are applied)
diff --git a/Examples/test-suite/lua/newobject2_runme.lua b/Examples/test-suite/lua/newobject2_runme.lua
index cf6c87ae7..748c95372 100644
--- a/Examples/test-suite/lua/newobject2_runme.lua
+++ b/Examples/test-suite/lua/newobject2_runme.lua
@@ -1,8 +1,8 @@
require("import") -- the import fn
import("newobject2",true) -- import code
-foo1 = newobject2.makeFoo() -- lua doesnt yet support static fns properly
-assert(newobject2.fooCount() == 1) -- lua doesnt yet support static fns properly
+foo1 = newobject2.makeFoo() -- lua doesn't yet support static fns properly
+assert(newobject2.fooCount() == 1) -- lua doesn't yet support static fns properly
foo2 = newobject2.makeFoo()
assert(newobject2.fooCount() == 2)
diff --git a/Examples/test-suite/lua/overload_complicated_runme.lua b/Examples/test-suite/lua/overload_complicated_runme.lua
index e8ef43107..3decfa87d 100644
--- a/Examples/test-suite/lua/overload_complicated_runme.lua
+++ b/Examples/test-suite/lua/overload_complicated_runme.lua
@@ -12,11 +12,11 @@ assert(oc.foo(1,1,"test",1) == 15)
p1 = oc.Pop(nil)
p1 = oc.Pop(nil,false)
-assert(p1:hip(true) == 701)
+assert(p1:hip(false) == 701)
assert(p1:hip(nil) == 702)
-assert(p1:hop(true) == 801)
+assert(p1:hop(false) == 801)
assert(p1:hop(nil) == 805)
-assert(oc.muzak(true) == 3001)
+assert(oc.muzak(false) == 3001)
assert(oc.muzak(nil) == 3002)
diff --git a/Examples/test-suite/lua/overload_null_runme.lua b/Examples/test-suite/lua/overload_null_runme.lua
new file mode 100644
index 000000000..69b7de2db
--- /dev/null
+++ b/Examples/test-suite/lua/overload_null_runme.lua
@@ -0,0 +1,41 @@
+require("import") -- the import fn
+import("overload_null") -- import lib into global
+
+o = overload_null.Overload()
+x = overload_null.X()
+
+assert(1 == o:byval1(x))
+assert(2 == o:byval1(nil))
+
+assert(3 == o:byval2(nil))
+assert(4 == o:byval2(x))
+
+assert(5 == o:byref1(x))
+assert(6 == o:byref1(nil))
+
+assert(7 == o:byref2(nil))
+assert(8 == o:byref2(x))
+
+assert(9 == o:byconstref1(x))
+assert(10 == o:byconstref1(nil))
+
+assert(11 == o:byconstref2(nil))
+assert(12 == o:byconstref2(x))
+
+-- const pointer references
+assert(13 == o:byval1cpr(x))
+assert(14 == o:byval1cpr(nil))
+
+assert(15 == o:byval2cpr(nil))
+assert(16 == o:byval2cpr(x))
+
+-- forward class declaration
+assert(17 == o:byval1forwardptr(x))
+assert(18 == o:byval1forwardptr(nil))
+
+assert(19 == o:byval2forwardptr(nil))
+assert(20 == o:byval2forwardptr(x))
+
+assert(21 == o:byval1forwardref(x))
+
+assert(22 == o:byval2forwardref(x))
diff --git a/Examples/test-suite/member_funcptr_galore.i b/Examples/test-suite/member_funcptr_galore.i
index 9a012f306..27c2f02a7 100644
--- a/Examples/test-suite/member_funcptr_galore.i
+++ b/Examples/test-suite/member_funcptr_galore.i
@@ -1,5 +1,17 @@
%module member_funcptr_galore
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) extra2;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) extra3;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) pp2;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) pp3;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) pp5;
+
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ccextra2;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) ccextra3;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc2;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc3;
+%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) cc5;
+
%{
#if defined(__SUNPRO_CC)
#pragma error_messages (off, badargtype2w) /* Formal argument ... is being passed extern "C" ... */
@@ -27,6 +39,8 @@ public:
void move(double dx, double dy);
virtual double area(Shape &ref, int & (FunkSpace::Funktions::*d)(const int &, int)) { return 0.0; }
+ virtual double area_const(Shape &ref, int & (FunkSpace::Funktions::*)(const int &, int) const) { return 0.0; } // Note: unnamed parameter
+ virtual double zyx(int (FunkSpace::Funktions::*)() const) { return 0.0; } // Note: unnamed parameter
virtual double abc(Thing<short> ts, Thing< const Space::Shape * > tda[]) { return 0.0; }
virtual ~Shape() {}
};
@@ -55,6 +69,10 @@ double do_op(Space::Shape *s, double (Space::Shape::*m)(void)) {
return (s->*m)();
}
+double do_op_const(Space::Shape *s, double (Space::Shape::*m)(void) const) {
+ return (s->*m)();
+}
+
double (Space::Shape::*areapt(Space::Shape &ref, int & (FunkSpace::Funktions::*d)(const int &, int)))(Space::Shape &, int & (FunkSpace::Funktions::*d)(const int &, int)) {
return &Space::Shape::area;
}
@@ -75,6 +93,7 @@ double (Space::Shape::*abcvar)(Thing<short>, Thing< const Space::Shape * >[]) =
/* Some constants */
%constant double (Space::Shape::*AREAPT)(Space::Shape &, int & (FunkSpace::Funktions::*)(const int &, int)) = &Space::Shape::area;
+%constant double (Space::Shape::*AREAPT_CONST)(Space::Shape &, int & (FunkSpace::Funktions::*)(const int &, int) const) = &Space::Shape::area_const;
%constant double (Space::Shape::*PERIMPT)(Thing<short>, Thing< const Space::Shape * >[]) = &Space::Shape::abc;
%constant double (Space::Shape::*NULLPT)(void) = 0;
@@ -94,3 +113,115 @@ int call3(int & (FunkSpace::Funktions::*d)(const int &, int), int a, int b) { Fu
int unreal1(double (Space::Shape::*memptr)(Space::Shape &, int & (FunkSpace::Funktions::*)(const int &, int))) { return 0; }
int unreal2(double (Space::Shape::*memptr)(Thing<short>)) { return 0; }
%}
+
+
+%inline %{
+struct Funcs {
+ short FF(bool) { return 0; }
+ short CC(bool) const { return 0; }
+};
+
+class MemberFuncPtrs
+{
+public:
+ // member const function pointers, unnamed parameters
+ int aaa1(short (Funcs::* )(bool) const) const;
+ int aaa2(short (Funcs::* const *&)(bool) const) const;
+ int aaa3(short (Funcs::* *& )(bool) const) const;
+ int aaa4(short (Funcs::* *const& )(bool) const) const;
+ int aaa5(short (Funcs::* & )(bool) const) const;
+ int aaa6(short (Funcs::* const)(bool) const) const;
+ int aaa7(short (Funcs::* const&)(bool) const) const;
+
+ // member non-const function pointers, unnamed parameters
+ int bbb1(short (Funcs::* )(bool)) const;
+ int bbb2(short (Funcs::* const *&)(bool)) const;
+ int bbb3(short (Funcs::* *& )(bool)) const;
+ int bbb4(short (Funcs::* *const& )(bool)) const;
+ int bbb5(short (Funcs::* & )(bool)) const;
+ int bbb6(short (Funcs::* const)(bool)) const;
+ int bbb7(short (Funcs::* const&)(bool)) const;
+
+ // member const function pointers, named parameters
+ int ppp1(short (Funcs::* pp1)(bool) const) const;
+ int ppp2(short (Funcs::* const *& pp2)(bool) const) const;
+ int ppp3(short (Funcs::* *& pp3)(bool) const) const;
+ int ppp4(short (Funcs::* *const& pp4)(bool) const) const;
+ int ppp5(short (Funcs::* & pp5)(bool) const) const;
+ int ppp6(short (Funcs::* const pp6)(bool) const) const;
+ int ppp7(short (Funcs::* const& pp7)(bool) const) const;
+
+ // member non-const function pointers, named parameters
+ int qqq1(short (Funcs::* qq1)(bool)) const;
+ int qqq2(short (Funcs::* const *& qq2)(bool)) const;
+ int qqq3(short (Funcs::* *& qq3)(bool)) const;
+ int qqq4(short (Funcs::* *const& qq4)(bool)) const;
+ int qqq5(short (Funcs::* & qq5)(bool)) const;
+ int qqq6(short (Funcs::* const qq6)(bool)) const;
+ int qqq7(short (Funcs::* const& qq7)(bool)) const;
+};
+
+// member const function pointers, unnamed parameters
+int MemberFuncPtrs::aaa1(short (Funcs::* )(bool) const) const { return 0; }
+int MemberFuncPtrs::aaa2(short (Funcs::* const *&)(bool) const) const { return 0; }
+int MemberFuncPtrs::aaa3(short (Funcs::* *& )(bool) const) const { return 0; }
+int MemberFuncPtrs::aaa4(short (Funcs::* *const& )(bool) const) const { return 0; }
+int MemberFuncPtrs::aaa5(short (Funcs::* & )(bool) const) const { return 0; }
+int MemberFuncPtrs::aaa6(short (Funcs::* const)(bool) const) const { return 0; }
+int MemberFuncPtrs::aaa7(short (Funcs::* const&)(bool) const) const { return 0; }
+
+// member non-const function pointers, unnamed parameters
+int MemberFuncPtrs::bbb1(short (Funcs::* )(bool)) const { return 0; }
+int MemberFuncPtrs::bbb2(short (Funcs::* const *&)(bool)) const { return 0; }
+int MemberFuncPtrs::bbb3(short (Funcs::* *& )(bool)) const { return 0; }
+int MemberFuncPtrs::bbb4(short (Funcs::* *const& )(bool)) const { return 0; }
+int MemberFuncPtrs::bbb5(short (Funcs::* & )(bool)) const { return 0; }
+int MemberFuncPtrs::bbb6(short (Funcs::* const)(bool)) const { return 0; }
+int MemberFuncPtrs::bbb7(short (Funcs::* const&)(bool)) const { return 0; }
+
+// member const function pointers, named parameters
+int MemberFuncPtrs::ppp1(short (Funcs::* pp1)(bool) const) const { return 0; }
+int MemberFuncPtrs::ppp2(short (Funcs::* const *& pp2)(bool) const) const { return 0; }
+int MemberFuncPtrs::ppp3(short (Funcs::* *& pp3)(bool) const) const { return 0; }
+int MemberFuncPtrs::ppp4(short (Funcs::* *const& pp4)(bool) const) const { return 0; }
+int MemberFuncPtrs::ppp5(short (Funcs::* & pp5)(bool) const) const { return 0; }
+int MemberFuncPtrs::ppp6(short (Funcs::* const pp6)(bool) const) const { return 0; }
+int MemberFuncPtrs::ppp7(short (Funcs::* const& pp7)(bool) const) const { return 0; }
+
+// member non-const function pointers, named parameters
+int MemberFuncPtrs::qqq1(short (Funcs::* qq1)(bool)) const { return 0; }
+int MemberFuncPtrs::qqq2(short (Funcs::* const *& qq2)(bool)) const { return 0; }
+int MemberFuncPtrs::qqq3(short (Funcs::* *& qq3)(bool)) const { return 0; }
+int MemberFuncPtrs::qqq4(short (Funcs::* *const& qq4)(bool)) const { return 0; }
+int MemberFuncPtrs::qqq5(short (Funcs::* & qq5)(bool)) const { return 0; }
+int MemberFuncPtrs::qqq6(short (Funcs::* const qq6)(bool)) const { return 0; }
+int MemberFuncPtrs::qqq7(short (Funcs::* const& qq7)(bool)) const { return 0; }
+
+// member non-const function pointer variables
+short (Funcs::* pp1)(bool) = &Funcs::FF;
+
+short (Funcs::* const * extra2)(bool) = &pp1;
+short (Funcs::* * extra3)(bool) = &pp1;
+short (Funcs::* *const extra4)(bool) = &pp1;
+
+short (Funcs::* const *& pp2)(bool) = extra2;
+short (Funcs::* *& pp3)(bool) = extra3;
+short (Funcs::* *const& pp4)(bool) = extra4;
+short (Funcs::* & pp5)(bool) = pp1;
+short (Funcs::* const pp6)(bool) = &Funcs::FF;
+short (Funcs::* const& pp7)(bool) = pp1;
+
+// member const function pointer variables
+short (Funcs::* cc1)(bool) const = &Funcs::CC;
+
+short (Funcs::* const * ccextra2)(bool) const = &cc1;
+short (Funcs::* * ccextra3)(bool) const = &cc1;
+short (Funcs::* *const ccextra4)(bool) const = &cc1;
+
+short (Funcs::* const *& cc2)(bool) const = ccextra2;
+short (Funcs::* *& cc3)(bool) const = ccextra3;
+short (Funcs::* *const& cc4)(bool) const = ccextra4;
+short (Funcs::* & cc5)(bool) const = cc1;
+short (Funcs::* const cc6)(bool) const = &Funcs::CC;
+short (Funcs::* const& cc7)(bool) const = cc1;
+%}
diff --git a/Examples/test-suite/member_pointer.i b/Examples/test-suite/member_pointer.i
index fe454302a..e3b4f85ab 100644
--- a/Examples/test-suite/member_pointer.i
+++ b/Examples/test-suite/member_pointer.i
@@ -44,17 +44,22 @@ public:
virtual double perimeter(void);
};
+/* Typedef */
+typedef double (Shape::*PerimeterFunc_td)(void);
+
extern double do_op(Shape *s, double (Shape::*m)(void));
+extern double do_op_td(Shape *s, PerimeterFunc_td m);
/* Functions that return member pointers */
extern double (Shape::*areapt())(void);
extern double (Shape::*perimeterpt())(void);
+extern PerimeterFunc_td perimeterpt_td();
/* Global variables that are member pointers */
extern double (Shape::*areavar)(void);
extern double (Shape::*perimetervar)(void);
-
+extern PerimeterFunc_td perimetervar_td;
%}
%{
@@ -88,6 +93,10 @@ double do_op(Shape *s, double (Shape::*m)(void)) {
return (s->*m)();
}
+double do_op_td(Shape *s, PerimeterFunc_td m) {
+ return (s->*m)();
+}
+
double (Shape::*areapt())(void) {
return &Shape::area;
}
@@ -96,9 +105,14 @@ double (Shape::*perimeterpt())(void) {
return &Shape::perimeter;
}
+PerimeterFunc_td perimeterpt_td() {
+ return &Shape::perimeter;
+}
+
/* Member pointer variables */
double (Shape::*areavar)(void) = &Shape::area;
double (Shape::*perimetervar)(void) = &Shape::perimeter;
+PerimeterFunc_td perimetervar_td = &Shape::perimeter;
%}
diff --git a/Examples/test-suite/member_pointer_const.i b/Examples/test-suite/member_pointer_const.i
new file mode 100644
index 000000000..4af712f7f
--- /dev/null
+++ b/Examples/test-suite/member_pointer_const.i
@@ -0,0 +1,149 @@
+%module member_pointer_const
+// Same as member_pointer.i but using member pointer const functions
+
+%{
+#if defined(__SUNPRO_CC)
+#pragma error_messages (off, badargtype2w) /* Formal argument ... is being passed extern "C" ... */
+#pragma error_messages (off, wbadinit) /* Using extern "C" ... to initialize ... */
+#pragma error_messages (off, wbadasg) /* Assigning extern "C" ... */
+#endif
+%}
+
+%inline %{
+class Shape {
+public:
+ Shape() {
+ nshapes++;
+ }
+ virtual ~Shape() {
+ nshapes--;
+ };
+ double x, y;
+ double *z;
+
+ void move(double dx, double dy);
+ virtual double area(void) const = 0;
+ virtual double perimeter(void) const = 0;
+ static int nshapes;
+};
+
+class Circle : public Shape {
+private:
+ double radius;
+public:
+ Circle(double r) : radius(r) { };
+ virtual double area(void) const;
+ virtual double perimeter(void) const;
+};
+
+class Square : public Shape {
+private:
+ double width;
+public:
+ Square(double w) : width(w) { };
+ virtual double area(void) const;
+ virtual double perimeter(void) const;
+};
+
+/* Typedef */
+typedef double (Shape::*PerimeterFunc_td)(void) const;
+
+extern double do_op(Shape *s, double (Shape::*m)(void) const);
+extern double do_op_td(Shape *s, PerimeterFunc_td m);
+
+/* Functions that return member pointers */
+
+extern double (Shape::*areapt())(void) const;
+extern double (Shape::*perimeterpt())(void) const;
+extern PerimeterFunc_td perimeterpt_td();
+
+/* Global variables that are member pointers */
+extern double (Shape::*areavar)(void) const;
+extern double (Shape::*perimetervar)(void) const;
+extern PerimeterFunc_td perimetervar_td;
+%}
+
+%{
+# define SWIG_M_PI 3.14159265358979323846
+
+/* Move the shape to a new location */
+void Shape::move(double dx, double dy) {
+ x += dx;
+ y += dy;
+}
+
+int Shape::nshapes = 0;
+
+double Circle::area(void) const {
+ return SWIG_M_PI*radius*radius;
+}
+
+double Circle::perimeter(void) const {
+ return 2*SWIG_M_PI*radius;
+}
+
+double Square::area(void) const {
+ return width*width;
+}
+
+double Square::perimeter(void) const {
+ return 4*width;
+}
+
+double do_op(Shape *s, double (Shape::*m)(void) const) {
+ return (s->*m)();
+}
+
+double do_op_td(Shape *s, PerimeterFunc_td m) {
+ return (s->*m)();
+}
+
+double (Shape::*areapt())(void) const {
+ return &Shape::area;
+}
+
+double (Shape::*perimeterpt())(void) const {
+ return &Shape::perimeter;
+}
+
+PerimeterFunc_td perimeterpt_td() {
+ return &Shape::perimeter;
+}
+
+/* Member pointer variables */
+double (Shape::*areavar)(void) const = &Shape::area;
+double (Shape::*perimetervar)(void) const = &Shape::perimeter;
+PerimeterFunc_td perimetervar_td = &Shape::perimeter;
+%}
+
+
+/* Some constants */
+%constant double (Shape::*AREAPT)(void) const = &Shape::area;
+%constant double (Shape::*PERIMPT)(void) const = &Shape::perimeter;
+%constant double (Shape::*NULLPT)(void) const = 0;
+
+/*
+%inline %{
+ struct Funktions {
+ void retByRef(int & (*d)(double)) {}
+ };
+ void byRef(int & (Funktions::*d)(double)) {}
+%}
+*/
+
+%inline %{
+
+struct Funktions {
+ int addByValue(const int &a, int b) const { return a+b; }
+ int * addByPointer(const int &a, int b) const { static int val; val = a+b; return &val; }
+ int & addByReference(const int &a, int b) const { static int val; val = a+b; return val; }
+};
+
+int call1(int (Funktions::*d)(const int &, int) const, int a, int b) { Funktions f; return (f.*d)(a, b); }
+//int call2(int * (Funktions::*d)(const int &, int) const, int a, int b) { Funktions f; return *(f.*d)(a, b); }
+//int call3(int & (Funktions::*d)(const int &, int) const, int a, int b) { Funktions f; return (f.*d)(a, b); }
+%}
+
+%constant int (Funktions::*ADD_BY_VALUE)(const int &, int) const = &Funktions::addByValue;
+//%constant int * (Funktions::*ADD_BY_POINTER)(const int &, int) const = &Funktions::addByPointer;
+//%constant int & (Funktions::*ADD_BY_REFERENCE)(const int &, int) const = &Funktions::addByReference;
diff --git a/Examples/test-suite/minherit2.i b/Examples/test-suite/minherit2.i
index 7d470d30e..2baea6495 100644
--- a/Examples/test-suite/minherit2.i
+++ b/Examples/test-suite/minherit2.i
@@ -17,8 +17,8 @@
#if defined(SWIGCSHARP)
#define javaclassmodifiers csclassmodifiers
#define javabody csbody
-#define javafinalize csfinalize
-#define javadestruct csdestruct
+#define javafinalize csdispose
+#define javadestruct csdisposing
#define javaout csout
#define javainterfaces csinterfaces
#define javabase csbase
diff --git a/Examples/test-suite/multiple_inheritance_shared_ptr.i b/Examples/test-suite/multiple_inheritance_shared_ptr.i
index 5a08e5e6e..3c061e1a9 100644
--- a/Examples/test-suite/multiple_inheritance_shared_ptr.i
+++ b/Examples/test-suite/multiple_inheritance_shared_ptr.i
@@ -50,9 +50,9 @@
%shared_ptr(Space::Bottom3)
%include "swiginterface.i"
-SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::ABase1)
-SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::CBase1)
-SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::CBase2)
+SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::ABase1)
+SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::CBase1)
+SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::CBase2)
%interface_impl(Space::ABase1)
%interface_impl(Space::CBase1)
%interface_impl(Space::CBase2)
diff --git a/Examples/test-suite/multivalue.i b/Examples/test-suite/multivalue.i
index 59f3d7643..3bc3471a1 100644
--- a/Examples/test-suite/multivalue.i
+++ b/Examples/test-suite/multivalue.i
@@ -11,14 +11,14 @@ back to this behavior, use: */
void divide_l(int a, int b, int *OUTPUT, int *OUTPUT);
-/* Multiple values as vectors. By issueing: */
+/* Multiple values as vectors. By issuing: */
%values_as_vector;
/* vectors instead of lists will be used. */
void divide_v(int a, int b, int *OUTPUT, int *OUTPUT);
/* Multiple values for multiple-value continuations.
- (This is the most elegant way.) By issueing: */
+ (This is the most elegant way.) By issuing: */
%multiple_values;
/* multiple values are passed to the multiple-value
continuation, as created by `call-with-values' or the
@@ -26,6 +26,11 @@ void divide_v(int a, int b, int *OUTPUT, int *OUTPUT);
void divide_mv(int a, int b, int *OUTPUT, int *OUTPUT);
+#else
+%include "typemaps.i"
+void divide_l(int a, int b, int *OUTPUT, int *OUTPUT);
+void divide_v(int a, int b, int *OUTPUT, int *OUTPUT);
+void divide_mv(int a, int b, int *OUTPUT, int *OUTPUT);
#endif
%{
@@ -49,4 +54,3 @@ void divide_mv(int a, int b, int *quotient_p, int *remainder_p)
}
%}
-
diff --git a/Examples/test-suite/mzscheme/Makefile.in b/Examples/test-suite/mzscheme/Makefile.in
index 3e15f8610..6a8ef74e4 100644
--- a/Examples/test-suite/mzscheme/Makefile.in
+++ b/Examples/test-suite/mzscheme/Makefile.in
@@ -10,10 +10,70 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
+FAILING_CPP_TESTS = \
+allowexcept \
+apply_strings \
+arrays_dimensionless \
+arrays_global \
+char_strings \
+chartest \
+class_scope_weird \
+constant_pointers \
+cpp_basic \
+cpp_enum \
+curiously_recurring_template_pattern \
+default_arg_expressions \
+default_constructor \
+derived_nested \
+director_ignore \
+enum_thorough \
+extend \
+friends \
+global_scope_types \
+inherit_member \
+li_attribute \
+li_attribute_template \
+li_boost_shared_ptr \
+li_std_combinations \
+li_std_map \
+li_std_pair \
+li_std_pair_using \
+li_std_string \
+li_std_vector \
+li_windows \
+member_funcptr_galore \
+member_pointer \
+member_pointer_const \
+memberin_extend \
+namespace_spaces \
+naturalvar \
+naturalvar_more \
+nested_class \
+nested_template_base \
+ordering \
+preproc_constants \
+samename \
+static_const_member \
+string_constants \
+template_default2 \
+template_specialization_defarg \
+template_typemaps \
+typemap_variables \
+valuewrapper_opaque \
+
+FAILING_C_TESTS = \
+enums \
+integers \
+preproc_constants_c \
+preproc_line_file \
+
+FAILING_MULTI_CPP_TESTS = \
+multi_import \
+
include $(srcdir)/../common.mk
# Overridden variables here
-# none!
+SWIGOPT += -w524 # Suppress SWIGWARN_LANG_EXPERIMENTAL warning
# Custom tests - tests with additional commandline options
# none!
diff --git a/Examples/test-suite/mzscheme/name_runme.scm b/Examples/test-suite/mzscheme/name_runme.scm
index 1782c6481..94df9131d 100644
--- a/Examples/test-suite/mzscheme/name_runme.scm
+++ b/Examples/test-suite/mzscheme/name_runme.scm
@@ -1,7 +1,7 @@
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module. That's enough for such a simple test.
-(load-extension "./name.so")
+(load-extension "name.so")
(foo-2)
bar-2
diff --git a/Examples/test-suite/mzscheme/unions_runme.scm b/Examples/test-suite/mzscheme/unions_runme.scm
index c44847cfc..1c39cb94c 100644
--- a/Examples/test-suite/mzscheme/unions_runme.scm
+++ b/Examples/test-suite/mzscheme/unions_runme.scm
@@ -25,13 +25,15 @@
(if (not (= Jill1 200))
(begin
(display "Runtime test 1 failed.")
- (exit 1))))
+ (exit 1))
+ (void)))
(let ((Num1 (EmbeddedUnionTest-number-get eut)))
(if (not (= Num1 1))
(begin
(display "Runtime test 2 failed.")
- (exit 1))))
+ (exit 1))
+ (void)))
;; that should do
diff --git a/Examples/test-suite/name_warnings.i b/Examples/test-suite/name_warnings.i
index 3455c03bf..0b62ec5d7 100644
--- a/Examples/test-suite/name_warnings.i
+++ b/Examples/test-suite/name_warnings.i
@@ -40,9 +40,7 @@ namespace std
#endif
virtual ~A() {}
-#ifndef SWIGGO // func is a keyword in Go.
- virtual int func() = 0;
-#endif
+ virtual int funk() = 0;
private:
typedef complex False;
};
diff --git a/Examples/test-suite/namespace_chase.i b/Examples/test-suite/namespace_chase.i
new file mode 100644
index 000000000..5e3921d0d
--- /dev/null
+++ b/Examples/test-suite/namespace_chase.i
@@ -0,0 +1,36 @@
+%module namespace_chase
+
+%inline %{
+ namespace Space1A {
+ struct Struct1A {};
+ namespace Space1B {
+ struct Struct1B {};
+ namespace Space1C {
+ struct Struct1C {};
+ }
+ }
+ }
+ namespace Space2A {
+ using namespace Space1A;
+ namespace Space2B {
+ using namespace Space1B;
+ namespace Space2C {
+ using namespace Space1C;
+ }
+ }
+ }
+ namespace Space3 {
+ using namespace Space2A;
+ void sss3a(Space1A::Struct1A, Space1A::Space1B::Struct1B, Space1A::Space1B::Space1C::Struct1C) {}
+ void sss3b(Struct1A, Space1B::Struct1B, Space1B::Space1C::Struct1C) {}
+ // To fix: the last two parameters below fail and result in SWIGTYPE_ types instead of proxy classes
+ void sss3c(Space2A::Struct1A, Space2A::Space1B::Struct1B, Space2A::Space1B::Space1C::Struct1C) {}
+ }
+ namespace Space4 {
+ using namespace Space2A;
+ using namespace Space2A::Space2B;
+ using namespace Space2A::Space2B::Space2C;
+ void sss4a(Struct1A, Struct1B, Space2C::Struct1C) {}
+ void sss4b(Struct1A, Struct1B, Struct1C) {}
+ }
+%}
diff --git a/Examples/test-suite/namespace_template.i b/Examples/test-suite/namespace_template.i
index a36abb19b..8a4b6dca9 100644
--- a/Examples/test-suite/namespace_template.i
+++ b/Examples/test-suite/namespace_template.i
@@ -2,10 +2,10 @@
%module namespace_template
-%warnfilter(SWIGWARN_RUBY_WRONG_NAME) vector<int>; /* Ruby, wrong class name */
-%warnfilter(SWIGWARN_RUBY_WRONG_NAME) test2::vector<short>; /* Ruby, wrong class name */
-%warnfilter(SWIGWARN_RUBY_WRONG_NAME) test3::vector<long>; /* Ruby, wrong class name */
-%warnfilter(SWIGWARN_RUBY_WRONG_NAME) vector<test4::Integer>; /* Ruby, wrong class name */
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) test::vector<int>; /* Ruby, wrong class name */
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) test::vector<short>; /* Ruby, wrong class name */
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) test::vector<long>; /* Ruby, wrong class name */
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) test::vector<test::Char>; /* Ruby, wrong class name */
%{
#ifdef max
@@ -23,20 +23,9 @@ namespace test {
char * blah(T x) {
return (char *) "vector::blah";
}
+ void vectoruse(vector<T> a, test::vector<T> b) {}
};
}
-
-namespace test2 {
- using namespace test;
-}
-
-namespace test3 {
- using test::max;
- using test::vector;
-}
-
-using namespace test2;
-namespace T4 = test;
%}
namespace test {
@@ -48,6 +37,7 @@ namespace test {
char * blah(T x) {
return (char *) "vector::blah";
}
+ void vectoruse(vector<T> a, test::vector<T> b) {}
};
}
@@ -55,30 +45,26 @@ using namespace test;
%template(maxint) max<int>;
%template(vectorint) vector<int>;
-namespace test2 {
- using namespace test;
+namespace test {
%template(maxshort) max<short>;
%template(vectorshort) vector<short>;
}
-namespace test3 {
- using test::max;
- using test::vector;
+namespace test {
%template(maxlong) max<long>;
%template(vectorlong) vector<long>;
}
%inline %{
-namespace test4 {
- using namespace test;
- typedef int Integer;
+namespace test {
+ typedef char Char;
}
%}
-namespace test4 {
- %template(maxInteger) max<Integer>;
- %template(vectorInteger) vector<Integer>;
+namespace test {
+ %template(maxchar) max<Char>;
+ %template(vectorchar) vector<Char>;
}
diff --git a/Examples/test-suite/native_directive.i b/Examples/test-suite/native_directive.i
new file mode 100644
index 000000000..9ae76e0b7
--- /dev/null
+++ b/Examples/test-suite/native_directive.i
@@ -0,0 +1,102 @@
+%module native_directive
+
+%{
+#include <ctype.h>
+int alpha_count(const char *instring) {
+ int count = 0;
+ const char *s = instring;
+ while (s && *s) {
+ if (isalpha((int)*s))
+ count++;
+ s++;
+ };
+ return count;
+}
+%}
+
+%inline %{
+int CountAlphas(const char *instring) {
+ return alpha_count(instring);
+}
+%}
+
+// Languages that support %native should code up language specific implementations below
+
+#if defined(SWIGJAVA)
+%native(CountAlphaCharacters) int alpha_count(const char *inputString);
+%{
+extern "C" JNIEXPORT jint JNICALL Java_native_1directive_native_1directiveJNI_CountAlphaCharacters(JNIEnv *jenv, jclass jcls, jstring instring) {
+ jint jresult = 0 ;
+ (void)jcls;
+
+ if (instring) {
+ const char *s = (char *)jenv->GetStringUTFChars(instring, 0);
+ if (s) {
+ jresult = (jint)alpha_count(s);
+ jenv->ReleaseStringUTFChars(instring, s);
+ }
+ }
+ return jresult;
+}
+%}
+#endif
+
+
+// TODO: C#
+// TODO: Python
+
+
+#ifdef SWIGJAVASCRIPT
+%native(CountAlphaCharacters) void JavaScript_alpha_count();
+%{
+#ifdef SWIG_V8_VERSION /* engine = node || v8 */
+
+static SwigV8ReturnValue JavaScript_alpha_count(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+ v8::Handle<v8::Value> jsresult;
+ char *arg1 = (char *)0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int result;
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_alpha_count.");
+ res1 = SWIG_AsCharPtrAndSize(args[0], &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1))
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "alpha_count" "', argument " "1"" of type '" "char const *""'");
+ arg1 = reinterpret_cast< char * >(buf1);
+ result = (int)alpha_count((char const *)arg1);
+ jsresult = SWIG_From_int(static_cast< int >(result));
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ SWIGV8_RETURN(jsresult);
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+#else /* engine = jsc */
+
+static JSValueRef JavaScript_alpha_count(JSContextRef context, JSObjectRef function,
+ JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ char *arg1 = (char *)0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int result;
+ JSValueRef jsresult;
+ if (argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+ res1 = SWIG_JSC_AsCharPtrAndSize(context, argv[0], &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1))
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "alpha_count" "', argument " "1"" of type '" "char const *""'");
+ arg1 = reinterpret_cast< char * >(buf1);
+ result = (int)alpha_count((char const *)arg1);
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS(static_cast< int >(result));
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ return jsresult;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+#endif /* engine */
+%}
+#endif /* SWIGJAVASCRIPT */
+
diff --git a/Examples/test-suite/nested.i b/Examples/test-suite/nested.i
index 216ee4224..6c4ffe34a 100644
--- a/Examples/test-suite/nested.i
+++ b/Examples/test-suite/nested.i
@@ -44,42 +44,6 @@ struct OuterStructNamed {
%}
-#if !defined(SWIGSCILAB)
-
-%inline %{
-
-struct OuterStructUnnamed {
- struct {
- double xx;
- } inner_struct_unnamed;
- union {
- double yy;
- int zz;
- } inner_union_unnamed;
-};
-
-typedef struct OuterStruct {
- union {
-
- struct outer_nested_struct {
- union inner_nested_union {
-#define BAD_STYLE 1
- int red;
- struct TestStruct green;
- } InnerNestedUnion;
-
- struct inner_nested_struct {
- int blue;
- } InnerNestedStruct;
- } OuterNestedStruct;
-
- } EmbeddedUnion;
-} OuterStruct;
-
-%}
-
-#else
-
%inline %{
struct OutStUnnamed {
@@ -112,6 +76,51 @@ typedef struct OutSt {
%}
-#endif
+%inline %{
+ typedef struct {
+ union x_union {
+ int x;
+ } duplicate_p;
+ } x_t;
+
+ typedef struct {
+ union y_union {
+ int y;
+ } duplicate_p;
+ } y_t;
+
+ typedef struct A {
+ union a_union {
+ int a;
+ } duplicate_p;
+ } a_t;
+
+ typedef struct B {
+ union b_union {
+ int b;
+ } duplicate_p;
+ } b_t;
+
+ typedef struct {
+ union {
+ int c;
+ } duplicate_p;
+ } c_t;
+
+ typedef struct {
+ union {
+ int d;
+ } duplicate_p;
+ } d_t;
+
+ void set_union_values(int startval, x_t *x, y_t *y, a_t *a, b_t *b, c_t *c, d_t *d) {
+ x->duplicate_p.x = startval++;
+ y->duplicate_p.y = startval++;
+ a->duplicate_p.a = startval++;
+ b->duplicate_p.b = startval++;
+ c->duplicate_p.c = startval++;
+ d->duplicate_p.d = startval++;
+ }
+%}
diff --git a/Examples/test-suite/nested_in_template.i b/Examples/test-suite/nested_in_template.i
new file mode 100644
index 000000000..81d5b6289
--- /dev/null
+++ b/Examples/test-suite/nested_in_template.i
@@ -0,0 +1,34 @@
+%module nested_in_template
+
+#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
+%feature("flatnested");
+#endif
+
+%inline %{
+template <int>
+struct OuterTemplate;
+
+template <>
+struct OuterTemplate<1>
+{
+ struct AbstractBase
+ {
+ virtual bool IsSameAs(const AbstractBase& other) const = 0;
+ virtual ~AbstractBase() {}
+ };
+
+ struct ConcreteDerived : AbstractBase
+ {
+ ConcreteDerived() : m_value(0) {}
+ explicit ConcreteDerived(int value) : m_value(value) {}
+
+ virtual bool IsSameAs(const AbstractBase& other) const {
+ return m_value == static_cast<const ConcreteDerived&>(other).m_value;
+ }
+
+ int m_value;
+ };
+};
+%}
+
+%template(OuterTemplate1) OuterTemplate<1>;
diff --git a/Examples/test-suite/nested_inheritance_interface.i b/Examples/test-suite/nested_inheritance_interface.i
new file mode 100644
index 000000000..f8335c0af
--- /dev/null
+++ b/Examples/test-suite/nested_inheritance_interface.i
@@ -0,0 +1,20 @@
+%module nested_inheritance_interface
+
+%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
+ SWIGWARN_D_MULTIPLE_INHERITANCE,
+ SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
+
+#if defined(SWIGJAVA) || defined(SWIGCSHARP)
+%include "swiginterface.i"
+%interface(IA)
+#endif
+
+#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
+%feature ("flatnested");
+#endif
+
+
+%inline %{
+struct IA {};
+struct B { struct N : IA {}; };
+%}
diff --git a/Examples/test-suite/nested_structs.i b/Examples/test-suite/nested_structs.i
index c70924958..48bd9f2b9 100644
--- a/Examples/test-suite/nested_structs.i
+++ b/Examples/test-suite/nested_structs.i
@@ -12,6 +12,10 @@
#endif
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
// bug #491476
%inline %{
struct Outer {
diff --git a/Examples/test-suite/nested_template_base.i b/Examples/test-suite/nested_template_base.i
index 0b0272224..4d99e8af5 100644
--- a/Examples/test-suite/nested_template_base.i
+++ b/Examples/test-suite/nested_template_base.i
@@ -1,5 +1,9 @@
%module nested_template_base
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%inline %{
template <class T> class OuterT {
public:
diff --git a/Examples/test-suite/newobject3.i b/Examples/test-suite/newobject3.i
new file mode 100644
index 000000000..ef12cd401
--- /dev/null
+++ b/Examples/test-suite/newobject3.i
@@ -0,0 +1,25 @@
+/**
+ * Regression test for PHP bug: https://sourceforge.net/p/swig/bugs/1350/
+ */
+
+%module newobject3
+
+%newobject factory::create;
+%inline %{
+class Product {};
+class factory {
+public:
+ Product * create(short id, short type = 0);
+ Product * create(const char * name, short type = 0);
+};
+%}
+
+%{
+Product * factory::create(short id, short type) {
+ return (id && type >= 0) ? new Product : NULL;
+}
+
+Product * factory::create(const char * name, short type) {
+ return (name && type >= 0) ? new Product : NULL;
+}
+%}
diff --git a/Examples/test-suite/null_pointer.i b/Examples/test-suite/null_pointer.i
index 0da827f99..f40d6929f 100644
--- a/Examples/test-suite/null_pointer.i
+++ b/Examples/test-suite/null_pointer.i
@@ -1,11 +1,9 @@
%module null_pointer
-%warnfilter(SWIGWARN_PARSE_KEYWORD) func; // 'func' is a Go keyword, renamed as 'Xfunc'
-
%inline {
struct A {};
- bool func(A* a) {
+ bool funk(A* a) {
return !a;
}
diff --git a/Examples/test-suite/ocaml/Makefile.in b/Examples/test-suite/ocaml/Makefile.in
index ecdf32e9f..775b1ea71 100644
--- a/Examples/test-suite/ocaml/Makefile.in
+++ b/Examples/test-suite/ocaml/Makefile.in
@@ -3,7 +3,9 @@
#######################################################################
LANGUAGE = ocaml
-OCAMLC = @OCAMLC@
+OCAMLP4WHERE =`$(COMPILETOOL) @CAMLP4@ -where`
+OCC =$(COMPILETOOL) @OCAMLC@
+OCAMLPP = -pp "camlp4o ./swigp4.cmo"
VARIANT = _static
SCRIPTSUFFIX = _runme.ml
@@ -11,67 +13,94 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-C_TEST_CASES =
+FAILING_CPP_TESTS = \
+allprotected \
+apply_signed_char \
+apply_strings \
+cpp_enum \
+default_constructor \
+director_binary_string \
+director_enum \
+director_primitives \
+director_redefined \
+director_string \
+enum_thorough \
+li_windows \
+member_pointer_const \
+preproc_constants \
+smart_pointer_inherit \
+
+FAILING_C_TESTS = \
+enums \
+preproc_constants_c \
+
+CPP_TEST_CASES += \
+ inout \
+
+C_TEST_CASES += \
+ multivalue \
+
+ml_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
run_testcase = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) -a \
- -f $(top_srcdir)/Examples/test-suite/$*.list ] ; then \
- $(COMPILETOOL) $(OCAMLC) -c $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
- $(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./runme; \
- elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- $(COMPILETOOL) $(OCAMLC) -c $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
- $(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme $(srcdir)/$(*).cmo $(srcdir)/$(*)_runme.cmo $(srcdir)/$(*)_wrap.o && \
- $(RUNTOOL) ./runme; \
+ if [ -f $(srcdir)/$(ml_runme) ]; then \
+ if [ $(srcdir) != . ]; then \
+ cp $(srcdir)/$(ml_runme) $(ml_runme); \
+ fi ; \
+ $(OCC) $(OCAMLPP) -c $(ml_runme) && \
+ if [ -f $(top_srcdir)/Examples/test-suite/$*.list ]; then \
+ $(OCC) swig.cmo -custom -g -cc '$(CXX)' -o $*_runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./$*_runme; \
+ else \
+ $(OCC) swig.cmo -custom -g -cc '$(CXX)' -o $*_runme $(*).cmo $(*)_runme.cmo $(*)_wrap.o && $(RUNTOOL) ./$*_runme; \
+ fi ; \
fi ;
-check_quant:
- : > testing
- : > success
- $(MAKE) check
- echo "Failed:" > results
- diff testing success | sed 's/^< //p;d' >> results
- echo "Success:" >> results
- cat success >> results
-
include $(srcdir)/../common.mk
# Overridden variables here
-# none!
+SWIGOPT += -w524 # Suppress SWIGWARN_LANG_EXPERIMENTAL warning
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
%.cpptest:
- echo $@ >> testing
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
- if [ -f $(@:%.cpptest=%_wrap.o) ] ; then \
- echo $@ >> success ; \
- fi
%.ctest:
- echo $@ >> testing
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
- if [ -f $(@:%.ctest=%_wrap.o) ] ; then \
- echo $@ >> success ; \
- fi
%.multicpptest:
- echo $@ >> testing
+$(swig_and_compile_multi_cpp)
$(setup)
$(run_testcase)
- if [ -f $(@:%.multicpptest=%_runtime_wrap.o) ] ; then \
- echo $@ >> success ; \
- fi
+
+swig.cmi:
+ env SWIG_LIB=$(SWIG_LIB_DIR) $(SWIGEXE) -ocaml -co swig.mli
+ $(OCC) -c swig.mli
+swig.cmo:
+ env SWIG_LIB=$(SWIG_LIB_DIR) $(SWIGEXE) -ocaml -co swig.ml
+ $(OCC) -c swig.ml
+swigp4.cmi:
+ env SWIG_LIB=$(SWIG_LIB_DIR) $(SWIGEXE) -ocaml -co swigp4.ml
+ $(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
+extra_objects: swig.cmi swig.cmo swigp4.cmi
+
+$(C_TEST_CASES:=.ctest): extra_objects
+$(CPP_TEST_CASES:=.cpptest): extra_objects
+$(MULTI_CPP_TEST_CASES:=.multicpptest): extra_objects
# Clean
%.clean:
- @rm -f $*.ml $*.mli;
+ @rm -f $*.ml $*.mli $*_runme;
+ @if test $(srcdir) != .; then rm -f $(ml_runme); fi
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' ocaml_clean
+ rm -f clientdata_prop_a.ml clientdata_prop_b.ml import_stl_a.ml import_stl_b.ml
+ rm -f imports_a.ml imports_b.ml mod_a.ml mod_b.ml multi_import_a.ml
+ rm -f multi_import_b.ml packageoption_a.ml packageoption_b.ml packageoption_c.ml
diff --git a/Examples/test-suite/ocaml/abstract_access_runme.ml b/Examples/test-suite/ocaml/abstract_access_runme.ml
new file mode 100644
index 000000000..77ad88667
--- /dev/null
+++ b/Examples/test-suite/ocaml/abstract_access_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Abstract_access
+
+let d = new_D '()
+let _ = assert ((d -> "do_x" () as int) = 1)
diff --git a/Examples/test-suite/ocaml/abstract_typedef2_runme.ml b/Examples/test-suite/ocaml/abstract_typedef2_runme.ml
new file mode 100644
index 000000000..64aa19b91
--- /dev/null
+++ b/Examples/test-suite/ocaml/abstract_typedef2_runme.ml
@@ -0,0 +1,4 @@
+open Swig
+open Abstract_typedef2
+
+let a = new_A_UF '()
diff --git a/Examples/test-suite/ocaml/abstract_typedef_runme.ml b/Examples/test-suite/ocaml/abstract_typedef_runme.ml
new file mode 100644
index 000000000..728c25b3b
--- /dev/null
+++ b/Examples/test-suite/ocaml/abstract_typedef_runme.ml
@@ -0,0 +1,6 @@
+open Swig
+open Abstract_typedef
+
+let e = new_Engine '()
+let a = new_A '()
+let _ = assert ((a -> "write" (e) as bool) = true)
diff --git a/Examples/test-suite/ocaml/abstract_virtual_runme.ml b/Examples/test-suite/ocaml/abstract_virtual_runme.ml
new file mode 100644
index 000000000..60f4f4ab7
--- /dev/null
+++ b/Examples/test-suite/ocaml/abstract_virtual_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Abstract_virtual
+
+let d = new_D '()
+let e = new_E '()
diff --git a/Examples/test-suite/ocaml/aggregate_runme.ml b/Examples/test-suite/ocaml/aggregate_runme.ml
new file mode 100644
index 000000000..f8fff0f30
--- /dev/null
+++ b/Examples/test-suite/ocaml/aggregate_runme.ml
@@ -0,0 +1,15 @@
+open Swig
+open Aggregate
+
+let _ =
+ assert((_move (_UP '()) as int) = (_UP '() as int));
+ assert((_move (_DOWN '()) as int) = (_DOWN '() as int));
+ assert((_move (_LEFT '()) as int) = (_LEFT '() as int));
+ assert((_move (_RIGHT '()) as int) = (_RIGHT '() as int));
+;;
+
+let _ =
+ try
+ _move(0 to int)
+ with Failure _ -> exit 0
+let _ = raise (Failure "0 test failed")
diff --git a/Examples/test-suite/ocaml/allowexcept_runme.ml b/Examples/test-suite/ocaml/allowexcept_runme.ml
new file mode 100644
index 000000000..9c8c9de7f
--- /dev/null
+++ b/Examples/test-suite/ocaml/allowexcept_runme.ml
@@ -0,0 +1,7 @@
+open Swig
+open Allowexcept
+
+let _ =
+ assert (_global_variable '() = C_void);
+ assert (_Foo_static_member_variable '() = C_void)
+;;
diff --git a/Examples/test-suite/ocaml/cast_operator_runme.ml b/Examples/test-suite/ocaml/cast_operator_runme.ml
new file mode 100644
index 000000000..99c390a19
--- /dev/null
+++ b/Examples/test-suite/ocaml/cast_operator_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Cast_operator
+
+let a = new_A '()
+let _ = assert ((a -> "tochar" () as string) = "hi")
diff --git a/Examples/test-suite/ocaml/catches_runme.ml b/Examples/test-suite/ocaml/catches_runme.ml
new file mode 100644
index 000000000..ab38e635d
--- /dev/null
+++ b/Examples/test-suite/ocaml/catches_runme.ml
@@ -0,0 +1,39 @@
+open Swig
+open Catches
+
+let _ =
+ try
+ ignore (_test_catches '(1)); assert false
+ with Failure s ->
+ assert (s = "C++ int exception thrown, value: 1")
+
+ try
+ ignore (_test_catches '(2)); assert false
+ with Failure s ->
+ assert (s = "two")
+
+ try
+ ignore (_test_catches '(3)); assert false
+ with Failure s ->
+ assert (s = "C++ ThreeException const & exception thrown")
+
+ try
+ ignore (_test_exception_specification '(1)); assert false
+ with Failure s ->
+ assert (s = "C++ int exception thrown, value: 1")
+
+ try
+ ignore (_test_exception_specification '(2)); assert false
+ with Failure s ->
+ assert (s = "unknown exception")
+
+ try
+ ignore (_test_exception_specification '(3)); assert false
+ with Failure s ->
+ assert (s = "unknown exception")
+
+ try
+ ignore (_test_catches_all '(1)); assert false
+ with Failure s ->
+ assert (s = "unknown exception")
+;;
diff --git a/Examples/test-suite/ocaml/char_binary_runme.ml b/Examples/test-suite/ocaml/char_binary_runme.ml
new file mode 100644
index 000000000..2d3aba1b3
--- /dev/null
+++ b/Examples/test-suite/ocaml/char_binary_runme.ml
@@ -0,0 +1,24 @@
+open Swig
+open Char_binary
+
+let _ =
+ let t = new_Test '() in
+ assert (t -> strlen ("hile") as int = 4);
+ assert (t -> ustrlen ("hile") as int = 4);
+ assert (t -> strlen ("hil\x00") as int = 4);
+ assert (t -> ustrlen ("hil\x00") as int = 4);
+
+ let pc = _new_pchar '(5) in
+ assert (_pchar_setitem '(pc, 0, 'h') = C_void);
+ assert (_pchar_setitem '(pc, 1, 'o') = C_void);
+ assert (_pchar_setitem '(pc, 2, 'l') = C_void);
+ assert (_pchar_setitem '(pc, 3, 'a') = C_void);
+ assert (_pchar_setitem '(pc, 4, 0) = C_void);
+ assert (t -> strlen (pc) as int = 4);
+ assert (t -> ustrlen (pc) as int = 4);
+ ignore (_var_pchar '(pc));
+ assert (_var_pchar '() as string = "hola");
+ ignore (_var_namet '(pc));
+ assert (_var_namet '() as string = "hola");
+ _delete_pchar(pc)
+;;
diff --git a/Examples/test-suite/ocaml/char_constant_runme.ml b/Examples/test-suite/ocaml/char_constant_runme.ml
new file mode 100644
index 000000000..9d0ce6903
--- /dev/null
+++ b/Examples/test-suite/ocaml/char_constant_runme.ml
@@ -0,0 +1,16 @@
+open Swig
+open Char_constant
+
+let _ =
+ assert (_CHAR_CONSTANT '() as char = 'x');
+ assert (_STRING_CONSTANT '() as string = "xyzzy");
+ assert (_ESC_CONST '() as char = '\x01');
+ assert (_NULL_CONST '() as char = '\x00');
+ assert (_SPECIALCHARA '() as char = 'A');
+ assert (_SPECIALCHARB '() as char = 'B');
+ assert (_SPECIALCHARC '() as char = 'C');
+ assert (_SPECIALCHARD '() as char = 'D');
+ assert (_SPECIALCHARE '() as char = 'E');
+ assert (_ia '() as char = 'a');
+ assert (_ib '() as char = 'b');
+;;
diff --git a/Examples/test-suite/ocaml/chartest_runme.ml b/Examples/test-suite/ocaml/chartest_runme.ml
new file mode 100644
index 000000000..3a2c81d03
--- /dev/null
+++ b/Examples/test-suite/ocaml/chartest_runme.ml
@@ -0,0 +1,25 @@
+open Swig
+open Chartest
+
+let _ =
+ assert (_GetPrintableChar '() as char = 'a');
+ assert (_GetUnprintableChar '() as char = '\127');
+ assert (_printable_global_char '() as char = 'a');
+ assert (_unprintable_global_char '() as char = '\127');
+ assert (_globchar0 '() as char = '\x00');
+ assert (_globchar1 '() as char = '\x01');
+ assert (_globchar2 '() as char = '\n');
+ assert (_globcharA '() as char = 'A');
+ assert (_globcharB '() as char = 'B');
+ assert (_globcharC '() as char = 'C');
+ assert (_globcharD '() as char = 'D');
+ assert (_globcharE '() as char = 'E');
+ assert (_CharTestClass_memberchar0 '() as char = '\x00');
+ assert (_CharTestClass_memberchar1 '() as char = '\x01');
+ assert (_CharTestClass_memberchar2 '() as char = '\n');
+ assert (_CharTestClass_membercharA '() as char = 'A');
+ assert (_CharTestClass_membercharB '() as char = 'B');
+ assert (_CharTestClass_membercharC '() as char = 'C');
+ assert (_CharTestClass_membercharD '() as char = 'D');
+ assert (_CharTestClass_membercharE '() as char = 'E');
+;;
diff --git a/Examples/test-suite/ocaml/class_scope_weird_runme.ml b/Examples/test-suite/ocaml/class_scope_weird_runme.ml
new file mode 100644
index 000000000..de7f457d4
--- /dev/null
+++ b/Examples/test-suite/ocaml/class_scope_weird_runme.ml
@@ -0,0 +1,6 @@
+open Swig
+open Class_scope_weird
+
+let f = new_Foo (C_void)
+let g = new_Foo (C_int 3)
+let _ = assert (get_int ((invoke f) "bar" (C_int 3)) = 3)
diff --git a/Examples/test-suite/ocaml/constover_runme.ml b/Examples/test-suite/ocaml/constover_runme.ml
new file mode 100644
index 000000000..0ca2a5c01
--- /dev/null
+++ b/Examples/test-suite/ocaml/constover_runme.ml
@@ -0,0 +1,16 @@
+open Swig
+open Constover
+
+let test_str = "test" to string
+let _ =
+ assert ((_test (test_str) as string) = "test");
+ assert ((_test_pconst (test_str) as string) = "test_pconst");
+;;
+
+let f = new_Foo '()
+let _ =
+ assert ((f -> "test" (test_str) as string) = "test");
+ assert ((f -> "test_pconst" (test_str) as string) = "test_pconst");
+ assert ((f -> "test_constm" (test_str) as string) = "test_constmethod");
+ assert ((f -> "test_pconstm" (test_str) as string) = "test_pconstmethod");
+;;
diff --git a/Examples/test-suite/ocaml/constructor_rename_runme.ml b/Examples/test-suite/ocaml/constructor_rename_runme.ml
new file mode 100644
index 000000000..5e5553838
--- /dev/null
+++ b/Examples/test-suite/ocaml/constructor_rename_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Constructor_rename
+
+let x = new_RenamedConstructor '()
+let _ = assert ((x -> ":classof" () as string) = "Foo")
diff --git a/Examples/test-suite/ocaml/conversion_runme.ml b/Examples/test-suite/ocaml/conversion_runme.ml
new file mode 100644
index 000000000..8e4c19f2d
--- /dev/null
+++ b/Examples/test-suite/ocaml/conversion_runme.ml
@@ -0,0 +1,9 @@
+open Swig
+open Conversion
+
+let _ =
+ let bar = new_Bar '() in
+ assert (bar -> ":classof" () as string = "Bar");
+ let foo = bar -> toFoo () in
+ assert (foo -> ":classof" () as string = "Foo");
+;;
diff --git a/Examples/test-suite/ocaml/cpp_nodefault_runme.ml b/Examples/test-suite/ocaml/cpp_nodefault_runme.ml
new file mode 100644
index 000000000..a0bd84071
--- /dev/null
+++ b/Examples/test-suite/ocaml/cpp_nodefault_runme.ml
@@ -0,0 +1,17 @@
+open Swig
+open Cpp_nodefault
+
+let foo1 = new_Foo '(1, 2)
+let _ = foo1 -> "[a]" (5)
+let _ = assert ((foo1 -> "[a]" () as int) = 5)
+
+let foo2 = _create '(1, 2)
+let _ = _consume '(foo1,foo2)
+
+let bar1 = new_Bar '()
+let gvar = _gvar '()
+let args = (C_list [ gvar ; foo2 ])
+let _ = bar1 -> "consume" (args)
+let foo3 = bar1 -> "create" (1, 2)
+let _ = foo3 -> "[a]" (6)
+let _ = assert ((foo3 -> "[a]" () as int) = 6)
diff --git a/Examples/test-suite/ocaml/cpp_static_runme.ml b/Examples/test-suite/ocaml/cpp_static_runme.ml
new file mode 100644
index 000000000..9b04abced
--- /dev/null
+++ b/Examples/test-suite/ocaml/cpp_static_runme.ml
@@ -0,0 +1,17 @@
+open Swig
+open Cpp_static
+
+let _ = _StaticFunctionTest_static_func (C_void)
+let _ = _StaticFunctionTest_static_func_2 (C_int 1)
+let _ = _StaticFunctionTest_static_func_3 (C_list [C_int 1; C_int 2])
+
+let _ = assert (get_int (_StaticMemberTest_static_int (C_void)) = 99)
+let _ = _StaticMemberTest_static_int (C_int 10)
+let _ = assert (get_int (_StaticMemberTest_static_int (C_void)) = 10)
+
+let _ = assert (get_int (_StaticBase_statty (C_void)) = 11)
+let _ = assert (get_int (_StaticDerived_statty (C_void)) = 111)
+let _ = _StaticBase_statty (C_int 22)
+let _ = _StaticDerived_statty (C_int 222)
+let _ = assert (get_int (_StaticBase_statty (C_void)) = 22)
+let _ = assert (get_int (_StaticDerived_statty (C_void)) = 222)
diff --git a/Examples/test-suite/ocaml/default_arg_values_runme.ml b/Examples/test-suite/ocaml/default_arg_values_runme.ml
new file mode 100644
index 000000000..e9edcb9d9
--- /dev/null
+++ b/Examples/test-suite/ocaml/default_arg_values_runme.ml
@@ -0,0 +1,17 @@
+open Swig
+open Default_arg_values
+
+let _ =
+ let d = new_Display '() in
+ assert (d -> draw1 () as float = 0.);
+ let arg = C_float 12. in
+ assert (d -> draw1 (arg) as float = 12.);
+ let arg = C_float 123. in
+ let p = _createPtr '(arg) in
+ assert (d -> draw2 () as float = 0.);
+ assert (d -> draw2 (p) as float = 123.);
+ assert (d -> bool0 () as bool = false);
+ assert (d -> bool1 () as bool = true);
+ assert (d -> mybool0 () as bool = false);
+ assert (d -> mybool1 () as bool = true)
+;;
diff --git a/Examples/test-suite/ocaml/default_args_runme.ml b/Examples/test-suite/ocaml/default_args_runme.ml
new file mode 100644
index 000000000..1654b011f
--- /dev/null
+++ b/Examples/test-suite/ocaml/default_args_runme.ml
@@ -0,0 +1,58 @@
+open Swig
+open Default_args
+
+let _ =
+ assert (_anonymous '() as int = 7771);
+ assert (_anonymous '(1234) as int = 1234);
+ assert (_booltest '() as bool = true);
+ assert (_booltest '(true) as bool = true);
+ assert (_booltest '(false) as bool = false);
+ let ec = new_EnumClass '() in
+ assert (ec -> blah () as bool = true);
+ let de = new_DerivedEnumClass '() in
+ assert (de -> accelerate () = C_void);
+ let args = _SLOW '() in
+ assert (de -> accelerate (args) = C_void);
+ assert (_Statics_staticmethod '() as int = 60);
+ assert (_cfunc1 '(1) as float = 2.);
+ assert (_cfunc2 '(1) as float = 3.);
+ assert (_cfunc3 '(1) as float = 4.);
+
+ let f = new_Foo '() in
+ assert (f -> newname () = C_void);
+ assert (f -> newname (1) = C_void);
+ (* TODO: There needs to be a more elegant way to pass NULL/nullptr. *)
+ let args = C_list [ C_int 2 ; C_ptr (0L, 0L) ] in
+ assert (f -> double_if_void_ptr_is_null (args) as int = 4);
+ assert (f -> double_if_void_ptr_is_null (3) as int = 6);
+ let args = C_list [ C_int 4 ; C_ptr (0L, 0L) ] in
+ assert (f -> double_if_handle_is_null (args) as int = 8);
+ assert (f -> double_if_handle_is_null (5) as int = 10);
+ let args = C_list [ C_int 6 ; C_ptr (0L, 0L) ] in
+ assert (f -> double_if_dbl_ptr_is_null (args) as int = 12);
+ assert (f -> double_if_dbl_ptr_is_null (7) as int = 14);
+
+ let k = new_Klass '(22) in
+ let k2 = _Klass_inc (C_list [ C_int 100 ; k ]) in
+ assert (k2 -> "[val]" () as int = 122);
+ let k2 = _Klass_inc '(100) in
+ assert (k2 -> "[val]" () as int = 99);
+ let k2 = _Klass_inc '() in
+ assert (k2 -> "[val]" () as int = 0);
+
+ assert (_seek '() = C_void);
+ assert (_seek (C_int64 10L) = C_void);
+
+ assert (_slightly_off_square '(10) as int = 102);
+ assert (_slightly_off_square '() as int = 291);
+
+ assert (_casts1 '() as char = '\x00');
+ assert (_casts2 '() as string = "Hello");
+ assert (_casts1 '("Ciao") as string = "Ciao");
+ assert (_chartest1 '() as char = 'x');
+ assert (_chartest2 '() as char = '\x00');
+ assert (_chartest3 '() as char = '\x01');
+ assert (_chartest4 '() as char = '\n');
+ assert (_chartest5 '() as char = 'B');
+ assert (_chartest6 '() as char = 'C');
+;;
diff --git a/Examples/test-suite/ocaml/director_default_runme.ml b/Examples/test-suite/ocaml/director_default_runme.ml
new file mode 100644
index 000000000..4fd655a00
--- /dev/null
+++ b/Examples/test-suite/ocaml/director_default_runme.ml
@@ -0,0 +1,25 @@
+open Swig
+open Director_default
+
+let director_default_MyFoo ob meth args =
+ match meth with
+ "Msg" -> (match args with
+ | C_list [ msg ] -> C_string ("director_default_MyFoo-" ^ (msg as string))
+ | _ -> raise (Failure "director_default_MyFoo::Msg()"))
+ | _ -> (invoke ob) meth args
+
+let _ =
+ let a = new_derived_object new_Foo (director_default_MyFoo) '(10) in
+ assert (a -> GetMsg () as string = "director_default_MyFoo-default");
+ assert (a -> GetMsg ("boo") as string = "director_default_MyFoo-boo");
+ let f = new_Foo '(10) in
+ assert (f -> GetMsg () as string = "Foo-default");
+ assert (f -> GetMsg ("boo") as string = "Foo-boo");
+
+ let b = new_Bar '(1) in
+ assert (b -> GetMsg () as string = "Bar-default");
+ assert (b -> GetMsg ("boo") as string = "Bar-boo");
+ let b2 = new_Bar '() in
+ assert (b2 -> GetMsg () as string = "Bar-default");
+ assert (b2 -> GetMsg ("boo") as string = "Bar-boo");
+;;
diff --git a/Examples/test-suite/ocaml/director_exception_catches_runme.ml b/Examples/test-suite/ocaml/director_exception_catches_runme.ml
new file mode 100644
index 000000000..322cdda45
--- /dev/null
+++ b/Examples/test-suite/ocaml/director_exception_catches_runme.ml
@@ -0,0 +1,15 @@
+open Swig
+open Director_exception_catches
+
+exception CustomException of string
+
+let new_MyClass ob meth args =
+ match meth with
+ | "description" -> raise (CustomException "CustomException thrown in description().")
+ | _ -> (invoke ob) meth args
+
+let b = new_derived_object new_BaseClass (new_MyClass) '()
+try
+ ignore (_BaseClass_call_description (b)); assert false
+with CustomException s ->
+ assert (s = "CustomException thrown in description().")
diff --git a/Examples/test-suite/ocaml/director_exception_nothrow_runme.ml b/Examples/test-suite/ocaml/director_exception_nothrow_runme.ml
new file mode 100644
index 000000000..5b2b4b3d2
--- /dev/null
+++ b/Examples/test-suite/ocaml/director_exception_nothrow_runme.ml
@@ -0,0 +1,12 @@
+open Swig
+open Director_exception_nothrow
+
+let _MyBar ob meth args =
+ match meth with
+ | "pang" -> C_string "_MyBar::pang()"
+ | _ -> (invoke ob) meth args
+
+let a = new_derived_object new_Bar (_MyBar) '()
+let _ = assert (_MyBar a "pang" '() as string = "_MyBar::pang()")
+let b = new_Bar '()
+let _ = assert (b -> pang () as string = "Bar::pang()")
diff --git a/Examples/test-suite/ocaml/director_exception_runme.ml b/Examples/test-suite/ocaml/director_exception_runme.ml
new file mode 100644
index 000000000..1cd769b20
--- /dev/null
+++ b/Examples/test-suite/ocaml/director_exception_runme.ml
@@ -0,0 +1,46 @@
+open Swig
+open Director_exception
+
+exception MyException of string * string
+
+let director_exception_MyFoo ob meth args =
+ match meth with
+ "ping" -> raise (Failure "MyFoo::ping() EXCEPTION")
+ | _ -> (invoke ob) meth args
+
+let director_exception_MyFoo2 ob meth args =
+ match meth with
+ "ping" -> (C_bool true)
+ | _ -> (invoke ob) meth args
+
+let director_exception_MyFoo3 ob meth args =
+ match meth with
+ "ping" -> raise (MyException ("foo", "bar"))
+ | _ -> (invoke ob) meth args
+
+(* Check that Failure is raised by MyFoo.ping() (via MyFoo.pong()). *)
+let a =
+ new_derived_object
+ new_Foo (director_exception_MyFoo) '()
+let a = _launder(a)
+try
+ let _ = a -> pong () in assert false
+with Failure s -> assert(s = "MyFoo::ping() EXCEPTION")
+
+let a =
+ new_derived_object
+ new_Foo (director_exception_MyFoo2) '()
+let a = _launder(a)
+try
+ let _ = a -> pong () in assert false
+with Failure s -> assert(s = "No appropriate conversion found.")
+
+let a =
+ new_derived_object
+ new_Foo (director_exception_MyFoo3) '()
+let a = _launder(a)
+try
+ let _ = a -> pong () in assert false
+with MyException (s1, s2) ->
+ assert (s1 = "foo");
+ assert (s2 = "bar");
diff --git a/Examples/test-suite/ocaml/director_frob_runme.ml b/Examples/test-suite/ocaml/director_frob_runme.ml
new file mode 100644
index 000000000..137a88ef3
--- /dev/null
+++ b/Examples/test-suite/ocaml/director_frob_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Director_frob
+
+let foo = new_Bravo '()
+assert (foo -> abs_method () as string = "Bravo::abs_method()")
diff --git a/Examples/test-suite/ocaml/director_ignore_runme.ml b/Examples/test-suite/ocaml/director_ignore_runme.ml
new file mode 100644
index 000000000..b0d3b1451
--- /dev/null
+++ b/Examples/test-suite/ocaml/director_ignore_runme.ml
@@ -0,0 +1,18 @@
+open Swig
+open Director_ignore
+
+let _DIgnoresDerived ob meth args =
+ match meth with
+ | "OverloadedMethod" -> C_int 0
+ | _ -> (invoke ob) meth args
+
+let a =new_derived_object new_DIgnores (_DIgnoresDerived) '()
+let _ = assert (a -> Triple (5) as int = 15)
+
+let _DAbstractIgnoresDerived ob meth args =
+ match meth with
+ | "OverloadedMethod" -> C_int 0
+ | _ -> (invoke ob) meth args
+
+let a = new_derived_object new_DAbstractIgnores (_DAbstractIgnoresDerived) '()
+let _ = assert (a -> Quadruple (5) as int = 20)
diff --git a/Examples/test-suite/ocaml/director_pass_by_value_runme.ml b/Examples/test-suite/ocaml/director_pass_by_value_runme.ml
new file mode 100644
index 000000000..af862f189
--- /dev/null
+++ b/Examples/test-suite/ocaml/director_pass_by_value_runme.ml
@@ -0,0 +1,24 @@
+open Swig
+open Director_pass_by_value
+
+let passByVal = ref [| |]
+
+let director_pass_by_value_Derived ob meth args =
+ match meth with
+ | "virtualMethod" -> passByVal := Array.append !passByVal [|args|]; C_void
+ | _ -> (invoke ob) meth args
+
+let d =
+ new_derived_object
+ new_DirectorPassByValueAbstractBase
+ (director_pass_by_value_Derived)
+ '()
+
+let _ =
+ let caller = new_Caller '() in
+ assert (caller -> call_virtualMethod (d) = C_void);
+ assert (Array.length !passByVal = 1);
+ let a = List.hd (fnhelper (!passByVal.(0))) in
+ assert (a -> getVal () as int = 0x12345678);
+ assert (a -> "~" () = C_void);
+;;
diff --git a/Examples/test-suite/ocaml/director_unroll_runme.ml b/Examples/test-suite/ocaml/director_unroll_runme.ml
new file mode 100644
index 000000000..747d9adf6
--- /dev/null
+++ b/Examples/test-suite/ocaml/director_unroll_runme.ml
@@ -0,0 +1,15 @@
+open Swig
+open Director_unroll
+
+let director_unroll_MyFoo ob meth args =
+ match meth with
+ | "ping" -> C_string "MyFoo::ping()"
+ | _ -> (invoke ob) meth args
+
+let a = new_derived_object
+ new_Foo (director_unroll_MyFoo) '()
+
+let b = new_Bar '()
+let _ = b -> set (a)
+let c = b -> get ()
+let _ = assert ((a -> "&" () as int) = (c -> "&" () as int))
diff --git a/Examples/test-suite/ocaml/dynamic_cast_runme.ml b/Examples/test-suite/ocaml/dynamic_cast_runme.ml
new file mode 100644
index 000000000..54391d9a0
--- /dev/null
+++ b/Examples/test-suite/ocaml/dynamic_cast_runme.ml
@@ -0,0 +1,9 @@
+open Swig
+open Dynamic_cast
+
+let f = new_Foo '()
+let b = new_Bar '()
+
+let x = f -> blah ()
+let y = b -> blah ()
+assert (_do_test '(y) as string = "Bar::test")
diff --git a/Examples/test-suite/ocaml/exception_classname_runme.ml b/Examples/test-suite/ocaml/exception_classname_runme.ml
new file mode 100644
index 000000000..8467ed6e8
--- /dev/null
+++ b/Examples/test-suite/ocaml/exception_classname_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Exception_classname
+
+let a = new_Exception '()
+assert (a -> testfunc () as int = 42)
diff --git a/Examples/test-suite/ocaml/exception_order_runme.ml b/Examples/test-suite/ocaml/exception_order_runme.ml
new file mode 100644
index 000000000..9e987c84b
--- /dev/null
+++ b/Examples/test-suite/ocaml/exception_order_runme.ml
@@ -0,0 +1,17 @@
+open Swig
+open Exception_order
+
+let a = new_A '()
+
+let check meth args expected =
+ try
+ ignore ((invoke a) meth (args)); assert false
+ with Failure msg -> assert (msg = expected)
+
+let _ =
+ check "foo" '() "C++ E1 exception thrown";
+ check "bar" '() "C++ E2 exception thrown";
+ check "foobar" '() "postcatch unknown";
+ check "barfoo" (C_int 1) "C++ E1 exception thrown";
+ check "barfoo" (C_int 2) "C++ E2 * exception thrown";
+;;
diff --git a/Examples/test-suite/ocaml/extend_constructor_destructor_runme.ml b/Examples/test-suite/ocaml/extend_constructor_destructor_runme.ml
new file mode 100644
index 000000000..432d9d7dc
--- /dev/null
+++ b/Examples/test-suite/ocaml/extend_constructor_destructor_runme.ml
@@ -0,0 +1,12 @@
+open Swig
+open Extend_constructor_destructor
+
+let check o v =
+ assert ((o -> "[ivar]" () as int) = v);
+ ignore (o -> "~" ());
+ assert ((_globalVar '() as int) = -v)
+
+let ctors = [new_AStruct; new_BStruct; new_CStruct; new_DStruct; new_EStruct;
+ new_FStruct; new_GStruct]
+
+let _ = List.iteri (fun i c -> let j = succ i in check (c (C_int j)) j) ctors
diff --git a/Examples/test-suite/ocaml/extend_placement_runme.ml b/Examples/test-suite/ocaml/extend_placement_runme.ml
new file mode 100644
index 000000000..31d9ae671
--- /dev/null
+++ b/Examples/test-suite/ocaml/extend_placement_runme.ml
@@ -0,0 +1,53 @@
+open Swig
+open Extend_placement
+
+let _ =
+ let f = new_Foo '() in
+ assert (f -> spam () as int = 1);
+ assert (new_Foo '(1) -> spam () as int = 1);
+ let f = new_Foo '(1, 1) in
+ assert (f -> spam () as int = 1);
+ assert (f -> spam ("hello") as int = 2);
+ assert (f -> spam (1) as int = 1);
+ assert (f -> spam (1, 2) as int = 3);
+ assert (f -> spam (2, 4, 6) as int = 6);
+ assert (f -> spam (f) as int = 0);
+ let arg = C_double 1. in
+ assert (f -> spam (f, arg) as int = 0);
+
+ assert (new_Bar '() -> spam () as int = 1);
+ let b = new_Bar '(1) in
+ assert (b -> spam () as int = 1);
+ assert (b -> spam ("hello") as int = 2);
+ assert (b -> spam (1) as int = 1);
+ assert (b -> spam (1, 2) as int = 3);
+ assert (b -> spam (2, 4, 6) as int = 6);
+ assert (b -> spam (b) as int = 0);
+ let arg = C_double 1. in
+ assert (b -> spam (b, arg) as int = 0);
+
+ assert (new_FooTi '() -> spam () as int = 1);
+ assert (new_FooTi '(1) -> spam () as int = 1);
+ let f = new_FooTi '(1, 1) in
+ assert (f -> spam () as int = 1);
+ assert (f -> spam ("hello") as int = 2);
+ assert (f -> spam (1) as int = 1);
+ assert (f -> spam (1, 2) as int = 3);
+ assert (f -> spam (2, 4, 6) as int = 6);
+ let foo = new_Foo '() in
+ assert (f -> spam (foo) as int = 0);
+ let arg = C_double 1. in
+ assert (f -> spam (foo, arg) as int = 0);
+
+ assert (new_BarTi '() -> spam () as int = 1);
+ let b = new_BarTi '(1) in
+ assert (b -> spam () as int = 1);
+ assert (b -> spam ("hello") as int = 2);
+ assert (b -> spam (1) as int = 1);
+ assert (b -> spam (1, 2) as int = 3);
+ assert (b -> spam (2, 4, 6) as int = 6);
+ let bar = new_Bar '() in
+ assert (b -> spam (bar) as int = 0);
+ let arg = C_double 1. in
+ assert (b -> spam (bar, arg) as int = 0);
+;;
diff --git a/Examples/test-suite/ocaml/extend_runme.ml b/Examples/test-suite/ocaml/extend_runme.ml
new file mode 100644
index 000000000..695282f9c
--- /dev/null
+++ b/Examples/test-suite/ocaml/extend_runme.ml
@@ -0,0 +1,26 @@
+open Swig
+open Extend
+
+let _ =
+ let base1 = new_Base '() and base2 = new_Base '(10) in
+ assert ((base1 -> "[value]" () as int) = 0);
+ assert ((base2 -> "[value]" () as int) = 10);
+ let cint = C_int 5 in
+ assert ((base1 -> "method" (cint) as int) = 5);
+ assert ((_Base_zeroVal '() as int) = 0);
+ assert ((base2 -> "currentValue" () as int) = 10);
+ let cint = C_int 7 in
+ assert ((base2 -> "extendmethod" (cint) as int) = 14);
+;;
+
+let _ =
+ let der1 = new_Derived '(0) and der2 = new_Derived '(17) in
+ assert ((der1 -> "[value]" () as int) = 0);
+ let cint = C_int 5 in
+ assert ((der1 -> "method" (cint) as int) = 10);
+ assert ((der2 -> "[value]" () as int) = 34);
+ let cfloat = C_float 200. in
+ ignore (der2 -> "[extendval]" (cfloat));
+ assert (abs_float ((der2 -> "[actualval]" () as float) -. 2.) < 0.001);
+ assert (abs_float ((der2 -> "[extendval]" () as float) -. 200.) < 0.001);
+;;
diff --git a/Examples/test-suite/ocaml/extend_special_variables_runme.ml b/Examples/test-suite/ocaml/extend_special_variables_runme.ml
new file mode 100644
index 000000000..387d8fd0a
--- /dev/null
+++ b/Examples/test-suite/ocaml/extend_special_variables_runme.ml
@@ -0,0 +1,14 @@
+open Swig
+open Extend_special_variables
+
+let f = new_ForExtensionNewName '()
+let s = f -> "extended_renamed" () as string
+let s2 = f -> "extended_renamed" (10) as string
+
+let _ =
+ assert (s = "name:extended symname:extended_renamed wrapname: overname:__SWIG_0 decl:ForExtension::extended() fulldecl:char const * ForExtension::extended() parentclasssymname:ForExtensionNewName parentclassname:ForExtension")
+ assert (s2 = "name:extended symname:extended_renamed wrapname: overname:__SWIG_1 decl:ForExtension::extended(int) fulldecl:char const * ForExtension::extended(int) parentclasssymname:ForExtensionNewName parentclassname:ForExtension")
+;;
+
+let e = new_ExtendTemplateInt '()
+let _ = e -> "extending" ()
diff --git a/Examples/test-suite/ocaml/extend_template_runme.ml b/Examples/test-suite/ocaml/extend_template_runme.ml
new file mode 100644
index 000000000..2d611a14a
--- /dev/null
+++ b/Examples/test-suite/ocaml/extend_template_runme.ml
@@ -0,0 +1,8 @@
+open Swig
+open Extend_template
+
+let f = new_Foo_0 '()
+let _ =
+ assert((f -> "test1" (37) as int) = 37);
+ assert((f -> "test2" (42) as int) = 42);
+;;
diff --git a/Examples/test-suite/ocaml/extend_typedef_class_runme.ml b/Examples/test-suite/ocaml/extend_typedef_class_runme.ml
new file mode 100644
index 000000000..b5d97e2ad
--- /dev/null
+++ b/Examples/test-suite/ocaml/extend_typedef_class_runme.ml
@@ -0,0 +1,12 @@
+open Swig
+open Extend_typedef_class
+
+let test_obj o v =
+ let cint = C_int v in
+ let _ = o -> "[membervar]" (cint) in
+ assert ((o -> "getvar" () as int) = v)
+
+let ctors = [new_AClass; new_BClass; new_CClass; new_DClass; new_AStruct;
+ new_BStruct; new_CStruct; new_DStruct]
+
+let _ = List.iteri (fun i c -> test_obj (c '()) i) ctors
diff --git a/Examples/test-suite/ocaml/extern_c_runme.ml b/Examples/test-suite/ocaml/extern_c_runme.ml
new file mode 100644
index 000000000..18e672255
--- /dev/null
+++ b/Examples/test-suite/ocaml/extern_c_runme.ml
@@ -0,0 +1,4 @@
+open Swig
+open Extern_c
+
+let _ = _RealFunction '(2)
diff --git a/Examples/test-suite/ocaml/funcptr_cpp_runme.ml b/Examples/test-suite/ocaml/funcptr_cpp_runme.ml
new file mode 100644
index 000000000..bdc077d4e
--- /dev/null
+++ b/Examples/test-suite/ocaml/funcptr_cpp_runme.ml
@@ -0,0 +1,13 @@
+open Swig
+open Funcptr_cpp
+
+let _ =
+ let fp = _ADD_BY_VALUE '() in
+ assert (_call1 '(fp, 10, 11) as int = 21);
+ let fp = _ADD_BY_POINTER '() in
+ assert (_call2 '(fp, 12, 13) as int = 25);
+ let fp = _ADD_BY_REFERENCE '() in
+ assert (_call3 '(fp, 14, 15) as int = 29);
+ let fp = _ADD_BY_VALUE_C '() in
+ assert (_call1 '(fp, 2, 3) as int = 5);
+;;
diff --git a/Examples/test-suite/ocaml/fvirtual_runme.ml b/Examples/test-suite/ocaml/fvirtual_runme.ml
new file mode 100644
index 000000000..6b0782b20
--- /dev/null
+++ b/Examples/test-suite/ocaml/fvirtual_runme.ml
@@ -0,0 +1,10 @@
+open Swig
+open Fvirtual
+
+let _ =
+ let sw = new_NodeSwitch '() and n = new_Node '() in
+ assert (n -> addChild (n) as int = 1);
+ assert (sw -> addChild (n) as int = 2);
+ assert (sw -> addChild (sw) as int = 2);
+ assert (sw -> addChild (n, false) as int = 3)
+;;
diff --git a/Examples/test-suite/ocaml/global_ns_arg_runme.ml b/Examples/test-suite/ocaml/global_ns_arg_runme.ml
new file mode 100644
index 000000000..7717e52d9
--- /dev/null
+++ b/Examples/test-suite/ocaml/global_ns_arg_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Global_ns_arg
+
+let _ = assert ((_foo '(1) as int) = 1)
+let _ = assert ((_bar_fn '() as int) = 1)
diff --git a/Examples/test-suite/ocaml/global_vars_runme.ml b/Examples/test-suite/ocaml/global_vars_runme.ml
new file mode 100644
index 000000000..75df89499
--- /dev/null
+++ b/Examples/test-suite/ocaml/global_vars_runme.ml
@@ -0,0 +1,15 @@
+open Swig
+open Global_vars
+
+_init '()
+
+let _ =
+ assert (_b '() as string = "string b");
+ assert (_b '("a string value") as string = "a string value");
+ assert (_b '() as string = "a string value");
+ assert (_x '() as int = 1234);
+ assert (_x '(9876) as int = 9876);
+ assert (_x '() as int = 9876);
+ assert (_Hi '() as int = 0);
+ assert (_Hola '() as int = 1);
+;;
diff --git a/Examples/test-suite/ocaml/ignore_parameter_runme.ml b/Examples/test-suite/ocaml/ignore_parameter_runme.ml
new file mode 100644
index 000000000..358b25ebb
--- /dev/null
+++ b/Examples/test-suite/ocaml/ignore_parameter_runme.ml
@@ -0,0 +1,20 @@
+open Swig
+open Ignore_parameter
+
+let _ =
+ assert (get_string (_jaguar (C_list [ C_int 200 ; C_float 0. ])) = "hello");
+ assert (get_int (_lotus (C_list [ C_string "fast" ; C_float 0. ])) = 101);
+ assert (get_float (_tvr (C_list [ C_string "fast" ; C_int 200 ])) = 8.8);
+ assert (get_int (_ferrari (C_void)) = 101);
+;;
+let sc = new_SportsCars (C_void)
+let _ =
+ assert (get_string ((invoke sc) "daimler" (C_list [ C_int 200 ; C_float 0. ])) = "hello");
+ assert (get_int ((invoke sc) "astonmartin" (C_list [ C_string "fast" ; C_float 0. ])) = 101);
+ assert (get_float ((invoke sc) "bugatti" (C_list [ C_string "fast" ; C_int 200 ])) = 8.8);
+ assert (get_int ((invoke sc) "lamborghini" (C_void)) = 101);
+;;
+let mc = new_MiniCooper (C_list [ C_int 200 ; C_float 0. ])
+let mm = new_MorrisMinor (C_list [ C_string "slow" ; C_float 0. ])
+let fa = new_FordAnglia (C_list [ C_string "slow" ; C_int 200 ])
+let aa = new_AustinAllegro (C_void)
diff --git a/Examples/test-suite/ocaml/inctest_runme.ml b/Examples/test-suite/ocaml/inctest_runme.ml
new file mode 100644
index 000000000..886751109
--- /dev/null
+++ b/Examples/test-suite/ocaml/inctest_runme.ml
@@ -0,0 +1,7 @@
+open Swig
+open Inctest
+
+let _ = new_A '()
+let _ = new_B '()
+let _ = assert (_importtest1 '(5) as int = 15)
+let _ = assert (_importtest2 '("black") as string = "white")
diff --git a/Examples/test-suite/ocaml/inherit_missing_runme.ml b/Examples/test-suite/ocaml/inherit_missing_runme.ml
new file mode 100644
index 000000000..3d1901356
--- /dev/null
+++ b/Examples/test-suite/ocaml/inherit_missing_runme.ml
@@ -0,0 +1,10 @@
+open Swig
+open Inherit_missing
+
+let _ =
+ let a = _new_Foo '() and b = new_Bar '() and c = new_Spam '() in
+ assert (_do_blah '(a) as string = "Foo::blah");
+ assert (_do_blah '(b) as string = "Bar::blah");
+ assert (_do_blah '(c) as string = "Spam::blah");
+ assert (_delete_Foo '(a) = C_void)
+;;
diff --git a/Examples/test-suite/ocaml/inout_runme.ml b/Examples/test-suite/ocaml/inout_runme.ml
new file mode 100644
index 000000000..767bb43e6
--- /dev/null
+++ b/Examples/test-suite/ocaml/inout_runme.ml
@@ -0,0 +1,8 @@
+open Swig
+open Inout
+
+let _ =
+ assert (_AddOne1 '(1.) as float = 2.);
+ assert (_AddOne3 '(1, 1, 1) = C_list ['2.;'2.;'2.]);
+ assert (_AddOne1r '(1.) as float = 2.);
+;;
diff --git a/Examples/test-suite/ocaml/li_cpointer_cpp_runme.ml b/Examples/test-suite/ocaml/li_cpointer_cpp_runme.ml
new file mode 100644
index 000000000..1daf6b5bd
--- /dev/null
+++ b/Examples/test-suite/ocaml/li_cpointer_cpp_runme.ml
@@ -0,0 +1,10 @@
+open Swig
+open Li_cpointer_cpp
+
+let _ =
+ let p = _new_intp '() in
+ assert (_intp_value '(p) as int = 0);
+ assert (_intp_assign '(p, 3) = C_void);
+ assert (_intp_value '(p) as int = 3);
+ assert (_delete_intp '(p) = C_void)
+;;
diff --git a/Examples/test-suite/ocaml/li_std_except_runme.ml b/Examples/test-suite/ocaml/li_std_except_runme.ml
new file mode 100644
index 000000000..e6ad14dc3
--- /dev/null
+++ b/Examples/test-suite/ocaml/li_std_except_runme.ml
@@ -0,0 +1,18 @@
+open Swig
+open Li_std_except
+
+let _ =
+ let t = new_Test '() in
+ try let _ = t -> throw_bad_cast () in assert false with Failure s -> ();
+ try let _ = t -> throw_bad_exception () in assert false with Failure s -> ();
+ try let _ = t -> throw_domain_error () in assert false with Failure s -> assert (s = "oops");
+ try let _ = t -> throw_exception () in assert false with Failure s -> ();
+ try let _ = t -> throw_invalid_argument () in assert false with Invalid_argument s -> assert (s = "oops");
+ try let _ = t -> throw_length_error () in assert false with Failure s -> assert (s = "oops");
+ try let _ = t -> throw_logic_error () in assert false with Failure s -> assert (s = "oops");
+ try let _ = t -> throw_out_of_range () in assert false with Failure s -> assert (s = "oops");
+ try let _ = t -> throw_overflow_error () in assert false with Failure s -> assert (s = "oops");
+ try let _ = t -> throw_range_error () in assert false with Failure s -> assert (s = "oops");
+ try let _ = t -> throw_runtime_error () in assert false with Failure s -> assert (s = "oops");
+ try let _ = t -> throw_underflow_error () in assert false with Failure s -> assert (s = "oops");
+;;
diff --git a/Examples/test-suite/ocaml/li_std_vector_runme.ml b/Examples/test-suite/ocaml/li_std_vector_runme.ml
new file mode 100644
index 000000000..64e9ec9f2
--- /dev/null
+++ b/Examples/test-suite/ocaml/li_std_vector_runme.ml
@@ -0,0 +1,23 @@
+open Swig
+open Li_std_vector
+
+let _ =
+ let iv = new_IntVector '() in
+ assert (iv -> "empty" () as bool);
+ assert ((iv -> "size" () as int) = 0);
+ ignore (iv -> "push_back" (123));
+ assert ((iv -> "empty" () as bool) = false);
+ assert ((iv -> "size" () as int) = 1);
+ assert ((iv -> "[]" (0) as int) = 123);
+ ignore (iv -> "clear" ());
+ assert (iv -> "empty" () as bool);
+ assert ((iv -> "size" () as int) = 0);
+;;
+
+let _ =
+ let rv = new_RealVector '() in
+ ignore (rv -> "push_back" (100.));
+ ignore (rv -> "push_back" (200.));
+ assert ((rv -> "[]" (0) as float) = 100.);
+ assert ((rv -> "[]" (1) as float) = 200.);
+;;
diff --git a/Examples/test-suite/ocaml/memberin_extend_runme.ml b/Examples/test-suite/ocaml/memberin_extend_runme.ml
new file mode 100644
index 000000000..e2cca2275
--- /dev/null
+++ b/Examples/test-suite/ocaml/memberin_extend_runme.ml
@@ -0,0 +1,10 @@
+open Swig
+open Memberin_extend
+
+let _ =
+ let em1 = new_ExtendMe '() and em2 = new_ExtendMe '() in
+ assert (em1 -> "[thing]" ("em1thing") = C_void);
+ assert (em2 -> "[thing]" ("em2thing") = C_void);
+ assert (em1 -> "[thing]" () as string = "em1thing");
+ assert (em2 -> "[thing]" () as string = "em2thing");
+;;
diff --git a/Examples/test-suite/ocaml/multivalue_runme.ml b/Examples/test-suite/ocaml/multivalue_runme.ml
new file mode 100644
index 000000000..d7e19e7d8
--- /dev/null
+++ b/Examples/test-suite/ocaml/multivalue_runme.ml
@@ -0,0 +1,8 @@
+open Swig
+open Multivalue
+
+let _ =
+ assert (_divide_l '(37, 5) = C_list ['7;'2]);
+ assert (_divide_v '(41, 7) = C_list ['5;'6]);
+ assert (_divide_mv '(91, 13) = C_list ['7;'0]);
+;;
diff --git a/Examples/test-suite/ocaml/namespace_virtual_method_runme.ml b/Examples/test-suite/ocaml/namespace_virtual_method_runme.ml
new file mode 100644
index 000000000..3c5b2cf34
--- /dev/null
+++ b/Examples/test-suite/ocaml/namespace_virtual_method_runme.ml
@@ -0,0 +1,4 @@
+open Swig
+open Namespace_virtual_method
+
+let x = new_Spam '()
diff --git a/Examples/test-suite/ocaml/newobject2_runme.ml b/Examples/test-suite/ocaml/newobject2_runme.ml
new file mode 100644
index 000000000..eb9a191bc
--- /dev/null
+++ b/Examples/test-suite/ocaml/newobject2_runme.ml
@@ -0,0 +1,16 @@
+open Swig
+open Newobject2
+
+let _ =
+ assert (_fooCount '() as int = 0);
+ let foo1 = _makeFoo '() in
+ assert (_fooCount '() as int = 1);
+ assert (_do_stuff '(foo1) = C_void);
+ let foo2 = _makeFoo '() in
+ assert (_fooCount '() as int = 2);
+ assert (_do_stuff '(foo2) = C_void);
+ ignore (foo1 -> "~" ());
+ assert (_fooCount '() as int = 1);
+ ignore (foo2 -> "~" ());
+ assert (_fooCount '() as int = 0)
+;;
diff --git a/Examples/test-suite/ocaml/overload_bool_runme.ml b/Examples/test-suite/ocaml/overload_bool_runme.ml
new file mode 100644
index 000000000..fefd07429
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_bool_runme.ml
@@ -0,0 +1,26 @@
+open Swig
+open Overload_bool
+
+let _ =
+ assert (_overloaded '(true) as string = "bool");
+ assert (_overloaded '(false) as string = "bool");
+ assert (_overloaded '(0) as string = "int");
+ assert (_overloaded '(1) as string = "int");
+ assert (_overloaded '(2) as string = "int");
+ assert (_overloaded '("1234") as string = "string");
+ assert (_boolfunction '(true) as string = "true");
+ assert (_boolfunction '(false) as string = "false");
+ assert (_intfunction '(true) as string = "int");
+ assert (_intfunction '(false) as string = "int");
+
+ assert (_overloaded_ref '(true) as string = "bool");
+ assert (_overloaded_ref '(false) as string = "bool");
+ assert (_overloaded_ref '(0) as string = "int");
+ assert (_overloaded_ref '(1) as string = "int");
+ assert (_overloaded_ref '(2) as string = "int");
+ assert (_overloaded_ref '("1234") as string = "string");
+ assert (_boolfunction_ref '(true) as string = "true");
+ assert (_boolfunction_ref '(false) as string = "false");
+ assert (_intfunction_ref '(true) as string = "int");
+ assert (_intfunction_ref '(false) as string = "int");
+;;
diff --git a/Examples/test-suite/ocaml/overload_extend_runme.ml b/Examples/test-suite/ocaml/overload_extend_runme.ml
new file mode 100644
index 000000000..3793cdbb0
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_extend_runme.ml
@@ -0,0 +1,11 @@
+open Swig
+open Overload_extend
+
+let _ =
+ let f = new_Foo '() in
+ assert (f -> test () as int = 0);
+ assert (f -> test (3) as int = 1);
+ assert (f -> test ("hello") as int = 2);
+ assert (f -> test (3., 2.) as float = 5.);
+ assert (f -> test (3.) as float = 1003.)
+;;
diff --git a/Examples/test-suite/ocaml/overload_method_runme.ml b/Examples/test-suite/ocaml/overload_method_runme.ml
new file mode 100644
index 000000000..0303ba2a3
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_method_runme.ml
@@ -0,0 +1,11 @@
+open Swig
+open Overload_method
+
+let _ =
+ let b = new_Base '() in
+ assert (b -> "method" () as int = 42);
+ assert (b -> "overloaded_method" () as int = 42);
+ assert (b -> "overloaded_method" (5) = C_void);
+ assert (b -> "overloaded_method" () as int = 5);
+ assert (b -> "method" () as int = 5);
+;;
diff --git a/Examples/test-suite/ocaml/overload_numeric_runme.ml b/Examples/test-suite/ocaml/overload_numeric_runme.ml
new file mode 100644
index 000000000..0342d63e0
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_numeric_runme.ml
@@ -0,0 +1,14 @@
+open Swig
+open Overload_numeric
+
+let _ =
+ let n = new_Nums '() in
+ let arg = C_char 'c' in
+ assert (n -> over (arg) as string = "signed char");
+ let arg = C_short 2 in
+ assert (n -> over (arg) as string = "short");
+ assert (n -> over (2) as string = "int");
+ let arg = C_float 2. in
+ assert (n -> over (arg) as string = "float");
+ assert (n -> over (2.) as string = "double")
+;;
diff --git a/Examples/test-suite/ocaml/overload_polymorphic_runme.ml b/Examples/test-suite/ocaml/overload_polymorphic_runme.ml
new file mode 100644
index 000000000..5ed5f45f4
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_polymorphic_runme.ml
@@ -0,0 +1,9 @@
+open Swig
+open Overload_polymorphic
+
+let _ =
+ let t = new_Derived '() in
+ assert (_test (t) as int = 0);
+ assert (_test '(1) as int = 1);
+ assert (_test2 (t) as int = 1)
+;;
diff --git a/Examples/test-suite/ocaml/overload_rename_runme.ml b/Examples/test-suite/ocaml/overload_rename_runme.ml
new file mode 100644
index 000000000..9e012c0c5
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_rename_runme.ml
@@ -0,0 +1,7 @@
+open Swig
+open Overload_rename
+
+let _ = new_Foo (C_float 1.)
+let _ = new_Foo (C_list [ C_float 1. ; C_float 1. ])
+let _ = new_Foo_int (C_list [ C_float 1. ; C_int 1 ])
+let _ = new_Foo_int (C_list [ C_float 1. ; C_int 1 ; C_float 1. ])
diff --git a/Examples/test-suite/ocaml/overload_subtype_runme.ml b/Examples/test-suite/ocaml/overload_subtype_runme.ml
new file mode 100644
index 000000000..6f0aeab56
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_subtype_runme.ml
@@ -0,0 +1,8 @@
+open Swig
+open Overload_subtype
+
+let _ =
+ let f = new_Foo '() and b = new_Bar '() in
+ assert (_spam (f) as int = 1);
+ assert (_spam (b) as int = 2)
+;;
diff --git a/Examples/test-suite/ocaml/overload_template_runme.ml b/Examples/test-suite/ocaml/overload_template_runme.ml
new file mode 100644
index 000000000..42a4a397a
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_template_runme.ml
@@ -0,0 +1,60 @@
+open Swig
+open Overload_template
+
+let _ =
+ assert (_foo '() as int = 3);
+ assert (_maximum '(3, 4) as int = 4);
+ assert (_maximum '(3.4, 5.2) as float > 5.);
+ assert (_mix1 '("hi") as int = 101);
+ assert (_mix1 '(1.0, 1.0) as int = 102);
+ assert (_mix1 '(1.0) as int = 103);
+ assert (_mix2 '("hi") as int = 101);
+ assert (_mix2 '(1.0, 1.0) as int = 102);
+ assert (_mix2 '(1.0) as int = 103);
+ assert (_mix3 '("hi") as int = 101);
+ assert (_mix3 '(1.0, 1.0) as int = 102);
+ assert (_mix3 '(1.0) as int = 103);
+
+ assert (_overtparams1 '(100) as int = 10);
+ assert (_overtparams1 '(100.0, 100) as int = 20);
+ assert (_overtparams2 '(100.0, 100) as int = 40);
+ assert (_overloaded '() as int = 60);
+ assert (_overloaded '(100.0, 100) as int = 70);
+ assert (_overloadedagain '("hello") as int = 80);
+ assert (_overloadedagain '() as int = 90);
+
+ assert (_specialization '(10) as int = 202);
+ assert (_specialization '(10.0) as int = 203);
+ assert (_specialization '(10, 10) as int = 204);
+ assert (_specialization '(10.0, 10.0) as int = 205);
+ assert (_specialization '("hi", "hi") as int = 201);
+
+ assert (_xyz '() = C_void);
+ assert (_xyz_int '() = C_void);
+ assert (_xyz_double '() = C_void);
+
+ assert (_overload '("hi") as int = 0);
+ assert (_overload '(1) as int = 10);
+ assert (_overload '(1, 1) as int = 20);
+ assert (_overload '(1, "hello") as int = 30);
+ let k = new_Klass '() in
+ assert (_overload '(k) as int = 10);
+ assert (_overload '(k, k) as int = 20);
+ assert (_overload '(k, "hello") as int = 30);
+ assert (_overload '(10.0, "hi") as int = 40);
+ assert (_overload '() as int = 50);
+
+ assert (_nsoverload '("hi") as int = 1000);
+ assert (_nsoverload '(1) as int = 1010);
+ assert (_nsoverload '(1, 1) as int = 1020);
+ assert (_nsoverload '(1, "hello") as int = 1030);
+ assert (_nsoverload '(k) as int = 1010);
+ assert (_nsoverload '(k, k) as int = 1020);
+ assert (_nsoverload '(k, "hello") as int = 1030);
+ assert (_nsoverload '(10.0, "hi") as int = 1040);
+ assert (_nsoverload '() as int = 1050);
+
+ assert (_A_foo '(1) = C_void);
+ let b = new_B '() in
+ assert (b -> foo(1) = C_void);
+;;
diff --git a/Examples/test-suite/ocaml/primitive_ref_runme.ml b/Examples/test-suite/ocaml/primitive_ref_runme.ml
new file mode 100644
index 000000000..7c96caac2
--- /dev/null
+++ b/Examples/test-suite/ocaml/primitive_ref_runme.ml
@@ -0,0 +1,20 @@
+open Swig
+open Primitive_ref
+
+let _ =
+ assert (_ref_int '(3) as int = 3);
+ assert (_ref_short '(3) as int = 3);
+ assert (_ref_ushort '(3) as int = 3);
+ assert (_ref_long '(3) as int = 3);
+ assert (_ref_ulong '(3) as int = 3);
+ assert (_ref_schar '(3) as int = 3);
+ assert (_ref_uchar '(3) as int = 3);
+ assert (_ref_float '(3.5) as float = 3.5);
+ assert (_ref_double '(3.5) as float = 3.5);
+ assert (_ref_bool '(true) as bool = true);
+ let arg = C_char 'x' in
+ assert (_ref_char '(arg) as char = 'x');
+ assert (_ref_over '(0) as int = 0);
+ let a = new_A '(12) in
+ assert (_ref_over '(a) as int = 12);
+;;
diff --git a/Examples/test-suite/ocaml/reference_global_vars_runme.ml b/Examples/test-suite/ocaml/reference_global_vars_runme.ml
new file mode 100644
index 000000000..adde1b82e
--- /dev/null
+++ b/Examples/test-suite/ocaml/reference_global_vars_runme.ml
@@ -0,0 +1,57 @@
+open Swig
+open Reference_global_vars
+
+let _ =
+ let tc = _getconstTC '() in
+ assert (tc -> "[num]" () as int = 33);
+
+ let _ = _var_bool (_createref_bool (C_bool false)) in
+ assert (_value_bool (_var_bool '()) as bool = false);
+
+ let _ = _var_bool (_createref_bool (C_bool true)) in
+ assert (_value_bool (_var_bool '()) as bool = true);
+
+ let _ = _var_char (_createref_char (C_char 'w')) in
+ assert (_value_char (_var_char '()) as char = 'w');
+
+ let _ = _var_unsigned_char (_createref_unsigned_char (C_uchar 'w')) in
+ assert (_value_unsigned_char (_var_unsigned_char '()) as char = 'w');
+
+ let _ = _var_signed_char (_createref_signed_char (C_uchar 'w')) in
+ assert (_value_signed_char (_var_signed_char '()) as char = 'w');
+
+ let _ = _var_short (_createref_short (C_short 10)) in
+ assert (_value_short (_var_short '()) as int = 10);
+
+ let _ = _var_unsigned_short (_createref_unsigned_short (C_ushort 10)) in
+ assert (_value_unsigned_short (_var_unsigned_short '()) as int = 10);
+
+ let _ = _var_int (_createref_int (C_int 10)) in
+ assert (_value_int (_var_int '()) as int = 10);
+
+ let _ = _var_unsigned_int (_createref_unsigned_int (C_int 10)) in
+ assert (_value_unsigned_int (_var_unsigned_int '()) as int = 10);
+
+ let _ = _var_long (_createref_long (C_int64 10L)) in
+ assert (_value_long (_var_long '()) as int = 10);
+
+ let _ = _var_unsigned_long (_createref_unsigned_long (C_int64 10L)) in
+ assert (_value_unsigned_long (_var_unsigned_long '()) as int = 10);
+
+ let _ = _var_long_long (_createref_long_long (C_int64 0x6FFFFFFFFFFFFFF8L)) in
+ assert (_value_long_long (_var_long_long '()) = C_int64 0x6FFFFFFFFFFFFFF8L);
+
+ let _ = _var_unsigned_long_long (_createref_unsigned_long_long (C_int64 0x6FFFFFFFFFFFFFF8L)) in
+ assert (_value_unsigned_long_long (_var_unsigned_long_long '()) = C_int64 0x6FFFFFFFFFFFFFF8L);
+
+ let _ = _var_float (_createref_float (C_float 10.)) in
+ assert (_value_float (_var_float '()) as float = 10.);
+
+ let _ = _var_double (_createref_double (C_double 10.)) in
+ assert (_value_double (_var_double '()) as float = 10.);
+
+ let tc = new_TestClass '(20) in
+ let _ = _var_TestClass (_createref_TestClass (tc)) in
+ let tc = _value_TestClass (_var_TestClass '()) in
+ assert (tc -> "[num]" () as int = 20);
+;;
diff --git a/Examples/test-suite/ocaml/rename_predicates_runme.ml b/Examples/test-suite/ocaml/rename_predicates_runme.ml
new file mode 100644
index 000000000..984600207
--- /dev/null
+++ b/Examples/test-suite/ocaml/rename_predicates_runme.ml
@@ -0,0 +1,40 @@
+open Swig
+open Rename_predicates
+
+let _ =
+ let r = new_RenamePredicates '(123) in
+ assert (r -> MF_member_function () = C_void);
+ assert (_RenamePredicates_MF_static_member_function '() = C_void);
+ assert (r -> MF_member_function () = C_void);
+ assert (r -> MF_extend_function_before () = C_void);
+ assert (r -> MF_extend_function_after () = C_void);
+ assert (_GF_global_function '() = C_void);
+
+ assert (r -> "[MV_member_variable]" () as int = 123);
+ assert (r -> "[MV_member_variable]" (1234) = C_void);
+ assert (r -> "[MV_member_variable]" () as int = 1234);
+
+ assert (_RenamePredicates_MV_static_member_variable '() as int = 456);
+ assert (_RenamePredicates_MV_static_member_variable '(4567) as int = 4567);
+ assert (_RenamePredicates_MV_static_member_variable '() as int = 4567);
+
+ assert (_GV_global_variable '() as int = 789);
+ assert (_GV_global_variable '(7890) as int = 7890);
+ assert (_GV_global_variable '() as int = 7890);
+
+ assert (_UC_UPPERCASE '() = C_void);
+ assert (_LC_lowercase '() = C_void);
+ assert (_TI_Title '() = C_void);
+ assert (_FU_FirstUpperCase '() = C_void);
+ assert (_FL_firstLowerCase '() = C_void);
+ assert (_CA_CamelCase '() = C_void);
+ assert (_LC_lowerCamelCase '() = C_void);
+ assert (_UC_under_case_it '() = C_void);
+
+ let ex = new_ExtendCheck '() in
+ assert (ex -> MF_real_member1 () = C_void);
+ assert (ex -> MF_real_member2 () = C_void);
+ assert (ex -> EX_EXTENDMETHOD1 () = C_void);
+ assert (ex -> EX_EXTENDMETHOD2 () = C_void);
+ assert (ex -> EX_EXTENDMETHOD3 () = C_void)
+;;
diff --git a/Examples/test-suite/ocaml/sizet_runme.ml b/Examples/test-suite/ocaml/sizet_runme.ml
new file mode 100644
index 000000000..5f72459c9
--- /dev/null
+++ b/Examples/test-suite/ocaml/sizet_runme.ml
@@ -0,0 +1,10 @@
+open Swig
+open Sizet
+
+let _ =
+ let s = C_int64 2000L in
+ assert (_test1 '(s) as int = 2000);
+ assert (_test2 '(s) as int = 2000);
+ assert (_test3 '(s) as int = 2000);
+ assert (_test4 '(s) as int = 2000);
+;;
diff --git a/Examples/test-suite/ocaml/special_variable_macros_runme.ml b/Examples/test-suite/ocaml/special_variable_macros_runme.ml
new file mode 100644
index 000000000..7f4980ea3
--- /dev/null
+++ b/Examples/test-suite/ocaml/special_variable_macros_runme.ml
@@ -0,0 +1,14 @@
+open Swig
+open Special_variable_macros
+
+let _ =
+ let name = new_Name '() in
+ assert (_testFred '(name) as string = "none");
+ assert (_testJack '(name) as string = "$specialname");
+ assert (_testJill '(name) as string = "jilly");
+ assert (_testMary '(name) as string = "SWIGTYPE_p_NameWrap");
+ assert (_testJames '(name) as string = "SWIGTYPE_Name");
+ assert (_testJim '(name) as string = "multiname num");
+ let arg = new_PairIntBool '(10, false) in
+ assert (_testJohn '(arg) as int = 123);
+;;
diff --git a/Examples/test-suite/ocaml/special_variables_runme.ml b/Examples/test-suite/ocaml/special_variables_runme.ml
new file mode 100644
index 000000000..b569a54be
--- /dev/null
+++ b/Examples/test-suite/ocaml/special_variables_runme.ml
@@ -0,0 +1,36 @@
+open Swig
+open Special_variables
+
+let _ =
+ assert (_ExceptionVars '(1.0, 2.0) as string =
+ "result = Space::exceptionvars(arg1,arg2); Space::exceptionvars ExceptionVars _wrap_ExceptionVarsspecial_variables ");
+ assert (_overloadedmethod '() as string =
+ "result = Space::overloadedmethod(); Space::overloadedmethod overloadedmethod __SWIG_1 _wrap_overloadedmethod__SWIG_1special_variables ");
+ assert (_overloadedmethod '(10.0) as string =
+ "result = Space::overloadedmethod(arg1); Space::overloadedmethod overloadedmethod __SWIG_0 _wrap_overloadedmethod__SWIG_0special_variables ");
+
+ let _ = new_ABC '(0, 0.0) in
+ assert (_declaration '() as string = "SpaceNamespace::ABC::ABC(int,double) SpaceNamespace::ABC::ABC(int,double)");
+ let a = new_ABC '() in
+ assert (_declaration '() as string = "SpaceNamespace::ABC::ABC() SpaceNamespace::ABC::ABC()");
+ ignore (a -> instancemethod (1));
+ assert (_declaration '() as string = "short * SpaceNamespace::ABC::instancemethod(int) SpaceNamespace::ABC::instancemethod(int)");
+ ignore (a -> instancemethod (1, false));
+ assert (_declaration '() as string = "short * SpaceNamespace::ABC::instancemethod(int,bool) SpaceNamespace::ABC::instancemethod(int,bool)");
+ ignore (a -> constmethod (1));
+ assert (_declaration '() as string = "short * SpaceNamespace::ABC::constmethod(int) const SpaceNamespace::ABC::constmethod(int) const");
+ ignore (_ABC_staticmethod '(0, false));
+ assert (_declaration '() as string = "short * SpaceNamespace::ABC::staticmethod(int,bool) SpaceNamespace::ABC::staticmethod(int,bool)");
+ ignore (a -> "~" ());
+ assert (_declaration '() as string = "SpaceNamespace::ABC::~ABC() SpaceNamespace::ABC::~ABC()");
+ let abc = new_TemplateABC '() in
+ assert (_declaration '() as string = "SpaceNamespace::Template< SpaceNamespace::ABC >::Template() SpaceNamespace::Template< SpaceNamespace::ABC >::Template()");
+ let arg = new_ABC '() in
+ ignore (abc -> tmethod (arg));
+ assert (_declaration '() as string = "std::string SpaceNamespace::Template< SpaceNamespace::ABC >::tmethod(SpaceNamespace::ABC) SpaceNamespace::Template< SpaceNamespace::ABC >::tmethod(SpaceNamespace::ABC)");
+ ignore (abc -> "~" ());
+ assert (_declaration '() as string = "SpaceNamespace::Template< SpaceNamespace::ABC >::~Template() SpaceNamespace::Template< SpaceNamespace::ABC >::~Template()");
+ let arg = new_TemplateABC '() in
+ ignore (_globtemplate (arg));
+ assert (_declaration '() as string = "void SpaceNamespace::globtemplate(SpaceNamespace::Template< SpaceNamespace::ABC >) SpaceNamespace::globtemplate(SpaceNamespace::Template< SpaceNamespace::ABC >)");
+;;
diff --git a/Examples/test-suite/ocaml/static_const_member_runme.ml b/Examples/test-suite/ocaml/static_const_member_runme.ml
new file mode 100644
index 000000000..02dd2fe4b
--- /dev/null
+++ b/Examples/test-suite/ocaml/static_const_member_runme.ml
@@ -0,0 +1,9 @@
+open Swig
+open Static_const_member
+
+let _ =
+ assert (_X_PN '() as int = 0);
+ assert (_X_CN '() as int = 1);
+ assert (_X_EN '() as int = 2);
+ assert (_X_CHARTEST '() as char = 'A');
+;;
diff --git a/Examples/test-suite/ocaml/string_simple_runme.ml b/Examples/test-suite/ocaml/string_simple_runme.ml
new file mode 100644
index 000000000..327fb85d2
--- /dev/null
+++ b/Examples/test-suite/ocaml/string_simple_runme.ml
@@ -0,0 +1,9 @@
+open Swig
+open String_simple
+
+let str = "olé"
+
+let copy = _copy_str (C_string str) as string
+
+let _ = if str <> copy then
+ raise (Failure ("Error: copy is not equal: original="^str^", copy="^copy))
diff --git a/Examples/test-suite/ocaml/struct_value_runme.ml b/Examples/test-suite/ocaml/struct_value_runme.ml
new file mode 100644
index 000000000..73688bef3
--- /dev/null
+++ b/Examples/test-suite/ocaml/struct_value_runme.ml
@@ -0,0 +1,11 @@
+open Swig
+open Struct_value
+
+let b = new_Bar (C_void)
+let a = (invoke b) "[a]" (C_void)
+let _ = (invoke a) "[x]" (C_int 3)
+let _ = assert((invoke a) "[x]" (C_void) = C_int 3)
+
+let bb = (invoke b) "[b]" (C_void)
+let _ = (invoke bb) "[x]" (C_int 3)
+let _ = assert((invoke bb) "[x]" (C_void) = C_int 3)
diff --git a/Examples/test-suite/ocaml/swig_exception_runme.ml b/Examples/test-suite/ocaml/swig_exception_runme.ml
new file mode 100644
index 000000000..5bf36c36f
--- /dev/null
+++ b/Examples/test-suite/ocaml/swig_exception_runme.ml
@@ -0,0 +1,13 @@
+open Swig
+open Swig_exception
+
+let _ =
+ let c = new_Circle '(10) and s = new_Square '(10) in
+ assert (_Shape_nshapes '() as int = 2);
+ try
+ ignore (c -> throwException ()); assert false
+ with Sys_error msg -> assert (msg = "OK");
+ let _ = c -> "~" () in
+ let _ = s -> "~" () in
+ assert (_Shape_nshapes '() as int = 0);
+;;
diff --git a/Examples/test-suite/ocaml/template_default_arg_overloaded_extend_runme.ml b/Examples/test-suite/ocaml/template_default_arg_overloaded_extend_runme.ml
new file mode 100644
index 000000000..27fb9b543
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_default_arg_overloaded_extend_runme.ml
@@ -0,0 +1,17 @@
+open Swig
+open Template_default_arg_overloaded_extend
+
+let _ =
+ let rs = new_ResultSet '() and sp = new_SearchPoint '() in
+ assert (rs -> go_get_method (0, sp) as int = -1);
+ assert (rs -> go_get_method (0, sp, 100) as int = 100);
+ assert (rs -> go_get_template (0, sp) as int = -2);
+ assert (rs -> go_get_template (0, sp, 100) as int = 100);
+
+ assert (rs -> over () as string = "over(int)");
+ assert (rs -> over (10) as string = "over(int)");
+ assert (rs -> over (sp) as string = "over(giai2::SearchPoint, int)");
+ assert (rs -> over (sp, 10) as string = "over(giai2::SearchPoint, int)");
+ assert (rs -> over (true, sp) as string = "over(bool, gaia2::SearchPoint, int)");
+ assert (rs -> over (true, sp, 10) as string = "over(bool, gaia2::SearchPoint, int)");
+;;
diff --git a/Examples/test-suite/ocaml/template_default_arg_runme.ml b/Examples/test-suite/ocaml/template_default_arg_runme.ml
new file mode 100644
index 000000000..94f2291f1
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_default_arg_runme.ml
@@ -0,0 +1,52 @@
+open Swig
+open Template_default_arg
+
+let _ =
+ let helloInt = new_Hello_int '() and enumArg = _hi '() in
+ assert (helloInt -> foo (enumArg) = C_void);
+ assert (helloInt -> foo () = C_void);
+
+ let x = new_X_int '() in
+ assert (x -> meth (20.0, 200) as int = 200);
+ assert (x -> meth (20) as int = 20);
+ assert (x -> meth () as int = 0);
+
+ let x = new_Y_unsigned '() in
+ let args = C_list [ C_double 20.0 ; C_uint 200l ] in
+ assert (x -> meth (args) as int = 200);
+ let args = C_uint 20l in
+ assert (x -> meth (args) as int = 20);
+ assert (x -> meth () as int = 0);
+
+ let x = new_X_longlong '() in
+ assert (x -> meth (20.0) as int = 0);
+ let x = new_X_longlong '(20.0) in
+ assert (x -> meth (20.0) as int = 0);
+ let args = C_list [ C_double 20.0 ; C_int64 200L ] in
+ let x = new_X_longlong '(args) in
+ assert (x -> meth (20.0) as int = 0);
+
+ let x = new_X_int '() in
+ assert (x -> meth (20.0) as int = 0);
+ let x = new_X_int '(20.0) in
+ assert (x -> meth (20.0) as int = 0);
+ let x = new_X_int '(20.0, 200) in
+ assert (x -> meth (20.0) as int = 0);
+
+ let arg = new_Foo_int '() in
+ assert (_ott '(arg) as int = 30);
+ assert (_ott '() as int = 10);
+ assert (_ott '(1) as int = 10);
+ assert (_ott '(1, 1) as int = 10);
+ assert (_ott '("hi") as int = 20);
+ assert (_ott '("hi", 1) as int = 20);
+ assert (_ott '("hi", 1, 1) as int = 20);
+
+ let arg = new_Hello_int '() in
+ assert (_ottstring '(arg, "hi") as int = 40);
+ assert (_ottstring '(arg) as int = 40);
+ assert (_ottint '(arg, 1) as int = 50);
+ assert (_ottint '(arg) as int = 50);
+ assert (_ott '(arg, 1.0) as int = 60);
+ assert (_ott '(arg) as int = 60);
+;;
diff --git a/Examples/test-suite/ocaml/template_extend1_runme.ml b/Examples/test-suite/ocaml/template_extend1_runme.ml
new file mode 100644
index 000000000..b9b5a67d6
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_extend1_runme.ml
@@ -0,0 +1,8 @@
+open Swig
+open Template_extend1
+
+let _ =
+ let a = new_lBaz '() and b = new_dBaz '() in
+ assert (a -> foo () as string = "lBaz::foo");
+ assert (b -> foo () as string = "dBaz::foo")
+;;
diff --git a/Examples/test-suite/ocaml/template_extend2_runme.ml b/Examples/test-suite/ocaml/template_extend2_runme.ml
new file mode 100644
index 000000000..67f260f87
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_extend2_runme.ml
@@ -0,0 +1,8 @@
+open Swig
+open Template_extend2
+
+let _ =
+ let a = new_lBaz '() and b = new_dBaz '() in
+ assert (a -> foo () as string = "lBaz::foo");
+ assert (b -> foo () as string = "dBaz::foo")
+;;
diff --git a/Examples/test-suite/ocaml/template_inherit_runme.ml b/Examples/test-suite/ocaml/template_inherit_runme.ml
new file mode 100644
index 000000000..1f3761cd2
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_inherit_runme.ml
@@ -0,0 +1,22 @@
+open Swig
+open Template_inherit
+
+let _ =
+ let a = new_FooInt '() and b = new_FooDouble '() and c = new_BarInt '()
+ and d = new_BarDouble '() and e = new_FooUInt '() and f = new_BarUInt '() in
+ assert (a -> blah () as string = "Foo");
+ assert (b -> blah () as string = "Foo");
+ assert (e -> blah () as string = "Foo");
+ assert (c -> blah () as string = "Bar");
+ assert (d -> blah () as string = "Bar");
+ assert (f -> blah () as string = "Bar");
+ assert (c -> foomethod () as string = "foomethod");
+ assert (d -> foomethod () as string = "foomethod");
+ assert (f -> foomethod () as string = "foomethod");
+ assert (_invoke_blah_int '(a) as string = "Foo");
+ assert (_invoke_blah_int '(c) as string = "Bar");
+ assert (_invoke_blah_double '(b) as string = "Foo");
+ assert (_invoke_blah_double '(d) as string = "Bar");
+ assert (_invoke_blah_uint '(e) as string = "Foo");
+ assert (_invoke_blah_uint '(f) as string = "Bar")
+;;
diff --git a/Examples/test-suite/ocaml/template_opaque_runme.ml b/Examples/test-suite/ocaml/template_opaque_runme.ml
new file mode 100644
index 000000000..cb9e18905
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_opaque_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Template_opaque
+
+let v = new_OpaqueVectorType (C_uint 10l)
+let _ = _FillVector '(v)
diff --git a/Examples/test-suite/ocaml/template_ref_type_runme.ml b/Examples/test-suite/ocaml/template_ref_type_runme.ml
new file mode 100644
index 000000000..2db2f9b28
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_ref_type_runme.ml
@@ -0,0 +1,6 @@
+open Swig
+open Template_ref_type
+
+let xr = new_XC '()
+let y = new_Y '()
+let _ = y -> find (xr)
diff --git a/Examples/test-suite/ocaml/template_rename_runme.ml b/Examples/test-suite/ocaml/template_rename_runme.ml
new file mode 100644
index 000000000..be19aa107
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_rename_runme.ml
@@ -0,0 +1,12 @@
+open Swig
+open Template_rename
+
+let _ =
+ let i = new_iFoo '() and d = new_dFoo '() in
+ assert (i -> blah_test (4) as int = 4);
+ assert (i -> spam_test (5) as int = 5);
+ assert (i -> groki_test (6) as int = 6);
+ assert (d -> blah_test (7) as int = 7);
+ assert (d -> spam (8) as int = 8);
+ assert (d -> grok_test (9) as int = 9)
+;;
diff --git a/Examples/test-suite/ocaml/template_tbase_template_runme.ml b/Examples/test-suite/ocaml/template_tbase_template_runme.ml
new file mode 100644
index 000000000..724776a24
--- /dev/null
+++ b/Examples/test-suite/ocaml/template_tbase_template_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Template_tbase_template
+
+let a = _make_Class_dd '()
+assert (a -> test () as string = "test")
diff --git a/Examples/test-suite/ocaml/throw_exception_runme.ml b/Examples/test-suite/ocaml/throw_exception_runme.ml
index 8781926b6..5c4c0922a 100644
--- a/Examples/test-suite/ocaml/throw_exception_runme.ml
+++ b/Examples/test-suite/ocaml/throw_exception_runme.ml
@@ -1,28 +1,25 @@
-(* Throw exception test *)
-
open Swig
open Throw_exception
-let x = new_Foo C_void ;;
-let _ =
- try
- (invoke x) "test_int" C_void
- with (Failure "Exception(37): Thrown exception from C++ (int)\n") ->
- try
- (invoke x) "test_msg" C_void
- with (Failure "Exception(0): Dead\n") ->
- try
- (invoke x) "test_cls" C_void
- with (Failure "Exception(0): Thrown exception from C++ (unknown)\n") ->
- try
- (invoke x) "test_multi" (C_int 1)
- with (Failure "Exception(37): Thrown exception from C++ (int)\n") ->
- try
- (invoke x) "test_multi" (C_int 2)
- with (Failure "Exception(0): Dead\n") ->
+let x = new_Foo '()
+
+let check meth args expected =
try
- (invoke x) "test_multi" (C_int 3)
- with (Failure "Exception(0): Thrown exception from C++ (unknown)\n") ->
- exit 0
+ let _ = ((invoke x) meth (args)) in assert false
+ with Failure msg -> assert (msg = expected)
-let _ = exit 1
+let _ =
+ check "test_int" '() "C++ int exception thrown, value: 37";
+ check "test_msg" '() "Dead";
+ check "test_cls" '() "C++ CError exception thrown";
+ check "test_cls_ptr" '() "C++ CError * exception thrown";
+ check "test_cls_ref" '() "C++ CError & exception thrown";
+ check "test_cls_td" '() "C++ Namespace::ErrorTypedef exception thrown";
+ check "test_cls_ptr_td" '() "C++ Namespace::ErrorPtr exception thrown";
+ check "test_cls_ref_td" '() "C++ Namespace::ErrorRef exception thrown";
+ check "test_array" '() "C++ int [10] exception thrown";
+ check "test_enum" '() "C++ Namespace::EnumTest exception thrown";
+ check "test_multi" '(1) "C++ int exception thrown, value: 37";
+ check "test_multi" '(2) "Dead";
+ check "test_multi" '(3) "C++ CError exception thrown";
+;;
diff --git a/Examples/test-suite/ocaml/typedef_class_runme.ml b/Examples/test-suite/ocaml/typedef_class_runme.ml
new file mode 100644
index 000000000..969c3e420
--- /dev/null
+++ b/Examples/test-suite/ocaml/typedef_class_runme.ml
@@ -0,0 +1,13 @@
+open Swig
+open Typedef_class
+
+let a = new_RealA '()
+let _ = a -> "[a]" (3)
+
+let b = new_B '()
+let _ = assert (b -> testA (a) as int = 3)
+
+let bb = new_BB '()
+let bb2 = new_BB '(2)
+let _ = assert (bb -> aa_method (1.) as int = 0)
+let bbb = new_BBB '()
diff --git a/Examples/test-suite/ocaml/typedef_classforward_same_name_runme.ml b/Examples/test-suite/ocaml/typedef_classforward_same_name_runme.ml
new file mode 100644
index 000000000..304f74b7a
--- /dev/null
+++ b/Examples/test-suite/ocaml/typedef_classforward_same_name_runme.ml
@@ -0,0 +1,11 @@
+open Swig
+open Typedef_classforward_same_name
+
+let _ =
+ let foo = new_Foo '() in
+ ignore (foo -> "[x]" (5));
+ assert (_extractFoo '(foo) as int = 5);
+ let boo = new_Boo '() in
+ ignore (boo -> "[x]" (5));
+ assert (_extractBoo '(boo) as int = 5)
+;;
diff --git a/Examples/test-suite/ocaml/typedef_inherit_runme.ml b/Examples/test-suite/ocaml/typedef_inherit_runme.ml
new file mode 100644
index 000000000..6352fd4ad
--- /dev/null
+++ b/Examples/test-suite/ocaml/typedef_inherit_runme.ml
@@ -0,0 +1,11 @@
+open Swig
+open Typedef_inherit
+
+let _ =
+ let a = new_Foo '() and b = new_Bar '() in
+ assert (_do_blah (a) as string = "Foo::blah");
+ assert (_do_blah (b) as string = "Bar::blah");
+ let c = new_Spam '() and d = new_Grok '() in
+ assert (_do_blah2 (c) as string = "Spam::blah");
+ assert (_do_blah2 (d) as string = "Grok::blah")
+;;
diff --git a/Examples/test-suite/ocaml/typedef_mptr_runme.ml b/Examples/test-suite/ocaml/typedef_mptr_runme.ml
index 3bdaac4ba..36aafe695 100644
--- a/Examples/test-suite/ocaml/typedef_mptr_runme.ml
+++ b/Examples/test-suite/ocaml/typedef_mptr_runme.ml
@@ -1,16 +1,13 @@
open Swig
open Typedef_mptr
-let soci x = (string_of_int (get_int x))
-
-let x = new_Foo C_void
-let add_res = _do_op (C_list [ x ; C_int 2 ; C_int 1 ; _add ])
-and sub_res = _do_op (C_list [ x ; C_int 2 ; C_int 1 ; _sub ])
let _ =
- if add_res <> (C_int 3) || sub_res <> (C_int 1) then
- raise (Failure ("Bad result:" ^
- " (add " ^ (soci add_res) ^ ") " ^
- " (sub " ^ (soci sub_res) ^ ")"))
-let _ = Printf.printf "2 + 1 = %d, 2 - 1 = %d\n"
- (get_int add_res)
- (get_int sub_res)
+ let f = new_Foo '() in
+ let args = C_list [ C_int 2 ; C_int 1 ; _add '() ] in
+ assert (f -> do_op (args) as int = 3);
+ let args = C_list [ C_int 2 ; C_int 1 ; _sub '() ] in
+ assert (f -> do_op (args) as int = 1);
+
+ assert (_do_op (C_list [ f ; C_int 2 ; C_int 1 ; _add '() ]) = C_int 3);
+ assert (_do_op (C_list [ f ; C_int 2 ; C_int 1 ; _sub '() ]) = C_int 1);
+;;
diff --git a/Examples/test-suite/ocaml/typedef_reference_runme.ml b/Examples/test-suite/ocaml/typedef_reference_runme.ml
new file mode 100644
index 000000000..4c9cc6fca
--- /dev/null
+++ b/Examples/test-suite/ocaml/typedef_reference_runme.ml
@@ -0,0 +1,11 @@
+open Swig
+open Typedef_reference
+
+let _ =
+ let i = _copy_intp '(2) in
+ assert (_somefunc '(i) as int = 2);
+ assert (_delete_intp '(i) = C_void);
+ let i = _copy_intp '(3) in
+ assert (_otherfunc '(i) as int = 3);
+ assert (_delete_intp '(i) = C_void);
+;;
diff --git a/Examples/test-suite/ocaml/typemap_arrays_runme.ml b/Examples/test-suite/ocaml/typemap_arrays_runme.ml
new file mode 100644
index 000000000..611e1d338
--- /dev/null
+++ b/Examples/test-suite/ocaml/typemap_arrays_runme.ml
@@ -0,0 +1,4 @@
+open Swig
+open Typemap_arrays
+
+let _ = assert (_sumA '(0) as int = 60)
diff --git a/Examples/test-suite/ocaml/typemap_delete_runme.ml b/Examples/test-suite/ocaml/typemap_delete_runme.ml
new file mode 100644
index 000000000..0cffb025b
--- /dev/null
+++ b/Examples/test-suite/ocaml/typemap_delete_runme.ml
@@ -0,0 +1,5 @@
+open Swig
+open Typemap_delete
+
+let r = new_Rect '(123)
+let _ = assert (r -> "[val]" () as int = 123)
diff --git a/Examples/test-suite/ocaml/types_directive_runme.ml b/Examples/test-suite/ocaml/types_directive_runme.ml
new file mode 100644
index 000000000..8503d00ff
--- /dev/null
+++ b/Examples/test-suite/ocaml/types_directive_runme.ml
@@ -0,0 +1,14 @@
+open Swig
+open Types_directive
+
+let _ =
+ (* Check that a Time1 instance is accepted where a Date instance is expected. *)
+ let d1 = new_Time1 '(2001, 2, 3, 60) in
+ let newDate = _add '(d1, 7) in
+ assert (newDate -> "[day]" () as int = 10);
+
+ (* Check that a Time2 instance is accepted where a Date instance is expected. *)
+ let d2 = new_Time2 '(1999, 8, 7, 60) in
+ let newDate = _add '(d2, 7) in
+ assert (newDate -> "[day]" () as int = 14)
+;;
diff --git a/Examples/test-suite/ocaml/unions_runme.ml b/Examples/test-suite/ocaml/unions_runme.ml
index cbf1628ac..c451cb2be 100644
--- a/Examples/test-suite/ocaml/unions_runme.ml
+++ b/Examples/test-suite/ocaml/unions_runme.ml
@@ -8,21 +8,21 @@ let b = new_BigStruct C_void
let c = new_UnionTest C_void
let d = new_EmbeddedUnionTest C_void
-let _ = (invoke a) "jill" (C_short 3)
-let _ = (invoke b) "jack" (C_char 'a') (* Int conversion *)
-let _ = (invoke b) "smallstruct" a (* Put a in b *)
-let _ = (invoke c) "bs" b
+let _ = (invoke a) "[jill]" (C_short 3)
+let _ = (invoke b) "[jack]" (C_char 'a') (* Int conversion *)
+let _ = (invoke b) "[smallstruct]" a (* Put a in b *)
+let _ = (invoke c) "[bs]" b
-let _ = if get_int ((invoke a) "jill" C_void) != 3 then
+let _ = if get_int ((invoke a) "[jill]" C_void) != 3 then
raise (Failure "jill value is not preserved")
-let _ = if get_int ((invoke b) "jack" C_void) != (int_of_char 'a') then
+let _ = if get_int ((invoke b) "[jack]" C_void) != (int_of_char 'a') then
raise (Failure "jack value is not preserved")
-let _ = if get_int ((invoke ((invoke b) "smallstruct" C_void))
- "jill" C_void) != 3 then
+let _ = if get_int ((invoke ((invoke b) "[smallstruct]" C_void))
+ "[jill]" C_void) != 3 then
raise (Failure "jill value is not embedded in bigstruct")
-let _ = if get_int ((invoke ((invoke c) "bs" C_void))
- "jack" C_void) != (int_of_char 'a') then
+let _ = if get_int ((invoke ((invoke c) "[bs]" C_void))
+ "[jack]" C_void) != (int_of_char 'a') then
raise (Failure "union set of bigstruct did not take")
-let _ = if get_int ((invoke ((invoke c) "ss" C_void))
- "jill" C_void) != (int_of_char 'a') then
+let _ = if get_int ((invoke ((invoke c) "[ss]" C_void))
+ "[jill]" C_void) != (int_of_char 'a') then
raise (Failure "corresponding union values are not the same")
diff --git a/Examples/test-suite/ocaml/using1_runme.ml b/Examples/test-suite/ocaml/using1_runme.ml
new file mode 100644
index 000000000..defda603c
--- /dev/null
+++ b/Examples/test-suite/ocaml/using1_runme.ml
@@ -0,0 +1,4 @@
+open Swig
+open Using1
+
+let _ = assert (_spam '(37) as int = 37)
diff --git a/Examples/test-suite/ocaml/using_extend_runme.ml b/Examples/test-suite/ocaml/using_extend_runme.ml
new file mode 100644
index 000000000..0b7c57f65
--- /dev/null
+++ b/Examples/test-suite/ocaml/using_extend_runme.ml
@@ -0,0 +1,12 @@
+open Swig
+open Using_extend
+
+let _ =
+ let f = new_FooBar '() in
+ assert (f -> blah (3) as int = 3);
+ assert (f -> blah (3.5) as float = 3.5);
+ assert (f -> blah ("hello") as string = "hello");
+ assert (f -> blah (3, 4) as int = 7);
+ assert (f -> blah (3.5, 7.5) as float = 11.);
+ assert (f -> duh (3) as int = 3)
+;;
diff --git a/Examples/test-suite/ocaml/using_inherit_runme.ml b/Examples/test-suite/ocaml/using_inherit_runme.ml
new file mode 100644
index 000000000..2c49c5e6f
--- /dev/null
+++ b/Examples/test-suite/ocaml/using_inherit_runme.ml
@@ -0,0 +1,24 @@
+open Swig
+open Using_inherit
+
+let _ =
+ let b = new_Bar '() in
+ assert (b -> test (3) as int = 3);
+ assert (b -> test (3.5) as float = 3.5);
+ let b = new_Bar2 '() in
+ assert (b -> test (3) as int = 6);
+ assert (b -> test (3.5) as float = 7.0);
+ let b = new_Bar3 '() in
+ assert (b -> test (3) as int = 6);
+ assert (b -> test (3.5) as float = 7.0);
+ let b = new_Bar4 '() in
+ assert (b -> test (3) as int = 6);
+ assert (b -> test (3.5) as float = 7.0);
+
+ let f = new_Fred1 '() in
+ assert (f -> test (3) as int = 3);
+ assert (f -> test (3.5) as float = 7.0);
+ let f = new_Fred2 '() in
+ assert (f -> test (3) as int = 3);
+ assert (f -> test (3.5) as float = 7.0)
+;;
diff --git a/Examples/test-suite/ocaml/using_pointers_runme.ml b/Examples/test-suite/ocaml/using_pointers_runme.ml
new file mode 100644
index 000000000..98fd3fb48
--- /dev/null
+++ b/Examples/test-suite/ocaml/using_pointers_runme.ml
@@ -0,0 +1,10 @@
+open Swig
+open Using_pointers
+
+let f = new_FooBar '()
+try
+ ignore (f -> exception_spec (1)); assert false
+with Failure _ -> ()
+try
+ ignore (f -> exception_spec (2)); assert false
+with Failure _ -> ()
diff --git a/Examples/test-suite/ocaml/using_private_runme.ml b/Examples/test-suite/ocaml/using_private_runme.ml
new file mode 100644
index 000000000..026cbfd91
--- /dev/null
+++ b/Examples/test-suite/ocaml/using_private_runme.ml
@@ -0,0 +1,10 @@
+open Swig
+open Using_private
+
+let _ =
+ let f = new_FooBar '() in
+ let _ = f -> "[x]" (3) in
+ assert (f -> blah (4) as int = 4);
+ assert (f -> defaulted () as int = -1);
+ assert (f -> defaulted (222) as int = 222)
+;;
diff --git a/Examples/test-suite/ocaml/using_protected_runme.ml b/Examples/test-suite/ocaml/using_protected_runme.ml
index 4dc4fe1c9..29647c288 100644
--- a/Examples/test-suite/ocaml/using_protected_runme.ml
+++ b/Examples/test-suite/ocaml/using_protected_runme.ml
@@ -2,7 +2,7 @@ open Swig
open Using_protected
let f = new_FooBar C_void
-let _ = (invoke f) "x" (C_int 3)
+let _ = (invoke f) "[x]" (C_int 3)
let _ = if (invoke f) "blah" (C_int 4) <> (C_int 4) then
raise (Failure "blah(int)")
diff --git a/Examples/test-suite/ocaml/valuewrapper_runme.ml b/Examples/test-suite/ocaml/valuewrapper_runme.ml
new file mode 100644
index 000000000..0e2d73136
--- /dev/null
+++ b/Examples/test-suite/ocaml/valuewrapper_runme.ml
@@ -0,0 +1,8 @@
+open Swig
+open Valuewrapper
+
+let _ =
+ let x1 = new_Xi '(5) and y1 = new_YXi '() in
+ assert (y1 -> spam (x1) as int = 0);
+ assert (y1 -> spam () as int = 0)
+;;
diff --git a/Examples/test-suite/ocaml/varargs_overload_runme.ml b/Examples/test-suite/ocaml/varargs_overload_runme.ml
new file mode 100644
index 000000000..418f881e3
--- /dev/null
+++ b/Examples/test-suite/ocaml/varargs_overload_runme.ml
@@ -0,0 +1,29 @@
+open Swig
+open Varargs_overload
+
+let _ =
+ assert (_vararg_over1 '("Hello") as string = "Hello");
+ assert (_vararg_over1 '(2) as string = "2");
+ assert (_vararg_over2 '("Hello") as string = "Hello");
+ assert (_vararg_over2 '(2, 2.2) as string = "2 2.2");
+
+ assert (_vararg_over3 '("Hello") as string = "Hello");
+ assert (_vararg_over3 '(2, 2.2, "hey") as string = "2 2.2 hey");
+ assert (_vararg_over4 '("Hello") as string = "Hello");
+ assert (_vararg_over4 '(123) as string = "123");
+ assert (_vararg_over4 '("Hello", 123) as string = "Hello");
+
+
+ (* Same as above but non-vararg function declared first *)
+
+ assert (_vararg_over6 '("Hello") as string = "Hello");
+ assert (_vararg_over6 '(2) as string = "2");
+ assert (_vararg_over7 '("Hello") as string = "Hello");
+ assert (_vararg_over7 '(2, 2.2) as string = "2 2.2");
+
+ assert (_vararg_over8 '("Hello") as string = "Hello");
+ assert (_vararg_over8 '(2, 2.2, "hey") as string = "2 2.2 hey");
+ assert (_vararg_over9 '("Hello") as string = "Hello");
+ assert (_vararg_over9 '(123) as string = "123");
+ assert (_vararg_over9 '("Hello", 123) as string = "Hello");
+;;
diff --git a/Examples/test-suite/ocaml/wrapmacro_runme.ml b/Examples/test-suite/ocaml/wrapmacro_runme.ml
new file mode 100644
index 000000000..f11136360
--- /dev/null
+++ b/Examples/test-suite/ocaml/wrapmacro_runme.ml
@@ -0,0 +1,10 @@
+open Swig
+open Wrapmacro
+
+let _ =
+ let args = C_list [ C_int64 2L ; C_int64 1L ] in
+ assert (_maximum '(args) as int = 2);
+ let args = C_list [ C_double (2. /. 7.) ; C_double 256. ] in
+ assert (_maximum '(args) as float = 256.);
+ assert (_GUINT16_SWAP_LE_BE_CONSTANT '(0x1234) as int = 0x3412);
+;;
diff --git a/Examples/test-suite/octave/Makefile.in b/Examples/test-suite/octave/Makefile.in
index be47904e2..3c8f3b165 100644
--- a/Examples/test-suite/octave/Makefile.in
+++ b/Examples/test-suite/octave/Makefile.in
@@ -16,6 +16,12 @@ CPP_TEST_CASES += \
octave_cell_deref\
octave_dim
+CPP11_TEST_CASES += \
+ cpp11_shared_ptr_const \
+ cpp11_shared_ptr_nullptr_in_containers \
+ cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_upcast \
+
CPP_TEST_BROKEN += \
implicittest \
li_implicit \
@@ -59,7 +65,7 @@ CSRCS = octave_empty.c
# a file is found which has _runme.m appended after the testcase name.
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir):$$OCTAVE_PATH $(RUNTOOL) $(OCTAVE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir) OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: remove the generated .m file
@@ -70,20 +76,6 @@ run_testcase = \
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' octave_clean
-cvsignore:
- @echo '*wrap* *.mc *.so *.dll *.exp *.lib'
- @echo Makefile
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.m; done
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.m CVS/Entries ; then echo $${i}_runme.m; fi; done
- @echo clientdata_prop_a.m
- @echo clientdata_prop_b.m
- @echo imports_a.m
- @echo imports_b.m
- @echo mod_a.m mod_b.m
- @echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.m hugemod_b.m hugemod_runme.m
- @echo template_typedef_import.m
-
-
hugemod:
perl hugemod.pl
$(MAKE) hugemod_a.cpptest
diff --git a/Examples/test-suite/octave/complextest_runme.m b/Examples/test-suite/octave/complextest_runme.m
index 6a5433f1f..cd9c4a8b7 100644
--- a/Examples/test-suite/octave/complextest_runme.m
+++ b/Examples/test-suite/octave/complextest_runme.m
@@ -15,10 +15,16 @@ if (complextest.Conjf(a) != a.conjugate())
error("bad complex mapping")
endif
+if (complextest.Conj2(a) != a.conjugate())
+ error("bad complex mapping")
+endif
+
+if (complextest.Conjf2(a) != a.conjugate())
+ error("bad complex mapping")
+endif
+
v = (complex(1,2), complex(2,3), complex(4,3), 1);
-try
- complextest.Copy_h(v);
-catch
-end_try_catch
+complextest.CopyHalf(v);
+complextest.CopyHalfRef(v);
diff --git a/Examples/test-suite/octave/li_std_containers_overload_runme.m b/Examples/test-suite/octave/li_std_containers_overload_runme.m
new file mode 100644
index 000000000..786d63466
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_containers_overload_runme.m
@@ -0,0 +1,37 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+li_std_containers_overload
+
+function check(got, expected)
+ if (!strcmp(got, expected))
+ error("Failed check. '%s' != '%s'", got, expected)
+ endif
+end
+
+v = VectorX();
+check(VectorOverload(v), "vector<X>");
+
+v = VectorY();
+check(VectorOverload(v), "vector<Y>");
+
+v = VectorInt();
+check(VectorOverload(v), "vector<int>");
+
+v = VectorString();
+check(VectorOverload(v), "vector<string>");
+
+# TODO: Conversion from an Octave sequence not implemented yet
+# v = {X()};
+# check(VectorOverload(v), "vector<X>");
+
+# v = {Y()};
+# check(VectorOverload(v), "vector<Y>");
+
+# v = {1, 2, 3};
+# check(VectorOverload(v), "vector<int>");
+
+# v = {"aaa", "bbb", "ccc"};
+# check(VectorOverload(v), "vector<string>");
diff --git a/Examples/test-suite/octave/li_std_wstring_runme.m b/Examples/test-suite/octave/li_std_wstring_runme.m
deleted file mode 100644
index cbccc0c12..000000000
--- a/Examples/test-suite/octave/li_std_wstring_runme.m
+++ /dev/null
@@ -1,95 +0,0 @@
-# do not dump Octave core
-if exist("crash_dumps_octave_core", "builtin")
- crash_dumps_octave_core(0);
-endif
-
-li_std_wstring
-
-x="h";
-
-if (li_std_wstring.test_wcvalue(x) != x)
- error("bad string mapping")
-endif
-
-x="hello";
-if (li_std_wstring.test_ccvalue(x) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_cvalue(x) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_value(x) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_const_reference(x) != x)
- error("bad string mapping")
-endif
-
-
-s = li_std_wstring.wstring("he");
-s = s + "llo";
-
-if (s != x)
- error("bad string mapping")
-endif
-
-if (s(1:4) != x(1:4))
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_value(s) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_const_reference(s) != x)
- error("bad string mapping")
-endif
-
-a = li_std_wstring.A(s);
-
-if (li_std_wstring.test_value(a) != x)
- error("bad string mapping")
-endif
-
-if (li_std_wstring.test_const_reference(a) != x)
- error("bad string mapping")
-endif
-
-b = li_std_wstring.wstring(" world");
-
-if (a + b != "hello world")
- error("bad string mapping")
-endif
-
-if (a + " world" != "hello world")
- error("bad string mapping")
-endif
-
-if ("hello" + b != "hello world")
- error("bad string mapping")
-endif
-
-c = "hello" + b;
-if (c.find_last_of("l") != 9)
- error("bad string mapping")
-endif
-
-s = "hello world";
-
-b = li_std_wstring.B("hi");
-
-b.name = li_std_wstring.wstring("hello");
-if (b.name != "hello")
- error("bad string mapping")
-endif
-
-
-b.a = li_std_wstring.A("hello");
-if (b.a != "hello")
- error("bad string mapping")
-endif
-
-
diff --git a/Examples/test-suite/octave/null_pointer_runme.m b/Examples/test-suite/octave/null_pointer_runme.m
index 9d55d8be2..72362f451 100644
--- a/Examples/test-suite/octave/null_pointer_runme.m
+++ b/Examples/test-suite/octave/null_pointer_runme.m
@@ -5,4 +5,4 @@ endif
null_pointer;
-assert(func([]));
+assert(funk([]));
diff --git a/Examples/test-suite/octave/octave_cell_deref_runme.m b/Examples/test-suite/octave/octave_cell_deref_runme.m
index d00d17282..0a45999d3 100644
--- a/Examples/test-suite/octave/octave_cell_deref_runme.m
+++ b/Examples/test-suite/octave/octave_cell_deref_runme.m
@@ -5,8 +5,8 @@ endif
octave_cell_deref;
-assert(func("hello"));
-assert(func({"hello"}));
+assert(funk("hello"));
+assert(funk({"hello"}));
c = func2();
assert(strcmp(c{1}, "hello"));
diff --git a/Examples/test-suite/octave/overload_complicated_runme.m b/Examples/test-suite/octave/overload_complicated_runme.m
index 879bdc890..bbfc7ba19 100644
--- a/Examples/test-suite/octave/overload_complicated_runme.m
+++ b/Examples/test-suite/octave/overload_complicated_runme.m
@@ -5,15 +5,15 @@ endif
overload_complicated
-pInt = None;
+pInt = []; # NULL
# Check the correct constructors are available
p = Pop(pInt);
-p = Pop(pInt, 0);
+p = Pop(pInt, false);
# Check overloaded in const only and pointers/references which target languages cannot disambiguate
-if (p.hip(0) != 701)
+if (p.hip(false) != 701)
error("Test 1 failed")
endif
@@ -26,16 +26,16 @@ if (p.hop(pInt) != 805)
error("Test 3 failed")
endif
-if (p.hop(0) != 801)
+if (p.hop(false) != 801)
error("Test 4 failed")
endif
# Few more variations and order shuffled
-if (p.pop(0) != 901)
+if (p.pop(false) != 901)
error("Test 5 failed")
endif
-if (p.pop(pInt) != 902)
+if (p.pop(pInt) != 904)
error("Test 6 failed")
endif
@@ -48,12 +48,12 @@ if (p.bop(pInt) != 1001)
error("Test 8 failed")
endif
-if (p.bip(pInt) != 2001)
+if (p.bip(pInt) != 2002)
error("Test 9 failed")
endif
# Globals
-if (muzak(0) != 3001)
+if (muzak(false) != 3001)
error("Test 10 failed")
endif
diff --git a/Examples/test-suite/octave/overload_null_runme.m b/Examples/test-suite/octave/overload_null_runme.m
new file mode 100644
index 000000000..a7c346c26
--- /dev/null
+++ b/Examples/test-suite/octave/overload_null_runme.m
@@ -0,0 +1,52 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+overload_null
+
+function check(a, b)
+ if (a != b)
+ error("%i does not equal %i", a, b);
+ endif
+end
+
+o = Overload();
+x = X();
+null = []; # NULL pointer
+
+check(1, o.byval1(x));
+check(2, o.byval1(null));
+
+check(3, o.byval2(null));
+check(4, o.byval2(x));
+
+check(5, o.byref1(x));
+check(6, o.byref1(null));
+
+check(7, o.byref2(null));
+check(8, o.byref2(x));
+
+check(9, o.byconstref1(x));
+check(10, o.byconstref1(null));
+
+check(11, o.byconstref2(null));
+check(12, o.byconstref2(x));
+
+# const pointer references
+check(13, o.byval1cpr(x));
+check(14, o.byval1cpr(null));
+
+check(15, o.byval2cpr(null));
+check(16, o.byval2cpr(x));
+
+# forward class declaration
+check(17, o.byval1forwardptr(x));
+check(18, o.byval1forwardptr(null));
+
+check(19, o.byval2forwardptr(null));
+check(20, o.byval2forwardptr(x));
+
+check(21, o.byval1forwardref(x));
+
+check(22, o.byval2forwardref(x));
diff --git a/Examples/test-suite/octave/return_const_value_runme.m b/Examples/test-suite/octave/return_const_value_runme.m
index 1219c9293..8b363f297 100644
--- a/Examples/test-suite/octave/return_const_value_runme.m
+++ b/Examples/test-suite/octave/return_const_value_runme.m
@@ -2,10 +2,10 @@ return_const_value
p = return_const_value.Foo_ptr.getPtr();
if (p.getVal() != 17)
- error("Runtime test1 faild. p.getVal()=", p.getVal())
+ error("Runtime test1 failed. p.getVal()=", p.getVal())
endif
p = return_const_value.Foo_ptr.getConstPtr();
if (p.getVal() != 17)
- error("Runtime test2 faild. p.getVal()=", p.getVal())
+ error("Runtime test2 failed. p.getVal()=", p.getVal())
endif
diff --git a/Examples/test-suite/octave/template_typedef_cplx2_runme.m b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
index 94d3beb79..a72e0f1e0 100644
--- a/Examples/test-suite/octave/template_typedef_cplx2_runme.m
+++ b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
@@ -12,7 +12,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(d)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(d)) != 1)
d
error("is not an ArithUnaryFunction")
error
@@ -26,7 +26,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(e)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(e)) != 1)
e
error("is not an ArithUnaryFunction")
endif
@@ -44,7 +44,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(c)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(c)) != 1)
c
error("is not an ArithUnaryFunction")
endif
@@ -57,7 +57,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(f)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(f)) != 1)
f
error("is not an ArithUnaryFunction")
endif
@@ -74,7 +74,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(g)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(g)) != 1)
g
error("is not an ArithUnaryFunction")
error
@@ -89,7 +89,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(h)) == -1)
+if (strfind('ArithUnaryFunction',swig_type(h)) == -1)
h
error("is not an ArithUnaryFunction")
endif
diff --git a/Examples/test-suite/octave/template_typedef_cplx_runme.m b/Examples/test-suite/octave/template_typedef_cplx_runme.m
index d00981cec..9e3e3888f 100644
--- a/Examples/test-suite/octave/template_typedef_cplx_runme.m
+++ b/Examples/test-suite/octave/template_typedef_cplx_runme.m
@@ -12,7 +12,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr("ArithUnaryFunction",swig_type(d)) != 1)
+if (strfind("ArithUnaryFunction",swig_type(d)) != 1)
d
error("is not an ArithUnaryFunction")
endif
@@ -24,7 +24,7 @@ catch
error(e, "is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(e)) != 1);
+if (strfind('ArithUnaryFunction',swig_type(e)) != 1);
c
error("is not an ArithUnaryFunction")
endif
@@ -42,7 +42,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(c)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(c)) != 1)
c
error("is not an ArithUnaryFunction")
endif
@@ -55,7 +55,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(f)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(f)) != 1)
f
error("is not an ArithUnaryFunction")
endif
@@ -72,7 +72,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(g)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(g)) != 1)
g
error("is not an ArithUnaryFunction")
endif
@@ -86,7 +86,7 @@ catch
error("is not an instance")
end_try_catch
-if (findstr('ArithUnaryFunction',swig_type(h)) != 1)
+if (strfind('ArithUnaryFunction',swig_type(h)) != 1)
h
error("is not an ArithUnaryFunction")
endif
diff --git a/Examples/test-suite/octave_cell_deref.i b/Examples/test-suite/octave_cell_deref.i
index 2e92ec4de..272ba7c99 100644
--- a/Examples/test-suite/octave_cell_deref.i
+++ b/Examples/test-suite/octave_cell_deref.i
@@ -1,7 +1,7 @@
%module octave_cell_deref
%inline {
- bool func(const char* s) {
+ bool funk(const char* s) {
return !strcmp("hello",s);
}
diff --git a/Examples/test-suite/overload_arrays.i b/Examples/test-suite/overload_arrays.i
index 42c08390a..272c96a3d 100644
--- a/Examples/test-suite/overload_arrays.i
+++ b/Examples/test-suite/overload_arrays.i
@@ -18,9 +18,10 @@
%rename(Foos) Foo;
#endif
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) type;
+#endif
-
-#ifndef SWIG_NO_OVERLOAD
%immutable Spam::type;
%inline %{
@@ -130,8 +131,6 @@ static char *bar(void *[SIZE]) {
%}
-#endif
-
%inline {
class ClassA
diff --git a/Examples/test-suite/overload_complicated.i b/Examples/test-suite/overload_complicated.i
index 63ed32b3a..08abaaed6 100644
--- a/Examples/test-suite/overload_complicated.i
+++ b/Examples/test-suite/overload_complicated.i
@@ -1,27 +1,27 @@
// A complicated test of overloaded functions
%module overload_complicated
-#ifndef SWIG_NO_OVERLOAD
-
-// Different warning filters needed for scripting languages (eg Python) and for statically typed languages (eg C#).
-%warnfilter(509, 516) Pop::Pop; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used.
-%warnfilter(509, 516) Pop::hip; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used.
-%warnfilter(509, 516) Pop::hop; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used.
-%warnfilter(509, 516) Pop::pop; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used.
-%warnfilter(516) Pop::bop; // Overloaded method xxxx ignored. Method at xxx:y used.
-%warnfilter(516) Pop::bip; // Overloaded method xxxx ignored. Method at xxx:y used.
-%warnfilter(509, 516) ::muzak; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used.
+// Different overloaded warning filters needed for scripting languages (eg Python) and for statically typed languages (eg C#).
+%warnfilter(509, 516) Pop::Pop;
+%warnfilter(509, 516) Pop::hip;
+%warnfilter(509, 516) Pop::hop;
+%warnfilter(509, 516) Pop::pop;
+%warnfilter(516) Pop::bop;
+%warnfilter(516) Pop::bip;
+%warnfilter(509, 516) ::muzak;
+%warnfilter(509, 516) foo;
%typemap(in, numinputs=0) int l { $1 = 4711; }
%inline %{
-double foo(int, int, char *, int) {
+int foo(int, int, char *, int) {
return 15;
}
-double foo(int i, int j, double k = 17.4, int l = 18, char m = 'P') {
- return i + j + k + l + (int) m;
+int foo(int i, int j, double k = 17.4, int l = 18 /* Note numinputs typemap above */, char m = 'P') {
+ int sum = i + j + (int)k + l + (int)m;
+ return sum;
}
struct Pop {
@@ -67,6 +67,3 @@ int muzak(int& i) { return 3003; }
int muzak(const int* i) { return 3004; }
%}
-
-#endif
-
diff --git a/Examples/test-suite/overload_copy.i b/Examples/test-suite/overload_copy.i
index a685f76e2..238d011a6 100644
--- a/Examples/test-suite/overload_copy.i
+++ b/Examples/test-suite/overload_copy.i
@@ -1,7 +1,6 @@
// Tests copy constructor
%module overload_copy
-#ifndef SWIG_NO_OVERLOAD
%inline %{
class Foo {
@@ -11,6 +10,3 @@ public:
};
%}
-
-#endif
-
diff --git a/Examples/test-suite/overload_method.i b/Examples/test-suite/overload_method.i
index 8b44b8172..f282df6e2 100644
--- a/Examples/test-suite/overload_method.i
+++ b/Examples/test-suite/overload_method.i
@@ -1,6 +1,11 @@
/* This test confirms the fix to sourceforge bug #3478922 for R */
%module overload_method
+
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%inline %{
class Base
{
diff --git a/Examples/test-suite/overload_null.i b/Examples/test-suite/overload_null.i
new file mode 100644
index 000000000..d4879fdb5
--- /dev/null
+++ b/Examples/test-suite/overload_null.i
@@ -0,0 +1,52 @@
+%module overload_null
+
+%{
+struct F {};
+%}
+
+%inline %{
+struct X {};
+struct Y {};
+struct F;
+
+struct Overload {
+ int byval1(X x) { return 1; }
+ int byval1(Y* y) { return 2; }
+
+ int byval2(Y* y) { return 3; }
+ int byval2(X x) { return 4; }
+
+ int byref1(X& x) { return 5; }
+ int byref1(Y* y) { return 6; }
+
+ int byref2(Y* y) { return 7; }
+ int byref2(X& x) { return 8; }
+
+ int byconstref1(const X& x) { return 9; }
+ int byconstref1(Y* y) { return 10; }
+
+ int byconstref2(Y* y) { return 11; }
+ int byconstref2(const X& x) { return 12; }
+
+ // const pointer references
+ int byval1cpr(X x) { return 13; }
+ int byval1cpr(Y*const& y) { return 14; }
+
+ int byval2cpr(Y*const& y) { return 15; }
+ int byval2cpr(X x) { return 16; }
+
+ // forward class declaration
+ int byval1forwardptr(X x) { return 17; }
+ int byval1forwardptr(F* f) { return 18; }
+
+ int byval2forwardptr(F* f) { return 19; }
+ int byval2forwardptr(X x) { return 20; }
+
+ int byval1forwardref(X x) { return 21; }
+ int byval1forwardref(F& f) { return -21; }
+
+ int byval2forwardref(F& f) { return -22; }
+ int byval2forwardref(X x) { return 22; }
+
+};
+%}
diff --git a/Examples/test-suite/overload_simple.i b/Examples/test-suite/overload_simple.i
index 6bedf6cef..ba1900b40 100644
--- a/Examples/test-suite/overload_simple.i
+++ b/Examples/test-suite/overload_simple.i
@@ -19,7 +19,10 @@
%rename(Foos) Foo;
#endif
-#ifndef SWIG_NO_OVERLOAD
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) type;
+#endif
+
%immutable Spam::type;
%inline %{
@@ -177,8 +180,6 @@ long long ll(long long ull) { return ull; }
%malloc(void);
%free(void);
-#endif
-
%inline {
class ClassA
diff --git a/Examples/test-suite/perl5/README b/Examples/test-suite/perl5/README
index 804dec8e8..f15c07849 100644
--- a/Examples/test-suite/perl5/README
+++ b/Examples/test-suite/perl5/README
@@ -6,7 +6,7 @@ Test::More Support
==
Test::More is a standard perl test harness tool.
-Support was added for for using Test::More in 1.3.28.
+Support was added for using Test::More in 1.3.28.
If adding a new test to this suite, please use Test::More.
There are a few legacy test cases which do not use Test::More and these ought to be converted:
diff --git a/Examples/test-suite/perl5/director_classes_runme.pl b/Examples/test-suite/perl5/director_classes_runme.pl
index a4fddeed9..5e72703e0 100644
--- a/Examples/test-suite/perl5/director_classes_runme.pl
+++ b/Examples/test-suite/perl5/director_classes_runme.pl
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 29;
+use Test::More tests => 32;
BEGIN { use_ok 'director_classes' }
require_ok 'director_classes';
@@ -10,6 +10,7 @@ require_ok 'director_classes';
sub Val { $_[1] }
sub Ref { $_[1] }
sub Ptr { $_[1] }
+ sub ConstPtrRef { $_[1] }
sub FullyOverloaded {
my $rv = shift->SUPER::FullyOverloaded(@_);
$rv =~ s/Base/__PACKAGE__/sge;
@@ -45,6 +46,7 @@ sub makeCalls { my($caller, $base) = @_;
is($caller->ValCall($dh)->{val}, $dh->{val}, "$bname.Val");
is($caller->RefCall($dh)->{val}, $dh->{val}, "$bname.Ref");
is($caller->PtrCall($dh)->{val}, $dh->{val}, "$bname.Ptr");
+ is($caller->ConstPtrRefCall($dh)->{val}, $dh->{val}, "$bname.ConstPtrRef");
is($caller->FullyOverloadedCall(1),
"${bname}::FullyOverloaded(int)",
"$bname.FullyOverloaded(int)");
diff --git a/Examples/test-suite/perl5/global_vars_runme.pl b/Examples/test-suite/perl5/global_vars_runme.pl
index b645f7bac..6375aa7da 100644
--- a/Examples/test-suite/perl5/global_vars_runme.pl
+++ b/Examples/test-suite/perl5/global_vars_runme.pl
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 6;
BEGIN { use_ok('global_vars') }
require_ok('global_vars');
@@ -9,3 +9,9 @@ isa_ok($an, 'global_vars::A');
$global_vars::ap = $an;
is($global_vars::ap, $an, "global var assignment");
+# Regression test for https://sourceforge.net/p/swig/bugs/564/ - changing the
+# value in C/C++ apparently wasn't reflected in Perl:
+$global_vars::x = 17;
+is($global_vars::x, 17, "global var assignment");
+global_vars::init();
+is($global_vars::x, 1234, "C++ global var change visible in Perl");
diff --git a/Examples/test-suite/perl5/overload_null_runme.pl b/Examples/test-suite/perl5/overload_null_runme.pl
new file mode 100644
index 000000000..7cc5090de
--- /dev/null
+++ b/Examples/test-suite/perl5/overload_null_runme.pl
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+use Test::More tests => 24;
+BEGIN { use_ok('overload_null') }
+require_ok('overload_null');
+
+my $o = new overload_null::Overload();
+my $x = new overload_null::X();
+
+is(1, $o->byval1($x));
+is(2, $o->byval1(undef));
+
+is(3, $o->byval2(undef));
+is(4, $o->byval2($x));
+
+is(5, $o->byref1($x));
+is(6, $o->byref1(undef));
+
+is(7, $o->byref2(undef));
+is(8, $o->byref2($x));
+
+is(9, $o->byconstref1($x));
+is(10, $o->byconstref1(undef));
+
+is(11, $o->byconstref2(undef));
+is(12, $o->byconstref2($x));
+
+# const pointer references
+is(13, $o->byval1cpr($x));
+is(14, $o->byval1cpr(undef));
+
+is(15, $o->byval2cpr(undef));
+is(16, $o->byval2cpr($x));
+
+# forward class declaration
+is(17, $o->byval1forwardptr($x));
+is(18, $o->byval1forwardptr(undef));
+
+is(19, $o->byval2forwardptr(undef));
+is(20, $o->byval2forwardptr($x));
+
+is(21, $o->byval1forwardref($x));
+
+is(22, $o->byval2forwardref($x));
diff --git a/Examples/test-suite/perl5/run-perl-test.pl b/Examples/test-suite/perl5/run-perl-test.pl
index 106bf002b..5ea4e5115 100644
--- a/Examples/test-suite/perl5/run-perl-test.pl
+++ b/Examples/test-suite/perl5/run-perl-test.pl
@@ -7,7 +7,7 @@ use strict;
my $command = shift @ARGV;
-my $output = `$^X $command 2>&1`;
+my $output = `$^X -I. $command 2>&1`;
die "SWIG Perl test failed: \n\n$output\n"
if $?;
diff --git a/Examples/test-suite/perl5/scilab_multivalue_runme.pl b/Examples/test-suite/perl5/scilab_multivalue_runme.pl
new file mode 100644
index 000000000..8be8834f7
--- /dev/null
+++ b/Examples/test-suite/perl5/scilab_multivalue_runme.pl
@@ -0,0 +1,88 @@
+use strict;
+use warnings;
+use Test::More tests => 44;
+BEGIN { use_ok('scilab_multivalue') }
+require_ok('scilab_multivalue');
+
+my($a, $b, $c, $d, $ret);
+
+# OUTPUT
+
+($a, $b) = scilab_multivalue::output2();
+is($a, 1, "[a, b] = output2(): a");
+is($b, 2, "[a, b] = output2(): b");
+
+($ret, $a, $b) = scilab_multivalue::output2Ret();
+is($ret, 3, "[a, b] = output2Ret(): b");
+is($a, 1, "[a, b] = output2Ret(): a");
+is($b, 2, "[a, b] = output2Ret(): b");
+
+($c, $d) = scilab_multivalue::output2Input2(1, 2);
+is($c, 2, "[c, d] = output2Input2(1, 2): c");
+is($d, 4, "[c, d] = output2Input2(1, 2): d");
+
+($ret, $c, $d) = scilab_multivalue::output2Input2Ret(1, 2);
+is($ret, 6, "[ret, c, d] = output2Input2Ret(1, 2): ret");
+is($c, 2, "[ret, c, d] = output2Input2Ret(1, 2): c");
+is($d, 4, "[ret, c, d = output2Input2Ret(1, 2): d");
+
+($ret, $a, $b, $c) = scilab_multivalue::output3Input1Ret(10);
+is($ret, 10, "[ret, a, b, c] = output3Input1Ret(10): ret");
+is($a, 11, "[ret, a, b, c] = output3Input1Ret(10): a");
+is($b, 12, "[ret, a, b, c] = output3Input1Ret(10): b");
+is($c, 13, "[ret, a, b, c] = output3Input1Ret(10): c");
+
+($ret, $a, $b, $c) = scilab_multivalue::output3Input3Ret(10, 20, 30);
+is($ret, 66, "[ret, a, b, c] = output3Input1Ret(10, 20, 30): ret");
+is($a, 11, "[ret, a, b, c] = output3Input1Ret(10, 20, 30): a");
+is($b, 22, "[ret, a, b, c] = output3Input1Ret(10, 20, 30): b");
+is($c, 33, "[ret, a, b, c] = output3Input1Ret(10, 20, 30): c");
+
+
+# INOUT
+
+($a, $b) = scilab_multivalue::inout2(1, 2);
+is($a, 2, "[a, b] = output2(1, 2): a");
+is($b, 4, "[a, b] = output2(1, 2): b");
+
+($ret, $a, $b) = scilab_multivalue::inout2Ret(1, 2);
+is($ret, 6, "[a, b] = inout2Ret(1, 2): b");
+is($a, 2, "[a, b] = inout2Ret(1, 2): a");
+is($b, 4, "[a, b] = inout2Ret(1, 2): b");
+
+($c, $d) = scilab_multivalue::inout2Input2(1, 2, 1, 1);
+is($c, 2, "[c, d] = inout2Input2(1, 2): c");
+is($d, 3, "[c, d] = inout2Input2(1, 2): d");
+
+($ret, $c, $d) = scilab_multivalue::inout2Input2Ret(1, 2, 1, 1);
+is($ret, 5, "[c, d] = inout2Input2Ret(1, 2): ret");
+is($c, 2, "[c, d] = inout2Input2Ret(1, 2): c");
+is($d, 3, "[c, d] = inout2Input2Ret(1, 4): d");
+
+($ret, $a, $b, $c) = scilab_multivalue::inout3Input1Ret(10, 1, 2, 3);
+is($ret, 10, "[ret, a, b, c] = output3Input1Ret(ret, 1, 2, 3): ret");
+is($a, 11, "[ret, a, b, c] = output3Input1Ret(ret, 1, 2, 3): a");
+is($b, 12, "[ret, a, b, c] = output3Input1Ret(ret, 1, 2, 3): b");
+is($c, 13, "[ret, a, b, c] = output3Input1Ret(ret, 1, 2, 3): c");
+
+($ret, $a, $b, $c) = scilab_multivalue::inout3Input3Ret(10, 1, 20, 2, 30, 3);
+is($ret, 66, "[ret, a, b, c] = output3Input1Ret(10, 20, 30): ret");
+is($a, 11, "[ret, a, b, c] = inout3Input1Ret(10, 1, 20, 2, 30, 3): a");
+is($b, 22, "[ret, a, b, c] = inout3Input1Ret(10, 1, 20, 2, 30, 3): b");
+is($c, 33, "[ret, a, b, c] = inout3Input1Ret(10, 1, 20, 2, 30, 3): c");
+
+
+# CLASS
+
+$a = scilab_multivalue::ClassA->new();
+
+($ret, $c, $d) = $a->output2Input2Ret(1, 2);
+is($ret, 6, "[ret, c, d] = ClassA_output2Input2Ret(a, 1, 2): ret");
+is($c, 2, "[c, d] = ClassA_output2Input2Ret(a, 1, 2): c");
+is($d, 4, "[c, d] = ClassA_output2Input2Ret(a, 1, 2): d");
+
+($ret, $c, $d) = $a->inout2Input2Ret(1, 2, 1, 1);
+is($ret, 5, "[ret, c, d] = ClassA_inout2Input2Ret(a, 1, 2): ret");
+is($c, 2, "[c, d] = ClassA_inout2Input2(a, 1, 2): c");
+is($d, 3, "[c, d] = ClassA_inout2Input2(a, 1, 2): d");
+
diff --git a/Examples/test-suite/php/Makefile.in b/Examples/test-suite/php/Makefile.in
index c554e2b17..64f0d1f9d 100644
--- a/Examples/test-suite/php/Makefile.in
+++ b/Examples/test-suite/php/Makefile.in
@@ -14,6 +14,7 @@ CPP_TEST_CASES += \
li_factory \
php_iterator \
php_namewarn_rename \
+ php_pragma \
include $(srcdir)/../common.mk
diff --git a/Examples/test-suite/php/abstract_inherit_ok_runme.php b/Examples/test-suite/php/abstract_inherit_ok_runme.php
index c2d86499b..c2c343dac 100644
--- a/Examples/test-suite/php/abstract_inherit_ok_runme.php
+++ b/Examples/test-suite/php/abstract_inherit_ok_runme.php
@@ -3,7 +3,7 @@
require "tests.php";
require "abstract_inherit_ok.php";
-check::classes(array(Foo,Spam));
+check::classes(array('Foo','Spam'));
$spam=new Spam();
check::equal(0,$spam->blah(),"spam object method");
diff --git a/Examples/test-suite/php/abstract_inherit_runme.php b/Examples/test-suite/php/abstract_inherit_runme.php
index 3554e6fd8..514bbc3b0 100644
--- a/Examples/test-suite/php/abstract_inherit_runme.php
+++ b/Examples/test-suite/php/abstract_inherit_runme.php
@@ -3,7 +3,7 @@
require "tests.php";
require "abstract_inherit.php";
-check::classes(array(Foo,Bar,Spam,NRFilter_i,NRRCFilter_i,NRRCFilterpro_i,NRRCFilterpri_i));
+check::classes(array('Foo','Bar','Spam','NRFilter_i','NRRCFilter_i','NRRCFilterpro_i','NRRCFilterpri_i'));
// This constructor attempt should fail as there isn't one
//$spam=new Spam();
diff --git a/Examples/test-suite/php/add_link_runme.php b/Examples/test-suite/php/add_link_runme.php
index 7523bd604..3e16fa1df 100644
--- a/Examples/test-suite/php/add_link_runme.php
+++ b/Examples/test-suite/php/add_link_runme.php
@@ -4,15 +4,15 @@ require "tests.php";
require "add_link.php";
// No new functions, except the flat functions
-check::functions(array(new_foo,foo_blah));
+check::functions(array('new_foo','foo_blah'));
-check::classes(array(Foo));
+check::classes(array('Foo'));
$foo=new foo();
-check::is_a($foo,foo);
+check::is_a($foo,'foo');
$foo_blah=$foo->blah();
-check::is_a($foo_blah,foo);
+check::is_a($foo_blah,'foo');
//fails, can't be called as a class method, should allow and make it nil?
//$class_foo_blah=foo::blah();
diff --git a/Examples/test-suite/php/argout_runme.php b/Examples/test-suite/php/argout_runme.php
index 33fbd8129..8b66613fd 100644
--- a/Examples/test-suite/php/argout_runme.php
+++ b/Examples/test-suite/php/argout_runme.php
@@ -3,7 +3,7 @@
require "tests.php";
require "argout.php";
-check::functions(array(incp,incr,inctr,new_intp,copy_intp,delete_intp,intp_assign,intp_value,voidhandle,handle));
+check::functions(array('incp','incr','inctr','new_intp','copy_intp','delete_intp','intp_assign','intp_value','voidhandle','handle'));
$ip=copy_intp(42);
check::equal(42,incp($ip),"42==incp($ip)");
@@ -30,7 +30,7 @@ unset($handle);
#$handledata=handle($handle);
#check::equal($handledata,"Here it is","\$handledata != \"Here it is\"");
-unset($handle);
+$handle=NULL;
voidhandle($handle);
check::isnull($handle,'$handle not null');
diff --git a/Examples/test-suite/php/arrayptr_runme.php b/Examples/test-suite/php/arrayptr_runme.php
index 3b9baed05..86b7f8628 100644
--- a/Examples/test-suite/php/arrayptr_runme.php
+++ b/Examples/test-suite/php/arrayptr_runme.php
@@ -4,7 +4,7 @@ require "tests.php";
require "arrayptr.php";
// No new functions
-check::functions(array(foo));
+check::functions(array('foo'));
// No new classes
check::classes(array());
// now new vars
diff --git a/Examples/test-suite/php/arrays_global_runme.php b/Examples/test-suite/php/arrays_global_runme.php
index 12a7806c9..95a300775 100644
--- a/Examples/test-suite/php/arrays_global_runme.php
+++ b/Examples/test-suite/php/arrays_global_runme.php
@@ -3,17 +3,17 @@
require "tests.php";
require "arrays_global.php";
-check::functions(array(test_a,test_b,new_simplestruct,new_material));
-check::classes(array(arrays_global,SimpleStruct,Material));
-check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i,beginstring_fix44a,beginstring_fix44b,beginstring_fix44c,beginstring_fix44d,beginstring_fix44e,beginstring_fix44f,chitmat,hitmat_val,hitmat,simplestruct_double_field));
+check::functions(array('test_a','test_b','new_simplestruct','new_material'));
+check::classes(array('arrays_global','SimpleStruct','Material'));
+check::globals(array('array_c','array_sc','array_uc','array_s','array_us','array_i','array_ui','array_l','array_ul','array_ll','array_f','array_d','array_struct','array_structpointers','array_ipointers','array_enum','array_enumpointers','array_const_i','beginstring_fix44a','beginstring_fix44b','beginstring_fix44c','beginstring_fix44d','beginstring_fix44e','beginstring_fix44f','chitmat','hitmat_val','hitmat','simplestruct_double_field'));
// The size of array_c is 2, but the last byte is \0, so we can only store a
// single byte string in it.
-check::set(array_c,"Z");
-check::equal("Z",check::get(array_c),"set array_c");
-check::set(array_c,"xy");
-check::equal("x",check::get(array_c),"set array_c");
-check::set(array_c,"h");
-check::equal("h",check::get(array_c),"set array_c");
+check::set("array_c","Z");
+check::equal("Z",check::get("array_c"),"set array_c");
+check::set("array_c","xy");
+check::equal("x",check::get("array_c"),"set array_c");
+check::set("array_c","h");
+check::equal("h",check::get("array_c"),"set array_c");
check::done();
?>
diff --git a/Examples/test-suite/php/arrays_global_twodim_runme.php b/Examples/test-suite/php/arrays_global_twodim_runme.php
index 40ecf1719..d9f50a6de 100644
--- a/Examples/test-suite/php/arrays_global_twodim_runme.php
+++ b/Examples/test-suite/php/arrays_global_twodim_runme.php
@@ -3,14 +3,14 @@
require "tests.php";
require "arrays_global_twodim.php";
-check::functions(array(fn_taking_arrays,get_2d_array,new_simplestruct,new_material));
-check::classes(array(arrays_global_twodim,SimpleStruct,Material));
-check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i,chitmat,hitmat_val,hitmat,simplestruct_double_field));
+check::functions(array('fn_taking_arrays','get_2d_array','new_simplestruct','new_material'));
+check::classes(array('arrays_global_twodim','SimpleStruct','Material'));
+check::globals(array('array_c','array_sc','array_uc','array_s','array_us','array_i','array_ui','array_l','array_ul','array_ll','array_f','array_d','array_struct','array_structpointers','array_ipointers','array_enum','array_enumpointers','array_const_i','chitmat','hitmat_val','hitmat','simplestruct_double_field'));
$a1=array(10,11,12,13);
$a2=array(14,15,16,17);
$a=array($a1,$a2);
-$_a=check::get(array_const_i);
+$_a=check::get('array_const_i');
for($x=0;$x<count($a1);$x++) {
for($y=0;$y<2;$y++) {
diff --git a/Examples/test-suite/php/arrays_runme.php b/Examples/test-suite/php/arrays_runme.php
index ae17d05e7..c6e9e8f70 100644
--- a/Examples/test-suite/php/arrays_runme.php
+++ b/Examples/test-suite/php/arrays_runme.php
@@ -2,12 +2,12 @@
require "tests.php";
require "arrays.php";
-check::functions(array(fn_taking_arrays,newintpointer,setintfrompointer,getintfrompointer,array_pointer_func));
-check::classes(array(arrays,SimpleStruct,ArrayStruct,CartPoseData_t));
-check::globals(array(simplestruct_double_field,arraystruct_array_c,arraystruct_array_sc,arraystruct_array_uc,arraystruct_array_s,arraystruct_array_us,arraystruct_array_i,arraystruct_array_ui,arraystruct_array_l,arraystruct_array_ul,arraystruct_array_ll,arraystruct_array_f,arraystruct_array_d,arraystruct_array_struct,arraystruct_array_structpointers,arraystruct_array_ipointers,arraystruct_array_enum,arraystruct_array_enumpointers,arraystruct_array_const_i,cartposedata_t_p));
+check::functions(array('fn_taking_arrays','newintpointer','setintfrompointer','getintfrompointer','array_pointer_func'));
+check::classes(array('arrays','SimpleStruct','ArrayStruct','CartPoseData_t'));
+check::globals(array('simplestruct_double_field','arraystruct_array_c','arraystruct_array_sc','arraystruct_array_uc','arraystruct_array_s','arraystruct_array_us','arraystruct_array_i','arraystruct_array_ui','arraystruct_array_l','arraystruct_array_ul','arraystruct_array_ll','arraystruct_array_f','arraystruct_array_d','arraystruct_array_struct','arraystruct_array_structpointers','arraystruct_array_ipointers','arraystruct_array_enum','arraystruct_array_enumpointers','arraystruct_array_const_i','cartposedata_t_p'));
$ss=new simplestruct();
-check::classname(simplestruct,$ss);
+check::classname('simplestruct',$ss);
$as=new arraystruct();
$as->array_c="abc";
diff --git a/Examples/test-suite/php/arrays_scope_runme.php b/Examples/test-suite/php/arrays_scope_runme.php
index c208b7518..11c180870 100644
--- a/Examples/test-suite/php/arrays_scope_runme.php
+++ b/Examples/test-suite/php/arrays_scope_runme.php
@@ -4,11 +4,11 @@ require "tests.php";
require "arrays_scope.php";
// New functions
-check::functions(array(new_bar,bar_blah));
+check::functions(array('new_bar','bar_blah'));
// New classes
-check::classes(array(arrays_scope,Bar));
+check::classes(array('arrays_scope','Bar'));
// New vars
-check::globals(array(bar_adata,bar_bdata,bar_cdata));
+check::globals(array('bar_adata','bar_bdata','bar_cdata'));
$bar=new bar();
diff --git a/Examples/test-suite/php/casts_runme.php b/Examples/test-suite/php/casts_runme.php
index 10522dca4..a9623a328 100644
--- a/Examples/test-suite/php/casts_runme.php
+++ b/Examples/test-suite/php/casts_runme.php
@@ -4,13 +4,13 @@ require "tests.php";
require "casts.php";
// No new functions
-check::functions(array(new_a,a_hello,new_b));
+check::functions(array('new_a','a_hello','new_b'));
// No new classes
-check::classes(array(A,B));
+check::classes(array('A','B'));
// now new vars
check::globals(array());
-# Make sure $b inherites hello() from class A
+# Make sure $b inherits hello() from class A
$b=new B();
$b->hello();
diff --git a/Examples/test-suite/php/class_ignore_runme.php b/Examples/test-suite/php/class_ignore_runme.php
index d5ce36217..ae4881f27 100644
--- a/Examples/test-suite/php/class_ignore_runme.php
+++ b/Examples/test-suite/php/class_ignore_runme.php
@@ -3,8 +3,8 @@
require "tests.php";
require "class_ignore.php";
-check::functions(array(do_blah,new_bar,bar_blah,new_boo,boo_away,new_far,new_hoo));
-check::classes(array(class_ignore,Bar,Boo,Far,Hoo));
+check::functions(array('do_blah','new_bar','bar_blah','new_boo','boo_away','new_far','new_hoo'));
+check::classes(array('class_ignore','Bar','Boo','Far','Hoo'));
// No new vars
check::globals(array());
diff --git a/Examples/test-suite/php/cpp_basic_runme.php b/Examples/test-suite/php/cpp_basic_runme.php
index 6a8522e3e..b24cf7000 100644
--- a/Examples/test-suite/php/cpp_basic_runme.php
+++ b/Examples/test-suite/php/cpp_basic_runme.php
@@ -4,11 +4,11 @@ require "tests.php";
require "cpp_basic.php";
// New functions
-check::functions(array(foo_func1,foo_func2,foo___str__,foosubsub___str__,bar_test,bar_testfoo,get_func1_ptr,get_func2_ptr,test_func_ptr,fl_window_show));
+check::functions(array('foo_func1','foo_func2','foo___str__','foosubsub___str__','bar_test','bar_testfoo','get_func1_ptr','get_func2_ptr','test_func_ptr','fl_window_show'));
// New classes
-check::classes(array(cpp_basic,Foo,FooSub,FooSubSub,Bar,Fl_Window));
+check::classes(array('cpp_basic','Foo','FooSub','FooSubSub','Bar','Fl_Window'));
// New vars
-check::globals(array(foo_num,foo_func_ptr,bar_fptr,bar_fref,bar_fval,bar_cint,bar_global_fptr,bar_global_fref,bar_global_fval));
+check::globals(array('foo_num','foo_func_ptr','bar_fptr','bar_fref','bar_fval','bar_cint','bar_global_fptr','bar_global_fref','bar_global_fval'));
$f = new Foo(3);
$f->func_ptr = get_func1_ptr();
diff --git a/Examples/test-suite/php/cpp_static_runme.php b/Examples/test-suite/php/cpp_static_runme.php
index 9b436b87c..20b50dd9e 100644
--- a/Examples/test-suite/php/cpp_static_runme.php
+++ b/Examples/test-suite/php/cpp_static_runme.php
@@ -4,11 +4,11 @@ require "tests.php";
require "cpp_static.php";
// New functions
-check::functions(array(staticfunctiontest_static_func,staticfunctiontest_static_func_2,staticfunctiontest_static_func_3,is_python_builtin));
+check::functions(array('staticfunctiontest_static_func','staticfunctiontest_static_func_2','staticfunctiontest_static_func_3','is_python_builtin','staticmembertest_grab_int','staticbase_grab_statty_base','staticderived_grab_statty_derived'));
// New classes
-check::classes(array(StaticMemberTest,StaticFunctionTest,cpp_static,StaticBase,StaticDerived));
+check::classes(array('StaticMemberTest','StaticFunctionTest','cpp_static','StaticBase','StaticDerived'));
// New vars
-check::globals(array(staticmembertest_static_int,staticbase_statty,staticderived_statty));
+check::globals(array('staticmembertest_static_int','staticbase_statty','staticderived_statty'));
check::done();
?>
diff --git a/Examples/test-suite/php/director_abstract_runme.php b/Examples/test-suite/php/director_abstract_runme.php
index ca3d676da..1a119cfd5 100644
--- a/Examples/test-suite/php/director_abstract_runme.php
+++ b/Examples/test-suite/php/director_abstract_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_abstract.php";
// No new functions
-check::functions(array(foo_ping,foo_pong,example0_getxsize,example0_color,example0_get_color,example1_getxsize,example1_color,example1_get_color,example2_getxsize,example2_color,example2_get_color,example4_getxsize,example4_color,example4_get_color,example3_i_color,example3_i_get_color,g,a_f));
+check::functions(array('foo_ping','foo_pong','example0_getxsize','example0_color','example0_get_color','example1_getxsize','example1_color','example1_get_color','example2_getxsize','example2_color','example2_get_color','example4_getxsize','example4_color','example4_get_color','example3_i_color','example3_i_get_color','g','a_f'));
// No new classes
-check::classes(array(director_abstract,Foo,Example0,Example1,Example2,Example4,Example3_i,A));
+check::classes(array('director_abstract','Foo','Example0','Example1','Example2','Example4','Example3_i','A'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_basic_runme.php b/Examples/test-suite/php/director_basic_runme.php
index de6b50502..478a36f80 100644
--- a/Examples/test-suite/php/director_basic_runme.php
+++ b/Examples/test-suite/php/director_basic_runme.php
@@ -4,11 +4,11 @@ require "tests.php";
require "director_basic.php";
// No new functions
-check::functions(array(foo_ping,foo_pong,foo_get_self,a_f,a_rg,a1_ff,myclass_method,myclass_vmethod,myclass_pmethod,myclass_cmethod,myclass_get_self,myclass_call_pmethod,myclasst_i_method));
+check::functions(array('foo_ping','foo_pong','foo_get_self','a_f','a_rg','a1_ff','myclass_method','myclass_vmethod','myclass_pmethod','myclass_cmethod','myclass_get_self','myclass_call_pmethod','myclasst_i_method','myclass_nonvirtual','myclass_nonoverride','myclass_call_nonvirtual','myclass_call_nonoverride','myclass_connect'));
// No new classes
-check::classes(array(Foo,A,A1,Bar,MyClass,MyClassT_i));
+check::classes(array('Foo','A','A1','Bar','MyClass','MyClassT_i'));
// now new vars
-check::globals(array(bar_x));
+check::globals(array('bar_x'));
class PhpFoo extends Foo {
function ping() {
diff --git a/Examples/test-suite/php/director_classic_runme.php b/Examples/test-suite/php/director_classic_runme.php
index d2da1b1ba..a44881e04 100644
--- a/Examples/test-suite/php/director_classic_runme.php
+++ b/Examples/test-suite/php/director_classic_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_classic.php";
// No new functions
-check::functions(array(being_id,person_id,child_id,grandchild_id,caller_delcallback,caller_setcallback,caller_resetcallback,caller_call,caller_baseclass));
+check::functions(array('being_id','person_id','child_id','grandchild_id','caller_delcallback','caller_setcallback','caller_resetcallback','caller_call','caller_baseclass'));
// No new classes
-check::classes(array(Being,Person,Child,GrandChild,OrphanPerson,OrphanChild,Caller));
+check::classes(array('Being','Person','Child','GrandChild','OrphanPerson','OrphanChild','Caller'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_default_runme.php b/Examples/test-suite/php/director_default_runme.php
index f97fc7425..c459ce3ec 100644
--- a/Examples/test-suite/php/director_default_runme.php
+++ b/Examples/test-suite/php/director_default_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_default.php";
// No new functions
-check::functions(array(foo_msg,foo_getmsg,bar_msg,bar_getmsg,defaultsbase_defaultargs,defaultsderived_defaultargs));
+check::functions(array('foo_msg','foo_getmsg','bar_msg','bar_getmsg','defaultsbase_defaultargs','defaultsderived_defaultargs'));
// No new classes
-check::classes(array(Foo,Bar,DefaultsBase,DefaultsDerived));
+check::classes(array('Foo','Bar','DefaultsBase','DefaultsDerived'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_detect_runme.php b/Examples/test-suite/php/director_detect_runme.php
index cc19c0302..a6d3aebd6 100644
--- a/Examples/test-suite/php/director_detect_runme.php
+++ b/Examples/test-suite/php/director_detect_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_detect.php";
// No new functions
-check::functions(array(foo_cloner,foo_get_value,foo_get_class,foo_just_do_it,bar_baseclass,bar_cloner,bar_get_value,bar_get_class,bar_just_do_it));
+check::functions(array('foo_cloner','foo_get_value','foo_get_class','foo_just_do_it','bar_baseclass','bar_cloner','bar_get_value','bar_get_class','bar_just_do_it'));
// No new classes
-check::classes(array(A,Foo,Bar));
+check::classes(array('A','Foo','Bar'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_enum_runme.php b/Examples/test-suite/php/director_enum_runme.php
index 8f6487a28..0571ec0da 100644
--- a/Examples/test-suite/php/director_enum_runme.php
+++ b/Examples/test-suite/php/director_enum_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_enum.php";
// No new functions
-check::functions(array(foo_say_hello,foo_say_hi,foo_say_bye,foo_say_hi_ref,foo_ping,foo_ping_ref,foo_ping_member_enum,a_f,a2_f));
+check::functions(array('foo_say_hello','foo_say_hi','foo_say_bye','foo_say_hi_ref','foo_ping','foo_ping_ref','foo_ping_member_enum','a_f','a2_f'));
// No new classes
-check::classes(array(director_enum,Foo,A,B,A2,B2));
+check::classes(array('director_enum','Foo','A','B','A2','B2'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_exception_runme.php b/Examples/test-suite/php/director_exception_runme.php
index 8b852c2ce..dd2d04e8a 100644
--- a/Examples/test-suite/php/director_exception_runme.php
+++ b/Examples/test-suite/php/director_exception_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_exception.php";
// No new functions
-check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang,returnalltypes_return_int,returnalltypes_return_double,returnalltypes_return_const_char_star,returnalltypes_return_std_string,returnalltypes_return_bar,returnalltypes_call_int,returnalltypes_call_double,returnalltypes_call_const_char_star,returnalltypes_call_std_string,returnalltypes_call_bar,is_python_builtin));
+check::functions(array('foo_ping','foo_pong','launder','bar_ping','bar_pong','returnalltypes_return_int','returnalltypes_return_double','returnalltypes_return_const_char_star','returnalltypes_return_std_string','returnalltypes_return_bar','returnalltypes_call_int','returnalltypes_call_double','returnalltypes_call_const_char_star','returnalltypes_call_std_string','returnalltypes_call_bar','is_python_builtin'));
// No new classes
-check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
+check::classes(array('director_exception','Foo','Exception1','Exception2','Base','Bar','ReturnAllTypes'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_extend_runme.php b/Examples/test-suite/php/director_extend_runme.php
index f283aefbe..7aa2e0f78 100644
--- a/Examples/test-suite/php/director_extend_runme.php
+++ b/Examples/test-suite/php/director_extend_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_extend.php";
// No new functions
-check::functions(array(spobject_getfoobar,spobject_dummy,spobject_exceptionmethod));
+check::functions(array('spobject_getfoobar','spobject_dummy','spobject_exceptionmethod'));
// No new classes
-check::classes(array(SpObject));
+check::classes(array('SpObject'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_finalizer_runme.php b/Examples/test-suite/php/director_finalizer_runme.php
index 0fcddfd8b..96bb5c179 100644
--- a/Examples/test-suite/php/director_finalizer_runme.php
+++ b/Examples/test-suite/php/director_finalizer_runme.php
@@ -4,16 +4,16 @@ require "tests.php";
require "director_finalizer.php";
// No new functions
-check::functions(array(foo_orstatus,deletefoo,getstatus,launder,resetstatus));
+check::functions(array('foo_orstatus','deletefoo','getstatus','launder','resetstatus'));
// No new classes
-check::classes(array(director_finalizer,Foo));
+check::classes(array('director_finalizer','Foo'));
// now new vars
check::globals(array());
class MyFoo extends Foo {
function __destruct() {
$this->orStatus(2);
- if (method_exists(parent, "__destruct")) {
+ if (method_exists(get_parent_class(), "__destruct")) {
parent::__destruct();
}
}
diff --git a/Examples/test-suite/php/director_frob_runme.php b/Examples/test-suite/php/director_frob_runme.php
index 548b0b804..450a1234b 100644
--- a/Examples/test-suite/php/director_frob_runme.php
+++ b/Examples/test-suite/php/director_frob_runme.php
@@ -4,11 +4,11 @@ require "tests.php";
require "director_frob.php";
// No new functions
-check::functions(array(alpha_abs_method,bravo_abs_method,charlie_abs_method,ops_opint,ops_opintstarstarconst,ops_opintamp,ops_opintstar,ops_opconstintintstar,prims_ull,prims_callull,corecallbacks_on3dengineredrawn,corecallbacks_on3dengineredrawn2));
+check::functions(array('alpha_abs_method','bravo_abs_method','charlie_abs_method','ops_opint','ops_opintstarstarconst','ops_opintamp','ops_opintstar','ops_opconstintintstar','prims_ull','prims_callull','corecallbacks_on3dengineredrawn','corecallbacks_on3dengineredrawn2'));
// No new classes
-check::classes(array(Alpha,Bravo,Charlie,Delta,Ops,Prims,corePoint3d,coreCallbacks_On3dEngineRedrawnData,coreCallbacksOn3dEngineRedrawnData,coreCallbacks));
+check::classes(array('Alpha','Bravo','Charlie','Delta','Ops','Prims','corePoint3d','coreCallbacks_On3dEngineRedrawnData','coreCallbacksOn3dEngineRedrawnData','coreCallbacks'));
// now new vars
-check::globals(array(corecallbacks_on3dengineredrawndata__eye,corecallbacks_on3dengineredrawndata__at,corecallbackson3dengineredrawndata__eye,corecallbackson3dengineredrawndata__at));
+check::globals(array('corecallbacks_on3dengineredrawndata__eye','corecallbacks_on3dengineredrawndata__at','corecallbackson3dengineredrawndata__eye','corecallbackson3dengineredrawndata__at'));
$foo = new Bravo();
$s = $foo->abs_method();
diff --git a/Examples/test-suite/php/director_nested_runme.php b/Examples/test-suite/php/director_nested_runme.php
index 4965e94f7..9a094a182 100644
--- a/Examples/test-suite/php/director_nested_runme.php
+++ b/Examples/test-suite/php/director_nested_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_nested.php";
// No new functions
-check::functions(array(foo_int_advance,foo_int_do_advance,bar_step,bar_do_advance,bar_do_step,foobar_int_get_value,foobar_int_get_name,foobar_int_name,foobar_int_get_self,foobar_int_do_advance,foobar_int_do_step));
+check::functions(array('foo_int_advance','foo_int_do_advance','bar_step','bar_do_advance','bar_do_step','foobar_int_get_value','foobar_int_get_name','foobar_int_name','foobar_int_get_self','foobar_int_do_advance','foobar_int_do_step'));
// No new classes
-check::classes(array(Foo_int,Bar,FooBar_int));
+check::classes(array('Foo_int','Bar','FooBar_int'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_profile_runme.php b/Examples/test-suite/php/director_profile_runme.php
index c72421341..c6f4c3c94 100644
--- a/Examples/test-suite/php/director_profile_runme.php
+++ b/Examples/test-suite/php/director_profile_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_profile.php";
// No new functions
-check::functions(array(b_fn,b_vfi,b_fi,b_fj,b_fk,b_fl,b_get_self,b_vfs,b_fs));
+check::functions(array('b_fn','b_vfi','b_fi','b_fj','b_fk','b_fl','b_get_self','b_vfs','b_fs'));
// No new classes
-check::classes(array(A,B));
+check::classes(array('A','B'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_protected_runme.php b/Examples/test-suite/php/director_protected_runme.php
index 18586ca62..e759fed25 100644
--- a/Examples/test-suite/php/director_protected_runme.php
+++ b/Examples/test-suite/php/director_protected_runme.php
@@ -3,9 +3,9 @@
require "tests.php";
require "director_protected.php";
-check::functions(array(foo_pong,foo_s,foo_q,foo_ping,foo_pang,foo_used,foo_cheer,bar_create,bar_callping,bar_callcheer,bar_cheer,bar_pong,bar_used,bar_ping,bar_pang,a_draw,b_draw));
-check::classes(array(Foo,Bar,PrivateFoo,A,B,AA,BB));
-check::globals(array(bar_a));
+check::functions(array('foo_pong','foo_s','foo_q','foo_ping','foo_pang','foo_used','foo_cheer','bar_create','bar_callping','bar_callcheer','bar_cheer','bar_pong','bar_used','bar_ping','bar_pang','a_draw','b_draw'));
+check::classes(array('Foo','Bar','PrivateFoo','A','B','AA','BB'));
+check::globals(array('bar_a'));
class FooBar extends Bar {
protected function ping() {
diff --git a/Examples/test-suite/php/director_stl_runme.php b/Examples/test-suite/php/director_stl_runme.php
index 29addd261..f7a5c0aa0 100644
--- a/Examples/test-suite/php/director_stl_runme.php
+++ b/Examples/test-suite/php/director_stl_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_stl.php";
// No new functions
-check::functions(array(foo_bar,foo_ping,foo_pong,foo_tping,foo_tpong,foo_pident,foo_vident,foo_vsecond,foo_tpident,foo_tvident,foo_tvsecond,foo_vidents,foo_tvidents));
+check::functions(array('foo_bar','foo_ping','foo_pong','foo_tping','foo_tpong','foo_pident','foo_vident','foo_vsecond','foo_tpident','foo_tvident','foo_tvsecond','foo_vidents','foo_tvidents'));
// No new classes
-check::classes(array(Foo));
+check::classes(array('Foo'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/director_string_runme.php b/Examples/test-suite/php/director_string_runme.php
index 5ac583f78..77e84c9bf 100644
--- a/Examples/test-suite/php/director_string_runme.php
+++ b/Examples/test-suite/php/director_string_runme.php
@@ -4,11 +4,11 @@ require "tests.php";
require "director_string.php";
// No new functions
-check::functions(array(a_get_first,a_call_get_first,a_string_length,a_process_text,a_call_process_func,stringvector_size,stringvector_is_empty,stringvector_clear,stringvector_push,stringvector_pop,stringvector_capacity,stringvector_reserve));
+check::functions(array('a_get_first','a_call_get_first','a_string_length','a_process_text','a_call_process_func','stringvector_size','stringvector_is_empty','stringvector_clear','stringvector_push','stringvector_pop','stringvector_capacity','stringvector_reserve'));
// No new classes
-check::classes(array(A,StringVector));
+check::classes(array('A','StringVector'));
// now new vars
-check::globals(array(a,a_call,a_m_strings,stringvector));
+check::globals(array('a','a_call','a_m_strings','stringvector'));
class B extends A {
function get_first() {
diff --git a/Examples/test-suite/php/director_thread_runme.php b/Examples/test-suite/php/director_thread_runme.php
index ab0563213..2a640a022 100644
--- a/Examples/test-suite/php/director_thread_runme.php
+++ b/Examples/test-suite/php/director_thread_runme.php
@@ -8,11 +8,11 @@ require "director_thread.php";
exit(0);
// No new functions
-check::functions(array(millisecondsleep,foo_stop,foo_run,foo_do_foo));
+check::functions(array('millisecondsleep','foo_stop','foo_run','foo_do_foo'));
// No new classes
-check::classes(array(director_thread,Foo));
+check::classes(array('director_thread','Foo'));
// now new vars
-check::globals(array(foo_val));
+check::globals(array('foo_val'));
class Derived extends Foo {
function do_foo() {
diff --git a/Examples/test-suite/php/director_unroll_runme.php b/Examples/test-suite/php/director_unroll_runme.php
index 626b1f07d..e3101887d 100644
--- a/Examples/test-suite/php/director_unroll_runme.php
+++ b/Examples/test-suite/php/director_unroll_runme.php
@@ -4,11 +4,11 @@ require "tests.php";
require "director_unroll.php";
// No new functions
-check::functions(array(foo_ping,foo_pong));
+check::functions(array('foo_ping','foo_pong'));
// No new classes
-check::classes(array(Foo,Bar));
+check::classes(array('Foo','Bar'));
// now new vars
-check::globals(array(bar));
+check::globals(array('bar'));
class MyFoo extends Foo {
function ping() {
@@ -23,7 +23,10 @@ $b = new Bar();
$b->set($a);
$c = $b->get();
-check::equal($a->this, $c->this, "this failed");
+// FIXME: This doesn't work for checking that they wrap the same C++ object
+// because the two objects have different PHP resources, and we can't easily
+// look inside those resources to see which C++ objects they refer to.
+//check::equal($a->_cPtr, $c->_cPtr, "_cPtr check failed");
check::done();
?>
diff --git a/Examples/test-suite/php/evil_diamond_prop_runme.php b/Examples/test-suite/php/evil_diamond_prop_runme.php
index 02d9944d6..9bdb7435f 100644
--- a/Examples/test-suite/php/evil_diamond_prop_runme.php
+++ b/Examples/test-suite/php/evil_diamond_prop_runme.php
@@ -31,7 +31,9 @@ check::is_a($spam,"spam");
check::equal(1,$spam->_foo,"1==spam->_foo");
check::equal(2,$spam->_bar,"2==spam->_bar");
// multiple inheritance not supported in PHP
+set_error_handler(NULL, 0); // Don't complain that _baz is unknown.
check::equal(null,$spam->_baz,"null==spam->_baz");
+restore_error_handler();
check::equal(4,$spam->_spam,"4==spam->_spam");
check::done();
diff --git a/Examples/test-suite/php/exception_order_runme.php b/Examples/test-suite/php/exception_order_runme.php
index acb83561a..77f115fa1 100644
--- a/Examples/test-suite/php/exception_order_runme.php
+++ b/Examples/test-suite/php/exception_order_runme.php
@@ -2,9 +2,9 @@
require "tests.php";
require "exception_order.php";
-check::functions(array(a_foo,a_bar,a_foobar,a_barfoo,is_python_builtin));
-check::classes(array(A,E1,E2,E3,exception_order,ET_i,ET_d));
-check::globals(array(efoovar,foovar,cfoovar,a_sfoovar,a_foovar,a_efoovar));
+check::functions(array('a_foo','a_bar','a_foobar','a_barfoo','is_python_builtin'));
+check::classes(array('A','E1','E2','E3','exception_order','ET_i','ET_d'));
+check::globals(array('efoovar','foovar','cfoovar','a_sfoovar','a_foovar','a_efoovar'));
$a = new A();
try {
diff --git a/Examples/test-suite/php/grouping_runme.php b/Examples/test-suite/php/grouping_runme.php
index 51446f473..8bad7cd4c 100644
--- a/Examples/test-suite/php/grouping_runme.php
+++ b/Examples/test-suite/php/grouping_runme.php
@@ -6,14 +6,14 @@ require "grouping.php";
check::functions(array("test1","test2","do_unary","negate"));
check::equal(5,test1(5),"5==test1(5)");
check::resource(test2(7),"_p_int","_p_int==test2(7)");
-check::globals(array(test3));
+check::globals(array('test3'));
//check::equal(37,test3_get(),'37==test3_get()');
check::equal(37,check::get("test3"),'37==get(test3)');
//test3_set(38);
-check::set(test3,38);
+check::set('test3',38);
//check::equal(38,test3_get(),'38==test3_get() after test3_set(37)');
-check::equal(38,check::get(test3),'38==get(test3) after set(test)');
+check::equal(38,check::get('test3'),'38==get(test3) after set(test)');
check::equal(-5,negate(5),"-5==negate(5)");
check::equal(7,do_unary(-7,NEGATE),"7=do_unary(-7,NEGATE)");
diff --git a/Examples/test-suite/php/ignore_parameter_runme.php b/Examples/test-suite/php/ignore_parameter_runme.php
index 1c8c76ad4..b9c2b777d 100644
--- a/Examples/test-suite/php/ignore_parameter_runme.php
+++ b/Examples/test-suite/php/ignore_parameter_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "ignore_parameter.php";
// New functions
-check::functions(array(jaguar,lotus,tvr,ferrari,sportscars_daimler,sportscars_astonmartin,sportscars_bugatti,sportscars_lamborghini));
+check::functions(array('jaguar','lotus','tvr','ferrari','fiat','sportscars_daimler','sportscars_astonmartin','sportscars_bugatti','sportscars_lamborghini','sportscars_maseratti'));
// New classes
-check::classes(array(ignore_parameter,SportsCars,MiniCooper,MorrisMinor,FordAnglia,AustinAllegro));
+check::classes(array('ignore_parameter','SportsCars','MiniCooper','MorrisMinor','FordAnglia','AustinAllegro'));
// No new vars
check::globals(array());
diff --git a/Examples/test-suite/php/import_nomodule_runme.php b/Examples/test-suite/php/import_nomodule_runme.php
index 41836ba0f..e5ea761f7 100644
--- a/Examples/test-suite/php/import_nomodule_runme.php
+++ b/Examples/test-suite/php/import_nomodule_runme.php
@@ -3,9 +3,9 @@ require "tests.php";
require "import_nomodule.php";
// No new functions
-check::functions(array(create_foo,delete_foo,test1,is_python_builtin));
+check::functions(array('create_foo','delete_foo','test1','is_python_builtin'));
// No new classes
-check::classes(array(import_nomodule,Bar));
+check::classes(array('import_nomodule','Bar'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/li_carrays_cpp_runme.php b/Examples/test-suite/php/li_carrays_cpp_runme.php
index e0f9ffe92..3e8a443f6 100644
--- a/Examples/test-suite/php/li_carrays_cpp_runme.php
+++ b/Examples/test-suite/php/li_carrays_cpp_runme.php
@@ -3,14 +3,14 @@ require "tests.php";
require "li_carrays_cpp.php";
// Check functions.
-check::functions(array(new_intarray,delete_intarray,intarray_getitem,intarray_setitem,doublearray_getitem,doublearray_setitem,doublearray_cast,doublearray_frompointer,xyarray_getitem,xyarray_setitem,xyarray_cast,xyarray_frompointer,delete_abarray,abarray_getitem,abarray_setitem,shortarray_getitem,shortarray_setitem,shortarray_cast,shortarray_frompointer,sum_array));
+check::functions(array('new_intarray','delete_intarray','intarray_getitem','intarray_setitem','doublearray_getitem','doublearray_setitem','doublearray_cast','doublearray_frompointer','xyarray_getitem','xyarray_setitem','xyarray_cast','xyarray_frompointer','delete_abarray','abarray_getitem','abarray_setitem','shortarray_getitem','shortarray_setitem','shortarray_cast','shortarray_frompointer','sum_array'));
// Check classes.
// NB An "li_carrays_cpp" class is created as a mock namespace.
-check::classes(array(li_carrays_cpp,doubleArray,AB,XY,XYArray,shortArray));
+check::classes(array('li_carrays_cpp','doubleArray','AB','XY','XYArray','shortArray'));
// Check global variables.
-check::globals(array(xy_x,xy_y,globalxyarray,ab_a,ab_b,globalabarray));
+check::globals(array('xy_x','xy_y','globalxyarray','ab_a','ab_b','globalabarray'));
$d = new doubleArray(10);
diff --git a/Examples/test-suite/php/li_carrays_runme.php b/Examples/test-suite/php/li_carrays_runme.php
index 40e82f9ea..abe358101 100644
--- a/Examples/test-suite/php/li_carrays_runme.php
+++ b/Examples/test-suite/php/li_carrays_runme.php
@@ -3,14 +3,14 @@ require "tests.php";
require "li_carrays.php";
// Check functions.
-check::functions(array(new_intarray,delete_intarray,intarray_getitem,intarray_setitem,doublearray_getitem,doublearray_setitem,doublearray_cast,doublearray_frompointer,xyarray_getitem,xyarray_setitem,xyarray_cast,xyarray_frompointer,delete_abarray,abarray_getitem,abarray_setitem,shortarray_getitem,shortarray_setitem,shortarray_cast,shortarray_frompointer,sum_array));
+check::functions(array('new_intarray','delete_intarray','intarray_getitem','intarray_setitem','doublearray_getitem','doublearray_setitem','doublearray_cast','doublearray_frompointer','xyarray_getitem','xyarray_setitem','xyarray_cast','xyarray_frompointer','delete_abarray','abarray_getitem','abarray_setitem','shortarray_getitem','shortarray_setitem','shortarray_cast','shortarray_frompointer','sum_array'));
// Check classes.
// NB An "li_carrays" class is created as a mock namespace.
-check::classes(array(li_carrays,doubleArray,AB,XY,XYArray,shortArray));
+check::classes(array('li_carrays','doubleArray','AB','XY','XYArray','shortArray'));
// Check global variables.
-check::globals(array(xy_x,xy_y,globalxyarray,ab_a,ab_b,globalabarray));
+check::globals(array('xy_x','xy_y','globalxyarray','ab_a','ab_b','globalabarray'));
$d = new doubleArray(10);
diff --git a/Examples/test-suite/php/li_factory_runme.php b/Examples/test-suite/php/li_factory_runme.php
index 6623e2a8c..982d7b1fd 100644
--- a/Examples/test-suite/php/li_factory_runme.php
+++ b/Examples/test-suite/php/li_factory_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "li_factory.php";
// No new functions
-check::functions(array(geometry_draw,geometry_create,geometry_clone_,point_draw,point_width,point_clone_,circle_draw,circle_radius,circle_clone_));
+check::functions(array('geometry_draw','geometry_create','geometry_clone_','point_draw','point_width','point_clone_','circle_draw','circle_radius','circle_clone_'));
// No new classes
-check::classes(array(Geometry,Point,Circle));
+check::classes(array('Geometry','Point','Circle'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/li_std_string_runme.php b/Examples/test-suite/php/li_std_string_runme.php
index ad62247e1..04ee3fc86 100644
--- a/Examples/test-suite/php/li_std_string_runme.php
+++ b/Examples/test-suite/php/li_std_string_runme.php
@@ -27,5 +27,8 @@ check::equal(Structure::StaticMemberString2(), $s, "StaticMemberString2 test 2")
// below broken ?
//check::equal(Structure::ConstStaticMemberString(), "const static member string", "ConstStaticMemberString test");
+// This used to give "Undefined variable: r"
+li_std_string::test_const_reference_returning_void("foo");
+
check::done();
?>
diff --git a/Examples/test-suite/php/newobject1_runme.php b/Examples/test-suite/php/newobject1_runme.php
index 5853a72c0..863e3e423 100644
--- a/Examples/test-suite/php/newobject1_runme.php
+++ b/Examples/test-suite/php/newobject1_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "newobject1.php";
// No new functions
-check::functions(array(foo_makefoo,foo_makemore,foo_foocount));
+check::functions(array('foo_makefoo','foo_makemore','foo_foocount'));
// No new classes
-check::classes(array(Foo));
+check::classes(array('Foo'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/newobject3_runme.php b/Examples/test-suite/php/newobject3_runme.php
new file mode 100644
index 000000000..edd5d8608
--- /dev/null
+++ b/Examples/test-suite/php/newobject3_runme.php
@@ -0,0 +1,18 @@
+<?php
+
+require "tests.php";
+require "newobject3.php";
+
+$factory = new factory();
+
+check::classname("Product", $factory->create(7));
+check::classname("Product", $factory->create(7, 6));
+check::classname("Product", $factory->create("test"));
+check::classname("Product", $factory->create("test", 2));
+
+check::isnull($factory->create(0), "create(0) should be NULL");
+check::isnull($factory->create(7, -1), "create(7, -1) should be NULL");
+check::isnull($factory->create(0, -1), "create(0, -1) should be NULL");
+check::isnull($factory->create("bad", -1), "create(\"bad\", -1) should be NULL");
+
+?>
diff --git a/Examples/test-suite/php/overload_null_runme.php b/Examples/test-suite/php/overload_null_runme.php
new file mode 100644
index 000000000..22824d4fb
--- /dev/null
+++ b/Examples/test-suite/php/overload_null_runme.php
@@ -0,0 +1,46 @@
+<?php
+
+require "tests.php";
+require "overload_null.php";
+
+$o = new Overload();
+$x = new X();
+
+check::equal(1, $o->byval1($x), "test 1");
+check::equal(2, $o->byval1(null), "test 2");
+
+check::equal(3, $o->byval2(null), "test 3");
+check::equal(4, $o->byval2($x), "test 4");
+
+check::equal(5, $o->byref1($x), "test 5");
+check::equal(6, $o->byref1(null), "test 6");
+
+check::equal(7, $o->byref2(null), "test 7");
+check::equal(8, $o->byref2($x), "test 8");
+
+check::equal(9, $o->byconstref1($x), "test 9");
+check::equal(10, $o->byconstref1(null), "test 10");
+
+check::equal(11, $o->byconstref2(null), "test 11");
+check::equal(12, $o->byconstref2($x), "test 12");
+
+# const pointer references
+check::equal(13, $o->byval1cpr($x), "test 13");
+check::equal(14, $o->byval1cpr(null), "test 14");
+
+check::equal(15, $o->byval2cpr(null), "test 15");
+check::equal(16, $o->byval2cpr($x), "test 16");
+
+# forward class declaration
+check::equal(17, $o->byval1forwardptr($x), "test 17");
+check::equal(18, $o->byval1forwardptr(null), "test 18");
+
+check::equal(19, $o->byval2forwardptr(null), "test 19");
+check::equal(20, $o->byval2forwardptr($x), "test 20");
+
+check::equal(21, $o->byval1forwardref($x), "test 21");
+
+check::equal(22, $o->byval2forwardref($x), "test 22");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php/overload_rename_runme.php b/Examples/test-suite/php/overload_rename_runme.php
index dce4c6cb3..0357f91a6 100644
--- a/Examples/test-suite/php/overload_rename_runme.php
+++ b/Examples/test-suite/php/overload_rename_runme.php
@@ -6,7 +6,7 @@ require "overload_rename.php";
// No new functions
check::functions(array());
// No new classes
-check::classes(array(Foo));
+check::classes(array('Foo'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/php_iterator_runme.php b/Examples/test-suite/php/php_iterator_runme.php
index d69a5b385..fd645ccb2 100644
--- a/Examples/test-suite/php/php_iterator_runme.php
+++ b/Examples/test-suite/php/php_iterator_runme.php
@@ -3,8 +3,8 @@
require "tests.php";
require "php_iterator.php";
-check::functions(array(myiterator_rewind,myiterator_key,myiterator_current,myiterator_next,myiterator_valid));
-check::classes(array(MyIterator));
+check::functions(array('myiterator_rewind','myiterator_key','myiterator_current','myiterator_next','myiterator_valid'));
+check::classes(array('MyIterator'));
// No new global variables.
check::globals(array());
diff --git a/Examples/test-suite/php/php_pragma_runme.php b/Examples/test-suite/php/php_pragma_runme.php
new file mode 100644
index 000000000..c76cfc9b5
--- /dev/null
+++ b/Examples/test-suite/php/php_pragma_runme.php
@@ -0,0 +1,11 @@
+<?php
+
+require "tests.php";
+require "php_pragma.php";
+
+
+check::equal('1.5',(new ReflectionExtension('php_pragma'))->getVersion(),"1.5==version(php_pragma)");
+
+check::done();
+
+?>
diff --git a/Examples/test-suite/php/prefix_runme.php b/Examples/test-suite/php/prefix_runme.php
index ead064f5b..fcf7c66f6 100644
--- a/Examples/test-suite/php/prefix_runme.php
+++ b/Examples/test-suite/php/prefix_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "prefix.php";
// No new functions
-check::functions(array(foo_get_self));
+check::functions(array('foo_get_self'));
// No new classes
-check::classes(array(ProjectFoo));
+check::classes(array('ProjectFoo'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/preproc_constants_c_runme.php b/Examples/test-suite/php/preproc_constants_c_runme.php
index af9b76e1c..20868dcc0 100644
--- a/Examples/test-suite/php/preproc_constants_c_runme.php
+++ b/Examples/test-suite/php/preproc_constants_c_runme.php
@@ -62,5 +62,8 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant
check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type");
check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
+check::equal(gettype(preproc_constants_c::EXPR_MIXED1), "double", "preproc_constants.EXPR_MIXED1 has unexpected type");
+check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
+check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
?>
diff --git a/Examples/test-suite/php/preproc_constants_runme.php b/Examples/test-suite/php/preproc_constants_runme.php
index 5c9119b3e..bd216c269 100644
--- a/Examples/test-suite/php/preproc_constants_runme.php
+++ b/Examples/test-suite/php/preproc_constants_runme.php
@@ -61,5 +61,8 @@ check::equal(gettype(preproc_constants::EXPR_OR), "integer", "preproc_constants.
check::equal(gettype(preproc_constants::EXPR_LAND), "boolean", "preproc_constants.EXPR_LAND has unexpected type");
check::equal(gettype(preproc_constants::EXPR_LOR), "boolean", "preproc_constants.EXPR_LOR has unexpected type");
check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
+check::equal(gettype(preproc_constants::EXPR_MIXED1), "double", "preproc_constants.EXPR_MIXED1 has unexpected type");
+check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type");
+check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type");
?>
diff --git a/Examples/test-suite/php/sym_runme.php b/Examples/test-suite/php/sym_runme.php
index 483aaa980..127d28fd9 100644
--- a/Examples/test-suite/php/sym_runme.php
+++ b/Examples/test-suite/php/sym_runme.php
@@ -6,7 +6,7 @@ require "sym.php";
// No new functions
check::functions(array());
// No new classes
-check::classes(array(flim,flam));
+check::classes(array('flim','flam'));
// now new vars
check::globals(array());
diff --git a/Examples/test-suite/php/template_arg_typename_runme.php b/Examples/test-suite/php/template_arg_typename_runme.php
index 7d60285e3..e609240e7 100644
--- a/Examples/test-suite/php/template_arg_typename_runme.php
+++ b/Examples/test-suite/php/template_arg_typename_runme.php
@@ -6,11 +6,11 @@ require "template_arg_typename.php";
// No new functions
check::functions(array());
// No new classes
-check::classes(array(UnaryFunction_bool_bool,BoolUnaryFunction_bool));
+check::classes(array('UnaryFunction_bool_bool','BoolUnaryFunction_bool'));
$ufbb=new unaryfunction_bool_bool();
check::is_a($ufbb,"unaryfunction_bool_bool");
-unset($whatisthis);
+$whatisthis=NULL;
$bufb=new boolunaryfunction_bool($whatisthis);
check::is_a($bufb,"boolunaryfunction_bool");
diff --git a/Examples/test-suite/php/template_construct_runme.php b/Examples/test-suite/php/template_construct_runme.php
index 3a3986f7e..b227d9fec 100644
--- a/Examples/test-suite/php/template_construct_runme.php
+++ b/Examples/test-suite/php/template_construct_runme.php
@@ -3,7 +3,7 @@
require "tests.php";
require "template_construct.php";
-check::classes(array(Foo_int));
+check::classes(array('Foo_int'));
$foo_int=new foo_int(3);
check::is_a($foo_int,"foo_int","Made a foo_int");
diff --git a/Examples/test-suite/php/tests.php b/Examples/test-suite/php/tests.php
index d3fd66868..20fa1ed98 100644
--- a/Examples/test-suite/php/tests.php
+++ b/Examples/test-suite/php/tests.php
@@ -1,8 +1,15 @@
<?php
-// do we have true global vars or just GETSET functions?
-// Used to filter out get/set global functions to fake vars...
-define(GETSET,1);
+function die_on_error($errno, $errstr, $file, $line) {
+ if ($file !== Null) {
+ print $file;
+ if ($line !== Null) print ":$line";
+ print ": ";
+ }
+ print "$errstr\n";
+ exit(1);
+}
+set_error_handler("die_on_error", -1);
$_original_functions=get_defined_functions();
$_original_globals=1;
@@ -10,7 +17,11 @@ $_original_classes=get_declared_classes();
$_original_globals=array_keys($GLOBALS);
class check {
- function get_extra_classes($ref=FALSE) {
+ // do we have true global vars or just GETSET functions?
+ // Used to filter out get/set global functions to fake vars...
+ const GETSET = 1;
+
+ static function get_extra_classes($ref=FALSE) {
static $extra;
global $_original_classes;
if ($ref===FALSE) $f=$_original_classes;
@@ -22,7 +33,7 @@ class check {
return $extra;
}
- function get_extra_functions($ref=FALSE,$gs=false) {
+ static function get_extra_functions($ref=FALSE,$gs=false) {
static $extra;
static $extrags; // for get/setters
global $_original_functions;
@@ -31,11 +42,11 @@ class check {
$extra=array();
$extrags=array();
$df=get_defined_functions();
- $df=array_flip($df[internal]);
- foreach($_original_functions[internal] as $func) unset($df[$func]);
+ $df=array_flip($df['internal']);
+ foreach($_original_functions['internal'] as $func) unset($df[$func]);
// Now chop out any get/set accessors
foreach(array_keys($df) as $func)
- if ((GETSET && preg_match('/_[gs]et$/', $func)) ||
+ if ((self::GETSET && preg_match('/_[gs]et$/', $func)) ||
preg_match('/^new_/', $func) ||
preg_match('/_(alter|get)_newobject$/', $func))
$extrags[]=$func;
@@ -46,11 +57,11 @@ class check {
return $extra;
}
- function get_extra_globals($ref=FALSE) {
+ static function get_extra_globals($ref=FALSE) {
static $extra;
global $_original_globals;
if (! is_array($extra)) {
- if (GETSET) {
+ if (self::GETSET) {
$_extra=array();
foreach(check::get_extra_functions(false,1) as $global) {
if (preg_match('/^(.*)_[sg]et$/', $global, $match))
@@ -72,16 +83,17 @@ class check {
return $extra;
}
- function classname($string,$object) {
+ static function classname($string,$object) {
if (!is_object($object))
return check::fail("The second argument is a " . gettype($object) . ", not an object.");
if (strtolower($string)!=strtolower($classname=get_class($object))) return check::fail("Object: \$object is of class %s not class %s",$classname,$string);
return TRUE;
}
- function classmethods($classname,$methods) {
+ static function classmethods($classname,$methods) {
if (is_object($classname)) $classname=get_class($classname);
$classmethods=array_flip(get_class_methods($classname));
+ $message=NULL;
$missing=array();
$extra=array();
foreach($methods as $method) {
@@ -98,19 +110,19 @@ class check {
return TRUE;
}
- function set($var,$value) {
+ static function set($var,$value) {
$func=$var."_set";
- if (GETSET) $func($value);
+ if (self::GETSET) $func($value);
else $_GLOBALS[$var]=$value;
}
- function &get($var) {
+ static function get($var) {
$func=$var."_get";
- if (GETSET) return $func();
+ if (self::GETSET) return $func();
else return $_GLOBALS[$var];
}
- function is_a($a,$b) {
+ static function is_a($a,$b) {
if (is_object($a)) $a=strtolower(get_class($a));
if (is_object($b)) $a=strtolower(get_class($b));
$parents=array();
@@ -119,11 +131,11 @@ class check {
$parents[]=$c;
$c=strtolower(get_parent_class($c));
}
- if ($c!=$b) return check::fail("Class $a does not inherit from class $b\nHierachy:\n %s\n",join("\n ",$parents));
+ if ($c!=$b) return check::fail("Class $a does not inherit from class $b\nHierarchy:\n %s\n",join("\n ",$parents));
return TRUE;
}
- function classparent($a,$b) {
+ static function classparent($a,$b) {
if (is_object($a)) $a=get_class($a);
if (is_object($b)) $a=get_class($b);
$parent=get_parent_class($a);
@@ -132,7 +144,7 @@ class check {
return TRUE;
}
- function classes($classes) {
+ static function classes($classes) {
if (! is_array($classes)) $classes=array($classes);
$message=array();
$missing=array();
@@ -148,7 +160,7 @@ class check {
return TRUE;
}
- function functions($functions) {
+ static function functions($functions) {
if (! is_array($functions)) $functions=array($functions);
$message=array();
$missing=array();
@@ -165,13 +177,13 @@ class check {
return TRUE;
}
- function globals($globals) {
+ static function globals($globals) {
if (! is_array($globals)) $globals=array($globals);
$message=array();
$missing=array();
$extra=array_flip(check::get_extra_globals());
foreach ($globals as $glob) {
- if (GETSET) {
+ if (self::GETSET) {
if (! isset($extra[$glob])) $missing[]=$glob;
else unset($extra[$glob]);
} else {
@@ -187,30 +199,30 @@ class check {
}
- function functionref($a,$type,$message) {
+ static function functionref($a,$type,$message) {
if (! preg_match("/^_[a-f0-9]+$type$/i", $a))
return check::fail($message);
return TRUE;
}
- function equal($a,$b,$message) {
+ static function equal($a,$b,$message) {
if (! ($a===$b)) return check::fail($message . ": '$a'!=='$b'");
return TRUE;
}
- function resource($a,$b,$message) {
+ static function resource($a,$b,$message) {
$resource=trim(check::var_dump($a));
if (! preg_match("/^resource\([0-9]+\) of type \($b\)/i", $resource))
return check::fail($message);
return TRUE;
}
- function isnull($a,$message) {
+ static function isnull($a,$message) {
$value=trim(check::var_dump($a));
return check::equal($value,"NULL",$message);
}
- function var_dump($arg) {
+ static function var_dump($arg) {
ob_start();
var_dump($arg);
$result=ob_get_contents();
@@ -218,19 +230,19 @@ class check {
return $result;
}
- function fail($pattern) {
+ static function fail($pattern) {
$args=func_get_args();
print("Failed on: ".call_user_func_array("sprintf",$args)."\n");
exit(1);
}
- function warn($pattern) {
+ static function warn($pattern) {
$args=func_get_args();
print("Warning on: ".call_user_func_array("sprintf",$args)."\n");
return FALSE;
}
- function done() {
+ static function done() {
# print $_SERVER[argv][0]." ok\n";
}
}
diff --git a/Examples/test-suite/php/threads_exception_runme.php b/Examples/test-suite/php/threads_exception_runme.php
index 9e4d04e10..80717eb88 100644
--- a/Examples/test-suite/php/threads_exception_runme.php
+++ b/Examples/test-suite/php/threads_exception_runme.php
@@ -4,11 +4,11 @@ require "tests.php";
require "threads_exception.php";
// Check functions
-check::functions(array(test_simple,test_message,test_hosed,test_unknown,test_multi,is_python_builtin));
+check::functions(array('test_simple','test_message','test_hosed','test_unknown','test_multi','is_python_builtin'));
// Check classes.
-check::classes(array(Exc,Test,threads_exception));
-// Chek globals.
-check::globals(array(exc_code,exc_msg));
+check::classes(array('Exc','Test','threads_exception'));
+// Check globals.
+check::globals(array('exc_code','exc_msg'));
$t = new Test();
try {
diff --git a/Examples/test-suite/php/typedef_reference_runme.php b/Examples/test-suite/php/typedef_reference_runme.php
index 88a70f8d3..83e75fb66 100644
--- a/Examples/test-suite/php/typedef_reference_runme.php
+++ b/Examples/test-suite/php/typedef_reference_runme.php
@@ -3,7 +3,7 @@
require "tests.php";
require "typedef_reference.php";
-check::functions(array(somefunc,otherfunc,new_intp,copy_intp,delete_intp,intp_assign,intp_value));
+check::functions(array('somefunc','otherfunc','new_intp','copy_intp','delete_intp','intp_assign','intp_value'));
$int2=copy_intp(2);
check::equal(2,somefunc($int2)," test passing intp to somefunc");
$int3=copy_intp(3);
diff --git a/Examples/test-suite/php5/Makefile.in b/Examples/test-suite/php5/Makefile.in
deleted file mode 100644
index 391ca2c53..000000000
--- a/Examples/test-suite/php5/Makefile.in
+++ /dev/null
@@ -1,80 +0,0 @@
-#######################################################################
-# Makefile for php5 test-suite
-#######################################################################
-
-LANGUAGE = php5
-SCRIPTSUFFIX = _runme.php
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
-
-CPP_TEST_CASES += \
- callback \
- li_factory \
- php_iterator \
- php_namewarn_rename \
-
-include $(srcdir)/../common.mk
-
-# Overridden variables here
-TARGETPREFIX =# Should be php_ for Windows, empty otherwise
-
-# Custom tests - tests with additional commandline options
-prefix.cpptest: SWIGOPT += -prefix Project
-
-# write out tests without a _runme.php
-missingcpptests:
- for test in $(CPP_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done
-
-missingctests:
- for test in $(C_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done
-
-missingtests: missingcpptests missingctests
-
-# Rules for the different types of tests
-%.cpptest:
- $(setup)
- +$(swig_and_compile_cpp)
- +$(run_testcase)
-
-%.ctest:
- $(setup)
- +$(swig_and_compile_c)
- +$(run_testcase)
-
-%.multicpptest:
- $(setup)
- +$(swig_and_compile_multi_cpp)
- +$(run_testcase)
-
-# Smart target
-%.test:
- @echo ' $(C_TEST_CASES) '|grep -F -v ' $* ' >/dev/null ||\
- $(MAKE) $*.ctest
- @echo ' $(CPP_TEST_CASES) '|grep -F -v ' $* ' >/dev/null ||\
- $(MAKE) $*.cpptest
- @echo ' $(MULTI_CPP_TEST_CASES) '|grep -F -v ' $* ' >/dev/null ||\
- $(MAKE) $*.multicpptest
-
-# Runs the testcase. Tries to run testcase_runme.php, and if that's not
-# found, runs testcase.php, except for multicpptests.
-run_testcase = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP5_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL='$(RUNTOOL)' php5_run; \
- elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP5_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php RUNTOOL='$(RUNTOOL)' php5_run; \
- fi
-
-# Clean: remove the generated .php file
-%.clean:
- @rm -f $*.php php_$*.h
-
-clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' php5_clean
- rm -f clientdata_prop_a.php clientdata_prop_b.php php_clientdata_prop_a.h php_clientdata_prop_b.h
- rm -f import_stl_a.php import_stl_b.php php_import_stl_a.h php_import_stl_b.h
- rm -f imports_a.php imports_b.php php_imports_a.h php_imports_b.h
- rm -f mod_a.php mod_b.php php_mod_a.h php_mod_b.h
- rm -f multi_import_a.php multi_import_b.php php_multi_import_a.h php_multi_import_b.h
- rm -f packageoption_a.php packageoption_b.php packageoption_c.php php_packageoption_a.h php_packageoption_b.h php_packageoption_c.h
diff --git a/Examples/test-suite/php5/abstract_inherit_ok_runme.php b/Examples/test-suite/php5/abstract_inherit_ok_runme.php
deleted file mode 100644
index c2d86499b..000000000
--- a/Examples/test-suite/php5/abstract_inherit_ok_runme.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-require "tests.php";
-require "abstract_inherit_ok.php";
-
-check::classes(array(Foo,Spam));
-$spam=new Spam();
-
-check::equal(0,$spam->blah(),"spam object method");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/abstract_inherit_runme.php b/Examples/test-suite/php5/abstract_inherit_runme.php
deleted file mode 100644
index 3554e6fd8..000000000
--- a/Examples/test-suite/php5/abstract_inherit_runme.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-require "tests.php";
-require "abstract_inherit.php";
-
-check::classes(array(Foo,Bar,Spam,NRFilter_i,NRRCFilter_i,NRRCFilterpro_i,NRRCFilterpri_i));
-// This constructor attempt should fail as there isn't one
-//$spam=new Spam();
-
-//check::equal(0,$spam->blah(),"spam object method");
-//check::equal(0,Spam::blah($spam),"spam class method");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/add_link_runme.php b/Examples/test-suite/php5/add_link_runme.php
deleted file mode 100644
index 7523bd604..000000000
--- a/Examples/test-suite/php5/add_link_runme.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-require "tests.php";
-require "add_link.php";
-
-// No new functions, except the flat functions
-check::functions(array(new_foo,foo_blah));
-
-check::classes(array(Foo));
-
-$foo=new foo();
-check::is_a($foo,foo);
-
-$foo_blah=$foo->blah();
-check::is_a($foo_blah,foo);
-
-//fails, can't be called as a class method, should allow and make it nil?
-//$class_foo_blah=foo::blah();
-//check::is_a($class_foo_blah,foo);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/argout_runme.php b/Examples/test-suite/php5/argout_runme.php
deleted file mode 100644
index 33fbd8129..000000000
--- a/Examples/test-suite/php5/argout_runme.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-require "tests.php";
-require "argout.php";
-
-check::functions(array(incp,incr,inctr,new_intp,copy_intp,delete_intp,intp_assign,intp_value,voidhandle,handle));
-
-$ip=copy_intp(42);
-check::equal(42,incp($ip),"42==incp($ip)");
-check::equal(43,intp_value($ip),"43=$ip");
-
-$p=copy_intp(2);
-check::equal(2,incp($p),"2==incp($p)");
-check::equal(3,intp_value($p),"3==$p");
-
-$r=copy_intp(7);
-check::equal(7,incr($r),"7==incr($r)");
-check::equal(8,intp_value($r),"8==$r");
-
-$tr=copy_intp(4);
-check::equal(4,inctr($tr),"4==incr($tr)");
-check::equal(5,intp_value($tr),"5==$tr");
-
-# Check the voidhandle call, first with null
-unset($handle);
-# FIXME: Call-time pass-by-reference has been deprecated for ages, and was
-# removed in PHP 5.4. We need to rework
-#voidhandle(&$handle);
-#check::resource($handle,"_p_void",'$handle is not _p_void');
-#$handledata=handle($handle);
-#check::equal($handledata,"Here it is","\$handledata != \"Here it is\"");
-
-unset($handle);
-voidhandle($handle);
-check::isnull($handle,'$handle not null');
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/arrayptr_runme.php b/Examples/test-suite/php5/arrayptr_runme.php
deleted file mode 100644
index 3b9baed05..000000000
--- a/Examples/test-suite/php5/arrayptr_runme.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-require "tests.php";
-require "arrayptr.php";
-
-// No new functions
-check::functions(array(foo));
-// No new classes
-check::classes(array());
-// now new vars
-check::globals(array());
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/arrays_global_runme.php b/Examples/test-suite/php5/arrays_global_runme.php
deleted file mode 100644
index 12a7806c9..000000000
--- a/Examples/test-suite/php5/arrays_global_runme.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-require "tests.php";
-require "arrays_global.php";
-
-check::functions(array(test_a,test_b,new_simplestruct,new_material));
-check::classes(array(arrays_global,SimpleStruct,Material));
-check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i,beginstring_fix44a,beginstring_fix44b,beginstring_fix44c,beginstring_fix44d,beginstring_fix44e,beginstring_fix44f,chitmat,hitmat_val,hitmat,simplestruct_double_field));
-// The size of array_c is 2, but the last byte is \0, so we can only store a
-// single byte string in it.
-check::set(array_c,"Z");
-check::equal("Z",check::get(array_c),"set array_c");
-check::set(array_c,"xy");
-check::equal("x",check::get(array_c),"set array_c");
-check::set(array_c,"h");
-check::equal("h",check::get(array_c),"set array_c");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/arrays_global_twodim_runme.php b/Examples/test-suite/php5/arrays_global_twodim_runme.php
deleted file mode 100644
index 40ecf1719..000000000
--- a/Examples/test-suite/php5/arrays_global_twodim_runme.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-require "tests.php";
-require "arrays_global_twodim.php";
-
-check::functions(array(fn_taking_arrays,get_2d_array,new_simplestruct,new_material));
-check::classes(array(arrays_global_twodim,SimpleStruct,Material));
-check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i,chitmat,hitmat_val,hitmat,simplestruct_double_field));
-$a1=array(10,11,12,13);
-$a2=array(14,15,16,17);
-$a=array($a1,$a2);
-
-$_a=check::get(array_const_i);
-
-for($x=0;$x<count($a1);$x++) {
- for($y=0;$y<2;$y++) {
- check::equal($a[$y][$x],get_2d_array($_a,$y,$x),"check array $x,$y");
- }
-}
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/arrays_runme.php b/Examples/test-suite/php5/arrays_runme.php
deleted file mode 100644
index ae17d05e7..000000000
--- a/Examples/test-suite/php5/arrays_runme.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-require "tests.php";
-require "arrays.php";
-
-check::functions(array(fn_taking_arrays,newintpointer,setintfrompointer,getintfrompointer,array_pointer_func));
-check::classes(array(arrays,SimpleStruct,ArrayStruct,CartPoseData_t));
-check::globals(array(simplestruct_double_field,arraystruct_array_c,arraystruct_array_sc,arraystruct_array_uc,arraystruct_array_s,arraystruct_array_us,arraystruct_array_i,arraystruct_array_ui,arraystruct_array_l,arraystruct_array_ul,arraystruct_array_ll,arraystruct_array_f,arraystruct_array_d,arraystruct_array_struct,arraystruct_array_structpointers,arraystruct_array_ipointers,arraystruct_array_enum,arraystruct_array_enumpointers,arraystruct_array_const_i,cartposedata_t_p));
-
-$ss=new simplestruct();
-check::classname(simplestruct,$ss);
-
-$as=new arraystruct();
-$as->array_c="abc";
-check::equal($as->array_c,"a",'$as->array_c=="a"');
-check::equal(isset($as->array_const_i),TRUE,'isset($as->array_const_i)');
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/arrays_scope_runme.php b/Examples/test-suite/php5/arrays_scope_runme.php
deleted file mode 100644
index c208b7518..000000000
--- a/Examples/test-suite/php5/arrays_scope_runme.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-require "tests.php";
-require "arrays_scope.php";
-
-// New functions
-check::functions(array(new_bar,bar_blah));
-// New classes
-check::classes(array(arrays_scope,Bar));
-// New vars
-check::globals(array(bar_adata,bar_bdata,bar_cdata));
-
-$bar=new bar();
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/callback_runme.php b/Examples/test-suite/php5/callback_runme.php
deleted file mode 100644
index fefa32502..000000000
--- a/Examples/test-suite/php5/callback_runme.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-require "tests.php";
-require "callback.php";
-// In 2.0.6 and earlier, the constant was misnamed.
-if (gettype(callback::FOO_I_Cb_Ptr) !== 'resource') die("callback::FOO_I_Cb_Ptr not a resource\n");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/casts_runme.php b/Examples/test-suite/php5/casts_runme.php
deleted file mode 100644
index 10522dca4..000000000
--- a/Examples/test-suite/php5/casts_runme.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-require "tests.php";
-require "casts.php";
-
-// No new functions
-check::functions(array(new_a,a_hello,new_b));
-// No new classes
-check::classes(array(A,B));
-// now new vars
-check::globals(array());
-
-# Make sure $b inherites hello() from class A
-$b=new B();
-$b->hello();
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/char_strings_runme.php b/Examples/test-suite/php5/char_strings_runme.php
deleted file mode 100644
index e06ee9d2b..000000000
--- a/Examples/test-suite/php5/char_strings_runme.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-require "tests.php";
-require "char_strings.php";
-
-$CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible.";
-$OTHERLAND_MSG_10 = "Little message from the safe world.10";
-
-check::equal(GetCharHeapString(), $CPLUSPLUS_MSG, "failed GetCharHeapString");
-check::equal(GetConstCharProgramCodeString(), $CPLUSPLUS_MSG, "failed GetConstCharProgramCodeString");
-check::equal(GetCharStaticString(), $CPLUSPLUS_MSG, "failed GetCharStaticString");
-check::equal(GetCharStaticStringFixed(), $CPLUSPLUS_MSG, "failed GetCharStaticStringFixed");
-check::equal(GetConstCharStaticStringFixed(), $CPLUSPLUS_MSG, "failed GetConstCharStaticStringFixed");
-
-check::equal(SetCharHeapString($OTHERLAND_MSG_10, 10), true, "failed GetConstCharStaticStringFixed");
-check::equal(SetCharStaticString($OTHERLAND_MSG_10, 10), true, "failed SetCharStaticString");
-check::equal(SetCharArrayStaticString($OTHERLAND_MSG_10, 10), true, "failed SetCharArrayStaticString");
-check::equal(SetConstCharHeapString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharHeapString");
-check::equal(SetConstCharStaticString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharStaticString");
-check::equal(SetConstCharArrayStaticString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharArrayStaticString");
-
-check::equal(CharPingPong($OTHERLAND_MSG_10), $OTHERLAND_MSG_10, "failed CharPingPong");
-
-Global_char_set($OTHERLAND_MSG_10);
-check::equal(Global_char_get(), $OTHERLAND_MSG_10, "failed Global_char_get");
-
-Global_char_array1_set($OTHERLAND_MSG_10);
-check::equal(Global_char_array1_get(), $OTHERLAND_MSG_10, "failed Global_char_array1_get");
-
-Global_char_array2_set($OTHERLAND_MSG_10);
-check::equal(Global_char_array2_get(), $OTHERLAND_MSG_10, "failed Global_char_array2_get");
-
-check::equal(Global_const_char_get(), $CPLUSPLUS_MSG, "failed Global_const_char");
-check::equal(Global_const_char_array1_get(), $CPLUSPLUS_MSG, "failed Global_const_char_array1");
-check::equal(Global_const_char_array2_get(), $CPLUSPLUS_MSG, "failed Global_const_char_array2");
-
-check::equal(GetCharPointerRef(), $CPLUSPLUS_MSG, "failed GetCharPointerRef");
-check::equal(SetCharPointerRef($OTHERLAND_MSG_10, 10), true, "failed SetCharPointerRef");
-check::equal(GetConstCharPointerRef(), $CPLUSPLUS_MSG, "failed GetConstCharPointerRef");
-check::equal(SetConstCharPointerRef($OTHERLAND_MSG_10, 10), true, "failed SetConstCharPointerRef");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/class_ignore_runme.php b/Examples/test-suite/php5/class_ignore_runme.php
deleted file mode 100644
index d5ce36217..000000000
--- a/Examples/test-suite/php5/class_ignore_runme.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-require "tests.php";
-require "class_ignore.php";
-
-check::functions(array(do_blah,new_bar,bar_blah,new_boo,boo_away,new_far,new_hoo));
-check::classes(array(class_ignore,Bar,Boo,Far,Hoo));
-// No new vars
-check::globals(array());
-
-$bar=new bar();
-do_blah($bar);
-check::classparent($bar,"");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/conversion_namespace_runme.php b/Examples/test-suite/php5/conversion_namespace_runme.php
deleted file mode 100644
index e21ff7438..000000000
--- a/Examples/test-suite/php5/conversion_namespace_runme.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-require "tests.php";
-require "conversion_namespace.php";
-
-check::classes(array("Foo","Bar"));
-$bar=new Bar;
-check::classname("bar",$bar);
-$foo=$bar->toFoo();
-check::classname("foo",$foo);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/conversion_ns_template_runme.php b/Examples/test-suite/php5/conversion_ns_template_runme.php
deleted file mode 100644
index 9702eedb7..000000000
--- a/Examples/test-suite/php5/conversion_ns_template_runme.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-require "tests.php";
-require "conversion_ns_template.php";
-
-check::classes(array("conversion_ns_template","Foo_One","Bar_One","Hi"));
-// this is too hard, I'm not sure what to test for,
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/conversion_runme.php b/Examples/test-suite/php5/conversion_runme.php
deleted file mode 100644
index 1a10ff4f4..000000000
--- a/Examples/test-suite/php5/conversion_runme.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-require "tests.php";
-require "conversion.php";
-
-check::classes(array("Foo","Bar"));
-$bar=new Bar;
-check::classname("bar",$bar);
-$foo=$bar->toFoo();
-check::classname("foo",$foo);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/cpp11_strongly_typed_enumerations_runme.php b/Examples/test-suite/php5/cpp11_strongly_typed_enumerations_runme.php
deleted file mode 100644
index bee59b209..000000000
--- a/Examples/test-suite/php5/cpp11_strongly_typed_enumerations_runme.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-
-require "tests.php";
-require "cpp11_strongly_typed_enumerations.php";
-
-function enumCheck($actual, $expected) {
- check::equal($actual, $expected, "Enum value mismatch");
- return $expected + 1;
-}
-
-
-$val = 0;
-$val = enumCheck(Enum1_Val1, $val);
-$val = enumCheck(Enum1_Val2, $val);
-$val = enumCheck(Enum1_Val3, 13);
-$val = enumCheck(Enum1_Val4, $val);
-$val = enumCheck(Enum1_Val5a, 13);
-$val = enumCheck(Enum1_Val6a, $val);
-
-$val = 0;
-$val = enumCheck(Enum2_Val1, $val);
-$val = enumCheck(Enum2_Val2, $val);
-$val = enumCheck(Enum2_Val3, 23);
-$val = enumCheck(Enum2_Val4, $val);
-$val = enumCheck(Enum2_Val5b, 23);
-$val = enumCheck(Enum2_Val6b, $val);
-
-$val = 0;
-$val = enumCheck(Val1, $val);
-$val = enumCheck(Val2, $val);
-$val = enumCheck(Val3, 43);
-$val = enumCheck(Val4, $val);
-
-$val = 0;
-$val = enumCheck(Enum5_Val1, $val);
-$val = enumCheck(Enum5_Val2, $val);
-$val = enumCheck(Enum5_Val3, 53);
-$val = enumCheck(Enum5_Val4, $val);
-
-$val = 0;
-$val = enumCheck(Enum6_Val1, $val);
-$val = enumCheck(Enum6_Val2, $val);
-$val = enumCheck(Enum6_Val3, 63);
-$val = enumCheck(Enum6_Val4, $val);
-
-$val = 0;
-$val = enumCheck(Enum7td_Val1, $val);
-$val = enumCheck(Enum7td_Val2, $val);
-$val = enumCheck(Enum7td_Val3, 73);
-$val = enumCheck(Enum7td_Val4, $val);
-
-$val = 0;
-$val = enumCheck(Enum8_Val1, $val);
-$val = enumCheck(Enum8_Val2, $val);
-$val = enumCheck(Enum8_Val3, 83);
-$val = enumCheck(Enum8_Val4, $val);
-
-$val = 0;
-$val = enumCheck(Enum10_Val1, $val);
-$val = enumCheck(Enum10_Val2, $val);
-$val = enumCheck(Enum10_Val3, 103);
-$val = enumCheck(Enum10_Val4, $val);
-
-$val = 0;
-$val = enumCheck(Class1::Enum12_Val1, 1121);
-$val = enumCheck(Class1::Enum12_Val2, 1122);
-$val = enumCheck(Class1::Enum12_Val3, $val);
-$val = enumCheck(Class1::Enum12_Val4, $val);
-$val = enumCheck(Class1::Enum12_Val5c, 1121);
-$val = enumCheck(Class1::Enum12_Val6c, $val);
-
-$val = 0;
-$val = enumCheck(Class1::Val1, 1131);
-$val = enumCheck(Class1::Val2, 1132);
-$val = enumCheck(Class1::Val3, $val);
-$val = enumCheck(Class1::Val4, $val);
-$val = enumCheck(Class1::Val5d, 1131);
-$val = enumCheck(Class1::Val6d, $val);
-
-$val = 0;
-$val = enumCheck(Class1::Enum14_Val1, 1141);
-$val = enumCheck(Class1::Enum14_Val2, 1142);
-$val = enumCheck(Class1::Enum14_Val3, $val);
-$val = enumCheck(Class1::Enum14_Val4, $val);
-$val = enumCheck(Class1::Enum14_Val5e, 1141);
-$val = enumCheck(Class1::Enum14_Val6e, $val);
-
-# Requires nested class support to work
-#$val = 0;
-#$val = enumCheck(Class1::Struct1.Enum12_Val1, 3121);
-#$val = enumCheck(Class1::Struct1.Enum12_Val2, 3122);
-#$val = enumCheck(Class1::Struct1.Enum12_Val3, $val);
-#$val = enumCheck(Class1::Struct1.Enum12_Val4, $val);
-#$val = enumCheck(Class1::Struct1.Enum12_Val5f, 3121);
-#$val = enumCheck(Class1::Struct1.Enum12_Val6f, $val);
-#
-#$val = 0;
-#$val = enumCheck(Class1::Struct1.$val1, 3131);
-#$val = enumCheck(Class1::Struct1.$val2, 3132);
-#$val = enumCheck(Class1::Struct1.$val3, $val);
-#$val = enumCheck(Class1::Struct1.$val4, $val);
-#
-#$val = 0;
-#$val = enumCheck(Class1::Struct1.Enum14_Val1, 3141);
-#$val = enumCheck(Class1::Struct1.Enum14_Val2, 3142);
-#$val = enumCheck(Class1::Struct1.Enum14_Val3, $val);
-#$val = enumCheck(Class1::Struct1.Enum14_Val4, $val);
-#$val = enumCheck(Class1::Struct1.Enum14_Val5g, 3141);
-#$val = enumCheck(Class1::Struct1.Enum14_Val6g, $val);
-
-$val = 0;
-$val = enumCheck(Class2::Enum12_Val1, 2121);
-$val = enumCheck(Class2::Enum12_Val2, 2122);
-$val = enumCheck(Class2::Enum12_Val3, $val);
-$val = enumCheck(Class2::Enum12_Val4, $val);
-$val = enumCheck(Class2::Enum12_Val5h, 2121);
-$val = enumCheck(Class2::Enum12_Val6h, $val);
-
-$val = 0;
-$val = enumCheck(Class2::Val1, 2131);
-$val = enumCheck(Class2::Val2, 2132);
-$val = enumCheck(Class2::Val3, $val);
-$val = enumCheck(Class2::Val4, $val);
-$val = enumCheck(Class2::Val5i, 2131);
-$val = enumCheck(Class2::Val6i, $val);
-
-$val = 0;
-$val = enumCheck(Class2::Enum14_Val1, 2141);
-$val = enumCheck(Class2::Enum14_Val2, 2142);
-$val = enumCheck(Class2::Enum14_Val3, $val);
-$val = enumCheck(Class2::Enum14_Val4, $val);
-$val = enumCheck(Class2::Enum14_Val5j, 2141);
-$val = enumCheck(Class2::Enum14_Val6j, $val);
-
-# Requires nested class support to work
-#$val = 0;
-#$val = enumCheck(Class2::Struct1.Enum12_Val1, 4121);
-#$val = enumCheck(Class2::Struct1.Enum12_Val2, 4122);
-#$val = enumCheck(Class2::Struct1.Enum12_Val3, $val);
-#$val = enumCheck(Class2::Struct1.Enum12_Val4, $val);
-#$val = enumCheck(Class2::Struct1.Enum12_Val5k, 4121);
-#$val = enumCheck(Class2::Struct1.Enum12_Val6k, $val);
-#
-#$val = 0;
-#$val = enumCheck(Class2::Struct1.$val1, 4131);
-#$val = enumCheck(Class2::Struct1.$val2, 4132);
-#$val = enumCheck(Class2::Struct1.$val3, $val);
-#$val = enumCheck(Class2::Struct1.$val4, $val);
-#$val = enumCheck(Class2::Struct1.$val5l, 4131);
-#$val = enumCheck(Class2::Struct1.$val6l, $val);
-#
-#$val = 0;
-#$val = enumCheck(Class2::Struct1.Enum14_Val1, 4141);
-#$val = enumCheck(Class2::Struct1.Enum14_Val2, 4142);
-#$val = enumCheck(Class2::Struct1.Enum14_Val3, $val);
-#$val = enumCheck(Class2::Struct1.Enum14_Val4, $val);
-#$val = enumCheck(Class2::Struct1.Enum14_Val5m, 4141);
-#$val = enumCheck(Class2::Struct1.Enum14_Val6m, $val);
-
-$class1 = new Class1();
-enumCheck($class1->class1Test1(Enum1_Val5a), 13);
-enumCheck($class1->class1Test2(Class1::Enum12_Val5c), 1121);
-#enumCheck($class1.class1Test3(Class1::Struct1.Enum12_Val5f), 3121);
-
-enumCheck(globalTest1(Enum1_Val5a), 13);
-enumCheck(globalTest2(Class1::Enum12_Val5c), 1121);
-#enumCheck(globalTest3(Class1::Struct1.Enum12_Val5f), 3121);
-
-?>
diff --git a/Examples/test-suite/php5/cpp_basic_runme.php b/Examples/test-suite/php5/cpp_basic_runme.php
deleted file mode 100644
index 6a8522e3e..000000000
--- a/Examples/test-suite/php5/cpp_basic_runme.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-require "tests.php";
-require "cpp_basic.php";
-
-// New functions
-check::functions(array(foo_func1,foo_func2,foo___str__,foosubsub___str__,bar_test,bar_testfoo,get_func1_ptr,get_func2_ptr,test_func_ptr,fl_window_show));
-// New classes
-check::classes(array(cpp_basic,Foo,FooSub,FooSubSub,Bar,Fl_Window));
-// New vars
-check::globals(array(foo_num,foo_func_ptr,bar_fptr,bar_fref,bar_fval,bar_cint,bar_global_fptr,bar_global_fref,bar_global_fval));
-
-$f = new Foo(3);
-$f->func_ptr = get_func1_ptr();
-check::equal(test_func_ptr($f, 7), 2*7*3, "get_func1_ptr() didn't work");
-$f->func_ptr = get_func2_ptr();
-check::equal(test_func_ptr($f, 7), -7*3, "get_func2_ptr() didn't work");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/cpp_static_runme.php b/Examples/test-suite/php5/cpp_static_runme.php
deleted file mode 100644
index 9b436b87c..000000000
--- a/Examples/test-suite/php5/cpp_static_runme.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-require "tests.php";
-require "cpp_static.php";
-
-// New functions
-check::functions(array(staticfunctiontest_static_func,staticfunctiontest_static_func_2,staticfunctiontest_static_func_3,is_python_builtin));
-// New classes
-check::classes(array(StaticMemberTest,StaticFunctionTest,cpp_static,StaticBase,StaticDerived));
-// New vars
-check::globals(array(staticmembertest_static_int,staticbase_statty,staticderived_statty));
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_abstract_runme.php b/Examples/test-suite/php5/director_abstract_runme.php
deleted file mode 100644
index ca3d676da..000000000
--- a/Examples/test-suite/php5/director_abstract_runme.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_abstract.php";
-
-// No new functions
-check::functions(array(foo_ping,foo_pong,example0_getxsize,example0_color,example0_get_color,example1_getxsize,example1_color,example1_get_color,example2_getxsize,example2_color,example2_get_color,example4_getxsize,example4_color,example4_get_color,example3_i_color,example3_i_get_color,g,a_f));
-// No new classes
-check::classes(array(director_abstract,Foo,Example0,Example1,Example2,Example4,Example3_i,A));
-// now new vars
-check::globals(array());
-
-class MyFoo extends Foo {
- function ping() {
- return "MyFoo::ping()";
- }
-}
-
-$a = new MyFoo();
-
-check::equal($a->ping(), "MyFoo::ping()", "MyFoo::ping failed");
-
-check::equal($a->pong(), "Foo::pong();MyFoo::ping()", "MyFoo::pong failed");
-
-class MyExample1 extends Example1 {
- function Color($r, $g, $b) {
- return $r;
- }
-}
-
-class MyExample2 extends Example1 {
- function Color($r, $g, $b) {
- return $g;
- }
-}
-
-class MyExample3 extends Example1 {
- function Color($r, $g, $b) {
- return $b;
- }
-}
-
-$me1 = new MyExample1();
-check::equal($me1->Color(1, 2, 3), 1, "Example1_get_color failed");
-
-$me2 = new MyExample2(1, 2);
-check::equal($me2->Color(1, 2, 3), 2, "Example2_get_color failed");
-
-$me3 = new MyExample3();
-check::equal($me3->Color(1, 2, 3), 3, "Example3_get_color failed");
-
-$class = new ReflectionClass('Example1');
-check::equal($class->isAbstract(), true, "Example1 abstractness failed");
-
-$class = new ReflectionClass('Example2');
-check::equal($class->isAbstract(), true, "Example2 abstractness failed");
-
-$class = new ReflectionClass('Example3_i');
-check::equal($class->isAbstract(), true, "Example3_i abstractness failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_basic_runme.php b/Examples/test-suite/php5/director_basic_runme.php
deleted file mode 100644
index de6b50502..000000000
--- a/Examples/test-suite/php5/director_basic_runme.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_basic.php";
-
-// No new functions
-check::functions(array(foo_ping,foo_pong,foo_get_self,a_f,a_rg,a1_ff,myclass_method,myclass_vmethod,myclass_pmethod,myclass_cmethod,myclass_get_self,myclass_call_pmethod,myclasst_i_method));
-// No new classes
-check::classes(array(Foo,A,A1,Bar,MyClass,MyClassT_i));
-// now new vars
-check::globals(array(bar_x));
-
-class PhpFoo extends Foo {
- function ping() {
- return "PhpFoo::ping()";
- }
-}
-
-$a = new PhpFoo();
-
-check::equal($a->ping(), "PhpFoo::ping()", "ping failed");
-
-check::equal($a->pong(), "Foo::pong();PhpFoo::ping()", "pong failed");
-
-$b = new Foo();
-
-check::equal($b->ping(), "Foo::ping()", "ping failed");
-
-check::equal($b->pong(), "Foo::pong();Foo::ping()", "pong failed");
-
-$a = new A1(1);
-
-check::equal($a->rg(2), 2, "rg failed");
-
-class PhpClass extends MyClass {
- function vmethod($b) {
- $b->x = $b->x + 31;
- return $b;
- }
-}
-
-$b = new Bar(3);
-$d = new MyClass();
-$c = new PhpClass();
-
-$cc = MyClass::get_self($c);
-$dd = MyClass::get_self($d);
-
-$bc = $cc->cmethod($b);
-$bd = $dd->cmethod($b);
-
-$cc->method($b);
-
-check::equal($bc->x, 34, "bc failed");
-check::equal($bd->x, 16, "bd failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_classic_runme.php b/Examples/test-suite/php5/director_classic_runme.php
deleted file mode 100644
index d2da1b1ba..000000000
--- a/Examples/test-suite/php5/director_classic_runme.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_classic.php";
-
-// No new functions
-check::functions(array(being_id,person_id,child_id,grandchild_id,caller_delcallback,caller_setcallback,caller_resetcallback,caller_call,caller_baseclass));
-// No new classes
-check::classes(array(Being,Person,Child,GrandChild,OrphanPerson,OrphanChild,Caller));
-// now new vars
-check::globals(array());
-
-class TargetLangPerson extends Person {
- function id() {
- $identifier = "TargetLangPerson";
- return $identifier;
- }
-}
-
-class TargetLangChild extends Child {
- function id() {
- $identifier = "TargetLangChild";
- return $identifier;
- }
-}
-
-class TargetLangGrandChild extends GrandChild {
- function id() {
- $identifier = "TargetLangGrandChild";
- return $identifier;
- }
-}
-
-# Semis - don't override id() in target language
-class TargetLangSemiPerson extends Person {
- # No id() override
-}
-
-class TargetLangSemiChild extends Child {
- # No id() override
-}
-
-class TargetLangSemiGrandChild extends GrandChild {
- # No id() override
-}
-
-# Orphans - don't override id() in C++
-class TargetLangOrphanPerson extends OrphanPerson {
- function id() {
- $identifier = "TargetLangOrphanPerson";
- return $identifier;
- }
-}
-
-class TargetLangOrphanChild extends OrphanChild {
- function id() {
- $identifier = "TargetLangOrphanChild";
- return $identifier;
- }
-}
-
-function mycheck($person, $expected) {
- $debug = 0;
- # Normal target language polymorphic call
- $ret = $person->id();
- if ($debug)
- print $ret . "\n";
- check::equal($ret, $expected, "#1 failed");
-
- # Polymorphic call from C++
- $caller = new Caller();
- $caller->setCallback($person);
- $ret = $caller->call();
- if ($debug)
- print $ret . "\n";
- check::equal($ret, $expected, "#2 failed");
-
- # Polymorphic call of object created in target language and passed to
- # C++ and back again
- $baseclass = $caller->baseClass();
- $ret = $baseclass->id();
- if ($debug)
- print $ret . "\n";
- # TODO: Currently we do not track the dynamic type of returned
- # objects, so in case it's possible that the dynamic type is not equal
- # to the static type, we skip this check.
- if (get_parent_class($person) === false)
- check::equal($ret, $expected, "#3 failed");
-
- $caller->resetCallback();
- if ($debug)
- print "----------------------------------------\n";
-}
-
-$person = new Person();
-mycheck($person, "Person");
-unset($person);
-
-$person = new Child();
-mycheck($person, "Child");
-unset($person);
-
-$person = new GrandChild();
-mycheck($person, "GrandChild");
-unset($person);
-
-$person = new TargetLangPerson();
-mycheck($person, "TargetLangPerson");
-unset($person);
-
-$person = new TargetLangChild();
-mycheck($person, "TargetLangChild");
-unset($person);
-
-$person = new TargetLangGrandChild();
-mycheck($person, "TargetLangGrandChild");
-unset($person);
-
-# Semis - don't override id() in target language
-$person = new TargetLangSemiPerson();
-mycheck($person, "Person");
-unset($person);
-
-$person = new TargetLangSemiChild();
-mycheck($person, "Child");
-unset($person);
-
-$person = new TargetLangSemiGrandChild();
-mycheck($person, "GrandChild");
-unset($person);
-
-# Orphans - don't override id() in C++
-$person = new OrphanPerson();
-mycheck($person, "Person");
-unset($person);
-
-$person = new OrphanChild();
-mycheck($person, "Child");
-unset($person);
-
-$person = new TargetLangOrphanPerson();
-mycheck($person, "TargetLangOrphanPerson");
-unset($person);
-
-$person = new TargetLangOrphanChild();
-mycheck($person, "TargetLangOrphanChild");
-unset($person);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_default_runme.php b/Examples/test-suite/php5/director_default_runme.php
deleted file mode 100644
index f97fc7425..000000000
--- a/Examples/test-suite/php5/director_default_runme.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_default.php";
-
-// No new functions
-check::functions(array(foo_msg,foo_getmsg,bar_msg,bar_getmsg,defaultsbase_defaultargs,defaultsderived_defaultargs));
-// No new classes
-check::classes(array(Foo,Bar,DefaultsBase,DefaultsDerived));
-// now new vars
-check::globals(array());
-
-$f = new Foo();
-$f = new Foo(1);
-
-$f = new Bar();
-$f = new Bar(1);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_detect_runme.php b/Examples/test-suite/php5/director_detect_runme.php
deleted file mode 100644
index cc19c0302..000000000
--- a/Examples/test-suite/php5/director_detect_runme.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_detect.php";
-
-// No new functions
-check::functions(array(foo_cloner,foo_get_value,foo_get_class,foo_just_do_it,bar_baseclass,bar_cloner,bar_get_value,bar_get_class,bar_just_do_it));
-// No new classes
-check::classes(array(A,Foo,Bar));
-// now new vars
-check::globals(array());
-
-class MyBar extends Bar {
- function __construct($val = 2) {
- parent::__construct();
- $this->val = $val;
- }
-
- function get_value() {
- $this->val = $this->val + 1;
- return $this->val;
- }
-
- function get_class() {
- $this->val = $this->val + 1;
- return new A();
- }
-
- function just_do_it() {
- $this->val = $this->val + 1;
- }
-
- /* clone is a reserved keyword */
- function clone_() {
- return new MyBar($this->val);
- }
-}
-
-$b = new MyBar();
-
-$f = $b->baseclass();
-
-$v = $f->get_value();
-$a = $f->get_class();
-$f->just_do_it();
-
-$c = $b->clone_();
-$vc = $c->get_value();
-
-check::equal($v, 3, "f: Bad virtual detection");
-check::equal($b->val, 5, "b: Bad virtual detection");
-check::equal($vc, 6, "c: Bad virtual detection");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_enum_runme.php b/Examples/test-suite/php5/director_enum_runme.php
deleted file mode 100644
index 8f6487a28..000000000
--- a/Examples/test-suite/php5/director_enum_runme.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_enum.php";
-
-// No new functions
-check::functions(array(foo_say_hello,foo_say_hi,foo_say_bye,foo_say_hi_ref,foo_ping,foo_ping_ref,foo_ping_member_enum,a_f,a2_f));
-// No new classes
-check::classes(array(director_enum,Foo,A,B,A2,B2));
-// now new vars
-check::globals(array());
-
-class MyFoo extends Foo {
- function say_hi($val) {
- return $val;
- }
-}
-
-$b = new Foo();
-$a = new MyFoo();
-
-check::equal($a->say_hi(director_enum::hello), $b->say_hello(director_enum::hi), "say failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_exception_runme.php b/Examples/test-suite/php5/director_exception_runme.php
deleted file mode 100644
index 8b852c2ce..000000000
--- a/Examples/test-suite/php5/director_exception_runme.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_exception.php";
-
-// No new functions
-check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang,returnalltypes_return_int,returnalltypes_return_double,returnalltypes_return_const_char_star,returnalltypes_return_std_string,returnalltypes_return_bar,returnalltypes_call_int,returnalltypes_call_double,returnalltypes_call_const_char_star,returnalltypes_call_std_string,returnalltypes_call_bar,is_python_builtin));
-// No new classes
-check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
-// now new vars
-check::globals(array());
-
-class MyException extends Exception {
- function __construct($a, $b) {
- $this->msg = $a . $b;
- }
-}
-
-class MyFoo extends Foo {
- function ping() {
- throw new Exception("MyFoo::ping() EXCEPTION");
- }
-}
-
-class MyFoo2 extends Foo {
- function ping() {
- return true;
- }
-}
-
-class MyFoo3 extends Foo {
- function ping() {
- throw new MyException("foo", "bar");
- }
-}
-
-# Check that the Exception raised by MyFoo.ping() is returned by
-# MyFoo.pong().
-$ok = 0;
-$a = new MyFoo();
-# TODO: Currently we do not track the dynamic type of returned
-# objects, so we skip the launder() call.
-#$b = director_exception::launder($a);
-$b = $a;
-try {
- $b->pong();
-} catch (Exception $e) {
- $ok = 1;
- check::equal($e->getMessage(), "MyFoo::ping() EXCEPTION", "Unexpected error message #1");
-}
-check::equal($ok, 1, "Got no exception while expected one #1");
-
-# Check that the director can return an exception which requires two
-# arguments to the constructor, without mangling it.
-$ok = 0;
-$a = new MyFoo3();
-#$b = director_exception::launder($a);
-$b = $a;
-try {
- $b->pong();
-} catch (Exception $e) {
- $ok = 1;
- check::equal($e->msg, "foobar", "Unexpected error message #2");
-}
-check::equal($ok, 1, "Got no exception while expected one #2");
-
-try {
- throw new Exception2();
-} catch (Exception2 $e2) {
-}
-
-try {
- throw new Exception1();
-} catch (Exception1 $e1) {
-}
-
-// Check that we can throw exceptions from director methods (this didn't used
-// to work in all cases, as the exception gets "set" in PHP and the method
-// then returns PHP NULL, which the directorout template may fail to convert.
-
-class Bad extends ReturnAllTypes {
- function return_int() { throw new Exception("bad int"); }
- function return_double() { throw new Exception("bad double"); }
- function return_const_char_star() { throw new Exception("bad const_char_star"); }
- function return_std_string() { throw new Exception("bad std_string"); }
- function return_Bar() { throw new Exception("bad Bar"); }
-}
-
-$bad = new Bad();
-
-try {
- $bad->call_int();
- check::fail("Exception wasn't propagated from Bad::return_int()");
-} catch (Exception $e) {
- check::equal($e->getMessage(), "bad int", "propagated exception incorrect");
-}
-
-try {
- $bad->call_double();
- check::fail("Exception wasn't propagated from Bad::return_double()");
-} catch (Exception $e) {
- check::equal($e->getMessage(), "bad double", "propagated exception incorrect");
-}
-
-try {
- $bad->call_const_char_star();
- check::fail("Exception wasn't propagated from Bad::return_const_char_star()");
-} catch (Exception $e) {
- check::equal($e->getMessage(), "bad const_char_star", "propagated exception incorrect");
-}
-
-try {
- $bad->call_std_string();
- check::fail("Exception wasn't propagated from Bad::return_std_string()");
-} catch (Exception $e) {
- check::equal($e->getMessage(), "bad std_string", "propagated exception incorrect");
-}
-
-try {
- $bad->call_Bar();
- check::fail("Exception wasn't propagated from Bad::return_Bar()");
-} catch (Exception $e) {
- check::equal($e->getMessage(), "bad Bar", "propagated exception incorrect");
-}
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_extend_runme.php b/Examples/test-suite/php5/director_extend_runme.php
deleted file mode 100644
index f283aefbe..000000000
--- a/Examples/test-suite/php5/director_extend_runme.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_extend.php";
-
-// No new functions
-check::functions(array(spobject_getfoobar,spobject_dummy,spobject_exceptionmethod));
-// No new classes
-check::classes(array(SpObject));
-// now new vars
-check::globals(array());
-
-class MyObject extends SpObject{
- function getFoo() {
- return 123;
- }
-}
-
-$m = new MyObject();
-check::equal($m->dummy(), 666, "1st call");
-check::equal($m->dummy(), 666, "2st call"); // Locked system
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_finalizer_runme.php b/Examples/test-suite/php5/director_finalizer_runme.php
deleted file mode 100644
index 0fcddfd8b..000000000
--- a/Examples/test-suite/php5/director_finalizer_runme.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_finalizer.php";
-
-// No new functions
-check::functions(array(foo_orstatus,deletefoo,getstatus,launder,resetstatus));
-// No new classes
-check::classes(array(director_finalizer,Foo));
-// now new vars
-check::globals(array());
-
-class MyFoo extends Foo {
- function __destruct() {
- $this->orStatus(2);
- if (method_exists(parent, "__destruct")) {
- parent::__destruct();
- }
- }
-}
-
-resetStatus();
-
-$a = new MyFoo();
-unset($a);
-
-check::equal(getStatus(), 3, "getStatus() failed #1");
-
-resetStatus();
-
-$a = new MyFoo();
-launder($a);
-
-check::equal(getStatus(), 0, "getStatus() failed #2");
-
-unset($a);
-
-check::equal(getStatus(), 3, "getStatus() failed #3");
-
-resetStatus();
-
-$a = new MyFoo();
-$a->thisown = 0;
-deleteFoo($a);
-unset($a);
-
-check::equal(getStatus(), 3, "getStatus() failed #4");
-
-resetStatus();
-
-$a = new MyFoo();
-$a->thisown = 0;
-deleteFoo(launder($a));
-unset($a);
-
-check::equal(getStatus(), 3, "getStatus() failed #5");
-
-resetStatus();
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_frob_runme.php b/Examples/test-suite/php5/director_frob_runme.php
deleted file mode 100644
index 548b0b804..000000000
--- a/Examples/test-suite/php5/director_frob_runme.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_frob.php";
-
-// No new functions
-check::functions(array(alpha_abs_method,bravo_abs_method,charlie_abs_method,ops_opint,ops_opintstarstarconst,ops_opintamp,ops_opintstar,ops_opconstintintstar,prims_ull,prims_callull,corecallbacks_on3dengineredrawn,corecallbacks_on3dengineredrawn2));
-// No new classes
-check::classes(array(Alpha,Bravo,Charlie,Delta,Ops,Prims,corePoint3d,coreCallbacks_On3dEngineRedrawnData,coreCallbacksOn3dEngineRedrawnData,coreCallbacks));
-// now new vars
-check::globals(array(corecallbacks_on3dengineredrawndata__eye,corecallbacks_on3dengineredrawndata__at,corecallbackson3dengineredrawndata__eye,corecallbackson3dengineredrawndata__at));
-
-$foo = new Bravo();
-$s = $foo->abs_method();
-
-check::equal($s, "Bravo::abs_method()", "s failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_nested_runme.php b/Examples/test-suite/php5/director_nested_runme.php
deleted file mode 100644
index 4965e94f7..000000000
--- a/Examples/test-suite/php5/director_nested_runme.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_nested.php";
-
-// No new functions
-check::functions(array(foo_int_advance,foo_int_do_advance,bar_step,bar_do_advance,bar_do_step,foobar_int_get_value,foobar_int_get_name,foobar_int_name,foobar_int_get_self,foobar_int_do_advance,foobar_int_do_step));
-// No new classes
-check::classes(array(Foo_int,Bar,FooBar_int));
-// now new vars
-check::globals(array());
-
-class A extends FooBar_int {
- function do_step() {
- return "A::do_step;";
- }
-
- function get_value() {
- return "A::get_value";
- }
-}
-
-$a = new A();
-check::equal($a->step(), "Bar::step;Foo::advance;Bar::do_advance;A::do_step;", "Bad A virtual resolution");
-
-class B extends FooBar_int {
- function do_advance() {
- return "B::do_advance;" . $this->do_step();
- }
-
- function do_step() {
- return "B::do_step;";
- }
-
- function get_value() {
- return 1;
- }
-}
-
-$b = new B();
-
-check::equal($b->step(), "Bar::step;Foo::advance;B::do_advance;B::do_step;", "Bad B virtual resolution");
-
-class C extends FooBar_int {
- function do_advance() {
- return "C::do_advance;" . parent::do_advance();
- }
-
- function do_step() {
- return "C::do_step;";
- }
-
- function get_value() {
- return 2;
- }
-
- function get_name() {
- return parent::get_name() . " hello";
- }
-}
-
-$cc = new C();
-# TODO: Currently we do not track the dynamic type of returned
-# objects, so we skip the get_self() call.
-#$c = Foobar_int::get_self($cc);
-$c = $cc;
-$c->advance();
-
-check::equal($c->get_name(), "FooBar::get_name hello", "get_name failed");
-
-check::equal($c->name(), "FooBar::get_name hello", "name failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_pass_by_value_runme.php b/Examples/test-suite/php5/director_pass_by_value_runme.php
deleted file mode 100644
index 8a8b84d67..000000000
--- a/Examples/test-suite/php5/director_pass_by_value_runme.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_pass_by_value.php";
-
-$passByVal = null;
-
-class director_pass_by_value_Derived extends DirectorPassByValueAbstractBase {
- function virtualMethod($b) {
- global $passByVal;
- $passByVal = $b;
- }
-}
-
-# bug was the passByVal global object was destroyed after the call to virtualMethod had finished.
-$caller = new Caller();
-$caller->call_virtualMethod(new director_pass_by_value_Derived());
-$ret = $passByVal->getVal();
-if ($ret != 0x12345678) {
- check::fail("Bad return value, got " . dechex($ret));
-}
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_profile_runme.php b/Examples/test-suite/php5/director_profile_runme.php
deleted file mode 100644
index c72421341..000000000
--- a/Examples/test-suite/php5/director_profile_runme.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_profile.php";
-
-// No new functions
-check::functions(array(b_fn,b_vfi,b_fi,b_fj,b_fk,b_fl,b_get_self,b_vfs,b_fs));
-// No new classes
-check::classes(array(A,B));
-// now new vars
-check::globals(array());
-
-class MyB extends B {
- function vfi($a) {
- return $a+3;
- }
-}
-
-$a = new A();
-$myb = new MyB();
-$b = B::get_self($myb);
-
-$i = 50000;
-$a = 1;
-
-while ($i) {
- $a = $b->fi($a); #1
- $a = $b->fi($a); #2
- $a = $b->fi($a); #3
- $a = $b->fi($a); #4
- $a = $b->fi($a); #5
- $a = $b->fi($a); #6
- $a = $b->fi($a); #7
- $a = $b->fi($a); #8
- $a = $b->fi($a); #9
- $a = $b->fi($a); #10
- $a = $b->fi($a); #1
- $a = $b->fi($a); #2
- $a = $b->fi($a); #3
- $a = $b->fi($a); #4
- $a = $b->fi($a); #5
- $a = $b->fi($a); #6
- $a = $b->fi($a); #7
- $a = $b->fi($a); #8
- $a = $b->fi($a); #9
- $a = $b->fi($a); #20
- $i -= 1;
-}
-
-print $a . "\n";
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_protected_runme.php b/Examples/test-suite/php5/director_protected_runme.php
deleted file mode 100644
index 18586ca62..000000000
--- a/Examples/test-suite/php5/director_protected_runme.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_protected.php";
-
-check::functions(array(foo_pong,foo_s,foo_q,foo_ping,foo_pang,foo_used,foo_cheer,bar_create,bar_callping,bar_callcheer,bar_cheer,bar_pong,bar_used,bar_ping,bar_pang,a_draw,b_draw));
-check::classes(array(Foo,Bar,PrivateFoo,A,B,AA,BB));
-check::globals(array(bar_a));
-
-class FooBar extends Bar {
- protected function ping() {
- return "FooBar::ping();";
- }
-}
-
-class FooBar2 extends Bar {
- function ping() {
- return "FooBar2::ping();";
- }
-
- function pang() {
- return "FooBar2::pang();";
- }
-}
-
-class FooBar3 extends Bar {
- function cheer() {
- return "FooBar3::cheer();";
- }
-}
-
-$b = new Bar();
-$f = $b->create();
-$fb = new FooBar();
-$fb2 = new FooBar2();
-$fb3 = new FooBar3();
-
-check::equal($fb->used(), "Foo::pang();Bar::pong();Foo::pong();FooBar::ping();", "bad FooBar::used");
-
-check::equal($fb2->used(), "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();", "bad FooBar2::used");
-
-check::equal($b->pong(), "Bar::pong();Foo::pong();Bar::ping();", "bad Bar::pong");
-
-check::equal($f->pong(), "Bar::pong();Foo::pong();Bar::ping();", "bad Foo::pong");
-
-check::equal($fb->pong(), "Bar::pong();Foo::pong();FooBar::ping();", "bad FooBar::pong");
-
-$method = new ReflectionMethod('Bar', 'ping');
-check::equal($method->isProtected(), true, "Foo::ping should be protected");
-
-$method = new ReflectionMethod('Foo', 'ping');
-check::equal($method->isProtected(), true, "Foo::ping should be protected");
-
-$method = new ReflectionMethod('FooBar', 'pang');
-check::equal($method->isProtected(), true, "FooBar::pang should be protected");
-
-$method = new ReflectionMethod('Bar', 'cheer');
-check::equal($method->isProtected(), true, "Bar::cheer should be protected");
-
-$method = new ReflectionMethod('Foo', 'cheer');
-check::equal($method->isProtected(), true, "Foo::cheer should be protected");
-
-check::equal($fb3->cheer(), "FooBar3::cheer();", "bad fb3::pong");
-check::equal($fb2->callping(), "FooBar2::ping();", "bad fb2::callping");
-check::equal($fb2->callcheer(), "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();", "bad fb2::callcheer");
-check::equal($fb3->callping(), "Bar::ping();", "bad fb3::callping");
-check::equal($fb3->callcheer(), "FooBar3::cheer();", "bad fb3::callcheer");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_stl_runme.php b/Examples/test-suite/php5/director_stl_runme.php
deleted file mode 100644
index 29addd261..000000000
--- a/Examples/test-suite/php5/director_stl_runme.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_stl.php";
-
-// No new functions
-check::functions(array(foo_bar,foo_ping,foo_pong,foo_tping,foo_tpong,foo_pident,foo_vident,foo_vsecond,foo_tpident,foo_tvident,foo_tvsecond,foo_vidents,foo_tvidents));
-// No new classes
-check::classes(array(Foo));
-// now new vars
-check::globals(array());
-
-class MyFoo extends Foo {
- function ping($s) {
- return "MyFoo::ping():" . $s;
- }
-
- function pident($arg) {
- return $arg;
- }
-
- function vident($v) {
- return $v;
- }
-
- function vidents($v) {
- return $v;
- }
-
- function vsecond($v1, $v2) {
- return $v2;
- }
-}
-
-$a = new MyFoo();
-
-$a->tping("hello");
-$a->tpong("hello");
-
-# TODO: automatic conversion between PHP arrays and std::pair or
-# std::vector is not yet implemented.
-/*$p = array(1, 2);
-$a->pident($p);
-$v = array(3, 4);
-$a->vident($v);
-
-$a->tpident($p);
-$a->tvident($v);
-
-$v1 = array(3, 4);
-$v2 = array(5, 6);
-
-$a->tvsecond($v1, $v2);
-
-$vs = array("hi", "hello");
-$vs;
-$a->tvidents($vs);*/
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_string_runme.php b/Examples/test-suite/php5/director_string_runme.php
deleted file mode 100644
index 5ac583f78..000000000
--- a/Examples/test-suite/php5/director_string_runme.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_string.php";
-
-// No new functions
-check::functions(array(a_get_first,a_call_get_first,a_string_length,a_process_text,a_call_process_func,stringvector_size,stringvector_is_empty,stringvector_clear,stringvector_push,stringvector_pop,stringvector_capacity,stringvector_reserve));
-// No new classes
-check::classes(array(A,StringVector));
-// now new vars
-check::globals(array(a,a_call,a_m_strings,stringvector));
-
-class B extends A {
- function get_first() {
- return parent::get_first() . " world!";
- }
-
- function process_text($string) {
- parent::process_text($string);
- $this->smem = "hello";
- }
-}
-
-$b = new B("hello");
-
-$b->get(0);
-check::equal($b->get_first(),"hello world!", "get_first failed");
-
-$b->call_process_func();
-
-check::equal($b->smem, "hello", "smem failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_thread_runme.php b/Examples/test-suite/php5/director_thread_runme.php
deleted file mode 100644
index 809dec3e2..000000000
--- a/Examples/test-suite/php5/director_thread_runme.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_thread.php";
-
-# Fails in a ZTS-build of PHP - see: https://github.com/swig/swig/pull/155
-exit(0);
-
-// No new functions
-check::functions(array(millisecondsleep,foo_stop,foo_run,foo_do_foo));
-// No new classes
-check::classes(array(director_thread,Foo));
-// now new vars
-check::globals(array(foo_val));
-
-class Derived extends Foo {
- function do_foo() {
- $this->val = $this->val - 1;
- }
-}
-
-$d = new Derived();
-$d->run();
-
-if ($d->val >= 0) {
- check::fail($d->val);
-}
-
-$d->stop();
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/director_unroll_runme.php b/Examples/test-suite/php5/director_unroll_runme.php
deleted file mode 100644
index 626b1f07d..000000000
--- a/Examples/test-suite/php5/director_unroll_runme.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-require "tests.php";
-require "director_unroll.php";
-
-// No new functions
-check::functions(array(foo_ping,foo_pong));
-// No new classes
-check::classes(array(Foo,Bar));
-// now new vars
-check::globals(array(bar));
-
-class MyFoo extends Foo {
- function ping() {
- return "MyFoo::ping()";
- }
-}
-
-$a = new MyFoo();
-
-$b = new Bar();
-
-$b->set($a);
-$c = $b->get();
-
-check::equal($a->this, $c->this, "this failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/enum_scope_template_runme.php b/Examples/test-suite/php5/enum_scope_template_runme.php
deleted file mode 100644
index 85ba467b7..000000000
--- a/Examples/test-suite/php5/enum_scope_template_runme.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-require "tests.php";
-require "enum_scope_template.php";
-
-check::classes(array("enum_scope_template", "TreeInt"));
-check::functions(array("chops","treeint_chops"));
-check::equal(0,TreeInt_Oak,"0==TreeInt_Oak");
-check::equal(1,TreeInt_Fir,"1==TreeInt_Fir");
-check::equal(2,TreeInt_Cedar,"2==TreeInt_Cedar");
-check::equal(TreeInt_Oak,chops(TreeInt_Oak),"TreeInt_Oak==chops(TreeInt_Oak)");
-check::equal(TreeInt_Fir,chops(TreeInt_Fir),"TreeInt_Fir==chops(TreeInt_Fir)");
-check::equal(TreeInt_Cedar,chops(TreeInt_Cedar),"TreeInt_Cedar==chops(TreeInt_Cedar)");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/evil_diamond_ns_runme.php b/Examples/test-suite/php5/evil_diamond_ns_runme.php
deleted file mode 100644
index fcce0f767..000000000
--- a/Examples/test-suite/php5/evil_diamond_ns_runme.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-require "tests.php";
-require "evil_diamond_ns.php";
-
-check::classes(array("evil_diamond_ns","foo","bar","baz","spam"));
-check::functions("test");
-check::is_a("bar","foo");
-check::is_a("baz","foo");
-check::is_a("spam","foo");
-check::is_a("spam","bar");
-//No multiple inheritance
-//check::is_a("spam","baz");
-$spam=new spam();
-$_spam=test($spam);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/evil_diamond_prop_runme.php b/Examples/test-suite/php5/evil_diamond_prop_runme.php
deleted file mode 100644
index 02d9944d6..000000000
--- a/Examples/test-suite/php5/evil_diamond_prop_runme.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-require "tests.php";
-require "evil_diamond_prop.php";
-
-check::classes(array("evil_diamond_prop","foo","bar","baz","spam"));
-check::functions("test");
-check::is_a("bar","foo");
-check::is_a("baz","foo");
-check::is_a("spam","foo");
-check::is_a("spam","bar");
-//No multiple inheritance introspection yet
-//check::is_a("spam","baz");
-
-$foo=new foo();
-check::is_a($foo,"foo");
-check::equal(1,$foo->_foo,"1==foo->_foo");
-
-$bar=new bar();
-check::is_a($bar,"bar");
-check::equal(1,$bar->_foo,"1==bar->_foo");
-check::equal(2,$bar->_bar,"2==bar->_bar");
-
-$baz=new baz();
-check::is_a($baz,"baz");
-check::equal(1,$baz->_foo,"1==baz->_foo");
-check::equal(3,$baz->_baz,"3==baz->_baz");
-
-$spam=new spam();
-check::is_a($spam,"spam");
-check::equal(1,$spam->_foo,"1==spam->_foo");
-check::equal(2,$spam->_bar,"2==spam->_bar");
-// multiple inheritance not supported in PHP
-check::equal(null,$spam->_baz,"null==spam->_baz");
-check::equal(4,$spam->_spam,"4==spam->_spam");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/evil_diamond_runme.php b/Examples/test-suite/php5/evil_diamond_runme.php
deleted file mode 100644
index a587ca359..000000000
--- a/Examples/test-suite/php5/evil_diamond_runme.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-require "tests.php";
-require "evil_diamond.php";
-
-check::classes(array("evil_diamond","foo","bar","baz","spam"));
-check::functions("test");
-check::is_a("bar","foo");
-check::is_a("baz","foo");
-check::is_a("spam","foo");
-check::is_a("spam","bar");
-//No multiple inheritance
-//check::is_a("spam","baz");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/exception_order_runme.php b/Examples/test-suite/php5/exception_order_runme.php
deleted file mode 100644
index acb83561a..000000000
--- a/Examples/test-suite/php5/exception_order_runme.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?
-require "tests.php";
-require "exception_order.php";
-
-check::functions(array(a_foo,a_bar,a_foobar,a_barfoo,is_python_builtin));
-check::classes(array(A,E1,E2,E3,exception_order,ET_i,ET_d));
-check::globals(array(efoovar,foovar,cfoovar,a_sfoovar,a_foovar,a_efoovar));
-
-$a = new A();
-try {
- $a->foo();
-} catch (Exception $e) {
- check::equal($e->getMessage(), 'C++ E1 exception thrown', '');
-}
-
-try {
- $a->bar();
-} catch (Exception $e) {
- check::equal($e->getMessage(), 'C++ E2 exception thrown', '');
-}
-
-try {
- $a->foobar();
-} catch (Exception $e) {
- check::equal($e->getMessage(), 'postcatch unknown', '');
-}
-
-try {
- $a->barfoo(1);
-} catch (Exception $e) {
- check::equal($e->getMessage(), 'C++ E1 exception thrown', '');
-}
-
-try {
- $a->barfoo(2);
-} catch (Exception $e) {
- check::equal($e->getMessage(), 'C++ E2 * exception thrown', '');
-}
-?>
diff --git a/Examples/test-suite/php5/extend_template_ns_runme.php b/Examples/test-suite/php5/extend_template_ns_runme.php
deleted file mode 100644
index e6d3e9f73..000000000
--- a/Examples/test-suite/php5/extend_template_ns_runme.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-require "tests.php";
-require "extend_template_ns.php";
-
-check::classes(array("extend_template_ns","Foo_One"));
-$foo=new Foo_One();
-check::equal(2,$foo->test1(2),"test1");
-check::equal(3,$foo->test2(3),"test2");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/extend_template_runme.php b/Examples/test-suite/php5/extend_template_runme.php
deleted file mode 100644
index 41bde4458..000000000
--- a/Examples/test-suite/php5/extend_template_runme.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-require "tests.php";
-require "extend_template.php";
-
-check::classes(array("Foo_0"));
-$foo=new Foo_0();
-check::equal(2,$foo->test1(2),"test1");
-check::equal(3,$foo->test2(3),"test2");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/grouping_runme.php b/Examples/test-suite/php5/grouping_runme.php
deleted file mode 100644
index 51446f473..000000000
--- a/Examples/test-suite/php5/grouping_runme.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-require "tests.php";
-require "grouping.php";
-
-check::functions(array("test1","test2","do_unary","negate"));
-check::equal(5,test1(5),"5==test1(5)");
-check::resource(test2(7),"_p_int","_p_int==test2(7)");
-check::globals(array(test3));
-
-//check::equal(37,test3_get(),'37==test3_get()');
-check::equal(37,check::get("test3"),'37==get(test3)');
-//test3_set(38);
-check::set(test3,38);
-//check::equal(38,test3_get(),'38==test3_get() after test3_set(37)');
-check::equal(38,check::get(test3),'38==get(test3) after set(test)');
-
-check::equal(-5,negate(5),"-5==negate(5)");
-check::equal(7,do_unary(-7,NEGATE),"7=do_unary(-7,NEGATE)");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/ignore_parameter_runme.php b/Examples/test-suite/php5/ignore_parameter_runme.php
deleted file mode 100644
index 1c8c76ad4..000000000
--- a/Examples/test-suite/php5/ignore_parameter_runme.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-require "tests.php";
-require "ignore_parameter.php";
-
-// New functions
-check::functions(array(jaguar,lotus,tvr,ferrari,sportscars_daimler,sportscars_astonmartin,sportscars_bugatti,sportscars_lamborghini));
-// New classes
-check::classes(array(ignore_parameter,SportsCars,MiniCooper,MorrisMinor,FordAnglia,AustinAllegro));
-// No new vars
-check::globals(array());
-
-check::equal(jaguar(2,3.4),"hello",'jaguar(2,3.4)=="hello"');
-check::equal(lotus("eek",3.4),101,'lotus("eek",3.4)==101');
-check::equal(tvr("eek",2),8.8,'tvr("eek",2)==8.8');
-check::equal(ferrari(),101,'ferrari(2)==101');
-
-$sc=new sportscars();
-check::classname("sportscars",$sc);
-check::equal($sc->daimler(2,3.4),"hello",'$sc->daimler(2,3.4)=="hello"');
-check::equal($sc->astonmartin("eek",3.4),101,'$sc->mastonmartin("eek",3.4)==101');
-check::equal($sc->bugatti("eek",2),8.8,'$sc->bugatti("eek",2)==8.8');
-check::equal($sc->lamborghini(),101,'$sc->lamborghini(2)==101');
-
-$mc=new minicooper(2,3.4);
-check::classname("minicooper",$mc);
-
-$mm=new morrisminor("eek",3.4);
-check::classname("morrisminor",$mm);
-
-$fa=new fordanglia("eek",2);
-check::classname("fordanglia",$fa);
-
-$aa=new austinallegro();
-check::classname("austinallegro",$aa);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/import_nomodule_runme.php b/Examples/test-suite/php5/import_nomodule_runme.php
deleted file mode 100644
index 41836ba0f..000000000
--- a/Examples/test-suite/php5/import_nomodule_runme.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-require "tests.php";
-require "import_nomodule.php";
-
-// No new functions
-check::functions(array(create_foo,delete_foo,test1,is_python_builtin));
-// No new classes
-check::classes(array(import_nomodule,Bar));
-// now new vars
-check::globals(array());
-
-$f = import_nomodule::create_Foo();
-import_nomodule::test1($f,42);
-import_nomodule::delete_Foo($f);
-
-$b = new Bar();
-import_nomodule::test1($b,37);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/li_carrays_cpp_runme.php b/Examples/test-suite/php5/li_carrays_cpp_runme.php
deleted file mode 100644
index e0f9ffe92..000000000
--- a/Examples/test-suite/php5/li_carrays_cpp_runme.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-require "tests.php";
-require "li_carrays_cpp.php";
-
-// Check functions.
-check::functions(array(new_intarray,delete_intarray,intarray_getitem,intarray_setitem,doublearray_getitem,doublearray_setitem,doublearray_cast,doublearray_frompointer,xyarray_getitem,xyarray_setitem,xyarray_cast,xyarray_frompointer,delete_abarray,abarray_getitem,abarray_setitem,shortarray_getitem,shortarray_setitem,shortarray_cast,shortarray_frompointer,sum_array));
-
-// Check classes.
-// NB An "li_carrays_cpp" class is created as a mock namespace.
-check::classes(array(li_carrays_cpp,doubleArray,AB,XY,XYArray,shortArray));
-
-// Check global variables.
-check::globals(array(xy_x,xy_y,globalxyarray,ab_a,ab_b,globalabarray));
-
-$d = new doubleArray(10);
-
-$d->setitem(0, 7);
-$d->setitem(5, $d->getitem(0) + 3);
-check::equal($d->getitem(0) + $d->getitem(5), 17., "7+10==17");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/li_carrays_runme.php b/Examples/test-suite/php5/li_carrays_runme.php
deleted file mode 100644
index 40e82f9ea..000000000
--- a/Examples/test-suite/php5/li_carrays_runme.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-require "tests.php";
-require "li_carrays.php";
-
-// Check functions.
-check::functions(array(new_intarray,delete_intarray,intarray_getitem,intarray_setitem,doublearray_getitem,doublearray_setitem,doublearray_cast,doublearray_frompointer,xyarray_getitem,xyarray_setitem,xyarray_cast,xyarray_frompointer,delete_abarray,abarray_getitem,abarray_setitem,shortarray_getitem,shortarray_setitem,shortarray_cast,shortarray_frompointer,sum_array));
-
-// Check classes.
-// NB An "li_carrays" class is created as a mock namespace.
-check::classes(array(li_carrays,doubleArray,AB,XY,XYArray,shortArray));
-
-// Check global variables.
-check::globals(array(xy_x,xy_y,globalxyarray,ab_a,ab_b,globalabarray));
-
-$d = new doubleArray(10);
-
-$d->setitem(0, 7);
-$d->setitem(5, $d->getitem(0) + 3);
-check::equal($d->getitem(0) + $d->getitem(5), 17., "7+10==17");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/li_factory_runme.php b/Examples/test-suite/php5/li_factory_runme.php
deleted file mode 100644
index 6623e2a8c..000000000
--- a/Examples/test-suite/php5/li_factory_runme.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-require "tests.php";
-require "li_factory.php";
-
-// No new functions
-check::functions(array(geometry_draw,geometry_create,geometry_clone_,point_draw,point_width,point_clone_,circle_draw,circle_radius,circle_clone_));
-// No new classes
-check::classes(array(Geometry,Point,Circle));
-// now new vars
-check::globals(array());
-
-$circle = Geometry::create(Geometry::CIRCLE);
-$r = $circle->radius();
-check::equal($r, 1.5, "r failed");
-
-$point = Geometry::create(Geometry::POINT);
-$w = $point->width();
-check::equal($w, 1.0, "w failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/li_std_string_runme.php b/Examples/test-suite/php5/li_std_string_runme.php
deleted file mode 100644
index ad62247e1..000000000
--- a/Examples/test-suite/php5/li_std_string_runme.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-require "tests.php";
-require "li_std_string.php";
-
-// Global variables
-//$s="initial string";
-//check::equal(GlobalString2_get() ,"global string 2", "GlobalString2 test 1");
-
-// Global variables
-$s = "initial string";
-check::equal(GlobalString2_get(), "global string 2", "GlobalString2 test 1");
-GlobalString2_set($s);
-check::equal(GlobalString2_get(), $s, "GlobalString2 test 2");
-check::equal(ConstGlobalString_get(), "const global string", "ConstGlobalString test");
-
-// Member variables
-$myStructure = new Structure();
-check::equal($myStructure->MemberString2, "member string 2", "MemberString2 test 1");
-$myStructure->MemberString2 = $s;
-check::equal($myStructure->MemberString2, $s, "MemberString2 test 2");
-check::equal($myStructure->ConstMemberString, "const member string", "ConstMemberString test");
-
-check::equal(Structure::StaticMemberString2(), "static member string 2", "StaticMemberString2 test 1");
-Structure::StaticMemberString2($s);
-check::equal(Structure::StaticMemberString2(), $s, "StaticMemberString2 test 2");
-// below broken ?
-//check::equal(Structure::ConstStaticMemberString(), "const static member string", "ConstStaticMemberString test");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/li_std_vector_member_var_runme.php b/Examples/test-suite/php5/li_std_vector_member_var_runme.php
deleted file mode 100644
index 238350352..000000000
--- a/Examples/test-suite/php5/li_std_vector_member_var_runme.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-require "tests.php";
-require "li_std_vector_member_var.php";
-
-$t = new Test();
-
-check::equal($t->x, 0, "Test::x != 0");
-check::equal($t->v->size(), 0, "Test::v.size() != 0");
-
-$t->f(1);
-check::equal($t->x, 1, "Test::x != 1");
-check::equal($t->v->size(), 1, "Test::v.size() != 1");
-
-$t->f(2);
-check::equal($t->x, 3, "Test::x != 3");
-check::equal($t->v->size(), 2, "Test::v.size() != 2");
-
-$t->f(3);
-check::equal($t->x, 6, "Test::x != 6");
-check::equal($t->v->size(), 3, "Test::v.size() != 3");
-
-$T = new T();
-$T->start_t = new S();
-$T->length = 7;
-check::equal($T->start_t->x, 4, "S::x != 4");
-check::equal($T->length, 7, "T::length != 7");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/newobject1_runme.php b/Examples/test-suite/php5/newobject1_runme.php
deleted file mode 100644
index 5853a72c0..000000000
--- a/Examples/test-suite/php5/newobject1_runme.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-require "tests.php";
-require "newobject1.php";
-
-// No new functions
-check::functions(array(foo_makefoo,foo_makemore,foo_foocount));
-// No new classes
-check::classes(array(Foo));
-// now new vars
-check::globals(array());
-
-$foo = Foo::makeFoo();
-check::equal(get_class($foo), "Foo", "static failed");
-$bar = $foo->makeMore();
-check::equal(get_class($bar), "Foo", "regular failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/overload_rename_runme.php b/Examples/test-suite/php5/overload_rename_runme.php
deleted file mode 100644
index dce4c6cb3..000000000
--- a/Examples/test-suite/php5/overload_rename_runme.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-require "tests.php";
-require "overload_rename.php";
-
-// No new functions
-check::functions(array());
-// No new classes
-check::classes(array(Foo));
-// now new vars
-check::globals(array());
-
-$f = new Foo(1.0);
-$f = new Foo(1.0,1.0);
-$f = Foo::Foo_int(1.0,1);
-$f = Foo::Foo_int(1.0,1,1.0);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/overload_return_type_runme.php b/Examples/test-suite/php5/overload_return_type_runme.php
deleted file mode 100644
index 4fa19d22a..000000000
--- a/Examples/test-suite/php5/overload_return_type_runme.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-require "tests.php";
-require "overload_return_type.php";
-
-$b = new B;
-check::equal($b->foo(1), 0, "");
-check::classname("A", $b->foo("test"));
-
-check::equal(overload_return_type::foo(), 1, "overload_return_type::foo() should be 1");
-check::equal(overload_return_type::bar(), 1, "overload_return_type::bar() should be 1");
-
-?>
diff --git a/Examples/test-suite/php5/php_iterator_runme.php b/Examples/test-suite/php5/php_iterator_runme.php
deleted file mode 100644
index d69a5b385..000000000
--- a/Examples/test-suite/php5/php_iterator_runme.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-require "tests.php";
-require "php_iterator.php";
-
-check::functions(array(myiterator_rewind,myiterator_key,myiterator_current,myiterator_next,myiterator_valid));
-check::classes(array(MyIterator));
-// No new global variables.
-check::globals(array());
-
-$s = '';
-foreach (new MyIterator(1, 6) as $i) {
- $s .= $i;
-}
-check::equal($s, '12345', 'Simple iteration failed');
-
-$s = '';
-foreach (new MyIterator(2, 5) as $k => $v) {
- $s .= "($k=>$v)";
-}
-check::equal($s, '(0=>2)(1=>3)(2=>4)', 'Simple iteration failed');
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/pointer_reference_runme.php b/Examples/test-suite/php5/pointer_reference_runme.php
deleted file mode 100644
index 52946177e..000000000
--- a/Examples/test-suite/php5/pointer_reference_runme.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-require "tests.php";
-require "pointer_reference.php";
-
-$s = pointer_reference::get();
-check::equal($s->value, 10, "pointer_reference::get() failed");
-
-$ss = new Struct(20);
-pointer_reference::set($ss);
-$i = Struct::instance();
-check::equal($i->value, 20, "pointer_reference::set() failed");
-
-check::equal(pointer_reference::overloading(1), 111, "overload test 1 failed");
-check::equal(pointer_reference::overloading($ss), 222, "overload test 2 failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/prefix_runme.php b/Examples/test-suite/php5/prefix_runme.php
deleted file mode 100644
index ead064f5b..000000000
--- a/Examples/test-suite/php5/prefix_runme.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-require "tests.php";
-require "prefix.php";
-
-// No new functions
-check::functions(array(foo_get_self));
-// No new classes
-check::classes(array(ProjectFoo));
-// now new vars
-check::globals(array());
-
-$f = new ProjectFoo();
-// This resulted in "Fatal error: Class 'Foo' not found"
-$f->get_self();
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/preproc_constants_c_runme.php b/Examples/test-suite/php5/preproc_constants_c_runme.php
deleted file mode 100644
index 1ea01950e..000000000
--- a/Examples/test-suite/php5/preproc_constants_c_runme.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-
-require "tests.php";
-require "preproc_constants_c.php";
-
-// Same as preproc_constants.i testcase, but bool types are always wrapped as int.
-check::equal(gettype(preproc_constants_c::CONST_INT1), "integer", "preproc_constants.CONST_INT1 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_INT2), "integer", "preproc_constants.CONST_INT2 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_UINT1), "integer", "preproc_constants.CONST_UINT1 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_UINT2), "integer", "preproc_constants.CONST_UINT2 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_UINT3), "integer", "preproc_constants.CONST_UINT3 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_UINT4), "integer", "preproc_constants.CONST_UINT4 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_LONG1), "integer", "preproc_constants.CONST_LONG1 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_LONG2), "integer", "preproc_constants.CONST_LONG2 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_LONG3), "integer", "preproc_constants.CONST_LONG3 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_LONG4), "integer", "preproc_constants.CONST_LONG4 has unexpected type");
-# On some platforms these don't fit in a PHP integer and so get wrapped as a string constant.
-#check::equal(gettype(preproc_constants_c::CONST_LLONG1), "integer", "preproc_constants.CONST_LLONG1 has unexpected type");
-#check::equal(gettype(preproc_constants_c::CONST_LLONG2), "integer", "preproc_constants.CONST_LLONG2 has unexpected type");
-#check::equal(gettype(preproc_constants_c::CONST_LLONG3), "integer", "preproc_constants.CONST_LLONG3 has unexpected type");
-#check::equal(gettype(preproc_constants_c::CONST_LLONG4), "integer", "preproc_constants.CONST_LLONG4 has unexpected type");
-#check::equal(gettype(preproc_constants_c::CONST_ULLONG1), "integer", "preproc_constants.CONST_ULLONG1 has unexpected type");
-#check::equal(gettype(preproc_constants_c::CONST_ULLONG2), "integer", "preproc_constants.CONST_ULLONG2 has unexpected type");
-#check::equal(gettype(preproc_constants_c::CONST_ULLONG3), "integer", "preproc_constants.CONST_ULLONG3 has unexpected type");
-#check::equal(gettype(preproc_constants_c::CONST_ULLONG4), "integer", "preproc_constants.CONST_ULLONG4 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_DOUBLE1), "double", "preproc_constants.CONST_DOUBLE1 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_DOUBLE2), "double", "preproc_constants.CONST_DOUBLE2 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_DOUBLE3), "double", "preproc_constants.CONST_DOUBLE3 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_DOUBLE4), "double", "preproc_constants.CONST_DOUBLE4 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_DOUBLE5), "double", "preproc_constants.CONST_DOUBLE5 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_DOUBLE6), "double", "preproc_constants.CONST_DOUBLE6 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_BOOL1), "integer", "preproc_constants.CONST_BOOL1 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_BOOL2), "integer", "preproc_constants.CONST_BOOL2 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_CHAR), "string", "preproc_constants.CONST_CHAR has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_STRING1), "string", "preproc_constants.CONST_STRING1 has unexpected type");
-check::equal(gettype(preproc_constants_c::CONST_STRING2), "string", "preproc_constants.CONST_STRING2 has unexpected type");
-
-check::equal(gettype(preproc_constants_c::INT_AND_BOOL), "integer", "preproc_constants.INT_AND_BOOL has unexpected type");
-check::equal(gettype(preproc_constants_c::INT_AND_CHAR), "integer", "preproc_constants.INT_AND_CHAR has unexpected type");
-check::equal(gettype(preproc_constants_c::INT_AND_INT), "integer", "preproc_constants.INT_AND_INT has unexpected type");
-check::equal(gettype(preproc_constants_c::INT_AND_UINT), "integer", "preproc_constants.INT_AND_UINT has unexpected type");
-check::equal(gettype(preproc_constants_c::INT_AND_LONG), "integer", "preproc_constants.INT_AND_LONG has unexpected type");
-check::equal(gettype(preproc_constants_c::INT_AND_ULONG), "integer", "preproc_constants.INT_AND_ULONG has unexpected type");
-# On some platforms these don't fit in a PHP integer and so get wrapped as a string constant.
-#check::equal(gettype(preproc_constants_c::INT_AND_LLONG), "integer", "preproc_constants.INT_AND_LLONG has unexpected type");
-#check::equal(gettype(preproc_constants_c::INT_AND_ULLONG), "integer", "preproc_constants.INT_AND_ULLONG has unexpected type");
-check::equal(gettype(preproc_constants_c::BOOL_AND_BOOL), "integer", "preproc_constants.BOOL_AND_BOOL has unexpected type");
-
-check::equal(gettype(preproc_constants_c::EXPR_MULTIPLY), "integer", "preproc_constants.EXPR_MULTIPLY has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_DIVIDE), "integer", "preproc_constants.EXPR_DIVIDE has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_PLUS), "integer", "preproc_constants.EXPR_PLUS has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_MINUS), "integer", "preproc_constants.EXPR_MINUS has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_LSHIFT), "integer", "preproc_constants.EXPR_LSHIFT has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_RSHIFT), "integer", "preproc_constants.EXPR_RSHIFT has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_LTE), "integer", "preproc_constants.EXPR_LTE has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_GTE), "integer", "preproc_constants.EXPR_GTE has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_INEQUALITY), "integer", "preproc_constants.EXPR_INEQUALITY has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_EQUALITY), "integer", "preproc_constants.EXPR_EQUALITY has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_AND), "integer", "preproc_constants.EXPR_AND has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_XOR), "integer", "preproc_constants.EXPR_XOR has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constants.EXPR_OR has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
-check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
-
-?>
diff --git a/Examples/test-suite/php5/preproc_constants_runme.php b/Examples/test-suite/php5/preproc_constants_runme.php
deleted file mode 100644
index fb9ee4fa7..000000000
--- a/Examples/test-suite/php5/preproc_constants_runme.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-require "tests.php";
-require "preproc_constants.php";
-
-check::equal(gettype(preproc_constants::CONST_INT1), "integer", "preproc_constants.CONST_INT1 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_INT2), "integer", "preproc_constants.CONST_INT2 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_UINT1), "integer", "preproc_constants.CONST_UINT1 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_UINT2), "integer", "preproc_constants.CONST_UINT2 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_UINT3), "integer", "preproc_constants.CONST_UINT3 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_UINT4), "integer", "preproc_constants.CONST_UINT4 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_LONG1), "integer", "preproc_constants.CONST_LONG1 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_LONG2), "integer", "preproc_constants.CONST_LONG2 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_LONG3), "integer", "preproc_constants.CONST_LONG3 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_LONG4), "integer", "preproc_constants.CONST_LONG4 has unexpected type");
-# On some platforms these don't fit in a PHP integer and so get wrapped as a string constant.
-#check::equal(gettype(preproc_constants::CONST_LLONG1), "integer", "preproc_constants.CONST_LLONG1 has unexpected type");
-#check::equal(gettype(preproc_constants::CONST_LLONG2), "integer", "preproc_constants.CONST_LLONG2 has unexpected type");
-#check::equal(gettype(preproc_constants::CONST_LLONG3), "integer", "preproc_constants.CONST_LLONG3 has unexpected type");
-#check::equal(gettype(preproc_constants::CONST_LLONG4), "integer", "preproc_constants.CONST_LLONG4 has unexpected type");
-#check::equal(gettype(preproc_constants::CONST_ULLONG1), "integer", "preproc_constants.CONST_ULLONG1 has unexpected type");
-#check::equal(gettype(preproc_constants::CONST_ULLONG2), "integer", "preproc_constants.CONST_ULLONG2 has unexpected type");
-#check::equal(gettype(preproc_constants::CONST_ULLONG3), "integer", "preproc_constants.CONST_ULLONG3 has unexpected type");
-#check::equal(gettype(preproc_constants::CONST_ULLONG4), "integer", "preproc_constants.CONST_ULLONG4 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_DOUBLE1), "double", "preproc_constants.CONST_DOUBLE1 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_DOUBLE2), "double", "preproc_constants.CONST_DOUBLE2 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_DOUBLE3), "double", "preproc_constants.CONST_DOUBLE3 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_DOUBLE4), "double", "preproc_constants.CONST_DOUBLE4 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_DOUBLE5), "double", "preproc_constants.CONST_DOUBLE5 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_DOUBLE6), "double", "preproc_constants.CONST_DOUBLE6 has unexpected type");
-
-// SWIG wraps bool constants as integers for PHP5:
-check::equal(gettype(preproc_constants::CONST_BOOL1), "integer", "preproc_constants.CONST_BOOL1 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_BOOL2), "integer", "preproc_constants.CONST_BOOL2 has unexpected type");
-
-check::equal(gettype(preproc_constants::CONST_CHAR), "string", "preproc_constants.CONST_CHAR has unexpected type");
-check::equal(gettype(preproc_constants::CONST_STRING1), "string", "preproc_constants.CONST_STRING1 has unexpected type");
-check::equal(gettype(preproc_constants::CONST_STRING2), "string", "preproc_constants.CONST_STRING2 has unexpected type");
-
-check::equal(gettype(preproc_constants::INT_AND_BOOL), "integer", "preproc_constants.INT_AND_BOOL has unexpected type");
-check::equal(gettype(preproc_constants::INT_AND_CHAR), "integer", "preproc_constants.INT_AND_CHAR has unexpected type");
-check::equal(gettype(preproc_constants::INT_AND_INT), "integer", "preproc_constants.INT_AND_INT has unexpected type");
-check::equal(gettype(preproc_constants::INT_AND_UINT), "integer", "preproc_constants.INT_AND_UINT has unexpected type");
-check::equal(gettype(preproc_constants::INT_AND_LONG), "integer", "preproc_constants.INT_AND_LONG has unexpected type");
-check::equal(gettype(preproc_constants::INT_AND_ULONG), "integer", "preproc_constants.INT_AND_ULONG has unexpected type");
-# On some platforms these don't fit in a PHP integer and so get wrapped as a string constant.
-#check::equal(gettype(preproc_constants::INT_AND_LLONG), "integer", "preproc_constants.INT_AND_LLONG has unexpected type");
-#check::equal(gettype(preproc_constants::INT_AND_ULLONG), "integer", "preproc_constants.INT_AND_ULLONG has unexpected type");
-check::equal(gettype(preproc_constants::BOOL_AND_BOOL), "integer", "preproc_constants.BOOL_AND_BOOL has unexpected type");
-
-check::equal(gettype(preproc_constants::EXPR_MULTIPLY), "integer", "preproc_constants.EXPR_MULTIPLY has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_DIVIDE), "integer", "preproc_constants.EXPR_DIVIDE has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_PLUS), "integer", "preproc_constants.EXPR_PLUS has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_MINUS), "integer", "preproc_constants.EXPR_MINUS has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_LSHIFT), "integer", "preproc_constants.EXPR_LSHIFT has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_RSHIFT), "integer", "preproc_constants.EXPR_RSHIFT has unexpected type");
-
-// SWIG wraps bool constants as integers for PHP5:
-check::equal(gettype(preproc_constants::EXPR_LTE), "integer", "preproc_constants.EXPR_LTE has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_GTE), "integer", "preproc_constants.EXPR_GTE has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_INEQUALITY), "integer", "preproc_constants.EXPR_INEQUALITY has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_EQUALITY), "integer", "preproc_constants.EXPR_EQUALITY has unexpected type");
-
-check::equal(gettype(preproc_constants::EXPR_AND), "integer", "preproc_constants.EXPR_AND has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_XOR), "integer", "preproc_constants.EXPR_XOR has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_OR), "integer", "preproc_constants.EXPR_OR has unexpected type");
-
-// SWIG wraps bool constants as integers for PHP5:
-check::equal(gettype(preproc_constants::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type");
-check::equal(gettype(preproc_constants::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type");
-
-check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type");
-
-?>
diff --git a/Examples/test-suite/php5/primitive_ref_runme.php b/Examples/test-suite/php5/primitive_ref_runme.php
deleted file mode 100644
index 263a28074..000000000
--- a/Examples/test-suite/php5/primitive_ref_runme.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-require "tests.php";
-require "primitive_ref.php";
-
-# A large long long number is too big, so PHP makes treats it as a double, but SWIG opts to return it as a string.
-# The conversion to double can lose precision so this isn't an exact comparison.
-function long_long_equal($a,$b,$message) {
- if (! ($a===$b))
- if (! ((double)$a===$b))
- return check::fail($message . ": '$a'!=='$b'");
- return TRUE;
-}
-
-
-check::equal(ref_over(3), 3, "ref_over failed");
-
-check::equal(ref_int(3), 3, "ref_int failed");
-check::equal(ref_uint(3), 3, "ref_uint failed");
-check::equal(ref_short(3), 3, "ref_short failed");
-check::equal(ref_ushort(3), 3, "ref_ushort failed");
-check::equal(ref_long(3), 3, "ref_long failed");
-check::equal(ref_ulong(3), 3, "ref_ulong failed");
-check::equal(ref_schar(3), 3, "ref_schar failed");
-check::equal(ref_uchar(3), 3, "ref_uchar failed");
-check::equal(ref_bool(true), true, "ref_bool failed");
-check::equal(ref_float(3.5), 3.5, "ref_float failed");
-check::equal(ref_double(3.5), 3.5, "ref_double failed");
-check::equal(ref_char('x'), 'x', "ref_char failed");
-long_long_equal(ref_longlong(0x123456789ABCDEF0), 0x123456789ABCDEF0, "ref_longlong failed");
-long_long_equal(ref_ulonglong(0xF23456789ABCDEF0), 0xF23456789ABCDEF0, "ref_ulonglong failed");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/rename_scope_runme.php b/Examples/test-suite/php5/rename_scope_runme.php
deleted file mode 100644
index df620d796..000000000
--- a/Examples/test-suite/php5/rename_scope_runme.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-require "tests.php";
-require "rename_scope.php";
-
-check::classes(array("rename_scope","Interface_UP","Interface_BP","Natural_UP","Natural_BP","Bucket"));
-
-check::classmethods("Interface_UP",array("__construct","__set","__isset","__get"));
-check::classmethods("Interface_BP",array("__construct","__set","__isset","__get"));
-check::classmethods("Natural_UP",array("__construct","__set","__isset","__get","rtest"));
-check::classmethods("Natural_BP",array("__construct","__set","__isset","__get","rtest"));
-check::classparent("Natural_UP","Interface_UP");
-check::classparent("Natural_BP","Interface_BP");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/skel.php b/Examples/test-suite/php5/skel.php
deleted file mode 100644
index 780a999ed..000000000
--- a/Examples/test-suite/php5/skel.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-// Sample test file
-
-require "tests.php";
-require "____.php";
-
-// No new functions
-check::functions(array());
-// No new classes
-check::classes(array());
-// now new vars
-check::globals(array());
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/smart_pointer_rename_runme.php b/Examples/test-suite/php5/smart_pointer_rename_runme.php
deleted file mode 100644
index 26692dde5..000000000
--- a/Examples/test-suite/php5/smart_pointer_rename_runme.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-require "tests.php";
-require "smart_pointer_rename.php";
-
-check::classes(array("Foo","Bar"));
-check::classmethods("foo",array("ftest1","ftest2","__set","__isset","__get","__construct"));
-check::classmethods("bar",array("__deref__","test","ftest1","ftest2","__set","__isset","__get","__construct"));
-$foo=new foo();
-check::classname("foo",$foo);
-$bar=new bar($foo);
-check::classname("bar",$bar);
-
-# check foo's ftest1, ftest2
-check::equal(1,$foo->ftest1(1),"foo->ftest1");
-check::equal(2,$foo->ftest2(1,2),"foo->ftest2");
-
-# check bar's ftest1, ftest2, ftest
-check::equal(1,$bar->ftest1(1),"bar->ftest1");
-check::equal(2,$bar->ftest2(1,2),"bar->ftest2");
-check::equal(3,$bar->test(),"bar->test");
-
-# check deref returns foo
-check::classname("foo",$bar->__deref__());
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/swig_exception_runme.php b/Examples/test-suite/php5/swig_exception_runme.php
deleted file mode 100644
index 76641996e..000000000
--- a/Examples/test-suite/php5/swig_exception_runme.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-require("swig_exception.php");
-require("tests.php");
-
-$c = new Circle(10);
-$s = new Square(10);
-
-if (Shape::nshapes() != 2) {
- check::fail("Shape::nshapes() should be 2, actually ".Shape::nshapes());
-}
-
-# ----- Throw exception -----
-try {
- $c->throwException();
- check::fail("Exception wasn't thrown");
-} catch (Exception $e) {
- if ($e->getMessage() != "OK") {
- check::fail("Exception getMessage() should be \"OK\", actually \"".$e->getMessage()."\"");
- }
-}
-
-# ----- Delete everything -----
-
-$c = NULL;
-$s = NULL;
-$e = NULL;
-
-if (Shape::nshapes() != 0) {
- check::fail("Shape::nshapes() should be 0, actually ".Shape::nshapes());
-}
-
-?>
diff --git a/Examples/test-suite/php5/sym_runme.php b/Examples/test-suite/php5/sym_runme.php
deleted file mode 100644
index 483aaa980..000000000
--- a/Examples/test-suite/php5/sym_runme.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-require "tests.php";
-require "sym.php";
-
-// No new functions
-check::functions(array());
-// No new classes
-check::classes(array(flim,flam));
-// now new vars
-check::globals(array());
-
-$flim=new flim();
-$flam=new flam();
-
-check::equal($flim->hulahoops(),"flim-jam","flim()->hulahoops==flim-jam");
-check::equal($flim->jar(),"flim-jar","flim()->jar==flim-jar");
-check::equal($flam->jam(),"flam-jam","flam()->jam==flam-jam");
-check::equal($flam->jar(),"flam-jar","flam()->jar==flam-jar");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/template_arg_typename_runme.php b/Examples/test-suite/php5/template_arg_typename_runme.php
deleted file mode 100644
index 7d60285e3..000000000
--- a/Examples/test-suite/php5/template_arg_typename_runme.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-require "tests.php";
-require "template_arg_typename.php";
-
-// No new functions
-check::functions(array());
-// No new classes
-check::classes(array(UnaryFunction_bool_bool,BoolUnaryFunction_bool));
-$ufbb=new unaryfunction_bool_bool();
-check::is_a($ufbb,"unaryfunction_bool_bool");
-
-unset($whatisthis);
-$bufb=new boolunaryfunction_bool($whatisthis);
-check::is_a($bufb,"boolunaryfunction_bool");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/template_construct_runme.php b/Examples/test-suite/php5/template_construct_runme.php
deleted file mode 100644
index 3a3986f7e..000000000
--- a/Examples/test-suite/php5/template_construct_runme.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-require "tests.php";
-require "template_construct.php";
-
-check::classes(array(Foo_int));
-$foo_int=new foo_int(3);
-check::is_a($foo_int,"foo_int","Made a foo_int");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/tests.php b/Examples/test-suite/php5/tests.php
deleted file mode 100644
index d3fd66868..000000000
--- a/Examples/test-suite/php5/tests.php
+++ /dev/null
@@ -1,237 +0,0 @@
-<?php
-
-// do we have true global vars or just GETSET functions?
-// Used to filter out get/set global functions to fake vars...
-define(GETSET,1);
-
-$_original_functions=get_defined_functions();
-$_original_globals=1;
-$_original_classes=get_declared_classes();
-$_original_globals=array_keys($GLOBALS);
-
-class check {
- function get_extra_classes($ref=FALSE) {
- static $extra;
- global $_original_classes;
- if ($ref===FALSE) $f=$_original_classes;
- if (! is_array($extra)) {
- $df=array_flip(get_declared_classes());
- foreach($_original_classes as $class) unset($df[$class]);
- $extra=array_keys($df);
- }
- return $extra;
- }
-
- function get_extra_functions($ref=FALSE,$gs=false) {
- static $extra;
- static $extrags; // for get/setters
- global $_original_functions;
- if ($ref===FALSE) $f=$_original_functions;
- if (! is_array($extra) || $gs) {
- $extra=array();
- $extrags=array();
- $df=get_defined_functions();
- $df=array_flip($df[internal]);
- foreach($_original_functions[internal] as $func) unset($df[$func]);
- // Now chop out any get/set accessors
- foreach(array_keys($df) as $func)
- if ((GETSET && preg_match('/_[gs]et$/', $func)) ||
- preg_match('/^new_/', $func) ||
- preg_match('/_(alter|get)_newobject$/', $func))
- $extrags[]=$func;
- else $extra[]=$func;
-// $extra=array_keys($df);
- }
- if ($gs) return $extrags;
- return $extra;
- }
-
- function get_extra_globals($ref=FALSE) {
- static $extra;
- global $_original_globals;
- if (! is_array($extra)) {
- if (GETSET) {
- $_extra=array();
- foreach(check::get_extra_functions(false,1) as $global) {
- if (preg_match('/^(.*)_[sg]et$/', $global, $match))
- $_extra[$match[1]] = 1;
- }
- $extra=array_keys($_extra);
- } else {
- if ($ref===FALSE) $ref=$_original_globals;
- if (! is_array($extra)) {
- $df=array_flip(array_keys($GLOBALS));
- foreach($_original_globals as $func) unset($df[$func]);
- // MASK xxxx_LOADED__ variables
- foreach(array_keys($df) as $func)
- if (preg_match('/_LOADED__$/', $func)) unset($df[$func]);
- $extra=array_keys($df);
- }
- }
- }
- return $extra;
- }
-
- function classname($string,$object) {
- if (!is_object($object))
- return check::fail("The second argument is a " . gettype($object) . ", not an object.");
- if (strtolower($string)!=strtolower($classname=get_class($object))) return check::fail("Object: \$object is of class %s not class %s",$classname,$string);
- return TRUE;
- }
-
- function classmethods($classname,$methods) {
- if (is_object($classname)) $classname=get_class($classname);
- $classmethods=array_flip(get_class_methods($classname));
- $missing=array();
- $extra=array();
- foreach($methods as $method) {
- if (! isset($classmethods[$method])) $missing[]=$method;
- else unset($classmethods[$method]);
- }
- $extra=array_keys($classmethods);
- if ($missing) $message[]="does not have these methods:\n ".join(",",$missing);
- if ($message) {
- return check::fail("Class %s %s\nFull class list:\n %s\n",$classname,join("\nbut ",$message),join("\n ",get_class_methods($classname)));
- }
- if ($extra) $message[]="Class ".$classname." has these extra methods:\n ".join(",",$extra);
- if ($message) return check::warn(join("\n ",$message));
- return TRUE;
- }
-
- function set($var,$value) {
- $func=$var."_set";
- if (GETSET) $func($value);
- else $_GLOBALS[$var]=$value;
- }
-
- function &get($var) {
- $func=$var."_get";
- if (GETSET) return $func();
- else return $_GLOBALS[$var];
- }
-
- function is_a($a,$b) {
- if (is_object($a)) $a=strtolower(get_class($a));
- if (is_object($b)) $a=strtolower(get_class($b));
- $parents=array();
- $c=$a;
- while($c!=$b && $c) {
- $parents[]=$c;
- $c=strtolower(get_parent_class($c));
- }
- if ($c!=$b) return check::fail("Class $a does not inherit from class $b\nHierachy:\n %s\n",join("\n ",$parents));
- return TRUE;
- }
-
- function classparent($a,$b) {
- if (is_object($a)) $a=get_class($a);
- if (is_object($b)) $a=get_class($b);
- $parent=get_parent_class($a);
-
- if ($parent!=$b) return check::fail("Class $a parent not actually $b but $parent");
- return TRUE;
- }
-
- function classes($classes) {
- if (! is_array($classes)) $classes=array($classes);
- $message=array();
- $missing=array();
- $extra=array_flip(check::get_extra_classes());
- foreach($classes as $class) {
- if (! class_exists($class)) $missing[]=$class;
- else unset($extra[$class]);
- }
- if ($missing) $message[]=sprintf("Classes missing: %s",join(",",$missing));
- if ($message) return check::fail(join("\n ",$message));
- if ($extra) $message[]=sprintf("These extra classes are defined: %s",join(",",array_keys($extra)));
- if ($message) return check::warn(join("\n ",$message));
- return TRUE;
- }
-
- function functions($functions) {
- if (! is_array($functions)) $functions=array($functions);
- $message=array();
- $missing=array();
- $extra=array_flip(check::get_extra_functions());
-
- foreach ($functions as $func) {
- if (! function_exists($func)) $missing[]=$func;
- else unset($extra[$func]);
- }
- if ($missing) $message[]=sprintf("Functions missing: %s",join(",",$missing));
- if ($message) return check::fail(join("\n ",$message));
- if ($extra) $message[]=sprintf("These extra functions are defined: %s",join(",",array_keys($extra)));
- if ($message) return check::warn(join("\n ",$message));
- return TRUE;
- }
-
- function globals($globals) {
- if (! is_array($globals)) $globals=array($globals);
- $message=array();
- $missing=array();
- $extra=array_flip(check::get_extra_globals());
- foreach ($globals as $glob) {
- if (GETSET) {
- if (! isset($extra[$glob])) $missing[]=$glob;
- else unset($extra[$glob]);
- } else {
- if (! isset($GLOBALS[$glob])) $missing[]=$glob;
- else unset($extra[$glob]);
- }
- }
- if ($missing) $message[]=sprintf("Globals missing: %s",join(",",$missing));
- if ($message) return check::fail(join("\n ",$message));
- if ($extra) $message[]=sprintf("These extra globals are defined: %s",join(",",array_keys($extra)));
- if ($message) return check::warn(join("\n ",$message));
- return TRUE;
-
- }
-
- function functionref($a,$type,$message) {
- if (! preg_match("/^_[a-f0-9]+$type$/i", $a))
- return check::fail($message);
- return TRUE;
- }
-
- function equal($a,$b,$message) {
- if (! ($a===$b)) return check::fail($message . ": '$a'!=='$b'");
- return TRUE;
- }
-
- function resource($a,$b,$message) {
- $resource=trim(check::var_dump($a));
- if (! preg_match("/^resource\([0-9]+\) of type \($b\)/i", $resource))
- return check::fail($message);
- return TRUE;
- }
-
- function isnull($a,$message) {
- $value=trim(check::var_dump($a));
- return check::equal($value,"NULL",$message);
- }
-
- function var_dump($arg) {
- ob_start();
- var_dump($arg);
- $result=ob_get_contents();
- ob_end_clean();
- return $result;
- }
-
- function fail($pattern) {
- $args=func_get_args();
- print("Failed on: ".call_user_func_array("sprintf",$args)."\n");
- exit(1);
- }
-
- function warn($pattern) {
- $args=func_get_args();
- print("Warning on: ".call_user_func_array("sprintf",$args)."\n");
- return FALSE;
- }
-
- function done() {
-# print $_SERVER[argv][0]." ok\n";
- }
-}
-?>
diff --git a/Examples/test-suite/php5/threads_exception_runme.php b/Examples/test-suite/php5/threads_exception_runme.php
deleted file mode 100644
index 9e4d04e10..000000000
--- a/Examples/test-suite/php5/threads_exception_runme.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-require "tests.php";
-require "threads_exception.php";
-
-// Check functions
-check::functions(array(test_simple,test_message,test_hosed,test_unknown,test_multi,is_python_builtin));
-// Check classes.
-check::classes(array(Exc,Test,threads_exception));
-// Chek globals.
-check::globals(array(exc_code,exc_msg));
-
-$t = new Test();
-try {
- $t->unknown();
-} catch (Exception $e) {
- check::equal($e->getMessage(), 'C++ A * exception thrown', '');
-}
-
-try {
- $t->simple();
-} catch (Exception $e) {
- check::equal($e->getCode(), 37, '');
-}
-
-try {
- $t->message();
-} catch (Exception $e) {
- check::equal($e->getMessage(), 'I died.', '');
-}
-
-try {
- $t->hosed();
-} catch (Exception $e) {
- check::equal($e->getMessage(), 'C++ Exc exception thrown', '');
-}
-
-foreach (Array(1,2,3,4) as $i) {
- try {
- $t->multi($i);
- } catch (Exception $e) {
- }
-}
diff --git a/Examples/test-suite/php5/typedef_reference_runme.php b/Examples/test-suite/php5/typedef_reference_runme.php
deleted file mode 100644
index 88a70f8d3..000000000
--- a/Examples/test-suite/php5/typedef_reference_runme.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-require "tests.php";
-require "typedef_reference.php";
-
-check::functions(array(somefunc,otherfunc,new_intp,copy_intp,delete_intp,intp_assign,intp_value));
-$int2=copy_intp(2);
-check::equal(2,somefunc($int2)," test passing intp to somefunc");
-$int3=copy_intp(3);
-check::equal(3,otherfunc($int3)," test passing intp to otherfunc");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/typemap_ns_using_runme.php b/Examples/test-suite/php5/typemap_ns_using_runme.php
deleted file mode 100644
index 6a599f008..000000000
--- a/Examples/test-suite/php5/typemap_ns_using_runme.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-require "tests.php";
-require "typemap_ns_using.php";
-if (! class_exists("_fooimpl")) die("_fooimpl class not found\n");
-if (! 3==spam(3)) die("spam function not working right\n");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/using1_runme.php b/Examples/test-suite/php5/using1_runme.php
deleted file mode 100644
index 51841bc78..000000000
--- a/Examples/test-suite/php5/using1_runme.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-require "tests.php";
-require "using1.php";
-if (! class_exists("_fooimpl")) die("_fooimpl class not found\n");
-if (! 3==spam(3)) die("spam function not working right\n");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/using2_runme.php b/Examples/test-suite/php5/using2_runme.php
deleted file mode 100644
index 391a98f52..000000000
--- a/Examples/test-suite/php5/using2_runme.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-require "tests.php";
-require "using2.php";
-if (! class_exists("_fooimpl")) die("_fooimpl class not found\n");
-if (! 3==spam(3)) die("spam function not working right\n");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/valuewrapper_base_runme.php b/Examples/test-suite/php5/valuewrapper_base_runme.php
deleted file mode 100644
index 6a1abdbd2..000000000
--- a/Examples/test-suite/php5/valuewrapper_base_runme.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-require "tests.php";
-require "valuewrapper_base.php";
-
-check::classes(array("valuewrapper_base","Base","Interface_BP"));
-check::functions("make_interface_bp");
-
-$ibp=valuewrapper_base::make_interface_bp();
-check::classname("interface_bp",$ibp);
-
-check::done();
-?>
diff --git a/Examples/test-suite/php5/virtual_vs_nonvirtual_base_runme.php b/Examples/test-suite/php5/virtual_vs_nonvirtual_base_runme.php
deleted file mode 100644
index 0d4aa3d5f..000000000
--- a/Examples/test-suite/php5/virtual_vs_nonvirtual_base_runme.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?
-
-require "tests.php";
-require "virtual_vs_nonvirtual_base.php";
-
-$fail = new SimpleClassFail();
-$work = new SimpleClassWork();
-
-check::equal($work->getInner()->get(), $fail->getInner()->get(), "should both be 10");
-
-?>
diff --git a/Examples/test-suite/php5/wrapmacro_runme.php b/Examples/test-suite/php5/wrapmacro_runme.php
deleted file mode 100644
index f32da990e..000000000
--- a/Examples/test-suite/php5/wrapmacro_runme.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-require "tests.php";
-require "wrapmacro.php";
-
-check::functions(array('guint16_swap_le_be_constant', 'maximum'));
-
-check::equal(maximum(2.3, 2.4), 2.4, "maximum() doesn't work");
-check::equal(guint16_swap_le_be_constant(0x1234), 0x3412, "GUINT16_SWAP_LE_BE_CONSTANT() doesn't work");
-
-check::done();
-?>
diff --git a/Examples/test-suite/php_pragma.i b/Examples/test-suite/php_pragma.i
new file mode 100644
index 000000000..4d14f1357
--- /dev/null
+++ b/Examples/test-suite/php_pragma.i
@@ -0,0 +1,6 @@
+// Test pragma of php - pragma version.
+
+%module php_pragma
+
+%pragma(php) version= "1.5"
+
diff --git a/Examples/test-suite/preproc.i b/Examples/test-suite/preproc.i
index f236bfdff..215fdd0ef 100644
--- a/Examples/test-suite/preproc.i
+++ b/Examples/test-suite/preproc.i
@@ -16,8 +16,16 @@
//Suppress: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
#pragma clang diagnostic ignored "-Wconstant-logical-operand"
#endif
+#if defined(_MSC_VER)
+ #pragma warning(disable: 4003) // not enough actual parameters for macro 'FOO2'
+#endif
%}
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
/* check __cplusplus case */
%header
%{
@@ -370,3 +378,75 @@ int methodX(int x);
int methodX(int x) { return x+100; }
%}
+// Comma in macro - https://github.com/swig/swig/issues/974 (for /* */)
+// and https://github.com/swig/swig/pull/1166 (for //)
+%inline %{
+#define swig__attribute__(x)
+#define TCX_PACKED(d) d swig__attribute__ ((__packed__))
+
+
+TCX_PACKED (typedef struct tcxMessageTestImpl
+{
+ int mHeader; /**< comment */
+}) tcxMessageTest;
+
+
+TCX_PACKED (typedef struct tcxMessageBugImpl
+{
+ int mBid; /**< Bid price and size, check PresentMap if available in message */
+}) tcxMessageBug;
+
+
+TCX_PACKED (typedef struct tcxMessageTestImpl2
+{
+ int mHeader; ///< comment
+}) tcxMessageTest2;
+
+
+TCX_PACKED (typedef struct tcxMessageBugImpl2
+{
+ int mBid; ///< Bid price and size, check PresentMap if available in message
+}) tcxMessageBug2;
+
+
+%}
+
+// Regression tests for https://github.com/swig/swig/pull/1111
+%{
+static int foo_func(int x) { return x; }
+static int foo_func2() { return 0; }
+static int bar_func() { return 0; }
+static int baz_func(int a, int b, int c) { return a + b - c; }
+%}
+%inline %{
+#define FOO(X) int foo_func(X);
+#define FOO2(X) int foo_func2(X);
+#define BAR() int bar_func();
+#define BAR2() int bar_func2()
+#define BAZ(A,B,C) baz_func(A+0,B,C)
+#define FOOVAR(...) foo_func(__VA_ARGS__)
+#define BARVAR(...) bar_func(__VA_ARGS__)
+#define BAZVAR(...) baz_func(__VA_ARGS__)
+// This has probably always worked, but make sure that the fix to accept
+// an empty X doesn't cause this case to be incorrectly expanded:
+const int FOO = 7;
+// BAR was incorrectly expanded here, causing:
+// Error: Syntax error in input(1).
+const int BAR = 6;
+// This has probably always worked, but make sure that the fix to accept
+// an empty X doesn't stop a non-empty X from working:
+FOO(int x)
+// FOO() didn't used to get expanded here, causing:
+// Syntax error in input(1).
+FOO2()
+// Check BAR2() still gets expanded here.
+BAR2() {
+ // Regression test - this used to fail with:
+ // Error: Macro 'BAZ' expects 3 arguments
+ BAZ(,2,3);
+ BARVAR();
+ FOOVAR(1);
+ BAZVAR(1,2,3);
+ return 0;
+}
+%}
diff --git a/Examples/test-suite/preproc_constants.i b/Examples/test-suite/preproc_constants.i
index 3a999ada3..3050baa06 100644
--- a/Examples/test-suite/preproc_constants.i
+++ b/Examples/test-suite/preproc_constants.i
@@ -86,11 +86,20 @@
#define EXPR_LAND 0xFF && 1
#define EXPR_LOR 0xFF || 1
#define EXPR_CONDITIONAL true ? 2 : 2.2
+#define EXPR_MIXED1 (0x80 + 11.1) - 1
+
+#define EXPR_WCHAR_MAX (0x7fffffff + L'\0')
+#define EXPR_WCHAR_MIN (-EXPR_WCHAR_MAX - 1)
#define EXPR_CHAR_COMPOUND_ADD 'A' + 12
#define EXPR_CHAR_COMPOUND_LSHIFT 'B' << 6
#define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p')
+// https://sourceforge.net/p/swig/bugs/1168/
+#define CHR(ch1,ch2,ch3,ch4) (((ch1)<<24)|((ch2)<<16)|((ch3)<<8)|(ch4))
+#define DEFAULT_LANG CHR('d','f','l','t')
+%constant DEFAULT_LANG_SIMPLIFIED = ('d')<<24;
+
/// constant assignment in enum
#if defined(SWIGCSHARP)
%csconstvalue("1<<2") kValue;
diff --git a/Examples/test-suite/preproc_gcc_output.h b/Examples/test-suite/preproc_gcc_output.h
new file mode 100644
index 000000000..cc5065d12
--- /dev/null
+++ b/Examples/test-suite/preproc_gcc_output.h
@@ -0,0 +1,13 @@
+# 1 "header1.h"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "/usr/include/stdc-predef.h" 1 3 4
+# 1 "<command-line>" 2
+# 1 "header1.h"
+# 18 "header1.h"
+void header1_function_a(int a);
+# 1 "header2.h" 1
+# 13 "header2.h"
+void header2_function(int x);
+# 20 "header1.h" 2
+void header1_function_b(int b);
diff --git a/Examples/test-suite/preproc_gcc_output.i b/Examples/test-suite/preproc_gcc_output.i
new file mode 100644
index 000000000..b4db9e70a
--- /dev/null
+++ b/Examples/test-suite/preproc_gcc_output.i
@@ -0,0 +1,12 @@
+%module preproc_gcc_output
+// Testcase for Github issue #1475 using the output of gcc -E
+
+// The file below was generated using 'gcc -E header1.h'
+// where header1.h included header2.h
+%include "preproc_gcc_output.h"
+
+%{
+void header1_function_a(int a) {}
+void header2_function(int x) {}
+void header1_function_b(int b) {}
+%}
diff --git a/Examples/test-suite/primitive_types.i b/Examples/test-suite/primitive_types.i
index b9b973a2b..a71f62a4f 100644
--- a/Examples/test-suite/primitive_types.i
+++ b/Examples/test-suite/primitive_types.i
@@ -7,12 +7,6 @@
%rename(TestDir) TestDirector;
#endif
-%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-%}
-
// Ruby constant names
#pragma SWIG nowarn=SWIGWARN_RUBY_WRONG_NAME
@@ -259,14 +253,17 @@ macro(Param<char>, pfx, paramc)
macro(size_t, pfx, sizet)
%enddef
+%define catches_decl(type, pfx, name)
+ %catches(type) pfx##_##name(type x);
+%enddef
/* function passing by value */
%define val_decl(type, pfx, name)
- type pfx##_##name(type x) throw (type) { return x; }
+ type pfx##_##name(type x) { return x; }
%enddef
/* function passing by ref */
%define ref_decl(type, pfx, name)
- const type& pfx##_##name(const type& x) throw (type) { return x; }
+ const type& pfx##_##name(const type& x) { return x; }
%enddef
/* C++ constant declaration */
@@ -301,6 +298,11 @@ macro(size_t, pfx, sizet)
%test_prim_types(sct_decl, sct)
+%test_prim_types(catches_decl, val)
+%test_prim_types(catches_decl, ref)
+%test_prim_types(catches_decl, cct)
+%test_prim_types(catches_decl, var)
+
%inline {
%test_prim_types(val_decl, val)
%test_prim_types(ref_decl, ref)
@@ -452,12 +454,12 @@ macro(size_t, pfx, sizet)
var_decl(namet, var, namet)
- const char* val_namet(namet x) throw(namet)
+ const char* val_namet(namet x)
{
return x;
}
- const char* val_cnamet(const namet x) throw(namet)
+ const char* val_cnamet(const namet x)
{
return x;
}
@@ -465,7 +467,7 @@ macro(size_t, pfx, sizet)
#if 0
/* I have no idea how to define a typemap for
const namet&, where namet is a char[ANY] array */
- const namet& ref_namet(const namet& x) throw(namet)
+ const namet& ref_namet(const namet& x)
{
return x;
}
@@ -509,12 +511,12 @@ macro(size_t, pfx, sizet)
var_namet[0]='h';
}
- virtual const char* vval_namet(namet x) throw(namet)
+ virtual const char* vval_namet(namet x)
{
return x;
}
- virtual const char* vval_cnamet(const namet x) throw(namet)
+ virtual const char* vval_cnamet(const namet x)
{
return x;
}
@@ -522,7 +524,7 @@ macro(size_t, pfx, sizet)
#if 0
/* I have no idea how to define a typemap for
const namet&, where namet is a char[ANY] array */
- virtual const namet& vref_namet(const namet& x) throw(namet)
+ virtual const namet& vref_namet(const namet& x)
{
return x;
}
@@ -559,7 +561,7 @@ macro(size_t, pfx, sizet)
%test_prim_types_ovr(ovr_decl, ovr)
- virtual Test* vtest(Test* t) const throw (Test)
+ virtual Test* vtest(Test* t) const
{
return t;
}
@@ -628,6 +630,10 @@ macro(size_t, pfx, sizet)
float val_float(float x) {
return x;
}
+
+ float val_float_3(float f = 0e1f, float f2 = 020e0f, float f3 = 0.3e4f) {
+ return f + f2 + f3;
+ }
%}
diff --git a/Examples/test-suite/pure_virtual.i b/Examples/test-suite/pure_virtual.i
index 9e345e2a4..c1c7edc15 100644
--- a/Examples/test-suite/pure_virtual.i
+++ b/Examples/test-suite/pure_virtual.i
@@ -12,6 +12,10 @@
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE) E; /* C#, D, Java, PHP multiple inheritance */
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%nodefaultctor C;
%nodefaultdtor C;
%nodefaultctor E;
diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in
index 133b7056a..be06f7e51 100644
--- a/Examples/test-suite/python/Makefile.in
+++ b/Examples/test-suite/python/Makefile.in
@@ -10,13 +10,13 @@ endif
LANGUAGE = python
PYTHON = $(PYBIN)
-PEP8 = @PEP8@
-PEP8_FLAGS = --ignore=E30,E402,E501,E731,W291,W391
+PYCODESTYLE = @PYCODESTYLE@
+PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391
#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
PY2SCRIPTSUFFIX = _runme.py
PY3SCRIPTSUFFIX = _runme3.py
-PY2TO3 = 2to3 -x import
+PY2TO3 = @PY2TO3@ -x import
ifeq (,$(PY3))
SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX)
@@ -45,6 +45,7 @@ CPP_TEST_CASES += \
li_factory \
li_implicit \
li_std_containers_int \
+ li_std_list \
li_std_map_member \
li_std_multimap \
li_std_pair_extra \
@@ -54,7 +55,7 @@ CPP_TEST_CASES += \
li_std_vectora \
li_std_vector_extra \
li_std_wstream \
- li_std_wstring \
+ li_std_wstring_inherit \
primitive_types \
python_abstractbase \
python_append \
@@ -64,27 +65,38 @@ CPP_TEST_CASES += \
python_docstring \
python_extranative \
python_moduleimport \
- python_nondynamic \
python_overload_simple_cast \
python_pickle \
+ python_pybuffer \
python_pythoncode \
python_richcompare \
python_strict_unicode \
+ python_threads \
simutry \
std_containers \
swigobject \
- template_matrix
+ template_matrix \
# li_std_carray
# director_profile
-# python_pybuf
+
+CPP11_TEST_CASES = \
+ cpp11_hash_tables \
+ cpp11_shared_ptr_const \
+ cpp11_shared_ptr_nullptr_in_containers \
+ cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_upcast \
+ cpp11_std_unordered_map \
+ cpp11_std_unordered_multimap \
+ cpp11_std_unordered_multiset \
+ cpp11_std_unordered_set \
C_TEST_CASES += \
file_test \
li_cstring \
li_cwstring \
python_nondynamic \
- python_varargs_typemap
+ python_varargs_typemap \
#
# This test only works with modern C compilers
@@ -133,12 +145,12 @@ py_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
-ifneq (,$(PEP8))
-check_pep8 = $(COMPILETOOL) $(PEP8) $(PEP8_FLAGS) $(SCRIPTPREFIX)$*.py
+ifneq (,$(PYCODESTYLE))
+check_pep8 = $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(SCRIPTPREFIX)$*.py
check_pep8_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
- $(COMPILETOOL) $(PEP8) $(PEP8_FLAGS) $$f.py; \
+ $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$f.py; \
done
endif
@@ -149,19 +161,54 @@ run_testcase = \
$(run_python);\
fi
-# No copying/conversion needed for in-source-tree Python 2 scripts
-ifeq ($(SCRIPTDIR)|$(SCRIPTSUFFIX),$(srcdir)|$(PY2SCRIPTSUFFIX))
-convert_testcase =
+# Grab runme file ready for running: copied for out of source tree builds, and/or run 2to3
+# Note terminal (double colon) rules creating runme files to fix possible infinite recursion,
+# see https://github.com/swig/swig/pull/688
+ifeq ($(SCRIPTDIR),$(srcdir))
+ # in source tree build
+ ifeq (,$(PY3))
+ convert_testcase =
+ else
+ convert_testcase = \
+ if [ -f $(srcdir)/$(py2_runme) ]; then \
+ $(MAKE) $(SCRIPTDIR)/$(py_runme); \
+ fi
+
+# For converting python 2 tests into Python 3 tests
+$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
+ cp $< $@
+ $(PY2TO3) -w $@ >/dev/null 2>&1
+
+ endif
else
+ # out of source tree build
+ ifeq (,$(PY3))
+ convert_testcase = \
+ if [ -f $(srcdir)/$(py2_runme) ]; then \
+ $(MAKE) $(SCRIPTDIR)/$(py_runme); \
+ fi
+
+$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
+ cp $< $@
-convert_testcase = \
+ else
+ convert_testcase = \
if [ -f $(srcdir)/$(py2_runme) ]; then \
$(MAKE) $(SCRIPTDIR)/$(py_runme); \
+ elif [ -f $(srcdir)/$(py3_runme) ]; then \
+ $(MAKE) $(SCRIPTDIR)/$(py3_runme); \
fi
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX): $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
- test x$< = x$@ || cp $< $@ || exit 1
- test x$(PY3) = x || $(PY2TO3) -w $@ >/dev/null 2>&1 || exit 1
+# For when there is a _runme3.py instead of a _runme.py, ie a Python 3 only run test
+$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY3SCRIPTSUFFIX)
+ cp $< $@
+
+# For converting python 2 tests into Python 3 tests
+$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
+ cp $< $@
+ $(PY2TO3) -w $@ >/dev/null 2>&1
+
+ endif
endif
@@ -170,7 +217,7 @@ endif
%.clean:
@rm -f $*.py
@if test -f $(srcdir)/$(py2_runme); then rm -f $(SCRIPTDIR)/$(py3_runme) $(SCRIPTDIR)/$(py3_runme).bak; fi
- @if test "x$(SCRIPTDIR)" != "x$(srcdir)"; then rm -f $(SCRIPTDIR)/$(py2_runme); fi
+ @if test "x$(SCRIPTDIR)" != "x$(srcdir)"; then rm -f $(SCRIPTDIR)/$(py_runme); fi
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' python_clean
@@ -179,19 +226,6 @@ clean:
rm -f imports_a.py imports_b.py mod_a.py mod_b.py multi_import_a.py
rm -f multi_import_b.py packageoption_a.py packageoption_b.py packageoption_c.py
-cvsignore:
- @echo '*wrap* *.pyc *.so *.dll *.exp *.lib'
- @echo Makefile
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done
- @echo clientdata_prop_a.py
- @echo clientdata_prop_b.py
- @echo imports_a.py
- @echo imports_b.py
- @echo mod_a.py mod_b.py
- @echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
- @echo template_typedef_import.py
-
hugemod_runme = hugemod$(SCRIPTPREFIX)
hugemod:
diff --git a/Examples/test-suite/python/argcargvtest_runme.py b/Examples/test-suite/python/argcargvtest_runme.py
index 38843b932..b0345746f 100644
--- a/Examples/test-suite/python/argcargvtest_runme.py
+++ b/Examples/test-suite/python/argcargvtest_runme.py
@@ -1,21 +1,21 @@
from argcargvtest import *
-largs = ['hi', 'hola', 'hello']
+largs = ["hi", "hola", "hello"]
if mainc(largs) != 3:
raise RuntimeError("bad main typemap")
-targs = ('hi', 'hola')
-if mainv(targs, 1) != 'hola':
+targs = ("hi", "hola")
+if mainv(targs, 1) != "hola":
print(mainv(targs, 1))
raise RuntimeError("bad main typemap")
-targs = ('hi', 'hola')
-if mainv(targs, 1) != 'hola':
+targs = ("hi", "hola")
+if mainv(targs, 1) != "hola":
raise RuntimeError("bad main typemap")
try:
error = 0
- mainv('hello', 1)
+ mainv("hello", 1)
error = 1
except TypeError:
pass
diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py
index af04c8c0e..6002d49fe 100644
--- a/Examples/test-suite/python/autodoc_runme.py
+++ b/Examples/test-suite/python/autodoc_runme.py
@@ -1,367 +1,281 @@
from autodoc import *
+import _autodoc
+import comment_verifier
+import inspect
import sys
-
def check(got, expected, expected_builtin=None, skip=False):
- if not skip:
+ if is_python_builtin() and skip:
+ # Only skip for builtins
+ pass
+ else:
expect = expected
if is_python_builtin() and expected_builtin != None:
expect = expected_builtin
- if expect != got:
- raise RuntimeError(
- "\n" + "Expected: [" + str(expect) + "]\n" + "Got : [" + str(got) + "]")
-
-
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-def is_fastproxy(module):
- return "new_instancemethod" in module
-
-if not is_new_style_class(A):
- # Missing static methods make this hard to test... skip if -classic is
- # used!
- sys.exit(0)
-
-if is_fastproxy(dir()):
- # Detect when -fastproxy is specified and skip test as it changes the function names making it
- # hard to test... skip until the number of options are reduced in SWIG-3.1 and autodoc is improved
- sys.exit(0)
+ comment_verifier.check(got, expect)
# skip builtin check - the autodoc is missing, but it probably should not be
skip = True
-check(A.__doc__, "Proxy of C++ A class.", "::A")
-check(A.funk.__doc__, "just a string.")
-check(A.func0.__doc__,
- "func0(self, arg2, hello) -> int",
- "func0(arg2, hello) -> int")
-check(A.func1.__doc__,
- "func1(A self, short arg2, Tuple hello) -> int",
- "func1(short arg2, Tuple hello) -> int")
-check(A.func2.__doc__,
- "\n"
- " func2(self, arg2, hello) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " arg2: short\n"
- " hello: int tuple[2]\n"
- "\n"
- " ",
- "\n"
- "func2(arg2, hello) -> int\n"
+check(inspect.getdoc(A), "Proxy of C++ A class.", "::A")
+check(inspect.getdoc(A.funk), "just a string.")
+check(inspect.getdoc(A.func0),
+ "func0(self, arg2, hello) -> int")
+check(inspect.getdoc(A.func1),
+ "func1(A self, short arg2, Tuple hello) -> int")
+check(inspect.getdoc(A.func2),
+ "func2(self, arg2, hello) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"arg2: short\n"
- "hello: int tuple[2]\n"
- "\n"
- ""
- )
-check(A.func3.__doc__,
- "\n"
- " func3(A self, short arg2, Tuple hello) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " arg2: short\n"
- " hello: int tuple[2]\n"
- "\n"
- " ",
- "\n"
- "func3(short arg2, Tuple hello) -> int\n"
+ "hello: int tuple[2]")
+check(inspect.getdoc(A.func3),
+ "func3(A self, short arg2, Tuple hello) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"arg2: short\n"
- "hello: int tuple[2]\n"
- "\n"
- ""
- )
+ "hello: int tuple[2]")
-check(A.func0default.__doc__,
- "\n"
- " func0default(self, e, arg3, hello, f=2) -> int\n"
- " func0default(self, e, arg3, hello) -> int\n"
- " ",
- "\n"
- "func0default(e, arg3, hello, f=2) -> int\n"
- "func0default(e, arg3, hello) -> int\n"
- ""
- )
-check(A.func1default.__doc__,
- "\n"
- " func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
- " func1default(A self, A e, short arg3, Tuple hello) -> int\n"
- " ",
- "\n"
- "func1default(A e, short arg3, Tuple hello, double f=2) -> int\n"
- "func1default(A e, short arg3, Tuple hello) -> int\n"
- ""
- )
-check(A.func2default.__doc__,
- "\n"
- " func2default(self, e, arg3, hello, f=2) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " e: A *\n"
- " arg3: short\n"
- " hello: int tuple[2]\n"
- " f: double\n"
- "\n"
- " func2default(self, e, arg3, hello) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " e: A *\n"
- " arg3: short\n"
- " hello: int tuple[2]\n"
- "\n"
- " ",
- "\n"
- "func2default(e, arg3, hello, f=2) -> int\n"
+check(inspect.getdoc(A.func0default),
+ "func0default(self, e, arg3, hello, f=2) -> int")
+check(inspect.getdoc(A.func1default),
+ "func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int")
+check(inspect.getdoc(A.func2default),
+ "func2default(self, e, arg3, hello, f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg3: short\n"
"hello: int tuple[2]\n"
- "f: double\n"
- "\n"
- "func2default(e, arg3, hello) -> int\n"
+ "f: double")
+check(inspect.getdoc(A.func3default),
+ "func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg3: short\n"
"hello: int tuple[2]\n"
- "\n"
- ""
- )
-check(A.func3default.__doc__,
- "\n"
- " func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " e: A *\n"
- " arg3: short\n"
- " hello: int tuple[2]\n"
- " f: double\n"
- "\n"
- " func3default(A self, A e, short arg3, Tuple hello) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " e: A *\n"
- " arg3: short\n"
- " hello: int tuple[2]\n"
- "\n"
- " ",
- "\n"
- "func3default(A e, short arg3, Tuple hello, double f=2) -> int\n"
+ "f: double")
+
+check(inspect.getdoc(A.func0static),
+ "func0static(e, arg2, hello, f=2) -> int")
+check(inspect.getdoc(_autodoc.A_func0static),
+ "A_func0static(e, arg2, hello, f=2) -> int")
+check(inspect.getdoc(A_func0static),
+ "A_func0static(e, arg2, hello, f=2) -> int")
+check(inspect.getdoc(A.func1static),
+ "func1static(A e, short arg2, Tuple hello, double f=2) -> int")
+check(inspect.getdoc(_autodoc.A_func1static),
+ "A_func1static(A e, short arg2, Tuple hello, double f=2) -> int")
+check(inspect.getdoc(A_func1static),
+ "A_func1static(A e, short arg2, Tuple hello, double f=2) -> int")
+check(inspect.getdoc(A.func2static),
+ "func2static(e, arg2, hello, f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
- "arg3: short\n"
+ "arg2: short\n"
"hello: int tuple[2]\n"
- "f: double\n"
- "\n"
- "func3default(A e, short arg3, Tuple hello) -> int\n"
+ "f: double")
+check(inspect.getdoc(_autodoc.A_func2static),
+ "A_func2static(e, arg2, hello, f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
- "arg3: short\n"
+ "arg2: short\n"
"hello: int tuple[2]\n"
- "\n"
- ""
- )
-
-check(A.func0static.__doc__,
- "\n"
- " func0static(e, arg2, hello, f=2) -> int\n"
- " func0static(e, arg2, hello) -> int\n"
- " ",
- "\n"
- "func0static(e, arg2, hello, f=2) -> int\n"
- "func0static(e, arg2, hello) -> int\n"
- ""
- )
-check(A.func1static.__doc__,
- "\n"
- " func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
- " func1static(A e, short arg2, Tuple hello) -> int\n"
- " ",
- "\n"
- "func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
- "func1static(A e, short arg2, Tuple hello) -> int\n"
- ""
- )
-check(A.func2static.__doc__,
- "\n"
- " func2static(e, arg2, hello, f=2) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " e: A *\n"
- " arg2: short\n"
- " hello: int tuple[2]\n"
- " f: double\n"
- "\n"
- " func2static(e, arg2, hello) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " e: A *\n"
- " arg2: short\n"
- " hello: int tuple[2]\n"
- "\n"
- " ",
- "\n"
- "func2static(e, arg2, hello, f=2) -> int\n"
+ "f: double")
+check(inspect.getdoc(A_func2static),
+ "A_func2static(e, arg2, hello, f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
- "f: double\n"
- "\n"
- "func2static(e, arg2, hello) -> int\n"
+ "f: double")
+check(inspect.getdoc(A.func3static),
+ "func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
- "\n"
- ""
- )
-check(A.func3static.__doc__,
- "\n"
- " func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " e: A *\n"
- " arg2: short\n"
- " hello: int tuple[2]\n"
- " f: double\n"
- "\n"
- " func3static(A e, short arg2, Tuple hello) -> int\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " e: A *\n"
- " arg2: short\n"
- " hello: int tuple[2]\n"
- "\n"
- " ",
- "\n"
- "func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
+ "f: double")
+check(inspect.getdoc(_autodoc.A_func3static),
+ "A_func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
- "f: double\n"
- "\n"
- "func3static(A e, short arg2, Tuple hello) -> int\n"
+ "f: double")
+check(inspect.getdoc(A_func3static),
+ "A_func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
- "\n"
- ""
+ "f: double")
+
+check(inspect.getdoc(A.variable_a),
+ "variable_a"
+ )
+check(inspect.getdoc(A.variable_b),
+ "variable_b : int"
+ )
+check(inspect.getdoc(A.variable_c),
+ "variable_c"
+ )
+check(inspect.getdoc(A.variable_d),
+ "variable_d : int"
)
-if sys.version_info[0:2] > (2, 4):
- # Python 2.4 does not seem to work
- check(A.variable_a.__doc__,
- "A_variable_a_get(self) -> int",
- "A.variable_a"
- )
- check(A.variable_b.__doc__,
- "A_variable_b_get(A self) -> int",
- "A.variable_b"
- )
- check(A.variable_c.__doc__,
+# Check the low-level functions (not present when using -builtin except for the static ones)
+if not is_python_builtin():
+ check(inspect.getdoc(_autodoc.A_funk), "just a string.")
+ check(inspect.getdoc(_autodoc.A_func0),
+ "A_func0(self, arg2, hello) -> int")
+ check(inspect.getdoc(_autodoc.A_func1),
+ "A_func1(A self, short arg2, Tuple hello) -> int")
+ check(inspect.getdoc(_autodoc.A_func2),
+ "A_func2(self, arg2, hello) -> int\n"
"\n"
- "A_variable_c_get(self) -> int\n"
+ "Parameters\n"
+ "----------\n"
+ "arg2: short\n"
+ "hello: int tuple[2]")
+ check(inspect.getdoc(_autodoc.A_func3),
+ "A_func3(A self, short arg2, Tuple hello) -> int\n"
"\n"
"Parameters\n"
"----------\n"
- "self: A *\n"
- "\n",
- "A.variable_c"
+ "arg2: short\n"
+ "hello: int tuple[2]")
+ check(inspect.getdoc(_autodoc.A_func0default),
+ "A_func0default(self, e, arg3, hello, f=2) -> int")
+ check(inspect.getdoc(_autodoc.A_func1default),
+ "A_func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int")
+ check(inspect.getdoc(_autodoc.A_func2default),
+ "A_func2default(self, e, arg3, hello, f=2) -> int\n"
+ "\n"
+ "Parameters\n"
+ "----------\n"
+ "e: A *\n"
+ "arg3: short\n"
+ "hello: int tuple[2]\n"
+ "f: double")
+ check(inspect.getdoc(_autodoc.A_func3default),
+ "A_func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
+ "\n"
+ "Parameters\n"
+ "----------\n"
+ "e: A *\n"
+ "arg3: short\n"
+ "hello: int tuple[2]\n"
+ "f: double")
+ check(inspect.getdoc(_autodoc.A_variable_a_set), "A_variable_a_set(self, variable_a)")
+ check(inspect.getdoc(_autodoc.A_variable_a_get), "A_variable_a_get(self) -> int" )
+ check(inspect.getdoc(_autodoc.A_variable_b_set), "A_variable_b_set(A self, int variable_b)")
+ check(inspect.getdoc(_autodoc.A_variable_b_get), "A_variable_b_get(A self) -> int")
+ check(inspect.getdoc(_autodoc.A_variable_c_set),
+ "A_variable_c_set(self, variable_c)\n"
+ "\n"
+ "Parameters\n"
+ "----------\n"
+ "variable_c: int"
)
- check(A.variable_d.__doc__,
+ check(inspect.getdoc(_autodoc.A_variable_c_get), "A_variable_c_get(self) -> int")
+ check(inspect.getdoc(_autodoc.A_variable_d_set),
+ "A_variable_d_set(A self, int variable_d)\n"
"\n"
- "A_variable_d_get(A self) -> int\n"
+ "Parameters\n"
+ "----------\n"
+ "variable_d: int"
+ )
+ check(inspect.getdoc(_autodoc.A_variable_d_get), "A_variable_d_get(A self) -> int")
+ check(inspect.getdoc(_autodoc.new_C), "new_C(a, b, h) -> C")
+ check(inspect.getdoc(_autodoc.delete_C), "delete_C(self)")
+ check(inspect.getdoc(_autodoc.new_D), "new_D(int a, int b, Hola h) -> D")
+ check(inspect.getdoc(_autodoc.delete_D), "delete_D(D self)")
+ check(inspect.getdoc(_autodoc.new_E),
+ "new_E(a, b, h) -> E\n"
+ "\n"
+ "Parameters\n"
+ "----------\n"
+ "a: special comment for parameter a\n"
+ "b: another special comment for parameter b\n"
+ "h: enum Hola"
+ )
+ check(inspect.getdoc(_autodoc.delete_E), "delete_E(self)")
+ check(inspect.getdoc(_autodoc.new_F),
+ "new_F(int a, int b, Hola h) -> F\n"
"\n"
"Parameters\n"
"----------\n"
- "self: A *\n"
- "\n",
- "A.variable_d"
+ "a: special comment for parameter a\n"
+ "b: another special comment for parameter b\n"
+ "h: enum Hola"
)
+ check(inspect.getdoc(_autodoc.delete_F), "delete_F(F self)")
+ check(inspect.getdoc(_autodoc.B_funk), "B_funk(B self, int c, int d) -> int")
+ check(inspect.getdoc(_autodoc.TInteger_inout), "TInteger_inout(TInteger self, TInteger t) -> TInteger")
-check(B.__doc__,
+check(inspect.getdoc(B),
"Proxy of C++ B class.",
"::B"
)
-check(C.__init__.__doc__, "__init__(self, a, b, h) -> C", None, skip)
-check(D.__init__.__doc__,
+check(inspect.getdoc(C.__init__), "__init__(self, a, b, h) -> C", None, skip)
+check(inspect.getdoc(D.__init__),
"__init__(D self, int a, int b, Hola h) -> D", None, skip)
-check(E.__init__.__doc__,
+check(inspect.getdoc(E.__init__),
+ "__init__(self, a, b, h) -> E\n"
"\n"
- " __init__(self, a, b, h) -> E\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " a: special comment for parameter a\n"
- " b: another special comment for parameter b\n"
- " h: enum Hola\n"
- "\n"
- " ", None, skip
+ "Parameters\n"
+ "----------\n"
+ "a: special comment for parameter a\n"
+ "b: another special comment for parameter b\n"
+ "h: enum Hola", None, skip
)
-check(F.__init__.__doc__,
+check(inspect.getdoc(F.__init__),
+ "__init__(F self, int a, int b, Hola h) -> F\n"
"\n"
- " __init__(F self, int a, int b, Hola h) -> F\n"
- "\n"
- " Parameters\n"
- " ----------\n"
- " a: special comment for parameter a\n"
- " b: another special comment for parameter b\n"
- " h: enum Hola\n"
- "\n"
- " ", None, skip
+ "Parameters\n"
+ "----------\n"
+ "a: special comment for parameter a\n"
+ "b: another special comment for parameter b\n"
+ "h: enum Hola", None, skip
)
-check(B.funk.__doc__,
- "funk(B self, int c, int d) -> int",
- "funk(int c, int d) -> int")
-check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int")
-check(funkdefaults.__doc__,
- "\n"
- " funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
- " funkdefaults(A e, short arg2, int c, int d) -> int\n"
- " ",
- "\n"
- "funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
- "funkdefaults(A e, short arg2, int c, int d) -> int\n"
- ""
- )
+check(inspect.getdoc(B.funk),
+ "funk(B self, int c, int d) -> int")
+check(inspect.getdoc(funk), "funk(A e, short arg2, int c, int d) -> int")
+check(inspect.getdoc(funkdefaults),
+ "funkdefaults(A e, short arg2, int c, int d, double f=2) -> int")
+
+check(inspect.getdoc(func_input), "func_input(int * INPUT) -> int")
+check(inspect.getdoc(func_output), "func_output() -> int")
+check(inspect.getdoc(func_inout), "func_inout(int * INOUT) -> int")
+check(inspect.getdoc(func_cb), "func_cb(int c, int d) -> int")
+check(inspect.getdoc(banana), "banana(S a, S b, int c, Integer d)")
+
+check(inspect.getdoc(TInteger), "Proxy of C++ T< int > class.", "::T< int >")
+check(inspect.getdoc(TInteger.__init__), "__init__(TInteger self) -> TInteger", None, skip)
+check(inspect.getdoc(TInteger.inout), "inout(TInteger self, TInteger t) -> TInteger")
+
+check(inspect.getdoc(process), "process(int _from, int _in, int var) -> int")
+check(inspect.getdoc(process2), "process2(int _from=0, int _in=1, int var=2) -> int")
+check(inspect.getdoc(process3), "process3(int _from, int _in, int var) -> int")
+check(inspect.getdoc(process4), "process4(int _from=0, int _in=1, int var=2) -> int")
-check(func_input.__doc__, "func_input(int * INPUT) -> int")
-check(func_output.__doc__, "func_output() -> int")
-check(func_inout.__doc__, "func_inout(int * INOUT) -> int")
-check(func_cb.__doc__, "func_cb(int c, int d) -> int")
-check(banana.__doc__, "banana(S a, S b, int c, Integer d)")
+check(inspect.getdoc(process_complex_defval), "process_complex_defval(val=PROCESS_DEFAULT_VALUE, factor=some_type(-1)) -> int")
diff --git a/Examples/test-suite/python/callback_runme.py b/Examples/test-suite/python/callback_runme.py
index ef7baad4e..de8a372f6 100644
--- a/Examples/test-suite/python/callback_runme.py
+++ b/Examples/test-suite/python/callback_runme.py
@@ -13,6 +13,10 @@ if foobar(3, _callback.foo) != foo(3):
if foobar(3, foo) != foo(3):
raise RuntimeError
+# Needs some more work for -builtin
+# if foobar(3, A.bar) != A.bar(3):
+# raise RuntimeError
+
if foobar(3, A_bar) != A_bar(3):
raise RuntimeError
diff --git a/Examples/test-suite/python/char_binary_runme.py b/Examples/test-suite/python/char_binary_runme.py
index 34caa3208..0425fe1c9 100644
--- a/Examples/test-suite/python/char_binary_runme.py
+++ b/Examples/test-suite/python/char_binary_runme.py
@@ -1,26 +1,26 @@
from char_binary import *
t = Test()
-if t.strlen('hile') != 4:
- print t.strlen('hile')
+if t.strlen("hile") != 4:
+ print t.strlen("hile")
raise RuntimeError, "bad multi-arg typemap"
-if t.ustrlen('hile') != 4:
- print t.ustrlen('hile')
+if t.ustrlen("hile") != 4:
+ print t.ustrlen("hile")
raise RuntimeError, "bad multi-arg typemap"
-if t.strlen('hil\0') != 4:
+if t.strlen("hil\0") != 4:
raise RuntimeError, "bad multi-arg typemap"
-if t.ustrlen('hil\0') != 4:
+if t.ustrlen("hil\0") != 4:
raise RuntimeError, "bad multi-arg typemap"
#
# creating a raw char*
#
pc = new_pchar(5)
-pchar_setitem(pc, 0, 'h')
-pchar_setitem(pc, 1, 'o')
-pchar_setitem(pc, 2, 'l')
-pchar_setitem(pc, 3, 'a')
+pchar_setitem(pc, 0, "h")
+pchar_setitem(pc, 1, "o")
+pchar_setitem(pc, 2, "l")
+pchar_setitem(pc, 3, "a")
pchar_setitem(pc, 4, 0)
diff --git a/Examples/test-suite/python/comment_verifier.py b/Examples/test-suite/python/comment_verifier.py
new file mode 100644
index 000000000..653cb4940
--- /dev/null
+++ b/Examples/test-suite/python/comment_verifier.py
@@ -0,0 +1,26 @@
+def check(got, expected, expected_builtin=None):
+ if got is None: # Absence of comment is equivalent to empty comment.
+ got = ""
+
+ if got != expected:
+ import re
+ p = re.compile(r"^[+-]([^+-].*\S)?(\s+)$", re.M)
+
+ def make_trailing_spaces_visible(str):
+ def replace_trailing_spaces(match):
+ res = match.group(0)
+ spaces = match.group(2)
+ if spaces is not None:
+ res = res + "{+%d trailing spaces}" % len(spaces)
+ return res
+ return re.sub(p, replace_trailing_spaces, str)
+
+ from difflib import unified_diff
+ diff = unified_diff(expected.splitlines(True),
+ got.splitlines(True), "expected", "got")
+ lines = []
+ for line in diff:
+ line = make_trailing_spaces_visible(line.strip("\r\n"))
+ lines.append(line + "\n")
+
+ raise RuntimeError("Comments don't match:\n" + "".join(lines))
diff --git a/Examples/test-suite/python/complextest_runme.py b/Examples/test-suite/python/complextest_runme.py
index 7dd7f5a3b..5cfc7ccab 100644
--- a/Examples/test-suite/python/complextest_runme.py
+++ b/Examples/test-suite/python/complextest_runme.py
@@ -8,10 +8,23 @@ if complextest.Conj(a) != a.conjugate():
if complextest.Conjf(a) != a.conjugate():
raise RuntimeError, "bad complex mapping"
+if complextest.Conj2(a) != a.conjugate():
+ raise RuntimeError, "bad complex mapping"
+
+if complextest.Conjf2(a) != a.conjugate():
+ raise RuntimeError, "bad complex mapping"
+
v = (complex(1, 2), complex(2, 3), complex(4, 3), 1)
-try:
- complextest.Copy_h(v)
-except:
- pass
+if len(complextest.CopyHalf(v)) != 2:
+ raise RuntimeError("CopyHalf failed")
+
+if len(complextest.CopyHalfRef(v)) != 2:
+ raise RuntimeError("CopyHalfRef failed")
+
+p = complextest.ComplexPair()
+p.z1 = complex(0, 1)
+p.z2 = complex(0, -1)
+if complextest.Conj(p.z2) != p.z1:
+ raise RuntimeError, "bad complex mapping"
diff --git a/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py b/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
index 363736a84..cc7b5cd91 100644
--- a/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
+++ b/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
@@ -4,11 +4,20 @@ a = cpp11_alternate_function_syntax.SomeStruct()
res = a.addNormal(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addNormal(4,5) returns ",
- res, " should be 9.")
-
+ raise RuntimeError, ("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
res = a.addAlternate(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternate(4,5) returns ",
- res, " should be 9.")
+ raise RuntimeError, ("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")
+
+res = a.addAlternateConst(4, 5)
+if res != 9:
+ raise RuntimeError, ("SomeStruct::addAlternateConst(4,5) returns ", res, " should be 9.")
+
+res = a.addAlternateNoExcept(4, 5)
+if res != 9:
+ raise RuntimeError, ("SomeStruct::addAlternateNoExcept(4,5) returns ", res, " should be 9.")
+
+res = a.addAlternateConstNoExcept(4, 5)
+if res != 9:
+ raise RuntimeError, ("SomeStruct::addAlternateConstNoExcept(4,5) returns ", res, " should be 9.")
diff --git a/Examples/test-suite/python/cpp11_final_directors_runme.py b/Examples/test-suite/python/cpp11_final_directors_runme.py
new file mode 100644
index 000000000..2e5f8af96
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_final_directors_runme.py
@@ -0,0 +1,11 @@
+import cpp11_final_directors
+
+class Derived2(cpp11_final_directors.Derived):
+
+ def meth(self):
+ return 3
+
+
+b = Derived2()
+if b.meth() != 3:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/cpp11_hash_tables_runme.py b/Examples/test-suite/python/cpp11_hash_tables_runme.py
new file mode 100644
index 000000000..7b772ff9a
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_hash_tables_runme.py
@@ -0,0 +1,60 @@
+import cpp11_hash_tables
+
+def swig_assert_equal(a, b):
+ if a != b:
+ raise RuntimeError(str(a) + " != " + str(b))
+
+for x in [cpp11_hash_tables.MapIntInt({1:7}),
+ cpp11_hash_tables.MultiMapIntInt({1:7}),
+ cpp11_hash_tables.UnorderedMapIntInt({1:7}),
+ cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})
+ ]:
+
+ swig_assert_equal([(k, v) for k, v in x.iteritems()], [(1, 7)])
+ swig_assert_equal(x.keys(), [1])
+ swig_assert_equal(x.values(), [7])
+ swig_assert_equal(x.items(), [(1, 7)])
+ swig_assert_equal([k for k in x], [1])
+ swig_assert_equal([i for i in x.iterkeys()], [1])
+ swig_assert_equal([i for i in x.itervalues()], [7])
+ swig_assert_equal([i for i in x.iteritems()], [(1, 7)])
+
+ swig_assert_equal(x[1], 7)
+ swig_assert_equal(2 in x, False)
+ x[2] = 9
+ swig_assert_equal(x[2], 9)
+ del x[2]
+ swig_assert_equal(2 in x, False)
+ swig_assert_equal(x.empty(), False)
+ del x[1]
+ swig_assert_equal(x.empty(), True)
+ swig_assert_equal(1 in x, False)
+
+for x in [cpp11_hash_tables.MultiMapIntInt({1:7}),
+ cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})]:
+ x[1] = 9
+ swig_assert_equal(sorted([v for k, v in x.iteritems()]), [7, 9])
+ swig_assert_equal(len(x), 2)
+
+for x in [cpp11_hash_tables.SetInt([1]),
+ cpp11_hash_tables.MultiSetInt([1]),
+ cpp11_hash_tables.UnorderedSetInt([1]),
+ cpp11_hash_tables.UnorderedMultiSetInt([1])]:
+
+ swig_assert_equal([e for e in x], [1])
+ swig_assert_equal(x[0], 1)
+
+ swig_assert_equal(1 in x, True)
+ swig_assert_equal(2 in x, False)
+ x.append(2)
+ swig_assert_equal(2 in x, True)
+ x.erase(2)
+ swig_assert_equal(x.empty(), False)
+ x.erase(1)
+ swig_assert_equal(x.empty(), True)
+
+for x in [cpp11_hash_tables.MultiSetInt([1]),
+ cpp11_hash_tables.UnorderedMultiSetInt([1])]:
+ x.append(1)
+ swig_assert_equal(x.count(1), 2)
+ swig_assert_equal(len(x), 2)
diff --git a/Examples/test-suite/python/cpp11_raw_string_literals_runme.py b/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
index 29e53c6a7..6a587b860 100644
--- a/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
+++ b/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
@@ -1,4 +1,5 @@
from cpp11_raw_string_literals import *
+import inspect
if cvar.L != 100:
raise RuntimeError
@@ -46,3 +47,29 @@ if cvar.ff != "I'm a \"raw wide\" \\ string.":
if cvar.gg != "I'm a \"raw UTF-8\" \\ string.":
raise RuntimeError, cvar.gg
+
+
+def check(got, expected):
+ expected_list = expected.split("\n")
+ got_list = got.split("\n")
+
+ if expected_list != got_list:
+ raise RuntimeError("\n" + "Expected: " + str(expected_list) + "\n" + "Got : " + str(got_list))
+
+# When getting docstrings, use inspect.getdoc(x) instead of x.__doc__ otherwise the different options
+# such as -O and -builtin may produce different initial indentation.
+check(inspect.getdoc(RawStringDoc.WW), "Single line documentation comment")
+check(inspect.getdoc(RawStringDoc.XX),
+"""Multi-line
+documentation
+comment""")
+check(inspect.getdoc(RawStringDoc.YY), """Single line "raw string" documentation comment""")
+check(inspect.getdoc(RawStringDoc.ZZ),
+"""Documentation comment
+
+as a "raw string"
+on multiple lines including a \ backslash""")
+
+check(mm, """)I'm an "ascii" \ string constant with multiple
+
+lines.""")
diff --git a/Examples/test-suite/python/cpp11_ref_qualifiers_runme.py b/Examples/test-suite/python/cpp11_ref_qualifiers_runme.py
new file mode 100644
index 000000000..d3aa98c47
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_ref_qualifiers_runme.py
@@ -0,0 +1,45 @@
+import cpp11_ref_qualifiers
+
+h = cpp11_ref_qualifiers.Host()
+
+# Basic testing
+h.h1()
+h.h2()
+h.h6()
+h.h7()
+
+h.h()
+
+# %feature testing
+f = cpp11_ref_qualifiers.Features()
+if f.F1() != "F1":
+ raise RuntimeException("Fail")
+if f.F2() != "F2":
+ raise RuntimeException("Fail")
+if f.F3() != "F3":
+ raise RuntimeException("Fail")
+
+if f.C1(0) != "C1":
+ raise RuntimeException("Fail")
+if f.C2(0) != "C2":
+ raise RuntimeException("Fail")
+if f.C3(0) != "C3":
+ raise RuntimeException("Fail")
+
+# %rename testing
+r = cpp11_ref_qualifiers.Renames()
+r.RR1()
+r.RR2()
+r.RR3()
+
+r.SS1(0)
+r.SS2(0)
+r.SS3(0)
+
+# Conversion operators
+co = cpp11_ref_qualifiers.ConversionOperators()
+s = co.StringConvertCopy()
+s = co.StringConvertMove()
+
+co2 = cpp11_ref_qualifiers.ConversionOperators2()
+s = co2.StringConvertMove()
diff --git a/Examples/test-suite/python/cpp11_ref_qualifiers_rvalue_unignore_runme.py b/Examples/test-suite/python/cpp11_ref_qualifiers_rvalue_unignore_runme.py
new file mode 100644
index 000000000..6352c79c2
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_ref_qualifiers_rvalue_unignore_runme.py
@@ -0,0 +1,4 @@
+import cpp11_ref_qualifiers_rvalue_unignore
+
+cpp11_ref_qualifiers_rvalue_unignore.RefQualifier().m1()
+cpp11_ref_qualifiers_rvalue_unignore.RefQualifier().m2()
diff --git a/Examples/test-suite/python/cpp11_shared_ptr_overload_runme.py b/Examples/test-suite/python/cpp11_shared_ptr_overload_runme.py
new file mode 100644
index 000000000..6b179cb6d
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_shared_ptr_overload_runme.py
@@ -0,0 +1,45 @@
+import cpp11_shared_ptr_overload
+from cpp11_shared_ptr_overload import MyType
+
+# ref
+ret = cpp11_shared_ptr_overload.UseA(MyType("123"))
+if ret != "123 ref": raise RuntimeError("UseA fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.UseB(0, MyType("123"))
+if ret != "123 ref": raise RuntimeError("UseB fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.UseC(0, MyType("123"), MyType("456"))
+if ret != "123 ref": raise RuntimeError("UseC fail:" + ret)
+
+# sharedptr
+ret = cpp11_shared_ptr_overload.UseX(MyType("123"))
+if ret != "123 sharedptr": raise RuntimeError("UseX fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.UseY(0, MyType("123"))
+if ret != "123 sharedptr": raise RuntimeError("UseY fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.UseZ(0, MyType("123"), MyType("456"))
+if ret != "123 sharedptr": raise RuntimeError("UseZ fail:" + ret)
+
+# Combo1-4
+ret = cpp11_shared_ptr_overload.Combo1(MyType("XXX"))
+if ret != "XXXCombo1": raise RuntimeError("Combo1 fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.Combo2(MyType("XXX"))
+if ret != "XXXCombo2": raise RuntimeError("Combo2 fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.Combo3(MyType("XXX"))
+if ret != "XXXCombo3": raise RuntimeError("Combo3 fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.Combo4(MyType("XXX"))
+if ret != "XXXCombo4": raise RuntimeError("Combo4 fail:" + ret)
+
+# Combo5-7
+ret = cpp11_shared_ptr_overload.Combo5(MyType("XXX"))
+if ret != "XXXCombo5": raise RuntimeError("Combo5 fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.Combo6(MyType("XXX"))
+if ret != "XXXCombo6": raise RuntimeError("Combo6 fail:" + ret)
+
+ret = cpp11_shared_ptr_overload.Combo7(MyType("XXX"))
+if ret != "XXXCombo7": raise RuntimeError("Combo7 fail:" + ret)
diff --git a/Examples/test-suite/python/cpp11_li_std_array_runme.py b/Examples/test-suite/python/cpp11_std_array_runme.py
index 3b1ceb2f8..e5e7373dd 100644
--- a/Examples/test-suite/python/cpp11_li_std_array_runme.py
+++ b/Examples/test-suite/python/cpp11_std_array_runme.py
@@ -1,4 +1,4 @@
-from cpp11_li_std_array import *
+from cpp11_std_array import *
import sys
diff --git a/Examples/test-suite/python/cpp14_binary_integer_literals_runme.py b/Examples/test-suite/python/cpp14_binary_integer_literals_runme.py
new file mode 100644
index 000000000..8274ec6b5
--- /dev/null
+++ b/Examples/test-suite/python/cpp14_binary_integer_literals_runme.py
@@ -0,0 +1,16 @@
+from cpp14_binary_integer_literals import *
+
+if cvar.b1 != 1:
+ raise RuntimeError
+
+if cvar.b2 != 2:
+ raise RuntimeError
+
+if cvar.b3 != 3:
+ raise RuntimeError
+
+if cvar.b4 != 4:
+ raise RuntimeError
+
+if cvar.b5 != 5:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/cpp17_hex_floating_literals_runme.py b/Examples/test-suite/python/cpp17_hex_floating_literals_runme.py
new file mode 100644
index 000000000..ed9f4d26b
--- /dev/null
+++ b/Examples/test-suite/python/cpp17_hex_floating_literals_runme.py
@@ -0,0 +1,28 @@
+from cpp17_hex_floating_literals import *
+
+if cvar.f1 != 0.:
+ raise RuntimeError
+
+if cvar.f2 != 0.:
+ raise RuntimeError
+
+if cvar.f3 != 0.:
+ raise RuntimeError
+
+if cvar.f4 != 7.5:
+ raise RuntimeError
+
+if cvar.f5 != 20.:
+ raise RuntimeError
+
+if cvar.f6 != 64.:
+ raise RuntimeError
+
+if cvar.f7 != 11452.:
+ raise RuntimeError
+
+if cvar.f8 != 149140.:
+ raise RuntimeError
+
+if cvar.f9 != 18253638.:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/cpp17_nested_namespaces_runme.py b/Examples/test-suite/python/cpp17_nested_namespaces_runme.py
new file mode 100644
index 000000000..562216625
--- /dev/null
+++ b/Examples/test-suite/python/cpp17_nested_namespaces_runme.py
@@ -0,0 +1,18 @@
+from cpp17_nested_namespaces import *
+
+A1Struct().A1Method()
+B1Struct().B1Method()
+C1Struct().C1Method()
+createA1Struct().A1Method()
+createB1Struct().B1Method()
+createC1Struct().C1Method()
+
+B2Struct().B2Method()
+C2Struct().C2Method()
+createB2Struct().B2Method()
+createC2Struct().C2Method()
+
+B3Struct().B3Method()
+C3Struct().C3Method()
+createB3Struct().B3Method()
+createC3Struct().C3Method()
diff --git a/Examples/test-suite/python/cpp17_u8_char_literals_runme.py b/Examples/test-suite/python/cpp17_u8_char_literals_runme.py
new file mode 100644
index 000000000..e2f8897f3
--- /dev/null
+++ b/Examples/test-suite/python/cpp17_u8_char_literals_runme.py
@@ -0,0 +1,10 @@
+from cpp17_u8_char_literals import *
+
+if cvar.a != "a":
+ raise RuntimeError
+
+if cvar.u != "u":
+ raise RuntimeError
+
+if cvar.u8 != "8":
+ raise RuntimeError
diff --git a/Examples/test-suite/python/cpp_static_runme.py b/Examples/test-suite/python/cpp_static_runme.py
index ef31f88af..cd7398fbb 100644
--- a/Examples/test-suite/python/cpp_static_runme.py
+++ b/Examples/test-suite/python/cpp_static_runme.py
@@ -2,29 +2,27 @@
from cpp_static import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-if is_new_style_class(StaticFunctionTest):
- StaticFunctionTest.static_func()
- StaticFunctionTest.static_func_2(1)
- StaticFunctionTest.static_func_3(1, 2)
-else:
- StaticFunctionTest().static_func()
- StaticFunctionTest().static_func_2(1)
- StaticFunctionTest().static_func_3(1, 2)
+StaticFunctionTest.static_func()
+StaticFunctionTest.static_func_2(1)
+StaticFunctionTest.static_func_3(1, 2)
if is_python_builtin():
if not StaticMemberTest.static_int == 99: raise RuntimeError("static_int not 99")
+ if not StaticMemberTest.grab_int() == 99: raise RuntimeError("static_int not 99")
StaticMemberTest.static_int = 10
if not StaticMemberTest.static_int == 10: raise RuntimeError("static_int not 10")
+ if not StaticMemberTest.grab_int() == 10: raise RuntimeError("static_int not 10")
if not StaticBase.statty == 11: raise RuntimeError("statty not 11")
+ if not StaticBase.grab_statty_base() == 11: raise RuntimeError("statty not 11")
if not StaticDerived.statty == 111: raise RuntimeError("statty not 111")
+ if not StaticDerived.grab_statty_derived() == 111: raise RuntimeError("statty not 111")
StaticBase.statty = 22
StaticDerived.statty = 222
if not StaticBase.statty == 22: raise RuntimeError("statty not 22")
+ if not StaticBase.grab_statty_base() == 22: raise RuntimeError("statty not 22")
if not StaticDerived.statty == 222: raise RuntimeError("statty not 222")
+ if not StaticDerived.grab_statty_derived() == 222: raise RuntimeError("statty not 222")
# Restore
StaticMemberTest.static_int = 99
@@ -32,12 +30,43 @@ if is_python_builtin():
StaticDerived.statty = 111
if not cvar.StaticMemberTest_static_int == 99: raise RuntimeError("cvar static_int not 99")
+if not StaticMemberTest.grab_int() == 99: raise RuntimeError("cvar static_int not 99")
cvar.StaticMemberTest_static_int = 10
if not cvar.StaticMemberTest_static_int == 10: raise RuntimeError("cvar static_int not 10")
+if not StaticMemberTest.grab_int() == 10: raise RuntimeError("cvar static_int not 10")
if not cvar.StaticBase_statty == 11: raise RuntimeError("cvar statty not 11")
+if not StaticBase.grab_statty_base() == 11: raise RuntimeError("cvar statty not 11")
if not cvar.StaticDerived_statty == 111: raise RuntimeError("cvar statty not 111")
+if not StaticDerived.grab_statty_derived() == 111: raise RuntimeError("cvar statty not 111")
cvar.StaticBase_statty = 22
cvar.StaticDerived_statty = 222
if not cvar.StaticBase_statty == 22: raise RuntimeError("cvar statty not 22")
+if not StaticBase.grab_statty_base() == 22: raise RuntimeError("cvar statty not 22")
if not cvar.StaticDerived_statty == 222: raise RuntimeError("cvar statty not 222")
+if not StaticDerived.grab_statty_derived() == 222: raise RuntimeError("cvar statty not 222")
+
+# Restore
+cvar.StaticMemberTest_static_int = 99
+cvar.StaticBase_statty = 11
+cvar.StaticDerived_statty = 111
+
+# Low-level layer testing
+if not is_python_builtin():
+ from cpp_static import _cpp_static
+ if not _cpp_static.StaticMemberTest_static_int_get() == 99: raise RuntimeError("low-level static_int not 99")
+ if not StaticMemberTest.grab_int() == 99: raise RuntimeError("low-level static_int not 99")
+ _cpp_static.StaticMemberTest_static_int_set(10)
+ if not _cpp_static.StaticMemberTest_static_int_get() == 10: raise RuntimeError("low-level static_int not 10")
+ if not StaticMemberTest.grab_int() == 10: raise RuntimeError("low-level static_int not 10")
+
+ if not _cpp_static.StaticBase_statty_get() == 11: raise RuntimeError("low-level statty not 11")
+ if not StaticBase.grab_statty_base() == 11: raise RuntimeError("low-level statty not 11")
+ if not _cpp_static.StaticDerived_statty_get() == 111: raise RuntimeError("low-level statty not 111")
+ if not StaticDerived.grab_statty_derived() == 111: raise RuntimeError("low-level statty not 111")
+ _cpp_static.StaticBase_statty_set(22)
+ _cpp_static.StaticDerived_statty_set(222)
+ if not _cpp_static.StaticBase_statty_get() == 22: raise RuntimeError("low-level statty not 22")
+ if not StaticBase.grab_statty_base() == 22: raise RuntimeError("low-level statty not 22")
+ if not _cpp_static.StaticDerived_statty_get() == 222: raise RuntimeError("low-level statty not 222")
+ if not StaticDerived.grab_statty_derived() == 222: raise RuntimeError("low-level statty not 222")
diff --git a/Examples/test-suite/python/default_args_c_runme.py b/Examples/test-suite/python/default_args_c_runme.py
index 5985fd75c..65ca9178f 100644
--- a/Examples/test-suite/python/default_args_c_runme.py
+++ b/Examples/test-suite/python/default_args_c_runme.py
@@ -4,3 +4,23 @@ if default_args_c.foo1() != 1:
raise RuntimeError("failed")
if default_args_c.foo43() != 43:
raise RuntimeError("failed")
+
+f = default_args_c.FooStruct()
+f.no_arg()
+f.one_req(None)
+f.one_opt()
+f.one_opt(None)
+f.two_arg(None)
+f.two_arg(None, None)
+
+default_args_c.StaticStruct.no_arg()
+default_args_c.StaticStruct.one_req(None)
+default_args_c.StaticStruct.one_opt()
+default_args_c.StaticStruct.one_opt(None)
+default_args_c.StaticStruct.two_arg(None)
+default_args_c.StaticStruct.two_arg(None, None)
+
+default_args_c.global_opts1()
+default_args_c.global_opts1(None)
+default_args_c.global_opts2(None)
+default_args_c.global_opts2(None, None)
diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py
index 9d275e4a1..14ef8c594 100644
--- a/Examples/test-suite/python/default_args_runme.py
+++ b/Examples/test-suite/python/default_args_runme.py
@@ -2,10 +2,6 @@
# the use of __main__ and the run function
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-
def run(module_name):
default_args = __import__(module_name)
ec = default_args.EnumClass()
@@ -32,6 +28,8 @@ def run(module_name):
f.newname()
f.newname(1)
+ f.defaulted1()
+ f.defaulted2()
if f.double_if_void_ptr_is_null(2, None) != 4:
raise RuntimeError
@@ -99,10 +97,7 @@ def run(module_name):
if error:
raise RuntimeError("Foo::meth ignore is not working")
- if is_new_style_class(default_args.Klass):
- Klass_inc = default_args.Klass.inc
- else:
- Klass_inc = default_args.Klass_inc
+ Klass_inc = default_args.Klass.inc
if Klass_inc(100, default_args.Klass(22)).val != 122:
raise RuntimeError("Klass::inc failed")
@@ -113,15 +108,54 @@ def run(module_name):
if Klass_inc().val != 0:
raise RuntimeError("Klass::inc failed")
- default_args.trickyvalue1(10)
- default_args.trickyvalue1(10, 10)
- default_args.trickyvalue2(10)
- default_args.trickyvalue2(10, 10)
- default_args.trickyvalue3(10)
- default_args.trickyvalue3(10, 10)
+ tricky_failure = False
+ tricky = default_args.TrickyInPython()
+ if tricky.value_m1(10) != -1:
+ print "trickyvalue_m1 failed"
+ tricky_failure = True
+ if tricky.value_m1(10, 10) != 10:
+ print "trickyvalue_m1 failed"
+ tricky_failure = True
+ if tricky.value_0xabcdef(10) != 0xabcdef:
+ print "trickyvalue_0xabcdef failed"
+ tricky_failure = True
+ if tricky.value_0644(10) != 420:
+ print "trickyvalue_0644 failed"
+ tricky_failure = True
+ if tricky.value_perm(10) != 420:
+ print "trickyvalue_perm failed"
+ tricky_failure = True
+ if tricky.value_m01(10) != -1:
+ print "trickyvalue_m01 failed"
+ tricky_failure = True
+ if not tricky.booltest2():
+ print "booltest2 failed"
+ tricky_failure = True
+
+ if tricky.max_32bit_int1() != 0x7FFFFFFF:
+ print "max_32bit_int1 failed"
+ tricky_failure = True
+ if tricky.min_32bit_int1() != -2147483648:
+ print "min_32bit_int1 failed"
+ tricky_failure = True
+ if tricky.max_32bit_int2() != 0x7FFFFFFF:
+ print "max_32bit_int2 failed"
+ tricky_failure = True
+
+ tricky.too_big_32bit_int1()
+ tricky.too_small_32bit_int1()
+ tricky.too_big_32bit_int2()
+ tricky.too_small_32bit_int2()
+
+ if tricky_failure:
+ raise RuntimeError
+
default_args.seek()
default_args.seek(10)
+ if not default_args.booltest():
+ raise RuntimeError("booltest failed")
+
if default_args.slightly_off_square(10) != 102:
raise RuntimeError
@@ -136,23 +170,23 @@ def run(module_name):
if default_args.CDA().cdefaultargs_test2() != 1:
raise RuntimeError
- if default_args.chartest1() != 'x':
+ if default_args.chartest1() != "x":
raise RuntimeError
- if default_args.chartest2() != '\0':
+ if default_args.chartest2() != "\0":
raise RuntimeError
- if default_args.chartest3() != '\1':
+ if default_args.chartest3() != "\1":
raise RuntimeError
- if default_args.chartest4() != '\n':
+ if default_args.chartest4() != "\n":
raise RuntimeError
- if default_args.chartest5() != 'B':
+ if default_args.chartest5() != "B":
raise RuntimeError
- if default_args.chartest6() != 'C':
+ if default_args.chartest6() != "C":
raise RuntimeError
if __name__ == "__main__":
- run('default_args')
+ run("default_args")
diff --git a/Examples/test-suite/python/director_abstract_runme.py b/Examples/test-suite/python/director_abstract_runme.py
index 031c476d8..333b75fe5 100644
--- a/Examples/test-suite/python/director_abstract_runme.py
+++ b/Examples/test-suite/python/director_abstract_runme.py
@@ -1,10 +1,6 @@
import director_abstract
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-
class MyFoo(director_abstract.Foo):
def __init__(self):
@@ -44,20 +40,12 @@ me1 = MyExample1()
if director_abstract.Example1_get_color(me1, 1, 2, 3) != 1:
raise RuntimeError
-if is_new_style_class(MyExample2):
- MyExample2_static = MyExample2
-else:
- MyExample2_static = MyExample2(0, 0)
me2 = MyExample2(1, 2)
-if MyExample2_static.get_color(me2, 1, 2, 3) != 2:
+if MyExample2.get_color(me2, 1, 2, 3) != 2:
raise RuntimeError
-if is_new_style_class(MyExample3):
- MyExample3_static = MyExample3
-else:
- MyExample3_static = MyExample3()
me3 = MyExample3()
-if MyExample3_static.get_color(me3, 1, 2, 3) != 3:
+if MyExample3.get_color(me3, 1, 2, 3) != 3:
raise RuntimeError
error = 1
diff --git a/Examples/test-suite/python/director_exception_runme.py b/Examples/test-suite/python/director_exception_runme.py
index 892c7e653..06856f30a 100644
--- a/Examples/test-suite/python/director_exception_runme.py
+++ b/Examples/test-suite/python/director_exception_runme.py
@@ -25,6 +25,13 @@ class MyFoo3(Foo):
def ping(self):
raise MyException("foo", "bar")
+class MyFoo4(Foo):
+
+ def ping(self, *args):
+ print(type("bad", "call")) # throws TypeError message: type() takes 1 or 3 arguments
+ return "Foo4.ping"
+
+
# Check that the NotImplementedError raised by MyFoo.ping() is returned by
# MyFoo.pong().
ok = 0
@@ -51,7 +58,8 @@ b = launder(a)
try:
b.pong()
except TypeError, e:
- if str(e) == "SWIG director type mismatch in output value of type 'std::string'":
+ # fastdispatch mode adds on Additional Information to the exception message - just check the main exception message exists
+ if str(e).startswith("SWIG director type mismatch in output value of type 'std::string'"):
ok = 1
else:
print "Unexpected error message: %s" % str(e)
@@ -67,13 +75,29 @@ b = launder(a)
try:
b.pong()
except MyException, e:
- if e.msg == 'foobar':
+ if e.msg == "foobar":
ok = 1
else:
print "Unexpected error message: %s" % str(e)
if not ok:
raise RuntimeError
+
+# Check that the director returns the appropriate TypeError thrown in a director method
+ok = 0
+a = MyFoo4()
+b = launder(a)
+try:
+ b.pong()
+except TypeError as e:
+ if str(e).startswith("type() takes 1 or 3 arguments"):
+ ok = 1
+ else:
+ print "Unexpected error message: %s" % str(e)
+if not ok:
+ raise RuntimeError
+
+
# This is expected to fail with -builtin option
# Throwing builtin classes as exceptions not supported
if not is_python_builtin():
diff --git a/Examples/test-suite/python/director_smartptr_runme.py b/Examples/test-suite/python/director_smartptr_runme.py
index c8bab9d7a..23e22d0fb 100644
--- a/Examples/test-suite/python/director_smartptr_runme.py
+++ b/Examples/test-suite/python/director_smartptr_runme.py
@@ -15,6 +15,20 @@ class director_smartptr_MyBarFoo(Foo):
def makeFoo(self):
return Foo()
+class director_smartptr_MyBarFooDerived(FooDerived):
+
+ def ping(self):
+ return "director_smartptr_MyBarFooDerived.ping()"
+
+ def pong(self):
+ return "director_smartptr_MyBarFooDerived.pong();" + self.ping()
+
+ def upcall(self, fooBarPtr):
+ return "overrideDerived;" + fooBarPtr.FooBarDo()
+
+ def makeFoo(self):
+ return Foo()
+
def check(got, expected):
if (got != expected):
raise RuntimeError, "Failed, got: " + got + " expected: " + expected
@@ -35,3 +49,8 @@ myFoo2 = Foo().makeFoo()
check(myFoo2.pong(), "Foo::pong();Foo::ping()")
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()")
check(myFoo2.upcall(FooBar()), "Bar::Foo2::Foo2Bar()")
+
+myBarFooDerived = director_smartptr_MyBarFooDerived()
+check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()")
+check(FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()")
+check(FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()")
diff --git a/Examples/test-suite/python/doxygen_alias_runme.py b/Examples/test-suite/python/doxygen_alias_runme.py
new file mode 100644
index 000000000..505261bcd
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_alias_runme.py
@@ -0,0 +1,10 @@
+import doxygen_alias
+import inspect
+import comment_verifier
+
+comment_verifier.check(inspect.getdoc(doxygen_alias.make_something),
+ """\
+A function returning something.
+
+:rtype: :py:class:`Something`
+:return: A new object which may be None.""")
diff --git a/Examples/test-suite/python/doxygen_basic_notranslate_runme.py b/Examples/test-suite/python/doxygen_basic_notranslate_runme.py
new file mode 100644
index 000000000..1e654effc
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_basic_notranslate_runme.py
@@ -0,0 +1,66 @@
+import doxygen_basic_notranslate
+import inspect
+import string
+import sys
+import comment_verifier
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function),
+ r"""\brief
+Brief description.
+
+The comment text
+\author Some author
+\return Some number
+\sa function2"""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function1),
+ r"""Single line comment """
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function2),
+ r"""A test of a very very very very very very very very very very very very very very very very
+very very very very very long comment string."""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function3),
+ r"""*Overload 1:*
+
+A test for overloaded functions
+This is function \b one
+
+|
+
+*Overload 2:*
+
+A test for overloaded functions
+This is function \b two"""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function4),
+ r"""A test of some mixed tag usage
+\if CONDITION
+This \a code fragment shows us something \.
+\par Minuses:
+\arg it's senseless
+\arg it's stupid
+\arg it's null
+
+\warning This may not work as expected
+
+\code
+int main() { while(true); }
+\endcode
+\endif"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function5),
+ r"""This is a post comment. """
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function6),
+ r"""Test for default args
+@param a Some parameter, default is 42"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function7),
+ r"""Test for a parameter with difficult type
+(mostly for python)
+@param a Very strange param"""
+)
diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py
new file mode 100644
index 000000000..9ef8dbd52
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py
@@ -0,0 +1,84 @@
+import doxygen_basic_translate
+import inspect
+import string
+import sys
+import comment_verifier
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function),
+ """\
+Brief description.
+
+The comment text.
+
+Author: Some author
+
+:rtype: int
+:return: Some number
+
+See also: function2"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function2),
+ """\
+A test of a very very very very very very very very very very very very very very very very
+very very very very very long comment string."""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function3),
+ """*Overload 1:*
+
+A test for overloaded functions
+This is function **one**
+
+|
+
+*Overload 2:*
+
+A test for overloaded functions
+This is function **two**"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function4),
+ """\
+A test of some mixed tag usage
+If: CONDITION {
+This *code* fragment shows us something .
+Title: Minuses:
+* it\'s senseless
+* it\'s stupid
+* it\'s null
+
+Warning: This may not work as expected
+
+.. code-block:: c++
+
+ int main() { while(true); }
+
+ // Test blank line in code block
+}"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function5),
+ """This is a post comment."""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function6),
+ """\
+Test for default args
+:type a: int
+:param a: Some parameter, default is 42"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function7),
+ """\
+Test for a parameter with difficult type
+(mostly for python)
+:type a: :py:class:`Shape`
+:param a: Very strange param"""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.Atan2),
+ """\
+Multiple parameters test.
+
+:type y: float
+:param y: Vertical coordinate.
+:type x: float
+:param x: Horizontal coordinate.
+:rtype: float
+:return: Arc tangent of ``y/x``."""
+)
diff --git a/Examples/test-suite/python/doxygen_basic_translate_style2_runme.py b/Examples/test-suite/python/doxygen_basic_translate_style2_runme.py
new file mode 100644
index 000000000..b75045d59
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_basic_translate_style2_runme.py
@@ -0,0 +1,82 @@
+import doxygen_basic_translate_style2
+import inspect
+import string
+import sys
+import comment_verifier
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function),
+ """\
+Brief description.
+
+The comment text.
+
+Author: Some author
+
+:rtype: int
+:return: Some number
+
+See also: function2"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function2),
+ """\
+A test of a very very very very very very very very very very very very very very very very
+very very very very very long comment string."""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function3),
+ """*Overload 1:*
+A test for overloaded functions
+This is function **one**
+
+|
+
+*Overload 2:*
+A test for overloaded functions
+This is function **two**"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function4),
+ """\
+A test of some mixed tag usage
+If: CONDITION {
+This *code* fragment shows us something .
+Title: Minuses:
+* it\'s senseless
+* it\'s stupid
+* it\'s null
+
+Warning: This may not work as expected
+
+.. code-block:: c++
+
+ int main() { while(true); }
+
+ // Test blank line in code block
+}"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function5),
+ """This is a post comment."""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function6),
+ """\
+Test for default args
+:type a: int
+:param a: Some parameter, default is 42"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function7),
+ """\
+Test for a parameter with difficult type
+(mostly for python)
+:type a: :py:class:`Shape`
+:param a: Very strange param"""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.Atan2),
+ """\
+Multiple parameters test.
+
+:type y: float
+:param y: Vertical coordinate.
+:type x: float
+:param x: Horizontal coordinate.
+:rtype: float
+:return: Arc tangent of ``y/x``."""
+)
diff --git a/Examples/test-suite/python/doxygen_ignore_runme.py b/Examples/test-suite/python/doxygen_ignore_runme.py
new file mode 100644
index 000000000..9a7b2e5df
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_ignore_runme.py
@@ -0,0 +1,17 @@
+import doxygen_ignore
+import inspect
+import comment_verifier
+
+comment_verifier.check(inspect.getdoc(doxygen_ignore.func),
+ """\
+A contrived example of ignoring too many commands in one comment.
+
+
+
+
+
+
+This is specific to **Python**.
+
+
+Command ignored, but anything here is still included.""")
diff --git a/Examples/test-suite/python/doxygen_misc_constructs_runme.py b/Examples/test-suite/python/doxygen_misc_constructs_runme.py
new file mode 100644
index 000000000..11aa53ba3
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_misc_constructs_runme.py
@@ -0,0 +1,133 @@
+import doxygen_misc_constructs
+import inspect
+import string
+import sys
+import comment_verifier
+
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getAddress),
+ r"""Returns address of file line.
+
+:type fileName: int
+:param fileName: name of the file, where the source line is located
+:type line: int
+:param line: line number
+:type isGetSize: boolean
+:param isGetSize: if set, for every object location both address and size are returned
+
+Connection::getId() """)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.CConnectionConfig),
+ r"""This class contains information for connection to winIDEA. Its methods
+return reference to self, so we can use it like this:
+
+CConnectionConfig config = new CConnectionConfig();
+config.discoveryPort(5534).dllPath("C:\\myWinIDEA\\connect.dll").id("main");
+
+
+All parameters are optional. Set only what is required, default values are
+used for unspecified parameters.
+
+
+
+advancedWinIDEALaunching.py Python example.""")
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.waitTime),
+ r"""Determines how long the ``isystem.connect`` should wait for running
+instances to respond. Only one of ``lfWaitXXX`` flags from IConnect::ELaunchFlags
+may be specified."""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getConnection),
+ r"""This function returns connection id."""
+)
+
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getFirstLetter),
+ r""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.ClassWithNestedEnum),
+ r"""Class description."""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.showList),
+ r"""An example of a list in a documentation comment.
+
+ - The first item of the list.
+ - The second list item, on
+ several indented lines,
+ showing that the indentation
+ is preserved.
+ - And the final list item after it.
+
+And this is not a list item any more."""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidA),
+ r"""This comment without space after '*' is valid in Doxygen."""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidB),
+ r""".This comment without space after '*' is valid in Doxygen."""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidC),
+ r""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashA),
+ r"""Backslash following``word`` is a valid doxygen command. Output contains
+'followingword' with 'word' in code font."""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashB),
+ r"""Doxy command without trailing space is ignored - nothing appears
+on output. Standalone \ and '\' get to output.
+Standalone @ and '@' get to output.
+Commands "in quoted \b strings are treated as plain text".
+Commands not recognized by Doxygen are ignored.
+Backslashes in DOS paths d:and words
+following them do not appear on output, we must quote them with
+double quotes: "d:\xyz\qwe\myfile", "@something". Single quotes do not help:
+'d:'. Escaping works: d:\xyz\qwe\myfile. Unix
+paths of course have no such problems: /xyz/qwe/myfile
+Commands for escaped symbols:
+$ @ \ & ~ < > # % " . :: @text ::text"""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashC),
+ r"""Backslash e at end of *line* froze SWIG
+*with* old comment parser.
+
+See also: MyClass::fun(char,
+ float)"""
+)
+
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.cycle),
+ r"""The next line contains expression:
+
+['retVal < 10', 'g_counter == 23 && g_mode & 3']
+
+
+Both words should be emphasized **isystem.connect**.
+But not the last period. For **example**, comma should not be emphasized.
+Similar **for**: double colon.
+
+Spaces at the start of line should be taken into account:
+:type id: int
+:param id: used as prefix in log
+ statements. The default value is empty string, which is OK if
+ there is only one app. instance. Example:
+
+ ctrl.setBP("func1");
+
+ If we set the id to ``main_``, we get:
+
+ main_ctrl.setBP("func1");
+
+
+:type fileName: string
+:param fileName: name of the log file"""
+);
diff --git a/Examples/test-suite/python/doxygen_parsing_runme.py b/Examples/test-suite/python/doxygen_parsing_runme.py
new file mode 100644
index 000000000..80e8892fa
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_parsing_runme.py
@@ -0,0 +1,66 @@
+import doxygen_parsing
+import inspect
+import string
+import os
+import sys
+import comment_verifier
+
+comment_verifier.check(inspect.getdoc(doxygen_parsing.someFunction),
+ "The function comment")
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeClass),
+ "The class comment")
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeStruct),
+ "The struct comment")
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass),
+ "SomeAnotherClass description")
+
+# There doesn't seem to be any way to specify the doc string for __init__ when
+# using "-builtin" (see http://stackoverflow.com/q/11913492/15275), so skip
+# this test in this case.
+if not doxygen_parsing.is_python_builtin():
+ comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.__init__),
+ r"""*Overload 1:*
+First overloaded constructor.
+
+|
+
+*Overload 2:*
+Second overloaded constructor.""")
+
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethod),
+ r"""The class method comment.
+
+SomeAnotherClass#classMethodExtended(int, int) a link text""")
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethodExtended),
+ r"""The class method with parameter
+
+:type a: int
+:param a: Parameter a
+:type b: int
+:param b: Parameter b"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethodExtended2),
+ r"""The class method with parameter
+
+:type a: int
+:param a: Parameter a
+:type b: int
+:param b: Parameter b"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethod),
+ r"""The struct method comment""")
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethodExtended),
+ r"""The struct method with parameter
+
+:type a: int
+:param a: Parameter a
+:type b: int
+:param b: Parameter b"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethodExtended2),
+ r"""The struct method with parameter
+
+:type a: int
+:param a: Parameter a
+:type b: int
+:param b: Parameter b""")
diff --git a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py
new file mode 100644
index 000000000..df1c0eba5
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py
@@ -0,0 +1,313 @@
+import doxygen_translate_all_tags
+import inspect
+import string
+import sys
+import comment_verifier
+
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func01),
+r"""*Hello*
+
+
+
+
+
+* some list item
+
+This is attention!
+You were warned!
+
+Authors: lots of them
+Author: Zubr
+
+**boldword**
+
+Some brief description,
+extended to many lines.
+
+Not everything works right now...
+``codeword``
+
+
+
+
+
+'citationword'
+
+.. code-block:: c++
+
+ some test code
+
+Code immediately following text. Pydoc translation must add an
+empty line before:
+
+.. code-block:: c++
+
+ more test code""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func02),
+r"""Conditional comment: SOMECONDITION
+Some conditional comment
+End of conditional comment.
+
+
+
+
+
+
+
+Copyright: some copyright
+
+1970 - 2012
+
+
+
+
+
+Deprecated: Now use another function
+
+This is very large
+and detailed description of some thing""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func03),
+r"""Comment for **func03()**.
+
+
+
+
+
+
+
+
+
+*italicword*
+
+emphazedWord
+
+
+
+Example: someFile.txt
+Some details on using the example""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func04),
+r""":raises: SuperError
+
+
+
+:math:`\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}`
+
+.. math::
+
+ \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
+
+.. math::
+
+ \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
+
+Math immediately following text. Pydoc translation must add an
+empty line before:
+
+.. math::
+
+ \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
+
+
+
+
+
+
+
+
+
+
+
+This will only appear in hmtl""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func05),
+r"""If: ANOTHERCONDITION {
+ First part of comment
+ If: SECONDCONDITION {
+ Nested condition text
+ }Else if: THIRDCONDITION {
+ The third condition text
+ }Else: { The last text block
+ }
+}Else: { Second part of comment
+ If: CONDITION {
+ Second part extended
+ }
+}
+
+If not: SOMECONDITION {
+ This is printed if not
+}
+
+Image: testImage.bmp("Hello, world!")
+
+
+
+
+
+
+
+
+
+
+
+Some text
+describing invariant.""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func06),
+r"""Comment for **func06()**.
+
+
+
+
+This will only appear in LATeX
+
+
+
+
+* Some unordered list
+* With lots of items
+* lots of lots of items
+
+
+
+
+someMember Some description follows
+
+
+
+
+This will only appear in man""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func07),
+r"""Comment for **func07()**.
+
+
+
+
+
+
+Notes: Here
+is the note!
+
+This is an overloaded member function, provided for convenience.
+It differs from the above function only in what argument(s) it accepts.
+
+someword
+
+
+
+
+
+Title: The paragraph title
+The paragraph text.
+Maybe even multiline
+
+
+
+:type a: int
+:param a: the first param""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func08),
+r"""Text after anchor.
+
+
+
+
+
+
+'Anchor description'
+
+'someAnchor' not quoted text is not part of ref tag
+
+'someAnchor'
+
+
+
+
+
+
+
+
+
+Remarks: Some remark text
+
+Another remarks section
+
+:rtype: void
+:return: Whatever
+
+:rtype: void
+:return: it
+
+:rtype: void
+:return: may return""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func09),
+r"""This will only appear in RTF
+
+
+See also: someOtherMethod
+
+
+
+See also: function
+
+Same as
+brief description
+
+
+
+Since: version 0.0.0.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+:raises: superException
+
+:raises: RuntimeError""")
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func10),
+r"""TODO: Some very important task
+
+:type b: float
+:param b: B is mentioned again...
+
+
+
+
+
+
+very long
+text with tags <sometag>
+
+
+
+Version: 0.0.0.2
+
+Warning: This is senseless!
+
+
+
+
+This will only appear in XML
+
+
+Here goes test of symbols:
+$ @ \ & ~ < > # % " . ::
+
+And here goes simple text""")
diff --git a/Examples/test-suite/python/doxygen_translate_links_runme.py b/Examples/test-suite/python/doxygen_translate_links_runme.py
new file mode 100644
index 000000000..89f276f6e
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_translate_links_runme.py
@@ -0,0 +1,38 @@
+import doxygen_translate_links
+import inspect
+import string
+import sys
+import comment_verifier
+
+
+comment_verifier.check(inspect.getdoc(doxygen_translate_links.function),
+r"""Testing typenames converting in @ link
+
+superFunc(int,std::string)
+Test for std_string member
+
+
+superFunc(int,long,void*)
+Test for simple types
+
+
+superFunc(Shape::superType*)
+Test for custom types
+
+
+superFunc(int**[13])
+Test for complex types
+
+
+same works for 'See also:' links:
+
+See also: superFunc(int,std::string)
+See also: superFunc(int,long,void*)
+See also: superFunc(Shape::superType*)
+See also: superFunc(int**[13])
+
+some failing params:
+
+See also: superFunc()
+See also: superFunc()
+See also: superFunc()""")
diff --git a/Examples/test-suite/python/doxygen_translate_runme.py b/Examples/test-suite/python/doxygen_translate_runme.py
new file mode 100644
index 000000000..d698ba873
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_translate_runme.py
@@ -0,0 +1,260 @@
+import doxygen_translate
+import inspect
+import string
+import sys
+import comment_verifier
+
+
+comment_verifier.check(inspect.getdoc(doxygen_translate.function),
+r"""*Hello*
+
+* some list item
+
+Authors: lots of them
+
+Author: Zubr
+
+**boldword**
+
+``codeword``
+
+'citationword'
+
+.. code-block:: c++
+
+ some test code
+
+Conditional comment: SOMECONDITION
+Some conditional comment
+End of conditional comment.
+
+Copyright: some copyright
+
+Deprecated: Now use another function
+
+*italicword*
+
+Example: someFile.txt
+Some details on using the example
+
+:raises: SuperError
+
+If: ANOTHERCONDITION {
+ First part of comment
+ If: SECONDCONDITION {
+ Nested condition text
+ }Else if: THIRDCONDITION {
+ The third condition text
+ }Else: { The last text block
+ }
+}Else: { Second part of comment
+ If: CONDITION {
+ Second part extended
+ }
+}
+
+If not: SOMECONDITION {
+ This is printed if not
+}
+
+Image: testImage.bmp("Hello, world!")
+
+
+
+* Some unordered list
+* With lots of items
+* lots of lots of items
+
+
+
+someMember Some description follows
+
+
+
+
+
+
+Notes: Here
+is the note!
+
+This is an overloaded member function, provided for convenience.
+It differs from the above function only in what argument(s) it accepts.
+
+someword
+
+
+
+Title: The paragraph title
+The paragraph text.
+Maybe even multiline
+
+:type a: int
+:param a: the first param
+
+Remarks: Some remark text
+
+Another remarks section
+
+:rtype: int
+:return: Whatever
+
+:rtype: int
+:return: it
+
+:rtype: int
+:return: may return
+
+See also: someOtherMethod
+
+See also: function
+
+Since: version 0.0.0.1
+
+:raises: superException
+
+:raises: RuntimeError
+
+TODO: Some very important task
+
+:type b: float
+:param b: B is mentioned again...
+
+very long
+text with tags <sometag>
+
+Version: 0.0.0.2
+
+Warning: This is senseless!
+
+Here goes test of symbols:
+$ @ \ & ~ < > # % " . ::
+
+And here goes simple text"""
+)
+
+
+
+comment_verifier.check(inspect.getdoc(doxygen_translate.htmlFunction),
+r"""Test for html tags. See Doxygen doc for list of tags recognized by Doxygen.
+
+This is link ("http://acme.com/index.html")
+**bold**
+Quote:
+Quotation block.
+ ("http://www.worldwildlife.org/who/index.html")
+
+
+center
+``this is code``
+
+
+Starts an item title.
+ Starts an item description.
+
+
+Starts a piece of text displayed in a typewriter font.
+
+Starts a section with a specific style (HTML only)
+
+**Starts a piece of text displayed in an italic font.**
+
+'Form' does not generate any output.
+
+--------------------------------------------------------------------
+
+# Heading 1
+
+## Heading 2
+
+### Heading 3
+
+*Starts a piece of text displayed in an italic font.*
+Input tag.
+Image: src="slika.png"
+Meta tag.
+Multicol is ignored by doxygen.
+
+
+
+* List item 1.
+* List item 2.
+
+
+
+Starts a new paragraph.
+
+Starts a preformatted fragment.
+
+Starts a section of text displayed in a smaller font.
+
+'Starts an inline text fragment with a specific style.'
+**Starts a section of bold text.**
+ Starts a piece of text displayed in subscript.
+ Starts a piece of text displayed in superscript.
+
+
+Animals
+| Column 1 | Column 2 |
+-----------------------
+| cow | dog |
+| cat | mouse |
+| horse | parrot |
+
+
+Starts a piece of text displayed in a typewriter font.
+
+Starts a piece of text displayed in a typewriter font.
+
+
+
+* List item 1.
+* List item 2.
+* List item 3.
+
+
+*Starts a piece of text displayed in an italic font.*
+
+
+<u>underlined \b bold text - doxy commands are ignored inside 'htmlonly' section </u>""")
+
+
+comment_verifier.check(inspect.getdoc(doxygen_translate.htmlTableFunction),
+r"""The meaning of flags:
+
+:type byFlags: int
+:param byFlags: bits marking required items:
+
+ | Size in bits| Items Required |
+ --------------------------------
+ | 1 - 8 | 1 |
+ | 9 - 16 | 2 |
+ | 17 - 32 | 4 |
+
+ Almost all combinations of above flags are supported by
+ ``htmlTable...`` functions.""")
+
+
+comment_verifier.check(inspect.getdoc(doxygen_translate.htmlEntitiesFunction),
+r"""All entities are treated as commands (C) TM (R)
+should work also<in text
+>
+&
+'
+"
+`
+'
+"
+"
+-
+--
+
+x
+-
+.
+~
+<=
+>=
+<--
+-->
+Not an html entity - ignored by Doxygen.
+Not an &text html entity - ampersand is replaced with entity.""")
diff --git a/Examples/test-suite/python/funcptr_cpp_runme.py b/Examples/test-suite/python/funcptr_cpp_runme.py
index eb113d226..22c50b4e9 100644
--- a/Examples/test-suite/python/funcptr_cpp_runme.py
+++ b/Examples/test-suite/python/funcptr_cpp_runme.py
@@ -8,3 +8,6 @@ if call3(ADD_BY_REFERENCE, 14, 15) != 29:
raise RuntimeError
if call1(ADD_BY_VALUE_C, 2, 3) != 5:
raise RuntimeError
+
+if callconst1(ADD_BY_VALUE_C, 2, 3) != 5:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/functors_runme.py b/Examples/test-suite/python/functors_runme.py
new file mode 100644
index 000000000..98945a047
--- /dev/null
+++ b/Examples/test-suite/python/functors_runme.py
@@ -0,0 +1,12 @@
+from functors import *
+
+a = Functor0(10)
+b = Functor1(10)
+c = Functor2(10)
+
+if a()!=-10:
+ raise RuntimeError("a failed")
+if b(1)!=11:
+ raise RuntimeError("b failed")
+if c(1, 2)!=13:
+ raise RuntimeError("c failed")
diff --git a/Examples/test-suite/python/global_namespace_runme.py b/Examples/test-suite/python/global_namespace_runme.py
index ac12fe2dc..a47f41047 100644
--- a/Examples/test-suite/python/global_namespace_runme.py
+++ b/Examples/test-suite/python/global_namespace_runme.py
@@ -1,9 +1,6 @@
from global_namespace import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
k1 = Klass1()
k2 = Klass2()
k3 = Klass3()
@@ -12,12 +9,8 @@ k5 = Klass5()
k6 = Klass6()
k7 = Klass7()
-if is_new_style_class(KlassMethods):
- KlassMethods_static = KlassMethods
-else:
- KlassMethods_static = KlassMethods()
-KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
-KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
k1 = getKlass1A()
k2 = getKlass2A()
@@ -27,8 +20,8 @@ k5 = getKlass5A()
k6 = getKlass6A()
k7 = getKlass7A()
-KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
-KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
k1 = getKlass1B()
k2 = getKlass2B()
@@ -38,21 +31,11 @@ k5 = getKlass5B()
k6 = getKlass6B()
k7 = getKlass7B()
-KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
-KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
-
-if is_new_style_class(XYZMethods):
- XYZMethods_static = XYZMethods
-else:
- XYZMethods_static = XYZMethods()
-XYZMethods_static.methodA(
- XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
-XYZMethods_static.methodB(
- XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
-
-if is_new_style_class(TheEnumMethods):
- TheEnumMethods_static = TheEnumMethods
-else:
- TheEnumMethods_static = TheEnumMethods()
-TheEnumMethods_static.methodA(theenum1, theenum2, theenum3)
-TheEnumMethods_static.methodA(theenum1, theenum2, theenum3)
+KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
+
+XYZMethods.methodA(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
+XYZMethods.methodB(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
+
+TheEnumMethods.methodA(theenum1, theenum2, theenum3)
+TheEnumMethods.methodA(theenum1, theenum2, theenum3)
diff --git a/Examples/test-suite/python/ignore_parameter_runme.py b/Examples/test-suite/python/ignore_parameter_runme.py
new file mode 100644
index 000000000..2b5c21235
--- /dev/null
+++ b/Examples/test-suite/python/ignore_parameter_runme.py
@@ -0,0 +1,23 @@
+from ignore_parameter import *
+
+def check(a, b):
+ if a != b:
+ raise RuntimeError("'%s' != '%s'" % (a, b))
+
+check(jaguar(200, 0), "hello")
+check(lotus("foo", 1), 101)
+check(tvr("bar", 2), 8.8)
+check(ferrari(), 101)
+check(fiat(17), 17)
+
+car = SportsCars()
+check(car.daimler(200, 0), "hello")
+check(car.astonmartin("foo", 1), 101)
+check(car.bugatti("bar", 2), 8.8)
+check(car.lamborghini(), 101)
+check(car.maseratti(289), 289)
+
+MiniCooper(200, 0)
+MorrisMinor("baz", 0)
+FordAnglia("quux", 200)
+AustinAllegro()
diff --git a/Examples/test-suite/python/implicittest_runme.py b/Examples/test-suite/python/implicittest_runme.py
index 4646d08c0..625613a95 100644
--- a/Examples/test-suite/python/implicittest_runme.py
+++ b/Examples/test-suite/python/implicittest_runme.py
@@ -6,9 +6,6 @@ def check(a, b):
raise RuntimeError(str(a) + " does not equal " + str(b))
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
#### Class ####
# No implicit conversion
@@ -16,15 +13,7 @@ check(1, A(1).get())
check(2, A(1.0).get())
check(3, A(B()).get())
check(4, A("hello").get())
-try:
- check(3, A(None).get())
- raise RuntimeError
-except ValueError:
- # ValueError: invalid null reference in method 'new_A', argument 1 of type 'B const &'
- # Arguably A(char *) should be chosen, but there is a bug to do with None passed to methods overloaded by value,
- # references and pointers to different types, where pointers ought to be
- # given a slightly higher precedence.
- pass
+check(4, A(None).get())
check(1, get(1))
check(2, get(1.0))
@@ -45,17 +34,13 @@ check(2, A_int(1.0).get())
check(3, A_int(B()).get())
check(4, A_int("hello").get())
-if is_new_style_class(A_int):
- A_int_static = A_int
-else:
- A_int_static = A_int(0)
-check(1, A_int_static.sget(1))
-check(2, A_int_static.sget(1.0))
-check(3, A_int_static.sget(B()))
+check(1, A_int.sget(1))
+check(2, A_int.sget(1.0))
+check(3, A_int.sget(B()))
# explicit constructor:
try:
- check(4, A_int_static.sget("hello"))
+ check(4, A_int.sget("hello"))
raise RuntimeError
except TypeError:
pass
diff --git a/Examples/test-suite/python/keyword_rename_runme.py b/Examples/test-suite/python/keyword_rename_runme.py
index 5646ce7d6..0bdd64b10 100644
--- a/Examples/test-suite/python/keyword_rename_runme.py
+++ b/Examples/test-suite/python/keyword_rename_runme.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python
import keyword_rename
keyword_rename._in(1)
+keyword_rename._in(_except=1)
keyword_rename._except(1)
+keyword_rename._except(_in=1)
diff --git a/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
index 9b9c7d683..adf9ac4cf 100644
--- a/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
+++ b/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
@@ -1,10 +1,6 @@
from li_boost_shared_ptr_bits import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-
def check(nd):
nd.i = 200
i = nd.i
@@ -35,7 +31,4 @@ if sum != 66:
raise "sum is wrong"
################################
-if is_new_style_class(HiddenDestructor):
- p = HiddenDestructor.create()
-else:
- p = HiddenDestructor_create()
+p = HiddenDestructor.create()
diff --git a/Examples/test-suite/python/li_boost_shared_ptr_director_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_director_runme.py
new file mode 100644
index 000000000..52868eacc
--- /dev/null
+++ b/Examples/test-suite/python/li_boost_shared_ptr_director_runme.py
@@ -0,0 +1,80 @@
+from li_boost_shared_ptr_director import *
+
+class Derived(Base):
+ def __init__(self, flag):
+ self.return_none = flag
+ Base.__init__(self)
+
+ def ret_c_shared_ptr(self):
+ if self.return_none:
+ return None
+ else:
+ return C()
+
+ def ret_c_by_value(self):
+ return C()
+
+ def take_c_by_value(self,c):
+ return c.get_m()
+
+ def take_c_by_ref(self,c):
+ return c.get_m()
+
+ def take_c_by_pointer(self,c):
+ if c:
+ return c.get_m()
+ else:
+ return -2
+
+ def take_c_by_pointer_ref(self,c):
+ if c:
+ return c.get_m()
+ else:
+ return -3
+
+ def take_c_shared_ptr_by_value(self,c):
+ if c:
+ return c.get_m()
+ else:
+ return -4
+
+ def take_c_shared_ptr_by_ref(self,c):
+ if c:
+ return c.get_m()
+ else:
+ return -5
+
+ def take_c_shared_ptr_by_pointer(self,c):
+ if c:
+ return c.get_m()
+ else:
+ return -6
+
+ def take_c_shared_ptr_by_pointer_ref(self,c):
+ if c:
+ return c.get_m()
+ else:
+ return -7
+
+a = Derived(False)
+b = Derived(True)
+
+assert call_ret_c_shared_ptr(a) == 1
+assert call_ret_c_shared_ptr(b) == -1
+assert call_ret_c_by_value(a) == 1
+
+assert call_take_c_by_value(a) == 5
+assert call_take_c_by_ref(a) == 6
+assert call_take_c_by_pointer(a) == 7
+assert call_take_c_by_pointer_ref(a) == 8
+assert call_take_c_shared_ptr_by_value(a) == 9
+assert call_take_c_shared_ptr_by_ref(a) == 10
+assert call_take_c_shared_ptr_by_pointer(a) == 11
+assert call_take_c_shared_ptr_by_pointer_ref(a) == 12
+
+assert call_take_c_by_pointer_with_null(a) == -2
+assert call_take_c_by_pointer_ref_with_null(a) == -3
+assert call_take_c_shared_ptr_by_value_with_null(a) == -4
+assert call_take_c_shared_ptr_by_ref_with_null(a) == -5
+assert call_take_c_shared_ptr_by_pointer_with_null(a) == -6
+assert call_take_c_shared_ptr_by_pointer_ref_with_null(a) == -7
diff --git a/Examples/test-suite/python/li_cstring_runme.py b/Examples/test-suite/python/li_cstring_runme.py
index 55b51d1c7..b718f1352 100644
--- a/Examples/test-suite/python/li_cstring_runme.py
+++ b/Examples/test-suite/python/li_cstring_runme.py
@@ -7,7 +7,7 @@ if count("ab\0ab\0ab\0", 0) != 3:
if test1() != "Hello World":
raise RuntimeError
-if test2() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
+if test2() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
raise RuntimeError
if test3("hello") != "hello-suffix":
@@ -18,14 +18,14 @@ if test4("hello") != "hello-suffix":
print test4("hello")
raise RuntimeError
-if test5(4) != 'xxxx':
+if test5(4) != "xxxx":
raise RuntimeError
-if test6(10) != 'xxxxx':
+if test6(10) != "xxxxx":
raise RuntimeError
if test7() != "Hello world!":
raise RuntimeError
-if test8() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
+if test8() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
raise RuntimeError
diff --git a/Examples/test-suite/python/li_cwstring_runme.py b/Examples/test-suite/python/li_cwstring_runme.py
index aaa5b6e62..5dd7b9b20 100644
--- a/Examples/test-suite/python/li_cwstring_runme.py
+++ b/Examples/test-suite/python/li_cwstring_runme.py
@@ -6,7 +6,7 @@ if count(u"ab\0ab\0ab\0", 0) != 3:
if test1() != u"Hello World":
raise RuntimeError
-if test2() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
+if test2() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
raise RuntimeError
if test3("hello") != u"hello-suffix":
@@ -15,14 +15,14 @@ if test3("hello") != u"hello-suffix":
if test4("hello") != u"hello-suffix":
raise RuntimeError
-if test5(4) != u'xxxx':
+if test5(4) != u"xxxx":
raise RuntimeError
-if test6(10) != u'xxxxx':
+if test6(10) != u"xxxxx":
raise RuntimeError
if test7() != u"Hello world!":
raise RuntimeError
-if test8() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
+if test8() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
raise RuntimeError
diff --git a/Examples/test-suite/python/li_std_containers_int_runme.py b/Examples/test-suite/python/li_std_containers_int_runme.py
index c7d262f60..941838a5f 100644
--- a/Examples/test-suite/python/li_std_containers_int_runme.py
+++ b/Examples/test-suite/python/li_std_containers_int_runme.py
@@ -84,16 +84,11 @@ def container_insert_step(i, j, step, newval):
except IndexError, e:
il_error = e
- # Python 2.6 contains bug fixes in extended slicing syntax:
- # http://docs.python.org/2/whatsnew/2.6.html
- skip_check = ps_error != None and(
- iv_error == il_error == None) and step > 0 and (sys.version_info[0:2] < (2, 6))
- if not(skip_check):
- if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
- raise RuntimeError, "ValueError exception not consistently thrown: " + \
- str(ps_error) + " " + str(iv_error) + " " + str(il_error)
-
- compare_containers(ps, iv, il)
+ if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
+ raise RuntimeError, "ValueError exception not consistently thrown: " + \
+ str(ps_error) + " " + str(iv_error) + " " + str(il_error)
+
+ compare_containers(ps, iv, il)
# Check std::vector and std::list delete behaves same as Python list
diff --git a/Examples/test-suite/python/li_std_containers_overload_runme.py b/Examples/test-suite/python/li_std_containers_overload_runme.py
new file mode 100644
index 000000000..dcb383511
--- /dev/null
+++ b/Examples/test-suite/python/li_std_containers_overload_runme.py
@@ -0,0 +1,29 @@
+from li_std_containers_overload import *
+
+def check(got, expected):
+ if got != expected:
+ raise RuntimeError("Failed check. '{}' != '{}'".format(got, expected))
+
+v = VectorX()
+check(VectorOverload(v), "vector<X>")
+
+v = VectorY()
+check(VectorOverload(v), "vector<Y>")
+
+v = VectorInt()
+check(VectorOverload(v), "vector<int>")
+
+v = VectorString()
+check(VectorOverload(v), "vector<string>")
+
+v = [X()]
+check(VectorOverload(v), "vector<X>")
+
+v = [Y()]
+check(VectorOverload(v), "vector<Y>")
+
+v = [1, 2, 3]
+check(VectorOverload(v), "vector<int>")
+
+v = ["aaa", "bbb", "ccc"]
+check(VectorOverload(v), "vector<string>")
diff --git a/Examples/test-suite/python/li_std_map_runme.py b/Examples/test-suite/python/li_std_map_runme.py
index af3e1d989..ac214dd45 100644
--- a/Examples/test-suite/python/li_std_map_runme.py
+++ b/Examples/test-suite/python/li_std_map_runme.py
@@ -50,3 +50,32 @@ mii[1] = 2
if mii[1] != 2:
raise RuntimeError
+
+if mii.keys() != [1]:
+ raise RuntimeError("keys")
+if mii.values() != [2]:
+ raise RuntimeError("values")
+if mii.items() != [(1, 2)]:
+ raise RuntimeError("items")
+
+if [k for k in mii] != [1]:
+ raise RuntimeError("iteration")
+
+if [i for i in mii.iterkeys()] != [1]:
+ raise RuntimeError("iterkeys")
+if [i for i in mii.itervalues()] != [2]:
+ raise RuntimeError("itervalues")
+if [i for i in mii.iteritems()] != [(1, 2)]:
+ raise RuntimeError("iteritems")
+
+
+slmap = li_std_map.StringLengthNumberMap()
+li_std_map.populate(slmap)
+
+keys = " ".join([k for k in slmap.keys()])
+if keys != "a aa zzz xxxx aaaaa":
+ raise RuntimeError("Keys are wrong or in wrong order: " + keys)
+
+values = " ".join([str(v) for v in slmap.values()])
+if values != "1 2 3 4 5":
+ raise RuntimeError("Values are wrong or in wrong order: " + values)
diff --git a/Examples/test-suite/python/li_std_set_runme.py b/Examples/test-suite/python/li_std_set_runme.py
index ad3c6d881..5e5b72442 100644
--- a/Examples/test-suite/python/li_std_set_runme.py
+++ b/Examples/test-suite/python/li_std_set_runme.py
@@ -54,6 +54,8 @@ if i.next() != 2:
if i.next() != 3:
raise RuntimeError
+if si[0] != 1:
+ raise RuntimeError
i = s.begin()
i.next()
@@ -88,5 +90,5 @@ sum = ()
for i in s:
sum = sum + (i,)
-if (len(sum) != 3 or (not 1 in sum) or (not 'hello' in sum) or (not (1, 2) in sum)):
+if (len(sum) != 3 or (not 1 in sum) or (not "hello" in sum) or (not (1, 2) in sum)):
raise RuntimeError
diff --git a/Examples/test-suite/python/li_std_string_extra_runme.py b/Examples/test-suite/python/li_std_string_extra_runme.py
index b65f0774a..087d92b19 100644
--- a/Examples/test-suite/python/li_std_string_extra_runme.py
+++ b/Examples/test-suite/python/li_std_string_extra_runme.py
@@ -19,7 +19,7 @@ if li_std_string_extra.test_const_reference(x) != x:
s = li_std_string_extra.string("he")
#s += "ll"
-# s.append('o')
+# s.append("o")
s = s + "llo"
if s != x:
@@ -87,6 +87,28 @@ if li_std_string_extra.test_value_basic2(x) != x:
if li_std_string_extra.test_value_basic3(x) != x:
raise RuntimeError, "bad string mapping"
+if li_std_string_extra.test_value_basic_overload(x) != x:
+ raise RuntimeError, "bad overload string"
+
+if li_std_string_extra.test_value_basic_overload(123) != "int":
+ raise RuntimeError, "bad overload int"
+
+try:
+ li_std_string_extra.test_value_basic_overload([x])
+ raise RuntimeError, "should throw TypeError"
+except TypeError as e:
+ if str(e).find("Possible C/C++ prototypes are:") == -1:
+ raise RuntimeError("Incorrect error message text:\n{}".format(e))
+ pass
+
+try:
+ li_std_string_extra.test_value_basic_overload([123])
+ raise RuntimeError, "should throw TypeError"
+except TypeError as e:
+ if str(e).find("Possible C/C++ prototypes are:") == -1:
+ raise RuntimeError("Incorrect error message text:\n{}".format(e))
+ pass
+
# Global variables
s = "initial string"
if li_std_string_extra.cvar.GlobalString2 != "global string 2":
diff --git a/Examples/test-suite/python/li_std_vector_back_reference_runme.py b/Examples/test-suite/python/li_std_vector_back_reference_runme.py
new file mode 100644
index 000000000..cec9e8cc4
--- /dev/null
+++ b/Examples/test-suite/python/li_std_vector_back_reference_runme.py
@@ -0,0 +1,10 @@
+from li_std_vector_back_reference import *
+
+def first_element():
+ v = VectorWheel((Wheel(11), Wheel(22)))
+ # v will be deleted after exit from this method
+ return v[0]
+
+size = first_element().size
+if size != 11:
+ raise RuntimeError("Back reference not working {}".format(size))
diff --git a/Examples/test-suite/python/li_std_vector_extra_runme.py b/Examples/test-suite/python/li_std_vector_extra_runme.py
index d541de6db..59e729a27 100644
--- a/Examples/test-suite/python/li_std_vector_extra_runme.py
+++ b/Examples/test-suite/python/li_std_vector_extra_runme.py
@@ -91,7 +91,7 @@ if v.size() != 0:
v = vecStr(["hello ", "world"])
-if v[0] != 'hello world':
+if v[0] != "hello world":
raise RuntimeError, "bad std::string+std::vector"
@@ -173,3 +173,11 @@ if extractConstShort(vcs[0]) != 111:
if extractConstShort(vcs[1]) != 222:
raise RuntimeError
+
+for p in vcs[0:1]:
+ if extractConstShort2(p) != 111:
+ raise RuntimeError
+
+for p in vcs[1:2]:
+ if extractConstShort2(p) != 222:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/li_std_vector_ptr_runme.py b/Examples/test-suite/python/li_std_vector_ptr_runme.py
index baa92cfee..875d1c9c9 100644
--- a/Examples/test-suite/python/li_std_vector_ptr_runme.py
+++ b/Examples/test-suite/python/li_std_vector_ptr_runme.py
@@ -4,12 +4,20 @@ def check(val1, val2):
if val1 != val2:
raise RuntimeError("Values are not the same %s %s" % (val1, val2))
ip1 = makeIntPtr(11)
-ip2 = makeIntPtr(22)
+ip2 = makeIntPtr2(22)
vi = IntPtrVector((ip1, ip2))
check(getValueFromVector(vi, 0), 11)
check(getValueFromVector(vi, 1), 22)
+check(getIntValue(vi[0]), 11)
+check(getIntValue(vi[1]), 22)
+check(getIntValue2(vi[0]), 11)
+check(getIntValue2(vi[1]), 22)
+
+ipp = makeIntPtrPtr(vi[0])
+check(getIntValue3(ipp), 11) # Note: getIntValue3 takes int**
+
vA = APtrVector([makeA(33), makeA(34)])
check(getVectorValueA(vA, 0), 33)
diff --git a/Examples/test-suite/python/li_std_wstring_inherit_runme.py b/Examples/test-suite/python/li_std_wstring_inherit_runme.py
new file mode 100644
index 000000000..558914e7e
--- /dev/null
+++ b/Examples/test-suite/python/li_std_wstring_inherit_runme.py
@@ -0,0 +1,45 @@
+import li_std_wstring_inherit
+import sys
+
+x = u"hello"
+
+s = li_std_wstring_inherit.wstring(u"he")
+s = s + u"llo"
+
+if s != x:
+ print s, x
+ raise RuntimeError("bad string mapping")
+
+if s[1:4] != x[1:4]:
+ raise RuntimeError("bad string mapping")
+
+a = li_std_wstring_inherit.A(s)
+b = li_std_wstring_inherit.wstring(" world")
+
+if a + b != "hello world":
+ raise RuntimeError("bad string mapping")
+
+if a + " world" != "hello world":
+ raise RuntimeError("bad string mapping")
+
+# This is expected to fail if -builtin is used
+# Reverse operators not supported in builtin types
+if not li_std_wstring_inherit.is_python_builtin():
+ if "hello" + b != "hello world":
+ raise RuntimeError("bad string mapping")
+
+ c = "hello" + b
+ if c.find_last_of("l") != 9:
+ raise RuntimeError("bad string mapping")
+
+b = li_std_wstring_inherit.B("hi")
+
+b.name = li_std_wstring_inherit.wstring(u"hello")
+if b.name != "hello":
+ raise RuntimeError("bad string mapping")
+
+
+b.a = li_std_wstring_inherit.A("hello")
+if b.a != u"hello":
+ raise RuntimeError("bad string mapping")
+
diff --git a/Examples/test-suite/python/li_std_wstring_runme.py b/Examples/test-suite/python/li_std_wstring_runme.py
index e93196b80..c6210e2de 100644
--- a/Examples/test-suite/python/li_std_wstring_runme.py
+++ b/Examples/test-suite/python/li_std_wstring_runme.py
@@ -1,83 +1,79 @@
import li_std_wstring
-
-x = u"h"
-
-if li_std_wstring.test_wcvalue(x) != x:
- print li_std_wstring.test_wcvalue(x)
- raise RuntimeError("bad string mapping")
-
-x = u"hello"
-if li_std_wstring.test_ccvalue(x) != x:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_cvalue(x) != x:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_wchar_overload(x) != x:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_wchar_overload("not unicode") != "not unicode":
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_value(x) != x:
- print x, li_std_wstring.test_value(x)
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_const_reference(x) != x:
- raise RuntimeError("bad string mapping")
-
-
-s = li_std_wstring.wstring(u"he")
-s = s + u"llo"
-
-if s != x:
- print s, x
- raise RuntimeError("bad string mapping")
-
-if s[1:4] != x[1:4]:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_value(s) != x:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_const_reference(s) != x:
- raise RuntimeError("bad string mapping")
-
-a = li_std_wstring.A(s)
-
-if li_std_wstring.test_value(a) != x:
- raise RuntimeError("bad string mapping")
-
-if li_std_wstring.test_const_reference(a) != x:
- raise RuntimeError("bad string mapping")
-
-b = li_std_wstring.wstring(" world")
-
-if a + b != "hello world":
- raise RuntimeError("bad string mapping")
-
-if a + " world" != "hello world":
- raise RuntimeError("bad string mapping")
-
-# This is expected to fail if -builtin is used
-# Reverse operators not supported in builtin types
-if not li_std_wstring.is_python_builtin():
- if "hello" + b != "hello world":
+import sys
+
+def check_equal(a, b):
+ if a != b:
+ raise RuntimeError("failed {} {}".format(a, b))
+
+h = u"h"
+check_equal(li_std_wstring.test_wcvalue(h), h)
+
+x = u"abc"
+check_equal(li_std_wstring.test_ccvalue(x), x)
+check_equal(li_std_wstring.test_cvalue(x), x)
+
+check_equal(li_std_wstring.test_wchar_overload(x), x)
+check_equal(li_std_wstring.test_wchar_overload(), None)
+
+li_std_wstring.test_pointer(None)
+li_std_wstring.test_const_pointer(None)
+
+try:
+ li_std_wstring.test_value(None)
+ raise RuntimeError("NULL check failed")
+except TypeError as e:
+ pass
+
+try:
+ li_std_wstring.test_reference(None)
+ raise RuntimeError("NULL check failed")
+except ValueError as e:
+ if "invalid null reference" not in str(e):
+ raise RuntimeError("Missing text {}".format(e))
+try:
+ li_std_wstring.test_const_reference(None)
+ raise RuntimeError("NULL check failed")
+except ValueError as e:
+ if "invalid null reference" not in str(e):
+ raise RuntimeError("Missing text {}".format(e))
+
+x = "hello"
+check_equal(li_std_wstring.test_const_reference(x), x)
+
+s = "abc"
+if not li_std_wstring.test_equal_abc(s):
+ raise RuntimeError("Not equal {}".format(s))
+
+try:
+ li_std_wstring.test_throw
+except RuntimeError as e:
+ check_equal(e.message, "throwing test_throw")
+
+x = "abc\0def"
+check_equal(li_std_wstring.test_value(x), x)
+check_equal(li_std_wstring.test_ccvalue(x), "abc")
+check_equal(li_std_wstring.test_wchar_overload(x), "abc")
+
+################### Python specific
+
+# Byte strings only converted in Python 2
+if sys.version_info[0:2] < (3, 0):
+ x = b"hello there"
+ if li_std_wstring.test_value(x) != x:
raise RuntimeError("bad string mapping")
- c = "hello" + b
- if c.find_last_of("l") != 9:
- raise RuntimeError("bad string mapping")
-
-s = "hello world"
-
-b = li_std_wstring.B("hi")
-
-b.name = li_std_wstring.wstring(u"hello")
-if b.name != "hello":
- raise RuntimeError("bad string mapping")
-
-
-b.a = li_std_wstring.A("hello")
-if b.a != u"hello":
- raise RuntimeError("bad string mapping")
+# Invalid utf-8 in a byte string fails in all versions
+x = b"h\xe9llo"
+try:
+ li_std_wstring.test_value(x)
+ raise RuntimeError("TypeError not thrown")
+except TypeError:
+ pass
+
+# Check surrogateescape
+if sys.version_info[0:2] > (3, 1):
+ x = u"h\udce9llo" # surrogate escaped representation of C char*: "h\xe9llo"
+ if li_std_wstring.non_utf8_c_str() != x:
+ raise RuntimeError("surrogateescape not working")
+ if li_std_wstring.size_wstring(x) != 5 and len(x) != 5:
+ raise RuntimeError("Unexpected length")
diff --git a/Examples/test-suite/python/member_pointer_const_runme.py b/Examples/test-suite/python/member_pointer_const_runme.py
new file mode 100644
index 000000000..ad6c2df99
--- /dev/null
+++ b/Examples/test-suite/python/member_pointer_const_runme.py
@@ -0,0 +1,51 @@
+# Example using pointers to member functions
+
+from member_pointer_const import *
+
+
+def check(what, expected, actual):
+ if expected != actual:
+ raise RuntimeError(
+ "Failed: ", what, " Expected: ", expected, " Actual: ", actual)
+
+# Get the pointers
+
+area_pt = areapt()
+perim_pt = perimeterpt()
+
+# Create some objects
+
+s = Square(10)
+
+# Do some calculations
+
+check("Square area ", 100.0, do_op(s, area_pt))
+check("Square perim", 40.0, do_op(s, perim_pt))
+
+memberPtr = cvar.areavar
+memberPtr = cvar.perimetervar
+
+# Try the variables
+check("Square area ", 100.0, do_op(s, cvar.areavar))
+check("Square perim", 40.0, do_op(s, cvar.perimetervar))
+
+# Modify one of the variables
+cvar.areavar = perim_pt
+
+check("Square perimeter", 40.0, do_op(s, cvar.areavar))
+
+# Try the constants
+
+memberPtr = AREAPT
+memberPtr = PERIMPT
+memberPtr = NULLPT
+
+check("Square area ", 100.0, do_op(s, AREAPT))
+check("Square perim", 40.0, do_op(s, PERIMPT))
+
+# Typedefs
+check("Square perim", 40.0, do_op_td(s, perim_pt));
+
+check("Add by value", 3, call1(ADD_BY_VALUE, 1, 2))
+#check("Add by pointer", 7, call2(ADD_BY_POINTER, 3, 4))
+#check("Add by reference", 11, call3(ADD_BY_REFERENCE, 5, 6))
diff --git a/Examples/test-suite/python/member_pointer_runme.py b/Examples/test-suite/python/member_pointer_runme.py
index 5ae7ab9a4..f6f165863 100644
--- a/Examples/test-suite/python/member_pointer_runme.py
+++ b/Examples/test-suite/python/member_pointer_runme.py
@@ -43,6 +43,9 @@ memberPtr = NULLPT
check("Square area ", 100.0, do_op(s, AREAPT))
check("Square perim", 40.0, do_op(s, PERIMPT))
+# Typedefs
+check("Square perim", 40.0, do_op_td(s, perim_pt));
+
check("Add by value", 3, call1(ADD_BY_VALUE, 1, 2))
check("Add by pointer", 7, call2(ADD_BY_POINTER, 3, 4))
check("Add by reference", 11, call3(ADD_BY_REFERENCE, 5, 6))
diff --git a/Examples/test-suite/python/namespace_class_runme.py b/Examples/test-suite/python/namespace_class_runme.py
index e0bd3ca09..aa5165562 100644
--- a/Examples/test-suite/python/namespace_class_runme.py
+++ b/Examples/test-suite/python/namespace_class_runme.py
@@ -1,9 +1,5 @@
from namespace_class import *
-
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
try:
p = Private1()
error = 1
@@ -22,10 +18,7 @@ except:
if (error):
raise RuntimeError, "Private2 is private"
-if is_new_style_class(EulerT3D):
- EulerT3D.toFrame(1, 1, 1)
-else:
- EulerT3D().toFrame(1, 1, 1)
+EulerT3D.toFrame(1, 1, 1)
b = BooT_i()
b = BooT_H()
@@ -40,7 +33,6 @@ f.moo(1)
f = FooT_H()
f.foo(Hi)
-if is_new_style_class(FooT_H):
- f_type = str(type(f))
- if f_type.find("'namespace_class.FooT_H'") == -1:
- raise RuntimeError("Incorrect type: " + f_type)
+f_type = str(type(f))
+if f_type.find("'namespace_class.FooT_H'") == -1:
+ raise RuntimeError("Incorrect type: " + f_type)
diff --git a/Examples/test-suite/python/nested_in_template_runme.py b/Examples/test-suite/python/nested_in_template_runme.py
new file mode 100644
index 000000000..69afd1604
--- /dev/null
+++ b/Examples/test-suite/python/nested_in_template_runme.py
@@ -0,0 +1,5 @@
+from nested_in_template import *
+
+cd = ConcreteDerived(88)
+if cd.m_value != 88:
+ raise RuntimeError("ConcreteDerived not created correctly")
diff --git a/Examples/test-suite/python/nested_runme.py b/Examples/test-suite/python/nested_runme.py
new file mode 100644
index 000000000..0e839e64b
--- /dev/null
+++ b/Examples/test-suite/python/nested_runme.py
@@ -0,0 +1,20 @@
+from nested import *
+
+def check(a, b):
+ if a != b:
+ raise RuntimeError("Problem: {} != {}".format(a, b))
+xx = x_t()
+yy = y_t()
+aa = a_t()
+bb = b_t()
+cc = c_t()
+dd = d_t()
+
+set_union_values(100, xx, yy, aa, bb, cc, dd)
+
+check(xx.duplicate_p.x, 100)
+check(yy.duplicate_p.y, 101)
+check(aa.duplicate_p.a, 102)
+check(bb.duplicate_p.b, 103)
+check(cc.duplicate_p.c, 104)
+check(dd.duplicate_p.d, 105)
diff --git a/Examples/test-suite/python/operator_overload_runme.py b/Examples/test-suite/python/operator_overload_runme.py
index cf4277f35..31c49058e 100644
--- a/Examples/test-suite/python/operator_overload_runme.py
+++ b/Examples/test-suite/python/operator_overload_runme.py
@@ -75,3 +75,10 @@ if not -a==a:
if not -b==Op(-5):
raise RuntimeError("-b==Op(-5)")
+# test functors
+if not b()==5:
+ raise RuntimeError("functor")
+if not b(1)==6:
+ raise RuntimeError("functor")
+if not b(1, 2)==8:
+ raise RuntimeError("functor")
diff --git a/Examples/test-suite/python/overload_complicated_runme.py b/Examples/test-suite/python/overload_complicated_runme.py
index 9c039a0a5..2593c4f16 100644
--- a/Examples/test-suite/python/overload_complicated_runme.py
+++ b/Examples/test-suite/python/overload_complicated_runme.py
@@ -5,11 +5,11 @@ pInt = None
# Check the correct constructors are available
p = Pop(pInt)
-p = Pop(pInt, 0)
+p = Pop(pInt, False)
# Check overloaded in const only and pointers/references which target
# languages cannot disambiguate
-if p.hip(0) != 701:
+if p.hip(False) != 701:
raise RuntimeError, "Test 1 failed"
if p.hip(pInt) != 702:
@@ -19,14 +19,14 @@ if p.hip(pInt) != 702:
if p.hop(pInt) != 805:
raise RuntimeError, "Test 3 failed"
-if p.hop(0) != 801:
+if p.hop(False) != 801:
raise RuntimeError, "Test 4 failed"
# Few more variations and order shuffled
-if p.pop(0) != 901:
+if p.pop(False) != 901:
raise RuntimeError, "Test 5 failed"
-if p.pop(pInt) != 902:
+if p.pop(pInt) != 904:
raise RuntimeError, "Test 6 failed"
if p.pop() != 905:
@@ -36,11 +36,11 @@ if p.pop() != 905:
if p.bop(pInt) != 1001:
raise RuntimeError, "Test 8 failed"
-if p.bip(pInt) != 2001:
+if p.bip(pInt) != 2002:
raise RuntimeError, "Test 9 failed"
# Globals
-if muzak(0) != 3001:
+if muzak(False) != 3001:
raise RuntimeError, "Test 10 failed"
if muzak(pInt) != 3002:
diff --git a/Examples/test-suite/python/overload_null_runme.py b/Examples/test-suite/python/overload_null_runme.py
new file mode 100644
index 000000000..a34524255
--- /dev/null
+++ b/Examples/test-suite/python/overload_null_runme.py
@@ -0,0 +1,44 @@
+from overload_null import *
+
+def check(a, b):
+ if a != b:
+ raise RuntimeError(str(a) + " does not equal " + str(b))
+
+o = Overload()
+x = X()
+
+check(1, o.byval1(x))
+check(2, o.byval1(None))
+
+check(3, o.byval2(None))
+check(4, o.byval2(x))
+
+check(5, o.byref1(x))
+check(6, o.byref1(None))
+
+check(7, o.byref2(None))
+check(8, o.byref2(x))
+
+check(9, o.byconstref1(x))
+check(10, o.byconstref1(None))
+
+check(11, o.byconstref2(None))
+check(12, o.byconstref2(x))
+
+# const pointer references
+check(13, o.byval1cpr(x))
+check(14, o.byval1cpr(None))
+
+check(15, o.byval2cpr(None))
+check(16, o.byval2cpr(x))
+
+# forward class declaration
+check(17, o.byval1forwardptr(x))
+check(18, o.byval1forwardptr(None))
+
+check(19, o.byval2forwardptr(None))
+check(20, o.byval2forwardptr(x))
+
+check(21, o.byval1forwardref(x))
+
+check(22, o.byval2forwardref(x))
diff --git a/Examples/test-suite/python/overload_template_fast_runme.py b/Examples/test-suite/python/overload_template_fast_runme.py
index 95349a9b1..ca3cac9b5 100644
--- a/Examples/test-suite/python/overload_template_fast_runme.py
+++ b/Examples/test-suite/python/overload_template_fast_runme.py
@@ -1,9 +1,5 @@
from overload_template_fast import *
-
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
f = foo()
a = maximum(3, 4)
@@ -145,9 +141,6 @@ if (nsoverload() != 1050):
raise RuntimeError, ("nsoverload(const char *)")
-if is_new_style_class(A):
- A.foo(1)
-else:
- A_foo(1)
+A.foo(1)
b = B()
b.foo(1)
diff --git a/Examples/test-suite/python/preproc_gcc_output_runme.py b/Examples/test-suite/python/preproc_gcc_output_runme.py
new file mode 100644
index 000000000..66ff7d21a
--- /dev/null
+++ b/Examples/test-suite/python/preproc_gcc_output_runme.py
@@ -0,0 +1,5 @@
+import preproc_gcc_output
+
+preproc_gcc_output.header1_function_a(99)
+preproc_gcc_output.header1_function_b(99)
+preproc_gcc_output.header2_function(99)
diff --git a/Examples/test-suite/python/preproc_runme.py b/Examples/test-suite/python/preproc_runme.py
index 99a6d0307..071362bc3 100644
--- a/Examples/test-suite/python/preproc_runme.py
+++ b/Examples/test-suite/python/preproc_runme.py
@@ -14,3 +14,6 @@ if 2 * preproc.one != preproc.two:
if preproc.methodX(99) != 199:
raise RuntimeError
+
+t1 = preproc.tcxMessageTest()
+t2 = preproc.tcxMessageBug()
diff --git a/Examples/test-suite/python/primitive_ref_runme.py b/Examples/test-suite/python/primitive_ref_runme.py
index f3a640389..2f1a5144c 100644
--- a/Examples/test-suite/python/primitive_ref_runme.py
+++ b/Examples/test-suite/python/primitive_ref_runme.py
@@ -33,7 +33,7 @@ if ref_double(3.5) != 3.5:
if ref_bool(True) != True:
raise RuntimeError
-if ref_char('x') != 'x':
+if ref_char("x") != "x":
raise RuntimeError
if ref_over(0) != 0:
diff --git a/Examples/test-suite/python/primitive_types_runme.py b/Examples/test-suite/python/primitive_types_runme.py
index b2060a028..04588ddf2 100644
--- a/Examples/test-suite/python/primitive_types_runme.py
+++ b/Examples/test-suite/python/primitive_types_runme.py
@@ -227,7 +227,7 @@ t.var_paramc = sct_paramc
t.v_check()
# this value contains a '0' char!
-if def_namet != 'hola':
+if def_namet != "hola":
print "bad namet", def_namet
raise RuntimeError
@@ -236,54 +236,54 @@ if t.var_namet != def_namet:
print "bad namet", t.var_namet, def_namet
raise RuntimeError
-t.var_namet = 'hola'
+t.var_namet = "hola"
-if t.var_namet != 'hola':
+if t.var_namet != "hola":
print "bad namet", t.var_namet
raise RuntimeError
-t.var_namet = 'hol'
+t.var_namet = "hol"
-if t.var_namet != 'hol':
- # if t.var_namet != 'hol\0\0':
+if t.var_namet != "hol":
+ # if t.var_namet != "hol\0\0":
print "bad namet", t.var_namet
raise RuntimeError
-cvar.var_char = '\0'
-if cvar.var_char != '\0':
+cvar.var_char = "\0"
+if cvar.var_char != "\0":
raise RuntimeError, "bad char '0' case"
cvar.var_char = 0
-if cvar.var_char != '\0':
+if cvar.var_char != "\0":
raise RuntimeError, "bad char '0' case"
-cvar.var_namet = '\0'
-# if cvar.var_namet != '\0\0\0\0\0':
-if cvar.var_namet != '':
- print 'hola', '', cvar.var_namet
+cvar.var_namet = "\0"
+# if cvar.var_namet != "\0\0\0\0\0":
+if cvar.var_namet != "":
+ print "hola", "", cvar.var_namet
raise RuntimeError, "bad char '\0' case"
-cvar.var_namet = ''
-# if cvar.var_namet != '\0\0\0\0\0':
-if cvar.var_namet != '':
+cvar.var_namet = ""
+# if cvar.var_namet != "\0\0\0\0\0":
+if cvar.var_namet != "":
raise RuntimeError, "bad char empty case"
cvar.var_pchar = None
if cvar.var_pchar != None:
raise RuntimeError, "bad None case"
-cvar.var_pchar = ''
-if cvar.var_pchar != '':
- print '%c' % (cvar.var_pchar[0],)
+cvar.var_pchar = ""
+if cvar.var_pchar != "":
+ print "%c" % (cvar.var_pchar[0],)
raise RuntimeError, "bad char empty case"
cvar.var_pcharc = None
if cvar.var_pcharc != None:
raise RuntimeError, "bad None case"
-cvar.var_pcharc = ''
-if cvar.var_pcharc != '':
+cvar.var_pcharc = ""
+if cvar.var_pcharc != "":
raise RuntimeError, "bad char empty case"
@@ -291,10 +291,10 @@ if cvar.var_pcharc != '':
# creating a raw char*
#
pc = new_pchar(5)
-pchar_setitem(pc, 0, 'h')
-pchar_setitem(pc, 1, 'o')
-pchar_setitem(pc, 2, 'l')
-pchar_setitem(pc, 3, 'a')
+pchar_setitem(pc, 0, "h")
+pchar_setitem(pc, 1, "o")
+pchar_setitem(pc, 2, "l")
+pchar_setitem(pc, 3, "a")
pchar_setitem(pc, 4, 0)
@@ -331,7 +331,7 @@ if error:
try:
error = 0
a = t.var_char
- t.var_char = '23'
+ t.var_char = "23"
error = 1
except TypeError:
if a != t.var_char:
@@ -393,7 +393,7 @@ if error:
try:
error = 0
a = t.var_namet
- t.var_namet = '123456'
+ t.var_namet = "123456"
error = 1
except TypeError:
if a != t.var_namet:
@@ -410,11 +410,11 @@ if t.var_namet != t2.var_namet:
raise RuntimeError, "bad SWIGTYPE* typemap"
-if cvar.fixsize != 'ho\0la\0\0\0':
+if cvar.fixsize != "ho\0la\0\0\0":
raise RuntimeError, "bad FIXSIZE typemap"
-cvar.fixsize = 'ho'
-if cvar.fixsize != 'ho\0\0\0\0\0\0':
+cvar.fixsize = "ho"
+if cvar.fixsize != "ho\0\0\0\0\0\0":
raise RuntimeError, "bad FIXSIZE typemap"
@@ -487,26 +487,26 @@ def checkType(t, e, val, delta):
"""t = Test object, e = type name (e.g. ulong), val = max or min allowed value, delta = +1 for max, -1 for min"""
error = 0
# Set the extreme valid value for var_*
- setattr(t, 'var_' + e, val)
+ setattr(t, "var_" + e, val)
# Make sure it was set properly and works properly in the val_* and ref_* methods
- if getattr(t, 'var_' + e) != val or getattr(t, 'val_' + e)(val) != val or getattr(t, 'ref_' + e)(val) != val:
+ if getattr(t, "var_" + e) != val or getattr(t, "val_" + e)(val) != val or getattr(t, "ref_" + e)(val) != val:
error = 1
# Make sure setting a more extreme value fails without changing the value
try:
- a = getattr(t, 'var_' + e)
- setattr(t, 'var_' + e, val + delta)
+ a = getattr(t, "var_" + e)
+ setattr(t, "var_" + e, val + delta)
error = 1
except OverflowError:
- if a != getattr(t, 'var_' + e):
+ if a != getattr(t, "var_" + e):
error = 1
# Make sure the val_* and ref_* methods fail with a more extreme value
try:
- getattr(t, 'val_' + e)(val + delta)
+ getattr(t, "val_" + e)(val + delta)
error = 1
except OverflowError:
pass
try:
- getattr(t, 'ref_' + e)(val + delta)
+ getattr(t, "ref_" + e)(val + delta)
error = 1
except OverflowError:
pass
@@ -518,16 +518,16 @@ def checkFull(t, e, maxval, minval):
checkType(t, e, maxval, 1)
checkType(t, e, minval, -1)
-checkFull(t, 'llong', maxllong, minllong)
-checkFull(t, 'long', maxlong, minlong)
-checkFull(t, 'int', maxint, minint)
-checkFull(t, 'short', maxshort, minshort)
-checkFull(t, 'schar', maxchar, minchar)
-checkFull(t, 'ullong', maxullong, 0)
-checkFull(t, 'ulong', maxulong, 0)
-checkFull(t, 'uint', maxuint, 0)
-checkFull(t, 'ushort', maxushort, 0)
-checkFull(t, 'uchar', maxuchar, 0)
+checkFull(t, "llong", maxllong, minllong)
+checkFull(t, "long", maxlong, minlong)
+checkFull(t, "int", maxint, minint)
+checkFull(t, "short", maxshort, minshort)
+checkFull(t, "schar", maxchar, minchar)
+checkFull(t, "ullong", maxullong, 0)
+checkFull(t, "ulong", maxulong, 0)
+checkFull(t, "uint", maxuint, 0)
+checkFull(t, "ushort", maxushort, 0)
+checkFull(t, "uchar", maxuchar, 0)
def checkOverload(t, name, val, delta, prevval, limit):
"""
@@ -549,28 +549,23 @@ def checkOverload(t, name, val, delta, prevval, limit):
if t.ovr_str(val + delta) == name:
raise RuntimeError, "bad " + name + " typemap"
if val == limit:
- # Should raise NotImplementedError here since this is the largest integral type
- raise RuntimeError, "bad " + name + " typemap"
- except NotImplementedError:
- # NotImplementedError is expected only if this is the most extreme type
- if val != limit:
+ # Should raise TypeError here since this is the largest integral type
raise RuntimeError, "bad " + name + " typemap"
except TypeError:
- # TypeError is raised instead if swig is run with -O or -fastdispatch
if val != limit:
raise RuntimeError, "bad " + name + " typemap"
# Check that overloading works: uchar > schar > ushort > short > uint > int > ulong > long > ullong > llong
-checkOverload(t, 'uchar', maxuchar, +1, 0, maxullong)
-checkOverload(t, 'ushort', maxushort, +1, maxuchar, maxullong)
-checkOverload(t, 'uint', maxuint, +1, maxushort, maxullong)
-checkOverload(t, 'ulong', maxulong, +1, maxuint, maxullong)
-checkOverload(t, 'ullong', maxullong, +1, maxulong, maxullong)
-checkOverload(t, 'schar', minchar, -1, 0, minllong)
-checkOverload(t, 'short', minshort, -1, minchar, minllong)
-checkOverload(t, 'int', minint, -1, minshort, minllong)
-checkOverload(t, 'long', minlong, -1, minint, minllong)
-checkOverload(t, 'llong', minllong, -1, minlong, minllong)
+checkOverload(t, "uchar", maxuchar, +1, 0, maxullong)
+checkOverload(t, "ushort", maxushort, +1, maxuchar, maxullong)
+checkOverload(t, "uint", maxuint, +1, maxushort, maxullong)
+checkOverload(t, "ulong", maxulong, +1, maxuint, maxullong)
+checkOverload(t, "ullong", maxullong, +1, maxulong, maxullong)
+checkOverload(t, "schar", minchar, -1, 0, minllong)
+checkOverload(t, "short", minshort, -1, minchar, minllong)
+checkOverload(t, "int", minint, -1, minshort, minllong)
+checkOverload(t, "long", minlong, -1, minint, minllong)
+checkOverload(t, "llong", minllong, -1, minlong, minllong)
# Make sure that large ints can be converted to doubles properly
if val_double(sys.maxint + 1) != float(sys.maxint + 1):
diff --git a/Examples/test-suite/python/python_abstractbase_runme3.py b/Examples/test-suite/python/python_abstractbase_runme3.py
index 4fdc79935..9f99dcb54 100644
--- a/Examples/test-suite/python/python_abstractbase_runme3.py
+++ b/Examples/test-suite/python/python_abstractbase_runme3.py
@@ -1,5 +1,11 @@
+import sys
+
+# collections.abc requires Python 3.3+
+if sys.version_info[0:2] < (3, 3):
+ exit(0)
+
from python_abstractbase import *
-from collections import *
+import collections.abc
# This is expected to fail with -builtin option
# Builtin types can't inherit from pure-python abstract bases
@@ -10,12 +16,16 @@ if is_python_builtin():
if not is_swig_py3:
exit(0)
-assert issubclass(Mapii, MutableMapping)
-assert issubclass(Multimapii, MutableMapping)
-assert issubclass(IntSet, MutableSet)
-assert issubclass(IntMultiset, MutableSet)
-assert issubclass(IntVector, MutableSequence)
-assert issubclass(IntList, MutableSequence)
+def check_issubclass(derived, base):
+ if not issubclass(derived, base):
+ raise RuntimeError("{} is not a subclass of {}".format(derived, base))
+
+check_issubclass(Mapii, collections.abc.MutableMapping)
+check_issubclass(Multimapii, collections.abc.MutableMapping)
+check_issubclass(IntSet, collections.abc.MutableSet)
+check_issubclass(IntMultiset, collections.abc.MutableSet)
+check_issubclass(IntVector, collections.abc.MutableSequence)
+check_issubclass(IntList, collections.abc.MutableSequence)
mapii = Mapii()
multimapii = Multimapii()
diff --git a/Examples/test-suite/python/python_append_runme.py b/Examples/test-suite/python/python_append_runme.py
index 6675f3509..eddda53ff 100644
--- a/Examples/test-suite/python/python_append_runme.py
+++ b/Examples/test-suite/python/python_append_runme.py
@@ -1,19 +1,13 @@
from python_append import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
# test not relevant for -builtin
if is_python_builtin():
exit(0)
t = Test()
-t.func()
-if is_new_style_class(Test):
- t.static_func()
-else:
- Test_static_func()
+t.funk()
+t.static_func()
if grabpath() != os.path.dirname(mypath):
raise RuntimeError("grabpath failed")
diff --git a/Examples/test-suite/python/python_builtin_runme.py b/Examples/test-suite/python/python_builtin_runme.py
index 7afab2a39..26e757ca7 100644
--- a/Examples/test-suite/python/python_builtin_runme.py
+++ b/Examples/test-suite/python/python_builtin_runme.py
@@ -83,6 +83,7 @@ if is_python_builtin():
if MyClass.less_than_counts != 6:
raise RuntimeError("python:compare feature not working")
+# Test 6
sa = SimpleArray(5)
elements = [x for x in sa]
if elements != [0, 10, 20, 30, 40]:
@@ -96,3 +97,17 @@ subslice = sa[1:3]
elements = [x for x in subslice]
if elements != [10, 20]:
raise RuntimeError("slice not working")
+
+# Test 7 mapping to Python's pow
+x = ANumber(2)
+y = ANumber(4)
+z = x ** y
+if z.Value() != 16:
+ raise RuntimeError("x ** y wrong")
+z = pow(x, y)
+if z.Value() != 16:
+ raise RuntimeError("pow(x, y) wrong")
+z = ANumber(9)
+z = pow(x, y, z)
+if z.Value() != 7:
+ raise RuntimeError("pow(x, y, z) wrong")
diff --git a/Examples/test-suite/python/python_docstring_runme.py b/Examples/test-suite/python/python_docstring_runme.py
index 0284ea0de..a601ecb54 100644
--- a/Examples/test-suite/python/python_docstring_runme.py
+++ b/Examples/test-suite/python/python_docstring_runme.py
@@ -9,7 +9,7 @@ def check(got, expected):
raise RuntimeError("\n" + "Expected: " + str(expected_list) + "\n" + "Got : " + str(got_list))
# When getting docstrings, use inspect.getdoc(x) instead of x.__doc__ otherwise the different options
-# such as -O, -builtin, -classic produce different initial indentation.
+# such as -O and -builtin may produce different initial indentation.
check(inspect.getdoc(DocStrings.docstring1),
" line 1\n"
diff --git a/Examples/test-suite/python/python_nondynamic_runme.py b/Examples/test-suite/python/python_nondynamic_runme.py
index 6a430961e..fbb60ad36 100644
--- a/Examples/test-suite/python/python_nondynamic_runme.py
+++ b/Examples/test-suite/python/python_nondynamic_runme.py
@@ -1,21 +1,41 @@
import python_nondynamic
+def is_python_modern():
+ """Return True if SWIG is generating Python code using -modern. Works only if %python_nondynamic has been used."""
+ return hasattr(python_nondynamic, "_swig_setattr_nondynamic_class_variable")
+
+def debug_print(s):
+ show_debug = False
+ if show_debug:
+ print(s)
+
aa = python_nondynamic.A()
aa.a = 1
aa.b = 2
+
+# Check values are really set
+if python_nondynamic.retrieve_A_a(aa) != 1: raise RuntimeError("a not set correctly")
+if python_nondynamic.retrieve_A_b(aa) != 2: raise RuntimeError("b not set correctly")
+
try:
aa.c = 2
- err = 0
-except:
- err = 1
-
-if not err:
- raise RuntimeError, "A is not static"
+ raise RuntimeError("A is not static")
+except AttributeError as e:
+ debug_print(e)
+ pass
+class PurePythonClass(object):
+ def __init__(self):
+ self.variables = dict()
+ def __set__(self, name, value):
+ self.variables[name] = value
+ pass
class B(python_nondynamic.A):
c = 4
+ cc = PurePythonClass()
+ cc.nnn = "new attrib"
def __init__(self):
python_nondynamic.A.__init__(self)
@@ -23,26 +43,66 @@ class B(python_nondynamic.A):
pass
bb = B()
+bb.a = 4
+bb.b = 5
+# Check values are really set
+if python_nondynamic.retrieve_A_a(bb) != 4: raise RuntimeError("a not set correctly")
+if python_nondynamic.retrieve_A_b(bb) != 5: raise RuntimeError("b not set correctly")
try:
bb.c = 3
- err = 0
-except:
- err = 1
-
-if not err:
- print "bb.c = %d" % bb.c
- print "B.c = %d" % B.c
- raise RuntimeError, "B.c class variable messes up nondynamic-ness of B"
+ print("bb.c = {}".format(bb.c))
+ print("B.c = {}".format(B.c))
+ raise RuntimeError("B.c class variable messes up nondynamic-ness of B")
+except AttributeError as e:
+ debug_print(e)
+ pass
try:
bb.d = 2
- err = 0
-except:
- err = 1
-
-if not err:
- raise RuntimeError, "B is not static"
+ raise RuntimeError("B is not static")
+except AttributeError as e:
+ debug_print(e)
+ pass
cc = python_nondynamic.C()
cc.d = 3
+
+# An inconsistency between builtin and (non-builtin/modern).
+# Class variables cannot be set on builtin types, like other Python builtins, eg list.classvar=111 fails
+if python_nondynamic.is_python_builtin():
+ try:
+ python_nondynamic.C.classvar = 111
+ raise RuntimeError("C should not allow static variables to be added when using builtin")
+ except AttributeError as e:
+ debug_print(e)
+ pass
+else:
+ python_nondynamic.C.classvar = 111
+
+if is_python_modern() and not python_nondynamic.is_python_builtin():
+ # Not working with builtin or non-modern :(
+ try:
+ B.a = 10
+ raise RuntimeError("B should not allow adding a class variable by setting it as an instance variable")
+ except AttributeError as e:
+ debug_print(e)
+ pass
+
+ try:
+ python_nondynamic.A.a = 10
+ raise RuntimeError("A should not allow adding a class variable by setting it as an instance variable")
+ except AttributeError as e:
+ debug_print(e)
+ pass
+
+if not python_nondynamic.is_python_builtin():
+ try:
+ bb.cc = 3
+ print("bb.cc = {}".format(bb.cc))
+ print("B.cc = {}".format(B.cc))
+ raise RuntimeError("B.cc class variable messes up nondynamic-ness of B")
+ except AttributeError as e:
+ debug_print(e)
+ pass
+
diff --git a/Examples/test-suite/python/python_overload_simple_cast_runme.py b/Examples/test-suite/python/python_overload_simple_cast_runme.py
index 79ef6cd2e..d4cb8a37a 100644
--- a/Examples/test-suite/python/python_overload_simple_cast_runme.py
+++ b/Examples/test-suite/python/python_overload_simple_cast_runme.py
@@ -168,9 +168,9 @@ ullmaxd = 9007199254740992.0
ullmin = 0
ullmind = 0.0
if ull(ullmin) != ullmin:
- raise runtimeerror, "ull(ullmin)"
+ raise RuntimeError, "ull(ullmin)"
if ull(ullmax) != ullmax:
- raise runtimeerror, "ull(ullmax)"
+ raise RuntimeError, "ull(ullmax)"
if ull(ullmind) != ullmind:
raise RuntimeError, "ull(ullmind)"
if ull(ullmaxd) != ullmaxd:
@@ -183,9 +183,9 @@ llmin = -9223372036854775808
llmaxd = 9007199254740992.0
llmind = -9007199254740992.0
if ll(llmin) != llmin:
- raise runtimeerror, "ll(llmin)"
+ raise RuntimeError, "ll(llmin)"
if ll(llmax) != llmax:
- raise runtimeerror, "ll(llmax)"
+ raise RuntimeError, "ll(llmax)"
if ll(llmind) != llmind:
raise RuntimeError, "ll(llmind)"
if ll(llmaxd) != llmaxd:
diff --git a/Examples/test-suite/python/python_pickle_runme.py b/Examples/test-suite/python/python_pickle_runme.py
index cf2847919..27c67ae10 100644
--- a/Examples/test-suite/python/python_pickle_runme.py
+++ b/Examples/test-suite/python/python_pickle_runme.py
@@ -3,17 +3,11 @@ import python_pickle
import pickle
import sys
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
def check(p):
msg = p.msg
if msg != "hi there":
raise RuntimeError("Bad, got: " + msg)
-if not is_new_style_class(python_pickle.PickleMe):
- sys.exit(0)
-
python_pickle.cvar.debug = False
p = python_pickle.PickleMe("hi there")
diff --git a/Examples/test-suite/python/python_pybuf_runme3.py b/Examples/test-suite/python/python_pybuf_runme3.py
deleted file mode 100644
index 4e57b69e8..000000000
--- a/Examples/test-suite/python/python_pybuf_runme3.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# run:
-# python python_pybuf_runme3.py benchmark
-# for the benchmark, other wise the test case will be run
-import python_pybuf
-import sys
-if len(sys.argv) >= 2 and sys.argv[1] == "benchmark":
- # run the benchmark
- import time
- k = 1000000 # number of times to excute the functions
-
- t = time.time()
- a = bytearray(b'hello world')
- for i in range(k):
- pybuf.title1(a)
- print("Time used by bytearray:", time.time() - t)
-
- t = time.time()
- b = 'hello world'
- for i in range(k):
- pybuf.title2(b)
- print("Time used by string:", time.time() - t)
-else:
- # run the test case
- buf1 = bytearray(10)
- buf2 = bytearray(50)
-
- pybuf.func1(buf1)
- assert buf1 == b'a' * 10
-
- pybuf.func2(buf2)
- assert buf2.startswith(b"Hello world!\x00")
-
- count = pybuf.func3(buf2)
- assert count == 10 # number of alpha and number in 'Hello world!'
-
- length = pybuf.func4(buf2)
- assert length == 12
-
- buf3 = bytearray(b"hello")
- pybuf.title1(buf3)
- assert buf3 == b'Hello'
diff --git a/Examples/test-suite/python/python_pybuffer_runme.py b/Examples/test-suite/python/python_pybuffer_runme.py
new file mode 100644
index 000000000..8ecdb523b
--- /dev/null
+++ b/Examples/test-suite/python/python_pybuffer_runme.py
@@ -0,0 +1,46 @@
+# run:
+# python python_pybuffer_runme.py benchmark
+# for the benchmark, other wise the test case will be run
+import python_pybuffer
+import sys
+
+def check(flag):
+ if not flag:
+ raise RuntimeError("Test failed")
+
+if len(sys.argv) >= 2 and sys.argv[1] == "benchmark":
+ # run the benchmark
+ import time
+ k = 1000000 # number of times to execute the functions
+
+ t = time.time()
+ a = bytearray(b"hello world")
+ for i in range(k):
+ python_pybuffer.title1(a)
+ print "Time used by bytearray:", time.time() - t
+
+ t = time.time()
+ b = "hello world"
+ for i in range(k):
+ python_pybuffer.title2(b)
+ print "Time used by string:", time.time() - t
+else:
+ # run the test case
+ buf1 = bytearray(10)
+ buf2 = bytearray(50)
+
+ python_pybuffer.func1(buf1)
+ check(buf1 == b"a" * 10)
+
+ python_pybuffer.func2(buf2)
+ check(buf2.startswith(b"Hello world!\x00"))
+
+ count = python_pybuffer.func3(buf2)
+ check(count == 10) # number of alpha and number in 'Hello world!'
+
+ length = python_pybuffer.func4(buf2)
+ check(length == 12)
+
+ buf3 = bytearray(b"hello")
+ python_pybuffer.title1(buf3)
+ check(buf3 == b"Hello")
diff --git a/Examples/test-suite/python/python_pythoncode_runme.py b/Examples/test-suite/python/python_pythoncode_runme.py
index da238780d..c27f4452d 100644
--- a/Examples/test-suite/python/python_pythoncode_runme.py
+++ b/Examples/test-suite/python/python_pythoncode_runme.py
@@ -3,3 +3,7 @@ import python_pythoncode
# No need to actually do anything, this is a regression test for a bug which
# caused an invalid python_pythoncode.py to be generated, so if we can import
# it the bug is still fixed.
+
+# A later test enhancement checking __new__ requires some code...
+f = python_pythoncode.get_foo()
+f = python_pythoncode.Foo()
diff --git a/Examples/test-suite/python/python_richcompare_runme.py b/Examples/test-suite/python/python_richcompare_runme.py
index a68da2f98..724d1d73c 100644
--- a/Examples/test-suite/python/python_richcompare_runme.py
+++ b/Examples/test-suite/python/python_richcompare_runme.py
@@ -1,4 +1,10 @@
import python_richcompare
+import sys
+
+def check_unorderable_types(exception):
+# if str(exception).find("unorderable types") == -1:
+# raise RuntimeError("A TypeError 'unorderable types' exception was expected"), None, sys.exc_info()[2]
+ pass # Exception message seems to vary from one version of Python to another
base1 = python_richcompare.BaseClass(1)
base2 = python_richcompare.BaseClass(2)
@@ -65,6 +71,18 @@ if (b1 == a1):
raise RuntimeError(
"Comparing equivalent instances of different subclasses, == returned True")
+# Check comparison to other objects
+#-------------------------------------------------------------------------------
+if (base1 == 42) :
+ raise RuntimeError("Comparing class to incompatible type, == returned True")
+if not (base1 != 42) :
+ raise RuntimeError("Comparing class to incompatible type, != returned False")
+
+if (a1 == 42) :
+ raise RuntimeError("Comparing class (with overloaded operator ==) to incompatible type, == returned True")
+if not (a1 != 42) :
+ raise RuntimeError("Comparing class (with overloaded operator ==) to incompatible type, != returned False")
+
# Check inequalities
#-------------------------------------------------------------------------
@@ -80,6 +98,40 @@ if not (a2 >= b2):
if not (a2 <= b2):
raise RuntimeError("operator<= failed")
+# Check inequalities to other objects
+#-------------------------------------------------------------------------------
+if sys.version_info[0:2] < (3, 0):
+ if (base1 < 42):
+ raise RuntimeError("Comparing class to incompatible type, < returned True")
+ if (base1 <= 42):
+ raise RuntimeError("Comparing class to incompatible type, <= returned True")
+ if not (base1 > 42):
+ raise RuntimeError("Comparing class to incompatible type, > returned False")
+ if not (base1 >= 42):
+ raise RuntimeError("Comparing class to incompatible type, >= returned False")
+else:
+ # Python 3 throws: TypeError: unorderable types
+ try:
+ res = base1 < 42
+ raise RuntimeError("Failed to throw")
+ except TypeError,e:
+ check_unorderable_types(e)
+ try:
+ res = base1 <= 42
+ raise RuntimeError("Failed to throw")
+ except TypeError,e:
+ check_unorderable_types(e)
+ try:
+ res = base1 > 42
+ raise RuntimeError("Failed to throw")
+ except TypeError,e:
+ check_unorderable_types(e)
+ try:
+ res = base1 >= 42
+ raise RuntimeError("Failed to throw")
+ except TypeError,e:
+ check_unorderable_types(e)
+
# Check inequalities used for ordering
#-------------------------------------------------------------------------
diff --git a/Examples/test-suite/python/python_strict_unicode_runme.py b/Examples/test-suite/python/python_strict_unicode_runme.py
index 642e127fa..e7fae2556 100644
--- a/Examples/test-suite/python/python_strict_unicode_runme.py
+++ b/Examples/test-suite/python/python_strict_unicode_runme.py
@@ -1,16 +1,8 @@
import python_strict_unicode
-from sys import version_info
-test_bytes = 'hello \x01world\x99'
-BYTES = 'BYTES'
-test_unicode = u'h\udce9llo w\u00f6rld'
-
-# Python < 2.6 rejects the b prefix for byte string literals as a SyntaxError,
-# so instead create Python3 bytes objects by encoding unicode strings as
-# latin-1, which maps code points 0-255 directly to the corresponding bytes.
-if version_info[0] >= 3:
- test_bytes = test_bytes.encode('latin-1')
- BYTES = BYTES.encode('latin-1')
+test_bytes = b"hello \x01world\x99"
+BYTES = b"BYTES"
+test_unicode = u"h\udce9llo w\u00f6rld"
# Test that byte string inputs and outputs work as expected
bdbl = python_strict_unicode.double_str(test_bytes)
@@ -28,12 +20,12 @@ if type(bout) != type(BYTES):
udbl = python_strict_unicode.double_wstr(test_unicode)
if udbl != test_unicode + test_unicode:
raise RuntimeError("Failed to double wide string")
-if type(udbl) != type(u''):
+if type(udbl) != type(u""):
raise RuntimeError("Wrong type output for wide string")
uout = python_strict_unicode.same_wstr(test_unicode)
if uout != test_unicode:
raise RuntimeError("Failed to copy wchar_t*")
-if type(uout) != type(u''):
+if type(uout) != type(u""):
raise RuntimeError("Wrong type output for wchar_t*")
# Test that overloading is handled properly
@@ -43,9 +35,9 @@ if bovr != BYTES:
if type(bovr) != type(BYTES):
raise RuntimeError("Wrong type output from overload")
uovr = python_strict_unicode.overload(test_unicode)
-if uovr != u'UNICODE':
+if uovr != u"UNICODE":
raise RuntimeError("Failed to return unicode from overload")
-if type(uovr) != type(u''):
+if type(uovr) != type(u""):
raise RuntimeERror("Wrong type output from overload")
# Test that bytes aren't accepted as wide strings and unicode isn't accepted as narrow strings
diff --git a/Examples/test-suite/python/reference_global_vars_runme.py b/Examples/test-suite/python/reference_global_vars_runme.py
index 6c2d181ac..6f86527b7 100644
--- a/Examples/test-suite/python/reference_global_vars_runme.py
+++ b/Examples/test-suite/python/reference_global_vars_runme.py
@@ -13,8 +13,8 @@ cvar.var_bool = createref_bool(True)
if value_bool(cvar.var_bool) != True:
raise RuntimeError
-cvar.var_char = createref_char('w')
-if value_char(cvar.var_char) != 'w':
+cvar.var_char = createref_char("w")
+if value_char(cvar.var_char) != "w":
raise RuntimeError
cvar.var_unsigned_char = createref_unsigned_char(10)
diff --git a/Examples/test-suite/python/return_const_value_runme.py b/Examples/test-suite/python/return_const_value_runme.py
index 947102840..ff3bd5f02 100644
--- a/Examples/test-suite/python/return_const_value_runme.py
+++ b/Examples/test-suite/python/return_const_value_runme.py
@@ -3,10 +3,10 @@ import sys
p = return_const_value.Foo_ptr_getPtr()
if (p.getVal() != 17):
- print "Runtime test1 faild. p.getVal()=", p.getVal()
+ print "Runtime test1 failed. p.getVal()=", p.getVal()
sys.exit(1)
p = return_const_value.Foo_ptr_getConstPtr()
if (p.getVal() != 17):
- print "Runtime test2 faild. p.getVal()=", p.getVal()
+ print "Runtime test2 failed. p.getVal()=", p.getVal()
sys.exit(1)
diff --git a/Examples/test-suite/python/smart_pointer_member_runme.py b/Examples/test-suite/python/smart_pointer_member_runme.py
index ce91da2bd..d2ed87e79 100644
--- a/Examples/test-suite/python/smart_pointer_member_runme.py
+++ b/Examples/test-suite/python/smart_pointer_member_runme.py
@@ -1,9 +1,6 @@
from smart_pointer_member import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
f = Foo()
f.y = 1
@@ -24,6 +21,5 @@ if b.x != f.x:
if b.z != f.z:
raise RuntimeError
-if is_new_style_class(Bar): # feature not supported in old style classes
- if Foo.z == Bar.z:
- raise RuntimeError
+if Foo.z == Bar.z:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/std_containers_runme.py b/Examples/test-suite/python/std_containers_runme.py
index d4625daa0..7404cd5f4 100644
--- a/Examples/test-suite/python/std_containers_runme.py
+++ b/Examples/test-suite/python/std_containers_runme.py
@@ -60,15 +60,24 @@ if mi[0][1] != mc[0][1]:
map = {}
-map['hello'] = 1
-map['hi'] = 2
-map['3'] = 2
+map["hello"] = 1
+map["hi"] = 2
+map["3"] = 2
imap = std_containers.mapident(map)
for k in map:
if map[k] != imap[k]:
raise RuntimeError, "bad map"
+# Test __contains__ (required for 'x in y' to work)
+if not imap.__contains__("hello"):
+ raise RuntimeError("hello imap.__contains__")
+if "hello" not in imap:
+ raise RuntimeError("hello not in imap")
+if imap.__contains__("oops"):
+ raise RuntimeError("oops imap.__contains__")
+if "oops" in imap:
+ raise RuntimeError("oops in imap")
mapc = {}
c1 = std_containers.C()
@@ -114,3 +123,14 @@ for i in s:
if i != j:
raise RuntimeError
j = j + 1
+
+# Test __contains__ (required for 'x in y' to work)
+if not s.__contains__(3):
+ raise RuntimeError("3 s.__contains__")
+if 3 not in s:
+ raise RuntimeError("3 not in s")
+if s.__contains__(-1):
+ raise RuntimeError("-1 s.__contains__")
+if -1 in s:
+ raise RuntimeError("-1 in s")
+
diff --git a/Examples/test-suite/python/swigobject_runme.py b/Examples/test-suite/python/swigobject_runme.py
index 346b05d40..de232f580 100644
--- a/Examples/test-suite/python/swigobject_runme.py
+++ b/Examples/test-suite/python/swigobject_runme.py
@@ -15,11 +15,11 @@ lthis = long(a.this)
# match pointer value, but deal with leading zeros on 8/16 bit systems and
# different C++ compilers interpretation of %p
xstr1 = "%016X" % (lthis,)
-xstr1 = str.lstrip(xstr1, '0')
+xstr1 = str.lstrip(xstr1, "0")
xstr2 = pointer_str(a)
xstr2 = str.replace(xstr2, "0x", "")
xstr2 = str.replace(xstr2, "0X", "")
-xstr2 = str.lstrip(xstr2, '0')
+xstr2 = str.lstrip(xstr2, "0")
xstr2 = str.upper(xstr2)
if xstr1 != xstr2:
diff --git a/Examples/test-suite/python/template_class_reuse_name_runme.py b/Examples/test-suite/python/template_class_reuse_name_runme.py
new file mode 100644
index 000000000..3ce427508
--- /dev/null
+++ b/Examples/test-suite/python/template_class_reuse_name_runme.py
@@ -0,0 +1,42 @@
+from template_class_reuse_name import *
+
+Bool1().tt()
+Bool1False().ff()
+
+Bool2().tt()
+Bool2False().ff()
+
+Bool3().tt()
+Bool3False().ff()
+
+Bool4().tt()
+Bool4False().ff()
+
+
+BoolForward1().tt()
+BoolForward1False().ff()
+
+BoolForward2().tt()
+BoolForward2False().ff()
+
+BoolForward3().tt()
+BoolForward3False().ff()
+
+BoolForward4().tt()
+BoolForward4False().ff()
+
+
+IntBool1().tt()
+IntBool1False().ff()
+
+IntBool2().tt()
+IntBool2False().ff()
+
+IntBool3().tt()
+IntBool3False().ff()
+
+IntBool4().tt()
+IntBool4False().ff()
+
+Duplicate2_0().n()
+Duplicate3().n()
diff --git a/Examples/test-suite/python/template_typedef_cplx2_runme.py b/Examples/test-suite/python/template_typedef_cplx2_runme.py
index 3043d4285..161bd51fc 100644
--- a/Examples/test-suite/python/template_typedef_cplx2_runme.py
+++ b/Examples/test-suite/python/template_typedef_cplx2_runme.py
@@ -11,8 +11,8 @@ except:
print d, "is not an instance"
raise RuntimeError
-s = '%s' % d
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % d
+if str.find(s, "ArithUnaryFunction") == -1:
print d, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -23,8 +23,8 @@ except:
print e, "is not an instance"
raise RuntimeError
-s = '%s' % e
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % e
+if str.find(s, "ArithUnaryFunction") == -1:
print e, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -40,8 +40,8 @@ except:
print c, "is not an instance"
raise RuntimeError
-s = '%s' % c
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % c
+if str.find(s, "ArithUnaryFunction") == -1:
print c, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -52,8 +52,8 @@ except:
print f, "is not an instance"
raise RuntimeError
-s = '%s' % f
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % f
+if str.find(s, "ArithUnaryFunction") == -1:
print f, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -68,8 +68,8 @@ except:
print g, "is not an instance"
raise RuntimeError
-s = '%s' % g
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % g
+if str.find(s, "ArithUnaryFunction") == -1:
print g, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -81,8 +81,8 @@ except:
print h, "is not an instance"
raise RuntimeError
-s = '%s' % h
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % h
+if str.find(s, "ArithUnaryFunction") == -1:
print h, "is not an ArithUnaryFunction"
raise RuntimeError
diff --git a/Examples/test-suite/python/template_typedef_cplx_runme.py b/Examples/test-suite/python/template_typedef_cplx_runme.py
index afb97d070..1846739eb 100644
--- a/Examples/test-suite/python/template_typedef_cplx_runme.py
+++ b/Examples/test-suite/python/template_typedef_cplx_runme.py
@@ -11,8 +11,8 @@ except:
print d, "is not an instance"
raise RuntimeError
-s = '%s' % d
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % d
+if str.find(s, "ArithUnaryFunction") == -1:
print d, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -23,8 +23,8 @@ except:
print e, "is not an instance"
raise RuntimeError
-s = '%s' % e
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % e
+if str.find(s, "ArithUnaryFunction") == -1:
print e, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -40,8 +40,8 @@ except:
print c, "is not an instance"
raise RuntimeError
-s = '%s' % c
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % c
+if str.find(s, "ArithUnaryFunction") == -1:
print c, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -52,8 +52,8 @@ except:
print f, "is not an instance"
raise RuntimeError
-s = '%s' % f
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % f
+if str.find(s, "ArithUnaryFunction") == -1:
print f, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -68,8 +68,8 @@ except:
print g, "is not an instance"
raise RuntimeError
-s = '%s' % g
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % g
+if str.find(s, "ArithUnaryFunction") == -1:
print g, "is not an ArithUnaryFunction"
raise RuntimeError
@@ -81,7 +81,7 @@ except:
print h, "is not an instance"
raise RuntimeError
-s = '%s' % h
-if str.find(s, 'ArithUnaryFunction') == -1:
+s = "%s" % h
+if str.find(s, "ArithUnaryFunction") == -1:
print h, "is not an ArithUnaryFunction"
raise RuntimeError
diff --git a/Examples/test-suite/python/template_using_directive_typedef_runme.py b/Examples/test-suite/python/template_using_directive_typedef_runme.py
new file mode 100644
index 000000000..363a3b754
--- /dev/null
+++ b/Examples/test-suite/python/template_using_directive_typedef_runme.py
@@ -0,0 +1,15 @@
+import template_using_directive_typedef
+
+vo = template_using_directive_typedef.Vector_Obj();
+
+h = template_using_directive_typedef.Holder();
+h.holder_use1(vo, vo, vo);
+h.holder_use2(vo, vo, vo);
+h.holder_use3(vo, vo, vo);
+
+template_using_directive_typedef.tns_holder_use(vo, vo);
+template_using_directive_typedef.tns_use(vo, vo, vo);
+template_using_directive_typedef.global_holder_use(vo);
+template_using_directive_typedef.global_use(vo, vo, vo);
+template_using_directive_typedef.ns1_holder_use(vo);
+template_using_directive_typedef.ns2_holder_use(vo, vo, vo, vo);
diff --git a/Examples/test-suite/python/typedef_classforward_same_name_runme.py b/Examples/test-suite/python/typedef_classforward_same_name_runme.py
new file mode 100644
index 000000000..61f45fbee
--- /dev/null
+++ b/Examples/test-suite/python/typedef_classforward_same_name_runme.py
@@ -0,0 +1,11 @@
+from typedef_classforward_same_name import *
+
+foo = Foo()
+foo.x = 5
+if extractFoo(foo) != 5:
+ raise RuntimeError("unexpected value")
+
+boo = Boo()
+boo.x = 5
+if extractBoo(boo) != 5:
+ raise RuntimeError("unexpected value")
diff --git a/Examples/test-suite/python/typedef_funcptr_runme.py b/Examples/test-suite/python/typedef_funcptr_runme.py
new file mode 100644
index 000000000..a186963f7
--- /dev/null
+++ b/Examples/test-suite/python/typedef_funcptr_runme.py
@@ -0,0 +1,20 @@
+import typedef_funcptr
+
+a = 100
+b = 10
+
+if typedef_funcptr.do_op(a,b,typedef_funcptr.addf) != 110:
+ raise RuntimeError("addf failed")
+if typedef_funcptr.do_op(a,b,typedef_funcptr.subf) != 90:
+ raise RuntimeError("subf failed")
+
+if typedef_funcptr.do_op_typedef_int(a,b,typedef_funcptr.addf) != 110:
+ raise RuntimeError("addf failed")
+if typedef_funcptr.do_op_typedef_int(a,b,typedef_funcptr.subf) != 90:
+ raise RuntimeError("subf failed")
+
+if typedef_funcptr.do_op_typedef_Integer(a,b,typedef_funcptr.addf) != 110:
+ raise RuntimeError("addf failed")
+if typedef_funcptr.do_op_typedef_Integer(a,b,typedef_funcptr.subf) != 90:
+ raise RuntimeError("subf failed")
+
diff --git a/Examples/test-suite/python/typemap_template_typedef_runme.py b/Examples/test-suite/python/typemap_template_typedef_runme.py
new file mode 100644
index 000000000..a2458367e
--- /dev/null
+++ b/Examples/test-suite/python/typemap_template_typedef_runme.py
@@ -0,0 +1,32 @@
+from typemap_template_typedef import *
+
+def check(got, expected):
+ if got != expected:
+ raise RuntimeError("got: " + str(got) + " expected: " + str(expected))
+
+x = XXXInt()
+
+check(x.aa1(0), 0)
+check(x.aa2(0), 55)
+check(x.aa3(0), 0)
+check(aa1(0), 0)
+check(aa2(0), 0)
+
+check(x.bb1(0), 0)
+check(x.bb2(0), 66)
+check(x.bb3(0), 0)
+check(bb1(0), 0)
+check(bb2(0), 0)
+
+check(x.cc1(0), 0)
+check(x.cc2(0), 77)
+check(x.cc3(0), 77)
+check(cc1(0), 0)
+check(cc2(0), 0)
+
+check(x.dd1(0), 0)
+check(x.dd2(0), 88)
+check(x.dd3(0), 0)
+check(dd1(0), 0)
+check(dd2(0), 0)
+
diff --git a/Examples/test-suite/python/unicode_strings_runme.py b/Examples/test-suite/python/unicode_strings_runme.py
index fa9c51437..4e661f00e 100644
--- a/Examples/test-suite/python/unicode_strings_runme.py
+++ b/Examples/test-suite/python/unicode_strings_runme.py
@@ -5,13 +5,13 @@ import unicode_strings
# The 'u' string prefix isn't valid in Python 3.0 - 3.2 and is redundant
# in 3.3+. Since this file is run through 2to3 before testing, though,
# mark this as a unicode string in 2.x so it'll become a str in 3.x.
-test_string = u'h\udce9llo w\u00f6rld'
+test_string = u"h\udce9llo w\u00f6rld"
if sys.version_info[0:2] >= (3, 1):
if unicode_strings.non_utf8_c_str() != test_string:
- raise ValueError('Test comparison mismatch')
+ raise ValueError("Test comparison mismatch")
if unicode_strings.non_utf8_std_string() != test_string:
- raise ValueError('Test comparison mismatch')
+ raise ValueError("Test comparison mismatch")
def check(s1, s2):
if s1 != s2:
@@ -25,3 +25,13 @@ if sys.version_info[0:2] < (3, 0):
check(unicode_strings.charstring(unicode("hello4")), "hello4")
unicode_strings.charstring(u"hell\xb05")
unicode_strings.charstring(u"hell\u00f66")
+
+low_surrogate_string = u"\udcff"
+try:
+ unicode_strings.instring(low_surrogate_string)
+ # Will succeed with Python 2
+except TypeError, e:
+ # Python 3 will fail the PyUnicode_AsUTF8String conversion resulting in a TypeError.
+ # The real error is actually:
+ # UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 0: surrogates not allowed
+ pass
diff --git a/Examples/test-suite/python/varargs_overload_runme.py b/Examples/test-suite/python/varargs_overload_runme.py
index 37958620c..6f5a70222 100644
--- a/Examples/test-suite/python/varargs_overload_runme.py
+++ b/Examples/test-suite/python/varargs_overload_runme.py
@@ -28,3 +28,35 @@ if varargs_overload.vararg_over4(123) != "123":
if varargs_overload.vararg_over4("Hello", 123) != "Hello":
raise RuntimeError, "Failed"
+
+
+# Same as above but non-vararg function declared first
+
+if varargs_overload.vararg_over6("Hello") != "Hello":
+ raise RuntimeError, "Failed"
+
+if varargs_overload.vararg_over6(2) != "2":
+ raise RuntimeError, "Failed"
+
+
+if varargs_overload.vararg_over7("Hello") != "Hello":
+ raise RuntimeError, "Failed"
+
+if varargs_overload.vararg_over7(2, 2.2) != "2 2.2":
+ raise RuntimeError, "Failed"
+
+
+if varargs_overload.vararg_over8("Hello") != "Hello":
+ raise RuntimeError, "Failed"
+
+if varargs_overload.vararg_over8(2, 2.2, "hey") != "2 2.2 hey":
+ raise RuntimeError, "Failed"
+
+if varargs_overload.vararg_over9("Hello") != "Hello":
+ raise RuntimeError, "Failed"
+
+if varargs_overload.vararg_over9(123) != "123":
+ raise RuntimeError, "Failed"
+
+if varargs_overload.vararg_over9("Hello", 123) != "Hello":
+ raise RuntimeError, "Failed"
diff --git a/Examples/test-suite/python/varargs_runme.py b/Examples/test-suite/python/varargs_runme.py
index 7105ba8d7..277ea757a 100644
--- a/Examples/test-suite/python/varargs_runme.py
+++ b/Examples/test-suite/python/varargs_runme.py
@@ -30,7 +30,5 @@ if varargs.test_plenty("Hello", 1, 2) != "Hello":
try:
varargs.test_plenty("Hello", 1, 2, 3)
raise RuntimeError
-except NotImplementedError:
- pass
except TypeError:
pass
diff --git a/Examples/test-suite/python_append.i b/Examples/test-suite/python_append.i
index 2a71b5784..049494319 100644
--- a/Examples/test-suite/python_append.i
+++ b/Examples/test-suite/python_append.i
@@ -17,11 +17,11 @@ def clearstaticpath():
staticfuncpath = None
%}
-%pythonappend Test::func %{
+%pythonappend Test::funk %{
funcpath = os.path.dirname(funcpath)
%}
-%pythonprepend Test::func %{
+%pythonprepend Test::funk %{
global funcpath
funcpath = mypath
%}
@@ -46,7 +46,7 @@ import os.path
class Test {
public:
static void static_func() {};
- void func() {};
+ void funk() {};
};
#ifdef SWIGPYTHON_BUILTIN
diff --git a/Examples/test-suite/python_builtin.i b/Examples/test-suite/python_builtin.i
index d4e245dc4..994c625e8 100644
--- a/Examples/test-suite/python_builtin.i
+++ b/Examples/test-suite/python_builtin.i
@@ -2,10 +2,12 @@
%module python_builtin
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW1(T1)
+#define TESTCASE_THROW2(T1, T2)
%}
%inline %{
@@ -192,13 +194,13 @@ void Dealloc2Destroyer(PyObject *v) {
return size;
}
- int __getitem__(Py_ssize_t n) throw (std::out_of_range) {
+ int __getitem__(Py_ssize_t n) TESTCASE_THROW1(std::out_of_range) {
if (n >= (int)size)
throw std::out_of_range("Index too large");
return numbers[n];
}
- SimpleArray __getitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) {
+ SimpleArray __getitem__(PySliceObject *slice) TESTCASE_THROW2(std::out_of_range, std::invalid_argument) {
if (!PySlice_Check(slice))
throw std::invalid_argument("Slice object expected");
Py_ssize_t i, j, step;
@@ -223,3 +225,23 @@ void Dealloc2Destroyer(PyObject *v) {
}
};
%}
+
+// Test 7 mapping to Python's pow
+%pybinoperator(__pow__, ANumber::power, ternaryfunc, nb_power);
+
+%inline %{
+class ANumber {
+ int num;
+public:
+ ANumber(int d = 0) : num(d) {}
+ ANumber __pow__(const ANumber &other, const ANumber *x = 0) const {
+ int val = (int)pow(num, other.num);
+ val = x ? val % x->num : val;
+ return ANumber(val);
+ }
+ int Value() const {
+ return num;
+ }
+};
+%}
+
diff --git a/Examples/test-suite/python_nondynamic.i b/Examples/test-suite/python_nondynamic.i
index 54a3f28ca..b08cec9e6 100644
--- a/Examples/test-suite/python_nondynamic.i
+++ b/Examples/test-suite/python_nondynamic.i
@@ -29,8 +29,6 @@
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158
- and works for modern (-modern) and plain python.
-
*/
@@ -54,5 +52,14 @@
int b;
};
+ int retrieve_A_a(const struct A* self) { return self->a; }
+ int retrieve_A_b(const struct A* self) { return self->b; }
+%}
+%inline %{
+#ifdef SWIGPYTHON_BUILTIN
+int is_python_builtin() { return 1; }
+#else
+int is_python_builtin() { return 0; }
+#endif
%}
diff --git a/Examples/test-suite/python_pybuf.i b/Examples/test-suite/python_pybuffer.i
index 8e1302582..bff72bfa2 100644
--- a/Examples/test-suite/python_pybuf.i
+++ b/Examples/test-suite/python_pybuffer.i
@@ -1,6 +1,6 @@
-%module python_pybuf
-%include<pybuffer.i>
-%include<cstring.i>
+%module python_pybuffer
+%include <pybuffer.i>
+%include <cstring.i>
/*functions for the test case*/
%pybuffer_mutable_binary(char *buf1, int len);
%pybuffer_mutable_string(char *buf2);
@@ -28,7 +28,7 @@
++count;
return count;
}
- int func4(const char *buf4)
+ size_t func4(const char *buf4)
{
return strlen(buf4);
}
diff --git a/Examples/test-suite/python_pythoncode.i b/Examples/test-suite/python_pythoncode.i
index 70474d44c..017f076c4 100644
--- a/Examples/test-suite/python_pythoncode.i
+++ b/Examples/test-suite/python_pythoncode.i
@@ -29,3 +29,33 @@ struct TYPE2 {
struct TYPE { };
struct TYPE2 { };
%}
+
+
+// Overriding __new__ test: https://github.com/swig/swig/pull/1357
+%inline %{
+class Foo {
+ public:
+ virtual ~Foo() {}
+ Foo() {}
+};
+
+Foo* get_foo() {return new Foo();}
+%}
+
+%pythoncode %{
+ print_debug = False
+%}
+
+%extend Foo {
+ // Note that %pythoncode is not available with -builtin
+ %pythoncode %{
+ def __new__(cls, *args, **kwargs):
+ if print_debug:
+ print('in Foo.__new__()')
+ return super(Foo, cls).__new__(cls)
+
+ def __init__(self):
+ if print_debug:
+ print('in Foo.__init__()')
+ %}
+};
diff --git a/Examples/test-suite/python_varargs_typemap.i b/Examples/test-suite/python_varargs_typemap.i
index f05fb98eb..d809bf1fa 100644
--- a/Examples/test-suite/python_varargs_typemap.i
+++ b/Examples/test-suite/python_varargs_typemap.i
@@ -23,8 +23,11 @@
SWIG_fail;
}
pystr = PyUnicode_AsUTF8String(pyobj);
+ if (!pystr) {
+ SWIG_fail;
+ }
str = strdup(PyBytes_AsString(pystr));
- Py_XDECREF(pystr);
+ Py_DECREF(pystr);
%#else
if (!PyString_Check(pyobj)) {
PyErr_SetString(PyExc_ValueError, "Expected a string");
diff --git a/Examples/test-suite/r/Makefile.in b/Examples/test-suite/r/Makefile.in
index d75d4c042..33e9d90da 100644
--- a/Examples/test-suite/r/Makefile.in
+++ b/Examples/test-suite/r/Makefile.in
@@ -20,7 +20,17 @@ CPP_TEST_CASES += \
r_double_delete \
r_overload_array \
r_sexp \
- r_overload_comma
+ r_overload_comma \
+ r_use_isnull
+
+# These tests are failing because enums currently cannot handle
+# arithmetic expressions
+
+FAILING_CPP_TESTS = \
+ preproc_constants
+
+FAILING_C_TESTS = \
+ preproc_constants_c
include $(srcdir)/../common.mk
@@ -53,7 +63,7 @@ include $(srcdir)/../common.mk
# check for syntactic correctness
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) || (cat $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)out ; false); \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) || (cat ./$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)out ; false); \
else \
$(RUNTOOL) $(RUNR) ./$(SCRIPTPREFIX)$*$(WRAPSUFFIX) || (cat ./$(SCRIPTPREFIX)$*$(WRAPSUFFIX)out ; false); \
fi
@@ -61,7 +71,7 @@ run_testcase = \
run_multitestcase = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(SCRIPTDIR)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) || (cat $(SCRIPTDIR)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX)out ; false); \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(SCRIPTDIR)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) || (cat ./$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX)out ; false); \
else \
$(RUNTOOL) $(RUNR) ./$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX) || (cat ./$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX)out ; false); \
fi; \
diff --git a/Examples/test-suite/r/enum_thorough_runme.R b/Examples/test-suite/r/enum_thorough_runme.R
new file mode 100644
index 000000000..a0f1270b7
--- /dev/null
+++ b/Examples/test-suite/r/enum_thorough_runme.R
@@ -0,0 +1,452 @@
+clargs <- commandArgs(trailing=TRUE)
+source(file.path(clargs[1], "unittest.R"))
+
+dyn.load(paste("enum_thorough", .Platform$dynlib.ext, sep=""))
+source("enum_thorough.R")
+cacheMetaData(1)
+
+## Anonymous enums are not wrapped by the R module
+##
+
+# Colours - string interface, various function signatures
+unittest('red', colourTest1('red'))
+unittest('blue', colourTest1('blue'))
+unittest('green', colourTest1('green'))
+
+
+unittest('red', colourTest2('red'))
+unittest('blue', colourTest2('blue'))
+unittest('green', colourTest2('green'))
+
+unittest('red', colourTest3('red'))
+unittest('blue', colourTest3('blue'))
+unittest('green', colourTest3('green'))
+
+unittest('red', colourTest4('red'))
+unittest('blue', colourTest4('blue'))
+unittest('green', colourTest4('green'))
+
+## Colours - underlying integers
+unittest(-1, enumToInteger('red', '_colour'))
+unittest(0, enumToInteger('blue', '_colour'))
+unittest(10, enumToInteger('green', '_colour'))
+
+########
+## enum variable, wrapped as a function
+## Is initialization to 0 a "standard"
+myColour()
+
+## Test setting and retrieving
+myColour('green')
+unittest('green', myColour())
+
+########
+## SpeedClass
+
+s <- SpeedClass()
+v <- "medium"
+unittest(v, s$speedTest1(v))
+unittest(v, s$speedTest2(v))
+unittest(v, s$speedTest3(v))
+unittest(v, s$speedTest4(v))
+unittest(v, s$speedTest5(v))
+unittest(v, s$speedTest6(v))
+unittest(v, s$speedTest7(v))
+unittest(v, s$speedTest8(v))
+
+## speedTest methods not in the class
+
+unittest(v, speedTest1(v))
+unittest(v, speedTest2(v))
+unittest(v, speedTest3(v))
+unittest(v, speedTest4(v))
+# enum reference
+unittest(v, speedTest5(v))
+
+## member access
+s <- SpeedClass()
+unittest("slow", s$mySpeedtd1)
+# check integer value
+unittest(10, enumToInteger(s$mySpeedtd1, "_SpeedClass__speed"))
+# set and check
+s$mySpeedtd1 <- "lightning"
+unittest("lightning", s$mySpeedtd1)
+unittest(31, enumToInteger(s$mySpeedtd1, "_SpeedClass__speed"))
+
+## Named anon - not wrapped nicely, but can be retrieved:
+
+
+unittest("NamedAnon2", namedanon_NamedAnon2_get())
+unittest(0, enumToInteger(namedanon_NamedAnon1_get(), "_namedanon"))
+unittest(1, enumToInteger(namedanon_NamedAnon2_get(), "_namedanon"))
+
+## Twonames
+v <- "TwoNames1"
+unittest(v, twonamesTest1(v))
+unittest(v, twonamesTest2(v))
+unittest(v, twonamesTest3(v))
+unittest(33, enumToInteger("TwoNames3", "_twonamestag"))
+
+tt <- TwoNamesStruct()
+v <- "TwoNamesStruct1"
+unittest(v, tt$twonamesTest1(v))
+unittest(v, tt$twonamesTest2(v))
+unittest(v, tt$twonamesTest3(v))
+## Try the wrong name
+unittest(TRUE, is.na(tt$twonamesTest3("TwoNames1")))
+
+## Namedanonspace
+## can get the values
+
+v <- namedanonspace_NamedAnonSpace2_get()
+unittest(v, namedanonspaceTest1(v))
+unittest(v, namedanonspaceTest2(v))
+unittest(v, namedanonspaceTest3(v))
+unittest(v, namedanonspaceTest4(v))
+
+## scientists
+
+tt <- TemplateClassInt()
+
+g <- "galileo"
+unittest(g, tt$scientistsTest1(g))
+unittest(g, tt$scientistsTest2(g))
+unittest(g, tt$scientistsTest3(g))
+unittest(g, tt$scientistsTest4(g))
+unittest(g, tt$scientistsTest5(g))
+unittest(g, tt$scientistsTest6(g))
+unittest(g, tt$scientistsTest7(g))
+unittest(g, tt$scientistsTest8(g))
+unittest(g, tt$scientistsTest9(g))
+
+## This one is commented out in csharp too
+## unittest(g, tt$scientistsTestA(g))
+unittest(g, tt$scientistsTestB(g))
+## This one is commented out in csharp too
+## unittest(g, tt$scientistsTestC(g))
+unittest(g, tt$scientistsTestD(g))
+unittest(g, tt$scientistsTestE(g))
+unittest(g, tt$scientistsTestF(g))
+unittest(g, tt$scientistsTestG(g))
+unittest(g, tt$scientistsTestH(g))
+unittest(g, tt$scientistsTestI(g))
+# enum reference
+unittest(g, tt$scientistsTestJ(g))
+
+
+unittest(g, scientistsTest1(g))
+unittest(g, scientistsTest2(g))
+unittest(g, scientistsTest3(g))
+unittest(g, scientistsTest4(g))
+unittest(g, scientistsTest5(g))
+unittest(g, scientistsTest6(g))
+unittest(g, scientistsTest7(g))
+## enum reference
+unittest(g, scientistsTest8(g))
+
+tt <- TClassInt()
+b <- "bell"
+unittest(b, tt$scientistsNameTest1(b))
+unittest(b, tt$scientistsNameTest2(b))
+unittest(b, tt$scientistsNameTest3(b))
+unittest(b, tt$scientistsNameTest4(b))
+unittest(b, tt$scientistsNameTest5(b))
+unittest(b, tt$scientistsNameTest6(b))
+unittest(b, tt$scientistsNameTest7(b))
+unittest(b, tt$scientistsNameTest8(b))
+unittest(b, tt$scientistsNameTest9(b))
+
+## This one is commented out in csharp too
+## unittest(b, tt$scientistsNameTestA(b))
+unittest(b, tt$scientistsNameTestB(b))
+## This one is commented out in csharp too
+## unittest(b, tt$scientistsNameTestC(b))
+unittest(b, tt$scientistsNameTestD(b))
+unittest(b, tt$scientistsNameTestE(b))
+unittest(b, tt$scientistsNameTestF(b))
+unittest(b, tt$scientistsNameTestG(b))
+unittest(b, tt$scientistsNameTestH(b))
+unittest(b, tt$scientistsNameTestI(b))
+
+
+unittest(b, tt$scientistsNameSpaceTest1(b))
+unittest(b, tt$scientistsNameSpaceTest2(b))
+unittest(b, tt$scientistsNameSpaceTest3(b))
+unittest(b, tt$scientistsNameSpaceTest4(b))
+unittest(b, tt$scientistsNameSpaceTest5(b))
+unittest(b, tt$scientistsNameSpaceTest6(b))
+unittest(b, tt$scientistsNameSpaceTest7(b))
+
+unittest(g, tt$scientistsOtherTest1(g))
+unittest(g, tt$scientistsOtherTest2(g))
+unittest(g, tt$scientistsOtherTest3(g))
+unittest(g, tt$scientistsOtherTest4(g))
+unittest(g, tt$scientistsOtherTest5(g))
+unittest(g, tt$scientistsOtherTest6(g))
+unittest(g, tt$scientistsOtherTest7(g))
+
+## Global
+unittest(b, scientistsNameTest1(b))
+unittest(b, scientistsNameTest2(b))
+unittest(b, scientistsNameTest3(b))
+unittest(b, scientistsNameTest4(b))
+unittest(b, scientistsNameTest5(b))
+unittest(b, scientistsNameTest6(b))
+unittest(b, scientistsNameTest7(b))
+
+unittest(b, scientistsNameSpaceTest1(b))
+unittest(b, scientistsNameSpaceTest2(b))
+unittest(b, scientistsNameSpaceTest3(b))
+unittest(b, scientistsNameSpaceTest4(b))
+unittest(b, scientistsNameSpaceTest5(b))
+unittest(b, scientistsNameSpaceTest6(b))
+unittest(b, scientistsNameSpaceTest7(b))
+
+unittest(b, scientistsNameSpaceTest8(b))
+unittest(b, scientistsNameSpaceTest9(b))
+unittest(b, scientistsNameSpaceTestA(b))
+unittest(b, scientistsNameSpaceTestB(b))
+unittest(b, scientistsNameSpaceTestC(b))
+unittest(b, scientistsNameSpaceTestD(b))
+unittest(b, scientistsNameSpaceTestE(b))
+unittest(b, scientistsNameSpaceTestF(b))
+unittest(b, scientistsNameSpaceTestG(b))
+unittest(b, scientistsNameSpaceTestH(b))
+unittest(b, scientistsNameSpaceTestI(b))
+unittest(b, scientistsNameSpaceTestJ(b))
+unittest(b, scientistsNameSpaceTestK(b))
+unittest(b, scientistsNameSpaceTestL(b))
+
+## rename test
+v <- "eek"
+unittest(v, renameTest1(v))
+unittest(v, renameTest2(v))
+
+## NewName
+N <- NewNameStruct()
+## Only half works:
+unittest("kerboom", NewNameStruct_bang_get())
+## Can't put in "bang" in the call
+## confirm with:
+## get(".__E___OldNameStruct__enumeration")
+
+## TreeClass
+
+T <- TreesClass()
+p <- "pine"
+
+unittest(p, T$treesTest1(p))
+unittest(p, T$treesTest2(p))
+unittest(p, T$treesTest3(p))
+unittest(p, T$treesTest4(p))
+unittest(p, T$treesTest5(p))
+unittest(p, T$treesTest6(p))
+unittest(p, T$treesTest7(p))
+unittest(p, T$treesTest8(p))
+unittest(p, T$treesTest9(p))
+unittest(p, T$treesTestA(p))
+unittest(p, T$treesTestB(p))
+unittest(p, T$treesTestC(p))
+unittest(p, T$treesTestD(p))
+unittest(p, T$treesTestE(p))
+unittest(p, T$treesTestF(p))
+unittest(p, T$treesTestG(p))
+unittest(p, T$treesTestH(p))
+unittest(p, T$treesTestI(p))
+unittest(p, T$treesTestJ(p))
+unittest(p, T$treesTestK(p))
+unittest(p, T$treesTestL(p))
+unittest(p, T$treesTestM(p))
+unittest(p, T$treesTestN(p))
+unittest(p, T$treesTestO(p))
+
+unittest(p, treesTest1(p))
+unittest(p, treesTest2(p))
+unittest(p, treesTest3(p))
+unittest(p, treesTest4(p))
+unittest(p, treesTest5(p))
+unittest(p, treesTest6(p))
+unittest(p, treesTest7(p))
+unittest(p, treesTest8(p))
+unittest(p, treesTest9(p))
+unittest(p, treesTestA(p))
+unittest(p, treesTestB(p))
+unittest(p, treesTestC(p))
+unittest(p, treesTestD(p))
+unittest(p, treesTestE(p))
+unittest(p, treesTestF(p))
+unittest(p, treesTestG(p))
+unittest(p, treesTestH(p))
+unittest(p, treesTestI(p))
+unittest(p, treesTestJ(p))
+unittest(p, treesTestK(p))
+unittest(p, treesTestL(p))
+unittest(p, treesTestM(p))
+unittest(p, treesTestO(p))
+unittest(p, treesTestP(p))
+unittest(p, treesTestQ(p))
+unittest(p, treesTestR(p))
+
+## Hair
+h <- HairStruct()
+g <- "ginger"
+unittest(g, h$hairTest1(g))
+unittest(g, h$hairTest2(g))
+unittest(g, h$hairTest3(g))
+unittest(g, h$hairTest4(g))
+unittest(g, h$hairTest5(g))
+unittest(g, h$hairTest6(g))
+unittest(g, h$hairTest7(g))
+unittest(g, h$hairTest8(g))
+unittest(g, h$hairTest9(g))
+unittest(g, h$hairTestA(g))
+unittest(g, h$hairTestB(g))
+
+r <- "red"
+unittest(r, h$colourTest1(r))
+unittest(r, h$colourTest2(r))
+
+nmA <- "NamedAnon1"
+unittest(nmA, h$namedanonTest1(nmA))
+unittest("NamedAnonSpace2", h$namedanonspaceTest1("NamedAnonSpace2"))
+
+f <- "fir"
+
+unittest(f, h$treesGlobalTest1(f))
+unittest(f, h$treesGlobalTest2(f))
+unittest(f, h$treesGlobalTest3(f))
+unittest(f, h$treesGlobalTest4(f))
+
+b <- "blonde"
+unittest(b, hairTest1(b))
+unittest(b, hairTest2(b))
+unittest(b, hairTest3(b))
+unittest(b, hairTest4(b))
+unittest(b, hairTest5(b))
+unittest(b, hairTest6(b))
+unittest(b, hairTest7(b))
+unittest(b, hairTest8(b))
+unittest(b, hairTest9(b))
+unittest(b, hairTestA(b))
+unittest(b, hairTestB(b))
+## enum reference
+unittest(b, hairTestC(b))
+unittest(b, hairTestA1(b))
+unittest(b, hairTestA2(b))
+unittest(b, hairTestA3(b))
+unittest(b, hairTestA4(b))
+unittest(b, hairTestA5(b))
+unittest(b, hairTestA6(b))
+unittest(b, hairTestA7(b))
+unittest(b, hairTestA8(b))
+unittest(b, hairTestA9(b))
+unittest(b, hairTestAA(b))
+unittest(b, hairTestAB(b))
+## enum reference
+unittest(b, hairTestAC(b))
+
+unittest(b, hairTestB1(b))
+unittest(b, hairTestB2(b))
+unittest(b, hairTestB3(b))
+unittest(b, hairTestB4(b))
+unittest(b, hairTestB5(b))
+unittest(b, hairTestB6(b))
+unittest(b, hairTestB7(b))
+unittest(b, hairTestB8(b))
+unittest(b, hairTestB9(b))
+unittest(b, hairTestBA(b))
+unittest(b, hairTestBB(b))
+## enum reference
+unittest(b, hairTestBC(b))
+
+f <- FirStruct()
+b <- "blonde"
+
+unittest(b, f$hairTestFir1(b))
+unittest(b, f$hairTestFir2(b))
+unittest(b, f$hairTestFir3(b))
+unittest(b, f$hairTestFir4(b))
+unittest(b, f$hairTestFir5(b))
+unittest(b, f$hairTestFir6(b))
+unittest(b, f$hairTestFir7(b))
+unittest(b, f$hairTestFir8(b))
+unittest(b, f$hairTestFir9(b))
+unittest(b, f$hairTestFirA(b))
+
+## Unnamed enum instance doesn't work
+## Wrapper set/get exists, but there's
+## no mapping between strings and integers
+GlobalInstance(1)
+unittest(1, GlobalInstance())
+
+ii <- Instances()
+ii$MemberInstance <- 1
+unittest(1, ii$MemberInstance)
+
+ii <- IgnoreTest()
+
+## Testing integer values
+unittest(0, enumToInteger(IgnoreTest_ignoreA_zero_get(), "_IgnoreTest__IgnoreA"))
+unittest(3, enumToInteger(IgnoreTest_ignoreA_three_get(), "_IgnoreTest__IgnoreA"))
+unittest(10, enumToInteger(IgnoreTest_ignoreA_ten_get(), "_IgnoreTest__IgnoreA"))
+
+unittest(11, enumToInteger(IgnoreTest_ignoreA_eleven_get(), "_IgnoreTest__IgnoreA"))
+unittest(14, enumToInteger(IgnoreTest_ignoreA_fourteen_get(), "_IgnoreTest__IgnoreA"))
+unittest(20, enumToInteger(IgnoreTest_ignoreA_twenty_get(), "_IgnoreTest__IgnoreA"))
+unittest(30, enumToInteger(IgnoreTest_ignoreA_thirty_get(), "_IgnoreTest__IgnoreA"))
+unittest(32, enumToInteger(IgnoreTest_ignoreA_thirty_two_get(), "_IgnoreTest__IgnoreA"))
+unittest(33, enumToInteger(IgnoreTest_ignoreA_thirty_three_get(), "_IgnoreTest__IgnoreA"))
+
+unittest(11, enumToInteger(IgnoreTest_ignoreB_eleven_get(), "_IgnoreTest__IgnoreB"))
+unittest(12, enumToInteger(IgnoreTest_ignoreB_twelve_get(), "_IgnoreTest__IgnoreB"))
+unittest(31, enumToInteger(IgnoreTest_ignoreB_thirty_one_get(), "_IgnoreTest__IgnoreB"))
+unittest(32, enumToInteger(IgnoreTest_ignoreB_thirty_two_get(), "_IgnoreTest__IgnoreB"))
+unittest(41, enumToInteger(IgnoreTest_ignoreB_forty_one_get(), "_IgnoreTest__IgnoreB"))
+unittest(42, enumToInteger(IgnoreTest_ignoreB_forty_two_get(), "_IgnoreTest__IgnoreB"))
+
+unittest(10, enumToInteger(IgnoreTest_ignoreC_ten_get(), "_IgnoreTest__IgnoreC"))
+unittest(12, enumToInteger(IgnoreTest_ignoreC_twelve_get(), "_IgnoreTest__IgnoreC"))
+unittest(30, enumToInteger(IgnoreTest_ignoreC_thirty_get(), "_IgnoreTest__IgnoreC"))
+unittest(32, enumToInteger(IgnoreTest_ignoreC_thirty_two_get(), "_IgnoreTest__IgnoreC"))
+unittest(40, enumToInteger(IgnoreTest_ignoreC_forty_get(), "_IgnoreTest__IgnoreC"))
+unittest(42, enumToInteger(IgnoreTest_ignoreC_forty_two_get(), "_IgnoreTest__IgnoreC"))
+
+unittest(21, enumToInteger(IgnoreTest_ignoreD_twenty_one_get(), "_IgnoreTest__IgnoreD"))
+unittest(22, enumToInteger(IgnoreTest_ignoreD_twenty_two_get(), "_IgnoreTest__IgnoreD"))
+
+unittest(0, enumToInteger(IgnoreTest_ignoreE_zero_get(), "_IgnoreTest__IgnoreE"))
+unittest(21, enumToInteger(IgnoreTest_ignoreE_twenty_one_get(), "_IgnoreTest__IgnoreE"))
+unittest(22, enumToInteger(IgnoreTest_ignoreE_twenty_two_get(), "_IgnoreTest__IgnoreE"))
+
+## confirm that an ignore directive is followed:
+unittest(TRUE, is.na(ignoreCTest("ignoreC_eleven")))
+
+
+## repeat test
+unittest(1, enumToInteger(repeatTest("one"), "_RepeatSpace__repeat"))
+unittest(1, enumToInteger(repeatTest("initial"), "_RepeatSpace__repeat"))
+unittest(2, enumToInteger(repeatTest("two"), "_RepeatSpace__repeat"))
+unittest(3, enumToInteger(repeatTest("three"), "_RepeatSpace__repeat"))
+unittest(3, enumToInteger(repeatTest("llast"), "_RepeatSpace__repeat"))
+unittest(3, enumToInteger(repeatTest("end"), "_RepeatSpace__repeat"))
+
+## Macro test - nothing in csharp
+## Note - this enum is set up with both entries the same
+## This means that mapping back from the integer value to the
+## string value isn't unique, so asking for "ABCD2" will return
+## a string of "ABCD"
+unittest("ABCD", enumWithMacroTest("ABCD"))
+
+## Different types
+unittest(10, enumToInteger(differentTypesTest("typeint"), "_DifferentSpace__DifferentTypes"))
+unittest(0, enumToInteger(differentTypesTest("typeboolfalse"), "_DifferentSpace__DifferentTypes"))
+unittest(1, enumToInteger(differentTypesTest("typebooltrue"), "_DifferentSpace__DifferentTypes"))
+unittest(2, enumToInteger(differentTypesTest("typebooltwo"), "_DifferentSpace__DifferentTypes"))
+unittest(utf8ToInt('C'), enumToInteger(differentTypesTest("typechar"), "_DifferentSpace__DifferentTypes"))
+unittest(utf8ToInt('D'), enumToInteger(differentTypesTest("typedefaultint"), "_DifferentSpace__DifferentTypes"))
+unittest(utf8ToInt('A') + 1, enumToInteger(differentTypesTest("typecharcompound"), "_DifferentSpace__DifferentTypes"))
+
+
+## Global different types
+## Test uses an anonymous type so the string mapping
+## framework doesn't exist.
diff --git a/Examples/test-suite/r/overload_null_runme.R b/Examples/test-suite/r/overload_null_runme.R
new file mode 100644
index 000000000..d187a1fbb
--- /dev/null
+++ b/Examples/test-suite/r/overload_null_runme.R
@@ -0,0 +1,49 @@
+clargs <- commandArgs(trailing=TRUE)
+source(file.path(clargs[1], "unittest.R"))
+
+dyn.load(paste("overload_null", .Platform$dynlib.ext, sep=""))
+source("overload_null.R")
+cacheMetaData(1)
+
+o <- Overload()
+x <- X()
+
+unittest(1, o$byval1(x))
+unittest(2, o$byval1(NULL))
+
+unittest(3, o$byval2(NULL))
+unittest(4, o$byval2(x))
+
+unittest(5, o$byref1(x))
+unittest(6, o$byref1(NULL))
+
+unittest(7, o$byref2(NULL))
+unittest(8, o$byref2(x))
+
+unittest(9, o$byconstref1(x))
+unittest(10, o$byconstref1(NULL))
+
+unittest(11, o$byconstref2(NULL))
+unittest(12, o$byconstref2(x))
+
+# const pointer references
+# No SWIGTYPE *const& typemaps for R yet
+#unittest(13, o$byval1cpr(x))
+#unittest(14, o$byval1cpr(NULL))
+
+#unittest(15, o$byval2cpr(NULL))
+#unittest(16, o$byval2cpr(x))
+
+# forward class declaration
+unittest(17, o$byval1forwardptr(x))
+unittest(18, o$byval1forwardptr(NULL))
+
+unittest(19, o$byval2forwardptr(NULL))
+unittest(20, o$byval2forwardptr(x))
+
+unittest(21, o$byval1forwardref(x))
+
+unittest(22, o$byval2forwardref(x))
+
+q(save="no")
+
diff --git a/Examples/test-suite/r/r_use_isnull_runme.R b/Examples/test-suite/r/r_use_isnull_runme.R
new file mode 100644
index 000000000..0dbf8762f
--- /dev/null
+++ b/Examples/test-suite/r/r_use_isnull_runme.R
@@ -0,0 +1,11 @@
+clargs <- commandArgs(trailing=TRUE)
+source(file.path(clargs[1], "unittest.R"))
+
+dyn.load(paste("r_use_isnull", .Platform$dynlib.ext, sep=""))
+source("r_use_isnull.R")
+cacheMetaData(1)
+
+tp <- pointerTest()
+circ1 <- tp$getCircle(1)
+circ1
+unittest(is.null(circ1), TRUE)
diff --git a/Examples/test-suite/r_use_isnull.i b/Examples/test-suite/r_use_isnull.i
new file mode 100644
index 000000000..03b4c15a7
--- /dev/null
+++ b/Examples/test-suite/r_use_isnull.i
@@ -0,0 +1,34 @@
+%module r_use_isnull
+
+%inline %{
+// C++ code
+class circle {
+public:
+circle(double radius)
+{
+m_radius = radius;
+}
+double getArea() const
+{
+return (3.14 * m_radius * m_radius);
+}
+
+private:
+double m_radius;
+};
+
+class pointerTest {
+public:
+pointerTest() : m_circle(2) {}
+const circle * getCircle(int index) const {
+if (index == 0)
+return & m_circle;
+else
+return 0;
+}
+
+private:
+ circle m_circle;
+
+};
+ %}
diff --git a/Examples/test-suite/redefined_not.i b/Examples/test-suite/redefined_not.i
index db9d3a248..fde5994fb 100644
--- a/Examples/test-suite/redefined_not.i
+++ b/Examples/test-suite/redefined_not.i
@@ -1,6 +1,6 @@
%module redefined_not
-// These should not emit an Identifer redefined warning
+// These should not emit an Identifier redefined warning
%inline %{
typedef unsigned int my_size_t;
namespace Std {
diff --git a/Examples/test-suite/register_par.i b/Examples/test-suite/register_par.i
index 030be4556..643841455 100644
--- a/Examples/test-suite/register_par.i
+++ b/Examples/test-suite/register_par.i
@@ -1,6 +1,10 @@
%module register_par
+%{
+struct swig_tree;
+%}
+
// bug # 924413
%inline {
- void clear_tree_flags(register struct tree *tp, register int i) {}
+ void clear_tree_flags(register struct swig_tree *tp, register int i) {}
}
diff --git a/Examples/test-suite/rename.h b/Examples/test-suite/rename.h
index c8199eeeb..3f10c5856 100644
--- a/Examples/test-suite/rename.h
+++ b/Examples/test-suite/rename.h
@@ -27,7 +27,6 @@ namespace Space {
void templateXYZ(XYZ<T> i) {}
operator T() { return m_t; }
operator NotXYZ<T>() const { return m_notxyz; }
- operator XYZ<T>() const { XYZ<T> xyz = XYZ<T>(); return xyz; }
};
}
@@ -48,10 +47,7 @@ class ABC {
public:
void method(ABC a) const {}
void method(Klass k) const {}
-#if !defined(__clang__)
- // Workaround for: warning: conversion function converting 'Space::ABC' to itself will never be used
- operator ABC() const { ABC a; return a; }
-#endif
+ operator ABC*() const { return new ABC(); }
operator Klass() const { Klass k; return k; }
};
}
diff --git a/Examples/test-suite/rename1.i b/Examples/test-suite/rename1.i
index 38af2b3bd..92e6b3494 100644
--- a/Examples/test-suite/rename1.i
+++ b/Examples/test-suite/rename1.i
@@ -35,14 +35,9 @@
%rename(opNotXYZ3) Space::XYZ<Space::Klass>::operator NotXYZ<Space::Klass>() const;
%rename(opNotXYZ4) Space::XYZ<Space::Enu>::operator NotXYZ<Space::Enu>() const;
-%rename(opXYZ1) Space::XYZ::operator XYZ<T>() const;
-%rename(opXYZ2) Space::XYZ<int>::operator XYZ<int>() const;
-%rename(opXYZ3) Space::XYZ<Space::Klass>::operator XYZ<Space::Klass>() const;
-%rename(opXYZ4) Space::XYZ<Space::Enu>::operator XYZ<Space::Enu>() const;
-
%rename(methodABC) Space::ABC::method(ABC a) const;
-%rename(opABC) Space::ABC::operator ABC() const;
+%rename(opABC) Space::ABC::operator ABC*() const;
%rename(methodKlass) Space::ABC::method(Klass k) const;
%rename(opKlass) Space::ABC::operator Klass() const;
diff --git a/Examples/test-suite/rename2.i b/Examples/test-suite/rename2.i
index 6a9c22ecf..93b82ddc6 100644
--- a/Examples/test-suite/rename2.i
+++ b/Examples/test-suite/rename2.i
@@ -43,7 +43,7 @@ namespace Space {
%rename(methodABC) ABC::method(ABC a) const;
-%rename(opABC) ABC::operator ABC() const;
+%rename(opABC) ABC::operator ABC*() const;
%rename(methodKlass) ABC::method(Klass k) const;
%rename(opKlass) ABC::operator Klass() const;
}
diff --git a/Examples/test-suite/rename3.i b/Examples/test-suite/rename3.i
index b39979fdd..5b613d769 100644
--- a/Examples/test-suite/rename3.i
+++ b/Examples/test-suite/rename3.i
@@ -52,7 +52,7 @@ namespace Space {
%extend ABC {
%rename(methodABC) method(ABC a) const;
- %rename(opABC) operator ABC() const;
+ %rename(opABC) operator ABC*() const;
%rename(methodKlass) method(Klass k) const;
%rename(opKlass) operator Klass() const;
}
diff --git a/Examples/test-suite/rename4.i b/Examples/test-suite/rename4.i
index 9ddff362f..75f01ca5b 100644
--- a/Examples/test-suite/rename4.i
+++ b/Examples/test-suite/rename4.i
@@ -29,21 +29,18 @@ namespace Space {
%rename(tMethodXYZ2) templateXYZ(XYZ<int>);
%rename(opT2) operator int();
%rename(opNotXYZ2) operator NotXYZ<int>() const;
-%rename(opXYZ2) operator XYZ<int>() const;
%rename(tMethod3) templateT(Space::Klass i);
%rename(tMethodNotXYZ3) templateNotXYZ(NotXYZ<Space::Klass>);
%rename(tMethodXYZ3) templateXYZ(XYZ<Space::Klass>);
%rename(opT3) operator Space::Klass();
%rename(opNotXYZ3) operator NotXYZ<Space::Klass>() const;
-%rename(opXYZ3) operator XYZ<Space::Klass>() const;
%rename(tMethod4) templateT(Space::Enu i);
%rename(tMethodNotXYZ4) templateNotXYZ(NotXYZ<Space::Enu>);
%rename(tMethodXYZ4) templateXYZ(XYZ<Space::Enu>);
%rename(opT4) operator Space::Enu();
%rename(opNotXYZ4) operator NotXYZ<Space::Enu>() const;
-%rename(opXYZ4) operator XYZ<Space::Enu>() const;
namespace Space {
using namespace AnotherSpace;
@@ -60,7 +57,6 @@ namespace Space {
%rename(tMethodXYZ1) templateXYZ(XYZ<T>);
%rename(opT1) operator T();
%rename(opNotXYZ1) operator NotXYZ<T>() const;
- %rename(opXYZ1) operator XYZ<T>() const;
NotXYZ<int> *m_int;
T m_t;
@@ -74,7 +70,6 @@ namespace Space {
void templateXYZ(XYZ<T> i) {}
operator T() { return m_t; }
operator NotXYZ<T>() const { return m_notxyz; }
- operator XYZ<T>() const { XYZ<T> xyz; return xyz; }
};
}
@@ -93,16 +88,13 @@ class ABC {
public:
%rename(methodABC) method(ABC a) const;
- %rename(opABC) operator ABC() const;
+ %rename(opABC) operator ABC*() const;
%rename(methodKlass) method(Klass k) const;
%rename(opKlass) operator Klass() const;
void method(ABC a) const {}
void method(Klass k) const {}
-#if !defined(__clang__)
- // Workaround for: warning: conversion function converting 'Space::ABC' to itself will never be used
- operator ABC() const { ABC a; return a; }
-#endif
+ operator ABC*() const { return new ABC(); }
operator Klass() const { Klass k; return k; }
};
}
diff --git a/Examples/test-suite/restrict_cplusplus.i b/Examples/test-suite/restrict_cplusplus.i
index 62abffa52..53c5782a1 100644
--- a/Examples/test-suite/restrict_cplusplus.i
+++ b/Examples/test-suite/restrict_cplusplus.i
@@ -1,7 +1,8 @@
%module restrict_cplusplus
%{
-// For PHP 5.3 / gcc-4.4
+// Workaround PHP's headers which do:
+// #define restrict __restrict__
#ifdef restrict
#undef restrict
#endif
diff --git a/Examples/test-suite/ruby/Makefile.in b/Examples/test-suite/ruby/Makefile.in
index d94ac7061..d75cdb058 100644
--- a/Examples/test-suite/ruby/Makefile.in
+++ b/Examples/test-suite/ruby/Makefile.in
@@ -14,23 +14,40 @@ CPP_TEST_CASES = \
li_cstring \
li_factory \
li_std_functors \
+ li_std_list \
li_std_multimap \
li_std_pair_lang_object \
li_std_queue \
li_std_set \
li_std_stack \
+ li_std_wstring_inherit \
primitive_types \
+ ruby_alias_method \
ruby_keywords \
ruby_minherit_shared_ptr \
ruby_naming \
+ ruby_rdata \
ruby_track_objects \
ruby_track_objects_directors \
- std_containers
-# ruby_li_std_speed
-# stl_new
+ std_containers \
+# ruby_li_std_speed \
+# stl_new \
+
+CPP11_TEST_CASES = \
+ cpp11_hash_tables \
+ cpp11_shared_ptr_const \
+ cpp11_shared_ptr_nullptr_in_containers \
+ cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_upcast \
+ cpp11_std_unordered_map \
+ cpp11_std_unordered_multimap \
+ cpp11_std_unordered_multiset \
+ cpp11_std_unordered_set \
C_TEST_CASES += \
li_cstring \
+ ruby_alias_global_function \
+ ruby_alias_module_function \
ruby_manual_proxy \
include $(srcdir)/../common.mk
@@ -39,6 +56,7 @@ include $(srcdir)/../common.mk
SWIGOPT += -w801 -noautorename -features autodoc=4
# Custom tests - tests with additional commandline options
+ruby_alias_global_function.ctest: SWIGOPT += -globalmodule
ruby_naming.cpptest: SWIGOPT += -autorename
# Rules for the different types of tests
diff --git a/Examples/test-suite/ruby/cpp11_hash_tables_runme.rb b/Examples/test-suite/ruby/cpp11_hash_tables_runme.rb
new file mode 100644
index 000000000..203b0ce06
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp11_hash_tables_runme.rb
@@ -0,0 +1,61 @@
+require 'swig_assert'
+require 'cpp11_hash_tables'
+
+[Cpp11_hash_tables::MapIntInt.new({1=>7}),
+ Cpp11_hash_tables::MultiMapIntInt.new({1=>7}),
+ Cpp11_hash_tables::UnorderedMapIntInt.new({1=>7}),
+ Cpp11_hash_tables::UnorderedMultiMapIntInt.new({1=>7})].each{|x|
+
+ swig_assert_equal("x.find_all{|e,k| e == 1}", "[[1,7]]", binding)
+
+ swig_assert_equal("x[1]", "7", binding)
+ swig_assert_equal("x[2]", "nil", binding)
+ x[2] = 9
+ swig_assert_equal("x[2]", "9", binding)
+ x.delete(2)
+ swig_assert_equal("x[2]", "nil", binding)
+ swig_assert_equal("x.empty?", "false", binding)
+ x.delete(1)
+ swig_assert_equal("x.empty?", "true", binding)
+ swig_assert_equal("x.include?(1)", "false", binding)
+}
+
+[Cpp11_hash_tables::MultiMapIntInt.new({1=>7}),
+ Cpp11_hash_tables::UnorderedMultiMapIntInt.new({1=>7})].each{|x|
+ x[1] = 9
+ swig_assert_equal("x[1].sort", "[7,9]", binding)
+}
+
+[Cpp11_hash_tables::SetInt.new([1]),
+ Cpp11_hash_tables::MultiSetInt.new([1]),
+ Cpp11_hash_tables::UnorderedSetInt.new([1]),
+ Cpp11_hash_tables::UnorderedMultiSetInt.new([1])].each{|x|
+
+ swig_assert_equal("x.find_all{|e| e == 1}", "[1]", binding)
+
+ swig_assert_equal("x.include?(1)", "true", binding)
+ swig_assert_equal("x.include?(2)", "false", binding)
+ x << 2
+ swig_assert_equal("x.include?(2)", "true", binding)
+ x.erase(2)
+ swig_assert_equal("x.empty?", "false", binding)
+ x.erase(1)
+ swig_assert_equal("x.empty?", "true", binding)
+}
+
+[Cpp11_hash_tables::MultiSetInt.new([1]),
+ Cpp11_hash_tables::UnorderedMultiSetInt.new([1])].each{|x|
+ x << 1
+ swig_assert_equal("x.count(1)", "2", binding)
+}
+
+[Cpp11_hash_tables::MapIntInt,
+ Cpp11_hash_tables::MultiMapIntInt,
+ Cpp11_hash_tables::UnorderedMapIntInt,
+ Cpp11_hash_tables::UnorderedMultiMapIntInt,
+ Cpp11_hash_tables::SetInt,
+ Cpp11_hash_tables::MultiSetInt,
+ Cpp11_hash_tables::UnorderedSetInt,
+ Cpp11_hash_tables::UnorderedMultiSetInt].each{|k|
+ swig_assert("k.include?(Enumerable)", binding)
+}
diff --git a/Examples/test-suite/ruby/cpp11_shared_ptr_const_runme.rb b/Examples/test-suite/ruby/cpp11_shared_ptr_const_runme.rb
new file mode 100644
index 000000000..149aa0898
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp11_shared_ptr_const_runme.rb
@@ -0,0 +1,9 @@
+require "swig_assert"
+require "cpp11_shared_ptr_const"
+
+include Cpp11_shared_ptr_const
+
+swig_assert_equal_simple(1, foo( Foo.new(1) ).get_m )
+swig_assert_equal_simple(7, const_foo( Foo.new(7) ).get_m )
+swig_assert_equal_simple(7, foo_vec( Foo.new(7) )[0].get_m )
+swig_assert_equal_simple(8, const_foo_vec( Foo.new(8) )[0].get_m )
diff --git a/Examples/test-suite/ruby/cpp11_shared_ptr_nullptr_in_containers_runme.rb b/Examples/test-suite/ruby/cpp11_shared_ptr_nullptr_in_containers_runme.rb
new file mode 100644
index 000000000..9d8b3c050
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp11_shared_ptr_nullptr_in_containers_runme.rb
@@ -0,0 +1,16 @@
+require "cpp11_shared_ptr_nullptr_in_containers"
+
+include Cpp11_shared_ptr_nullptr_in_containers
+
+a = ret_vec_c_shared_ptr()
+raise unless a[0].get_m == 0
+raise unless a[1] == nil
+raise unless a[2].get_m == 2
+
+a = ret_arg_vec([C.new(7), nil, C.new(9)])
+raise unless a[0].get_m == 7
+raise unless a[1] == nil
+raise unless a[2].get_m == 9
+
+raise unless is_last_null([C.new(7), C.new(8), nil])
+raise if is_last_null([C.new(7), C.new(8)])
diff --git a/Examples/test-suite/ruby/cpp11_shared_ptr_upcast_runme.rb b/Examples/test-suite/ruby/cpp11_shared_ptr_upcast_runme.rb
new file mode 100644
index 000000000..000b9b6a9
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp11_shared_ptr_upcast_runme.rb
@@ -0,0 +1,60 @@
+require 'swig_assert'
+require 'cpp11_shared_ptr_upcast'
+
+
+include Cpp11_shared_ptr_upcast
+
+# non-overloaded
+swig_assert_equal_simple( 7, derived_num1(Derived.new(7)) )
+swig_assert_equal_simple( 7, derived_num2([Derived.new(7)]) )
+swig_assert_equal_simple( 7, derived_num3({0 => Derived.new(7)}) )
+
+swig_assert_equal_simple(-1, base_num1(Derived.new(7)) )
+swig_assert_equal_simple(-1, base_num2([Derived.new(7)]) )
+swig_assert_equal_simple(-1, base_num3({0 => Derived.new(7)}) )
+
+swig_assert_equal_simple( 999, derived_num1(nil) )
+swig_assert_equal_simple( 999, derived_num2([nil]) )
+swig_assert_equal_simple( 999, derived_num3({0 => nil}) )
+
+swig_assert_equal_simple( 999, base_num1(nil) )
+swig_assert_equal_simple( 999, base_num2([nil]) )
+swig_assert_equal_simple( 999, base_num3({0 => nil}) )
+
+# overloaded
+swig_assert_equal_simple( 7, derived_num(Derived.new(7)) )
+swig_assert_equal_simple( 7, derived_num([Derived.new(7)]) )
+swig_assert_equal_simple( 7, derived_num({0 => Derived.new(7)}) )
+
+swig_assert_equal_simple(-1, base_num(Derived.new(7)) )
+swig_assert_equal_simple(-1, base_num([Derived.new(7)]) )
+swig_assert_equal_simple(-1, base_num({0 => Derived.new(7)}) )
+
+# ptr to shared_ptr
+swig_assert_equal_simple( 7, derived2_num1(Derived2.new(7)) )
+swig_assert_equal_simple( 7, derived2_num2([Derived2.new(7)]) )
+swig_assert_equal_simple( 7, derived2_num3({0 => Derived2.new(7)}) )
+
+swig_assert_equal_simple( -1, base2_num1(Derived2.new(7)) )
+
+begin
+ # Upcast for pointers to shared_ptr in this generic framework has not been implemented
+ swig_assert_equal_simple( -1, base2_num2([Derived2.new(7)]) )
+ raise RuntimeError, "Failed to catch TypeError"
+rescue TypeError
+end
+begin
+ # Upcast for pointers to shared_ptr in this generic framework has not been implemented
+ swig_assert_equal_simple( -1, base2_num3({0 => Derived2.new(7)}) )
+ raise RuntimeError, "Failed to catch TypeError"
+rescue TypeError
+end
+
+swig_assert_equal_simple( 888, derived2_num1(nil) )
+swig_assert_equal_simple( 999, derived2_num2([nil]) ) # although 888 would be more consistent
+swig_assert_equal_simple( 999, derived2_num3({0 => nil}) ) # although 888 would be more consistent
+
+swig_assert_equal_simple( 888, base2_num1(nil) )
+swig_assert_equal_simple( 999, base2_num2([nil]) ) # although 888 would be more consistent
+swig_assert_equal_simple( 999, base2_num3({0 => nil}) ) # although 888 would be more consistent
+
diff --git a/Examples/test-suite/ruby/cpp11_li_std_array_runme.rb b/Examples/test-suite/ruby/cpp11_std_array_runme.rb
index 770f37c0f..13c5efb84 100644
--- a/Examples/test-suite/ruby/cpp11_li_std_array_runme.rb
+++ b/Examples/test-suite/ruby/cpp11_std_array_runme.rb
@@ -9,9 +9,9 @@
require 'swig_assert'
-require 'cpp11_li_std_array'
+require 'cpp11_std_array'
-include Cpp11_li_std_array
+include Cpp11_std_array
def failed(a, b, msg)
diff --git a/Examples/test-suite/ruby/director_smartptr_runme.rb b/Examples/test-suite/ruby/director_smartptr_runme.rb
index 8b4bd3d6d..46ef8b1b5 100644
--- a/Examples/test-suite/ruby/director_smartptr_runme.rb
+++ b/Examples/test-suite/ruby/director_smartptr_runme.rb
@@ -30,6 +30,25 @@ class Director_smartptr_MyBarFoo < Foo
end
end
+class Director_smartptr_MyBarFooDerived < FooDerived
+
+ def ping()
+ return "director_smartptr_MyBarFooDerived.ping()"
+ end
+
+ def pong()
+ return "director_smartptr_MyBarFooDerived.pong();" + ping()
+ end
+
+ def upcall(fooBarPtr)
+ return "overrideDerived;" + fooBarPtr.FooBarDo()
+ end
+
+ def makeFoo()
+ return Foo.new()
+ end
+end
+
def check(got, expected)
if (got != expected)
raise RuntimeError, "Failed, got: #{got} expected: #{expected}"
@@ -52,3 +71,8 @@ myFoo2 = Foo.new().makeFoo()
check(myFoo2.pong(), "Foo::pong();Foo::ping()")
check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()")
check(myFoo2.upcall(FooBar.new()), "Bar::Foo2::Foo2Bar()")
+
+myBarFooDerived = Director_smartptr_MyBarFooDerived.new()
+check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()")
+check(FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()")
+check(FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()")
diff --git a/Examples/test-suite/ruby/li_boost_shared_ptr_director_runme.rb b/Examples/test-suite/ruby/li_boost_shared_ptr_director_runme.rb
new file mode 100644
index 000000000..55c1cbebd
--- /dev/null
+++ b/Examples/test-suite/ruby/li_boost_shared_ptr_director_runme.rb
@@ -0,0 +1,103 @@
+require 'li_boost_shared_ptr_director'
+
+include Li_boost_shared_ptr_director
+
+class Derived < Base
+
+ def initialize(flag)
+ @return_none = flag
+ super()
+ end
+
+ def ret_c_shared_ptr
+ if @return_none
+ nil
+ else
+ C.new
+ end
+ end
+
+ def ret_c_by_value
+ C.new
+ end
+
+ def take_c_by_value(c)
+ c.get_m
+ end
+
+ def take_c_by_ref(c)
+ c.get_m
+ end
+
+ def take_c_by_pointer(c)
+ if c
+ c.get_m
+ else
+ -2
+ end
+ end
+
+ def take_c_by_pointer_ref(c)
+ if c
+ c.get_m
+ else
+ -3
+ end
+ end
+
+ def take_c_shared_ptr_by_value(c)
+ if c
+ c.get_m
+ else
+ -4
+ end
+ end
+
+ def take_c_shared_ptr_by_ref(c)
+ if c
+ c.get_m
+ else
+ -5
+ end
+ end
+
+ def take_c_shared_ptr_by_pointer(c)
+ if c
+ c.get_m
+ else
+ -6
+ end
+ end
+
+ def take_c_shared_ptr_by_pointer_ref(c)
+ if c
+ c.get_m
+ else
+ -7
+ end
+ end
+
+end
+
+a = Derived.new(false)
+b = Derived.new(true)
+
+raise unless call_ret_c_shared_ptr(a) == 1
+raise unless call_ret_c_shared_ptr(b) == -1
+raise unless call_ret_c_by_value(a) == 1
+
+raise unless call_take_c_by_value(a) == 5
+raise unless call_take_c_by_ref(a) == 6
+raise unless call_take_c_by_pointer(a) == 7
+raise unless call_take_c_by_pointer_ref(a) == 8
+raise unless call_take_c_shared_ptr_by_value(a) == 9
+raise unless call_take_c_shared_ptr_by_ref(a) == 10
+raise unless call_take_c_shared_ptr_by_pointer(a) == 11
+raise unless call_take_c_shared_ptr_by_pointer_ref(a) == 12
+
+raise unless call_take_c_by_pointer_with_null(a) == -2
+raise unless call_take_c_by_pointer_ref_with_null(a) == -3
+raise unless call_take_c_shared_ptr_by_value_with_null(a) == -4
+raise unless call_take_c_shared_ptr_by_ref_with_null(a) == -5
+raise unless call_take_c_shared_ptr_by_pointer_with_null(a) == -6
+raise unless call_take_c_shared_ptr_by_pointer_ref_with_null(a) == -7
diff --git a/Examples/test-suite/ruby/li_std_containers_overload_runme.rb b/Examples/test-suite/ruby/li_std_containers_overload_runme.rb
new file mode 100644
index 000000000..913b6113a
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_containers_overload_runme.rb
@@ -0,0 +1,44 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_containers_overload'
+
+include Li_std_containers_overload
+
+def check(got, expected)
+ if (got != expected)
+ raise RuntimeError, "Failed check. '#{got}' != '#{expected}'"
+ end
+end
+
+v = VectorX.new()
+check(VectorOverload(v), "vector<X>")
+
+v = VectorY.new()
+check(VectorOverload(v), "vector<Y>")
+
+v = VectorInt.new()
+check(VectorOverload(v), "vector<int>")
+
+v = VectorString.new()
+check(VectorOverload(v), "vector<string>")
+
+v = [X.new()]
+check(VectorOverload(v), "vector<X>")
+
+v = [Y.new()]
+check(VectorOverload(v), "vector<Y>")
+
+v = [1, 2, 3]
+check(VectorOverload(v), "vector<int>")
+
+v = ["aaa", "bbb", "ccc"]
+check(VectorOverload(v), "vector<string>")
diff --git a/Examples/test-suite/ruby/li_std_list_runme.rb b/Examples/test-suite/ruby/li_std_list_runme.rb
new file mode 100644
index 000000000..b1182e2e3
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_list_runme.rb
@@ -0,0 +1,8 @@
+require 'swig_assert'
+
+require 'li_std_list'
+
+include Li_std_list
+
+x = DoubleList.new([1,2,3])
+swig_assert_equal("[1.0]", "x.find_all{|e| e == 1 }", binding)
diff --git a/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb b/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb
new file mode 100644
index 000000000..b5a90d834
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+require 'swig_assert'
+require 'li_std_wstring_inherit'
+x = "abc"
+swig_assert_equal("Li_std_wstring_inherit.test_value(Li_std_wstring_inherit::Wstring.new(x))", "x", binding)
+
+
+x = "y"
+swig_assert_equal("Li_std_wstring_inherit.test_value(x)", "x", binding)
+a = Li_std_wstring_inherit::A.new(x)
+swig_assert_equal("Li_std_wstring_inherit.test_value(a)", "x", binding)
+
diff --git a/Examples/test-suite/ruby/li_std_wstring_runme.rb b/Examples/test-suite/ruby/li_std_wstring_runme.rb
new file mode 100644
index 000000000..4922d8d90
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_wstring_runme.rb
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+require 'swig_assert'
+require 'li_std_wstring'
+
+h = "h"
+swig_assert_equal("Li_std_wstring.test_wcvalue(h)", "h", binding)
+
+x = "abc"
+swig_assert_equal("Li_std_wstring.test_ccvalue(x)", "x", binding)
+swig_assert_equal("Li_std_wstring.test_cvalue(x)", "x", binding)
+
+swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", "x", binding)
+swig_assert_equal("Li_std_wstring.test_wchar_overload()", "nil", binding)
+
+Li_std_wstring.test_pointer(nil)
+Li_std_wstring.test_const_pointer(nil)
+
+begin
+ Li_std_wstring.test_value(nil)
+ raise RuntimeError, "NULL check failed"
+rescue TypeError => e
+end
+
+begin
+ Li_std_wstring.test_reference(nil)
+ raise RuntimeError, "NULL check failed"
+rescue ArgumentError => e
+ swig_assert_simple(e.message.include? "invalid null reference")
+end
+begin
+ Li_std_wstring.test_const_reference(nil)
+ raise RuntimeError, "NULL check failed"
+rescue ArgumentError => e
+ swig_assert_simple(e.message.include? "invalid null reference")
+end
+
+x = "hello"
+swig_assert_equal("Li_std_wstring.test_const_reference(x)", "x", binding)
+
+s = "abc"
+swig_assert("Li_std_wstring.test_equal_abc(s)", binding)
+
+begin
+ Li_std_wstring.test_throw
+rescue RuntimeError => e
+ swig_assert_equal("e.message", "'throwing test_throw'", binding)
+end
+
+x = "abc\0def"
+swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding)
+swig_assert_equal("Li_std_wstring.test_ccvalue(x)", '"abc"', binding)
+swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", '"abc"', binding)
diff --git a/Examples/test-suite/ruby/newobject1_runme.rb b/Examples/test-suite/ruby/newobject1_runme.rb
index f5dc12fb5..be1949377 100644
--- a/Examples/test-suite/ruby/newobject1_runme.rb
+++ b/Examples/test-suite/ruby/newobject1_runme.rb
@@ -8,7 +8,7 @@
#
# Ruby's GC is somewhat broken in that it will mark some more stack space
# leading to the collection of local objects to be delayed.
-# Thus, upon invokation, it sometimes you can wait up to several
+# Thus, upon invocation, it sometimes you can wait up to several
# instructions to kick in.
# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/7449
#
diff --git a/Examples/test-suite/ruby/newobject2_runme.rb b/Examples/test-suite/ruby/newobject2_runme.rb
index 99bc24374..04129f4aa 100644
--- a/Examples/test-suite/ruby/newobject2_runme.rb
+++ b/Examples/test-suite/ruby/newobject2_runme.rb
@@ -2,7 +2,7 @@
#
# Ruby's GC is somewhat broken in that it will mark some more stack space
# leading to the collection of local objects to be delayed.
-# Thus, upon invokation, it sometimes you can wait up to several
+# Thus, upon invocation, it sometimes you can wait up to several
# instructions to kick in.
# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/7449
#
diff --git a/Examples/test-suite/ruby/overload_null_runme.rb b/Examples/test-suite/ruby/overload_null_runme.rb
new file mode 100644
index 000000000..eabea5e40
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_null_runme.rb
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+#
+# Put script description here.
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+require 'overload_null'
+
+include Overload_null
+
+o = Overload.new
+x = X.new
+
+swig_assert(1 == o.byval1(x))
+swig_assert(2 == o.byval1(nil))
+
+swig_assert(3 == o.byval2(nil))
+swig_assert(4 == o.byval2(x))
+
+swig_assert(5 == o.byref1(x))
+swig_assert(6 == o.byref1(nil))
+
+swig_assert(7 == o.byref2(nil))
+swig_assert(8 == o.byref2(x))
+
+swig_assert(9 == o.byconstref1(x))
+swig_assert(10 == o.byconstref1(nil))
+
+swig_assert(11 == o.byconstref2(nil))
+swig_assert(12 == o.byconstref2(x))
+
+# const pointer references
+swig_assert(13 == o.byval1cpr(x))
+swig_assert(14 == o.byval1cpr(nil))
+
+swig_assert(15 == o.byval2cpr(nil))
+swig_assert(16 == o.byval2cpr(x))
+
+# forward class declaration
+swig_assert(17 == o.byval1forwardptr(x))
+swig_assert(18 == o.byval1forwardptr(nil))
+
+swig_assert(19 == o.byval2forwardptr(nil))
+swig_assert(20 == o.byval2forwardptr(x))
+
+swig_assert(21 == o.byval1forwardref(x))
+
+swig_assert(22 == o.byval2forwardref(x))
diff --git a/Examples/test-suite/ruby/ruby_alias_global_function_runme.rb b/Examples/test-suite/ruby/ruby_alias_global_function_runme.rb
new file mode 100644
index 000000000..14e38e4cf
--- /dev/null
+++ b/Examples/test-suite/ruby/ruby_alias_global_function_runme.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+#
+# Runtime tests for ruby_alias_global_function.i
+#
+
+require 'swig_assert'
+require 'ruby_alias_global_function'
+
+expected_name = get_my_name
+
+swig_assert(fullname == expected_name, msg: "nickname not working as expected")
+swig_assert(nickname == expected_name, msg: "fullname not working as expected")
+
+if method(:nickname).respond_to?(:original_name)
+ swig_assert_equal_simple(method(:nickname).original_name, :get_my_name)
+ swig_assert_equal_simple(method(:fullname).original_name, :get_my_name)
+else
+ swig_assert(method(:nickname) == method(:get_my_name), msg: "nickname is not an alias of get_my_name")
+ swig_assert(method(:fullname) == method(:get_my_name), msg: "fullname is not an alias of get_my_name")
+end
diff --git a/Examples/test-suite/ruby/ruby_alias_method_runme.rb b/Examples/test-suite/ruby/ruby_alias_method_runme.rb
new file mode 100644
index 000000000..c19101e63
--- /dev/null
+++ b/Examples/test-suite/ruby/ruby_alias_method_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# Runtime tests for ruby_alias_method.i
+#
+
+require 'swig_assert'
+require 'ruby_alias_method'
+
+include Ruby_alias_method
+
+expected_name = "Chester Tester"
+syn = Synonym.new(expected_name)
+
+swig_assert(syn.getMyName() == expected_name, msg: "getMyName not working as expected")
+swig_assert(syn.nickname() == expected_name, msg: "nickname not working as expected")
+swig_assert(syn.fullname() == expected_name, msg: "fullname not working as expected")
+
+if syn.method(:nickname).respond_to?(:original_name)
+ swig_assert_equal_simple(syn.method(:nickname).original_name, :getMyName)
+ swig_assert_equal_simple(syn.method(:fullname).original_name, :getMyName)
+else
+ swig_assert(syn.method(:nickname) == syn.method(:getMyName))
+ swig_assert(syn.method(:fullname) == syn.method(:getMyName))
+end
diff --git a/Examples/test-suite/ruby/ruby_alias_module_function_runme.rb b/Examples/test-suite/ruby/ruby_alias_module_function_runme.rb
new file mode 100644
index 000000000..1f4205f1f
--- /dev/null
+++ b/Examples/test-suite/ruby/ruby_alias_module_function_runme.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+#
+# Runtime tests for ruby_alias_module_function.i
+#
+
+require 'swig_assert'
+require 'ruby_alias_module_function'
+
+include Ruby_alias_module_function
+
+expected_name = Ruby_alias_module_function.get_my_name
+
+swig_assert(Ruby_alias_module_function.nickname == expected_name, msg: "nickname returned a different result than get_my_name")
+swig_assert(Ruby_alias_module_function.fullname == expected_name, msg: "fullname returned a different result than get_my_name")
+
+nickname_method = Ruby_alias_module_function.method(:nickname)
+fullname_method = Ruby_alias_module_function.method(:fullname)
+
+if nickname_method.respond_to?(:original_name)
+ swig_assert_equal_simple(nickname_method.original_name, :get_my_name)
+ swig_assert_equal_simple(fullname_method.original_name, :get_my_name)
+else
+ original_method = Ruby_alias_module_function.method(:get_my_name)
+ swig_assert(nickname_method == original_method, msg: "nickname is not an alias of get_my_name")
+ swig_assert(fullname_method == original_method, msg: "fullname is not an alias of get_my_name")
+end
diff --git a/Examples/test-suite/ruby/ruby_rdata_runme.rb b/Examples/test-suite/ruby/ruby_rdata_runme.rb
new file mode 100644
index 000000000..b7f293077
--- /dev/null
+++ b/Examples/test-suite/ruby/ruby_rdata_runme.rb
@@ -0,0 +1,7 @@
+require 'swig_assert'
+require 'ruby_rdata'
+
+include Ruby_rdata
+
+swig_assert_equal_simple(1, take_proc_or_cpp_obj_and_ret_1(Proc.new{}))
+swig_assert_equal_simple(1, take_proc_or_cpp_obj_and_ret_1(C.new))
diff --git a/Examples/test-suite/ruby/std_containers_runme.rb b/Examples/test-suite/ruby/std_containers_runme.rb
index 73d443218..65a8b5b86 100644
--- a/Examples/test-suite/ruby/std_containers_runme.rb
+++ b/Examples/test-suite/ruby/std_containers_runme.rb
@@ -13,6 +13,8 @@ require 'swig_assert'
require 'std_containers'
include Std_containers
+swig_assert_equal("[true, false]", "videntb([true, false])")
+
swig_assert_each_line(<<'EOF', binding)
cube = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
diff --git a/Examples/test-suite/ruby/swig_assert.rb b/Examples/test-suite/ruby/swig_assert.rb
index 69a1a0207..cbdfc036d 100644
--- a/Examples/test-suite/ruby/swig_assert.rb
+++ b/Examples/test-suite/ruby/swig_assert.rb
@@ -1,12 +1,7 @@
#!/usr/bin/env ruby
#
-# A simple function to create useful asserts
+# Useful assert functions
#
-#
-#
-#
-#
-
#
# Exception raised when some swig binding test fails
@@ -16,6 +11,21 @@ end
#
+# Simple assertions. Strings are not needed as arguments.
+#
+def swig_assert_equal_simple(a, b)
+ unless a == b
+ raise SwigRubyError.new("\n#{a} expected but was \n#{b}")
+ end
+end
+
+def swig_assert_simple(a)
+ unless a
+ raise SwigRubyError.new("assertion failed.")
+ end
+end
+
+#
# Asserts whether a and b are equal.
#
# scope - optional Binding where to run the code
diff --git a/Examples/test-suite/ruby_alias_global_function.i b/Examples/test-suite/ruby_alias_global_function.i
new file mode 100644
index 000000000..bddb24959
--- /dev/null
+++ b/Examples/test-suite/ruby_alias_global_function.i
@@ -0,0 +1,11 @@
+%module ruby_alias_global_function
+
+%alias get_my_name "nickname,fullname";
+
+%inline %{
+
+const char *get_my_name(){
+ return "Chester Tester";
+}
+
+%}
diff --git a/Examples/test-suite/ruby_alias_method.i b/Examples/test-suite/ruby_alias_method.i
new file mode 100644
index 000000000..9ddcfce5e
--- /dev/null
+++ b/Examples/test-suite/ruby_alias_method.i
@@ -0,0 +1,26 @@
+%module ruby_alias_method
+%include <std_string.i>
+
+%alias Synonym::getMyName "nickname,fullname"
+
+%inline %{
+
+class Synonym {
+private:
+ std::string myName;
+
+public:
+ Synonym(std::string myName);
+
+ std::string getMyName();
+};
+
+Synonym::Synonym(std::string myName){
+ this->myName = myName;
+};
+
+std::string Synonym::getMyName(){
+ return this->myName;
+};
+
+%}
diff --git a/Examples/test-suite/ruby_alias_module_function.i b/Examples/test-suite/ruby_alias_module_function.i
new file mode 100644
index 000000000..900de5f1d
--- /dev/null
+++ b/Examples/test-suite/ruby_alias_module_function.i
@@ -0,0 +1,11 @@
+%module ruby_alias_module_function
+
+%alias get_my_name "nickname,fullname";
+
+%inline %{
+
+const char *get_my_name(){
+ return "Chester Tester";
+}
+
+%}
diff --git a/Examples/test-suite/ruby_rdata.i b/Examples/test-suite/ruby_rdata.i
new file mode 100644
index 000000000..06af06f36
--- /dev/null
+++ b/Examples/test-suite/ruby_rdata.i
@@ -0,0 +1,20 @@
+%module ruby_rdata
+
+%{
+
+ class C {};
+
+ int take_proc_or_cpp_obj_and_ret_1(VALUE obj) {
+ return 1;
+ }
+
+ int take_proc_or_cpp_obj_and_ret_1(C c) {
+ return 1;
+ }
+
+%}
+
+class C {};
+
+int take_proc_or_cpp_obj_and_ret_1(VALUE);
+int take_proc_or_cpp_obj_and_ret_1(C);
diff --git a/Examples/test-suite/schemerunme/reference_global_vars.scm b/Examples/test-suite/schemerunme/reference_global_vars.scm
index 4b3370cfc..29d0904b8 100644
--- a/Examples/test-suite/schemerunme/reference_global_vars.scm
+++ b/Examples/test-suite/schemerunme/reference_global_vars.scm
@@ -56,4 +56,12 @@
(if (!= (TestClass-num-get (value-TestClass (var-TestClass))) 20)
(begin (display "Runtime test 13 failed.\n") (exit 1)))
+; Test garbage collection on guile >= 2.0.12
+(if (or (and (string=? (major-version) "2")
+ (string=? (minor-version) "0")
+ (string>=? (micro-version) "12"))
+ (and (string>=? (major-version) "2")
+ (string>=? (minor-version) "1")))
+ (gc))
+
(exit 0)
diff --git a/Examples/test-suite/scilab/Makefile.in b/Examples/test-suite/scilab/Makefile.in
index 483ed2439..f873b8687 100644
--- a/Examples/test-suite/scilab/Makefile.in
+++ b/Examples/test-suite/scilab/Makefile.in
@@ -29,7 +29,7 @@ CPP_STD_TEST_CASES += \
include $(srcdir)/../common.mk
-# Overriden variables
+# Overridden variables
SRCDIR = ../$(srcdir)/
# Local variables
diff --git a/Examples/test-suite/scilab/li_std_container_typemaps_runme.sci b/Examples/test-suite/scilab/li_std_container_typemaps_runme.sci
index e4832efe6..af87d54bf 100644
--- a/Examples/test-suite/scilab/li_std_container_typemaps_runme.sci
+++ b/Examples/test-suite/scilab/li_std_container_typemaps_runme.sci
@@ -6,7 +6,7 @@ function checkerror(ierr, cmd)
if ierr <> 0 then swigtesterror("error " + string(ierr) + " in """ + cmd + """"); end
endfunction
-// test container of pointers returned from fonction (expected a list)
+// test container of pointers returned from function (expected a list)
function [classAPtr_list, classAPtr1, classAPtr2] = testCreateContainerPtr(container, value1, value2)
classAPtr1 = new_ClassA(value1);
classAPtr2 = new_ClassA(value2);
@@ -57,7 +57,7 @@ endfunction
// computed on the container
function testContainerType(container, value_type, value1, value2, ..
expected_returned_container, expected_accumulate_value)
- // test container of basic type returned from fonction
+ // test container of basic type returned from function
func = msprintf("ret_%s_%s", value_type, container);
if value_type == "string" then
cmd = msprintf("c = %s(''%s'', ''%s'');", func, value1, value2);
diff --git a/Examples/test-suite/scilab/li_std_deque_runme.sci b/Examples/test-suite/scilab/li_std_deque_runme.sci
index c0680846b..0903db4ae 100644
--- a/Examples/test-suite/scilab/li_std_deque_runme.sci
+++ b/Examples/test-suite/scilab/li_std_deque_runme.sci
@@ -25,7 +25,7 @@ IntDeque_push_back(intDeque, 6);
avg = average(intDeque);
checkequal(avg, 4.0, "average(intDeque)");
-// half shoud return a deque with elements half of the input elements
+// half should return a deque with elements half of the input elements
RealDeque_clear(realDeque);
RealDeque_push_front(realDeque, 2.0);
RealDeque_push_front(realDeque, 4.0);
diff --git a/Examples/test-suite/scilab/null_pointer_runme.sci b/Examples/test-suite/scilab/null_pointer_runme.sci
index 2c693d259..dab59acf8 100644
--- a/Examples/test-suite/scilab/null_pointer_runme.sci
+++ b/Examples/test-suite/scilab/null_pointer_runme.sci
@@ -2,6 +2,6 @@ exec("swigtest.start", -1);
p = getnull();
checkequal(SWIG_this(p), 0, "SWIG_this(p)");
-checkequal(func(p), %T, "func(p)");
+checkequal(funk(p), %T, "funk(p)");
exec("swigtest.quit", -1);
diff --git a/Examples/test-suite/scilab/overload_null_runme.sci b/Examples/test-suite/scilab/overload_null_runme.sci
new file mode 100644
index 000000000..e3939ac5c
--- /dev/null
+++ b/Examples/test-suite/scilab/overload_null_runme.sci
@@ -0,0 +1,45 @@
+exec("swigtest.start", -1);
+
+NULL = SWIG_ptr(0);
+
+o = new_Overload();
+x = new_X();
+
+checkequal(1, Overload_byval1(o, x), "test 1");
+checkequal(2, Overload_byval1(o, NULL), "test 2");
+
+checkequal(3, Overload_byval2(o, NULL), "test 3");
+checkequal(4, Overload_byval2(o, x), "test 4");
+
+checkequal(5, Overload_byref1(o, x), "test 5");
+checkequal(6, Overload_byref1(o, NULL), "test 6");
+
+checkequal(7, Overload_byref2(o, NULL), "test 7");
+checkequal(8, Overload_byref2(o, x), "test 8");
+
+checkequal(9, Overload_byconstref1(o, x), "test 9");
+checkequal(10, Overload_byconstref1(o, NULL), "test 10");
+
+checkequal(11, Overload_byconstref2(o, NULL), "test 11");
+checkequal(12, Overload_byconstref2(o, x), "test 12");
+
+// const pointer references
+checkequal(13, Overload_byval1cpr(o, x), "test 13");
+checkequal(14, Overload_byval1cpr(o, NULL), "test 14");
+
+checkequal(15, Overload_byval2cpr(o, NULL), "test 15");
+checkequal(16, Overload_byval2cpr(o, x), "test 16");
+
+// forward class declaration
+checkequal(17, Overload_byval1forwardptr(o, x), "test 17");
+checkequal(18, Overload_byval1forwardptr(o, NULL), "test 18");
+
+checkequal(19, Overload_byval2forwardptr(o, NULL), "test 19");
+checkequal(20, Overload_byval2forwardptr(o, x), "test 20");
+
+checkequal(21, Overload_byval1forwardref(o, x), "test 21");
+
+checkequal(22, Overload_byval2forwardref(o, x), "test 22");
+
+exec("swigtest.quit", -1);
+
diff --git a/Examples/test-suite/scilab/scilab_li_matrix_runme.sci b/Examples/test-suite/scilab/scilab_li_matrix_runme.sci
index 41924d6f9..55184cc20 100644
--- a/Examples/test-suite/scilab/scilab_li_matrix_runme.sci
+++ b/Examples/test-suite/scilab/scilab_li_matrix_runme.sci
@@ -2,7 +2,7 @@
exec("swigtest.start", -1);
-// test matrix passed as output argument from fonction
+// test matrix passed as output argument from function
function test_outMatrix(func, valueType, expectedOutMatrix)
funcName = msprintf("out%s%s", valueType, func);
cmd = msprintf("outMatrix = %s();", funcName);
@@ -13,7 +13,7 @@ function test_outMatrix(func, valueType, expectedOutMatrix)
checkequal(outMatrix, expectedOutMatrix, funcName);
endfunction
-// test matrix passed as input argument of fonction
+// test matrix passed as input argument of function
function test_inMatrix(func, valueType, inMatrix, expectedInValue)
funcName = msprintf("in%s%s", valueType, func);
cmd = msprintf("inValue = %s(inMatrix);", funcName);
@@ -24,7 +24,7 @@ function test_inMatrix(func, valueType, inMatrix, expectedInValue)
checkequal(inValue, expectedInValue, funcName);
endfunction
-// test matrixes passed as input and output arguments of fonction
+// test matrixes passed as input and output arguments of function
function test_inoutMatrix(func, valueType, inoutMatrix, expectedInoutMatrix)
funcName = msprintf("inout%s%s", valueType, func);
cmd = msprintf("inoutMatrix = %s(inoutMatrix);", funcName);
diff --git a/Examples/test-suite/scilab/throw_exception_runme.sci b/Examples/test-suite/scilab/throw_exception_runme.sci
index 2eada4be2..535a2f4b9 100644
--- a/Examples/test-suite/scilab/throw_exception_runme.sci
+++ b/Examples/test-suite/scilab/throw_exception_runme.sci
@@ -8,15 +8,15 @@ endfunction
foo = new_Foo();
-checkException('Foo_test_int(foo)', 'Exception (int) occured: 37');
+checkException('Foo_test_int(foo)', 'Exception (int) occurred: 37');
-checkException('Foo_test_msg(foo)', 'Exception (char const *) occured: Dead');
+checkException('Foo_test_msg(foo)', 'Exception (char const *) occurred: Dead');
-checkException('Foo_test_multi(foo, 1)', 'Exception (int) occured: 37');
+checkException('Foo_test_multi(foo, 1)', 'Exception (int) occurred: 37');
-checkException('Foo_test_multi(foo, 2)', 'Exception (char const *) occured: Dead');
+checkException('Foo_test_multi(foo, 2)', 'Exception (char const *) occurred: Dead');
-checkException('Foo_test_cls(foo)', 'Exception (CError) occured.');
+checkException('Foo_test_cls(foo)', 'Exception (CError) occurred.');
delete_Foo(foo);
diff --git a/Examples/test-suite/scilab/varargs_overload_runme.sci b/Examples/test-suite/scilab/varargs_overload_runme.sci
index 7603b667c..7426e8165 100644
--- a/Examples/test-suite/scilab/varargs_overload_runme.sci
+++ b/Examples/test-suite/scilab/varargs_overload_runme.sci
@@ -4,7 +4,7 @@ checkequal(vararg_over1("Hello"), "Hello", "vararg_over1(""Hello"")");
checkequal(vararg_over1(2), "2", "vararg_over1(2)");
-checkequal(vararg_over2("Hello"), "Hello", "vararg_over1(""Hello"")");
+checkequal(vararg_over2("Hello"), "Hello", "vararg_over2(""Hello"")");
checkequal(vararg_over2(2, 2.2), "2 2.2", "vararg_over2(2, 2.2)")
@@ -18,4 +18,24 @@ checkequal(vararg_over4(123), "123", "vararg_over4(123)");
checkequal(vararg_over4("Hello", 123), "Hello", "vararg_over4(""Hello"", 123)");
+
+// Same as above but non-vararg function declared first
+
+checkequal(vararg_over6("Hello"), "Hello", "vararg_over6(""Hello"")");
+
+checkequal(vararg_over6(2), "2", "vararg_over6(2)");
+
+checkequal(vararg_over7("Hello"), "Hello", "vararg_over7(""Hello"")");
+
+checkequal(vararg_over7(2, 2.2), "2 2.2", "vararg_over7(2, 2.2)")
+
+checkequal(vararg_over8("Hello"), "Hello", "vararg_over8(""Hello"")");
+
+checkequal(vararg_over8(2, 2.2, "hey"), "2 2.2 hey", "vararg_over8(2, 2.2, ""hey"")");
+
+checkequal(vararg_over9("Hello"), "Hello", "vararg_over9(""Hello"")");
+
+checkequal(vararg_over9(123), "123", "vararg_over9(123)");
+
+checkequal(vararg_over9("Hello", 123), "Hello", "vararg_over9(""Hello"", 123)");
exec("swigtest.quit", -1);
diff --git a/Examples/test-suite/simutry.i b/Examples/test-suite/simutry.i
index addea14db..ad45da425 100644
--- a/Examples/test-suite/simutry.i
+++ b/Examples/test-suite/simutry.i
@@ -23,7 +23,7 @@ namespace simuPOP
{
}
- virtual int func() const
+ virtual int funk() const
{ return m_pop.m_a; }
};
@@ -32,7 +32,7 @@ namespace simuPOP
struct DerivedOperator: public Operator<Pop>
{
DerivedOperator(int a):Operator<Pop>(a){}
- virtual int func() const
+ virtual int funk() const
{ return 2*this->m_pop.m_a; }
};
@@ -90,7 +90,7 @@ namespace simuPOP
void test( const std::vector< Operator<pop>*>& para)
{
for( size_t i =0; i < para.size(); ++i)
- para[i]->func();
+ para[i]->funk();
}
}
}
diff --git a/Examples/test-suite/smart_pointer_namespace2.i b/Examples/test-suite/smart_pointer_namespace2.i
index 882799862..e78364c25 100644
--- a/Examples/test-suite/smart_pointer_namespace2.i
+++ b/Examples/test-suite/smart_pointer_namespace2.i
@@ -49,11 +49,6 @@ namespace one
};
}
-%define PTR_DEF(o)
-typedef one::Ptr<o> o ## _ptr;
-%template(o ## _ptr) one::Ptr<o>;
-%enddef
-
namespace one
{
class Obj1
@@ -63,7 +58,8 @@ namespace one
void donothing() {}
};
- PTR_DEF(Obj1)
+ typedef one::Ptr<Obj1> Obj1_ptr;
+ %template(Obj1_ptr) one::Ptr<Obj1>;
}
namespace two
@@ -75,6 +71,9 @@ namespace two
void donothing() {}
};
- PTR_DEF(Obj2)
+ typedef one::Ptr<Obj2> Obj2_ptr;
}
+using two::Obj2;
+%template(Obj2_ptr) one::Ptr<Obj2>;
+
diff --git a/Examples/test-suite/smart_pointer_overload.i b/Examples/test-suite/smart_pointer_overload.i
index 0d2cc595d..08248d295 100644
--- a/Examples/test-suite/smart_pointer_overload.i
+++ b/Examples/test-suite/smart_pointer_overload.i
@@ -4,8 +4,6 @@
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) test;
#endif
-#ifndef SWIG_NO_OVERLOAD
-
%inline %{
struct Foo {
int x;
@@ -24,5 +22,3 @@ public:
};
%}
-#endif
-
diff --git a/Examples/test-suite/static_const_member_2.i b/Examples/test-suite/static_const_member_2.i
index 0b6d38d21..0b38b394b 100644
--- a/Examples/test-suite/static_const_member_2.i
+++ b/Examples/test-suite/static_const_member_2.i
@@ -4,6 +4,10 @@
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) oss::modules::CavityPackFlags::backward_field;
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) oss::modules::Test::current_profile;
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%inline %{
namespace oss
{
diff --git a/Examples/test-suite/std_containers.i b/Examples/test-suite/std_containers.i
index ae69b6418..80409a1f0 100644
--- a/Examples/test-suite/std_containers.i
+++ b/Examples/test-suite/std_containers.i
@@ -115,6 +115,10 @@
return v;
}
+ std::vector<bool> videntb(const std::vector<bool>& v)
+ {
+ return v;
+ }
int get_elem(const std::vector<int>& v, int index)
{
diff --git a/Examples/test-suite/stl_no_default_constructor.i b/Examples/test-suite/stl_no_default_constructor.i
new file mode 100644
index 000000000..32aff2b46
--- /dev/null
+++ b/Examples/test-suite/stl_no_default_constructor.i
@@ -0,0 +1,19 @@
+%module stl_no_default_constructor
+
+%include <stl.i>
+
+%inline %{
+struct NoDefaultCtor {
+ int value;
+ NoDefaultCtor(int i) : value(i) {}
+};
+%}
+
+#if defined(SWIGCSHARP) || defined(SWIGJAVA) || defined(SWIGD)
+%template(VectorNoDefaultCtor) std::vector<NoDefaultCtor>;
+#endif
+
+#if defined(SWIGJAVA) || defined(SWIGJAVA)
+%include <std_list.i>
+%template(ListNoDefaultCtor) std::list<NoDefaultCtor>;
+#endif
diff --git a/Examples/test-suite/string_simple.i b/Examples/test-suite/string_simple.i
index c319aa1ef..537daa570 100644
--- a/Examples/test-suite/string_simple.i
+++ b/Examples/test-suite/string_simple.i
@@ -1,10 +1,10 @@
%module string_simple
-%newobject copy_string;
+%newobject copy_str;
%inline %{
#include <string.h>
-const char* copy_string(const char* str) {
+const char* copy_str(const char* str) {
size_t len = strlen(str);
char* newstring = (char*) malloc(len + 1);
strcpy(newstring, str);
diff --git a/Examples/test-suite/tcl/null_pointer_runme.tcl b/Examples/test-suite/tcl/null_pointer_runme.tcl
index be99c7166..7ed87c153 100644
--- a/Examples/test-suite/tcl/null_pointer_runme.tcl
+++ b/Examples/test-suite/tcl/null_pointer_runme.tcl
@@ -3,7 +3,7 @@ if [ catch { load ./null_pointer[info sharedlibextension] null_pointer} err_msg
}
set a [A]
-if {[func $a] != 0} {
+if {[funk $a] != 0} {
puts stderr "null_pointer test 1 failed"
exit 1
}
diff --git a/Examples/test-suite/tcl/overload_null_runme.tcl b/Examples/test-suite/tcl/overload_null_runme.tcl
new file mode 100644
index 000000000..3716612ab
--- /dev/null
+++ b/Examples/test-suite/tcl/overload_null_runme.tcl
@@ -0,0 +1,52 @@
+
+if [ catch { load ./overload_null[info sharedlibextension] overload_null} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+}
+
+proc check {what expected actual} {
+ if {$expected != $actual } {
+ error "Failed: $what Expected: $expected , Actual: $actual"
+ }
+}
+
+set o [Overload]
+set x [X]
+
+check "test1 " 1 [$o byval1 $x]
+check "test2 " 2 [$o byval1 "NULL"]
+
+check "testX" 1 [$o byval1 $x]
+check "testX" 2 [$o byval1 "NULL"]
+
+check "testX" 3 [$o byval2 "NULL"]
+check "testX" 4 [$o byval2 $x]
+
+check "testX" 5 [$o byref1 $x]
+check "testX" 6 [$o byref1 "NULL"]
+
+check "testX" 7 [$o byref2 "NULL"]
+check "testX" 8 [$o byref2 $x]
+
+check "testX" 9 [$o byconstref1 $x]
+check "testX" 10 [$o byconstref1 "NULL"]
+
+check "testX" 11 [$o byconstref2 "NULL"]
+check "testX" 12 [$o byconstref2 $x]
+
+# const pointer references
+check "testX" 13 [$o byval1cpr $x]
+check "testX" 14 [$o byval1cpr "NULL"]
+
+check "testX" 15 [$o byval2cpr "NULL"]
+check "testX" 16 [$o byval2cpr $x]
+
+# forward class declaration
+check "testX" 17 [$o byval1forwardptr $x]
+check "testX" 18 [$o byval1forwardptr "NULL"]
+
+check "testX" 19 [$o byval2forwardptr "NULL"]
+check "testX" 20 [$o byval2forwardptr $x]
+
+check "testX" 21 [$o byval1forwardref $x]
+
+check "testX" 22 [$o byval2forwardref $x]
diff --git a/Examples/test-suite/template_class_reuse_name.i b/Examples/test-suite/template_class_reuse_name.i
new file mode 100644
index 000000000..818816d0e
--- /dev/null
+++ b/Examples/test-suite/template_class_reuse_name.i
@@ -0,0 +1,132 @@
+%module template_class_reuse_name
+
+// One parameter templates
+%inline %{
+namespace Space {
+ template <bool B> struct Bool1 { void tt(){}; void ff(){}; };
+ template <bool B = true> struct Bool2 { void tt(){}; void ff(){}; };
+ template <bool B> struct Bool3 {};
+ template <> struct Bool3<true> { void tt(){}; };
+ template <> struct Bool3<false> { void ff(){}; };
+ template <bool B = true> struct Bool4 { void tt(){}; };
+ template <> struct Bool4<false> { void ff(){}; };
+}
+%}
+
+// Instantiated names are the same as C++ template name
+%template(Bool1) Space::Bool1<true>;
+%template(Bool2) Space::Bool2<true>;
+%template(Bool3) Space::Bool3<true>;
+%template(Bool4) Space::Bool4<true>;
+
+// Instantiated names are not the same as C++ template name
+%template(Bool1False) Space::Bool1<false>;
+%template(Bool2False) Space::Bool2<false>;
+%template(Bool3False) Space::Bool3<false>;
+%template(Bool4False) Space::Bool4<false>;
+
+
+// Forward declared templates
+%inline %{
+namespace Space {
+ template <bool B> struct BoolForward1;
+ template <bool B> struct BoolForward2;
+ template <bool B> struct BoolForward3;
+ template <bool B> struct BoolForward4;
+
+ template <bool B> struct BoolForward1 { void tt(){}; void ff(){}; };
+ template <bool B = true> struct BoolForward2 { void tt(){}; void ff(){}; };
+ template <bool B> struct BoolForward3 {};
+ template <> struct BoolForward3<true> { void tt(){}; };
+ template <> struct BoolForward3<false> { void ff(){}; };
+ template <bool B = true> struct BoolForward4 { void tt(){}; };
+ template <> struct BoolForward4<false> { void ff(){}; };
+}
+%}
+
+// Instantiated names are the same as C++ template name
+%template(BoolForward1) Space::BoolForward1<true>;
+%template(BoolForward2) Space::BoolForward2<true>;
+%template(BoolForward3) Space::BoolForward3<true>;
+%template(BoolForward4) Space::BoolForward4<true>;
+
+// Instantiated names are not the same as C++ template name
+%template(BoolForward1False) Space::BoolForward1<false>;
+%template(BoolForward2False) Space::BoolForward2<false>;
+%template(BoolForward3False) Space::BoolForward3<false>;
+%template(BoolForward4False) Space::BoolForward4<false>;
+
+
+// Two parameter templates
+%inline %{
+namespace Space {
+ template <int I, bool B> struct IntBool1 { void tt(){}; void ff(){}; };
+ template <int I, bool B = true> struct IntBool2 { void tt(){}; void ff(){}; };
+ template <int I, bool B> struct IntBool3 {};
+ template <int I> struct IntBool3<I, true> { void tt(){}; };
+ template <int I> struct IntBool3<I, false> { void ff(){}; };
+ template <int I, bool B = true> struct IntBool4 { void tt(){}; };
+ template <int I> struct IntBool4<I, false> { void ff(){}; };
+}
+%}
+
+// Instantiated names are the same as C++ template name
+%template(IntBool1) Space::IntBool1<0, true>;
+%template(IntBool2) Space::IntBool2<0, true>;
+%template(IntBool3) Space::IntBool3<0, true>;
+%template(IntBool4) Space::IntBool4<0, true>;
+
+// Instantiated names are not the same as C++ template name
+%template(IntBool1False) Space::IntBool1<0, false>;
+%template(IntBool2False) Space::IntBool2<0, false>;
+%template(IntBool3False) Space::IntBool3<0, false>;
+%template(IntBool4False) Space::IntBool4<0, false>;
+
+
+%{
+namespace Space {
+ template <bool B> struct Duplicate1 { void ff(){}; };
+}
+%}
+
+%warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate1;
+namespace Space {
+ template <bool B> struct Duplicate1 { void ff(){}; };
+ template <bool B> struct Duplicate1 { void ff(){}; };
+}
+
+
+%warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate2;
+%inline %{
+namespace Space {
+ template <int I> struct Duplicate2 { void n(){}; };
+}
+%}
+%template(Duplicate2_0) Space::Duplicate2<0>;
+%template(Duplicate2_0) Space::Duplicate2<0>;
+
+
+%warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate3;
+%inline %{
+namespace Space {
+ template <int I> struct Duplicate3 { void n(){}; };
+}
+%}
+%template(Duplicate3) Space::Duplicate3<0>;
+%template(Duplicate3) Space::Duplicate3<0>;
+
+
+%{
+namespace Space {
+ template <bool B> struct Duplicate4 { void ff(){}; };
+}
+%}
+
+%warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate4;
+namespace Space {
+ template <bool B> struct Duplicate4 { void ff(){}; };
+ template <bool B> struct Duplicate4 { void ff(){}; };
+}
+%template(Duplicate4) Space::Duplicate4<0>;
+%template(Duplicate4) Space::Duplicate4<0>;
+
diff --git a/Examples/test-suite/template_default_class_parms.i b/Examples/test-suite/template_default_class_parms.i
index d07a1309f..02e993f32 100644
--- a/Examples/test-suite/template_default_class_parms.i
+++ b/Examples/test-suite/template_default_class_parms.i
@@ -1,5 +1,9 @@
%module template_default_class_parms
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%inline %{
namespace Space {
struct SomeType {};
diff --git a/Examples/test-suite/template_default_class_parms_typedef.i b/Examples/test-suite/template_default_class_parms_typedef.i
index 0767498bf..748b23cbb 100644
--- a/Examples/test-suite/template_default_class_parms_typedef.i
+++ b/Examples/test-suite/template_default_class_parms_typedef.i
@@ -4,6 +4,10 @@
%feature("python:nondynamic");
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%inline %{
namespace Space {
struct SomeType {};
diff --git a/Examples/test-suite/template_empty_inherit.i b/Examples/test-suite/template_empty_inherit.i
new file mode 100644
index 000000000..5677b8b1a
--- /dev/null
+++ b/Examples/test-suite/template_empty_inherit.i
@@ -0,0 +1,34 @@
+%module template_empty_inherit
+
+%rename(FunctorOperator) operator();
+
+%inline %{
+template<class Arg, typename Result> struct Functor {
+ virtual Result operator()(Arg x) const = 0;
+ virtual ~Functor() {}
+};
+%}
+
+// Bug fix - %ignore was resulting in this warning:
+// Warning 401: Base class 'Functor< int,int >' has no name as it is an empty template instantiated with '%template()'. Ignored.
+%ignore Functor<int, int>;
+%template() Functor<int, int>;
+
+%inline %{
+#include <algorithm>
+#include <iterator>
+struct SquareFunctor : Functor<int, int> {
+ int operator()(int v) const { return v*v; }
+};
+%}
+
+%include <std_vector.i>
+%template(VectorInt) std::vector<int>;
+
+%inline %{
+std::vector<int> squares(const std::vector<int>& vi) {
+ std::vector<int> result;
+ std::transform(vi.begin(), vi.end(), std::back_inserter(result), SquareFunctor());
+ return result;
+}
+%}
diff --git a/Examples/test-suite/template_nested_typemaps.i b/Examples/test-suite/template_nested_typemaps.i
index 54f5bc503..577a88e14 100644
--- a/Examples/test-suite/template_nested_typemaps.i
+++ b/Examples/test-suite/template_nested_typemaps.i
@@ -1,25 +1,30 @@
-#pragma SWIG nowarn=SWIGWARN_PARSE_NESTED_TEMPLATE
-
%module template_nested_typemaps
-// Testing that the typemaps invoked within a class via %template are picked up by appropriate methods
+#pragma SWIG nowarn=SWIGWARN_PARSE_NAMED_NESTED_CLASS
-template <typename T> struct Typemap {
- %typemap(in) T {
- $1 = -99;
- }
-};
-template <> struct Typemap<short> { // Note explicit specialization
- %typemap(in) short {
- $1 = -77;
- }
-};
+// Testing that the typemaps invoked within a class via %template are picked up by appropriate methods
+// Only for languages that support nested classes
%inline %{
int globalInt1(int s) { return s; }
short globalShort1(short s) { return s; }
template <typename T> struct Breeze {
+ template <typename TMT> struct Typemap {
+#ifdef SWIG
+ %typemap(in) TMT {
+ $1 = -99;
+ }
+#endif
+ };
+ template <typename TMT> struct TypemapShort {
+#ifdef SWIG
+ %typemap(in) short {
+ $1 = -77;
+ }
+#endif
+ };
+
int methodInt1(int s) { return s; }
#if defined(SWIG)
%template() Typemap<int>;
@@ -29,7 +34,7 @@ template <typename T> struct Breeze {
short methodShort1(short s) { return s; }
#if defined(SWIG)
- %template(TypemapShort) Typemap<short>; // should issue warning SWIGWARN_PARSE_NESTED_TEMPLATE
+ %template() TypemapShort<short>;
#endif
short methodShort2(short s) { return s; } // should pick up the typemap within Typemap<short>
};
diff --git a/Examples/test-suite/template_opaque.i b/Examples/test-suite/template_opaque.i
index b910e47e3..7aafd62e8 100644
--- a/Examples/test-suite/template_opaque.i
+++ b/Examples/test-suite/template_opaque.i
@@ -36,7 +36,4 @@ namespace A {
}
}
-#ifndef SWIGCSHARP
-// C# vector typemaps only ready for simple cases right now
%template(OpaqueVectorType) std::vector<A::OpaqueType>;
-#endif
diff --git a/Examples/test-suite/template_parameters_global_scope.i b/Examples/test-suite/template_parameters_global_scope.i
new file mode 100644
index 000000000..a828187b5
--- /dev/null
+++ b/Examples/test-suite/template_parameters_global_scope.i
@@ -0,0 +1,133 @@
+%module template_parameters_global_scope
+
+%inline %{
+namespace Alloc {
+ template<typename T> struct Rebind {
+ typedef int Integer;
+ };
+}
+%}
+
+%inline %{
+struct Bucket_ {};
+typedef Bucket_ TDBucket;
+typedef ::Bucket_ TDGlobalBucket;
+%}
+
+// Check 1: %template no unary scope operator
+%template(RebindBucket) Alloc::Rebind< Bucket_ >;
+
+%inline %{
+Alloc::Rebind< Bucket_ >::Integer Bucket1() { return 1; }
+Alloc::Rebind< ::Bucket_ >::Integer Bucket2() { return 2; }
+Alloc::Rebind< TDBucket >::Integer Bucket3() { return 3; }
+Alloc::Rebind< ::TDBucket >::Integer Bucket4() { return 4; }
+Alloc::Rebind< TDGlobalBucket >::Integer Bucket5() { return 5; }
+Alloc::Rebind< ::TDGlobalBucket >::Integer Bucket6() { return 6; }
+%}
+
+// Check 2: %template with unary scope operator
+%inline %{
+struct Spade {};
+typedef Spade TDSpade;
+typedef ::Spade TDGlobalSpade;
+%}
+%template(RebindSpade) Alloc::Rebind< ::Spade >;
+
+%inline %{
+Alloc::Rebind< Spade >::Integer Spade1() { return 1; }
+Alloc::Rebind< ::Spade >::Integer Spade2() { return 2; }
+Alloc::Rebind< TDSpade >::Integer Spade3() { return 3; }
+Alloc::Rebind< ::TDSpade >::Integer Spade4() { return 4; }
+Alloc::Rebind< TDGlobalSpade >::Integer Spade5() { return 5; }
+Alloc::Rebind< ::TDGlobalSpade >::Integer Spade6() { return 6; }
+%}
+
+// Check 3: %template typedef no unary scope operator
+%inline %{
+struct Ball {};
+typedef Ball TDBall;
+typedef ::Ball TDGlobalBall;
+%}
+%template(RebindBall) Alloc::Rebind< TDBall >;
+
+%inline %{
+Alloc::Rebind< Ball >::Integer Ball1() { return 1; }
+Alloc::Rebind< ::Ball >::Integer Ball2() { return 2; }
+Alloc::Rebind< TDBall >::Integer Ball3() { return 3; }
+Alloc::Rebind< ::TDBall >::Integer Ball4() { return 4; }
+Alloc::Rebind< TDGlobalBall >::Integer Ball5() { return 5; }
+Alloc::Rebind< ::TDGlobalBall >::Integer Ball6() { return 6; }
+%}
+
+// Check 4: %template typedef with unary scope operator
+%inline %{
+struct Bat {};
+typedef Bat TDBat;
+typedef ::Bat TDGlobalBat;
+%}
+%template(RebindBat) Alloc::Rebind< ::TDBat >;
+
+%inline %{
+Alloc::Rebind< Bat >::Integer Bat1() { return 1; }
+Alloc::Rebind< ::Bat >::Integer Bat2() { return 2; }
+Alloc::Rebind< TDBat >::Integer Bat3() { return 3; }
+Alloc::Rebind< ::TDBat >::Integer Bat4() { return 4; }
+Alloc::Rebind< TDGlobalBat >::Integer Bat5() { return 5; }
+Alloc::Rebind< ::TDGlobalBat >::Integer Bat6() { return 6; }
+%}
+
+// Check 5: %template double typedef no unary scope operator
+%inline %{
+struct Chair {};
+typedef Chair TDChair;
+typedef ::Chair TDGlobalChair;
+%}
+%template(RebindChair) Alloc::Rebind< TDGlobalChair >;
+
+%inline %{
+Alloc::Rebind< Chair >::Integer Chair1() { return 1; }
+Alloc::Rebind< ::Chair >::Integer Chair2() { return 2; }
+Alloc::Rebind< TDChair >::Integer Chair3() { return 3; }
+Alloc::Rebind< ::TDChair >::Integer Chair4() { return 4; }
+Alloc::Rebind< TDGlobalChair >::Integer Chair5() { return 5; }
+Alloc::Rebind< ::TDGlobalChair >::Integer Chair6() { return 6; }
+%}
+
+// Check 6: %template double typedef with unary scope operator
+%inline %{
+struct Table {};
+typedef Table TDTable;
+typedef ::Table TDGlobalTable;
+%}
+%template(RebindTable) Alloc::Rebind< ::TDGlobalTable >;
+
+%inline %{
+Alloc::Rebind< Table >::Integer Table1() { return 1; }
+Alloc::Rebind< ::Table >::Integer Table2() { return 2; }
+Alloc::Rebind< TDTable >::Integer Table3() { return 3; }
+Alloc::Rebind< ::TDTable >::Integer Table4() { return 4; }
+Alloc::Rebind< TDGlobalTable >::Integer Table5() { return 5; }
+Alloc::Rebind< ::TDGlobalTable >::Integer Table6() { return 6; }
+%}
+
+#if 0
+%inline %{
+namespace Alloc {
+ template<typename T=::Spade/*, typename T2=TDSpade, typename T3=::TDSpade, typename T4=TDGlobalSpade, typename T5=::TDGlobalSpade*/> struct Rejig {
+ typedef int Integer;
+ };
+}
+%}
+
+%template(RejigSpade) Alloc::Rejig<::Spade>;
+
+%inline %{
+Alloc::Rejig<>::Integer rejig1() { return 1; }
+Alloc::Rejig< ::Spade >::Integer rejig2() { return 2; }
+Alloc::Rejig< ::TDSpade >::Integer rejig3() { return 3; }
+Alloc::Rejig< ::TDSpade >::Integer rejig4() { return 4; }
+Alloc::Rejig< TDGlobalSpade >::Integer rejig5() { return 5; }
+Alloc::Rejig< ::TDGlobalSpade >::Integer rejig6() { return 6; }
+%}
+#endif
diff --git a/Examples/test-suite/template_partial_specialization.i b/Examples/test-suite/template_partial_specialization.i
index 8781fbbda..9727b52f8 100644
--- a/Examples/test-suite/template_partial_specialization.i
+++ b/Examples/test-suite/template_partial_specialization.i
@@ -12,10 +12,10 @@ namespace One {
template <> struct OneParm<int * const &> { void g() {} };
template <> struct OneParm<int **> { void h() {} };
- template <> struct OneParm<float> { void i() {} };
- template <> struct OneParm<float *> { void j() {} };
- template <> struct OneParm<float **> { void k() {} };
- template <> struct OneParm<float ***> { void l() {} };
+ template <> struct OneParm<float> { void j() {} };
+ template <> struct OneParm<float *> { void k() {} };
+ template <> struct OneParm<float **> { void m() {} };
+ template <> struct OneParm<float ***> { void n() {} };
}
%}
@@ -32,17 +32,17 @@ namespace One {
%template(H) One::OneParm<int **>;
// %template scope explicit specializations
-namespace ONE {
- %template(I) One::OneParm<float>;
- %template(J) ::One::OneParm<float *>;
+namespace One {
+ %template(J) One::OneParm<float>;
+ %template(K) ::One::OneParm<float *>;
}
-%template(K) ::One::OneParm<float **>;
+%template(M) ::One::OneParm<float **>;
namespace One {
- %template(L) OneParm<float ***>;
+ %template(N) OneParm<float ***>;
}
// %template scope partial specializations
-namespace ONE {
+namespace One {
%template(BB) One::OneParm<bool *>;
%template(BBB) ::One::OneParm<char *>;
}
diff --git a/Examples/test-suite/template_partial_specialization_typedef.i b/Examples/test-suite/template_partial_specialization_typedef.i
index 6fdbf99aa..6f8a11591 100644
--- a/Examples/test-suite/template_partial_specialization_typedef.i
+++ b/Examples/test-suite/template_partial_specialization_typedef.i
@@ -39,10 +39,10 @@ namespace One {
template <> struct OneParm<int * const &> { void g() {} };
template <> struct OneParm<int **> { void h() {} };
- template <> struct OneParm<float> { void i() {} };
- template <> struct OneParm<float *> { void j() {} };
- template <> struct OneParm<float **> { void k() {} };
- template <> struct OneParm<float ***> { void l() {} };
+ template <> struct OneParm<float> { void j() {} };
+ template <> struct OneParm<float *> { void k() {} };
+ template <> struct OneParm<float **> { void m() {} };
+ template <> struct OneParm<float ***> { void n() {} };
}
%}
@@ -59,17 +59,17 @@ namespace One {
%template(H) One::OneParm<TypeDef::IntPtrPtr>;
// %template scope explicit specializations
-namespace ONE {
- %template(I) One::OneParm<TypeDef::Float>;
- %template(J) ::One::OneParm<TypeDef::FloatPtr>;
+namespace One {
+ %template(J) One::OneParm<TypeDef::Float>;
+ %template(K) ::One::OneParm<TypeDef::FloatPtr>;
}
-%template(K) ::One::OneParm<TypeDef::FloatPtrPtr>;
+%template(M) ::One::OneParm<TypeDef::FloatPtrPtr>;
namespace One {
- %template(L) OneParm<TypeDef::FloatPtrPtrPtr>;
+ %template(N) OneParm<TypeDef::FloatPtrPtrPtr>;
}
// %template scope partial specializations
-namespace ONE {
+namespace One {
%template(BB) One::OneParm<TypeDef::BoolPtr>;
%template(BBB) ::One::OneParm<TypeDef::CharPtr>;
}
diff --git a/Examples/test-suite/template_typedef_class_template.i b/Examples/test-suite/template_typedef_class_template.i
index fc8151ff0..e391c6a3a 100644
--- a/Examples/test-suite/template_typedef_class_template.i
+++ b/Examples/test-suite/template_typedef_class_template.i
@@ -1,5 +1,9 @@
%module template_typedef_class_template
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%inline %{
namespace Standard {
template <class T, class U > struct Pair {
diff --git a/Examples/test-suite/template_typedef_cplx5.i b/Examples/test-suite/template_typedef_cplx5.i
index 84b09fd78..566696992 100644
--- a/Examples/test-suite/template_typedef_cplx5.i
+++ b/Examples/test-suite/template_typedef_cplx5.i
@@ -7,7 +7,7 @@
%inline %{
- // This typedef triggers an inifinite recursion
+ // This typedef triggers an infinite recursion
// in the next test1() nd test2() function declarations
typedef std::complex<double> complex;
diff --git a/Examples/test-suite/template_typemaps.i b/Examples/test-suite/template_typemaps.i
index d01945460..38a9c66de 100644
--- a/Examples/test-suite/template_typemaps.i
+++ b/Examples/test-suite/template_typemaps.i
@@ -25,6 +25,10 @@
%typemap(out) Integer2 { /* do nothing */ }
#endif
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%{
typedef int Integer1;
%}
diff --git a/Examples/test-suite/template_typemaps_typedef.i b/Examples/test-suite/template_typemaps_typedef.i
index 022fe884f..44c485dfb 100644
--- a/Examples/test-suite/template_typemaps_typedef.i
+++ b/Examples/test-suite/template_typemaps_typedef.i
@@ -2,6 +2,10 @@
// Similar to template_typedef_class_template
// Testing typemaps of a typedef of a nested class in a template and where the template uses default parameters
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%inline %{
namespace Standard {
template <class T, class U > struct Pair {
diff --git a/Examples/test-suite/template_typemaps_typedef2.i b/Examples/test-suite/template_typemaps_typedef2.i
index 64055c4ea..443fa3627 100644
--- a/Examples/test-suite/template_typemaps_typedef2.i
+++ b/Examples/test-suite/template_typemaps_typedef2.i
@@ -4,6 +4,10 @@
// Similar to template_typedef_class_template
// Testing typemaps of a typedef of a nested class in a template and where the template uses default parameters
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%inline %{
namespace Standard {
template <class T, class U > struct Pair {
diff --git a/Examples/test-suite/template_using_directive_typedef.i b/Examples/test-suite/template_using_directive_typedef.i
new file mode 100644
index 000000000..1c8bcb9dd
--- /dev/null
+++ b/Examples/test-suite/template_using_directive_typedef.i
@@ -0,0 +1,44 @@
+%module template_using_directive_typedef
+
+%inline %{
+namespace space {
+ template<typename T> class Vector {};
+ class VectorClass {};
+}
+struct Obj {};
+%}
+
+%template(Vector_Obj) space::Vector<Obj>;
+
+%inline %{
+namespace tns {
+ using space::Vector; // template using directives were not being added into the typedef table
+ using space::VectorClass;
+ typedef Vector<Obj> NSVec;
+}
+%}
+
+%inline %{
+namespace tns {
+ struct Holder {
+// using Vec = Vector<Obj>;
+ typedef Vector<Obj> Vec;
+ typedef VectorClass VecClass;
+ Vec items;
+ void holder_use1(space::Vector<Obj>, tns::NSVec, tns::Vector<Obj>) {}
+ void holder_use2(space::Vector<Obj>, NSVec, Vector<Obj>) {}
+ void holder_use3(tns::Holder::Vec, Holder::Vec, Vec) {}
+ };
+ void tns_holder_use(tns::Holder::Vec, Holder::Vec) {}
+ void tns_use(space::Vector<Obj>, NSVec, tns::NSVec) {}
+}
+void global_holder_use(tns::Holder::Vec) {}
+void global_use(space::Vector<Obj>, tns::NSVec, tns::Vector<Obj>) {}
+namespace ns1 {
+ void ns1_holder_use(tns::Holder::Vec) {}
+}
+namespace ns2 {
+ using namespace tns;
+ void ns2_holder_use(tns::Holder::Vec, Holder::Vec, NSVec, Vector<Obj>) {}
+}
+%}
diff --git a/Examples/test-suite/template_virtual.i b/Examples/test-suite/template_virtual.i
index 8c844f946..c760e1833 100644
--- a/Examples/test-suite/template_virtual.i
+++ b/Examples/test-suite/template_virtual.i
@@ -1,7 +1,7 @@
%module template_virtual
// Submitted by Marcelo Matus
-// assertion emmitted with templates + derivation + pure virtual member
+// assertion emitted with templates + derivation + pure virtual member
// allocate.cxx:47: int Allocate::is_abstract_inherit(Node*, Node*):
// Assertion `dn' failed.
diff --git a/Examples/test-suite/threads_exception.i b/Examples/test-suite/threads_exception.i
index caa79c78e..4708633db 100644
--- a/Examples/test-suite/threads_exception.i
+++ b/Examples/test-suite/threads_exception.i
@@ -4,6 +4,14 @@
%module(threads="1") threads_exception
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+#define TESTCASE_THROW3(T1, T2, T3) throw(T1, T2, T3)
+%{
+#define TESTCASE_THROW1(T1)
+#define TESTCASE_THROW3(T1, T2, T3)
+%}
+
%{
struct A {};
%}
@@ -11,10 +19,6 @@ struct A {};
%inline %{
#include <string>
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
-
class Exc {
public:
Exc(int c, const char *m) {
@@ -28,24 +32,24 @@ public:
class Test {
public:
- int simple() throw(int) {
+ int simple() TESTCASE_THROW1(int) {
throw(37);
return 1;
}
- int message() throw(const char *) {
+ int message() TESTCASE_THROW1(const char *) {
throw("I died.");
return 1;
}
- int hosed() throw(Exc) {
+ int hosed() TESTCASE_THROW1(Exc) {
throw(Exc(42,"Hosed"));
return 1;
}
- int unknown() throw(A*) {
+ int unknown() TESTCASE_THROW1(A*) {
static A a;
throw &a;
return 1;
}
- int multi(int x) throw(int, const char *, Exc) {
+ int multi(int x) TESTCASE_THROW3(int, const char *, Exc) {
if (x == 1) throw(37);
if (x == 2) throw("Bleah!");
if (x == 3) throw(Exc(42,"No-go-diggy-die"));
diff --git a/Examples/test-suite/throw_exception.i b/Examples/test-suite/throw_exception.i
index 396c633a6..ed9288290 100644
--- a/Examples/test-suite/throw_exception.i
+++ b/Examples/test-suite/throw_exception.i
@@ -1,9 +1,11 @@
%module throw_exception
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+#define TESTCASE_THROW3(T1, T2, T3) throw(T1, T2, T3)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW1(T1)
+#define TESTCASE_THROW3(T1, T2, T3)
%}
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum1;
@@ -30,45 +32,45 @@ namespace Namespace {
}
class Foo {
public:
- void test_int() throw(int) {
+ void test_int() TESTCASE_THROW1(int) {
throw 37;
}
- void test_msg() throw(const char *) {
+ void test_msg() TESTCASE_THROW1(const char *) {
throw "Dead";
}
- void test_cls() throw(CError) {
+ void test_cls() TESTCASE_THROW1(CError) {
throw CError();
}
- void test_cls_ptr() throw(CError *) {
+ void test_cls_ptr() TESTCASE_THROW1(CError *) {
static CError StaticError;
throw &StaticError;
}
- void test_cls_ref() throw(CError &) {
+ void test_cls_ref() TESTCASE_THROW1(CError &) {
static CError StaticError;
throw StaticError;
}
- void test_cls_td() throw(Namespace::ErrorTypedef) {
+ void test_cls_td() TESTCASE_THROW1(Namespace::ErrorTypedef) {
throw CError();
}
- void test_cls_ptr_td() throw(Namespace::ErrorPtr) {
+ void test_cls_ptr_td() TESTCASE_THROW1(Namespace::ErrorPtr) {
static CError StaticError;
throw &StaticError;
}
- void test_cls_ref_td() throw(Namespace::ErrorRef) {
+ void test_cls_ref_td() TESTCASE_THROW1(Namespace::ErrorRef) {
static CError StaticError;
throw StaticError;
}
- void test_array() throw(Namespace::IntArray) {
+ void test_array() TESTCASE_THROW1(Namespace::IntArray) {
static Namespace::IntArray array;
for (int i=0; i<10; i++) {
array[i] = i;
}
throw array;
}
- void test_enum() throw(Namespace::EnumTest) {
+ void test_enum() TESTCASE_THROW1(Namespace::EnumTest) {
throw Namespace::enum2;
}
- void test_multi(int x) throw(int, const char *, CError) {
+ void test_multi(int x) TESTCASE_THROW3(int, const char *, CError) {
if (x == 1) throw 37;
if (x == 2) throw "Dead";
if (x == 3) throw CError();
diff --git a/Examples/test-suite/typedef_classforward_same_name.i b/Examples/test-suite/typedef_classforward_same_name.i
new file mode 100644
index 000000000..ad2e456f8
--- /dev/null
+++ b/Examples/test-suite/typedef_classforward_same_name.i
@@ -0,0 +1,15 @@
+%module typedef_classforward_same_name
+
+%inline %{
+typedef struct Foo Foo;
+struct Foo {
+ int x;
+};
+int extractFoo(Foo* foo) { return foo->x; }
+
+struct Boo {
+ int x;
+};
+typedef struct Boo Boo;
+int extractBoo(Boo* boo) { return boo->x; }
+%}
diff --git a/Examples/test-suite/typedef_funcptr.i b/Examples/test-suite/typedef_funcptr.i
index f8cdd14b3..45ea99ef2 100644
--- a/Examples/test-suite/typedef_funcptr.i
+++ b/Examples/test-suite/typedef_funcptr.i
@@ -21,6 +21,16 @@ extern "C"
Integer do_op(Integer x, Integer y, Integer (*op)(Integer, Integer)) {
return (*op)(x,y);
}
+
+typedef int (*FnPtr_int_td)(int, int);
+int do_op_typedef_int(int x, int y, FnPtr_int_td op) {
+ return (*op)(x,y);
+}
+
+typedef Integer (*FnPtr_Integer_td)(Integer, Integer);
+Integer do_op_typedef_Integer(Integer x, Integer y, FnPtr_Integer_td op) {
+ return (*op)(x,y);
+}
%}
%constant int addf(int x, int y);
diff --git a/Examples/test-suite/typemap_delete.i b/Examples/test-suite/typemap_delete.i
index eb6abe73c..fa62803cb 100644
--- a/Examples/test-suite/typemap_delete.i
+++ b/Examples/test-suite/typemap_delete.i
@@ -1,5 +1,9 @@
%module typemap_delete
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
+#endif
+
%typemap(in) Rect* (Rect temp) {
$1 = 0;
will_not_compile
diff --git a/Examples/test-suite/typemap_template.i b/Examples/test-suite/typemap_template.i
index 7ef77c79d..9f283105b 100644
--- a/Examples/test-suite/typemap_template.i
+++ b/Examples/test-suite/typemap_template.i
@@ -27,7 +27,7 @@ template<typename T> struct TemplateTest1 {
%template(TTint) TemplateTest1< int >;
%inline %{
- void extratest(const TemplateTest1< YY > &t,
+ void extratest(const TemplateTest1< YY > &t,
const TemplateTest1< ZZ > &tt,
const TemplateTest1< int > &ttt)
{}
@@ -38,3 +38,27 @@ template<typename T> struct TemplateTest1 {
%inline %{
void wasbug(TemplateTest1< int >::Double wbug) {}
%}
+
+/* Test bug where the %apply directive was ignored inside anonymous template
+ * instantiations */
+
+template<class T>
+struct Foo {
+ %typemap(in) Foo<T> ""
+ %apply Foo<T> { const Foo<T> & }
+};
+
+%{
+template<class T> struct Foo {};
+%}
+
+%template(Foo_int) Foo<int>;
+%template() Foo<double>;
+
+%inline %{
+ void this_works(Foo<int> f) {}
+ void this_also_works(const Foo<int>& f) {}
+ void this_also_also_works(Foo<double> f) {}
+ void this_used_to_fail(const Foo<double>& f) {}
+%}
+
diff --git a/Examples/test-suite/typemap_template_parms.i b/Examples/test-suite/typemap_template_parms.i
new file mode 100644
index 000000000..90231e827
--- /dev/null
+++ b/Examples/test-suite/typemap_template_parms.i
@@ -0,0 +1,41 @@
+%module typemap_template_parms
+
+%typemap(ret) int "_this_will_not_compile_int_$symname"
+
+%extend X {
+%typemap(ret) T lake "/* ret lake X<T> */"
+%typemap(ret) T X<T>::rake "/* ret rake X<T> */"
+
+// Overrides below: %typemap(ret) T take
+%typemap(ret) T X<T>::take "/* ret take X<T> */"
+}
+
+%inline %{
+template<typename T> struct X {
+#if defined(SWIG)
+%typemap(ret) T bake "/* ret bake X<T> */"
+%typemap(ret) T X<T>::make "/* ret make X<T> */"
+%typemap(ret) T take "_rake_T_this_will_not_compile_"
+#endif
+ T bake() { return T(); }
+ T make() { return T(); }
+ T lake() { return T(); }
+ T rake() { return T(); }
+ T take() { return T(); }
+};
+%}
+
+%template(Xint) X<int>;
+
+
+// The function name and parameter name are both 'labels'
+%inline %{
+template <typename T>
+void labels(T labels) {}
+void voido(int vooo) {}
+%}
+
+// TODO: R has a problem with parameter names clashing with the function name
+#if !defined(SWIGR)
+%template(ShortLabels) labels<short>;
+#endif
diff --git a/Examples/test-suite/typemap_template_typedef.i b/Examples/test-suite/typemap_template_typedef.i
new file mode 100644
index 000000000..6605ec711
--- /dev/null
+++ b/Examples/test-suite/typemap_template_typedef.i
@@ -0,0 +1,66 @@
+%module typemap_template_typedef
+//%module("templatereduce") typemap_template_typedef
+
+%typemap(in) int TMAP55 %{ $1 = 55; /* int TMAP55 typemap */ %}
+%typemap(in) int TMAP66 %{ $1 = 66; /* int TMAP66 typemap */ %}
+%typemap(in) int TMAP77 %{ $1 = 77; /* int TMAP77 typemap */ %}
+%typemap(in) int TMAP88 %{ $1 = 88; /* int TMAP88 typemap */ %}
+
+%apply int TMAP77 { XXX<int>::Long cc }
+
+%inline %{
+typedef int MyInteger;
+
+template<typename T> struct XXX {
+#ifdef SWIG
+// In swig-3.0.12 'Long aa' was actually stored as 'long aa' in typemap table instead of 'XXX<int>::Long aa'
+%apply int TMAP55 { Long aa }
+%apply int TMAP66 { XXX<int>::Long bb }
+%apply int TMAP88 { XXX<MyInteger>::Long dd }
+#endif
+ typedef long Long;
+ long aa1(long aa) { return aa; }
+ long aa2(Long aa) { return aa; }
+ long bb1(long bb) { return bb; }
+ long bb2(Long bb) { return bb; }
+ long cc1(long cc) { return cc; }
+ long cc2(Long cc) { return cc; }
+ long dd1(long dd) { return dd; }
+ long dd2(Long dd) { return dd; }
+#ifdef SWIG
+%clear Long aa;
+%clear XXX<int>::Long bb;
+%clear XXX<MyInteger>::Long dd;
+#endif
+ long aa3(Long aa) { return aa; }
+ long bb3(Long bb) { return bb; }
+ long cc3(Long cc) { return cc; }
+ long dd3(Long dd) { return dd; }
+};
+%}
+
+%template(XXXInt) XXX<MyInteger>;
+
+%clear XXX<int>::Long cc;
+
+%inline %{
+ long aa1(XXX<int>::Long aa) { return aa; }
+ long aa2(long aa) { return aa; }
+ long bb1(XXX<int>::Long bb) { return bb; }
+ long bb2(long bb) { return bb; }
+ long cc1(XXX<int>::Long cc) { return cc; }
+ long cc2(long cc) { return cc; }
+ long dd1(XXX<MyInteger>::Long dd) { return dd; }
+ long dd2(long dd) { return dd; }
+%}
+
+%inline %{
+typedef MyInteger MY_INTEGER;
+template<typename T1, typename T2 = MY_INTEGER> struct YYY {
+ void meff(T1 t1, T2 t2) {}
+};
+%}
+%template(YYYIntInt) YYY<MY_INTEGER>;
+%inline %{
+ void whyohwhy(YYY<MY_INTEGER> yy) {}
+%}
diff --git a/Examples/test-suite/unicode_strings.i b/Examples/test-suite/unicode_strings.i
index 9be3748e6..e7266266e 100644
--- a/Examples/test-suite/unicode_strings.i
+++ b/Examples/test-suite/unicode_strings.i
@@ -20,4 +20,6 @@ char *charstring(char *s) {
return s;
}
+void instring(const char *s) {
+}
%}
diff --git a/Examples/test-suite/using_pointers.i b/Examples/test-suite/using_pointers.i
index b2d6abe4d..1a3824afa 100644
--- a/Examples/test-suite/using_pointers.i
+++ b/Examples/test-suite/using_pointers.i
@@ -4,10 +4,10 @@
%csmethodmodifiers x "public new"
#endif
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW2(T1, T2) throw(T1, T2)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW2(T1, T2)
%}
%inline %{
@@ -16,7 +16,7 @@
int x;
virtual ~Foo() { }
virtual Foo* blah() { return this; }
- virtual Foo* exception_spec(int what_to_throw) throw (int, const char *) {
+ virtual Foo* exception_spec(int what_to_throw) TESTCASE_THROW2(int, const char *) {
int num = 10;
const char *str = "exception message";
if (what_to_throw == 1) throw num;
diff --git a/Examples/test-suite/valuewrapper_opaque.i b/Examples/test-suite/valuewrapper_opaque.i
index 52da89391..bc7ba8683 100644
--- a/Examples/test-suite/valuewrapper_opaque.i
+++ b/Examples/test-suite/valuewrapper_opaque.i
@@ -4,6 +4,10 @@
* Opaque types
*/
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
%feature("valuewrapper") C;
class C;
diff --git a/Examples/test-suite/varargs_overload.i b/Examples/test-suite/varargs_overload.i
index 9a24e15a8..eb9dcaab9 100644
--- a/Examples/test-suite/varargs_overload.i
+++ b/Examples/test-suite/varargs_overload.i
@@ -44,3 +44,47 @@ const char *vararg_over4(int i) {
return buffer;
}
%}
+
+
+// Same as above but non-vararg function declared first
+
+%inline %{
+const char *vararg_over6(int i) {
+ static char buffer[256];
+ sprintf(buffer, "%d", i);
+ return buffer;
+}
+const char *vararg_over6(const char *fmt, ...) {
+ return fmt;
+}
+
+const char *vararg_over7(int i, double j) {
+ static char buffer[256];
+ sprintf(buffer, "%d %g", i, j);
+ return buffer;
+}
+const char *vararg_over7(const char *fmt, ...) {
+ return fmt;
+}
+
+const char *vararg_over8(int i, double j, const char *s) {
+ static char buffer[256];
+ sprintf(buffer, "%d %g %s", i, j, s);
+ return buffer;
+}
+const char *vararg_over8(const char *fmt, ...) {
+ return fmt;
+}
+%}
+
+%varargs(int mode = 0) vararg_over9;
+%inline %{
+const char *vararg_over9(int i) {
+ static char buffer[256];
+ sprintf(buffer, "%d", i);
+ return buffer;
+}
+const char *vararg_over9(const char *fmt, ...) {
+ return fmt;
+}
+%}
diff --git a/Examples/test-suite/virtual_derivation.i b/Examples/test-suite/virtual_derivation.i
index a199646d4..59b7fcea1 100644
--- a/Examples/test-suite/virtual_derivation.i
+++ b/Examples/test-suite/virtual_derivation.i
@@ -58,6 +58,7 @@
class IndexReader{
public:
virtual void norms() = 0;
+ virtual ~IndexReader() {}
};
class MultiReader : public IndexReader {
diff --git a/Examples/test-suite/virtual_poly.i b/Examples/test-suite/virtual_poly.i
index 5f2f1d201..8b500539e 100644
--- a/Examples/test-suite/virtual_poly.i
+++ b/Examples/test-suite/virtual_poly.i
@@ -13,6 +13,10 @@
#endif
%}
+#ifdef SWIGOCAML
+%warnfilter(SWIGWARN_PARSE_KEYWORD) method;
+#endif
+
//
// Check this example with directors wherever possible.
//
diff --git a/Lib/allegrocl/allegrocl.swg b/Lib/allegrocl/allegrocl.swg
index 152e5e6f0..524aa7c11 100644
--- a/Lib/allegrocl/allegrocl.swg
+++ b/Lib/allegrocl/allegrocl.swg
@@ -232,6 +232,8 @@ $body)"
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
/* name conversion for overloaded operators. */
#ifdef __cplusplus
diff --git a/Lib/allegrocl/std_list.i b/Lib/allegrocl/std_list.i
index 4e260897f..a3660c9f7 100644
--- a/Lib/allegrocl/std_list.i
+++ b/Lib/allegrocl/std_list.i
@@ -28,17 +28,20 @@ namespace std{
template<class T> class list
{
public:
-
- typedef T &reference;
- typedef const T& const_reference;
+ 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;
typedef T &iterator;
typedef const T& const_iterator;
-
+
list();
list(unsigned int size, const T& value = T());
- list(const list<T> &);
+ list(const list& other);
- ~list();
void assign(unsigned int n, const T& value);
void swap(list<T> &x);
@@ -46,21 +49,20 @@ namespace std{
const_reference back();
const_iterator begin();
const_iterator end();
-
+
void resize(unsigned int n, T c = T());
bool empty() const;
void push_front(const T& INPUT);
void push_back(const T& INPUT);
-
void pop_front();
void pop_back();
void clear();
unsigned int size() const;
unsigned int max_size() const;
void resize(unsigned int n, const T& INPUT);
-
+
void remove(const T& INPUT);
void unique();
void reverse();
@@ -153,7 +155,7 @@ namespace std{
if (j<0) j += size;
if (i<0) i = 0;
if (j>size) j = size;
-
+
for (int k=0;k<i;k++)
{
first++;
@@ -174,7 +176,7 @@ namespace std{
if (j<0) j += size;
if (i<0) i = 0;
if (j>size) j = size;
-
+
for (int k=0;k<i;k++)
{
first++;
@@ -200,7 +202,6 @@ namespace std{
}
else self->insert(self->end(),v.begin(),v.end());
}
-
}
unsigned int __len__()
{
@@ -218,8 +219,7 @@ namespace std{
{
self->pop_back();
}
-
- };
+ }
};
}
diff --git a/Lib/allkw.swg b/Lib/allkw.swg
index b9413191f..2d3cf6ea9 100644
--- a/Lib/allkw.swg
+++ b/Lib/allkw.swg
@@ -16,7 +16,6 @@
*/
-%include <chicken/chickenkw.swg>
%include <csharp/csharpkw.swg>
%include <d/dkw.swg>
%include <go/gokw.swg>
@@ -24,9 +23,7 @@
%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 <r/rkw.swg>
%include <ruby/rubykw.swg>
diff --git a/Lib/cdata.i b/Lib/cdata.i
index 3ac693cfc..f18ed4af5 100644
--- a/Lib/cdata.i
+++ b/Lib/cdata.i
@@ -21,21 +21,6 @@ typedef struct SWIGCDATA {
}
%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 SWIGPHP5
-
-%typemap(out) SWIGCDATA {
- ZVAL_STRINGL($result, $1.data, $1.len, 1);
-}
-%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
-
#elif SWIGPHP7
%typemap(out) SWIGCDATA {
diff --git a/Lib/cffi/cffi.swg b/Lib/cffi/cffi.swg
index 3ad767ef8..f7294956f 100644
--- a/Lib/cffi/cffi.swg
+++ b/Lib/cffi/cffi.swg
@@ -136,6 +136,8 @@
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
%{
diff --git a/Lib/chicken/chicken.swg b/Lib/chicken/chicken.swg
index 17f0d0ac3..7df676754 100644
--- a/Lib/chicken/chicken.swg
+++ b/Lib/chicken/chicken.swg
@@ -11,8 +11,9 @@
#include <chicken.h>
%}
-%insert(runtime) "swigrun.swg"; // Common C API type-checking code
-%insert(runtime) "chickenrun.swg"; // CHICKEN run-time code
+%insert(runtime) "swigrun.swg" // Common C API type-checking code
+%insert(runtime) "swigerrors.swg" // SWIG errors
+%insert(runtime) "chickenrun.swg" // CHICKEN run-time code
/* -----------------------------------------------------------------------------
* standard typemaps
@@ -617,7 +618,7 @@ $result = C_SCHEME_UNDEFINED;
$1 = C_swig_is_string ($input);
}
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
+%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
void *ptr;
$1 = !SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0);
}
@@ -630,33 +631,30 @@ $result = C_SCHEME_UNDEFINED;
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &
{
void *ptr = 0;
- if (SWIG_ConvertPtr($input, &ptr, $descriptor, 0)) {
- /* error */
+ if (SWIG_ConvertPtr($input, &ptr, $descriptor, SWIG_POINTER_NO_NULL)) {
$1 = 0;
} else {
- $1 = (ptr != 0);
+ $1 = 1;
}
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &&
{
void *ptr = 0;
- if (SWIG_ConvertPtr($input, &ptr, $descriptor, 0)) {
- /* error */
+ if (SWIG_ConvertPtr($input, &ptr, $descriptor, SWIG_POINTER_NO_NULL)) {
$1 = 0;
} else {
- $1 = (ptr != 0);
+ $1 = 1;
}
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
{
void *ptr = 0;
- if (SWIG_ConvertPtr($input, &ptr, $&descriptor, 0)) {
- /* error */
+ if (SWIG_ConvertPtr($input, &ptr, $&descriptor, SWIG_POINTER_NO_NULL)) {
$1 = 0;
} else {
- $1 = (ptr != 0);
+ $1 = 1;
}
}
@@ -716,6 +714,8 @@ $result = C_SCHEME_UNDEFINED;
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
/* ------------------------------------------------------------
* Overloaded operator support
diff --git a/Lib/chicken/chickenrun.swg b/Lib/chicken/chickenrun.swg
index f13400181..bb14b4bc9 100644
--- a/Lib/chicken/chickenrun.swg
+++ b/Lib/chicken/chickenrun.swg
@@ -7,7 +7,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
+#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__BORLANDC__) || defined(_WATCOM)
# ifndef snprintf
# define snprintf _snprintf
# endif
@@ -265,6 +265,7 @@ SWIG_Chicken_ConvertPtr(C_word s, void **result, swig_type_info *type, int flags
if (s == C_SCHEME_FALSE) {
*result = NULL;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
} else if (C_swig_is_swigpointer(s)) {
/* try and convert type */
from = (swig_type_info *) C_block_item(s, 1);
diff --git a/Lib/csharp/arrays_csharp.i b/Lib/csharp/arrays_csharp.i
index 237067a88..861da8386 100644
--- a/Lib/csharp/arrays_csharp.i
+++ b/Lib/csharp/arrays_csharp.i
@@ -103,7 +103,47 @@ CSHARP_ARRAYS(long long, long)
CSHARP_ARRAYS(unsigned long long, ulong)
CSHARP_ARRAYS(float, float)
CSHARP_ARRAYS(double, double)
-CSHARP_ARRAYS(bool, bool)
+
+// By default C# will marshal bools as 4 bytes
+// UnmanagedType.I1 will change this to 1 byte
+// FIXME - When running on mono ArraySubType appears to be ignored and bools will be marshalled as 4-byte
+// https://github.com/mono/mono/issues/15592
+
+// input only arrays
+%typemap(ctype) bool INPUT[] "bool*"
+%typemap(cstype) bool INPUT[] "bool[]"
+%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INPUT[] "bool[]"
+%typemap(csin) bool INPUT[] "$csinput"
+
+%typemap(in) bool INPUT[] %{
+$1 = $input;
+%}
+%typemap(freearg) bool INPUT[] ""
+%typemap(argout) bool INPUT[] ""
+
+// output only arrays
+%typemap(ctype) bool OUTPUT[] "bool*"
+%typemap(cstype) bool OUTPUT[] "bool[]"
+%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool OUTPUT[] "bool[]"
+%typemap(csin) bool OUTPUT[] "$csinput"
+
+%typemap(in) bool OUTPUT[] %{
+$1 = $input;
+%}
+%typemap(freearg) bool OUTPUT[] ""
+%typemap(argout) bool OUTPUT[] ""
+
+// inout arrays
+%typemap(ctype) bool INOUT[] "bool*"
+%typemap(cstype) bool INOUT[] "bool[]"
+%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INOUT[] "bool[]"
+%typemap(csin) bool INOUT[] "$csinput"
+
+%typemap(in) bool INOUT[] %{
+$1 = $input;
+%}
+%typemap(freearg) bool INOUT[] ""
+%typemap(argout) bool INOUT[] ""
%define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE )
diff --git a/Lib/csharp/boost_intrusive_ptr.i b/Lib/csharp/boost_intrusive_ptr.i
index d0a048d16..fa3f53a20 100644
--- a/Lib/csharp/boost_intrusive_ptr.i
+++ b/Lib/csharp/boost_intrusive_ptr.i
@@ -314,7 +314,7 @@
}
%}
-%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
+%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) {
@@ -323,11 +323,10 @@
}
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 {
+%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) {
@@ -336,8 +335,7 @@
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
- global::System.GC.SuppressFinalize(this);
- base.Dispose();
+ base.Dispose(disposing);
}
}
@@ -473,7 +471,7 @@
}
%}
-%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
+%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) {
@@ -482,11 +480,10 @@
}
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 {
+%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) {
@@ -495,8 +492,7 @@
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
- global::System.GC.SuppressFinalize(this);
- base.Dispose();
+ base.Dispose(disposing);
}
}
@@ -505,6 +501,17 @@
%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"
+// Typecheck typemaps
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *")
+ TYPE CONST,
+ TYPE CONST &,
+ TYPE CONST *,
+ TYPE *CONST&,
+ 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 > *&
+ ""
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef
diff --git a/Lib/csharp/boost_shared_ptr.i b/Lib/csharp/boost_shared_ptr.i
index 2b65bf20d..508c0ec14 100644
--- a/Lib/csharp/boost_shared_ptr.i
+++ b/Lib/csharp/boost_shared_ptr.i
@@ -14,7 +14,7 @@
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
-%feature("unref") TYPE
+%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;"
@@ -28,9 +28,21 @@
return $null;
}
$1 = *argp; %}
-%typemap(out) CONST TYPE
+%typemap(out) CONST TYPE
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
+%typemap(directorin) CONST TYPE
+%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
+
+%typemap(directorout) CONST TYPE
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
+ return $null;
+ }
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
+ $result = *smartarg->get();
+%}
+
// plain pointer
%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
@@ -39,6 +51,13 @@
$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%}
+%typemap(directorin) CONST TYPE *
+%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
+
+%typemap(directorout) CONST TYPE * %{
+#error "typemaps for $1_type not available"
+%}
+
// 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);
@@ -49,6 +68,13 @@
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
+%typemap(directorin) CONST TYPE &
+%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (&$1 SWIG_NO_NULL_DELETER_0); %}
+
+%typemap(directorout) CONST TYPE & %{
+#error "typemaps for $1_type not available"
+%}
+
// plain pointer by reference
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
@@ -56,17 +82,41 @@
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
+%typemap(directorin) TYPE *CONST&
+%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
+
+%typemap(directorout) TYPE *CONST& %{
+#error "typemaps for $1_type not available"
+%}
+
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ if ($input) $1 = *($&1_ltype)$input; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ $result = $1 ? new $1_ltype($1) : 0; %}
+%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
+%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
+%{ if ($input) {
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
+ $result = *smartarg;
+ }
+%}
+
// shared_ptr by reference
%typemap(in, canthrow=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
-%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
+%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
+
+%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
+%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
+#error "typemaps for $1_type not available"
+%}
// shared_ptr by pointer
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
@@ -75,12 +125,26 @@
%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
if ($owner) delete $1; %}
+%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
+%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
+#error "typemaps for $1_type not available"
+%}
+
// shared_ptr by pointer reference
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
$1 = &temp; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
-%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
+%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
+
+%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
+%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
+#error "typemaps for $1_type not available"
+%}
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
@@ -91,20 +155,20 @@
%}
-%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
+%typemap (ctype) 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 > *& "void *"
-%typemap (imtype, out="global::System.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 > *& "global::System.Runtime.InteropServices.HandleRef"
-%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
+%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 > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE)"
-%typemap(csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
+%typemap(csin) 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 > *& "$typemap(cstype, TYPE).getCPtr($csinput)"
@@ -175,6 +239,18 @@
return ret;
} %}
+%typemap(csdirectorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($cscall).Handle"
+
+%typemap(csdirectorin) CONST TYPE,
+ CONST TYPE *,
+ CONST TYPE &,
+ TYPE *CONST& "($iminput == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)($iminput, true)"
+
+%typemap(csdirectorin) 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 > *& "($iminput == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)($iminput, true)"
+
// Proxy classes (base classes, ie, not derived classes)
%typemap(csbody) TYPE %{
@@ -206,7 +282,7 @@
}
%}
-%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
+%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) {
@@ -215,11 +291,10 @@
}
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 {
+%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) {
@@ -228,11 +303,21 @@
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
- global::System.GC.SuppressFinalize(this);
- base.Dispose();
+ base.Dispose(disposing);
}
}
+// Typecheck typemaps
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *")
+ TYPE CONST,
+ TYPE CONST &,
+ TYPE CONST *,
+ TYPE *CONST&,
+ 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 > *&
+ ""
+
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef
-
diff --git a/Lib/csharp/complex.i b/Lib/csharp/complex.i
new file mode 100644
index 000000000..4a6f91cdf
--- /dev/null
+++ b/Lib/csharp/complex.i
@@ -0,0 +1,5 @@
+#ifdef __cplusplus
+%include <std_complex.i>
+#else
+#error C# module only supports complex in C++ mode.
+#endif
diff --git a/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg
index 8dc2ba813..832206386 100644
--- a/Lib/csharp/csharp.swg
+++ b/Lib/csharp/csharp.swg
@@ -843,11 +843,26 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
$*csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
return ret;
}
+%typemap(csvarout, excode=SWIGEXCODE) SWIGTYPE *const& %{
+ get {
+ 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)
%{ temp = ($*1_ltype)$input;
$1 = ($1_ltype)&temp; %}
%typemap(out) SWIGTYPE *const&
%{ $result = (void *)*$1; %}
+%typemap(directorin) SWIGTYPE *const&
+%{ $input = (void *) $1; %}
+%typemap(directorout, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) SWIGTYPE *const&
+%{ static $*1_ltype swig_temp;
+ swig_temp = ($*1_ltype)$input;
+ $result = &swig_temp; %}
+%typemap(csdirectorin) SWIGTYPE *const& "($iminput == global::System.IntPtr.Zero) ? null : new $*csclassname($iminput, false)"
+%typemap(csdirectorout) SWIGTYPE *const& "$*csclassname.getCPtr($cscall).Handle"
/* Marshal C/C++ pointer to global::System.IntPtr */
%typemap(ctype) void *VOID_INT_PTR "void *"
@@ -944,17 +959,24 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
SWIG_CSBODY_PROXY(internal, internal, SWIGTYPE)
SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
-%typemap(csfinalize) SWIGTYPE %{
+%typemap(csdispose) SWIGTYPE %{
~$csclassname() {
- Dispose();
+ Dispose(false);
+ }
+
+ public void Dispose() {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
}
%}
+%typemap(csdispose_derived) SWIGTYPE ""
+
%typemap(csconstruct, excode=SWIGEXCODE,directorconnect="\n SwigDirectorConnect();") SWIGTYPE %{: this($imcall, true) {$excode$directorconnect
}
%}
-%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
+%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") SWIGTYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
@@ -963,11 +985,10 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
- global::System.GC.SuppressFinalize(this);
}
}
-%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
+%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") SWIGTYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
@@ -976,8 +997,7 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
- global::System.GC.SuppressFinalize(this);
- base.Dispose();
+ base.Dispose(disposing);
}
}
@@ -1011,6 +1031,8 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
/* csharp keywords */
%include <csharpkw.swg>
diff --git a/Lib/csharp/csharphead.swg b/Lib/csharp/csharphead.swg
index 0b55635b3..7db4c0e3c 100644
--- a/Lib/csharp/csharphead.swg
+++ b/Lib/csharp/csharphead.swg
@@ -244,6 +244,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
[global::System.ThreadStatic]
private static global::System.Exception pendingException = null;
private static int numExceptionsPending = 0;
+ private static global::System.Object exceptionsLock = null;
public static bool Pending {
get {
@@ -259,7 +260,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
if (pendingException != null)
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)) {
+ lock(exceptionsLock) {
numExceptionsPending++;
}
}
@@ -270,13 +271,17 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
if (pendingException != null) {
e = pendingException;
pendingException = null;
- lock(typeof($imclassname)) {
+ lock(exceptionsLock) {
numExceptionsPending--;
}
}
}
return e;
}
+
+ static SWIGPendingException() {
+ exceptionsLock = new global::System.Object();
+ }
}
%}
#endif // SWIG_CSHARP_NO_EXCEPTION_HELPER
diff --git a/Lib/csharp/director.swg b/Lib/csharp/director.swg
index 3438f2bf0..5d2ab5d9b 100644
--- a/Lib/csharp/director.swg
+++ b/Lib/csharp/director.swg
@@ -41,6 +41,10 @@ namespace Swig {
public:
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
}
+
+ static void raise(const char *msg) {
+ throw DirectorPureVirtualException(msg);
+ }
};
}
diff --git a/Lib/csharp/std_array.i b/Lib/csharp/std_array.i
index 61bb510de..a4f0f9640 100644
--- a/Lib/csharp/std_array.i
+++ b/Lib/csharp/std_array.i
@@ -174,7 +174,7 @@
bool empty() const;
%rename(Fill) fill;
- void fill(const value_type& val);
+ void fill(const value_type& value);
%rename(Swap) swap;
void swap(array& other);
diff --git a/Lib/csharp/std_complex.i b/Lib/csharp/std_complex.i
new file mode 100644
index 000000000..6a0cc5458
--- /dev/null
+++ b/Lib/csharp/std_complex.i
@@ -0,0 +1,95 @@
+/* -----------------------------------------------------------------------------
+ * std_complex.i
+ *
+ * Typemaps for handling std::complex<float> and std::complex<double> as a .NET
+ * System.Numerics.Complex type. Requires .NET 4 minimum.
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <complex>
+%}
+
+%fragment("SwigSystemNumericsComplex", "header") {
+extern "C" {
+// Identical to the layout of System.Numerics.Complex, but does assume that it is
+// LayoutKind.Sequential on the managed side
+struct SwigSystemNumericsComplex {
+ double real;
+ double imag;
+};
+}
+
+SWIGINTERN SwigSystemNumericsComplex SwigCreateSystemNumericsComplex(double real, double imag) {
+ SwigSystemNumericsComplex cpx;
+ cpx.real = real;
+ cpx.imag = imag;
+ return cpx;
+}
+}
+
+namespace std {
+
+%naturalvar complex;
+
+template<typename T>
+class complex
+{
+public:
+ complex(T re = T(), T im = T());
+};
+
+}
+
+%define SWIG_COMPLEX_TYPEMAPS(T)
+%typemap(ctype, fragment="SwigSystemNumericsComplex") std::complex<T>, const std::complex<T> & "SwigSystemNumericsComplex"
+%typemap(imtype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
+%typemap(cstype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
+
+%typemap(in) std::complex<T>
+%{$1 = std::complex< double >($input.real, $input.imag);%}
+
+%typemap(in) const std::complex<T> &($*1_ltype temp)
+%{temp = std::complex< T >((T)$input.real, (T)$input.imag);
+ $1 = &temp;%}
+
+%typemap(out, null="SwigCreateSystemNumericsComplex(0.0, 0.0)") std::complex<T>
+%{$result = SwigCreateSystemNumericsComplex($1.real(), $1.imag());%}
+
+%typemap(out, null="SwigCreateSystemNumericsComplex(0.0, 0.0)") const std::complex<T> &
+%{$result = SwigCreateSystemNumericsComplex($1->real(), $1->imag());%}
+
+%typemap(cstype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
+
+%typemap(csin) std::complex<T>, const std::complex<T> & "$csinput"
+
+%typemap(csout, excode=SWIGEXCODE) std::complex<T>, const std::complex<T> & {
+ System.Numerics.Complex ret = $imcall;$excode
+ return ret;
+ }
+
+%typemap(csvarin, excode=SWIGEXCODE2) const std::complex<T> & %{
+ set {
+ $imcall;$excode
+ }
+ %}
+
+%typemap(csvarout, excode=SWIGEXCODE2) const std::complex<T> & %{
+ get {
+ System.Numerics.Complex ret = $imcall;$excode
+ return ret;
+ }
+ %}
+
+%template() std::complex<T>;
+%enddef
+
+// By default, typemaps for both std::complex<double> and std::complex<float>
+// are defined, but one of them can be disabled by predefining the
+// corresponding symbol before including this file.
+#ifndef SWIG_NO_STD_COMPLEX_DOUBLE
+SWIG_COMPLEX_TYPEMAPS(double)
+#endif
+
+#ifndef SWIG_NO_STD_COMPLEX_FLOAT
+SWIG_COMPLEX_TYPEMAPS(float)
+#endif
diff --git a/Lib/csharp/std_list.i b/Lib/csharp/std_list.i
new file mode 100644
index 000000000..674aba0ab
--- /dev/null
+++ b/Lib/csharp/std_list.i
@@ -0,0 +1,519 @@
+/* -----------------------------------------------------------------------------
+ * std_list.i
+ *
+ * SWIG typemaps for std::list<T>
+ * C# implementation
+ * The C# wrapper is made to look and feel like a C# System.Collections.Generic.LinkedList<> collection.
+ *
+ * Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
+ * C++ std::list wrappers. The ICollection<> interface is also implemented to provide enhanced functionality
+ * whenever we are confident that the required C++ operator== is available. This is the case for when
+ * T is a primitive type or a pointer. If T does define an operator==, then use the SWIG_STD_LIST_ENHANCED
+ * macro to obtain this enhanced functionality, for example:
+ *
+ * SWIG_STD_LIST_ENHANCED(SomeNamespace::Klass)
+ * %template(ListKlass) std::list<SomeNamespace::Klass>;
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// MACRO for use within the std::list class body
+%define SWIG_STD_LIST_MINIMUM_INTERNAL(CSINTERFACE, CTYPE...)
+%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
+
+%apply void *VOID_INT_PTR { std::list< CTYPE >::iterator * };
+
+%proxycode %{
+ public $csclassname(global::System.Collections.IEnumerable c) : this() {
+ if (c == null)
+ throw new global::System.ArgumentNullException("c");
+ foreach ($typemap(cstype, CTYPE) element in c) {
+ this.AddLast(element);
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public int Count {
+ get {
+ return (int)size();
+ }
+ }
+
+ public $csclassnameNode First {
+ get {
+ if (Count == 0)
+ return null;
+ return new $csclassnameNode(getFirstIter(), this);
+ }
+ }
+
+ public $csclassnameNode Last {
+ get {
+ if (Count == 0)
+ return null;
+ return new $csclassnameNode(getLastIter(), this);
+ }
+ }
+
+ public $csclassnameNode AddFirst($typemap(cstype, CTYPE) value) {
+ push_front(value);
+ return new $csclassnameNode(getFirstIter(), this);
+ }
+
+ public void AddFirst($csclassnameNode newNode) {
+ ValidateNewNode(newNode);
+ if (!newNode.inlist) {
+ push_front(newNode.csharpvalue);
+ newNode.iter = getFirstIter();
+ newNode.inlist = true;
+ } else {
+ throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
+ }
+ }
+
+ public $csclassnameNode AddLast($typemap(cstype, CTYPE) value) {
+ push_back(value);
+ return new $csclassnameNode(getLastIter(), this);
+ }
+
+ public void AddLast($csclassnameNode newNode) {
+ ValidateNewNode(newNode);
+ if (!newNode.inlist) {
+ push_back(newNode.csharpvalue);
+ newNode.iter = getLastIter();
+ newNode.inlist = true;
+ } else {
+ throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
+ }
+ }
+
+ public $csclassnameNode AddBefore($csclassnameNode node, $typemap(cstype, CTYPE) value) {
+ return new $csclassnameNode(insertNode(node.iter, value), this);
+ }
+
+ public void AddBefore($csclassnameNode node, $csclassnameNode newNode) {
+ ValidateNode(node);
+ ValidateNewNode(newNode);
+ if (!newNode.inlist) {
+ newNode.iter = insertNode(node.iter, newNode.csharpvalue);
+ newNode.inlist = true;
+ } else {
+ throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
+ }
+ }
+
+ public $csclassnameNode AddAfter($csclassnameNode node, $typemap(cstype, CTYPE) value) {
+ node = node.Next;
+ return new $csclassnameNode(insertNode(node.iter, value), this);
+ }
+
+ public void AddAfter($csclassnameNode node, $csclassnameNode newNode) {
+ ValidateNode(node);
+ ValidateNewNode(newNode);
+ if (!newNode.inlist) {
+ if (node == this.Last)
+ AddLast(newNode);
+ else
+ {
+ node = node.Next;
+ newNode.iter = insertNode(node.iter, newNode.csharpvalue);
+ newNode.inlist = true;
+ }
+ } else {
+ throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
+ }
+ }
+
+ public void Add($typemap(cstype, CTYPE) value) {
+ AddLast(value);
+ }
+
+ public void Remove($csclassnameNode node) {
+ ValidateNode(node);
+ eraseIter(node.iter);
+ }
+
+ public void CopyTo($typemap(cstype, CTYPE)[] array, int index) {
+ if (array == null)
+ throw new global::System.ArgumentNullException("array");
+ if (index < 0 || index > array.Length)
+ throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
+ if (array.Rank > 1)
+ throw new global::System.ArgumentException("Multi dimensional array.", "array");
+ $csclassnameNode node = this.First;
+ if (node != null) {
+ do {
+ array[index++] = node.Value;
+ node = node.Next;
+ } while (node != null);
+ }
+ }
+
+ internal void ValidateNode($csclassnameNode node) {
+ if (node == null) {
+ throw new System.ArgumentNullException("node");
+ }
+ if (!node.inlist || node.list != this) {
+ throw new System.InvalidOperationException("node");
+ }
+ }
+
+ internal void ValidateNewNode($csclassnameNode node) {
+ if (node == null) {
+ throw new System.ArgumentNullException("node");
+ }
+ }
+
+ global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.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);
+ }
+
+ public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
+ global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
+ {
+ private $csclassname collectionRef;
+ private $csclassnameNode currentNode;
+ private int currentIndex;
+ private object currentObject;
+ private int currentSize;
+
+ public $csclassnameEnumerator($csclassname collection) {
+ collectionRef = collection;
+ currentNode = collection.First;
+ currentIndex = 0;
+ currentObject = null;
+ currentSize = collectionRef.Count;
+ }
+
+ // Type-safe iterator Current
+ public $typemap(cstype, CTYPE) Current {
+ get {
+ if (currentIndex == -1)
+ throw new global::System.InvalidOperationException("Enumeration not started.");
+ if (currentIndex > currentSize)
+ throw new global::System.InvalidOperationException("Enumeration finished.");
+ if (currentObject == null)
+ throw new global::System.InvalidOperationException("Collection modified.");
+ return ($typemap(cstype, CTYPE))currentObject;
+ }
+ }
+
+ // Type-unsafe IEnumerator.Current
+ object global::System.Collections.IEnumerator.Current {
+ get {
+ return Current;
+ }
+ }
+
+ public bool MoveNext() {
+ if (currentNode == null) {
+ currentIndex = collectionRef.Count + 1;
+ return false;
+ }
+ ++currentIndex;
+ currentObject = currentNode.Value;
+ currentNode = currentNode.Next;
+ return true;
+ }
+
+ 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 sealed class $csclassnameNode {
+ internal $csclassname list;
+ internal System.IntPtr iter;
+ internal $typemap(cstype, CTYPE) csharpvalue;
+ internal bool inlist;
+
+ public $csclassnameNode($typemap(cstype, CTYPE) value) {
+ csharpvalue = value;
+ inlist = false;
+ }
+
+ internal $csclassnameNode(System.IntPtr iter, $csclassname list) {
+ this.list = list;
+ this.iter = iter;
+ inlist = true;
+ }
+
+ public $csclassname List {
+ get {
+ return this.list;
+ }
+ }
+
+ public $csclassnameNode Next {
+ get {
+ if (list.getNextIter(iter) == System.IntPtr.Zero)
+ return null;
+ return new $csclassnameNode(list.getNextIter(iter), list);
+ }
+ }
+
+ public $csclassnameNode Previous {
+ get {
+ if (list.getPrevIter(iter) == System.IntPtr.Zero)
+ return null;
+ return new $csclassnameNode(list.getPrevIter(iter), list);
+ }
+ }
+
+ public $typemap(cstype, CTYPE) Value {
+ get {
+ return list.getItem(this.iter);
+ }
+ set {
+ list.setItem(this.iter, value);
+ }
+ }
+
+ public static bool operator==($csclassnameNode node1, $csclassnameNode node2) {
+ if (object.ReferenceEquals(node1, null) && object.ReferenceEquals(node2, null))
+ return true;
+ if (object.ReferenceEquals(node1, null) || object.ReferenceEquals(node2, null))
+ return false;
+ return node1.Equals(node2);
+ }
+
+ public static bool operator!=($csclassnameNode node1, $csclassnameNode node2) {
+ if (node1 == null && node2 == null)
+ return false;
+ if (node1 == null || node2 == null)
+ return true;
+ return !node1.Equals(node2);
+ }
+
+ public bool Equals($csclassnameNode node) {
+ if (node == null)
+ return false;
+ if (!node.inlist || !this.inlist)
+ return object.ReferenceEquals(this, node);
+ return list.equals(this.iter, node.iter);
+ }
+
+ public override bool Equals(object node) {
+ return Equals(($csclassnameNode)node);
+ }
+
+ public override int GetHashCode() {
+ int hash = 13;
+ if (inlist) {
+ hash = (hash * 7) + this.list.GetHashCode();
+ hash = (hash * 7) + this.Value.GetHashCode();
+ hash = (hash * 7) + this.list.getNextIter(this.iter).GetHashCode();
+ hash = (hash * 7) + this.list.getPrevIter(this.iter).GetHashCode();
+ } else {
+ hash = (hash * 7) + this.csharpvalue.GetHashCode();
+ }
+ return hash;
+ }
+
+ public void Dispose() {
+ list.deleteIter(this.iter);
+ }
+ }
+%}
+
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef CTYPE value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ class iterator;
+
+ void push_front(CTYPE const& x);
+ void push_back(CTYPE const& x);
+ %rename(RemoveFirst) pop_front;
+ void pop_front();
+ %rename(RemoveLast) pop_back;
+ void pop_back();
+ size_type size() const;
+ %rename(Clear) clear;
+ void clear();
+ %extend {
+ const_reference getItem(iterator *iter) {
+ return **iter;
+ }
+
+ void setItem(iterator *iter, CTYPE const& val) {
+ *(*iter) = val;
+ }
+
+ iterator *getFirstIter() {
+ if ($self->size() == 0)
+ return NULL;
+ return new std::list< CTYPE >::iterator($self->begin());
+ }
+
+ iterator *getLastIter() {
+ if ($self->size() == 0)
+ return NULL;
+ return new std::list< CTYPE >::iterator(--$self->end());
+ }
+
+ iterator *getNextIter(iterator *iter) {
+ std::list< CTYPE >::iterator it = *iter;
+ if (std::distance(it, --$self->end()) != 0) {
+ std::list< CTYPE >::iterator* itnext = new std::list< CTYPE >::iterator(++it);
+ return itnext;
+ }
+ return NULL;
+ }
+
+ iterator *getPrevIter(iterator *iter) {
+ std::list< CTYPE >::iterator it = *iter;
+ if (std::distance($self->begin(), it) != 0) {
+ std::list< CTYPE >::iterator* itprev = new std::list< CTYPE >::iterator(--it);
+ return itprev;
+ }
+ return NULL;
+ }
+
+ iterator *insertNode(iterator *iter, CTYPE const& value) {
+ std::list< CTYPE >::iterator it = $self->insert(*iter, value);
+ return new std::list< CTYPE >::iterator(it);
+ }
+
+ void eraseIter(iterator *iter) {
+ std::list< CTYPE >::iterator it = *iter;
+ $self->erase(it);
+ }
+
+ void deleteIter(iterator *iter) {
+ delete iter;
+ }
+
+ bool equals(iterator *iter1, iterator *iter2) {
+ if (iter1 == NULL && iter2 == NULL)
+ return true;
+ std::list< CTYPE >::iterator it1 = *iter1;
+ std::list< CTYPE >::iterator it2 = *iter2;
+ return it1 == it2;
+ }
+ }
+%enddef
+
+// Extra methods added to the collection class if operator== is defined for the class being wrapped
+// The class will then implement ICollection<>, which adds extra functionality
+%define SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
+ %extend {
+ bool Contains(CTYPE const& value) {
+ return std::find($self->begin(), $self->end(), value) != $self->end();
+ }
+
+ bool Remove(CTYPE const& value) {
+ std::list< CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
+ if (it != $self->end()) {
+ $self->erase(it);
+ return true;
+ }
+ return false;
+ }
+
+ iterator *find(CTYPE const& value) {
+ if (std::find($self->begin(), $self->end(), value) != $self->end()) {
+ return new std::list< CTYPE >::iterator(std::find($self->begin(), $self->end(), value));
+ }
+ return NULL;
+ }
+ }
+%proxycode %{
+ public $csclassnameNode Find($typemap(cstype, CTYPE) value) {
+ System.IntPtr tmp = find(value);
+ if (tmp != System.IntPtr.Zero) {
+ return new $csclassnameNode(tmp, this);
+ }
+ return null;
+ }
+%}
+%enddef
+
+// Macros for std::list class specializations/enhancements
+%define SWIG_STD_LIST_ENHANCED(CTYPE...)
+namespace std {
+ template<> class list< CTYPE > {
+ SWIG_STD_LIST_MINIMUM_INTERNAL(ICollection, %arg(CTYPE));
+ SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(CTYPE)
+ };
+}
+%enddef
+
+
+%{
+#include <list>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+%csmethodmodifiers std::list::size "private"
+%csmethodmodifiers std::list::getItem "private"
+%csmethodmodifiers std::list::setItem "private"
+%csmethodmodifiers std::list::push_front "private"
+%csmethodmodifiers std::list::push_back "private"
+%csmethodmodifiers std::list::getFirstIter "private"
+%csmethodmodifiers std::list::getNextIter "private"
+%csmethodmodifiers std::list::getPrevIter "private"
+%csmethodmodifiers std::list::getLastIter "private"
+%csmethodmodifiers std::list::find "private"
+%csmethodmodifiers std::list::deleteIter "private"
+
+namespace std {
+ // primary (unspecialized) class template for std::list
+ // does not require operator== to be defined
+ template<class T>
+ class list {
+ SWIG_STD_LIST_MINIMUM_INTERNAL(IEnumerable, T)
+ };
+ // specialization for pointers
+ template<class T>
+ class list<T *> {
+ SWIG_STD_LIST_MINIMUM_INTERNAL(ICollection, T *)
+ SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(T *)
+ };
+}
+
+// template specializations for std::list
+// these provide extra collections methods as operator== is defined
+SWIG_STD_LIST_ENHANCED(char)
+SWIG_STD_LIST_ENHANCED(signed char)
+SWIG_STD_LIST_ENHANCED(unsigned char)
+SWIG_STD_LIST_ENHANCED(short)
+SWIG_STD_LIST_ENHANCED(unsigned short)
+SWIG_STD_LIST_ENHANCED(int)
+SWIG_STD_LIST_ENHANCED(unsigned int)
+SWIG_STD_LIST_ENHANCED(long)
+SWIG_STD_LIST_ENHANCED(unsigned long)
+SWIG_STD_LIST_ENHANCED(long long)
+SWIG_STD_LIST_ENHANCED(unsigned long long)
+SWIG_STD_LIST_ENHANCED(float)
+SWIG_STD_LIST_ENHANCED(double)
+SWIG_STD_LIST_ENHANCED(std::string) // also requires a %include <std_string.i>
+SWIG_STD_LIST_ENHANCED(std::wstring) // also requires a %include <std_wstring.i>
diff --git a/Lib/csharp/std_map.i b/Lib/csharp/std_map.i
index 90a865079..e538a03a1 100644
--- a/Lib/csharp/std_map.i
+++ b/Lib/csharp/std_map.i
@@ -4,14 +4,14 @@
* SWIG typemaps for std::map< K, T, C >
*
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.IDictionary<>.
- *
+ *
* Using this wrapper is fairly simple. For example, to create a map from integers to doubles use:
*
* %include <std_map.i>
* %template(MapIntDouble) std::map<int, double>
*
* Notes:
- * 1) 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!
@@ -55,8 +55,8 @@
}
public bool IsReadOnly {
- get {
- return false;
+ get {
+ return false;
}
}
@@ -84,7 +84,7 @@
return vals;
}
}
-
+
public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
Add(item.Key, item.Value);
}
@@ -143,7 +143,7 @@
/// 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,
+ 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;
@@ -206,7 +206,7 @@
currentObject = null;
}
}
-
+
%}
public:
@@ -214,9 +214,14 @@
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
map();
- map(const map< K, T, C > &other);
+ map(const map& other);
size_type size() const;
bool empty() const;
%rename(Clear) clear;
@@ -239,11 +244,11 @@
return iter != $self->end();
}
- void Add(const key_type& key, const mapped_type& val) throw (std::out_of_range) {
+ void Add(const key_type& key, const mapped_type& value) throw (std::out_of_range) {
std::map< K, T, C >::iterator iter = $self->find(key);
if (iter != $self->end())
throw std::out_of_range("key already exists");
- $self->insert(std::pair< K, T >(key, val));
+ $self->insert(std::pair< K, T >(key, value));
}
bool Remove(const key_type& key) {
@@ -251,7 +256,7 @@
if (iter != $self->end()) {
$self->erase(iter);
return true;
- }
+ }
return false;
}
@@ -285,12 +290,12 @@
%csmethodmodifiers std::map::destroy_iterator "private"
// Default implementation
-namespace std {
+namespace std {
template<class K, class T, class C = std::less<K> > class map {
SWIG_STD_MAP_INTERNAL(K, T, C)
};
}
-
+
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
diff --git a/Lib/csharp/std_pair.i b/Lib/csharp/std_pair.i
index 0712ad762..732347db5 100644
--- a/Lib/csharp/std_pair.i
+++ b/Lib/csharp/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
- pair(T t, U u);
- pair(const pair& p);
+ pair(T first, U second);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/csharp/std_set.i b/Lib/csharp/std_set.i
new file mode 100644
index 000000000..82f010aff
--- /dev/null
+++ b/Lib/csharp/std_set.i
@@ -0,0 +1,311 @@
+/* -----------------------------------------------------------------------------
+ * std_set.i
+ *
+ * SWIG typemaps for std::set<T>.
+ *
+ * Note that ISet<> used here requires .NET 4 or later.
+ *
+ * The C# wrapper implements ISet<> interface and shares performance
+ * characteristics of C# System.Collections.Generic.SortedSet<> class, but
+ * doesn't provide quite all of its methods.
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <set>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+%csmethodmodifiers std::set::size "private"
+%csmethodmodifiers std::set::getitem "private"
+%csmethodmodifiers std::set::create_iterator_begin "private"
+%csmethodmodifiers std::set::get_next "private"
+%csmethodmodifiers std::set::destroy_iterator "private"
+
+namespace std {
+
+// TODO: Add support for comparator and allocator template parameters.
+template <class T>
+class set {
+
+%typemap(csinterfaces) std::set<T> "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n";
+%proxycode %{
+ void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) {
+ ((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item);
+ }
+
+ public bool TryGetValue($typemap(cstype, T) equalValue, out $typemap(cstype, T) actualValue) {
+ try {
+ actualValue = getitem(equalValue);
+ return true;
+ } catch {
+ actualValue = default($typemap(cstype, T));
+ return false;
+ }
+ }
+
+ public int Count {
+ get {
+ return (int)size();
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public void CopyTo($typemap(cstype, T)[] array) {
+ CopyTo(array, 0);
+ }
+
+ public void CopyTo($typemap(cstype, T)[] array, int arrayIndex) {
+ if (array == null)
+ throw new global::System.ArgumentNullException("array");
+ if (arrayIndex < 0)
+ throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
+ if (array.Rank > 1)
+ throw new global::System.ArgumentException("Multi dimensional array.", "array");
+ if (arrayIndex+this.Count > array.Length)
+ throw new global::System.ArgumentException("Number of elements to copy is too large.");
+
+ foreach ($typemap(cstype, T) item in this) {
+ array.SetValue(item, arrayIndex++);
+ }
+ }
+
+ public void ExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ foreach ($typemap(cstype, T) item in other) {
+ Remove(item);
+ }
+ }
+
+ public void IntersectWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ $csclassname old = new $csclassname(this);
+
+ Clear();
+ foreach ($typemap(cstype, T) item in other) {
+ if (old.Contains(item))
+ Add(item);
+ }
+ }
+
+ private static int count_enum(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ int count = 0;
+ foreach ($typemap(cstype, T) item in other) {
+ count++;
+ }
+
+ return count;
+ }
+
+ public bool IsProperSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ return IsSubsetOf(other) && Count < count_enum(other);
+ }
+
+ public bool IsProperSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ return IsSupersetOf(other) && Count > count_enum(other);
+ }
+
+ public bool IsSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ int countContained = 0;
+
+ foreach ($typemap(cstype, T) item in other) {
+ if (Contains(item))
+ countContained++;
+ }
+
+ return countContained == Count;
+ }
+
+ public bool IsSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ foreach ($typemap(cstype, T) item in other) {
+ if (!Contains(item))
+ return false;
+ }
+
+ return true;
+ }
+
+ public bool Overlaps(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ foreach ($typemap(cstype, T) item in other) {
+ if (Contains(item))
+ return true;
+ }
+
+ return false;
+ }
+
+ public bool SetEquals(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ return IsSupersetOf(other) && Count == count_enum(other);
+ }
+
+ public void SymmetricExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ foreach ($typemap(cstype, T) item in other) {
+ if (!Remove(item))
+ Add(item);
+ }
+ }
+
+ public void UnionWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
+ foreach ($typemap(cstype, T) item in other) {
+ Add(item);
+ }
+ }
+
+ private global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Items {
+ get {
+ global::System.Collections.Generic.ICollection<$typemap(cstype, T)> items = new global::System.Collections.Generic.List<$typemap(cstype, T)>();
+ int size = this.Count;
+ if (size > 0) {
+ global::System.IntPtr iter = create_iterator_begin();
+ for (int i = 0; i < size; i++) {
+ items.Add(get_next(iter));
+ }
+ destroy_iterator(iter);
+ }
+ return items;
+ }
+ }
+
+ 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 global::System.Collections.Generic.IList<$typemap(cstype, T)> ItemsCollection;
+ private int currentIndex;
+ private object currentObject;
+ private int currentSize;
+
+ public $csclassnameEnumerator($csclassname collection) {
+ collectionRef = collection;
+ ItemsCollection = new global::System.Collections.Generic.List<$typemap(cstype, T)>(collection.Items);
+ 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 = ItemsCollection[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 key_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;
+
+ set();
+ set(const set& other);
+ size_type size() const;
+ bool empty() const;
+ %rename(Clear) clear;
+ void clear();
+ %extend {
+ bool Add(const value_type& item) {
+ return $self->insert(item).second;
+ }
+
+ bool Contains(const value_type& item) {
+ return $self->count(item) != 0;
+ }
+
+ bool Remove(const value_type& item) {
+ return $self->erase(item) != 0;
+ }
+
+ const value_type& getitem(const value_type& item) throw (std::out_of_range) {
+ std::set<T>::iterator iter = $self->find(item);
+ if (iter == $self->end())
+ throw std::out_of_range("item not found");
+
+ return *iter;
+ }
+
+ // create_iterator_begin(), get_next() and destroy_iterator work together to provide a collection of items to C#
+ %apply void *VOID_INT_PTR { std::set<T>::iterator *create_iterator_begin }
+ %apply void *VOID_INT_PTR { std::set<T>::iterator *swigiterator }
+
+ std::set<T>::iterator *create_iterator_begin() {
+ return new std::set<T>::iterator($self->begin());
+ }
+
+ const key_type& get_next(std::set<T>::iterator *swigiterator) {
+ std::set<T>::iterator iter = *swigiterator;
+ (*swigiterator)++;
+ return *iter;
+ }
+
+ void destroy_iterator(std::set<T>::iterator *swigiterator) {
+ delete swigiterator;
+ }
+ }
+};
+
+}
diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i
index 12220aa57..e2811290c 100644
--- a/Lib/csharp/std_vector.i
+++ b/Lib/csharp/std_vector.i
@@ -5,28 +5,31 @@
* C# implementation
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection.
*
- * Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
+ * 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
- * whenever we are confident that the required C++ operator== is available. This is the case for when
+ * whenever we are confident that the required C++ operator== is available. This is the case for when
* T is a primitive type or a pointer. If T does define an operator==, then use the SWIG_STD_VECTOR_ENHANCED
* macro to obtain this enhanced functionality, for example:
*
* SWIG_STD_VECTOR_ENHANCED(SomeNamespace::Klass)
* %template(VectKlass) std::vector<SomeNamespace::Klass>;
- *
- * Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
* ----------------------------------------------------------------------------- */
-// Warning: Use the typemaps here in the expectation that the macros they are in will change name.
-
-
%include <std_common.i>
// MACRO for use within the std::vector class body
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...)
-%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
+%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
%proxycode %{
- public $csclassname(global::System.Collections.ICollection c) : this() {
+ public $csclassname(global::System.Collections.IEnumerable c) : this() {
+ if (c == null)
+ throw new global::System.ArgumentNullException("c");
+ foreach ($typemap(cstype, CTYPE) element in c) {
+ this.Add(element);
+ }
+ }
+
+ public $csclassname(global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)> c) : this() {
if (c == null)
throw new global::System.ArgumentNullException("c");
foreach ($typemap(cstype, CTYPE) element in c) {
@@ -62,7 +65,7 @@
set {
if (value < size())
throw new global::System.ArgumentOutOfRangeException("Capacity");
- reserve((uint)value);
+ reserve(($typemap(cstype, size_t))value);
}
}
@@ -106,6 +109,12 @@
array.SetValue(getitemcopy(index+i), arrayIndex+i);
}
+ public $typemap(cstype, CTYPE)[] ToArray() {
+ $typemap(cstype, CTYPE)[] array = new $typemap(cstype, CTYPE)[this.Count];
+ this.CopyTo(array);
+ return array;
+ }
+
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
@@ -187,8 +196,13 @@
public:
typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
typedef CTYPE value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
typedef CONST_REFERENCE const_reference;
+
%rename(Clear) clear;
void clear();
%rename(Add) push_back;
@@ -198,8 +212,10 @@
void reserve(size_type n);
%newobject GetRange(int index, int count);
%newobject Repeat(CTYPE const& value, int count);
+
vector();
vector(const vector &other);
+
%extend {
vector(int capacity) throw (std::out_of_range) {
std::vector< CTYPE >* pv = 0;
@@ -324,7 +340,7 @@
std::vector< CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
if (it != $self->end()) {
$self->erase(it);
- return true;
+ return true;
}
return false;
}
@@ -335,7 +351,7 @@
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
namespace std {
template<> class vector< CTYPE > {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, %arg(CTYPE const&), %arg(CTYPE))
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, %arg(CTYPE))
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
};
}
@@ -368,11 +384,11 @@ namespace std {
// primary (unspecialized) class template for std::vector
// does not require operator== to be defined
template<class T> class vector {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, T const&, T)
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, T)
};
// specialization for pointers
template<class T> class vector<T *> {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, T *const&, T *)
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, T *)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T *)
};
// bool is specialized in the C++ standard - const_reference in particular
diff --git a/Lib/csharp/std_wstring.i b/Lib/csharp/std_wstring.i
index 09bdaaaa2..162b90e80 100644
--- a/Lib/csharp/std_wstring.i
+++ b/Lib/csharp/std_wstring.i
@@ -23,7 +23,10 @@ class wstring;
// wstring
%typemap(ctype, out="void *") wstring "wchar_t *"
-%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") wstring "string"
+%typemap(imtype,
+ inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ outattributes="[return: 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 +63,10 @@ class wstring;
// const wstring &
%typemap(ctype, out="void *") const wstring & "wchar_t *"
-%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") const wstring & "string"
+%typemap(imtype,
+ inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ outattributes="[return: 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/Lib/csharp/stl.i b/Lib/csharp/stl.i
index 9d2e91eee..04f86014f 100644
--- a/Lib/csharp/stl.i
+++ b/Lib/csharp/stl.i
@@ -1,7 +1,5 @@
/* -----------------------------------------------------------------------------
* stl.i
- *
- * Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
%include <std_common.i>
diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i
index 9361edf6f..798194114 100644
--- a/Lib/csharp/wchar.i
+++ b/Lib/csharp/wchar.i
@@ -20,6 +20,7 @@ static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
%pragma(csharp) imclasscode=%{
protected class SWIGWStringHelper {
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]
public delegate string SWIGWStringDelegate(global::System.IntPtr message);
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
@@ -52,7 +53,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
// wchar_t
%typemap(ctype) wchar_t "wchar_t"
-%typemap(imtype) wchar_t "char"
+%typemap(imtype) wchar_t "char" // Requires adding CharSet=CharSet.Unicode to the DllImport to correctly marshal Unicode characters
%typemap(cstype) wchar_t "char"
%typemap(csin) wchar_t "$csinput"
diff --git a/Lib/d/boost_shared_ptr.i b/Lib/d/boost_shared_ptr.i
index 5c171555e..4a220a589 100644
--- a/Lib/d/boost_shared_ptr.i
+++ b/Lib/d/boost_shared_ptr.i
@@ -1,7 +1,9 @@
%include <shared_ptr.i>
+// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
+// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
@@ -10,6 +12,7 @@
//"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;"
+// Typemap customisations...
// plain value
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
@@ -22,6 +25,18 @@
%typemap(out) CONST TYPE
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
+%typemap(directorin) CONST TYPE
+%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
+
+%typemap(directorout) CONST TYPE
+%{ if (!$input) {
+ SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type");
+ return $null;
+ }
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
+ $result = *smartarg->get();
+%}
+
// plain pointer
%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
@@ -30,6 +45,13 @@
$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%}
+%typemap(directorin) CONST TYPE *
+%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
+
+%typemap(directorout) CONST TYPE * %{
+#error "typemaps for $1_type not available"
+%}
+
// 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);
@@ -40,6 +62,13 @@
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
+%typemap(directorin) CONST TYPE &
+%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (&$1 SWIG_NO_NULL_DELETER_0); %}
+
+%typemap(directorout) CONST TYPE & %{
+#error "typemaps for $1_type not available"
+%}
+
// plain pointer by reference
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
@@ -47,18 +76,42 @@
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
+%typemap(directorin) TYPE *CONST&
+%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
+
+%typemap(directorout) TYPE *CONST& %{
+#error "typemaps for $1_type not available"
+%}
+
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ if ($input) $1 = *($&1_ltype)$input; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ $result = $1 ? new $1_ltype($1) : 0; %}
+%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
+%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
+%{ if ($input) {
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
+ $result = *smartarg;
+ }
+%}
+
// shared_ptr by reference
%typemap(in, canthrow=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
+%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
+%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
+#error "typemaps for $1_type not available"
+%}
+
// shared_ptr by pointer
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
@@ -66,6 +119,13 @@
%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
if ($owner) delete $1; %}
+%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
+%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
+#error "typemaps for $1_type not available"
+%}
+
// shared_ptr by pointer reference
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
@@ -73,6 +133,13 @@
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
+%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
+%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
+#error "typemaps for $1_type not available"
+%}
+
// 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"
@@ -96,9 +163,22 @@
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE)"
%typemap(din) 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 > *& "$typemap(dtype, TYPE).swigGetCPtr($dinput)"
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE).swigGetCPtr($dinput)"
+
+%typemap(ddirectorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(dtype, TYPE).swigGetCPtr($dcall)"
+
+%typemap(ddirectorin) CONST TYPE,
+ CONST TYPE *,
+ CONST TYPE &,
+ TYPE *CONST& "($winput is null) ? null : new $typemap(dtype, TYPE)($winput, true)"
+
+%typemap(ddirectorin) 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 > *& "($winput is null) ? null : new $typemap(dtype, TYPE)($winput, true)"
+
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
void* cPtr = $imcall;
@@ -141,8 +221,7 @@
return ret;
}
-// For shared pointers, both the derived and the base class have to »own« their
-// pointer; otherwise the reference count is not decreased properly on destruction.
+// Proxy classes (base classes, ie, not derived classes)
%typemap(dbody) SWIGTYPE %{
private void* swigCPtr;
private bool swigCMemOwn;
@@ -157,6 +236,7 @@ public static void* swigGetCPtr(typeof(this) obj) {
}
%}
+// Derived proxy classes
%typemap(dbody_derived) SWIGTYPE %{
private void* swigCPtr;
private bool swigCMemOwn;
@@ -197,5 +277,17 @@ public static void* swigGetCPtr(typeof(this) obj) {
}
}
+// Typecheck typemaps
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *")
+ TYPE CONST,
+ TYPE CONST &,
+ TYPE CONST *,
+ TYPE *CONST&,
+ 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 > *&
+ ""
+
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef
diff --git a/Lib/d/dclassgen.swg b/Lib/d/dclassgen.swg
index 68910b412..84fa03a0b 100644
--- a/Lib/d/dclassgen.swg
+++ b/Lib/d/dclassgen.swg
@@ -33,7 +33,7 @@
// We do not use »override« attribute for generated dispose() methods to stay
// somewhat compatible to Phobos and older Tango versions where Object.dispose()
// does not exist.
-%typemap(ddispose, methodname="dispose", methodmodifiers="public") SWIGTYPE {
+%typemap(ddispose, methodname="dispose", methodmodifiers="public", parameters="") SWIGTYPE {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
@@ -45,7 +45,7 @@
}
}
-%typemap(ddispose_derived, methodname="dispose", methodmodifiers="public") SWIGTYPE {
+%typemap(ddispose_derived, methodname="dispose", methodmodifiers="public", parameters="") SWIGTYPE {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
diff --git a/Lib/d/director.swg b/Lib/d/director.swg
index a7d9c7688..02da0e0ac 100644
--- a/Lib/d/director.swg
+++ b/Lib/d/director.swg
@@ -40,6 +40,10 @@ namespace Swig {
public:
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempted to invoke pure virtual method ") + msg) {
}
+
+ static void raise(const char *msg) {
+ throw DirectorPureVirtualException(msg);
+ }
};
}
diff --git a/Lib/d/dmemberfunctionpointers.swg b/Lib/d/dmemberfunctionpointers.swg
index c63eca23e..a07d0a5d8 100644
--- a/Lib/d/dmemberfunctionpointers.swg
+++ b/Lib/d/dmemberfunctionpointers.swg
@@ -43,6 +43,8 @@
return ret;
}
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
/*
* Helper functions to pack/unpack arbitrary binary data (member function
diff --git a/Lib/d/dprimitives.swg b/Lib/d/dprimitives.swg
index 445437957..eaee816d3 100644
--- a/Lib/d/dprimitives.swg
+++ b/Lib/d/dprimitives.swg
@@ -20,7 +20,7 @@
/*
* The SWIG_D_PRIMITIVE macro is used to define the typemaps for the primitive
* types, because are more or less the same for all of them. The few special
- * cases are handeled below.
+ * cases are handled below.
*/
%define SWIG_D_PRIMITIVE(TYPE, DTYPE)
%typemap(ctype) TYPE, const TYPE & "TYPE"
diff --git a/Lib/d/dswigtype.swg b/Lib/d/dswigtype.swg
index f91d6dfe6..f0d604b6f 100644
--- a/Lib/d/dswigtype.swg
+++ b/Lib/d/dswigtype.swg
@@ -162,7 +162,7 @@
return ret;
}
-// Treat references to arrays like like references to a single element.
+// Treat references to arrays like references to a single element.
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
@@ -182,3 +182,16 @@
$*dclassname ret = (cPtr is null) ? null : new $*dclassname(cPtr, $owner);$excode
return ret;
}
+%typemap(directorin) SWIGTYPE *const&
+ "$input = (void *) $1;"
+%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *const&
+%{ static $*1_ltype swig_temp;
+ swig_temp = ($*1_ltype)$input;
+ $result = &swig_temp; %}
+%typemap(ddirectorin,
+ nativepointer="cast($dtype)$winput"
+) SWIGTYPE *const& "($winput is null) ? null : new $*dclassname($winput, false)"
+%typemap(ddirectorout,
+ nativepointer="cast(void*)$dcall"
+) SWIGTYPE *const& "$*dclassname.swigGetCPtr($dcall)"
+
diff --git a/Lib/d/std_map.i b/Lib/d/std_map.i
index 0e8574b8a..c5e03d06d 100644
--- a/Lib/d/std_map.i
+++ b/Lib/d/std_map.i
@@ -16,44 +16,47 @@
#include <stdexcept>
%}
-// exported class
-
namespace std {
- 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> &);
+ template<class K, class T, class C = std::less<K> > class map {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ map();
+ map(const map& other);
- unsigned int size() const;
- bool empty() const;
- void clear();
- %extend {
- const T& get(const K& key) throw (std::out_of_range) {
- std::map<K,T >::iterator i = self->find(key);
- if (i != self->end())
- return i->second;
- else
- throw std::out_of_range("key not found");
- }
- void set(const K& key, const T& x) {
- (*self)[key] = x;
- }
- void del(const K& key) throw (std::out_of_range) {
- 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);
- return i != self->end();
- }
+ unsigned int size() const;
+ bool empty() const;
+ void clear();
+ %extend {
+ const T& get(const K& key) throw (std::out_of_range) {
+ std::map< K, T, C >::iterator i = self->find(key);
+ if (i != self->end())
+ return i->second;
+ else
+ throw std::out_of_range("key not found");
+ }
+ void set(const K& key, const T& x) {
+ (*self)[key] = x;
+ }
+ void del(const K& key) throw (std::out_of_range) {
+ std::map< K, T, C >::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, C >::iterator i = self->find(key);
+ return i != self->end();
}
- };
+ }
+ };
}
diff --git a/Lib/d/std_pair.i b/Lib/d/std_pair.i
index 0712ad762..732347db5 100644
--- a/Lib/d/std_pair.i
+++ b/Lib/d/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
- pair(T t, U u);
- pair(const pair& p);
+ pair(T first, U second);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/d/std_vector.i b/Lib/d/std_vector.i
index 56f7188c7..fb8f7d2e0 100644
--- a/Lib/d/std_vector.i
+++ b/Lib/d/std_vector.i
@@ -104,15 +104,22 @@ public void capacity(size_t value) {
public:
typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
typedef CTYPE value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
typedef CONST_REFERENCE const_reference;
+
void clear();
void push_back(CTYPE const& x);
size_type size() const;
size_type capacity() const;
void reserve(size_type n) throw (std::length_error);
+
vector();
vector(const vector &other);
+
%extend {
vector(size_type capacity) throw (std::length_error) {
std::vector< CTYPE >* pv = 0;
@@ -128,7 +135,7 @@ public void capacity(size_t value) {
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 +145,7 @@ public void capacity(size_t value) {
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 +160,7 @@ public void capacity(size_t value) {
// 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.");
}
@@ -442,8 +449,13 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
public:
typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
typedef CTYPE value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
typedef CONST_REFERENCE const_reference;
+
bool empty() const;
void clear();
void push_back(CTYPE const& x);
@@ -451,8 +463,10 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
size_type size() const;
size_type capacity() const;
void reserve(size_type n) throw (std::length_error);
+
vector();
vector(const vector &other);
+
%extend {
vector(size_type capacity) throw (std::length_error) {
std::vector< CTYPE >* pv = 0;
@@ -464,7 +478,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
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 +488,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
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 +520,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
// 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.");
}
@@ -544,7 +558,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
namespace std {
template<> class vector<CTYPE > {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(%arg(CTYPE const&), %arg(CTYPE))
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(const value_type&, %arg(CTYPE))
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
};
}
@@ -559,11 +573,11 @@ namespace std {
// primary (unspecialized) class template for std::vector
// does not require operator== to be defined
template<class T> class vector {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(T const&, T)
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(const value_type&, T)
};
// specializations for pointers
template<class T> class vector<T *> {
- SWIG_STD_VECTOR_MINIMUM_INTERNAL(T *const&, T *)
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(const value_type&, T *)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T *)
};
// bool is a bit different in the C++ standard - const_reference in particular
diff --git a/Lib/d/stl.i b/Lib/d/stl.i
index 9d2e91eee..04f86014f 100644
--- a/Lib/d/stl.i
+++ b/Lib/d/stl.i
@@ -1,7 +1,5 @@
/* -----------------------------------------------------------------------------
* stl.i
- *
- * Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
%include <std_common.i>
diff --git a/Lib/exception.i b/Lib/exception.i
index da0d56cdd..ee9ce9bc6 100644
--- a/Lib/exception.i
+++ b/Lib/exception.i
@@ -12,13 +12,6 @@
%insert("runtime") "swigerrors.swg"
-#ifdef SWIGPHP5
-%{
-#include "zend_exceptions.h"
-#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"
@@ -134,33 +127,48 @@ SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
#ifdef SWIGOCAML
%{
-#define OCAML_MSG_BUF_LEN 1024
-SWIGINTERN void SWIG_exception_(int code, const char *msg) {
- char msg_buf[OCAML_MSG_BUF_LEN];
- sprintf( msg_buf, "Exception(%d): %s\n", code, msg );
- failwith( msg_buf );
-}
-#define SWIG_exception(a,b) SWIG_exception_((a),(b))
-%}
-#endif
-
+SWIGINTERN void SWIG_OCamlException(int code, const char *msg) {
+ CAMLparam0();
-#ifdef SWIGCHICKEN
-%{
-SWIGINTERN void SWIG_exception_(int code, const char *msg) {
- C_word *a;
- C_word scmmsg;
- C_word list;
-
- a = C_alloc (C_SIZEOF_STRING (strlen (msg)) + C_SIZEOF_LIST(2));
- scmmsg = C_string2 (&a, (char *) msg);
- list = C_list(&a, 2, C_fix(code), scmmsg);
- SWIG_ThrowException(list);
+ SWIG_OCamlExceptionCodes exception_code = SWIG_OCamlUnknownError;
+ switch (code) {
+ case SWIG_DivisionByZero:
+ exception_code = SWIG_OCamlArithmeticException;
+ break;
+ case SWIG_IndexError:
+ exception_code = SWIG_OCamlIndexOutOfBoundsException;
+ break;
+ case SWIG_IOError:
+ case SWIG_SystemError:
+ exception_code = SWIG_OCamlSystemException;
+ break;
+ case SWIG_MemoryError:
+ exception_code = SWIG_OCamlOutOfMemoryError;
+ break;
+ case SWIG_OverflowError:
+ exception_code = SWIG_OCamlOverflowException;
+ break;
+ case SWIG_RuntimeError:
+ exception_code = SWIG_OCamlRuntimeException;
+ break;
+ case SWIG_SyntaxError:
+ case SWIG_TypeError:
+ case SWIG_ValueError:
+ exception_code = SWIG_OCamlIllegalArgumentException;
+ break;
+ case SWIG_UnknownError:
+ default:
+ exception_code = SWIG_OCamlUnknownError;
+ break;
+ }
+ SWIG_OCamlThrowException(exception_code, msg);
+ CAMLreturn0;
}
-#define SWIG_exception(a,b) SWIG_exception_((a),(b))
+#define SWIG_exception(code, msg) SWIG_OCamlException(code, msg)
%}
#endif
+
#ifdef SWIGCSHARP
%{
SWIGINTERN void SWIG_CSharpException(int code, const char *msg) {
diff --git a/Lib/gcj/cni.i b/Lib/gcj/cni.i
deleted file mode 100644
index fcc56687a..000000000
--- a/Lib/gcj/cni.i
+++ /dev/null
@@ -1,39 +0,0 @@
-%{
-#include <gcj/cni.h>
-%}
-
-%include <gcj/javaprims.i>
-
-extern void JvInitClass (jclass cls);
-
-extern jstring JvAllocString (jsize sz);
-
-extern jstring JvNewString (const jchar *chars, jsize len);
-
-extern jstring JvNewStringLatin1 (const char *bytes, jsize len);
-
-extern jstring JvNewStringLatin1 (const char *bytes);
-
-extern jchar* JvGetStringChars (jstring str);
-
-extern jsize JvGetStringUTFLength (jstring string);
-
-extern jsize JvGetStringUTFRegion (jstring str, jsize start, jsize len, char *buf);
-
-extern jstring JvNewStringUTF (const char *bytes);
-
-extern void *JvMalloc (jsize size);
-
-extern void JvFree (void *ptr);
-
-extern jint JvCreateJavaVM (JvVMInitArgs* vm_args);
-
-extern java::lang::Thread* JvAttachCurrentThread (jstring name, java::lang::ThreadGroup* group);
-
-extern java::lang::Thread* JvAttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group);
-
-extern jint JvDetachCurrentThread (void);
-
-
-%include <gcj/cni.swg>
-
diff --git a/Lib/gcj/cni.swg b/Lib/gcj/cni.swg
deleted file mode 100644
index 4bd07df06..000000000
--- a/Lib/gcj/cni.swg
+++ /dev/null
@@ -1,14 +0,0 @@
-/* -----------------------------------------------------------------------------
- * cni.swg
- * ----------------------------------------------------------------------------- */
-
-#ifdef SWIG
-
-#define __attribute__(...)
-%ignore class$;
-#pragma SWIG nowarn=313,402
-
-%nodefaultdtor;
-
-#endif
-
diff --git a/Lib/gcj/javaprims.i b/Lib/gcj/javaprims.i
deleted file mode 100644
index 12c92a793..000000000
--- a/Lib/gcj/javaprims.i
+++ /dev/null
@@ -1,422 +0,0 @@
-%include <stdint.i>
-
-typedef int8_t jbyte;
-typedef int16_t jshort;
-typedef int32_t jint;
-typedef int64_t jlong;
-typedef float jfloat;
-typedef double jdouble;
-typedef jint jsize;
-typedef int8_t jboolean;
-
-extern "Java"
-{
- namespace java
- {
- namespace io
- {
- class BufferedInputStream;
- class BufferedOutputStream;
- class BufferedReader;
- class BufferedWriter;
- class ByteArrayInputStream;
- class ByteArrayOutputStream;
- class CharArrayReader;
- class CharArrayWriter;
- class CharConversionException;
- class DataInput;
- class DataInputStream;
- class DataOutput;
- class DataOutputStream;
- class EOFException;
- class Externalizable;
- class File;
- class FileDescriptor;
- class FileFilter;
- class FileInputStream;
- class FileNotFoundException;
- class FileOutputStream;
- class FilePermission;
- class FileReader;
- class FileWriter;
- class FilenameFilter;
- class FilterInputStream;
- class FilterOutputStream;
- class FilterReader;
- class FilterWriter;
- class IOException;
- class InputStream;
- class InputStreamReader;
- class InterfaceComparator;
- class InterruptedIOException;
- class InvalidClassException;
- class InvalidObjectException;
- class LineNumberInputStream;
- class LineNumberReader;
- class MemberComparator;
- class NotActiveException;
- class NotSerializableException;
- class ObjectInput;
- class ObjectInputStream;
- class ObjectInputStream$GetField;
- class ObjectInputValidation;
- class ObjectOutput;
- class ObjectOutputStream;
- class ObjectOutputStream$PutField;
- class ObjectStreamClass;
- class ObjectStreamConstants;
- class ObjectStreamException;
- class ObjectStreamField;
- class OptionalDataException;
- class OutputStream;
- class OutputStreamWriter;
- class PipedInputStream;
- class PipedOutputStream;
- class PipedReader;
- class PipedWriter;
- class PrintStream;
- class PrintWriter;
- class PushbackInputStream;
- class PushbackReader;
- class RandomAccessFile;
- class Reader;
- class SequenceInputStream;
- class Serializable;
- class SerializablePermission;
- class StreamCorruptedException;
- class StreamTokenizer;
- class StringBufferInputStream;
- class StringReader;
- class StringWriter;
- class SyncFailedException;
- class UTFDataFormatException;
- class UnsupportedEncodingException;
- class VMObjectStreamClass;
- class ValidatorAndPriority;
- class WriteAbortedException;
- class Writer;
- }
-
- namespace lang
- {
- class AbstractMethodError;
- class ArithmeticException;
- class ArrayIndexOutOfBoundsException;
- class ArrayStoreException;
- class AssertionError;
- class Boolean;
- class Byte;
- class CharSequence;
- class Character;
- class Character$Subset;
- class Character$UnicodeBlock;
- class Class;
- class ClassCastException;
- class ClassCircularityError;
- class ClassFormatError;
- class ClassLoader;
- class ClassNotFoundException;
- class CloneNotSupportedException;
- class Cloneable;
- class Comparable;
- class Compiler;
- class ConcreteProcess;
- class Double;
- class Error;
- class Exception;
- class ExceptionInInitializerError;
- class Float;
- class IllegalAccessError;
- class IllegalAccessException;
- class IllegalArgumentException;
- class IllegalMonitorStateException;
- class IllegalStateException;
- class IllegalThreadStateException;
- class IncompatibleClassChangeError;
- class IndexOutOfBoundsException;
- class InheritableThreadLocal;
- class InstantiationError;
- class InstantiationException;
- class Integer;
- class InternalError;
- class InterruptedException;
- class LinkageError;
- class Long;
- class Math;
- class NegativeArraySizeException;
- class NoClassDefFoundError;
- class NoSuchFieldError;
- class NoSuchFieldException;
- class NoSuchMethodError;
- class NoSuchMethodException;
- class NullPointerException;
- class Number;
- class NumberFormatException;
- class Object;
- class OutOfMemoryError;
- class Package;
- class Process;
- class Runnable;
- class Runtime;
- class RuntimeException;
- class RuntimePermission;
- class SecurityContext;
- class SecurityException;
- class SecurityManager;
- class Short;
- class StackOverflowError;
- class StackTraceElement;
- class StrictMath;
- class String;
- class String$CaseInsensitiveComparator;
- class StringBuffer;
- class StringIndexOutOfBoundsException;
- class System;
- class Thread;
- class ThreadDeath;
- class ThreadGroup;
- class ThreadLocal;
- class Throwable;
- class UnknownError;
- class UnsatisfiedLinkError;
- class UnsupportedClassVersionError;
- class UnsupportedOperationException;
- class VMClassLoader;
- class VMSecurityManager;
- class VMThrowable;
- class VerifyError;
- class VirtualMachineError;
- class Void;
- namespace ref
- {
- class PhantomReference;
- class Reference;
- class ReferenceQueue;
- class SoftReference;
- class WeakReference;
- }
-
- namespace reflect
- {
- class AccessibleObject;
- class Array;
- class Constructor;
- class Field;
- class InvocationHandler;
- class InvocationTargetException;
- class Member;
- class Method;
- class Modifier;
- class Proxy;
- class Proxy$ClassFactory;
- class Proxy$ProxyData;
- class Proxy$ProxySignature;
- class Proxy$ProxyType;
- class ReflectPermission;
- class UndeclaredThrowableException;
- }
- }
-
- namespace util
- {
- class AbstractCollection;
- class AbstractList;
- class AbstractMap;
- class AbstractMap$BasicMapEntry;
- class AbstractSequentialList;
- class AbstractSet;
- class ArrayList;
- class Arrays;
- class Arrays$ArrayList;
- class BitSet;
- class Calendar;
- class Collection;
- class Collections;
- class Collections$CopiesList;
- class Collections$EmptyList;
- class Collections$EmptyMap;
- class Collections$EmptySet;
- class Collections$ReverseComparator;
- class Collections$SingletonList;
- class Collections$SingletonMap;
- class Collections$SingletonSet;
- class Collections$SynchronizedCollection;
- class Collections$SynchronizedIterator;
- class Collections$SynchronizedList;
- class Collections$SynchronizedListIterator;
- class Collections$SynchronizedMap;
- class Collections$SynchronizedMapEntry;
- class Collections$SynchronizedRandomAccessList;
- class Collections$SynchronizedSet;
- class Collections$SynchronizedSortedMap;
- class Collections$SynchronizedSortedSet;
- class Collections$UnmodifiableCollection;
- class Collections$UnmodifiableEntrySet;
- class Collections$UnmodifiableIterator;
- class Collections$UnmodifiableList;
- class Collections$UnmodifiableListIterator;
- class Collections$UnmodifiableMap;
- class Collections$UnmodifiableRandomAccessList;
- class Collections$UnmodifiableSet;
- class Collections$UnmodifiableSortedMap;
- class Collections$UnmodifiableSortedSet;
- class Comparator;
- class ConcurrentModificationException;
- class Currency;
- class Date;
- class Dictionary;
- class EmptyStackException;
- class Enumeration;
- class EventListener;
- class EventListenerProxy;
- class EventObject;
- class GregorianCalendar;
- class HashMap;
- class HashMap$HashEntry;
- class HashMap$HashIterator;
- class HashSet;
- class Hashtable;
- class Hashtable$Enumerator;
- class Hashtable$HashEntry;
- class Hashtable$HashIterator;
- class IdentityHashMap;
- class IdentityHashMap$IdentityEntry;
- class IdentityHashMap$IdentityIterator;
- class Iterator;
- class LinkedHashMap;
- class LinkedHashMap$LinkedHashEntry;
- class LinkedHashSet;
- class LinkedList;
- class LinkedList$Entry;
- class LinkedList$LinkedListItr;
- class List;
- class ListIterator;
- class ListResourceBundle;
- class Locale;
- class Map;
- class Map$Entry;
- class Map$Map;
- class MissingResourceException;
- class MyResources;
- class NoSuchElementException;
- class Observable;
- class Observer;
- class Properties;
- class PropertyPermission;
- class PropertyPermissionCollection;
- class PropertyResourceBundle;
- class Random;
- class RandomAccess;
- class RandomAccessSubList;
- class ResourceBundle;
- class Set;
- class SimpleTimeZone;
- class SortedMap;
- class SortedSet;
- class Stack;
- class StringTokenizer;
- class SubList;
- class TimeZone;
- class Timer;
- class Timer$Scheduler;
- class Timer$TaskQueue;
- class TimerTask;
- class TooManyListenersException;
- class TreeMap;
- class TreeMap$Node;
- class TreeMap$SubMap;
- class TreeMap$TreeIterator;
- class TreeSet;
- class Vector;
- class WeakHashMap;
- class WeakHashMap$WeakBucket;
- class WeakHashMap$WeakEntry;
- class WeakHashMap$WeakEntrySet;
- namespace jar
- {
- class Attributes;
- class Attributes$Name;
- class JarEntry;
- class JarException;
- class JarFile;
- class JarFile$JarEnumeration;
- class JarInputStream;
- class JarOutputStream;
- class Manifest;
- }
-
- namespace logging
- {
- class ConsoleHandler;
- class ErrorManager;
- class FileHandler;
- class Filter;
- class Formatter;
- class Handler;
- class Level;
- class LogManager;
- class LogRecord;
- class Logger;
- class LoggingPermission;
- class MemoryHandler;
- class SimpleFormatter;
- class SocketHandler;
- class StreamHandler;
- class XMLFormatter;
- }
-
- namespace prefs
- {
- class AbstractPreferences;
- class BackingStoreException;
- class InvalidPreferencesFormatException;
- class NodeChangeEvent;
- class NodeChangeListener;
- class PreferenceChangeEvent;
- class PreferenceChangeListener;
- class Preferences;
- class PreferencesFactory;
- }
-
- namespace regex
- {
- class Matcher;
- class Pattern;
- class PatternSyntaxException;
- }
-
- namespace zip
- {
- class Adler32;
- class CRC32;
- class CheckedInputStream;
- class CheckedOutputStream;
- class Checksum;
- class DataFormatException;
- class Deflater;
- class DeflaterOutputStream;
- class GZIPInputStream;
- class GZIPOutputStream;
- class Inflater;
- class InflaterInputStream;
- class ZipConstants;
- class ZipEntry;
- class ZipException;
- class ZipFile;
- class ZipFile$PartialInputStream;
- class ZipFile$ZipEntryEnumeration;
- class ZipInputStream;
- class ZipOutputStream;
- }
- }
- }
-}
-
-typedef class java::lang::Object* jobject;
-typedef class java::lang::Class* jclass;
-typedef class java::lang::Throwable* jthrowable;
-typedef class java::lang::String* jstring;
-
-
-%include <gcj/cni.swg>
-
diff --git a/Lib/go/director.swg b/Lib/go/director.swg
new file mode 100644
index 000000000..103ba22a3
--- /dev/null
+++ b/Lib/go/director.swg
@@ -0,0 +1,80 @@
+/* -----------------------------------------------------------------------------
+ * director.swg
+ *
+ * This file contains support for director classes so that Go proxy
+ * methods can be called from C++.
+ * ----------------------------------------------------------------------------- */
+
+#include <exception>
+#include <map>
+
+namespace Swig {
+
+ class DirectorException : public std::exception {
+ };
+}
+
+/* Handle memory management for directors. */
+
+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);
+}
diff --git a/Lib/go/go.swg b/Lib/go/go.swg
index 53b653f7c..c225ed9ad 100644
--- a/Lib/go/go.swg
+++ b/Lib/go/go.swg
@@ -341,8 +341,6 @@
%typemap(directorout) SWIGTYPE *
%{ $result = *($&1_ltype)&$input; %}
-%apply SWIGTYPE * { SWIGTYPE *const }
-
/* Pointer references. */
%typemap(gotype) SWIGTYPE *const&
@@ -382,6 +380,11 @@
%typemap(directorout) SWIGTYPE &
%{ *($&1_ltype)&$result = $input; %}
+%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *const&
+%{ static $*1_ltype swig_temp;
+ swig_temp = *($1_ltype)&$input;
+ $result = &swig_temp; %}
+
%typemap(gotype) SWIGTYPE &&
%{$gotypename%}
@@ -692,6 +695,10 @@
SWIGTYPE (CLASS::*)
""
+%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
+
/* Go keywords. */
%include <gokw.swg>
diff --git a/Lib/go/goruntime.swg b/Lib/go/goruntime.swg
index dc6193d04..269a4eefd 100644
--- a/Lib/go/goruntime.swg
+++ b/Lib/go/goruntime.swg
@@ -346,75 +346,6 @@ 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. */
diff --git a/Lib/go/std_list.i b/Lib/go/std_list.i
index e0262331e..ff6f70013 100644
--- a/Lib/go/std_list.i
+++ b/Lib/go/std_list.i
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------------
- * std_vector.i
+ * std_list.i
* ----------------------------------------------------------------------------- */
%{
@@ -9,7 +9,7 @@
namespace std {
- template<class T, class Alloc = allocator<T> >
+ template<class T>
class list {
public:
typedef size_t size_type;
@@ -19,9 +19,10 @@ namespace std {
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
- typedef Alloc allocator_type;
list();
+ list(const list& other);
+
size_type size() const;
bool empty() const;
%rename(isEmpty) empty;
diff --git a/Lib/go/std_map.i b/Lib/go/std_map.i
index 84b0c74ff..773b6d0c3 100644
--- a/Lib/go/std_map.i
+++ b/Lib/go/std_map.i
@@ -20,22 +20,28 @@
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
bool empty() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -45,14 +51,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
}
diff --git a/Lib/go/std_pair.i b/Lib/go/std_pair.i
index fe45ee676..732347db5 100644
--- a/Lib/go/std_pair.i
+++ b/Lib/go/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/go/std_vector.i b/Lib/go/std_vector.i
index 29bcd1391..679c70759 100644
--- a/Lib/go/std_vector.i
+++ b/Lib/go/std_vector.i
@@ -12,10 +12,17 @@ namespace std {
template<class T> class vector {
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;
+
vector();
vector(size_type n);
+ vector(const vector& other);
+
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
@@ -46,10 +53,17 @@ namespace std {
template<> class vector<bool> {
public:
typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
typedef bool value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
typedef bool const_reference;
+
vector();
vector(size_type n);
+ vector(const vector& other);
+
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
diff --git a/Lib/go/stl.i b/Lib/go/stl.i
index 38aba67b8..04f86014f 100644
--- a/Lib/go/stl.i
+++ b/Lib/go/stl.i
@@ -7,3 +7,4 @@
%include <std_vector.i>
%include <std_map.i>
%include <std_pair.i>
+
diff --git a/Lib/guile/guile_scm.swg b/Lib/guile/guile_scm.swg
index dfd5da271..16dc8aa92 100644
--- a/Lib/guile/guile_scm.swg
+++ b/Lib/guile/guile_scm.swg
@@ -8,6 +8,7 @@
#define SWIGGUILE_SCM
%runtime "swigrun.swg" // Common C API type-checking code
+%runtime "swigerrors.swg" // SWIG errors
%runtime "guile_scm_run.swg"
%include <guile.i>
@@ -26,10 +27,10 @@
else { \
if (!gswig_list_p) { \
gswig_list_p = 1; \
- gswig_result = scm_listify(gswig_result, object, SCM_UNDEFINED); \
+ gswig_result = scm_list_n(gswig_result, object, SCM_UNDEFINED); \
} \
else \
- gswig_result = scm_append(scm_listify(gswig_result, scm_listify(object, SCM_UNDEFINED), SCM_UNDEFINED)); \
+ gswig_result = scm_append(scm_list_n(gswig_result, scm_list_n(object, SCM_UNDEFINED), SCM_UNDEFINED)); \
}
%}
diff --git a/Lib/guile/guile_scm_run.swg b/Lib/guile/guile_scm_run.swg
index 1cc08b024..86e5c3be0 100644
--- a/Lib/guile/guile_scm_run.swg
+++ b/Lib/guile/guile_scm_run.swg
@@ -24,6 +24,8 @@ scm_module_variable (SCM module, SCM sym)
return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
}
+#define scm_to_utf8_string scm_to_locale_string
+#define scm_from_utf8_string scm_from_locale_string
#endif
#if SCM_MAJOR_VERSION >= 2
@@ -40,10 +42,6 @@ typedef struct swig_guile_clientdata {
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) \
@@ -101,6 +99,7 @@ SWIG_Guile_scm2newstr(SCM str, size_t *len) {
static int swig_initialized = 0;
static scm_t_bits swig_tag = 0;
static scm_t_bits swig_collectable_tag = 0;
+static scm_t_bits swig_finalized_tag = 0;
static scm_t_bits swig_destroyed_tag = 0;
static scm_t_bits swig_member_function_tag = 0;
static SCM swig_make_func = SCM_EOL;
@@ -165,7 +164,19 @@ SWIG_Guile_PointerType(SCM object)
}
else scm_wrong_type_arg("SWIG-Guile-PointerType", 1, object);
}
-
+
+SWIGINTERN int
+SWIG_Guile_IsValidSmob(SCM smob)
+{
+ /* We do not accept smobs representing destroyed pointers, but we have to
+ allow finalized smobs because Guile >= 2.0.12 sets all smob instances
+ to the 'finalized' type before calling their 'free' function. This change
+ was introduced to Guile in commit 8dff3af087c6eaa83ae0d72aa8b22aef5c65d65d */
+ return SCM_SMOB_PREDICATE(swig_tag, smob)
+ || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
+ || SCM_SMOB_PREDICATE(swig_finalized_tag, smob);
+}
+
SWIGINTERN int
SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
{
@@ -175,14 +186,13 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
if (SCM_NULLP(smob)) {
*result = NULL;
- return SWIG_OK;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : 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 */
+ } else if (SWIG_Guile_IsValidSmob(smob)) {
from = (swig_type_info *) SCM_CELL_WORD_2(smob);
if (!from) return SWIG_ERROR;
if (type) {
@@ -241,7 +251,7 @@ SWIG_Guile_MarkPointerNoncollectable(SCM s)
{
SCM smob = SWIG_Guile_GetSmob(s);
if (!SCM_NULLP(smob)) {
- if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
+ if (SWIG_Guile_IsValidSmob(smob)) {
SCM_SET_CELL_TYPE(smob, swig_tag);
}
else scm_wrong_type_arg(NULL, 0, s);
@@ -254,7 +264,7 @@ SWIG_Guile_MarkPointerDestroyed(SCM s)
{
SCM smob = SWIG_Guile_GetSmob(s);
if (!SCM_NULLP(smob)) {
- if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
+ if (SWIG_Guile_IsValidSmob(smob)) {
SCM_SET_CELL_TYPE(smob, swig_destroyed_tag);
}
else scm_wrong_type_arg(NULL, 0, s);
@@ -421,6 +431,8 @@ SWIG_Guile_Init ()
scm_set_smob_print(swig_collectable_tag, print_collectable_swig);
scm_set_smob_equalp(swig_collectable_tag, equalp_swig);
scm_set_smob_free(swig_collectable_tag, free_swig);
+ /* For Guile >= 2.0.12. See libguile/smob.c:clear_smobnum */
+ swig_finalized_tag = swig_collectable_tag & ~0xff00;
}
if (ensure_smob_tag(swig_module, &swig_destroyed_tag,
"destroyed-swig-pointer", "destroyed-swig-pointer-tag")) {
diff --git a/Lib/guile/guilemain.i b/Lib/guile/guilemain.i
index 925b81fee..809154e99 100644
--- a/Lib/guile/guilemain.i
+++ b/Lib/guile/guilemain.i
@@ -12,11 +12,6 @@
extern "C" {
#endif
-/* Debugger interface (don't change the order of the following lines) */
-#define GDB_TYPE SCM
-#include <libguile/gdb_interface.h>
-GDB_INTERFACE;
-
static void
inner_main(void *closure, int argc, char **argv)
{
diff --git a/Lib/guile/std_map.i b/Lib/guile/std_map.i
index 489acc187..f84e78bc3 100644
--- a/Lib/guile/std_map.i
+++ b/Lib/guile/std_map.i
@@ -40,12 +40,12 @@
namespace std {
- template<class K, class T> class map {
- %typemap(in) map<K,T> {
+ template<class K, class T, class C = std::less<K> > class map {
+ %typemap(in) map< K, T, C > {
if (scm_is_null($input)) {
- $1 = std::map< K, T >();
+ $1 = std::map< K, T, C >();
} else if (scm_is_pair($input)) {
- $1 = std::map< K, T >();
+ $1 = std::map< K, T, C >();
SCM alist = $input;
while (!scm_is_null(alist)) {
K* k;
@@ -72,13 +72,13 @@ namespace std {
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
- %typemap(in) const map<K,T>& (std::map<K,T> temp),
- const map<K,T>* (std::map<K,T> temp) {
+ %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp),
+ const map< K, T, C >* (std::map< K, T, C > temp) {
if (scm_is_null($input)) {
- temp = std::map< K, T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
} else if (scm_is_pair($input)) {
- temp = std::map< K, T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
SCM alist = $input;
while (!scm_is_null(alist)) {
@@ -105,9 +105,9 @@ namespace std {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
- %typemap(out) map<K,T> {
+ %typemap(out) map< K, T, C > {
SCM alist = SCM_EOL;
- for (std::map< K, T >::reverse_iterator i=$i.rbegin(); i!=$i.rend(); ++i) {
+ for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
K* key = new K(i->first);
T* val = new T(i->second);
SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
@@ -117,7 +117,7 @@ namespace std {
}
$result = alist;
}
- %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
+ %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
/* native sequence? */
if (scm_is_null($input)) {
/* an empty sequence can be of any type */
@@ -153,7 +153,7 @@ namespace std {
}
} else {
/* wrapped map? */
- std::map< K, T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) == 0)
$1 = 1;
@@ -161,8 +161,8 @@ namespace std {
$1 = 0;
}
}
- %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
- const map<K,T>* {
+ %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
+ const map< K, T, C >* {
/* native sequence? */
if (scm_is_null($input)) {
/* an empty sequence can be of any type */
@@ -198,7 +198,7 @@ namespace std {
}
} else {
/* wrapped map? */
- std::map< K, T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) == 0)
$1 = 1;
@@ -218,15 +218,21 @@ namespace std {
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map< K, T> &);
+ map(const map& other);
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -236,19 +242,19 @@ namespace std {
(*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, C >::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, C >::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, C >::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);
@@ -263,12 +269,12 @@ namespace std {
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
- template<class T> class map<K,T> {
- %typemap(in) map<K,T> {
+ template<class T> class map< K, T, C > {
+ %typemap(in) map< K, T, C > {
if (scm_is_null($input)) {
- $1 = std::map< K, T >();
+ $1 = std::map< K, T, C >();
} else if (scm_is_pair($input)) {
- $1 = std::map< K, T >();
+ $1 = std::map< K, T, C >();
SCM alist = $input;
while (!scm_is_null(alist)) {
T* x;
@@ -280,7 +286,7 @@ namespace std {
val = SCM_CDR(entry);
if (!CHECK(key))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
if (SWIG_ConvertPtr(val,(void**) &x,
$descriptor(T *), 0) != 0) {
if (!scm_is_pair(val))
@@ -296,13 +302,13 @@ namespace std {
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
- %typemap(in) const map<K,T>& (std::map<K,T> temp),
- const map<K,T>* (std::map<K,T> temp) {
+ %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp),
+ const map< K, T, C >* (std::map< K, T, C > temp) {
if (scm_is_null($input)) {
- temp = std::map< K, T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
} else if (scm_is_pair($input)) {
- temp = std::map< K, T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
SCM alist = $input;
while (!scm_is_null(alist)) {
@@ -315,7 +321,7 @@ namespace std {
val = SCM_CDR(entry);
if (!CHECK(key))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
if (SWIG_ConvertPtr(val,(void**) &x,
$descriptor(T *), 0) != 0) {
if (!scm_is_pair(val))
@@ -330,9 +336,9 @@ namespace std {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
- %typemap(out) map<K,T> {
+ %typemap(out) map< K, T, C > {
SCM alist = SCM_EOL;
- for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
+ for (std::map< K, T, C >::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);
@@ -341,7 +347,7 @@ namespace std {
}
$result = alist;
}
- %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
+ %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
// native sequence?
if (scm_is_null($input)) {
/* an empty sequence can be of any type */
@@ -375,7 +381,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map< K, T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) == 0)
$1 = 1;
@@ -383,8 +389,8 @@ namespace std {
$1 = 0;
}
}
- %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
- const map<K,T>* {
+ %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
+ const map< K, T, C >* {
// native sequence?
if (scm_is_null($input)) {
/* an empty sequence can be of any type */
@@ -418,7 +424,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map< K, T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) == 0)
$1 = 1;
@@ -434,15 +440,25 @@ namespace std {
%rename("delete!") __delitem__;
%rename("has-key?") has_key;
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map< K, T > &);
+ map(const map& other);
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -452,19 +468,19 @@ namespace std {
(*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, C >::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, C >::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, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
SCM k = CONVERT_TO(i->first);
result = scm_cons(k,result);
}
@@ -475,12 +491,12 @@ namespace std {
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
- template<class K> class map<K,T> {
- %typemap(in) map<K,T> {
+ template<class K> class map< K, T, C > {
+ %typemap(in) map< K, T, C > {
if (scm_is_null($input)) {
- $1 = std::map< K, T >();
+ $1 = std::map< K, T, C >();
} else if (scm_is_pair($input)) {
- $1 = std::map< K, T >();
+ $1 = std::map< K, T, C >();
SCM alist = $input;
while (!scm_is_null(alist)) {
K* k;
@@ -497,7 +513,7 @@ namespace std {
val = SCM_CAR(val);
if (!CHECK(val))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
}
(($1_type &)$1)[*k] = CONVERT_FROM(val);
alist = SCM_CDR(alist);
@@ -507,13 +523,13 @@ namespace std {
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
- %typemap(in) const map<K,T>& (std::map<K,T> temp),
- const map<K,T>* (std::map<K,T> temp) {
+ %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp),
+ const map< K, T, C >* (std::map< K, T, C > temp) {
if (scm_is_null($input)) {
- temp = std::map< K, T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
} else if (scm_is_pair($input)) {
- temp = std::map< K, T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
SCM alist = $input;
while (!scm_is_null(alist)) {
@@ -531,7 +547,7 @@ namespace std {
val = SCM_CAR(val);
if (!CHECK(val))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
}
temp[*k] = CONVERT_FROM(val);
alist = SCM_CDR(alist);
@@ -540,9 +556,9 @@ namespace std {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
- %typemap(out) map<K,T> {
+ %typemap(out) map< K, T, C > {
SCM alist = SCM_EOL;
- for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
+ for (std::map< K, T, C >::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);
@@ -551,7 +567,7 @@ namespace std {
}
$result = alist;
}
- %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
+ %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
// native sequence?
if (scm_is_null($input)) {
/* an empty sequence can be of any type */
@@ -583,7 +599,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map< K, T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) == 0)
$1 = 1;
@@ -591,8 +607,8 @@ namespace std {
$1 = 0;
}
}
- %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
- const map<K,T>* {
+ %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
+ const map< K, T, C >* {
// native sequence?
if (scm_is_null($input)) {
/* an empty sequence can be of any type */
@@ -624,7 +640,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map< K, T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) == 0)
$1 = 1;
@@ -640,15 +656,25 @@ namespace std {
%rename("delete!") __delitem__;
%rename("has-key?") has_key;
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map< K, T > &);
+ map(const map& other);
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -658,19 +684,19 @@ namespace std {
(*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, C >::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, C >::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, C >::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);
@@ -683,12 +709,12 @@ namespace std {
%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> {
+ template<> class map< K, T, C > {
+ %typemap(in) map< K, T, C > {
if (scm_is_null($input)) {
- $1 = std::map< K, T >();
+ $1 = std::map< K, T, C >();
} else if (scm_is_pair($input)) {
- $1 = std::map< K, T >();
+ $1 = std::map< K, T, C >();
SCM alist = $input;
while (!scm_is_null(alist)) {
SCM entry, key, val;
@@ -699,14 +725,14 @@ namespace std {
val = SCM_CDR(entry);
if (!CHECK_K(key))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
if (!CHECK_T(val)) {
if (!scm_is_pair(val))
SWIG_exception(SWIG_TypeError,"alist expected");
val = SCM_CAR(val);
if (!CHECK_T(val))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
}
(($1_type &)$1)[CONVERT_K_FROM(key)] =
CONVERT_T_FROM(val);
@@ -717,13 +743,13 @@ namespace std {
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
}
}
- %typemap(in) const map<K,T>& (std::map<K,T> temp),
- const map<K,T>* (std::map<K,T> temp) {
+ %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp),
+ const map< K, T, C >* (std::map< K, T, C > temp) {
if (scm_is_null($input)) {
- temp = std::map< K, T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
} else if (scm_is_pair($input)) {
- temp = std::map< K, T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
SCM alist = $input;
while (!scm_is_null(alist)) {
@@ -735,14 +761,14 @@ namespace std {
val = SCM_CDR(entry);
if (!CHECK_K(key))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
if (!CHECK_T(val)) {
if (!scm_is_pair(val))
SWIG_exception(SWIG_TypeError,"alist expected");
val = SCM_CAR(val);
if (!CHECK_T(val))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
}
temp[CONVERT_K_FROM(key)] = CONVERT_T_FROM(val);
alist = SCM_CDR(alist);
@@ -751,9 +777,9 @@ namespace std {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
- %typemap(out) map<K,T> {
+ %typemap(out) map< K, T, C > {
SCM alist = SCM_EOL;
- for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
+ for (std::map< K, T, C >::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);
@@ -761,7 +787,7 @@ namespace std {
}
$result = alist;
}
- %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
+ %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
// native sequence?
if (scm_is_null($input)) {
/* an empty sequence can be of any type */
@@ -792,7 +818,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map< K, T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) == 0)
$1 = 1;
@@ -800,8 +826,8 @@ namespace std {
$1 = 0;
}
}
- %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
- const map<K,T>* {
+ %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
+ const map< K, T, C >* {
// native sequence?
if (scm_is_null($input)) {
/* an empty sequence can be of any type */
@@ -832,7 +858,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map< K, T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) == 0)
$1 = 1;
@@ -848,15 +874,25 @@ namespace std {
%rename("delete!") __delitem__;
%rename("has-key?") has_key;
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map< K, T> &);
+ map(const map& other);
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -866,19 +902,19 @@ namespace std {
(*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, C >::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, C >::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, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
SCM k = CONVERT_K_TO(i->first);
result = scm_cons(k,result);
}
diff --git a/Lib/guile/std_pair.i b/Lib/guile/std_pair.i
index 92dec5fae..050d4880a 100644
--- a/Lib/guile/std_pair.i
+++ b/Lib/guile/std_pair.i
@@ -113,11 +113,15 @@ namespace std {
$1 = 0;
}
}
+
+ typedef T first_type;
+ typedef U second_type;
+
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
@@ -217,9 +221,9 @@ namespace std {
}
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
@@ -317,9 +321,9 @@ namespace std {
}
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
@@ -408,9 +412,9 @@ namespace std {
}
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/guile/std_vector.i b/Lib/guile/std_vector.i
index d7a7140c6..42bad849d 100644
--- a/Lib/guile/std_vector.i
+++ b/Lib/guile/std_vector.i
@@ -187,9 +187,18 @@ namespace std {
}
}
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, const T& value);
- vector(const vector<T>&);
+ vector(const vector& other);
+
%rename(length) size;
unsigned int size() const;
%rename("empty?") empty;
@@ -351,9 +360,18 @@ namespace std {
}
}
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, const T& value);
- vector(const vector<T>&);
+ vector(const vector& other);
+
%rename(length) size;
unsigned int size() const;
%rename("empty?") empty;
diff --git a/Lib/guile/stl.i b/Lib/guile/stl.i
index 9d2e91eee..04f86014f 100644
--- a/Lib/guile/stl.i
+++ b/Lib/guile/stl.i
@@ -1,7 +1,5 @@
/* -----------------------------------------------------------------------------
* stl.i
- *
- * Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
%include <std_common.i>
diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i
index a01e73f64..cfccced88 100644
--- a/Lib/guile/typemaps.i
+++ b/Lib/guile/typemaps.i
@@ -69,13 +69,13 @@
%typemap(throws) SWIGTYPE {
$&ltype temp = new $ltype($1);
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
- scm_listify(SWIG_NewPointerObj(temp, $&descriptor, 1),
+ scm_list_n(SWIG_NewPointerObj(temp, $&descriptor, 1),
SCM_UNDEFINED));
}
%typemap(throws) SWIGTYPE & {
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
- scm_listify(SWIG_NewPointerObj(&$1, $descriptor, 1),
+ scm_list_n(SWIG_NewPointerObj(&$1, $descriptor, 1),
SCM_UNDEFINED));
}
@@ -87,13 +87,13 @@
%typemap(throws) SWIGTYPE * {
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
- scm_listify(SWIG_NewPointerObj($1, $descriptor, 1),
+ scm_list_n(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),
+ scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1),
SCM_UNDEFINED));
}
@@ -176,7 +176,7 @@
%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((int)$1), SCM_UNDEFINED));
+ scm_list_n(scm_from_long((int)$1), SCM_UNDEFINED));
}
/* The SIMPLE_MAP_WITH_EXPR macro below defines the whole set of
@@ -225,7 +225,7 @@
%typemap(throws) C_NAME {
C_NAME swig_c_value = $1;
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
- scm_listify(C_TO_SCM_EXPR, SCM_UNDEFINED));
+ scm_list_n(C_TO_SCM_EXPR, SCM_UNDEFINED));
}
%enddef
@@ -269,7 +269,7 @@
/* Throw typemap */
%typemap(throws) C_NAME {
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
- scm_listify(C_TO_SCM($1), SCM_UNDEFINED));
+ scm_list_n(C_TO_SCM($1), SCM_UNDEFINED));
}
%enddef
@@ -344,7 +344,7 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer);
%typemap(throws) char * {
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
- scm_listify(SWIG_str02scm($1), SCM_UNDEFINED));
+ scm_list_n(SWIG_str02scm($1), SCM_UNDEFINED));
}
/* Void */
@@ -444,15 +444,21 @@ typedef unsigned long SCM;
$1 = scm_is_string($input) ? 1 : 0;
}
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
+%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
void *ptr;
int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0);
$1 = SWIG_CheckState(res);
}
+%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &, SWIGTYPE && {
+ void *ptr;
+ int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, SWIG_POINTER_NO_NULL);
+ $1 = SWIG_CheckState(res);
+}
+
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
void *ptr;
- int res = SWIG_ConvertPtr($input, &ptr, $&descriptor, 0);
+ int res = SWIG_ConvertPtr($input, &ptr, $&descriptor, SWIG_POINTER_NO_NULL);
$1 = SWIG_CheckState(res);
}
@@ -468,5 +474,7 @@ typedef unsigned long SCM;
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
/* typemaps.i ends here */
diff --git a/Lib/intrusive_ptr.i b/Lib/intrusive_ptr.i
index ceaeaf0bb..621a701f9 100644
--- a/Lib/intrusive_ptr.i
+++ b/Lib/intrusive_ptr.i
@@ -44,18 +44,16 @@ struct SWIG_null_deleter {
%#define SWIG_NO_NULL_DELETER_1
}
-// Workaround empty first macro argument bug
-#define SWIGEMPTYHACK
// Main user macro for defining intrusive_ptr typemaps for both const and non-const pointer types
%define %intrusive_ptr(TYPE...)
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
-SWIG_INTRUSIVE_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE)
+SWIG_INTRUSIVE_PTR_TYPEMAPS(, TYPE)
SWIG_INTRUSIVE_PTR_TYPEMAPS(const, TYPE)
%enddef
%define %intrusive_ptr_no_wrap(TYPE...)
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
-SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(SWIGEMPTYHACK, TYPE)
+SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(, TYPE)
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(const, TYPE)
%enddef
diff --git a/Lib/java/boost_intrusive_ptr.i b/Lib/java/boost_intrusive_ptr.i
index a484a3b6c..3bc80b467 100644
--- a/Lib/java/boost_intrusive_ptr.i
+++ b/Lib/java/boost_intrusive_ptr.i
@@ -29,26 +29,26 @@
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
return $null;
}
- $1 = *argp;
+ $1 = *argp;
%}
-%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{
+%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 >());
+ *(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) 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);
+ $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 >());
+ *(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;
}
@@ -63,70 +63,70 @@
if(!$1) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
return $null;
- }
+ }
%}
-%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE & %{
+%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 >());
+ *(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) %{
+%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;
+ $1 = &temp;
%}
-%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{
+%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 >());
+ *(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 > ($&1_type argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
+%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > ($&1_type argp, 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);
+ $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 > %{
+%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{
if ($1) {
intrusive_ptr_add_ref(result.get());
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(result.get(), SWIG_intrusive_deleter< CONST TYPE >());
} else {
- *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
+ *(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;
+ 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(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) %{
+%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;
+ 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 {
@@ -140,21 +140,21 @@
$1 = *temp;
}
%}
-%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{
+%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) %{
+%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;
+ smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
- $1 = &temp;
+ $1 = &temp;
} else {
$1 = &tempnull;
}
@@ -163,17 +163,17 @@
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 > * %{
+%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;
+ 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) %{
+%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) {
@@ -185,14 +185,14 @@
%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 > *& %{
+%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::*) %{
@@ -208,7 +208,7 @@
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "jlong"
-%typemap (jtype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
+%typemap (jtype) 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 > *,
@@ -341,7 +341,7 @@
return $null;
}
$1 = *argp; %}
-%typemap(out) CONST TYPE
+%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
@@ -371,11 +371,11 @@
%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;
+ 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(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
@@ -467,6 +467,17 @@
%typemap(jtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "long"
%typemap(jtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "long"
+// Typecheck typemaps
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *")
+ TYPE CONST,
+ TYPE CONST &,
+ TYPE CONST *,
+ TYPE *CONST&,
+ 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 > *&
+ ""
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef
diff --git a/Lib/java/boost_shared_ptr.i b/Lib/java/boost_shared_ptr.i
index 5ed16aa32..325a6832d 100644
--- a/Lib/java/boost_shared_ptr.i
+++ b/Lib/java/boost_shared_ptr.i
@@ -14,7 +14,7 @@
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor wrapper customisation
-%feature("unref") TYPE
+%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;"
@@ -28,9 +28,22 @@
return $null;
}
$1 = *argp; %}
-%typemap(out) CONST TYPE
+%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)); %}
+%typemap(directorin,descriptor="L$packagepath/$&javaclassname;") CONST TYPE
+%{ $input = 0;
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
+
+%typemap(directorout) CONST TYPE
+%{ if (!$input) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
+ return $null;
+ }
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input;
+ $result = *smartarg->get();
+ %}
+
// 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;
@@ -39,6 +52,16 @@
*(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;
%}
+%typemap(directorin,descriptor="L$packagepath/$javaclassname;") CONST TYPE *
+%{ $input = 0;
+ if ($1) {
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ($1 SWIG_NO_NULL_DELETER_0);
+ } %}
+
+%typemap(directorout) CONST TYPE * %{
+#error "typemaps for $1_type not available"
+%}
+
// plain reference
%typemap(in) 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);
@@ -49,6 +72,14 @@
%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); %}
+%typemap(directorin,descriptor="L$packagepath/$javaclassname;") CONST TYPE &
+%{ $input = 0;
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (&$1 SWIG_NO_NULL_DELETER_0); %}
+
+%typemap(directorout) CONST TYPE & %{
+#error "typemaps for $1_type not available"
+%}
+
// plain pointer by reference
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
@@ -56,18 +87,50 @@
%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(directorin,descriptor="L$packagepath/$*javaclassname;") TYPE *CONST&
+%{ $input = 0;
+ if ($1) {
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ($1 SWIG_NO_NULL_DELETER_0);
+ } %}
+
+%typemap(directorout) TYPE *CONST& %{
+#error "typemaps for $1_type not available"
+%}
+
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ($&1_type argp)
-%{ argp = *($&1_ltype*)&$input;
+%{ argp = *($&1_ltype*)&$input;
if (argp) $1 = *argp; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ *($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0; %}
+%typemap(directorin,descriptor="L$packagepath/$typemap(jstype, TYPE);") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
+%{ $input = 0;
+ if ($1) {
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1);
+ } %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
+%{ if ($input) {
+ $&1_type smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input;
+ $result = *smartarg;
+ } %}
+
// shared_ptr by reference
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
%{ $1 = $input ? *($&1_ltype)&$input : &tempnull; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
-%{ *($&1_ltype)&$result = *$1 ? new $*1_ltype(*$1) : 0; %}
+%{ *($&1_ltype)&$result = *$1 ? new $*1_ltype(*$1) : 0; %}
+
+%typemap(directorin,descriptor="L$packagepath/$typemap(jstype, TYPE);") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
+%{ $input = 0;
+ if ($1) {
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1);
+ } %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
+#error "typemaps for $1_type not available"
+%}
// shared_ptr by pointer
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
@@ -76,12 +139,32 @@
%{ *($&1_ltype)&$result = ($1 && *$1) ? new $*1_ltype(*$1) : 0;
if ($owner) delete $1; %}
+%typemap(directorin,descriptor="L$packagepath/$typemap(jstype, TYPE);") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
+%{ $input = 0;
+ if ($1 && *$1) {
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1);
+ } %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
+#error "typemaps for $1_type not available"
+%}
+
// shared_ptr by pointer reference
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
$1 = &temp; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
-%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
+%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
+
+%typemap(directorin,descriptor="L$packagepath/$typemap(jstype, TYPE);") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
+%{ $input = 0;
+ if ($1 && *$1) {
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1);
+ } %}
+
+%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
+#error "typemaps for $1_type not available"
+%}
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
@@ -92,20 +175,20 @@
%}
-%typemap (jni) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
+%typemap (jni) 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 > *& "jlong"
-%typemap (jtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
+%typemap (jtype) 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 > *& "long"
-%typemap (jstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
+%typemap (jstype) 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 > *& "$typemap(jstype, TYPE)"
-%typemap(javain) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
+%typemap(javain) 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 > *& "$typemap(jstype, TYPE).getCPtr($javainput)"
@@ -143,6 +226,18 @@
return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true);
}
+%typemap(javadirectorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(jstype, TYPE).getCPtr($javacall)"
+
+%typemap(javadirectorin) CONST TYPE,
+ CONST TYPE *,
+ CONST TYPE &,
+ TYPE *CONST& "($jniinput == 0) ? null : new $typemap(jstype, TYPE)($jniinput, true)"
+
+%typemap(javadirectorin) 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 > *& "($jniinput == 0) ? null : new $typemap(jstype, TYPE)($jniinput, true)"
+
// Base proxy classes
%typemap(javabody) TYPE %{
private transient long swigCPtr;
@@ -156,6 +251,10 @@
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
+
+ CPTR_VISIBILITY void swigSetCMemOwn(boolean own) {
+ swigCMemOwn = own;
+ }
%}
// Derived proxy classes
@@ -172,6 +271,11 @@
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
+
+ CPTR_VISIBILITY void swigSetCMemOwn(boolean own) {
+ swigCMemOwnDerived = own;
+ super.swigSetCMemOwn(own);
+ }
%}
%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized") TYPE {
@@ -195,6 +299,38 @@
super.delete();
}
+%typemap(directordisconnect, methodname="swigDirectorDisconnect") TYPE %{
+ protected void $methodname() {
+ swigSetCMemOwn(false);
+ $jnicall;
+ }
+%}
+
+%typemap(directorowner_release, methodname="swigReleaseOwnership") TYPE %{
+ public void $methodname() {
+ swigSetCMemOwn(false);
+ $jnicall;
+ }
+%}
+
+%typemap(directorowner_take, methodname="swigTakeOwnership") TYPE %{
+ public void $methodname() {
+ swigSetCMemOwn(true);
+ $jnicall;
+ }
+%}
+
+// Typecheck typemaps
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *")
+ TYPE CONST,
+ TYPE CONST &,
+ TYPE CONST *,
+ TYPE *CONST&,
+ 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 > *&
+ ""
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef
diff --git a/Lib/java/director.swg b/Lib/java/director.swg
index 355e62d67..d3bd162ec 100644
--- a/Lib/java/director.swg
+++ b/Lib/java/director.swg
@@ -5,12 +5,52 @@
* methods can be called from C++.
* ----------------------------------------------------------------------------- */
-#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION)
+#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) || defined(DEBUG_DIRECTOR_THREAD_NAME)
#include <iostream>
#endif
#include <exception>
+#if defined(SWIG_JAVA_USE_THREAD_NAME)
+
+#if !defined(SWIG_JAVA_GET_THREAD_NAME)
+namespace Swig {
+ SWIGINTERN int GetThreadName(char *name, size_t len);
+}
+
+#if defined(__linux__)
+
+#include <sys/prctl.h>
+SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
+ (void)len;
+#if defined(PR_GET_NAME)
+ return prctl(PR_GET_NAME, (unsigned long)name, 0, 0, 0);
+#else
+ (void)name;
+ return 1;
+#endif
+}
+
+#elif defined(__unix__) || defined(__APPLE__)
+
+#include <pthread.h>
+SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
+ return pthread_getname_np(pthread_self(), name, len);
+}
+
+#else
+
+SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
+ (void)len;
+ (void)name;
+ return 1;
+}
+#endif
+
+#endif
+
+#endif
+
namespace Swig {
/* Java object wrapper */
@@ -139,12 +179,27 @@ namespace Swig {
void **jenv = (void **)&jenv_;
#endif
env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2);
+ JavaVMAttachArgs args;
+ args.version = JNI_VERSION_1_2;
+ args.group = NULL;
+ args.name = NULL;
+#if defined(SWIG_JAVA_USE_THREAD_NAME)
+ char thread_name[64]; // MAX_TASK_COMM_LEN=16 is hard-coded in the Linux kernel and MacOS has MAXTHREADNAMESIZE=64.
+ if (Swig::GetThreadName(thread_name, sizeof(thread_name)) == 0) {
+ args.name = thread_name;
+#if defined(DEBUG_DIRECTOR_THREAD_NAME)
+ std::cout << "JNIEnvWrapper: thread name: " << thread_name << std::endl;
+ } else {
+ std::cout << "JNIEnvWrapper: Couldn't set Java thread name" << std::endl;
+#endif
+ }
+#endif
#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);
+ director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, &args);
#else
- director_->swig_jvm_->AttachCurrentThread(jenv, NULL);
+ director_->swig_jvm_->AttachCurrentThread(jenv, &args);
#endif
}
~JNIEnvWrapper() {
@@ -259,8 +314,10 @@ namespace Swig {
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");
+ // Return a C string of the exception message in the jthrowable passed in the constructor
+ // If no message is available, null_string is return instead
+ const char *message(const char *null_string = "Could not get exception message in JavaExceptionMessage") const {
+ return message_.c_str(null_string);
}
private:
@@ -294,10 +351,11 @@ namespace Swig {
public:
// Construct exception from a Java throwable
- DirectorException(JNIEnv *jenv, jthrowable throwable) : classname_(0), msg_(0) {
+ DirectorException(JNIEnv *jenv, jthrowable throwable) : jenv_(jenv), throwable_(throwable), classname_(0), msg_(0) {
// Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/')
- if (throwable) {
+ if (jenv && throwable) {
+ jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions
jclass throwclz = jenv->GetObjectClass(throwable);
if (throwclz) {
jclass clzclz = jenv->GetObjectClass(throwclz);
@@ -318,11 +376,11 @@ namespace Swig {
}
JavaExceptionMessage exceptionmsg(jenv, throwable);
- msg_ = copystr(exceptionmsg.message());
+ msg_ = copystr(exceptionmsg.message(0));
}
// More general constructor for handling as a java.lang.RuntimeException
- DirectorException(const char *msg) : classname_(0), msg_(copystr(msg ? msg : "Unspecified DirectorException message")) {
+ DirectorException(const char *msg) : jenv_(0), throwable_(0), classname_(0), msg_(msg ? copystr(msg) : 0) {
}
~DirectorException() throw() {
@@ -331,31 +389,53 @@ namespace Swig {
}
const char *what() const throw() {
- return msg_;
+ return msg_ ? msg_ : "Unspecified DirectorException message";
}
// 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 {
+ void throwException(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());
- }
+ if (jenv == jenv_ && throwable_) {
+ // Throw original exception if not already pending
+ jthrowable throwable = jenv->ExceptionOccurred();
+ if (throwable && jenv->IsSameObject(throwable, throwable_) == JNI_FALSE) {
+ jenv->ExceptionClear();
+ throwable = 0;
+ }
+ if (!throwable)
+ jenv->Throw(throwable_);
+ } else {
+ // Try and reconstruct original exception, but original stacktrace is not reconstructed
+ 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());
+ }
+ }
}
}
+ // Deprecated - use throwException
+ void raiseJavaException(JNIEnv *jenv) const {
+ throwException(jenv);
+ }
+
+ // Create and throw the DirectorException
+ static void raise(JNIEnv *jenv, jthrowable throwable) {
+ throw DirectorException(jenv, throwable);
+ }
+
private:
static char *copypath(const char *srcmsg) {
char *target = copystr(srcmsg);
@@ -376,11 +456,14 @@ namespace Swig {
return target;
}
+ JNIEnv *jenv_;
+ jthrowable throwable_;
const char *classname_;
const char *msg_;
};
// Helper method to determine if a Java throwable matches a particular Java class type
+ // Note side effect of clearing any pending exceptions
SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) {
bool matches = false;
diff --git a/Lib/java/java.swg b/Lib/java/java.swg
index d173cb627..e9309331a 100644
--- a/Lib/java/java.swg
+++ b/Lib/java/java.swg
@@ -54,6 +54,14 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
}
}
+%fragment("SWIG_JavaIntFromSize_t", "header") {
+/* Check for overflow converting to Java int (always signed 32-bit) from (unsigned variable-bit) size_t */
+SWIGINTERN jint SWIG_JavaIntFromSize_t(size_t size) {
+ static const jint JINT_MAX = 0x7FFFFFFF;
+ return (size > (size_t)JINT_MAX) ? -1 : (jint)size;
+}
+}
+
/* Primitive types */
%typemap(jni) bool, const bool & "jboolean"
%typemap(jni) char, const char & "jchar"
@@ -103,6 +111,21 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(jstype) double, const double & "double"
%typemap(jstype) void "void"
+%typemap(jboxtype) bool, const bool & "Boolean"
+%typemap(jboxtype) char, const char & "Character"
+%typemap(jboxtype) signed char, const signed char & "Byte"
+%typemap(jboxtype) unsigned char, const unsigned char & "Short"
+%typemap(jboxtype) short, const short & "Short"
+%typemap(jboxtype) unsigned short, const unsigned short & "Integer"
+%typemap(jboxtype) int, const int & "Integer"
+%typemap(jboxtype) unsigned int, const unsigned int & "Long"
+%typemap(jboxtype) long, const long & "Integer"
+%typemap(jboxtype) unsigned long, const unsigned long & "Long"
+%typemap(jboxtype) long long, const long long & "Long"
+%typemap(jboxtype) unsigned long long, const unsigned long long & "java.math.BigInteger"
+%typemap(jboxtype) float, const float & "Float"
+%typemap(jboxtype) double, const double & "Double"
+
%typemap(jni) char *, char *&, char[ANY], char[] "jstring"
%typemap(jtype) char *, char *&, char[ANY], char[] "String"
%typemap(jstype) char *, char *&, char[ANY], char[] "String"
@@ -137,7 +160,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(jtype) jfloat "float"
%typemap(jtype) jdouble "double"
%typemap(jtype) jstring "String"
-%typemap(jtype) jobject "Object"
+%typemap(jtype) jobject "java.lang.Object"
%typemap(jtype) jbooleanArray "boolean[]"
%typemap(jtype) jcharArray "char[]"
%typemap(jtype) jbyteArray "byte[]"
@@ -146,7 +169,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(jtype) jlongArray "long[]"
%typemap(jtype) jfloatArray "float[]"
%typemap(jtype) jdoubleArray "double[]"
-%typemap(jtype) jobjectArray "Object[]"
+%typemap(jtype) jobjectArray "java.lang.Object[]"
%typemap(jstype) jboolean "boolean"
%typemap(jstype) jchar "char"
@@ -157,7 +180,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(jstype) jfloat "float"
%typemap(jstype) jdouble "double"
%typemap(jstype) jstring "String"
-%typemap(jstype) jobject "Object"
+%typemap(jstype) jobject "java.lang.Object"
%typemap(jstype) jbooleanArray "boolean[]"
%typemap(jstype) jcharArray "char[]"
%typemap(jstype) jbyteArray "byte[]"
@@ -166,12 +189,13 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(jstype) jlongArray "long[]"
%typemap(jstype) jfloatArray "float[]"
%typemap(jstype) jdoubleArray "double[]"
-%typemap(jstype) jobjectArray "Object[]"
+%typemap(jstype) jobjectArray "java.lang.Object[]"
/* Non primitive types */
%typemap(jni) SWIGTYPE "jlong"
%typemap(jtype) SWIGTYPE "long"
%typemap(jstype) SWIGTYPE "$&javaclassname"
+%typemap(jboxtype) SWIGTYPE "$typemap(jstype, $1_type)"
%typemap(jni) SWIGTYPE [] "jlong"
%typemap(jtype) SWIGTYPE [] "long"
@@ -1027,6 +1051,14 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
%{ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1);
return $null; %}
+/* For methods to raise/throw the original Java exception thrown in a director method */
+%typemap(throws) Swig::DirectorException
+%{ $1.throwException(jenv);
+ return $null; %}
+
+/* Java to C++ DirectorException should already be handled. Suppress warning and do nothing in the
+ event a user specifies a global: %catches(Swig::DirectorException); */
+%typemap(directorthrows) Swig::DirectorException ""
/* Typemaps for code generation in proxy classes and Java type wrapper classes */
@@ -1149,6 +1181,14 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
$1 = ($1_ltype)&temp; %}
%typemap(out) SWIGTYPE *const&
%{ *($1_ltype)&$result = *$1; %}
+%typemap(directorin,descriptor="L$packagepath/$*javaclassname;") SWIGTYPE *const&
+%{ *(($1_ltype)&$input) = ($*1_ltype) $1; %}
+%typemap(directorout, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) SWIGTYPE *const&
+%{ static $*1_ltype swig_temp;
+ swig_temp = *($1_ltype)&$input;
+ $result = &swig_temp; %}
+%typemap(javadirectorin) SWIGTYPE *const& "($jniinput == 0) ? null : new $*javaclassname($jniinput, false)"
+%typemap(javadirectorout) SWIGTYPE *const& "$*javaclassname.getCPtr($javacall)"
/* Typemaps used for the generation of proxy and type wrapper class code */
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
@@ -1233,6 +1273,7 @@ SWIG_JAVABODY_PROXY(protected, protected, SWIGTYPE)
SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE)
%typemap(javafinalize) SWIGTYPE %{
+ @SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
@@ -1260,7 +1301,7 @@ SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE)
*/
%define SWIG_PROXY_CONSTRUCTOR(OWNERSHIP, WEAKREF, TYPENAME...)
-%typemap(javaconstruct,directorconnect="\n $imclassname.$javaclazznamedirector_connect(this, swigCPtr, swigCMemOwn, WEAKREF);") TYPENAME {
+%typemap(javaconstruct,directorconnect="\n $imclassname.$javaclazznamedirector_connect(this, swigCPtr, OWNERSHIP, WEAKREF);") TYPENAME {
this($imcall, OWNERSHIP);$directorconnect
}
%enddef
@@ -1272,7 +1313,7 @@ SWIG_PROXY_CONSTRUCTOR(true, false, TYPENAME)
// Set the default for SWIGTYPE: Java owns the C/C++ object.
SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
-%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized") SWIGTYPE {
+%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized", parameters="") SWIGTYPE {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
@@ -1282,7 +1323,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
}
}
-%typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized") SWIGTYPE {
+%typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized", parameters="") SWIGTYPE {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
@@ -1338,14 +1379,16 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
/* String & length */
-%typemap(jni) (char *STRING, size_t LENGTH) "jbyteArray"
-%typemap(jtype) (char *STRING, size_t LENGTH) "byte[]"
-%typemap(jstype) (char *STRING, size_t LENGTH) "byte[]"
-%typemap(javain) (char *STRING, size_t LENGTH) "$javainput"
-%typemap(freearg) (char *STRING, size_t LENGTH) ""
-%typemap(in) (char *STRING, size_t LENGTH) {
+%typemap(jni) (const char *STRING, size_t LENGTH) "jbyteArray"
+%typemap(jtype) (const char *STRING, size_t LENGTH) "byte[]"
+%typemap(jstype) (const char *STRING, size_t LENGTH) "byte[]"
+%typemap(javain) (const char *STRING, size_t LENGTH) "$javainput"
+%typemap(freearg) (const char *STRING, size_t LENGTH) ""
+%typemap(in) (const char *STRING, size_t LENGTH) {
if ($input) {
$1 = ($1_ltype) JCALL2(GetByteArrayElements, jenv, $input, 0);
$2 = ($2_type) JCALL1(GetArrayLength, jenv, $input);
@@ -1354,10 +1397,10 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
$2 = 0;
}
}
-%typemap(argout) (char *STRING, size_t LENGTH) {
- if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
+%typemap(argout) (const char *STRING, size_t LENGTH) {
+ if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, JNI_ABORT);
}
-%typemap(directorin, descriptor="[B", noblock=1) (char *STRING, size_t LENGTH) {
+%typemap(directorin, descriptor="[B", noblock=1) (const char *STRING, size_t LENGTH) {
$input = 0;
if ($1) {
$input = JCALL1(NewByteArray, jenv, (jsize)$2);
@@ -1366,9 +1409,14 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
}
Swig::LocalRefGuard $1_refguard(jenv, $input);
}
+%typemap(javadirectorin, descriptor="[B") (const char *STRING, size_t LENGTH) "$jniinput"
+%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) }
+/* Enable write-back for non-const version */
+%typemap(argout) (char *STRING, size_t LENGTH) {
+ if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
+}
%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/Lib/java/javahead.swg b/Lib/java/javahead.swg
index 685bba198..2e10254f3 100644
--- a/Lib/java/javahead.swg
+++ b/Lib/java/javahead.swg
@@ -5,7 +5,7 @@
* ----------------------------------------------------------------------------- */
-/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so
+/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so
* that the same typemaps can be used for generating code for both C and C++. The SWIG preprocessor can expand
* the macros thereby generating the correct calling convention. It is thus essential that all typemaps that
* use the macros are not within %{ %} brackets as they won't be run through the SWIG preprocessor. */
@@ -50,15 +50,16 @@
%insert(runtime) %{
/* Support for throwing Java exceptions */
typedef enum {
- SWIG_JavaOutOfMemoryError = 1,
- SWIG_JavaIOException,
- SWIG_JavaRuntimeException,
+ SWIG_JavaOutOfMemoryError = 1,
+ SWIG_JavaIOException,
+ SWIG_JavaRuntimeException,
SWIG_JavaIndexOutOfBoundsException,
SWIG_JavaArithmeticException,
SWIG_JavaIllegalArgumentException,
SWIG_JavaNullPointerException,
SWIG_JavaDirectorPureVirtual,
- SWIG_JavaUnknownError
+ SWIG_JavaUnknownError,
+ SWIG_JavaIllegalStateException,
} SWIG_JavaExceptionCodes;
typedef struct {
@@ -80,6 +81,7 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC
{ SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
{ SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
{ SWIG_JavaUnknownError, "java/lang/UnknownError" },
+ { SWIG_JavaIllegalStateException, "java/lang/IllegalStateException" },
{ (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" }
};
const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
diff --git a/Lib/java/std_array.i b/Lib/java/std_array.i
index cbacfe673..d3436cc66 100644
--- a/Lib/java/std_array.i
+++ b/Lib/java/std_array.i
@@ -8,15 +8,17 @@ 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;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
array();
array(const array& other);
+
size_type size() const;
%rename(isEmpty) empty;
bool empty() const;
diff --git a/Lib/java/std_list.i b/Lib/java/std_list.i
new file mode 100644
index 000000000..1077bd0a0
--- /dev/null
+++ b/Lib/java/std_list.i
@@ -0,0 +1,225 @@
+/* -----------------------------------------------------------------------------
+ * std_list.i
+ *
+ * SWIG typemaps for std::list.
+ * The Java proxy class extends java.util.AbstractSequentialList. The std::list
+ * container looks and feels much like a java.util.LinkedList from Java.
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+%{
+#include <list>
+#include <stdexcept>
+%}
+
+%fragment("SWIG_ListSize", "header", fragment="SWIG_JavaIntFromSize_t") {
+SWIGINTERN jint SWIG_ListSize(size_t size) {
+ jint sz = SWIG_JavaIntFromSize_t(size);
+ if (sz == -1)
+ throw std::out_of_range("list size is too large to fit into a Java int");
+ return sz;
+}
+}
+
+%javamethodmodifiers std::list::begin "private";
+%javamethodmodifiers std::list::insert "private";
+%javamethodmodifiers std::list::doSize "private";
+%javamethodmodifiers std::list::doPreviousIndex "private";
+%javamethodmodifiers std::list::doNextIndex "private";
+%javamethodmodifiers std::list::doHasNext "private";
+
+// Match Java style better:
+%rename(Iterator) std::list::iterator;
+
+%nodefaultctor std::list::iterator;
+
+namespace std {
+ template <typename T> class list {
+
+%typemap(javabase) std::list<T> "java.util.AbstractSequentialList<$typemap(jboxtype, T)>"
+%proxycode %{
+ public $javaclassname(java.util.Collection c) {
+ this();
+ java.util.ListIterator<$typemap(jboxtype, T)> it = listIterator(0);
+ // Special case the "copy constructor" here to avoid lots of cross-language calls
+ for (java.lang.Object o : c) {
+ it.add(($typemap(jboxtype, T))o);
+ }
+ }
+
+ public int size() {
+ return doSize();
+ }
+
+ public boolean add($typemap(jboxtype, T) value) {
+ addLast(value);
+ return true;
+ }
+
+ public java.util.ListIterator<$typemap(jboxtype, T)> listIterator(int index) {
+ return new java.util.ListIterator<$typemap(jboxtype, T)>() {
+ private Iterator pos;
+ private Iterator last;
+
+ private java.util.ListIterator<$typemap(jboxtype, T)> init(int index) {
+ if (index < 0 || index > $javaclassname.this.size())
+ throw new IndexOutOfBoundsException("Index: " + index);
+ pos = $javaclassname.this.begin();
+ pos = pos.advance_unchecked(index);
+ return this;
+ }
+
+ public void add($typemap(jboxtype, T) v) {
+ // Technically we can invalidate last here, but this makes more sense
+ last = $javaclassname.this.insert(pos, v);
+ }
+
+ public void set($typemap(jboxtype, T) v) {
+ if (null == last) {
+ throw new IllegalStateException();
+ }
+ last.set_unchecked(v);
+ }
+
+ public void remove() {
+ if (null == last) {
+ throw new IllegalStateException();
+ }
+ $javaclassname.this.remove(last);
+ last = null;
+ }
+
+ public int previousIndex() {
+ return $javaclassname.this.doPreviousIndex(pos);
+ }
+
+ public int nextIndex() {
+ return $javaclassname.this.doNextIndex(pos);
+ }
+
+ public $typemap(jboxtype, T) previous() {
+ if (previousIndex() < 0) {
+ throw new java.util.NoSuchElementException();
+ }
+ last = pos;
+ pos = pos.previous_unchecked();
+ return last.deref_unchecked();
+ }
+
+ public $typemap(jboxtype, T) next() {
+ if (!hasNext()) {
+ throw new java.util.NoSuchElementException();
+ }
+ last = pos;
+ pos = pos.next_unchecked();
+ return last.deref_unchecked();
+ }
+
+ public boolean hasPrevious() {
+ // This call to previousIndex() will be much slower than the hasNext() implementation, but it's simpler like this with C++ forward iterators
+ return previousIndex() != -1;
+ }
+
+ public boolean hasNext() {
+ return $javaclassname.this.doHasNext(pos);
+ }
+ }.init(index);
+ }
+%}
+
+ 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;
+
+ /*
+ * We'd actually be better off having the nested class *not* be static in the wrapper
+ * output, but this doesn't actually remove the $static from the nested class still.
+ * (This would allow us to somewhat simplify the implementation of the ListIterator
+ * interface and give "natural" semantics to Java users of the C++ iterator)
+ */
+ //%typemap(javaclassmodifiers) iterator "public class"
+ //%typemap(javainterfaces) iterator "java.util.ListIterator<$typemap(jboxtype, T)>"
+
+ struct iterator {
+ %extend {
+ void set_unchecked(const T &v) {
+ **$self = v;
+ }
+
+ iterator next_unchecked() const {
+ std::list<T>::iterator ret = *$self;
+ ++ret;
+ return ret;
+ }
+
+ iterator previous_unchecked() const {
+ std::list<T>::iterator ret = *$self;
+ --ret;
+ return ret;
+ }
+
+ T deref_unchecked() const {
+ return **$self;
+ }
+
+ iterator advance_unchecked(size_type index) const {
+ std::list<T>::iterator ret = *$self;
+ std::advance(ret, index);
+ return ret;
+ }
+ }
+ };
+
+ list();
+ list(const list& other);
+
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ %rename(remove) erase;
+ iterator erase(iterator pos);
+ %rename(removeLast) pop_back;
+ void pop_back();
+ %rename(removeFirst) pop_front;
+ void pop_front();
+ %rename(addLast) push_back;
+ void push_back(const T &value);
+ %rename(addFirst) push_front;
+ void push_front(const T &value);
+ iterator begin();
+ iterator end();
+ iterator insert(iterator pos, const T &value);
+
+ %extend {
+ %fragment("SWIG_ListSize");
+
+ list(jint count, const T &value) throw (std::out_of_range) {
+ if (count < 0)
+ throw std::out_of_range("list count must be positive");
+ return new std::list<T>(static_cast<std::list<T>::size_type>(count), value);
+ }
+
+ jint doSize() const throw (std::out_of_range) {
+ return SWIG_ListSize(self->size());
+ }
+
+ jint doPreviousIndex(const iterator &pos) const throw (std::out_of_range) {
+ return pos == self->begin() ? -1 : SWIG_ListSize(std::distance(self->begin(), static_cast<std::list<T>::const_iterator>(pos)));
+ }
+
+ jint doNextIndex(const iterator &pos) const throw (std::out_of_range) {
+ return pos == self->end() ? SWIG_ListSize(self->size()) : SWIG_ListSize(std::distance(self->begin(), static_cast<std::list<T>::const_iterator>(pos)));
+ }
+
+ bool doHasNext(const iterator &pos) const {
+ return pos != $self->end();
+ }
+ }
+ };
+}
diff --git a/Lib/java/std_map.i b/Lib/java/std_map.i
index e7812f38a..6d5ca1aac 100644
--- a/Lib/java/std_map.i
+++ b/Lib/java/std_map.i
@@ -2,6 +2,8 @@
* std_map.i
*
* SWIG typemaps for std::map
+ * The Java proxy class extends java.util.AbstractMap. The std::map
+ * container looks and feels much like a java.util.HashMap from Java.
* ----------------------------------------------------------------------------- */
%include <std_common.i>
@@ -12,52 +14,200 @@
%{
#include <map>
-#include <algorithm>
#include <stdexcept>
%}
-// exported class
+%fragment("SWIG_MapSize", "header", fragment="SWIG_JavaIntFromSize_t") {
+ SWIGINTERN jint SWIG_MapSize(size_t size) {
+ jint sz = SWIG_JavaIntFromSize_t(size);
+ if (sz == -1) {
+ throw std::out_of_range("map size is too large to fit into a Java int");
+ }
+
+ return sz;
+ }
+}
+
+%javamethodmodifiers std::map::sizeImpl "private";
+%javamethodmodifiers std::map::containsImpl "private";
+%javamethodmodifiers std::map::putUnchecked "private";
+%javamethodmodifiers std::map::removeUnchecked "private";
+%javamethodmodifiers std::map::find "private";
+%javamethodmodifiers std::map::begin "private";
+%javamethodmodifiers std::map::end "private";
+
+%rename(Iterator) std::map::iterator;
+%nodefaultctor std::map::iterator;
+%javamethodmodifiers std::map::iterator::getNextUnchecked "private";
+%javamethodmodifiers std::map::iterator::isNot "private";
+%javamethodmodifiers std::map::iterator::getKey "private";
+%javamethodmodifiers std::map::iterator::getValue "private";
+%javamethodmodifiers std::map::iterator::setValue "private";
namespace std {
- 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> &);
-
- unsigned int size() const;
- bool empty() const;
- void clear();
- %extend {
- const T& get(const K& key) throw (std::out_of_range) {
- std::map<K,T >::iterator i = self->find(key);
- if (i != self->end())
- return i->second;
- else
- throw std::out_of_range("key not found");
- }
- void set(const K& key, const T& x) {
- (*self)[key] = x;
- }
- void del(const K& key) throw (std::out_of_range) {
- 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);
- return i != self->end();
- }
+template<class K, class T, class C = std::less< K> > class map {
+
+%typemap(javabase) std::map< K, T, C >
+ "java.util.AbstractMap<$typemap(jboxtype, K), $typemap(jboxtype, T)>"
+
+%proxycode %{
+
+ public int size() {
+ return sizeImpl();
+ }
+
+ public boolean containsKey(java.lang.Object key) {
+ if (!(key instanceof $typemap(jboxtype, K))) {
+ return false;
+ }
+
+ return containsImpl(($typemap(jboxtype, K))key);
+ }
+
+ public $typemap(jboxtype, T) get(java.lang.Object key) {
+ if (!(key instanceof $typemap(jboxtype, K))) {
+ return null;
+ }
+
+ Iterator itr = find(($typemap(jboxtype, K)) key);
+ if (itr.isNot(end())) {
+ return itr.getValue();
+ }
+
+ return null;
+ }
+
+ public $typemap(jboxtype, T) put($typemap(jboxtype, K) key, $typemap(jboxtype, T) value) {
+ Iterator itr = find(($typemap(jboxtype, K)) key);
+ if (itr.isNot(end())) {
+ $typemap(jboxtype, T) oldValue = itr.getValue();
+ itr.setValue(value);
+ return oldValue;
+ } else {
+ putUnchecked(key, value);
+ return null;
+ }
+ }
+
+ public $typemap(jboxtype, T) remove(java.lang.Object key) {
+ if (!(key instanceof $typemap(jboxtype, K))) {
+ return null;
+ }
+
+ Iterator itr = find(($typemap(jboxtype, K)) key);
+ if (itr.isNot(end())) {
+ $typemap(jboxtype, T) oldValue = itr.getValue();
+ removeUnchecked(itr);
+ return oldValue;
+ } else {
+ return null;
+ }
+ }
+
+ public java.util.Set<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>> entrySet() {
+ java.util.Set<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>> setToReturn =
+ new java.util.HashSet<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>>();
+
+ Iterator itr = begin();
+ final Iterator end = end();
+ while (itr.isNot(end)) {
+ setToReturn.add(new Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>() {
+ private Iterator iterator;
+
+ private Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)> init(Iterator iterator) {
+ this.iterator = iterator;
+ return this;
+ }
+
+ public $typemap(jboxtype, K) getKey() {
+ return iterator.getKey();
+ }
+
+ public $typemap(jboxtype, T) getValue() {
+ return iterator.getValue();
}
+
+ public $typemap(jboxtype, T) setValue($typemap(jboxtype, T) newValue) {
+ $typemap(jboxtype, T) oldValue = iterator.getValue();
+ iterator.setValue(newValue);
+ return oldValue;
+ }
+ }.init(itr));
+ itr = itr.getNextUnchecked();
+ }
+
+ return setToReturn;
+ }
+%}
+
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ map();
+ map(const map& other);
+
+ struct iterator {
+ %typemap(javaclassmodifiers) iterator "protected class"
+ %extend {
+ std::map< K, T, C >::iterator getNextUnchecked() {
+ std::map< K, T, C >::iterator copy = (*$self);
+ return ++copy;
+ }
+
+ bool isNot(iterator other) const {
+ return (*$self != other);
+ }
+
+ K getKey() const {
+ return (*$self)->first;
+ }
+
+ T getValue() const {
+ return (*$self)->second;
+ }
+
+ void setValue(const T& newValue) {
+ (*$self)->second = newValue;
+ }
+ }
};
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ iterator find(const K& key);
+ iterator begin();
+ iterator end();
+ %extend {
+ %fragment("SWIG_MapSize");
+
+ jint sizeImpl() const throw (std::out_of_range) {
+ return SWIG_MapSize(self->size());
+ }
+
+ bool containsImpl(const K& key) {
+ return (self->count(key) > 0);
+ }
+
+ void putUnchecked(const K& key, const T& value) {
+ (*self)[key] = value;
+ }
+
+ void removeUnchecked(const std::map< K, T, C >::iterator itr) {
+ self->erase(itr);
+ }
+ }
+};
+
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
diff --git a/Lib/java/std_pair.i b/Lib/java/std_pair.i
index fe45ee676..75ad30315 100644
--- a/Lib/java/std_pair.i
+++ b/Lib/java/std_pair.i
@@ -18,12 +18,15 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
+
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/java/std_set.i b/Lib/java/std_set.i
new file mode 100644
index 000000000..73e0c2cf9
--- /dev/null
+++ b/Lib/java/std_set.i
@@ -0,0 +1,203 @@
+/* -----------------------------------------------------------------------------
+ * std_set.i
+ *
+ * SWIG typemaps for std::set
+ * The Java proxy class extends java.util.AbstractSet. The std::set
+ * container looks and feels much like a java.util.HashSet from Java.
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::set
+// ------------------------------------------------------------------------
+
+%{
+#include <set>
+#include <stdexcept>
+%}
+
+%fragment("SWIG_SetSize", "header", fragment="SWIG_JavaIntFromSize_t") {
+ SWIGINTERN jint SWIG_SetSize(size_t size) {
+ jint sz = SWIG_JavaIntFromSize_t(size);
+ if (sz == -1) {
+ throw std::out_of_range("set size is too large to fit into a Java int");
+ }
+
+ return sz;
+ }
+}
+
+%javamethodmodifiers std::set::sizeImpl "private";
+%javamethodmodifiers std::set::containsImpl "private";
+%javamethodmodifiers std::set::removeImpl "private";
+%javamethodmodifiers std::set::hasNextImpl "private";
+%javamethodmodifiers std::set::begin "private";
+%javamethodmodifiers std::set::end "private";
+
+%rename(Iterator) std::set::iterator;
+%nodefaultctor std::set::iterator;
+%javamethodmodifiers std::set::iterator::incrementUnchecked "private";
+%javamethodmodifiers std::set::iterator::derefUnchecked "private";
+%javamethodmodifiers std::set::iterator::isNot "private";
+
+namespace std {
+
+template <class T>
+class set {
+
+%typemap(javabase) std::set<T> "java.util.AbstractSet<$typemap(jboxtype, T)>"
+%proxycode %{
+ public $javaclassname(java.util.Collection<? extends $typemap(jboxtype, T)> collection) {
+ this();
+ addAll(collection);
+ }
+
+ public int size() {
+ return sizeImpl();
+ }
+
+ public boolean add($typemap(jboxtype, T) key) {
+ return addImpl(key);
+ }
+
+ public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, T)> collection) {
+ boolean didAddElement = false;
+ for (java.lang.Object object : collection) {
+ didAddElement |= add(($typemap(jboxtype, T))object);
+ }
+
+ return didAddElement;
+ }
+
+ public java.util.Iterator<$typemap(jboxtype, T)> iterator() {
+ return new java.util.Iterator<$typemap(jboxtype, T)>() {
+ private Iterator curr;
+ private Iterator end;
+
+ private java.util.Iterator<$typemap(jboxtype, T)> init() {
+ curr = $javaclassname.this.begin();
+ end = $javaclassname.this.end();
+ return this;
+ }
+
+ public $typemap(jboxtype, T) next() {
+ if (!hasNext()) {
+ throw new java.util.NoSuchElementException();
+ }
+
+ // Save the current position, increment it,
+ // then return the value at the position before the increment.
+ final $typemap(jboxtype, T) currValue = curr.derefUnchecked();
+ curr.incrementUnchecked();
+ return currValue;
+ }
+
+ public boolean hasNext() {
+ return curr.isNot(end);
+ }
+ }.init();
+ }
+
+ public boolean containsAll(java.util.Collection<?> collection) {
+ for (java.lang.Object object : collection) {
+ if (!contains(object)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public boolean contains(java.lang.Object object) {
+ if (!(object instanceof $typemap(jboxtype, T))) {
+ return false;
+ }
+
+ return containsImpl(($typemap(jboxtype, T))object);
+ }
+
+ public boolean removeAll(java.util.Collection<?> collection) {
+ boolean didRemoveElement = false;
+ for (java.lang.Object object : collection) {
+ didRemoveElement |= remove(object);
+ }
+
+ return didRemoveElement;
+ }
+
+ public boolean remove(java.lang.Object object) {
+ if (!(object instanceof $typemap(jboxtype, T))) {
+ return false;
+ }
+
+ return removeImpl(($typemap(jboxtype, T))object);
+ }
+%}
+
+ public:
+
+ struct iterator {
+ %typemap(javaclassmodifiers) iterator "protected class"
+ %extend {
+ void incrementUnchecked() {
+ ++(*$self);
+ }
+
+ T derefUnchecked() const {
+ return **$self;
+ }
+
+ bool isNot(iterator other) const {
+ return (*$self != other);
+ }
+ }
+ };
+
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T key_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;
+
+ set();
+ set(const set& other);
+
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ iterator begin();
+ iterator end();
+
+ %extend {
+ %fragment("SWIG_SetSize");
+
+ // Returns whether item was inserted.
+ bool addImpl(const T& key) {
+ return self->insert(key).second;
+ }
+
+ // Returns whether set contains key.
+ bool containsImpl(const T& key) {
+ return (self->count(key) > 0);
+ }
+
+ // Returns whether the item was erased.
+ bool removeImpl(const T& key) {
+ return (self->erase(key) > 0);
+ }
+
+ jint sizeImpl() const throw (std::out_of_range) {
+ return SWIG_SetSize(self->size());
+ }
+
+ bool hasNextImpl(const iterator& itr) const {
+ return (itr != $self->end());
+ }
+ }
+};
+
+}
diff --git a/Lib/java/std_unordered_map.i b/Lib/java/std_unordered_map.i
new file mode 100644
index 000000000..283a9b464
--- /dev/null
+++ b/Lib/java/std_unordered_map.i
@@ -0,0 +1,211 @@
+/* -----------------------------------------------------------------------------
+ * std_unordered_map.i
+ *
+ * SWIG typemaps for std::unordered_map
+ * The Java proxy class extends java.util.AbstractMap. The std::unordered_map
+ * container looks and feels much like a java.util.HashMap from Java.
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::unordered_map
+// ------------------------------------------------------------------------
+
+%{
+#include <unordered_map>
+#include <stdexcept>
+%}
+
+%fragment("SWIG_MapSize", "header", fragment="SWIG_JavaIntFromSize_t") {
+ SWIGINTERN jint SWIG_MapSize(size_t size) {
+ jint sz = SWIG_JavaIntFromSize_t(size);
+ if (sz == -1) {
+ throw std::out_of_range("map size is too large to fit into a Java int");
+ }
+
+ return sz;
+ }
+}
+
+%javamethodmodifiers std::unordered_map::sizeImpl "private";
+%javamethodmodifiers std::unordered_map::containsImpl "private";
+%javamethodmodifiers std::unordered_map::putUnchecked "private";
+%javamethodmodifiers std::unordered_map::removeUnchecked "private";
+%javamethodmodifiers std::unordered_map::find "private";
+%javamethodmodifiers std::unordered_map::begin "private";
+%javamethodmodifiers std::unordered_map::end "private";
+
+%rename(Iterator) std::unordered_map::iterator;
+%nodefaultctor std::unordered_map::iterator;
+%javamethodmodifiers std::unordered_map::iterator::getNextUnchecked "private";
+%javamethodmodifiers std::unordered_map::iterator::isNot "private";
+%javamethodmodifiers std::unordered_map::iterator::getKey "private";
+%javamethodmodifiers std::unordered_map::iterator::getValue "private";
+%javamethodmodifiers std::unordered_map::iterator::setValue "private";
+
+namespace std {
+
+template<class K, class T> class unordered_map {
+
+%typemap(javabase) std::unordered_map<K, T>
+ "java.util.AbstractMap<$typemap(jboxtype, K), $typemap(jboxtype, T)>"
+
+%proxycode %{
+
+ public int size() {
+ return sizeImpl();
+ }
+
+ public boolean containsKey(java.lang.Object key) {
+ if (!(key instanceof $typemap(jboxtype, K))) {
+ return false;
+ }
+
+ return containsImpl(($typemap(jboxtype, K))key);
+ }
+
+ public $typemap(jboxtype, T) get(java.lang.Object key) {
+ if (!(key instanceof $typemap(jboxtype, K))) {
+ return null;
+ }
+
+ Iterator itr = find(($typemap(jboxtype, K)) key);
+ if (itr.isNot(end())) {
+ return itr.getValue();
+ }
+
+ return null;
+ }
+
+ public $typemap(jboxtype, T) put($typemap(jboxtype, K) key, $typemap(jboxtype, T) value) {
+ Iterator itr = find(($typemap(jboxtype, K)) key);
+ if (itr.isNot(end())) {
+ $typemap(jboxtype, T) oldValue = itr.getValue();
+ itr.setValue(value);
+ return oldValue;
+ } else {
+ putUnchecked(key, value);
+ return null;
+ }
+ }
+
+ public $typemap(jboxtype, T) remove(java.lang.Object key) {
+ if (!(key instanceof $typemap(jboxtype, K))) {
+ return null;
+ }
+
+ Iterator itr = find(($typemap(jboxtype, K)) key);
+ if (itr.isNot(end())) {
+ $typemap(jboxtype, T) oldValue = itr.getValue();
+ removeUnchecked(itr);
+ return oldValue;
+ } else {
+ return null;
+ }
+ }
+
+ public java.util.Set<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>> entrySet() {
+ java.util.Set<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>> setToReturn =
+ new java.util.HashSet<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>>();
+
+ Iterator itr = begin();
+ final Iterator end = end();
+ while (itr.isNot(end)) {
+ setToReturn.add(new Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>() {
+ private Iterator iterator;
+
+ private Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)> init(Iterator iterator) {
+ this.iterator = iterator;
+ return this;
+ }
+
+ public $typemap(jboxtype, K) getKey() {
+ return iterator.getKey();
+ }
+
+ public $typemap(jboxtype, T) getValue() {
+ return iterator.getValue();
+ }
+
+ public $typemap(jboxtype, T) setValue($typemap(jboxtype, T) newValue) {
+ $typemap(jboxtype, T) oldValue = iterator.getValue();
+ iterator.setValue(newValue);
+ return oldValue;
+ }
+ }.init(itr));
+ itr = itr.getNextUnchecked();
+ }
+
+ return setToReturn;
+ }
+%}
+
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ unordered_map();
+ unordered_map(const unordered_map& other);
+
+ struct iterator {
+ %typemap(javaclassmodifiers) iterator "protected class"
+ %extend {
+ std::unordered_map< K, T >::iterator getNextUnchecked() {
+ std::unordered_map< K, T >::iterator copy = (*$self);
+ return ++copy;
+ }
+
+ bool isNot(iterator other) const {
+ return (*$self != other);
+ }
+
+ K getKey() const {
+ return (*$self)->first;
+ }
+
+ T getValue() const {
+ return (*$self)->second;
+ }
+
+ void setValue(const T& newValue) {
+ (*$self)->second = newValue;
+ }
+ }
+ };
+
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ iterator find(const K& key);
+ iterator begin();
+ iterator end();
+ %extend {
+ %fragment("SWIG_MapSize");
+
+ jint sizeImpl() const throw (std::out_of_range) {
+ return SWIG_MapSize(self->size());
+ }
+
+ bool containsImpl(const K& key) {
+ return (self->count(key) > 0);
+ }
+
+ void putUnchecked(const K& key, const T& value) {
+ (*self)[key] = value;
+ }
+
+ void removeUnchecked(const std::unordered_map< K, T >::iterator itr) {
+ self->erase(itr);
+ }
+ }
+};
+
+}
diff --git a/Lib/java/std_unordered_set.i b/Lib/java/std_unordered_set.i
new file mode 100644
index 000000000..59726e94d
--- /dev/null
+++ b/Lib/java/std_unordered_set.i
@@ -0,0 +1,199 @@
+/* -----------------------------------------------------------------------------
+ * std_unordered_set.i
+ *
+ * SWIG typemaps for std::unordered_set
+ * The Java proxy class extends java.util.AbstractSet. The std::unordered_set
+ * container looks and feels much like a java.util.HashSet from Java.
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::unordered_set
+// ------------------------------------------------------------------------
+
+%{
+#include <unordered_set>
+#include <stdexcept>
+%}
+
+%fragment("SWIG_UnorderedSetSize", "header", fragment="SWIG_JavaIntFromSize_t") {
+ SWIGINTERN jint SWIG_UnorderedSetSize(size_t size) {
+ jint sz = SWIG_JavaIntFromSize_t(size);
+ if (sz == -1) {
+ throw std::out_of_range("unordered_set size is too large to fit into a Java int");
+ }
+
+ return sz;
+ }
+}
+
+%javamethodmodifiers std::unordered_set::sizeImpl "private";
+%javamethodmodifiers std::unordered_set::containsImpl "private";
+%javamethodmodifiers std::unordered_set::removeImpl "private";
+%javamethodmodifiers std::unordered_set::hasNextImpl "private";
+%javamethodmodifiers std::unordered_set::begin "private";
+%javamethodmodifiers std::unordered_set::end "private";
+
+%rename(Iterator) std::unordered_set::iterator;
+%nodefaultctor std::unordered_set::iterator;
+%javamethodmodifiers std::unordered_set::iterator::incrementUnchecked "private";
+%javamethodmodifiers std::unordered_set::iterator::derefUnchecked "private";
+%javamethodmodifiers std::unordered_set::iterator::isNot "private";
+
+namespace std {
+
+template <class Key>
+class unordered_set {
+
+%typemap(javabase) std::unordered_set<Key> "java.util.AbstractSet<$typemap(jboxtype, Key)>"
+%proxycode %{
+ public $javaclassname(java.util.Collection<? extends $typemap(jboxtype, Key)> collection) {
+ this();
+ addAll(collection);
+ }
+
+ public int size() {
+ return sizeImpl();
+ }
+
+ public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, Key)> collection) {
+ boolean didAddElement = false;
+ for (java.lang.Object object : collection) {
+ didAddElement |= add(($typemap(jboxtype, Key))object);
+ }
+
+ return didAddElement;
+ }
+
+ public java.util.Iterator<$typemap(jboxtype, Key)> iterator() {
+ return new java.util.Iterator<$typemap(jboxtype, Key)>() {
+ private Iterator curr;
+ private Iterator end;
+
+ private java.util.Iterator<$typemap(jboxtype, Key)> init() {
+ curr = $javaclassname.this.begin();
+ end = $javaclassname.this.end();
+ return this;
+ }
+
+ public $typemap(jboxtype, Key) next() {
+ if (!hasNext()) {
+ throw new java.util.NoSuchElementException();
+ }
+
+ // Save the current position, increment it,
+ // then return the value at the position before the increment.
+ final $typemap(jboxtype, Key) currValue = curr.derefUnchecked();
+ curr.incrementUnchecked();
+ return currValue;
+ }
+
+ public boolean hasNext() {
+ return curr.isNot(end);
+ }
+ }.init();
+ }
+
+ public boolean containsAll(java.util.Collection<?> collection) {
+ for (java.lang.Object object : collection) {
+ if (!contains(object)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public boolean contains(java.lang.Object object) {
+ if (!(object instanceof $typemap(jboxtype, Key))) {
+ return false;
+ }
+
+ return containsImpl(($typemap(jboxtype, Key))object);
+ }
+
+ public boolean removeAll(java.util.Collection<?> collection) {
+ boolean didRemoveElement = false;
+ for (java.lang.Object object : collection) {
+ didRemoveElement |= remove(object);
+ }
+
+ return didRemoveElement;
+ }
+
+ public boolean remove(java.lang.Object object) {
+ if (!(object instanceof $typemap(jboxtype, Key))) {
+ return false;
+ }
+
+ return removeImpl(($typemap(jboxtype, Key))object);
+ }
+%}
+
+ public:
+
+ struct iterator {
+ %typemap(javaclassmodifiers) iterator "protected class"
+ %extend {
+ void incrementUnchecked() {
+ ++(*$self);
+ }
+
+ Key derefUnchecked() const {
+ return **$self;
+ }
+
+ bool isNot(iterator other) const {
+ return (*$self != other);
+ }
+ }
+ };
+
+ 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;
+
+ unordered_set();
+ unordered_set(const unordered_set& other);
+
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ iterator begin();
+ iterator end();
+
+ %extend {
+ %fragment("SWIG_UnorderedSetSize");
+
+ // Returns whether item was inserted.
+ bool add(const Key& key) {
+ return self->insert(key).second;
+ }
+
+ // Returns whether set contains key.
+ bool containsImpl(const Key& key) {
+ return (self->count(key) > 0);
+ }
+
+ // Returns whether the item was erased.
+ bool removeImpl(const Key& key) {
+ return (self->erase(key) > 0);
+ }
+
+ jint sizeImpl() const throw (std::out_of_range) {
+ return SWIG_UnorderedSetSize(self->size());
+ }
+
+ bool hasNextImpl(const iterator& itr) const {
+ return (itr != $self->end());
+ }
+ }
+};
+
+}
diff --git a/Lib/java/std_vector.i b/Lib/java/std_vector.i
index 971b426a1..60ee23ebb 100644
--- a/Lib/java/std_vector.i
+++ b/Lib/java/std_vector.i
@@ -1,5 +1,10 @@
/* -----------------------------------------------------------------------------
* std_vector.i
+ *
+ * SWIG typemaps for std::vector.
+ * The Java proxy class extends java.util.AbstractList and implements
+ * java.util.RandomAccess. The std::vector container looks and feels much like a
+ * java.util.ArrayList from Java.
* ----------------------------------------------------------------------------- */
%include <std_common.i>
@@ -9,77 +14,172 @@
#include <stdexcept>
%}
+%fragment("SWIG_VectorSize", "header", fragment="SWIG_JavaIntFromSize_t") {
+SWIGINTERN jint SWIG_VectorSize(size_t size) {
+ jint sz = SWIG_JavaIntFromSize_t(size);
+ if (sz == -1)
+ throw std::out_of_range("vector size is too large to fit into a Java int");
+ return sz;
+}
+}
+
+%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CTYPE, CONST_REFERENCE)
+%typemap(javabase) std::vector< CTYPE > "java.util.AbstractList<$typemap(jboxtype, CTYPE)>"
+%typemap(javainterfaces) std::vector< CTYPE > "java.util.RandomAccess"
+%proxycode %{
+ public $javaclassname($typemap(jstype, CTYPE)[] initialElements) {
+ this();
+ reserve(initialElements.length);
+
+ for ($typemap(jstype, CTYPE) element : initialElements) {
+ add(element);
+ }
+ }
+
+ public $javaclassname(Iterable<$typemap(jboxtype, CTYPE)> initialElements) {
+ this();
+ for ($typemap(jstype, CTYPE) element : initialElements) {
+ add(element);
+ }
+ }
+
+ public $typemap(jboxtype, CTYPE) get(int index) {
+ return doGet(index);
+ }
+
+ public $typemap(jboxtype, CTYPE) set(int index, $typemap(jboxtype, CTYPE) e) {
+ return doSet(index, e);
+ }
+
+ public boolean add($typemap(jboxtype, CTYPE) e) {
+ modCount++;
+ doAdd(e);
+ return true;
+ }
+
+ public void add(int index, $typemap(jboxtype, CTYPE) e) {
+ modCount++;
+ doAdd(index, e);
+ }
+
+ public $typemap(jboxtype, CTYPE) remove(int index) {
+ modCount++;
+ return doRemove(index);
+ }
+
+ protected void removeRange(int fromIndex, int toIndex) {
+ modCount++;
+ doRemoveRange(fromIndex, toIndex);
+ }
+
+ public int size() {
+ return doSize();
+ }
+%}
+
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef CTYPE value_type;
+ typedef CTYPE *pointer;
+ typedef CTYPE const *const_pointer;
+ typedef CTYPE &reference;
+ typedef CONST_REFERENCE const_reference;
+
+ vector();
+ vector(const vector &other);
+
+ size_type capacity() const;
+ void reserve(size_type n) throw (std::length_error);
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ %extend {
+ %fragment("SWIG_VectorSize");
+
+ vector(jint count, const CTYPE &value) throw (std::out_of_range) {
+ if (count < 0)
+ throw std::out_of_range("vector count must be positive");
+ return new std::vector< CTYPE >(static_cast<std::vector< CTYPE >::size_type>(count), value);
+ }
+
+ jint doSize() const throw (std::out_of_range) {
+ return SWIG_VectorSize(self->size());
+ }
+
+ void doAdd(const value_type& x) {
+ self->push_back(x);
+ }
+
+ void doAdd(jint index, const value_type& x) throw (std::out_of_range) {
+ jint size = static_cast<jint>(self->size());
+ if (0 <= index && index <= size) {
+ self->insert(self->begin() + index, x);
+ } else {
+ throw std::out_of_range("vector index out of range");
+ }
+ }
+
+ value_type doRemove(jint index) throw (std::out_of_range) {
+ jint size = static_cast<jint>(self->size());
+ if (0 <= index && index < size) {
+ CTYPE const old_value = (*self)[index];
+ self->erase(self->begin() + index);
+ return old_value;
+ } else {
+ throw std::out_of_range("vector index out of range");
+ }
+ }
+
+ CONST_REFERENCE doGet(jint index) throw (std::out_of_range) {
+ jint size = static_cast<jint>(self->size());
+ if (index >= 0 && index < size)
+ return (*self)[index];
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+
+ value_type doSet(jint index, const value_type& val) throw (std::out_of_range) {
+ jint size = static_cast<jint>(self->size());
+ if (index >= 0 && index < size) {
+ CTYPE const old_value = (*self)[index];
+ (*self)[index] = val;
+ return old_value;
+ }
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+
+ void doRemoveRange(jint fromIndex, jint toIndex) throw (std::out_of_range) {
+ jint size = static_cast<jint>(self->size());
+ if (0 <= fromIndex && fromIndex <= toIndex && toIndex <= size) {
+ self->erase(self->begin() + fromIndex, self->begin() + toIndex);
+ } else {
+ throw std::out_of_range("vector index out of range");
+ }
+ }
+ }
+%enddef
+
+%javamethodmodifiers std::vector::doSize "private";
+%javamethodmodifiers std::vector::doAdd "private";
+%javamethodmodifiers std::vector::doGet "private";
+%javamethodmodifiers std::vector::doSet "private";
+%javamethodmodifiers std::vector::doRemove "private";
+%javamethodmodifiers std::vector::doRemoveRange "private";
+
namespace std {
-
+
template<class T> class vector {
- public:
- typedef size_t size_type;
- typedef T value_type;
- typedef const value_type& const_reference;
- vector();
- vector(size_type n);
- size_type size() const;
- size_type capacity() const;
- void reserve(size_type n);
- %rename(isEmpty) empty;
- bool empty() const;
- void clear();
- %rename(add) push_back;
- void push_back(const value_type& x);
- %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("vector 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("vector index out of range");
- }
- }
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(T, const value_type&)
};
// bool specialization
template<> class vector<bool> {
- public:
- typedef size_t size_type;
- typedef bool value_type;
- typedef bool const_reference;
- vector();
- vector(size_type n);
- size_type size() const;
- size_type capacity() const;
- void reserve(size_type n);
- %rename(isEmpty) empty;
- bool empty() const;
- void clear();
- %rename(add) push_back;
- void push_back(const value_type& x);
- %extend {
- bool 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("vector 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("vector index out of range");
- }
- }
+ SWIG_STD_VECTOR_MINIMUM_INTERNAL(bool, bool)
};
}
%define specialize_std_vector(T)
#warning "specialize_std_vector - specialization for type T no longer needed"
%enddef
-
diff --git a/Lib/java/typemaps.i b/Lib/java/typemaps.i
index 4170915b3..e130c1930 100644
--- a/Lib/java/typemaps.i
+++ b/Lib/java/typemaps.i
@@ -212,22 +212,32 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue);
}
-%typemap(directorin,descriptor=JNIDESC) TYPE &OUTPUT, TYPE *OUTPUT %{
+%typemap(directorin,descriptor=JNIDESC) TYPE &OUTPUT %{
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
+ if (!$input) return $null;
+ Swig::LocalRefGuard $1_refguard(jenv, $input); %}
+
+%typemap(directorin,descriptor=JNIDESC) TYPE *OUTPUT %{
+ if ($1) {
+ $input = JCALL1(New##JAVATYPE##Array, jenv, 1);
+ if (!$input) return $null;
+ }
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;
+ $result = ($*1_ltype)$1_jvalue;
}
%typemap(directorargout, noblock=1) TYPE *OUTPUT
{
- JNITYPE $1_jvalue;
- JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
- *$result = $1_jvalue;
+ if ($result) {
+ JNITYPE $1_jvalue;
+ JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
+ *$result = ($*1_ltype)$1_jvalue;
+ }
}
%typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE;
@@ -264,6 +274,23 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
$1 = &temp;
}
+%typemap(directorargout, noblock=1) bool &OUTPUT
+{
+ jboolean $1_jvalue;
+ JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
+ $result = $1_jvalue ? true : false;
+}
+
+%typemap(directorargout, noblock=1) bool *OUTPUT
+{
+ if ($result) {
+ jboolean $1_jvalue;
+ JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
+ *$result = $1_jvalue ? true : false;
+ }
+}
+
+
/* Convert to BigInteger - byte array holds number in 2's complement big endian format */
/* Use first element in BigInteger array for output */
/* Overrides the typemap in the OUTPUT_TYPEMAP macro */
@@ -373,26 +400,33 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
%typemap(directorin,descriptor=JNIDESC) TYPE &INOUT %{
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
+ if (!$input) return $null;
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);
+ if ($1) {
+ $input = JCALL1(New##JAVATYPE##Array, jenv, 1);
+ if (!$input) return $null;
+ 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;
+ $result = ($*1_ltype)$1_jvalue;
}
%typemap(directorargout, noblock=1) TYPE *INOUT
{
- JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
- *$result = $1_jvalue;
+ if ($result) {
+ JNITYPE $1_jvalue;
+ JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
+ *$result = ($*1_ltype)$1_jvalue;
+ }
}
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
@@ -436,6 +470,22 @@ INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
JCALL3(ReleaseBooleanArrayElements, jenv, $input , (jboolean *)jbtemp$argnum, 0);
}
+%typemap(directorargout, noblock=1) bool &INOUT
+{
+ JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
+ $result = $1_jvalue ? true : false;
+}
+
+%typemap(directorargout, noblock=1) bool *INOUT
+{
+ if ($result) {
+ jboolean $1_jvalue;
+ JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
+ *$result = $1_jvalue ? true : false;
+ }
+}
+
+
/* Override the typemap in the INOUT_TYPEMAP macro for unsigned long long */
%typemap(in) unsigned long long *INOUT ($*1_ltype temp), unsigned long long &INOUT ($*1_ltype temp) {
jobject bigint;
diff --git a/Lib/java/various.i b/Lib/java/various.i
index 76fb2b129..24796ba84 100644
--- a/Lib/java/various.i
+++ b/Lib/java/various.i
@@ -129,7 +129,7 @@
/*
* char *BYTE typemaps.
* These are input typemaps for mapping a Java byte[] array to a C char array.
- * Note that as a Java array is used and thus passeed by reference, the C routine
+ * Note that as a Java array is used and thus passed by reference, the C routine
* can return data to Java via the parameter.
*
* Example usage wrapping:
diff --git a/Lib/javascript/jsc/javascriptcode.swg b/Lib/javascript/jsc/javascriptcode.swg
index 4b21c98b2..4050a6ee3 100644
--- a/Lib/javascript/jsc/javascriptcode.swg
+++ b/Lib/javascript/jsc/javascriptcode.swg
@@ -388,7 +388,7 @@ static JSStaticFunction $jsmangledname_functions[] = {
* jsc_nspace_declaration: template for a namespace declaration
* - $jsnspace: mangled name of the namespace
* - $jsglobalvariables: list of variable entries
- * - $jsglobalfunctions: list if fuction entries
+ * - $jsglobalfunctions: list of function entries
* ----------------------------------------------------------------------------- */
%fragment ("jsc_nspace_declaration", "templates")
%{
diff --git a/Lib/javascript/jsc/javascriptrun.swg b/Lib/javascript/jsc/javascriptrun.swg
index 30ee032ed..4a8fc5be5 100644
--- a/Lib/javascript/jsc/javascriptrun.swg
+++ b/Lib/javascript/jsc/javascriptrun.swg
@@ -150,7 +150,7 @@ SWIGRUNTIME int SWIG_JSC_ConvertPtr(JSContextRef context, JSValueRef valRef, voi
/* special case: JavaScript null => C NULL pointer */
if(JSValueIsNull(context, valRef)) {
*ptr=0;
- return SWIG_OK;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
if(!JSValueIsObject(context, valRef)) {
diff --git a/Lib/javascript/jsc/std_complex.i b/Lib/javascript/jsc/std_complex.i
index 088a4fe7b..a252e0aa8 100644
--- a/Lib/javascript/jsc/std_complex.i
+++ b/Lib/javascript/jsc/std_complex.i
@@ -8,6 +8,13 @@
#include <complex>
%}
+namespace std {
+ %naturalvar complex;
+ template<typename T> class complex;
+ %template() complex<double>;
+ %template() complex<float>;
+}
+
/* defining the complex as/from converters */
%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
diff --git a/Lib/javascript/jsc/std_map.i b/Lib/javascript/jsc/std_map.i
index e7812f38a..9fa10880f 100644
--- a/Lib/javascript/jsc/std_map.i
+++ b/Lib/javascript/jsc/std_map.i
@@ -20,22 +20,29 @@
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
bool empty() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -45,14 +52,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
}
diff --git a/Lib/javascript/jsc/std_pair.i b/Lib/javascript/jsc/std_pair.i
index fe45ee676..732347db5 100644
--- a/Lib/javascript/jsc/std_pair.i
+++ b/Lib/javascript/jsc/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/javascript/jsc/std_vector.i b/Lib/javascript/jsc/std_vector.i
index 971b426a1..586ac5c60 100644
--- a/Lib/javascript/jsc/std_vector.i
+++ b/Lib/javascript/jsc/std_vector.i
@@ -14,10 +14,17 @@ namespace std {
template<class T> class vector {
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;
+
vector();
vector(size_type n);
+ vector(const vector& other);
+
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
@@ -48,10 +55,17 @@ namespace std {
template<> class vector<bool> {
public:
typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
typedef bool value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
typedef bool const_reference;
+
vector();
vector(size_type n);
+ vector(const vector& other);
+
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
index fb7d55c2a..c4aaf3db0 100644
--- a/Lib/javascript/v8/javascriptcode.swg
+++ b/Lib/javascript/v8/javascriptcode.swg
@@ -133,10 +133,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
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
+#elif (V8_MAJOR_VERSION-0) < 5
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
v8::Local<v8::Object> object = data.GetValue();
SWIGV8_Proxy *proxy = data.GetParameter();
+#else
+ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
+ SWIGV8_Proxy *proxy = data.GetParameter();
#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
@@ -147,7 +150,9 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
}
delete proxy;
+#if (V8_MAJOR_VERSION-0) < 5
object.Clear();
+#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
object.Dispose();
@@ -155,7 +160,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
object.Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
object->Dispose(isolate);
-#else
+#elif (V8_MAJOR_VERSION-0) < 5
object->Dispose();
#endif
}
@@ -177,10 +182,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
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
+#elif (V8_MAJOR_VERSION-0) < 5
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
v8::Local<v8::Object> object = data.GetValue();
SWIGV8_Proxy *proxy = data.GetParameter();
+#else
+static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
+ SWIGV8_Proxy *proxy = data.GetParameter();
#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
@@ -197,7 +205,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
object->Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
object->Dispose();
-#else
+#elif (V8_MAJOR_VERSION-0) < 5
object.Clear();
#endif
}
@@ -211,7 +219,11 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
* ----------------------------------------------------------------------------- */
%fragment("js_getter", "templates")
%{
+#if (V8_MAJOR_VERSION-0) < 5
static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+#else
+static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) {
+#endif
SWIGV8_HANDLESCOPE();
v8::Handle<v8::Value> jsresult;
@@ -233,8 +245,11 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("js_setter", "templates")
%{
-static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value,
- const SwigV8PropertyCallbackInfoVoid &info) {
+#if (V8_MAJOR_VERSION-0) < 5
+static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
+#else
+static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
+#endif
SWIGV8_HANDLESCOPE();
$jslocals
diff --git a/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg
index 1c0107beb..d3b4aaffa 100644
--- a/Lib/javascript/v8/javascriptcomplex.swg
+++ b/Lib/javascript/v8/javascriptcomplex.swg
@@ -17,7 +17,7 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
{
SWIGV8_HANDLESCOPE_ESC();
- v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW(2);
+ v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW();
vals->Set(0, SWIG_From(double)(Real(c)));
vals->Set(1, SWIG_From(double)(Imag(c)));
diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
index 091467df4..80fbd7aa1 100644
--- a/Lib/javascript/v8/javascripthelpers.swg
+++ b/Lib/javascript/v8/javascripthelpers.swg
@@ -6,11 +6,16 @@ typedef v8::InvocationCallback SwigV8FunctionCallback;
typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
-#else
+#elif (V8_MAJOR_VERSION-0) < 5
typedef v8::FunctionCallback SwigV8FunctionCallback;
typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback;
typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback;
typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
+#else
+typedef v8::FunctionCallback SwigV8FunctionCallback;
+typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback;
+typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback;
+typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
#endif
/**
@@ -65,18 +70,36 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char
*/
SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
+#if (V8_MAJOR_VERSION-0) < 5
obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
+#else
+ obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
+#endif
}
-SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value,
- const SwigV8PropertyCallbackInfoVoid& info)
+#if (V8_MAJOR_VERSION-0) < 5
+SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
+#else
+SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
+#endif
{
char buffer[256];
char msg[512];
int res;
+#if (V8_MAJOR_VERSION-0) < 5
property->WriteUtf8(buffer, 256);
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
+#else
+ v8::Local<v8::String> sproperty;
+ if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) {
+ SWIGV8_WRITE_UTF8(sproperty, buffer, 256);
+ res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
+ }
+ else {
+ res = -1;
+ }
+#endif
if(res<0) {
SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg
index 34befa7ce..8faf2dd8e 100644
--- a/Lib/javascript/v8/javascriptinit.swg
+++ b/Lib/javascript/v8/javascriptinit.swg
@@ -1,21 +1,35 @@
-%insert(init) %{
-
+%insert(header) %{
#include <assert.h>
+%}
+
+%insert(init) %{
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());
+#if (V8_MAJOR_VERSION-0) < 5
global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod);
+#else
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
+ global_obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, mod);
+#endif
}
SWIGRUNTIME swig_module_info *
SWIG_V8_GetModule(void *) {
v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
+#if (V8_MAJOR_VERSION-0) < 5
v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"));
+#else
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
+ v8::Local<v8::Value> moduleinfo;
+ if (!global_obj->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&moduleinfo))
+ return 0;
+#endif
- if (moduleinfo.IsEmpty())
+ if (moduleinfo.IsEmpty() || moduleinfo->IsNull() || moduleinfo->IsUndefined())
{
// It's not yet loaded
return 0;
@@ -23,7 +37,7 @@ SWIG_V8_GetModule(void *) {
v8::Local<v8::External> moduleinfo_extern = v8::Local<v8::External>::Cast(moduleinfo);
- if (moduleinfo_extern.IsEmpty())
+ if (moduleinfo_extern.IsEmpty() || moduleinfo_extern->IsNull() || moduleinfo_extern->IsUndefined())
{
// Something's not right
return 0;
diff --git a/Lib/javascript/v8/javascriptprimtypes.swg b/Lib/javascript/v8/javascriptprimtypes.swg
index c0055c48e..f76be983b 100644
--- a/Lib/javascript/v8/javascriptprimtypes.swg
+++ b/Lib/javascript/v8/javascriptprimtypes.swg
@@ -22,7 +22,7 @@ int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
return SWIG_ERROR;
}
- if (val) *val = obj->BooleanValue();
+ if (val) *val = SWIGV8_BOOLEAN_VALUE(obj);
return SWIG_OK;
}
}
@@ -44,7 +44,7 @@ int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
if (!valRef->IsNumber()) {
return SWIG_TypeError;
}
- if(val) *val = valRef->IntegerValue();
+ if(val) *val = SWIGV8_INTEGER_VALUE(valRef);
return SWIG_OK;
}
@@ -68,7 +68,7 @@ int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
if (!obj->IsNumber()) {
return SWIG_TypeError;
}
- if(val) *val = (long) obj->IntegerValue();
+ if(val) *val = (long) SWIGV8_INTEGER_VALUE(obj);
return SWIG_OK;
}
@@ -95,7 +95,7 @@ int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
return SWIG_TypeError;
}
- long longVal = (long) obj->NumberValue();
+ long longVal = (long) SWIGV8_NUMBER_VALUE(obj);
if(longVal < 0) {
return SWIG_OverflowError;
@@ -133,7 +133,7 @@ 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();
+ if(val) *val = (long long) SWIGV8_INTEGER_VALUE(obj);
return SWIG_OK;
}
@@ -168,7 +168,7 @@ int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long
return SWIG_TypeError;
}
- long long longVal = (long long) obj->NumberValue();
+ long long longVal = (long long) SWIGV8_NUMBER_VALUE(obj);
if(longVal < 0) {
return SWIG_OverflowError;
@@ -198,7 +198,7 @@ int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
if(!obj->IsNumber()) {
return SWIG_TypeError;
}
- if(val) *val = obj->NumberValue();
+ if(val) *val = SWIGV8_NUMBER_VALUE(obj);
return SWIG_OK;
}
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 5ac52a51d..2452f4040 100644
--- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg
@@ -91,6 +91,32 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class);
#endif
+#ifdef NODE_VERSION
+#if NODE_VERSION_AT_LEAST(10, 12, 0)
+#define SWIG_NODE_AT_LEAST_1012
+#endif
+#endif
+
+//Necessary to check Node.js version because V8 API changes are backported in Node.js
+#if (defined(NODE_VERSION) && !defined(SWIG_NODE_AT_LEAST_1012)) || \
+ (!defined(NODE_VERSION) && (V8_MAJOR_VERSION-0) < 7)
+#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject()
+#define SWIGV8_TO_STRING(handle) (handle)->ToString()
+#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue()
+#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue()
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue()
+#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(buffer, len)
+#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length()
+#else
+#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
+#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
+#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
+#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
+#endif
+
/* ---------------------------------------------------------------------------
* Error handling
*
@@ -109,11 +135,11 @@ SWIGINTERN void SWIG_V8_Raise(const char *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
+ during dispatching. As V8 exceptions can not be reset properly
the trick is to use a dynamic ErrorHandler with same local name as the global
one.
- - See defintion of SWIG_Error above.
+ - See definition of SWIG_Error above.
- See code templates 'JS_function_dispatcher', 'JS_functionwrapper_overload',
and 'JS_function_dispatch_case' in javascriptcode.swg
@@ -193,8 +219,10 @@ public:
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
+#elif (V8_MAJOR_VERSION-0) < 5
void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data);
+#else
+ void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data);
#endif
};
@@ -241,9 +269,12 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Val
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
+#elif (V8_MAJOR_VERSION-0) < 5
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
+#else
+SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
+ SWIGV8_Proxy *proxy = data.GetParameter();
#endif
delete proxy;
@@ -253,7 +284,7 @@ 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();
+ v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
@@ -312,12 +343,18 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw
} else {
cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
}
-#else
+#elif (V8_MAJOR_VERSION-0) < 5
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
} else {
cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor);
}
+#else
+ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
+ cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter);
+ } else {
+ cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter);
+ }
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
@@ -336,12 +373,12 @@ SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swi
/* special case: JavaScript null => C NULL pointer */
if(valRef->IsNull()) {
*ptr=0;
- return SWIG_OK;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = valRef->ToObject();
+ v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
}
@@ -468,10 +505,17 @@ SWIGRUNTIMEINLINE
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> objRef = valRef->ToObject();
+ v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
if(objRef->InternalFieldCount() < 1) return false;
+#if (V8_MAJOR_VERSION-0) < 5
v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
- return (flag->IsBoolean() && flag->BooleanValue());
+#else
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
+ v8::Local<v8::Value> flag;
+ if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag))
+ return false;
+#endif
+ return (flag->IsBoolean() && SWIGV8_BOOLEAN_VALUE(flag));
}
SWIGRUNTIME
@@ -481,7 +525,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr,
SwigV8PackedData *sobj;
- v8::Handle<v8::Object> objRef = valRef->ToObject();
+ v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
@@ -519,10 +563,13 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persist
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
+#elif (V8_MAJOR_VERSION-0) < 5
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) {
v8::Local<v8::Object> object = data.GetValue();
SwigV8PackedData *cdata = data.GetParameter();
+#else
+SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8PackedData> &data) {
+ SwigV8PackedData *cdata = data.GetParameter();
#endif
delete cdata;
@@ -537,7 +584,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Ob
object->Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
object->Dispose();
-#else
+#elif (V8_MAJOR_VERSION-0) < 5
object.Clear();
#endif
}
@@ -550,7 +597,12 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
+#if (V8_MAJOR_VERSION-0) < 5
obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true));
+#else
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
+ obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true));
+#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
obj->SetPointerInInternalField(0, cdata);
@@ -573,9 +625,11 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
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
+#elif (V8_MAJOR_VERSION-0) < 5
cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete);
// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete);
+#else
+ cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter);
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
diff --git a/Lib/javascript/v8/javascriptruntime.swg b/Lib/javascript/v8/javascriptruntime.swg
index 0e4059326..c78e04efb 100644
--- a/Lib/javascript/v8/javascriptruntime.swg
+++ b/Lib/javascript/v8/javascriptruntime.swg
@@ -44,6 +44,8 @@
#ifdef BUILDING_NODE_EXTENSION
%insert("runtime") %{
#include <node.h>
+//Older version of node.h does not include this
+#include <node_version.h>
%}
#endif
diff --git a/Lib/javascript/v8/javascriptstrings.swg b/Lib/javascript/v8/javascriptstrings.swg
index 65ba20e5a..e767a6d66 100644
--- a/Lib/javascript/v8/javascriptstrings.swg
+++ b/Lib/javascript/v8/javascriptstrings.swg
@@ -7,11 +7,11 @@ 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();
+ v8::Handle<v8::String> js_str = SWIGV8_TO_STRING(valRef);
- size_t len = js_str->Utf8Length() + 1;
+ size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
char* cstr = new char[len];
- js_str->WriteUtf8(cstr, len);
+ SWIGV8_WRITE_UTF8(js_str, cstr, len);
if(alloc) *alloc = SWIG_NEWOBJ;
if(psize) *psize = len;
@@ -20,7 +20,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
return SWIG_OK;
} else {
if(valRef->IsObject()) {
- v8::Handle<v8::Object> obj = valRef->ToObject();
+ v8::Handle<v8::Object> obj = SWIGV8_TO_OBJECT(valRef);
// try if the object is a wrapped char[]
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor) {
diff --git a/Lib/javascript/v8/std_complex.i b/Lib/javascript/v8/std_complex.i
index 088a4fe7b..a252e0aa8 100644
--- a/Lib/javascript/v8/std_complex.i
+++ b/Lib/javascript/v8/std_complex.i
@@ -8,6 +8,13 @@
#include <complex>
%}
+namespace std {
+ %naturalvar complex;
+ template<typename T> class complex;
+ %template() complex<double>;
+ %template() complex<float>;
+}
+
/* defining the complex as/from converters */
%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
diff --git a/Lib/javascript/v8/std_map.i b/Lib/javascript/v8/std_map.i
index e7812f38a..3b8b09369 100644
--- a/Lib/javascript/v8/std_map.i
+++ b/Lib/javascript/v8/std_map.i
@@ -20,22 +20,28 @@
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
bool empty() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -45,14 +51,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
}
diff --git a/Lib/javascript/v8/std_pair.i b/Lib/javascript/v8/std_pair.i
index 8d6057223..b72c50b99 100644
--- a/Lib/javascript/v8/std_pair.i
+++ b/Lib/javascript/v8/std_pair.i
@@ -17,12 +17,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/javascript/v8/std_vector.i b/Lib/javascript/v8/std_vector.i
index 971b426a1..586ac5c60 100644
--- a/Lib/javascript/v8/std_vector.i
+++ b/Lib/javascript/v8/std_vector.i
@@ -14,10 +14,17 @@ namespace std {
template<class T> class vector {
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;
+
vector();
vector(size_type n);
+ vector(const vector& other);
+
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
@@ -48,10 +55,17 @@ namespace std {
template<> class vector<bool> {
public:
typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
typedef bool value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
typedef bool const_reference;
+
vector();
vector(size_type n);
+ vector(const vector& other);
+
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
diff --git a/Lib/lua/lua.swg b/Lib/lua/lua.swg
index 9c21d0812..6db3add6e 100644
--- a/Lib/lua/lua.swg
+++ b/Lib/lua/lua.swg
@@ -33,7 +33,7 @@
%typemap(consttab) char *, const char *, char [], const char []
{SWIG_LUA_CONSTTAB_STRING("$symname", $value)}
-// note: char is treated as a seperate special type
+// note: char is treated as a separate special type
// signed char & unsigned char are numbers
%typemap(consttab) char
{SWIG_LUA_CONSTTAB_CHAR("$symname", $value)}
diff --git a/Lib/lua/luarun.swg b/Lib/lua/luarun.swg
index 660dbbf86..bd764d668 100644
--- a/Lib/lua/luarun.swg
+++ b/Lib/lua/luarun.swg
@@ -180,8 +180,8 @@ typedef struct swig_elua_entry {
* -------------------------------------------------------------------------- */
/* 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). */
+ prefixed with the location of the innermost Lua call-point
+ (as formatted by luaL_where). */
SWIGRUNTIME void
SWIG_Lua_pusherrstring (lua_State *L, const char *str)
{
@@ -191,8 +191,8 @@ SWIG_Lua_pusherrstring (lua_State *L, const char *str)
}
/* 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). */
+ the Lua stack, like lua_pushfstring, but prefixed with the
+ location of the innermost Lua call-point (as formatted by luaL_where). */
SWIGRUNTIME void
SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
{
@@ -289,7 +289,7 @@ 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 */
+ char data[1]; /* arbitrary amount of data */
} swig_lua_rawdata;
/* Common SWIG API */
@@ -341,7 +341,7 @@ typedef struct {
#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
#ifdef __cplusplus
-/* Special helper for member function pointers
+/* 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
@@ -444,7 +444,7 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
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);
@@ -453,11 +453,11 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
break;
case LUA_TUSERDATA:
- if(entry->value.value.userdata.member)
+ 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
+ else
SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue,
*(entry->value.value.userdata.ptype),0);
break;
@@ -502,7 +502,7 @@ SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L)
}
assert(lua_gettop(L) == 2);
return 1;
-
+
fail:
lua_error(L);
return 0;
@@ -520,7 +520,7 @@ SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L)
lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable);
lua_rawset(L,-3);
lua_pop(L,2);
-
+
}
/* END OF REMOVE */
@@ -1039,17 +1039,11 @@ 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;
+ swig_lua_userdata* 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);
+ userData = (swig_lua_userdata*)lua_touserdata(L,1); /* get the userdata address */
- lua_pushfstring(L, "<%s userdata: %p>", className, userData);
+ lua_pushfstring(L, "<userdata of type '%s' at %p>", userData->type->str, userData->ptr);
return 1;
}
@@ -1061,7 +1055,7 @@ SWIGINTERN int SWIG_Lua_class_disown(lua_State *L)
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;
}
@@ -1170,7 +1164,7 @@ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname)
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.
+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)
@@ -1404,11 +1398,11 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
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 */
@@ -1440,7 +1434,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
/* 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 */
@@ -1450,7 +1444,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
lua_pop(L,1);
return -1;
}
- lua_pop(L,1);
+ lua_pop(L,1);
/* Iterating over immediate bases */
for(i=0;clss->bases[i];i++)
@@ -1460,13 +1454,13 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
lua_pushvalue(L, key_index);
lua_rawget(L, -2);
if( !lua_isnil(L,-1) ) {
- lua_pushvalue(L, key_index);
+ 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;
}
@@ -1477,7 +1471,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
break;
}
- return success;
+ return success;
}
SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
@@ -1765,7 +1759,12 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type
{
swig_lua_userdata *usr;
swig_cast_info *cast;
- if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
+ /* special case: lua nil => NULL pointer */
+ if (lua_isnil(L,index))
+ {
+ *ptr=0;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
+ }
usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
if (usr)
{
@@ -1811,7 +1810,7 @@ SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_t
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)
{
@@ -1860,7 +1859,7 @@ SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
switch(constants[i].type) {
case SWIG_LUA_INT:
lua_pushstring(L,constants[i].name);
- lua_pushinteger(L,(lua_Number)constants[i].lvalue);
+ lua_pushinteger(L,(lua_Integer)constants[i].lvalue);
lua_rawset(L,-3);
break;
case SWIG_LUA_FLOAT:
@@ -1871,7 +1870,7 @@ SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
case SWIG_LUA_CHAR:
lua_pushstring(L,constants[i].name);
{
- char c = constants[i].lvalue;
+ char c = (char)constants[i].lvalue;
lua_pushlstring(L,&c,1);
}
lua_rawset(L,-3);
@@ -1910,7 +1909,7 @@ 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
+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 */
@@ -1925,7 +1924,7 @@ SWIG_Lua_dostring(lua_State *L, const char *str) {
}
lua_settop(L,top); /* restore the stack */
return ok;
-}
+}
#ifdef __cplusplus
}
diff --git a/Lib/lua/luaruntime.swg b/Lib/lua/luaruntime.swg
index 8df46e8cb..399bb640e 100644
--- a/Lib/lua/luaruntime.swg
+++ b/Lib/lua/luaruntime.swg
@@ -4,8 +4,9 @@
* all the runtime code for .
* ----------------------------------------------------------------------------- */
-%runtime "swigrun.swg"; /* Common C API type-checking code */
-%runtime "luarun.swg"; /* Lua runtime stuff */
+%runtime "swigrun.swg" /* Common C API type-checking code */
+%runtime "swigerrors.swg" /* SWIG errors */
+%runtime "luarun.swg" /* Lua runtime stuff */
%insert(initbeforefunc) "swiginit.swg"
diff --git a/Lib/lua/luatypemaps.swg b/Lib/lua/luatypemaps.swg
index 5d98e6107..8959f201e 100644
--- a/Lib/lua/luatypemaps.swg
+++ b/Lib/lua/luatypemaps.swg
@@ -189,7 +189,7 @@ SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
// Also needed for object ptrs by const ref
// eg A* const& ref_pointer(A* const& a);
// found in mixed_types.i
-%typemap(in,checkfn="lua_isuserdata") SWIGTYPE *const&($*ltype temp)
+%typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE *const&($*ltype temp)
%{temp=($*ltype)SWIG_MustGetPtr(L,$input,$*descriptor,0,$argnum,"$symname");
$1=($1_ltype)&temp;%}
@@ -235,7 +235,6 @@ $1=($1_ltype)&temp;%}
// so the standard wrapping cannot be done
// nor can you cast a member function pointer to a void* (obviously)
// therefore a special wrapping functions SWIG_ConvertMember() & SWIG_NewMemberObj() were written
-#ifdef __cplusplus
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*)
%{
if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($type),$descriptor)))
@@ -246,7 +245,6 @@ $1=($1_ltype)&temp;%}
%{
SWIG_NewMemberObj(L,(void*)(&$1),sizeof($type),$descriptor); SWIG_arg++;
%}
-#endif
// void (must be empty without the SWIG_arg++)
@@ -329,7 +327,7 @@ parameters match which function
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE & {
void *ptr;
- if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, 0)) {
+ if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) {
$1 = 0;
} else {
$1 = 1;
@@ -338,7 +336,7 @@ parameters match which function
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && {
void *ptr;
- if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, 0)) {
+ if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) {
$1 = 0;
} else {
$1 = 1;
@@ -347,7 +345,7 @@ parameters match which function
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
void *ptr;
- if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $&1_descriptor, 0)) {
+ if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $&1_descriptor, SWIG_POINTER_NO_NULL)) {
$1 = 0;
} else {
$1 = 1;
@@ -369,7 +367,7 @@ parameters match which function
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
{
void *ptr;
- if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $*descriptor, 0)) {
+ if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $*descriptor, 0)) {
$1 = 0;
} else {
$1 = 1;
@@ -386,6 +384,8 @@ parameters match which function
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
// size_t (which is just a unsigned long)
%apply unsigned long { size_t };
diff --git a/Lib/lua/std_map.i b/Lib/lua/std_map.i
index 84b0c74ff..773b6d0c3 100644
--- a/Lib/lua/std_map.i
+++ b/Lib/lua/std_map.i
@@ -20,22 +20,28 @@
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
bool empty() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -45,14 +51,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
}
diff --git a/Lib/lua/std_pair.i b/Lib/lua/std_pair.i
index 06728533b..410da9223 100644
--- a/Lib/lua/std_pair.i
+++ b/Lib/lua/std_pair.i
@@ -7,21 +7,6 @@
%{
#include <utility>
%}
-/*
-A really cut down version of the pair class.
-
-this is not useful on its own - it needs a %template definition with it
-
-eg.
-namespace std {
- %template(IntPair) pair<int, int>;
- %template(make_IntPair) make_pair<int, int>;
-}
-
-
-*/
-
-
namespace std {
template <class T, class U > struct pair {
@@ -30,13 +15,12 @@ namespace std {
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
T first;
U second;
};
template <class T, class U >
- pair<T,U> make_pair(const T&,const U&);
-
+ pair<T,U> make_pair(const T& first, const U& second);
}
diff --git a/Lib/lua/std_string.i b/Lib/lua/std_string.i
index e9f326b52..b95a8a4a2 100644
--- a/Lib/lua/std_string.i
+++ b/Lib/lua/std_string.i
@@ -109,7 +109,6 @@ as this is overloaded by the const char* version
public:
string();
string(const char*);
- //string(const string&);
unsigned int size() const;
unsigned int length() const;
bool empty() const;
@@ -119,7 +118,6 @@ as this is overloaded by the const char* version
// assign does not return a copy of this object
// (no point in a scripting language)
void assign(const char*);
- //void assign(const string&);
// no support for all the other features
// it's probably better to do it in lua
};
diff --git a/Lib/lua/std_vector.i b/Lib/lua/std_vector.i
index a4ea978db..9eb85e9e6 100644
--- a/Lib/lua/std_vector.i
+++ b/Lib/lua/std_vector.i
@@ -25,10 +25,19 @@ namespace std {
template<class T>
class vector {
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;
+
vector();
vector(unsigned int);
- vector(const vector&);
+ vector(const vector& other);
vector(unsigned int,T);
+
unsigned int size() const;
unsigned int max_size() const;
bool empty() const;
diff --git a/Lib/lua/typemaps.i b/Lib/lua/typemaps.i
index c662cd31e..8392e5bfa 100644
--- a/Lib/lua/typemaps.i
+++ b/Lib/lua/typemaps.i
@@ -182,7 +182,7 @@ TYPE* SWIG_get_NAME_num_array_var(lua_State* L, int index, int* size);
// writes a table to Lua with all the specified numbers
void SWIG_write_NAME_num_array(lua_State* L,TYPE *array,int size);
// read the specified table, and fills the array with numbers
- // returns 1 of ok (only fails if it doesnt find numbers)
+ // returns 1 of ok (only fails if it doesn't find numbers)
// helper fn (called by SWIG_get_NAME_num_array_*() fns)
int SWIG_read_NAME_num_array(lua_State* L,int index,TYPE *array,int size);
diff --git a/Lib/modula3/modula3.swg b/Lib/modula3/modula3.swg
index 262f8ead4..13d06e9c6 100644
--- a/Lib/modula3/modula3.swg
+++ b/Lib/modula3/modula3.swg
@@ -782,4 +782,6 @@ FROM BlaBla IMPORT Bla;
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
diff --git a/Lib/mzscheme/mzrun.swg b/Lib/mzscheme/mzrun.swg
index 06447d78d..c438c9ce8 100644
--- a/Lib/mzscheme/mzrun.swg
+++ b/Lib/mzscheme/mzrun.swg
@@ -158,7 +158,7 @@ SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type,
if (SCHEME_NULLP(s)) {
*result = NULL;
- return 0;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
} else if (SCHEME_TYPE(s) == swig_type) {
struct swig_mz_proxy *proxy = (struct swig_mz_proxy *) s;
if (type) {
diff --git a/Lib/mzscheme/mzscheme.swg b/Lib/mzscheme/mzscheme.swg
index 9ae242845..f45c87250 100644
--- a/Lib/mzscheme/mzscheme.swg
+++ b/Lib/mzscheme/mzscheme.swg
@@ -7,6 +7,7 @@
/* Include headers */
%runtime "swigrun.swg" // Common C API type-checking code
+%runtime "swigerrors.swg" // SWIG errors
%runtime "mzrun.swg"
%define SWIG_APPEND_VALUE(value)
diff --git a/Lib/mzscheme/std_map.i b/Lib/mzscheme/std_map.i
index 849f8baf5..1d3eec241 100644
--- a/Lib/mzscheme/std_map.i
+++ b/Lib/mzscheme/std_map.i
@@ -40,12 +40,12 @@
namespace std {
- template<class K, class T> class map {
- %typemap(in) map<K,T> (std::map<K,T>* m) {
+ template<class K, class T, class C = std::less<K> > class map {
+ %typemap(in) map< K, T, C > (std::map< K, T, C >* m) {
if (SCHEME_NULLP($input)) {
- $1 = std::map<K,T >();
+ $1 = std::map< K, T, C >();
} else if (SCHEME_PAIRP($input)) {
- $1 = std::map<K,T >();
+ $1 = std::map< K, T, C >();
Scheme_Object* alist = $input;
while (!SCHEME_NULLP(alist)) {
K* k;
@@ -72,15 +72,15 @@ namespace std {
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, C >& (std::map< K, T, C > temp,
+ std::map< K, T, C >* m),
+ const map< K, T, C >* (std::map< K, T, C > temp,
+ std::map< K, T, C >* m) {
if (SCHEME_NULLP($input)) {
- temp = std::map<K,T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
} else if (SCHEME_PAIRP($input)) {
- temp = std::map<K,T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
Scheme_Object* alist = $input;
while (!SCHEME_NULLP(alist)) {
@@ -107,9 +107,9 @@ namespace std {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
- %typemap(out) map<K,T> {
+ %typemap(out) map< K, T, C > {
Scheme_Object* alist = scheme_null;
- for (std::map<K,T >::reverse_iterator i=$1.rbegin();
+ for (std::map< K, T, C >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
K* key = new K(i->first);
T* val = new T(i->second);
@@ -120,7 +120,7 @@ namespace std {
}
$result = alist;
}
- %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
+ %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
/* native sequence? */
if (SCHEME_NULLP($input)) {
/* an empty sequence can be of any type */
@@ -156,7 +156,7 @@ namespace std {
}
} else {
/* wrapped map? */
- std::map<K,T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) != -1)
$1 = 1;
@@ -164,8 +164,8 @@ namespace std {
$1 = 0;
}
}
- %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
- const map<K,T>* {
+ %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
+ const map< K, T, C >* {
/* native sequence? */
if (SCHEME_NULLP($input)) {
/* an empty sequence can be of any type */
@@ -201,7 +201,7 @@ namespace std {
}
} else {
/* wrapped map? */
- std::map<K,T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) != -1)
$1 = 1;
@@ -221,15 +221,21 @@ namespace std {
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -239,19 +245,19 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
- for (std::map<K,T >::reverse_iterator i=self->rbegin();
+ for (std::map< K, T, C >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
K* key = new K(i->first);
Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
@@ -267,12 +273,12 @@ namespace std {
%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) {
+ template<class T> class map< K, T, C > {
+ %typemap(in) map< K, T, C > (std::map< K, T, C >* m) {
if (SCHEME_NULLP($input)) {
- $1 = std::map<K,T >();
+ $1 = std::map< K, T, C >();
} else if (SCHEME_PAIRP($input)) {
- $1 = std::map<K,T >();
+ $1 = std::map< K, T, C >();
Scheme_Object* alist = $input;
while (!SCHEME_NULLP(alist)) {
T* x;
@@ -284,7 +290,7 @@ namespace std {
val = scheme_cdr(entry);
if (!CHECK(key))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
if (SWIG_ConvertPtr(val,(void**) &x,
$descriptor(T *), 0) == -1) {
if (!SCHEME_PAIRP(val))
@@ -300,15 +306,15 @@ namespace std {
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, C >& (std::map< K, T, C > temp,
+ std::map< K, T, C >* m),
+ const map< K, T, C >* (std::map< K, T, C > temp,
+ std::map< K, T, C >* m) {
if (SCHEME_NULLP($input)) {
- temp = std::map<K,T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
} else if (SCHEME_PAIRP($input)) {
- temp = std::map<K,T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
Scheme_Object* alist = $input;
while (!SCHEME_NULLP(alist)) {
@@ -321,7 +327,7 @@ namespace std {
val = scheme_cdr(entry);
if (!CHECK(key))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
if (SWIG_ConvertPtr(val,(void**) &x,
$descriptor(T *), 0) == -1) {
if (!SCHEME_PAIRP(val))
@@ -336,9 +342,9 @@ namespace std {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
- %typemap(out) map<K,T> {
+ %typemap(out) map< K, T, C > {
Scheme_Object* alist = scheme_null;
- for (std::map<K,T >::reverse_iterator i=$1.rbegin();
+ for (std::map< K, T, C >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
T* val = new T(i->second);
Scheme_Object* k = CONVERT_TO(i->first);
@@ -348,7 +354,7 @@ namespace std {
}
$result = alist;
}
- %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
+ %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
// native sequence?
if (SCHEME_NULLP($input)) {
/* an empty sequence can be of any type */
@@ -382,7 +388,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map<K,T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) != -1)
$1 = 1;
@@ -390,8 +396,8 @@ namespace std {
$1 = 0;
}
}
- %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
- const map<K,T>* {
+ %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
+ const map< K, T, C >* {
// native sequence?
if (SCHEME_NULLP($input)) {
/* an empty sequence can be of any type */
@@ -425,7 +431,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map<K,T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) != -1)
$1 = 1;
@@ -441,15 +447,25 @@ namespace std {
%rename("delete!") __delitem__;
%rename("has-key?") has_key;
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -459,19 +475,19 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
- for (std::map<K,T >::reverse_iterator i=self->rbegin();
+ for (std::map< K, T, C >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
Scheme_Object* k = CONVERT_TO(i->first);
result = scheme_make_pair(k,result);
@@ -483,12 +499,12 @@ namespace std {
%enddef
%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) {
+ template<class K> class map< K, T, C > {
+ %typemap(in) map< K, T, C > (std::map< K, T, C >* m) {
if (SCHEME_NULLP($input)) {
- $1 = std::map<K,T >();
+ $1 = std::map< K, T, C >();
} else if (SCHEME_PAIRP($input)) {
- $1 = std::map<K,T >();
+ $1 = std::map< K, T, C >();
Scheme_Object* alist = $input;
while (!SCHEME_NULLP(alist)) {
K* k;
@@ -505,7 +521,7 @@ namespace std {
val = scheme_car(val);
if (!CHECK(val))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
}
(($1_type &)$1)[*k] = CONVERT_FROM(val);
alist = scheme_cdr(alist);
@@ -515,15 +531,15 @@ namespace std {
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, C >& (std::map< K, T, C > temp,
+ std::map< K, T, C >* m),
+ const map< K, T, C >* (std::map< K, T, C > temp,
+ std::map< K, T, C >* m) {
if (SCHEME_NULLP($input)) {
- temp = std::map<K,T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
} else if (SCHEME_PAIRP($input)) {
- temp = std::map<K,T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
Scheme_Object* alist = $input;
while (!SCHEME_NULLP(alist)) {
@@ -541,7 +557,7 @@ namespace std {
val = scheme_car(val);
if (!CHECK(val))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
}
temp[*k] = CONVERT_FROM(val);
alist = scheme_cdr(alist);
@@ -550,9 +566,9 @@ namespace std {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
- %typemap(out) map<K,T> {
+ %typemap(out) map< K, T, C > {
Scheme_Object* alist = scheme_null;
- for (std::map<K,T >::reverse_iterator i=$1.rbegin();
+ for (std::map< K, T, C >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
K* key = new K(i->first);
Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
@@ -562,7 +578,7 @@ namespace std {
}
$result = alist;
}
- %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
+ %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
// native sequence?
if (SCHEME_NULLP($input)) {
/* an empty sequence can be of any type */
@@ -595,7 +611,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map<K,T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) != -1)
$1 = 1;
@@ -603,8 +619,8 @@ namespace std {
$1 = 0;
}
}
- %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
- const map<K,T>* {
+ %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
+ const map< K, T, C >* {
// native sequence?
if (SCHEME_NULLP($input)) {
/* an empty sequence can be of any type */
@@ -637,7 +653,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map<K,T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) != -1)
$1 = 1;
@@ -653,15 +669,25 @@ namespace std {
%rename("delete!") __delitem__;
%rename("has-key?") has_key;
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -671,19 +697,19 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
- for (std::map<K,T >::reverse_iterator i=self->rbegin();
+ for (std::map< K, T, C >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
K* key = new K(i->first);
Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
@@ -697,12 +723,12 @@ namespace std {
%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) {
+ template<> class map< K, T, C > {
+ %typemap(in) map< K, T, C > (std::map< K, T, C >* m) {
if (SCHEME_NULLP($input)) {
- $1 = std::map<K,T >();
+ $1 = std::map< K, T, C >();
} else if (SCHEME_PAIRP($input)) {
- $1 = std::map<K,T >();
+ $1 = std::map< K, T, C >();
Scheme_Object* alist = $input;
while (!SCHEME_NULLP(alist)) {
Scheme_Object *entry, *key, *val;
@@ -713,14 +739,14 @@ namespace std {
val = scheme_cdr(entry);
if (!CHECK_K(key))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
if (!CHECK_T(val)) {
if (!SCHEME_PAIRP(val))
SWIG_exception(SWIG_TypeError,"alist expected");
val = scheme_car(val);
if (!CHECK_T(val))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
}
(($1_type &)$1)[CONVERT_K_FROM(key)] =
CONVERT_T_FROM(val);
@@ -731,15 +757,15 @@ namespace std {
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, C >& (std::map< K, T, C > temp,
+ std::map< K, T, C >* m),
+ const map< K, T, C >* (std::map< K, T, C > temp,
+ std::map< K, T, C >* m) {
if (SCHEME_NULLP($input)) {
- temp = std::map<K,T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
} else if (SCHEME_PAIRP($input)) {
- temp = std::map<K,T >();
+ temp = std::map< K, T, C >();
$1 = &temp;
Scheme_Object* alist = $input;
while (!SCHEME_NULLP(alist)) {
@@ -751,14 +777,14 @@ namespace std {
val = scheme_cdr(entry);
if (!CHECK_K(key))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
if (!CHECK_T(val)) {
if (!SCHEME_PAIRP(val))
SWIG_exception(SWIG_TypeError,"alist expected");
val = scheme_car(val);
if (!CHECK_T(val))
SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "> expected");
+ "map<" #K "," #T "," #C "> expected");
}
temp[CONVERT_K_FROM(key)] = CONVERT_T_FROM(val);
alist = scheme_cdr(alist);
@@ -767,9 +793,9 @@ namespace std {
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
}
}
- %typemap(out) map<K,T> {
+ %typemap(out) map< K, T, C > {
Scheme_Object* alist = scheme_null;
- for (std::map<K,T >::reverse_iterator i=$1.rbegin();
+ for (std::map< K, T, C >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
Scheme_Object* k = CONVERT_K_TO(i->first);
Scheme_Object* x = CONVERT_T_TO(i->second);
@@ -778,7 +804,7 @@ namespace std {
}
$result = alist;
}
- %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
+ %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
// native sequence?
if (SCHEME_NULLP($input)) {
/* an empty sequence can be of any type */
@@ -809,7 +835,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map<K,T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$&1_descriptor, 0) != -1)
$1 = 1;
@@ -817,8 +843,8 @@ namespace std {
$1 = 0;
}
}
- %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
- const map<K,T>* {
+ %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
+ const map< K, T, C >* {
// native sequence?
if (SCHEME_NULLP($input)) {
/* an empty sequence can be of any type */
@@ -849,7 +875,7 @@ namespace std {
}
} else {
// wrapped map?
- std::map<K,T >* m;
+ std::map< K, T, C >* m;
if (SWIG_ConvertPtr($input,(void **) &m,
$1_descriptor, 0) != -1)
$1 = 1;
@@ -865,15 +891,25 @@ namespace std {
%rename("delete!") __delitem__;
%rename("has-key?") has_key;
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -883,19 +919,19 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
- for (std::map<K,T >::reverse_iterator i=self->rbegin();
+ for (std::map< K, T, C >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
Scheme_Object* k = CONVERT_K_TO(i->first);
result = scheme_make_pair(k,result);
diff --git a/Lib/mzscheme/std_pair.i b/Lib/mzscheme/std_pair.i
index d5a65470d..75f6751cc 100644
--- a/Lib/mzscheme/std_pair.i
+++ b/Lib/mzscheme/std_pair.i
@@ -115,11 +115,15 @@ namespace std {
$1 = 0;
}
}
+
+ typedef T first_type;
+ typedef U second_type;
+
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
@@ -219,9 +223,9 @@ namespace std {
}
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
@@ -320,9 +324,9 @@ namespace std {
}
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
@@ -415,9 +419,9 @@ namespace std {
}
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/mzscheme/std_vector.i b/Lib/mzscheme/std_vector.i
index 22e1fa96b..0ef5edb15 100644
--- a/Lib/mzscheme/std_vector.i
+++ b/Lib/mzscheme/std_vector.i
@@ -189,9 +189,18 @@ namespace std {
}
}
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, const T& value);
- vector(const vector<T>&);
+ vector(const vector& other);
+
%rename(length) size;
unsigned int size() const;
%rename("empty?") empty;
@@ -365,9 +374,18 @@ namespace std {
}
}
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, const T& value);
- vector(const vector<T>&);
+ vector(const vector& other);
+
%rename(length) size;
unsigned int size() const;
%rename("empty?") empty;
diff --git a/Lib/mzscheme/stl.i b/Lib/mzscheme/stl.i
index b19eae58b..04f86014f 100644
--- a/Lib/mzscheme/stl.i
+++ b/Lib/mzscheme/stl.i
@@ -1,8 +1,7 @@
/* -----------------------------------------------------------------------------
* stl.i
- *
- * Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
+
%include <std_common.i>
%include <std_string.i>
%include <std_vector.i>
diff --git a/Lib/mzscheme/typemaps.i b/Lib/mzscheme/typemaps.i
index 9346349bd..09bda2cca 100644
--- a/Lib/mzscheme/typemaps.i
+++ b/Lib/mzscheme/typemaps.i
@@ -329,7 +329,7 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
$1 = (SCHEME_STRINGP($input)) ? 1 : 0;
}
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
+%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
void *ptr;
if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, 0)) {
$1 = 0;
@@ -338,9 +338,18 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
}
}
+%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &, SWIGTYPE && {
+ void *ptr;
+ if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) {
+ $1 = 0;
+ } else {
+ $1 = 1;
+ }
+}
+
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
void *ptr;
- if (SWIG_ConvertPtr($input, (void **) &ptr, $&1_descriptor, 0)) {
+ if (SWIG_ConvertPtr($input, (void **) &ptr, $&1_descriptor, SWIG_POINTER_NO_NULL)) {
$1 = 0;
} else {
$1 = 1;
diff --git a/Lib/ocaml/carray.i b/Lib/ocaml/carray.i
index bbf1ddd58..5e74c3da1 100644
--- a/Lib/ocaml/carray.i
+++ b/Lib/ocaml/carray.i
@@ -9,7 +9,6 @@ type _value = c_obj
%define %array_tmap_out(type,what,out_f)
%typemap(type) what [ANY] {
int i;
- /* $*1_type */
$result = caml_array_new($1_dim0);
for( i = 0; i < $1_dim0; i++ ) {
caml_array_set($result,i,out_f($1[i]));
@@ -20,7 +19,6 @@ type _value = c_obj
%define %array_tmap_in(type,what,in_f)
%typemap(type) what [ANY] {
int i;
- /* $*1_type */
$1 = ($*1_type *)malloc( $1_size );
for( i = 0; i < $1_dim0 && i < caml_array_len($input); i++ ) {
$1[i] = in_f(caml_array_nth($input,i));
@@ -57,7 +55,6 @@ type _value = c_obj
%typemap(in) SWIGTYPE [] {
int i;
- /* $*1_type */
$1 = new $*1_type [$1_dim0];
for( i = 0; i < $1_dim0 && i < caml_array_len($input); i++ ) {
$1[i] = *(($*1_ltype *)
@@ -69,7 +66,6 @@ type _value = c_obj
%typemap(in) SWIGTYPE [] {
int i;
- /* $*1_type */
$1 = ($*1_type *)malloc( $1_size );
for( i = 0; i < $1_dim0 && i < caml_array_len($input); i++ ) {
$1[i] = *(($*1_ltype)
@@ -89,7 +85,7 @@ type _value = c_obj
caml_array_set
($result,
i,
- callback(*fromval,caml_val_ptr((void *)&$1[i],$*1_descriptor)));
+ caml_callback(*fromval,caml_val_ptr((void *)&$1[i],$*1_descriptor)));
} else {
caml_array_set
($result,
@@ -102,7 +98,6 @@ type _value = c_obj
%typemap(in) enum SWIGTYPE [] {
int i;
- /* $*1_type */
$1 = ($*1_type *)malloc( $1_size );
for( i = 0; i < $1_dim0 && i < caml_array_len($input); i++ ) {
$1[i] = ($type)
@@ -119,7 +114,7 @@ type _value = c_obj
caml_array_set
($result,
i,
- callback2(*caml_named_value(SWIG_MODULE "_int_to_enum"),
+ caml_callback2(*caml_named_value(SWIG_MODULE "_int_to_enum"),
*caml_named_value("$type_marker"),
Val_int($1[i])));
}
diff --git a/Lib/ocaml/class.swg b/Lib/ocaml/class.swg
index 0ee304cab..eb369cd70 100644
--- a/Lib/ocaml/class.swg
+++ b/Lib/ocaml/class.swg
@@ -56,6 +56,7 @@ begin
(fun mth arg -> invoke_inner raw_ptr mth arg)
end
+let _ = register_class_byname "$realname" create_$classname_from_ptr
let _ = Callback.register
"create_$normalized_from_ptr"
create_$classname_from_ptr
diff --git a/Lib/ocaml/cstring.i b/Lib/ocaml/cstring.i
index 0d6aa4b69..f1190ad5c 100644
--- a/Lib/ocaml/cstring.i
+++ b/Lib/ocaml/cstring.i
@@ -108,7 +108,7 @@
%define %cstring_mutable(TYPEMAP,...)
%typemap(in) TYPEMAP {
char *t = String_val($input);
- int n = string_length($input);
+ int n = caml_string_length($input);
$1 = ($1_ltype) t;
#if #__VA_ARGS__ == ""
#ifdef __cplusplus
diff --git a/Lib/ocaml/director.swg b/Lib/ocaml/director.swg
index 158cbfeec..eb91aaf4b 100644
--- a/Lib/ocaml/director.swg
+++ b/Lib/ocaml/director.swg
@@ -74,12 +74,12 @@ namespace Swig {
public:
/* wrap a ocaml object. */
Director(CAML_VALUE self) : swig_self(self), swig_disown_flag(false) {
- register_global_root(&swig_self);
+ caml_register_global_root(&swig_self);
}
/* discard our reference at destruction */
virtual ~Director() {
- remove_global_root(&swig_self);
+ caml_remove_global_root(&swig_self);
swig_disown();
// Disown is safe here because we're just divorcing a reference that points to us.
}
@@ -93,7 +93,7 @@ namespace Swig {
void swig_disown() const {
if (!swig_disown_flag) {
swig_disown_flag=true;
- callback(*caml_named_value("caml_obj_disown"),swig_self);
+ caml_callback(*caml_named_value("caml_obj_disown"),swig_self);
}
}
};
diff --git a/Lib/ocaml/extra-install.list b/Lib/ocaml/extra-install.list
index a63c7fc2f..16486eb2c 100644
--- a/Lib/ocaml/extra-install.list
+++ b/Lib/ocaml/extra-install.list
@@ -1,5 +1,4 @@
# see top-level Makefile.in
-# libswigocaml is not needed anymore.
swigp4.ml
swig.mli
swig.ml
diff --git a/Lib/ocaml/libswigocaml.h b/Lib/ocaml/libswigocaml.h
deleted file mode 100644
index e752540fe..000000000
--- a/Lib/ocaml/libswigocaml.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Ocaml runtime support */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- typedef int oc_bool;
- extern void *nullptr;
-
- extern oc_bool isnull( void *v );
-
- extern void *get_char_ptr( char *str );
- extern void *make_ptr_array( int size );
- extern void *get_ptr( void *arrayptr, int elt );
- extern void set_ptr( void *arrayptr, int elt, void *elt_v );
- extern void *offset_ptr( void *ptr, int n );
-
-#ifdef __cplusplus
-};
-#endif
diff --git a/Lib/ocaml/ocaml.i b/Lib/ocaml/ocaml.i
index e099f7c10..cc26d1859 100644
--- a/Lib/ocaml/ocaml.i
+++ b/Lib/ocaml/ocaml.i
@@ -4,15 +4,11 @@
* SWIG Configuration File for Ocaml
* ----------------------------------------------------------------------------- */
-%runtime %{
-#define SWIGSTATIC static
-%}
-
/* Insert common stuff */
%insert(runtime) "swigrun.swg"
/* Include headers */
-%insert(runtime) "ocamldec.swg"
+%insert(runtime) "ocamlrundec.swg"
/* Type registration */
%insert(init) "swiginit.swg"
@@ -32,18 +28,14 @@
%}
/*#ifndef SWIG_NOINCLUDE*/
-%insert(runtime) "ocaml.swg"
+%insert(runtime) "ocamlrun.swg"
/*#endif*/
%insert(classtemplate) "class.swg"
-/* Definitions */
-#define SWIG_malloc(size) swig_malloc(size, FUNC_NAME)
-#define SWIG_free(mem) free(mem)
-
/* Read in standard typemaps. */
%include <swig.swg>
-%include <typemaps.i>
+%include <ocaml.swg>
%include <typecheck.i>
%include <exception.i>
%include <preamble.swg>
diff --git a/Lib/ocaml/ocaml.swg b/Lib/ocaml/ocaml.swg
index a00252b28..ac496bdba 100644
--- a/Lib/ocaml/ocaml.swg
+++ b/Lib/ocaml/ocaml.swg
@@ -1,602 +1,311 @@
-/* -*-c-*- */
+/* -----------------------------------------------------------------------------
+ * ocaml.swg
+ *
+ * The Ocaml module handles all types uniformly via typemaps. Here
+ * are the definitions.
+ * ----------------------------------------------------------------------------- */
-/* SWIG pointer structure */
+/* Pointers */
-#include <string.h>
-#include <assert.h>
+%typemap(in) void ""
-#ifdef __cplusplus
-extern "C" {
-#endif
+%typemap(out) void "$result = Val_int(0);"
-#define C_bool 0
-#define C_char 1
-#define C_uchar 2
-#define C_short 3
-#define C_ushort 4
-#define C_int 5
-#define C_uint 6
-#define C_int32 7
-#define C_int64 8
-#define C_float 9
-#define C_double 10
-#define C_ptr 11
-#define C_array 12
-#define C_list 13
-#define C_obj 14
-#define C_string 15
-#define C_enum 16
-#define C_director_core 17
-
-
-/* Cast a pointer if possible; returns 1 if successful */
-
- SWIGSTATIC int
- SWIG_Cast (void *source, swig_type_info *source_type,
- void **ptr, swig_type_info *dest_type)
- {
- if( !source ) { // Special case for NULL. This is a popular question
- // for other modules on the list, so I want an easy way out...
- *ptr = 0;
- return 0;
- }
-
-#ifdef TYPE_CAST_VERBOSE
- fprintf( stderr, "Trying to cast %s to %s\n",
- source_type ? source_type->str : "<none>",
- dest_type ? dest_type->str : "<none>" );
-#endif
- if (dest_type != source_type) {
- /* We have a type mismatch. Will have to look through our type
- mapping table to figure out whether or not we can accept this
- datatype.
- --
- Ignore typechecks for void *. Allow any conversion. */
- if( !dest_type || !source_type ||
- !strcmp(dest_type->name,"_p_void") ||
- !strcmp(source_type->name,"_p_void") ) {
- *ptr = source;
- return 0;
- } else {
- swig_cast_info *tc =
- SWIG_TypeCheckStruct(source_type, dest_type );
-#ifdef TYPE_CAST_VERBOSE
- fprintf( stderr, "Typecheck -> %s\n",
- tc ? tc->str : "<none>" );
-#endif
- if( tc ) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc, source, &newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- return 0;
- } else
- return -1;
- }
- } else {
- *ptr = source;
- return 0;
- }
- }
-
-/* Return 0 if successful. */
- SWIGSTATIC int
- SWIG_GetPtr(void *inptr, void **outptr,
- swig_type_info *intype, swig_type_info *outtype) {
- if (intype) {
- return SWIG_Cast(inptr, intype,
- outptr, outtype) == -1;
- } else {
- *outptr = inptr;
- return 0;
- }
- }
-
- SWIGSTATIC void caml_print_list( CAML_VALUE v );
-
- SWIGSTATIC void caml_print_val( CAML_VALUE v ) {
- switch( SWIG_Tag_val(v) ) {
- case C_bool:
- if( Bool_val(SWIG_Field(v,0)) ) fprintf( stderr, "true " );
- else fprintf( stderr, "false " );
- break;
- case C_char:
- case C_uchar:
- fprintf( stderr, "'%c' (\\%03d) ",
- (Int_val(SWIG_Field(v,0)) >= ' ' &&
- Int_val(SWIG_Field(v,0)) < 127) ? Int_val(SWIG_Field(v,0)) : '.',
- Int_val(SWIG_Field(v,0)) );
- break;
- case C_short:
- case C_ushort:
- case C_int:
- fprintf( stderr, "%d ", (int)caml_long_val(v) );
- break;
-
- case C_uint:
- case C_int32:
- fprintf( stderr, "%ud ", (unsigned int)caml_long_val(v) );
- break;
- case C_int64:
- fprintf( stderr, "%ld ", caml_long_val(v) );
- break;
- case C_float:
- case C_double:
- fprintf( stderr, "%f ", caml_double_val(v) );
- break;
-
- case C_ptr:
- {
- void *vout = 0;
- swig_type_info *ty = (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field(v,1));
- caml_ptr_val_internal(v,&vout,0);
- fprintf( stderr, "PTR(%p,%s) ",
- vout,
- ty ? ty->name : "(null)" );
- }
- break;
- case C_array:
- {
- unsigned int i;
- for( i = 0; i < Wosize_val( SWIG_Field(v,0) ); i++ )
- caml_print_val( SWIG_Field(SWIG_Field(v,0),i) );
- }
- break;
- case C_list:
- caml_print_list( SWIG_Field(v,0) );
- break;
- case C_obj:
- fprintf( stderr, "OBJ(%p) ", (void *)SWIG_Field(v,0) );
- break;
- case C_string:
- {
- void *cout;
- caml_ptr_val_internal(v,&cout,0);
- fprintf( stderr, "'%s' ", (char *)cout );
- }
- break;
- }
- }
-
- SWIGSTATIC void caml_print_list( CAML_VALUE v ) {
- CAMLparam1(v);
- while( v && Is_block(v) ) {
- fprintf( stderr, "[ " );
- caml_print_val( SWIG_Field(v,0) );
- fprintf( stderr, "]\n" );
- v = SWIG_Field(v,1);
- }
- CAMLreturn0;
- }
-
- SWIGSTATIC CAML_VALUE caml_list_nth( CAML_VALUE lst, int n ) {
- CAMLparam1(lst);
- int i = 0;
- while( i < n && lst && Is_block(lst) ) {
- i++; lst = SWIG_Field(lst,1);
- }
- if( lst == Val_unit ) CAMLreturn(Val_unit);
- else CAMLreturn(SWIG_Field(lst,0));
- }
-
- SWIGSTATIC CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt ) {
- CAMLparam2(lst,elt);
- SWIG_CAMLlocal3(v,vt,lh);
- lh = Val_unit;
- v = Val_unit;
-
- /* Appending C_void should have no effect */
- if( !Is_block(elt) ) return lst;
-
- while( lst && Is_block(lst) ) {
- if( v && v != Val_unit ) {
- vt = alloc_tuple(2);
- SWIG_Store_field(v,1,vt);
- v = vt;
- } else {
- v = lh = alloc_tuple(2);
- }
- SWIG_Store_field(v,0,SWIG_Field(lst,0));
- lst = SWIG_Field(lst,1);
- }
-
- if( v && Is_block(v) ) {
- vt = alloc_tuple(2);
- SWIG_Store_field(v,1,vt);
- v = vt;
- } else {
- v = lh = alloc_tuple(2);
- }
- SWIG_Store_field(v,0,elt);
- SWIG_Store_field(v,1,Val_unit);
-
- CAMLreturn(lh);
- }
-
- SWIGSTATIC int caml_list_length( CAML_VALUE lst ) {
- CAMLparam1(lst);
- int i = 0;
- while( lst && Is_block(lst) ) { i++; lst = SWIG_Field(lst,1); }
- CAMLreturn(i);
- }
-
- SWIGSTATIC void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item ) {
- CAMLparam2(arr,item);
- SWIG_Store_field(SWIG_Field(arr,0),n,item);
- CAMLreturn0;
- }
+%typemap(in) void * {
+ $1 = caml_ptr_val($input,$descriptor);
+}
- SWIGSTATIC value caml_array_nth( CAML_VALUE arr, int n ) {
- CAMLparam1(arr);
- if( SWIG_Tag_val(arr) == C_array )
- CAMLreturn(SWIG_Field(SWIG_Field(arr,0),n));
- else if( SWIG_Tag_val(arr) == C_list )
- CAMLreturn(caml_list_nth(arr,0));
- else
- failwith("Need array or list");
- }
+%typemap(varin) void * {
+ $1 = ($ltype)caml_ptr_val($input,$descriptor);
+}
- SWIGSTATIC int caml_array_len( CAML_VALUE arr ) {
- CAMLparam1(arr);
- if( SWIG_Tag_val(arr) == C_array )
- CAMLreturn(Wosize_val(SWIG_Field(arr,0)));
- else if( SWIG_Tag_val(arr) == C_list )
- CAMLreturn(caml_list_length(arr));
- else
- failwith("Need array or list");
- }
+%typemap(out) void * {
+ $result = caml_val_ptr($1,$descriptor);
+}
- SWIGSTATIC CAML_VALUE caml_swig_alloc(int x,int y) {
- return caml_alloc(x,y);
- }
+%typemap(varout) void * {
+ $result = caml_val_ptr($1,$descriptor);
+}
- SWIGSTATIC value caml_array_new( int n ) {
- CAMLparam0();
- SWIG_CAMLlocal1(vv);
- vv = caml_swig_alloc(1,C_array);
- SWIG_Store_field(vv,0,alloc_tuple(n));
- CAMLreturn(vv);
- }
-
- SWIGSTATIC CAML_VALUE caml_val_bool( int b ) {
- CAMLparam0();
- SWIG_CAMLlocal1(bv);
- bv = caml_swig_alloc(1,C_bool);
- SWIG_Store_field(bv,0,Val_bool(b));
- CAMLreturn(bv);
- }
+%typemap(in) char *& (char *temp) {
+ temp = (char*)caml_val_ptr($1,$descriptor);
+ $1 = &temp;
+}
- SWIGSTATIC CAML_VALUE caml_val_char( char c ) {
- CAMLparam0();
- SWIG_CAMLlocal1(cv);
- cv = caml_swig_alloc(1,C_char);
- SWIG_Store_field(cv,0,Val_int(c));
- CAMLreturn(cv);
- }
+%typemap(argout) char *& {
+ swig_result = caml_list_append(swig_result,caml_val_string_len(*$1, strlen(*$1)));
+}
- SWIGSTATIC CAML_VALUE caml_val_uchar( unsigned char uc ) {
- CAMLparam0();
- SWIG_CAMLlocal1(ucv);
- ucv = caml_swig_alloc(1,C_uchar);
- SWIG_Store_field(ucv,0,Val_int(uc));
- CAMLreturn(ucv);
- }
+%typemap(in) SWIGTYPE & {
+ $1 = ($ltype) caml_ptr_val($input,$1_descriptor);
+}
- SWIGSTATIC CAML_VALUE caml_val_short( short s ) {
- CAMLparam0();
- SWIG_CAMLlocal1(sv);
- sv = caml_swig_alloc(1,C_short);
- SWIG_Store_field(sv,0,Val_int(s));
- CAMLreturn(sv);
- }
+%typemap(in) SWIGTYPE && {
+ $1 = ($ltype) caml_ptr_val($input,$1_descriptor);
+}
- SWIGSTATIC CAML_VALUE caml_val_ushort( unsigned short us ) {
- CAMLparam0();
- SWIG_CAMLlocal1(usv);
- usv = caml_swig_alloc(1,C_ushort);
- SWIG_Store_field(usv,0,Val_int(us));
- CAMLreturn(usv);
- }
+%typemap(varin) SWIGTYPE & {
+ $1 = *(($ltype) caml_ptr_val($input,$1_descriptor));
+}
- SWIGSTATIC CAML_VALUE caml_val_int( int i ) {
- CAMLparam0();
- SWIG_CAMLlocal1(iv);
- iv = caml_swig_alloc(1,C_int);
- SWIG_Store_field(iv,0,Val_int(i));
- CAMLreturn(iv);
- }
+%typemap(varin) SWIGTYPE && {
+ $1 = *(($ltype) caml_ptr_val($input,$1_descriptor));
+}
- SWIGSTATIC CAML_VALUE caml_val_uint( unsigned int ui ) {
- CAMLparam0();
- SWIG_CAMLlocal1(uiv);
- uiv = caml_swig_alloc(1,C_int);
- SWIG_Store_field(uiv,0,Val_int(ui));
- CAMLreturn(uiv);
- }
+%typemap(varout) SWIGTYPE &, SWIGTYPE && {
+ $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)&$1, $1_descriptor);
+}
- SWIGSTATIC CAML_VALUE caml_val_long( long l ) {
- CAMLparam0();
- SWIG_CAMLlocal1(lv);
- lv = caml_swig_alloc(1,C_int64);
- SWIG_Store_field(lv,0,copy_int64(l));
- CAMLreturn(lv);
- }
+%typemap(out) SWIGTYPE &, SWIGTYPE && {
+ $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)$1, $1_descriptor);
+}
- SWIGSTATIC CAML_VALUE caml_val_ulong( unsigned long ul ) {
- CAMLparam0();
- SWIG_CAMLlocal1(ulv);
- ulv = caml_swig_alloc(1,C_int64);
- SWIG_Store_field(ulv,0,copy_int64(ul));
- CAMLreturn(ulv);
+#if 0
+%typemap(argout) SWIGTYPE & {
+ CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+ if( fromval ) {
+ swig_result =
+ caml_list_append(swig_result,
+ caml_callback(*fromval,caml_val_ptr((void *) $1,
+ $1_descriptor)));
+ } else {
+ swig_result =
+ caml_list_append(swig_result,
+ caml_val_ptr ((void *) $1,$1_descriptor));
}
-
- SWIGSTATIC CAML_VALUE caml_val_float( float f ) {
- CAMLparam0();
- SWIG_CAMLlocal1(fv);
- fv = caml_swig_alloc(1,C_float);
- SWIG_Store_field(fv,0,copy_double((double)f));
- CAMLreturn(fv);
+}
+%typemap(argout) SWIGTYPE && {
+ CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+ if( fromval ) {
+ swig_result =
+ caml_list_append(swig_result,
+ caml_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
- SWIGSTATIC CAML_VALUE caml_val_double( double d ) {
- CAMLparam0();
- SWIG_CAMLlocal1(fv);
- fv = caml_swig_alloc(1,C_double);
- SWIG_Store_field(fv,0,copy_double(d));
- CAMLreturn(fv);
- }
+%typemap(in) SWIGTYPE {
+ $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ;
+}
- SWIGSTATIC CAML_VALUE caml_val_ptr( void *p, swig_type_info *info ) {
- CAMLparam0();
- SWIG_CAMLlocal1(vv);
- vv = caml_swig_alloc(2,C_ptr);
- SWIG_Store_field(vv,0,copy_int64((long)p));
- SWIG_Store_field(vv,1,copy_int64((long)info));
- CAMLreturn(vv);
- }
+#ifdef __cplusplus
- SWIGSTATIC CAML_VALUE caml_val_string( const char *p ) {
- CAMLparam0();
- SWIG_CAMLlocal1(vv);
- if( !p ) CAMLreturn(caml_val_ptr( (void *)p, 0 ));
- vv = caml_swig_alloc(1,C_string);
- SWIG_Store_field(vv,0,copy_string(p));
- CAMLreturn(vv);
- }
+%typemap(out) SWIGTYPE {
+ $&1_ltype temp = new $ltype((const $1_ltype &) $1);
+ $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)temp, $&1_descriptor);
+}
- SWIGSTATIC CAML_VALUE caml_val_string_len( const char *p, int len ) {
- CAMLparam0();
- SWIG_CAMLlocal1(vv);
- if( !p || len < 0 ) CAMLreturn(caml_val_ptr( (void *)p, 0 ));
- vv = caml_swig_alloc(1,C_string);
- SWIG_Store_field(vv,0,alloc_string(len));
- memcpy(String_val(SWIG_Field(vv,0)),p,len);
- CAMLreturn(vv);
- }
+#else
- #define caml_val_obj(v, name) caml_val_obj_helper(v, SWIG_TypeQuery((name)), name)
- SWIGSTATIC CAML_VALUE caml_val_obj_helper( void *v, swig_type_info *type, char *name) {
- CAMLparam0();
- CAMLreturn(callback2(*caml_named_value("caml_create_object_fn"),
- caml_val_ptr(v,type),
- copy_string(name)));
- }
+%typemap(out) SWIGTYPE {
+ void *temp = calloc(1,sizeof($ltype));
+ memmove(temp, &$1, sizeof($1_type));
+ $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", temp, $&1_descriptor);
+}
- SWIGSTATIC long caml_long_val_full( CAML_VALUE v, char *name ) {
- CAMLparam1(v);
- if( !Is_block(v) ) return 0;
-
- switch( SWIG_Tag_val(v) ) {
- case C_bool:
- case C_char:
- case C_uchar:
- case C_short:
- case C_ushort:
- case C_int:
- CAMLreturn(Int_val(SWIG_Field(v,0)));
- case C_uint:
- case C_int32:
- CAMLreturn(Int32_val(SWIG_Field(v,0)));
- case C_int64:
- CAMLreturn((long)SWIG_Int64_val(SWIG_Field(v,0)));
- case C_float:
- case C_double:
- CAMLreturn((long)Double_val(SWIG_Field(v,0)));
- case C_string:
- CAMLreturn((long)String_val(SWIG_Field(v,0)));
- case C_ptr:
- CAMLreturn((long)SWIG_Int64_val(SWIG_Field(SWIG_Field(v,0),0)));
- case C_enum: {
- SWIG_CAMLlocal1(ret);
- CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
- if( !name ) failwith( "Not an enum conversion" );
- ret = callback2(*enum_to_int,*caml_named_value(name),v);
- CAMLreturn(caml_long_val(ret));
- }
- default:
- failwith("No conversion to int");
- }
- }
+#endif
- SWIGSTATIC long caml_long_val( CAML_VALUE v ) {
- return caml_long_val_full(v,0);
- }
+%typemap(directorin) SWIGTYPE {
+ $&ltype temp = new $ltype((const $ltype &)$1);
+ swig_result = SWIG_Ocaml_ptr_to_val("create_$ltype_from_ptr", (void *)temp, $&1_descriptor);
+ args = caml_list_append(args, swig_result);
+}
- SWIGSTATIC double caml_double_val( CAML_VALUE v ) {
- CAMLparam1(v);
- if( !Is_block(v) ) return 0.0;
- switch( SWIG_Tag_val(v) ) {
- case C_bool:
- case C_char:
- case C_uchar:
- case C_short:
- case C_ushort:
- case C_int:
- CAMLreturn_type(Int_val(SWIG_Field(v,0)));
- case C_uint:
- case C_int32:
- CAMLreturn_type(Int32_val(SWIG_Field(v,0)));
- case C_int64:
- CAMLreturn_type(SWIG_Int64_val(SWIG_Field(v,0)));
- case C_float:
- case C_double:
- CAMLreturn_type(Double_val(SWIG_Field(v,0)));
- default:
- fprintf( stderr, "Unknown block tag %d\n", SWIG_Tag_val(v) );
- failwith("No conversion to double");
- }
- }
+%typemap(directorin) SWIGTYPE *, SWIGTYPE [], SWIGTYPE &, SWIGTYPE && {
+ swig_result = SWIG_Ocaml_ptr_to_val("create_$ltype_from_ptr", (void *)&$1, $&1_descriptor);
+ args = caml_list_append(args, swig_result);
+}
- SWIGSTATIC int caml_ptr_val_internal( CAML_VALUE v, void **out,
- swig_type_info *descriptor ) {
- CAMLparam1(v);
- void *outptr = NULL;
- swig_type_info *outdescr = NULL;
-
- if( v == Val_unit ) {
- *out = 0;
- CAMLreturn(0);
- }
- if( !Is_block(v) ) return -1;
- switch( SWIG_Tag_val(v) ) {
- case C_int:
- if( !caml_long_val( v ) ) {
- *out = 0;
- CAMLreturn(0);
- } else {
- *out = 0;
- CAMLreturn(1);
- }
- break;
- case C_obj:
- CAMLreturn
- (caml_ptr_val_internal
- (callback(*caml_named_value("caml_obj_ptr"),v),
- out,descriptor));
- case C_string:
- outptr = (void *)String_val(SWIG_Field(v,0));
- break;
- case C_ptr:
- outptr = (void *)(long)SWIG_Int64_val(SWIG_Field(v,0));
- outdescr = (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field(v,1));
- break;
- default:
- *out = 0;
- CAMLreturn(1);
- break;
- }
-
- CAMLreturn(SWIG_GetPtr(outptr,out,outdescr,descriptor));
- }
+/* The SIMPLE_MAP macro below defines the whole set of typemaps needed
+ for simple types. */
- SWIGSTATIC void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor ) {
- CAMLparam0();
-#ifdef TYPE_CAST_VERBOSE
- caml_print_val( v );
+%define SIMPLE_MAP(C_NAME, C_TO_OCAML, OCAML_TO_C)
+/* In */
+%typemap(in) C_NAME {
+ $1 = OCAML_TO_C($input);
+}
+%typemap(varin) C_NAME {
+ $1 = OCAML_TO_C($input);
+}
+%typemap(in) const C_NAME & ($*1_ltype temp) {
+ temp = ($*1_ltype) OCAML_TO_C($input);
+ $1 = &temp;
+}
+%typemap(varin) const C_NAME & {
+ $1 = OCAML_TO_C($input);
+}
+%typemap(directorout) C_NAME {
+ $1 = OCAML_TO_C($input);
+}
+/* Out */
+%typemap(out) C_NAME {
+ $result = C_TO_OCAML($1);
+}
+%typemap(varout) C_NAME {
+ $result = C_TO_OCAML($1);
+}
+%typemap(varout) const C_NAME & {
+ $result = C_TO_OCAML($1);
+}
+%typemap(out) const C_NAME & {
+ $result = C_TO_OCAML(*$1);
+}
+%typemap(directorin) C_NAME {
+ args = caml_list_append(args, C_TO_OCAML($1));
+}
+%enddef
+
+SIMPLE_MAP(bool, caml_val_bool, caml_long_val);
+SIMPLE_MAP(char, caml_val_char, caml_long_val);
+SIMPLE_MAP(signed char, caml_val_char, caml_long_val);
+SIMPLE_MAP(unsigned char, caml_val_uchar, caml_long_val);
+SIMPLE_MAP(int, caml_val_int, caml_long_val);
+SIMPLE_MAP(short, caml_val_short, caml_long_val);
+SIMPLE_MAP(wchar_t, caml_val_short, caml_long_val);
+SIMPLE_MAP(long, caml_val_long, caml_long_val);
+SIMPLE_MAP(ptrdiff_t, caml_val_int, caml_long_val);
+SIMPLE_MAP(unsigned int, caml_val_uint, caml_long_val);
+SIMPLE_MAP(unsigned short, caml_val_ushort, caml_long_val);
+SIMPLE_MAP(unsigned long, caml_val_ulong, caml_long_val);
+SIMPLE_MAP(size_t, caml_val_int, caml_long_val);
+SIMPLE_MAP(float, caml_val_float, caml_double_val);
+SIMPLE_MAP(double, caml_val_double, caml_double_val);
+SIMPLE_MAP(long long,caml_val_ulong,caml_long_val);
+SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
+
+/* Void */
+
+%typemap(out) void "$result = Val_unit;";
+
+/* Pass through value */
+
+%typemap (in) CAML_VALUE "$1=$input;";
+%typemap (out) CAML_VALUE "$result=$1;";
+
+#if 0
+%include <carray.i>
#endif
- void *out = NULL;
- if( !caml_ptr_val_internal( v, &out, descriptor ) )
- CAMLreturn_type(out);
- else
- failwith( "No appropriate conversion found." );
- }
- SWIGSTATIC char *caml_string_val( CAML_VALUE v ) {
- return (char *)caml_ptr_val( v, 0 );
- }
+/* Handle char arrays as strings */
- SWIGSTATIC int caml_string_len( CAML_VALUE v ) {
- switch( SWIG_Tag_val(v) ) {
- case C_string:
- return string_length(SWIG_Field(v,0));
- default:
- return strlen((char *)caml_ptr_val(v,0));
- }
- }
+%define %char_ptr_in(how)
+%typemap(how) char *, signed char *, unsigned char * {
+ $1 = ($ltype)caml_string_val($input);
+}
+/* Again work around the empty array bound bug */
+%typemap(how) char [ANY], signed char [ANY], unsigned char [ANY] {
+ char *temp = caml_string_val($input);
+ strcpy((char *)$1,temp);
+}
+%enddef
- SWIGSTATIC int caml_bool_check( CAML_VALUE v ) {
- CAMLparam1(v);
-
- if( !Is_block(v) ) return 0;
-
- switch( SWIG_Tag_val(v) ) {
- case C_bool:
- case C_ptr:
- case C_string:
- CAMLreturn(1);
- default:
- CAMLreturn(0);
- }
- }
+%char_ptr_in(in);
+%char_ptr_in(varin);
+%char_ptr_in(directorout);
- SWIGSTATIC int caml_int_check( CAML_VALUE v ) {
- CAMLparam1(v);
-
- if( !Is_block(v) ) return 0;
-
- switch( SWIG_Tag_val(v) ) {
- case C_char:
- case C_uchar:
- case C_short:
- case C_ushort:
- case C_int:
- case C_uint:
- case C_int32:
- case C_int64:
- CAMLreturn(1);
-
- default:
- CAMLreturn(0);
- }
- }
+%define %char_ptr_out(how)
+%typemap(how)
+ char *, signed char *, unsigned char *,
+ const char *, const signed char *, const unsigned char * {
+ $result = caml_val_string((char *)$1);
+}
+/* I'd like to use the length here but can't because it might be empty */
+%typemap(how)
+ char [ANY], signed char [ANY], unsigned char [ANY],
+ const char [ANY], const signed char [ANY], const unsigned char [ANY] {
+ $result = caml_val_string((char *)$1);
+}
+%enddef
- SWIGSTATIC int caml_float_check( CAML_VALUE v ) {
- CAMLparam1(v);
- if( !Is_block(v) ) return 0;
+%char_ptr_out(out);
+%char_ptr_out(varout);
+%char_ptr_out(directorin);
- switch( SWIG_Tag_val(v) ) {
- case C_float:
- case C_double:
- CAMLreturn(1);
+%define %swigtype_ptr_in(how)
+%typemap(how) SWIGTYPE * {
+ $1 = ($ltype)caml_ptr_val($input,$1_descriptor);
+}
+%typemap(how) SWIGTYPE (CLASS::*) {
+ void *v = caml_ptr_val($input,$1_descriptor);
+ memcpy(& $1, &v, sizeof(v));
+}
+%enddef
- default:
- CAMLreturn(0);
- }
- }
+%typemap(out) SWIGTYPE * {
+ $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)$1, $1_descriptor);
+}
- SWIGSTATIC int caml_ptr_check( CAML_VALUE v ) {
- CAMLparam1(v);
- if( !Is_block(v) ) return 0;
+%define %swigtype_ptr_out(how)
+%typemap(how) SWIGTYPE (CLASS::*) {
+ void *v;
+ memcpy(&v,& $1, sizeof(void *));
+ $result = caml_val_ptr (v,$1_descriptor);
+}
+%enddef
+
+%swigtype_ptr_in(in);
+%swigtype_ptr_in(varin);
+%swigtype_ptr_in(directorout);
+%swigtype_ptr_out(out);
+%swigtype_ptr_out(varout);
+%swigtype_ptr_out(directorin);
+
+%define %swigtype_array_fail(how,msg)
+%typemap(how) SWIGTYPE [] {
+ caml_failwith(msg);
+}
+%enddef
- switch( SWIG_Tag_val(v) ) {
- case C_string:
- case C_ptr:
- case C_int64:
- CAMLreturn(1);
+%swigtype_array_fail(in,"Array arguments for arbitrary types need a typemap");
+%swigtype_array_fail(varin,"Assignment to global arrays for arbitrary types need a typemap");
+%swigtype_array_fail(out,"Array arguments for arbitrary types need a typemap");
+%swigtype_array_fail(varout,"Array variables need a typemap");
+%swigtype_array_fail(directorin,"Array results with arbitrary types need a typemap");
+%swigtype_array_fail(directorout,"Array arguments with arbitrary types need a typemap");
- default:
- CAMLreturn(0);
- }
- }
+/* C++ References */
- static swig_module_info *SWIG_Ocaml_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
- CAML_VALUE pointer;
+/* Enums */
+%define %swig_enum_in(how)
+%typemap(how) enum SWIGTYPE {
+ $1 = ($type)caml_long_val_full($input,"$type_marker");
+}
+%enddef
- pointer = callback(*caml_named_value("swig_find_type_info"), caml_val_int(0));
- if (Is_block(pointer) && SWIG_Tag_val(pointer) == C_ptr) {
- return (swig_module_info *)(void *)(long)SWIG_Int64_val(SWIG_Field(pointer,0));
- }
- return 0;
- }
+%define %swig_enum_out(how)
+%typemap(how) enum SWIGTYPE {
+ $result = caml_callback2(*caml_named_value(SWIG_MODULE "_int_to_enum"),*caml_named_value("$type_marker"),Val_int((int)$1));
+}
+%enddef
+
+%swig_enum_in(in)
+%swig_enum_in(varin)
+%swig_enum_in(directorout)
+%swig_enum_out(out)
+%swig_enum_out(varout)
+%swig_enum_out(directorin)
+
+%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
+ $1 = ($1_ltype) caml_string_val($input);
+ $2 = ($2_ltype) caml_string_len($input);
+}
- static void SWIG_Ocaml_SetModule(swig_module_info *pointer) {
- CAML_VALUE mod_pointer;
+%typemap(out) SWIGTYPE *DYNAMIC, SWIGTYPE &DYNAMIC {
+ swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **)&$1);
+ $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)$1, ty);
+}
- mod_pointer = caml_val_ptr(pointer, NULL);
- callback(*caml_named_value("swig_set_type_info"), mod_pointer);
- }
+/* Array reference typemaps */
+%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
+%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) }
-#ifdef __cplusplus
-}
-#endif
-#undef value
+/* const pointers */
+%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
diff --git a/Lib/ocaml/ocamlkw.swg b/Lib/ocaml/ocamlkw.swg
index 92d822219..5e66085e0 100644
--- a/Lib/ocaml/ocamlkw.swg
+++ b/Lib/ocaml/ocamlkw.swg
@@ -6,12 +6,13 @@
/*
from
- http://caml.inria.fr/ocaml/htmlman/manual044.html
+ https://caml.inria.fr/pub/docs/manual-ocaml/lex.html
*/
OCAMLKW(and);
OCAMLKW(as);
+OCAMLKW(asr);
OCAMLKW(assert);
OCAMLKW(begin);
OCAMLKW(class);
@@ -33,13 +34,20 @@ OCAMLKW(in);
OCAMLKW(include);
OCAMLKW(inherit);
OCAMLKW(initializer);
+OCAMLKW(land);
OCAMLKW(lazy);
OCAMLKW(let);
+OCAMLKW(lor);
+OCAMLKW(lsl);
+OCAMLKW(lsr);
+OCAMLKW(lxor);
OCAMLKW(match);
OCAMLKW(method);
+OCAMLKW(mod);
OCAMLKW(module);
OCAMLKW(mutable);
OCAMLKW(new);
+OCAMLKW(nonrec);
OCAMLKW(object);
OCAMLKW(of);
OCAMLKW(open);
diff --git a/Lib/ocaml/ocamlrun.swg b/Lib/ocaml/ocamlrun.swg
new file mode 100644
index 000000000..3d552cc50
--- /dev/null
+++ b/Lib/ocaml/ocamlrun.swg
@@ -0,0 +1,607 @@
+/* -*-c-*- */
+
+/* SWIG pointer structure */
+
+#include <string.h>
+#include <assert.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define C_bool 0
+#define C_char 1
+#define C_uchar 2
+#define C_short 3
+#define C_ushort 4
+#define C_int 5
+#define C_uint 6
+#define C_int32 7
+#define C_int64 8
+#define C_float 9
+#define C_double 10
+#define C_ptr 11
+#define C_array 12
+#define C_list 13
+#define C_obj 14
+#define C_string 15
+#define C_enum 16
+#define C_director_core 17
+
+
+/* Cast a pointer if possible; returns 1 if successful */
+
+ SWIGINTERN int
+ SWIG_Cast (void *source, swig_type_info *source_type,
+ void **ptr, swig_type_info *dest_type)
+ {
+ if( !source ) { /* Special case for NULL. This is a popular question
+ for other modules on the list, so I want an easy way out... */
+ *ptr = 0;
+ return 0;
+ }
+
+#ifdef TYPE_CAST_VERBOSE
+ fprintf( stderr, "Trying to cast %s to %s\n",
+ source_type ? source_type->str : "<none>",
+ dest_type ? dest_type->str : "<none>" );
+#endif
+ if (dest_type != source_type) {
+ /* We have a type mismatch. Will have to look through our type
+ mapping table to figure out whether or not we can accept this
+ datatype.
+ --
+ Ignore typechecks for void *. Allow any conversion. */
+ if( !dest_type || !source_type ||
+ !strcmp(dest_type->name,"_p_void") ||
+ !strcmp(source_type->name,"_p_void") ) {
+ *ptr = source;
+ return 0;
+ } else {
+ swig_cast_info *tc =
+ SWIG_TypeCheckStruct(source_type, dest_type );
+#ifdef TYPE_CAST_VERBOSE
+ fprintf( stderr, "Typecheck -> %s\n",
+ tc ? tc->type->str : "<none>" );
+#endif
+ if( tc ) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, source, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ return 0;
+ } else
+ return -1;
+ }
+ } else {
+ *ptr = source;
+ return 0;
+ }
+ }
+
+/* Return 0 if successful. */
+ SWIGINTERN int
+ SWIG_GetPtr(void *inptr, void **outptr,
+ swig_type_info *intype, swig_type_info *outtype) {
+ if (intype) {
+ return SWIG_Cast(inptr, intype,
+ outptr, outtype) == -1;
+ } else {
+ *outptr = inptr;
+ return 0;
+ }
+ }
+
+ SWIGINTERN void caml_print_list( CAML_VALUE v );
+
+ SWIGINTERN void caml_print_val( CAML_VALUE v ) {
+ switch( SWIG_Tag_val(v) ) {
+ case C_bool:
+ if( Bool_val(SWIG_Field(v,0)) ) fprintf( stderr, "true " );
+ else fprintf( stderr, "false " );
+ break;
+ case C_char:
+ case C_uchar:
+ fprintf( stderr, "'%c' (\\%03d) ",
+ (Int_val(SWIG_Field(v,0)) >= ' ' &&
+ Int_val(SWIG_Field(v,0)) < 127) ? Int_val(SWIG_Field(v,0)) : '.',
+ Int_val(SWIG_Field(v,0)) );
+ break;
+ case C_short:
+ case C_ushort:
+ case C_int:
+ fprintf( stderr, "%d ", (int)caml_long_val(v) );
+ break;
+
+ case C_uint:
+ case C_int32:
+ fprintf( stderr, "%ud ", (unsigned int)caml_long_val(v) );
+ break;
+ case C_int64:
+ fprintf( stderr, "%ld ", caml_long_val(v) );
+ break;
+ case C_float:
+ case C_double:
+ fprintf( stderr, "%f ", caml_double_val(v) );
+ break;
+
+ case C_ptr:
+ {
+ void *vout = 0;
+ swig_type_info *ty = (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field(v,1));
+ caml_ptr_val_internal(v,&vout,0);
+ fprintf( stderr, "PTR(%p,%s) ",
+ vout,
+ ty ? ty->name : "(null)" );
+ }
+ break;
+ case C_array:
+ {
+ unsigned int i;
+ for( i = 0; i < Wosize_val( SWIG_Field(v,0) ); i++ )
+ caml_print_val( SWIG_Field(SWIG_Field(v,0),i) );
+ }
+ break;
+ case C_list:
+ caml_print_list( SWIG_Field(v,0) );
+ break;
+ case C_obj:
+ fprintf( stderr, "OBJ(%p) ", (void *)SWIG_Field(v,0) );
+ break;
+ case C_string:
+ {
+ void *cout;
+ caml_ptr_val_internal(v,&cout,0);
+ fprintf( stderr, "'%s' ", (char *)cout );
+ }
+ break;
+ }
+ }
+
+ SWIGINTERN void caml_print_list( CAML_VALUE v ) {
+ CAMLparam1(v);
+ while( v && Is_block(v) ) {
+ fprintf( stderr, "[ " );
+ caml_print_val( SWIG_Field(v,0) );
+ fprintf( stderr, "]\n" );
+ v = SWIG_Field(v,1);
+ }
+ CAMLreturn0;
+ }
+
+ SWIGINTERN CAML_VALUE caml_list_nth( CAML_VALUE lst, int n ) {
+ CAMLparam1(lst);
+ int i = 0;
+ while( i < n && lst && Is_block(lst) ) {
+ i++; lst = SWIG_Field(lst,1);
+ }
+ if( lst == Val_unit ) CAMLreturn(Val_unit);
+ else CAMLreturn(SWIG_Field(lst,0));
+ }
+
+ SWIGINTERN CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt ) {
+ CAMLparam2(lst,elt);
+ SWIG_CAMLlocal3(v,vt,lh);
+ lh = Val_unit;
+ v = Val_unit;
+
+ /* Appending C_void should have no effect */
+ if( !Is_block(elt) ) return lst;
+
+ while( lst && Is_block(lst) ) {
+ if( v && v != Val_unit ) {
+ vt = caml_alloc_tuple(2);
+ SWIG_Store_field(v,1,vt);
+ v = vt;
+ } else {
+ v = lh = caml_alloc_tuple(2);
+ }
+ SWIG_Store_field(v,0,SWIG_Field(lst,0));
+ lst = SWIG_Field(lst,1);
+ }
+
+ if( v && Is_block(v) ) {
+ vt = caml_alloc_tuple(2);
+ SWIG_Store_field(v,1,vt);
+ v = vt;
+ } else {
+ v = lh = caml_alloc_tuple(2);
+ }
+ SWIG_Store_field(v,0,elt);
+ SWIG_Store_field(v,1,Val_unit);
+
+ CAMLreturn(lh);
+ }
+
+ SWIGINTERN int caml_list_length( CAML_VALUE lst ) {
+ CAMLparam1(lst);
+ int i = 0;
+ while( lst && Is_block(lst) ) { i++; lst = SWIG_Field(lst,1); }
+ CAMLreturn(i);
+ }
+
+ SWIGINTERN void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item ) {
+ CAMLparam2(arr,item);
+ SWIG_Store_field(SWIG_Field(arr,0),n,item);
+ CAMLreturn0;
+ }
+
+ SWIGINTERN value caml_array_nth( CAML_VALUE arr, int n ) {
+ CAMLparam1(arr);
+ if( SWIG_Tag_val(arr) == C_array )
+ CAMLreturn(SWIG_Field(SWIG_Field(arr,0),n));
+ else if( SWIG_Tag_val(arr) == C_list )
+ CAMLreturn(caml_list_nth(arr,0));
+ else
+ caml_failwith("Need array or list");
+ }
+
+ SWIGINTERN int caml_array_len( CAML_VALUE arr ) {
+ CAMLparam1(arr);
+ if( SWIG_Tag_val(arr) == C_array )
+ CAMLreturn(Wosize_val(SWIG_Field(arr,0)));
+ else if( SWIG_Tag_val(arr) == C_list )
+ CAMLreturn(caml_list_length(arr));
+ else
+ caml_failwith("Need array or list");
+ }
+
+ SWIGINTERN CAML_VALUE caml_swig_alloc(int x,int y) {
+ return caml_alloc(x,y);
+ }
+
+ SWIGINTERN value caml_array_new( int n ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(vv);
+ vv = caml_swig_alloc(1,C_array);
+ SWIG_Store_field(vv,0,caml_alloc_tuple(n));
+ CAMLreturn(vv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_bool( int b ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(bv);
+ bv = caml_swig_alloc(1,C_bool);
+ SWIG_Store_field(bv,0,Val_bool(b));
+ CAMLreturn(bv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_char( char c ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(cv);
+ cv = caml_swig_alloc(1,C_char);
+ SWIG_Store_field(cv,0,Val_int(c));
+ CAMLreturn(cv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_uchar( unsigned char uc ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(ucv);
+ ucv = caml_swig_alloc(1,C_uchar);
+ SWIG_Store_field(ucv,0,Val_int(uc));
+ CAMLreturn(ucv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_short( short s ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(sv);
+ sv = caml_swig_alloc(1,C_short);
+ SWIG_Store_field(sv,0,Val_int(s));
+ CAMLreturn(sv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_ushort( unsigned short us ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(usv);
+ usv = caml_swig_alloc(1,C_ushort);
+ SWIG_Store_field(usv,0,Val_int(us));
+ CAMLreturn(usv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_int( int i ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(iv);
+ iv = caml_swig_alloc(1,C_int);
+ SWIG_Store_field(iv,0,Val_int(i));
+ CAMLreturn(iv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_uint( unsigned int ui ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(uiv);
+ uiv = caml_swig_alloc(1,C_int);
+ SWIG_Store_field(uiv,0,Val_int(ui));
+ CAMLreturn(uiv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_long( long l ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(lv);
+ lv = caml_swig_alloc(1,C_int64);
+ SWIG_Store_field(lv,0,caml_copy_int64(l));
+ CAMLreturn(lv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_ulong( unsigned long ul ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(ulv);
+ ulv = caml_swig_alloc(1,C_int64);
+ SWIG_Store_field(ulv,0,caml_copy_int64(ul));
+ CAMLreturn(ulv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_float( float f ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(fv);
+ fv = caml_swig_alloc(1,C_float);
+ SWIG_Store_field(fv,0,caml_copy_double((double)f));
+ CAMLreturn(fv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_double( double d ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(fv);
+ fv = caml_swig_alloc(1,C_double);
+ SWIG_Store_field(fv,0,caml_copy_double(d));
+ CAMLreturn(fv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_ptr( void *p, swig_type_info *info ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(vv);
+ vv = caml_swig_alloc(2,C_ptr);
+ SWIG_Store_field(vv,0,caml_copy_int64((long)p));
+ SWIG_Store_field(vv,1,caml_copy_int64((long)info));
+ CAMLreturn(vv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_string( const char *p ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(vv);
+ if( !p ) CAMLreturn(caml_val_ptr( (void *)p, 0 ));
+ vv = caml_swig_alloc(1,C_string);
+ SWIG_Store_field(vv,0,caml_copy_string(p));
+ CAMLreturn(vv);
+ }
+
+ SWIGINTERN CAML_VALUE caml_val_string_len( const char *p, int len ) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(vv);
+ if( !p || len < 0 ) CAMLreturn(caml_val_ptr( (void *)p, 0 ));
+ vv = caml_swig_alloc(1,C_string);
+ SWIG_Store_field(vv,0,caml_alloc_string(len));
+ memcpy(String_val(SWIG_Field(vv,0)),p,len);
+ CAMLreturn(vv);
+ }
+
+ #define caml_val_obj(v, name) caml_val_obj_helper(v, SWIG_TypeQuery((name)), name)
+ SWIGINTERN CAML_VALUE caml_val_obj_helper( void *v, swig_type_info *type, char *name) {
+ CAMLparam0();
+ CAMLreturn(caml_callback2(*caml_named_value("caml_create_object_fn"),
+ caml_val_ptr(v,type),
+ caml_copy_string(name)));
+ }
+
+ SWIGINTERN long caml_long_val_full( CAML_VALUE v, const char *name ) {
+ CAMLparam1(v);
+ if( !Is_block(v) ) return 0;
+
+ switch( SWIG_Tag_val(v) ) {
+ case C_bool:
+ case C_char:
+ case C_uchar:
+ case C_short:
+ case C_ushort:
+ case C_int:
+ CAMLreturn(Int_val(SWIG_Field(v,0)));
+ case C_uint:
+ case C_int32:
+ CAMLreturn(Int32_val(SWIG_Field(v,0)));
+ case C_int64:
+ CAMLreturn((long)SWIG_Int64_val(SWIG_Field(v,0)));
+ case C_float:
+ case C_double:
+ CAMLreturn((long)Double_val(SWIG_Field(v,0)));
+ case C_string:
+ CAMLreturn((long)String_val(SWIG_Field(v,0)));
+ case C_ptr:
+ CAMLreturn((long)SWIG_Int64_val(SWIG_Field(SWIG_Field(v,0),0)));
+ case C_enum: {
+ SWIG_CAMLlocal1(ret);
+ CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
+ if( !name ) caml_failwith( "Not an enum conversion" );
+ ret = caml_callback2(*enum_to_int,*caml_named_value(name),v);
+ CAMLreturn(caml_long_val(ret));
+ }
+ default:
+ caml_failwith("No conversion to int");
+ }
+ }
+
+ SWIGINTERN long caml_long_val( CAML_VALUE v ) {
+ return caml_long_val_full(v,0);
+ }
+
+ SWIGINTERN double caml_double_val( CAML_VALUE v ) {
+ CAMLparam1(v);
+ if( !Is_block(v) ) return 0.0;
+ switch( SWIG_Tag_val(v) ) {
+ case C_bool:
+ case C_char:
+ case C_uchar:
+ case C_short:
+ case C_ushort:
+ case C_int:
+ CAMLreturn_type(Int_val(SWIG_Field(v,0)));
+ case C_uint:
+ case C_int32:
+ CAMLreturn_type(Int32_val(SWIG_Field(v,0)));
+ case C_int64:
+ CAMLreturn_type(SWIG_Int64_val(SWIG_Field(v,0)));
+ case C_float:
+ case C_double:
+ CAMLreturn_type(Double_val(SWIG_Field(v,0)));
+ default:
+ fprintf( stderr, "Unknown block tag %d\n", SWIG_Tag_val(v) );
+ caml_failwith("No conversion to double");
+ }
+ }
+
+ SWIGINTERN int caml_ptr_val_internal( CAML_VALUE v, void **out,
+ swig_type_info *descriptor ) {
+ CAMLparam1(v);
+ void *outptr = NULL;
+ swig_type_info *outdescr = NULL;
+ static CAML_VALUE *func_val = NULL;
+
+ if( v == Val_unit ) {
+ *out = 0;
+ CAMLreturn_type(0);
+ }
+ if( !Is_block(v) ) return -1;
+ switch( SWIG_Tag_val(v) ) {
+ case C_obj:
+ if (!func_val) {
+ func_val = caml_named_value("caml_obj_ptr");
+ }
+ CAMLreturn_type(caml_ptr_val_internal(caml_callback(*func_val, v), out, descriptor));
+ case C_string:
+ outptr = (void *)String_val(SWIG_Field(v,0));
+ break;
+ case C_ptr:
+ outptr = (void *)(long)SWIG_Int64_val(SWIG_Field(v,0));
+ outdescr = (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field(v,1));
+ break;
+ default:
+ *out = 0;
+ CAMLreturn_type(1);
+ break;
+ }
+
+ CAMLreturn_type(SWIG_GetPtr(outptr, out, outdescr, descriptor));
+ }
+
+ SWIGINTERN void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor ) {
+ CAMLparam0();
+#ifdef TYPE_CAST_VERBOSE
+ caml_print_val( v );
+#endif
+ void *out = NULL;
+ if( !caml_ptr_val_internal( v, &out, descriptor ) )
+ CAMLreturn_type(out);
+ else
+ caml_failwith( "No appropriate conversion found." );
+ }
+
+ SWIGINTERN char *caml_string_val( CAML_VALUE v ) {
+ return (char *)caml_ptr_val( v, 0 );
+ }
+
+ SWIGINTERN int caml_string_len( CAML_VALUE v ) {
+ switch( SWIG_Tag_val(v) ) {
+ case C_string:
+ return caml_string_length(SWIG_Field(v,0));
+ default:
+ return strlen((char *)caml_ptr_val(v,0));
+ }
+ }
+
+ SWIGINTERN int caml_bool_check( CAML_VALUE v ) {
+ CAMLparam1(v);
+
+ if( !Is_block(v) ) return 0;
+
+ switch( SWIG_Tag_val(v) ) {
+ case C_bool:
+ case C_ptr:
+ case C_string:
+ CAMLreturn(1);
+ default:
+ CAMLreturn(0);
+ }
+ }
+
+ SWIGINTERN int caml_int_check( CAML_VALUE v ) {
+ CAMLparam1(v);
+
+ if( !Is_block(v) ) return 0;
+
+ switch( SWIG_Tag_val(v) ) {
+ case C_char:
+ case C_uchar:
+ case C_short:
+ case C_ushort:
+ case C_int:
+ case C_uint:
+ case C_int32:
+ case C_int64:
+ CAMLreturn(1);
+
+ default:
+ CAMLreturn(0);
+ }
+ }
+
+ SWIGINTERN int caml_float_check( CAML_VALUE v ) {
+ CAMLparam1(v);
+ if( !Is_block(v) ) return 0;
+
+ switch( SWIG_Tag_val(v) ) {
+ case C_float:
+ case C_double:
+ CAMLreturn(1);
+
+ default:
+ CAMLreturn(0);
+ }
+ }
+
+ SWIGINTERN int caml_ptr_check( CAML_VALUE v ) {
+ CAMLparam1(v);
+ if( !Is_block(v) ) return 0;
+
+ switch( SWIG_Tag_val(v) ) {
+ case C_string:
+ case C_ptr:
+ case C_int64:
+ CAMLreturn(1);
+
+ default:
+ CAMLreturn(0);
+ }
+ }
+
+ SWIGINTERN CAML_VALUE SWIG_Ocaml_ptr_to_val(const char *name, void *ptr, swig_type_info *descriptor) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(result);
+
+ CAML_VALUE *fromval = caml_named_value(name);
+ if (fromval) {
+ result = caml_callback(*fromval, caml_val_ptr(ptr, descriptor));
+ } else {
+ result = caml_val_ptr(ptr, descriptor);
+ }
+ CAMLreturn(result);
+ }
+
+ static swig_module_info *SWIG_Ocaml_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+ CAML_VALUE pointer;
+
+ pointer = caml_callback(*caml_named_value("swig_find_type_info"), caml_val_int(0));
+ if (Is_block(pointer) && SWIG_Tag_val(pointer) == C_ptr) {
+ return (swig_module_info *)(void *)(long)SWIG_Int64_val(SWIG_Field(pointer,0));
+ }
+ return 0;
+ }
+
+ static void SWIG_Ocaml_SetModule(swig_module_info *pointer) {
+ CAML_VALUE mod_pointer;
+
+ mod_pointer = caml_val_ptr(pointer, NULL);
+ caml_callback(*caml_named_value("swig_set_type_info"), mod_pointer);
+ }
+
+#ifdef __cplusplus
+}
+#endif
+#undef value
+
diff --git a/Lib/ocaml/ocamldec.swg b/Lib/ocaml/ocamlrundec.swg
index 96e1cd2ce..555f9a44f 100644
--- a/Lib/ocaml/ocamldec.swg
+++ b/Lib/ocaml/ocamlrundec.swg
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------------
- * ocamldec.swg
+ * ocamlrundec.swg
*
* Ocaml runtime code -- declarations
* ----------------------------------------------------------------------------- */
@@ -16,6 +16,7 @@ SWIGEXT {
#endif
#define value caml_value_t
#define CAML_VALUE caml_value_t
+#define CAML_NAME_SPACE
#include <caml/alloc.h>
#include <caml/custom.h>
#include <caml/mlvalues.h>
@@ -24,9 +25,16 @@ SWIGEXT {
#include <caml/fail.h>
#include <caml/misc.h>
+#if defined(CAMLassert)
+/* Both this macro and version.h were introduced in version 4.02.0 */
+#include <caml/version.h>
+#else
+#define OCAML_VERSION 0 /* Unknown, but < 40200 */
+#endif
+
#define caml_array_set swig_caml_array_set
-// Adapted from memory.h and mlvalues.h
+/* Adapted from memory.h and mlvalues.h */
#define SWIG_CAMLlocal1(x) \
caml_value_t x = 0; \
@@ -56,7 +64,7 @@ SWIGEXT {
#define SWIG_Store_field(block, offset, val) do{ \
mlsize_t caml__temp_offset = (offset); \
caml_value_t caml__temp_val = (val); \
- modify (&SWIG_Field ((block), caml__temp_offset), caml__temp_val); \
+ caml_modify (&SWIG_Field ((block), caml__temp_offset), caml__temp_val); \
}while(0)
#define SWIG_Data_custom_val(v) ((void *) &SWIG_Field((v), 1))
@@ -101,9 +109,17 @@ SWIGEXT {
#ifndef ARCH_ALIGN_INT64
+#if OCAML_VERSION >= 40300
+#define SWIG_Int64_val(v) (*((int64_t *) SWIG_Data_custom_val(v)))
+#else
#define SWIG_Int64_val(v) (*((int64 *) SWIG_Data_custom_val(v)))
+#endif
+#else
+#if OCAML_VERSION >= 40300
+CAMLextern int64_t Int64_val(caml_value_t v);
#else
CAMLextern int64 Int64_val(caml_value_t v);
+#endif
#define SWIG_Int64_val(v) Int64_val(v)
#endif
@@ -111,56 +127,85 @@ CAMLextern int64 Int64_val(caml_value_t v);
#define SWIG_GetModule(clientdata) SWIG_Ocaml_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Ocaml_SetModule(pointer)
-#define SWIG_contract_assert(expr, msg) if(!(expr)) {failwith(msg);} else
+typedef enum {
+ SWIG_OCamlArithmeticException,
+ SWIG_OCamlDirectorPureVirtual,
+ SWIG_OCamlOutOfMemoryError,
+ SWIG_OCamlOverflowException,
+ SWIG_OCamlIllegalArgumentException,
+ SWIG_OCamlIndexOutOfBoundsException,
+ SWIG_OCamlRuntimeException,
+ SWIG_OCamlSystemException,
+ SWIG_OCamlUnknownError
+} SWIG_OCamlExceptionCodes;
+
+SWIGINTERN void SWIG_OCamlThrowException(SWIG_OCamlExceptionCodes code, const char *msg) {
+ CAMLparam0();
+ SWIG_CAMLlocal1(str);
+
+ switch (code) {
+ case SWIG_OCamlIllegalArgumentException:
+ caml_invalid_argument(msg);
+ break;
+ case SWIG_OCamlSystemException:
+ str = caml_copy_string(msg);
+ caml_raise_sys_error(str);
+ break;
+ case SWIG_OCamlArithmeticException:
+ case SWIG_OCamlIndexOutOfBoundsException:
+ case SWIG_OCamlOutOfMemoryError:
+ case SWIG_OCamlOverflowException:
+ case SWIG_OCamlRuntimeException:
+ case SWIG_OCamlUnknownError:
+ default:
+ caml_failwith(msg);
+ break;
+ }
+ CAMLreturn0;
+}
- SWIGSTATIC int
+#define SWIG_contract_assert(expr, msg) if(!(expr)) {SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, msg);}
+
+ SWIGINTERN int
SWIG_GetPtr(void *source, void **result, swig_type_info *type, swig_type_info *result_type);
+
+ SWIGINTERN CAML_VALUE caml_list_nth( CAML_VALUE lst, int n );
+ SWIGINTERN CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt );
+ SWIGINTERN int caml_list_length( CAML_VALUE lst );
+ SWIGINTERN CAML_VALUE caml_array_new( int n );
+ SWIGINTERN void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item );
+ SWIGINTERN CAML_VALUE caml_array_nth( CAML_VALUE arr, int n );
+ SWIGINTERN int caml_array_len( CAML_VALUE arr );
+
+ SWIGINTERN CAML_VALUE caml_val_char( char c );
+ SWIGINTERN CAML_VALUE caml_val_uchar( unsigned char c );
+
+ SWIGINTERN CAML_VALUE caml_val_short( short s );
+ SWIGINTERN CAML_VALUE caml_val_ushort( unsigned short s );
- SWIGSTATIC void *
- SWIG_MustGetPtr (CAML_VALUE v, swig_type_info *type);
-
- SWIGSTATIC CAML_VALUE _wrap_delete_void( CAML_VALUE );
-
- SWIGSTATIC int enum_to_int( char *name, CAML_VALUE v );
- SWIGSTATIC CAML_VALUE int_to_enum( char *name, int v );
-
- SWIGSTATIC CAML_VALUE caml_list_nth( CAML_VALUE lst, int n );
- SWIGSTATIC CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt );
- SWIGSTATIC int caml_list_length( CAML_VALUE lst );
- 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_len( CAML_VALUE arr );
-
- SWIGSTATIC CAML_VALUE caml_val_char( char c );
- SWIGSTATIC CAML_VALUE caml_val_uchar( unsigned char c );
-
- SWIGSTATIC CAML_VALUE caml_val_short( short s );
- SWIGSTATIC CAML_VALUE caml_val_ushort( unsigned short s );
-
- SWIGSTATIC CAML_VALUE caml_val_int( int x );
- SWIGSTATIC CAML_VALUE caml_val_uint( unsigned int x );
+ SWIGINTERN CAML_VALUE caml_val_int( int x );
+ SWIGINTERN CAML_VALUE caml_val_uint( unsigned int x );
- SWIGSTATIC CAML_VALUE caml_val_long( long x );
- SWIGSTATIC CAML_VALUE caml_val_ulong( unsigned long x );
+ SWIGINTERN CAML_VALUE caml_val_long( long x );
+ SWIGINTERN CAML_VALUE caml_val_ulong( unsigned long x );
- SWIGSTATIC CAML_VALUE caml_val_float( float f );
- SWIGSTATIC CAML_VALUE caml_val_double( double d );
+ SWIGINTERN CAML_VALUE caml_val_float( float f );
+ SWIGINTERN CAML_VALUE caml_val_double( double d );
- SWIGSTATIC CAML_VALUE caml_val_ptr( void *p, swig_type_info *descriptor );
+ SWIGINTERN CAML_VALUE caml_val_ptr( void *p, swig_type_info *descriptor );
- SWIGSTATIC CAML_VALUE caml_val_string( const char *str );
- SWIGSTATIC CAML_VALUE caml_val_string_len( const char *str, int len );
+ SWIGINTERN CAML_VALUE caml_val_string( const char *str );
+ SWIGINTERN CAML_VALUE caml_val_string_len( const char *str, int len );
- SWIGSTATIC long caml_long_val( CAML_VALUE v );
- SWIGSTATIC double caml_double_val( CAML_VALUE v );
+ SWIGINTERN long caml_long_val( CAML_VALUE v );
+ SWIGINTERN double caml_double_val( CAML_VALUE v );
- SWIGSTATIC int caml_ptr_val_internal( CAML_VALUE v, void **out,
+ SWIGINTERN int caml_ptr_val_internal( CAML_VALUE v, void **out,
swig_type_info *descriptor );
- SWIGSTATIC void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor );
+ SWIGINTERN void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor );
- SWIGSTATIC char *caml_string_val( CAML_VALUE v );
- SWIGSTATIC int caml_string_len( CAML_VALUE v );
+ SWIGINTERN char *caml_string_val( CAML_VALUE v );
+ SWIGINTERN int caml_string_len( CAML_VALUE v );
#ifdef __cplusplus
}
diff --git a/Lib/ocaml/std_common.i b/Lib/ocaml/std_common.i
index 6523af0b5..7e64607d9 100644
--- a/Lib/ocaml/std_common.i
+++ b/Lib/ocaml/std_common.i
@@ -7,6 +7,7 @@
%include <std/std_except.i>
%apply size_t { std::size_t };
+%apply const size_t& { const std::size_t& };
%{
#include <string>
diff --git a/Lib/ocaml/std_except.i b/Lib/ocaml/std_except.i
new file mode 100644
index 000000000..74ddcb51d
--- /dev/null
+++ b/Lib/ocaml/std_except.i
@@ -0,0 +1,23 @@
+%{
+#include <typeinfo>
+#include <stdexcept>
+%}
+
+namespace std
+{
+ %ignore exception;
+ struct exception {};
+}
+
+%typemap(throws) std::bad_cast "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.what());"
+%typemap(throws) std::bad_exception "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.what());"
+%typemap(throws) std::domain_error "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.what());"
+%typemap(throws) std::exception "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.what());"
+%typemap(throws) std::invalid_argument "SWIG_OCamlThrowException(SWIG_OCamlIllegalArgumentException, $1.what());"
+%typemap(throws) std::length_error "SWIG_OCamlThrowException(SWIG_OCamlIndexOutOfBoundsException, $1.what());"
+%typemap(throws) std::logic_error "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.what());"
+%typemap(throws) std::out_of_range "SWIG_OCamlThrowException(SWIG_OCamlIndexOutOfBoundsException, $1.what());"
+%typemap(throws) std::overflow_error "SWIG_OCamlThrowException(SWIG_OCamlArithmeticException, $1.what());"
+%typemap(throws) std::range_error "SWIG_OCamlThrowException(SWIG_OCamlIndexOutOfBoundsException, $1.what());"
+%typemap(throws) std::runtime_error "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.what());"
+%typemap(throws) std::underflow_error "SWIG_OCamlThrowException(SWIG_OCamlArithmeticException, $1.what());"
diff --git a/Lib/ocaml/std_list.i b/Lib/ocaml/std_list.i
index 06181cca8..e0524aa40 100644
--- a/Lib/ocaml/std_list.i
+++ b/Lib/ocaml/std_list.i
@@ -13,21 +13,24 @@
%}
-namespace std{
+namespace std {
template<class T> class list
{
public:
-
- typedef T &reference;
- typedef const T& const_reference;
+ 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;
typedef T &iterator;
typedef const T& const_iterator;
-
+
list();
list(unsigned int size, const T& value = T());
- list(const list<T> &);
+ list(const list& other);
- ~list();
void assign(unsigned int n, const T& value);
void swap(list<T> &x);
@@ -35,28 +38,25 @@ namespace std{
const_reference back();
const_iterator begin();
const_iterator end();
-
+
void resize(unsigned int n, T c = T());
bool empty() const;
void push_front(const T& x);
void push_back(const T& x);
-
void pop_front();
void pop_back();
void clear();
unsigned int size() const;
unsigned int max_size() const;
void resize(unsigned int n, const T& value);
-
+
void remove(const T& value);
void unique();
void reverse();
void sort();
-
-
-
+
%extend
{
const_reference __getitem__(int i) throw (std::out_of_range)
@@ -206,9 +206,7 @@ namespace std{
{
self->pop_back();
}
-
- };
-
+ }
};
}
diff --git a/Lib/ocaml/std_map.i b/Lib/ocaml/std_map.i
index 5656b7fa2..3f197baa6 100644
--- a/Lib/ocaml/std_map.i
+++ b/Lib/ocaml/std_map.i
@@ -19,22 +19,28 @@
// exported class
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
bool empty() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -44,14 +50,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
}
diff --git a/Lib/ocaml/std_pair.i b/Lib/ocaml/std_pair.i
index fe45ee676..732347db5 100644
--- a/Lib/ocaml/std_pair.i
+++ b/Lib/ocaml/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/ocaml/std_string.i b/Lib/ocaml/std_string.i
index bd5be0da2..712c3bb73 100644
--- a/Lib/ocaml/std_string.i
+++ b/Lib/ocaml/std_string.i
@@ -29,7 +29,6 @@ class wstring;
/* Overloading check */
%typemap(in) string {
- /* %typemap(in) string */
if (caml_ptr_check($input))
$1.assign((char *)caml_ptr_val($input,0), caml_string_len($input));
else
@@ -37,7 +36,6 @@ class wstring;
}
%typemap(in) const string & ($*1_ltype temp) {
- /* %typemap(in) const string & */
if (caml_ptr_check($input)) {
temp.assign((char *)caml_ptr_val($input,0), caml_string_len($input));
$1 = &temp;
@@ -47,7 +45,6 @@ class wstring;
}
%typemap(in) string & ($*1_ltype temp) {
- /* %typemap(in) string & */
if (caml_ptr_check($input)) {
temp.assign((char *)caml_ptr_val($input,0), caml_string_len($input));
$1 = &temp;
@@ -57,7 +54,6 @@ class wstring;
}
%typemap(in) string * ($*1_ltype *temp) {
- /* %typemap(in) string * */
if (caml_ptr_check($input)) {
temp = new $*1_ltype((char *)caml_ptr_val($input,0), caml_string_len($input));
$1 = temp;
@@ -71,24 +67,26 @@ class wstring;
}
%typemap(argout) string & {
- /* %typemap(argout) string & */
swig_result = caml_list_append(swig_result,caml_val_string_len((*$1).c_str(), (*$1).size()));
}
+%typemap(directorin) string {
+ swig_result = caml_val_string_len($1.c_str(), $1.size());
+ args = caml_list_append(args, swig_result);
+}
+
%typemap(directorout) string {
- /* %typemap(directorout) string */
$result.assign((char *)caml_ptr_val($input,0), caml_string_len($input));
}
%typemap(out) string {
- /* %typemap(out) string */
$result = caml_val_string_len($1.c_str(),$1.size());
}
%typemap(out) string * {
- /* %typemap(out) string * */
$result = caml_val_string_len((*$1).c_str(),(*$1).size());
}
+%typemap(typecheck) string, const string & = char *;
}
#ifdef ENABLE_CHARPTR_ARRAY
@@ -114,7 +112,7 @@ char **c_charptr_array( const std::vector <std::string > &str_v );
let string_array_to_vector sa =
let nv = _new_StringVector C_void in
- array_to_vector nv (fun x -> C_string x) sa ; nv
+ ignore (array_to_vector nv (fun x -> C_string x) sa) ; nv
let c_string_array ar =
_c_charptr_array (string_array_to_vector ar)
diff --git a/Lib/ocaml/std_vector.i b/Lib/ocaml/std_vector.i
index 53d107447..891d038c9 100644
--- a/Lib/ocaml/std_vector.i
+++ b/Lib/ocaml/std_vector.i
@@ -41,9 +41,18 @@
namespace std {
template <class T> class vector {
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, const T& value);
- vector(const vector<T>&);
+ vector(const vector& other);
+
unsigned int size() const;
bool empty() const;
void clear();
@@ -71,7 +80,7 @@ namespace std {
let array_to_vector v argcons array =
for i = 0 to (Array.length array) - 1 do
- (invoke v) "set" (C_list [ C_int i ; (argcons array.(i)) ])
+ ignore ((invoke v) "set" (C_list [ C_int i ; (argcons array.(i)) ]))
done ;
v
diff --git a/Lib/ocaml/stl.i b/Lib/ocaml/stl.i
index 9d2e91eee..04f86014f 100644
--- a/Lib/ocaml/stl.i
+++ b/Lib/ocaml/stl.i
@@ -1,7 +1,5 @@
/* -----------------------------------------------------------------------------
* stl.i
- *
- * Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
%include <std_common.i>
diff --git a/Lib/ocaml/swig.ml b/Lib/ocaml/swig.ml
index 5dc2de7be..58a93347b 100644
--- a/Lib/ocaml/swig.ml
+++ b/Lib/ocaml/swig.ml
@@ -44,6 +44,13 @@ let _ = Callback.register "swig_runmethod" invoke
let fnhelper arg =
match arg with C_list l -> l | C_void -> [] | _ -> [ arg ]
+let director_core_helper fnargs =
+ try
+ match List.hd fnargs with
+ | C_director_core (o,r) -> fnargs
+ | _ -> C_void :: fnargs
+ with Failure _ -> C_void :: fnargs
+
let rec get_int x =
match x with
C_bool b -> if b then 1 else 0
@@ -155,5 +162,5 @@ let _ = Callback.register "swig_set_type_info" set_type_info
let class_master_list = Hashtbl.create 20
let register_class_byname nm co =
Hashtbl.replace class_master_list nm (Obj.magic co)
-let create_class nm arg =
- try (Obj.magic (Hashtbl.find class_master_list nm)) arg with _ -> raise (NoSuchClass nm)
+let create_class nm =
+ try (Obj.magic (Hashtbl.find class_master_list nm)) with _ -> raise (NoSuchClass nm)
diff --git a/Lib/ocaml/swig.mli b/Lib/ocaml/swig.mli
index 3207b9e73..c5ffadb15 100644
--- a/Lib/ocaml/swig.mli
+++ b/Lib/ocaml/swig.mli
@@ -30,6 +30,7 @@ exception NoSuchClass of string
val invoke : ('a c_obj_t) -> (string -> 'a c_obj_t -> 'a c_obj_t)
val fnhelper : 'a c_obj_t -> 'a c_obj_t list
+val director_core_helper : 'a c_obj_t list -> 'a c_obj_t list
val get_int : 'a c_obj_t -> int
val get_float : 'a c_obj_t -> float
diff --git a/Lib/ocaml/typecheck.i b/Lib/ocaml/typecheck.i
index a13e1552e..0c0a600a0 100644
--- a/Lib/ocaml/typecheck.i
+++ b/Lib/ocaml/typecheck.i
@@ -4,7 +4,7 @@
* Typechecking rules
* ----------------------------------------------------------------------------- */
-%typecheck(SWIG_TYPECHECK_INTEGER) char, signed char, const char &, const signed char & {
+%typecheck(SWIG_TYPECHECK_INT8) char, signed char, const char &, const signed char & {
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -14,7 +14,7 @@
}
}
-%typecheck(SWIG_TYPECHECK_INTEGER) unsigned char, const unsigned char & {
+%typecheck(SWIG_TYPECHECK_UINT8) unsigned char, const unsigned char & {
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -24,7 +24,7 @@
}
}
-%typecheck(SWIG_TYPECHECK_INTEGER) short, signed short, const short &, const signed short &, wchar_t {
+%typecheck(SWIG_TYPECHECK_INT16) short, signed short, const short &, const signed short &, wchar_t {
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -34,7 +34,7 @@
}
}
-%typecheck(SWIG_TYPECHECK_INTEGER) unsigned short, const unsigned short & {
+%typecheck(SWIG_TYPECHECK_UINT16) unsigned short, const unsigned short & {
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -47,7 +47,7 @@
// XXX arty
// Will move enum SWIGTYPE later when I figure out what to do with it...
-%typecheck(SWIG_TYPECHECK_INTEGER) int, signed int, const int &, const signed int &, enum SWIGTYPE {
+%typecheck(SWIG_TYPECHECK_INT32) int, signed int, const int &, const signed int &, enum SWIGTYPE {
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -57,7 +57,7 @@
}
}
-%typecheck(SWIG_TYPECHECK_INTEGER) unsigned int, const unsigned int & {
+%typecheck(SWIG_TYPECHECK_UINT32) unsigned int, const unsigned int & {
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -68,7 +68,13 @@
}
}
-%typecheck(SWIG_TYPECHECK_INTEGER) long, signed long, unsigned long, long long, signed long long, unsigned long long, const long &, const signed long &, const unsigned long &, const long long &, const signed long long &, const unsigned long long & {
+%typecheck(SWIG_TYPECHECK_INT64)
+ long, signed long, unsigned long,
+ long long, signed long long, unsigned long long,
+ const long &, const signed long &, const unsigned long &,
+ const long long &, const signed long long &, const unsigned long long &,
+ size_t, const size_t &
+{
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -78,7 +84,7 @@
}
}
-%typecheck(SWIG_TYPECHECK_INTEGER) bool, oc_bool, BOOL, const bool &, const oc_bool &, const BOOL & {
+%typecheck(SWIG_TYPECHECK_BOOL) bool, const bool & {
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -88,7 +94,7 @@
}
}
-%typecheck(SWIG_TYPECHECK_DOUBLE) float, const float & {
+%typecheck(SWIG_TYPECHECK_FLOAT) float, const float & {
if( !Is_block($input) ) $1 = 0;
else {
switch( SWIG_Tag_val($input) ) {
@@ -130,24 +136,42 @@
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
- void *ptr;
- $1 = !caml_ptr_val_internal($input, &ptr,$descriptor);
+ if (!Is_block($input) || !(SWIG_Tag_val($input) == C_obj || SWIG_Tag_val($input) == C_ptr)) {
+ $1 = 0;
+ } else {
+ void *ptr;
+ $1 = !caml_ptr_val_internal($input, &ptr, $descriptor);
+ }
}
-#if 0
-
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
- void *ptr;
- $1 = !caml_ptr_val_internal($input, &ptr, $&1_descriptor);
+ swig_type_info *typeinfo;
+ if (!Is_block($input)) {
+ $1 = 0;
+ } else {
+ switch (SWIG_Tag_val($input)) {
+ case C_obj: {
+ void *ptr;
+ $1 = !caml_ptr_val_internal($input, &ptr, $&1_descriptor);
+ break;
+ }
+ case C_ptr: {
+ typeinfo = (swig_type_info *)SWIG_Int64_val(SWIG_Field($input, 1));
+ $1 = SWIG_TypeCheck("$1_type", typeinfo) != NULL;
+ break;
+ }
+ default: $1 = 0; break;
+ }
+ }
}
-#endif
-
%typecheck(SWIG_TYPECHECK_VOIDPTR) void * {
void *ptr;
$1 = !caml_ptr_val_internal($input, &ptr, 0);
}
+%typecheck(SWIG_TYPECHECK_SWIGOBJECT) CAML_VALUE "$1 = 1;"
+
/* ------------------------------------------------------------
* Exception handling
* ------------------------------------------------------------ */
@@ -158,19 +182,16 @@
unsigned int,
unsigned long,
unsigned short {
- SWIG_exception($1,"Thrown exception from C++ (int)");
-}
-
-%typemap(throws) SWIGTYPE CLASS {
- $&1_ltype temp = new $1_ltype($1);
- SWIG_exception((int)temp,"Thrown exception from C++ (object)");
+ char error_msg[256];
+ sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
+ SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, error_msg);
}
-%typemap(throws) SWIGTYPE {
+%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] {
(void)$1;
- SWIG_exception(0,"Thrown exception from C++ (unknown)");
+ SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, "C++ $1_type exception thrown");
}
%typemap(throws) char * {
- SWIG_exception(0,$1);
+ SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1);
}
diff --git a/Lib/ocaml/typemaps.i b/Lib/ocaml/typemaps.i
index 7602ad629..39231e221 100644
--- a/Lib/ocaml/typemaps.i
+++ b/Lib/ocaml/typemaps.i
@@ -1,371 +1,44 @@
-/* -----------------------------------------------------------------------------
+/* ----------------------------------------------------------------------------
* typemaps.i
*
- * The Ocaml module handles all types uniformly via typemaps. Here
- * are the definitions.
- * ----------------------------------------------------------------------------- */
+ * These typemaps provide support for input/output arguments for C/C++ pointers
+ * and C++ references.
+* ---------------------------------------------------------------------------- */
-/* Pointers */
-
-%typemap(in) void ""
-
-%typemap(out) void "$result = Val_int(0);"
-
-%typemap(in) void * {
- $1 = caml_ptr_val($input,$descriptor);
-}
-
-%typemap(varin) void * {
- $1 = ($ltype)caml_ptr_val($input,$descriptor);
-}
-
-%typemap(out) void * {
- $result = caml_val_ptr($1,$descriptor);
-}
-
-%typemap(varout) void * {
- $result = caml_val_ptr($1,$descriptor);
-}
-
-#ifdef __cplusplus
-
-%typemap(in) SWIGTYPE & {
- /* %typemap(in) SWIGTYPE & */
- $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");
- if( fromval ) {
- $result = callback(*fromval,caml_val_ptr((void *) &$1,$1_descriptor));
- } else {
- $result = caml_val_ptr ((void *) &$1,$1_descriptor);
- }
-}
-
-%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");
- 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));
- }
-}
-%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)) ;
-}
-
-%typemap(out) SWIGTYPE {
- /* %typemap(out) SWIGTYPE */
- $&1_ltype temp = new $ltype((const $1_ltype &) $1);
- CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
- if( fromval ) {
- $result = callback(*fromval,caml_val_ptr((void *)temp,$&1_descriptor));
- } else {
- $result = caml_val_ptr ((void *)temp,$&1_descriptor);
- }
-}
-
-%typemap(in) char *& (char *temp) {
- /* %typemap(in) char *& */
- temp = (char*)caml_val_ptr($1,$descriptor);
+%define INPUT_OUTPUT_INOUT_TYPEMAPS(type, c_to_ocaml, ocaml_to_c)
+%typemap(in) type *INPUT(type temp), type &INPUT(type temp) {
+ temp = (type)ocaml_to_c($input);
$1 = &temp;
}
-
-%typemap(argout) char *& {
- /* %typemap(argout) char *& */
- swig_result = caml_list_append(swig_result,caml_val_string_len(*$1, strlen(*$1)));
-}
-
-#else
-
-%typemap(in) SWIGTYPE {
- $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ;
-}
-
-%typemap(out) SWIGTYPE {
- /* %typemap(out) SWIGTYPE */
- void *temp = calloc(1,sizeof($ltype));
- CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
- memmove( temp, &$1, sizeof( $1_type ) );
- if( fromval ) {
- $result = callback(*fromval,caml_val_ptr((void *)temp,$&1_descriptor));
- } else {
- $result = caml_val_ptr ((void *)temp,$&1_descriptor);
- }
-}
-
-%apply SWIGTYPE { const SWIGTYPE & };
-%apply SWIGTYPE { const SWIGTYPE && };
-
-#endif
-
-/* The SIMPLE_MAP macro below defines the whole set of typemaps needed
- for simple types. */
-
-%define SIMPLE_MAP(C_NAME, C_TO_MZ, MZ_TO_C)
-/* In */
-%typemap(in) C_NAME {
- $1 = MZ_TO_C($input);
-}
-%typemap(varin) C_NAME {
- $1 = MZ_TO_C($input);
-}
-%typemap(in) C_NAME & ($*1_ltype temp) {
- temp = ($*1_ltype) MZ_TO_C($input);
- $1 = &temp;
-}
-%typemap(varin) C_NAME & {
- $1 = MZ_TO_C($input);
-}
-%typemap(directorout) C_NAME {
- $1 = MZ_TO_C($input);
-}
-%typemap(in) C_NAME *INPUT ($*1_ltype temp) {
- temp = ($*1_ltype) MZ_TO_C($input);
- $1 = &temp;
-}
-%typemap(in,numinputs=0) C_NAME *OUTPUT ($*1_ltype temp) {
- $1 = &temp;
-}
-/* Out */
-%typemap(out) C_NAME {
- $result = C_TO_MZ($1);
-}
-%typemap(varout) C_NAME {
- $result = C_TO_MZ($1);
-}
-%typemap(varout) C_NAME & {
- /* %typemap(varout) C_NAME & (generic) */
- $result = C_TO_MZ($1);
-}
-%typemap(argout) C_NAME *OUTPUT {
- swig_result = caml_list_append(swig_result,C_TO_MZ((long)*$1));
-}
-%typemap(out) C_NAME & {
- /* %typemap(out) C_NAME & (generic) */
- $result = C_TO_MZ(*$1);
-}
-%typemap(argout) C_NAME & {
- swig_result = caml_list_append(swig_result,C_TO_MZ((long)*$1));
-}
-%typemap(directorin) C_NAME {
- args = caml_list_append(args,C_TO_MZ($1));
-}
-%enddef
-
-SIMPLE_MAP(bool, caml_val_bool, caml_long_val);
-SIMPLE_MAP(oc_bool, caml_val_bool, caml_long_val);
-SIMPLE_MAP(char, caml_val_char, caml_long_val);
-SIMPLE_MAP(signed char, caml_val_char, caml_long_val);
-SIMPLE_MAP(unsigned char, caml_val_uchar, caml_long_val);
-SIMPLE_MAP(int, caml_val_int, caml_long_val);
-SIMPLE_MAP(short, caml_val_short, caml_long_val);
-SIMPLE_MAP(wchar_t, caml_val_short, caml_long_val);
-SIMPLE_MAP(long, caml_val_long, caml_long_val);
-SIMPLE_MAP(ptrdiff_t, caml_val_int, caml_long_val);
-SIMPLE_MAP(unsigned int, caml_val_uint, caml_long_val);
-SIMPLE_MAP(unsigned short, caml_val_ushort, caml_long_val);
-SIMPLE_MAP(unsigned long, caml_val_ulong, caml_long_val);
-SIMPLE_MAP(size_t, caml_val_int, caml_long_val);
-SIMPLE_MAP(float, caml_val_float, caml_double_val);
-SIMPLE_MAP(double, caml_val_double, caml_double_val);
-SIMPLE_MAP(long long,caml_val_ulong,caml_long_val);
-SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
-
-/* Void */
-
-%typemap(out) void "$result = Val_unit;";
-
-/* Pass through value */
-
-%typemap (in) value,caml::value,CAML_VALUE "$1=$input;";
-%typemap (out) value,caml::value,CAML_VALUE "$result=$1;";
-
-/* Arrays */
-
-%typemap(in) ArrayCarrier * {
- $1 = ($ltype)caml_ptr_val($input,$1_descriptor);
-}
-
-%typemap(out) ArrayCarrier * {
- 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
-%include <carray.i>
-#endif
-
-/* Handle char arrays as strings */
-
-%define %char_ptr_in(how)
-%typemap(how) char *, signed char *, unsigned char * {
- /* %typemap(how) char * ... */
- $1 = ($ltype)caml_string_val($input);
-}
-/* Again work around the empty array bound bug */
-%typemap(how) char [ANY], signed char [ANY], unsigned char [ANY] {
- /* %typemap(how) char [ANY] ... */
- char *temp = caml_string_val($input);
- strcpy((char *)$1,temp);
- /* strncpy would be better but we might not have an array size */
-}
-%enddef
-
-%char_ptr_in(in);
-%char_ptr_in(varin);
-%char_ptr_in(directorout);
-
-%define %char_ptr_out(how)
-%typemap(how)
- char *, signed char *, unsigned char *,
- const char *, const signed char *, const unsigned char * {
- $result = caml_val_string((char *)$1);
-}
-/* I'd like to use the length here but can't because it might be empty */
-%typemap(how)
- char [ANY], signed char [ANY], unsigned char [ANY],
- const char [ANY], const signed char [ANY], const unsigned char [ANY] {
- $result = caml_val_string((char *)$1);
-}
-%enddef
-
-%char_ptr_out(out);
-%char_ptr_out(varout);
-%char_ptr_out(directorin);
-
-%define %swigtype_ptr_in(how)
-%typemap(how) SWIGTYPE * {
- /* %typemap(how) SWIGTYPE * */
- $1 = ($ltype)caml_ptr_val($input,$1_descriptor);
-}
-%typemap(how) SWIGTYPE (CLASS::*) {
- /* %typemap(how) SWIGTYPE (CLASS::*) */
- void *v = caml_ptr_val($input,$1_descriptor);
- memcpy(& $1, &v, sizeof(v));
-}
-%enddef
-
-%define %swigtype_ptr_out(how)
-%typemap(out) SWIGTYPE * {
- /* %typemap(how) SWIGTYPE *, SWIGTYPE (CLASS::*) */
- 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);
- }
-}
-%typemap(how) SWIGTYPE (CLASS::*) {
- /* %typemap(how) SWIGTYPE *, SWIGTYPE (CLASS::*) */
- void *v;
- memcpy(&v,& $1, sizeof(void *));
- $result = caml_val_ptr (v,$1_descriptor);
-}
-%enddef
-
-%swigtype_ptr_in(in);
-%swigtype_ptr_in(varin);
-%swigtype_ptr_in(directorout);
-%swigtype_ptr_out(out);
-%swigtype_ptr_out(varout);
-%swigtype_ptr_out(directorin);
-
-%define %swigtype_array_fail(how,msg)
-%typemap(how) SWIGTYPE [] {
- failwith(msg);
-}
-%enddef
-
-%swigtype_array_fail(in,"Array arguments for arbitrary types need a typemap");
-%swigtype_array_fail(varin,"Assignment to global arrays for arbitrary types need a typemap");
-%swigtype_array_fail(out,"Array arguments for arbitrary types need a typemap");
-%swigtype_array_fail(varout,"Array variables need a typemap");
-%swigtype_array_fail(directorin,"Array results with arbitrary types need a typemap");
-%swigtype_array_fail(directorout,"Array arguments with arbitrary types need a typemap");
-
-/* C++ References */
-
-/* Enums */
-%define %swig_enum_in(how)
-%typemap(how) enum SWIGTYPE {
- $1 = ($type)caml_long_val_full($input,"$type_marker");
-}
-%enddef
-
-%define %swig_enum_out(how)
-%typemap(how) enum SWIGTYPE {
- $result = callback2(*caml_named_value(SWIG_MODULE "_int_to_enum"),*caml_named_value("$type_marker"),Val_int((int)$1));
-}
-%enddef
-
-%swig_enum_in(in)
-%swig_enum_in(varin)
-%swig_enum_in(directorout)
-%swig_enum_out(out)
-%swig_enum_out(varout)
-%swig_enum_out(directorin)
-
-
-/* Array reference typemaps */
-%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) }
-
-/* const pointers */
-%apply SWIGTYPE * { SWIGTYPE *const }
-
+%typemap(typecheck) type *INPUT = type;
+%typemap(typecheck) type &INPUT = type;
+
+%typemap(in, numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;"
+%typemap(argout) type *OUTPUT, type &OUTPUT {
+ swig_result = caml_list_append(swig_result, c_to_ocaml(*$1));
+}
+%typemap(in) type *INOUT = type *INPUT;
+%typemap(in) type &INOUT = type &INPUT;
+
+%typemap(argout) type *INOUT = type *OUTPUT;
+%typemap(argout) type &INOUT = type &OUTPUT;
+
+%typemap(typecheck) type *INOUT = type;
+%typemap(typecheck) type &INOUT = type;
+%enddef
+
+INPUT_OUTPUT_INOUT_TYPEMAPS(bool, caml_val_bool, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(int, caml_val_int, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(long, caml_val_long, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(short, caml_val_int, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(char, caml_val_char, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(signed char, caml_val_char, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(float, caml_val_float, caml_double_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(double, caml_val_double, caml_double_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned int, caml_val_uint, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned long, caml_val_ulong, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned short, caml_val_ushort, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned char, caml_val_uchar, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(long long, caml_val_long, caml_long_val);
+INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned long long, caml_val_ulong, caml_long_val);
+#undef INPUT_OUTPUT_INOUT_TYPEMAPS
diff --git a/Lib/octave/boost_shared_ptr.i b/Lib/octave/boost_shared_ptr.i
index e91862057..668bf4354 100644
--- a/Lib/octave/boost_shared_ptr.i
+++ b/Lib/octave/boost_shared_ptr.i
@@ -1,5 +1,11 @@
%include <shared_ptr.i>
+// Set SHARED_PTR_DISOWN to $disown if required, for example
+// #define SHARED_PTR_DISOWN $disown
+#if !defined(SHARED_PTR_DISOWN)
+#define SHARED_PTR_DISOWN 0
+#endif
+
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
@@ -8,7 +14,7 @@
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor wrapper customisation
-%feature("unref") TYPE
+%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;"
@@ -19,7 +25,7 @@
int newmem = 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);
@@ -52,13 +58,31 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
+ int newmem = 0;
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (!swig_argp) {
+ %dirout_nullref("$type");
+ } else {
+ $result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
+ if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
+ }
+}
+
// plain pointer
-// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
+// 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;
- res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ 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) {
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
@@ -69,6 +93,7 @@
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
}
}
+
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
@@ -97,12 +122,20 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE * %{
+#error "directorout typemap for plain pointer not implemented"
+%}
+
// plain reference
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
int newmem = 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) {
@@ -142,13 +175,21 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE & %{
+#error "directorout typemap for plain reference not implemented"
+%}
+
// plain pointer by reference
-// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
+// 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;
- res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ 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) {
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
@@ -160,7 +201,7 @@
$1 = &temp;
}
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -171,12 +212,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) TYPE *CONST& %{
+#error "directorout typemap for plain pointer by reference not implemented"
+%}
+
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
int newmem = 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, $&ltype));
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $&ltype);
@@ -201,12 +250,28 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
+ int newmem = 0;
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (swig_argp) {
+ $result = *(%reinterpret_cast(swig_argp, $&ltype));
+ if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $&ltype);
+ }
+}
+
// 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;
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 (argp) tempshared = *%reinterpret_cast(argp, $ltype);
@@ -228,12 +293,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
+#error "directorout typemap for shared_ptr ref not implemented"
+%}
+
// 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;
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 (argp) tempshared = *%reinterpret_cast(argp, $ltype);
@@ -244,7 +317,7 @@
}
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
if ($owner) delete $1;
}
@@ -256,12 +329,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
+#error "directorout typemap for pointer to shared_ptr not implemented"
+%}
+
// 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;
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);
@@ -269,7 +350,7 @@
$1 = &temp;
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -280,10 +361,18 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
+#error "directorout typemap for pointer ref to shared_ptr not implemented"
+%}
+
// 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, equivalent="TYPE *", noblock=1)
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
@@ -307,5 +396,6 @@
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
-%enddef
+
+%enddef
diff --git a/Lib/octave/director.swg b/Lib/octave/director.swg
index e80877ef6..bf71d18e8 100644
--- a/Lib/octave/director.swg
+++ b/Lib/octave/director.swg
@@ -46,10 +46,12 @@ namespace Swig {
}
};
- struct DirectorTypeMismatchException {
+ // Base class for director exceptions.
+ class DirectorException : public std::exception {
+ public:
static void raise(const char *msg) {
// ... todo
- throw(DirectorTypeMismatchException());
+ throw DirectorException();
}
static void raise(const octave_value &ov, const char *msg) {
@@ -58,10 +60,24 @@ namespace Swig {
}
};
- struct DirectorPureVirtualException {
+ class DirectorTypeMismatchException : public DirectorException {
+ public:
+ static void raise(const char *msg) {
+ // ... todo
+ throw DirectorTypeMismatchException();
+ }
+
+ static void raise(const octave_value &ov, const char *msg) {
+ // ... todo
+ raise(msg);
+ }
+ };
+
+ class DirectorPureVirtualException : public DirectorException {
+ public:
static void raise(const char *msg) {
// ... todo
- throw(DirectorPureVirtualException());
+ throw DirectorPureVirtualException();
}
static void raise(const octave_value &ov, const char *msg) {
diff --git a/Lib/octave/octcontainer.swg b/Lib/octave/octcontainer.swg
index 771edbde0..310a849d9 100644
--- a/Lib/octave/octcontainer.swg
+++ b/Lib/octave/octcontainer.swg
@@ -202,8 +202,8 @@ namespace swig
// swig::SwigVar_PyObject item = OctSequence_GetItem(_seq, _index);
octave_value item; // * todo
try {
- return swig::as<T>(item, true);
- } catch (std::exception& e) {
+ return swig::as<T>(item);
+ } catch (const std::exception& e) {
char msg[1024];
sprintf(msg, "in sequence element %d ", _index);
if (!Octave_Error_Occurred()) {
@@ -401,20 +401,14 @@ namespace swig
return const_reference(_seq, n);
}
- bool check(bool set_err = true) const
+ bool check() const
{
int s = size();
for (int i = 0; i < s; ++i) {
// swig::SwigVar_PyObject item = OctSequence_GetItem(_seq, i);
octave_value item; // * todo
- if (!swig::check<value_type>(item)) {
- if (set_err) {
- char msg[1024];
- sprintf(msg, "in sequence element %d", i);
- SWIG_Error(SWIG_RuntimeError, msg);
- }
+ if (!swig::check<value_type>(item))
return false;
- }
}
return true;
}
@@ -567,7 +561,11 @@ namespace swig {
if (seq) *seq = p;
return SWIG_OLDOBJ;
}
+%#if SWIG_OCTAVE_PREREQ(4,4,0)
+ } else if (obj.iscell()) {
+%#else
} else if (obj.is_cell()) {
+%#endif
try {
OctSequence_Cont<value_type> octseq(obj);
if (seq) {
diff --git a/Lib/octave/octiterators.swg b/Lib/octave/octiterators.swg
index 79a20f833..e186c94a2 100644
--- a/Lib/octave/octiterators.swg
+++ b/Lib/octave/octiterators.swg
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
* octiterators.swg
*
- * Users can derive form the OctSwigIterator to implemet their
+ * Users can derive form the OctSwigIterator to implement their
* own iterators. As an example (real one since we use it for STL/STD
* containers), the template OctSwigIterator_T does the
* implementation for generic C++ iterators.
diff --git a/Lib/octave/octprimtypes.swg b/Lib/octave/octprimtypes.swg
index 663d1fe10..1c9aa9089 100644
--- a/Lib/octave/octprimtypes.swg
+++ b/Lib/octave/octprimtypes.swg
@@ -18,7 +18,11 @@ SWIGINTERNINLINE octave_value
SWIGINTERN int
SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
{
+%#if SWIG_OCTAVE_PREREQ(4,4,0)
+ if (!ov.islogical())
+%#else
if (!ov.is_bool_type())
+%#endif
return SWIG_ERROR;
if (val)
*val = ov.bool_value();
@@ -214,7 +218,13 @@ SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
SWIGINTERN int
SWIG_AsCharPtrAndSize(octave_value ov, char** cptr, size_t* psize, int *alloc)
{
- if (ov.is_cell() && ov.rows() == 1 && ov.columns() == 1)
+ if (
+%#if SWIG_OCTAVE_PREREQ(4,4,0)
+ ov.iscell()
+%#else
+ ov.is_cell()
+%#endif
+ && ov.rows() == 1 && ov.columns() == 1)
ov = ov.cell_value()(0);
if (!ov.is_string())
return SWIG_TypeError;
diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg
index 57a888fb4..ff614e681 100644
--- a/Lib/octave/octrun.swg
+++ b/Lib/octave/octrun.swg
@@ -51,7 +51,7 @@ SWIGRUNTIME octave_value SWIG_Error(int code, const char *msg) {
octave_value type(SWIG_ErrorType(code));
std::string r = msg;
r += " (" + type.string_value() + ")";
- error(r.c_str());
+ error("%s", r.c_str());
return octave_value(r);
}
@@ -151,6 +151,67 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
const swig_type_info **base;
};
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ // in Octave 4.4 behaviour of octave_builtin() appears to have changed and 'self' argument is no longer passed
+ // to function (maybe because this is now a 'method'??) so need to create our own octave_function subclass
+#define SWIG_OCTAVE_BOUND_FUNC(func, args) octave_value(new octave_swig_bound_func(func, args))
+ class octave_swig_bound_func : public octave_function {
+ public:
+
+ octave_swig_bound_func(void) : octave_function(), method(0), first_args()
+ { }
+
+ octave_swig_bound_func(octave_function* _method, octave_value_list _first_args)
+ : octave_function("", ""), method(_method), first_args(_first_args)
+ { }
+
+ octave_swig_bound_func(const octave_swig_bound_func& f) = delete;
+
+ octave_swig_bound_func& operator= (const octave_swig_bound_func& f) = delete;
+
+ ~octave_swig_bound_func(void) = default;
+
+ bool is_function(void) const { return true; }
+
+ octave_function* function_value(bool = false) { return this; }
+
+ octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
+ octave_value_list all_args;
+ all_args.append(first_args);
+ all_args.append(args);
+ return method->call(tw, nargout, all_args);
+ }
+
+ octave_value subsref(const std::string &ops, const std::list < octave_value_list > &idx) {
+ octave_value_list ovl = subsref(ops, idx, 1);
+ return ovl.length() ? ovl(0) : octave_value();
+ }
+
+ octave_value_list subsref(const std::string &ops, const std::list < octave_value_list > &idx, int nargout) {
+ assert(ops.size() > 0);
+ assert(ops.size() == idx.size());
+ if (ops != "(")
+ error("invalid function call");
+ octave::tree_evaluator& tw = octave::interpreter::the_interpreter()->get_evaluator();
+ return call(tw, nargout, *idx.begin());
+ }
+
+ protected:
+
+ octave_function* method;
+ octave_value_list first_args;
+
+ std::set<std::string> dispatch_classes;
+
+ private:
+
+ DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+ };
+ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_bound_func, "octave_swig_bound_func", "octave_swig_bound_func");
+#else
+#define SWIG_OCTAVE_BOUND_FUNC(func, args) octave_value(func)
+#endif
+
// octave_swig_type plays the role of both the shadow class and the class
// representation within Octave, since there is no support for classes.
//
@@ -323,13 +384,17 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
octave_value_list member_deref(member_value_pair *m, const octave_value_list &args) {
- if (m->second.is_defined())
- return m->second;
- else if (m->first) {
+ if (m->second.is_defined()) {
+ if (m->second.is_function() || m->second.is_function_handle()) {
+ return SWIG_OCTAVE_BOUND_FUNC(m->second.function_value(), args);
+ } else {
+ return m->second;
+ }
+ } else if (m->first) {
if (m->first->get_method)
return m->first->get_method(args, 1);
else if (m->first->method)
- return octave_value(new octave_builtin(m->first->method));
+ return SWIG_OCTAVE_BOUND_FUNC(new octave_builtin(m->first->method), args);
}
error("undefined member");
return octave_value_list();
@@ -383,7 +448,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
return dim_vector(1,1);
// Return value should be cell or matrix of integers
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ if (out.iscell()) {
+#else
if (out.is_cell()) {
+#endif
const Cell & c=out.cell_value();
int ndim = c.rows();
if (ndim==1 && c.columns()!=1) ndim = c.columns();
@@ -401,7 +470,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
if (error_state) return dim_vector(1,1);
}
return d;
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ } else if (out.is_matrix_type() || out.isnumeric() ) {
+#else
} else if (out.is_matrix_type() || out.is_numeric_type() ) {
+#endif
if (out.rows()==1 || out.columns()==1) {
Array<int> a = out.int_vector_value();
if (error_state) return dim_vector(1,1);
@@ -476,8 +549,12 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
types.insert(types.end(), rhs.types.begin(), rhs.types.end());
members.insert(rhs.members.begin(), rhs.members.end());
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ assign(rhs.swig_type_name(), rhs.as_value());
+#else
rhs.types.clear();
rhs.members.clear();
+#endif
}
typedef member_map::const_iterator swig_member_const_iterator;
@@ -763,7 +840,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
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());
+ error("%s", (opname + std::string(" method not found")).c_str());
return octave_value();
}
return ret;
@@ -848,7 +925,14 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
octave_function *fcn = is_valid_function(symbol, std::string(), false);
if (!fcn)
return false;
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::tree_evaluator& tw = octave::interpreter::the_interpreter()->get_evaluator();
+ octave_value_list retval = fcn->call(tw, 1, args);
+ if (retval.length() == 1)
+ ret = retval(0);
+#else
ret = fcn->do_multi_index_op(1, args)(0);
+#endif
return true;
}
@@ -1238,7 +1322,13 @@ namespace Swig {
}
SWIGRUNTIME octave_swig_type *swig_value_deref(octave_value ov) {
- if (ov.is_cell() && ov.rows() == 1 && ov.columns() == 1)
+ if (
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ ov.iscell()
+#else
+ ov.is_cell()
+#endif
+ && ov.rows() == 1 && ov.columns() == 1)
ov = ov.cell_value()(0);
return swig_value_deref(*ov.internal_rep());
}
@@ -1261,12 +1351,24 @@ SWIGRUNTIME octave_value swig_unary_op_##name(const octave_base_value &x) { \
SWIGRUNTIME octave_value swig_binary_op_##name(const octave_base_value&lhs,const octave_base_value &rhs) { \
return octave_swig_type::dispatch_binary_op(lhs,rhs,#name); \
}
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+#define swigreg_unary_op(name) \
+if (!octave_value_typeinfo::lookup_unary_op(octave_value::op_##name,tid)) \
+typeinfo.register_unary_op(octave_value::op_##name,tid,swig_unary_op_##name);
+#else
#define swigreg_unary_op(name) \
if (!octave_value_typeinfo::lookup_unary_op(octave_value::op_##name,tid)) \
octave_value_typeinfo::register_unary_op(octave_value::op_##name,tid,swig_unary_op_##name);
+#endif
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+#define swigreg_binary_op(name) \
+if (!octave_value_typeinfo::lookup_binary_op(octave_value::op_##name,tid1,tid2)) \
+typeinfo.register_binary_op(octave_value::op_##name,tid1,tid2,swig_binary_op_##name);
+#else
#define swigreg_binary_op(name) \
if (!octave_value_typeinfo::lookup_binary_op(octave_value::op_##name,tid1,tid2)) \
octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig_binary_op_##name);
+#endif
swig_unary_op(not);
swig_unary_op(uplus);
@@ -1300,6 +1402,9 @@ octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig
swig_binary_op(el_or);
SWIGRUNTIME void SWIG_InstallUnaryOps(int tid) {
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::type_info& typeinfo = octave::interpreter::the_interpreter()->get_type_info();
+#endif
swigreg_unary_op(not);
swigreg_unary_op(uplus);
swigreg_unary_op(uminus);
@@ -1309,6 +1414,9 @@ octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig
swigreg_unary_op(decr);
}
SWIGRUNTIME void SWIG_InstallBinaryOps(int tid1, int tid2) {
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::type_info& typeinfo = octave::interpreter::the_interpreter()->get_type_info();
+#endif
swigreg_binary_op(add);
swigreg_binary_op(sub);
swigreg_binary_op(mul);
@@ -1357,13 +1465,19 @@ SWIGRUNTIME octave_value SWIG_Octave_NewPointerObj(void *ptr, swig_type_info *ty
}
SWIGRUNTIME int SWIG_Octave_ConvertPtrAndOwn(octave_value ov, void **ptr, swig_type_info *type, int flags, int *own) {
- if (ov.is_cell() && ov.rows() == 1 && ov.columns() == 1)
+ if (
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ ov.iscell()
+#else
+ ov.is_cell()
+#endif
+ && ov.rows() == 1 && ov.columns() == 1)
ov = ov.cell_value()(0);
if (!ov.is_defined() ||
(ov.is_matrix_type() && ov.rows() == 0 && ov.columns() == 0) ) {
if (ptr)
*ptr = 0;
- return SWIG_OK;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
if (ov.type_id() != octave_swig_ref::static_type_id())
return SWIG_ERROR;
@@ -1390,14 +1504,30 @@ SWIGRUNTIMEINLINE void SWIG_Octave_SetConstant(octave_swig_type *module_ns, cons
}
SWIGRUNTIMEINLINE octave_value SWIG_Octave_GetGlobalValue(std::string name) {
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
+ return symtab.global_varval(name);
+#else
return get_global_value(name, true);
+#endif
}
SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value& value) {
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
+ symtab.global_assign(name, value);
+#else
set_global_value(name, value);
+#endif
}
SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) {
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
+ octave::symbol_scope symscope = octave::interpreter::the_interpreter()->get_current_scope();
+ symscope.assign(name, symtab.global_varval(name));
+ symscope.mark_global(name);
+#else
#if !SWIG_OCTAVE_PREREQ(3,2,0)
link_to_global_variable(curr_sym_tab->lookup(name, true));
#else
@@ -1406,6 +1536,7 @@ SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) {
#endif
symbol_table::mark_global(name);
#endif
+#endif
}
SWIGRUNTIME swig_module_info *SWIG_Octave_GetModule(void *clientdata) {
diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg
index f5e687123..f98bf4fe4 100644
--- a/Lib/octave/octruntime.swg
+++ b/Lib/octave/octruntime.swg
@@ -139,7 +139,11 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
#endif
#if SWIG_OCTAVE_PREREQ(4,2,0)
try {
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::feval(name, octave_value_list(), 0);
+#else
feval(name, octave_value_list(), 0);
+#endif
retn = true;
} catch (octave::execution_exception&) { }
#else
@@ -170,7 +174,7 @@ SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::st
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::begin_frame("SWIG_Octave_InstallFunction");
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;
@@ -181,7 +185,11 @@ SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::st
args.append(octloadfcn->fcn_file_name());
#if SWIG_OCTAVE_PREREQ(4,2,0)
try {
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::feval("autoload", args, 0);
+#else
feval("autoload", args, 0);
+#endif
retn = true;
} catch (octave::execution_exception&) { }
#else
@@ -312,6 +320,8 @@ static const char *const SWIG_name_usage = "-*- texinfo -*- \n\
Loads the SWIG-generated module `" SWIG_name_d "'.\n\
@end deftypefn";
+void __swig_atexit__(void) { ::_Exit(0); }
+
DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
static octave_swig_type* module_ns = 0;
@@ -322,7 +332,9 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
// 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)
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ atexit(__swig_atexit__);
+#elif SWIG_OCTAVE_PREREQ(3,2,0)
octave_exit = ::_Exit;
#endif
#endif
@@ -351,15 +363,54 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
"__swig_atexit__; "
"atexit(\"__swig_atexit__\", false); "
"atexit(\"__swig_atexit__\")");
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::feval("evalin", eval_args, 0);
+#else
feval("evalin", eval_args, 0);
#endif
+#endif
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ {
+ octave::type_info& typeinfo = octave::interpreter::the_interpreter()->get_type_info();
+ string_vector types = typeinfo.installed_type_names();
+ bool register_octave_swig_ref = true;
+ bool register_octave_swig_packed = true;
+ bool register_octave_swig_bound_func = true;
+ for (int i = 0; i < types.numel(); ++i) {
+ if (types(i) == octave_swig_ref::static_type_name()) {
+ register_octave_swig_ref = false;
+ }
+ if (types(i) == octave_swig_packed::static_type_name()) {
+ register_octave_swig_packed = false;
+ }
+ if (types(i) == octave_swig_bound_func::static_type_name()) {
+ register_octave_swig_bound_func = false;
+ }
+ }
+ if (register_octave_swig_ref) {
+ octave_swig_ref::register_type();
+ }
+ if (register_octave_swig_packed) {
+ octave_swig_packed::register_type();
+ }
+ if (register_octave_swig_bound_func) {
+ octave_swig_bound_func::register_type();
+ }
+ }
+#else
octave_swig_ref::register_type();
octave_swig_packed::register_type();
+#endif
SWIG_InitializeModule(0);
SWIG_PropagateClientData();
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::call_stack& stack = octave::interpreter::the_interpreter()->get_call_stack();
+ octave_function *me = stack.current();
+#else
octave_function *me = octave_call_stack::current();
+#endif
if (!SWIG_Octave_InstallFunction(me, "subclass")) {
return octave_value_list();
@@ -426,10 +477,12 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
}
}
-#if !SWIG_OCTAVE_PREREQ(3,2,0)
- mlock(me->name());
-#else
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ octave::interpreter::the_interpreter()->mlock();
+#elif SWIG_OCTAVE_PREREQ(3,2,0)
mlock();
+#else
+ mlock(me->name());
#endif
}
diff --git a/Lib/octave/octstdcommon.swg b/Lib/octave/octstdcommon.swg
index 799d369a7..80b2154d9 100644
--- a/Lib/octave/octstdcommon.swg
+++ b/Lib/octave/octstdcommon.swg
@@ -41,7 +41,7 @@ namespace swig {
template <class Type>
struct traits_asptr {
static int asptr(const octave_value& obj, Type **val) {
- Type *p;
+ Type *p = 0;
swig_type_info *descriptor = type_info<Type>();
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res)) {
@@ -103,14 +103,14 @@ namespace swig {
template <class Type>
struct traits_as<Type, value_category> {
- static Type as(const octave_value& obj, bool throw_error) {
+ static Type as(const octave_value& obj) {
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");
+ throw std::invalid_argument("bad type");
}
return v;
}
@@ -118,7 +118,7 @@ namespace swig {
template <class Type>
struct traits_as<Type, pointer_category> {
- static Type as(const octave_value& obj, bool throw_error) {
+ static Type as(const octave_value& obj) {
Type *v = 0;
int res = traits_asptr<Type>::asptr(obj, &v);
if (SWIG_IsOK(res) && v) {
@@ -130,21 +130,17 @@ namespace swig {
return *v;
}
} 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");
- memset(v_def,0,sizeof(Type));
- return *v_def;
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
struct traits_as<Type*, pointer_category> {
- static Type* as(const octave_value& obj, bool throw_error) {
+ static Type* as(const octave_value& obj) {
Type *v = 0;
int res = traits_asptr<Type>::asptr(obj, &v);
if (SWIG_IsOK(res)) {
@@ -153,15 +149,14 @@ namespace swig {
if (!Octave_Error_Occurred()) {
%type_error(swig::type_name<Type>());
}
- if (throw_error) throw std::invalid_argument("bad type");
- return 0;
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
- inline Type as(const octave_value& obj, bool te = false) {
- return traits_as<Type, typename traits<Type>::category>::as(obj, te);
+ inline Type as(const octave_value& obj) {
+ return traits_as<Type, typename traits<Type>::category>::as(obj);
}
template <class Type>
diff --git a/Lib/octave/std_basic_string.i b/Lib/octave/std_basic_string.i
index 19712e8d0..01a2c34a2 100644
--- a/Lib/octave/std_basic_string.i
+++ b/Lib/octave/std_basic_string.i
@@ -10,24 +10,20 @@
%fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
fragment="SWIG_AsCharPtrAndSize") {
SWIGINTERN int
-SWIG_AsPtr(std::basic_string<char>)(octave_value obj, std::string **val)
-{
+SWIG_AsPtr(std::basic_string<char>)(octave_value obj, std::string **val) {
if (obj.is_string()) {
if (val)
*val = new std::string(obj.string_value());
return SWIG_NEWOBJ;
}
- if (val)
- error("a string is expected");
- return 0;
+ return SWIG_ERROR;
}
}
%fragment(SWIG_From_frag(std::basic_string<char>),"header",
fragment="SWIG_FromCharPtrAndSize") {
SWIGINTERNINLINE octave_value
- SWIG_From(std::basic_string<char>)(const std::string& s)
- {
+ SWIG_From(std::basic_string<char>)(const std::string& s) {
return SWIG_FromCharPtrAndSize(s.data(), s.size());
}
}
@@ -45,41 +41,20 @@ SWIGINTERNINLINE octave_value
%fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
fragment="SWIG_AsWCharPtrAndSize") {
SWIGINTERN int
- SWIG_AsPtr(std::basic_string<wchar_t>)(PyObject* obj, std::wstring **val)
- {
- static swig_type_info* string_info =
- SWIG_TypeQuery("std::basic_string<wchar_t> *");
- std::wstring *vptr;
- if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
- if (val) *val = vptr;
- return SWIG_OLDOBJ;
- } else {
- PyErr_Clear();
- wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
- if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
- if (buf) {
- if (val) *val = new std::wstring(buf, size - 1);
- if (alloc == SWIG_NEWOBJ) %delete_array(buf);
- return SWIG_NEWOBJ;
- }
- } else {
- PyErr_Clear();
- }
- if (val) {
- SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyErr_SetString(PyExc_TypeError,"a wstring is expected");
- SWIG_PYTHON_THREAD_END_BLOCK;
- }
- return 0;
- }
+SWIG_AsPtr(std::basic_string<wchar_t>)(octave_value obj, std::wstring **val) {
+ if (obj.is_string()) {
+ if (val)
+ *val = new std::wstring(obj.string_value());
+ return SWIG_NEWOBJ;
}
+ return SWIG_ERROR;
+}
}
%fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
fragment="SWIG_FromWCharPtrAndSize") {
SWIGINTERNINLINE PyObject*
- SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
- {
+ SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s) {
return SWIG_FromWCharPtrAndSize(s.data(), s.size());
}
}
diff --git a/Lib/octave/std_complex.i b/Lib/octave/std_complex.i
index 771728b9d..30c188244 100644
--- a/Lib/octave/std_complex.i
+++ b/Lib/octave/std_complex.i
@@ -8,6 +8,13 @@
#include <complex>
%}
+namespace std {
+ %naturalvar complex;
+ template<typename T> class complex;
+ %template() complex<double>;
+ %template() complex<float>;
+}
+
/* defining the complex as/from converters */
%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
diff --git a/Lib/octave/std_deque.i b/Lib/octave/std_deque.i
index 6866a610f..c40cfee12 100644
--- a/Lib/octave/std_deque.i
+++ b/Lib/octave/std_deque.i
@@ -12,7 +12,7 @@
template <class T>
struct traits_from<std::deque<T> > {
- static octave_value from(const std::deque<T> & vec) {
+ static octave_value from(const std::deque<T>& vec) {
return traits_from_stdseq<std::deque<T> >::from(vec);
}
};
diff --git a/Lib/octave/std_list.i b/Lib/octave/std_list.i
index 1421efaee..35f6c1321 100644
--- a/Lib/octave/std_list.i
+++ b/Lib/octave/std_list.i
@@ -12,7 +12,7 @@
template <class T>
struct traits_from<std::list<T> > {
- static octave_value *from(const std::list<T> & vec) {
+ static octave_value *from(const std::list<T>& vec) {
return traits_from_stdseq<std::list<T> >::from(vec);
}
};
diff --git a/Lib/octave/std_pair.i b/Lib/octave/std_pair.i
index 2f3d4dfa4..2f307380e 100644
--- a/Lib/octave/std_pair.i
+++ b/Lib/octave/std_pair.i
@@ -38,7 +38,13 @@
}
static int asval(const octave_value& obj, std::pair<T,U> *val) {
- if (obj.is_cell()) {
+ if (
+%#if SWIG_OCTAVE_PREREQ(4,4,0)
+ obj.iscell()
+%#else
+ obj.is_cell()
+%#endif
+ ) {
Cell c=obj.cell_value();
if (c.numel()<2) {
error("pair from Cell array requires at least two elements");
@@ -96,7 +102,13 @@
}
static int asptr(const octave_value& obj, std::pair<T,U> **val) {
- if (obj.is_cell()) {
+ if (
+%#if SWIG_OCTAVE_PREREQ(4,4,0)
+ obj.iscell()
+%#else
+ obj.is_cell()
+%#endif
+ ) {
Cell c=obj.cell_value();
if (c.numel()<2) {
error("pair from Cell array requires at least two elements");
diff --git a/Lib/octave/stl.i b/Lib/octave/stl.i
index b29f7d84d..04f86014f 100644
--- a/Lib/octave/stl.i
+++ b/Lib/octave/stl.i
@@ -1,6 +1,10 @@
-/* initial STL definition. extended as needed in each language */
+/* -----------------------------------------------------------------------------
+ * stl.i
+ * ----------------------------------------------------------------------------- */
+
%include <std_common.i>
%include <std_string.i>
%include <std_vector.i>
%include <std_map.i>
%include <std_pair.i>
+
diff --git a/Lib/perl5/cni.i b/Lib/perl5/cni.i
deleted file mode 100644
index c4d4eafa8..000000000
--- a/Lib/perl5/cni.i
+++ /dev/null
@@ -1,12 +0,0 @@
-%warnfilter(SWIGWARN_PARSE_KEYWORD) java::lang::ref;
-
-%{
-#undef STATIC
-%}
-%include <gcj/cni.i>
-%{
-#undef TRUE
-#define TRUE 1
-%}
-
-%include <jstring.i>
diff --git a/Lib/perl5/jstring.i b/Lib/perl5/jstring.i
deleted file mode 100644
index 1c179b754..000000000
--- a/Lib/perl5/jstring.i
+++ /dev/null
@@ -1,48 +0,0 @@
-%include <typemaps/valtypes.swg>
-
-%fragment(SWIG_AsVal_frag(jstring),"header") {
-SWIGINTERN int
-SWIG_AsVal_dec(jstring)(SV *obj, jstring *val)
-{
- if (SvPOK(obj)) {
- if (val) {
- STRLEN len = 0;
- char *cstr = SvPV(obj, len);
- *val = JvNewStringLatin1(cstr, len);
- }
- return SWIG_OK;
- }
- return SWIG_ERROR;
-}
-}
-
-%fragment(SWIG_From_frag(jstring),"header") {
-SWIGINTERNINLINE SV *
-SWIG_From_dec(jstring)(jstring val)
-{
- SV *obj = sv_newmortal();
- if (!val) {
- sv_setsv(obj, &PL_sv_undef);
- } else {
- jsize len = JvGetStringUTFLength(val);
- if (!len) {
- sv_setsv(obj, &PL_sv_undef);
- } else {
- char *tmp = %new_array(len, char);
- JvGetStringUTFRegion(val, 0, len, tmp);
- sv_setpvn(obj, tmp, len);
- SvUTF8_on(obj);
- %delete_array(tmp);
- }
- }
- return obj;
-}
-}
-
-%typemaps_asvalfrom(%checkcode(STRING),
- %arg(SWIG_AsVal(jstring)),
- %arg(SWIG_From(jstring)),
- %arg(SWIG_AsVal_frag(jstring)),
- %arg(SWIG_From_frag(jstring)),
- java::lang::String *);
-
diff --git a/Lib/perl5/perlrun.swg b/Lib/perl5/perlrun.swg
index d1865de0a..b04002f5d 100644
--- a/Lib/perl5/perlrun.swg
+++ b/Lib/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_AcquirePtr(ptr, src) SWIG_Perl_AcquirePtr(ptr, src)
#define swig_owntype int
/* for raw packed data */
@@ -229,6 +230,14 @@ SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
return 0;
}
+/* Acquire a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, int own) {
+ /* TODO */
+ return 0;
+}
+
/* Function for getting a pointer value */
SWIGRUNTIME int
@@ -268,7 +277,7 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_
voidptr = INT2PTR(void *,tmp);
} else if (! SvOK(sv)) { /* Check for undef */
*(ptr) = (void *) 0;
- return SWIG_OK;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
} else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
if (!SvROK(sv)) {
/* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value. */
@@ -392,7 +401,7 @@ SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info
return result;
}
-/* Convert a packed value value */
+/* Convert a packed pointer value */
SWIGRUNTIME int
SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
swig_cast_info *tc;
diff --git a/Lib/perl5/perltypemaps.swg b/Lib/perl5/perltypemaps.swg
index ffec5eaf1..bf1596e9f 100644
--- a/Lib/perl5/perltypemaps.swg
+++ b/Lib/perl5/perltypemaps.swg
@@ -43,7 +43,7 @@
/* Perl types */
#define SWIG_Object SV *
-#define VOID_Object sv_newmortal()
+#define VOID_Object &PL_sv_undef
/* Perl $shadow flag */
#define %newpointer_flags $shadow
@@ -56,7 +56,7 @@
%define %set_output(obj) $result = obj; argvi++ %enddef
/* append output */
-%define %append_output(obj) if (argvi >= items) EXTEND(sp,1); %set_output(obj) %enddef
+%define %append_output(obj) if (argvi >= items) EXTEND(sp, argvi+1); %set_output(obj) %enddef
/* variable output */
%define %set_varoutput(obj) sv_setsv($result,obj) %enddef
@@ -71,6 +71,10 @@
/* raise exception */
%define %raise(obj, type, desc) sv_setsv(get_sv("@", GV_ADD), obj); SWIG_fail %enddef
+/* For directors to raise/throw the original exception */
+%typemap(throws) Swig::DirectorException
+%{ sv_setsv(ERRSV, $1.getNative()); SWIG_fail; %}
+
/* Include the unified typemap library */
%include <typemaps/swigtypemaps.swg>
diff --git a/Lib/perl5/std_list.i b/Lib/perl5/std_list.i
index cd5a61120..36678add2 100644
--- a/Lib/perl5/std_list.i
+++ b/Lib/perl5/std_list.i
@@ -189,11 +189,15 @@ namespace std {
}
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;
list();
- list(const list<T> &);
+ list(const list& other);
unsigned int size() const;
bool empty() const;
@@ -346,7 +350,7 @@ namespace std {
typedef const value_type& const_reference;
list();
- list(const list<T> &);
+ list(const list& other);
unsigned int size() const;
bool empty() const;
diff --git a/Lib/perl5/std_map.i b/Lib/perl5/std_map.i
index af49ed38e..1b3731832 100644
--- a/Lib/perl5/std_map.i
+++ b/Lib/perl5/std_map.i
@@ -20,22 +20,28 @@
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
bool empty() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -45,14 +51,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
}
diff --git a/Lib/perl5/std_pair.i b/Lib/perl5/std_pair.i
index 0712ad762..732347db5 100644
--- a/Lib/perl5/std_pair.i
+++ b/Lib/perl5/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
- pair(T t, U u);
- pair(const pair& p);
+ pair(T first, U second);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/perl5/std_vector.i b/Lib/perl5/std_vector.i
index ec8449464..5bfd2c5ac 100644
--- a/Lib/perl5/std_vector.i
+++ b/Lib/perl5/std_vector.i
@@ -181,11 +181,16 @@ namespace std {
}
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, const T& value);
- vector(const vector<T> &);
+ vector(const vector& other);
unsigned int size() const;
bool empty() const;
@@ -353,11 +358,16 @@ namespace std {
}
public:
typedef size_t size_type;
- typedef T value_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;
+
vector(unsigned int size = 0);
vector(unsigned int size, T *value);
- vector(const vector<T *> &);
+ vector(const vector& other);
unsigned int size() const;
bool empty() const;
@@ -524,11 +534,16 @@ namespace std {
}
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, T value);
- vector(const vector<T> &);
+ vector(const vector& other);
unsigned int size() const;
bool empty() const;
diff --git a/Lib/perl5/stl.i b/Lib/perl5/stl.i
index b19eae58b..04f86014f 100644
--- a/Lib/perl5/stl.i
+++ b/Lib/perl5/stl.i
@@ -1,8 +1,7 @@
/* -----------------------------------------------------------------------------
* stl.i
- *
- * Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
+
%include <std_common.i>
%include <std_string.i>
%include <std_vector.i>
diff --git a/Lib/perl5/typemaps.i b/Lib/perl5/typemaps.i
index 7d96f2ace..3e1f60d90 100644
--- a/Lib/perl5/typemaps.i
+++ b/Lib/perl5/typemaps.i
@@ -168,7 +168,7 @@ output values.
bool *OUTPUT, bool &OUTPUT
{
if (argvi >= items) {
- EXTEND(sp,1);
+ EXTEND(sp, argvi+1);
}
$result = sv_newmortal();
sv_setiv($result,(IV) *($1));
@@ -181,7 +181,7 @@ output values.
unsigned char *OUTPUT, unsigned char &OUTPUT
{
if (argvi >= items) {
- EXTEND(sp,1);
+ EXTEND(sp, argvi+1);
}
$result = sv_newmortal();
sv_setuv($result,(UV) *($1));
@@ -194,7 +194,7 @@ output values.
double *OUTPUT, double &OUTPUT
{
if (argvi >= items) {
- EXTEND(sp,1);
+ EXTEND(sp, argvi+1);
}
$result = sv_newmortal();
sv_setnv($result,(double) *($1));
@@ -204,7 +204,7 @@ output values.
%typemap(argout) long long *OUTPUT, long long &OUTPUT {
char temp[256];
if (argvi >= items) {
- EXTEND(sp,1);
+ EXTEND(sp, argvi+1);
}
sprintf(temp,"%lld", (long long)*($1));
$result = sv_newmortal();
@@ -215,7 +215,7 @@ output values.
%typemap(argout) unsigned long long *OUTPUT, unsigned long long &OUTPUT {
char temp[256];
if (argvi >= items) {
- EXTEND(sp,1);
+ EXTEND(sp, argvi+1);
}
sprintf(temp,"%llu", (unsigned long long)*($1));
$result = sv_newmortal();
diff --git a/Lib/php/const.i b/Lib/php/const.i
index d62f162c1..32b4b9b0b 100644
--- a/Lib/php/const.i
+++ b/Lib/php/const.i
@@ -39,8 +39,7 @@
SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0);
zval_copy_ctor(&c.value);
c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0);
- c.flags = CONST_CS;
- c.module_number = module_number;
+ SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number);
zend_register_constant(&c);
}
diff --git a/Lib/php/globalvar.i b/Lib/php/globalvar.i
index a5fd779ab..6b31207a6 100644
--- a/Lib/php/globalvar.i
+++ b/Lib/php/globalvar.i
@@ -136,7 +136,7 @@
%typemap(varin) SWIGTYPE []
{
- if($1) {
+ 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);
}
@@ -144,15 +144,15 @@
%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);
- }
+ 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
@@ -166,7 +166,6 @@
}
$1 = *($&1_ltype)_temp;
-
}
%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
@@ -245,7 +244,7 @@
(z_var)->value.str.val = 0;
(z_var)->value.str.len = 0;
}
- }
+ }
}
%typemap(varout) SWIGTYPE
diff --git a/Lib/php/php.swg b/Lib/php/php.swg
index c9b9a5217..4eba6be2a 100644
--- a/Lib/php/php.swg
+++ b/Lib/php/php.swg
@@ -5,6 +5,7 @@
* ----------------------------------------------------------------------------- */
%runtime "swigrun.swg" // Common C API type-checking code
+%runtime "swigerrors.swg" // SWIG errors
%runtime "phprun.swg" // PHP runtime functions
%include <phpinit.swg> // PHP initialization routine.
@@ -134,7 +135,7 @@
%typemap(in) SWIGTYPE *DISOWN
%{
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");
+ SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
}
%}
@@ -148,8 +149,8 @@
if (SWIG_ConvertPtr(&$input, (void **) &$1, 0, 0) < 0) {
/* Allow NULL from php for void* */
if (Z_ISNULL($input)) $1=0;
- else
- SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
+ else
+ SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
}
%}
@@ -470,30 +471,36 @@
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
{
void *tmp;
- _v = (SWIG_ConvertPtr(&$input, (void **)&tmp, $&1_descriptor, 0) >= 0);
+ $1 = (SWIG_ConvertPtr(&$input, (void **)&tmp, $&1_descriptor, SWIG_POINTER_NO_NULL) >= 0);
}
%typecheck(SWIG_TYPECHECK_POINTER)
SWIGTYPE *,
SWIGTYPE [],
- SWIGTYPE &,
- SWIGTYPE &&,
SWIGTYPE *const&
{
void *tmp;
- _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, 0) >= 0);
+ $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, 0) >= 0);
+}
+
+%typecheck(SWIG_TYPECHECK_POINTER)
+ SWIGTYPE &,
+ SWIGTYPE &&
+{
+ void *tmp;
+ $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, SWIG_POINTER_NO_NULL) >= 0);
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
{
void *tmp;
- _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, $*1_descriptor, 0) >= 0);
+ $1 = (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);
+ $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, 0, 0) >= 0);
}
/* Exception handling */
@@ -525,7 +532,8 @@
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
-
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
/* php keywords */
%include <phpkw.swg>
diff --git a/Lib/php/phpinit.swg b/Lib/php/phpinit.swg
index 1f252d1ac..1665f5dc4 100644
--- a/Lib/php/phpinit.swg
+++ b/Lib/php/phpinit.swg
@@ -1,13 +1,13 @@
/* ------------------------------------------------------------
- * The start of the PHP initialization function
+ * The start of the PHP initialization function
* ------------------------------------------------------------ */
%insert(init) "swiginit.swg"
%init %{
SWIG_php_minit {
- SWIG_InitializeModule(0);
+ SWIG_InitializeModule((void*)&module_number);
%}
%fragment("swig_php_init_member_ptr2", "header") %{
@@ -21,5 +21,5 @@ static int swig_member_ptr = 0;
%}
%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);
+ swig_member_ptr = zend_register_list_destructors_ex(swig_member_ptr_dtor, NULL, SWIG_MEMBER_PTR, module_number);
%}
diff --git a/Lib/php/phpkw.swg b/Lib/php/phpkw.swg
index db451f957..5c5296a1f 100644
--- a/Lib/php/phpkw.swg
+++ b/Lib/php/phpkw.swg
@@ -30,13 +30,11 @@
* 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(callable);
PHPKW(case);
PHPKW(catch);
PHPKW(class);
@@ -45,71 +43,57 @@ 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(finally);
PHPKW(for);
PHPKW(foreach);
PHPKW(function);
PHPKW(global);
-PHPKW(goto); // As of PHP 5.3
+PHPKW(goto);
PHPKW(if);
PHPKW(implements);
-PHPKW(include); // "Language construct"
-PHPKW(include_once); // "Language construct"
PHPKW(instanceof);
-PHPKW(insteadof); // As of PHP 5.4
+PHPKW(insteadof);
PHPKW(interface);
-PHPKW(isset); // "Language construct"
-PHPKW(list); // "Language construct"
-PHPKW(namespace); // As of PHP 5.3
+PHPKW(namespace);
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(trait);
PHPKW(try);
-PHPKW(unset); // "Language construct"
PHPKW(use);
PHPKW(var);
PHPKW(while);
PHPKW(xor);
-PHPKW(yield); // As of PHP 5.5
+PHPKW(yield);
// 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(__dir__);
PHPKW(__file__);
PHPKW(__function__);
PHPKW(__line__);
PHPKW(__method__);
-PHPKW(__namespace__); // As of PHP 5.3
-PHPKW(__trait__); // As of PHP 5.4
+PHPKW(__namespace__);
+PHPKW(__trait__);
/* We classify these as built-in names since they conflict, but PHP still runs */
@@ -122,27 +106,27 @@ 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_MAJOR_VERSION);
+PHPBN2(PHP_MINOR_VERSION);
+PHPBN2(PHP_RELEASE_VERSION);
+PHPBN2(PHP_VERSION_ID);
+PHPBN2(PHP_EXTRA_VERSION);
+PHPBN2(PHP_ZTS);
+PHPBN2(PHP_DEBUG);
+PHPBN2(PHP_MAXPATHLEN);
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(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_BINARY); // As of PHP 5.4
-PHPBN2(PHP_MANDIR); // As of PHP 5.3.7
+PHPBN2(PHP_BINARY);
+PHPBN2(PHP_MANDIR);
PHPBN2(PHP_LIBDIR);
PHPBN2(PHP_DATADIR);
PHPBN2(PHP_SYSCONFDIR);
@@ -161,11 +145,11 @@ 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_DEPRECATED);
+PHPBN2(E_USER_DEPRECATED);
PHPBN2(E_ALL);
PHPBN2(E_STRICT);
-PHPBN2(__COMPILER_HALT_OFFSET__); // As of PHP 5.1.0
+PHPBN2(__COMPILER_HALT_OFFSET__);
// 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.
@@ -174,17 +158,17 @@ 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
+PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER);
+PHPBN2(PHP_WINDOWS_NT_SERVER);
+PHPBN2(PHP_WINDOWS_NT_WORKSTATION);
+PHPBN2(PHP_WINDOWS_VERSION_BUILD);
+PHPBN2(PHP_WINDOWS_VERSION_MAJOR);
+PHPBN2(PHP_WINDOWS_VERSION_MINOR);
+PHPBN2(PHP_WINDOWS_VERSION_PLATFORM);
+PHPBN2(PHP_WINDOWS_VERSION_PRODUCTTYPE);
+PHPBN2(PHP_WINDOWS_VERSION_SP_MAJOR);
+PHPBN2(PHP_WINDOWS_VERSION_SP_MINOR);
+PHPBN2(PHP_WINDOWS_VERSION_SUITEMASK);
/* "Standard Predefined Constants" from http://php.net/manual/en/reserved.constants.php */
PHPBN2(EXTR_OVERWRITE);
PHPBN2(EXTR_SKIP);
@@ -214,8 +198,8 @@ 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(INI_SCANNER_NORMAL);
+PHPBN2(INI_SCANNER_RAW);
PHPBN2(M_E);
PHPBN2(M_LOG2E);
PHPBN2(M_LOG10E);
@@ -229,10 +213,10 @@ 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(M_EULER);
+PHPBN2(M_LNPI);
+PHPBN2(M_SQRT3);
+PHPBN2(M_SQRTPI);
PHPBN2(CRYPT_SALT_LENGTH);
PHPBN2(CRYPT_STD_DES);
PHPBN2(CRYPT_EXT_DES);
@@ -273,7 +257,7 @@ PHPBN2(STR_PAD_BOTH);
PHPBN2(PATHINFO_DIRNAME);
PHPBN2(PATHINFO_BASENAME);
PHPBN2(PATHINFO_EXTENSION);
-PHPBN2(PATHINFO_FILENAME); // As of PHP 5.2
+PHPBN2(PATHINFO_FILENAME);
PHPBN2(PATH_SEPARATOR);
PHPBN2(CHAR_MAX);
PHPBN2(LC_CTYPE);
@@ -393,7 +377,6 @@ 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);
@@ -415,10 +398,10 @@ 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(CURLOPT_TCP_NODELAY);
+PHPBN2(CURLOPT_TIMEOUT_MS);
+PHPBN2(CURLOPT_CONNECTTIMEOUT_MS);
+PHPBN2(GMP_VERSION);
PHPBN2(SWFTEXTFIELD_USEFONT);
PHPBN2(SWFTEXTFIELD_AUTOSIZE);
PHPBN2(SWF_SOUND_NOT_COMPRESSED);
@@ -440,7 +423,6 @@ 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);
@@ -504,7 +486,6 @@ PHPBN2(SIG_UNBLOCK);
PHPBN2(TRAP_BRKPT);
PHPBN2(TRAP_TRACE);
-/* Added in PHP 5.4 */
PHPBN2(ENT_DISALLOWED);
PHPBN2(ENT_HTML401);
PHPBN2(ENT_HTML5);
@@ -583,7 +564,6 @@ 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);
@@ -622,7 +602,6 @@ 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);
@@ -654,10 +633,10 @@ PHPCN(stdclass);
PHPCN(__php_incomplete_class);
/* Added in PHP5. */
PHPCN(exception);
-PHPCN(errorexception); // As of PHP 5.1
+PHPCN(errorexception);
PHPCN(php_user_filter);
-PHPCN(closure); // As of PHP 5.3
-PHPCN(generator); // As of PHP 5.5
+PHPCN(closure);
+PHPCN(generator);
PHPCN(self);
PHPCN(static);
PHPCN(parent);
@@ -772,7 +751,9 @@ 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(__halt_compiler);
PHPFN(acos);
+PHPFN(array);
PHPFN(array_change_key_case);
PHPFN(array_chunk);
PHPFN(array_column);
@@ -834,17 +815,26 @@ PHPFN(cos);
PHPFN(cosh);
PHPFN(count);
PHPFN(current);
+PHPFN(die); // "Language construct"
PHPFN(each);
+PHPFN(echo); // "Language construct"
+PHPFN(empty);
PHPFN(end);
+PHPFN(eval); // "Language construct"
+PHPFN(exit); // "Language construct"
PHPFN(exp);
PHPFN(extract);
PHPFN(floor);
PHPFN(fmod);
PHPFN(in_array);
+PHPFN(include); // "Language construct"
+PHPFN(include_once); // "Language construct"
+PHPFN(isset); // "Language construct"
PHPFN(key);
PHPFN(key_exists);
PHPFN(krsort);
PHPFN(ksort);
+PHPFN(list); // "Language construct"
PHPFN(log);
PHPFN(log10);
PHPFN(max);
@@ -855,9 +845,13 @@ PHPFN(next);
PHPFN(pos);
PHPFN(pow);
PHPFN(prev);
+PHPFN(print); // "Language construct"
PHPFN(range);
PHPFN(reset);
PHPFN(rsort);
+PHPFN(require); // "Language construct"
+PHPFN(require_once); // "Language construct"
+PHPFN(return); // "Language construct"
PHPFN(shuffle);
PHPFN(sin);
PHPFN(sinh);
@@ -868,6 +862,7 @@ PHPFN(tan);
PHPFN(tanh);
PHPFN(uasort);
PHPFN(uksort);
+PHPFN(unset); // "Language construct"
PHPFN(usort);
#undef PHPKW
diff --git a/Lib/php/phprun.swg b/Lib/php/phprun.swg
index 5c62d1927..a07a1b9f8 100644
--- a/Lib/php/phprun.swg
+++ b/Lib/php/phprun.swg
@@ -13,7 +13,7 @@ extern "C" {
#include "php.h"
#if PHP_MAJOR_VERSION != 7
-# error These bindings need PHP7 - to generate PHP5 bindings use: swig -php5
+# error These bindings need PHP7 - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
#endif
#include "ext/standard/php_string.h"
@@ -32,6 +32,13 @@ extern "C" {
REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\
} while (0)
+/* ZEND_CONSTANT_SET_FLAGS is new in PHP 7.3. */
+#ifdef ZEND_CONSTANT_SET_FLAGS
+# define SWIG_ZEND_CONSTANT_SET_FLAGS ZEND_CONSTANT_SET_FLAGS
+#else
+# define SWIG_ZEND_CONSTANT_SET_FLAGS(C, F, N) do { (C)->flags = (F); (C)->module_number = (N); } while (0)
+#endif
+
#ifdef __cplusplus
}
#endif
@@ -50,7 +57,7 @@ static int default_error_code = E_ERROR;
/* Standard SWIG API */
#define SWIG_GetModule(clientdata) SWIG_Php_GetModule()
-#define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer)
+#define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer, *(int*)clientdata)
/* used to wrap returned objects in so we know whether they are newobject
and need freeing, or not */
@@ -217,13 +224,13 @@ SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
return (*ptr == NULL ? -1 : 0);
case IS_NULL:
*ptr = 0;
- return 0;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
return -1;
}
-static char const_name[] = "swig_runtime_data_type_pointer";
+static const 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) {
@@ -234,6 +241,6 @@ static swig_module_info *SWIG_Php_GetModule() {
return NULL;
}
-static void SWIG_Php_SetModule(swig_module_info *pointer) {
- REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, CONST_PERSISTENT | CONST_CS);
+static void SWIG_Php_SetModule(swig_module_info *pointer, int module_number) {
+ REGISTER_LONG_CONSTANT(const_name, (long) pointer, CONST_CS | CONST_PERSISTENT);
}
diff --git a/Lib/php/std_map.i b/Lib/php/std_map.i
index 6d5e3db13..7c0157353 100644
--- a/Lib/php/std_map.i
+++ b/Lib/php/std_map.i
@@ -20,21 +20,27 @@
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -44,14 +50,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
bool is_empty() const {
diff --git a/Lib/php/std_pair.i b/Lib/php/std_pair.i
index fe45ee676..732347db5 100644
--- a/Lib/php/std_pair.i
+++ b/Lib/php/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/php/std_vector.i b/Lib/php/std_vector.i
index 9cc1486ef..e633bc3ad 100644
--- a/Lib/php/std_vector.i
+++ b/Lib/php/std_vector.i
@@ -14,10 +14,17 @@ namespace std {
template<class T> class vector {
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;
+
vector();
vector(size_type n);
+ vector(const vector& other);
+
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
@@ -56,10 +63,17 @@ namespace std {
template<> class vector<bool> {
public:
typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
typedef bool value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
typedef bool const_reference;
+
vector();
vector(size_type n);
+ vector(const vector& other);
+
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
diff --git a/Lib/php/stl.i b/Lib/php/stl.i
index 9d2e91eee..04f86014f 100644
--- a/Lib/php/stl.i
+++ b/Lib/php/stl.i
@@ -1,7 +1,5 @@
/* -----------------------------------------------------------------------------
* stl.i
- *
- * Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
%include <std_common.i>
diff --git a/Lib/php/utils.i b/Lib/php/utils.i
index 8581646a2..ed6e08ff4 100644
--- a/Lib/php/utils.i
+++ b/Lib/php/utils.i
@@ -77,18 +77,12 @@
%{
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;
%}
diff --git a/Lib/php5/const.i b/Lib/php5/const.i
deleted file mode 100644
index 061ba99a2..000000000
--- a/Lib/php5/const.i
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -----------------------------------------------------------------------------
- * const.i
- *
- * Typemaps for constants
- * ----------------------------------------------------------------------------- */
-
-%typemap(consttab) int,
- unsigned int,
- short,
- unsigned short,
- long,
- unsigned long,
- unsigned char,
- signed char,
- bool,
- enum SWIGTYPE
- "SWIG_LONG_CONSTANT($symname, ($1_type)$value);";
-
-%typemap(consttab) float,
- double
- "SWIG_DOUBLE_CONSTANT($symname, $value);";
-
-%typemap(consttab) char
- "SWIG_CHAR_CONSTANT($symname, $value);";
-
-%typemap(consttab) char *,
- const char *,
- char [],
- const char []
- "SWIG_STRING_CONSTANT($symname, $value);";
-
-%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);
- c.value = *z_var;
- zval_copy_ctor(&c.value);
- c.name = zend_strndup("$symname", len);
- c.name_len = len+1;
- c.flags = CONST_CS | CONST_PERSISTENT;
- c.module_number = module_number;
- zend_register_constant( &c TSRMLS_CC );
-}
-
-/* Handled as a global variable. */
-%typemap(consttab) SWIGTYPE (CLASS::*) "";
diff --git a/Lib/php5/director.swg b/Lib/php5/director.swg
deleted file mode 100644
index 638a1697d..000000000
--- a/Lib/php5/director.swg
+++ /dev/null
@@ -1,170 +0,0 @@
-/* -----------------------------------------------------------------------------
- * 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/Lib/php5/factory.i b/Lib/php5/factory.i
deleted file mode 100644
index c4e082dd2..000000000
--- a/Lib/php5/factory.i
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- Implement a more natural wrap for factory methods, for example, if
- you have:
-
- ---- geometry.h --------
- struct Geometry {
- enum GeomType{
- POINT,
- CIRCLE
- };
-
- virtual ~Geometry() {}
- virtual int draw() = 0;
-
- //
- // Factory method for all the Geometry objects
- //
- static Geometry *create(GeomType i);
- };
-
- struct Point : Geometry {
- int draw() { return 1; }
- double width() { return 1.0; }
- };
-
- struct Circle : Geometry {
- int draw() { return 2; }
- double radius() { return 1.5; }
- };
-
- //
- // Factory method for all the Geometry objects
- //
- Geometry *Geometry::create(GeomType type) {
- switch (type) {
- case POINT: return new Point();
- case CIRCLE: return new Circle();
- default: return 0;
- }
- }
- ---- geometry.h --------
-
-
- You can use the %factory with the Geometry::create method as follows:
-
- %newobject Geometry::create;
- %factory(Geometry *Geometry::create, Point, Circle);
- %include "geometry.h"
-
- and Geometry::create will return a 'Point' or 'Circle' instance
- instead of the plain 'Geometry' type. For example, in python:
-
- circle = Geometry.create(Geometry.CIRCLE)
- r = circle.radius()
-
- where circle is a Circle proxy instance.
-
- NOTES: remember to fully qualify all the type names and don't
- use %factory inside a namespace declaration, ie, instead of
-
- namespace Foo {
- %factory(Geometry *Geometry::create, Point, Circle);
- }
-
- use
-
- %factory(Foo::Geometry *Foo::Geometry::create, Foo::Point, Foo::Circle);
-
-
-*/
-
-/* for loop for macro with one argument */
-%define %_formacro_1(macro, arg1,...)macro(arg1)
-#if #__VA_ARGS__ != "__fordone__"
-%_formacro_1(macro, __VA_ARGS__)
-#endif
-%enddef
-
-/* for loop for macro with one argument */
-%define %formacro_1(macro,...)%_formacro_1(macro,__VA_ARGS__,__fordone__)%enddef
-%define %formacro(macro,...)%_formacro_1(macro,__VA_ARGS__,__fordone__)%enddef
-
-/* for loop for macro with two arguments */
-%define %_formacro_2(macro, arg1, arg2, ...)macro(arg1, arg2)
-#if #__VA_ARGS__ != "__fordone__"
-%_formacro_2(macro, __VA_ARGS__)
-#endif
-%enddef
-
-/* for loop for macro with two arguments */
-%define %formacro_2(macro,...)%_formacro_2(macro, __VA_ARGS__, __fordone__)%enddef
-
-%define %_factory_dispatch(Type)
-if (!dcast) {
- Type *dobj = dynamic_cast<Type *>($1);
- if (dobj) {
- dcast = 1;
- SWIG_SetPointerZval(return_value, SWIG_as_voidptr(dobj),$descriptor(Type *), $owner);
- }
-}%enddef
-
-%define %factory(Method,Types...)
-%typemap(out) Method {
- int dcast = 0;
- %formacro(%_factory_dispatch, Types)
- if (!dcast) {
- SWIG_SetPointerZval(return_value, SWIG_as_voidptr($1),$descriptor, $owner);
- }
-}%enddef
diff --git a/Lib/php5/globalvar.i b/Lib/php5/globalvar.i
deleted file mode 100644
index a3e99f510..000000000
--- a/Lib/php5/globalvar.i
+++ /dev/null
@@ -1,361 +0,0 @@
-/* -----------------------------------------------------------------------------
- * globalvar.i
- *
- * Global variables - add the variable to PHP
- * ----------------------------------------------------------------------------- */
-
-%typemap(varinit) char *
-{
- zval *z_var;
- MAKE_STD_ZVAL(z_var);
- z_var->type = IS_STRING;
- if($1) {
- z_var->value.str.val = estrdup($1);
- z_var->value.str.len = strlen($1);
- } else {
- z_var->value.str.val = 0;
- z_var->value.str.len = 0;
- }
- 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,
- short,
- unsigned short,
- long,
- unsigned long,
- signed char,
- unsigned char,
- enum SWIGTYPE
-{
- zval *z_var;
- MAKE_STD_ZVAL(z_var);
- z_var->type = IS_LONG;
- z_var->value.lval = (long)$1;
- zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void *)&z_var, sizeof(zval *), NULL);
-}
-
-%typemap(varinit) bool
-{
- zval *z_var;
- MAKE_STD_ZVAL(z_var);
- z_var->type = IS_BOOL;
- z_var->value.lval = ($1)?1:0;
- zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void *)&z_var, sizeof(zval *), NULL);
-}
-
-%typemap(varinit) float, double
-{
- zval *z_var;
- MAKE_STD_ZVAL(z_var);
- z_var->type = IS_DOUBLE;
- z_var->value.dval = $1;
- zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void *)&z_var,
- sizeof(zval *), NULL);
-}
-
-%typemap(varinit) char
-{
- zval *z_var;
- char c[2];
- MAKE_STD_ZVAL(z_var);
- c[0] = $1;
- c[1] = 0;
- z_var->type = IS_STRING;
- z_var->value.str.val = estrndup(c, 1);
- z_var->value.str.len = 1;
- zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void *)&z_var,
- sizeof(zval *), NULL);
-}
-
-%typemap(varinit) SWIGTYPE *, SWIGTYPE []
-{
- zval *z_var;
- MAKE_STD_ZVAL(z_var);
- SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0);
- zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void *)&z_var,
- sizeof(zval *), NULL);
-}
-
-%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&
-{
- zval *z_var;
-
- MAKE_STD_ZVAL(z_var);
- SWIG_SetPointerZval(z_var, (void*)&$1, $&1_descriptor, 0);
- zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void*)&z_var,
- sizeof(zval *), NULL);
-}
-
-%typemap(varinit) char [ANY]
-{
- zval *z_var;
- MAKE_STD_ZVAL(z_var);
- z_var->type = IS_STRING;
- 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);
-}
-
-%typemap(varinit, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
-{
- void * p = emalloc(sizeof($1));
- memcpy(p, &$1, sizeof($1));
- zval * resource;
- MAKE_STD_ZVAL(resource);
- ZEND_REGISTER_RESOURCE(resource, p, swig_member_ptr);
- zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void*)&resource, sizeof(zval *), NULL);
-}
-
-%typemap(varin) int, unsigned int, short, unsigned short, long, unsigned long, signed char, unsigned char, enum SWIGTYPE
-{
- zval **z_var;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- convert_to_long_ex(z_var);
- if ($1 != ($1_ltype)((*z_var)->value.lval)) {
- $1 = Z_LVAL_PP(z_var);
- }
-}
-
-%typemap(varin) bool
-{
- zval **z_var;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- convert_to_boolean_ex(z_var);
- if ($1 != ($1_ltype)((*z_var)->value.lval)) {
- $1 = Z_LVAL_PP(z_var);
- }
-}
-
-%typemap(varin) double,float
-{
- zval **z_var;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- convert_to_double_ex(z_var);
- if ($1 != ($1_ltype)((*z_var)->value.dval)) {
- $1 = Z_DVAL_PP(z_var);
- }
-}
-
-%typemap(varin) char
-{
- zval **z_var;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- convert_to_string_ex(z_var);
- if ($1 != *((*z_var)->value.str.val)) {
- $1 = *((*z_var)->value.str.val);
- }
-}
-
-%typemap(varin) char *
-{
- zval **z_var;
- char *s1;
-
- 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) || strcmp(s1, $1)) {
- if (s1)
- $1 = estrdup(s1);
- else
- $1 = NULL;
- }
-}
-
-
-%typemap(varin) SWIGTYPE []
-{
- zval **z_var;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- if($1) {
- SWIG_SetPointerZval(*z_var, (void*)$1, $1_descriptor, $owner);
- }
-}
-
-%typemap(varin) char [ANY]
-{
- zval **z_var;
- char *s1;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- s1 = Z_STRVAL_PP(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;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- 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;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- 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_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- void * p = (void*)zend_fetch_resource(*z_var TSRMLS_CC, -1, SWIG_MEMBER_PTR, NULL, 1, 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_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- if($1 != ($1_ltype)((*z_var)->value.lval)) {
- (*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_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- if($1 != ($1_ltype)((*z_var)->value.lval)) {
- (*z_var)->value.lval = (long)$1;
- }
-}
-
-%typemap(varout) double, float
-{
- zval **z_var;
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- if($1 != ($1_ltype)((*z_var)->value.dval)) {
- (*z_var)->value.dval = (double)$1;
- }
-}
-
-%typemap(varout) char
-{
- zval **z_var;
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- if($1 != *((*z_var)->value.str.val)) {
- char c[2];
- efree((*z_var)->value.str.val);
- c[0] = $1;
- c[1] = 0;
- (*z_var)->value.str.val = estrdup(c);
- }
-}
-
-%typemap(varout) char *
-{
- zval **z_var;
- char *s1;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- s1 = Z_STRVAL_PP(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_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- SWIG_SetPointerZval(*z_var, (void*)&$1, $&1_descriptor, 0);
-}
-
-%typemap(varout) SWIGTYPE []
-{
- zval **z_var;
-
- zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- if($1)
- SWIG_SetPointerZval(*z_var, (void*)$1, $1_descriptor, 0);
-}
-
-%typemap(varout) char [ANY]
-{
- zval **z_var;
- char *s1;
-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) || 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_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- SWIG_SetPointerZval(*z_var, (void*)$1, $1_descriptor, 0);
-}
-
-%typemap(varout, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
-{
- void * p = emalloc(sizeof($1));
- memcpy(p, &$1, sizeof($1));
- zval * resource;
- MAKE_STD_ZVAL(resource);
- ZEND_REGISTER_RESOURCE(resource, p, swig_member_ptr);
- zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void*)&resource, sizeof(zval *), NULL);
-}
diff --git a/Lib/php5/php.swg b/Lib/php5/php.swg
deleted file mode 100644
index 535c7d347..000000000
--- a/Lib/php5/php.swg
+++ /dev/null
@@ -1,529 +0,0 @@
-/* -----------------------------------------------------------------------------
- * php.swg
- *
- * PHP configuration file
- * ----------------------------------------------------------------------------- */
-
-%runtime "swigrun.swg" // Common C API type-checking code
-%runtime "phprun.swg" // PHP runtime functions
-
-%include <phpinit.swg> // PHP initialization routine.
-
-%include <globalvar.i> // Global variables.
-%include <const.i>
-
-// use %init %{ "/*code goes here*/ " %}
-// or %minit %{ "/* code goes here*/ " %} to
-// insert code in the PHP_MINIT_FUNCTION
-#define %minit %insert("init")
-
-// use %rinit %{ "/* code goes here*/ " %} to
-// insert code in the PHP_RINIT_FUNCTION
-#define %rinit %insert("rinit")
-
-// use %shutdown %{ " /*code goes here*/ " %} to
-// insert code in the PHP_MSHUTDOWN_FUNCTION
-#define %shutdown %insert("shutdown")
-#define %mshutdown %insert("shutdown")
-
-// use %rshutdown %{ " /*code goes here*/" %} to
-// insert code in the PHP_RSHUTDOWN_FUNCTION
-#define %rshutdown %insert("rshutdown")
-
-/* Typemaps for input parameters by value */
-
-%include <utils.i>
-
-%pass_by_val(bool,CONVERT_BOOL_IN);
-
-%pass_by_val(size_t, CONVERT_INT_IN);
-
-%pass_by_val(enum SWIGTYPE, CONVERT_INT_IN);
-
-%pass_by_val(signed int, CONVERT_INT_IN);
-%pass_by_val(int,CONVERT_INT_IN);
-%pass_by_val(unsigned int,CONVERT_INT_IN);
-
-%pass_by_val(signed short, CONVERT_INT_IN);
-%pass_by_val(short,CONVERT_INT_IN);
-%pass_by_val(unsigned short, CONVERT_INT_IN);
-
-%pass_by_val(signed long, CONVERT_INT_IN);
-%pass_by_val(long, CONVERT_INT_IN);
-%pass_by_val(unsigned long, CONVERT_INT_IN);
-
-%pass_by_val(signed long long, CONVERT_LONG_LONG_IN);
-%pass_by_val(long long, CONVERT_LONG_LONG_IN);
-%pass_by_val(unsigned long long, CONVERT_UNSIGNED_LONG_LONG_IN);
-
-%pass_by_val(signed char, CONVERT_INT_IN);
-%pass_by_val(char, CONVERT_CHAR_IN);
-%pass_by_val(unsigned char, CONVERT_INT_IN);
-
-%pass_by_val(float, CONVERT_FLOAT_IN);
-
-%pass_by_val(double, CONVERT_FLOAT_IN);
-
-%pass_by_val(char *, CONVERT_STRING_IN);
-%typemap(in) char *& = const char *&;
-%typemap(directorout) char *& = const char *&;
-
-// 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);
-}
-
-%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);
-}
-
-/* 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) {
- SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
- }
- $1 = *tmp;
-}
-
-%typemap(directorout) SWIGTYPE ($&1_ltype tmp)
-{
- /* 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;
- }
-}
-
-%typemap(in) SWIGTYPE *,
- SWIGTYPE []
-{
- 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) {
- 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) {
- 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) {
- SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
- }
-}
-
-%typemap(argout) SWIGTYPE *,
- SWIGTYPE [],
- SWIGTYPE &,
- SWIGTYPE &&;
-
-%typemap(in) void *
-{
- if(SWIG_ConvertPtr(*$input, (void **) &$1, 0, 0) < 0) {
- /* Allow NULL from php for void* */
- if ((*$input)->type==IS_NULL) $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 */
-%typemap(in) void ** ($*1_ltype ptr, int force),
- void *& ($*1_ltype ptr, int force)
-{
- /* 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) {
- /* 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))) {
- /* wasn't a pre/ref/thing, OR anything like an int thing */
- SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname.");
- }
- }
- force=0;
- if (arg1==NULL) {
-#ifdef __cplusplus
- ptr=new $*1_ltype();
-#else
- ptr=($*1_ltype) calloc(1,sizeof($*1_ltype));
-#endif
- $1=&ptr;
- /* have to passback arg$arg too */
- force=1;
- }
-}
-%typemap(argout) void **,
- void *&
-{
- if (force$argnum) {
- SWIG_SetPointerZval( *$input, (void*) ptr$argnum, $*1_descriptor, 1);
- }
-}
-
-/* Typemap for output values */
-
-%typemap(out) int,
- unsigned int,
- short,
- unsigned short,
- long,
- unsigned long,
- signed char,
- unsigned char,
- bool,
- 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) {
- return_value->value.lval = (long)($1);
- return_value->type = IS_LONG;
- } else {
- char temp[256];
- sprintf(temp, "%lld", (long long)$1);
- ZVAL_STRING(return_value, temp, 1);
- }
-%}
-%typemap(out) unsigned long long
-%{
- if ($1 <= (unsigned long long)LONG_MAX) {
- return_value->value.lval = (long)($1);
- return_value->type = IS_LONG;
- } else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)$1);
- ZVAL_STRING(return_value, temp, 1);
- }
-%}
-
-%typemap(out) const int &,
- const unsigned int &,
- const short &,
- const unsigned short &,
- const long &,
- const unsigned long &,
- const signed char &,
- const unsigned char &,
- const bool &,
- 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) {
- return_value->value.lval = (long)(*$1);
- return_value->type = IS_LONG;
- } else {
- char temp[256];
- sprintf(temp, "%lld", (long long)(*$1));
- ZVAL_STRING(return_value, temp, 1);
- }
-%}
-%typemap(out) const unsigned long long &
-%{
- if (*$1 <= (unsigned long long)LONG_MAX) {
- return_value->value.lval = (long)(*$1);
- return_value->type = IS_LONG;
- } else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)(*$1));
- ZVAL_STRING(return_value, temp, 1);
- }
-%}
-
-%typemap(directorin) int,
- unsigned int,
- short,
- unsigned short,
- long,
- unsigned long,
- signed char,
- 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);
- }
-}
-
-%typemap(out) bool
-{
- ZVAL_BOOL(return_value,($1)?1:0);
-}
-
-%typemap(out) const bool &
-{
- ZVAL_BOOL(return_value,(*$1)?1:0);
-}
-
-%typemap(directorin) bool
-{
- ZVAL_BOOL($input,($1)?1:0);
-}
-
-%typemap(out) float,
- double
-{
- ZVAL_DOUBLE(return_value,$1);
-}
-
-%typemap(out) const float &,
- const double &
-{
- ZVAL_DOUBLE(return_value,*$1);
-}
-
-%typemap(directorin) float,
- double
-{
- ZVAL_DOUBLE($input,$1);
-}
-
-%typemap(out) char
-{
- ZVAL_STRINGL(return_value,&$1, 1, 1);
-}
-
-%typemap(out) const char &
-{
- ZVAL_STRINGL(return_value,&*$1, 1, 1);
-}
-
-%typemap(out) char *,
- char []
-{
- if(!$1) {
- ZVAL_NULL(return_value);
- } else {
- ZVAL_STRING(return_value, (char *)$1, 1);
- }
-}
-
-%typemap(out) char *&
-{
- if(!*$1) {
- ZVAL_NULL(return_value);
- } else {
- ZVAL_STRING(return_value, (char *)*$1, 1);
- }
-}
-
-%typemap(out) SWIGTYPE *,
- SWIGTYPE [],
- SWIGTYPE &,
- SWIGTYPE &&
-%{
- SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
-%}
-
-%typemap(out) SWIGTYPE *const&
-%{
- SWIG_SetPointerZval(return_value, (void *)*$1, $*1_descriptor, $owner);
-%}
-
-%typemap(directorin) SWIGTYPE *,
- SWIGTYPE [],
- SWIGTYPE &,
- SWIGTYPE &&
-%{
- SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2);
-%}
-
-%typemap(out, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
-{
- void * p = emalloc(sizeof($1));
- memcpy(p, &$1, sizeof($1));
- ZEND_REGISTER_RESOURCE(return_value, 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);
- memcpy(&$1, p, sizeof($1));
-}
-
-%typemap(out) SWIGTYPE *DYNAMIC,
- SWIGTYPE &DYNAMIC
-{
- swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1);
- SWIG_SetPointerZval(return_value, (void *)$1, ty, $owner);
-}
-
-%typemap(out) SWIGTYPE
-#ifdef __cplusplus
-{
- $&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1);
- SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1);
-}
-#else
-{
- $&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type));
- memcpy(resultobj, &$1, sizeof($1_type));
- SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1);
-}
-#endif
-
-%typemap(directorin) SWIGTYPE
-{
- SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1|2);
-}
-
-%typemap(out) void "";
-
-%typemap(out) char [ANY]
-{
- int len = 0;
- while (len < $1_dim0 && $1[len]) ++len;
- RETVAL_STRINGL($1, len, 1);
-}
-
-// This typecheck does hard checking for proper argument type. If you want
-// an argument to be converted from a different PHP type, you must convert
-// 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); "
-%enddef
-
-%php_typecheck(int,SWIG_TYPECHECK_INTEGER,IS_LONG)
-%php_typecheck(unsigned int,SWIG_TYPECHECK_UINT32,IS_LONG)
-%php_typecheck(short,SWIG_TYPECHECK_INT16,IS_LONG)
-%php_typecheck(unsigned short,SWIG_TYPECHECK_UINT16,IS_LONG)
-%php_typecheck(long,SWIG_TYPECHECK_INT32,IS_LONG)
-%php_typecheck(unsigned long,SWIG_TYPECHECK_UINT32,IS_LONG)
-%php_typecheck(long long,SWIG_TYPECHECK_INT64,IS_LONG)
-%php_typecheck(unsigned long long,SWIG_TYPECHECK_UINT64,IS_LONG)
-%php_typecheck(signed char,SWIG_TYPECHECK_INT8,IS_LONG)
-%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_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); "
-
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
-{
- void *tmp;
- _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);
-}
-
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
-{
- void *tmp;
- _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);
-}
-
-/* Exception handling */
-
-%typemap(throws) int,
- long,
- short,
- unsigned int,
- unsigned long,
- unsigned short {
- zend_throw_exception(NULL, const_cast<char*>("C++ $1_type exception thrown"), $1 TSRMLS_CC);
- return;
-}
-
-%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;
-%}
-
-%typemap(throws) char * %{
- zend_throw_exception(NULL, const_cast<char*>($1), 0 TSRMLS_CC);
- return;
-%}
-
-/* Array reference typemaps */
-%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
-
-/* const pointers */
-%apply SWIGTYPE * { SWIGTYPE *const }
-
-
-/* php keywords */
-%include <phpkw.swg>
diff --git a/Lib/php5/phpinit.swg b/Lib/php5/phpinit.swg
deleted file mode 100644
index d8a61b02b..000000000
--- a/Lib/php5/phpinit.swg
+++ /dev/null
@@ -1,25 +0,0 @@
-
-/* ------------------------------------------------------------
- * The start of the PHP initialization function
- * ------------------------------------------------------------ */
-
-%insert(init) "swiginit.swg"
-
-%init %{
-SWIG_php_minit {
- SWIG_InitializeModule(0);
-%}
-
-%fragment("swig_php_init_member_ptr2", "header") {
-#define SWIG_MEMBER_PTR ((char*)"CLASS::*")
-
-static void swig_member_ptr_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
- efree(rsrc->ptr);
-}
-
-static int swig_member_ptr = 0;
-}
-
-%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/Lib/php5/phpkw.swg b/Lib/php5/phpkw.swg
deleted file mode 100644
index 36e535f52..000000000
--- a/Lib/php5/phpkw.swg
+++ /dev/null
@@ -1,866 +0,0 @@
-/* -----------------------------------------------------------------------------
- * 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/Lib/php5/phppointers.i b/Lib/php5/phppointers.i
deleted file mode 100644
index e50ada7ac..000000000
--- a/Lib/php5/phppointers.i
+++ /dev/null
@@ -1,42 +0,0 @@
-%define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT )
-%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 ) ) {
- $1 = 0;
- } else if ( PZVAL_IS_REF( *$input ) ) {
- /* Not swig wrapped type, so we check if it's a PHP reference type */
- CONVERT_IN( tmp, $*1_ltype, $input );
- $1 = &tmp;
- } else {
- 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 );";
-%enddef
-
-%pass_by_ref( size_t, CONVERT_INT_IN, ZVAL_LONG );
-
-%pass_by_ref( signed int, CONVERT_INT_IN, ZVAL_LONG );
-%pass_by_ref( int, CONVERT_INT_IN, ZVAL_LONG );
-%pass_by_ref( unsigned int, CONVERT_INT_IN, ZVAL_LONG );
-
-%pass_by_ref( signed short, CONVERT_INT_IN, ZVAL_LONG );
-%pass_by_ref( short, CONVERT_INT_IN, ZVAL_LONG );
-%pass_by_ref( unsigned short, CONVERT_INT_IN, ZVAL_LONG );
-
-%pass_by_ref( signed long, CONVERT_INT_IN, ZVAL_LONG );
-%pass_by_ref( long, CONVERT_INT_IN, ZVAL_LONG );
-%pass_by_ref( unsigned long, CONVERT_INT_IN, ZVAL_LONG );
-
-%pass_by_ref( signed char, CONVERT_INT_IN, ZVAL_LONG );
-%pass_by_ref( char, CONVERT_CHAR_IN, ZVAL_STRING );
-%pass_by_ref( unsigned char, CONVERT_INT_IN, ZVAL_LONG );
-
-%pass_by_ref( float, CONVERT_FLOAT_IN, ZVAL_DOUBLE );
-%pass_by_ref( double, CONVERT_FLOAT_IN, ZVAL_DOUBLE );
-
-%pass_by_ref( char *, CONVERT_CHAR_IN, ZVAL_STRING );
diff --git a/Lib/php5/phprun.swg b/Lib/php5/phprun.swg
deleted file mode 100644
index a18e1fcbb..000000000
--- a/Lib/php5/phprun.swg
+++ /dev/null
@@ -1,280 +0,0 @@
-/* -----------------------------------------------------------------------------
- * 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 != 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. */
-
-#ifdef ZEND_RAW_FENTRY
-/* ZEND_RAW_FENTRY was added somewhere between 5.2.0 and 5.2.3 */
-# define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_RAW_FENTRY((char*)#ZN, N, A, 0)
-#else
-/* This causes warnings from GCC >= 4.2 (assigning a string literal to char*).
- * But this seems to be unavoidable without directly assuming knowledge of
- * the structure, which changed between PHP4 and PHP5. */
-# 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
-#endif
-#ifndef Z_SET_REFCOUNT_P
-/* For PHP < 5.3 */
-# define Z_SET_REFCOUNT_P(z, rc) (z)->refcount = (rc)
-#endif
-
-#define SWIG_LONG_CONSTANT(N, V) zend_register_long_constant((char*)#N, sizeof(#N), V, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC)
-#define SWIG_DOUBLE_CONSTANT(N, V) zend_register_double_constant((char*)#N, sizeof(#N), V, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC)
-#define SWIG_STRING_CONSTANT(N, V) zend_register_stringl_constant((char*)#N, sizeof(#N), (char*)(V), strlen(V), CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC)
-#define SWIG_CHAR_CONSTANT(N, V) do {\
- static char swig_char = (V);\
- zend_register_stringl_constant((char*)#N, sizeof(#N), &swig_char, 1, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);\
-} while (0)
-
-/* These TSRMLS_ stuff should already be defined now, but with older php under
- redhat are not... */
-#ifndef TSRMLS_D
-#define TSRMLS_D
-#endif
-#ifndef TSRMLS_DC
-#define TSRMLS_DC
-#endif
-#ifndef TSRMLS_C
-#define TSRMLS_C
-#endif
-#ifndef TSRMLS_CC
-#define TSRMLS_CC
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-/* But in fact SWIG_ConvertPtr is the native interface for getting typed
- pointer values out of zvals. We need the TSRMLS_ macros for when we
- make PHP type calls later as we handle php resources */
-#define SWIG_ConvertPtr(obj,pp,type,flags) SWIG_ZTS_ConvertPtr(obj,pp,type,flags TSRMLS_CC)
-
-
-#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_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))
-
-static void
-SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject TSRMLS_DC) {
- /*
- * 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. */
- ZEND_REGISTER_RESOURCE(z, 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;
- int result;
- const char * p;
-
- /* 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);
-
- MAKE_STD_ZVAL(resource);
- ZEND_REGISTER_RESOURCE(resource, value, *(int *)(type->clientdata));
- if (SWIG_PREFIX_LEN > 0) {
- char * classname = (char*)emalloc(SWIG_PREFIX_LEN + type_name_len + 1);
- strcpy(classname, SWIG_PREFIX);
- strcpy(classname + SWIG_PREFIX_LEN, type_name);
- result = zend_lookup_class(classname, SWIG_PREFIX_LEN + type_name_len, &ce TSRMLS_CC);
- efree(classname);
- } else {
- result = zend_lookup_class((char *)type_name, type_name_len, &ce TSRMLS_CC);
- }
- if (result != SUCCESS) {
- /* class does not exist */
- object_init(z);
- } else {
- object_init_ex(z, *ce);
- }
- 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);
- }
- 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_ZTS_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_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty TSRMLS_DC) {
- 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_ZTS_ConvertResourceData to do the real work. */
-static void *
-SWIG_ZTS_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags TSRMLS_DC) {
- swig_object_wrapper *value;
- void *p;
- int type;
- const char *type_name;
-
- value = (swig_object_wrapper *) zend_list_find(z->value.lval, &type);
- if (type==-1) return NULL;
- if (flags & SWIG_POINTER_DISOWN) {
- value->newobject = 0;
- }
- p = value->ptr;
-
- type_name=zend_rsrc_list_get_rsrc_type(z->value.lval TSRMLS_CC);
-
- return SWIG_ZTS_ConvertResourceData(p, type_name, ty TSRMLS_CC);
-}
-
-/* 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_ZTS_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags TSRMLS_DC) {
- if (z == NULL) {
- *ptr = 0;
- return 0;
- }
-
- switch (z->type) {
- case IS_OBJECT: {
- zval ** _cPtr;
- if (zend_hash_find(HASH_OF(z),(char*)"_cPtr",sizeof("_cPtr"),(void**)&_cPtr)==SUCCESS) {
- if ((*_cPtr)->type==IS_RESOURCE) {
- *ptr = SWIG_ZTS_ConvertResourcePtr(*_cPtr, ty, flags TSRMLS_CC);
- return (*ptr == NULL ? -1 : 0);
- }
- }
- break;
- }
- case IS_RESOURCE:
- *ptr = SWIG_ZTS_ConvertResourcePtr(z, ty, flags TSRMLS_CC);
- 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;
- swig_module_info *ret = 0;
- TSRMLS_FETCH();
-
- MAKE_STD_ZVAL(pointer);
-
- 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;
- }
- }
- FREE_ZVAL(pointer);
- return ret;
-}
-
-static void SWIG_Php_SetModule(swig_module_info *pointer) {
- TSRMLS_FETCH();
- REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, CONST_PERSISTENT | CONST_CS);
-}
diff --git a/Lib/php5/std_common.i b/Lib/php5/std_common.i
deleted file mode 100644
index 092bf012b..000000000
--- a/Lib/php5/std_common.i
+++ /dev/null
@@ -1,10 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_common.i
- *
- * SWIG typemaps for STL - common utilities
- * ----------------------------------------------------------------------------- */
-
-%include <std/std_except.i>
-
-%apply size_t { std::size_t };
-
diff --git a/Lib/php5/std_deque.i b/Lib/php5/std_deque.i
deleted file mode 100644
index cb98f6c2f..000000000
--- a/Lib/php5/std_deque.i
+++ /dev/null
@@ -1 +0,0 @@
-%include <std/_std_deque.i>
diff --git a/Lib/php5/std_map.i b/Lib/php5/std_map.i
deleted file mode 100644
index 6d5e3db13..000000000
--- a/Lib/php5/std_map.i
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_map.i
- *
- * SWIG typemaps for std::map
- * ----------------------------------------------------------------------------- */
-
-%include <std_common.i>
-
-// ------------------------------------------------------------------------
-// std::map
-// ------------------------------------------------------------------------
-
-%{
-#include <map>
-#include <algorithm>
-#include <stdexcept>
-%}
-
-// exported class
-
-namespace std {
-
- 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> &);
-
- unsigned int size() const;
- void clear();
- %extend {
- const T& get(const K& key) throw (std::out_of_range) {
- std::map<K,T >::iterator i = self->find(key);
- if (i != self->end())
- return i->second;
- else
- throw std::out_of_range("key not found");
- }
- void set(const K& key, const T& x) {
- (*self)[key] = x;
- }
- void del(const K& key) throw (std::out_of_range) {
- 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);
- return i != self->end();
- }
- bool is_empty() const {
- return self->empty();
- }
- }
- };
-
-// Legacy macros (deprecated)
-%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
-#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
-%enddef
-
-%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
-#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
-%enddef
-
-%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
-#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
-%enddef
-
-}
diff --git a/Lib/php5/std_pair.i b/Lib/php5/std_pair.i
deleted file mode 100644
index fe45ee676..000000000
--- a/Lib/php5/std_pair.i
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_pair.i
- *
- * SWIG typemaps for std::pair
- * ----------------------------------------------------------------------------- */
-
-%include <std_common.i>
-%include <exception.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/Lib/php5/std_string.i b/Lib/php5/std_string.i
deleted file mode 100644
index aaa5dc9cd..000000000
--- a/Lib/php5/std_string.i
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -----------------------------------------------------------------------------
- * 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_PP($input) == IS_STRING ) ? 1 : 0;
- %}
-
- %typemap(in) string %{
- convert_to_string_ex($input);
- $1.assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
- %}
-
- %typemap(directorout) string %{
- convert_to_string_ex(&$input);
- $result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input));
- %}
-
- %typemap(out) string %{
- ZVAL_STRINGL($result, const_cast<char*>($1.data()), $1.size(), 1);
- %}
-
- %typemap(directorin) string, const string& %{
- ZVAL_STRINGL($input, const_cast<char*>($1.data()), $1.size(), 1);
- %}
-
- %typemap(out) const string & %{
- ZVAL_STRINGL($result, const_cast<char*>($1->data()), $1->size(), 1);
- %}
-
- %typemap(throws) string, const string& %{
- zend_throw_exception(NULL, const_cast<char*>($1.c_str()), 0 TSRMLS_CC);
- return;
- %}
-
- /* These next two handle a function which takes a non-const reference to
- * a std::string and modifies the string. */
- %typemap(in) string & ($*1_ltype temp) %{
- convert_to_string_ex($input);
- temp.assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
- $1 = &temp;
- %}
-
- %typemap(directorout) string & ($*1_ltype *temp) %{
- convert_to_string_ex(&$input);
- temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input));
- swig_acquire_ownership(temp);
- $result = temp;
- %}
-
- %typemap(argout) string & %{
- ZVAL_STRINGL(*($input), const_cast<char*>($1->data()), $1->size(), 1);
- %}
-
- /* SWIG will apply the non-const typemap above to const string& without
- * this more specific typemap. */
- %typemap(argout) const string & "";
-}
diff --git a/Lib/php5/std_vector.i b/Lib/php5/std_vector.i
deleted file mode 100644
index 9cc1486ef..000000000
--- a/Lib/php5/std_vector.i
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_vector.i
- * ----------------------------------------------------------------------------- */
-
-%include <std_common.i>
-
-%{
-#include <vector>
-#include <stdexcept>
-%}
-
-namespace std {
-
- template<class T> class vector {
- public:
- typedef size_t size_type;
- typedef T value_type;
- typedef const value_type& const_reference;
- vector();
- vector(size_type n);
- size_type size() const;
- size_type capacity() const;
- void reserve(size_type n);
- void clear();
- %rename(push) push_back;
- void push_back(const value_type& x);
- %extend {
- bool is_empty() const {
- return $self->empty();
- }
- T pop() throw (std::out_of_range) {
- if (self->size() == 0)
- throw std::out_of_range("pop from empty vector");
- T x = self->back();
- self->pop_back();
- return x;
- }
- 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("vector 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("vector index out of range");
- }
- }
- };
-
- // bool specialization
- template<> class vector<bool> {
- public:
- typedef size_t size_type;
- typedef bool value_type;
- typedef bool const_reference;
- vector();
- vector(size_type n);
- size_type size() const;
- size_type capacity() const;
- void reserve(size_type n);
- void clear();
- %rename(push) push_back;
- void push_back(const value_type& x);
- %extend {
- bool is_empty() const {
- return $self->empty();
- }
- bool pop() throw (std::out_of_range) {
- if (self->size() == 0)
- throw std::out_of_range("pop from empty vector");
- bool x = self->back();
- self->pop_back();
- return x;
- }
- bool 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("vector 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("vector index out of range");
- }
- }
- };
-}
-
-%define specialize_std_vector(T)
-#warning "specialize_std_vector - specialization for type T no longer needed"
-%enddef
-
-
diff --git a/Lib/php5/stl.i b/Lib/php5/stl.i
deleted file mode 100644
index 9d2e91eee..000000000
--- a/Lib/php5/stl.i
+++ /dev/null
@@ -1,12 +0,0 @@
-/* -----------------------------------------------------------------------------
- * stl.i
- *
- * Initial STL definition. extended as needed in each language
- * ----------------------------------------------------------------------------- */
-
-%include <std_common.i>
-%include <std_string.i>
-%include <std_vector.i>
-%include <std_map.i>
-%include <std_pair.i>
-
diff --git a/Lib/php5/typemaps.i b/Lib/php5/typemaps.i
deleted file mode 100644
index faae0a6ac..000000000
--- a/Lib/php5/typemaps.i
+++ /dev/null
@@ -1,322 +0,0 @@
-/* -----------------------------------------------------------------------------
- * typemaps.i.
- *
- * SWIG Typemap library for PHP.
- *
- * This library provides standard typemaps for modifying SWIG's behavior.
- * With enough entries in this file, I hope that very few people actually
- * ever need to write a typemap.
- *
- * Define macros to define the following typemaps:
- *
- * TYPE *INPUT. Argument is passed in as native variable by value.
- * TYPE *OUTPUT. Argument is returned as an array from the function call.
- * TYPE *INOUT. Argument is passed in by value, and out as part of returned list
- * TYPE *REFERENCE. Argument is passed in as native variable with value
- * semantics. Variable value is changed with result.
- * Use like this:
- * int foo(int *REFERENCE);
- *
- * $a = 0;
- * $rc = foo($a);
- *
- * Even though $a looks like it's passed by value,
- * its value can be changed by foo().
- * ----------------------------------------------------------------------------- */
-
-%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;
- $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 TSRMLS_CC );
-}
-%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
-%{
- convert_to_boolean_ex($input);
- lvalue = (*$input)->value.lval ? true : false;
- $1 = &lvalue;
-%}
-%typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE
-%{
- (*$arg)->value.lval = lvalue$argnum ? true : false;
- (*$arg)->type = IS_BOOL;
-%}
-%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);
- $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 TSRMLS_CC );
-}
-%typemap(in) TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue)
-%{
- convert_to_double_ex($input);
- dvalue = (TYPE) (*$input)->value.dval;
- $1 = &dvalue;
-%}
-%typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE
-%{
- $1->value.dval = (double)(lvalue$argnum);
- $1->type = IS_DOUBLE;
-%}
-%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);
- $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 TSRMLS_CC );
-}
-%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
-%{
- convert_to_long_ex($input);
- lvalue = (TYPE) (*$input)->value.lval;
- $1 = &lvalue;
-%}
-%typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE
-%{
- (*$arg)->value.lval = (long)(lvalue$argnum);
- (*$arg)->type = IS_LONG;
-%}
-%enddef
-
-BOOL_TYPEMAP(bool);
-
-DOUBLE_TYPEMAP(float);
-DOUBLE_TYPEMAP(double);
-
-INT_TYPEMAP(int);
-INT_TYPEMAP(short);
-INT_TYPEMAP(long);
-INT_TYPEMAP(unsigned int);
-INT_TYPEMAP(unsigned short);
-INT_TYPEMAP(unsigned long);
-INT_TYPEMAP(unsigned char);
-INT_TYPEMAP(signed char);
-
-INT_TYPEMAP(long long);
-%typemap(argout,fragment="t_output_helper") long long *OUTPUT
-{
- zval *o;
- MAKE_STD_ZVAL(o);
- if ((long long)LONG_MIN <= temp$argnum && temp$argnum <= (long long)LONG_MAX) {
- ZVAL_LONG(o, temp$argnum);
- } else {
- char temp[256];
- sprintf(temp, "%lld", (long long)temp$argnum);
- ZVAL_STRING(o, temp, 1);
- }
- t_output_helper( &$result, o TSRMLS_CC );
-}
-%typemap(in) TYPE *REFERENCE (long long lvalue)
-%{
- CONVERT_LONG_LONG_IN(lvalue, long long, $input)
- $1 = &lvalue;
-%}
-%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;
- } else {
- char temp[256];
- sprintf(temp, "%lld", (long long)lvalue$argnum);
- ZVAL_STRING((*$arg), temp, 1);
- }
-%}
-%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;
- } else {
- char temp[256];
- sprintf(temp, "%lld", (long long)(*arg$argnum));
- ZVAL_STRING($result, temp, 1);
- }
-%}
-INT_TYPEMAP(unsigned long long);
-%typemap(argout,fragment="t_output_helper") unsigned long long *OUTPUT
-{
- zval *o;
- MAKE_STD_ZVAL(o);
- if (temp$argnum <= (unsigned long long)LONG_MAX) {
- ZVAL_LONG(o, temp$argnum);
- } else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)temp$argnum);
- ZVAL_STRING(o, temp, 1);
- }
- t_output_helper( &$result, o TSRMLS_CC );
-}
-%typemap(in) TYPE *REFERENCE (unsigned long long lvalue)
-%{
- CONVERT_UNSIGNED_LONG_LONG_IN(lvalue, unsigned long long, $input)
- $1 = &lvalue;
-%}
-%typemap(argout) unsigned long long *REFERENCE
-%{
- if (lvalue$argnum <= (unsigned long long)LONG_MAX) {
- (*$arg)->value.lval = (long)(lvalue$argnum);
- (*$arg)->type = IS_LONG;
- } else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)lvalue$argnum);
- ZVAL_STRING((*$arg), temp, 1);
- }
-%}
-%typemap(argout) unsigned long long &OUTPUT
-%{
- if (*arg$argnum <= (unsigned long long)LONG_MAX) {
- ($result)->value.lval = (long)(*arg$argnum);
- ($result)->type = IS_LONG;
- } else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)(*arg$argnum));
- ZVAL_STRING($result, temp, 1);
- }
-%}
-
-%typemap(in) bool *INOUT = bool *INPUT;
-%typemap(in) float *INOUT = float *INPUT;
-%typemap(in) double *INOUT = double *INPUT;
-
-%typemap(in) int *INOUT = int *INPUT;
-%typemap(in) short *INOUT = short *INPUT;
-%typemap(in) long *INOUT = long *INPUT;
-%typemap(in) long long *INOUT = long long *INPUT;
-%typemap(in) unsigned *INOUT = unsigned *INPUT;
-%typemap(in) unsigned short *INOUT = unsigned short *INPUT;
-%typemap(in) unsigned long *INOUT = unsigned long *INPUT;
-%typemap(in) unsigned char *INOUT = unsigned char *INPUT;
-%typemap(in) unsigned long long *INOUT = unsigned long long *INPUT;
-%typemap(in) signed char *INOUT = signed char *INPUT;
-
-%typemap(in) bool &INOUT = bool *INPUT;
-%typemap(in) float &INOUT = float *INPUT;
-%typemap(in) double &INOUT = double *INPUT;
-
-%typemap(in) int &INOUT = int *INPUT;
-%typemap(in) short &INOUT = short *INPUT;
-%typemap(in) long &INOUT = long *INPUT;
-%typemap(in) long long &INOUT = long long *INPUT;
-%typemap(in) long long &INPUT = long long *INPUT;
-%typemap(in) unsigned &INOUT = unsigned *INPUT;
-%typemap(in) unsigned short &INOUT = unsigned short *INPUT;
-%typemap(in) unsigned long &INOUT = unsigned long *INPUT;
-%typemap(in) unsigned char &INOUT = unsigned char *INPUT;
-%typemap(in) unsigned long long &INOUT = unsigned long long *INPUT;
-%typemap(in) unsigned long long &INPUT = unsigned long long *INPUT;
-%typemap(in) signed char &INOUT = signed char *INPUT;
-
-%typemap(argout) bool *INOUT = bool *OUTPUT;
-%typemap(argout) float *INOUT = float *OUTPUT;
-%typemap(argout) double *INOUT= double *OUTPUT;
-
-%typemap(argout) int *INOUT = int *OUTPUT;
-%typemap(argout) short *INOUT = short *OUTPUT;
-%typemap(argout) long *INOUT= long *OUTPUT;
-%typemap(argout) long long *INOUT= long long *OUTPUT;
-%typemap(argout) unsigned short *INOUT= unsigned short *OUTPUT;
-%typemap(argout) unsigned long *INOUT = unsigned long *OUTPUT;
-%typemap(argout) unsigned char *INOUT = unsigned char *OUTPUT;
-%typemap(argout) unsigned long long *INOUT = unsigned long long *OUTPUT;
-%typemap(argout) signed char *INOUT = signed char *OUTPUT;
-
-%typemap(argout) bool &INOUT = bool *OUTPUT;
-%typemap(argout) float &INOUT = float *OUTPUT;
-%typemap(argout) double &INOUT= double *OUTPUT;
-
-%typemap(argout) int &INOUT = int *OUTPUT;
-%typemap(argout) short &INOUT = short *OUTPUT;
-%typemap(argout) long &INOUT= long *OUTPUT;
-%typemap(argout) long long &INOUT= long long *OUTPUT;
-%typemap(argout) unsigned short &INOUT= unsigned short *OUTPUT;
-%typemap(argout) unsigned long &INOUT = unsigned long *OUTPUT;
-%typemap(argout) unsigned char &INOUT = unsigned char *OUTPUT;
-%typemap(argout) unsigned long long &INOUT = unsigned long long *OUTPUT;
-%typemap(argout) signed char &INOUT = signed char *OUTPUT;
-
-%typemap(in) char INPUT[ANY] ( char temp[$1_dim0] )
-%{
- convert_to_string_ex($input);
- 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,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 TSRMLS_CC );
-}
-
-%typemap(in,numinputs=0) void **OUTPUT (int force),
- void *&OUTPUT (int force)
-%{
- /* 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) {
- /* 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))) {
- /* wasn't a pre/ref/thing, OR anything like an int thing */
- SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname.");
- }
- }
- force=0;
- if (arg1==NULL) {
-#ifdef __cplusplus
- ptr=new $*1_ltype();
-#else
- ptr=($*1_ltype) calloc(1,sizeof($*1_ltype));
-#endif
- $1=&ptr;
- /* have to passback arg$arg too */
- force=1;
- }
-%}
-
-%typemap(argout) void **OUTPUT,
- void *&OUTPUT
-%{
- if (force$argnum) { /* pass back arg$argnum through params ($arg) if we can */
- if (!PZVAL_IS_REF(*$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/Lib/php5/utils.i b/Lib/php5/utils.i
deleted file mode 100644
index 408a3b366..000000000
--- a/Lib/php5/utils.i
+++ /dev/null
@@ -1,114 +0,0 @@
-
-%define CONVERT_BOOL_IN(lvar,t,invar)
- convert_to_boolean_ex(invar);
- lvar = (t) Z_LVAL_PP(invar);
-%enddef
-
-%define CONVERT_INT_IN(lvar,t,invar)
- convert_to_long_ex(invar);
- lvar = (t) Z_LVAL_PP(invar);
-%enddef
-
-%define CONVERT_LONG_LONG_IN(lvar,t,invar)
- switch ((*(invar))->type) {
- case IS_DOUBLE:
- lvar = (t) (*(invar))->value.dval;
- break;
- case IS_STRING: {
- char * endptr;
- errno = 0;
- lvar = (t) strtoll((*(invar))->value.str.val, &endptr, 10);
- if (*endptr && !errno) break;
- /* FALL THRU */
- }
- default:
- convert_to_long_ex(invar);
- lvar = (t) (*(invar))->value.lval;
- }
-%enddef
-
-%define CONVERT_UNSIGNED_LONG_LONG_IN(lvar,t,invar)
- switch ((*(invar))->type) {
- case IS_DOUBLE:
- lvar = (t) (*(invar))->value.dval;
- break;
- case IS_STRING: {
- char * endptr;
- errno = 0;
- lvar = (t) strtoull((*(invar))->value.str.val, &endptr, 10);
- if (*endptr && !errno) break;
- /* FALL THRU */
- }
- default:
- convert_to_long_ex(invar);
- lvar = (t) (*(invar))->value.lval;
- }
-%enddef
-
-%define CONVERT_INT_OUT(lvar,invar)
- lvar = (t) Z_LVAL_PP(invar);
-%enddef
-
-%define CONVERT_FLOAT_IN(lvar,t,invar)
- convert_to_double_ex(invar);
- lvar = (t) Z_DVAL_PP(invar);
-%enddef
-
-%define CONVERT_CHAR_IN(lvar,t,invar)
- convert_to_string_ex(invar);
- lvar = (t) *Z_STRVAL_PP(invar);
-%enddef
-
-%define CONVERT_STRING_IN(lvar,t,invar)
- if ((*invar)->type==IS_NULL) {
- lvar = (t) 0;
- } else {
- convert_to_string_ex(invar);
- lvar = (t) Z_STRVAL_PP(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
-%{
- CONVERT_IN($result,$1_ltype,&$input);
-%}
-%typemap(directorout) const TYPE & ($*1_ltype temp)
-%{
- CONVERT_IN(temp,$*1_ltype,&$input);
- $result = &temp;
-%}
-%enddef
-
-%fragment("t_output_helper","header") %{
-static void
-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 );
- return;
- }
- if ( (*target)->type == IS_NULL ) {
- REPLACE_ZVAL_VALUE(target,o,1);
- FREE_ZVAL(o);
- return;
- }
- ALLOC_INIT_ZVAL(tmp);
- *tmp = **target;
- zval_copy_ctor(tmp);
- array_init(*target);
- add_next_index_zval( *target, tmp);
- add_next_index_zval( *target, o);
-
-}
-%}
diff --git a/Lib/pike/pike.swg b/Lib/pike/pike.swg
index 95cc20835..a36bf3ad2 100644
--- a/Lib/pike/pike.swg
+++ b/Lib/pike/pike.swg
@@ -273,6 +273,8 @@ extern "C" {
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
/* ------------------------------------------------------------
* Overloaded operator support
diff --git a/Lib/python/boost_shared_ptr.i b/Lib/python/boost_shared_ptr.i
index 40a1ae1ef..709e7811d 100644
--- a/Lib/python/boost_shared_ptr.i
+++ b/Lib/python/boost_shared_ptr.i
@@ -18,7 +18,7 @@
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor wrapper customisation
-%feature("unref") TYPE
+%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;"
@@ -29,7 +29,7 @@
int newmem = 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);
@@ -62,13 +62,31 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
+ int newmem = 0;
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (!swig_argp) {
+ %dirout_nullref("$type");
+ } else {
+ $result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
+ if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
+ }
+}
+
// 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;
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) {
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
@@ -108,12 +126,20 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter_python") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE * %{
+#error "directorout typemap for plain pointer not implemented"
+%}
+
// plain reference
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
int newmem = 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) {
@@ -153,13 +179,21 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter_python") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE & %{
+#error "directorout typemap for plain reference not implemented"
+%}
+
// 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;
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) {
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
@@ -171,7 +205,7 @@
$1 = &temp;
}
%typemap(out, fragment="SWIG_null_deleter_python") TYPE *CONST& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -182,12 +216,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter_python") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) TYPE *CONST& %{
+#error "directorout typemap for plain pointer by reference not implemented"
+%}
+
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
int newmem = 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, $&ltype));
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $&ltype);
@@ -212,12 +254,28 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
+ int newmem = 0;
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (swig_argp) {
+ $result = *(%reinterpret_cast(swig_argp, $&ltype));
+ if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $&ltype);
+ }
+}
+
// 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;
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 (argp) tempshared = *%reinterpret_cast(argp, $ltype);
@@ -239,12 +297,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
+#error "directorout typemap for shared_ptr ref not implemented"
+%}
+
// 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;
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 (argp) tempshared = *%reinterpret_cast(argp, $ltype);
@@ -255,7 +321,7 @@
}
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
if ($owner) delete $1;
}
@@ -267,12 +333,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
+#error "directorout typemap for pointer to shared_ptr not implemented"
+%}
+
// 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;
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);
@@ -280,7 +354,7 @@
$1 = &temp;
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -291,10 +365,18 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
+#error "directorout typemap for pointer ref to shared_ptr not implemented"
+%}
+
// 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, equivalent="TYPE *", noblock=1)
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
@@ -316,9 +398,14 @@
#error "typemaps for $1_type not available"
%}
+%typemap(doctype) 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 > *&
+ %{TYPE%}
+
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef
-
diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg
index 4fd19471a..28051e67b 100644
--- a/Lib/python/builtin.swg
+++ b/Lib/python/builtin.swg
@@ -13,12 +13,9 @@ 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))
+ else if (PyLong_Check(obj))
result = PyLong_AsLong(obj);
#else
if (PyNumber_Check(obj))
@@ -92,8 +89,8 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) {
}
tuple = PyTuple_New(1);
assert(tuple);
+ Py_INCREF(val);
PyTuple_SET_ITEM(tuple, 0, val);
- Py_XINCREF(val);
result = (*getset->set)(obj, tuple);
Py_DECREF(tuple);
Py_XDECREF(result);
@@ -120,7 +117,7 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure)
SWIGINTERN void
SwigPyStaticVar_dealloc(PyDescrObject *descr) {
- _PyObject_GC_UNTRACK(descr);
+ PyObject_GC_UnTrack(descr);
Py_XDECREF(PyDescr_TYPE(descr));
Py_XDECREF(PyDescr_NAME(descr));
PyObject_GC_Del(descr);
@@ -254,12 +251,8 @@ SwigPyStaticVar_Type(void) {
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
@@ -267,20 +260,14 @@ SwigPyStaticVar_Type(void) {
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;
}
@@ -342,12 +329,8 @@ SwigPyObjectType(void) {
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
@@ -355,21 +338,15 @@ SwigPyObjectType(void) {
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;
}
@@ -393,10 +370,10 @@ SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) {
SWIGINTERN void
SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) {
- int base_count = 0;
+ Py_ssize_t base_count = 0;
PyTypeObject **b;
PyObject *tuple;
- int i;
+ Py_ssize_t i;
if (!bases[0]) {
bases[0] = SwigPyObject_type();
@@ -408,8 +385,8 @@ SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) {
++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]);
+ PyTuple_SET_ITEM(tuple, i, (PyObject *)bases[i]);
}
type->tp_bases = tuple;
}
@@ -459,15 +436,15 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap
Py_XDECREF(sobj->dict);
if (sobj->own) {
PyObject *o;
- PyObject *val = 0, *type = 0, *tb = 0;
- PyErr_Fetch(&val, &type, &tb);
+ PyObject *type = 0, *value = 0, *traceback = 0;
+ PyErr_Fetch(&type, &value, &traceback);
o = wrapper(a, NULL);
if (!o) {
PyObject *deallocname = PyString_FromString(wrappername);
PyErr_WriteUnraisable(deallocname);
Py_DECREF(deallocname);
}
- PyErr_Restore(val, type, tb);
+ PyErr_Restore(type, value, traceback);
Py_XDECREF(o);
}
if (PyType_IS_GC(a->ob_type)) {
@@ -512,8 +489,8 @@ SwigPyBuiltin_binaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyO
PyObject *tuple, *result;
tuple = PyTuple_New(1);
assert(tuple);
+ Py_INCREF(b);
PyTuple_SET_ITEM(tuple, 0, b);
- Py_XINCREF(b);
result = wrapper(a, tuple);
Py_DECREF(tuple);
return result;
@@ -531,10 +508,10 @@ SwigPyBuiltin_ternaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py
PyObject *tuple, *result;
tuple = PyTuple_New(2);
assert(tuple);
+ Py_INCREF(b);
PyTuple_SET_ITEM(tuple, 0, b);
+ Py_INCREF(c);
PyTuple_SET_ITEM(tuple, 1, c);
- Py_XINCREF(b);
- Py_XINCREF(c);
result = wrapper(a, tuple);
Py_DECREF(tuple);
return result;
@@ -597,8 +574,8 @@ SwigPyBuiltin_ssizessizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObje
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);
+ PyTuple_SET_ITEM(tuple, 2, d);
}
resultobj = wrapper(a, tuple);
result = resultobj ? 0 : -1;
@@ -649,8 +626,8 @@ SwigPyBuiltin_ssizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a
tuple = PyTuple_New(2);
assert(tuple);
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
+ Py_INCREF(c);
PyTuple_SET_ITEM(tuple, 1, c);
- Py_XINCREF(c);
resultobj = wrapper(a, tuple);
result = resultobj ? 0 : -1;
Py_XDECREF(resultobj);
@@ -658,6 +635,42 @@ SwigPyBuiltin_ssizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a
return result;
}
+#define SWIGPY_OBJOBJPROC_CLOSURE(wrapper) \
+SWIGINTERN int \
+wrapper##_objobjproc_closure(PyObject *a, PyObject *b) { \
+ return SwigPyBuiltin_objobjproc_closure(wrapper, a, b); \
+}
+SWIGINTERN int
+SwigPyBuiltin_objobjproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) {
+ int result;
+ PyObject *pyresult;
+ PyObject *tuple;
+ tuple = PyTuple_New(1);
+ assert(tuple);
+ Py_INCREF(b);
+ PyTuple_SET_ITEM(tuple, 0, b);
+ pyresult = wrapper(a, tuple);
+ result = pyresult ? (PyObject_IsTrue(pyresult) ? 1 : 0) : -1;
+ Py_XDECREF(pyresult);
+ Py_DECREF(tuple);
+ return result;
+}
+
+#define SWIGPY_FUNPACK_OBJOBJPROC_CLOSURE(wrapper) \
+SWIGINTERN int \
+wrapper##_objobjproc_closure(PyObject *a, PyObject *b) { \
+ return SwigPyBuiltin_funpack_objobjproc_closure(wrapper, a, b); \
+}
+SWIGINTERN int
+SwigPyBuiltin_funpack_objobjproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) {
+ int result;
+ PyObject *pyresult;
+ pyresult = wrapper(a, b);
+ result = pyresult ? (PyObject_IsTrue(pyresult) ? 1 : 0) : -1;
+ Py_XDECREF(pyresult);
+ return result;
+}
+
#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \
SWIGINTERN int \
wrapper##_objobjargproc_closure(PyObject *a, PyObject *b, PyObject *c) { \
@@ -669,11 +682,11 @@ SwigPyBuiltin_objobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a,
int result;
tuple = PyTuple_New(c ? 2 : 1);
assert(tuple);
+ Py_INCREF(b);
PyTuple_SET_ITEM(tuple, 0, b);
- Py_XINCREF(b);
if (c) {
+ Py_INCREF(c);
PyTuple_SET_ITEM(tuple, 1, c);
- Py_XINCREF(c);
}
resultobj = wrapper(a, tuple);
result = resultobj ? 0 : -1;
diff --git a/Lib/python/cni.i b/Lib/python/cni.i
deleted file mode 100644
index 10a1403a2..000000000
--- a/Lib/python/cni.i
+++ /dev/null
@@ -1,2 +0,0 @@
-%include <gcj/cni.i>
-%include <jstring.i>
diff --git a/Lib/python/defarg.swg b/Lib/python/defarg.swg
index 10c991615..59450bd82 100644
--- a/Lib/python/defarg.swg
+++ b/Lib/python/defarg.swg
@@ -24,7 +24,7 @@ SWIGINTERN PyObject *swig_call_defargs(PyObject *self, PyObject *args) {
PyObject *func;
PyObject *parms;
- if (!PyArg_ParseTuple(args,"OO",&func,&parms))
+ if (!PyArg_ParseTuple(args, "OO", &func, &parms))
return NULL;
if (!PyCallable_Check(func)) {
diff --git a/Lib/python/director.swg b/Lib/python/director.swg
index 4bdc94dc2..9694c6233 100644
--- a/Lib/python/director.swg
+++ b/Lib/python/director.swg
@@ -199,46 +199,6 @@ namespace Swig {
}
};
- /* 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.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
- << "Exception is being re-thrown, program will likely abort/terminate." << std::endl;
- throw;
- }
-
- public:
-
- std::unexpected_handler old;
- UnknownExceptionHandler(std::unexpected_handler nh = handler) {
- old = std::set_unexpected(nh);
- }
-
- ~UnknownExceptionHandler() {
- std::set_unexpected(old);
- }
-#endif
- };
-
/* type mismatch in the return value from a python method call */
class DirectorTypeMismatchException : public DirectorException {
public:
diff --git a/Lib/python/jstring.i b/Lib/python/jstring.i
deleted file mode 100644
index bda95237b..000000000
--- a/Lib/python/jstring.i
+++ /dev/null
@@ -1,72 +0,0 @@
-%include <typemaps/valtypes.swg>
-
-%fragment(SWIG_AsVal_frag(jstring),"header") {
-SWIGINTERN int
-SWIG_AsVal(jstring)(PyObject *obj, jstring *val)
-{
- if (obj == Py_None) {
- if (val) *val = 0;
- return SWIG_OK;
- }
-
- PyObject *tmp = 0;
- int isunicode = PyUnicode_Check(obj);
- if (!isunicode && PyString_Check(obj)) {
- if (val) {
- obj = tmp = PyUnicode_FromObject(obj);
- }
- isunicode = 1;
- }
- if (isunicode) {
- if (val) {
- if (sizeof(Py_UNICODE) == sizeof(jchar)) {
- *val = JvNewString((const jchar *) PyUnicode_AS_UNICODE(obj),PyUnicode_GET_SIZE(obj));
- return SWIG_NEWOBJ;
- } else {
- int len = PyUnicode_GET_SIZE(obj);
- Py_UNICODE *pchars = PyUnicode_AS_UNICODE(obj);
- *val = JvAllocString (len);
- jchar *jchars = JvGetStringChars (*val);
- for (int i = 0; i < len; ++i) {
- jchars[i] = pchars[i];
- }
- return SWIG_NEWOBJ;
- }
- }
- Py_XDECREF(tmp);
- return SWIG_OK;
- }
- return SWIG_TypeError;
-}
-}
-
-%fragment(SWIG_From_frag(jstring),"header") {
-SWIGINTERNINLINE PyObject *
-SWIG_From(jstring)(jstring val)
-{
- if (!val) {
- return SWIG_Py_Void();
- }
- if (sizeof(Py_UNICODE) == sizeof(jchar)) {
- return PyUnicode_FromUnicode((const Py_UNICODE *) JvGetStringChars(val),
- JvGetStringUTFLength(val));
- } else {
- int len = JvGetStringUTFLength(val);
- Py_UNICODE pchars[len];
- jchar *jchars = JvGetStringChars(val);
-
- for (int i = 0; i < len; i++) {
- pchars[i] = jchars[i];
- }
- return PyUnicode_FromUnicode((const Py_UNICODE *) pchars, len);
- }
-}
-}
-
-%typemaps_asvalfrom(%checkcode(STRING),
- %arg(SWIG_AsVal(jstring)),
- %arg(SWIG_From(jstring)),
- %arg(SWIG_AsVal_frag(jstring)),
- %arg(SWIG_From_frag(jstring)),
- java::lang::String *);
-
diff --git a/Lib/python/pyabc.i b/Lib/python/pyabc.i
index 12ce65985..fbd91dce4 100644
--- a/Lib/python/pyabc.i
+++ b/Lib/python/pyabc.i
@@ -1,10 +1,10 @@
%define %pythonabc(Type, Abc)
%feature("python:abc", #Abc) Type;
%enddef
-%pythoncode %{import collections%}
-%pythonabc(std::vector, collections.MutableSequence);
-%pythonabc(std::list, collections.MutableSequence);
-%pythonabc(std::map, collections.MutableMapping);
-%pythonabc(std::multimap, collections.MutableMapping);
-%pythonabc(std::set, collections.MutableSet);
-%pythonabc(std::multiset, collections.MutableSet);
+%pythoncode %{import collections.abc%}
+%pythonabc(std::vector, collections.abc.MutableSequence);
+%pythonabc(std::list, collections.abc.MutableSequence);
+%pythonabc(std::map, collections.abc.MutableMapping);
+%pythonabc(std::multimap, collections.abc.MutableMapping);
+%pythonabc(std::set, collections.abc.MutableSet);
+%pythonabc(std::multiset, collections.abc.MutableSet);
diff --git a/Lib/python/pyapi.swg b/Lib/python/pyapi.swg
index 2da05f9e9..19e6979b5 100644
--- a/Lib/python/pyapi.swg
+++ b/Lib/python/pyapi.swg
@@ -17,30 +17,13 @@ extern "C" {
/* Constant information structure */
typedef struct swig_const_info {
int type;
- char *name;
+ const char *name;
long lvalue;
double dvalue;
void *pvalue;
swig_type_info **ptype;
} swig_const_info;
-
-/* -----------------------------------------------------------------------------
- * Wrapper of PyInstanceMethod_New() used in Python 3
- * It is exported to the generated module, used for -fastproxy
- * ----------------------------------------------------------------------------- */
-#if PY_VERSION_HEX >= 0x03000000
-SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
-{
- return PyInstanceMethod_New(func);
-}
-#else
-SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
-{
- return NULL;
-}
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/Lib/python/pybuffer.i b/Lib/python/pybuffer.i
index 121cd709f..577eb69c8 100644
--- a/Lib/python/pybuffer.i
+++ b/Lib/python/pybuffer.i
@@ -13,10 +13,14 @@
*/
%define %pybuffer_mutable_binary(TYPEMAP, SIZE)
-%typemap(in) (TYPEMAP, SIZE)
- (int res, Py_ssize_t size = 0, void *buf = 0) {
- res = PyObject_AsWriteBuffer($input, &buf, &size);
- if (res<0) {
+%typemap(in) (TYPEMAP, SIZE) {
+ int res; Py_ssize_t size = 0; void *buf = 0;
+ Py_buffer view;
+ res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE);
+ size = view.len;
+ buf = view.buf;
+ PyBuffer_Release(&view);
+ if (res < 0) {
PyErr_Clear();
%argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
}
@@ -25,7 +29,7 @@
}
%enddef
-/* %pybuffer_mutable_string(TYPEMAP, SIZE)
+/* %pybuffer_mutable_string(TYPEMAP)
*
* Macro for functions accept mutable zero terminated string pointer.
* This can be used for both input and output. For example:
@@ -39,12 +43,15 @@
*/
%define %pybuffer_mutable_string(TYPEMAP)
-%typemap(in) (TYPEMAP)
- (int res, Py_ssize_t size = 0, void *buf = 0) {
- res = PyObject_AsWriteBuffer($input, &buf, &size);
- if (res<0) {
+%typemap(in) (TYPEMAP) {
+ int res; void *buf = 0;
+ Py_buffer view;
+ res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE);
+ buf = view.buf;
+ PyBuffer_Release(&view);
+ if (res < 0) {
PyErr_Clear();
- %argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
+ %argument_fail(res, "(TYPEMAP)", $symname, $argnum);
}
$1 = ($1_ltype) buf;
}
@@ -65,10 +72,14 @@
*/
%define %pybuffer_binary(TYPEMAP, SIZE)
-%typemap(in) (TYPEMAP, SIZE)
- (int res, Py_ssize_t size = 0, const void *buf = 0) {
- res = PyObject_AsReadBuffer($input, &buf, &size);
- if (res<0) {
+%typemap(in) (TYPEMAP, SIZE) {
+ int res; Py_ssize_t size = 0; const void *buf = 0;
+ Py_buffer view;
+ res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
+ size = view.len;
+ buf = view.buf;
+ PyBuffer_Release(&view);
+ if (res < 0) {
PyErr_Clear();
%argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
}
@@ -77,7 +88,7 @@
}
%enddef
-/* %pybuffer_string(TYPEMAP, SIZE)
+/* %pybuffer_string(TYPEMAP)
*
* Macro for functions accept read only zero terminated string pointer.
* This can be used for input. For example:
@@ -93,11 +104,14 @@
*/
%define %pybuffer_string(TYPEMAP)
-%typemap(in) (TYPEMAP)
- (int res, Py_ssize_t size = 0, const void *buf = 0) {
- res = PyObject_AsReadBuffer($input, &buf, &size);
- if (res<0) {
- %argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
+%typemap(in) (TYPEMAP) {
+ int res; const void *buf = 0;
+ Py_buffer view;
+ res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
+ buf = view.buf;
+ PyBuffer_Release(&view);
+ if (res < 0) {
+ %argument_fail(res, "(TYPEMAP)", $symname, $argnum);
}
$1 = ($1_ltype) buf;
}
diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg
index d40b0baa8..fef4e9b3b 100644
--- a/Lib/python/pycontainer.swg
+++ b/Lib/python/pycontainer.swg
@@ -36,6 +36,48 @@
%include <std_except.i>
+%fragment("container_owner_attribute_init", "init") {
+ // thread safe initialization
+ swig::container_owner_attribute();
+}
+
+%fragment("reference_container_owner", "header", fragment="container_owner_attribute_init") {
+namespace swig {
+ static PyObject* container_owner_attribute() {
+ static PyObject* attr = SWIG_Python_str_FromChar("__swig_container");
+ return attr;
+ }
+
+ template <typename T>
+ struct container_owner {
+ // By default, do not add the back-reference (for value types)
+ // Specialization below will check the reference for pointer types.
+ static bool back_reference(PyObject* child, PyObject* owner) {
+ return false;
+ }
+ };
+
+ template <>
+ struct container_owner<swig::pointer_category> {
+ /*
+ * Call to add a back-reference to the owning object when returning a
+ * reference from a container. Will only set the reference if child
+ * is a SWIG wrapper object that does not own the pointer.
+ *
+ * returns whether the reference was set or not
+ */
+ static bool back_reference(PyObject* child, PyObject* owner) {
+ SwigPyObject* swigThis = SWIG_Python_GetSwigThis(child);
+ if (swigThis && (swigThis->own & SWIG_POINTER_OWN) != SWIG_POINTER_OWN) {
+ PyObject_SetAttr(child, container_owner_attribute(), owner);
+ return true;
+ }
+ return false;
+ }
+ };
+}
+}
+
%fragment(SWIG_Traits_frag(swig::SwigPtr_PyObject),"header",fragment="StdTraits") {
namespace swig {
template <> struct traits<SwigPtr_PyObject > {
@@ -102,7 +144,7 @@ namespace swig {
}
}
-%fragment("SwigPySequence_Base","header",fragment="<stddef.h>")
+%fragment("SwigPySequence_Base","header",fragment="<stddef.h>",fragment="StdTraits")
{
%#include <functional>
@@ -351,7 +393,7 @@ namespace swig {
typename Sequence::const_iterator isit = is.begin();
typename Sequence::iterator it = self->begin();
std::advance(it,ii);
- for (size_t rc=0; rc<replacecount; ++rc) {
+ for (size_t rc=0; rc<replacecount && it != self->end(); ++rc) {
*it++ = *isit++;
for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c)
it++;
@@ -367,7 +409,7 @@ namespace swig {
typename Sequence::const_iterator isit = is.begin();
typename Sequence::reverse_iterator it = self->rbegin();
std::advance(it,size-ii-1);
- for (size_t rc=0; rc<replacecount; ++rc) {
+ for (size_t rc=0; rc<replacecount && it != self->rend(); ++rc) {
*it++ = *isit++;
for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c)
it++;
@@ -434,8 +476,8 @@ namespace swig
{
swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index);
try {
- return swig::as<T>(item, true);
- } catch (std::exception& e) {
+ return swig::as<T>(item);
+ } catch (const std::invalid_argument& e) {
char msg[1024];
sprintf(msg, "in sequence element %d ", (int)_index);
if (!PyErr_Occurred()) {
@@ -630,19 +672,13 @@ namespace swig
return const_reference(_seq, n);
}
- bool check(bool set_err = true) const
+ bool check() const
{
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", (int)i);
- SWIG_Error(SWIG_RuntimeError, msg);
- }
+ if (!swig::check<value_type>(item))
return false;
- }
}
return true;
}
@@ -655,6 +691,14 @@ namespace swig
}
%define %swig_sequence_iterator(Sequence...)
+ %swig_sequence_iterator_with_making_function(swig::make_output_iterator,Sequence...)
+%enddef
+
+%define %swig_sequence_forward_iterator(Sequence...)
+ %swig_sequence_iterator_with_making_function(swig::make_output_forward_iterator,Sequence...)
+%enddef
+
+%define %swig_sequence_iterator_with_making_function(Make_output_iterator,Sequence...)
#if defined(SWIG_EXPORT_ITERATOR_METHODS)
class iterator;
class reverse_iterator;
@@ -663,15 +707,15 @@ namespace swig
%typemap(out,noblock=1,fragment="SwigPySequence_Cont")
iterator, reverse_iterator, const_iterator, const_reverse_iterator {
- $result = SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &)),
+ $result = SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
}
%typemap(out,noblock=1,fragment="SwigPySequence_Cont")
std::pair<iterator, iterator>, std::pair<const_iterator, const_iterator> {
$result = PyTuple_New(2);
- PyTuple_SetItem($result,0,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).first),
+ PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).first),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
- PyTuple_SetItem($result,1,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).second),
+ PyTuple_SetItem($result,1,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).second),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
}
@@ -680,7 +724,7 @@ namespace swig
%typemap(out,noblock=1,fragment="SwigPyPairBoolOutputIterator")
std::pair<iterator, bool>, std::pair<const_iterator, bool> {
$result = PyTuple_New(2);
- PyTuple_SetItem($result,0,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).first),
+ PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).first),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
PyTuple_SetItem($result,1,SWIG_From(bool)(%static_cast($1,const $type &).second));
}
@@ -715,7 +759,7 @@ namespace swig
%newobject iterator(PyObject **PYTHON_SELF);
%extend {
swig::SwigPyIterator* iterator(PyObject **PYTHON_SELF) {
- return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
+ return Make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
}
#if defined(SWIGPYTHON_BUILTIN)
@@ -758,6 +802,12 @@ namespace swig
size_type __len__() const {
return self->size();
}
+
+ // Although __getitem__, front, back actually use a const value_type& return type, the typemaps below
+ // use non-const so that they can be easily overridden by users if necessary.
+ %typemap(ret, fragment="reference_container_owner", noblock=1) value_type& __getitem__, value_type& front, value_type& back {
+ (void)swig::container_owner<swig::traits<$*1_ltype>::category>::back_reference($result, $self);
+ }
}
%enddef
diff --git a/Lib/python/pydocs.swg b/Lib/python/pydocs.swg
index 969af92aa..1eea41b8d 100644
--- a/Lib/python/pydocs.swg
+++ b/Lib/python/pydocs.swg
@@ -22,3 +22,24 @@
%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)";
%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)";
#endif
+
+
+// Types to use in Python documentation for the parameters of the given C++ type.
+%typemap(doctype) bool "boolean";
+
+%define int_doctype_for_cppint_type(cppint_type)
+ %typemap(doctype) cppint_type, unsigned cppint_type "int";
+%enddef
+%formacro(int_doctype_for_cppint_type, short, int, long, long long)
+
+%typemap(doctype) size_t "int";
+
+%typemap(doctype) enum SWIGTYPE "int";
+
+%typemap(doctype) float, double, long double "float";
+
+%typemap(doctype) char*, std::string "string";
+
+%typemap(doctype) SWIGTYPE "$1_basetype"
+%typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)"
+%typemap(doctype) SWIGTYPE & "$typemap(doctype, $*1_ltype)"
diff --git a/Lib/python/pyerrors.swg b/Lib/python/pyerrors.swg
index fe7313554..dcd99c939 100644
--- a/Lib/python/pyerrors.swg
+++ b/Lib/python/pyerrors.swg
@@ -53,14 +53,17 @@ SWIG_Python_AddErrorMsg(const char* mesg)
PyObject *value = 0;
PyObject *traceback = 0;
- if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
+ if (PyErr_Occurred())
+ PyErr_Fetch(&type, &value, &traceback);
if (value) {
- char *tmp;
PyObject *old_str = PyObject_Str(value);
+ const char *tmp = SWIG_Python_str_AsChar(old_str);
PyErr_Clear();
Py_XINCREF(type);
-
- PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
+ if (tmp)
+ PyErr_Format(type, "%s %s", tmp, mesg);
+ else
+ PyErr_Format(type, "%s", mesg);
SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str);
Py_DECREF(value);
@@ -68,3 +71,34 @@ SWIG_Python_AddErrorMsg(const char* mesg)
PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
+
+SWIGRUNTIME int
+SWIG_Python_TypeErrorOccurred(PyObject *obj)
+{
+ PyObject *error;
+ if (obj)
+ return 0;
+ error = PyErr_Occurred();
+ return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
+}
+
+SWIGRUNTIME void
+SWIG_Python_RaiseOrModifyTypeError(const char *message)
+{
+ if (SWIG_Python_TypeErrorOccurred(NULL)) {
+ /* Use existing TypeError to preserve stacktrace and enhance with given message */
+ PyObject *newvalue;
+ PyObject *type = NULL, *value = NULL, *traceback = NULL;
+ PyErr_Fetch(&type, &value, &traceback);
+#if PY_VERSION_HEX >= 0x03000000
+ newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message);
+#else
+ newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
+#endif
+ Py_XDECREF(value);
+ PyErr_Restore(type, newvalue, traceback);
+ } else {
+ /* Raise TypeError using given message */
+ PyErr_SetString(PyExc_TypeError, message);
+ }
+}
diff --git a/Lib/python/pyhead.swg b/Lib/python/pyhead.swg
index 55eb95a6d..c820f9016 100644
--- a/Lib/python/pyhead.swg
+++ b/Lib/python/pyhead.swg
@@ -38,14 +38,16 @@ SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject *str)
{
#if PY_VERSION_HEX >= 0x03000000
- char *cstr;
- char *newstr;
- Py_ssize_t len;
+ char *newstr = 0;
str = PyUnicode_AsUTF8String(str);
- PyBytes_AsStringAndSize(str, &cstr, &len);
- newstr = (char *) malloc(len+1);
- memcpy(newstr, cstr, len+1);
- Py_XDECREF(str);
+ if (str) {
+ char *cstr;
+ Py_ssize_t len;
+ PyBytes_AsStringAndSize(str, &cstr, &len);
+ newstr = (char *) malloc(len+1);
+ memcpy(newstr, cstr, len+1);
+ Py_XDECREF(str);
+ }
return newstr;
#else
return PyString_AsString(str);
@@ -69,144 +71,14 @@ SWIG_Python_str_FromChar(const char *c)
#endif
}
-/* Add PyOS_snprintf for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
-# define PyOS_snprintf _snprintf
-# else
-# define PyOS_snprintf snprintf
-# endif
-#endif
-
-/* A crude PyString_FromFormat implementation for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-
-#ifndef SWIG_PYBUFFER_SIZE
-# define SWIG_PYBUFFER_SIZE 1024
-#endif
-
-static PyObject *
-PyString_FromFormat(const char *fmt, ...) {
- va_list ap;
- char buf[SWIG_PYBUFFER_SIZE * 2];
- int res;
- va_start(ap, fmt);
- res = vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
-}
-#endif
-
#ifndef PyObject_DEL
# define PyObject_DEL PyObject_Del
#endif
-/* A crude PyExc_StopIteration exception for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-# ifndef PyExc_StopIteration
-# define PyExc_StopIteration PyExc_RuntimeError
-# endif
-# ifndef PyObject_GenericGetAttr
-# define PyObject_GenericGetAttr 0
-# endif
-#endif
-
-/* Py_NotImplemented is defined in 2.1 and up. */
-#if PY_VERSION_HEX < 0x02010000
-# ifndef Py_NotImplemented
-# define Py_NotImplemented PyExc_RuntimeError
-# endif
-#endif
-
-/* A crude PyString_AsStringAndSize implementation for old Pythons */
-#if PY_VERSION_HEX < 0x02010000
-# ifndef PyString_AsStringAndSize
-# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
-# endif
-#endif
-
-/* PySequence_Size for old Pythons */
-#if PY_VERSION_HEX < 0x02000000
-# ifndef PySequence_Size
-# define PySequence_Size PySequence_Length
-# endif
-#endif
-
-/* PyBool_FromLong for old Pythons */
-#if PY_VERSION_HEX < 0x02030000
-static
-PyObject *PyBool_FromLong(long ok)
-{
- PyObject *result = ok ? Py_True : Py_False;
- Py_INCREF(result);
- return result;
-}
-#endif
-
-/* Py_ssize_t for old Pythons */
-/* This code is as recommended by: */
-/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
-#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-# define PY_SSIZE_T_MAX INT_MAX
-# define PY_SSIZE_T_MIN INT_MIN
-typedef inquiry lenfunc;
-typedef intargfunc ssizeargfunc;
-typedef intintargfunc ssizessizeargfunc;
-typedef intobjargproc ssizeobjargproc;
-typedef intintobjargproc ssizessizeobjargproc;
-typedef getreadbufferproc readbufferproc;
-typedef getwritebufferproc writebufferproc;
-typedef getsegcountproc segcountproc;
-typedef getcharbufferproc charbufferproc;
-static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
-{
- long result = 0;
- PyObject *i = PyNumber_Int(x);
- if (i) {
- result = PyInt_AsLong(i);
- Py_DECREF(i);
- }
- return result;
-}
-#endif
-
-#if PY_VERSION_HEX < 0x02050000
-#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
-#endif
-
-#if PY_VERSION_HEX < 0x02040000
-#define Py_VISIT(op) \
- do { \
- if (op) { \
- int vret = visit((op), arg); \
- if (vret) \
- return vret; \
- } \
- } while (0)
-#endif
-
-#if PY_VERSION_HEX < 0x02030000
-typedef struct {
- PyTypeObject type;
- PyNumberMethods as_number;
- PyMappingMethods as_mapping;
- PySequenceMethods as_sequence;
- PyBufferProcs as_buffer;
- PyObject *name, *slots;
-} PyHeapTypeObject;
-#endif
-
-#if PY_VERSION_HEX < 0x02030000
-typedef destructor freefunc;
-#endif
-
-#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
- (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
- (PY_MAJOR_VERSION > 3))
+// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
+// interface files check for it.
# define SWIGPY_USE_CAPSULE
-# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
-#endif
+# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
#if PY_VERSION_HEX < 0x03020000
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg
index 2cc582841..dfbf40b34 100644
--- a/Lib/python/pyinit.swg
+++ b/Lib/python/pyinit.swg
@@ -8,6 +8,22 @@
%fragment("<stddef.h>"); // For offsetof
#endif
+%insert(runtime) %{
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Method creation and docstring support functions */
+
+SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name);
+SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
+SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
+
+#ifdef __cplusplus
+}
+#endif
+%}
+
%init %{
#ifdef __cplusplus
@@ -82,17 +98,6 @@ swig_varlink_str(swig_varlinkobject *v) {
return str;
}
-SWIGINTERN int
-swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
- char *tmp;
- PyObject *str = swig_varlink_str(v);
- fprintf(fp,"Swig global variables ");
- fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
- SWIG_Python_str_DelForPy3(tmp);
- Py_DECREF(str);
- return 0;
-}
-
SWIGINTERN void
swig_varlink_dealloc(swig_varlinkobject *v) {
swig_globalvar *var = v->vars;
@@ -151,11 +156,11 @@ swig_varlink_type(void) {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
#endif
- (char *)"swigvarlink", /* tp_name */
+ "swigvarlink", /* tp_name */
sizeof(swig_varlinkobject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor) swig_varlink_dealloc, /* tp_dealloc */
- (printfunc) swig_varlink_print, /* tp_print */
+ 0, /* tp_print */
(getattrfunc) swig_varlink_getattr, /* tp_getattr */
(setattrfunc) swig_varlink_setattr, /* tp_setattr */
0, /* tp_compare */
@@ -175,15 +180,9 @@ swig_varlink_type(void) {
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
-#endif
-#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
@@ -191,20 +190,14 @@ swig_varlink_type(void) {
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;
type_init = 1;
-#if PY_VERSION_HEX < 0x02020000
- varlink_type.ob_type = &PyType_Type;
-#else
if (PyType_Ready(&varlink_type) < 0)
return NULL;
-#endif
}
return &varlink_type;
}
@@ -220,14 +213,14 @@ SWIG_Python_newvarlink(void) {
}
SWIGINTERN void
-SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
+SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
swig_varlinkobject *v = (swig_varlinkobject *) p;
swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
if (gv) {
size_t size = strlen(name)+1;
gv->name = (char *)malloc(size);
if (gv->name) {
- strncpy(gv->name,name,size);
+ memcpy(gv->name, name, size);
gv->get_attr = get_attr;
gv->set_attr = set_attr;
gv->next = v->vars;
@@ -238,9 +231,11 @@ SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int
SWIGINTERN PyObject *
SWIG_globals(void) {
- static PyObject *_SWIG_globals = 0;
- if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
- return _SWIG_globals;
+ static PyObject *globals = 0;
+ if (!globals) {
+ globals = SWIG_newvarlink();
+ }
+ return globals;
}
/* -----------------------------------------------------------------------------
@@ -306,9 +301,9 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
char *ndoc = (char*)malloc(ldoc + lptr + 10);
if (ndoc) {
char *buff = ndoc;
- strncpy(buff, methods[i].ml_doc, ldoc);
+ memcpy(buff, methods[i].ml_doc, ldoc);
buff += ldoc;
- strncpy(buff, "swig_ptr: ", 10);
+ memcpy(buff, "swig_ptr: ", 10);
buff += 10;
SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
methods[i].ml_doc = ndoc;
@@ -319,6 +314,64 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
}
}
+/* -----------------------------------------------------------------------------
+ * Method creation and docstring support functions
+ * ----------------------------------------------------------------------------- */
+
+/* -----------------------------------------------------------------------------
+ * Function to find the method definition with the correct docstring for the
+ * proxy module as opposed to the low-level API
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) {
+ /* Find the function in the modified method table */
+ size_t offset = 0;
+ int found = 0;
+ while (SwigMethods_proxydocs[offset].ml_meth != NULL) {
+ if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) {
+ found = 1;
+ break;
+ }
+ offset++;
+ }
+ /* Use the copy with the modified docstring if available */
+ return found ? &SwigMethods_proxydocs[offset] : NULL;
+}
+
+/* -----------------------------------------------------------------------------
+ * Wrapper of PyInstanceMethod_New() used in Python 3
+ * It is exported to the generated module, used for -fastproxy
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
+ if (PyCFunction_Check(func)) {
+ PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
+ PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
+ if (ml)
+ func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
+ }
+#if PY_VERSION_HEX >= 0x03000000
+ return PyInstanceMethod_New(func);
+#else
+ return PyMethod_New(func, NULL, NULL);
+#endif
+}
+
+/* -----------------------------------------------------------------------------
+ * Wrapper of PyStaticMethod_New()
+ * It is exported to the generated module, used for -fastproxy
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
+ if (PyCFunction_Check(func)) {
+ PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
+ PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
+ if (ml)
+ func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
+ }
+ return PyStaticMethod_New(func);
+}
+
#ifdef __cplusplus
}
#endif
@@ -338,20 +391,12 @@ SWIGEXPORT
void
#endif
SWIG_init(void) {
- PyObject *m, *d, *md;
+ PyObject *m, *d, *md, *globals;
+
#if PY_VERSION_HEX >= 0x03000000
static struct PyModuleDef SWIG_module = {
-# if PY_VERSION_HEX >= 0x03020000
PyModuleDef_HEAD_INIT,
-# else
- {
- PyObject_HEAD_INIT(NULL)
- NULL, /* m_init */
- 0, /* m_index */
- NULL, /* m_copy */
- },
-# endif
- (char *) SWIG_name,
+ SWIG_name,
NULL,
-1,
SwigMethods,
@@ -368,8 +413,8 @@ SWIG_init(void) {
(char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
};
static SwigPyGetSet thisown_getset_closure = {
- (PyCFunction) SwigPyObject_own,
- (PyCFunction) SwigPyObject_own
+ SwigPyObject_own,
+ SwigPyObject_own
};
static PyGetSetDef thisown_getset_def = {
(char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
@@ -400,13 +445,23 @@ SWIG_init(void) {
assert(metatype);
#endif
+ (void)globals;
+
+ /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
+ SWIG_This();
+ SWIG_Python_TypeCache();
+ SwigPyPacked_type();
+#ifndef SWIGPYTHON_BUILTIN
+ SwigPyObject_type();
+#endif
+
/* Fix SwigMethods to carry the callback ptrs when needed */
SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
#if PY_VERSION_HEX >= 0x03000000
m = PyModule_Create(&SWIG_module);
#else
- m = Py_InitModule((char *) SWIG_name, SwigMethods);
+ m = Py_InitModule(SWIG_name, SwigMethods);
#endif
md = d = PyModule_GetDict(m);
diff --git a/Lib/python/pyiterators.swg b/Lib/python/pyiterators.swg
index 8fbb31226..cb15e35cd 100644
--- a/Lib/python/pyiterators.swg
+++ b/Lib/python/pyiterators.swg
@@ -198,16 +198,16 @@ namespace swig {
template<typename OutIterator,
typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
typename FromOper = from_oper<ValueType> >
- class SwigPyIteratorOpen_T : public SwigPyIterator_T<OutIterator>
+ class SwigPyForwardIteratorOpen_T : public SwigPyIterator_T<OutIterator>
{
public:
FromOper from;
typedef OutIterator out_iterator;
typedef ValueType value_type;
typedef SwigPyIterator_T<out_iterator> base;
- typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
+ typedef SwigPyForwardIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
- SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq)
+ SwigPyForwardIteratorOpen_T(out_iterator curr, PyObject *seq)
: SwigPyIterator_T<OutIterator>(curr, seq)
{
}
@@ -229,6 +229,25 @@ namespace swig {
return this;
}
+ };
+
+ template<typename OutIterator,
+ typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
+ typename FromOper = from_oper<ValueType> >
+ class SwigPyIteratorOpen_T : public SwigPyForwardIteratorOpen_T<OutIterator, ValueType, FromOper>
+ {
+ public:
+ FromOper from;
+ typedef OutIterator out_iterator;
+ typedef ValueType value_type;
+ typedef SwigPyIterator_T<out_iterator> base;
+ typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
+
+ SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq)
+ : SwigPyForwardIteratorOpen_T<OutIterator>(curr, seq)
+ {
+ }
+
SwigPyIterator *decr(size_t n = 1)
{
while (n--) {
@@ -241,16 +260,16 @@ namespace swig {
template<typename OutIterator,
typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
typename FromOper = from_oper<ValueType> >
- class SwigPyIteratorClosed_T : public SwigPyIterator_T<OutIterator>
+ class SwigPyForwardIteratorClosed_T : public SwigPyIterator_T<OutIterator>
{
public:
FromOper from;
typedef OutIterator out_iterator;
typedef ValueType value_type;
typedef SwigPyIterator_T<out_iterator> base;
- typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
+ typedef SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
- SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
+ SwigPyForwardIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
: SwigPyIterator_T<OutIterator>(curr, seq), begin(first), end(last)
{
}
@@ -280,10 +299,33 @@ namespace swig {
return this;
}
+ protected:
+ out_iterator begin;
+ out_iterator end;
+ };
+
+ template<typename OutIterator,
+ typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
+ typename FromOper = from_oper<ValueType> >
+ class SwigPyIteratorClosed_T : public SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>
+ {
+ public:
+ FromOper from;
+ typedef OutIterator out_iterator;
+ typedef ValueType value_type;
+ typedef SwigPyIterator_T<out_iterator> base;
+ typedef SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper> base0;
+ typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
+
+ SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
+ : SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
+ {
+ }
+
SwigPyIterator *decr(size_t n = 1)
{
while (n--) {
- if (base::current == begin) {
+ if (base::current == base0::begin) {
throw stop_iteration();
} else {
--base::current;
@@ -291,12 +333,16 @@ namespace swig {
}
return this;
}
-
- private:
- out_iterator begin;
- out_iterator end;
};
+
+ template<typename OutIter>
+ inline SwigPyIterator*
+ make_output_forward_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0)
+ {
+ return new SwigPyForwardIteratorClosed_T<OutIter>(current, begin, end, seq);
+ }
+
template<typename OutIter>
inline SwigPyIterator*
make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0)
@@ -306,6 +352,13 @@ namespace swig {
template<typename OutIter>
inline SwigPyIterator*
+ make_output_forward_iterator(const OutIter& current, PyObject *seq = 0)
+ {
+ return new SwigPyForwardIteratorOpen_T<OutIter>(current, seq);
+ }
+
+ template<typename OutIter>
+ inline SwigPyIterator*
make_output_iterator(const OutIter& current, PyObject *seq = 0)
{
return new SwigPyIteratorOpen_T<OutIter>(current, seq);
diff --git a/Lib/python/pyname_compat.i b/Lib/python/pyname_compat.i
index 96af343ca..a9630dbe7 100644
--- a/Lib/python/pyname_compat.i
+++ b/Lib/python/pyname_compat.i
@@ -34,7 +34,7 @@
%inline %{
#define PyMapIterator_T SwigPyMapIterator_T
#define PyMapKeyIterator_T SwigPyMapKeyIterator_T
-#define PyMapValueIterator_T SwigPyMapValueITerator_T
+#define PyMapValueIterator_T SwigPyMapValueIterator_T
#define PyObject_ptr SwigPtr_PyObject
#define PyObject_var SwigVar_PyObject
#define PyOper SwigPyOper
@@ -76,7 +76,6 @@
#define PySwigPacked_UnpackData SwigPyPacked_UnpackData
#define PySwigPacked_compare SwigPyPacked_compare
#define PySwigPacked_dealloc SwigPyPacked_dealloc
-#define PySwigPacked_print SwigPyPacked_print
#define PySwigPacked_repr SwigPyPacked_repr
#define PySwigPacked_str SwigPyPacked_str
#define PySwigPacked_type SwigPyPacked_type
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
index ab1237f62..445a1e324 100644
--- a/Lib/python/pyrun.swg
+++ b/Lib/python/pyrun.swg
@@ -7,6 +7,14 @@
*
* ----------------------------------------------------------------------------- */
+#if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
+# error "This version of SWIG only supports Python >= 2.7"
+#endif
+
+#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
+# error "This version of SWIG only supports Python 3 >= 3.2"
+#endif
+
/* Common SWIG API */
/* for raw pointers */
@@ -90,11 +98,7 @@ SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
SWIGINTERN void
SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
-#if PY_VERSION_HEX < 0x02030000
- PyDict_SetItemString(d, (char *)name, obj);
-#else
PyDict_SetItemString(d, name, obj);
-#endif
Py_DECREF(obj);
if (public_interface)
SwigPyBuiltin_AddPublicSymbol(public_interface, name);
@@ -104,11 +108,7 @@ SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *nam
SWIGINTERN void
SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
-#if PY_VERSION_HEX < 0x02030000
- PyDict_SetItemString(d, (char *)name, obj);
-#else
PyDict_SetItemString(d, name, obj);
-#endif
Py_DECREF(obj);
}
@@ -118,7 +118,6 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
SWIGINTERN PyObject*
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
-#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
if (!result) {
result = obj;
} else if (result == Py_None) {
@@ -134,29 +133,6 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
Py_DECREF(obj);
}
return result;
-#else
- PyObject* o2;
- PyObject* o3;
- if (!result) {
- result = obj;
- } else if (result == Py_None) {
- Py_DECREF(result);
- result = obj;
- } else {
- if (!PyTuple_Check(result)) {
- o2 = result;
- result = PyTuple_New(1);
- PyTuple_SET_ITEM(result, 0, o2);
- }
- o3 = PyTuple_New(1);
- PyTuple_SET_ITEM(o3, 0, obj);
- o2 = result;
- result = PySequence_Concat(o2, o3);
- Py_DECREF(o2);
- Py_DECREF(o3);
- }
- return result;
-#endif
}
/* Unpack the argument tuple */
@@ -208,11 +184,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
}
/* A functor is a function object with one single object argument */
-#if PY_VERSION_HEX >= 0x02020000
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
-#else
-#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
-#endif
/*
Helper for static pointer initialization for both C and C++ code, for example
@@ -241,35 +213,6 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
extern "C" {
#endif
-/* How to access Py_None */
-#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# ifndef SWIG_PYTHON_NO_BUILD_NONE
-# ifndef SWIG_PYTHON_BUILD_NONE
-# define SWIG_PYTHON_BUILD_NONE
-# endif
-# endif
-#endif
-
-#ifdef SWIG_PYTHON_BUILD_NONE
-# ifdef Py_None
-# undef Py_None
-# define Py_None SWIG_Py_None()
-# endif
-SWIGRUNTIMEINLINE PyObject *
-_SWIG_Py_None(void)
-{
- PyObject *none = Py_BuildValue((char*)"");
- Py_DECREF(none);
- return none;
-}
-SWIGRUNTIME PyObject *
-SWIG_Py_None(void)
-{
- static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
- return none;
-}
-#endif
-
/* The python void return value */
SWIGRUNTIMEINLINE PyObject *
@@ -296,7 +239,10 @@ SWIGRUNTIMEINLINE int
SWIG_Python_CheckImplicit(swig_type_info *ty)
{
SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
- return data ? data->implicitconv : 0;
+ int fail = data ? data->implicitconv : 0;
+ if (fail)
+ PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors.");
+ return fail;
}
SWIGRUNTIMEINLINE PyObject *
@@ -323,11 +269,7 @@ SwigPyClientData_New(PyObject* obj)
data->newargs = obj;
Py_INCREF(obj);
} else {
-#if (PY_VERSION_HEX < 0x02020000)
- data->newraw = 0;
-#else
- data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
-#endif
+ data->newraw = PyObject_GetAttrString(data->klass, "__new__");
if (data->newraw) {
Py_INCREF(data->newraw);
data->newargs = PyTuple_New(1);
@@ -338,7 +280,7 @@ SwigPyClientData_New(PyObject* obj)
Py_INCREF(data->newargs);
}
/* the destroy method, aka as the C++ delete method */
- data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
+ data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
if (PyErr_Occurred()) {
PyErr_Clear();
data->destroy = 0;
@@ -347,11 +289,7 @@ SwigPyClientData_New(PyObject* obj)
int flags;
Py_INCREF(data->destroy);
flags = PyCFunction_GET_FLAGS(data->destroy);
-#ifdef METH_O
data->delargs = !(flags & (METH_O));
-#else
- data->delargs = 0;
-#endif
} else {
data->delargs = 0;
}
@@ -439,20 +377,12 @@ SwigPyObject_hex(SwigPyObject *v)
}
SWIGRUNTIME PyObject *
-#ifdef METH_NOARGS
SwigPyObject_repr(SwigPyObject *v)
-#else
-SwigPyObject_repr(SwigPyObject *v, PyObject *args)
-#endif
{
const char *name = SWIG_TypePrettyName(v->ty);
PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
if (v->next) {
-# ifdef METH_NOARGS
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
-# else
- PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
-# endif
# if PY_VERSION_HEX >= 0x03000000
PyObject *joined = PyUnicode_Concat(repr, nrep);
Py_DecRef(repr);
@@ -465,6 +395,14 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args)
return repr;
}
+/* We need a version taking two PyObject* parameters so it's a valid
+ * PyCFunction to use in swigobject_methods[]. */
+SWIGRUNTIME PyObject *
+SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
+{
+ return SwigPyObject_repr((SwigPyObject*)v);
+}
+
SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
{
@@ -538,14 +476,14 @@ SwigPyObject_dealloc(PyObject *v)
PyObject *res;
/* PyObject_CallFunction() has the potential to silently drop
- the active active exception. In cases of unnamed temporary
+ the 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);
+ PyObject *type = NULL, *value = NULL, *traceback = NULL;
+ PyErr_Fetch(&type, &value, &traceback);
if (data->delargs) {
/* we need to create a temporary object to carry the destroy operation */
@@ -560,7 +498,7 @@ SwigPyObject_dealloc(PyObject *v)
if (!res)
PyErr_WriteUnraisable(destroy);
- PyErr_Restore(val, type, tb);
+ PyErr_Restore(type, value, traceback);
Py_XDECREF(res);
}
@@ -579,11 +517,6 @@ SWIGRUNTIME PyObject*
SwigPyObject_append(PyObject* v, PyObject* next)
{
SwigPyObject *sobj = (SwigPyObject *) v;
-#ifndef METH_O
- PyObject *tmp = 0;
- if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
- next = tmp;
-#endif
if (!SwigPyObject_Check(next)) {
PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
return NULL;
@@ -594,11 +527,7 @@ SwigPyObject_append(PyObject* v, PyObject* next)
}
SWIGRUNTIME PyObject*
-#ifdef METH_NOARGS
-SwigPyObject_next(PyObject* v)
-#else
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
{
SwigPyObject *sobj = (SwigPyObject *) v;
if (sobj->next) {
@@ -610,11 +539,7 @@ SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
}
SWIGINTERN PyObject*
-#ifdef METH_NOARGS
-SwigPyObject_disown(PyObject *v)
-#else
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
{
SwigPyObject *sobj = (SwigPyObject *)v;
sobj->own = 0;
@@ -622,11 +547,7 @@ SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
}
SWIGINTERN PyObject*
-#ifdef METH_NOARGS
-SwigPyObject_acquire(PyObject *v)
-#else
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
{
SwigPyObject *sobj = (SwigPyObject *)v;
sobj->own = SWIG_POINTER_OWN;
@@ -637,70 +558,32 @@ SWIGINTERN PyObject*
SwigPyObject_own(PyObject *v, PyObject *args)
{
PyObject *val = 0;
-#if (PY_VERSION_HEX < 0x02020000)
- if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
-#elif (PY_VERSION_HEX < 0x02050000)
- if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
-#else
- if (!PyArg_UnpackTuple(args, "own", 0, 1, &val))
-#endif
- {
- return NULL;
+ if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) {
+ return NULL;
+ } else {
+ SwigPyObject *sobj = (SwigPyObject *)v;
+ PyObject *obj = PyBool_FromLong(sobj->own);
+ if (val) {
+ if (PyObject_IsTrue(val)) {
+ SwigPyObject_acquire(v,args);
+ } else {
+ SwigPyObject_disown(v,args);
+ }
}
- else
- {
- SwigPyObject *sobj = (SwigPyObject *)v;
- PyObject *obj = PyBool_FromLong(sobj->own);
- if (val) {
-#ifdef METH_NOARGS
- if (PyObject_IsTrue(val)) {
- SwigPyObject_acquire(v);
- } else {
- SwigPyObject_disown(v);
- }
-#else
- if (PyObject_IsTrue(val)) {
- SwigPyObject_acquire(v,args);
- } else {
- SwigPyObject_disown(v,args);
- }
-#endif
- }
- return obj;
- }
+ return obj;
+ }
}
-#ifdef METH_O
-static PyMethodDef
-swigobject_methods[] = {
- {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
- {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (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_O, (char *)"appends another 'this' object"},
- {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
- {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"},
- {0, 0, 0, 0}
-};
-#else
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 *)"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"},
- {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"},
+ {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"},
+ {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"},
+ {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"},
+ {"append", SwigPyObject_append, METH_O, "appends another 'this' object"},
+ {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"},
+ {"__repr__",SwigPyObject_repr2, METH_NOARGS, "returns object representation"},
{0, 0, 0, 0}
};
-#endif
-
-#if PY_VERSION_HEX < 0x02020000
-SWIGINTERN PyObject *
-SwigPyObject_getattr(SwigPyObject *sobj,char *name)
-{
- return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
-}
-#endif
SWIGRUNTIME PyTypeObject*
SwigPyObject_TypeOnce(void) {
@@ -745,12 +628,8 @@ SwigPyObject_TypeOnce(void) {
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 */
+#else
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
-#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
- 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
#endif
};
@@ -764,16 +643,12 @@ SwigPyObject_TypeOnce(void) {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
#endif
- (char *)"SwigPyObject", /* tp_name */
+ "SwigPyObject", /* tp_name */
sizeof(SwigPyObject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyObject_dealloc, /* tp_dealloc */
0, /* tp_print */
-#if PY_VERSION_HEX < 0x02020000
- (getattrfunc)SwigPyObject_getattr, /* tp_getattr */
-#else
(getattrfunc)0, /* tp_getattr */
-#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 */
@@ -796,7 +671,6 @@ SwigPyObject_TypeOnce(void) {
0, /* tp_clear */
(richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
0, /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
0, /* tp_iter */
0, /* tp_iternext */
swigobject_methods, /* tp_methods */
@@ -817,13 +691,8 @@ SwigPyObject_TypeOnce(void) {
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
-#endif
-#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
@@ -831,20 +700,14 @@ SwigPyObject_TypeOnce(void) {
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;
type_init = 1;
-#if PY_VERSION_HEX < 0x02020000
- swigpyobject_type.ob_type = &PyType_Type;
-#else
if (PyType_Ready(&swigpyobject_type) < 0)
return NULL;
-#endif
}
return &swigpyobject_type;
}
@@ -873,20 +736,6 @@ typedef struct {
size_t size;
} SwigPyPacked;
-SWIGRUNTIME int
-SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
-{
- char result[SWIG_BUFFER_SIZE];
- fputs("<Swig Packed ", fp);
- if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
- fputs("at ", fp);
- fputs(result, fp);
- }
- fputs(v->ty->name,fp);
- fputs(">", fp);
- return 0;
-}
-
SWIGRUNTIME PyObject *
SwigPyPacked_repr(SwigPyPacked *v)
{
@@ -915,7 +764,7 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
size_t i = v->size;
size_t j = w->size;
int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
- return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
+ return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2*v->size);
}
SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
@@ -955,11 +804,11 @@ SwigPyPacked_TypeOnce(void) {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
#endif
- (char *)"SwigPyPacked", /* tp_name */
+ "SwigPyPacked", /* tp_name */
sizeof(SwigPyPacked), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyPacked_dealloc, /* tp_dealloc */
- (printfunc)SwigPyPacked_print, /* tp_print */
+ 0, /* tp_print */
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */
#if PY_VERSION_HEX>=0x03000000
@@ -983,7 +832,6 @@ SwigPyPacked_TypeOnce(void) {
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
@@ -1004,13 +852,8 @@ SwigPyPacked_TypeOnce(void) {
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
-#endif
-#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
@@ -1018,20 +861,14 @@ SwigPyPacked_TypeOnce(void) {
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;
type_init = 1;
-#if PY_VERSION_HEX < 0x02020000
- swigpypacked_type.ob_type = &PyType_Type;
-#else
if (PyType_Ready(&swigpypacked_type) < 0)
return NULL;
-#endif
}
return &swigpypacked_type;
}
@@ -1072,20 +909,14 @@ SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
* pointers/data manipulation
* ----------------------------------------------------------------------------- */
-SWIGRUNTIMEINLINE PyObject *
-_SWIG_This(void)
-{
- return SWIG_Python_str_FromChar("this");
-}
-
-static PyObject *swig_this = NULL;
+static PyObject *Swig_This_global = NULL;
SWIGRUNTIME PyObject *
SWIG_This(void)
{
- if (swig_this == NULL)
- swig_this = _SWIG_This();
- return swig_this;
+ if (Swig_This_global == NULL)
+ Swig_This_global = SWIG_Python_str_FromChar("this");
+ return Swig_This_global;
}
/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
@@ -1117,7 +948,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
obj = 0;
-#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
+#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
if (PyInstance_Check(pyobj)) {
obj = _PyInstance_Lookup(pyobj, SWIG_This());
} else {
@@ -1187,7 +1018,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
if (obj == Py_None && !implicit_conv) {
if (ptr)
*ptr = 0;
- return SWIG_OK;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
res = SWIG_ERROR;
@@ -1267,13 +1098,13 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
}
- }
- if (!SWIG_IsOK(res) && obj == Py_None) {
- if (ptr)
- *ptr = 0;
- if (PyErr_Occurred())
- PyErr_Clear();
- res = SWIG_OK;
+ if (!SWIG_IsOK(res) && obj == Py_None) {
+ if (ptr)
+ *ptr = 0;
+ if (PyErr_Occurred())
+ PyErr_Clear();
+ res = SWIG_OK;
+ }
}
}
return res;
@@ -1287,31 +1118,28 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
return SWIG_ConvertPtr(obj, ptr, ty, 0);
} else {
void *vptr = 0;
-
+ swig_cast_info *tc;
+
/* here we get the method pointer for callbacks */
const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
if (desc)
desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
- if (!desc)
+ if (!desc)
return SWIG_ERROR;
- if (ty) {
- swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (tc) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- } else {
- return SWIG_ERROR;
- }
+ tc = SWIG_TypeCheck(desc,ty);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
} else {
- *ptr = vptr;
+ return SWIG_ERROR;
}
return SWIG_OK;
}
}
-/* Convert a packed value value */
+/* Convert a packed pointer value */
SWIGRUNTIME int
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
@@ -1339,7 +1167,6 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t
SWIGRUNTIME PyObject*
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
{
-#if (PY_VERSION_HEX >= 0x02020000)
PyObject *inst = 0;
PyObject *newraw = data->newraw;
if (newraw) {
@@ -1362,10 +1189,18 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
}
} else {
#if PY_VERSION_HEX >= 0x03000000
- 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;
+ PyObject *empty_args = PyTuple_New(0);
+ if (empty_args) {
+ PyObject *empty_kwargs = PyDict_New();
+ if (empty_kwargs) {
+ inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
+ Py_DECREF(empty_kwargs);
+ if (inst) {
+ PyObject_SetAttr(inst, SWIG_This(), swig_this);
+ Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
+ }
+ }
+ Py_DECREF(empty_args);
}
#else
PyObject *dict = PyDict_New();
@@ -1377,45 +1212,13 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
#endif
}
return inst;
-#else
-#if (PY_VERSION_HEX >= 0x02010000)
- PyObject *inst = 0;
- PyObject *dict = PyDict_New();
- if (dict) {
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- inst = PyInstance_NewRaw(data->newargs, dict);
- Py_DECREF(dict);
- }
- return (PyObject *) inst;
-#else
- PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
- if (inst == NULL) {
- return NULL;
- }
- inst->in_class = (PyClassObject *)data->newargs;
- Py_INCREF(inst->in_class);
- inst->in_dict = PyDict_New();
- if (inst->in_dict == NULL) {
- Py_DECREF(inst);
- return NULL;
- }
-#ifdef Py_TPFLAGS_HAVE_WEAKREFS
- inst->in_weakreflist = NULL;
-#endif
-#ifdef Py_TPFLAGS_GC
- PyObject_GC_Init(inst);
-#endif
- PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
- return (PyObject *) inst;
-#endif
-#endif
}
SWIGRUNTIME void
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
{
PyObject *dict;
-#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
+#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
PyObject **dictptr = _PyObject_GetDictPtr(inst);
if (dictptr != NULL) {
dict = *dictptr;
@@ -1427,7 +1230,7 @@ SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
return;
}
#endif
- dict = PyObject_GetAttrString(inst, (char*)"__dict__");
+ dict = PyObject_GetAttrString(inst, "__dict__");
PyDict_SetItem(dict, SWIG_This(), swig_this);
Py_DECREF(dict);
}
@@ -1526,12 +1329,7 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
#ifdef SWIG_LINK_RUNTIME
type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
#else
-# ifdef SWIGPY_USE_CAPSULE
type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
-# else
- type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
- (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
-# endif
if (PyErr_Occurred()) {
PyErr_Clear();
type_pointer = (void *)0;
@@ -1541,48 +1339,10 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
return (swig_module_info *) type_pointer;
}
-#if PY_MAJOR_VERSION < 2
-/* PyModule_AddObject function was introduced in Python 2.0. The following function
- is copied out of Python/modsupport.c in python version 2.3.4 */
-SWIGINTERN int
-PyModule_AddObject(PyObject *m, char *name, PyObject *o)
-{
- PyObject *dict;
- if (!PyModule_Check(m)) {
- 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");
- return SWIG_ERROR;
- }
-
- dict = PyModule_GetDict(m);
- if (dict == NULL) {
- /* Internal error -- modules must have a dict! */
- PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
- PyModule_GetName(m));
- return SWIG_ERROR;
- }
- if (PyDict_SetItemString(dict, name, o))
- return SWIG_ERROR;
- Py_DECREF(o);
- return SWIG_OK;
-}
-#endif
-
SWIGRUNTIME void
-#ifdef SWIGPY_USE_CAPSULE
SWIG_Python_DestroyModule(PyObject *obj)
-#else
-SWIG_Python_DestroyModule(void *vptr)
-#endif
{
-#ifdef SWIGPY_USE_CAPSULE
swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
-#else
- swig_module_info *swig_module = (swig_module_info *) vptr;
-#endif
swig_type_info **types = swig_module->types;
size_t i;
for (i =0; i < swig_module->size; ++i) {
@@ -1593,33 +1353,24 @@ SWIG_Python_DestroyModule(void *vptr)
}
}
Py_DECREF(SWIG_This());
- swig_this = NULL;
+ Swig_This_global = NULL;
}
SWIGRUNTIME void
SWIG_Python_SetModule(swig_module_info *swig_module) {
#if PY_VERSION_HEX >= 0x03000000
/* Add a dummy module object into sys.modules */
- PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
+ PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION);
#else
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
- PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
+ PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
#endif
-#ifdef SWIGPY_USE_CAPSULE
PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
if (pointer && module) {
- PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
+ PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
} else {
Py_XDECREF(pointer);
}
-#else
- PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
- if (pointer && module) {
- PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
- } else {
- Py_XDECREF(pointer);
- }
-#endif
}
/* The python cached type query */
@@ -1637,20 +1388,12 @@ SWIG_Python_TypeQuery(const char *type)
PyObject *obj = PyDict_GetItem(cache, key);
swig_type_info *descriptor;
if (obj) {
-#ifdef SWIGPY_USE_CAPSULE
descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
-#else
- descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
-#endif
} else {
swig_module_info *swig_module = SWIG_GetModule(0);
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) {
-#ifdef SWIGPY_USE_CAPSULE
obj = PyCapsule_New((void*) descriptor, NULL, NULL);
-#else
- obj = PyCObject_FromVoidPtr(descriptor, NULL);
-#endif
PyDict_SetItem(cache, key, obj);
Py_DECREF(obj);
}
@@ -1675,14 +1418,15 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront)
PyObject *traceback = 0;
PyErr_Fetch(&type, &value, &traceback);
if (value) {
- char *tmp;
PyObject *old_str = PyObject_Str(value);
+ const char *tmp = SWIG_Python_str_AsChar(old_str);
+ const char *errmesg = tmp ? tmp : "Invalid error message";
Py_XINCREF(type);
PyErr_Clear();
if (infront) {
- PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
+ PyErr_Format(type, "%s %s", mesg, errmesg);
} else {
- PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
+ PyErr_Format(type, "%s %s", errmesg, mesg);
}
SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str);
@@ -1808,6 +1552,8 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
Py_INCREF(name);
} else {
encoded_name = PyUnicode_AsUTF8String(name);
+ if (!encoded_name)
+ return -1;
}
PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
Py_DECREF(encoded_name);
diff --git a/Lib/python/pyruntime.swg b/Lib/python/pyruntime.swg
index fad97be9f..751bc8d5f 100644
--- a/Lib/python/pyruntime.swg
+++ b/Lib/python/pyruntime.swg
@@ -1,9 +1,14 @@
%insert(runtime) %{
+#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
+/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
+# include <math.h>
+#endif
+
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
# undef _DEBUG
# include <Python.h>
-# define _DEBUG
+# define _DEBUG 1
#else
# include <Python.h>
#endif
diff --git a/Lib/python/pystdcommon.swg b/Lib/python/pystdcommon.swg
index 8372426a0..0242e4d35 100644
--- a/Lib/python/pystdcommon.swg
+++ b/Lib/python/pystdcommon.swg
@@ -45,7 +45,7 @@ namespace swig {
template <class Type>
struct traits_asptr {
static int asptr(PyObject *obj, Type **val) {
- Type *p;
+ Type *p = 0;
swig_type_info *descriptor = type_info<Type>();
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res)) {
@@ -107,14 +107,14 @@ namespace swig {
template <class Type>
struct traits_as<Type, value_category> {
- static Type as(PyObject *obj, bool throw_error) {
+ static Type as(PyObject *obj) {
Type v;
int res = asval(obj, &v);
if (!obj || !SWIG_IsOK(res)) {
if (!PyErr_Occurred()) {
::%type_error(swig::type_name<Type>());
}
- if (throw_error) throw std::invalid_argument("bad type");
+ throw std::invalid_argument("bad type");
}
return v;
}
@@ -122,7 +122,7 @@ namespace swig {
template <class Type>
struct traits_as<Type, pointer_category> {
- static Type as(PyObject *obj, bool throw_error) {
+ static Type as(PyObject *obj) {
Type *v = 0;
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
if (SWIG_IsOK(res) && v) {
@@ -134,21 +134,17 @@ namespace swig {
return *v;
}
} else {
- // Uninitialized return value, no Type() constructor required.
- static Type *v_def = (Type*) malloc(sizeof(Type));
if (!PyErr_Occurred()) {
%type_error(swig::type_name<Type>());
}
- if (throw_error) throw std::invalid_argument("bad type");
- memset(v_def,0,sizeof(Type));
- return *v_def;
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
struct traits_as<Type*, pointer_category> {
- static Type* as(PyObject *obj, bool throw_error) {
+ static Type* as(PyObject *obj) {
Type *v = 0;
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
if (SWIG_IsOK(res)) {
@@ -157,15 +153,14 @@ namespace swig {
if (!PyErr_Occurred()) {
%type_error(swig::type_name<Type>());
}
- if (throw_error) throw std::invalid_argument("bad type");
- return 0;
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
- inline Type as(PyObject *obj, bool te = false) {
- return traits_as<Type, typename traits<Type>::category>::as(obj, te);
+ inline Type as(PyObject *obj) {
+ return traits_as<Type, typename traits<Type>::category>::as(obj);
}
template <class Type>
diff --git a/Lib/python/pystrings.swg b/Lib/python/pystrings.swg
index fd37855eb..93f48acfa 100644
--- a/Lib/python/pystrings.swg
+++ b/Lib/python/pystrings.swg
@@ -16,6 +16,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
%#endif
{
char *cstr; Py_ssize_t len;
+ int ret = SWIG_OK;
%#if PY_VERSION_HEX>=0x03000000
%#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
if (!alloc && cptr) {
@@ -26,7 +27,10 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
return SWIG_RuntimeError;
}
obj = PyUnicode_AsUTF8String(obj);
- if(alloc) *alloc = SWIG_NEWOBJ;
+ if (!obj)
+ return SWIG_TypeError;
+ if (alloc)
+ *alloc = SWIG_NEWOBJ;
%#endif
PyBytes_AsStringAndSize(obj, &cstr, &len);
%#else
@@ -34,21 +38,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
%#endif
if (cptr) {
if (alloc) {
- /*
- In python the user should not be able to modify the inner
- string representation. To warranty that, if you define
- SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
- buffer is always returned.
-
- The default behavior is just to return the pointer value,
- so, be careful.
- */
-%#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
- if (*alloc != SWIG_OLDOBJ)
-%#else
- if (*alloc == SWIG_NEWOBJ)
-%#endif
- {
+ if (*alloc == SWIG_NEWOBJ) {
*cptr = %new_copy_array(cstr, len + 1, char);
*alloc = SWIG_NEWOBJ;
} else {
@@ -64,6 +54,8 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
%#endif
%#else
*cptr = SWIG_Python_str_AsChar(obj);
+ if (!*cptr)
+ ret = SWIG_TypeError;
%#endif
}
}
@@ -71,7 +63,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
%#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
Py_XDECREF(obj);
%#endif
- return SWIG_OK;
+ return ret;
} else {
%#if defined(SWIG_PYTHON_2_UNICODE)
%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
@@ -84,6 +76,8 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
return SWIG_RuntimeError;
}
obj = PyUnicode_AsUTF8String(obj);
+ if (!obj)
+ return SWIG_TypeError;
if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
if (cptr) {
if (alloc) *alloc = SWIG_NEWOBJ;
@@ -129,11 +123,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
return PyBytes_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t));
%#else
-%#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));
diff --git a/Lib/python/pythonkw.swg b/Lib/python/pythonkw.swg
index 1a4329d20..0138e40e4 100644
--- a/Lib/python/pythonkw.swg
+++ b/Lib/python/pythonkw.swg
@@ -14,6 +14,8 @@
PYTHONKW(and);
PYTHONKW(as);
PYTHONKW(assert);
+PYTHONKW(async);
+PYTHONKW(await);
PYTHONKW(break);
PYTHONKW(class);
PYTHONKW(continue);
diff --git a/Lib/python/pythreads.swg b/Lib/python/pythreads.swg
index a7552f1fe..d8797e659 100644
--- a/Lib/python/pythreads.swg
+++ b/Lib/python/pythreads.swg
@@ -5,9 +5,7 @@
#endif
#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
-# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
-# define SWIG_PYTHON_USE_GIL
-# endif
+# define SWIG_PYTHON_USE_GIL
# endif
# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
# ifndef SWIG_PYTHON_INITIALIZE_THREADS
diff --git a/Lib/python/pytypemaps.swg b/Lib/python/pytypemaps.swg
index 48b0bcdc8..0eda17cda 100644
--- a/Lib/python/pytypemaps.swg
+++ b/Lib/python/pytypemaps.swg
@@ -80,7 +80,7 @@
/* Consttab, needed for callbacks, it should be removed later */
%typemap(consttab) SWIGTYPE ((*)(ANY))
-{ SWIG_PY_POINTER, (char*)"$symname", 0, 0, (void *)($value), &$descriptor }
+{ SWIG_PY_POINTER, "$symname", 0, 0, (void *)($value), &$descriptor }
%typemap(consttab) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY));
%typemap(constcode) SWIGTYPE ((*)(ANY)) "";
diff --git a/Lib/python/pyuserdir.swg b/Lib/python/pyuserdir.swg
index 00aec07d5..311076079 100644
--- a/Lib/python/pyuserdir.swg
+++ b/Lib/python/pyuserdir.swg
@@ -41,9 +41,6 @@ The implementation is based on this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158
-and works for modern (-modern) and plain python. We do not use __slots__,
-so, it works with old python versions.
-
*/
#define %pythonnondynamic %feature("python:nondynamic", "1")
@@ -163,7 +160,7 @@ These methods "may be called" if needed.
/* ------------------------------------------------------------------------- */
/*
- Enable keywords paramaters
+ Enable keywords parameters
*/
#define %kwargs %feature("kwargs")
diff --git a/Lib/python/pywstrings.swg b/Lib/python/pywstrings.swg
index e64618762..0e5a78df5 100644
--- a/Lib/python/pywstrings.swg
+++ b/Lib/python/pywstrings.swg
@@ -18,16 +18,32 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc)
int isunicode = PyUnicode_Check(obj);
%#if PY_VERSION_HEX < 0x03000000 && !defined(SWIG_PYTHON_STRICT_UNICODE_WCHAR)
if (!isunicode && PyString_Check(obj)) {
- obj = tmp = PyUnicode_FromObject(obj);
- isunicode = 1;
+ tmp = PyUnicode_FromObject(obj);
+ if (tmp) {
+ isunicode = 1;
+ obj = tmp;
+ } else {
+ PyErr_Clear();
+ return SWIG_TypeError;
+ }
}
%#endif
if (isunicode) {
+%#if PY_VERSION_HEX >= 0x03030000
+ Py_ssize_t len = PyUnicode_GetLength(obj);
+%#else
Py_ssize_t len = PyUnicode_GetSize(obj);
+%#endif
if (cptr) {
+ Py_ssize_t length;
*cptr = %new_array(len + 1, wchar_t);
- PyUnicode_AsWideChar(SWIGPY_UNICODE_ARG(obj), *cptr, len);
- (*cptr)[len] = 0;
+ length = PyUnicode_AsWideChar(SWIGPY_UNICODE_ARG(obj), *cptr, len);
+ if (length == -1) {
+ PyErr_Clear();
+ Py_XDECREF(tmp);
+ return SWIG_TypeError;
+ }
+ (*cptr)[length] = 0;
}
if (psize) *psize = (size_t) len + 1;
if (alloc) *alloc = cptr ? SWIG_NEWOBJ : 0;
diff --git a/Lib/python/std_basic_string.i b/Lib/python/std_basic_string.i
index 7d3366db5..e3f524dbd 100644
--- a/Lib/python/std_basic_string.i
+++ b/Lib/python/std_basic_string.i
@@ -9,41 +9,34 @@
%fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
fragment="SWIG_AsCharPtrAndSize") {
SWIGINTERN int
-SWIG_AsPtr(std::basic_string<char>)(PyObject* obj, std::string **val)
-{
- static swig_type_info* string_info =
- SWIG_TypeQuery("std::basic_string<char> *");
- std::string *vptr;
- if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
+SWIG_AsPtr(std::basic_string<char>)(PyObject* obj, std::string **val) {
+ static swig_type_info* string_info = SWIG_TypeQuery("std::basic_string<char> *");
+ std::string *vptr;
+ if (SWIG_IsOK(SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0))) {
if (val) *val = vptr;
return SWIG_OLDOBJ;
} else {
PyErr_Clear();
char* buf = 0 ; size_t size = 0; int alloc = 0;
- if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
+ if (SWIG_IsOK(SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc))) {
if (buf) {
if (val) *val = new std::string(buf, size - 1);
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
return SWIG_NEWOBJ;
+ } else {
+ if (val) *val = 0;
+ return SWIG_OLDOBJ;
}
- } else {
- PyErr_Clear();
- }
- if (val) {
- SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyErr_SetString(PyExc_TypeError,"a string is expected");
- SWIG_PYTHON_THREAD_END_BLOCK;
}
- return 0;
+ return SWIG_ERROR;
}
-}
+}
}
%fragment(SWIG_From_frag(std::basic_string<char>),"header",
fragment="SWIG_FromCharPtrAndSize") {
SWIGINTERNINLINE PyObject*
- SWIG_From(std::basic_string<char>)(const std::string& s)
- {
+ SWIG_From(std::basic_string<char>)(const std::string& s) {
return SWIG_FromCharPtrAndSize(s.data(), s.size());
}
}
@@ -59,41 +52,34 @@ SWIGINTERNINLINE PyObject*
%fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
fragment="SWIG_AsWCharPtrAndSize") {
SWIGINTERN int
- SWIG_AsPtr(std::basic_string<wchar_t>)(PyObject* obj, std::wstring **val)
- {
- static swig_type_info* string_info =
- SWIG_TypeQuery("std::basic_string<wchar_t> *");
- std::wstring *vptr;
- if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
- if (val) *val = vptr;
- return SWIG_OLDOBJ;
- } else {
- PyErr_Clear();
- wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
- if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
- if (buf) {
- if (val) *val = new std::wstring(buf, size - 1);
- if (alloc == SWIG_NEWOBJ) %delete_array(buf);
- return SWIG_NEWOBJ;
- }
+SWIG_AsPtr(std::basic_string<wchar_t>)(PyObject* obj, std::wstring **val) {
+ static swig_type_info* string_info = SWIG_TypeQuery("std::basic_string<wchar_t> *");
+ std::wstring *vptr;
+ if (SWIG_IsOK(SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0))) {
+ if (val) *val = vptr;
+ return SWIG_OLDOBJ;
+ } else {
+ PyErr_Clear();
+ wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
+ if (SWIG_IsOK(SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc))) {
+ if (buf) {
+ if (val) *val = new std::wstring(buf, size - 1);
+ if (alloc == SWIG_NEWOBJ) %delete_array(buf);
+ return SWIG_NEWOBJ;
} else {
- PyErr_Clear();
- }
- if (val) {
- SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyErr_SetString(PyExc_TypeError,"a wstring is expected");
- SWIG_PYTHON_THREAD_END_BLOCK;
+ if (val) *val = 0;
+ return SWIG_OLDOBJ;
}
- return 0;
}
+ return SWIG_ERROR;
}
}
+}
%fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
fragment="SWIG_FromWCharPtrAndSize") {
SWIGINTERNINLINE PyObject*
- SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
- {
+ SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s) {
return SWIG_FromWCharPtrAndSize(s.data(), s.size());
}
}
diff --git a/Lib/python/std_complex.i b/Lib/python/std_complex.i
index 4e8fed305..c9c46c4c3 100644
--- a/Lib/python/std_complex.i
+++ b/Lib/python/std_complex.i
@@ -8,6 +8,13 @@
#include <complex>
%}
+namespace std {
+ %naturalvar complex;
+ template<typename T> class complex;
+ %template() complex<double>;
+ %template() complex<float>;
+}
+
/* defining the complex as/from converters */
%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
@@ -18,5 +25,3 @@
%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>);
%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>);
-
-
diff --git a/Lib/python/std_deque.i b/Lib/python/std_deque.i
index b19375633..d9a174706 100644
--- a/Lib/python/std_deque.i
+++ b/Lib/python/std_deque.i
@@ -14,7 +14,7 @@
template <class T>
struct traits_from<std::deque<T> > {
- static PyObject *from(const std::deque<T> & vec) {
+ static PyObject *from(const std::deque<T>& vec) {
return traits_from_stdseq<std::deque<T> >::from(vec);
}
};
diff --git a/Lib/python/std_list.i b/Lib/python/std_list.i
index baf66d914..24d274b42 100644
--- a/Lib/python/std_list.i
+++ b/Lib/python/std_list.i
@@ -14,7 +14,7 @@
template <class T>
struct traits_from<std::list<T> > {
- static PyObject *from(const std::list<T> & vec) {
+ static PyObject *from(const std::list<T>& vec) {
return traits_from_stdseq<std::list<T> >::from(vec);
}
};
diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i
index f61f79c44..8ae483cef 100644
--- a/Lib/python/std_map.i
+++ b/Lib/python/std_map.i
@@ -56,9 +56,9 @@
template<class OutIterator,
class FromOper = from_value_oper<typename OutIterator::value_type> >
- struct SwigPyMapValueITerator_T : SwigPyMapIterator_T<OutIterator, FromOper>
+ struct SwigPyMapValueIterator_T : SwigPyMapIterator_T<OutIterator, FromOper>
{
- SwigPyMapValueITerator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
+ SwigPyMapValueIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
{
}
@@ -69,7 +69,7 @@
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);
+ return new SwigPyMapValueIterator_T<OutIter>(current, begin, end, seq);
}
}
}
@@ -156,6 +156,7 @@
%feature("python:slot", "mp_length", functype="lenfunc") __len__;
%feature("python:slot", "mp_subscript", functype="binaryfunc") __getitem__;
%feature("python:slot", "tp_iter", functype="getiterfunc") key_iterator;
+ %feature("python:slot", "sq_contains", functype="objobjproc") __contains__;
%extend {
%newobject iterkeys(PyObject **PYTHON_SELF);
@@ -263,7 +264,6 @@
return itemList;
}
- // Python 2.2 methods
bool __contains__(const key_type& key) {
return self->find(key) != self->end();
}
diff --git a/Lib/python/std_multimap.i b/Lib/python/std_multimap.i
index 3209fb0f8..f78a5277c 100644
--- a/Lib/python/std_multimap.i
+++ b/Lib/python/std_multimap.i
@@ -23,7 +23,11 @@
int res = SWIG_ERROR;
if (PyDict_Check(obj)) {
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
- return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
+%#if PY_VERSION_HEX >= 0x03000000
+ /* In Python 3.x the ".items()" method returns a dict_items object */
+ items = PySequence_Fast(items, ".items() didn't return a sequence!");
+%#endif
+ res = traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
} else {
multimap_type *p;
swig_type_info *descriptor = swig::type_info<multimap_type>();
@@ -68,7 +72,17 @@
%define %swig_multimap_methods(Type...)
%swig_map_common(Type);
+
+#if defined(SWIGPYTHON_BUILTIN)
+ %feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
+#endif
+
%extend {
+ // This will be called through the mp_ass_subscript slot to delete an entry.
+ void __setitem__(const key_type& key) {
+ self->erase(key);
+ }
+
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
self->insert(Type::value_type(key,x));
}
diff --git a/Lib/python/std_set.i b/Lib/python/std_set.i
index 53f97e475..0ef011998 100644
--- a/Lib/python/std_set.i
+++ b/Lib/python/std_set.i
@@ -36,7 +36,12 @@
%swig_sequence_iterator(set);
%swig_container_methods(set);
- %extend {
+#if defined(SWIGPYTHON_BUILTIN)
+ %feature("python:slot", "mp_subscript", functype="binaryfunc") __getitem__;
+ %feature("python:slot", "sq_contains", functype="objobjproc") __contains__;
+#endif
+
+ %extend {
void append(value_type x) {
self->insert(x);
}
@@ -56,8 +61,7 @@
void discard(value_type x) {
self->erase(x);
}
-
- };
+ }
%enddef
%include <std/std_set.i>
diff --git a/Lib/python/std_unordered_map.i b/Lib/python/std_unordered_map.i
index 894840c6c..042d5b671 100644
--- a/Lib/python/std_unordered_map.i
+++ b/Lib/python/std_unordered_map.i
@@ -1,161 +1,188 @@
/*
Unordered Maps
*/
+%include <std_map.i>
-%fragment("StdMapTraits","header",fragment="StdSequenceTraits")
+%fragment("StdUnorderedMapForwardIteratorTraits","header")
{
namespace swig {
- template <class SwigPySeq, class K, class T >
+ template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
+ struct SwigPyMapForwardIterator_T : SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper>
+ {
+ SwigPyMapForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
+ : SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
+ {
+ }
+ };
+
+
+ template<class OutIterator,
+ class FromOper = from_key_oper<typename OutIterator::value_type> >
+ struct SwigPyMapKeyForwardIterator_T : SwigPyMapForwardIterator_T<OutIterator, FromOper>
+ {
+ SwigPyMapKeyForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
+ : SwigPyMapForwardIterator_T<OutIterator, FromOper>(curr, first, last, seq)
+ {
+ }
+ };
+
+ template<typename OutIter>
+ inline SwigPyIterator*
+ make_output_key_forward_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
+ {
+ return new SwigPyMapKeyForwardIterator_T<OutIter>(current, begin, end, seq);
+ }
+
+ template<class OutIterator,
+ class FromOper = from_value_oper<typename OutIterator::value_type> >
+ struct SwigPyMapValueForwardIterator_T : SwigPyMapForwardIterator_T<OutIterator, FromOper>
+ {
+ SwigPyMapValueForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
+ : SwigPyMapForwardIterator_T<OutIterator, FromOper>(curr, first, last, seq)
+ {
+ }
+ };
+
+
+ template<typename OutIter>
+ inline SwigPyIterator*
+ make_output_value_forward_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
+ {
+ return new SwigPyMapValueForwardIterator_T<OutIter>(current, begin, end, seq);
+ }
+ }
+}
+
+%fragment("StdUnorderedMapTraits","header",fragment="StdMapCommonTraits",fragment="StdUnorderedMapForwardIteratorTraits")
+{
+ namespace swig {
+ template <class SwigPySeq, class K, class T, class Hash, class Compare, class Alloc>
inline void
- assign(const SwigPySeq& swigpyseq, std::unordered_map<K,T > *unordered_map) {
- typedef typename std::unordered_map<K,T>::value_type value_type;
+ assign(const SwigPySeq& swigpyseq, std::unordered_map<K,T,Hash,Compare,Alloc> *unordered_map) {
+ typedef typename std::unordered_map<K,T,Hash,Compare,Alloc>::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) {
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_reserve<std::unordered_map<K,T,Hash,Compare,Alloc> > {
+ static void reserve(std::unordered_map<K,T,Hash,Compare,Alloc> &seq, typename std::unordered_map<K,T,Hash,Compare,Alloc>::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;
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_asptr<std::unordered_map<K,T,Hash,Compare,Alloc> > {
+ typedef std::unordered_map<K,T,Hash,Compare,Alloc> unordered_map_type;
static int asptr(PyObject *obj, unordered_map_type **val) {
int res = SWIG_ERROR;
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
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!");
+ /* In Python 3.x the ".items()" method returns a dict_items object */
+ items = PySequence_Fast(items, ".items() didn't return a sequence!");
%#endif
- res = traits_asptr_stdseq<std::unordered_map<K,T>, std::pair<K, T> >::asptr(items, val);
+ res = traits_asptr_stdseq<std::unordered_map<K,T,Hash,Compare,Alloc>, 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;
}
+ SWIG_PYTHON_THREAD_END_BLOCK;
return res;
}
};
- template <class K, class T >
- struct traits_from<std::unordered_map<K,T> > {
- typedef std::unordered_map<K,T> unordered_map_type;
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_from<std::unordered_map<K,T,Hash,Compare,Alloc> > {
+ typedef std::unordered_map<K,T,Hash,Compare,Alloc> 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) {
+
+ static PyObject *asdict(const unordered_map_type& map) {
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+ size_type size = map.size();
+ 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");
+ SWIG_PYTHON_THREAD_END_BLOCK;
+ return NULL;
+ }
+ PyObject *obj = PyDict_New();
+ for (const_iterator i= map.begin(); i!= map.end(); ++i) {
+ swig::SwigVar_PyObject key = swig::from(i->first);
+ swig::SwigVar_PyObject val = swig::from(i->second);
+ PyDict_SetItem(obj, key, val);
+ }
+ SWIG_PYTHON_THREAD_END_BLOCK;
+ return obj;
+ }
+
+ static PyObject *from(const unordered_map_type& 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);
+ return SWIG_InternalNewPointerObj(new unordered_map_type(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;
+ return asdict(map);
}
}
};
+ }
+}
- 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)
- {
- }
- };
-
+%define %swig_unordered_map_common(Map...)
+ %swig_sequence_forward_iterator(Map);
+ %swig_container_methods(Map)
- 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)
- {
- }
- };
+#if defined(SWIGPYTHON_BUILTIN)
+ %feature("python:slot", "mp_length", functype="lenfunc") __len__;
+ %feature("python:slot", "mp_subscript", functype="binaryfunc") __getitem__;
+ %feature("python:slot", "tp_iter", functype="getiterfunc") key_iterator;
+ %feature("python:slot", "sq_contains", functype="objobjproc") __contains__;
- 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);
+ %extend {
+ %newobject iterkeys(PyObject **PYTHON_SELF);
+ swig::SwigPyIterator* iterkeys(PyObject **PYTHON_SELF) {
+ return swig::make_output_key_forward_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
}
- 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)
- {
- }
- };
-
+ %newobject itervalues(PyObject **PYTHON_SELF);
+ swig::SwigPyIterator* itervalues(PyObject **PYTHON_SELF) {
+ return swig::make_output_value_forward_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
+ }
- 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);
+ %newobject iteritems(PyObject **PYTHON_SELF);
+ swig::SwigPyIterator* iteritems(PyObject **PYTHON_SELF) {
+ return swig::make_output_forward_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
}
}
-}
-%define %swig_unordered_map_common(Map...)
- %swig_sequence_iterator(Map);
- %swig_container_methods(Map)
+#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()%}
+ }
+#endif
%extend {
- mapped_type __getitem__(const key_type& key) const throw (std::out_of_range) {
+ mapped_type const & __getitem__(const key_type& key) 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())
@@ -172,8 +199,8 @@
PyObject* keys() {
Map::size_type size = self->size();
Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1;
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
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;
@@ -183,14 +210,15 @@
for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
PyList_SET_ITEM(keyList, j, swig::from(i->first));
}
+ SWIG_PYTHON_THREAD_END_BLOCK;
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;
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
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;
@@ -200,14 +228,15 @@
for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
PyList_SET_ITEM(valList, j, swig::from(i->second));
}
+ SWIG_PYTHON_THREAD_END_BLOCK;
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;
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
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;
@@ -217,42 +246,50 @@
for (Py_ssize_t j = 0; j < pysize; ++i, ++j) {
PyList_SET_ITEM(itemList, j, swig::from(*i));
}
+ SWIG_PYTHON_THREAD_END_BLOCK;
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);
+ return swig::make_output_key_forward_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);
+ return swig::make_output_value_forward_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)
+
+#if defined(SWIGPYTHON_BUILTIN)
+ %feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
+#endif
+
%extend {
+ // This will be called through the mp_ass_subscript slot to delete an entry.
+ void __setitem__(const key_type& key) {
+ self->erase(key);
+ }
+
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
(*self)[key] = x;
}
+
+ PyObject* asdict() {
+ return swig::traits_from< Map >::asdict(*self);
+ }
}
+
+
%enddef
diff --git a/Lib/python/std_unordered_multimap.i b/Lib/python/std_unordered_multimap.i
index 2410aa52b..281140445 100644
--- a/Lib/python/std_unordered_multimap.i
+++ b/Lib/python/std_unordered_multimap.i
@@ -3,34 +3,38 @@
*/
%include <std_unordered_map.i>
-%fragment("StdUnorderedMultimapTraits","header",fragment="StdSequenceTraits")
+%fragment("StdUnorderedMultimapTraits","header",fragment="StdMapCommonTraits",fragment="StdUnorderedMapForwardIteratorTraits")
{
namespace swig {
- template <class SwigPySeq, class K, class T >
+ template <class SwigPySeq, class K, class T, class Hash, class Compare, class Alloc>
inline void
- assign(const SwigPySeq& swigpyseq, std::unordered_multimap<K,T > *unordered_multimap) {
- typedef typename std::unordered_multimap<K,T>::value_type value_type;
+ assign(const SwigPySeq& swigpyseq, std::unordered_multimap<K,T,Hash,Compare,Alloc> *unordered_multimap) {
+ typedef typename std::unordered_multimap<K,T,Hash,Compare,Alloc>::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) {
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_reserve<std::unordered_multimap<K,T,Hash,Compare,Alloc> > {
+ static void reserve(std::unordered_multimap<K,T,Hash,Compare,Alloc> &seq, typename std::unordered_multimap<K,T,Hash,Compare,Alloc>::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) {
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_asptr<std::unordered_multimap<K,T,Hash,Compare,Alloc> > {
+ typedef std::unordered_multimap<K,T,Hash,Compare,Alloc> unordered_multimap_type;
+ static int asptr(PyObject *obj, std::unordered_multimap<K,T,Hash,Compare,Alloc> **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);
+%#if PY_VERSION_HEX >= 0x03000000
+ /* In Python 3.x the ".items()" method returns a dict_items object */
+ items = PySequence_Fast(items, ".items() didn't return a sequence!");
+%#endif
+ res = traits_asptr_stdseq<std::unordered_multimap<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
} else {
unordered_multimap_type *p;
swig_type_info *descriptor = swig::type_info<unordered_multimap_type>();
@@ -41,16 +45,16 @@
}
};
- template <class K, class T >
- struct traits_from<std::unordered_multimap<K,T> > {
- typedef std::unordered_multimap<K,T> unordered_multimap_type;
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_from<std::unordered_multimap<K,T,Hash,Compare,Alloc> > {
+ typedef std::unordered_multimap<K,T,Hash,Compare,Alloc> 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);
+ return SWIG_InternalNewPointerObj(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;
@@ -74,8 +78,18 @@
}
%define %swig_unordered_multimap_methods(Type...)
- %swig_map_common(Type);
+ %swig_unordered_map_common(Type);
+
+#if defined(SWIGPYTHON_BUILTIN)
+ %feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
+#endif
+
%extend {
+ // This will be called through the mp_ass_subscript slot to delete an entry.
+ void __setitem__(const key_type& key) {
+ self->erase(key);
+ }
+
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
self->insert(Type::value_type(key,x));
}
diff --git a/Lib/python/std_unordered_multiset.i b/Lib/python/std_unordered_multiset.i
index 0d9f3d9c6..b0f3f096b 100644
--- a/Lib/python/std_unordered_multiset.i
+++ b/Lib/python/std_unordered_multiset.i
@@ -7,9 +7,9 @@
%fragment("StdUnorderedMultisetTraits","header",fragment="StdSequenceTraits")
%{
namespace swig {
- template <class SwigPySeq, class T>
+ template <class SwigPySeq, class Key, class Hash, class Compare, class Alloc>
inline void
- assign(const SwigPySeq& swigpyseq, std::unordered_multiset<T>* seq) {
+ assign(const SwigPySeq& swigpyseq, std::unordered_multiset<Key,Hash,Compare,Alloc>* 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();
@@ -18,30 +18,30 @@
}
}
- 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) {
+ template <class Key, class Hash, class Compare, class Alloc>
+ struct traits_reserve<std::unordered_multiset<Key,Hash,Compare,Alloc> > {
+ static void reserve(std::unordered_multiset<Key,Hash,Compare,Alloc> &seq, typename std::unordered_multiset<Key,Hash,Compare,Alloc>::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 Key, class Hash, class Compare, class Alloc>
+ struct traits_asptr<std::unordered_multiset<Key,Hash,Compare,Alloc> > {
+ static int asptr(PyObject *obj, std::unordered_multiset<Key,Hash,Compare,Alloc> **m) {
+ return traits_asptr_stdseq<std::unordered_multiset<Key,Hash,Compare,Alloc> >::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);
+ template <class Key, class Hash, class Compare, class Alloc>
+ struct traits_from<std::unordered_multiset<Key,Hash,Compare,Alloc> > {
+ static PyObject *from(const std::unordered_multiset<Key,Hash,Compare,Alloc>& vec) {
+ return traits_from_stdseq<std::unordered_multiset<Key,Hash,Compare,Alloc> >::from(vec);
}
};
}
%}
-#define %swig_unordered_multiset_methods(Set...) %swig_set_methods(Set)
+#define %swig_unordered_multiset_methods(Set...) %swig_unordered_set_methods(Set)
diff --git a/Lib/python/std_unordered_set.i b/Lib/python/std_unordered_set.i
index 855a28da5..79fca6c2f 100644
--- a/Lib/python/std_unordered_set.i
+++ b/Lib/python/std_unordered_set.i
@@ -5,9 +5,9 @@
%fragment("StdUnorderedSetTraits","header",fragment="StdSequenceTraits")
%{
namespace swig {
- template <class SwigPySeq, class T>
+ template <class SwigPySeq, class Key, class Hash, class Compare, class Alloc>
inline void
- assign(const SwigPySeq& swigpyseq, std::unordered_set<T>* seq) {
+ assign(const SwigPySeq& swigpyseq, std::unordered_set<Key,Hash,Compare,Alloc>* 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();
@@ -16,34 +16,40 @@
}
}
- 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) {
+ template <class Key, class Hash, class Compare, class Alloc>
+ struct traits_reserve<std::unordered_set<Key,Hash,Compare,Alloc> > {
+ static void reserve(std::unordered_set<Key,Hash,Compare,Alloc> &seq, typename std::unordered_set<Key,Hash,Compare,Alloc>::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 Key, class Hash, class Compare, class Alloc>
+ struct traits_asptr<std::unordered_set<Key,Hash,Compare,Alloc> > {
+ static int asptr(PyObject *obj, std::unordered_set<Key,Hash,Compare,Alloc> **s) {
+ return traits_asptr_stdseq<std::unordered_set<Key,Hash,Compare,Alloc> >::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);
+ template <class Key, class Hash, class Compare, class Alloc>
+ struct traits_from<std::unordered_set<Key,Hash,Compare,Alloc> > {
+ static PyObject *from(const std::unordered_set<Key,Hash,Compare,Alloc>& vec) {
+ return traits_from_stdseq<std::unordered_set<Key,Hash,Compare,Alloc> >::from(vec);
}
};
}
%}
%define %swig_unordered_set_methods(unordered_set...)
- %swig_sequence_iterator(unordered_set);
+ %swig_sequence_forward_iterator(unordered_set);
%swig_container_methods(unordered_set);
- %extend {
+#if defined(SWIGPYTHON_BUILTIN)
+ %feature("python:slot", "sq_contains", functype="objobjproc") __contains__;
+ %feature("python:slot", "mp_subscript", functype="binaryfunc") __getitem__;
+#endif
+
+
+ %extend {
void append(value_type x) {
self->insert(x);
}
@@ -55,8 +61,7 @@
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/Lib/python/stl.i b/Lib/python/stl.i
index a3566db5c..04f86014f 100644
--- a/Lib/python/stl.i
+++ b/Lib/python/stl.i
@@ -1,4 +1,7 @@
-/* initial STL definition. extended as needed in each language */
+/* -----------------------------------------------------------------------------
+ * stl.i
+ * ----------------------------------------------------------------------------- */
+
%include <std_common.i>
%include <std_string.i>
%include <std_vector.i>
diff --git a/Lib/r/boost_shared_ptr.i b/Lib/r/boost_shared_ptr.i
index 8ef8d2ef2..668bf4354 100644
--- a/Lib/r/boost_shared_ptr.i
+++ b/Lib/r/boost_shared_ptr.i
@@ -1,5 +1,11 @@
%include <shared_ptr.i>
+// Set SHARED_PTR_DISOWN to $disown if required, for example
+// #define SHARED_PTR_DISOWN $disown
+#if !defined(SHARED_PTR_DISOWN)
+#define SHARED_PTR_DISOWN 0
+#endif
+
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
@@ -8,7 +14,7 @@
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor wrapper customisation
-%feature("unref") TYPE
+%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;"
@@ -19,7 +25,7 @@
int newmem = 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);
@@ -29,7 +35,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 {
@@ -47,16 +54,35 @@
}
}
%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));
+}
+
+%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
+ int newmem = 0;
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (!swig_argp) {
+ %dirout_nullref("$type");
+ } else {
+ $result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
+ if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
+ }
}
// plain pointer
-// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
+// 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;
- res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ 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) {
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
@@ -67,8 +93,9 @@
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
}
}
+
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
}
@@ -95,12 +122,20 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE * %{
+#error "directorout typemap for plain pointer not implemented"
+%}
+
// plain reference
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
int newmem = 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) {
@@ -140,13 +175,21 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE & %{
+#error "directorout typemap for plain reference not implemented"
+%}
+
// plain pointer by reference
-// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
+// 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;
- res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ 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) {
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
@@ -158,7 +201,7 @@
$1 = &temp;
}
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -169,12 +212,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) TYPE *CONST& %{
+#error "directorout typemap for plain pointer by reference not implemented"
+%}
+
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
int newmem = 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, $&ltype));
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $&ltype);
@@ -199,12 +250,28 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
+ int newmem = 0;
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (swig_argp) {
+ $result = *(%reinterpret_cast(swig_argp, $&ltype));
+ if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $&ltype);
+ }
+}
+
// 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;
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 (argp) tempshared = *%reinterpret_cast(argp, $ltype);
@@ -226,12 +293,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
+#error "directorout typemap for shared_ptr ref not implemented"
+%}
+
// 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;
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 (argp) tempshared = *%reinterpret_cast(argp, $ltype);
@@ -242,7 +317,7 @@
}
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
if ($owner) delete $1;
}
@@ -254,12 +329,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
+#error "directorout typemap for pointer to shared_ptr not implemented"
+%}
+
// 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;
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);
@@ -267,7 +350,7 @@
$1 = &temp;
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -278,10 +361,18 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
+#error "directorout typemap for pointer ref to shared_ptr not implemented"
+%}
+
// 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, equivalent="TYPE *", noblock=1)
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
@@ -305,5 +396,6 @@
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
-%enddef
+
+%enddef
diff --git a/Lib/r/r.swg b/Lib/r/r.swg
index cf1cfc8f9..8cf8cdf53 100644
--- a/Lib/r/r.swg
+++ b/Lib/r/r.swg
@@ -3,9 +3,9 @@
%insert("header") "swiglabels.swg"
-%insert("header") "swigerrors.swg"
%insert("init") "swiginit.swg"
%insert("runtime") "swigrun.swg"
+%insert("runtime") "swigerrors.swg"
%insert("runtime") "rrun.swg"
%init %{
@@ -192,6 +192,11 @@ unsigned char *OUTPUT
free($1);
}
+%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
+%{ temp = ($*1_ltype)INTEGER($input)[0];
+ $1 = &temp; %}
+
+%typemap(out) const enum SWIGTYPE & %{ $result = Rf_ScalarInteger((int)*$1); %}
%typemap(memberin) char[] %{
if ($input) strcpy($1, $input);
diff --git a/Lib/r/rrun.swg b/Lib/r/rrun.swg
index 81f6461d2..c341321a1 100644
--- a/Lib/r/rrun.swg
+++ b/Lib/r/rrun.swg
@@ -213,17 +213,15 @@ R_SWIG_ReferenceFinalizer(SEXP el)
return;
}
-typedef enum {R_SWIG_EXTERNAL, R_SWIG_OWNER } R_SWIG_Owner;
-
SWIGRUNTIME SEXP
-SWIG_MakePtr(void *ptr, const char *typeName, R_SWIG_Owner owner)
+SWIG_MakePtr(void *ptr, const char *typeName, int flags)
{
SEXP external, r_obj;
Rf_protect(external = R_MakeExternalPtr(ptr, Rf_install(typeName), R_NilValue));
Rf_protect(r_obj = NEW_OBJECT(MAKE_CLASS((char *) typeName)));
- if(owner)
+ if (flags & SWIG_POINTER_OWN)
R_RegisterCFinalizer(external, R_SWIG_ReferenceFinalizer);
r_obj = SET_SLOT(r_obj, Rf_mkString((char *) "ref"), external);
@@ -262,7 +260,11 @@ AddOutputArgToReturn(int pos, SEXP value, const char *name, SEXP output)
/* Create a new pointer object */
SWIGRUNTIMEINLINE SEXP
SWIG_R_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
- SEXP rptr = R_MakeExternalPtr(ptr,
+ SEXP rptr;
+ if (!ptr) {
+ return R_NilValue;
+ }
+ rptr = R_MakeExternalPtr(ptr,
R_MakeExternalPtr(type, R_NilValue, R_NilValue), R_NilValue);
SET_S4_OBJECT(rptr);
return rptr;
@@ -276,7 +278,7 @@ SWIG_R_ConvertPtr(SEXP obj, void **ptr, swig_type_info *ty, int flags) {
if (!obj) return SWIG_ERROR;
if (obj == R_NilValue) {
if (ptr) *ptr = NULL;
- return SWIG_OK;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
vptr = R_ExternalPtrAddr(obj);
@@ -350,7 +352,7 @@ SWIG_R_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
return ptr ? RSwigPacked_New((void *) ptr, sz, type) : R_NilValue;
}
-/* Convert a packed value value */
+/* Convert a packed pointer value */
SWIGRUNTIME int
SWIG_R_ConvertPacked(SEXP obj, void *ptr, size_t sz, swig_type_info *ty) {
diff --git a/Lib/r/rstdcommon.swg b/Lib/r/rstdcommon.swg
index e6c873a07..5f41fd144 100644
--- a/Lib/r/rstdcommon.swg
+++ b/Lib/r/rstdcommon.swg
@@ -39,7 +39,7 @@ namespace swig {
template <class Type>
struct traits_asptr {
static int asptr(SWIG_Object obj, Type **val) {
- Type *p;
+ Type *p = 0;
swig_type_info *descriptor = type_info<Type>();
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res)) {
@@ -101,12 +101,11 @@ namespace swig {
template <class Type>
struct traits_as<Type, value_category> {
- static Type as(SWIG_Object obj, bool throw_error) {
+ static Type as(SWIG_Object obj) {
Type v;
int res = asval(obj, &v);
if (!obj || !SWIG_IsOK(res)) {
- if (throw_error)
- throw std::invalid_argument("bad type");
+ throw std::invalid_argument("bad type");
}
return v;
}
@@ -114,7 +113,7 @@ namespace swig {
template <class Type>
struct traits_as<Type, pointer_category> {
- static Type as(SWIG_Object obj, bool throw_error) {
+ static Type as(SWIG_Object obj) {
Type *v = 0;
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
if (SWIG_IsOK(res) && v) {
@@ -126,12 +125,7 @@ namespace swig {
return *v;
}
} else {
- // Uninitialized return value, no Type() constructor required.
- static Type *v_def = (Type*) malloc(sizeof(Type));
- if (throw_error)
throw std::invalid_argument("bad type");
- memset(v_def,0,sizeof(Type));
- return *v_def;
}
}
};
@@ -152,8 +146,8 @@ namespace swig {
};
template <class Type>
- inline Type as(SWIG_Object obj, bool te = false) {
- return traits_as<Type, typename traits<Type>::category>::as(obj, te);
+ inline Type as(SWIG_Object obj) {
+ return traits_as<Type, typename traits<Type>::category>::as(obj);
}
template <class Type>
diff --git a/Lib/r/rtype.swg b/Lib/r/rtype.swg
index 22639f2d0..bdc48c24e 100644
--- a/Lib/r/rtype.swg
+++ b/Lib/r/rtype.swg
@@ -16,6 +16,7 @@
%typemap("rtype") enum SWIGTYPE * "character";
%typemap("rtype") enum SWIGTYPE *const "character";
%typemap("rtype") enum SWIGTYPE & "character";
+%typemap("rtype") const enum SWIGTYPE & "character";
%typemap("rtype") enum SWIGTYPE && "character";
%typemap("rtype") SWIGTYPE * "$R_class";
%typemap("rtype") SWIGTYPE *const "$R_class";
@@ -86,9 +87,7 @@
%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"); %}
+ %{ $input = enumToInteger($input, "$*R_class"); %}
%typemap(scoercein) enum SWIGTYPE *
%{ $input = enumToInteger($input, "$R_class"); %}
%typemap(scoercein) enum SWIGTYPE *const
@@ -138,7 +137,7 @@ string &, std::string &
%{ $result = enumFromInteger($result, "$R_class"); %}
%typemap(scoerceout) enum SWIGTYPE &
- %{ $result = enumFromInteger($result, "$R_class"); %}
+ %{ $result = enumFromInteger($result, "$*R_class"); %}
%typemap(scoerceout) enum SWIGTYPE &&
%{ $result = enumFromInteger($result, "$R_class"); %}
@@ -152,19 +151,26 @@ string &, std::string &
%typemap(scoerceout) SEXP %{ %}
%typemap(scoerceout) SWIGTYPE
- %{ $result <- new("$&R_class", ref=$result); %}
+ %{ $result <- if (is.null($result)) $result
+ else new("$&R_class", ref=$result); %}
%typemap(scoerceout) SWIGTYPE &
- %{ $result <- new("$R_class", ref=$result) ; %}
+ %{ $result <- if (is.null($result)) $result
+ else new("$R_class", ref=$result); %}
+
%typemap(scoerceout) SWIGTYPE &&
- %{ $result <- new("$R_class", ref=$result) ; %}
+ %{ $result <- if (is.null($result)) $result
+ else new("$R_class", ref=$result); %}
%typemap(scoerceout) SWIGTYPE *
- %{ $result <- new("$R_class", ref=$result) ; %}
+ %{ $result <- if (is.null($result)) $result
+ else new("$R_class", ref=$result); %}
+
%typemap(scoerceout) SWIGTYPE *const
- %{ $result <- new("$R_class", ref=$result) ; %}
+ %{ $result <- if (is.null($result)) $result
+ else new("$R_class", ref=$result); %}
/* Override the SWIGTYPE * above. */
diff --git a/Lib/r/srun.swg b/Lib/r/srun.swg
index 2045ab94e..2e8eda112 100644
--- a/Lib/r/srun.swg
+++ b/Lib/r/srun.swg
@@ -7,7 +7,7 @@
# This could be provided as a separate run-time library but this
-# approach allows the code to to be included directly into the
+# approach allows the code to be included directly into the
# generated bindings and so removes the need to have and install an
# additional library. We may however end up with multiple copies of
# this and some confusion at run-time as to which class to use. This
@@ -73,7 +73,7 @@ function(name, .values, where = topenv(parent.frame()), suffix = "Value")
{
# Mirror the class definitions via the E analogous to .__C__
defName = paste(".__E__", name, sep = "")
- assign(defName, .values, envir = where)
+ delayedAssign(defName, .values, assign.env = where)
if(nchar(suffix))
name = paste(name, suffix, sep = "")
diff --git a/Lib/r/std_shared_ptr.i b/Lib/r/std_shared_ptr.i
new file mode 100644
index 000000000..df873679c
--- /dev/null
+++ b/Lib/r/std_shared_ptr.i
@@ -0,0 +1,2 @@
+#define SWIG_SHARED_PTR_NAMESPACE std
+%include <boost_shared_ptr.i>
diff --git a/Lib/r/stl.i b/Lib/r/stl.i
index 37e2ccbf4..91da6a2bf 100644
--- a/Lib/r/stl.i
+++ b/Lib/r/stl.i
@@ -1,10 +1,9 @@
-/* initial STL definition. extended as needed in each language */
-%include std_common.i
-%include std_vector.i
-%include std_pair.i
-%include std_string.i
-
-
-
-
+/* -----------------------------------------------------------------------------
+ * stl.i
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+%include <std_string.i>
+%include <std_vector.i>
+%include <std_pair.i>
diff --git a/Lib/ruby/boost_shared_ptr.i b/Lib/ruby/boost_shared_ptr.i
index 938074d81..9676bf9d8 100644
--- a/Lib/ruby/boost_shared_ptr.i
+++ b/Lib/ruby/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...)
@@ -62,6 +58,24 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
+ swig_ruby_owntype newmem = {0, 0};
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (!swig_argp) {
+ %dirout_nullref("$type");
+ } else {
+ $result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
+ if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
+ }
+}
+
// 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) {
@@ -80,7 +94,7 @@
}
}
-%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE * {
+%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
}
@@ -103,11 +117,19 @@
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
}
}
-%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE * {
+%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE * {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE * %{
+#error "directorout typemap for plain pointer not implemented"
+%}
+
// plain reference
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
swig_ruby_owntype newmem = {0, 0};
@@ -124,7 +146,7 @@
$1 = %const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
}
}
-%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE & {
+%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner);
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -148,11 +170,19 @@
$1 = *%const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
}
}
-%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE & {
+%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE & {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE & %{
+#error "directorout typemap for plain reference not implemented"
+%}
+
// 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) {
@@ -170,8 +200,8 @@
}
$1 = &temp;
}
-%typemap(out, fragment="SWIG_null_deleter_python") TYPE *CONST& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
+%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -182,6 +212,14 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) TYPE *CONST& %{
+#error "directorout typemap for plain pointer by reference not implemented"
+%}
+
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
swig_ruby_owntype newmem = {0, 0};
@@ -212,6 +250,22 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
+ swig_ruby_owntype newmem = {0, 0};
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (swig_argp) {
+ $result = *(%reinterpret_cast(swig_argp, $&ltype));
+ if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $&ltype);
+ }
+}
+
// shared_ptr by reference
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (void *argp, int res = 0, $*1_ltype tempshared) {
swig_ruby_owntype newmem = {0, 0};
@@ -239,6 +293,14 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
+#error "directorout typemap for shared_ptr ref not implemented"
+%}
+
// shared_ptr by pointer
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (void *argp, int res = 0, $*1_ltype tempshared) {
swig_ruby_owntype newmem = {0, 0};
@@ -255,7 +317,7 @@
}
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
if ($owner) delete $1;
}
@@ -267,6 +329,14 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
+#error "directorout typemap for pointer to shared_ptr not implemented"
+%}
+
// 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) {
swig_ruby_owntype newmem = {0, 0};
@@ -280,7 +350,7 @@
$1 = &temp;
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -291,10 +361,18 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
+#error "directorout typemap for pointer ref to shared_ptr not implemented"
+%}
+
// Typecheck typemaps
// 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, equivalent="TYPE *", noblock=1)
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
diff --git a/Lib/ruby/cni.i b/Lib/ruby/cni.i
deleted file mode 100644
index 10a1403a2..000000000
--- a/Lib/ruby/cni.i
+++ /dev/null
@@ -1,2 +0,0 @@
-%include <gcj/cni.i>
-%include <jstring.i>
diff --git a/Lib/ruby/director.swg b/Lib/ruby/director.swg
index c6c53a343..9395b8183 100644
--- a/Lib/ruby/director.swg
+++ b/Lib/ruby/director.swg
@@ -153,43 +153,6 @@ namespace Swig {
}
};
- /* 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.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 << "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:
- std::unexpected_handler old;
- UnknownExceptionHandler(std::unexpected_handler nh = handler) {
- old = std::set_unexpected(nh);
- }
-
- ~UnknownExceptionHandler() {
- std::set_unexpected(old);
- }
-#endif
- };
-
-
/* Type mismatch in the return value from a Ruby method call */
class DirectorTypeMismatchException : public DirectorException {
public:
diff --git a/Lib/ruby/jstring.i b/Lib/ruby/jstring.i
deleted file mode 100644
index 17efa978d..000000000
--- a/Lib/ruby/jstring.i
+++ /dev/null
@@ -1,44 +0,0 @@
-%include <typemaps/valtypes.swg>
-
-%fragment(SWIG_AsVal_frag(jstring),"header") {
-SWIGINTERN int
-SWIG_AsVal(jstring)(VALUE obj, jstring *val)
-{
- if (NIL_P(obj)){
- if (val) *val = 0;
- return SWIG_OK;
- }
- if (TYPE(obj) == T_STRING) {
- if (val) {
- char *cstr = rb_string_value_ptr(&(obj));
- jsize len = RSTRING_LEN(obj);
- *val = JvNewStringLatin1(cstr, len);
- }
- return SWIG_NEWOBJ;
- }
- return SWIG_TypeError;
-}
-}
-
-%fragment(SWIG_From_frag(jstring),"header") {
-SWIGINTERNINLINE VALUE
-SWIG_From(jstring)(jstring val)
-{
- if (!val) {
- return Qnil;
- } else {
- jint len = JvGetStringUTFLength(val);
- char buf[len];
- JvGetStringUTFRegion(val, 0, len, buf);
- return rb_str_new(buf,len);
- }
-}
-}
-
-%typemaps_asvalfrom(%checkcode(STRING),
- %arg(SWIG_AsVal(jstring)),
- %arg(SWIG_From(jstring)),
- %arg(SWIG_AsVal_frag(jstring)),
- %arg(SWIG_From_frag(jstring)),
- java::lang::String *);
-
diff --git a/Lib/ruby/ruby.swg b/Lib/ruby/ruby.swg
index efa8ec2f7..d1335974e 100644
--- a/Lib/ruby/ruby.swg
+++ b/Lib/ruby/ruby.swg
@@ -14,7 +14,7 @@
/* Constants created by %constant or #define are UPPER_CASE */
%rename("%(uppercase)s", %$isconstant) "";
-/* SWIG only considers static class members with inline intializers
+/* SWIG only considers static class members with inline initializers
to be constants. For examples of what is and isn't considered
a constant by SWIG see naming.i in the Ruby test suite. */
%rename("%(uppercase)s", %$ismember, %$isvariable,%$isimmutable,%$isstatic,%$hasvalue,%$hasconsttype) "";
diff --git a/Lib/ruby/rubycontainer.swg b/Lib/ruby/rubycontainer.swg
index 4f1c6f55e..9fa205bf5 100644
--- a/Lib/ruby/rubycontainer.swg
+++ b/Lib/ruby/rubycontainer.swg
@@ -183,8 +183,8 @@ namespace swig
{
VALUE item = rb_ary_entry(_seq, _index );
try {
- return swig::as<T>(item, true);
- } catch (std::exception& e) {
+ return swig::as<T>(item);
+ } catch (const std::invalid_argument& e) {
char msg[1024];
sprintf(msg, "in sequence element %d ", _index);
VALUE lastErr = rb_gv_get("$!");
@@ -395,19 +395,13 @@ namespace swig
return const_reference(_seq, n);
}
- bool check(bool set_err = false) const
+ bool check() const
{
int s = (int) size();
for (int i = 0; i < s; ++i) {
VALUE item = rb_ary_entry(_seq, i );
- if (!swig::check<value_type>(item)) {
- if (set_err) {
- char msg[1024];
- sprintf(msg, "in sequence element %d", i);
- SWIG_Error(SWIG_RuntimeError, msg);
- }
+ if (!swig::check<value_type>(item))
return false;
- }
}
return true;
}
@@ -926,7 +920,7 @@ namespace swig
VALUE elem = argv[0];
int idx = 0;
try {
- Sequence::value_type val = swig::as<Sequence::value_type>( elem, true );
+ Sequence::value_type val = swig::as<Sequence::value_type>( elem );
if ( i >= len ) {
$self->resize(i-1, val);
return $self;
@@ -943,7 +937,7 @@ namespace swig
}
}
- catch( std::invalid_argument )
+ catch(const std::invalid_argument &)
{
rb_raise( rb_eArgError, "%s",
Ruby_Format_TypeError( "",
@@ -967,10 +961,10 @@ namespace swig
Sequence::iterator start = $self->begin();
VALUE elem = argv[idx];
try {
- Sequence::value_type val = swig::as<Sequence::value_type>( elem, true );
+ Sequence::value_type val = swig::as<Sequence::value_type>( elem );
$self->insert( start, val );
}
- catch( std::invalid_argument )
+ catch(const std::invalid_argument &)
{
rb_raise( rb_eArgError, "%s",
Ruby_Format_TypeError( "",
diff --git a/Lib/ruby/rubycontainer_extended.swg b/Lib/ruby/rubycontainer_extended.swg
index 7514ba2c8..663dddb8c 100644
--- a/Lib/ruby/rubycontainer_extended.swg
+++ b/Lib/ruby/rubycontainer_extended.swg
@@ -69,7 +69,7 @@
*i = swig::as< Type >( r );
}
}
- catch ( const std::invalid_argument& )
+ catch (const std::invalid_argument&)
{
rb_raise(rb_eTypeError,
"Yield block did not return a valid element for " "Container");
diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg
index 9960087c6..90f07cf68 100644
--- a/Lib/ruby/rubyhead.swg
+++ b/Lib/ruby/rubyhead.swg
@@ -91,6 +91,9 @@
#ifndef RSTRUCT_PTR
# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
#endif
+#ifndef RTYPEDDATA_P
+# define RTYPEDDATA_P(x) (TYPE(x) != T_DATA)
+#endif
diff --git a/Lib/ruby/rubyiterators.swg b/Lib/ruby/rubyiterators.swg
index 88f1e7c8c..89fea4527 100644
--- a/Lib/ruby/rubyiterators.swg
+++ b/Lib/ruby/rubyiterators.swg
@@ -3,7 +3,7 @@
*
* Implement a C++ 'output' iterator for Ruby.
*
- * Users can derive form the Iterator to implemet their
+ * Users can derive form the Iterator to implement their
* own iterators. As an example (real one since we use it for STL/STD
* containers), the template Iterator_T does the
* implementation for generic C++ iterators.
diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg
index 249494ab0..4b2ffe4b4 100644
--- a/Lib/ruby/rubyrun.swg
+++ b/Lib/ruby/rubyrun.swg
@@ -171,10 +171,11 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
swig_class *sklass;
VALUE klass;
VALUE obj;
-
+
if (!ptr)
return Qnil;
-
+
+ assert(type);
if (type->clientdata) {
sklass = (swig_class *) type->clientdata;
@@ -182,7 +183,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
track = sklass->trackObjects;
if (track) {
obj = SWIG_RubyInstanceFor(ptr);
-
+
/* Check the object's type and make sure it has the correct type.
It might not in cases where methods do things like
downcast methods. */
@@ -214,7 +215,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
obj = Data_Wrap_Struct(klass, 0, 0, ptr);
}
rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
-
+
return obj;
}
@@ -246,7 +247,7 @@ typedef struct {
SWIGRUNTIME swig_ruby_owntype
SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) {
swig_ruby_owntype oldown = {0, 0};
- if (obj) {
+ if (TYPE(obj) == T_DATA && !RTYPEDDATA_P(obj)) {
oldown.datafree = RDATA(obj)->dfree;
RDATA(obj)->dfree = own.datafree;
}
@@ -265,9 +266,9 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
if (NIL_P(obj)) {
if (ptr)
*ptr = 0;
- return SWIG_OK;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
} else {
- if (TYPE(obj) != T_DATA) {
+ if (TYPE(obj) != T_DATA || (TYPE(obj) == T_DATA && RTYPEDDATA_P(obj))) {
return SWIG_ERROR;
}
Data_Get_Struct(obj, void, vptr);
@@ -362,7 +363,7 @@ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
return rb_str_new2(result);
}
-/* Convert a packed value value */
+/* Convert a packed pointer value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
swig_cast_info *tc;
diff --git a/Lib/ruby/rubystdcommon.swg b/Lib/ruby/rubystdcommon.swg
index f72745b56..99dd7f81e 100644
--- a/Lib/ruby/rubystdcommon.swg
+++ b/Lib/ruby/rubystdcommon.swg
@@ -3,8 +3,9 @@
* The Ruby classes, for C++
* ------------------------------------------------------------ */
%include <rubyclasses.swg>
+%include <rubystdcommon_forward.swg>
-%fragment("StdTraits","header",fragment="StdTraitsCommon")
+%fragment("StdTraits","header",fragment="StdTraitsCommon",fragment="StdTraitsForwardDeclaration")
{
namespace swig {
@@ -52,7 +53,7 @@ namespace swig {
template <class Type>
struct traits_asptr {
static int asptr(VALUE obj, Type **val) {
- Type *p;
+ Type *p = 0;
swig_type_info *descriptor = type_info<Type>();
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res)) {
@@ -114,15 +115,15 @@ namespace swig {
template <class Type>
struct traits_as<Type, value_category> {
- static Type as(VALUE obj, bool throw_error) {
+ static Type as(VALUE obj) {
Type v;
int res = asval(obj, &v);
- if (!obj || !SWIG_IsOK(res)) {
- if (throw_error) throw std::invalid_argument("bad type");
+ if (!SWIG_IsOK(res)) {
VALUE lastErr = rb_gv_get("$!");
if (lastErr == Qnil) {
%type_error(swig::type_name<Type>());
}
+ throw std::invalid_argument("bad type");
}
return v;
}
@@ -130,9 +131,9 @@ namespace swig {
template <class Type>
struct traits_as<Type, pointer_category> {
- static Type as(VALUE obj, bool throw_error) {
+ static Type as(VALUE obj) {
Type *v = 0;
- int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
+ int res = traits_asptr<Type>::asptr(obj, &v);
if (SWIG_IsOK(res) && v) {
if (SWIG_IsNewObj(res)) {
Type r(*v);
@@ -142,46 +143,41 @@ namespace swig {
return *v;
}
} else {
- // Uninitialized return value, no Type() constructor required.
- if (throw_error) throw std::invalid_argument("bad type");
VALUE lastErr = rb_gv_get("$!");
if (lastErr == Qnil) {
%type_error(swig::type_name<Type>());
}
- static Type *v_def = (Type*) malloc(sizeof(Type));
- memset(v_def,0,sizeof(Type));
- return *v_def;
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
struct traits_as<Type*, pointer_category> {
- static Type* as(VALUE obj, bool throw_error) {
+ static Type* as(VALUE obj) {
Type *v = 0;
- int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
+ int res = traits_asptr<Type>::asptr(obj, &v);
if (SWIG_IsOK(res)) {
return v;
} else {
- if (throw_error) throw std::invalid_argument("bad type");
VALUE lastErr = rb_gv_get("$!");
if (lastErr == Qnil) {
%type_error(swig::type_name<Type>());
}
- return 0;
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
- inline Type as(VALUE obj, bool te = false) {
- return traits_as< Type, typename traits< Type >::category >::as(obj, te);
+ inline Type as(VALUE obj) {
+ return traits_as< Type, typename traits< Type >::category >::as(obj);
}
template <class Type>
struct traits_check<Type, value_category> {
static bool check(VALUE obj) {
- int res = obj ? asval(obj, (Type *)(0)) : SWIG_ERROR;
+ int res = asval(obj, (Type *)(0));
return SWIG_IsOK(res) ? true : false;
}
};
@@ -189,7 +185,7 @@ namespace swig {
template <class Type>
struct traits_check<Type, pointer_category> {
static bool check(VALUE obj) {
- int res = obj ? asptr(obj, (Type **)(0)) : SWIG_ERROR;
+ int res = asptr(obj, (Type **)(0));
return SWIG_IsOK(res) ? true : false;
}
};
diff --git a/Lib/ruby/rubystdcommon_forward.swg b/Lib/ruby/rubystdcommon_forward.swg
new file mode 100644
index 000000000..4120b38e4
--- /dev/null
+++ b/Lib/ruby/rubystdcommon_forward.swg
@@ -0,0 +1,15 @@
+%fragment("StdTraitsForwardDeclaration","header")
+{
+namespace swig {
+ template <class Type> struct traits_asptr;
+ template <class Type> struct traits_asval;
+ struct pointer_category;
+ template <class Type, class Category> struct traits_as;
+ template <class Type> struct traits_from;
+ template <class Type> struct traits_from_ptr;
+ template <class Type> struct noconst_traits;
+ template <class Type> swig_type_info* type_info();
+ template <class Type> const char* type_name();
+ template <class Type> VALUE from(const Type& val);
+}
+}
diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg
index 8f9f01be8..b9fb249d8 100644
--- a/Lib/ruby/rubytracking.swg
+++ b/Lib/ruby/rubytracking.swg
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
* rubytracking.swg
*
- * This file contains support for tracking mappings from
+ * 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.
@@ -28,7 +28,7 @@ extern "C" {
#endif
/* Global hash table to store Trackings from C/C++
- structs to Ruby Objects.
+ structs to Ruby Objects.
*/
static st_table* swig_ruby_trackings = NULL;
@@ -42,7 +42,7 @@ 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
+ /* 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
@@ -101,13 +101,14 @@ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
/* 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 */
+ 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();
+ // object might have the T_ZOMBIE type, but that's just
+ // because the GC has flagged it as such for a deferred
+ // destruction. Until then, it's still a T_DATA object.
DATA_PTR(object) = 0;
}
}
diff --git a/Lib/ruby/rubyuserdir.swg b/Lib/ruby/rubyuserdir.swg
index 638433c2d..1689c7f0d 100644
--- a/Lib/ruby/rubyuserdir.swg
+++ b/Lib/ruby/rubyuserdir.swg
@@ -11,7 +11,7 @@
/* ------------------------------------------------------------------------- */
/*
- Enable keywords paramaters
+ Enable keywords parameters
*/
#define %kwargs %feature("kwargs")
diff --git a/Lib/ruby/rubywstrings.swg b/Lib/ruby/rubywstrings.swg
index b6dd937a5..7da6f4bf2 100644
--- a/Lib/ruby/rubywstrings.swg
+++ b/Lib/ruby/rubywstrings.swg
@@ -1,71 +1,57 @@
/* -----------------------------------------------------------------------------
* rubywstrings.swg
*
- * Currently, Ruby does not support Unicode or WChar properly, so these
- * are still treated as char arrays for now.
- * There are other libraries available that add support to this in
- * ruby including WString, FXString, etc.
- * ----------------------------------------------------------------------------- */
-
-/* ------------------------------------------------------------
* utility methods for wchar_t strings
* ------------------------------------------------------------ */
-%fragment("SWIG_AsWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_AsCharPtrAndSize") {
+%fragment("SWIG_AsWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_AsCharPtrAndSize",fragment="SWIG_ruby_wstring_encoding_init") {
SWIGINTERN int
SWIG_AsWCharPtrAndSize(VALUE obj, wchar_t **cptr, size_t *psize, int *alloc)
{
- return SWIG_AsCharPtrAndSize( obj, (char**)cptr, psize, alloc);
-// VALUE tmp = 0;
-// bool ok = false;
-// if ( TYPE(obj) == T_STRING ) {
-// if (cptr) {
-// obj = tmp = SWIG_Unicode_FromObject(obj);
-// ok = true;
-// }
-// }
-// if (ok) {
-// Py_ssize_t len = PyUnicode_GetSize(obj);
-// rb_notimplement();
-// if (cptr) {
-// *cptr = %new_array(len + 1, wchar_t);
-// SWIG_Unicode_AsWideChar((PyUnicodeObject *)obj, *cptr, len);
-// (*cptr)[len] = 0;
-// }
-// if (psize) *psize = (size_t) len + 1;
-// if (alloc) *alloc = cptr ? SWIG_NEWOBJ : 0;
-// return SWIG_OK;
-// } else {
-// swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor();
-// if (pwchar_descriptor) {
-// void * vptr = 0;
-// if (SWIG_ConvertPtr(obj, &vptr, pwchar_descriptor, 0) == SWIG_OK) {
-// if (cptr) *cptr = (wchar_t *)vptr;
-// if (psize) *psize = vptr ? (wcslen((wchar_t *)vptr) + 1) : 0;
-// return SWIG_OK;
-// }
-// }
-// }
-// return SWIG_TypeError;
+ rb_encoding* wstr_enc = swig_ruby_wstring_encoding;
+
+ if (TYPE(obj) == T_STRING) {
+ VALUE rstr = rb_str_conv_enc(obj, rb_enc_get(obj), wstr_enc);
+ wchar_t* cstr = (wchar_t*) StringValuePtr(rstr);
+ size_t size = RSTRING_LEN(rstr) / sizeof(wchar_t) + 1;
+
+ if ( RSTRING_LEN(rstr) % sizeof(wchar_t) != 0 ) {
+ rb_raise(rb_eRuntimeError,
+ "The length of the byte sequence of converted string is not a multiplier of sizeof(wchar_t). Invalid byte sequence is given. Or invalid SWIG_RUBY_WSTRING_ENCODING is given when compiling this binding.");
+ }
+ if (cptr && alloc) {
+ *alloc = SWIG_NEWOBJ;
+ *cptr = %new_array(size, wchar_t);
+ memmove(*cptr, cstr, RSTRING_LEN(rstr));
+ }
+ if (psize) *psize = size;
+
+ return SWIG_OK;
+ } else {
+ return SWIG_TypeError;
+ }
}
}
-%fragment("SWIG_FromWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_FromCharPtrAndSize") {
+%fragment("SWIG_FromWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_FromCharPtrAndSize",fragment="SWIG_ruby_wstring_encoding_init") {
SWIGINTERNINLINE VALUE
SWIG_FromWCharPtrAndSize(const wchar_t * carray, size_t size)
{
- return SWIG_FromCharPtrAndSize( (const char*)carray, size);
-// if (carray) {
-// if (size > INT_MAX) {
-// swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor();
-// return pwchar_descriptor ?
-// SWIG_NewPointerObj(%const_cast(carray,wchar_t *), pwchar_descriptor, 0) : Qnil;
-// } else {
-// return SWIG_Unicode_FromWideChar(carray, %numeric_cast(size,int));
-// }
-// } else {
-// return Qnil;
-// }
+ rb_encoding* wstr_enc = swig_ruby_wstring_encoding;
+ rb_encoding* rb_enc = swig_ruby_internal_encoding;
+
+ if (carray && size <= LONG_MAX/sizeof(wchar_t)) {
+ VALUE rstr = rb_str_new( (const char*)carray, %numeric_cast(size*sizeof(wchar_t),long) );
+ rb_encoding* new_enc = rb_default_internal_encoding();
+
+ rb_enc_associate(rstr, wstr_enc);
+ if ( !new_enc ) {
+ new_enc = rb_enc;
+ }
+ return rb_str_conv_enc(rstr, wstr_enc, new_enc);
+ } else {
+ return Qnil;
+ }
}
}
diff --git a/Lib/ruby/std_basic_string.i b/Lib/ruby/std_basic_string.i
index 1351177fc..ba13ba764 100644
--- a/Lib/ruby/std_basic_string.i
+++ b/Lib/ruby/std_basic_string.i
@@ -13,40 +13,37 @@
%fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
fragment="SWIG_AsCharPtrAndSize") {
SWIGINTERN int
-SWIG_AsPtr(std::basic_string<char>)(VALUE obj, std::string **val)
-{
- static swig_type_info* string_info =
- SWIG_TypeQuery("std::basic_string<char> *");
- std::string *vptr;
- if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
+SWIG_AsPtr(std::basic_string<char>)(VALUE obj, std::string **val) {
+ static swig_type_info* string_info = SWIG_TypeQuery("std::basic_string<char> *");
+ std::string *vptr;
+ if (SWIG_IsOK(SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0))) {
if (val) *val = vptr;
return SWIG_OLDOBJ;
} else {
char* buf = 0 ; size_t size = 0; int alloc = 0;
- if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
+ if (SWIG_IsOK(SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc))) {
if (buf) {
if (val) *val = new std::string(buf, size - 1);
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
return SWIG_NEWOBJ;
}
}
- if (val) {
- rb_raise( rb_eTypeError, "a string is expected");
- }
- return 0;
+ return SWIG_ERROR;
}
-}
+}
}
%fragment(SWIG_From_frag(std::basic_string<char>),"header",
fragment="SWIG_FromCharPtrAndSize") {
SWIGINTERNINLINE VALUE
- SWIG_From(std::basic_string<char>)(const std::string& s)
- {
+ SWIG_From(std::basic_string<char>)(const std::string& s) {
return SWIG_FromCharPtrAndSize(s.data(), s.size());
}
}
+%ignore std::basic_string::operator!=;
+%ignore std::basic_string::operator+=;
+
%include <std/std_basic_string.i>
%typemaps_asptrfromn(%checkcode(STRING), std::basic_string<char>);
@@ -55,39 +52,37 @@ SWIGINTERNINLINE VALUE
#if !defined(SWIG_STD_WSTRING)
+%traits_swigtype(std::basic_string<wchar_t>);
+%fragment(SWIG_Traits_frag(std::basic_string<wchar_t>));
+
+
%fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
fragment="SWIG_AsWCharPtrAndSize") {
SWIGINTERN int
- SWIG_AsPtr(std::basic_string<wchar_t>)(VALUE obj, std::wstring **val)
- {
- static swig_type_info* string_info =
- SWIG_TypeQuery("std::basic_string<wchar_t> *");
- std::wstring *vptr;
- if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
- if (val) *val = vptr;
- return SWIG_OLDOBJ;
- } else {
- wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
- if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
- if (buf) {
- if (val) *val = new std::wstring(buf, size - 1);
- if (alloc == SWIG_NEWOBJ) %delete_array(buf);
- return SWIG_NEWOBJ;
- }
- }
- if (val) {
- rb_raise( rb_eTypeError, "a string is expected");
+SWIG_AsPtr(std::basic_string<wchar_t>)(VALUE obj, std::wstring **val) {
+ static swig_type_info* string_info = SWIG_TypeQuery("std::basic_string<wchar_t> *");
+ std::wstring *vptr;
+ if (SWIG_IsOK(SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0))) {
+ if (val) *val = vptr;
+ return SWIG_OLDOBJ;
+ } else {
+ wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
+ if (SWIG_IsOK(SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc))) {
+ if (buf) {
+ if (val) *val = new std::wstring(buf, size - 1);
+ if (alloc == SWIG_NEWOBJ) %delete_array(buf);
+ return SWIG_NEWOBJ;
}
- return 0;
}
+ return SWIG_ERROR;
}
}
+}
%fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
fragment="SWIG_FromWCharPtrAndSize") {
SWIGINTERNINLINE VALUE
- SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
- {
+ SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s) {
return SWIG_FromWCharPtrAndSize(s.data(), s.size());
}
}
diff --git a/Lib/ruby/std_complex.i b/Lib/ruby/std_complex.i
index dacbea2bb..ef4e8a104 100644
--- a/Lib/ruby/std_complex.i
+++ b/Lib/ruby/std_complex.i
@@ -8,6 +8,13 @@
#include <complex>
%}
+namespace std {
+ %naturalvar complex;
+ template<typename T> class complex;
+ %template() complex<double>;
+ %template() complex<float>;
+}
+
/* defining the complex as/from converters */
%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
diff --git a/Lib/ruby/std_deque.i b/Lib/ruby/std_deque.i
index 38048aff7..b70f34ee3 100644
--- a/Lib/ruby/std_deque.i
+++ b/Lib/ruby/std_deque.i
@@ -14,7 +14,7 @@
template <class T>
struct traits_from<std::deque<T> > {
- static VALUE from(const std::deque<T> & vec) {
+ static VALUE from(const std::deque<T>& vec) {
return traits_from_stdseq<std::deque<T> >::from(vec);
}
};
diff --git a/Lib/ruby/std_list.i b/Lib/ruby/std_list.i
index 8d4284bbc..b0b4928e4 100644
--- a/Lib/ruby/std_list.i
+++ b/Lib/ruby/std_list.i
@@ -14,7 +14,7 @@
template <class T>
struct traits_from<std::list<T> > {
- static VALUE from(const std::list<T> & vec) {
+ static VALUE from(const std::list<T>& vec) {
return traits_from_stdseq<std::list<T> >::from(vec);
}
};
@@ -27,6 +27,7 @@
#define %swig_list_methods(Type...) %swig_sequence_methods(Type)
#define %swig_list_methods_val(Type...) %swig_sequence_methods_val(Type);
+%mixin std::list "Enumerable";
%rename("delete") std::list::__delete__;
%rename("reject!") std::list::reject_bang;
diff --git a/Lib/ruby/std_multimap.i b/Lib/ruby/std_multimap.i
index 3e06ee12c..762a87653 100644
--- a/Lib/ruby/std_multimap.i
+++ b/Lib/ruby/std_multimap.i
@@ -90,12 +90,11 @@
%extend {
VALUE __getitem__(const key_type& key) const {
- MultiMap::const_iterator i = self->find(key);
- if ( i != self->end() )
+ std::pair<MultiMap::const_iterator, MultiMap::const_iterator > r = $self->equal_range(key);
+ if ( r.first != r.second )
{
- MultiMap::const_iterator e = $self->upper_bound(key);
VALUE ary = rb_ary_new();
- for ( ; i != e; ++i )
+ for (MultiMap::const_iterator i = r.first ; i != r.second; ++i )
{
rb_ary_push( ary, swig::from<MultiMap::mapped_type>( i->second ) );
}
diff --git a/Lib/ruby/std_multiset.i b/Lib/ruby/std_multiset.i
index 87a7b292a..252ae10d2 100644
--- a/Lib/ruby/std_multiset.i
+++ b/Lib/ruby/std_multiset.i
@@ -36,7 +36,7 @@
#define %swig_multiset_methods(Set...) %swig_set_methods(Set)
-
+%mixin std::multiset "Enumerable";
%rename("delete") std::multiset::__delete__;
%rename("reject!") std::multiset::reject_bang;
diff --git a/Lib/ruby/std_queue.i b/Lib/ruby/std_queue.i
index a12936775..2a16d9cfd 100644
--- a/Lib/ruby/std_queue.i
+++ b/Lib/ruby/std_queue.i
@@ -14,7 +14,7 @@
template <class T>
struct traits_from<std::queue<T> > {
- static VALUE from(const std::queue<T> & vec) {
+ static VALUE from(const std::queue<T>& vec) {
return traits_from_stdseq<std::queue<T> >::from(vec);
}
};
diff --git a/Lib/ruby/std_shared_ptr.i b/Lib/ruby/std_shared_ptr.i
index df873679c..dee35ec03 100644
--- a/Lib/ruby/std_shared_ptr.i
+++ b/Lib/ruby/std_shared_ptr.i
@@ -1,2 +1,141 @@
#define SWIG_SHARED_PTR_NAMESPACE std
%include <boost_shared_ptr.i>
+%include <rubystdcommon_forward.swg>
+
+
+%fragment("StdSharedPtrTraits","header",fragment="StdTraitsForwardDeclaration",fragment="<memory>")
+{
+namespace swig {
+ /*
+ Template specialization for functions defined in rubystdcommon.swg. Special handling for shared_ptr
+ is required as, shared_ptr<T> * is used rather than the usual T *, see shared_ptr.i.
+ */
+ template <class Type>
+ struct traits_asptr<std::shared_ptr<Type> > {
+ static int asptr(VALUE obj, std::shared_ptr<Type> **val) {
+ std::shared_ptr<Type> *p = 0;
+ swig_type_info *descriptor = type_info<std::shared_ptr<Type> >();
+ swig_ruby_owntype newmem = {0, 0};
+ int res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR;
+ if (SWIG_IsOK(res)) {
+ if (val) {
+ if (*val) {
+ **val = p ? *p : std::shared_ptr<Type>();
+ } else {
+ *val = p;
+ if (newmem.own & SWIG_CAST_NEW_MEMORY) {
+ // Upcast for pointers to shared_ptr in this generic framework has not been implemented
+ res = SWIG_ERROR;
+ }
+ }
+ }
+ if (newmem.own & SWIG_CAST_NEW_MEMORY)
+ delete p;
+ }
+ return res;
+ }
+ };
+
+ template <class Type>
+ struct traits_asval<std::shared_ptr<Type> > {
+ static int asval(VALUE obj, std::shared_ptr<Type> *val) {
+ if (val) {
+ std::shared_ptr<Type> ret;
+ std::shared_ptr<Type> *p = &ret;
+ int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &p);
+ if (!SWIG_IsOK(res))
+ return res;
+ *val = ret;
+ return SWIG_OK;
+ } else {
+ return traits_asptr<std::shared_ptr<Type> >::asptr(obj, (std::shared_ptr<Type> **)(0));
+ }
+ }
+ };
+
+ template <class Type>
+ struct traits_asval<std::shared_ptr<Type> *> {
+ static int asval(VALUE obj, std::shared_ptr<Type> **val) {
+ if (val) {
+ typedef typename noconst_traits<std::shared_ptr<Type> >::noconst_type noconst_type;
+ if (*val) {
+ noconst_type ret;
+ noconst_type *p = &ret;
+ int res = traits_asptr<noconst_type>::asptr(obj, &p);
+ if (SWIG_IsOK(res))
+ **(const_cast<noconst_type**>(val)) = ret;
+ return res;
+ } else {
+ noconst_type *p = 0;
+ int res = traits_asptr<noconst_type>::asptr(obj, &p);
+ if (SWIG_IsOK(res))
+ *val = p;
+ return res;
+ }
+ } else {
+ return traits_asptr<std::shared_ptr<Type> >::asptr(obj, (std::shared_ptr<Type> **)(0));
+ }
+ }
+ };
+
+ template <class Type>
+ struct traits_as<std::shared_ptr<Type>, pointer_category> {
+ static std::shared_ptr<Type> as(VALUE obj) {
+ std::shared_ptr<Type> ret;
+ std::shared_ptr<Type> *v = &ret;
+ int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &v);
+ if (SWIG_IsOK(res)) {
+ return ret;
+ } else {
+
+ VALUE lastErr = rb_gv_get("$!");
+ if (lastErr == Qnil)
+ SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> >());
+ throw std::invalid_argument("bad type");
+ }
+ }
+ };
+
+ template <class Type>
+ struct traits_as<std::shared_ptr<Type> *, pointer_category> {
+ static std::shared_ptr<Type> * as(VALUE obj) {
+ std::shared_ptr<Type> *p = 0;
+ int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &p);
+ if (SWIG_IsOK(res)) {
+ return p;
+ } else {
+
+ VALUE lastErr = rb_gv_get("$!");
+ if (lastErr == Qnil)
+ SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> *>());
+ throw std::invalid_argument("bad type");
+ }
+ }
+ };
+
+ template <class Type>
+ struct traits_from_ptr<std::shared_ptr<Type> > {
+ static VALUE from(std::shared_ptr<Type> *val, int owner = 0) {
+ if (val && *val) {
+ return SWIG_NewPointerObj(val, type_info<std::shared_ptr<Type> >(), owner);
+ } else {
+ return Qnil;
+ }
+ }
+ };
+
+ /*
+ The descriptors in the shared_ptr typemaps remove the const qualifier for the SWIG type system.
+ Remove const likewise here, otherwise SWIG_TypeQuery("std::shared_ptr<const Type>") will return NULL.
+ */
+ template<class Type>
+ struct traits_from<std::shared_ptr<const Type> > {
+ static VALUE from(const std::shared_ptr<const Type>& val) {
+ std::shared_ptr<Type> p = std::const_pointer_cast<Type>(val);
+ return swig::from(p);
+ }
+ };
+}
+}
+
+%fragment("StdSharedPtrTraits");
diff --git a/Lib/ruby/std_stack.i b/Lib/ruby/std_stack.i
index 600c81c96..7df48ef1b 100644
--- a/Lib/ruby/std_stack.i
+++ b/Lib/ruby/std_stack.i
@@ -14,7 +14,7 @@
template <class T>
struct traits_from<std::stack<T> > {
- static VALUE from(const std::stack<T> & vec) {
+ static VALUE from(const std::stack<T>& vec) {
return traits_from_stdseq<std::stack<T> >::from(vec);
}
};
diff --git a/Lib/ruby/std_string.i b/Lib/ruby/std_string.i
index cac4324f0..f9ecd8e8a 100644
--- a/Lib/ruby/std_string.i
+++ b/Lib/ruby/std_string.i
@@ -1,7 +1,5 @@
-%warnfilter(801) std::string; // wrong class name
-%warnfilter(378) std::basic_string::operator!=;
-
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) std::basic_string<char>;
AUTODOC(substr, "Return a portion of the String");
diff --git a/Lib/ruby/std_unordered_map.i b/Lib/ruby/std_unordered_map.i
new file mode 100644
index 000000000..48c875214
--- /dev/null
+++ b/Lib/ruby/std_unordered_map.i
@@ -0,0 +1,83 @@
+//
+// Maps
+//
+%include <std_map.i>
+
+%fragment("StdUnorderedMapTraits","header",fragment="StdMapCommonTraits")
+{
+ namespace swig {
+ template <class RubySeq, class K, class T, class Hash, class Compare, class Alloc>
+ inline void
+ assign(const RubySeq& rubyseq, std::unordered_map<K,T,Hash,Compare,Alloc> *map) {
+ typedef typename std::unordered_map<K,T,Hash,Compare,Alloc>::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ map->insert(value_type(it->first, it->second));
+ }
+ }
+
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_asptr<std::unordered_map<K,T,Hash,Compare,Alloc> > {
+ typedef std::unordered_map<K,T,Hash,Compare,Alloc> map_type;
+ static int asptr(VALUE obj, map_type **val) {
+ int res = SWIG_ERROR;
+ if (TYPE(obj) == T_HASH) {
+ static ID id_to_a = rb_intern("to_a");
+ VALUE items = rb_funcall(obj, id_to_a, 0);
+ res = traits_asptr_stdseq<std::unordered_map<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
+ } else {
+ map_type *p;
+ 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;
+ }
+ };
+
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_from<std::unordered_map<K,T,Hash,Compare,Alloc> > {
+ typedef std::unordered_map<K,T,Hash,Compare,Alloc> map_type;
+ typedef typename map_type::const_iterator const_iterator;
+ typedef typename map_type::size_type size_type;
+
+ static VALUE from(const map_type& map) {
+ swig_type_info *desc = swig::type_info<map_type>();
+ if (desc && desc->clientdata) {
+ return SWIG_NewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN);
+ } else {
+ size_type size = map.size();
+ int rubysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
+ if (rubysize < 0) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ rb_raise(rb_eRuntimeError, "map size not valid in Ruby");
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return Qnil;
+ }
+ VALUE obj = rb_hash_new();
+ for (const_iterator i= map.begin(); i!= map.end(); ++i) {
+ VALUE key = swig::from(i->first);
+ VALUE val = swig::from(i->second);
+ rb_hash_aset(obj, key, val);
+ }
+ return obj;
+ }
+ }
+ };
+ }
+}
+
+#define %swig_unordered_map_common(Map...) %swig_map_common(Map)
+#define %swig_unordered_map_methods(Map...) %swig_map_methods(Map)
+
+%rename("delete") std::unordered_map::__delete__;
+%rename("reject!") std::unordered_map::reject_bang;
+%rename("map!") std::unordered_map::map_bang;
+%rename("empty?") std::unordered_map::empty;
+%rename("include?") std::unordered_map::__contains__ const;
+%rename("has_key?") std::unordered_map::has_key const;
+
+%mixin std::unordered_map "Enumerable";
+%alias std::unordered_map::push "<<";
+
+%include <std/std_unordered_map.i>
diff --git a/Lib/ruby/std_unordered_multimap.i b/Lib/ruby/std_unordered_multimap.i
new file mode 100644
index 000000000..ebc53b597
--- /dev/null
+++ b/Lib/ruby/std_unordered_multimap.i
@@ -0,0 +1,100 @@
+/*
+ Multimaps
+*/
+%include <std_multimap.i>
+
+%fragment("StdUnorderedMultimapTraits","header",fragment="StdMapCommonTraits")
+{
+ namespace swig {
+ template <class RubySeq, class K, class T, class Hash, class Compare, class Alloc>
+ inline void
+ assign(const RubySeq& rubyseq, std::unordered_multimap<K,T,Hash,Compare,Alloc> *multimap) {
+ typedef typename std::unordered_multimap<K,T,Hash,Compare,Alloc>::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ multimap->insert(value_type(it->first, it->second));
+ }
+ }
+
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_asptr<std::unordered_multimap<K,T,Hash,Compare,Alloc> > {
+ typedef std::unordered_multimap<K,T,Hash,Compare,Alloc> multimap_type;
+ static int asptr(VALUE obj, std::unordered_multimap<K,T,Hash,Compare,Alloc> **val) {
+ int res = SWIG_ERROR;
+ if ( TYPE(obj) == T_HASH ) {
+ static ID id_to_a = rb_intern("to_a");
+ VALUE items = rb_funcall(obj, id_to_a, 0);
+ return traits_asptr_stdseq<std::unordered_multimap<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
+ } else {
+ multimap_type *p;
+ res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<multimap_type>(),0);
+ if (SWIG_IsOK(res) && val) *val = p;
+ }
+ return res;
+ }
+ };
+
+ template <class K, class T, class Hash, class Compare, class Alloc>
+ struct traits_from<std::unordered_multimap<K,T,Hash,Compare,Alloc> > {
+ typedef std::unordered_multimap<K,T,Hash,Compare,Alloc> multimap_type;
+ typedef typename multimap_type::const_iterator const_iterator;
+ typedef typename multimap_type::size_type size_type;
+
+ static VALUE from(const multimap_type& multimap) {
+ swig_type_info *desc = swig::type_info<multimap_type>();
+ if (desc && desc->clientdata) {
+ return SWIG_NewPointerObj(new multimap_type(multimap), desc, SWIG_POINTER_OWN);
+ } else {
+ size_type size = multimap.size();
+ int rubysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
+ if (rubysize < 0) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ rb_raise(rb_eRuntimeError,
+ "multimap_ size not valid in Ruby");
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return Qnil;
+ }
+ VALUE obj = rb_hash_new();
+ for (const_iterator i= multimap.begin(); i!= multimap.end(); ++i) {
+ VALUE key = swig::from(i->first);
+ VALUE val = swig::from(i->second);
+
+ VALUE oldval = rb_hash_aref(obj, key);
+ if (oldval == Qnil) {
+ rb_hash_aset(obj, key, val);
+ } else {
+ // Multiple values for this key, create array if needed
+ // and add a new element to it.
+ VALUE ary;
+ if (TYPE(oldval) == T_ARRAY) {
+ ary = oldval;
+ } else {
+ ary = rb_ary_new2(2);
+ rb_ary_push(ary, oldval);
+ rb_hash_aset(obj, key, ary);
+ }
+ rb_ary_push(ary, val);
+ }
+ }
+ return obj;
+ }
+ }
+ };
+ }
+}
+
+#define %swig_unordered_multimap_methods(MultiMap...) %swig_multimap_methods(MultiMap)
+
+%mixin std::unordered_multimap "Enumerable";
+
+%rename("delete") std::unordered_multimap::__delete__;
+%rename("reject!") std::unordered_multimap::reject_bang;
+%rename("map!") std::unordered_multimap::map_bang;
+%rename("empty?") std::unordered_multimap::empty;
+%rename("include?" ) std::unordered_multimap::__contains__ const;
+%rename("has_key?" ) std::unordered_multimap::has_key const;
+
+%alias std::unordered_multimap::push "<<";
+
+%include <std/std_unordered_multimap.i>
+
diff --git a/Lib/ruby/std_unordered_multiset.i b/Lib/ruby/std_unordered_multiset.i
new file mode 100644
index 000000000..dae13eef3
--- /dev/null
+++ b/Lib/ruby/std_unordered_multiset.i
@@ -0,0 +1,50 @@
+/*
+ Multisets
+*/
+
+%include <std_unordered_set.i>
+
+%fragment("StdUnorderedMultisetTraits","header",fragment="StdUnorderedSetTraits")
+%{
+ namespace swig {
+ template <class RubySeq, class Key, class Hash, class Compare, class Alloc>
+ inline void
+ assign(const RubySeq& rubyseq, std::unordered_multiset<Key,Hash,Compare,Alloc>* seq) {
+ // seq->insert(rubyseq.begin(), rubyseq.end()); // not used as not always implemented
+ typedef typename RubySeq::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ seq->insert(seq->end(),(value_type)(*it));
+ }
+ }
+
+ template <class Key, class Hash, class Compare, class Alloc>
+ struct traits_asptr<std::unordered_multiset<Key,Hash,Compare,Alloc> > {
+ static int asptr(VALUE obj, std::unordered_multiset<Key,Hash,Compare,Alloc> **m) {
+ return traits_asptr_stdseq<std::unordered_multiset<Key,Hash,Compare,Alloc> >::asptr(obj, m);
+ }
+ };
+
+ template <class Key, class Hash, class Compare, class Alloc>
+ struct traits_from<std::unordered_multiset<Key,Hash,Compare,Alloc> > {
+ static VALUE from(const std::unordered_multiset<Key,Hash,Compare,Alloc>& vec) {
+ return traits_from_stdseq<std::unordered_multiset<Key,Hash,Compare,Alloc> >::from(vec);
+ }
+ };
+ }
+%}
+
+#define %swig_unordered_multiset_methods(Set...) %swig_unordered_set_methods(Set)
+
+%mixin std::unordered_multiset "Enumerable";
+
+%rename("delete") std::unordered_multiset::__delete__;
+%rename("reject!") std::unordered_multiset::reject_bang;
+%rename("map!") std::unordered_multiset::map_bang;
+%rename("empty?") std::unordered_multiset::empty;
+%rename("include?") std::unordered_multiset::__contains__ const;
+%rename("has_key?") std::unordered_multiset::has_key const;
+
+%alias std::unordered_multiset::push "<<";
+
+%include <std/std_unordered_multiset.i>
diff --git a/Lib/ruby/std_unordered_set.i b/Lib/ruby/std_unordered_set.i
new file mode 100644
index 000000000..e8e1b0872
--- /dev/null
+++ b/Lib/ruby/std_unordered_set.i
@@ -0,0 +1,50 @@
+/*
+ Sets
+*/
+
+%include <std_set.i>
+
+%fragment("StdUnorderedSetTraits","header",fragment="<stddef.h>",fragment="StdSetTraits")
+%{
+ namespace swig {
+ template <class RubySeq, class Key, class Hash, class Compare, class Alloc>
+ inline void
+ assign(const RubySeq& rubyseq, std::unordered_set<Key,Hash,Compare,Alloc>* seq) {
+ // seq->insert(rubyseq.begin(), rubyseq.end()); // not used as not always implemented
+ typedef typename RubySeq::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ seq->insert(seq->end(),(value_type)(*it));
+ }
+ }
+
+ template <class Key, class Hash, class Compare, class Alloc>
+ struct traits_asptr<std::unordered_set<Key,Hash,Compare,Alloc> > {
+ static int asptr(VALUE obj, std::unordered_set<Key,Hash,Compare,Alloc> **s) {
+ return traits_asptr_stdseq<std::unordered_set<Key,Hash,Compare,Alloc> >::asptr(obj, s);
+ }
+ };
+
+ template <class Key, class Hash, class Compare, class Alloc>
+ struct traits_from<std::unordered_set<Key,Hash,Compare,Alloc> > {
+ static VALUE from(const std::unordered_set<Key,Hash,Compare,Alloc>& vec) {
+ return traits_from_stdseq<std::unordered_set<Key,Hash,Compare,Alloc> >::from(vec);
+ }
+ };
+ }
+%}
+
+#define %swig_unordered_set_methods(set...) %swig_set_methods(set)
+
+%mixin std::unordered_set "Enumerable";
+
+%rename("delete") std::unordered_set::__delete__;
+%rename("reject!") std::unordered_set::reject_bang;
+%rename("map!") std::unordered_set::map_bang;
+%rename("empty?") std::unordered_set::empty;
+%rename("include?" ) std::unordered_set::__contains__ const;
+%rename("has_key?" ) std::unordered_set::has_key const;
+
+%alias std::unordered_set::push "<<";
+
+%include <std/std_unordered_set.i>
diff --git a/Lib/ruby/std_wstring.i b/Lib/ruby/std_wstring.i
index 5ca77c0c8..2b633438e 100644
--- a/Lib/ruby/std_wstring.i
+++ b/Lib/ruby/std_wstring.i
@@ -1,3 +1,52 @@
+%{
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_RUBY_ENCODING_H
+#include "ruby/encoding.h"
+#endif
+
+/**
+ * The internal encoding of std::wstring is defined based on
+ * the size of wchar_t. If it is not appropriate for your library,
+ * SWIG_RUBY_WSTRING_ENCODING must be given when compiling.
+ */
+#ifndef SWIG_RUBY_WSTRING_ENCODING
+
+#if WCHAR_MAX == 0x7fff || WCHAR_MAX == 0xffff
+#define SWIG_RUBY_WSTRING_ENCODING "UTF-16LE"
+#elif WCHAR_MAX == 0x7fffffff || WCHAR_MAX == 0xffffffff
+#define SWIG_RUBY_WSTRING_ENCODING "UTF-32LE"
+#else
+#error unsupported wchar_t size. SWIG_RUBY_WSTRING_ENCODING must be given.
+#endif
+
+#endif
+
+/**
+ * If Encoding.default_internal is nil, this encoding will be used
+ * when converting from std::wstring to String object in Ruby.
+ */
+#ifndef SWIG_RUBY_INTERNAL_ENCODING
+#define SWIG_RUBY_INTERNAL_ENCODING "UTF-8"
+#endif
+
+static rb_encoding *swig_ruby_wstring_encoding;
+static rb_encoding *swig_ruby_internal_encoding;
+
+#ifdef __cplusplus
+}
+#endif
+%}
+
+%fragment("SWIG_ruby_wstring_encoding_init", "init") {
+ swig_ruby_wstring_encoding = rb_enc_find( SWIG_RUBY_WSTRING_ENCODING );
+ swig_ruby_internal_encoding = rb_enc_find( SWIG_RUBY_INTERNAL_ENCODING );
+}
+
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) std::basic_string<wchar_t>;
+
%include <rubywstrings.swg>
%include <typemaps/std_wstring.swg>
diff --git a/Lib/ruby/stl.i b/Lib/ruby/stl.i
index 9d2e91eee..04f86014f 100644
--- a/Lib/ruby/stl.i
+++ b/Lib/ruby/stl.i
@@ -1,7 +1,5 @@
/* -----------------------------------------------------------------------------
* stl.i
- *
- * Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
%include <std_common.i>
diff --git a/Lib/scilab/boost_shared_ptr.i b/Lib/scilab/boost_shared_ptr.i
index b90422a66..668bf4354 100644
--- a/Lib/scilab/boost_shared_ptr.i
+++ b/Lib/scilab/boost_shared_ptr.i
@@ -14,7 +14,7 @@
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor wrapper customisation
-%feature("unref") TYPE
+%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;"
@@ -25,7 +25,7 @@
int newmem = 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);
@@ -58,13 +58,31 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
+ int newmem = 0;
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (!swig_argp) {
+ %dirout_nullref("$type");
+ } else {
+ $result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
+ if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
+ }
+}
+
// 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;
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) {
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
@@ -76,7 +94,7 @@
}
}
-%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE * {
+%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
}
@@ -99,17 +117,25 @@
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
}
}
-%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE * {
+%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE * {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE * %{
+#error "directorout typemap for plain pointer not implemented"
+%}
+
// plain reference
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
int newmem = 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) {
@@ -120,7 +146,7 @@
$1 = %const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
}
}
-%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE & {
+%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner);
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -144,18 +170,26 @@
$1 = *%const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
}
}
-%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE & {
+%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE & {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) CONST TYPE & %{
+#error "directorout typemap for plain reference not implemented"
+%}
+
// 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;
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) {
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
@@ -166,8 +200,8 @@
}
$1 = &temp;
}
-%typemap(out, fragment="SWIG_null_deleter_python") TYPE *CONST& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
+%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -178,12 +212,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) TYPE *CONST& %{
+#error "directorout typemap for plain pointer by reference not implemented"
+%}
+
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
int newmem = 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, $&ltype));
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $&ltype);
@@ -208,12 +250,28 @@
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
+ int newmem = 0;
+ swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
+ if (!SWIG_IsOK(swig_res)) {
+ %dirout_fail(swig_res, "$type");
+ }
+ if (swig_argp) {
+ $result = *(%reinterpret_cast(swig_argp, $&ltype));
+ if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $&ltype);
+ }
+}
+
// 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;
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 (argp) tempshared = *%reinterpret_cast(argp, $ltype);
@@ -235,12 +293,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
+#error "directorout typemap for shared_ptr ref not implemented"
+%}
+
// 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;
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 (argp) tempshared = *%reinterpret_cast(argp, $ltype);
@@ -251,7 +317,7 @@
}
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
if ($owner) delete $1;
}
@@ -263,12 +329,20 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
+#error "directorout typemap for pointer to shared_ptr not implemented"
+%}
+
// 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;
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);
@@ -276,7 +350,7 @@
$1 = &temp;
}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -287,10 +361,18 @@
#error "varout typemap not implemented"
%}
+%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
+ smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
+ $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
+%}
+%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
+#error "directorout typemap for pointer ref to shared_ptr not implemented"
+%}
+
// 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, equivalent="TYPE *", noblock=1)
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
@@ -317,4 +399,3 @@
%enddef
-
diff --git a/Lib/scilab/scicontainer.swg b/Lib/scilab/scicontainer.swg
index 2cc44b8e5..f6078690b 100644
--- a/Lib/scilab/scicontainer.swg
+++ b/Lib/scilab/scicontainer.swg
@@ -42,7 +42,9 @@
%fragment("SciSequence_Cont", "header",
fragment="StdTraits",
- fragment="SwigSciIterator_T")
+ fragment="SwigSciIterator_T",
+ fragment=SWIG_Traits_Sequence_frag(ptr),
+ fragment=SWIG_Traits_SequenceItem_frag(ptr))
{
namespace swig
{
@@ -334,8 +336,7 @@ namespace swig
%fragment("StdSequenceTraits","header",
fragment="StdTraits",
- fragment="SciSequence_Cont",
- fragment=SWIG_Traits_SequenceItem_frag(ptr))
+ fragment="SciSequence_Cont")
{
namespace swig {
template <class SciSeq, class Seq>
diff --git a/Lib/scilab/sciexception.swg b/Lib/scilab/sciexception.swg
index a5eb4c00f..1d653b314 100644
--- a/Lib/scilab/sciexception.swg
+++ b/Lib/scilab/sciexception.swg
@@ -43,7 +43,7 @@
}
%typemap(throws, noblock=1) char, char& {
- char obj[1];
+ char obj[2];
sprintf(obj, "%c", (char)$1);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
diff --git a/Lib/scilab/sciiterators.swg b/Lib/scilab/sciiterators.swg
index 1c7ce4394..69cb04bee 100644
--- a/Lib/scilab/sciiterators.swg
+++ b/Lib/scilab/sciiterators.swg
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
* sciiterators.swg
*
- * Users can derive form the SciSwigIterator to implemet their
+ * Users can derive form the SciSwigIterator to implement 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.
diff --git a/Lib/scilab/scirun.swg b/Lib/scilab/scirun.swg
index 29f8096ef..51df9a59e 100644
--- a/Lib/scilab/scirun.swg
+++ b/Lib/scilab/scirun.swg
@@ -49,8 +49,13 @@ static char *SWIG_Scilab_GetFuncName(void) {
static void SWIG_Scilab_SetFuncName(char *funcName) {
if (SwigFuncName != NULL) {
free(SwigFuncName);
+ SwigFuncName = NULL;
+ }
+ if (funcName) {
+ SwigFuncName = (char *)malloc(strlen(funcName) + 1);
+ if (SwigFuncName)
+ strcpy(SwigFuncName, funcName);
}
- SwigFuncName = strdup(funcName);
}
/* Api context management functions */
@@ -152,15 +157,15 @@ 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);
+ Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occurred: %s\n", type, obj);
else
- Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
+ Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occurred.\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);
+ Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occurred.\n", type);
}
/* Module initialization */
@@ -298,7 +303,10 @@ SwigScilabPtrToObject(void *pvApiCtx, int iVar, void **pvObj, swig_type_info *de
if (pvObj) {
*pvObj = pvPtr;
- return SWIG_OK;
+ if (pvPtr)
+ return SWIG_OK;
+ else
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
else {
return SWIG_ERROR;
@@ -446,36 +454,81 @@ int SWIG_this(SWIG_GatewayParameters) {
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) {
+ if (SWIG_NbInputArgument(pvApiCtx) > 0) {
+ SciErr sciErr;
+ int *piAddrVar1 = NULL;
+ int iTypeVar1 = 0;
+ char *pstInputPtrTypeName = NULL;
+ char *pstOutputMListTypeName = NULL;
+ if (SWIG_NbInputArgument(pvApiCtx) > 2) {
+ int *piAddrVar2 = NULL;
+ int *piAddrVar3 = NULL;
+ sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrVar2);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+ if (getAllocatedSingleString(pvApiCtx, piAddrVar2, &pstInputPtrTypeName)) {
+ return SWIG_ERROR;
+ }
+ sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddrVar3);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+ if (getAllocatedSingleString(pvApiCtx, piAddrVar3, &pstOutputMListTypeName)) {
+ return SWIG_ERROR;
+ }
+ }
+
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrVar1);
+ 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;
+ sciErr = getVarType(pvApiCtx, piAddrVar1, &iTypeVar1);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+
+ if ((iTypeVar1 == sci_pointer) || (iTypeVar1 == sci_mlist)) {
+ void *ptrValue = NULL;
+ if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, SWIG_Scilab_TypeQuery(pstInputPtrTypeName), 0, (char *) "SWIG_ptr") == SWIG_OK) {
+ SWIG_Scilab_SetOutputPosition(1);
+ return SWIG_Scilab_SetOutput(pvApiCtx,
+ SwigScilabPtrFromObject(pvApiCtx, 1, ptrValue, SWIG_Scilab_TypeQuery(pstInputPtrTypeName), 0, pstOutputMListTypeName));
}
- 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;
+ else {
+ return SWIG_ERROR;
+ }
+ }
+ else if (iTypeVar1 == sci_matrix) {
+ double dValue = 0;
+ if (getScalarDouble(pvApiCtx, piAddrVar1, &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, SWIG_Scilab_TypeQuery(pstInputPtrTypeName), 0, pstOutputMListTypeName));
+ }
+ else {
+ return SWIG_TypeError;
}
- 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);
+ Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A mlist, pointer or a double expected.\n"), (char *) "SWIG_ptr", 1);
return SWIG_TypeError;
}
}
+ else {
+ Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: A mlist, pointer, or a double expected.\n"), "SWIG_ptr", 1);
+ return SWIG_TypeError;
+ }
}
diff --git a/Lib/scilab/sciruntime.swg b/Lib/scilab/sciruntime.swg
index 9abedfe3d..3de138e11 100644
--- a/Lib/scilab/sciruntime.swg
+++ b/Lib/scilab/sciruntime.swg
@@ -25,12 +25,14 @@ SWIG_Scilab_SetModule(swig_module_info *swig_module) {
SWIGRUNTIME swig_type_info *
SWIG_Scilab_TypeQuery(const char *name) {
if (SWIG_Module_Initialized()) {
- return SWIG_TypeQuery(name);
+ if (name) {
+ return SWIG_TypeQuery(name);
+ }
}
else {
SWIG_Error(SWIG_RuntimeError, "the module is not initialized");
- return NULL;
}
+ return NULL;
}
%}
diff --git a/Lib/scilab/scistdcommon.swg b/Lib/scilab/scistdcommon.swg
index 63f3ca164..b08fc0307 100644
--- a/Lib/scilab/scistdcommon.swg
+++ b/Lib/scilab/scistdcommon.swg
@@ -41,7 +41,7 @@ namespace swig {
template <class Type>
struct traits_asptr {
static int asptr(const SwigSciObject& obj, Type **val) {
- Type *p;
+ Type *p = 0;
swig_type_info *descriptor = type_info<Type>();
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res)) {
@@ -104,23 +104,21 @@ namespace swig {
template <class Type>
struct traits_as<Type, value_category> {
- static Type as(const SwigSciObject& obj, bool throw_error) {
+ static Type as(const SwigSciObject& obj) {
Type v;
int res = asval(obj, &v);
if (SWIG_IsOK(res)) {
return v;
} else {
- %type_error(swig::type_name<Type>());
- if (throw_error)
- throw std::invalid_argument("bad type");
- return res;
+ %type_error(swig::type_name<Type>());
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
struct traits_as<Type, pointer_category> {
- static Type as(const SwigSciObject& obj, bool throw_error) {
+ static Type as(const SwigSciObject& obj) {
Type *v = 0;
int res = traits_asptr<Type>::asptr(obj, &v);
if (SWIG_IsOK(res) && v) {
@@ -132,36 +130,29 @@ namespace swig {
return *v;
}
} else {
- // Uninitialized return value, no Type() constructor required.
- static Type *v_def = (Type*) malloc(sizeof(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;
+ %type_error(swig::type_name<Type>());
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
struct traits_as<Type*, pointer_category> {
- static Type* as(const SwigSciObject& obj, bool throw_error) {
+ static Type* as(const SwigSciObject& obj) {
Type *v = 0;
int res = traits_asptr<Type>::asptr(obj, &v);
if (SWIG_IsOK(res)) {
return v;
} else {
- %type_error(swig::type_name<Type>());
- if (throw_error)
- throw std::invalid_argument("bad type");
- return SWIG_OK;
+ %type_error(swig::type_name<Type>());
+ throw std::invalid_argument("bad type");
}
}
};
template <class Type>
- inline Type as(const SwigSciObject& obj, bool te = false) {
- return traits_as<Type, typename traits<Type>::category>::as(obj, te);
+ inline Type as(const SwigSciObject& obj) {
+ return traits_as<Type, typename traits<Type>::category>::as(obj);
}
template <class Type>
diff --git a/Lib/scilab/scitypemaps.swg b/Lib/scilab/scitypemaps.swg
index 4cf0da3f1..99fdce7be 100644
--- a/Lib/scilab/scitypemaps.swg
+++ b/Lib/scilab/scitypemaps.swg
@@ -7,7 +7,7 @@
#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 %set_constant(name, obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR // Name is managed by 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
@@ -97,7 +97,7 @@
if (SWIG_AsVal_dec(Enum)($input, &val) != SWIG_OK) {
return SWIG_ERROR;
}
- $1 = %reinterpret_cast(val, $ltype);
+ $1 = %static_cast(val, $1_ltype);
}
%typemap(out, fragment=SWIG_From_frag(Enum)) enum SWIGTYPE {
diff --git a/Lib/scilab/std_basic_string.i b/Lib/scilab/std_basic_string.i
index 43b660db6..b57353816 100644
--- a/Lib/scilab/std_basic_string.i
+++ b/Lib/scilab/std_basic_string.i
@@ -21,8 +21,7 @@ SWIG_AsPtr_dec(std::basic_string<char>)(int _iVar, std::basic_string<char> **_ps
delete[] buf;
}
return SWIG_NEWOBJ;
- }
- else {
+ } else {
if (_pstValue) {
*_pstValue = NULL;
}
diff --git a/Lib/scilab/std_map.i b/Lib/scilab/std_map.i
index 250d2d84c..07eb63fda 100644
--- a/Lib/scilab/std_map.i
+++ b/Lib/scilab/std_map.i
@@ -19,18 +19,28 @@
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
bool empty() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -40,14 +50,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
}
diff --git a/Lib/scilab/std_pair.i b/Lib/scilab/std_pair.i
index 1448d6524..39ef008d3 100644
--- a/Lib/scilab/std_pair.i
+++ b/Lib/scilab/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/scilab/std_shared_ptr.i b/Lib/scilab/std_shared_ptr.i
new file mode 100644
index 000000000..df873679c
--- /dev/null
+++ b/Lib/scilab/std_shared_ptr.i
@@ -0,0 +1,2 @@
+#define SWIG_SHARED_PTR_NAMESPACE std
+%include <boost_shared_ptr.i>
diff --git a/Lib/scilab/stl.i b/Lib/scilab/stl.i
index b29f7d84d..04f86014f 100644
--- a/Lib/scilab/stl.i
+++ b/Lib/scilab/stl.i
@@ -1,6 +1,10 @@
-/* initial STL definition. extended as needed in each language */
+/* -----------------------------------------------------------------------------
+ * stl.i
+ * ----------------------------------------------------------------------------- */
+
%include <std_common.i>
%include <std_string.i>
%include <std_vector.i>
%include <std_map.i>
%include <std_pair.i>
+
diff --git a/Lib/shared_ptr.i b/Lib/shared_ptr.i
index 2975b0628..eada0b9e7 100644
--- a/Lib/shared_ptr.i
+++ b/Lib/shared_ptr.i
@@ -49,12 +49,10 @@ struct SWIG_null_deleter {
}
-// Workaround empty first macro argument bug
-#define SWIGEMPTYHACK
// Main user macro for defining shared_ptr typemaps for both const and non-const pointer types
%define %shared_ptr(TYPE...)
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
-SWIG_SHARED_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE)
+SWIG_SHARED_PTR_TYPEMAPS(, TYPE)
SWIG_SHARED_PTR_TYPEMAPS(const, TYPE)
%enddef
diff --git a/Lib/std/std_alloc.i b/Lib/std/std_alloc.i
index 44dc8dc3e..e460dc3ea 100644
--- a/Lib/std/std_alloc.i
+++ b/Lib/std/std_alloc.i
@@ -31,9 +31,9 @@ namespace std
allocator() throw();
- allocator(const allocator&) throw();
+ allocator(const allocator& other) throw();
template<typename _Tp1>
- allocator(const allocator<_Tp1>&) throw();
+ allocator(const allocator<_Tp1>& other) throw();
~allocator() throw();
diff --git a/Lib/std/std_array.i b/Lib/std/std_array.i
index aadc3b80c..3f70ef57c 100644
--- a/Lib/std/std_array.i
+++ b/Lib/std/std_array.i
@@ -53,8 +53,8 @@ namespace std {
typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
%traits_swigtype(_Tp);
%traits_enum(_Tp);
diff --git a/Lib/std/std_carray.swg b/Lib/std/std_carray.swg
index ebb20ce6a..de2a07627 100644
--- a/Lib/std/std_carray.swg
+++ b/Lib/std/std_carray.swg
@@ -28,8 +28,8 @@ namespace std {
carray() { }
- carray(const carray& c) {
- std::copy(c.v, c.v + size(), v);
+ carray(const carray& other) {
+ std::copy(other.v, other.v + size(), v);
}
template <class _Iterator>
diff --git a/Lib/std/std_common.i b/Lib/std/std_common.i
index 05bc4325a..708f3ceed 100644
--- a/Lib/std/std_common.i
+++ b/Lib/std/std_common.i
@@ -5,7 +5,7 @@
//
//#define SWIG_STD_MODERN_STL
//
-// Use this to deactive the previous definition, when using gcc-2.95
+// Use this to deactivate the previous definition, when using gcc-2.95
// or similar old compilers.
//
//#define SWIG_STD_NOMODERN_STL
diff --git a/Lib/std/std_container.i b/Lib/std/std_container.i
index 000163f1e..570dfde48 100644
--- a/Lib/std/std_container.i
+++ b/Lib/std/std_container.i
@@ -11,7 +11,7 @@
%define %std_container_methods_non_resizable(container...)
container();
- container(const container&);
+ container(const container& other);
bool empty() const;
size_type size() const;
diff --git a/Lib/std/std_ios.i b/Lib/std/std_ios.i
index db83c7abf..7c62ed690 100644
--- a/Lib/std/std_ios.i
+++ b/Lib/std/std_ios.i
@@ -153,10 +153,10 @@ namespace std {
//50. Copy constructor and assignment operator of ios_base
private:
- ios_base(const ios_base&);
+ ios_base(const ios_base& other);
ios_base&
- operator=(const ios_base&);
+ operator=(const ios_base& other);
};
template<typename _CharT, typename _Traits = char_traits<_CharT> >
@@ -242,10 +242,10 @@ namespace std {
// 27.4.5.1 basic_ios constructors
basic_ios();
private:
- basic_ios(const basic_ios&);
+ basic_ios(const basic_ios& other);
basic_ios&
- operator=(const basic_ios&);
+ operator=(const basic_ios& other);
};
}
diff --git a/Lib/std/std_iostream.i b/Lib/std/std_iostream.i
index 7a33afe39..38a22963f 100644
--- a/Lib/std/std_iostream.i
+++ b/Lib/std/std_iostream.i
@@ -306,15 +306,15 @@ namespace std
template<typename _CharT, typename _Traits = char_traits<_CharT> >
std::basic_ostream<_CharT, _Traits>&
- endl(std::basic_ostream<_CharT, _Traits>&);
+ endl(std::basic_ostream<_CharT, _Traits>& value);
template<typename _CharT, typename _Traits = char_traits<_CharT> >
std::basic_ostream<_CharT, _Traits>&
- ends(std::basic_ostream<_CharT, _Traits>&);
+ ends(std::basic_ostream<_CharT, _Traits>& value);
template<typename _CharT, typename _Traits = char_traits<_CharT> >
std::basic_ostream<_CharT, _Traits>&
- flush(std::basic_ostream<_CharT, _Traits>&);
+ flush(std::basic_ostream<_CharT, _Traits>& value);
}
namespace std {
diff --git a/Lib/std/std_list.i b/Lib/std/std_list.i
index ebbafa22b..2cc2d97cf 100644
--- a/Lib/std/std_list.i
+++ b/Lib/std/std_list.i
@@ -106,8 +106,8 @@ namespace std {
typedef _Tp* value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
- typedef value_type reference;
- typedef value_type const_reference;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
typedef _Alloc allocator_type;
%traits_swigtype(_Tp);
diff --git a/Lib/std/std_map.i b/Lib/std/std_map.i
index 8043f924c..62f5cb37c 100644
--- a/Lib/std/std_map.i
+++ b/Lib/std/std_map.i
@@ -74,7 +74,6 @@ namespace std {
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;
@@ -113,7 +112,7 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::map< _Key, _Tp, _Compare, _Alloc >);
- map( const _Compare& );
+ map(const _Compare& other);
#ifdef %swig_map_methods
// Add swig/language extra methods
diff --git a/Lib/std/std_multimap.i b/Lib/std/std_multimap.i
index 7aa949907..03e765341 100644
--- a/Lib/std/std_multimap.i
+++ b/Lib/std/std_multimap.i
@@ -50,7 +50,6 @@ namespace std {
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;
@@ -89,7 +88,7 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::multimap< _Key, _Tp, _Compare, _Alloc >);
- multimap( const _Compare& );
+ multimap(const _Compare& other);
#ifdef %swig_multimap_methods
// Add swig/language extra methods
diff --git a/Lib/std/std_multiset.i b/Lib/std/std_multiset.i
index 1aa7ccce8..a1d0db813 100644
--- a/Lib/std/std_multiset.i
+++ b/Lib/std/std_multiset.i
@@ -71,7 +71,7 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::multiset< _Key, _Compare, _Alloc >);
- multiset( const _Compare& );
+ multiset(const _Compare& other);
#ifdef %swig_multiset_methods
// Add swig/language extra methods
diff --git a/Lib/std/std_pair.i b/Lib/std/std_pair.i
index 001cd6738..800155f21 100644
--- a/Lib/std/std_pair.i
+++ b/Lib/std/std_pair.i
@@ -35,9 +35,9 @@ namespace std {
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair< U1, U2 > &p);
+ template <class U1, class U2> pair(const pair< U1, U2 > &other);
T first;
U second;
@@ -76,8 +76,8 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair< T, U* >);
pair();
- pair(T __a, U* __b);
- pair(const pair& __p);
+ pair(T first, U* second);
+ pair(const pair& other);
T first;
U* second;
@@ -112,8 +112,8 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair< T*, U >);
pair();
- pair(T* __a, U __b);
- pair(const pair& __p);
+ pair(T* first, U second);
+ pair(const pair& other);
T* first;
U second;
@@ -148,8 +148,8 @@ namespace std {
%typemap_traits(SWIG_TYPECHECK_PAIR, std::pair< T*, U* >);
pair();
- pair(T* __a, U* __b);
- pair(const pair& __p);
+ pair(T* first, U* second);
+ pair(const pair& other);
T* first;
U* second;
diff --git a/Lib/std/std_queue.i b/Lib/std/std_queue.i
index b2c8d8d33..51bb04473 100644
--- a/Lib/std/std_queue.i
+++ b/Lib/std/std_queue.i
@@ -13,14 +13,14 @@
%define %std_queue_methods(queue...)
queue();
- queue( const _Sequence& );
+ queue(const _Sequence& other);
bool empty() const;
size_type size() const;
const value_type& front() const;
const value_type& back() const;
void pop();
- void push( const value_type& );
+ void push(const value_type& value);
%enddef
%define %std_queue_methods_val(queue...)
diff --git a/Lib/std/std_set.i b/Lib/std/std_set.i
index 107a23c71..0e05aca40 100644
--- a/Lib/std/std_set.i
+++ b/Lib/std/std_set.i
@@ -8,7 +8,7 @@
// Set
%define %std_set_methods_common(set...)
set();
- set( const set& );
+ set(const set& other);
bool empty() const;
size_type size() const;
@@ -110,7 +110,7 @@ namespace std {
%typemap_traits_ptr(SWIG_TYPECHECK_SET, std::set< _Key, _Compare, _Alloc >);
- set( const _Compare& );
+ set(const _Compare& other);
#ifdef %swig_set_methods
// Add swig/language extra methods
diff --git a/Lib/std/std_stack.i b/Lib/std/std_stack.i
index 5b624b571..ff714d099 100644
--- a/Lib/std/std_stack.i
+++ b/Lib/std/std_stack.i
@@ -13,13 +13,13 @@
%define %std_stack_methods(stack...)
stack();
- stack( const _Sequence& );
+ stack(const _Sequence& other);
bool empty() const;
size_type size() const;
const value_type& top() const;
void pop();
- void push( const value_type& );
+ void push(const value_type& value);
%enddef
%define %std_stack_methods_val(stack...)
diff --git a/Lib/std/std_streambuf.i b/Lib/std/std_streambuf.i
index 7efb19c6c..e17249135 100644
--- a/Lib/std/std_streambuf.i
+++ b/Lib/std/std_streambuf.i
@@ -81,7 +81,7 @@ namespace std {
basic_streambuf();
private:
- basic_streambuf(const basic_streambuf&);
+ basic_streambuf(const basic_streambuf& other);
};
}
diff --git a/Lib/std/std_unordered_map.i b/Lib/std/std_unordered_map.i
index 1cb714821..1fd1eb980 100644
--- a/Lib/std/std_unordered_map.i
+++ b/Lib/std/std_unordered_map.i
@@ -1,15 +1,11 @@
//
// 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);
+ %std_container_methods_without_reverse_iterators(unordered_map);
size_type erase(const key_type& x);
size_type count(const key_type& x) const;
@@ -22,8 +18,6 @@
}
iterator find(const key_type& x);
- iterator lower_bound(const key_type& x);
- iterator upper_bound(const key_type& x);
#endif
%enddef
@@ -68,7 +62,7 @@
namespace std {
- template<class _Key, class _Tp, class _Compare = std::less< _Key >,
+ template<class _Key, class _Tp, class _Hash = std::hash< _Key >, class _Pred = std::equal_to< _Key >,
class _Alloc = allocator<std::pair< const _Key, _Tp > > >
class unordered_map {
public:
@@ -77,11 +71,12 @@ namespace std {
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 _Hash hasher;
+ typedef _Compare key_equal;
typedef _Alloc allocator_type;
%traits_swigtype(_Key);
@@ -101,26 +96,24 @@ namespace std {
}
}
- %fragment(SWIG_Traits_frag(std::unordered_map< _Key, _Tp, _Compare, _Alloc >), "header",
+ %fragment(SWIG_Traits_frag(std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc >), "header",
fragment=SWIG_Traits_frag(std::pair< _Key, _Tp >),
- fragment="StdMapTraits") {
+ fragment="StdUnorderedMapTraits") {
namespace swig {
- template <> struct traits<std::unordered_map< _Key, _Tp, _Compare, _Alloc > > {
+ template <> struct traits<std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc > > {
typedef pointer_category category;
static const char* type_name() {
- return "std::unordered_map<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >";
+ return "std::unordered_map<" #_Key "," #_Tp "," #_Hash "," #_Pred "," #_Alloc " >";
}
};
}
}
- %typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::unordered_map< _Key, _Tp, _Compare, _Alloc >);
-
- unordered_map( const _Compare& );
+ %typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc >);
#ifdef %swig_unordered_map_methods
// Add swig/language extra methods
- %swig_unordered_map_methods(std::unordered_map< _Key, _Tp, _Compare, _Alloc >);
+ %swig_unordered_map_methods(std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc >);
#endif
%std_unordered_map_methods(unordered_map);
diff --git a/Lib/std/std_unordered_multimap.i b/Lib/std/std_unordered_multimap.i
index 46b56d88a..4be6aa492 100644
--- a/Lib/std/std_unordered_multimap.i
+++ b/Lib/std/std_unordered_multimap.i
@@ -1,15 +1,11 @@
//
// 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);
+ %std_unordered_map_methods_common(mmap);
#ifdef SWIG_EXPORT_ITERATOR_METHODS
std::pair<iterator,iterator> equal_range(const key_type& x);
@@ -44,7 +40,7 @@
namespace std {
- template<class _Key, class _Tp, class _Compare = std::less< _Key >,
+ template<class _Key, class _Tp, class _Hash = std::hash< _Key >, class _Pred = std::equal_to< _Key >,
class _Alloc = allocator<std::pair< const _Key, _Tp > > >
class unordered_multimap {
public:
@@ -53,36 +49,35 @@ namespace std {
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 _Hash hasher;
+ typedef _Compare key_equal;
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::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >), "header",
fragment=SWIG_Traits_frag(std::pair< _Key, _Tp >),
- fragment="StdMultimapTraits") {
+ fragment="StdUnorderedMultimapTraits") {
namespace swig {
- template <> struct traits<std::unordered_multimap< _Key, _Tp, _Compare, _Alloc > > {
+ template <> struct traits<std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > > {
typedef pointer_category category;
static const char* type_name() {
- return "std::unordered_multimap<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >";
+ return "std::unordered_multimap<" #_Key "," #_Tp "," #_Hash "," #_Pred "," #_Alloc " >";
}
};
}
}
- %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::unordered_multimap< _Key, _Tp, _Compare, _Alloc >);
+ %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _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 >);
+ %swig_unordered_multimap_methods(std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >);
#endif
%std_unordered_multimap_methods(unordered_multimap);
diff --git a/Lib/std/std_unordered_multiset.i b/Lib/std/std_unordered_multiset.i
index 725ca2fe7..2910fb6ff 100644
--- a/Lib/std/std_unordered_multiset.i
+++ b/Lib/std/std_unordered_multiset.i
@@ -1,8 +1,5 @@
//
// 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>
@@ -20,19 +17,19 @@
// 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>&):
+// -- f(std::unordered_multiset<Key>), f(const std::unordered_multiset<Key>&):
// 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>*):
+// previously wrapped std::unordered_multiset<Key> can be passed.
+// -- f(std::unordered_multiset<Key>&), f(std::unordered_multiset<Key>*):
// 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
+// -- std::unordered_multiset<Key> f(), const std::unordered_multiset<Key>& f():
+// the set is returned by copy; therefore, a sequence of Key:s
// is returned which is most easily used in other functions
-// -- std::unordered_multiset<T>& f(), std::unordered_multiset<T>* f():
+// -- std::unordered_multiset<Key>& f(), std::unordered_multiset<Key>* 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>*):
+// -- const std::unordered_multiset<Key>* f(), f(const std::unordered_multiset<Key>*):
// for consistency, they expect and return a plain set pointer.
// ------------------------------------------------------------------------
@@ -43,8 +40,10 @@ namespace std {
//unordered_multiset
- template <class _Key, class _Compare = std::less< _Key >,
- class _Alloc = allocator< _Key > >
+ template <class _Key,
+ class _Hash = std::hash< _Key >,
+ class _Compare = std::equal_to< _Key >,
+ class _Alloc = allocator< _Key > >
class unordered_multiset {
public:
typedef size_t size_type;
@@ -55,30 +54,30 @@ namespace std {
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
+ typedef _Hash hasher;
+ typedef _Compare key_equal;
typedef _Alloc allocator_type;
%traits_swigtype(_Key);
- %fragment(SWIG_Traits_frag(std::unordered_multiset< _Key, _Compare, _Alloc >), "header",
+ %fragment(SWIG_Traits_frag(std::unordered_multiset< _Key, _Hash, _Compare, _Alloc >), "header",
fragment=SWIG_Traits_frag(_Key),
- fragment="StdMultisetTraits") {
+ fragment="StdUnorderedMultisetTraits") {
namespace swig {
- template <> struct traits<std::unordered_multiset< _Key, _Compare, _Alloc > > {
+ template <> struct traits<std::unordered_multiset< _Key, _Hash, _Compare, _Alloc > > {
typedef pointer_category category;
static const char* type_name() {
- return "std::unordered_multiset<" #_Key "," #_Compare "," #_Alloc " >";
+ return "std::unordered_multiset<" #_Key "," #_Hash "," #_Compare "," #_Alloc " >";
}
};
}
}
- %typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::unordered_multiset< _Key, _Compare, _Alloc >);
-
- unordered_multiset( const _Compare& );
+ %typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::unordered_multiset< _Key, _Hash, _Compare, _Alloc >);
#ifdef %swig_unordered_multiset_methods
// Add swig/language extra methods
- %swig_unordered_multiset_methods(std::unordered_multiset< _Key, _Compare, _Alloc >);
+ %swig_unordered_multiset_methods(std::unordered_multiset< _Key, _Hash, _Compare, _Alloc >);
#endif
%std_unordered_multiset_methods(unordered_multiset);
diff --git a/Lib/std/std_unordered_set.i b/Lib/std/std_unordered_set.i
index 98e792040..91e807423 100644
--- a/Lib/std/std_unordered_set.i
+++ b/Lib/std/std_unordered_set.i
@@ -1,8 +1,5 @@
//
// 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>
@@ -11,7 +8,7 @@
// Unordered Set
%define %std_unordered_set_methods_common(unordered_set...)
unordered_set();
- unordered_set( const unordered_set& );
+ unordered_set(const unordered_set& other);
bool empty() const;
size_type size() const;
@@ -53,19 +50,19 @@
// 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>&):
+// -- f(std::unordered_set<Key>), f(const std::unordered_set<Key>&):
// 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>*):
+// previously wrapped std::unordered_set<Key> can be passed.
+// -- f(std::unordered_set<Key>&), f(std::unordered_set<Key>*):
// 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
+// -- std::unordered_set<Key> f(), const std::unordered_set<Key>& f():
+// the unordered_set is returned by copy; therefore, a sequence of Key:s
// is returned which is most easily used in other functions
-// -- std::unordered_set<T>& f(), std::unordered_set<T>* f():
+// -- std::unordered_set<Key>& f(), std::unordered_set<Key>* 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>*):
+// -- const std::unordered_set<Key>* f(), f(const std::unordered_set<Key>*):
// for consistency, they expect and return a plain unordered_set pointer.
// ------------------------------------------------------------------------
@@ -77,20 +74,22 @@
namespace std {
- template <class _Key, class _Hash = std::hash< _Key >,
+ template <class _Key,
+ class _Hash = std::hash< _Key >,
class _Compare = std::equal_to< _Key >,
- class _Alloc = allocator< _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 _Hash hasher;
+ typedef _Compare key_equal;
typedef _Alloc allocator_type;
%traits_swigtype(_Key);
@@ -110,8 +109,6 @@ namespace std {
%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 >);
diff --git a/Lib/std/std_vector.i b/Lib/std/std_vector.i
index fae759a36..b35f03bea 100644
--- a/Lib/std/std_vector.i
+++ b/Lib/std/std_vector.i
@@ -64,8 +64,8 @@ namespace std {
typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
typedef _Alloc allocator_type;
%traits_swigtype(_Tp);
@@ -101,13 +101,13 @@ namespace std {
template<class _Tp, class _Alloc >
class vector< _Tp*, _Alloc > {
public:
- typedef size_t size_type;
+ 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 value_type reference;
- typedef value_type const_reference;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
typedef _Alloc allocator_type;
%traits_swigtype(_Tp);
@@ -141,13 +141,13 @@ namespace std {
template<class _Tp, class _Alloc >
class vector< _Tp const *, _Alloc > {
public:
- typedef size_t size_type;
+ typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp const * value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
- typedef value_type reference;
- typedef value_type const_reference;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
typedef _Alloc allocator_type;
%traits_swigtype(_Tp);
@@ -182,13 +182,13 @@ namespace std {
template<class _Alloc >
class vector<bool,_Alloc > {
public:
- typedef size_t size_type;
+ typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef bool value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
- typedef value_type reference;
- typedef value_type const_reference;
+ typedef value_type& reference;
+ typedef bool const_reference;
typedef _Alloc allocator_type;
%traits_swigtype(bool);
diff --git a/Lib/std_except.i b/Lib/std_except.i
index 50b5a88a2..0f8b23e70 100644
--- a/Lib/std_except.i
+++ b/Lib/std_except.i
@@ -19,7 +19,7 @@
* a new std_except.i file in the target library directory.
* ----------------------------------------------------------------------------- */
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGGUILE) || defined(SWIGUTL) || defined(SWIGD)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGGUILE) || defined(SWIGUTL) || defined(SWIGD) || defined(SWIGOCAML)
#error "This version of std_except.i should not be used"
#endif
diff --git a/Lib/swig.swg b/Lib/swig.swg
index 6f48f0d20..6dc215dcf 100644
--- a/Lib/swig.swg
+++ b/Lib/swig.swg
@@ -309,11 +309,13 @@ static int NAME(TYPE x) {
%define %$classname %$ismember,"match$parentNode$name" %enddef
%define %$isnested "match$nested"="1" %enddef
+
/* -----------------------------------------------------------------------------
- * Include all the warnings labels and macros
+ * Common includes for warning labels, macros, fragments etc
* ----------------------------------------------------------------------------- */
%include <swigwarnings.swg>
+%include <swigfragments.swg>
/* -----------------------------------------------------------------------------
* Overloading support
diff --git a/Lib/swigfragments.swg b/Lib/swigfragments.swg
new file mode 100644
index 000000000..2cbef7cce
--- /dev/null
+++ b/Lib/swigfragments.swg
@@ -0,0 +1,86 @@
+/* -----------------------------------------------------------------------------
+ * swigfragments.swg
+ *
+ * Common fragments
+ * ----------------------------------------------------------------------------- */
+
+/* -----------------------------------------------------------------------------
+ * Fragments for C header files
+ * ----------------------------------------------------------------------------- */
+
+%fragment("<float.h>", "header") %{
+#include <float.h>
+%}
+
+/* Default compiler options for gcc allow long_long but not LLONG_MAX.
+ * Define SWIG_NO_LLONG_MAX if this added limits support is not wanted. */
+%fragment("<limits.h>", "header") %{
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+# define LLONG_MAX __LONG_LONG_MAX__
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+%}
+
+%fragment("<math.h>", "header") %{
+#include <math.h>
+%}
+
+%fragment("<stddef.h>", "header") %{
+#include <stddef.h>
+%}
+
+%fragment("<stdio.h>", "header") %{
+#include <stdio.h>
+#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__BORLANDC__) || defined(_WATCOM)
+# ifndef snprintf
+# define snprintf _snprintf
+# endif
+#endif
+%}
+
+%fragment("<stdlib.h>", "header") %{
+#include <stdlib.h>
+#ifdef _MSC_VER
+# ifndef strtoull
+# define strtoull _strtoui64
+# endif
+# ifndef strtoll
+# define strtoll _strtoi64
+# endif
+#endif
+%}
+
+%fragment("<wchar.h>", "header") %{
+#include <wchar.h>
+#include <limits.h>
+#ifndef WCHAR_MIN
+# define WCHAR_MIN 0
+#endif
+#ifndef WCHAR_MAX
+# define WCHAR_MAX 65535
+#endif
+%}
+
+/* -----------------------------------------------------------------------------
+ * Fragments for C++ header files
+ * ----------------------------------------------------------------------------- */
+
+%fragment("<algorithm>", "header") %{
+#include <algorithm>
+%}
+
+%fragment("<stdexcept>", "header") %{
+#include <stdexcept>
+%}
+
+%fragment("<string>", "header") %{
+#include <string>
+%}
+
+%fragment("<memory>", "header") %{
+#include <memory>
+%}
diff --git a/Lib/swiginit.swg b/Lib/swiginit.swg
index cb72c36eb..33926b10f 100644
--- a/Lib/swiginit.swg
+++ b/Lib/swiginit.swg
@@ -98,7 +98,7 @@ SWIG_InitializeModule(void *clientdata) {
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+ printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
#endif
for (i = 0; i < swig_module.size; ++i) {
swig_type_info *type = 0;
@@ -106,7 +106,7 @@ SWIG_InitializeModule(void *clientdata) {
swig_cast_info *cast;
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
#endif
/* if there is another module already loaded */
@@ -182,7 +182,7 @@ SWIG_InitializeModule(void *clientdata) {
for (i = 0; i < swig_module.size; ++i) {
int j = 0;
swig_cast_info *cast = swig_module.cast_initial[i];
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
while (cast->type) {
printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
cast++;
diff --git a/Lib/swigrun.swg b/Lib/swigrun.swg
index 1ef676187..59118ecad 100644
--- a/Lib/swigrun.swg
+++ b/Lib/swigrun.swg
@@ -43,6 +43,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
#define SWIG_CAST_NEW_MEMORY 0x2
+#define SWIG_POINTER_NO_NULL 0x4
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
diff --git a/Lib/tcl/cni.i b/Lib/tcl/cni.i
deleted file mode 100644
index 10a1403a2..000000000
--- a/Lib/tcl/cni.i
+++ /dev/null
@@ -1,2 +0,0 @@
-%include <gcj/cni.i>
-%include <jstring.i>
diff --git a/Lib/tcl/jstring.i b/Lib/tcl/jstring.i
deleted file mode 100644
index 7fb7b89fe..000000000
--- a/Lib/tcl/jstring.i
+++ /dev/null
@@ -1,42 +0,0 @@
-%include <typemaps/valtypes.swg>
-
-%fragment(SWIG_AsVal_frag(jstring),"header") {
-SWIGINTERN int
-SWIG_AsVal_dec(jstring)(Tcl_Obj * obj, jstring *val)
-{
- int len = 0;
- const char *cstr = Tcl_GetStringFromObj(obj, &len);
- if (!cstr || (strcmp(cstr,"NULL") == 0)) {
- if (val) *val = 0;
- return SWIG_OK;
- } else {
- int len = 0;
- const Tcl_UniChar *ucstr = Tcl_GetUnicodeFromObj(obj,&len);
- if (val) {
- *val = JvNewString((const jchar*)ucstr, len);
- }
- }
-
- return SWIG_NEWOBJ;
-}
-}
-
-%fragment(SWIG_From_frag(jstring),"header") {
-SWIGINTERNINLINE Tcl_Obj *
-SWIG_From_dec(jstring)(jstring val)
-{
- if (!val) {
- return Tcl_NewStringObj("NULL",-1);
- } else {
- return Tcl_NewUnicodeObj((Tcl_UniChar *)JvGetStringChars(val),JvGetStringUTFLength(val));
- }
-}
-}
-
-%typemaps_asvalfrom(%checkcode(STRING),
- %arg(SWIG_AsVal(jstring)),
- %arg(SWIG_From(jstring)),
- %arg(SWIG_AsVal_frag(jstring)),
- %arg(SWIG_From_frag(jstring)),
- java::lang::String *);
-
diff --git a/Lib/tcl/mactkinit.c b/Lib/tcl/mactkinit.c
index 78391d445..8d1420088 100644
--- a/Lib/tcl/mactkinit.c
+++ b/Lib/tcl/mactkinit.c
@@ -42,7 +42,7 @@ short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event));
*
* MacintoshInit --
*
- * This procedure calls Mac specific initilization calls. Most of
+ * This procedure calls Mac specific initialization calls. Most of
* these calls must be made as soon as possible in the startup
* process.
*
@@ -64,7 +64,7 @@ MacintoshInit()
/*
* Tk needs us to set the qd pointer it uses. This is needed
- * so Tk doesn't have to assume the availablity of the qd global
+ * so Tk doesn't have to assume the availiblity of the qd global
* variable. Which in turn allows Tk to be used in code resources.
*/
tcl_macQdPtr = &qd;
@@ -124,7 +124,7 @@ MacintoshInit()
*
* SetupMainInterp --
*
- * This procedure calls initalization routines require a Tcl
+ * This procedure calls initialization routines require a Tcl
* interp as an argument. This call effectively makes the passed
* iterpreter the "main" interpreter for the application.
*
@@ -133,7 +133,7 @@ MacintoshInit()
* application should probably fail.
*
* Side effects:
- * More initilization.
+ * More initialization.
*
*----------------------------------------------------------------------
*/
diff --git a/Lib/tcl/std_map.i b/Lib/tcl/std_map.i
index ade2b0ad1..2c7f40ac7 100644
--- a/Lib/tcl/std_map.i
+++ b/Lib/tcl/std_map.i
@@ -19,22 +19,28 @@
namespace std {
- template<class K, class T> class map {
+ template<class K, class T, class C = std::less<K> > class map {
// add typemaps here
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
+ typedef std::pair< const K, T > value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
map();
- map(const map<K,T> &);
+ map(const map& other);
unsigned int size() const;
bool empty() const;
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, C >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
@@ -44,14 +50,14 @@ namespace std {
(*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, C >::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, C >::iterator i = self->find(key);
return i != self->end();
}
}
diff --git a/Lib/tcl/std_pair.i b/Lib/tcl/std_pair.i
index 1448d6524..39ef008d3 100644
--- a/Lib/tcl/std_pair.i
+++ b/Lib/tcl/std_pair.i
@@ -18,12 +18,14 @@
namespace std {
template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
pair();
pair(T first, U second);
- pair(const pair& p);
+ pair(const pair& other);
- template <class U1, class U2> pair(const pair<U1, U2> &p);
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
diff --git a/Lib/tcl/std_vector.i b/Lib/tcl/std_vector.i
index 3fc0fd61d..5fba5379f 100644
--- a/Lib/tcl/std_vector.i
+++ b/Lib/tcl/std_vector.i
@@ -208,9 +208,17 @@ namespace std {
}
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, const T& value);
- vector(const vector< T > &);
+ vector(const vector& other);
unsigned int size() const;
bool empty() const;
@@ -359,9 +367,17 @@ namespace std {
}
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;
+
vector(unsigned int size = 0);
vector(unsigned int size, const T& value);
- vector(const vector< T > &);
+ vector(const vector& other);
unsigned int size() const;
bool empty() const;
diff --git a/Lib/tcl/stl.i b/Lib/tcl/stl.i
index 40c7584ec..04f86014f 100644
--- a/Lib/tcl/stl.i
+++ b/Lib/tcl/stl.i
@@ -2,7 +2,6 @@
* stl.i
* ----------------------------------------------------------------------------- */
-/* initial STL definition. extended as needed in each language */
%include <std_common.i>
%include <std_string.i>
%include <std_vector.i>
diff --git a/Lib/tcl/tclapi.swg b/Lib/tcl/tclapi.swg
index 33dc324d4..2187de52e 100644
--- a/Lib/tcl/tclapi.swg
+++ b/Lib/tcl/tclapi.swg
@@ -16,7 +16,7 @@ extern "C" {
/* Constant information structure */
typedef struct swig_const_info {
int type;
- char *name;
+ const char *name;
long lvalue;
double dvalue;
void *pvalue;
diff --git a/Lib/tcl/tclrun.swg b/Lib/tcl/tclrun.swg
index f671ba240..9010b9c87 100644
--- a/Lib/tcl/tclrun.swg
+++ b/Lib/tcl/tclrun.swg
@@ -125,7 +125,8 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi
/* Pointer values must start with leading underscore */
while (*c != '_') {
*ptr = (void *) 0;
- if (strcmp(c,"NULL") == 0) return SWIG_OK;
+ if (strcmp(c,"NULL") == 0)
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
/* Empty string: not a pointer */
if (*c == 0) return SWIG_ERROR;
@@ -199,7 +200,7 @@ SWIG_Tcl_PointerTypeFromString(char *c) {
return c;
}
-/* Convert a packed value value */
+/* Convert a packed pointer value */
SWIGRUNTIME int
SWIG_Tcl_ConvertPacked(Tcl_Interp *SWIGUNUSEDPARM(interp) , Tcl_Obj *obj, void *ptr, int sz, swig_type_info *ty) {
swig_cast_info *tc;
diff --git a/Lib/typemaps/fragments.swg b/Lib/typemaps/fragments.swg
index 3f33ca98d..e83f415c4 100644
--- a/Lib/typemaps/fragments.swg
+++ b/Lib/typemaps/fragments.swg
@@ -96,82 +96,13 @@
* common fragments
* ------------------------------------------------------------ */
-/* Default compiler options for gcc allow long_long but not LLONG_MAX.
- * Define SWIG_NO_LLONG_MAX if this added limits support is not wanted. */
-%fragment("<limits.h>","header") %{
-#include <limits.h>
-#if !defined(SWIG_NO_LLONG_MAX)
-# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
-# define LLONG_MAX __LONG_LONG_MAX__
-# define LLONG_MIN (-LLONG_MAX - 1LL)
-# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
-# endif
-#endif
-%}
-
-%fragment("<math.h>","header") %{
-#include <math.h>
-%}
-
-%fragment("<wchar.h>","header") %{
-#include <wchar.h>
-#include <limits.h>
-#ifndef WCHAR_MIN
-# define WCHAR_MIN 0
-#endif
-#ifndef WCHAR_MAX
-# define WCHAR_MAX 65535
-#endif
-%}
-
-%fragment("<float.h>","header") %{
-#include <float.h>
-%}
-
-%fragment("<stdio.h>","header") %{
-#include <stdio.h>
-#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
-# ifndef snprintf
-# define snprintf _snprintf
-# endif
-#endif
-%}
-
-%fragment("<stdlib.h>","header") %{
-#include <stdlib.h>
-#ifdef _MSC_VER
-# ifndef strtoull
-# define strtoull _strtoui64
-# endif
-# ifndef strtoll
-# define strtoll _strtoi64
-# endif
-#endif
-%}
-
-%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
+# 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.
@@ -187,6 +118,12 @@ inline int SWIG_isfinite_func(T x) {
return isfinite(x);
}
# define SWIG_isfinite(X) (SWIG_isfinite_func(X))
+# elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
+# define SWIG_isfinite(X) (__builtin_isfinite(X))
+# elif defined(__clang__) && defined(__has_builtin)
+# if __has_builtin(__builtin_isfinite)
+# define SWIG_isfinite(X) (__builtin_isfinite(X))
+# endif
# elif defined(_MSC_VER)
# define SWIG_isfinite(X) (_finite(X))
# elif defined(__sun) && defined(__SVR4)
diff --git a/Lib/typemaps/swigmacros.swg b/Lib/typemaps/swigmacros.swg
index 3a63a256c..687b0680e 100644
--- a/Lib/typemaps/swigmacros.swg
+++ b/Lib/typemaps/swigmacros.swg
@@ -31,7 +31,7 @@
%as_voidptrptr(a) reinterpret_cast<void **>(a)
or their C unsafe versions. In C++ we use the safe version unless
- SWIG_NO_CPLUSPLUS_CAST is defined (usually via the -nocppcast swig flag).
+ SWIG_NO_CPLUSPLUS_CAST is defined
Memory allocation:
@@ -123,14 +123,7 @@ nocppval
* Casting operators
* ----------------------------------------------------------------------------- */
-#if defined(SWIG_NO_CPLUSPLUS_CAST)
-/* Disable 'modern' cplusplus casting operators */
-# if defined(SWIG_CPLUSPLUS_CAST)
-# undef SWIG_CPLUSPLUS_CAST
-# endif
-#endif
-
-#if defined(__cplusplus) && defined(SWIG_CPLUSPLUS_CAST)
+#if defined(__cplusplus) && !defined(SWIG_NO_CPLUSPLUS_CAST)
# define %const_cast(a,Type...) const_cast< Type >(a)
# define %static_cast(a,Type...) static_cast< Type >(a)
# define %reinterpret_cast(a,Type...) reinterpret_cast< Type >(a)
diff --git a/Lib/typemaps/swigtype.swg b/Lib/typemaps/swigtype.swg
index d3633eb49..581de1a90 100644
--- a/Lib/typemaps/swigtype.swg
+++ b/Lib/typemaps/swigtype.swg
@@ -358,46 +358,46 @@
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE & {
void *vptr = 0;
- int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL);
$1 = SWIG_CheckState(res);
}
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE && {
void *vptr = 0;
- int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL);
$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);
+ int res = SWIG_ConvertPtr($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %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);
+ int res = SWIG_ConvertPtr($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %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);
+ int res = SWIG_ConvertPtr($input, 0, $&descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag);
$1 = SWIG_CheckState(res);
}
#else
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE & {
void *vptr = 0;
- int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL);
$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);
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL);
$1 = SWIG_CheckState(res);
}
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE {
void *vptr = 0;
- int res = SWIG_ConvertPtr($input, &vptr, $&descriptor, 0);
+ int res = SWIG_ConvertPtr($input, &vptr, $&descriptor, SWIG_POINTER_NO_NULL);
$1 = SWIG_CheckState(res);
}
#endif
@@ -410,12 +410,16 @@
/* directorin */
-%typemap(directorin,noblock=1) SWIGTYPE *, SWIGTYPE *const& {
+%typemap(directorin,noblock=1) SWIGTYPE {
+ $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(new $1_ltype((const $1_ltype &)$1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags);
+%typemap(directorin,noblock=1) SWIGTYPE *const& {
+ $input = SWIG_NewPointerObj(%as_voidptr($1), $*descriptor, %newpointer_flags);
}
%typemap(directorin,noblock=1) SWIGTYPE & {
@@ -427,6 +431,7 @@
}
/* directorout */
+
#if defined(__cplusplus) && defined(%implicitconv_flag)
%typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int swig_res = 0) {
swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags | %implicitconv_flag);
@@ -462,6 +467,22 @@
}
%typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG)
+ SWIGTYPE *const&(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");
+ }
+ $1_ltype swig_temp = new $*1_ltype(($*1_ltype)swig_argp);
+ swig_acquire_ownership(swig_temp);
+ $result = swig_temp;
+}
+%typemap(directorfree,noblock=1,match="directorout") SWIGTYPE *const& {
+ if (director) {
+ SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr(*$input)));
+ }
+}
+
+%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)) {
@@ -584,6 +605,9 @@
}
#endif
+%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
+%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
+
/* ------------------------------------------------------------
* --- function ptr typemaps ---
* ------------------------------------------------------------ */
@@ -645,6 +669,8 @@
}
#endif
+%apply SWIGTYPE ((*)(ANY)) { SWIGTYPE ((* const)(ANY)) }
+
%apply SWIGTYPE * { SWIGTYPE *const }
/* ------------------------------------------------------------
diff --git a/Lib/windows.i b/Lib/windows.i
index 2c093dacc..3e4626196 100644
--- a/Lib/windows.i
+++ b/Lib/windows.i
@@ -112,6 +112,9 @@ typedef unsigned __int64 DWORD64, *PDWORD64;
// Types from winnt.h
typedef void *PVOID;
typedef void *PVOID64;
+#ifndef VOID
+#define VOID void
+#endif
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
diff --git a/METADATA b/METADATA
new file mode 100644
index 000000000..fff9de76f
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,18 @@
+name: "swig"
+description: "SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages."
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "http://www.swig.org/"
+ }
+ url {
+ type: GIT
+ value: "https://github.com/swig/swig.git"
+ }
+ version: "rel-4.0.1"
+ last_upgrade_date {
+ year: 2019
+ month: 10
+ day: 18
+ }
+}
diff --git a/Makefile.in b/Makefile.in
index df882ce34..39816bed5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -67,18 +67,10 @@ skip-guile = test -n "@SKIP_GUILE@"
skip-mzscheme = test -n "@SKIP_MZSCHEME@"
skip-ruby = test -n "@SKIP_RUBY@"
skip-php = test -n "@SKIP_PHP@"
-skip-php5 = test -n "@SKIP_PHP5@"
skip-ocaml = test -n "@SKIP_OCAML@"
skip-octave = test -n "@SKIP_OCTAVE@"
-skip-pike = test -n "@SKIP_PIKE@"
-skip-chicken = test -n "@SKIP_CHICKEN@"
skip-csharp = test -n "@SKIP_CSHARP@"
-skip-modula3 = test -n "@SKIP_MODULA3@"
skip-lua = test -n "@SKIP_LUA@"
-skip-allegrocl = test -n "@SKIP_ALLEGROCL@"
-skip-clisp = test -n "@SKIP_CLISP@"
-skip-cffi = test -n "@SKIP_CFFI@"
-skip-uffi = test -n "@SKIP_UFFI@"
skip-r = test -n "@SKIP_R@"
skip-scilab = test -n "@SKIP_SCILAB@"
skip-go = test -n "@SKIP_GO@"
@@ -86,7 +78,6 @@ skip-d = test -n "@SKIP_D@"
skip-javascript = test -n "@SKIP_JAVASCRIPT@"
# Additional dependencies for some tests
-skip-gcj = test -n "@SKIP_GCJ@"
skip-android = test -n "@SKIP_ANDROID@"
# Special errors test-case
@@ -119,15 +110,7 @@ check-aliveness:
@$(skip-ocaml) || ./$(TARGET) -ocaml -help
@$(skip-octave) || ./$(TARGET) -octave -help
@$(skip-php) || ./$(TARGET) -php7 -help
- @$(skip-php5) || ./$(TARGET) -php5 -help
- @$(skip-pike) || ./$(TARGET) -pike -help
- @$(skip-chicken) || ./$(TARGET) -chicken -help
@$(skip-csharp) || ./$(TARGET) -csharp -help
- @$(skip-modula3) || ./$(TARGET) -modula3 -help
- @$(skip-allegrocl)|| ./$(TARGET) -allegrocl -help
- @$(skip-clisp) || ./$(TARGET) -clisp -help
- @$(skip-uffi) || ./$(TARGET) -uffi -help
- @$(skip-cffi) || ./$(TARGET) -cffi -help
@$(skip-lua) || ./$(TARGET) -lua -help
@$(skip-r) || ./$(TARGET) -r -help
@$(skip-scilab) || ./$(TARGET) -scilab -help
@@ -152,16 +135,8 @@ check-versions: \
check-ocaml-version \
check-octave-version \
check-php-version \
- check-php5-version \
- check-pike-version \
- check-chicken-version \
check-csharp-version \
- check-modula3-version \
check-lua-version \
- check-allegrocl-version \
- check-clisp-version \
- check-uffi-version \
- check-cffi-version \
check-r-version \
check-scilab-version \
check-go-version \
@@ -193,16 +168,8 @@ check-examples: \
check-ocaml-examples \
check-octave-examples \
check-php-examples \
- check-php5-examples \
- check-pike-examples \
- check-chicken-examples \
check-csharp-examples \
- check-modula3-examples \
check-lua-examples \
- check-allegrocl-examples \
- check-clisp-examples \
- check-uffi-examples \
- check-cffi-examples \
check-r-examples \
check-scilab-examples \
check-go-examples \
@@ -220,16 +187,8 @@ ruby_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/ruby/check.list)
ocaml_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/ocaml/check.list)
octave_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/octave/check.list)
php_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/php/check.list)
-php5_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/php5/check.list)
-pike_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/pike/check.list)
-chicken_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/chicken/check.list)
csharp_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/csharp/check.list)
-modula3_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/modula3/check.list)
lua_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/lua/check.list)
-allegrocl_examples :=
-clisp_examples :=
-uffi_examples :=
-cffi_examples :=
r_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/r/check.list)
scilab_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/scilab/check.list)
go_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/go/check.list)
@@ -256,16 +215,6 @@ check-%-examples :
@echo $(ACTION)ing Examples/$(LANGUAGE)/$*
@(cd Examples/$(LANGUAGE)/$* && $(MAKE) $(FLAGS) $(ACTION) RUNPIPE=$(RUNPIPE))
-# gcj individual example
-java.actionexample:
- @cd Examples && $(MAKE) Makefile
- @if $(skip-gcj); then \
- echo "skipping Examples/$(LANGUAGE)/java $(ACTION) (gcj test)"; \
- else \
- echo $(ACTION)ing Examples/$(LANGUAGE)/java; \
- (cd Examples/$(LANGUAGE)/java && $(MAKE) $(FLAGS) $(ACTION) RUNPIPE=$(RUNPIPE)) \
- fi
-
# Checks testcases in the test-suite excluding those which are known to be broken
check-test-suite: \
check-errors-test-suite \
@@ -279,16 +228,8 @@ check-test-suite: \
check-ocaml-test-suite \
check-octave-test-suite \
check-php-test-suite \
- check-php5-test-suite \
- check-pike-test-suite \
check-csharp-test-suite \
- check-modula3-test-suite \
check-lua-test-suite \
- check-allegrocl-test-suite \
- check-clisp-test-suite \
- check-uffi-test-suite \
- check-cffi-test-suite \
- check-chicken-test-suite \
check-r-test-suite \
check-scilab-test-suite \
check-go-test-suite \
@@ -334,16 +275,8 @@ all-test-suite: \
all-ocaml-test-suite \
all-octave-test-suite \
all-php-test-suite \
- all-php5-test-suite \
- all-pike-test-suite \
all-csharp-test-suite \
- all-modula3-test-suite \
all-lua-test-suite \
- all-allegrocl-test-suite \
- all-clisp-test-suite \
- all-uffi-test-suite \
- all-cffi-test-suite \
- all-chicken-test-suite \
all-r-test-suite \
all-scilab-test-suite \
all-go-test-suite \
@@ -365,16 +298,8 @@ broken-test-suite: \
broken-ocaml-test-suite \
broken-octave-test-suite \
broken-php-test-suite \
- broken-php5-test-suite \
- broken-pike-test-suite \
broken-csharp-test-suite \
- broken-modula3-test-suite \
broken-lua-test-suite \
- broken-allegrocl-test-suite \
- broken-clisp-test-suite \
- broken-uffi-test-suite \
- broken-cffi-test-suite \
- broken-chicken-test-suite \
broken-r-test-suite \
broken-scilab-test-suite \
broken-go-test-suite \
@@ -487,7 +412,7 @@ check-maintainer-clean: maintainer-clean
$(srcdir)/Lib/swigwarn.swg: $(srcdir)/Source/Include/swigwarn.h
mkdir -p Lib
- echo "/* SWIG warning codes */" > $@
+ echo "/* SWIG warning codes - generated from swigwarn.h - do not edit */" > $@
cat $? | grep "^#define WARN\|/\*.*\*/\|^[ \t]*$$" | sed 's/^#define \(WARN.*[0-9][0-9]*\)\(.*\)$$/%define SWIG\1 %enddef\2/' >> $@
#####################################################################
@@ -510,9 +435,9 @@ install-main:
@echo "Installing $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@"
@$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@
-lib-languages = gcj typemaps tcl perl5 python guile java mzscheme ruby php php5 ocaml octave \
- pike chicken csharp modula3 allegrocl clisp lua cffi uffi r go d javascript javascript/jsc \
- javascript/v8 scilab
+lib-languages = typemaps tcl perl5 python guile java mzscheme ruby php ocaml octave \
+ csharp lua r go d javascript javascript/jsc \
+ javascript/v8 scilab xml
lib-modules = std
@@ -594,9 +519,9 @@ srcrpm:
# version 1.10 for our case of not having a top level Makefile.am. Until then we
# can fetch them manually and will have to commit them to Git.
configfiles:
- wget ftp://ftp.gnu.org/pub/gnu/config/config.guess -O Tools/config/config.guess
+ wget 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess' -O Tools/config/config.guess
chmod a+x Tools/config/config.guess
- wget ftp://ftp.gnu.org/pub/gnu/config/config.sub -O Tools/config/config.sub
+ wget 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub' -O Tools/config/config.sub
chmod a+x Tools/config/config.sub
# Regenerate Makefile if Makefile.in or config.status have changed.
diff --git a/OWNERS b/OWNERS
index 7b567cc24..3d61a5488 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,2 +1,3 @@
ezemtsov@google.com
labath@google.com
+hhb@google.com
diff --git a/README b/README
index c4c6b9c52..6d118335f 100644
--- a/README
+++ b/README
@@ -1,13 +1,11 @@
SWIG (Simplified Wrapper and Interface Generator)
-Version: 3.0.12 (27 Jan 2017)
+Version: 4.0.1 (21 Aug 2019)
Tagline: SWIG is a compiler that integrates C and C++ with languages
including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua,
- Octave, R, Scheme (Guile, MzScheme/Racket, CHICKEN), Scilab,
- Ocaml, Modula-3, Common Lisp (CLISP, Allegro CL, CFFI, UFFI)
- and Pike. SWIG can also export its parse tree into XML and
- Lisp s-expressions.
+ Octave, R, Scheme (Guile, MzScheme/Racket), Scilab, Ocaml.
+ SWIG can also export its parse tree into XML.
SWIG reads annotated C/C++ header files and creates wrapper code (glue
code) in order to make the corresponding C/C++ libraries available to
diff --git a/RELEASENOTES b/RELEASENOTES
index 5f6560c3c..8633dadef 100644
--- a/RELEASENOTES
+++ b/RELEASENOTES
@@ -7,6 +7,45 @@ Release Notes
Detailed release notes are available with the release and are also
published on the SWIG web site at http://swig.org/release.html.
+SWIG-4.0.1 summary:
+- SWIG now cleans up on error by removing all generated files.
+- Add Python 3.8 support.
+- Python Sphinx compatibility added for Doxygen comments.
+- Some minor regressions introduced in 4.0.0 were fixed.
+- Fix some C++17 compatibility problems in Python and Ruby generated
+ code.
+- Minor improvements/fixes for C#, Java, Javascript, Lua, MzScheme,
+ Ocaml, Octave and Python.
+
+SWIG-4.0.0 summary:
+- Support for Doxygen documentation comments which are parsed and
+ converted into JavaDoc or PyDoc comments.
+- STL wrappers improved for C#, Java and Ruby.
+- C++11 STL containers added for Java, Python and Ruby.
+- Improved support for parsing C++11 and C++14 code.
+- Various fixes for shared_ptr.
+- Various C preprocessor corner case fixes.
+- Corner case fixes for member function pointers.
+- Python module overhaul by simplifying the generated code and turning
+ most optimizations on by default.
+- %template improvements wrt scoping to align with C++ explicit
+ template instantiations.
+- Added support for a command-line options file (sometimes called a
+ response file).
+- Numerous enhancements and fixes for all supported target languages.
+- SWIG now classifies the status of target languages into either
+ 'Experimental' or 'Supported' to indicate the expected maturity
+ level.
+- Support for CFFI, Allegrocl, Chicken, CLISP, S-EXP, UFFI, Pike,
+ Modula3 has been removed.
+- Octave 4.4-5.1 support added.
+- PHP5 support removed, PHP7 is now the supported PHP version.
+- Minimum Python version required is now 2.7, 3.2-3.7 are the only
+ other versions supported.
+- Added support for Javascript NodeJS versions 2-10.
+- OCaml support is much improved and updated, minimum OCaml version
+ required is now 3.12.0.
+
SWIG-3.0.12 summary:
- Add support for Octave-4.2.
- Enhance %extend to support template functions.
diff --git a/Source/CParse/cparse.h b/Source/CParse/cparse.h
index 8079805e4..c67ffeaba 100644
--- a/Source/CParse/cparse.h
+++ b/Source/CParse/cparse.h
@@ -28,6 +28,7 @@ extern "C" {
extern int cparse_cplusplusout;
extern int cparse_start_line;
extern String *cparse_unknown_directive;
+ extern int scan_doxygen_comments;
extern void Swig_cparse_cplusplus(int);
extern void Swig_cparse_cplusplusout(int);
@@ -61,7 +62,7 @@ extern "C" {
extern void cparse_normalize_void(Node *);
extern Parm *Swig_cparse_parm(String *s);
extern ParmList *Swig_cparse_parms(String *s, Node *file_line_node);
- extern Node *new_node(const_String_or_char_ptr tag);
+ extern Node *Swig_cparse_new_node(const_String_or_char_ptr tag);
/* templ.c */
extern int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *tscope);
diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c
index 637ac9d60..4566817a0 100644
--- a/Source/CParse/cscanner.c
+++ b/Source/CParse/cscanner.c
@@ -50,6 +50,57 @@ static int last_brace = 0;
static int last_id = 0;
static int rename_active = 0;
+/* Doxygen comments scanning */
+int scan_doxygen_comments = 0;
+
+int isStructuralDoxygen(String *s) {
+ static const char* const structuralTags[] = {
+ "addtogroup",
+ "callgraph",
+ "callergraph",
+ "category",
+ "def",
+ "defgroup",
+ "dir",
+ "example",
+ "file",
+ "headerfile",
+ "internal",
+ "mainpage",
+ "name",
+ "nosubgrouping",
+ "overload",
+ "package",
+ "page",
+ "protocol",
+ "relates",
+ "relatesalso",
+ "showinitializer",
+ "weakgroup",
+ };
+
+ unsigned n;
+ char *slashPointer = Strchr(s, '\\');
+ char *atPointer = Strchr(s,'@');
+ if (slashPointer == NULL && atPointer == NULL)
+ return 0;
+ else if(slashPointer == NULL)
+ slashPointer = atPointer;
+
+ slashPointer++; /* skip backslash or at sign */
+
+ for (n = 0; n < sizeof(structuralTags)/sizeof(structuralTags[0]); n++) {
+ const size_t len = strlen(structuralTags[n]);
+ if (strncmp(slashPointer, structuralTags[n], len) == 0) {
+ /* Take care to avoid false positives with prefixes of other tags. */
+ if (slashPointer[len] == '\0' || isspace(slashPointer[len]))
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
/* -----------------------------------------------------------------------------
* Swig_cparse_cplusplus()
* ----------------------------------------------------------------------------- */
@@ -367,10 +418,70 @@ static int yylook(void) {
case SWIG_TOKEN_COMMENT:
{
- String *cmt = Scanner_text(scan);
- char *loc = Char(cmt);
- if ((strncmp(loc,"/*@SWIG",7) == 0) && (loc[Len(cmt)-3] == '@')) {
- Scanner_locator(scan, cmt);
+ typedef enum {
+ DOX_COMMENT_PRE = -1,
+ DOX_COMMENT_NONE,
+ DOX_COMMENT_POST
+ } comment_kind_t;
+ comment_kind_t existing_comment = DOX_COMMENT_NONE;
+
+ /* Concatenate or skip all consecutive comments at once. */
+ do {
+ String *cmt = Scanner_text(scan);
+ char *loc = Char(cmt);
+ if ((strncmp(loc, "/*@SWIG", 7) == 0) && (loc[Len(cmt)-3] == '@')) {
+ Scanner_locator(scan, cmt);
+ }
+ if (scan_doxygen_comments) { /* else just skip this node, to avoid crashes in parser module*/
+ /* Check for all possible Doxygen comment start markers while ignoring
+ comments starting with a row of asterisks or slashes just as
+ Doxygen itself does. */
+ if (Len(cmt) > 3 && loc[0] == '/' &&
+ ((loc[1] == '/' && ((loc[2] == '/' && loc[3] != '/') || loc[2] == '!')) ||
+ (loc[1] == '*' && ((loc[2] == '*' && loc[3] != '*') || loc[2] == '!')))) {
+ comment_kind_t this_comment = loc[3] == '<' ? DOX_COMMENT_POST : DOX_COMMENT_PRE;
+ if (existing_comment != DOX_COMMENT_NONE && this_comment != existing_comment) {
+ /* We can't concatenate together Doxygen pre- and post-comments. */
+ break;
+ }
+
+ if (this_comment == DOX_COMMENT_POST || !isStructuralDoxygen(loc)) {
+ String *str;
+
+ int begin = this_comment == DOX_COMMENT_POST ? 4 : 3;
+ int end = Len(cmt);
+ if (loc[end - 1] == '/' && loc[end - 2] == '*') {
+ end -= 2;
+ }
+
+ str = NewStringWithSize(loc + begin, end - begin);
+
+ if (existing_comment == DOX_COMMENT_NONE) {
+ yylval.str = str;
+ Setline(yylval.str, Scanner_start_line(scan));
+ Setfile(yylval.str, Scanner_file(scan));
+ } else {
+ Append(yylval.str, str);
+ }
+
+ existing_comment = this_comment;
+ }
+ }
+ }
+ do {
+ tok = Scanner_token(scan);
+ } while (tok == SWIG_TOKEN_ENDLINE);
+ } while (tok == SWIG_TOKEN_COMMENT);
+
+ Scanner_pushtoken(scan, tok, Scanner_text(scan));
+
+ switch (existing_comment) {
+ case DOX_COMMENT_PRE:
+ return DOXYGENSTRING;
+ case DOX_COMMENT_NONE:
+ break;
+ case DOX_COMMENT_POST:
+ return DOXYGENPOSTSTRING;
}
}
break;
@@ -907,6 +1018,8 @@ int yylex(void) {
return (ID);
case POUND:
return yylex();
+ case SWIG_TOKEN_COMMENT:
+ return yylex();
default:
return (l);
}
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index 0536f4c34..470b7d065 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -65,6 +65,13 @@ static int cparse_externc = 0;
int ignore_nested_classes = 0;
int kwargs_supported = 0;
/* -----------------------------------------------------------------------------
+ * Doxygen Comment Globals
+ * ----------------------------------------------------------------------------- */
+static String *currentDeclComment = NULL; /* Comment of C/C++ declaration. */
+static Node *previousNode = NULL; /* Pointer to the previous node (for post comments) */
+static Node *currentNode = NULL; /* Pointer to the current node (for post comments) */
+
+/* -----------------------------------------------------------------------------
* Assist Functions
* ----------------------------------------------------------------------------- */
@@ -75,6 +82,14 @@ static void yyerror (const char *e) {
(void)e;
}
+static Node *new_node(const_String_or_char_ptr tag) {
+ Node *n = Swig_cparse_new_node(tag);
+ /* Remember the previous node in case it will need a post-comment */
+ previousNode = currentNode;
+ currentNode = n;
+ return n;
+}
+
/* Copies a node. Does not copy tree links or symbol table data (except for
sym:name) */
@@ -151,6 +166,11 @@ static Node *copy_node(Node *n) {
Setattr(nn, "needs_defaultargs", "1");
continue;
}
+ /* same for abstracts, which contains pointers to the source node children, and so will need to be patch too */
+ if (strcmp(ckey,"abstracts") == 0) {
+ SetFlag(nn, "needs_abstracts");
+ continue;
+ }
/* Looks okay. Just copy the data using Copy */
ci = Copy(k.item);
Setattr(nn, key, ci);
@@ -159,6 +179,36 @@ static Node *copy_node(Node *n) {
return nn;
}
+static void set_comment(Node *n, String *comment) {
+ String *name;
+ Parm *p;
+ if (!n || !comment)
+ return;
+
+ if (Getattr(n, "doxygen"))
+ Append(Getattr(n, "doxygen"), comment);
+ else {
+ Setattr(n, "doxygen", comment);
+ /* This is the first comment, populate it with @params, if any */
+ p = Getattr(n, "parms");
+ while (p) {
+ if (Getattr(p, "doxygen"))
+ Printv(comment, "\n@param ", Getattr(p, "name"), Getattr(p, "doxygen"), NIL);
+ p=nextSibling(p);
+ }
+ }
+
+ /* Append same comment to every generated overload */
+ name = Getattr(n, "name");
+ if (!name)
+ return;
+ n = nextSibling(n);
+ while (n && Getattr(n, "name") && Strcmp(Getattr(n, "name"), name) == 0) {
+ Setattr(n, "doxygen", comment);
+ n = nextSibling(n);
+ }
+}
+
/* -----------------------------------------------------------------------------
* Variables
* ----------------------------------------------------------------------------- */
@@ -194,7 +244,7 @@ int SWIG_cparse_template_reduce(int treduce) {
* ----------------------------------------------------------------------------- */
static int promote_type(int t) {
- if (t <= T_UCHAR || t == T_CHAR) return T_INT;
+ if (t <= T_UCHAR || t == T_CHAR || t == T_WCHAR) return T_INT;
return t;
}
@@ -209,7 +259,7 @@ static String *yyrename = 0;
/* Forward renaming operator */
-static String *resolve_create_node_scope(String *cname);
+static String *resolve_create_node_scope(String *cname, int is_class_definition);
Hash *Swig_cparse_features(void) {
@@ -485,8 +535,19 @@ static void add_symbols(Node *n) {
SetFlag(n,"deleted");
SetFlag(n,"feature:ignore");
}
+ if (SwigType_isrvalue_reference(Getattr(n, "refqualifier"))) {
+ /* Ignore rvalue ref-qualifiers by default
+ * Use Getattr instead of GetFlag to handle explicit ignore and explicit not ignore */
+ if (!(Getattr(n, "feature:ignore") || Strncmp(symname, "$ignore", 7) == 0)) {
+ SWIG_WARN_NODE_BEGIN(n);
+ Swig_warning(WARN_TYPE_RVALUE_REF_QUALIFIER_IGNORED, Getfile(n), Getline(n),
+ "Method with rvalue ref-qualifier %s ignored.\n", Swig_name_decl(n));
+ SWIG_WARN_NODE_END(n);
+ SetFlag(n, "feature:ignore");
+ }
+ }
}
- if (only_csymbol || GetFlag(n,"feature:ignore") || strncmp(Char(symname),"$ignore",7) == 0) {
+ if (only_csymbol || GetFlag(n, "feature:ignore") || Strncmp(symname, "$ignore", 7) == 0) {
/* Only add to C symbol table and continue */
Swig_symbol_add(0, n);
if (!only_csymbol && !GetFlag(n, "feature:ignore")) {
@@ -501,7 +562,7 @@ static void add_symbols(Node *n) {
SetFlag(n, "feature:ignore");
}
if (!GetFlag(n, "feature:ignore") && Strcmp(symname,"$ignore") == 0) {
- /* Add feature:ignore if the symbol was explicitely ignored, regardless of visibility */
+ /* Add feature:ignore if the symbol was explicitly ignored, regardless of visibility */
SetFlag(n, "feature:ignore");
}
} else {
@@ -732,6 +793,22 @@ static List *pure_abstracts(Node *n) {
return abstracts;
}
+/* Recompute the "abstracts" attribute for the classes in instantiated templates, similarly to update_defaultargs() above. */
+static void update_abstracts(Node *n) {
+ for (; n; n = nextSibling(n)) {
+ Node* const child = firstChild(n);
+ if (!child)
+ continue;
+
+ update_abstracts(child);
+
+ if (Getattr(n, "needs_abstracts")) {
+ Setattr(n, "abstracts", pure_abstracts(child));
+ Delattr(n, "needs_abstracts");
+ }
+ }
+}
+
/* Make a classname */
static String *make_class_name(String *name) {
@@ -815,32 +892,53 @@ static String *remove_block(Node *kw, const String *inputcode) {
return modified_code;
}
-
+/*
+#define RESOLVE_DEBUG 1
+*/
static Node *nscope = 0;
static Node *nscope_inner = 0;
/* Remove the scope prefix from cname and return the base name without the prefix.
* The scopes required for the symbol name are resolved and/or created, if required.
* For example AA::BB::CC as input returns CC and creates the namespace AA then inner
- * namespace BB in the current scope. If cname is found to already exist as a weak symbol
- * (forward reference) then the scope might be changed to match, such as when a symbol match
- * is made via a using reference. */
-static String *resolve_create_node_scope(String *cname) {
+ * namespace BB in the current scope. */
+static String *resolve_create_node_scope(String *cname, int is_class_definition) {
Symtab *gscope = 0;
Node *cname_node = 0;
- int skip_lookup = 0;
+ String *last = Swig_scopename_last(cname);
nscope = 0;
nscope_inner = 0;
- if (Strncmp(cname,"::",2) == 0)
- skip_lookup = 1;
-
- cname_node = skip_lookup ? 0 : Swig_symbol_clookup_no_inherit(cname, 0);
+ if (Strncmp(cname,"::" ,2) != 0) {
+ if (is_class_definition) {
+ /* Only lookup symbols which are in scope via a using declaration but not via a using directive.
+ For example find y via 'using x::y' but not y via a 'using namespace x'. */
+ cname_node = Swig_symbol_clookup_no_inherit(cname, 0);
+ if (!cname_node) {
+ Node *full_lookup_node = Swig_symbol_clookup(cname, 0);
+ if (full_lookup_node) {
+ /* This finds a symbol brought into scope via both a using directive and a using declaration. */
+ Node *last_node = Swig_symbol_clookup_no_inherit(last, 0);
+ if (last_node == full_lookup_node)
+ cname_node = last_node;
+ }
+ }
+ } else {
+ /* For %template, the template needs to be in scope via any means. */
+ cname_node = Swig_symbol_clookup(cname, 0);
+ }
+ }
+#if RESOLVE_DEBUG
+ if (!cname_node)
+ Printf(stdout, "symbol does not yet exist (%d): [%s]\n", is_class_definition, cname);
+ else
+ Printf(stdout, "symbol does exist (%d): [%s]\n", is_class_definition, cname);
+#endif
if (cname_node) {
/* The symbol has been defined already or is in another scope.
- If it is a weak symbol, it needs replacing and if it was brought into the current scope
- via a using declaration, the scope needs adjusting appropriately for the new symbol.
+ If it is a weak symbol, it needs replacing and if it was brought into the current scope,
+ the scope needs adjusting appropriately for the new symbol.
Similarly for defined templates. */
Symtab *symtab = Getattr(cname_node, "sym:symtab");
Node *sym_weak = Getattr(cname_node, "sym:weak");
@@ -848,48 +946,92 @@ static String *resolve_create_node_scope(String *cname) {
/* Check if the scope is the current scope */
String *current_scopename = Swig_symbol_qualifiedscopename(0);
String *found_scopename = Swig_symbol_qualifiedscopename(symtab);
- int len;
if (!current_scopename)
current_scopename = NewString("");
if (!found_scopename)
found_scopename = NewString("");
- len = Len(current_scopename);
- if ((len > 0) && (Strncmp(current_scopename, found_scopename, len) == 0)) {
- if (Len(found_scopename) > len + 2) {
- /* A matching weak symbol was found in non-global scope, some scope adjustment may be required */
- String *new_cname = NewString(Char(found_scopename) + len + 2); /* skip over "::" prefix */
- String *base = Swig_scopename_last(cname);
- Printf(new_cname, "::%s", base);
- cname = new_cname;
- Delete(base);
- } else {
- /* A matching weak symbol was found in the same non-global local scope, no scope adjustment required */
- assert(len == Len(found_scopename));
+
+ {
+ int fail = 1;
+ List *current_scopes = Swig_scopename_tolist(current_scopename);
+ List *found_scopes = Swig_scopename_tolist(found_scopename);
+ Iterator cit = First(current_scopes);
+ Iterator fit = First(found_scopes);
+#if RESOLVE_DEBUG
+Printf(stdout, "comparing current: [%s] found: [%s]\n", current_scopename, found_scopename);
+#endif
+ for (; fit.item && cit.item; fit = Next(fit), cit = Next(cit)) {
+ String *current = cit.item;
+ String *found = fit.item;
+#if RESOLVE_DEBUG
+ Printf(stdout, " looping %s %s\n", current, found);
+#endif
+ if (Strcmp(current, found) != 0)
+ break;
}
- } else {
- String *base = Swig_scopename_last(cname);
- if (Len(found_scopename) > 0) {
- /* A matching weak symbol was found in a different scope to the local scope - probably via a using declaration */
- cname = NewStringf("%s::%s", found_scopename, base);
+
+ if (!cit.item) {
+ String *subscope = NewString("");
+ for (; fit.item; fit = Next(fit)) {
+ if (Len(subscope) > 0)
+ Append(subscope, "::");
+ Append(subscope, fit.item);
+ }
+ if (Len(subscope) > 0)
+ cname = NewStringf("%s::%s", subscope, last);
+ else
+ cname = Copy(last);
+#if RESOLVE_DEBUG
+ Printf(stdout, "subscope to create: [%s] cname: [%s]\n", subscope, cname);
+#endif
+ fail = 0;
+ Delete(subscope);
} else {
- /* Either:
- 1) A matching weak symbol was found in a different scope to the local scope - this is actually a
- symbol with the same name in a different scope which we don't want, so no adjustment required.
- 2) A matching weak symbol was found in the global scope - no adjustment required.
- */
- cname = Copy(base);
+ if (is_class_definition) {
+ if (!fit.item) {
+ /* It is valid to define a new class with the same name as one forward declared in a parent scope */
+ fail = 0;
+ } else if (Swig_scopename_check(cname)) {
+ /* Classes defined with scope qualifiers must have a matching forward declaration in matching scope */
+ fail = 1;
+ } else {
+ /* This may let through some invalid cases */
+ fail = 0;
+ }
+#if RESOLVE_DEBUG
+ Printf(stdout, "scope for class definition, fail: %d\n", fail);
+#endif
+ } else {
+#if RESOLVE_DEBUG
+ Printf(stdout, "no matching base scope for template\n");
+#endif
+ fail = 1;
+ }
+ }
+
+ Delete(found_scopes);
+ Delete(current_scopes);
+
+ if (fail) {
+ String *cname_resolved = NewStringf("%s::%s", found_scopename, last);
+ Swig_error(cparse_file, cparse_line, "'%s' resolves to '%s' and was incorrectly instantiated in scope '%s' instead of within scope '%s'.\n", cname, cname_resolved, current_scopename, found_scopename);
+ cname = Copy(last);
+ Delete(cname_resolved);
}
- Delete(base);
}
+
Delete(current_scopename);
Delete(found_scopename);
}
+ } else if (!is_class_definition) {
+ /* A template instantiation requires a template to be found in scope... fail here too?
+ Swig_error(cparse_file, cparse_line, "No template found to instantiate '%s' with %%template.\n", cname);
+ */
}
if (Swig_scopename_check(cname)) {
Node *ns;
String *prefix = Swig_scopename_prefix(cname);
- String *base = Swig_scopename_last(cname);
if (prefix && (Strncmp(prefix,"::",2) == 0)) {
/* I don't think we can use :: global scope to declare classes and hence neither %template. - consider reporting error instead - wsfulton. */
/* Use the global scope */
@@ -899,6 +1041,7 @@ static String *resolve_create_node_scope(String *cname) {
gscope = set_scope_to_global();
}
if (Len(prefix) == 0) {
+ String *base = Copy(last);
/* Use the global scope, but we need to add a 'global' namespace. */
if (!gscope) gscope = set_scope_to_global();
/* note that this namespace is not the "unnamed" one,
@@ -907,6 +1050,7 @@ static String *resolve_create_node_scope(String *cname) {
nscope = new_node("namespace");
Setattr(nscope,"symtab", gscope);;
nscope_inner = nscope;
+ Delete(last);
return base;
}
/* Try to locate the scope */
@@ -924,7 +1068,7 @@ static String *resolve_create_node_scope(String *cname) {
String *nname = Swig_symbol_qualifiedscopename(nstab);
if (tname && (Strcmp(tname,nname) == 0)) {
ns = 0;
- cname = base;
+ cname = Copy(last);
}
Delete(tname);
Delete(nname);
@@ -932,19 +1076,10 @@ static String *resolve_create_node_scope(String *cname) {
if (ns) {
/* we will try to create a new node using the namespaces we
can find in the scope name */
- List *scopes;
+ List *scopes = Swig_scopename_tolist(prefix);
String *sname;
Iterator si;
- String *name = NewString(prefix);
- scopes = NewList();
- while (name) {
- String *base = Swig_scopename_last(name);
- String *tprefix = Swig_scopename_prefix(name);
- Insert(scopes,0,base);
- Delete(base);
- Delete(name);
- name = tprefix;
- }
+
for (si = First(scopes); si.item; si = Next(si)) {
Node *ns1,*ns2;
sname = si.item;
@@ -990,12 +1125,13 @@ static String *resolve_create_node_scope(String *cname) {
nscope_inner = ns2;
if (!nscope) nscope = ns2;
}
- cname = base;
+ cname = Copy(last);
Delete(scopes);
}
}
Delete(prefix);
}
+ Delete(last);
return cname;
}
@@ -1351,6 +1487,56 @@ static void mark_nodes_as_extend(Node *n) {
}
}
+/* -----------------------------------------------------------------------------
+ * add_qualifier_to_declarator()
+ *
+ * Normally the qualifier is pushed on to the front of the type.
+ * Adding a qualifier to a pointer to member function is a special case.
+ * For example : typedef double (Cls::*pmf)(void) const;
+ * The qualifier is : q(const).
+ * The declarator is : m(Cls).f(void).
+ * We need : m(Cls).q(const).f(void).
+ * ----------------------------------------------------------------------------- */
+
+static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) {
+ int is_pointer_to_member_function = 0;
+ String *decl = Copy(type);
+ String *poppedtype = NewString("");
+ assert(qualifier);
+
+ while (decl) {
+ if (SwigType_ismemberpointer(decl)) {
+ String *memberptr = SwigType_pop(decl);
+ if (SwigType_isfunction(decl)) {
+ is_pointer_to_member_function = 1;
+ SwigType_push(decl, qualifier);
+ SwigType_push(decl, memberptr);
+ Insert(decl, 0, poppedtype);
+ Delete(memberptr);
+ break;
+ } else {
+ Append(poppedtype, memberptr);
+ }
+ Delete(memberptr);
+ } else {
+ String *popped = SwigType_pop(decl);
+ if (!popped)
+ break;
+ Append(poppedtype, popped);
+ Delete(popped);
+ }
+ }
+
+ if (!is_pointer_to_member_function) {
+ Delete(decl);
+ decl = Copy(type);
+ SwigType_push(decl, qualifier);
+ }
+
+ Delete(poppedtype);
+ return decl;
+}
+
%}
%union {
@@ -1361,10 +1547,12 @@ static void mark_nodes_as_extend(Node *n) {
String *rawval;
int type;
String *qualifier;
+ String *refqualifier;
String *bitfield;
Parm *throws;
String *throwf;
String *nexcept;
+ String *final;
} dtype;
struct {
const char *type;
@@ -1380,6 +1568,7 @@ static void mark_nodes_as_extend(Node *n) {
ParmList *throws;
String *throwf;
String *nexcept;
+ String *final;
} decl;
Parm *tparms;
struct {
@@ -1432,6 +1621,9 @@ static void mark_nodes_as_extend(Node *n) {
%token <str> CONVERSIONOPERATOR
%token PARSETYPE PARSEPARM PARSEPARMS
+%token <str> DOXYGENSTRING
+%token <str> DOXYGENPOSTSTRING
+
%left CAST
%left QUESTIONMARK
%left LOR
@@ -1458,23 +1650,23 @@ static void mark_nodes_as_extend(Node *n) {
/* C declarations */
%type <node> c_declaration c_decl c_decl_tail c_enum_key c_enum_inherit c_enum_decl c_enum_forward_decl c_constructor_decl;
-%type <node> enumlist edecl;
+%type <node> enumlist enumlist_item edecl_with_dox edecl;
/* C++ declarations */
%type <node> cpp_declaration cpp_class_decl cpp_forward_class_decl cpp_template_decl cpp_alternate_rettype;
-%type <node> cpp_members cpp_member;
+%type <node> cpp_members cpp_member cpp_member_no_dox;
%type <node> cpp_constructor_decl cpp_destructor_decl cpp_protection_decl cpp_conversion_operator cpp_static_assert;
-%type <node> cpp_swig_directive cpp_temp_possible cpp_opt_declarators ;
+%type <node> cpp_swig_directive cpp_template_possible cpp_opt_declarators ;
%type <node> cpp_using_decl cpp_namespace_decl cpp_catch_decl cpp_lambda_decl;
%type <node> kwargs options;
/* Misc */
%type <id> identifier;
-%type <dtype> initializer cpp_const exception_specification;
+%type <dtype> initializer cpp_const exception_specification cv_ref_qualifier qualifiers_exception_specification;
%type <id> storage_class extern_string;
%type <pl> parms ptail rawparms varargs_parms ;
%type <pl> templateparameters templateparameterstail;
-%type <p> parm valparm rawvalparms valparms valptail ;
+%type <p> parm_no_dox parm valparm rawvalparms valparms valptail ;
%type <p> typemap_parm tm_list tm_tail ;
%type <p> templateparameter ;
%type <id> templcpptype cpptype classkey classkeyopt access_specifier;
@@ -1483,10 +1675,11 @@ static void mark_nodes_as_extend(Node *n) {
%type <type> type rawtype type_right anon_bitfield_type decltype ;
%type <bases> base_list inherit raw_inherit;
%type <dtype> definetype def_args etype default_delete deleted_definition explicit_default;
-%type <dtype> expr exprnum exprcompound valexpr;
+%type <dtype> expr exprnum exprcompound valexpr exprmem;
%type <id> ename ;
%type <id> less_valparms_greater;
-%type <str> type_qualifier ;
+%type <str> type_qualifier;
+%type <str> ref_qualifier;
%type <id> type_qualifier_raw;
%type <id> idstring idstringopt;
%type <id> pragma_lang;
@@ -1506,8 +1699,7 @@ static void mark_nodes_as_extend(Node *n) {
%type <node> featattr;
%type <node> lambda_introducer lambda_body;
%type <pl> lambda_tail;
-%type <node> optional_constant_directive;
-%type <str> virt_specifier_seq;
+%type <str> virt_specifier_seq virt_specifier_seq_opt;
%%
@@ -1553,9 +1745,24 @@ program : interface {
interface : interface declaration {
/* add declaration to end of linked list (the declaration isn't always a single declaration, sometimes it is a linked list itself) */
+ if (currentDeclComment != NULL) {
+ set_comment($2, currentDeclComment);
+ currentDeclComment = NULL;
+ }
appendChild($1,$2);
$$ = $1;
}
+ | interface DOXYGENSTRING {
+ currentDeclComment = $2;
+ $$ = $1;
+ }
+ | interface DOXYGENPOSTSTRING {
+ Node *node = lastChild($1);
+ if (node) {
+ set_comment(node, $2);
+ }
+ $$ = $1;
+ }
| empty {
$$ = new_node("top");
}
@@ -1572,7 +1779,7 @@ declaration : swig_directive { $$ = $1; }
} else {
Swig_error(cparse_file, cparse_line, "Syntax error in input(1).\n");
}
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
/* Out of class constructor/destructor declarations */
| c_constructor_decl {
@@ -1751,7 +1958,6 @@ constant_directive : CONSTANT identifier EQUAL definetype SEMI {
}
}
-
| CONSTANT type declarator def_args SEMI {
if (($4.type != T_ERROR) && ($4.type != T_SYMBOL)) {
SwigType_push($2,$3.type);
@@ -1768,12 +1974,38 @@ constant_directive : CONSTANT identifier EQUAL definetype SEMI {
SetFlag($$,"feature:immutable");
add_symbols($$);
} else {
- if ($4.type == T_ERROR) {
- Swig_warning(WARN_PARSE_UNSUPPORTED_VALUE,cparse_file,cparse_line,"Unsupported constant value\n");
- }
+ if ($4.type == T_ERROR) {
+ Swig_warning(WARN_PARSE_UNSUPPORTED_VALUE,cparse_file,cparse_line, "Unsupported constant value\n");
+ }
$$ = 0;
}
}
+ /* Member function pointers with qualifiers. eg.
+ %constant short (Funcs::*pmf)(bool) const = &Funcs::F; */
+ | CONSTANT type direct_declarator LPAREN parms RPAREN cv_ref_qualifier def_args SEMI {
+ if (($8.type != T_ERROR) && ($8.type != T_SYMBOL)) {
+ SwigType_add_function($2, $5);
+ SwigType_push($2, $7.qualifier);
+ SwigType_push($2, $3.type);
+ /* Sneaky callback function trick */
+ if (SwigType_isfunction($2)) {
+ SwigType_add_pointer($2);
+ }
+ $$ = new_node("constant");
+ Setattr($$, "name", $3.id);
+ Setattr($$, "type", $2);
+ Setattr($$, "value", $8.val);
+ if ($8.rawval) Setattr($$, "rawval", $8.rawval);
+ Setattr($$, "storage", "%constant");
+ SetFlag($$, "feature:immutable");
+ add_symbols($$);
+ } else {
+ if ($8.type == T_ERROR) {
+ Swig_warning(WARN_PARSE_UNSUPPORTED_VALUE,cparse_file,cparse_line, "Unsupported constant value\n");
+ }
+ $$ = 0;
+ }
+ }
| CONSTANT error SEMI {
Swig_warning(WARN_PARSE_BAD_VALUE,cparse_file,cparse_line,"Bad constant value (ignored).\n");
$$ = 0;
@@ -2575,9 +2807,8 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
tscope = Swig_symbol_current(); /* Get the current scope */
/* If the class name is qualified, we need to create or lookup namespace entries */
- if (!inclass) {
- $5 = resolve_create_node_scope($5);
- }
+ $5 = resolve_create_node_scope($5, 0);
+
if (nscope_inner && Strcmp(nodeType(nscope_inner), "class") == 0) {
outer_class = nscope_inner;
}
@@ -2733,7 +2964,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
Swig_cparse_template_expand(templnode,nname,temparms,tscope);
Setattr(templnode,"sym:name",nname);
Delete(nname);
- Setattr(templnode,"feature:onlychildren", "typemap,typemapitem,typemapcopy,typedef,types,fragment");
+ Setattr(templnode,"feature:onlychildren", "typemap,typemapitem,typemapcopy,typedef,types,fragment,apply");
if ($3) {
Swig_warning(WARN_PARSE_NESTED_TEMPLATE, cparse_file, cparse_line, "Named nested template instantiations not supported. Processing as if no name was given to %%template().\n");
}
@@ -2848,6 +3079,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
nn = Getattr(nn,"sym:nextSibling"); /* repeat for overloaded templated functions. If a templated class there will never be a sibling. */
}
update_defaultargs(linkliststart);
+ update_abstracts(linkliststart);
}
Swig_symbol_setscope(tscope);
Delete(Namespaceprefix);
@@ -2935,40 +3167,47 @@ c_declaration : c_decl {
SetFlag($$,"aliastemplate");
add_symbols($$);
}
+ | cpp_static_assert {
+ $$ = $1;
+ }
;
/* ------------------------------------------------------------
A C global declaration of some kind (may be variable, function, typedef, etc.)
------------------------------------------------------------ */
-c_decl : storage_class type declarator initializer c_decl_tail {
+c_decl : storage_class type declarator cpp_const initializer c_decl_tail {
+ String *decl = $3.type;
$$ = new_node("cdecl");
- if ($4.qualifier) SwigType_push($3.type,$4.qualifier);
+ if ($4.qualifier)
+ decl = add_qualifier_to_declarator($3.type, $4.qualifier);
+ Setattr($$,"refqualifier",$4.refqualifier);
Setattr($$,"type",$2);
Setattr($$,"storage",$1);
Setattr($$,"name",$3.id);
- Setattr($$,"decl",$3.type);
+ Setattr($$,"decl",decl);
Setattr($$,"parms",$3.parms);
- Setattr($$,"value",$4.val);
+ Setattr($$,"value",$5.val);
Setattr($$,"throws",$4.throws);
Setattr($$,"throw",$4.throwf);
Setattr($$,"noexcept",$4.nexcept);
- if ($4.val && $4.type) {
+ Setattr($$,"final",$4.final);
+ if ($5.val && $5.type) {
/* store initializer type as it might be different to the declared type */
- SwigType *valuetype = NewSwigType($4.type);
+ SwigType *valuetype = NewSwigType($5.type);
if (Len(valuetype) > 0)
Setattr($$,"valuetype",valuetype);
else
Delete(valuetype);
}
- if (!$5) {
+ if (!$6) {
if (Len(scanner_ccode)) {
String *code = Copy(scanner_ccode);
Setattr($$,"code",code);
Delete(code);
}
} else {
- Node *n = $5;
+ Node *n = $6;
/* Inherit attributes */
while (n) {
String *type = Copy($2);
@@ -2978,67 +3217,77 @@ c_decl : storage_class type declarator initializer c_decl_tail {
Delete(type);
}
}
- if ($4.bitfield) {
- Setattr($$,"bitfield", $4.bitfield);
+ if ($5.bitfield) {
+ Setattr($$,"bitfield", $5.bitfield);
}
- /* Look for "::" declarations (ignored) */
- if (Strstr($3.id,"::")) {
- /* This is a special case. If the scope name of the declaration exactly
- matches that of the declaration, then we will allow it. Otherwise, delete. */
- String *p = Swig_scopename_prefix($3.id);
- if (p) {
- if ((Namespaceprefix && Strcmp(p, Namespaceprefix) == 0) ||
- (Classprefix && Strcmp(p, Classprefix) == 0)) {
- String *lstr = Swig_scopename_last($3.id);
- Setattr($$,"name",lstr);
- Delete(lstr);
- set_nextSibling($$,$5);
+ if ($3.id) {
+ /* Look for "::" declarations (ignored) */
+ if (Strstr($3.id, "::")) {
+ /* This is a special case. If the scope name of the declaration exactly
+ matches that of the declaration, then we will allow it. Otherwise, delete. */
+ String *p = Swig_scopename_prefix($3.id);
+ if (p) {
+ if ((Namespaceprefix && Strcmp(p, Namespaceprefix) == 0) ||
+ (Classprefix && Strcmp(p, Classprefix) == 0)) {
+ String *lstr = Swig_scopename_last($3.id);
+ Setattr($$, "name", lstr);
+ Delete(lstr);
+ set_nextSibling($$, $6);
+ } else {
+ Delete($$);
+ $$ = $6;
+ }
+ Delete(p);
} else {
Delete($$);
- $$ = $5;
+ $$ = $6;
}
- Delete(p);
} else {
- Delete($$);
- $$ = $5;
+ set_nextSibling($$, $6);
}
} else {
- set_nextSibling($$,$5);
+ Swig_error(cparse_file, cparse_line, "Missing symbol name for global declaration\n");
+ $$ = 0;
}
+
+ if ($4.qualifier && $1 && Strstr($1, "static"))
+ Swig_error(cparse_file, cparse_line, "Static function %s cannot have a qualifier.\n", Swig_name_decl($$));
}
/* Alternate function syntax introduced in C++11:
auto funcName(int x, int y) -> int; */
- | storage_class AUTO declarator ARROW cpp_alternate_rettype initializer c_decl_tail {
+ | storage_class AUTO declarator cpp_const ARROW cpp_alternate_rettype virt_specifier_seq_opt initializer c_decl_tail {
$$ = new_node("cdecl");
- if ($6.qualifier) SwigType_push($3.type,$6.qualifier);
- Setattr($$,"type",$5);
+ if ($4.qualifier) SwigType_push($3.type, $4.qualifier);
+ Setattr($$,"refqualifier",$4.refqualifier);
+ Setattr($$,"type",$6);
Setattr($$,"storage",$1);
Setattr($$,"name",$3.id);
Setattr($$,"decl",$3.type);
Setattr($$,"parms",$3.parms);
- Setattr($$,"value",$6.val);
- Setattr($$,"throws",$6.throws);
- Setattr($$,"throw",$6.throwf);
- Setattr($$,"noexcept",$6.nexcept);
- if (!$7) {
+ Setattr($$,"value",$4.val);
+ Setattr($$,"throws",$4.throws);
+ Setattr($$,"throw",$4.throwf);
+ Setattr($$,"noexcept",$4.nexcept);
+ Setattr($$,"final",$4.final);
+ if (!$9) {
if (Len(scanner_ccode)) {
String *code = Copy(scanner_ccode);
Setattr($$,"code",code);
Delete(code);
}
} else {
- Node *n = $7;
+ Node *n = $9;
while (n) {
- String *type = Copy($5);
+ String *type = Copy($6);
Setattr(n,"type",type);
Setattr(n,"storage",$1);
n = nextSibling(n);
Delete(type);
}
}
- if ($6.bitfield) {
- Setattr($$,"bitfield", $6.bitfield);
+ if ($4.bitfield) {
+ Setattr($$,"bitfield", $4.bitfield);
}
if (Strstr($3.id,"::")) {
@@ -3049,19 +3298,22 @@ c_decl : storage_class type declarator initializer c_decl_tail {
String *lstr = Swig_scopename_last($3.id);
Setattr($$,"name",lstr);
Delete(lstr);
- set_nextSibling($$,$7);
+ set_nextSibling($$, $9);
} else {
Delete($$);
- $$ = $7;
+ $$ = $9;
}
Delete(p);
} else {
Delete($$);
- $$ = $7;
+ $$ = $9;
}
} else {
- set_nextSibling($$,$7);
+ set_nextSibling($$, $9);
}
+
+ if ($4.qualifier && $1 && Strstr($1, "static"))
+ Swig_error(cparse_file, cparse_line, "Static function %s cannot have a qualifier.\n", Swig_name_decl($$));
}
;
@@ -3071,27 +3323,29 @@ c_decl_tail : SEMI {
$$ = 0;
Clear(scanner_ccode);
}
- | COMMA declarator initializer c_decl_tail {
+ | COMMA declarator cpp_const initializer c_decl_tail {
$$ = new_node("cdecl");
if ($3.qualifier) SwigType_push($2.type,$3.qualifier);
+ Setattr($$,"refqualifier",$3.refqualifier);
Setattr($$,"name",$2.id);
Setattr($$,"decl",$2.type);
Setattr($$,"parms",$2.parms);
- Setattr($$,"value",$3.val);
+ Setattr($$,"value",$4.val);
Setattr($$,"throws",$3.throws);
Setattr($$,"throw",$3.throwf);
Setattr($$,"noexcept",$3.nexcept);
- if ($3.bitfield) {
- Setattr($$,"bitfield", $3.bitfield);
+ Setattr($$,"final",$3.final);
+ if ($4.bitfield) {
+ Setattr($$,"bitfield", $4.bitfield);
}
- if (!$4) {
+ if (!$5) {
if (Len(scanner_ccode)) {
String *code = Copy(scanner_ccode);
Setattr($$,"code",code);
Delete(code);
}
} else {
- set_nextSibling($$,$4);
+ set_nextSibling($$, $5);
}
}
| LBRACE {
@@ -3105,37 +3359,12 @@ c_decl_tail : SEMI {
} else {
Swig_error(cparse_file, cparse_line, "Syntax error - possibly a missing semicolon.\n");
}
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
;
-initializer : def_args {
- $$ = $1;
- $$.qualifier = 0;
- $$.throws = 0;
- $$.throwf = 0;
- $$.nexcept = 0;
- }
- | type_qualifier def_args {
- $$ = $2;
- $$.qualifier = $1;
- $$.throws = 0;
- $$.throwf = 0;
- $$.nexcept = 0;
- }
- | exception_specification def_args {
- $$ = $2;
- $$.qualifier = 0;
- $$.throws = $1.throws;
- $$.throwf = $1.throwf;
- $$.nexcept = $1.nexcept;
- }
- | type_qualifier exception_specification def_args {
- $$ = $3;
- $$.qualifier = $1;
- $$.throws = $2.throws;
- $$.throwf = $2.throwf;
- $$.nexcept = $2.nexcept;
+initializer : def_args {
+ $$ = $1;
}
;
@@ -3278,7 +3507,7 @@ c_enum_decl : storage_class c_enum_key ename c_enum_inherit LBRACE enumlist RBR
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
}
}
- | storage_class c_enum_key ename c_enum_inherit LBRACE enumlist RBRACE declarator initializer c_decl_tail {
+ | storage_class c_enum_key ename c_enum_inherit LBRACE enumlist RBRACE declarator cpp_const initializer c_decl_tail {
Node *n;
SwigType *ty = 0;
String *unnamed = 0;
@@ -3325,8 +3554,8 @@ c_enum_decl : storage_class c_enum_key ename c_enum_inherit LBRACE enumlist RBR
SetFlag(n,"unnamedinstance");
Delete(cty);
}
- if ($10) {
- Node *p = $10;
+ if ($11) {
+ Node *p = $11;
set_nextSibling(n,p);
while (p) {
SwigType *cty = Copy(ty);
@@ -3414,12 +3643,13 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
Setattr($$,"throws",$6.throws);
Setattr($$,"throw",$6.throwf);
Setattr($$,"noexcept",$6.nexcept);
+ Setattr($$,"final",$6.final);
err = 0;
}
}
if (err) {
Swig_error(cparse_file,cparse_line,"Syntax error in input(2).\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
;
@@ -3457,7 +3687,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
Setattr($<node>$,"prev_symtab",Swig_symbol_current());
/* If the class name is qualified. We need to create or lookup namespace/scope entries */
- scope = resolve_create_node_scope($3);
+ scope = resolve_create_node_scope($3, 1);
/* save nscope_inner to the class - it may be overwritten in nested classes*/
Setattr($<node>$, "nested:innerscope", nscope_inner);
Setattr($<node>$, "nested:nscope", nscope);
@@ -3649,7 +3879,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
if ($9) {
appendSibling($$, $9);
}
- } else if (!SwigType_istemplate(ty) && template_parameters == 0) { /* for tempalte we need the class itself */
+ } else if (!SwigType_istemplate(ty) && template_parameters == 0) { /* for template we need the class itself */
$$ = $9;
}
} else {
@@ -3660,6 +3890,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
while (Getattr(outer, "nested:outer"))
outer = Getattr(outer, "nested:outer");
appendSibling(outer, $$);
+ Swig_symbol_setscope(cscope); /* declaration goes in the parent scope */
add_symbols($9);
set_scope_to_global();
Delete(Namespaceprefix);
@@ -3834,12 +4065,12 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
;
cpp_opt_declarators : SEMI { $$ = 0; }
- | declarator initializer c_decl_tail {
+ | declarator cpp_const initializer c_decl_tail {
$$ = new_node("cdecl");
Setattr($$,"name",$1.id);
Setattr($$,"decl",$1.type);
Setattr($$,"parms",$1.parms);
- set_nextSibling($$,$3);
+ set_nextSibling($$, $4);
}
;
/* ------------------------------------------------------------
@@ -3869,7 +4100,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN {
Setattr(currentOuterClass, "template_parameters", template_parameters);
template_parameters = $3;
parsing_template_declaration = 1;
- } cpp_temp_possible {
+ } cpp_template_possible {
String *tname = 0;
int error = 0;
@@ -4137,7 +4368,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN {
}
;
-cpp_temp_possible: c_decl {
+cpp_template_possible: c_decl {
$$ = $1;
}
| cpp_class_decl {
@@ -4146,9 +4377,6 @@ cpp_temp_possible: c_decl {
| cpp_constructor_decl {
$$ = $1;
}
- | cpp_static_assert {
- $$ = $1;
- }
| cpp_template_decl {
$$ = 0;
}
@@ -4263,32 +4491,61 @@ cpp_using_decl : USING idcolon SEMI {
cpp_namespace_decl : NAMESPACE idcolon LBRACE {
Hash *h;
- $1 = Swig_symbol_current();
- h = Swig_symbol_clookup($2,0);
- if (h && ($1 == Getattr(h,"sym:symtab")) && (Strcmp(nodeType(h),"namespace") == 0)) {
- if (Getattr(h,"alias")) {
- h = Getattr(h,"namespace");
- Swig_warning(WARN_PARSE_NAMESPACE_ALIAS, cparse_file, cparse_line, "Namespace alias '%s' not allowed here. Assuming '%s'\n",
- $2, Getattr(h,"name"));
- $2 = Getattr(h,"name");
+ Node *parent_ns = 0;
+ List *scopes = Swig_scopename_tolist($2);
+ int ilen = Len(scopes);
+ int i;
+
+/*
+Printf(stdout, "==== Namespace %s creation...\n", $2);
+*/
+ $<node>$ = 0;
+ for (i = 0; i < ilen; i++) {
+ Node *ns = new_node("namespace");
+ Symtab *current_symtab = Swig_symbol_current();
+ String *scopename = Getitem(scopes, i);
+ Setattr(ns, "name", scopename);
+ $<node>$ = ns;
+ if (parent_ns)
+ appendChild(parent_ns, ns);
+ parent_ns = ns;
+ h = Swig_symbol_clookup(scopename, 0);
+ if (h && (current_symtab == Getattr(h, "sym:symtab")) && (Strcmp(nodeType(h), "namespace") == 0)) {
+/*
+Printf(stdout, " Scope %s [found C++17 style]\n", scopename);
+*/
+ if (Getattr(h, "alias")) {
+ h = Getattr(h, "namespace");
+ Swig_warning(WARN_PARSE_NAMESPACE_ALIAS, cparse_file, cparse_line, "Namespace alias '%s' not allowed here. Assuming '%s'\n",
+ scopename, Getattr(h, "name"));
+ scopename = Getattr(h, "name");
+ }
+ Swig_symbol_setscope(Getattr(h, "symtab"));
+ } else {
+/*
+Printf(stdout, " Scope %s [creating single scope C++17 style]\n", scopename);
+*/
+ h = Swig_symbol_newscope();
+ Swig_symbol_setscopename(scopename);
}
- Swig_symbol_setscope(Getattr(h,"symtab"));
- } else {
- Swig_symbol_newscope();
- Swig_symbol_setscopename($2);
+ Delete(Namespaceprefix);
+ Namespaceprefix = Swig_symbol_qualifiedscopename(0);
}
- Delete(Namespaceprefix);
- Namespaceprefix = Swig_symbol_qualifiedscopename(0);
+ Delete(scopes);
} interface RBRACE {
- Node *n = $5;
- set_nodeType(n,"namespace");
- Setattr(n,"name",$2);
- Setattr(n,"symtab", Swig_symbol_popscope());
- Swig_symbol_setscope($1);
- $$ = n;
- Delete(Namespaceprefix);
- Namespaceprefix = Swig_symbol_qualifiedscopename(0);
- add_symbols($$);
+ Node *n = $<node>4;
+ Node *top_ns = 0;
+ do {
+ Setattr(n, "symtab", Swig_symbol_popscope());
+ Delete(Namespaceprefix);
+ Namespaceprefix = Swig_symbol_qualifiedscopename(0);
+ add_symbols(n);
+ top_ns = n;
+ n = parentNode(n);
+ } while(n);
+ appendChild($<node>4, firstChild($5));
+ Delete($5);
+ $$ = top_ns;
}
| NAMESPACE LBRACE {
Hash *h;
@@ -4375,7 +4632,7 @@ cpp_members : cpp_member cpp_members {
int start_line = cparse_line;
skip_decl();
Swig_error(cparse_file,start_line,"Syntax error in input(3).\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
} cpp_members {
$$ = $3;
}
@@ -4387,7 +4644,7 @@ cpp_members : cpp_member cpp_members {
/* A class member. May be data or a function. Static or virtual as well */
-cpp_member : c_declaration { $$ = $1; }
+cpp_member_no_dox : c_declaration { $$ = $1; }
| cpp_constructor_decl {
$$ = $1;
if (extendmode && current_class) {
@@ -4406,7 +4663,6 @@ cpp_member : c_declaration { $$ = $1; }
default_arguments($$);
}
| cpp_destructor_decl { $$ = $1; }
- | cpp_static_assert { $$ = $1; }
| cpp_protection_decl { $$ = $1; }
| cpp_swig_directive { $$ = $1; }
| cpp_conversion_operator { $$ = $1; }
@@ -4422,6 +4678,18 @@ cpp_member : c_declaration { $$ = $1; }
| fragment_directive {$$ = $1; }
| types_directive {$$ = $1; }
| SEMI { $$ = 0; }
+
+cpp_member : cpp_member_no_dox {
+ $$ = $1;
+ }
+ | DOXYGENSTRING cpp_member_no_dox {
+ $$ = $2;
+ set_comment($2, $1);
+ }
+ | cpp_member_no_dox DOXYGENPOSTSTRING {
+ $$ = $1;
+ set_comment($1, $2);
+ }
;
/* Possibly a constructor */
@@ -4442,6 +4710,7 @@ cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
Setattr($$,"throws",$6.throws);
Setattr($$,"throw",$6.throwf);
Setattr($$,"noexcept",$6.nexcept);
+ Setattr($$,"final",$6.final);
if (Len(scanner_ccode)) {
String *code = Copy(scanner_ccode);
Setattr($$,"code",code);
@@ -4478,8 +4747,11 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end {
Setattr($$,"throws",$6.throws);
Setattr($$,"throw",$6.throwf);
Setattr($$,"noexcept",$6.nexcept);
+ Setattr($$,"final",$6.final);
if ($6.val)
Setattr($$,"value",$6.val);
+ if ($6.qualifier)
+ Swig_error(cparse_file, cparse_line, "Destructor %s %s cannot have a qualifier.\n", Swig_name_decl($$), SwigType_str($6.qualifier, 0));
add_symbols($$);
}
@@ -4496,6 +4768,7 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end {
Setattr($$,"throws",$7.throws);
Setattr($$,"throw",$7.throwf);
Setattr($$,"noexcept",$7.nexcept);
+ Setattr($$,"final",$7.final);
if ($7.val)
Setattr($$,"value",$7.val);
if (Len(scanner_ccode)) {
@@ -4509,7 +4782,8 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end {
Setattr($$,"decl",decl);
Delete(decl);
}
-
+ if ($7.qualifier)
+ Swig_error(cparse_file, cparse_line, "Destructor %s %s cannot have a qualifier.\n", Swig_name_decl($$), SwigType_str($7.qualifier, 0));
add_symbols($$);
}
;
@@ -4526,6 +4800,7 @@ cpp_conversion_operator : storage_class CONVERSIONOPERATOR type pointer LPAREN p
if ($8.qualifier) {
SwigType_push($4,$8.qualifier);
}
+ Setattr($$,"refqualifier",$8.refqualifier);
Setattr($$,"decl",$4);
Setattr($$,"parms",$6);
Setattr($$,"conversion_operator","1");
@@ -4543,6 +4818,7 @@ cpp_conversion_operator : storage_class CONVERSIONOPERATOR type pointer LPAREN p
if ($8.qualifier) {
SwigType_push(decl,$8.qualifier);
}
+ Setattr($$,"refqualifier",$8.refqualifier);
Setattr($$,"decl",decl);
Setattr($$,"parms",$6);
Setattr($$,"conversion_operator","1");
@@ -4560,6 +4836,7 @@ cpp_conversion_operator : storage_class CONVERSIONOPERATOR type pointer LPAREN p
if ($8.qualifier) {
SwigType_push(decl,$8.qualifier);
}
+ Setattr($$,"refqualifier",$8.refqualifier);
Setattr($$,"decl",decl);
Setattr($$,"parms",$6);
Setattr($$,"conversion_operator","1");
@@ -4579,6 +4856,7 @@ cpp_conversion_operator : storage_class CONVERSIONOPERATOR type pointer LPAREN p
if ($9.qualifier) {
SwigType_push(decl,$9.qualifier);
}
+ Setattr($$,"refqualifier",$9.refqualifier);
Setattr($$,"decl",decl);
Setattr($$,"parms",$7);
Setattr($$,"conversion_operator","1");
@@ -4595,6 +4873,7 @@ cpp_conversion_operator : storage_class CONVERSIONOPERATOR type pointer LPAREN p
if ($7.qualifier) {
SwigType_push(t,$7.qualifier);
}
+ Setattr($$,"refqualifier",$7.refqualifier);
Setattr($$,"decl",t);
Setattr($$,"parms",$5);
Setattr($$,"conversion_operator","1");
@@ -4610,7 +4889,8 @@ cpp_catch_decl : CATCH LPAREN parms RPAREN LBRACE {
}
;
-/* static_assert(bool, const char*); */
+/* static_assert(bool, const char*); (C++11)
+ * static_assert(bool); (C++17) */
cpp_static_assert : STATIC_ASSERT LPAREN {
skip_balanced('(',')');
$$ = 0;
@@ -4664,23 +4944,35 @@ cpp_swig_directive: pragma_directive { $$ = $1; }
cpp_end : cpp_const SEMI {
Clear(scanner_ccode);
$$.val = 0;
+ $$.qualifier = $1.qualifier;
+ $$.refqualifier = $1.refqualifier;
+ $$.bitfield = 0;
$$.throws = $1.throws;
$$.throwf = $1.throwf;
$$.nexcept = $1.nexcept;
+ $$.final = $1.final;
}
| cpp_const EQUAL default_delete SEMI {
Clear(scanner_ccode);
$$.val = $3.val;
+ $$.qualifier = $1.qualifier;
+ $$.refqualifier = $1.refqualifier;
+ $$.bitfield = 0;
$$.throws = $1.throws;
$$.throwf = $1.throwf;
$$.nexcept = $1.nexcept;
+ $$.final = $1.final;
}
| cpp_const LBRACE {
skip_balanced('{','}');
$$.val = 0;
+ $$.qualifier = $1.qualifier;
+ $$.refqualifier = $1.refqualifier;
+ $$.bitfield = 0;
$$.throws = $1.throws;
$$.throwf = $1.throwf;
$$.nexcept = $1.nexcept;
+ $$.final = $1.final;
}
;
@@ -4688,28 +4980,34 @@ cpp_vend : cpp_const SEMI {
Clear(scanner_ccode);
$$.val = 0;
$$.qualifier = $1.qualifier;
+ $$.refqualifier = $1.refqualifier;
$$.bitfield = 0;
$$.throws = $1.throws;
$$.throwf = $1.throwf;
$$.nexcept = $1.nexcept;
+ $$.final = $1.final;
}
| cpp_const EQUAL definetype SEMI {
Clear(scanner_ccode);
$$.val = $3.val;
$$.qualifier = $1.qualifier;
+ $$.refqualifier = $1.refqualifier;
$$.bitfield = 0;
$$.throws = $1.throws;
$$.throwf = $1.throwf;
- $$.nexcept = $1.nexcept;
+ $$.nexcept = $1.nexcept;
+ $$.final = $1.final;
}
| cpp_const LBRACE {
skip_balanced('{','}');
$$.val = 0;
$$.qualifier = $1.qualifier;
+ $$.refqualifier = $1.refqualifier;
$$.bitfield = 0;
$$.throws = $1.throws;
$$.throwf = $1.throwf;
- $$.nexcept = $1.nexcept;
+ $$.nexcept = $1.nexcept;
+ $$.final = $1.final;
}
;
@@ -4788,20 +5086,31 @@ rawparms : parm ptail {
set_nextSibling($1,$2);
$$ = $1;
}
- | empty { $$ = 0; }
+ | empty {
+ $$ = 0;
+ previousNode = currentNode;
+ currentNode=0;
+ }
;
ptail : COMMA parm ptail {
set_nextSibling($2,$3);
$$ = $2;
}
+ | COMMA DOXYGENPOSTSTRING parm ptail {
+ set_comment(previousNode, $2);
+ set_nextSibling($3, $4);
+ $$ = $3;
+ }
| empty { $$ = 0; }
;
-parm : rawtype parameter_declarator {
+parm_no_dox : rawtype parameter_declarator {
SwigType_push($1,$2.type);
$$ = NewParmWithoutFileLineInfo($1,$2.id);
+ previousNode = currentNode;
+ currentNode = $$;
Setfile($$,cparse_file);
Setline($$,cparse_line);
if ($2.defarg) {
@@ -4811,6 +5120,8 @@ parm : rawtype parameter_declarator {
| TEMPLATE LESSTHAN cpptype GREATERTHAN cpptype idcolon def_args {
$$ = NewParmWithoutFileLineInfo(NewStringf("template<class> %s %s", $5,$6), 0);
+ previousNode = currentNode;
+ currentNode = $$;
Setfile($$,cparse_file);
Setline($$,cparse_line);
if ($7.val) {
@@ -4820,11 +5131,26 @@ parm : rawtype parameter_declarator {
| PERIOD PERIOD PERIOD {
SwigType *t = NewString("v(...)");
$$ = NewParmWithoutFileLineInfo(t, 0);
+ previousNode = currentNode;
+ currentNode = $$;
Setfile($$,cparse_file);
Setline($$,cparse_line);
}
;
+parm : parm_no_dox {
+ $$ = $1;
+ }
+ | DOXYGENSTRING parm_no_dox {
+ $$ = $2;
+ set_comment($2, $1);
+ }
+ | parm_no_dox DOXYGENPOSTSTRING {
+ $$ = $1;
+ set_comment($1, $2);
+ }
+ ;
+
valparms : rawvalparms {
Parm *p;
$$ = $1;
@@ -4899,6 +5225,7 @@ def_args : EQUAL definetype {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
}
| EQUAL definetype LBRACKET expr RBRACKET {
@@ -4912,6 +5239,7 @@ def_args : EQUAL definetype {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
} else {
$$.val = NewStringf("%s[%s]",$2.val,$4.val);
}
@@ -4925,6 +5253,7 @@ def_args : EQUAL definetype {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
| COLON expr {
$$.val = 0;
@@ -4934,6 +5263,7 @@ def_args : EQUAL definetype {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
| empty {
$$.val = 0;
@@ -4943,6 +5273,7 @@ def_args : EQUAL definetype {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
;
@@ -4959,6 +5290,28 @@ parameter_declarator : declarator def_args {
$$.id = 0;
$$.defarg = $1.rawval ? $1.rawval : $1.val;
}
+ /* Member function pointers with qualifiers. eg.
+ int f(short (Funcs::*parm)(bool) const); */
+ | direct_declarator LPAREN parms RPAREN cv_ref_qualifier {
+ SwigType *t;
+ $$ = $1;
+ t = NewStringEmpty();
+ SwigType_add_function(t,$3);
+ if ($5.qualifier)
+ SwigType_push(t, $5.qualifier);
+ if (!$$.have_parms) {
+ $$.parms = $3;
+ $$.have_parms = 1;
+ }
+ if (!$$.type) {
+ $$.type = t;
+ } else {
+ SwigType_push(t, $$.type);
+ Delete($$.type);
+ $$.type = t;
+ }
+ $$.defarg = 0;
+ }
;
plain_declarator : declarator {
@@ -4995,6 +5348,27 @@ plain_declarator : declarator {
$$.parms = 0;
}
}
+ /* Member function pointers with qualifiers. eg.
+ int f(short (Funcs::*parm)(bool) const) */
+ | direct_declarator LPAREN parms RPAREN cv_ref_qualifier {
+ SwigType *t;
+ $$ = $1;
+ t = NewStringEmpty();
+ SwigType_add_function(t, $3);
+ if ($5.qualifier)
+ SwigType_push(t, $5.qualifier);
+ if (!$$.have_parms) {
+ $$.parms = $3;
+ $$.have_parms = 1;
+ }
+ if (!$$.type) {
+ $$.type = t;
+ } else {
+ SwigType_push(t, $$.type);
+ Delete($$.type);
+ $$.type = t;
+ }
+ }
| empty {
$$.type = 0;
$$.id = 0;
@@ -5002,7 +5376,6 @@ plain_declarator : declarator {
}
;
-
declarator : pointer notso_direct_declarator {
$$ = $2;
if ($$.type) {
@@ -5355,7 +5728,7 @@ direct_declarator : idcolon {
}
SwigType_add_rvalue_reference($$.type);
}
- | LPAREN idcolon DSTAR direct_declarator RPAREN {
+ | LPAREN idcolon DSTAR declarator RPAREN {
SwigType *t;
$$ = $4;
t = NewStringEmpty();
@@ -5365,7 +5738,42 @@ direct_declarator : idcolon {
Delete($$.type);
}
$$.type = t;
+ }
+ | LPAREN idcolon DSTAR type_qualifier declarator RPAREN {
+ SwigType *t;
+ $$ = $5;
+ t = NewStringEmpty();
+ SwigType_add_memberpointer(t, $2);
+ SwigType_push(t, $4);
+ if ($$.type) {
+ SwigType_push(t, $$.type);
+ Delete($$.type);
+ }
+ $$.type = t;
+ }
+ | LPAREN idcolon DSTAR abstract_declarator RPAREN {
+ SwigType *t;
+ $$ = $4;
+ t = NewStringEmpty();
+ SwigType_add_memberpointer(t, $2);
+ if ($$.type) {
+ SwigType_push(t, $$.type);
+ Delete($$.type);
}
+ $$.type = t;
+ }
+ | LPAREN idcolon DSTAR type_qualifier abstract_declarator RPAREN {
+ SwigType *t;
+ $$ = $5;
+ t = NewStringEmpty();
+ SwigType_add_memberpointer(t, $2);
+ SwigType_push(t, $4);
+ if ($$.type) {
+ SwigType_push(t, $$.type);
+ Delete($$.type);
+ }
+ $$.type = t;
+ }
| direct_declarator LBRACKET RBRACKET {
SwigType *t;
$$ = $1;
@@ -5404,7 +5812,7 @@ direct_declarator : idcolon {
Delete($$.type);
$$.type = t;
}
- }
+ }
/* User-defined string literals. eg.
int operator"" _mySuffix(const char* val, int length) {...} */
/* This produces one S/R conflict. */
@@ -5515,6 +5923,14 @@ abstract_declarator : pointer {
$$.parms = 0;
$$.have_parms = 0;
}
+ | idcolon DSTAR type_qualifier {
+ $$.type = NewStringEmpty();
+ SwigType_add_memberpointer($$.type, $1);
+ SwigType_push($$.type, $3);
+ $$.id = 0;
+ $$.parms = 0;
+ $$.have_parms = 0;
+ }
| pointer idcolon DSTAR {
SwigType *t = NewStringEmpty();
$$.type = $1;
@@ -5592,6 +6008,24 @@ direct_abstract_declarator : direct_abstract_declarator LBRACKET RBRACKET {
$$.have_parms = 1;
}
}
+ | direct_abstract_declarator LPAREN parms RPAREN cv_ref_qualifier {
+ SwigType *t;
+ $$ = $1;
+ t = NewStringEmpty();
+ SwigType_add_function(t,$3);
+ SwigType_push(t, $5.qualifier);
+ if (!$$.type) {
+ $$.type = t;
+ } else {
+ SwigType_push(t,$$.type);
+ Delete($$.type);
+ $$.type = t;
+ }
+ if (!$$.have_parms) {
+ $$.parms = $3;
+ $$.have_parms = 1;
+ }
+ }
| LPAREN parms RPAREN {
$$.type = NewStringEmpty();
SwigType_add_function($$.type,$2);
@@ -5626,6 +6060,33 @@ pointer : STAR type_qualifier pointer {
}
;
+/* cv-qualifier plus C++11 ref-qualifier for non-static member functions */
+cv_ref_qualifier : type_qualifier {
+ $$.qualifier = $1;
+ $$.refqualifier = 0;
+ }
+ | type_qualifier ref_qualifier {
+ $$.qualifier = $1;
+ $$.refqualifier = $2;
+ SwigType_push($$.qualifier, $2);
+ }
+ | ref_qualifier {
+ $$.qualifier = NewStringEmpty();
+ $$.refqualifier = $1;
+ SwigType_push($$.qualifier, $1);
+ }
+ ;
+
+ref_qualifier : AND {
+ $$ = NewStringEmpty();
+ SwigType_add_reference($$);
+ }
+ | LAND {
+ $$ = NewStringEmpty();
+ SwigType_add_rvalue_reference($$);
+ }
+ ;
+
type_qualifier : type_qualifier_raw {
$$ = NewStringEmpty();
if ($1) SwigType_add_qualifier($$,$1);
@@ -5847,10 +6308,12 @@ definetype : { /* scanner_check_typedef(); */ } expr {
$$.rawval = NewStringf("%s", $$.val);
}
$$.qualifier = 0;
+ $$.refqualifier = 0;
$$.bitfield = 0;
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
scanner_ignore_typedef();
}
| default_delete {
@@ -5872,10 +6335,12 @@ deleted_definition : DELETE_KW {
$$.rawval = 0;
$$.type = T_STRING;
$$.qualifier = 0;
+ $$.refqualifier = 0;
$$.bitfield = 0;
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
;
@@ -5885,10 +6350,12 @@ explicit_default : DEFAULT {
$$.rawval = 0;
$$.type = T_STRING;
$$.qualifier = 0;
+ $$.refqualifier = 0;
$$.bitfield = 0;
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
;
@@ -5898,28 +6365,70 @@ ename : identifier { $$ = $1; }
| empty { $$ = (char *) 0;}
;
-optional_constant_directive : constant_directive { $$ = $1; }
- | empty { $$ = 0; }
- ;
+constant_directives : constant_directive
+ | constant_directive constant_directives
+ ;
+
+optional_ignored_defines
+ : constant_directives
+ | empty
+ ;
/* Enum lists - any #define macros (constant directives) within the enum list are ignored. Trailing commas accepted. */
-enumlist : enumlist COMMA optional_constant_directive edecl optional_constant_directive {
- Node *leftSibling = Getattr($1,"_last");
- set_nextSibling(leftSibling,$4);
- Setattr($1,"_last",$4);
- $$ = $1;
- }
- | enumlist COMMA optional_constant_directive {
- $$ = $1;
- }
- | optional_constant_directive edecl optional_constant_directive {
- Setattr($2,"_last",$2);
- $$ = $2;
- }
- | optional_constant_directive {
- $$ = 0;
- }
- ;
+
+/*
+ Note that "_last" attribute is not supposed to be set on the last enum element, as might be expected from its name, but on the _first_ one, and _only_ on it,
+ so we propagate it back to the first item while parsing and reset it on all the subsequent ones.
+ */
+
+enumlist : enumlist_item {
+ Setattr($1,"_last",$1);
+ $$ = $1;
+ }
+ | enumlist_item DOXYGENPOSTSTRING {
+ Setattr($1,"_last",$1);
+ set_comment($1, $2);
+ $$ = $1;
+ }
+ | enumlist_item COMMA enumlist {
+ if ($3) {
+ set_nextSibling($1, $3);
+ Setattr($1,"_last",Getattr($3,"_last"));
+ Setattr($3,"_last",NULL);
+ } else {
+ Setattr($1,"_last",$1);
+ }
+ $$ = $1;
+ }
+ | enumlist_item COMMA DOXYGENPOSTSTRING enumlist {
+ if ($4) {
+ set_nextSibling($1, $4);
+ Setattr($1,"_last",Getattr($4,"_last"));
+ Setattr($4,"_last",NULL);
+ } else {
+ Setattr($1,"_last",$1);
+ }
+ set_comment($1, $3);
+ $$ = $1;
+ }
+ | optional_ignored_defines {
+ $$ = 0;
+ }
+ ;
+
+enumlist_item : optional_ignored_defines edecl_with_dox optional_ignored_defines {
+ $$ = $2;
+ }
+ ;
+
+edecl_with_dox : edecl {
+ $$ = $1;
+ }
+ | DOXYGENSTRING edecl {
+ $$ = $2;
+ set_comment($2, $1);
+ }
+ ;
edecl : identifier {
SwigType *type = NewSwigType(T_INT);
@@ -5976,7 +6485,33 @@ expr : valexpr { $$ = $1; }
}
;
-valexpr : exprnum { $$ = $1; }
+/* simple member access expressions */
+exprmem : ID ARROW ID {
+ $$.val = NewStringf("%s->%s", $1, $3);
+ $$.type = 0;
+ }
+ | exprmem ARROW ID {
+ $$ = $1;
+ Printf($$.val, "->%s", $3);
+ }
+/* This generates a shift-reduce
+ | ID PERIOD ID {
+ $$.val = NewStringf("%s.%s", $1, $3);
+ $$.type = 0;
+ }
+*/
+ | exprmem PERIOD ID {
+ $$ = $1;
+ Printf($$.val, ".%s", $3);
+ }
+ ;
+
+valexpr : exprnum {
+ $$ = $1;
+ }
+ | exprmem {
+ $$ = $1;
+ }
| string {
$$.val = $1;
$$.type = T_STRING;
@@ -6009,6 +6544,7 @@ valexpr : exprnum { $$ = $1; }
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
| WCHARCONST {
$$.val = NewString($1);
@@ -6022,13 +6558,17 @@ valexpr : exprnum { $$ = $1; }
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
/* grouping */
| LPAREN expr RPAREN %prec CAST {
- $$.val = NewStringf("(%s)",$2.val);
+ $$.val = NewStringf("(%s)",$2.val);
+ if ($2.rawval) {
+ $$.rawval = NewStringf("(%s)",$2.rawval);
+ }
$$.type = $2.type;
- }
+ }
/* A few common casting operations */
@@ -6048,6 +6588,7 @@ valexpr : exprnum { $$ = $1; }
break;
}
}
+ $$.type = promote($2.type, $4.type);
}
| LPAREN expr pointer RPAREN expr %prec CAST {
$$ = $5;
@@ -6372,62 +6913,92 @@ virt_specifier_seq : OVERRIDE {
$$ = 0;
}
| FINAL {
- $$ = 0;
+ $$ = NewString("1");
}
| FINAL OVERRIDE {
- $$ = 0;
+ $$ = NewString("1");
}
| OVERRIDE FINAL {
- $$ = 0;
+ $$ = NewString("1");
}
;
+virt_specifier_seq_opt : virt_specifier_seq {
+ $$ = $1;
+ }
+ | empty {
+ $$ = 0;
+ }
+ ;
+
exception_specification : THROW LPAREN parms RPAREN {
$$.throws = $3;
$$.throwf = NewString("1");
$$.nexcept = 0;
+ $$.final = 0;
}
| NOEXCEPT {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = NewString("true");
+ $$.final = 0;
}
| virt_specifier_seq {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = $1;
+ }
+ | THROW LPAREN parms RPAREN virt_specifier_seq {
+ $$.throws = $3;
+ $$.throwf = NewString("1");
+ $$.nexcept = 0;
+ $$.final = $5;
}
| NOEXCEPT virt_specifier_seq {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = NewString("true");
+ $$.final = $2;
}
| NOEXCEPT LPAREN expr RPAREN {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = $3.val;
+ $$.final = 0;
}
;
-cpp_const : type_qualifier {
+qualifiers_exception_specification : cv_ref_qualifier {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
- $$.qualifier = $1;
+ $$.final = 0;
+ $$.qualifier = $1.qualifier;
+ $$.refqualifier = $1.refqualifier;
}
| exception_specification {
$$ = $1;
$$.qualifier = 0;
+ $$.refqualifier = 0;
}
- | type_qualifier exception_specification {
+ | cv_ref_qualifier exception_specification {
$$ = $2;
- $$.qualifier = $1;
+ $$.qualifier = $1.qualifier;
+ $$.refqualifier = $1.refqualifier;
+ }
+ ;
+
+cpp_const : qualifiers_exception_specification {
+ $$ = $1;
}
| empty {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
- $$.qualifier = 0;
+ $$.final = 0;
+ $$.qualifier = 0;
+ $$.refqualifier = 0;
}
;
@@ -6438,6 +7009,9 @@ ctor_end : cpp_const ctor_initializer SEMI {
$$.throws = $1.throws;
$$.throwf = $1.throwf;
$$.nexcept = $1.nexcept;
+ $$.final = $1.final;
+ if ($1.qualifier)
+ Swig_error(cparse_file, cparse_line, "Constructor cannot have a qualifier.\n");
}
| cpp_const ctor_initializer LBRACE {
skip_balanced('{','}');
@@ -6446,6 +7020,9 @@ ctor_end : cpp_const ctor_initializer SEMI {
$$.throws = $1.throws;
$$.throwf = $1.throwf;
$$.nexcept = $1.nexcept;
+ $$.final = $1.final;
+ if ($1.qualifier)
+ Swig_error(cparse_file, cparse_line, "Constructor cannot have a qualifier.\n");
}
| LPAREN parms RPAREN SEMI {
Clear(scanner_ccode);
@@ -6455,6 +7032,7 @@ ctor_end : cpp_const ctor_initializer SEMI {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
| LPAREN parms RPAREN LBRACE {
skip_balanced('{','}');
@@ -6464,6 +7042,7 @@ ctor_end : cpp_const ctor_initializer SEMI {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
| EQUAL definetype SEMI {
$$.have_parms = 0;
@@ -6471,6 +7050,7 @@ ctor_end : cpp_const ctor_initializer SEMI {
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
+ $$.final = 0;
}
| exception_specification EQUAL default_delete SEMI {
$$.have_parms = 0;
@@ -6478,6 +7058,9 @@ ctor_end : cpp_const ctor_initializer SEMI {
$$.throws = $1.throws;
$$.throwf = $1.throwf;
$$.nexcept = $1.nexcept;
+ $$.final = $1.final;
+ if ($1.qualifier)
+ Swig_error(cparse_file, cparse_line, "Constructor cannot have a qualifier.\n");
}
;
diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c
index e575073a4..22d49fac5 100644
--- a/Source/CParse/templ.c
+++ b/Source/CParse/templ.c
@@ -26,12 +26,19 @@ void SwigType_template_init() {
}
-static void add_parms(ParmList *p, List *patchlist, List *typelist) {
+static void add_parms(ParmList *p, List *patchlist, List *typelist, int is_pattern) {
while (p) {
SwigType *ty = Getattr(p, "type");
SwigType *val = Getattr(p, "value");
Append(typelist, ty);
Append(typelist, val);
+ if (is_pattern) {
+ /* Typemap patterns are not simple parameter lists.
+ * Output style ("out", "ret" etc) typemap names can be
+ * qualified names and so may need template expansion */
+ SwigType *name = Getattr(p, "name");
+ Append(typelist, name);
+ }
Append(patchlist, val);
p = nextSibling(p);
}
@@ -49,32 +56,31 @@ void Swig_cparse_debug_templates(int x) {
* template parameters
* ----------------------------------------------------------------------------- */
-static int cparse_template_expand(Node *n, String *tname, String *rname, String *templateargs, List *patchlist, List *typelist, List *cpatchlist) {
+static void cparse_template_expand(Node *templnode, Node *n, String *tname, String *rname, String *templateargs, List *patchlist, List *typelist, List *cpatchlist) {
static int expanded = 0;
- int ret;
String *nodeType;
if (!n)
- return 0;
+ return;
nodeType = nodeType(n);
if (Getattr(n, "error"))
- return 0;
+ return;
if (Equal(nodeType, "template")) {
/* Change the node type back to normal */
if (!expanded) {
expanded = 1;
set_nodeType(n, Getattr(n, "templatetype"));
- ret = cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
+ cparse_template_expand(templnode, n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
expanded = 0;
- return ret;
+ return;
} else {
/* Called when template appears inside another template */
/* Member templates */
set_nodeType(n, Getattr(n, "templatetype"));
- ret = cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
+ cparse_template_expand(templnode, n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
set_nodeType(n, "template");
- return ret;
+ return;
}
} else if (Equal(nodeType, "cdecl")) {
/* A simple C declaration */
@@ -107,8 +113,8 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
Append(typelist, Getattr(n, "name"));
}
- add_parms(Getattr(n, "parms"), cpatchlist, typelist);
- add_parms(Getattr(n, "throws"), cpatchlist, typelist);
+ add_parms(Getattr(n, "parms"), cpatchlist, typelist, 0);
+ add_parms(Getattr(n, "throws"), cpatchlist, typelist, 0);
} else if (Equal(nodeType, "class")) {
/* Patch base classes */
@@ -131,7 +137,7 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
{
Node *cn = firstChild(n);
while (cn) {
- cparse_template_expand(cn, tname, rname, templateargs, patchlist, typelist, cpatchlist);
+ cparse_template_expand(templnode, cn, tname, rname, templateargs, patchlist, typelist, cpatchlist);
cn = nextSibling(cn);
}
}
@@ -174,28 +180,33 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
}
Append(cpatchlist, Getattr(n, "code"));
Append(typelist, Getattr(n, "decl"));
- add_parms(Getattr(n, "parms"), cpatchlist, typelist);
- add_parms(Getattr(n, "throws"), cpatchlist, typelist);
+ add_parms(Getattr(n, "parms"), cpatchlist, typelist, 0);
+ add_parms(Getattr(n, "throws"), cpatchlist, typelist, 0);
} else if (Equal(nodeType, "destructor")) {
- String *name = Getattr(n, "name");
- if (name) {
- if (strchr(Char(name), '<'))
- Append(patchlist, Getattr(n, "name"));
- else
- Append(name, templateargs);
- }
- name = Getattr(n, "sym:name");
- if (name) {
- if (strchr(Char(name), '<')) {
- String *sn = Copy(tname);
- Setattr(n, "sym:name", sn);
- Delete(sn);
- } else {
- Replace(name, tname, rname, DOH_REPLACE_ANY);
+ /* We only need to patch the dtor of the template itself, not the destructors of any nested classes, so check that the parent of this node is the root
+ * template node, with the special exception for %extend which adds its methods under an intermediate node. */
+ Node* parent = parentNode(n);
+ if (parent == templnode || (parentNode(parent) == templnode && Equal(nodeType(parent), "extend"))) {
+ String *name = Getattr(n, "name");
+ if (name) {
+ if (strchr(Char(name), '<'))
+ Append(patchlist, Getattr(n, "name"));
+ else
+ Append(name, templateargs);
}
+ name = Getattr(n, "sym:name");
+ if (name) {
+ if (strchr(Char(name), '<')) {
+ String *sn = Copy(tname);
+ Setattr(n, "sym:name", sn);
+ Delete(sn);
+ } else {
+ Replace(name, tname, rname, DOH_REPLACE_ANY);
+ }
+ }
+ /* Setattr(n,"sym:name",name); */
+ Append(cpatchlist, Getattr(n, "code"));
}
- /* Setattr(n,"sym:name",name); */
- Append(cpatchlist, Getattr(n, "code"));
} else if (Equal(nodeType, "using")) {
String *uname = Getattr(n, "uname");
if (uname && strchr(Char(uname), '<')) {
@@ -211,17 +222,16 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
Append(cpatchlist, Getattr(n, "code"));
Append(typelist, Getattr(n, "type"));
Append(typelist, Getattr(n, "decl"));
- add_parms(Getattr(n, "parms"), cpatchlist, typelist);
- add_parms(Getattr(n, "kwargs"), cpatchlist, typelist);
- add_parms(Getattr(n, "pattern"), cpatchlist, typelist);
- add_parms(Getattr(n, "throws"), cpatchlist, typelist);
+ add_parms(Getattr(n, "parms"), cpatchlist, typelist, 0);
+ add_parms(Getattr(n, "kwargs"), cpatchlist, typelist, 0);
+ add_parms(Getattr(n, "pattern"), cpatchlist, typelist, 1);
+ add_parms(Getattr(n, "throws"), cpatchlist, typelist, 0);
cn = firstChild(n);
while (cn) {
- cparse_template_expand(cn, tname, rname, templateargs, patchlist, typelist, cpatchlist);
+ cparse_template_expand(templnode, cn, tname, rname, templateargs, patchlist, typelist, cpatchlist);
cn = nextSibling(cn);
}
}
- return 0;
}
static
@@ -306,7 +316,7 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab
/* Printf(stdout,"targs = '%s'\n", templateargs);
Printf(stdout,"rname = '%s'\n", rname);
Printf(stdout,"tname = '%s'\n", tname); */
- cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
+ cparse_template_expand(n, n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
/* Set the name */
{
diff --git a/Source/CParse/util.c b/Source/CParse/util.c
index 0e2136a49..714bb2972 100644
--- a/Source/CParse/util.c
+++ b/Source/CParse/util.c
@@ -112,12 +112,12 @@ void cparse_normalize_void(Node *n) {
}
/* -----------------------------------------------------------------------------
- * new_node()
+ * Swig_cparse_new_node()
*
* Create an empty parse node, setting file and line number information
* ----------------------------------------------------------------------------- */
-Node *new_node(const_String_or_char_ptr tag) {
+Node *Swig_cparse_new_node(const_String_or_char_ptr tag) {
Node *n = NewHash();
set_nodeType(n,tag);
Setfile(n,cparse_file);
diff --git a/Source/DOH/base.c b/Source/DOH/base.c
index 12351dd09..f5e418893 100644
--- a/Source/DOH/base.c
+++ b/Source/DOH/base.c
@@ -756,25 +756,6 @@ int DohUngetc(int ch, DOH *obj) {
}
/* -----------------------------------------------------------------------------
- * DohClose()
- * ----------------------------------------------------------------------------- */
-
-/*
-int DohClose(DOH *obj) {
- DohBase *b = (DohBase *) obj;
- DohObjInfo *objinfo;
- if (DohCheck(obj)) {
- objinfo = b->type;
- if (objinfo->doh_file->doh_close) {
- return (objinfo->doh_file->doh_close) (b);
- }
- return 0;
- }
- return fclose((FILE *) obj);
-}
-*/
-
-/* -----------------------------------------------------------------------------
* DohIsString()
* ----------------------------------------------------------------------------- */
diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h
index 5a9bae2b3..7fb64c058 100644
--- a/Source/DOH/doh.h
+++ b/Source/DOH/doh.h
@@ -103,7 +103,6 @@
#define DohNewFileFromFile DOH_NAMESPACE(NewFileFromFile)
#define DohNewFileFromFd DOH_NAMESPACE(NewFileFromFd)
#define DohFileErrorDisplay DOH_NAMESPACE(FileErrorDisplay)
-#define DohClose DOH_NAMESPACE(Close)
#define DohCopyto DOH_NAMESPACE(Copyto)
#define DohNewList DOH_NAMESPACE(NewList)
#define DohNewHash DOH_NAMESPACE(NewHash)
@@ -303,15 +302,12 @@ extern char *DohStrchr(const DOHString_or_char *s1, int ch);
* Files
* ----------------------------------------------------------------------------- */
-extern DOHFile *DohNewFile(DOH *filename, const char *mode, DOHList *outfiles);
+extern DOHFile *DohNewFile(DOHString *filename, const char *mode, DOHList *outfiles);
extern DOHFile *DohNewFileFromFile(FILE *f);
extern DOHFile *DohNewFileFromFd(int fd);
extern void DohFileErrorDisplay(DOHString * filename);
-/*
- Deprecated, just use DohDelete
-extern int DohClose(DOH *file);
-*/
extern int DohCopyto(DOHFile * input, DOHFile * output);
+extern void DohCloseAllOpenFiles(void);
/* -----------------------------------------------------------------------------
@@ -392,7 +388,6 @@ extern void DohMemoryDebug(void);
/* #define StringChar DohStringChar */
/* #define StringEqual DohStringEqual */
-#define Close DohClose
#define vPrintf DohvPrintf
#define GetInt DohGetInt
#define GetDouble DohGetDouble
@@ -424,7 +419,6 @@ extern void DohMemoryDebug(void);
#define NewFileFromFile DohNewFileFromFile
#define NewFileFromFd DohNewFileFromFd
#define FileErrorDisplay DohFileErrorDisplay
-#define Close DohClose
#define NewVoid DohNewVoid
#define Keys DohKeys
#define Strcmp DohStrcmp
@@ -432,6 +426,7 @@ extern void DohMemoryDebug(void);
#define Strstr DohStrstr
#define Strchr DohStrchr
#define Copyto DohCopyto
+#define CloseAllOpenFiles DohCloseAllOpenFiles
#define Split DohSplit
#define SplitLines DohSplitLines
#define Setmark DohSetmark
diff --git a/Source/DOH/dohint.h b/Source/DOH/dohint.h
index c073bd95b..87def9d3d 100644
--- a/Source/DOH/dohint.h
+++ b/Source/DOH/dohint.h
@@ -49,7 +49,6 @@ typedef struct {
int (*doh_ungetc) (DOH *obj, int ch); /* Unget character */
int (*doh_seek) (DOH *obj, long offset, int whence); /* Seek */
long (*doh_tell) (DOH *obj); /* Tell */
- int (*doh_close) (DOH *obj); /* Close */
} DohFileMethods;
/* String methods */
diff --git a/Source/DOH/file.c b/Source/DOH/file.c
index 5c56771d0..570f84ed5 100644
--- a/Source/DOH/file.c
+++ b/Source/DOH/file.c
@@ -26,6 +26,73 @@ typedef struct {
} DohFile;
/* -----------------------------------------------------------------------------
+ * open_files_list_instance
+ * open_files_list_add
+ * open_files_list_remove
+ *
+ * Singleton list containing all the files that have been opened by DohNewFile.
+ * Open file pointers are held in the list as strings so as to not affect the
+ * reference count of the underlying DOH objects.
+ * ----------------------------------------------------------------------------- */
+
+static DOHList *open_files_list_instance() {
+ static DOHList *all_open_files = 0;
+ if (!all_open_files)
+ all_open_files = DohNewList();
+ return all_open_files;
+}
+
+static void open_files_list_add(DohFile *f) {
+ DOHList *all_open_files = open_files_list_instance();
+ DOHString *sf = NewStringf("%p", f);
+ Append(all_open_files, sf);
+ Delete(sf);
+}
+
+static void open_files_list_remove(DohFile *f) {
+ int i;
+ int removed = 0;
+ DOHList *all_open_files = open_files_list_instance();
+ DOHString *sf = NewStringf("%p", f);
+ for (i = 0; i < DohLen(all_open_files); i++) {
+ DOHString *sf_i = Getitem(all_open_files, i);
+ if (Strcmp(sf, sf_i) == 0) {
+ DohDelitem(all_open_files, i);
+ removed = 1;
+ break;
+ }
+ }
+ Delete(sf);
+ assert(removed);
+}
+
+/* -----------------------------------------------------------------------------
+ * DohCloseAllOpenFiles()
+ *
+ * Close all opened files, to be called on program termination
+ * ----------------------------------------------------------------------------- */
+
+void DohCloseAllOpenFiles() {
+ int i;
+ DOHList *all_open_files = open_files_list_instance();
+ for (i = 0; i < DohLen(all_open_files); i++) {
+ DohFile *f = 0;
+ DOHString *sf = Getitem(all_open_files, i);
+ int check = sscanf(Char(sf), "%p", (void **)&f);
+ assert(check == 1);
+ if (f->closeondel) {
+ if (f->filep) {
+ check = fclose(f->filep);
+ assert(check == 0);
+ }
+ f->closeondel = 0;
+ f->filep = 0;
+ }
+ }
+ DohClear(all_open_files);
+}
+
+/* -----------------------------------------------------------------------------
* DelFile()
* ----------------------------------------------------------------------------- */
@@ -40,6 +107,7 @@ static void DelFile(DOH *fo) {
close(f->fd);
}
#endif
+ open_files_list_remove(f);
}
DohFree(f);
}
@@ -166,27 +234,6 @@ static int File_ungetc(DOH *fo, int ch) {
return -1;
}
-/* -----------------------------------------------------------------------------
- * File_close()
- *
- * Close the file
- * ----------------------------------------------------------------------------- */
-
-static int File_close(DOH *fo) {
- int ret = 0;
- DohFile *f = (DohFile *) ObjData(fo);
- if (f->filep) {
- ret = fclose(f->filep);
- f->filep = 0;
- } else if (f->fd) {
-#ifdef DOH_INTFILE
- ret = close(f->fd);
- f->fd = 0;
-#endif
- }
- return ret;
-}
-
static DohFileMethods FileFileMethods = {
File_read,
File_write,
@@ -195,7 +242,6 @@ static DohFileMethods FileFileMethods = {
File_ungetc,
File_seek,
File_tell,
- File_close, /* close */
};
static DohObjInfo DohFileType = {
@@ -231,8 +277,9 @@ static DohObjInfo DohFileType = {
* If newfiles is non-zero, the filename is added to the list of new files.
* ----------------------------------------------------------------------------- */
-DOH *DohNewFile(DOH *filename, const char *mode, DOHList *newfiles) {
+DOH *DohNewFile(DOHString *filename, const char *mode, DOHList *newfiles) {
DohFile *f;
+ DOH *obj;
FILE *file;
char *filen;
@@ -251,7 +298,9 @@ DOH *DohNewFile(DOH *filename, const char *mode, DOHList *newfiles) {
f->filep = file;
f->fd = 0;
f->closeondel = 1;
- return DohObjMalloc(&DohFileType, f);
+ obj = DohObjMalloc(&DohFileType, f);
+ open_files_list_add(f);
+ return obj;
}
/* -----------------------------------------------------------------------------
diff --git a/Source/DOH/memory.c b/Source/DOH/memory.c
index b916870d7..e0e4c68bd 100644
--- a/Source/DOH/memory.c
+++ b/Source/DOH/memory.c
@@ -81,8 +81,8 @@ static void InitPools() {
* ---------------------------------------------------------------------- */
int DohCheck(const DOH *ptr) {
- register Pool *p = Pools;
- register char *cptr = (char *) ptr;
+ Pool *p = Pools;
+ char *cptr = (char *) ptr;
while (p) {
if ((cptr >= p->pbeg) && (cptr < p->pend)) {
#ifdef DOH_DEBUG_MEMORY_POOLS
diff --git a/Source/DOH/string.c b/Source/DOH/string.c
index 490198dfa..6c6728578 100644
--- a/Source/DOH/string.c
+++ b/Source/DOH/string.c
@@ -141,15 +141,15 @@ static int String_cmp(DOH *so1, DOH *so2) {
static int String_equal(DOH *so1, DOH *so2) {
String *s1 = (String *) ObjData(so1);
String *s2 = (String *) ObjData(so2);
- register int len = s1->len;
+ int len = s1->len;
if (len != s2->len) {
return 0;
} else {
- register char *c1 = s1->str;
- register char *c2 = s2->str;
+ char *c1 = s1->str;
+ char *c2 = s2->str;
#if 0
- register int mlen = len >> 2;
- register int i = mlen;
+ int mlen = len >> 2;
+ int i = mlen;
for (; i; --i) {
if (*(c1++) != *(c2++))
return 0;
@@ -180,11 +180,11 @@ static int String_hash(DOH *so) {
if (s->hashkey >= 0) {
return s->hashkey;
} else {
- register char *c = s->str;
- register unsigned int len = s->len > 50 ? 50 : s->len;
- register unsigned int h = 0;
- register unsigned int mlen = len >> 2;
- register unsigned int i = mlen;
+ char *c = s->str;
+ unsigned int len = s->len > 50 ? 50 : s->len;
+ unsigned int h = 0;
+ unsigned int mlen = len >> 2;
+ unsigned int i = mlen;
for (; i; --i) {
h = (h << 5) + *(c++);
h = (h << 5) + *(c++);
@@ -463,9 +463,9 @@ static int String_seek(DOH *so, long offset, int whence) {
{
#if 0
- register int sp = s->sp;
- register char *tc = s->str;
- register int len = s->len;
+ int sp = s->sp;
+ char *tc = s->str;
+ int len = s->len;
while (sp != nsp) {
int prev = sp + inc;
if (prev >= 0 && prev <= len && tc[prev] == '\n')
@@ -473,8 +473,8 @@ static int String_seek(DOH *so, long offset, int whence) {
sp += inc;
}
#else
- register int sp = s->sp;
- register char *tc = s->str;
+ int sp = s->sp;
+ char *tc = s->str;
if (inc > 0) {
while (sp != nsp) {
if (tc[++sp] == '\n')
@@ -508,12 +508,12 @@ static long String_tell(DOH *so) {
static int String_putc(DOH *so, int ch) {
String *s = (String *) ObjData(so);
- register int len = s->len;
- register int sp = s->sp;
+ int len = s->len;
+ int sp = s->sp;
s->hashkey = -1;
if (sp >= len) {
- register int maxsize = s->maxsize;
- register char *tc = s->str;
+ int maxsize = s->maxsize;
+ char *tc = s->str;
if (len > (maxsize - 2)) {
maxsize *= 2;
tc = (char *) DohRealloc(tc, maxsize);
@@ -679,7 +679,7 @@ static int replace_simple(String *str, char *token, char *rep, int flags, int co
int noquote = 0;
char *c, *s, *t, *first;
char *q, *q2;
- register char *base;
+ char *base;
int i;
/* Figure out if anything gets replaced */
@@ -987,7 +987,6 @@ static DohFileMethods StringFileMethods = {
String_ungetc,
String_seek,
String_tell,
- 0, /* close */
};
static DohStringMethods StringStringMethods = {
diff --git a/Source/Doxygen/doxycommands.h b/Source/Doxygen/doxycommands.h
new file mode 100644
index 000000000..1f7b5fa5b
--- /dev/null
+++ b/Source/Doxygen/doxycommands.h
@@ -0,0 +1,170 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * doxycommands.h
+ *
+ * Part of the Doxygen comment translation module of SWIG.
+ * ----------------------------------------------------------------------------- */
+
+#ifndef DOXYGENCOMMANDS_H
+#define DOXYGENCOMMANDS_H
+
+// doxy commands are not processed inside this block
+const char *CMD_HTML_ONLY = "htmlonly";
+// doxy commands are not processed inside this block
+const char *CMD_VERBATIM = "verbatim";
+const char *CMD_LATEX_1 = "f$";
+const char *CMD_LATEX_2 = "f{";
+const char *CMD_LATEX_3 = "f[";
+const char *CMD_END_HTML_ONLY = "endhtmlonly";
+const char *CMD_END_VERBATIM = "endverbatim";
+const char *CMD_END_LATEX_1 = "f$";
+const char *CMD_END_LATEX_2 = "f}";
+const char *CMD_END_LATEX_3 = "f]";
+
+const char *sectionIndicators[] = {
+ "attention", "author", "authors", "brief", "bug", "cond", "date",
+ "deprecated", "details", "else", "elseif", "endcond", "endif",
+ "exception", "if", "ifnot", "invariant", "note", "par", "param",
+ "tparam", "post", "pre", "remarks", "remark", "result", "return",
+ "returns", "retval", "sa", "see", "since", "test", "throw", "throws",
+ "todo", "version", "warning", "xrefitem"
+};
+
+const int sectionIndicatorsSize = sizeof(sectionIndicators) / sizeof(*sectionIndicators);
+
+/* All of the doxygen commands divided up by how they are parsed */
+const char *simpleCommands[] = {
+ // the first line are escaped chars, except \~, which is a language ID command.
+ "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%", "\"", ".", "::",
+ "endcond",
+ "callgraph", "callergraph", "showinitializer", "hideinitializer", "internal",
+ "nosubgrouping", "public", "publicsection", "private", "privatesection",
+ "protected", "protectedsection", "tableofcontents"
+};
+
+const int simpleCommandsSize = sizeof(simpleCommands) / sizeof(*simpleCommands);
+
+const char *commandWords[] = {
+ "a", "b", "c", "e", "em", "p", "def", "enum", "package", "relates",
+ "namespace", "relatesalso", "anchor", "dontinclude", "include",
+ "includelineno", "copydoc", "copybrief", "copydetails", "verbinclude",
+ "htmlinclude", "extends", "implements", "memberof", "related", "relatedalso",
+ "cite"
+};
+
+const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords);
+
+const char *commandLines[] = {
+ "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip",
+ "until", "property"
+};
+
+const int commandLinesSize = sizeof(commandLines) / sizeof(*commandLines);
+
+const char *commandParagraph[] = {
+ "partofdescription", "result", "return", "returns", "remarks", "remark",
+ "since", "test", "sa", "see", "pre", "post", "details", "invariant",
+ "deprecated", "date", "note", "warning", "version", "todo", "bug",
+ "attention", "brief", "author", "authors", "copyright", "short"
+};
+
+const int commandParagraphSize = sizeof(commandParagraph) / sizeof(*commandParagraph);
+
+const char *commandEndCommands[] = {
+ CMD_HTML_ONLY, "latexonly", "manonly", "xmlonly", "link", "rtfonly"
+};
+
+const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands);
+
+const char *commandWordParagraphs[] = {
+ "param", "tparam", "throw", "throws", "retval", "exception", "example"
+};
+
+const int commandWordParagraphsSize = sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs);
+
+const char *commandWordLines[] = {
+ "page", "subsection", "subsubsection", "section", "paragraph", "defgroup",
+ "snippet", "mainpage"
+};
+
+const int commandWordLinesSize = sizeof(commandWordLines) / sizeof(*commandWordLines);
+
+const char *commandWordOWordOWords[] = {
+ "category", "class", "protocol", "interface", "struct", "union"
+};
+
+const int commandWordOWordOWordsSize = sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords);
+
+const char *commandOWords[] = {
+ "dir", "file", "cond"
+};
+
+const int commandOWordsSize = sizeof(commandOWords) / sizeof(*commandOWords);
+
+const char *commandErrorThrowings[] = {
+ "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header",
+ "headerfilestd::list", "inherit", "l", "postheader", "endcode", "enddot", "endmsc", "endhtmlonly",
+ "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif", "else",
+ "endrtfonly"
+};
+
+const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings);
+
+const char *commandUniques[] = {
+ "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li",
+ "if", "ifnot", "elseif", "else", "mscfile", "code", CMD_VERBATIM, "f{", "f[", "f$", "dot", "msc"
+};
+
+const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques);
+
+// These HTML commands are transformed when producing output in other formats.
+// Other commands are left intact, but '<' and '> are replaced with entities in HTML
+// output. So <varName> appears as &lt;varName&gt; in HTML output. The same
+// behavior must be repeated by SWIG. See Doxygen doc for the list of commands.
+// '<' is prepended to distinguish HTML tags from Doxygen commands.
+const char *commandHtml[] = {
+ "<a", "<b", "<blockquote", "<body", "<br", "<center", "<caption", "<code", "<dd", "<dfn",
+ "<div", "<dl", "<dt", "<em", "<form", "<hr", "<h1", "<h2", "<h3", "<i", "<input", "<img",
+ "<li", "<meta", "<multicol", "<ol", "<p", "<pre", "<small", "<span", "<strong",
+ "<sub", "<sup", "<table", "<td", "<th", "<tr", "<tt", "<kbd", "<ul", "<var"
+};
+
+const int commandHtmlSize = sizeof(commandHtml) / sizeof(*commandHtml);
+
+// Only entities which are translatable to plain text are used here. Others
+// are copied unchanged to output.
+const char *commandHtmlEntities[] = {
+ "&copy", // (C)
+ "&trade", // (TM)
+ "&reg", // (R)
+ "&lt", // less-than symbol
+ "&gt", // greater-than symbol
+ "&amp", // ampersand
+ "&apos", // single quotation mark (straight)
+ "&quot", // double quotation mark (straight)
+ "&lsquo", // left single quotation mark
+ "&rsquo", // right single quotation mark
+ "&ldquo", // left double quotation mark
+ "&rdquo", // right double quotation mark
+ "&ndash", // n-dash (for numeric ranges, e.g. 2–8)
+ "&mdash", // --
+ "&nbsp", //
+ "&times", // x
+ "&minus", // -
+ "&sdot", // .
+ "&sim", // ~
+ "&le", // <=
+ "&ge", // >=
+ "&larr", // <--
+ "&rarr" // -->
+};
+
+const int commandHtmlEntitiesSize = sizeof(commandHtmlEntities) / sizeof(*commandHtmlEntities);
+
+#endif
diff --git a/Source/Doxygen/doxyentity.cxx b/Source/Doxygen/doxyentity.cxx
new file mode 100644
index 000000000..8b9f65736
--- /dev/null
+++ b/Source/Doxygen/doxyentity.cxx
@@ -0,0 +1,69 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * doxyentity.cxx
+ *
+ * Part of the Doxygen comment translation module of SWIG.
+ * ----------------------------------------------------------------------------- */
+
+#include "doxyentity.h"
+#include <iostream>
+
+using std::cout;
+
+DoxygenEntity::DoxygenEntity(const std::string &typeEnt):typeOfEntity(typeEnt), isLeaf(true) {
+}
+
+
+/* Basic node for commands that have
+ * only 1 item after them
+ * example: \b word
+ * OR holding a std::string
+ */
+DoxygenEntity::DoxygenEntity(const std::string &typeEnt, const std::string &param1) : typeOfEntity(typeEnt), data(param1), isLeaf(true) {
+}
+
+
+/* Nonterminal node
+ * contains
+ */
+DoxygenEntity::DoxygenEntity(const std::string &typeEnt, const DoxygenEntityList &entList) : typeOfEntity(typeEnt), isLeaf(false), entityList(entList) {
+}
+
+
+void DoxygenEntity::printEntity(int level) const {
+
+ int thisLevel = level;
+
+ if (isLeaf) {
+ for (int i = 0; i < thisLevel; i++) {
+ cout << "\t";
+ }
+
+ cout << "Node Leaf Command: '" << typeOfEntity << "', ";
+
+ if (!data.empty()) {
+ cout << "Node Data: '" << data << "'";
+ }
+ cout << std::endl;
+
+ } else {
+
+ for (int i = 0; i < thisLevel; i++) {
+ cout << "\t";
+ }
+
+ cout << "Node Command: '" << typeOfEntity << "'" << std::endl;
+
+ thisLevel++;
+
+ for (DoxygenEntityListCIt p = entityList.begin(); p != entityList.end(); p++) {
+ p->printEntity(thisLevel);
+ }
+ }
+}
diff --git a/Source/Doxygen/doxyentity.h b/Source/Doxygen/doxyentity.h
new file mode 100644
index 000000000..93737e604
--- /dev/null
+++ b/Source/Doxygen/doxyentity.h
@@ -0,0 +1,45 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * doxyentity.h
+ *
+ * Part of the Doxygen comment translation module of SWIG.
+ * ----------------------------------------------------------------------------- */
+
+#ifndef DOXYGENENTITY_H_
+#define DOXYGENENTITY_H_
+
+#include <string>
+#include <list>
+
+
+class DoxygenEntity;
+
+typedef std::list<DoxygenEntity> DoxygenEntityList;
+typedef DoxygenEntityList::iterator DoxygenEntityListIt;
+typedef DoxygenEntityList::const_iterator DoxygenEntityListCIt;
+
+
+/*
+ * Structure to represent a doxygen comment entry
+ */
+class DoxygenEntity {
+public:
+ std::string typeOfEntity;
+ std::string data;
+ bool isLeaf;
+ DoxygenEntityList entityList;
+
+ DoxygenEntity(const std::string &typeEnt);
+ DoxygenEntity(const std::string &typeEnt, const std::string &param1);
+ DoxygenEntity(const std::string &typeEnt, const DoxygenEntityList &entList);
+
+ void printEntity(int level) const;
+};
+
+#endif
diff --git a/Source/Doxygen/doxyparser.cxx b/Source/Doxygen/doxyparser.cxx
new file mode 100644
index 000000000..2e826b265
--- /dev/null
+++ b/Source/Doxygen/doxyparser.cxx
@@ -0,0 +1,1439 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * doxyparser.cxx
+ * ----------------------------------------------------------------------------- */
+
+#include "doxyparser.h"
+#include "doxycommands.h"
+#include "swig.h"
+#include "swigwarn.h"
+
+#include <iostream>
+#include <algorithm>
+#include <vector>
+
+using std::string;
+using std::cout;
+using std::endl;
+
+// This constant defines the (only) characters valid inside a Doxygen "word".
+// It includes some unusual ones because of the commands such as \f[, \f{, \f],
+// \f} and \f$.
+static const char *DOXYGEN_WORD_CHARS = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" "$[]{}";
+
+// Define static class members
+DoxygenParser::DoxyCommandsMap DoxygenParser::doxygenCommands;
+std::set<std::string> DoxygenParser::doxygenSectionIndicators;
+
+const int TOKENSPERLINE = 8; //change this to change the printing behaviour of the token list
+const std::string END_HTML_TAG_MARK("/");
+
+DoxygenParser::DoxygenParser(bool noisy) : noisy(noisy) {
+ fillTables();
+}
+
+DoxygenParser::~DoxygenParser() {
+}
+
+void DoxygenParser::fillTables() {
+ // run it only once
+ if (doxygenCommands.size())
+ return;
+
+ // fill in tables with data from doxycommands.h
+ for (int i = 0; i < simpleCommandsSize; i++)
+ doxygenCommands[simpleCommands[i]] = SIMPLECOMMAND;
+
+ for (int i = 0; i < commandWordsSize; i++)
+ doxygenCommands[commandWords[i]] = COMMANDWORD;
+
+ for (int i = 0; i < commandLinesSize; i++)
+ doxygenCommands[commandLines[i]] = COMMANDLINE;
+
+ for (int i = 0; i < commandParagraphSize; i++)
+ doxygenCommands[commandParagraph[i]] = COMMANDPARAGRAPH;
+
+ for (int i = 0; i < commandEndCommandsSize; i++)
+ doxygenCommands[commandEndCommands[i]] = COMMANDENDCOMMAND;
+
+ for (int i = 0; i < commandWordParagraphsSize; i++)
+ doxygenCommands[commandWordParagraphs[i]] = COMMANDWORDPARAGRAPH;
+
+ for (int i = 0; i < commandWordLinesSize; i++)
+ doxygenCommands[commandWordLines[i]] = COMMANDWORDLINE;
+
+ for (int i = 0; i < commandWordOWordOWordsSize; i++)
+ doxygenCommands[commandWordOWordOWords[i]] = COMMANDWORDOWORDWORD;
+
+ for (int i = 0; i < commandOWordsSize; i++)
+ doxygenCommands[commandOWords[i]] = COMMANDOWORD;
+
+ for (int i = 0; i < commandErrorThrowingsSize; i++)
+ doxygenCommands[commandErrorThrowings[i]] = COMMANDERRORTHROW;
+
+ for (int i = 0; i < commandUniquesSize; i++)
+ doxygenCommands[commandUniques[i]] = COMMANDUNIQUE;
+
+ for (int i = 0; i < commandHtmlSize; i++)
+ doxygenCommands[commandHtml[i]] = COMMAND_HTML;
+
+ for (int i = 0; i < commandHtmlEntitiesSize; i++)
+ doxygenCommands[commandHtmlEntities[i]] = COMMAND_HTML_ENTITY;
+
+ // fill section indicators command set
+ for (int i = 0; i < sectionIndicatorsSize; i++)
+ doxygenSectionIndicators.insert(sectionIndicators[i]);
+}
+
+std::string DoxygenParser::stringToLower(const std::string &stringToConvert) {
+
+ string result(stringToConvert.size(), ' ');
+
+ for (size_t i = 0; i < result.size(); i++) {
+ result[i] = tolower(stringToConvert[i]);
+ }
+
+ return result;
+}
+
+bool DoxygenParser::isSectionIndicator(const std::string &smallString) {
+
+ std::set<std::string>::iterator it = doxygenSectionIndicators.find(stringToLower(smallString));
+
+ return it != doxygenSectionIndicators.end();
+}
+
+void DoxygenParser::printTree(const DoxygenEntityList &rootList) {
+ DoxygenEntityList::const_iterator p = rootList.begin();
+ while (p != rootList.end()) {
+ (*p).printEntity(0);
+ p++;
+ }
+}
+
+DoxygenParser::DoxyCommandEnum DoxygenParser::commandBelongs(const std::string &theCommand) {
+ DoxyCommandsMapIt it = doxygenCommands.find(stringToLower(theCommand));
+
+ if (it != doxygenCommands.end()) {
+ return it->second;
+ }
+ // Check if this command is defined as an alias.
+ if (Getattr(m_node, ("feature:doxygen:alias:" + theCommand).c_str())) {
+ return COMMAND_ALIAS;
+ }
+ // Check if this command should be ignored.
+ if (String *const ignore = getIgnoreFeature(theCommand)) {
+ // Check that no value is specified for this feature ("1" is the implicit
+ // one given to it by SWIG itself), we may use the value in the future, but
+ // for now we only use the attributes.
+ if (Strcmp(ignore, "1") != 0) {
+ Swig_warning(WARN_PP_UNEXPECTED_TOKENS, m_fileName.c_str(), m_fileLineNo,
+ "Feature \"doxygen:ignore\" value ignored for Doxygen command \"%s\".\n", theCommand.c_str());
+ }
+ // Also ensure that the matching end command, if any, will be recognized.
+ const string endCommand = getIgnoreFeatureEndCommand(theCommand);
+ if (!endCommand.empty()) {
+ Setattr(m_node, ("feature:doxygen:ignore:" + endCommand).c_str(), NewString("1"));
+ }
+
+ return COMMAND_IGNORE;
+ }
+
+ return NONE;
+}
+
+std::string DoxygenParser::trim(const std::string &text) {
+ size_t start = text.find_first_not_of(" \t");
+ size_t end = text.find_last_not_of(" \t");
+
+ if (start == string::npos || start > end) {
+ return "";
+ }
+ return text.substr(start, end - start + 1);
+}
+
+bool DoxygenParser::isEndOfLine() {
+ if (m_tokenListIt == m_tokenList.end()) {
+ return false;
+ }
+ Token nextToken = *m_tokenListIt;
+ return nextToken.m_tokenType == END_LINE;
+}
+
+void DoxygenParser::skipWhitespaceTokens() {
+ if (m_tokenListIt == m_tokenList.end()) {
+ return;
+ }
+
+ while (m_tokenListIt != m_tokenList.end()
+ && (m_tokenListIt->m_tokenType == END_LINE || trim(m_tokenListIt->m_tokenString).empty())) {
+
+ m_tokenListIt++;
+ }
+}
+
+std::string DoxygenParser::getNextToken() {
+
+ if (m_tokenListIt == m_tokenList.end()) {
+ return "";
+ }
+
+ if (m_tokenListIt->m_tokenType == PLAINSTRING) {
+ return (m_tokenListIt++)->m_tokenString;
+ }
+
+ return "";
+}
+
+std::string DoxygenParser::getNextWord() {
+
+ /* if (m_tokenListIt == m_tokenList.end()) {
+ return "";
+ }
+ */
+ while (m_tokenListIt != m_tokenList.end()
+ && (m_tokenListIt->m_tokenType == PLAINSTRING)) {
+ // handle quoted strings as words
+ string token = m_tokenListIt->m_tokenString;
+ if (token == "\"") {
+
+ string word = m_tokenListIt->m_tokenString;
+ m_tokenListIt++;
+ while (true) {
+ string nextWord = getNextToken();
+ if (nextWord.empty()) { // maybe report unterminated string error
+ return word;
+ }
+ word += nextWord;
+ if (nextWord == "\"") {
+ return word;
+ }
+ }
+ }
+
+ string tokenStr = trim(m_tokenListIt->m_tokenString);
+ m_tokenListIt++;
+ if (!tokenStr.empty()) {
+ return tokenStr;
+ }
+ }
+
+ return "";
+}
+
+DoxygenParser::TokenListCIt DoxygenParser::getOneLine(const TokenList &tokList) {
+
+ TokenListCIt endOfLineIt = m_tokenListIt;
+
+ while (endOfLineIt != tokList.end()) {
+ if (endOfLineIt->m_tokenType == END_LINE) {
+ return endOfLineIt;
+ }
+ endOfLineIt++;
+ }
+
+ return tokList.end();
+}
+
+std::string DoxygenParser::getStringTilCommand(const TokenList &tokList) {
+
+ if (m_tokenListIt == tokList.end()) {
+ return "";
+ }
+
+ string description;
+
+ while (m_tokenListIt->m_tokenType == PLAINSTRING) {
+ const Token &currentToken = *m_tokenListIt++;
+ if (currentToken.m_tokenType == PLAINSTRING) {
+ description = description + currentToken.m_tokenString; // + " ";
+ }
+ }
+ return description;
+}
+
+std::string DoxygenParser::getStringTilEndCommand(const std::string &theCommand, const TokenList &tokList) {
+
+ if (m_tokenListIt == tokList.end()) {
+ return "";
+ }
+
+ string description;
+ while (m_tokenListIt != tokList.end()) {
+
+ if (m_tokenListIt->m_tokenType == PLAINSTRING) {
+ description += m_tokenListIt->m_tokenString;
+ } else if (m_tokenListIt->m_tokenType == END_LINE) {
+ description += "\n";
+ } else if (m_tokenListIt->m_tokenString == theCommand) {
+ m_tokenListIt++;
+ return description;
+ }
+
+ m_tokenListIt++;
+ }
+
+ printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected Doxygen command: " + theCommand + ".");
+
+ return description;
+}
+
+DoxygenParser::TokenListCIt DoxygenParser::getEndOfParagraph(const TokenList &tokList) {
+
+ TokenListCIt endOfParagraph = m_tokenListIt;
+
+ while (endOfParagraph != tokList.end()) {
+ // If \code or \verbatim is encountered within a paragraph, then
+ // go all the way to the end of that command, since the content
+ // could contain empty lines that would appear to be paragraph
+ // ends:
+ if (endOfParagraph->m_tokenType == COMMAND &&
+ (endOfParagraph->m_tokenString == "code" ||
+ endOfParagraph->m_tokenString == "verbatim")) {
+ const string theCommand = endOfParagraph->m_tokenString;
+ endOfParagraph = getEndCommand("end" + theCommand, tokList);
+ endOfParagraph++; // Move after the end command
+ return endOfParagraph;
+ }
+ if (endOfParagraph->m_tokenType == END_LINE) {
+ endOfParagraph++;
+ if (endOfParagraph != tokList.end()
+ && endOfParagraph->m_tokenType == END_LINE) {
+ endOfParagraph++;
+ //cout << "ENCOUNTERED END OF PARA" << endl;
+ return endOfParagraph;
+ }
+
+ } else if (endOfParagraph->m_tokenType == COMMAND) {
+
+ if (isSectionIndicator(endOfParagraph->m_tokenString)) {
+ return endOfParagraph;
+ } else {
+ endOfParagraph++;
+ }
+
+ } else if (endOfParagraph->m_tokenType == PLAINSTRING) {
+ endOfParagraph++;
+ } else {
+ return tokList.end();
+ }
+ }
+
+ return tokList.end();
+}
+
+DoxygenParser::TokenListCIt DoxygenParser::getEndOfSection(const std::string &theCommand, const TokenList &tokList) {
+
+ TokenListCIt endOfParagraph = m_tokenListIt;
+
+ while (endOfParagraph != tokList.end()) {
+ if (endOfParagraph->m_tokenType == COMMAND) {
+ if (theCommand == endOfParagraph->m_tokenString)
+ return endOfParagraph;
+ else
+ endOfParagraph++;
+ } else if (endOfParagraph->m_tokenType == PLAINSTRING) {
+ endOfParagraph++;
+ } else if (endOfParagraph->m_tokenType == END_LINE) {
+ endOfParagraph++;
+ if (endOfParagraph->m_tokenType == END_LINE) {
+ endOfParagraph++;
+ return endOfParagraph;
+ }
+ }
+ }
+ return tokList.end();
+}
+
+DoxygenParser::TokenListCIt DoxygenParser::getEndCommand(const std::string &theCommand, const TokenList &tokList) {
+
+ TokenListCIt endOfCommand = m_tokenListIt;
+
+ while (endOfCommand != tokList.end()) {
+ endOfCommand++;
+ if ((*endOfCommand).m_tokenType == COMMAND) {
+ if (theCommand == (*endOfCommand).m_tokenString) {
+ return endOfCommand;
+ }
+ }
+ }
+ //End command not found
+ return tokList.end();
+}
+
+void DoxygenParser::skipEndOfLine() {
+ if (m_tokenListIt != m_tokenList.end()
+ && m_tokenListIt->m_tokenType == END_LINE) {
+ m_tokenListIt++;
+ }
+}
+
+void DoxygenParser::addSimpleCommand(const std::string &theCommand, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ doxyList.push_back(DoxygenEntity(theCommand));
+}
+
+void DoxygenParser::addCommandWord(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ if (isEndOfLine()) {
+ // handles cases when command is at the end of line (for example "\c\nreally"
+ skipWhitespaceTokens();
+ doxyList.push_back(DoxygenEntity("plainstd::endl"));
+ }
+ std::string name = getNextWord();
+ if (!name.empty()) {
+ DoxygenEntityList aNewList;
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ } else {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored.");
+ }
+}
+
+void DoxygenParser::addCommandLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ TokenListCIt endOfLine = getOneLine(tokList);
+ DoxygenEntityList aNewList = parse(endOfLine, tokList);
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ skipEndOfLine();
+}
+
+void DoxygenParser::addCommandParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ TokenListCIt endOfParagraph = getEndOfParagraph(tokList);
+ DoxygenEntityList aNewList;
+ aNewList = parse(endOfParagraph, tokList);
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+}
+
+void DoxygenParser::addCommandEndCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ TokenListCIt endCommand = getEndCommand("end" + theCommand, tokList);
+ if (endCommand == tokList.end()) {
+ printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected Doxygen command: end" + theCommand + ".");
+ return;
+ }
+ DoxygenEntityList aNewList;
+ aNewList = parse(endCommand, tokList);
+ m_tokenListIt++;
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+}
+
+void DoxygenParser::addCommandWordParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ std::string name = getNextWord();
+
+ if (name.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored.");
+ return;
+ }
+ TokenListCIt endOfParagraph = getEndOfParagraph(tokList);
+ DoxygenEntityList aNewList;
+ aNewList = parse(endOfParagraph, tokList);
+ aNewList.push_front(DoxygenEntity("plainstd::string", name));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+}
+
+void DoxygenParser::addCommandWordLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ std::string name = getNextWord();
+ if (name.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored.");
+ return;
+ }
+
+ TokenListCIt endOfLine = getOneLine(tokList);
+ DoxygenEntityList aNewList;
+ aNewList = parse(endOfLine, tokList);
+ aNewList.push_front(DoxygenEntity("plainstd::string", name));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ //else cout << "No line followed " << theCommand << " command. Not added" << endl;
+}
+
+void DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ std::string name = getNextWord();
+ if (name.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored.");
+ return;
+ }
+ std::string headerfile = getNextWord();
+ std::string headername = getNextWord();
+ DoxygenEntityList aNewList;
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ if (!headerfile.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", headerfile));
+ if (!headername.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", headername));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+}
+
+void DoxygenParser::addCommandOWord(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ std::string name = getNextWord();
+ DoxygenEntityList aNewList;
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+}
+
+void DoxygenParser::addCommandErrorThrow(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &) {
+
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": Unexpectedly encountered this command.");
+ m_tokenListIt = getOneLine(tokList);
+}
+
+void DoxygenParser::addCommandHtml(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ std::string htmlTagArgs = getNextToken();
+ doxyList.push_back(DoxygenEntity(theCommand, htmlTagArgs));
+}
+
+void DoxygenParser::addCommandHtmlEntity(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ DoxygenEntityList aNewList;
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+}
+
+void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) {
+
+ static std::map<std::string, std::string> endCommands;
+ DoxygenEntityList aNewList;
+ if (theCommand == "arg" || theCommand == "li") {
+ TokenListCIt endOfSection = getEndOfSection(theCommand, tokList);
+ DoxygenEntityList aNewList;
+ aNewList = parse(endOfSection, tokList);
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \xrefitem <key> "(heading)" "(std::list title)" {text}
+ else if (theCommand == "xrefitem") {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ std::string key = getNextWord();
+ if (key.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No key followed the command. Command ignored.");
+ return;
+ }
+ std::string heading = getNextWord();
+ if (key.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No heading followed the command. Command ignored.");
+ return;
+ }
+ std::string title = getNextWord();
+ if (title.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No title followed the command. Command ignored.");
+ return;
+ }
+ TokenListCIt endOfParagraph = getEndOfParagraph(tokList);
+ aNewList = parse(endOfParagraph, tokList);
+ aNewList.push_front(DoxygenEntity("plainstd::string", title));
+ aNewList.push_front(DoxygenEntity("plainstd::string", heading));
+ aNewList.push_front(DoxygenEntity("plainstd::string", key));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \ingroup (<groupname> [<groupname> <groupname>])
+ else if (theCommand == "ingroup") {
+ std::string name = getNextWord();
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ name = getNextWord();
+ if (!name.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ name = getNextWord();
+ if (!name.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \par [(paragraph title)] { paragraph }
+ else if (theCommand == "par") {
+ TokenListCIt endOfLine = getOneLine(tokList);
+ aNewList = parse(endOfLine, tokList);
+ DoxygenEntityList aNewList2;
+ TokenListCIt endOfParagraph = getEndOfParagraph(tokList);
+ aNewList2 = parse(endOfParagraph, tokList);
+ aNewList.splice(aNewList.end(), aNewList2);
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \headerfile <header-file> [<header-name>]
+ else if (theCommand == "headerfile") {
+ DoxygenEntityList aNewList;
+ std::string name = getNextWord();
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ name = getNextWord();
+ if (!name.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \overload [(function declaration)]
+ else if (theCommand == "overload") {
+ TokenListCIt endOfLine = getOneLine(tokList);
+ if (endOfLine != m_tokenListIt) {
+ DoxygenEntityList aNewList;
+ aNewList = parse(endOfLine, tokList);
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ } else
+ doxyList.push_back(DoxygenEntity(theCommand));
+ }
+ // \weakgroup <name> [(title)]
+ else if (theCommand == "weakgroup") {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ std::string name = getNextWord();
+ if (name.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored.");
+ return;
+ }
+ DoxygenEntityList aNewList;
+ TokenListCIt endOfLine = getOneLine(tokList);
+ if (endOfLine != m_tokenListIt) {
+ aNewList = parse(endOfLine, tokList);
+ }
+ aNewList.push_front(DoxygenEntity("plainstd::string", name));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \ref <name> ["(text)"]
+ else if (theCommand == "ref") {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ std::string name = getNextWord();
+ if (name.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No key followed the command. Command ignored.");
+ return;
+ }
+ DoxygenEntityList aNewList;
+ aNewList.push_front(DoxygenEntity("plainstd::string", name));
+ // TokenListCIt endOfLine = getOneLine(tokList);
+ // if (endOfLine != m_tokenListIt) {
+ // aNewList = parse(endOfLine, tokList);
+ //}
+ TokenListCIt tmpIt = m_tokenListIt;
+ std::string refTitle = getNextWord();
+ // If title is following the ref tag, it must be quoted. Otherwise
+ // doxy puts link on ref id.
+ if (refTitle.size() > 1 && refTitle[0] == '"') {
+ // remove quotes
+ refTitle = refTitle.substr(1, refTitle.size() - 2);
+ aNewList.push_back(DoxygenEntity("plainstd::string", refTitle));
+ } else {
+ // no quoted string is following, so we have to restore iterator
+ m_tokenListIt = tmpIt;
+ }
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \subpage <name> ["(text)"]
+ else if (theCommand == "subpage") {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ std::string name = getNextWord();
+ if (name.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No name followed the command. Command ignored.");
+ return;
+ }
+ std::string text = getNextWord();
+ aNewList.push_back(DoxygenEntity("plainstd::string", name));
+ if (!text.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", text));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \code ... \endcode
+ // \verbatim ... \endverbatim
+ // \dot dotcode \enddot
+ // \msc msccode \endmsc
+ // \f[ ... \f]
+ // \f{ ... \f}
+ // \f{env}{ ... \f}
+ // \f$ ... \f$
+ else if (theCommand == "code" || theCommand == "verbatim"
+ || theCommand == "dot" || theCommand == "msc" || theCommand == "f[" || theCommand == "f{" || theCommand == "f$") {
+ if (!endCommands.size()) {
+ // fill in static table of end commands
+ endCommands["f["] = "f]";
+ endCommands["f{"] = "f}";
+ endCommands["f$"] = "f$";
+ }
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ std::string endCommand;
+ std::map<std::string, std::string>::iterator it;
+ it = endCommands.find(theCommand);
+ if (it != endCommands.end())
+ endCommand = it->second;
+ else
+ endCommand = "end" + theCommand;
+
+ std::string content = getStringTilEndCommand(endCommand, tokList);
+ aNewList.push_back(DoxygenEntity("plainstd::string", content));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \dotfile <file> ["caption"]
+ // \mscfile <file> ["caption"]
+ else if (theCommand == "dotfile" || theCommand == "mscfile") {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ std::string file = getNextWord();
+ if (file.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No file followed the command. Command ignored.");
+ return;
+ }
+ std::string caption = getNextWord();
+ aNewList.push_back(DoxygenEntity("plainstd::string", file));
+ if (!caption.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", caption));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \image <format> <file> ["caption"] [<sizeindication>=<size>]
+ else if (theCommand == "image") {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ std::string format = getNextWord();
+ if (format.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No format followed the command. Command ignored.");
+ return;
+ }
+ std::string file = getNextWord();
+ if (file.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No name followed the command. Command ignored.");
+ return;
+ }
+ std::string caption = getNextWord();
+ std::string size = getNextWord();
+
+ DoxygenEntityList aNewList;
+ aNewList.push_back(DoxygenEntity("plainstd::string", format));
+ aNewList.push_back(DoxygenEntity("plainstd::string", file));
+ if (!caption.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", caption));
+ if (!size.empty())
+ aNewList.push_back(DoxygenEntity("plainstd::string", size));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+ // \addtogroup <name> [(title)]
+ else if (theCommand == "addtogroup") {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+ std::string name = getNextWord();
+ if (name.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": There should be at least one word following the command. Command ignored.");
+ return;
+ }
+ DoxygenEntityList aNewList;
+ TokenListCIt endOfLine = getOneLine(tokList);
+ if (endOfLine != m_tokenListIt) {
+ aNewList = parse(endOfLine, tokList);
+ }
+ aNewList.push_front(DoxygenEntity("plainstd::string", name));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ skipEndOfLine();
+ }
+ // \if <cond> [\else ...] [\elseif <cond> ...] \endif
+ else if (theCommand == "if" || theCommand == "ifnot" || theCommand == "else" || theCommand == "elseif") {
+ if (noisy)
+ cout << "Parsing " << theCommand << endl;
+
+ std::string cond;
+ bool skipEndif = false; // if true then we skip endif after parsing block of code
+ bool needsCond = (theCommand == "if" || theCommand == "ifnot" || theCommand == "elseif");
+ if (needsCond) {
+ cond = getNextWord();
+ if (cond.empty()) {
+ printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored.");
+ return;
+ }
+ }
+
+ int nestedCounter = 1;
+ TokenListCIt endCommand = tokList.end();
+
+ // go through the commands and find closing endif or else or elseif
+ for (TokenListCIt it = m_tokenListIt; it != tokList.end(); it++) {
+ if (it->m_tokenType == COMMAND) {
+ if (it->m_tokenString == "if" || it->m_tokenString == "ifnot")
+ nestedCounter++;
+ else if (it->m_tokenString == "endif")
+ nestedCounter--;
+ if (nestedCounter == 1 && (it->m_tokenString == "else" || it->m_tokenString == "elseif")) { // else found
+ endCommand = it;
+ break;
+ }
+ if (nestedCounter == 0) { // endif found
+ endCommand = it;
+ skipEndif = true;
+ break;
+ }
+ }
+ }
+
+ if (endCommand == tokList.end()) {
+ printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected Doxygen command: endif.");
+ return;
+ }
+
+ DoxygenEntityList aNewList;
+ aNewList = parse(endCommand, tokList);
+ if (skipEndif)
+ m_tokenListIt++;
+ if (needsCond)
+ aNewList.push_front(DoxygenEntity("plainstd::string", cond));
+ doxyList.push_back(DoxygenEntity(theCommand, aNewList));
+ }
+}
+
+void DoxygenParser::aliasCommand(const std::string &theCommand, const TokenList &/* tokList */ , DoxygenEntityList &doxyList) {
+ String *const alias = Getattr(m_node, ("feature:doxygen:alias:" + theCommand).c_str());
+ if (!alias)
+ return;
+
+ doxyList.push_back(DoxygenEntity("plainstd::string", Char(alias)));
+}
+
+String *DoxygenParser::getIgnoreFeature(const std::string &theCommand, const char *argument) const {
+ string feature_name = "feature:doxygen:ignore:" + theCommand;
+ if (argument) {
+ feature_name += ':';
+ feature_name += argument;
+ }
+
+ return Getattr(m_node, feature_name.c_str());
+}
+
+string DoxygenParser::getIgnoreFeatureEndCommand(const std::string &theCommand) const {
+ // We may be dealing either with a simple command or with the starting command
+ // of a block, as indicated by the value of "range" starting with "end".
+ string endCommand;
+ if (String *const range = getIgnoreFeature(theCommand, "range")) {
+ const char *const p = Char(range);
+ if (strncmp(p, "end", 3) == 0) {
+ if (p[3] == ':') {
+ // Normally the end command name follows after the colon.
+ endCommand = p + 4;
+ } else if (p[3] == '\0') {
+ // But it may be omitted in which case the default Doxygen convention of
+ // using "something"/"endsomething" is used.
+ endCommand = "end" + theCommand;
+ }
+ }
+ }
+
+ return endCommand;
+}
+
+void DoxygenParser::ignoreCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) {
+ const string endCommand = getIgnoreFeatureEndCommand(theCommand);
+ if (!endCommand.empty()) {
+ TokenListCIt itEnd = getEndCommand(endCommand, tokList);
+ if (itEnd == tokList.end()) {
+ printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected Doxygen command: " + endCommand + ".");
+ return;
+ }
+ // If we ignore the command, also ignore any whitespace preceding it as we
+ // want to avoid having lines consisting of whitespace only or trailing
+ // whitespace in general (at least Python, with its pep8 tool, really
+ // doesn't like it).
+ if (!doxyList.empty()) {
+ DoxygenEntityList::iterator i = doxyList.end();
+ --i;
+ if (i->typeOfEntity == "plainstd::string" && i->data.find_first_not_of(" \t") == std::string::npos) {
+ doxyList.erase(i);
+ }
+ }
+ // Determine what to do with the part of the comment between the start and
+ // end commands: by default, we simply throw it away, but "contents"
+ // attribute may be used to change this.
+ if (String *const contents = getIgnoreFeature(theCommand, "contents")) {
+ // Currently only "parse" is supported but we may need to add "copy" to
+ // handle custom tags which contain text that is supposed to be copied
+ // verbatim in the future.
+ if (Strcmp(contents, "parse") == 0) {
+ DoxygenEntityList aNewList = parse(itEnd, tokList);
+ doxyList.splice(doxyList.end(), aNewList);
+ } else {
+ Swig_error(m_fileName.c_str(), m_fileLineNo, "Invalid \"doxygen:ignore\" feature \"contents\" attribute \"%s\".\n", Char(contents));
+ return;
+ }
+ }
+
+ m_tokenListIt = itEnd;
+ m_tokenListIt++;
+ } else if (String *const range = getIgnoreFeature(theCommand, "range")) {
+ // Currently we only support "line" but, in principle, we should also
+ // support "word" and "paragraph" for consistency with the built-in Doxygen
+ // commands which can have either of these three ranges (which are indicated
+ // using <word-arg>, (line-arg) and {para-arg} respectively in Doxygen
+ // documentation).
+ if (Strcmp(range, "line") == 0) {
+ // Consume everything until the end of line.
+ m_tokenListIt = getOneLine(tokList);
+ skipEndOfLine();
+ } else {
+ Swig_error(m_fileName.c_str(), m_fileLineNo, "Invalid \"doxygen:ignore\" feature \"range\" attribute \"%s\".\n", Char(range));
+ return;
+ }
+ }
+}
+
+void DoxygenParser::addCommand(const std::string &commandString, const TokenList &tokList, DoxygenEntityList &doxyList) {
+
+ string theCommand = stringToLower(commandString);
+
+ if (theCommand == "plainstd::string") {
+ string nextPhrase = getStringTilCommand(tokList);
+ if (noisy)
+ cout << "Parsing plain std::string :" << nextPhrase << endl;
+ doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase));
+ return;
+ }
+
+ switch (commandBelongs(commandString)) {
+ case SIMPLECOMMAND:
+ addSimpleCommand(theCommand, doxyList);
+ break;
+ case COMMANDWORD:
+ addCommandWord(theCommand, tokList, doxyList);
+ break;
+ case COMMANDLINE:
+ addCommandLine(theCommand, tokList, doxyList);
+ break;
+ case COMMANDPARAGRAPH:
+ addCommandParagraph(theCommand, tokList, doxyList);
+ break;
+ case COMMANDENDCOMMAND:
+ addCommandEndCommand(theCommand, tokList, doxyList);
+ break;
+ case COMMANDWORDPARAGRAPH:
+ addCommandWordParagraph(theCommand, tokList, doxyList);
+ break;
+ case COMMANDWORDLINE:
+ addCommandWordLine(theCommand, tokList, doxyList);
+ break;
+ case COMMANDWORDOWORDWORD:
+ addCommandWordOWordOWord(theCommand, tokList, doxyList);
+ break;
+ case COMMANDOWORD:
+ addCommandOWord(theCommand, tokList, doxyList);
+ break;
+ case COMMANDERRORTHROW:
+ addCommandErrorThrow(theCommand, tokList, doxyList);
+ break;
+ case COMMANDUNIQUE:
+ addCommandUnique(theCommand, tokList, doxyList);
+ break;
+ case COMMAND_HTML:
+ addCommandHtml(theCommand, tokList, doxyList);
+ break;
+ case COMMAND_HTML_ENTITY:
+ addCommandHtmlEntity(theCommand, tokList, doxyList);
+ break;
+ case COMMAND_ALIAS:
+ aliasCommand(commandString, tokList, doxyList);
+ break;
+ case COMMAND_IGNORE:
+ ignoreCommand(commandString, tokList, doxyList);
+ break;
+ case NONE:
+ case END_LINE:
+ case PARAGRAPH_END:
+ case PLAINSTRING:
+ case COMMAND:
+ // TODO: Ensure that these values either are correctly ignored here or can't happen.
+ break;
+ }
+}
+
+/**
+ * This method converts TokenList to DoxygenEntryList.
+ */
+DoxygenEntityList DoxygenParser::parse(TokenListCIt endParsingIndex, const TokenList &tokList, bool root) {
+ // if we are root, than any strings should be added as 'partofdescription', else as 'plainstd::string'
+ std::string currPlainstringCommandType = root ? "partofdescription" : "plainstd::string";
+ DoxygenEntityList aNewList;
+
+ // Less than check (instead of not equal) is a safeguard in case the
+ // iterator is incremented past the end
+ while (m_tokenListIt < endParsingIndex) {
+
+ Token currToken = *m_tokenListIt;
+
+ if (noisy)
+ cout << "Parsing for phrase starting in:" << currToken.toString() << endl;
+
+ if (currToken.m_tokenType == END_LINE) {
+ aNewList.push_back(DoxygenEntity("plainstd::endl"));
+ m_tokenListIt++;
+ } else if (currToken.m_tokenType == COMMAND) {
+ m_tokenListIt++;
+ addCommand(currToken.m_tokenString, tokList, aNewList);
+ } else if (currToken.m_tokenType == PLAINSTRING) {
+ addCommand(currPlainstringCommandType, tokList, aNewList);
+ }
+
+ // If addCommand above misbehaves, it can move the iterator past endParsingIndex
+ if (m_tokenListIt > endParsingIndex)
+ printListError(WARN_DOXYGEN_UNEXPECTED_ITERATOR_VALUE, "Unexpected iterator value in DoxygenParser::parse");
+
+ if (endParsingIndex != tokList.end() && m_tokenListIt == tokList.end()) {
+ // this could happen if we can't reach the original endParsingIndex
+ printListError(WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT, "Unexpected end of Doxygen comment encountered.");
+ break;
+ }
+ }
+ return aNewList;
+}
+
+DoxygenEntityList DoxygenParser::createTree(Node *node, String *documentation) {
+ m_node = node;
+
+ tokenizeDoxygenComment(Char(documentation), Char(Getfile(documentation)), Getline(documentation));
+
+ if (noisy) {
+ cout << "---TOKEN LIST---" << endl;
+ printList();
+ }
+
+ DoxygenEntityList rootList = parse(m_tokenList.end(), m_tokenList, true);
+
+ if (noisy) {
+ cout << "PARSED LIST" << endl;
+ printTree(rootList);
+ }
+ return rootList;
+}
+
+/*
+ * Splits 'text' on 'separator' chars. Separator chars are not part of the
+ * strings.
+ */
+DoxygenParser::StringVector DoxygenParser::split(const std::string &text, char separator) {
+ StringVector lines;
+ size_t prevPos = 0, pos = 0;
+
+ while (pos < string::npos) {
+ pos = text.find(separator, prevPos);
+ lines.push_back(text.substr(prevPos, pos - prevPos));
+ prevPos = pos + 1;
+ }
+
+ return lines;
+}
+
+/*
+ * Returns true, if 'c' is one of doxygen comment block start
+ * characters: *, /, or !
+ */
+bool DoxygenParser::isStartOfDoxyCommentChar(char c) {
+ return (strchr("*/!", c) != NULL);
+}
+
+/*
+ * Adds token with Doxygen command to token list, but only if command is one of
+ * Doxygen commands. In that case true is returned. If the command is not
+ * recognized as a doxygen command, it is ignored and false is returned.
+ */
+bool DoxygenParser::addDoxyCommand(DoxygenParser::TokenList &tokList, const std::string &cmd) {
+ if (commandBelongs(cmd) != NONE) {
+ tokList.push_back(Token(COMMAND, cmd));
+ return true;
+ } else {
+ // This function is called for the special Doxygen commands, but also for
+ // HTML commands (or anything that looks like them, actually) and entities.
+ // We don't recognize all of those, so just ignore them and pass them
+ // through, but warn about unknown Doxygen commands as ignoring them will
+ // often result in wrong output being generated.
+ const char ch = *cmd.begin();
+ if (ch != '<' && ch != '&') {
+ // Before calling printListError() we must ensure that m_tokenListIt used
+ // by it is valid.
+ const TokenListCIt itSave = m_tokenListIt;
+ m_tokenListIt = m_tokenList.end();
+
+ printListError(WARN_DOXYGEN_UNKNOWN_COMMAND, "Unknown Doxygen command: " + cmd + ".");
+
+ m_tokenListIt = itSave;
+ }
+ }
+
+ return false;
+}
+
+/*
+ * This method copies comment text to output as it is - no processing is
+ * done, Doxygen commands are ignored. It is used for commands \verbatim,
+ * \htmlonly, \f$, \f[, and \f{.
+ */
+size_t DoxygenParser::processVerbatimText(size_t pos, const std::string &line) {
+ if (line[pos] == '\\' || line[pos] == '@') { // check for end commands
+
+ pos++;
+ size_t endOfWordPos = line.find_first_not_of(DOXYGEN_WORD_CHARS, pos);
+ string cmd = line.substr(pos, endOfWordPos - pos);
+
+ if (cmd == CMD_END_HTML_ONLY || cmd == CMD_END_VERBATIM || cmd == CMD_END_LATEX_1 || cmd == CMD_END_LATEX_2 || cmd == CMD_END_LATEX_3) {
+
+ m_isVerbatimText = false;
+ addDoxyCommand(m_tokenList, cmd);
+
+ } else {
+
+ m_tokenList.push_back(Token(PLAINSTRING,
+ // include '\' or '@'
+ line.substr(pos - 1, endOfWordPos - pos + 1)));
+ }
+
+ pos = endOfWordPos;
+
+ } else {
+
+ // whitespaces are stored as plain strings
+ size_t startOfPossibleEndCmd = line.find_first_of("\\@", pos);
+ m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, startOfPossibleEndCmd - pos)));
+ pos = startOfPossibleEndCmd;
+ }
+
+ return pos;
+}
+
+/*
+ * Processes doxy commands for escaped characters: \$ \@ \\ \& \~ \< \> \# \% \" \. \::
+ * Handling this separately supports documentation text like \@someText.
+ */
+bool DoxygenParser::processEscapedChars(size_t &pos, const std::string &line) {
+ if ((pos + 1) < line.size()) {
+
+ // \ and @ with trailing whitespace or quoted get to output as plain string
+ string whitespaces = " '\t\n";
+ if (whitespaces.find(line[pos + 1]) != string::npos) {
+ m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, 1)));
+ pos++;
+ return true;
+ }
+ // these chars can be escaped for doxygen
+ string escapedChars = "$@\\&~<>#%\".";
+ if (escapedChars.find(line[pos + 1]) != string::npos) {
+
+ addDoxyCommand(m_tokenList, line.substr(pos + 1, 1));
+ pos += 2;
+ return true;
+
+ } else if ((pos + 2) < line.size() && line[pos + 1] == ':' && line[pos + 2] == ':') {
+
+ // add command \:: - handling this separately supports documentation
+ // text like \::someText
+ addDoxyCommand(m_tokenList, line.substr(pos + 1, 2));
+ pos += 3;
+ return true;
+ }
+ }
+ return false;
+}
+
+/*
+ * Processes word doxygen commands, like \arg, \c, \b, \return, ...
+ */
+void DoxygenParser::processWordCommands(size_t &pos, const std::string &line) {
+ pos++;
+ size_t endOfWordPos = line.find_first_not_of(DOXYGEN_WORD_CHARS, pos);
+
+ string cmd = line.substr(pos, endOfWordPos - pos);
+ addDoxyCommand(m_tokenList, cmd);
+
+ if (cmd == CMD_HTML_ONLY || cmd == CMD_VERBATIM || cmd == CMD_LATEX_1 || cmd == CMD_LATEX_2 || cmd == CMD_LATEX_3) {
+
+ m_isVerbatimText = true;
+
+ } else {
+ // skip any possible spaces after command, because some commands have parameters,
+ // and spaces between command and parameter must be ignored.
+ if (endOfWordPos != string::npos) {
+ endOfWordPos = line.find_first_not_of(" \t", endOfWordPos);
+ }
+ }
+ pos = endOfWordPos;
+}
+
+void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) {
+ bool isEndHtmlTag = false;
+ pos++;
+ if (line.size() > pos && line[pos] == '/') {
+ isEndHtmlTag = true;
+ pos++;
+ }
+
+ size_t endHtmlPos = line.find_first_of("\t >", pos);
+
+ string cmd = line.substr(pos, endHtmlPos - pos);
+ pos = endHtmlPos;
+
+ // prepend '<' to distinguish HTML tags from doxygen commands
+ if (!cmd.empty() && addDoxyCommand(m_tokenList, '<' + cmd)) {
+ // it is a valid HTML command
+ if (line[pos] != '>') {
+ // it should be HTML tag with args,
+ // for example <A ...>, <IMG ...>, ...
+ if (isEndHtmlTag) {
+ m_tokenListIt = m_tokenList.end();
+ printListError(WARN_DOXYGEN_HTML_ERROR, "Doxygen HTML error for tag " + cmd + ": Illegal end HTML tag without '>' found.");
+ }
+
+ endHtmlPos = line.find(">", pos);
+ if (endHtmlPos == string::npos) {
+ m_tokenListIt = m_tokenList.end();
+ printListError(WARN_DOXYGEN_HTML_ERROR, "Doxygen HTML error for tag " + cmd + ": HTML tag without '>' found.");
+ }
+ // add args of HTML command, like link URL, image URL, ...
+ m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, endHtmlPos - pos)));
+ pos = endHtmlPos;
+ } else {
+ if (isEndHtmlTag) {
+ m_tokenList.push_back(Token(PLAINSTRING, END_HTML_TAG_MARK));
+ } else {
+ // it is a simple tag, so push empty string
+ m_tokenList.push_back(Token(PLAINSTRING, ""));
+ }
+ }
+
+ if (pos != string::npos) {
+ pos++; // skip '>'
+ }
+ } else {
+ // the command is not HTML supported by Doxygen, < and > will be
+ // replaced by HTML entities &lt; and &gt; respectively,
+ addDoxyCommand(m_tokenList, "&lt");
+ m_tokenList.push_back(Token(PLAINSTRING, cmd));
+ }
+}
+
+void DoxygenParser::processHtmlEntities(size_t &pos, const std::string &line) {
+ size_t endOfWordPos = line.find_first_not_of("abcdefghijklmnopqrstuvwxyz", pos + 1);
+
+ if (endOfWordPos != string::npos) {
+
+ if (line[endOfWordPos] == ';' && (endOfWordPos - pos) > 1) {
+ // if entity is not recognized by Doxygen (not in the list of
+ // commands) nothing is added (here and in Doxygen).
+ addDoxyCommand(m_tokenList, line.substr(pos, endOfWordPos - pos));
+ endOfWordPos++; // skip ';'
+ } else {
+ // it is not an entity - add entity for ampersand and the rest of string
+ addDoxyCommand(m_tokenList, "&amp");
+ m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos + 1, endOfWordPos - pos - 1)));
+ }
+ }
+ pos = endOfWordPos;
+}
+
+/*
+ * This method processes normal comment, which has to be tokenized.
+ */
+size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) {
+ switch (line[pos]) {
+ case '\\':
+ case '@':
+ if (processEscapedChars(pos, line)) {
+ break;
+ }
+ // handle word commands \arg, \c, \return, ... and \f[, \f$, ... commands
+ processWordCommands(pos, line);
+ break;
+
+ case ' ': // whitespace
+ case '\t':
+ {
+ // whitespaces are stored as plain strings
+ size_t startOfNextWordPos = line.find_first_not_of(" \t", pos + 1);
+ m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, startOfNextWordPos - pos)));
+ pos = startOfNextWordPos;
+ }
+ break;
+
+ case '<':
+ processHtmlTags(pos, line);
+ break;
+ case '>': // this char is detected here only when it is not part of HTML tag
+ addDoxyCommand(m_tokenList, "&gt");
+ pos++;
+ break;
+ case '&':
+ processHtmlEntities(pos, line);
+ break;
+ case '"':
+ m_isInQuotedString = true;
+ m_tokenList.push_back(Token(PLAINSTRING, "\""));
+ pos++;
+ break;
+ default:
+ m_tokenListIt = m_tokenList.end();
+ printListError(WARN_DOXYGEN_UNKNOWN_CHARACTER, std::string("Unknown special character in Doxygen comment: ") + line[pos] + ".");
+ }
+
+ return pos;
+}
+
+/*
+ * This is the main method, which tokenizes Doxygen comment to words and
+ * doxygen commands.
+ */
+void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine) {
+ m_isVerbatimText = false;
+ m_isInQuotedString = false;
+ m_tokenList.clear();
+ m_fileLineNo = fileLine;
+ m_fileName = fileName;
+
+ StringVector lines = split(doxygenComment, '\n');
+
+ // remove trailing spaces, because they cause additional new line at the end
+ // comment, which is wrong, because these spaces are space preceding
+ // end of comment : ' */'
+ if (!doxygenComment.empty() && doxygenComment[doxygenComment.size() - 1] == ' ') {
+
+ string lastLine = lines[lines.size() - 1];
+
+ if (trim(lastLine).empty()) {
+ lines.pop_back(); // remove trailing empty line
+ }
+ }
+
+ for (StringVectorCIt it = lines.begin(); it != lines.end(); it++) {
+ const string &line = *it;
+ size_t pos = line.find_first_not_of(" \t");
+
+ if (pos == string::npos) {
+ m_tokenList.push_back(Token(END_LINE, "\n"));
+ continue;
+ }
+ // skip sequences of '*', '/', and '!' of any length
+ bool isStartOfCommentLineCharFound = false;
+ while (pos < line.size() && isStartOfDoxyCommentChar(line[pos])) {
+ pos++;
+ isStartOfCommentLineCharFound = true;
+ }
+
+ if (pos == line.size()) {
+ m_tokenList.push_back(Token(END_LINE, "\n"));
+ continue;
+ }
+ // if 'isStartOfCommentLineCharFound' then preserve leading spaces, so
+ // ' * comment' gets translated to ' * comment', not ' * comment'
+ // This is important to keep formatting for comments translated to Python.
+ if (isStartOfCommentLineCharFound && line[pos] == ' ') {
+ pos++; // points to char after ' * '
+ if (pos == line.size()) {
+ m_tokenList.push_back(Token(END_LINE, "\n"));
+ continue;
+ }
+ }
+ // line[pos] may be ' \t' or start of word, it there was no '*', '/' or '!'
+ // at beginning of the line. Make sure it points to start of the first word
+ // in the line.
+ if (isStartOfCommentLineCharFound) {
+ size_t firstWordPos = line.find_first_not_of(" \t", pos);
+ if (firstWordPos == string::npos) {
+ m_tokenList.push_back(Token(END_LINE, "\n"));
+ continue;
+ }
+
+ if (firstWordPos > pos) {
+ m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, firstWordPos - pos)));
+ pos = firstWordPos;
+ }
+ } else {
+ m_tokenList.push_back(Token(PLAINSTRING, line.substr(0, pos)));
+ }
+
+ while (pos != string::npos) {
+ // find the end of the word
+ size_t doxyCmdOrHtmlTagPos = line.find_first_of("\\@<>&\" \t", pos);
+ if (doxyCmdOrHtmlTagPos != pos) {
+ // plain text found
+ // if the last char is punctuation, make it a separate word, otherwise
+ // it may be included with word also when not appropriate, for example:
+ // colors are \b red, green, and blue --> colors are <b>red,</b> green, and blue
+ // instead of (comma not bold):
+ // colors are \b red, green, and blue --> colors are <b>red</b>, green, and blue
+ // In Python it looks even worse:
+ // colors are \b red, green, and blue --> colors are 'red,' green, and blue
+ string text = line.substr(pos, doxyCmdOrHtmlTagPos - pos);
+ string punctuations(".,:");
+ size_t textSize = text.size();
+
+ if (!text.empty()
+ && punctuations.find(text[text.size() - 1]) != string::npos &&
+ // but do not break ellipsis (...)
+ !(textSize > 1 && text[textSize - 2] == '.')) {
+ m_tokenList.push_back(Token(PLAINSTRING, text.substr(0, text.size() - 1)));
+ m_tokenList.push_back(Token(PLAINSTRING, text.substr(text.size() - 1)));
+ } else {
+ m_tokenList.push_back(Token(PLAINSTRING, text));
+ }
+ }
+
+ pos = doxyCmdOrHtmlTagPos;
+ if (pos != string::npos) {
+ if (m_isVerbatimText) {
+ pos = processVerbatimText(pos, line);
+
+ } else if (m_isInQuotedString) {
+
+ if (line[pos] == '"') {
+ m_isInQuotedString = false;
+ }
+ m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, 1)));
+ pos++;
+
+ } else {
+ pos = processNormalComment(pos, line);
+ }
+ }
+ }
+ m_tokenList.push_back(Token(END_LINE, "\n")); // add when pos == npos - end of line
+ }
+
+ m_tokenListIt = m_tokenList.begin();
+}
+
+void DoxygenParser::printList() {
+
+ int tokNo = 0;
+ for (TokenListCIt it = m_tokenList.begin(); it != m_tokenList.end(); it++, tokNo++) {
+
+ cout << it->toString() << " ";
+
+ if ((tokNo % TOKENSPERLINE) == 0) {
+ cout << endl;
+ }
+ }
+}
+
+void DoxygenParser::printListError(int warningType, const std::string &message) {
+ int curLine = m_fileLineNo;
+ for (TokenListCIt it = m_tokenList.begin(); it != m_tokenListIt; it++) {
+ if (it->m_tokenType == END_LINE) {
+ curLine++;
+ }
+ }
+
+ Swig_warning(warningType, m_fileName.c_str(), curLine, "%s\n", message.c_str());
+}
diff --git a/Source/Doxygen/doxyparser.h b/Source/Doxygen/doxyparser.h
new file mode 100644
index 000000000..96c71d22f
--- /dev/null
+++ b/Source/Doxygen/doxyparser.h
@@ -0,0 +1,372 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * doxyparser.h
+ * ----------------------------------------------------------------------------- */
+
+#ifndef DOXYGENPARSER_H_
+#define DOXYGENPARSER_H_
+#include <string>
+#include <list>
+#include <map>
+#include <vector>
+#include <set>
+
+#include "swig.h"
+
+#include "doxyentity.h"
+
+class DoxygenParser {
+private:
+
+ enum DoxyCommandEnum {
+ NONE = -1,
+ SIMPLECOMMAND,
+ COMMANDWORD,
+ COMMANDLINE,
+ COMMANDPARAGRAPH,
+ COMMANDENDCOMMAND,
+ COMMANDWORDPARAGRAPH,
+ COMMANDWORDLINE,
+ COMMANDWORDOWORDWORD,
+ COMMANDOWORD,
+ COMMANDERRORTHROW,
+ COMMANDUNIQUE,
+ COMMAND_HTML,
+ COMMAND_HTML_ENTITY,
+ COMMAND_ALIAS,
+ COMMAND_IGNORE,
+ END_LINE,
+ PARAGRAPH_END,
+ PLAINSTRING,
+ COMMAND
+ };
+
+
+ /** This class contains parts of Doxygen comment as a token. */
+ class Token {
+ public:
+ DoxyCommandEnum m_tokenType;
+ std::string m_tokenString; /* the data , such as param for @param */
+
+ Token(DoxyCommandEnum tType, std::string tString) : m_tokenType(tType), m_tokenString(tString) {
+ }
+
+ std::string toString() const {
+ switch (m_tokenType) {
+ case END_LINE:
+ return "{END OF LINE}";
+ case PARAGRAPH_END:
+ return "{END OF PARAGRAPH}";
+ case PLAINSTRING:
+ return "{PLAINSTRING :" + m_tokenString + "}";
+ case COMMAND:
+ return "{COMMAND : " + m_tokenString + "}";
+ default:
+ return "";
+ }
+ }
+ };
+
+
+ typedef std::vector<Token> TokenList;
+ typedef TokenList::const_iterator TokenListCIt;
+ typedef TokenList::iterator TokenListIt;
+
+ TokenList m_tokenList;
+ TokenListCIt m_tokenListIt;
+
+ typedef std::map<std::string, DoxyCommandEnum> DoxyCommandsMap;
+ typedef DoxyCommandsMap::iterator DoxyCommandsMapIt;
+
+ /*
+ * Map of Doxygen commands to determine if a string is a
+ * command and how it needs to be parsed
+ */
+ static DoxyCommandsMap doxygenCommands;
+ static std::set<std::string> doxygenSectionIndicators;
+
+ bool m_isVerbatimText; // used to handle \htmlonly and \verbatim commands
+ bool m_isInQuotedString;
+
+ Node *m_node;
+ std::string m_fileName;
+ int m_fileLineNo;
+
+ /*
+ * Return the end command for a command appearing in "ignore" feature or empty
+ * string if this is a simple command and not a block one.
+ */
+ std::string getIgnoreFeatureEndCommand(const std::string &theCommand) const;
+
+ /*
+ * Helper for getting the value of doxygen:ignore feature or its argument.
+ */
+ String *getIgnoreFeature(const std::string &theCommand, const char *argument = NULL) const;
+
+ /*
+ * Whether to print lots of debug info during parsing
+ */
+ bool noisy;
+
+ /*
+ *Changes a std::string to all lower case
+ */
+ std::string stringToLower(const std::string &stringToConvert);
+
+ /*
+ * isSectionIndicator returns a boolean if the command is a section indicator
+ * This is a helper method for finding the end of a paragraph
+ * by Doxygen's terms
+ */
+ bool isSectionIndicator(const std::string &smallString);
+ /*
+ * Determines how a command should be handled (what group it belongs to
+ * for parsing rules
+ */
+ DoxyCommandEnum commandBelongs(const std::string &theCommand);
+
+ /*
+ *prints the parse tree
+ */
+ void printTree(const std::list<DoxygenEntity> &rootList);
+
+ /**
+ * Returns true if the next token is end of line token. This is important
+ * when single word commands like \c are at the end of line.
+ */
+ bool isEndOfLine();
+
+ /**
+ * Skips spaces, tabs, and end of line tokens.
+ */
+ void skipWhitespaceTokens();
+
+ /**
+ * Removes all spaces and tabs from beginning end end of string.
+ */
+ std::string trim(const std::string &text);
+
+ /*
+ * Returns string of the next token if the next token is PLAINSTRING. Returns
+ * empty string otherwise.
+ */
+ std::string getNextToken();
+
+ /*
+ * Returns the next word ON THE CURRENT LINE ONLY
+ * if a new line is encountered, returns a blank std::string.
+ * Updates the iterator if successful.
+ */
+ std::string getNextWord();
+
+ /*
+ * Returns the next word, which is not necessarily on the same line.
+ * Updates the iterator if successful.
+ */
+ std::string getNextWordInComment();
+
+ /*
+ * Returns the location of the end of the line as
+ * an iterator.
+ */
+ TokenListCIt getOneLine(const TokenList &tokList);
+
+ /*
+ * Returns a properly formatted std::string
+ * up til ANY command or end of line is encountered.
+ */
+ std::string getStringTilCommand(const TokenList &tokList);
+
+ /*
+ * Returns a properly formatted std::string
+ * up til the command specified is encountered
+ */
+ //TODO check that this behaves properly for formulas
+ std::string getStringTilEndCommand(const std::string &theCommand, const TokenList &tokList);
+
+ /*
+ * Returns the end of a Paragraph as an iterator-
+ * Paragraph is defined in Doxygen to be a paragraph of text
+ * separated by either a structural command or a blank line
+ */
+ TokenListCIt getEndOfParagraph(const TokenList &tokList);
+
+ /*
+ * Returns the end of a section, defined as the first blank line OR first
+ * encounter of the same command. Example of this behaviour is \arg.
+ * If no end is encountered, returns the last token of the std::list.
+ */
+ TokenListCIt getEndOfSection(const std::string &theCommand, const TokenList &tokList);
+
+ /*
+ * This method is for returning the end of a specific form of doxygen command
+ * that begins with a \command and ends in \endcommand
+ * such as \code and \endcode. The proper usage is
+ * progressTilEndCommand("endcode", tokenList);
+ * If the end is never encountered, it returns the end of the std::list.
+ */
+ TokenListCIt getEndCommand(const std::string &theCommand, const TokenList &tokList);
+ /*
+ * A special method for commands such as \arg that end at the end of a
+ * paragraph OR when another \arg is encountered
+ //TODO getTilAnyCommand
+ TokenListCIt getTilAnyCommand(const std::string &theCommand, const TokenList &tokList);
+ */
+
+ /**
+ * This methods skips end of line token, if it is the next token to be
+ * processed. It is called with comment commands which have args till the
+ * end of line, such as 'addtogroup' or 'addindex'.
+ * It is up to translator to specific language to decide whether
+ * to insert eol or not. For example, if a command is ignored in target
+ * language, new lines may make formatting ugly (Python).
+ */
+ void skipEndOfLine();
+
+ /*
+ * Method for Adding a Simple Command
+ * Format: @command
+ * Plain commands, such as newline etc, they contain no other data
+ * \n \\ \@ \& \$ \# \< \> \%
+ */
+ void addSimpleCommand(const std::string &theCommand, DoxygenEntityList &doxyList);
+ /*
+ * CommandWord
+ * Format: @command <word>
+ * Commands with a single WORD after then such as @b
+ * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package",
+ * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include",
+ * "includelineno"
+ */
+ void addCommandWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+ /*
+ * CommandLine
+ * Format: @command (line)
+ * Commands with a single LINE after then such as @var
+ * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip",
+ * "until", "property"
+ */
+ void addCommandLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+ /*
+ * CommandParagraph
+ * Format: @command {paragraph}
+ * Commands with a single paragraph after then such as @return
+ * "return", "remarks", "since", "test", "sa", "see", "pre", "post",
+ * "details", "invariant", "deprecated", "date", "note", "warning",
+ * "version", "todo", "bug", "attention", "brief", "arg", "author"
+ */
+ void addCommandParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+ /*
+ * Command EndCommand
+ * Format: @command and ends at @endcommand
+ * Commands that take in a block of text such as @code:
+ * "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly",
+ * "latexonly", "manonly", "verbatim", "xmlonly", "cond", "if", "ifnot",
+ * "link"
+ * Returns 1 if success, 0 if the endcommand is never encountered.
+ */
+ void addCommandEndCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+ /*
+ * CommandWordParagraph
+ * Format: @command <word> {paragraph}
+ * Commands such as param
+ * "param", "tparam", "throw", "throws", "retval", "exception"
+ */
+ void addCommandWordParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+ /*
+ * CommandWordLine
+ * Format: @command <word> (line)
+ * Commands such as param
+ * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"
+ */
+ void addCommandWordLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+ /*
+ * Command Word Optional Word Optional Word
+ * Format: @command <word> [<header-file>] [<header-name>]
+ * Commands such as class
+ * "category", "class", "protocol", "interface", "struct", "union"
+ */
+ void addCommandWordOWordOWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+ /*
+ * Command Optional Word
+ * Format: @command [<word>]
+ * Commands such as dir
+ * "dir", "file", "cond"
+ */
+ void addCommandOWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+
+ /*
+ * Commands that should not be encountered (such as PHP only)
+ * goes til the end of line then returns
+ */
+ void addCommandErrorThrow(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+
+ void addCommandHtml(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+
+ void addCommandHtmlEntity(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+
+ /*
+ *Adds the unique commands- different process for each unique command
+ */
+ void addCommandUnique(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+
+ /*
+ * Replace the given command with its predefined alias expansion.
+ */
+ void aliasCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+
+ /*
+ * Simply ignore the given command, possibly with the word following it or
+ * until the matching end command.
+ */
+ void ignoreCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
+
+ /*
+ * The actual "meat" of the doxygen parser. Calls the correct addCommand...()
+ * function.
+ */
+ void addCommand(const std::string &commandString, const TokenList &tokList, DoxygenEntityList &doxyList);
+
+ DoxygenEntityList parse(TokenListCIt endParsingIndex, const TokenList &tokList, bool root = false);
+
+ /*
+ * Fill static doxygenCommands and sectionIndicators containers
+ */
+ void fillTables();
+
+ /** Processes comment when \htmlonly and \verbatim commands are encountered. */
+ size_t processVerbatimText(size_t pos, const std::string &line);
+
+ bool processEscapedChars(size_t &pos, const std::string &line);
+ void processWordCommands(size_t &pos, const std::string &line);
+ void processHtmlTags(size_t &pos, const std::string &line);
+ void processHtmlEntities(size_t &pos, const std::string &line);
+
+
+ /** Processes comment outside \htmlonly and \verbatim commands. */
+ size_t processNormalComment(size_t pos, const std::string &line);
+
+ void tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine);
+ void printList();
+ void printListError(int warningType, const std::string &message);
+
+ typedef std::vector<std::string> StringVector;
+ typedef StringVector::const_iterator StringVectorCIt;
+
+ StringVector split(const std::string &text, char separator);
+ bool isStartOfDoxyCommentChar(char c);
+ bool addDoxyCommand(DoxygenParser::TokenList &tokList, const std::string &cmd);
+
+public:
+ DoxygenParser(bool noisy = false);
+ virtual ~DoxygenParser();
+ DoxygenEntityList createTree(Node *node, String *documentation);
+};
+
+#endif
diff --git a/Source/Doxygen/doxytranslator.cxx b/Source/Doxygen/doxytranslator.cxx
new file mode 100644
index 000000000..fb21de75c
--- /dev/null
+++ b/Source/Doxygen/doxytranslator.cxx
@@ -0,0 +1,69 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * doxytranslator.cxx
+ *
+ * Module to return documentation for nodes formatted for various documentation
+ * systems.
+ * ----------------------------------------------------------------------------- */
+
+#include "doxytranslator.h"
+
+DoxygenTranslator::DoxygenTranslator(int flags) : m_flags(flags), parser((flags &debug_parser) != 0) {
+}
+
+
+DoxygenTranslator::~DoxygenTranslator() {
+}
+
+
+bool DoxygenTranslator::hasDocumentation(Node *node) {
+ return getDoxygenComment(node) != NULL;
+}
+
+
+String *DoxygenTranslator::getDoxygenComment(Node *node) {
+ return Getattr(node, "doxygen");
+}
+
+/**
+ * Indent all lines in the comment by given indentation string
+ */
+void DoxygenTranslator::extraIndentation(String *comment, const_String_or_char_ptr indentationString) {
+ if (indentationString || Len(indentationString) > 0) {
+ int len = Len(comment);
+ bool trailing_newline = len > 0 && *(Char(comment) + len - 1) == '\n';
+ Insert(comment, 0, indentationString);
+ String *replace = NewStringf("\n%s", indentationString);
+ Replaceall(comment, "\n", replace);
+ if (trailing_newline) {
+ len = Len(comment);
+ Delslice(comment, len - 2, len); // Remove added trailing spaces on last line
+ }
+ Delete(replace);
+ }
+}
+
+String *DoxygenTranslator::getDocumentation(Node *node, const_String_or_char_ptr indentationString) {
+
+ if (!hasDocumentation(node)) {
+ return NewString("");
+ }
+
+ String *documentation = makeDocumentation(node);
+ extraIndentation(documentation, indentationString);
+ return documentation;
+}
+
+
+void DoxygenTranslator::printTree(const DoxygenEntityList &entityList) {
+
+ for (DoxygenEntityListCIt p = entityList.begin(); p != entityList.end(); p++) {
+ p->printEntity(0);
+ }
+}
diff --git a/Source/Doxygen/doxytranslator.h b/Source/Doxygen/doxytranslator.h
new file mode 100644
index 000000000..f07b632a2
--- /dev/null
+++ b/Source/Doxygen/doxytranslator.h
@@ -0,0 +1,90 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * doxytranslator.h
+ *
+ * Module to return documentation for nodes formatted for various documentation
+ * systems.
+ * ----------------------------------------------------------------------------- */
+
+#ifndef DOXYGENTRANSLATOR_H_
+#define DOXYGENTRANSLATOR_H_
+
+#include "swig.h"
+#include "doxyentity.h"
+#include "doxyparser.h"
+#include <list>
+#include <string>
+
+
+/*
+ * This is a base class for translator classes. It defines the basic interface
+ * for translators, which convert Doxygen comments into alternative formats for
+ * target languages.
+ */
+class DoxygenTranslator {
+public:
+ /*
+ * Bit flags for the translator ctor.
+ *
+ * Derived classes may define additional flags.
+ */
+ enum {
+ // Use DoxygenParser in "noisy" mode.
+ debug_parser = 1,
+
+ // Output results of translating Doxygen comments.
+ debug_translator = 2
+ };
+
+ /*
+ * Constructor
+ */
+ DoxygenTranslator(int flags = 0);
+
+ /*
+ * Virtual destructor.
+ */
+ virtual ~DoxygenTranslator();
+
+ /*
+ * Return the documentation for a given node formated for the correct
+ * documentation system.
+ */
+ String *getDocumentation(Node *node, const_String_or_char_ptr indentationString);
+
+ /*
+ * Returns truem is the specified node has comment attached.
+ */
+ bool hasDocumentation(Node *node);
+
+ /*
+ * Get original comment string in Doxygen-format.
+ */
+ String *getDoxygenComment(Node *node);
+
+protected:
+ // The flags passed to the ctor.
+ const int m_flags;
+
+ DoxygenParser parser;
+
+ /*
+ * Returns the documentation formatted for a target language.
+ */
+ virtual String *makeDocumentation(Node *node) = 0;
+
+ /*
+ * Prints the details of a parsed entity list to stdout (for debugging).
+ */
+ void printTree(const DoxygenEntityList &entityList);
+
+ void extraIndentation(String *comment, const_String_or_char_ptr indentationString);
+};
+
+#endif
diff --git a/Source/Doxygen/javadoc.cxx b/Source/Doxygen/javadoc.cxx
new file mode 100644
index 000000000..72f84ab6c
--- /dev/null
+++ b/Source/Doxygen/javadoc.cxx
@@ -0,0 +1,845 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * javadoc.cxx
+ * ----------------------------------------------------------------------------- */
+
+#include "javadoc.h"
+#include "doxyparser.h"
+#include <iostream>
+#include <vector>
+#include <list>
+#include "swigmod.h"
+#define APPROX_LINE_LENGTH 64 // characters per line allowed
+#define TAB_SIZE 8 // current tab size in spaces
+//TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag
+
+// define static tables, they are filled in JavaDocConverter's constructor
+std::map<std::string, std::pair<JavaDocConverter::tagHandler, std::string> > JavaDocConverter::tagHandlers;
+
+using std::string;
+using std::list;
+using std::vector;
+
+void JavaDocConverter::fillStaticTables() {
+ if (tagHandlers.size()) // fill only once
+ return;
+
+ /*
+ * Some translation rules:
+ *
+ * @ and \ must be escaped for both Java and Python to appear on output: \@, \\,
+ * while Doxygen produces output in both cases.
+ * Rule: @ and \ with space on the right should get to output.
+ *
+ * :: remains intact, even in class::method(). But you can use class#method also
+ * in C++ comment and it is properly translated to C++ output (changed by doxygen to ::)
+ * and Java output (remains #).
+ * Rule: SWIG type system can't be used to convert C::m to C#m, because in Java it is C.m
+ * Use string replacement :: --> # in tag see and links.
+ *
+ * HTML tags must be translated - remain in Java, to markdown in Python
+ *
+ * Unknown HTML tags, for example <x> is translated to &lt;x&gt; by doxygen, while
+ * Java src is <x> and therefore invisible on output - browser ignores unknown command.
+ * This is handy in syntax descriptions, for example: more <fileName>.
+ *
+ * Standalone < and > need not be translated, they are rendered properly in
+ * all three outputs.
+ *
+ * ., %, and " need not to be translated
+ *
+ * entities must be translated - remain in Java, something meaningful in Python (&lt, ...)
+ *
+ * - Python
+ * - add comments also to auto-generated methods like equals(), delete() in Java,
+ * and methods for std::vector(), ...
+ * Commenting methods of std types is simple - add comment to std_*.i file.
+ */
+
+ // these commands insert HTML tags
+ tagHandlers["a"] = make_pair(&JavaDocConverter::handleTagHtml, "i");
+ tagHandlers["arg"] = make_pair(&JavaDocConverter::handleTagHtml, "li");
+ tagHandlers["b"] = make_pair(&JavaDocConverter::handleTagHtml, "b");
+ tagHandlers["c"] = make_pair(&JavaDocConverter::handleTagHtml, "code");
+ tagHandlers["cite"] = make_pair(&JavaDocConverter::handleTagHtml, "i");
+ tagHandlers["e"] = make_pair(&JavaDocConverter::handleTagHtml, "i");
+ tagHandlers["em"] = make_pair(&JavaDocConverter::handleTagHtml, "i");
+ tagHandlers["li"] = make_pair(&JavaDocConverter::handleTagHtml, "li");
+ tagHandlers["p"] = make_pair(&JavaDocConverter::handleTagHtml, "code");
+ // these commands insert just a single char, some of them need to be escaped
+ tagHandlers["$"] = make_pair(&JavaDocConverter::handleTagChar, "");
+ tagHandlers["@"] = make_pair(&JavaDocConverter::handleTagChar, "");
+ tagHandlers["\\"] = make_pair(&JavaDocConverter::handleTagChar, "");
+ tagHandlers["<"] = make_pair(&JavaDocConverter::handleTagChar, "&lt;");
+ tagHandlers[">"] = make_pair(&JavaDocConverter::handleTagChar, "&gt;");
+ tagHandlers["&"] = make_pair(&JavaDocConverter::handleTagChar, "&amp;");
+ tagHandlers["#"] = make_pair(&JavaDocConverter::handleTagChar, "");
+ tagHandlers["%"] = make_pair(&JavaDocConverter::handleTagChar, "");
+ tagHandlers["~"] = make_pair(&JavaDocConverter::handleTagChar, "");
+ tagHandlers["\""] = make_pair(&JavaDocConverter::handleTagChar, "&quot;");
+ tagHandlers["."] = make_pair(&JavaDocConverter::handleTagChar, "");
+ tagHandlers["::"] = make_pair(&JavaDocConverter::handleTagChar, "");
+ // these commands are stripped out
+ tagHandlers["attention"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["anchor"] = make_pair(&JavaDocConverter::handleTagAnchor, "");
+ tagHandlers["brief"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["bug"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["date"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["details"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ // this command is inserts text accumulated after cmd htmlonly -
+ // see DoxygenParser - CMD_HTML_ONLY.
+ tagHandlers["htmlonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["invariant"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["latexonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["manonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["partofdescription"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["rtfonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["short"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ tagHandlers["xmlonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
+ // these commands are kept as-is, they are supported by JavaDoc
+ tagHandlers["author"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ tagHandlers["authors"] = make_pair(&JavaDocConverter::handleTagSame, "author");
+ tagHandlers["deprecated"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ tagHandlers["exception"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ tagHandlers["package"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ tagHandlers["param"] = make_pair(&JavaDocConverter::handleTagParam, "");
+ tagHandlers["tparam"] = make_pair(&JavaDocConverter::handleTagParam, "");
+ tagHandlers["ref"] = make_pair(&JavaDocConverter::handleTagRef, "");
+ tagHandlers["result"] = make_pair(&JavaDocConverter::handleTagSame, "return");
+ tagHandlers["return"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ tagHandlers["returns"] = make_pair(&JavaDocConverter::handleTagSame, "return");
+ //tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ //tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSame, "see");
+ tagHandlers["since"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ tagHandlers["throws"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ tagHandlers["throw"] = make_pair(&JavaDocConverter::handleTagSame, "throws");
+ tagHandlers["version"] = make_pair(&JavaDocConverter::handleTagSame, "");
+ // these commands have special handlers
+ tagHandlers["code"] = make_pair(&JavaDocConverter::handleTagExtended, "code");
+ tagHandlers["cond"] = make_pair(&JavaDocConverter::handleTagMessage, "Conditional comment: ");
+ tagHandlers["copyright"] = make_pair(&JavaDocConverter::handleTagMessage, "Copyright: ");
+ tagHandlers["else"] = make_pair(&JavaDocConverter::handleTagIf, "Else: ");
+ tagHandlers["elseif"] = make_pair(&JavaDocConverter::handleTagIf, "Else if: ");
+ tagHandlers["endcond"] = make_pair(&JavaDocConverter::handleTagMessage, "End of conditional comment.");
+ // space in second arg prevents Javadoc to treat '@ example' as command. File name of
+ // example is still informative to user.
+ tagHandlers["example"] = make_pair(&JavaDocConverter::handleTagSame, " example");
+ tagHandlers["if"] = make_pair(&JavaDocConverter::handleTagIf, "If: ");
+ tagHandlers["ifnot"] = make_pair(&JavaDocConverter::handleTagIf, "If not: ");
+ tagHandlers["image"] = make_pair(&JavaDocConverter::handleTagImage, "");
+ tagHandlers["link"] = make_pair(&JavaDocConverter::handleTagLink, "");
+ tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSee, "");
+ tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSee, "");
+ tagHandlers["note"] = make_pair(&JavaDocConverter::handleTagMessage, "Note: ");
+ tagHandlers["overload"] = make_pair(&JavaDocConverter::handleTagMessage,
+ "This is an overloaded member function, provided for"
+ " convenience. It differs from the above function only in what" " argument(s) it accepts.");
+ tagHandlers["par"] = make_pair(&JavaDocConverter::handleTagPar, "");
+ tagHandlers["remark"] = make_pair(&JavaDocConverter::handleTagMessage, "Remarks: ");
+ tagHandlers["remarks"] = make_pair(&JavaDocConverter::handleTagMessage, "Remarks: ");
+ tagHandlers["todo"] = make_pair(&JavaDocConverter::handleTagMessage, "TODO: ");
+ tagHandlers["verbatim"] = make_pair(&JavaDocConverter::handleTagExtended, "literal");
+
+ // \f commands output literal Latex formula, which is still better than nothing.
+ tagHandlers["f$"] = make_pair(&JavaDocConverter::handleTagVerbatim, "");
+ tagHandlers["f["] = make_pair(&JavaDocConverter::handleTagVerbatim, "");
+ tagHandlers["f{"] = make_pair(&JavaDocConverter::handleTagVerbatim, "");
+
+ tagHandlers["warning"] = make_pair(&JavaDocConverter::handleTagMessage, "Warning: ");
+ // this command just prints it's contents
+ // (it is internal command of swig's parser, contains plain text)
+ tagHandlers["plainstd::string"] = make_pair(&JavaDocConverter::handlePlainString, "");
+ tagHandlers["plainstd::endl"] = make_pair(&JavaDocConverter::handleNewLine, "");
+ tagHandlers["n"] = make_pair(&JavaDocConverter::handleNewLine, "");
+
+ // HTML tags
+ tagHandlers["<a"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<a");
+ tagHandlers["<b"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<b");
+ tagHandlers["<blockquote"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<blockquote");
+ tagHandlers["<body"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<body");
+ tagHandlers["<br"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<br");
+ tagHandlers["<center"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<center");
+ tagHandlers["<caption"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<caption");
+ tagHandlers["<code"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<code");
+ tagHandlers["<dd"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dd");
+ tagHandlers["<dfn"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dfn");
+ tagHandlers["<div"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<div");
+ tagHandlers["<dl"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dl");
+ tagHandlers["<dt"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dt");
+ tagHandlers["<em"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<em");
+ tagHandlers["<form"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<form");
+ tagHandlers["<hr"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<hr");
+ tagHandlers["<h1"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h1");
+ tagHandlers["<h2"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h2");
+ tagHandlers["<h3"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h3");
+ tagHandlers["<i"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<i");
+ tagHandlers["<input"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<input");
+ tagHandlers["<img"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<img");
+ tagHandlers["<li"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<li");
+ tagHandlers["<meta"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<meta");
+ tagHandlers["<multicol"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<multicol");
+ tagHandlers["<ol"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<ol");
+ tagHandlers["<p"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<p");
+ tagHandlers["<pre"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<pre");
+ tagHandlers["<small"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<small");
+ tagHandlers["<span"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<span");
+ tagHandlers["<strong"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<strong");
+ tagHandlers["<sub"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<sub");
+ tagHandlers["<sup"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<sup");
+ tagHandlers["<table"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<table");
+ tagHandlers["<td"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<td");
+ tagHandlers["<th"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<th");
+ tagHandlers["<tr"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<tr");
+ tagHandlers["<tt"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<tt");
+ tagHandlers["<kbd"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<kbd");
+ tagHandlers["<ul"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<ul");
+ tagHandlers["<var"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<var");
+
+ // HTML entities
+ tagHandlers["&copy"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&copy");
+ tagHandlers["&trade"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&trade");
+ tagHandlers["&reg"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&reg");
+ tagHandlers["&lt"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&lt");
+ tagHandlers["&gt"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&gt");
+ tagHandlers["&amp"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&amp");
+ tagHandlers["&apos"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&apos");
+ tagHandlers["&quot"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&quot");
+ tagHandlers["&lsquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&lsquo");
+ tagHandlers["&rsquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&rsquo");
+ tagHandlers["&ldquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&ldquo");
+ tagHandlers["&rdquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&rdquo");
+ tagHandlers["&ndash"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&ndash");
+ tagHandlers["&mdash"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&mdash");
+ tagHandlers["&nbsp"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&nbsp");
+ tagHandlers["&times"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&times");
+ tagHandlers["&minus"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&minus");
+ tagHandlers["&sdot"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&sdot");
+ tagHandlers["&sim"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&sim");
+ tagHandlers["&le"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&le");
+ tagHandlers["&ge"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&ge");
+ tagHandlers["&larr"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&larr");
+ tagHandlers["&rarr"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&rarr");
+}
+
+JavaDocConverter::JavaDocConverter(int flags) :
+ DoxygenTranslator(flags) {
+ fillStaticTables();
+}
+
+/**
+ * Formats comment lines by inserting '\n *' at to long lines and tabs for
+ * indent. Currently it is disabled, which means original comment format is
+ * preserved. Experience shows, that this is usually better than breaking
+ * lines automatically, especially because original line endings are not removed,
+ * which results in short lines. To be useful, this function should have much
+ * better algorithm.
+ */
+std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent) {
+ std::string formattedLines;
+ return unformattedLine; // currently disabled
+ std::string::size_type lastPosition = 0;
+ std::string::size_type i = 0;
+ int isFirstLine = 1;
+ while (i != std::string::npos && i < unformattedLine.length()) {
+ lastPosition = i;
+ if (isFirstLine) {
+ i += APPROX_LINE_LENGTH;
+ } else {
+ i += APPROX_LINE_LENGTH - indent * TAB_SIZE;
+ }
+
+ i = unformattedLine.find(" ", i);
+
+ if (i > 0 && i + 1 < unformattedLine.length()) {
+ if (!isFirstLine)
+ for (int j = 0; j < indent; j++) {
+ formattedLines.append("\t");
+ } else {
+ isFirstLine = 0;
+ }
+ formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1));
+ formattedLines.append("\n *");
+
+ }
+ }
+ if (lastPosition < unformattedLine.length()) {
+ if (!isFirstLine) {
+ for (int j = 0; j < indent; j++) {
+ formattedLines.append("\t");
+ }
+ }
+ formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition));
+ }
+
+ return formattedLines;
+}
+
+/**
+ * Returns true, if the given parameter exists in the current node
+ * (for example param is a name of function parameter). If feature
+ * 'doxygen:nostripparams' is set, then this method always returns
+ * true - parameters are copied to output regardless of presence in
+ * function params list.
+ */
+bool JavaDocConverter::paramExists(std::string param) {
+
+ if (GetFlag(currentNode, "feature:doxygen:nostripparams")) {
+ return true;
+ }
+
+ ParmList *plist = CopyParmList(Getattr(currentNode, "parms"));
+
+ for (Parm *p = plist; p;) {
+
+ if (Getattr(p, "name") && Char(Getattr(p, "name")) == param) {
+ return true;
+ }
+ /* doesn't seem to work always: in some cases (especially for 'self' parameters)
+ * tmap:in is present, but tmap:in:next is not and so this code skips all the parameters
+ */
+ //p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p);
+ p = nextSibling(p);
+ }
+
+ Delete(plist);
+
+ return false;
+}
+
+std::string JavaDocConverter::translateSubtree(DoxygenEntity &doxygenEntity) {
+ std::string translatedComment;
+
+ if (doxygenEntity.isLeaf) {
+ return translatedComment;
+ }
+
+ for (DoxygenEntityListIt p = doxygenEntity.entityList.begin(); p != doxygenEntity.entityList.end(); p++) {
+
+ translateEntity(*p, translatedComment);
+ translateSubtree(*p);
+ }
+
+ return translatedComment;
+}
+
+/**
+ * Checks if a handler for the given tag exists, and calls it.
+ */
+void JavaDocConverter::translateEntity(DoxygenEntity &tag, std::string &translatedComment) {
+
+ std::map<std::string, std::pair<tagHandler, std::string> >::iterator it;
+ it = tagHandlers.find(tag.typeOfEntity);
+
+ if (it != tagHandlers.end()) {
+ (this->*(it->second.first))(tag, translatedComment, it->second.second);
+ } else {
+ // do NOT print warning, since there are many tags, which are not
+ // translatable - many warnings hide important ones
+ // addError(WARN_DOXYGEN_COMMAND_ERROR, "Unknown doxygen or HTML tag: " + tag.typeOfEntity);
+ }
+}
+
+
+void JavaDocConverter::handleTagAnchor(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ translatedComment += "<a id=\"" + translateSubtree(tag) + "\"></a>";
+}
+
+
+void JavaDocConverter::handleTagHtml(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
+ if (tag.entityList.size()) { // do not include empty tags
+ std::string tagData = translateSubtree(tag);
+ // wrap the thing, ignoring whitespace
+ size_t wsPos = tagData.find_last_not_of("\n\t ");
+ if (wsPos != std::string::npos)
+ translatedComment += "<" + arg + ">" + tagData.substr(0, wsPos + 1) + "</" + arg + ">" + tagData.substr(wsPos + 1);
+ else
+ translatedComment += "<" + arg + ">" + translateSubtree(tag) + "</" + arg + "> ";
+ }
+}
+
+void JavaDocConverter::handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
+ std::string htmlTagArgs = tag.data;
+ if (htmlTagArgs == "/") {
+ // end html tag, for example "</ul>
+ translatedComment += "</" + arg.substr(1) + ">";
+ } else {
+ translatedComment += arg + htmlTagArgs + ">";
+ }
+}
+
+void JavaDocConverter::handleHtmlEntity(DoxygenEntity &, std::string &translatedComment, std::string &arg) {
+ // html entities can be preserved for Java
+ translatedComment += arg + ';';
+}
+
+void JavaDocConverter::handleNewLine(DoxygenEntity &, std::string &translatedComment, std::string &) {
+ // <br> tag is added, because otherwise to much text is joined
+ // into same paragraph by javadoc. For example, doxy list:
+ // - item one
+ // - item two
+ // becomes one paragraph with surrounding text without newlines.
+ // This way we get to many empty lines in javadoc output, but this
+ // is still better than joined lines. Possibility for improvements
+ // exists.
+ translatedComment += "<br>\n * ";
+}
+
+void JavaDocConverter::handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
+ // escape it if we need to, else just print
+ if (arg.size())
+ translatedComment += arg;
+ else
+ translatedComment += tag.typeOfEntity;
+}
+
+// handles tags which are the same in Doxygen and Javadoc.
+void JavaDocConverter::handleTagSame(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
+ if (arg.size())
+ tag.typeOfEntity = arg;
+ translatedComment += formatCommand(std::string("@" + tag.typeOfEntity + " " + translateSubtree(tag)), 2);
+}
+
+void JavaDocConverter::handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ translatedComment += formatCommand(translateSubtree(tag), 0);
+}
+
+void JavaDocConverter::handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ translatedComment += tag.data;
+ // if (tag.data.size() && tag.data[tag.data.size()-1] != ' ')
+ // translatedComment += " ";
+}
+
+void JavaDocConverter::handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
+ translatedComment += arg + " ";
+ for (DoxygenEntityListCIt it = tag.entityList.begin(); it != tag.entityList.end(); it++) {
+ translatedComment += it->data;
+ }
+}
+
+void JavaDocConverter::handleTagExtended(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
+ std::string dummy;
+ translatedComment += "{@" + arg + " ";
+ handleParagraph(tag, translatedComment, dummy);
+ translatedComment += "}";
+}
+
+void JavaDocConverter::handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
+ std::string dummy;
+ translatedComment += arg;
+ if (tag.entityList.size()) {
+ translatedComment += tag.entityList.begin()->data;
+ tag.entityList.pop_front();
+ translatedComment += " {" + translateSubtree(tag) + "}";
+ }
+}
+
+void JavaDocConverter::handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
+ std::string dummy;
+ translatedComment += formatCommand(arg, 0);
+ handleParagraph(tag, translatedComment, dummy);
+}
+
+void JavaDocConverter::handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ if (tag.entityList.size() < 2)
+ return;
+
+ std::string file;
+ std::string title;
+
+ std::list<DoxygenEntity>::iterator it = tag.entityList.begin();
+ if (it->data != "html")
+ return;
+
+ it++;
+ file = it->data;
+
+ it++;
+ if (it != tag.entityList.end())
+ title = it->data;
+
+ translatedComment += "<img src=" + file;
+ if (title.size())
+ translatedComment += " alt=" + title;
+
+ // the size indication is supported for Latex only in Doxygen, see manual
+
+ translatedComment += "/>";
+}
+
+void JavaDocConverter::handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ std::string dummy;
+ translatedComment += "<p";
+ if (tag.entityList.size()) {
+ translatedComment += " alt=\"" + tag.entityList.begin()->data + "\"";
+ translatedComment += ">";
+ tag.entityList.pop_front();
+ handleParagraph(tag, translatedComment, dummy);
+ }
+ translatedComment += "</p>";
+}
+
+
+void JavaDocConverter::handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ std::string dummy;
+
+ if (!tag.entityList.size())
+ return;
+ if (!paramExists(tag.entityList.begin()->data))
+ return;
+
+ translatedComment += "@param ";
+ translatedComment += tag.entityList.begin()->data;
+ tag.entityList.pop_front();
+ handleParagraph(tag, translatedComment, dummy);
+}
+
+
+void JavaDocConverter::handleTagRef(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ std::string dummy;
+ if (!tag.entityList.size())
+ return;
+
+ // we translate to link, although \page is not supported in Java, but
+ // reader at least knows what to look at. Also for \anchor tag on the same
+ // page this link works.
+ string anchor = tag.entityList.begin()->data;
+ tag.entityList.pop_front();
+ string anchorText = anchor;
+ if (!tag.entityList.empty()) {
+ anchorText = tag.entityList.begin()->data;
+ }
+ translatedComment += "<a href=\"#" + anchor + "\">" + anchorText + "</a>";
+}
+
+
+string JavaDocConverter::convertLink(string linkObject) {
+ if (GetFlag(currentNode, "feature:doxygen:nolinktranslate"))
+ return linkObject;
+ // find the params in function in linkObject (if any)
+ size_t lbracePos = linkObject.find('(', 0);
+ size_t rbracePos = linkObject.find(')', 0);
+ if (lbracePos == string::npos || rbracePos == string::npos || lbracePos >= rbracePos)
+ return "";
+
+ string paramsStr = linkObject.substr(lbracePos + 1,
+ rbracePos - lbracePos - 1);
+ // strip the params, to fill them later
+ string additionalObject = linkObject.substr(rbracePos + 1, string::npos);
+ linkObject = linkObject.substr(0, lbracePos);
+
+ // find all the params
+ vector<string> params;
+ size_t lastPos = 0, commaPos = 0;
+ while (true) {
+ commaPos = paramsStr.find(',', lastPos);
+ if (commaPos == string::npos)
+ commaPos = paramsStr.size();
+ string param = paramsStr.substr(lastPos, commaPos - lastPos);
+ // if any param type is empty, we are failed
+ if (!param.size())
+ return "";
+ params.push_back(param);
+ lastPos = commaPos + 1;
+ if (lastPos >= paramsStr.size())
+ break;
+ }
+
+ linkObject += "(";
+ for (size_t i = 0; i < params.size(); i++) {
+ // translate c/c++ type string to swig's type
+ // i e 'int **arr[100][10]' -> 'a(100).a(10).p.p.int'
+ // also converting arrays to pointers
+ string paramStr = params[i];
+ String *swigType = NewString("");
+
+ // handle const qualifier
+ if (paramStr.find("const") != string::npos)
+ SwigType_add_qualifier(swigType, "const");
+
+ // handle pointers, references and arrays
+ for (int j = (int)params[i].size() - 1; j >= 0; j--) {
+ // skip all the [...] blocks, write 'p.' for every of it
+ if (paramStr[j] == ']') {
+ while (j >= 0 && paramStr[j] != '[')
+ j--;
+ // no closing brace
+ if (j < 0)
+ return "";
+ SwigType_add_pointer(swigType);
+ continue;
+ } else if (paramStr[j] == '*')
+ SwigType_add_pointer(swigType);
+ else if (paramStr[j] == '&')
+ SwigType_add_reference(swigType);
+ else if (isalnum(paramStr[j])) {
+ size_t typeNameStart = paramStr.find_last_of(' ', j + 1);
+ if (typeNameStart == string::npos)
+ typeNameStart = 0;
+ else
+ typeNameStart++;
+ Append(swigType, paramStr.substr(typeNameStart, j - typeNameStart + 1).c_str());
+ break;
+ }
+ }
+
+ // make dummy param list, to lookup typemaps for it
+ Parm *dummyParam = NewParm(swigType, "", 0);
+ Swig_typemap_attach_parms("jstype", dummyParam, NULL);
+ Language::instance()->replaceSpecialVariables(0, Getattr(dummyParam, "tmap:jstype"), dummyParam);
+
+ //Swig_print(dummyParam, 1);
+ linkObject += Char(Getattr(dummyParam, "tmap:jstype"));
+ if (i != params.size() - 1)
+ linkObject += ",";
+
+ Delete(dummyParam);
+ Delete(swigType);
+ }
+ linkObject += ")";
+
+ return linkObject + additionalObject;
+}
+
+void JavaDocConverter::handleTagLink(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ std::string dummy;
+ if (!tag.entityList.size())
+ return;
+
+ string linkObject = convertLink(tag.entityList.begin()->data);
+ if (!linkObject.size())
+ linkObject = tag.entityList.begin()->data;
+ tag.entityList.pop_front();
+
+ translatedComment += "{@link ";
+ translatedComment += linkObject + " ";
+ handleParagraph(tag, translatedComment, dummy);
+ translatedComment += "}";
+}
+
+void JavaDocConverter::handleTagSee(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
+ std::string dummy;
+ if (!tag.entityList.size())
+ return;
+
+ // tag.entity list contains contents of the @see paragraph. It should contain
+ // one link (references) to method with or without parameters. Doxygen supports
+ // arbitrary text and types mixed, but this feature is not supported here.
+ // :: or # may be used as a separator between class name and method name.
+ list<DoxygenEntity>::iterator it;
+ string methodRef;
+ for (it = tag.entityList.begin(); it != tag.entityList.end(); it++) {
+ if (it->typeOfEntity == "plainstd::endl") {
+ // handleNewLine(*it, translatedComment, dummy);
+ continue;
+ }
+ // restore entities which may be used in C++ type declaration
+ if (it->typeOfEntity == "&amp") {
+ methodRef += '&';
+ } else if (it->typeOfEntity == "&lt") {
+ methodRef += '<';
+ } else if (it->typeOfEntity == "&gt") {
+ methodRef += '>';
+ } else {
+ methodRef += it->data;
+ }
+ }
+
+ // replace :: with #, but only if it appears before left brace
+ size_t lbrace = methodRef.find('(');
+ size_t dblColon = methodRef.find("::");
+ if (dblColon < lbrace) {
+ methodRef = methodRef.substr(0, dblColon) + '#' + methodRef.substr(dblColon + 2);
+ }
+
+ translatedComment += "@see ";
+ string linkObject = convertLink(methodRef);
+ if (!linkObject.size()) {
+ linkObject = methodRef;
+ }
+ translatedComment += linkObject;
+}
+
+/* This function moves all line endings at the end of child entities
+ * out of the child entities to the parent.
+ * For example, entity tree:
+
+ -root
+ |-param
+ |-paramText
+ |-endline
+
+ should be turned to
+
+ -root
+ |-param
+ |-paramText
+ |-endline
+ *
+ */
+int JavaDocConverter::shiftEndlinesUpTree(DoxygenEntity &root, int level) {
+ DoxygenEntityListIt it = root.entityList.begin();
+ while (it != root.entityList.end()) {
+ // remove line endings
+ int ret = shiftEndlinesUpTree(*it, level + 1);
+ // insert them after this element
+ it++;
+ for (int i = 0; i < ret; i++) {
+ root.entityList.insert(it, DoxygenEntity("plainstd::endl"));
+ }
+ }
+
+ // continue only if we are not root
+ if (!level) {
+ return 0;
+ }
+
+ int removedCount = 0;
+ while (!root.entityList.empty()
+ && root.entityList.rbegin()->typeOfEntity == "plainstd::endl") {
+ root.entityList.pop_back();
+ removedCount++;
+ }
+ return removedCount;
+}
+
+/**
+ * This makes sure that all comment lines contain '*'. It is not mandatory in doxygen,
+ * but highly recommended for Javadoc. '*' in empty lines are indented according
+ * to indentation of the first line. Indentation of non-empty lines is not
+ * changed - garbage in garbage out.
+ */
+std::string JavaDocConverter::indentAndInsertAsterisks(const string &doc) {
+
+ size_t idx = doc.find('\n');
+ size_t indent = 0;
+ bool singleLineComment = idx == string::npos;
+ // Detect indentation.
+ // The first line in comment is the one after '/**', which may be
+ // spaces and '\n' or the text. In any case it is not suitable to detect
+ // indentation, so we have to skip the first '\n'.
+ // However, if there is just one line, then use that line to detect indentation.
+ if (idx != string::npos) {
+ size_t nonspaceIdx = doc.find_first_not_of(" \t", idx + 1);
+ if (nonspaceIdx != string::npos) {
+ indent = nonspaceIdx - idx;
+ }
+ }
+
+ if (indent == 0) {
+ // we can't indent the first line less than 0
+ indent = 1;
+ }
+ // Create the first line of Javadoc comment.
+ string indentStr(indent - 1, ' ');
+ string translatedStr = indentStr + "/**";
+ if (indent > 1) {
+ // remove the first space, so that '*' will be aligned
+ translatedStr = translatedStr.substr(1);
+ }
+
+ translatedStr += doc;
+
+ // insert '*' before each comment line, if it does not have it
+ idx = translatedStr.find('\n');
+
+ while (idx != string::npos) {
+
+ size_t nonspaceIdx = translatedStr.find_first_not_of(" \t", idx + 1);
+ if (nonspaceIdx != string::npos && translatedStr[nonspaceIdx] != '*') {
+ // line without '*' found - is it empty?
+ if (translatedStr[nonspaceIdx] != '\n') {
+ // add '* ' to each line without it
+ translatedStr = translatedStr.substr(0, nonspaceIdx) + "* " + translatedStr.substr(nonspaceIdx);
+ //printf(translatedStr.c_str());
+ } else {
+ // we found empty line, replace it with indented '*'
+ translatedStr = translatedStr.substr(0, idx + 1) + indentStr + "* " + translatedStr.substr(nonspaceIdx);
+ }
+ }
+ idx = translatedStr.find('\n', nonspaceIdx);
+ }
+
+ // Add the last comment line properly indented
+ size_t nonspaceEndIdx = translatedStr.find_last_not_of(" \t");
+ if (nonspaceEndIdx != string::npos) {
+ if (translatedStr[nonspaceEndIdx] != '\n') {
+ if (!singleLineComment)
+ translatedStr += '\n';
+ } else {
+ // remove trailing spaces
+ translatedStr = translatedStr.substr(0, nonspaceEndIdx + 1);
+ }
+ }
+ translatedStr += indentStr + "*/\n";
+
+ return translatedStr;
+}
+
+String *JavaDocConverter::makeDocumentation(Node *node) {
+
+ String *documentation = getDoxygenComment(node);
+
+ if (documentation == NULL) {
+ return NewString("");
+ }
+
+ if (GetFlag(node, "feature:doxygen:notranslate")) {
+
+ string doc = Char(documentation);
+
+ string translatedStr = indentAndInsertAsterisks(doc);
+
+ return NewString(translatedStr.c_str());
+ }
+
+ DoxygenEntityList entityList = parser.createTree(node, documentation);
+
+ // entityList.sort(CompareDoxygenEntities()); sorting currently not used,
+
+ if (m_flags & debug_translator) {
+ std::cout << "---RESORTED LIST---" << std::endl;
+ printTree(entityList);
+ }
+ // store the current node
+ // (currently just to handle params)
+ currentNode = node;
+
+ std::string javaDocString = "/**\n * ";
+
+ DoxygenEntity root("root", entityList);
+
+ shiftEndlinesUpTree(root);
+
+ // strip line endings at the beginning
+ while (!root.entityList.empty()
+ && root.entityList.begin()->typeOfEntity == "plainstd::endl") {
+ root.entityList.pop_front();
+ }
+
+ // and at the end
+ while (!root.entityList.empty()
+ && root.entityList.rbegin()->typeOfEntity == "plainstd::endl") {
+ root.entityList.pop_back();
+ }
+
+ javaDocString += translateSubtree(root);
+
+ javaDocString += "\n */\n";
+
+ if (m_flags & debug_translator) {
+ std::cout << "\n---RESULT IN JAVADOC---" << std::endl;
+ std::cout << javaDocString;
+ }
+
+ return NewString(javaDocString.c_str());
+}
+
+void JavaDocConverter::addError(int warningType, const std::string &message) {
+ Swig_warning(warningType, "", 0, "Doxygen parser warning: %s. \n", message.c_str());
+}
diff --git a/Source/Doxygen/javadoc.h b/Source/Doxygen/javadoc.h
new file mode 100644
index 000000000..6feff5295
--- /dev/null
+++ b/Source/Doxygen/javadoc.h
@@ -0,0 +1,169 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * javadoc.h
+ *
+ * Module to return documentation for nodes formatted for JavaDoc
+ * ----------------------------------------------------------------------------- */
+
+#ifndef JAVADOCCONVERTER_H_
+#define JAVADOCCONVERTER_H_
+
+#include "doxytranslator.h"
+#include <map>
+
+/*
+ * A class to translate doxygen comments into JavaDoc style comments.
+ */
+class JavaDocConverter : public DoxygenTranslator {
+public:
+ JavaDocConverter(int flags = 0);
+ String *makeDocumentation(Node *node);
+
+protected:
+ /*
+ * Used to properly format JavaDoc-style command
+ */
+ std::string formatCommand(std::string unformattedLine, int indent);
+
+ /*
+ * Translate every entity in a tree.
+ */
+ std::string translateSubtree(DoxygenEntity &doxygenEntity);
+
+ /*
+ * Translate one entity with the appropriate handler, according
+ * to the tagHandlers
+ */
+ void translateEntity(DoxygenEntity &tag, std::string &translatedComment);
+
+ /*
+ * Fix all endlines location, etc
+ */
+ int shiftEndlinesUpTree(DoxygenEntity &root, int level = 0);
+
+ /*
+ * Convert params in link-objects and references
+ */
+ std::string convertLink(std::string linkObject);
+
+ /*
+ * Typedef for the function that handles one tag
+ * arg - some string argument to easily pass it through lookup table
+ */
+ typedef void (JavaDocConverter::*tagHandler) (DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /**
+ * Copies verbatim args of the tag to output, used for commands like \f$, ...
+ */
+ void handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /** Creates anchor link. */
+ void handleTagAnchor(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Wrap the command data with the html tag
+ * arg - html tag, with no braces
+ */
+ void handleTagHtml(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /* Handles HTML tags recognized by Doxygen, like <A ...>, <ul>, <table>, ... */
+ void handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /* Handles HTML entities recognized by Doxygen, like &lt;, &copy;, ... */
+ void handleHtmlEntity(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Just prints new line
+ */
+ void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Print the name of tag to the output, used for escape-commands
+ * arg - html-escaped variant, if not provided the command data is used
+ */
+ void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Do not translate and print as-is
+ * arg - the new tag name, if it needs to be renamed
+ */
+ void handleTagSame(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Print only the content and strip original tag
+ */
+ void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Print only data part of code
+ */
+ void handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Print extended Javadoc command, like {@code ...} or {@literal ...}
+ * arg - command name
+ */
+ void handleTagExtended(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Print the if-elseif-else-endif section
+ */
+ void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Prints the specified message, than the contents of the tag
+ * arg - message
+ */
+ void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Insert <img src=... /> tag if the 'format' field is specified as 'html'
+ */
+ void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Insert <p alt='title'>...</p>
+ */
+ void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Insert \@param command, if it is really a function param
+ */
+ void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Writes link for \ref tag.
+ */
+ void handleTagRef(DoxygenEntity &tag, std::string &translatedComment, std::string &);
+
+ /*
+ * Insert {@link...} command, and handle all the <link-object>s correctly
+ * (like converting types of params, etc)
+ */
+ void handleTagLink(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+ /*
+ * Insert @see command, and handle all the <link-object>s correctly
+ * (like converting types of params, etc)
+ */
+ void handleTagSee(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
+
+private:
+ Node *currentNode;
+ // this contains the handler pointer and one string argument
+ static std::map<std::string, std::pair<tagHandler, std::string> > tagHandlers;
+ void fillStaticTables();
+
+ bool paramExists(std::string param);
+ std::string indentAndInsertAsterisks(const std::string &doc);
+
+ void addError(int warningType, const std::string &message);
+};
+
+#endif
diff --git a/Source/Doxygen/pydoc.cxx b/Source/Doxygen/pydoc.cxx
new file mode 100644
index 000000000..eb489932a
--- /dev/null
+++ b/Source/Doxygen/pydoc.cxx
@@ -0,0 +1,911 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * pydoc.cxx
+ *
+ * Module to return documentation for nodes formatted for PyDoc
+ * ----------------------------------------------------------------------------- */
+
+#include "pydoc.h"
+#include "doxyparser.h"
+#include <sstream>
+#include <string>
+#include <vector>
+#include <iostream>
+
+#include "swigmod.h"
+
+// define static tables, they are filled in PyDocConverter's constructor
+PyDocConverter::TagHandlersMap PyDocConverter::tagHandlers;
+std::map<std::string, std::string> PyDocConverter::sectionTitles;
+
+using std::string;
+
+// Helper class increasing the provided indent string in its ctor and decreasing
+// it in its dtor.
+class IndentGuard {
+public:
+ // One indent level.
+ static const char *Level() {
+ return " ";
+ }
+ // Default ctor doesn't do anything and prevents the dtor from doing anything// too and should only be used when the guard needs to be initialized// conditionally as Init() can then be called after checking some condition.// Otherwise, prefer to use the non default ctor below.
+ IndentGuard() {
+ m_initialized = false;
+ }
+
+ // Ctor takes the output to determine the current indent and to remove the
+ // extra indent added to it in the dtor and the variable containing the indent
+ // to use, which must be used after every new line by the code actually
+ // updating the output.
+ IndentGuard(string &output, string &indent) {
+ Init(output, indent);
+ }
+
+ // Really initializes the object created using the default ctor.
+ void Init(string &output, string &indent) {
+ m_output = &output;
+ m_indent = &indent;
+
+ const string::size_type lastNonSpace = m_output->find_last_not_of(' ');
+ if (lastNonSpace == string::npos) {
+ m_firstLineIndent = m_output->length();
+ } else if ((*m_output)[lastNonSpace] == '\n') {
+ m_firstLineIndent = m_output->length() - (lastNonSpace + 1);
+ } else {
+ m_firstLineIndent = 0;
+ }
+
+ // Notice that the indent doesn't include the first line indent because it's
+ // implicit, i.e. it is present in the input and so is copied into the
+ // output anyhow.
+ *m_indent = Level();
+
+ m_initialized = true;
+ }
+
+ // Get the indent for the first line of the paragraph, which is smaller than
+ // the indent for the subsequent lines.
+ string getFirstLineIndent() const {
+ return string(m_firstLineIndent, ' ');
+ }
+
+ ~IndentGuard() {
+ if (!m_initialized)
+ return;
+
+ m_indent->clear();
+
+ // Get rid of possible remaining extra indent, e.g. if there were any trailing
+ // new lines: we shouldn't add the extra indent level to whatever follows
+ // this paragraph.
+ static const size_t lenIndentLevel = strlen(Level());
+ if (m_output->length() > lenIndentLevel) {
+ const size_t start = m_output->length() - lenIndentLevel;
+ if (m_output->compare(start, string::npos, Level()) == 0)
+ m_output->erase(start);
+ }
+ }
+
+private:
+ string *m_output;
+ string *m_indent;
+ string::size_type m_firstLineIndent;
+ bool m_initialized;
+
+ IndentGuard(const IndentGuard &);
+ IndentGuard &operator=(const IndentGuard &);
+};
+
+// Return the indent of the given multiline string, i.e. the maximal number of
+// spaces present in the beginning of all its non-empty lines.
+static size_t determineIndent(const string &s) {
+ size_t minIndent = static_cast<size_t>(-1);
+
+ for (size_t lineStart = 0; lineStart < s.length();) {
+ const size_t lineEnd = s.find('\n', lineStart);
+ const size_t firstNonSpace = s.find_first_not_of(' ', lineStart);
+
+ // If inequality doesn't hold, it means that this line contains only spaces
+ // (notice that this works whether lineEnd is valid or string::npos), in
+ // which case it doesn't matter when determining the indent.
+ if (firstNonSpace < lineEnd) {
+ // Here we can be sure firstNonSpace != string::npos.
+ const size_t lineIndent = firstNonSpace - lineStart;
+ if (lineIndent < minIndent)
+ minIndent = lineIndent;
+ }
+
+ if (lineEnd == string::npos)
+ break;
+
+ lineStart = lineEnd + 1;
+ }
+
+ return minIndent;
+}
+
+static void trimWhitespace(string &s) {
+ const string::size_type lastNonSpace = s.find_last_not_of(' ');
+ if (lastNonSpace == string::npos)
+ s.clear();
+ else
+ s.erase(lastNonSpace + 1);
+}
+
+// Erase the first character in the string if it is a newline
+static void eraseLeadingNewLine(string &s) {
+ if (!s.empty() && s[0] == '\n')
+ s.erase(s.begin());
+}
+
+// Erase the last character in the string if it is a newline
+static void eraseTrailingNewLine(string &s) {
+ if (!s.empty() && s[s.size() - 1] == '\n')
+ s.erase(s.size() - 1);
+}
+
+// Check the generated docstring line by line and make sure that any
+// code and verbatim blocks have an empty line preceding them, which
+// is necessary for Sphinx. Additionally, this strips any empty lines
+// appearing at the beginning of the docstring.
+static string padCodeAndVerbatimBlocks(const string &docString) {
+ std::string result;
+
+ std::istringstream iss(docString);
+
+ // Initialize to false because there is no previous line yet
+ bool lastLineWasNonBlank = false;
+
+ for (string line; std::getline(iss, line); result += line) {
+ if (!result.empty()) {
+ // Terminate the previous line
+ result += '\n';
+ }
+
+ const size_t pos = line.find_first_not_of(" \t");
+ if (pos == string::npos) {
+ lastLineWasNonBlank = false;
+ } else {
+ if (lastLineWasNonBlank &&
+ (line.compare(pos, 13, ".. code-block") == 0 ||
+ line.compare(pos, 7, ".. math") == 0)) {
+ // Must separate code or math blocks from the previous line
+ result += '\n';
+ }
+ lastLineWasNonBlank = true;
+ }
+ }
+ return result;
+}
+
+/* static */
+PyDocConverter::TagHandlersMap::mapped_type PyDocConverter::make_handler(tagHandler handler) {
+ return make_pair(handler, std::string());
+}
+
+/* static */
+PyDocConverter::TagHandlersMap::mapped_type PyDocConverter::make_handler(tagHandler handler, const char *arg) {
+ return make_pair(handler, arg);
+}
+
+void PyDocConverter::fillStaticTables() {
+ if (tagHandlers.size()) // fill only once
+ return;
+
+ // table of section titles, they are printed only once
+ // for each group of specified doxygen commands
+ sectionTitles["author"] = "Author: ";
+ sectionTitles["authors"] = "Authors: ";
+ sectionTitles["copyright"] = "Copyright: ";
+ sectionTitles["deprecated"] = "Deprecated: ";
+ sectionTitles["example"] = "Example: ";
+ sectionTitles["note"] = "Notes: ";
+ sectionTitles["remark"] = "Remarks: ";
+ sectionTitles["remarks"] = "Remarks: ";
+ sectionTitles["warning"] = "Warning: ";
+// sectionTitles["sa"] = "See also: ";
+// sectionTitles["see"] = "See also: ";
+ sectionTitles["since"] = "Since: ";
+ sectionTitles["todo"] = "TODO: ";
+ sectionTitles["version"] = "Version: ";
+
+ tagHandlers["a"] = make_handler(&PyDocConverter::handleTagWrap, "*");
+ tagHandlers["b"] = make_handler(&PyDocConverter::handleTagWrap, "**");
+ // \c command is translated as single quotes around next word
+ tagHandlers["c"] = make_handler(&PyDocConverter::handleTagWrap, "``");
+ tagHandlers["cite"] = make_handler(&PyDocConverter::handleTagWrap, "'");
+ tagHandlers["e"] = make_handler(&PyDocConverter::handleTagWrap, "*");
+ // these commands insert just a single char, some of them need to be escaped
+ tagHandlers["$"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["@"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["\\"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["<"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers[">"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["&"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["#"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["%"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["~"] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["\""] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["."] = make_handler(&PyDocConverter::handleTagChar);
+ tagHandlers["::"] = make_handler(&PyDocConverter::handleTagChar);
+ // these commands are stripped out, and only their content is printed
+ tagHandlers["attention"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["author"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["authors"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["brief"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["bug"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["code"] = make_handler(&PyDocConverter::handleCode);
+ tagHandlers["copyright"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["date"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["deprecated"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["details"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["em"] = make_handler(&PyDocConverter::handleParagraph, " ");
+ tagHandlers["example"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["exception"] = tagHandlers["throw"] = tagHandlers["throws"] = make_handler(&PyDocConverter::handleTagException);
+ tagHandlers["htmlonly"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["invariant"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["latexonly"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["link"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["manonly"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["note"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["p"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["partofdescription"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["rtfonly"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["remark"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["remarks"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["sa"] = make_handler(&PyDocConverter::handleTagMessage, "See also: ");
+ tagHandlers["see"] = make_handler(&PyDocConverter::handleTagMessage, "See also: ");
+ tagHandlers["since"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["short"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["todo"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["version"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["verbatim"] = make_handler(&PyDocConverter::handleVerbatimBlock);
+ tagHandlers["warning"] = make_handler(&PyDocConverter::handleParagraph);
+ tagHandlers["xmlonly"] = make_handler(&PyDocConverter::handleParagraph);
+ // these commands have special handlers
+ tagHandlers["arg"] = make_handler(&PyDocConverter::handleTagMessage, "* ");
+ tagHandlers["cond"] = make_handler(&PyDocConverter::handleTagMessage, "Conditional comment: ");
+ tagHandlers["else"] = make_handler(&PyDocConverter::handleTagIf, "Else: ");
+ tagHandlers["elseif"] = make_handler(&PyDocConverter::handleTagIf, "Else if: ");
+ tagHandlers["endcond"] = make_handler(&PyDocConverter::handleTagMessage, "End of conditional comment.");
+ tagHandlers["if"] = make_handler(&PyDocConverter::handleTagIf, "If: ");
+ tagHandlers["ifnot"] = make_handler(&PyDocConverter::handleTagIf, "If not: ");
+ tagHandlers["image"] = make_handler(&PyDocConverter::handleTagImage);
+ tagHandlers["li"] = make_handler(&PyDocConverter::handleTagMessage, "* ");
+ tagHandlers["overload"] = make_handler(&PyDocConverter::handleTagMessage,
+ "This is an overloaded member function, provided for"
+ " convenience.\nIt differs from the above function only in what" " argument(s) it accepts.");
+ tagHandlers["par"] = make_handler(&PyDocConverter::handleTagPar);
+ tagHandlers["param"] = tagHandlers["tparam"] = make_handler(&PyDocConverter::handleTagParam);
+ tagHandlers["ref"] = make_handler(&PyDocConverter::handleTagRef);
+ tagHandlers["result"] = tagHandlers["return"] = tagHandlers["returns"] = make_handler(&PyDocConverter::handleTagReturn);
+
+ // this command just prints it's contents
+ // (it is internal command of swig's parser, contains plain text)
+ tagHandlers["plainstd::string"] = make_handler(&PyDocConverter::handlePlainString);
+ tagHandlers["plainstd::endl"] = make_handler(&PyDocConverter::handleNewLine);
+ tagHandlers["n"] = make_handler(&PyDocConverter::handleNewLine);
+
+ // \f commands output literal Latex formula, which is still better than nothing.
+ tagHandlers["f$"] = tagHandlers["f["] = tagHandlers["f{"] = make_handler(&PyDocConverter::handleMath);
+
+ // HTML tags
+ tagHandlers["<a"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_A);
+ tagHandlers["<b"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "**");
+ tagHandlers["<blockquote"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_A, "Quote: ");
+ tagHandlers["<body"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<br"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "\n");
+
+ // there is no formatting for this tag as it was deprecated in HTML 4.01 and
+ // not used in HTML 5
+ tagHandlers["<center"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<caption"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<code"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "``");
+
+ tagHandlers["<dl"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<dd"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, " ");
+ tagHandlers["<dt"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+
+ tagHandlers["<dfn"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<div"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<em"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "**");
+ tagHandlers["<form"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<hr"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "--------------------------------------------------------------------\n");
+ tagHandlers["<h1"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "# ");
+ tagHandlers["<h2"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "## ");
+ tagHandlers["<h3"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "### ");
+ tagHandlers["<i"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "*");
+ tagHandlers["<input"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<img"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "Image:");
+ tagHandlers["<li"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "* ");
+ tagHandlers["<meta"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<multicol"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<ol"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<p"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "\n");
+ tagHandlers["<pre"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<small"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<span"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "'");
+ tagHandlers["<strong"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "**");
+
+ // make a space between text and super/sub script.
+ tagHandlers["<sub"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, " ");
+ tagHandlers["<sup"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, " ");
+
+ tagHandlers["<table"] = make_handler(&PyDocConverter::handleDoxyHtmlTagNoParam);
+ tagHandlers["<td"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_td);
+ tagHandlers["<th"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_th);
+ tagHandlers["<tr"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_tr);
+ tagHandlers["<tt"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<kbd"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<ul"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
+ tagHandlers["<var"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "*");
+
+ // HTML entities
+ tagHandlers["&copy"] = make_handler(&PyDocConverter::handleHtmlEntity, "(C)");
+ tagHandlers["&trade"] = make_handler(&PyDocConverter::handleHtmlEntity, " TM");
+ tagHandlers["&reg"] = make_handler(&PyDocConverter::handleHtmlEntity, "(R)");
+ tagHandlers["&lt"] = make_handler(&PyDocConverter::handleHtmlEntity, "<");
+ tagHandlers["&gt"] = make_handler(&PyDocConverter::handleHtmlEntity, ">");
+ tagHandlers["&amp"] = make_handler(&PyDocConverter::handleHtmlEntity, "&");
+ tagHandlers["&apos"] = make_handler(&PyDocConverter::handleHtmlEntity, "'");
+ tagHandlers["&quot"] = make_handler(&PyDocConverter::handleHtmlEntity, "\"");
+ tagHandlers["&lsquo"] = make_handler(&PyDocConverter::handleHtmlEntity, "`");
+ tagHandlers["&rsquo"] = make_handler(&PyDocConverter::handleHtmlEntity, "'");
+ tagHandlers["&ldquo"] = make_handler(&PyDocConverter::handleHtmlEntity, "\"");
+ tagHandlers["&rdquo"] = make_handler(&PyDocConverter::handleHtmlEntity, "\"");
+ tagHandlers["&ndash"] = make_handler(&PyDocConverter::handleHtmlEntity, "-");
+ tagHandlers["&mdash"] = make_handler(&PyDocConverter::handleHtmlEntity, "--");
+ tagHandlers["&nbsp"] = make_handler(&PyDocConverter::handleHtmlEntity, " ");
+ tagHandlers["&times"] = make_handler(&PyDocConverter::handleHtmlEntity, "x");
+ tagHandlers["&minus"] = make_handler(&PyDocConverter::handleHtmlEntity, "-");
+ tagHandlers["&sdot"] = make_handler(&PyDocConverter::handleHtmlEntity, ".");
+ tagHandlers["&sim"] = make_handler(&PyDocConverter::handleHtmlEntity, "~");
+ tagHandlers["&le"] = make_handler(&PyDocConverter::handleHtmlEntity, "<=");
+ tagHandlers["&ge"] = make_handler(&PyDocConverter::handleHtmlEntity, ">=");
+ tagHandlers["&larr"] = make_handler(&PyDocConverter::handleHtmlEntity, "<--");
+ tagHandlers["&rarr"] = make_handler(&PyDocConverter::handleHtmlEntity, "-->");
+}
+
+PyDocConverter::PyDocConverter(int flags):
+DoxygenTranslator(flags), m_tableLineLen(0), m_prevRowIsTH(false) {
+ fillStaticTables();
+}
+
+// Return the type as it should appear in the output documentation.
+static std::string getPyDocType(Node *n, const_String_or_char_ptr lname = "") {
+ std::string type;
+
+ String *s = Swig_typemap_lookup("doctype", n, lname, 0);
+ if (!s) {
+ if (String *t = Getattr(n, "type"))
+ s = SwigType_str(t, "");
+ }
+
+ if (!s)
+ return type;
+
+ if (Language::classLookup(s)) {
+ // In Python C++ namespaces are flattened, so remove all but last component
+ // of the name.
+ String *const last = Swig_scopename_last(s);
+
+ // We are not actually sure whether it's a documented class or not, but
+ // there doesn't seem to be any harm in making it a reference if it isn't,
+ // while there is a lot of benefit in having a hyperlink if it is.
+ type = ":py:class:`";
+ type += Char(last);
+ type += "`";
+
+ Delete(last);
+ } else {
+ type = Char(s);
+ }
+
+ Delete(s);
+
+ return type;
+}
+
+std::string PyDocConverter::getParamType(std::string param) {
+ std::string type;
+
+ ParmList *plist = CopyParmList(Getattr(currentNode, "parms"));
+ for (Parm *p = plist; p; p = nextSibling(p)) {
+ String *pname = Getattr(p, "name");
+ if (Char(pname) != param)
+ continue;
+
+ type = getPyDocType(p, pname);
+ break;
+ }
+ Delete(plist);
+ return type;
+}
+
+std::string PyDocConverter::translateSubtree(DoxygenEntity &doxygenEntity) {
+ std::string translatedComment;
+
+ if (doxygenEntity.isLeaf)
+ return translatedComment;
+
+ std::string currentSection;
+ std::list<DoxygenEntity>::iterator p = doxygenEntity.entityList.begin();
+ while (p != doxygenEntity.entityList.end()) {
+ std::map<std::string, std::string>::iterator it;
+ it = sectionTitles.find(p->typeOfEntity);
+ if (it != sectionTitles.end()) {
+ if (it->second != currentSection) {
+ currentSection = it->second;
+ translatedComment += currentSection;
+ }
+ }
+ translateEntity(*p, translatedComment);
+ translateSubtree(*p);
+ p++;
+ }
+
+ return translatedComment;
+}
+
+void PyDocConverter::translateEntity(DoxygenEntity &doxyEntity, std::string &translatedComment) {
+ // check if we have needed handler and call it
+ std::map<std::string, std::pair<tagHandler, std::string> >::iterator it;
+ it = tagHandlers.find(doxyEntity.typeOfEntity);
+ if (it != tagHandlers.end())
+ (this->*(it->second.first)) (doxyEntity, translatedComment, it->second.second);
+}
+
+void PyDocConverter::handleParagraph(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ translatedComment += translateSubtree(tag);
+}
+
+void PyDocConverter::handleVerbatimBlock(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ string verb = translateSubtree(tag);
+
+ eraseLeadingNewLine(verb);
+
+ // Remove the last newline to prevent doubling the newline already present after \endverbatim
+ trimWhitespace(verb); // Needed to catch trailing newline below
+ eraseTrailingNewLine(verb);
+ translatedComment += verb;
+}
+
+void PyDocConverter::handleMath(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ IndentGuard indent;
+
+ // Only \f$ is translated to inline formulae, \f[ and \f{ are for the block ones.
+ const bool inlineFormula = tag.typeOfEntity == "f$";
+
+ string formulaNL;
+
+ if (inlineFormula) {
+ translatedComment += ":math:`";
+ } else {
+ indent.Init(translatedComment, m_indent);
+
+ trimWhitespace(translatedComment);
+
+ const string formulaIndent = indent.getFirstLineIndent();
+ translatedComment += formulaIndent;
+ translatedComment += ".. math::\n";
+
+ formulaNL = '\n';
+ formulaNL += formulaIndent;
+ formulaNL += m_indent;
+ translatedComment += formulaNL;
+ }
+
+ std::string formula;
+ handleTagVerbatim(tag, formula, arg);
+
+ // It is important to ensure that we have no spaces around the inline math
+ // contents, so strip them.
+ const size_t start = formula.find_first_not_of(" \t\n");
+ const size_t end = formula.find_last_not_of(" \t\n");
+ if (start != std::string::npos) {
+ for (size_t n = start; n <= end; n++) {
+ if (formula[n] == '\n') {
+ // New lines must be suppressed in inline maths and indented in the block ones.
+ if (!inlineFormula)
+ translatedComment += formulaNL;
+ } else {
+ // Just copy everything else.
+ translatedComment += formula[n];
+ }
+ }
+ }
+
+ if (inlineFormula) {
+ translatedComment += "`";
+ }
+}
+
+void PyDocConverter::handleCode(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ IndentGuard indent(translatedComment, m_indent);
+
+ trimWhitespace(translatedComment);
+
+ // Use the current indent for the code-block line itself.
+ translatedComment += indent.getFirstLineIndent();
+
+ // Go out on a limb and assume that examples in the C or C++ sources use C++.
+ // In the worst case, we'll highlight C code using C++ syntax which is not a
+ // big deal (TODO: handle Doxygen code command language argument).
+ translatedComment += ".. code-block:: c++\n\n";
+
+ // Specify the level of extra indentation that will be used for
+ // subsequent lines within the code block. Note that the correct
+ // "starting indentation" is already present in the input, so we
+ // only need to add the desired code block indentation.
+ string codeIndent = m_indent;
+
+ std::string code;
+ handleTagVerbatim(tag, code, arg);
+
+ // Try and remove leading newline, which is present for block \code
+ // command:
+ eraseLeadingNewLine(code);
+
+ translatedComment += codeIndent;
+ for (size_t n = 0; n < code.length(); n++) {
+ if (code[n] == '\n') {
+ // Don't leave trailing white space, this results in PEP8 validation
+ // errors in Python code (which are performed by our own unit tests).
+ trimWhitespace(translatedComment);
+ translatedComment += '\n';
+
+ // Ensure that we indent all the lines by the code indent.
+ translatedComment += codeIndent;
+ } else {
+ // Just copy everything else.
+ translatedComment += code[n];
+ }
+ }
+
+ trimWhitespace(translatedComment);
+
+ // For block commands, the translator adds the newline after
+ // \endcode, so try and compensate by removing the last newline from
+ // the code text:
+ eraseTrailingNewLine(translatedComment);
+}
+
+void PyDocConverter::handlePlainString(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ translatedComment += tag.data;
+}
+
+void PyDocConverter::handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ translatedComment += arg;
+ for (DoxygenEntityListCIt it = tag.entityList.begin(); it != tag.entityList.end(); it++) {
+ translatedComment += it->data;
+ }
+}
+
+void PyDocConverter::handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ translatedComment += arg;
+ handleParagraph(tag, translatedComment);
+}
+
+void PyDocConverter::handleTagChar(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ translatedComment += tag.typeOfEntity;
+}
+
+void PyDocConverter::handleTagIf(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ translatedComment += arg;
+ if (tag.entityList.size()) {
+ translatedComment += tag.entityList.begin()->data;
+ tag.entityList.pop_front();
+ translatedComment += " {" + translateSubtree(tag) + "}";
+ }
+}
+
+void PyDocConverter::handleTagPar(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ translatedComment += "Title: ";
+ if (tag.entityList.size())
+ translatedComment += tag.entityList.begin()->data;
+ tag.entityList.pop_front();
+ handleParagraph(tag, translatedComment);
+}
+
+void PyDocConverter::handleTagImage(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ if (tag.entityList.size() < 2)
+ return;
+ tag.entityList.pop_front();
+ translatedComment += "Image: ";
+ translatedComment += tag.entityList.begin()->data;
+ tag.entityList.pop_front();
+ if (tag.entityList.size())
+ translatedComment += "(" + tag.entityList.begin()->data + ")";
+}
+
+void PyDocConverter::handleTagParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ if (tag.entityList.size() < 2)
+ return;
+
+ IndentGuard indent(translatedComment, m_indent);
+
+ DoxygenEntity paramNameEntity = *tag.entityList.begin();
+ tag.entityList.pop_front();
+
+ const std::string &paramName = paramNameEntity.data;
+
+ const std::string paramType = getParamType(paramName);
+ if (!paramType.empty()) {
+ translatedComment += ":type " + paramName + ": " + paramType + "\n";
+ translatedComment += indent.getFirstLineIndent();
+ }
+
+ translatedComment += ":param " + paramName + ":";
+
+ handleParagraph(tag, translatedComment);
+}
+
+
+void PyDocConverter::handleTagReturn(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ IndentGuard indent(translatedComment, m_indent);
+
+ const std::string pytype = getPyDocType(currentNode);
+ if (!pytype.empty()) {
+ translatedComment += ":rtype: ";
+ translatedComment += pytype;
+ translatedComment += "\n";
+ translatedComment += indent.getFirstLineIndent();
+ }
+
+ translatedComment += ":return: ";
+ handleParagraph(tag, translatedComment);
+}
+
+
+void PyDocConverter::handleTagException(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ IndentGuard indent(translatedComment, m_indent);
+
+ translatedComment += ":raises: ";
+ handleParagraph(tag, translatedComment);
+}
+
+
+void PyDocConverter::handleTagRef(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ if (!tag.entityList.size())
+ return;
+
+ string anchor = tag.entityList.begin()->data;
+ tag.entityList.pop_front();
+ string anchorText = anchor;
+ if (!tag.entityList.empty()) {
+ anchorText = tag.entityList.begin()->data;
+ }
+ translatedComment += "'" + anchorText + "'";
+}
+
+
+void PyDocConverter::handleTagWrap(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ if (tag.entityList.size()) { // do not include empty tags
+ std::string tagData = translateSubtree(tag);
+ // wrap the thing, ignoring whitespace
+ size_t wsPos = tagData.find_last_not_of("\n\t ");
+ if (wsPos != std::string::npos && wsPos != tagData.size() - 1)
+ translatedComment += arg + tagData.substr(0, wsPos + 1) + arg + tagData.substr(wsPos + 1);
+ else
+ translatedComment += arg + tagData + arg;
+ }
+}
+
+void PyDocConverter::handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ std::string htmlTagArgs = tag.data;
+ if (htmlTagArgs == "/") {
+ // end html tag, for example "</ul>
+ // translatedComment += "</" + arg.substr(1) + ">";
+ } else {
+ translatedComment += arg + htmlTagArgs;
+ }
+}
+
+void PyDocConverter::handleDoxyHtmlTagNoParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ std::string htmlTagArgs = tag.data;
+ if (htmlTagArgs == "/") {
+ // end html tag, for example "</ul>
+ } else {
+ translatedComment += arg;
+ }
+}
+
+void PyDocConverter::handleDoxyHtmlTag_A(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ std::string htmlTagArgs = tag.data;
+ if (htmlTagArgs == "/") {
+ // end html tag, "</a>
+ translatedComment += " (" + m_url + ')';
+ m_url.clear();
+ } else {
+ m_url.clear();
+ size_t pos = htmlTagArgs.find('=');
+ if (pos != string::npos) {
+ m_url = htmlTagArgs.substr(pos + 1);
+ }
+ translatedComment += arg;
+ }
+}
+
+void PyDocConverter::handleDoxyHtmlTag2(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
+ std::string htmlTagArgs = tag.data;
+ if (htmlTagArgs == "/") {
+ // end html tag, for example "</em>
+ translatedComment += arg;
+ } else {
+ translatedComment += arg;
+ }
+}
+
+void PyDocConverter::handleDoxyHtmlTag_tr(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ std::string htmlTagArgs = tag.data;
+ size_t nlPos = translatedComment.rfind('\n');
+ if (htmlTagArgs == "/") {
+ // end tag, </tr> appends vertical table line '|'
+ translatedComment += '|';
+ if (nlPos != string::npos) {
+ size_t startOfTableLinePos = translatedComment.find_first_not_of(" \t", nlPos + 1);
+ if (startOfTableLinePos != string::npos) {
+ m_tableLineLen = translatedComment.size() - startOfTableLinePos;
+ }
+ }
+ } else {
+ if (m_prevRowIsTH) {
+ // if previous row contained <th> tag, add horizontal separator
+ // but first get leading spaces, because they'll be needed for the next row
+ size_t numLeadingSpaces = translatedComment.size() - nlPos - 1;
+
+ translatedComment += string(m_tableLineLen, '-') + '\n';
+
+ if (nlPos != string::npos) {
+ translatedComment += string(numLeadingSpaces, ' ');
+ }
+ m_prevRowIsTH = false;
+ }
+ }
+}
+
+void PyDocConverter::handleDoxyHtmlTag_th(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ std::string htmlTagArgs = tag.data;
+ if (htmlTagArgs == "/") {
+ // end tag, </th> is ignored
+ } else {
+ translatedComment += '|';
+ m_prevRowIsTH = true;
+ }
+}
+
+void PyDocConverter::handleDoxyHtmlTag_td(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
+ std::string htmlTagArgs = tag.data;
+ if (htmlTagArgs == "/") {
+ // end tag, </td> is ignored
+ } else {
+ translatedComment += '|';
+ }
+}
+
+void PyDocConverter::handleHtmlEntity(DoxygenEntity &, std::string &translatedComment, const std::string &arg) {
+ // html entities
+ translatedComment += arg;
+}
+
+void PyDocConverter::handleNewLine(DoxygenEntity &, std::string &translatedComment, const std::string &) {
+ trimWhitespace(translatedComment);
+
+ translatedComment += "\n";
+ if (!m_indent.empty())
+ translatedComment += m_indent;
+}
+
+String *PyDocConverter::makeDocumentation(Node *n) {
+ String *documentation;
+ std::string pyDocString;
+
+ // store the node, we may need it later
+ currentNode = n;
+
+ // for overloaded functions we must concat documentation for underlying overloads
+ if (Getattr(n, "sym:overloaded")) {
+ // rewind to the first overload
+ while (Getattr(n, "sym:previousSibling"))
+ n = Getattr(n, "sym:previousSibling");
+
+ std::vector<std::string> allDocumentation;
+
+ // minimal indent of any documentation comments, not initialized yet
+ size_t minIndent = static_cast<size_t>(-1);
+
+ // for each real method (not a generated overload) append the documentation
+ string oneDoc;
+ while (n) {
+ documentation = getDoxygenComment(n);
+ if (!Swig_is_generated_overload(n) && documentation) {
+ currentNode = n;
+ if (GetFlag(n, "feature:doxygen:notranslate")) {
+ String *comment = NewString("");
+ Append(comment, documentation);
+ Replaceall(comment, "\n *", "\n");
+ oneDoc = Char(comment);
+ Delete(comment);
+ } else {
+ std::list<DoxygenEntity> entityList = parser.createTree(n, documentation);
+ DoxygenEntity root("root", entityList);
+
+ oneDoc = translateSubtree(root);
+ }
+
+ // find the minimal indent of this documentation comment, we need to
+ // ensure that the entire comment is indented by it to avoid the leading
+ // parts of the other lines being simply discarded later
+ const size_t oneIndent = determineIndent(oneDoc);
+ if (oneIndent < minIndent)
+ minIndent = oneIndent;
+
+ allDocumentation.push_back(oneDoc);
+ }
+ n = Getattr(n, "sym:nextSibling");
+ }
+
+ // construct final documentation string
+ if (allDocumentation.size() > 1) {
+ string indentStr;
+ if (minIndent != static_cast<size_t>(-1))
+ indentStr.assign(minIndent, ' ');
+
+ std::ostringstream concatDocString;
+ for (size_t realOverloadCount = 0; realOverloadCount < allDocumentation.size(); realOverloadCount++) {
+ if (realOverloadCount != 0) {
+ // separate it from the preceding one.
+ concatDocString << "\n" << indentStr << "|\n\n";
+ }
+
+ oneDoc = allDocumentation[realOverloadCount];
+ trimWhitespace(oneDoc);
+ concatDocString << indentStr << "*Overload " << (realOverloadCount + 1) << ":*\n" << oneDoc;
+ }
+ pyDocString = concatDocString.str();
+ } else if (allDocumentation.size() == 1) {
+ pyDocString = *(allDocumentation.begin());
+ }
+ }
+ // for other nodes just process as normal
+ else {
+ documentation = getDoxygenComment(n);
+ if (documentation != NULL) {
+ if (GetFlag(n, "feature:doxygen:notranslate")) {
+ String *comment = NewString("");
+ Append(comment, documentation);
+ Replaceall(comment, "\n *", "\n");
+ pyDocString = Char(comment);
+ Delete(comment);
+ } else {
+ std::list<DoxygenEntity> entityList = parser.createTree(n, documentation);
+ DoxygenEntity root("root", entityList);
+ pyDocString = translateSubtree(root);
+ }
+ }
+ }
+
+ // if we got something log the result
+ if (!pyDocString.empty()) {
+
+ // remove the last '\n' since additional one is added during writing to file
+ eraseTrailingNewLine(pyDocString);
+
+ // ensure that a blank line occurs before code or math blocks
+ pyDocString = padCodeAndVerbatimBlocks(pyDocString);
+
+ if (m_flags & debug_translator) {
+ std::cout << "\n---RESULT IN PYDOC---" << std::endl;
+ std::cout << pyDocString;
+ std::cout << std::endl;
+ }
+ }
+
+ return NewString(pyDocString.c_str());
+}
diff --git a/Source/Doxygen/pydoc.h b/Source/Doxygen/pydoc.h
new file mode 100644
index 000000000..df8997d76
--- /dev/null
+++ b/Source/Doxygen/pydoc.h
@@ -0,0 +1,203 @@
+/* -----------------------------------------------------------------------------
+ * This file is part of SWIG, which is licensed as a whole under version 3
+ * (or any later version) of the GNU General Public License. Some additional
+ * terms also apply to certain portions of SWIG. The full details of the SWIG
+ * license and copyrights can be found in the LICENSE and COPYRIGHT files
+ * included with the SWIG source code as distributed by the SWIG developers
+ * and at http://www.swig.org/legal.html.
+ *
+ * pydoc.h
+ *
+ * Module to return documentation for nodes formatted for PyDoc
+ * ----------------------------------------------------------------------------- */
+
+#ifndef PYDOCCONVERTER_H_
+#define PYDOCCONVERTER_H_
+
+#include <list>
+#include <string>
+#include "swig.h"
+#include "doxyentity.h"
+#include "doxytranslator.h"
+
+#define DOC_STRING_LENGTH 64 // characters per line allowed
+#define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type
+
+class PyDocConverter : public DoxygenTranslator {
+public:
+ PyDocConverter(int flags = 0);
+ String *makeDocumentation(Node *node);
+
+protected:
+
+ size_t m_tableLineLen;
+ bool m_prevRowIsTH;
+ std::string m_url;
+
+ /*
+ * Translate every entity in a tree, also manages sections
+ * display. Prints title for every group of tags that have
+ * a section title associated with them
+ */
+ std::string translateSubtree(DoxygenEntity &doxygenEntity);
+
+ /*
+ * Translate one entity with the appropriate handler, according
+ * to the tagHandlers
+ */
+ void translateEntity(DoxygenEntity &doxyEntity, std::string &translatedComment);
+
+ /*
+ * Typedef for the function that handles one tag
+ * arg - some string argument to easily pass it through lookup table
+ */
+ typedef void (PyDocConverter::*tagHandler) (DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Wrap the command data with the some string
+ * arg - string to wrap with, like '_' or '*'
+ */
+ void handleTagWrap(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Just prints new line
+ */
+ void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Print the name of tag to the output, used for escape-commands
+ */
+ void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Format the contents of the \exception tag or its synonyms.
+ */
+ void handleTagException(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Print only the content and strip original tag
+ */
+ void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg = std::string());
+
+ /*
+ * Handle Doxygen verbatim tag
+ */
+ void handleVerbatimBlock(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg = std::string());
+
+ /*
+ * Handle one of the Doxygen formula-related tags.
+ */
+ void handleMath(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Handle a code snippet.
+ */
+ void handleCode(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Print only data part of code
+ */
+ void handlePlainString(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /**
+ * Copies verbatim args of the tag to output, used for commands like \f$, ...
+ */
+ void handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Print the if-elseif-else-endif section
+ */
+ void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Prints the specified message, than the contents of the tag
+ * arg - message
+ */
+ void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Insert 'Title: ...'
+ */
+ void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Insert 'Image: ...'
+ */
+ void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Format nice param description with type information
+ */
+ void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Format the contents of the \return tag or its synonyms.
+ */
+ void handleTagReturn(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Writes text for \ref tag.
+ */
+ void handleTagRef(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /* Handles HTML tags recognized by Doxygen, like <A ...>, <ul>, <table>, ... */
+
+ void handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /** Does not output params of HTML tag, for example in <table border='1'>
+ * 'border=1' is not written to output.
+ */
+ void handleDoxyHtmlTagNoParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /** Translates tag <a href = "url">text</a> to: text ("url"). */
+ void handleDoxyHtmlTag_A(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /*
+ * Handles HTML tags, which are translated to markdown-like syntax, for example
+ * <i>text</i> --> _text_. Appends arg for start HTML tag and end HTML tag.
+ */
+ void handleDoxyHtmlTag2(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /* Handles HTML table, tag <tr> */
+ void handleDoxyHtmlTag_tr(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /* Handles HTML table, tag <th> */
+ void handleDoxyHtmlTag_th(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /* Handles HTML table, tag <td> */
+ void handleDoxyHtmlTag_td(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
+
+ /* Handles HTML entities recognized by Doxygen, like &lt;, &copy;, ... */
+ void handleHtmlEntity(DoxygenEntity &, std::string &translatedComment, const std::string &arg);
+
+
+ /*
+ * Simple helper function that calculates correct parameter type
+ * of the node stored in 'currentNode'
+ * If param with specified name is not found, empty string is returned
+ */
+ std::string getParamType(std::string name);
+
+private:
+ // temporary thing, should be refactored somehow
+ Node *currentNode;
+
+ // Extra indent for the current paragraph, must be output after each new line.
+ std::string m_indent;
+
+
+ // this contains the handler pointer and one string argument
+ typedef std::map<std::string, std::pair<tagHandler, std::string> >TagHandlersMap;
+ static TagHandlersMap tagHandlers;
+
+ // this contains the sections tittles, like 'Arguments:' or 'Notes:', that are printed only once
+ static std::map<std::string, std::string> sectionTitles;
+
+ // Helper functions for fillStaticTables(): make a new tag handler object.
+ TagHandlersMap::mapped_type make_handler(tagHandler handler);
+ TagHandlersMap::mapped_type make_handler(tagHandler handler, const char *arg);
+
+ void fillStaticTables();
+};
+
+#endif
diff --git a/Source/Include/swigconfig.h.in b/Source/Include/swigconfig.h.in
new file mode 100644
index 000000000..192c7d340
--- /dev/null
+++ b/Source/Include/swigconfig.h.in
@@ -0,0 +1,93 @@
+/* Source/Include/swigconfig.h.in. Generated from configure.ac by autoheader. */
+
+/* define if the Boost library is available */
+#undef HAVE_BOOST
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define to 1 if you have the `dld' library (-ldld). */
+#undef HAVE_LIBDLD
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define if you have PCRE library */
+#undef HAVE_PCRE
+
+/* Define if popen is available */
+#undef HAVE_POPEN
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Compiler that built SWIG */
+#undef SWIG_CXX
+
+/* Directory for SWIG system-independent libraries */
+#undef SWIG_LIB
+
+/* Directory for SWIG system-independent libraries (Unix install on native
+ Windows) */
+#undef SWIG_LIB_WIN_UNIX
+
+/* Platform that SWIG is built for */
+#undef SWIG_PLATFORM
+
+/* Version number of package */
+#undef VERSION
+
+
+/* Deal with attempt by Microsoft to deprecate C standard runtime functions */
+#if defined(_MSC_VER)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
diff --git a/Source/Include/swigwarn.h b/Source/Include/swigwarn.h
index 0b4c7eeb5..a08693ac8 100644
--- a/Source/Include/swigwarn.h
+++ b/Source/Include/swigwarn.h
@@ -18,6 +18,8 @@
* Even though symbolic constants are used in the SWIG source, this is
* not always the case in SWIG interface files. Do not change the
* numbers in this file.
+ *
+ * This file is used as the input for generating Lib/swigwarn.swg.
* ----------------------------------------------------------------------------- */
#ifndef SWIGWARN_H_
@@ -153,6 +155,7 @@
#define WARN_TYPE_INCOMPLETE 402
#define WARN_TYPE_ABSTRACT 403
#define WARN_TYPE_REDEFINED 404
+#define WARN_TYPE_RVALUE_REF_QUALIFIER_IGNORED 405
#define WARN_TYPEMAP_SOURCETARGET 450
#define WARN_TYPEMAP_CHARLEAK 451
@@ -207,6 +210,18 @@
#define WARN_LANG_ILLEGAL_DESTRUCTOR 521
#define WARN_LANG_EXTEND_CONSTRUCTOR 522
#define WARN_LANG_EXTEND_DESTRUCTOR 523
+#define WARN_LANG_EXPERIMENTAL 524
+#define WARN_LANG_DIRECTOR_FINAL 525
+
+/* -- Doxygen comments -- */
+
+#define WARN_DOXYGEN_UNKNOWN_COMMAND 560
+#define WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT 561
+#define WARN_DOXYGEN_COMMAND_EXPECTED 562
+#define WARN_DOXYGEN_HTML_ERROR 563
+#define WARN_DOXYGEN_COMMAND_ERROR 564
+#define WARN_DOXYGEN_UNKNOWN_CHARACTER 565
+#define WARN_DOXYGEN_UNEXPECTED_ITERATOR_VALUE 566
/* -- Reserved (600-799) -- */
diff --git a/Source/Makefile.am b/Source/Makefile.am
index efa3ac1e4..5cfb88839 100644
--- a/Source/Makefile.am
+++ b/Source/Makefile.am
@@ -13,6 +13,7 @@ AM_CPPFLAGS = -I$(BUILD_SOURCE_DIR)/Include \
-I$(SOURCE_DIR)/Include \
-I$(SOURCE_DIR)/DOH \
-I$(SOURCE_DIR)/CParse \
+ -I$(SOURCE_DIR)/Doxygen \
-I$(SOURCE_DIR)/Preprocessor \
-I$(SOURCE_DIR)/Swig \
-I$(SOURCE_DIR)/Modules
@@ -34,12 +35,18 @@ eswig_SOURCES = CParse/cscanner.c \
DOH/memory.c \
DOH/string.c \
DOH/void.c \
- Modules/allegrocl.cxx \
+ Doxygen/doxyentity.cxx \
+ Doxygen/doxyentity.h \
+ Doxygen/doxyparser.cxx \
+ Doxygen/doxyparser.h \
+ Doxygen/doxytranslator.cxx \
+ Doxygen/doxytranslator.h \
+ Doxygen/javadoc.cxx \
+ Doxygen/javadoc.h \
+ Doxygen/pydoc.cxx \
+ Doxygen/pydoc.h \
Modules/allocate.cxx \
Modules/browser.cxx \
- Modules/cffi.cxx \
- Modules/chicken.cxx \
- Modules/clisp.cxx \
Modules/contract.cxx \
Modules/csharp.cxx \
Modules/d.cxx \
@@ -53,26 +60,20 @@ eswig_SOURCES = CParse/cscanner.c \
Modules/lang.cxx \
Modules/lua.cxx \
Modules/main.cxx \
- Modules/modula3.cxx \
- Modules/module.cxx \
Modules/mzscheme.cxx \
- Modules/nested.cxx \
+ Modules/nested.cxx \
Modules/ocaml.cxx \
Modules/octave.cxx \
Modules/overload.cxx \
Modules/perl5.cxx \
Modules/php.cxx \
- Modules/php5.cxx \
- Modules/pike.cxx \
Modules/python.cxx \
Modules/r.cxx \
Modules/ruby.cxx \
- Modules/s-exp.cxx \
Modules/scilab.cxx \
Modules/swigmain.cxx \
Modules/tcl8.cxx \
Modules/typepass.cxx \
- Modules/uffi.cxx \
Modules/utils.cxx \
Modules/xml.cxx \
Preprocessor/cpp.c \
@@ -91,8 +92,8 @@ eswig_SOURCES = CParse/cscanner.c \
Swig/stype.c \
Swig/symbol.c \
Swig/tree.c \
- Swig/typeobj.c \
Swig/typemap.c \
+ Swig/typeobj.c \
Swig/typesys.c \
Swig/wrapfunc.c
@@ -122,7 +123,7 @@ distclean-local:
# swig executable as a way of checking before and after the 'beautifying'.
# Single files can be beautified with the beautify-file target, eg: 'make beautify-file INDENTFILE=chosenfile.c'
-SWIGTYPEDEFS=-T bool -T File -T DohObjInfo -T Parm -T Language -T List -T Typetab -T ModuleFactory -T ErrorMessageFormat -T Symtab -T Hash -T Scanner -T String -T DohBase -T Node -T String_or_char -T SwigType -T Dispatcher -T Wrapper -T DohStringMethods -T DohFileMethods -T DohListMethods -T DohHashMethods -T DOH -T DohIterator -T ParmList -T FILE -T HashNode -T DOHObj_or_char -T DOHFile -T DOHString -T DOHString_or_char -T UpcallData
+SWIGTYPEDEFS=-T bool -T File -T DohObjInfo -T Parm -T Language -T List -T TargetLanguageModule -T Typetab -T ModuleFactory -T ErrorMessageFormat -T Symtab -T Hash -T Scanner -T String -T DohBase -T Node -T String_or_char -T SwigType -T Dispatcher -T Wrapper -T DohStringMethods -T DohFileMethods -T DohListMethods -T DohHashMethods -T DOH -T DohIterator -T ParmList -T FILE -T HashNode -T DOHObj_or_char -T DOHFile -T DOHString -T DOHString_or_char -T UpcallData
INDENTBAKSDIR=../IndentBaks
beautify:
diff --git a/Source/Makefile.in b/Source/Makefile.in
new file mode 100644
index 000000000..19db67f71
--- /dev/null
+++ b/Source/Makefile.in
@@ -0,0 +1,1408 @@
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = eswig$(EXEEXT)
+subdir = Source
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = \
+ $(top_srcdir)/Tools/config/ac_compile_warnings.m4 \
+ $(top_srcdir)/Tools/config/ac_define_dir.m4 \
+ $(top_srcdir)/Tools/config/ax_boost_base.m4 \
+ $(top_srcdir)/Tools/config/ax_compare_version.m4 \
+ $(top_srcdir)/Tools/config/ax_cxx_compile_stdcxx_11.m4 \
+ $(top_srcdir)/Tools/config/ax_path_generic.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/Source/Include/swigconfig.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am__dirstamp = $(am__leading_dot)dirstamp
+am_eswig_OBJECTS = CParse/cscanner.$(OBJEXT) CParse/parser.$(OBJEXT) \
+ CParse/templ.$(OBJEXT) CParse/util.$(OBJEXT) \
+ DOH/base.$(OBJEXT) DOH/file.$(OBJEXT) DOH/fio.$(OBJEXT) \
+ DOH/hash.$(OBJEXT) DOH/list.$(OBJEXT) DOH/memory.$(OBJEXT) \
+ DOH/string.$(OBJEXT) DOH/void.$(OBJEXT) \
+ Doxygen/doxyentity.$(OBJEXT) Doxygen/doxyparser.$(OBJEXT) \
+ Doxygen/doxytranslator.$(OBJEXT) Doxygen/javadoc.$(OBJEXT) \
+ Doxygen/pydoc.$(OBJEXT) Modules/allocate.$(OBJEXT) \
+ Modules/browser.$(OBJEXT) Modules/contract.$(OBJEXT) \
+ Modules/csharp.$(OBJEXT) Modules/d.$(OBJEXT) \
+ Modules/directors.$(OBJEXT) Modules/emit.$(OBJEXT) \
+ Modules/go.$(OBJEXT) Modules/guile.$(OBJEXT) \
+ Modules/interface.$(OBJEXT) Modules/java.$(OBJEXT) \
+ Modules/javascript.$(OBJEXT) Modules/lang.$(OBJEXT) \
+ Modules/lua.$(OBJEXT) Modules/main.$(OBJEXT) \
+ Modules/mzscheme.$(OBJEXT) Modules/nested.$(OBJEXT) \
+ Modules/ocaml.$(OBJEXT) Modules/octave.$(OBJEXT) \
+ Modules/overload.$(OBJEXT) Modules/perl5.$(OBJEXT) \
+ Modules/php.$(OBJEXT) Modules/python.$(OBJEXT) \
+ Modules/r.$(OBJEXT) Modules/ruby.$(OBJEXT) \
+ Modules/scilab.$(OBJEXT) Modules/swigmain.$(OBJEXT) \
+ Modules/tcl8.$(OBJEXT) Modules/typepass.$(OBJEXT) \
+ Modules/utils.$(OBJEXT) Modules/xml.$(OBJEXT) \
+ Preprocessor/cpp.$(OBJEXT) Preprocessor/expr.$(OBJEXT) \
+ Swig/cwrap.$(OBJEXT) Swig/deprecate.$(OBJEXT) \
+ Swig/error.$(OBJEXT) Swig/extend.$(OBJEXT) \
+ Swig/fragment.$(OBJEXT) Swig/getopt.$(OBJEXT) \
+ Swig/include.$(OBJEXT) Swig/misc.$(OBJEXT) \
+ Swig/naming.$(OBJEXT) Swig/parms.$(OBJEXT) \
+ Swig/scanner.$(OBJEXT) Swig/stype.$(OBJEXT) \
+ Swig/symbol.$(OBJEXT) Swig/tree.$(OBJEXT) \
+ Swig/typemap.$(OBJEXT) Swig/typeobj.$(OBJEXT) \
+ Swig/typesys.$(OBJEXT) Swig/wrapfunc.$(OBJEXT)
+eswig_OBJECTS = $(am_eswig_OBJECTS)
+eswig_DEPENDENCIES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES =
+depcomp = $(SHELL) $(top_srcdir)/Tools/config/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = CParse/$(DEPDIR)/cscanner.Po \
+ CParse/$(DEPDIR)/parser.Po CParse/$(DEPDIR)/templ.Po \
+ CParse/$(DEPDIR)/util.Po DOH/$(DEPDIR)/base.Po \
+ DOH/$(DEPDIR)/file.Po DOH/$(DEPDIR)/fio.Po \
+ DOH/$(DEPDIR)/hash.Po DOH/$(DEPDIR)/list.Po \
+ DOH/$(DEPDIR)/memory.Po DOH/$(DEPDIR)/string.Po \
+ DOH/$(DEPDIR)/void.Po Doxygen/$(DEPDIR)/doxyentity.Po \
+ Doxygen/$(DEPDIR)/doxyparser.Po \
+ Doxygen/$(DEPDIR)/doxytranslator.Po \
+ Doxygen/$(DEPDIR)/javadoc.Po Doxygen/$(DEPDIR)/pydoc.Po \
+ Modules/$(DEPDIR)/allocate.Po Modules/$(DEPDIR)/browser.Po \
+ Modules/$(DEPDIR)/contract.Po Modules/$(DEPDIR)/csharp.Po \
+ Modules/$(DEPDIR)/d.Po Modules/$(DEPDIR)/directors.Po \
+ Modules/$(DEPDIR)/emit.Po Modules/$(DEPDIR)/go.Po \
+ Modules/$(DEPDIR)/guile.Po Modules/$(DEPDIR)/interface.Po \
+ Modules/$(DEPDIR)/java.Po Modules/$(DEPDIR)/javascript.Po \
+ Modules/$(DEPDIR)/lang.Po Modules/$(DEPDIR)/lua.Po \
+ Modules/$(DEPDIR)/main.Po Modules/$(DEPDIR)/mzscheme.Po \
+ Modules/$(DEPDIR)/nested.Po Modules/$(DEPDIR)/ocaml.Po \
+ Modules/$(DEPDIR)/octave.Po Modules/$(DEPDIR)/overload.Po \
+ Modules/$(DEPDIR)/perl5.Po Modules/$(DEPDIR)/php.Po \
+ Modules/$(DEPDIR)/python.Po Modules/$(DEPDIR)/r.Po \
+ Modules/$(DEPDIR)/ruby.Po Modules/$(DEPDIR)/scilab.Po \
+ Modules/$(DEPDIR)/swigmain.Po Modules/$(DEPDIR)/tcl8.Po \
+ Modules/$(DEPDIR)/typepass.Po Modules/$(DEPDIR)/utils.Po \
+ Modules/$(DEPDIR)/xml.Po Preprocessor/$(DEPDIR)/cpp.Po \
+ Preprocessor/$(DEPDIR)/expr.Po Swig/$(DEPDIR)/cwrap.Po \
+ Swig/$(DEPDIR)/deprecate.Po Swig/$(DEPDIR)/error.Po \
+ Swig/$(DEPDIR)/extend.Po Swig/$(DEPDIR)/fragment.Po \
+ Swig/$(DEPDIR)/getopt.Po Swig/$(DEPDIR)/include.Po \
+ Swig/$(DEPDIR)/misc.Po Swig/$(DEPDIR)/naming.Po \
+ Swig/$(DEPDIR)/parms.Po Swig/$(DEPDIR)/scanner.Po \
+ Swig/$(DEPDIR)/stype.Po Swig/$(DEPDIR)/symbol.Po \
+ Swig/$(DEPDIR)/tree.Po Swig/$(DEPDIR)/typemap.Po \
+ Swig/$(DEPDIR)/typeobj.Po Swig/$(DEPDIR)/typesys.Po \
+ Swig/$(DEPDIR)/wrapfunc.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
+CXXLD = $(CXX)
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
+am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
+ -e s/c++$$/h++/ -e s/c$$/h/
+YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
+AM_V_YACC = $(am__v_YACC_@AM_V@)
+am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@)
+am__v_YACC_0 = @echo " YACC " $@;
+am__v_YACC_1 =
+YLWRAP = $(top_srcdir)/Tools/config/ylwrap
+SOURCES = $(eswig_SOURCES)
+DIST_SOURCES = $(eswig_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+ $(top_srcdir)/Tools/config/depcomp \
+ $(top_srcdir)/Tools/config/ylwrap CParse/parser.c \
+ CParse/parser.h README
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADB = @ADB@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+ANDROID = @ANDROID@
+ANT = @ANT@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+CAMLP4 = @CAMLP4@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CCSHARED = @CCSHARED@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CSHARPCFLAGS = @CSHARPCFLAGS@
+CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
+CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
+CSHARPCOMPILER = @CSHARPCOMPILER@
+CSHARPCONVERTPATH = @CSHARPCONVERTPATH@
+CSHARPDYNAMICLINKING = @CSHARPDYNAMICLINKING@
+CSHARPLIBRARYPREFIX = @CSHARPLIBRARYPREFIX@
+CSHARPSO = @CSHARPSO@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CXXSHARED = @CXXSHARED@
+CYGPATH_W = @CYGPATH_W@
+D1COMPILER = @D1COMPILER@
+D2COMPILER = @D2COMPILER@
+DDEFAULTVERSION = @DDEFAULTVERSION@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLIBPREFIX = @DLIBPREFIX@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_CCACHE = @ENABLE_CCACHE@
+EXEEXT = @EXEEXT@
+EXTRA_CLEAN = @EXTRA_CLEAN@
+GCCGO = @GCCGO@
+GCCGOOPT = @GCCGOOPT@
+GO = @GO@
+GO1 = @GO1@
+GO12 = @GO12@
+GO13 = @GO13@
+GO15 = @GO15@
+GOC = @GOC@
+GOGCC = @GOGCC@
+GOOPT = @GOOPT@
+GOVERSIONOPTION = @GOVERSIONOPTION@
+GREP = @GREP@
+GUILE = @GUILE@
+GUILE_CFLAGS = @GUILE_CFLAGS@
+GUILE_CONFIG = @GUILE_CONFIG@
+GUILE_LIBS = @GUILE_LIBS@
+GUILE_SO = @GUILE_SO@
+HAVE_CXX11_COMPILER = @HAVE_CXX11_COMPILER@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVACXXSHARED = @JAVACXXSHARED@
+JAVADYNAMICLINKING = @JAVADYNAMICLINKING@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAINC = @JAVAINC@
+JAVALDSHARED = @JAVALDSHARED@
+JAVALIBRARYPREFIX = @JAVALIBRARYPREFIX@
+JAVASO = @JAVASO@
+JAVA_CLASSPATH_SEP = @JAVA_CLASSPATH_SEP@
+JAVA_TOOLS_JAR = @JAVA_TOOLS_JAR@
+JSCENABLED = @JSCENABLED@
+JSCOREDYNAMICLINKING = @JSCOREDYNAMICLINKING@
+JSCOREINC = @JSCOREINC@
+JSCOREVERSION = @JSCOREVERSION@
+JSINTERPRETERCXX = @JSINTERPRETERCXX@
+JSINTERPRETERLINKFLAGS = @JSINTERPRETERLINKFLAGS@
+JSV8DYNAMICLINKING = @JSV8DYNAMICLINKING@
+JSV8ENABLED = @JSV8ENABLED@
+JSV8INC = @JSV8INC@
+LDFLAGS = @LDFLAGS@
+LDSHARED = @LDSHARED@
+LIBC = @LIBC@
+LIBCRYPT = @LIBCRYPT@
+LIBM = @LIBM@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LINKFORSHARED = @LINKFORSHARED@
+LTLIBOBJS = @LTLIBOBJS@
+LUABIN = @LUABIN@
+LUADYNAMICLINKING = @LUADYNAMICLINKING@
+LUAFLAGS = @LUAFLAGS@
+LUALINK = @LUALINK@
+LUA_SO = @LUA_SO@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MZC = @MZC@
+MZDYNOBJ = @MZDYNOBJ@
+MZSCHEME = @MZSCHEME@
+MZSCHEME_SO = @MZSCHEME_SO@
+NDKBUILD = @NDKBUILD@
+NODEGYP = @NODEGYP@
+NODEJS = @NODEJS@
+OBJEXT = @OBJEXT@
+OCAMLC = @OCAMLC@
+OCAMLDLGEN = @OCAMLDLGEN@
+OCAMLFIND = @OCAMLFIND@
+OCAMLMKTOP = @OCAMLMKTOP@
+OCTAVE = @OCTAVE@
+OCTAVE_CPPFLAGS = @OCTAVE_CPPFLAGS@
+OCTAVE_CXXFLAGS = @OCTAVE_CXXFLAGS@
+OCTAVE_LDFLAGS = @OCTAVE_LDFLAGS@
+OCTAVE_SO = @OCTAVE_SO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCRE_CFLAGS = @PCRE_CFLAGS@
+PCRE_CONFIG = @PCRE_CONFIG@
+PCRE_LIBS = @PCRE_LIBS@
+PERL = @PERL@
+PERL5CCCDLFLAGS = @PERL5CCCDLFLAGS@
+PERL5CCDLFLAGS = @PERL5CCDLFLAGS@
+PERL5CCFLAGS = @PERL5CCFLAGS@
+PERL5DYNAMICLINKING = @PERL5DYNAMICLINKING@
+PERL5EXT = @PERL5EXT@
+PERL5LDFLAGS = @PERL5LDFLAGS@
+PERL5LIB = @PERL5LIB@
+PHP = @PHP@
+PHPINC = @PHPINC@
+PHP_SO = @PHP_SO@
+PKGCONFIG = @PKGCONFIG@
+PLATCFLAGS = @PLATCFLAGS@
+PLATCXXFLAGS = @PLATCXXFLAGS@
+PY2TO3 = @PY2TO3@
+PY3CONFIG = @PY3CONFIG@
+PY3INCLUDE = @PY3INCLUDE@
+PY3LIB = @PY3LIB@
+PY3LINK = @PY3LINK@
+PYCODESTYLE = @PYCODESTYLE@
+PYINCLUDE = @PYINCLUDE@
+PYLIB = @PYLIB@
+PYLINK = @PYLINK@
+PYTHON = @PYTHON@
+PYTHON3 = @PYTHON3@
+PYTHON3DYNAMICLINKING = @PYTHON3DYNAMICLINKING@
+PYTHONDYNAMICLINKING = @PYTHONDYNAMICLINKING@
+PYTHON_SO = @PYTHON_SO@
+RBIN = @RBIN@
+ROOT_DIR = @ROOT_DIR@
+RPATH = @RPATH@
+RUBY = @RUBY@
+RUBYCCDLFLAGS = @RUBYCCDLFLAGS@
+RUBYDYNAMICLINKING = @RUBYDYNAMICLINKING@
+RUBYINCLUDE = @RUBYINCLUDE@
+RUBYLIB = @RUBYLIB@
+RUBYLINK = @RUBYLINK@
+RUBYSO = @RUBYSO@
+SCILAB = @SCILAB@
+SCILABINCLUDE = @SCILABINCLUDE@
+SCILABOPT = @SCILABOPT@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SKIP_ANDROID = @SKIP_ANDROID@
+SKIP_CSHARP = @SKIP_CSHARP@
+SKIP_D = @SKIP_D@
+SKIP_GO = @SKIP_GO@
+SKIP_GUILE = @SKIP_GUILE@
+SKIP_JAVA = @SKIP_JAVA@
+SKIP_JAVASCRIPT = @SKIP_JAVASCRIPT@
+SKIP_LUA = @SKIP_LUA@
+SKIP_MZSCHEME = @SKIP_MZSCHEME@
+SKIP_OCAML = @SKIP_OCAML@
+SKIP_OCTAVE = @SKIP_OCTAVE@
+SKIP_PERL5 = @SKIP_PERL5@
+SKIP_PHP = @SKIP_PHP@
+SKIP_PYTHON = @SKIP_PYTHON@
+SKIP_PYTHON3 = @SKIP_PYTHON3@
+SKIP_R = @SKIP_R@
+SKIP_RUBY = @SKIP_RUBY@
+SKIP_SCILAB = @SKIP_SCILAB@
+SKIP_TCL = @SKIP_TCL@
+SO = @SO@
+STRIP = @STRIP@
+SWIGLIBS = @SWIGLIBS@
+SWIG_LIB = @SWIG_LIB@
+SWIG_LIB_INSTALL = @SWIG_LIB_INSTALL@
+SWIG_LIB_PREINST = @SWIG_LIB_PREINST@
+SWIG_LIB_SET = @SWIG_LIB_SET@
+SWILL = @SWILL@
+TCLCXXSHARED = @TCLCXXSHARED@
+TCLDYNAMICLINKING = @TCLDYNAMICLINKING@
+TCLINCLUDE = @TCLINCLUDE@
+TCLLDSHARED = @TCLLDSHARED@
+TCLLIB = @TCLLIB@
+TCL_SO = @TCL_SO@
+TRYLINKINGWITHCXX = @TRYLINKINGWITHCXX@
+VERSION = @VERSION@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# subdir-objects generates object files using the directory structure of the source files.
+AUTOMAKE_OPTIONS = foreign nostdinc subdir-objects 1.7.2
+SOURCE_DIR = $(top_srcdir)/Source
+BUILD_SOURCE_DIR = $(top_builddir)/Source
+SWIG_CXX_DEFS = @SWILL@
+AM_CPPFLAGS = -I$(BUILD_SOURCE_DIR)/Include \
+ -I$(BUILD_SOURCE_DIR)/CParse \
+ -I$(SOURCE_DIR)/Include \
+ -I$(SOURCE_DIR)/DOH \
+ -I$(SOURCE_DIR)/CParse \
+ -I$(SOURCE_DIR)/Doxygen \
+ -I$(SOURCE_DIR)/Preprocessor \
+ -I$(SOURCE_DIR)/Swig \
+ -I$(SOURCE_DIR)/Modules
+
+AM_CXXFLAGS = $(SWIG_CXX_DEFS)
+AM_YFLAGS = -d
+BUILT_SOURCES = CParse/parser.h
+eswig_SOURCES = CParse/cscanner.c \
+ CParse/parser.y \
+ CParse/templ.c \
+ CParse/util.c \
+ DOH/base.c \
+ DOH/file.c \
+ DOH/fio.c \
+ DOH/hash.c \
+ DOH/list.c \
+ DOH/memory.c \
+ DOH/string.c \
+ DOH/void.c \
+ Doxygen/doxyentity.cxx \
+ Doxygen/doxyentity.h \
+ Doxygen/doxyparser.cxx \
+ Doxygen/doxyparser.h \
+ Doxygen/doxytranslator.cxx \
+ Doxygen/doxytranslator.h \
+ Doxygen/javadoc.cxx \
+ Doxygen/javadoc.h \
+ Doxygen/pydoc.cxx \
+ Doxygen/pydoc.h \
+ Modules/allocate.cxx \
+ Modules/browser.cxx \
+ Modules/contract.cxx \
+ Modules/csharp.cxx \
+ Modules/d.cxx \
+ Modules/directors.cxx \
+ Modules/emit.cxx \
+ Modules/go.cxx \
+ Modules/guile.cxx \
+ Modules/interface.cxx \
+ Modules/java.cxx \
+ Modules/javascript.cxx \
+ Modules/lang.cxx \
+ Modules/lua.cxx \
+ Modules/main.cxx \
+ Modules/mzscheme.cxx \
+ Modules/nested.cxx \
+ Modules/ocaml.cxx \
+ Modules/octave.cxx \
+ Modules/overload.cxx \
+ Modules/perl5.cxx \
+ Modules/php.cxx \
+ Modules/python.cxx \
+ Modules/r.cxx \
+ Modules/ruby.cxx \
+ Modules/scilab.cxx \
+ Modules/swigmain.cxx \
+ Modules/tcl8.cxx \
+ Modules/typepass.cxx \
+ Modules/utils.cxx \
+ Modules/xml.cxx \
+ Preprocessor/cpp.c \
+ Preprocessor/expr.c \
+ Swig/cwrap.c \
+ Swig/deprecate.c \
+ Swig/error.c \
+ Swig/extend.c \
+ Swig/fragment.c \
+ Swig/getopt.c \
+ Swig/include.c \
+ Swig/misc.c \
+ Swig/naming.c \
+ Swig/parms.c \
+ Swig/scanner.c \
+ Swig/stype.c \
+ Swig/symbol.c \
+ Swig/tree.c \
+ Swig/typemap.c \
+ Swig/typeobj.c \
+ Swig/typesys.c \
+ Swig/wrapfunc.c
+
+eswig_LDADD = @SWIGLIBS@
+
+# Override the link stage to avoid using Libtool
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+
+# Beautify the code.
+# Note that this works well on C code, but does some odd joining of lines for C++ code.
+# Compiling with -DNDEBUG and no optimisations will allow one to do a binary diff of the
+# swig executable as a way of checking before and after the 'beautifying'.
+# Single files can be beautified with the beautify-file target, eg: 'make beautify-file INDENTFILE=chosenfile.c'
+SWIGTYPEDEFS = -T bool -T File -T DohObjInfo -T Parm -T Language -T List -T TargetLanguageModule -T Typetab -T ModuleFactory -T ErrorMessageFormat -T Symtab -T Hash -T Scanner -T String -T DohBase -T Node -T String_or_char -T SwigType -T Dispatcher -T Wrapper -T DohStringMethods -T DohFileMethods -T DohListMethods -T DohHashMethods -T DOH -T DohIterator -T ParmList -T FILE -T HashNode -T DOHObj_or_char -T DOHFile -T DOHString -T DOHString_or_char -T UpcallData
+INDENTBAKSDIR = ../IndentBaks
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cxx .o .obj .y
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Source/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Source/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+CParse/$(am__dirstamp):
+ @$(MKDIR_P) CParse
+ @: > CParse/$(am__dirstamp)
+CParse/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) CParse/$(DEPDIR)
+ @: > CParse/$(DEPDIR)/$(am__dirstamp)
+CParse/cscanner.$(OBJEXT): CParse/$(am__dirstamp) \
+ CParse/$(DEPDIR)/$(am__dirstamp)
+CParse/parser.h: CParse/parser.c
+ @if test ! -f $@; then rm -f CParse/parser.c; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) CParse/parser.c; else :; fi
+CParse/parser.$(OBJEXT): CParse/$(am__dirstamp) \
+ CParse/$(DEPDIR)/$(am__dirstamp)
+CParse/templ.$(OBJEXT): CParse/$(am__dirstamp) \
+ CParse/$(DEPDIR)/$(am__dirstamp)
+CParse/util.$(OBJEXT): CParse/$(am__dirstamp) \
+ CParse/$(DEPDIR)/$(am__dirstamp)
+DOH/$(am__dirstamp):
+ @$(MKDIR_P) DOH
+ @: > DOH/$(am__dirstamp)
+DOH/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) DOH/$(DEPDIR)
+ @: > DOH/$(DEPDIR)/$(am__dirstamp)
+DOH/base.$(OBJEXT): DOH/$(am__dirstamp) DOH/$(DEPDIR)/$(am__dirstamp)
+DOH/file.$(OBJEXT): DOH/$(am__dirstamp) DOH/$(DEPDIR)/$(am__dirstamp)
+DOH/fio.$(OBJEXT): DOH/$(am__dirstamp) DOH/$(DEPDIR)/$(am__dirstamp)
+DOH/hash.$(OBJEXT): DOH/$(am__dirstamp) DOH/$(DEPDIR)/$(am__dirstamp)
+DOH/list.$(OBJEXT): DOH/$(am__dirstamp) DOH/$(DEPDIR)/$(am__dirstamp)
+DOH/memory.$(OBJEXT): DOH/$(am__dirstamp) \
+ DOH/$(DEPDIR)/$(am__dirstamp)
+DOH/string.$(OBJEXT): DOH/$(am__dirstamp) \
+ DOH/$(DEPDIR)/$(am__dirstamp)
+DOH/void.$(OBJEXT): DOH/$(am__dirstamp) DOH/$(DEPDIR)/$(am__dirstamp)
+Doxygen/$(am__dirstamp):
+ @$(MKDIR_P) Doxygen
+ @: > Doxygen/$(am__dirstamp)
+Doxygen/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) Doxygen/$(DEPDIR)
+ @: > Doxygen/$(DEPDIR)/$(am__dirstamp)
+Doxygen/doxyentity.$(OBJEXT): Doxygen/$(am__dirstamp) \
+ Doxygen/$(DEPDIR)/$(am__dirstamp)
+Doxygen/doxyparser.$(OBJEXT): Doxygen/$(am__dirstamp) \
+ Doxygen/$(DEPDIR)/$(am__dirstamp)
+Doxygen/doxytranslator.$(OBJEXT): Doxygen/$(am__dirstamp) \
+ Doxygen/$(DEPDIR)/$(am__dirstamp)
+Doxygen/javadoc.$(OBJEXT): Doxygen/$(am__dirstamp) \
+ Doxygen/$(DEPDIR)/$(am__dirstamp)
+Doxygen/pydoc.$(OBJEXT): Doxygen/$(am__dirstamp) \
+ Doxygen/$(DEPDIR)/$(am__dirstamp)
+Modules/$(am__dirstamp):
+ @$(MKDIR_P) Modules
+ @: > Modules/$(am__dirstamp)
+Modules/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) Modules/$(DEPDIR)
+ @: > Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/allocate.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/browser.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/contract.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/csharp.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/d.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/directors.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/emit.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/go.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/guile.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/interface.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/java.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/javascript.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/lang.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/lua.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/main.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/mzscheme.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/nested.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/ocaml.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/octave.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/overload.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/perl5.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/php.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/python.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/r.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/ruby.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/scilab.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/swigmain.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/tcl8.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/typepass.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/utils.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Modules/xml.$(OBJEXT): Modules/$(am__dirstamp) \
+ Modules/$(DEPDIR)/$(am__dirstamp)
+Preprocessor/$(am__dirstamp):
+ @$(MKDIR_P) Preprocessor
+ @: > Preprocessor/$(am__dirstamp)
+Preprocessor/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) Preprocessor/$(DEPDIR)
+ @: > Preprocessor/$(DEPDIR)/$(am__dirstamp)
+Preprocessor/cpp.$(OBJEXT): Preprocessor/$(am__dirstamp) \
+ Preprocessor/$(DEPDIR)/$(am__dirstamp)
+Preprocessor/expr.$(OBJEXT): Preprocessor/$(am__dirstamp) \
+ Preprocessor/$(DEPDIR)/$(am__dirstamp)
+Swig/$(am__dirstamp):
+ @$(MKDIR_P) Swig
+ @: > Swig/$(am__dirstamp)
+Swig/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) Swig/$(DEPDIR)
+ @: > Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/cwrap.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/deprecate.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/error.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/extend.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/fragment.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/getopt.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/include.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/misc.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/naming.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/parms.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/scanner.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/stype.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/symbol.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/tree.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/typemap.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/typeobj.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/typesys.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+Swig/wrapfunc.$(OBJEXT): Swig/$(am__dirstamp) \
+ Swig/$(DEPDIR)/$(am__dirstamp)
+
+eswig$(EXEEXT): $(eswig_OBJECTS) $(eswig_DEPENDENCIES) $(EXTRA_eswig_DEPENDENCIES)
+ @rm -f eswig$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(eswig_OBJECTS) $(eswig_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+ -rm -f CParse/*.$(OBJEXT)
+ -rm -f DOH/*.$(OBJEXT)
+ -rm -f Doxygen/*.$(OBJEXT)
+ -rm -f Modules/*.$(OBJEXT)
+ -rm -f Preprocessor/*.$(OBJEXT)
+ -rm -f Swig/*.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@CParse/$(DEPDIR)/cscanner.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@CParse/$(DEPDIR)/parser.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@CParse/$(DEPDIR)/templ.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@CParse/$(DEPDIR)/util.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@DOH/$(DEPDIR)/base.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@DOH/$(DEPDIR)/file.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@DOH/$(DEPDIR)/fio.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@DOH/$(DEPDIR)/hash.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@DOH/$(DEPDIR)/list.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@DOH/$(DEPDIR)/memory.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@DOH/$(DEPDIR)/string.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@DOH/$(DEPDIR)/void.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Doxygen/$(DEPDIR)/doxyentity.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Doxygen/$(DEPDIR)/doxyparser.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Doxygen/$(DEPDIR)/doxytranslator.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Doxygen/$(DEPDIR)/javadoc.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Doxygen/$(DEPDIR)/pydoc.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/allocate.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/browser.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/contract.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/csharp.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/d.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/directors.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/emit.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/go.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/guile.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/interface.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/java.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/javascript.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/lang.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/lua.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/main.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/mzscheme.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/nested.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/ocaml.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/octave.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/overload.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/perl5.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/php.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/python.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/r.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/ruby.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/scilab.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/swigmain.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/tcl8.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/typepass.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/utils.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Modules/$(DEPDIR)/xml.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Preprocessor/$(DEPDIR)/cpp.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Preprocessor/$(DEPDIR)/expr.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/cwrap.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/deprecate.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/error.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/extend.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/fragment.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/getopt.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/include.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/misc.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/naming.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/parms.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/scanner.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/stype.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/symbol.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/tree.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/typemap.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/typeobj.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/typesys.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@Swig/$(DEPDIR)/wrapfunc.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cxx.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cxx.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.y.c:
+ $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) all-local
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f CParse/$(DEPDIR)/$(am__dirstamp)
+ -rm -f CParse/$(am__dirstamp)
+ -rm -f DOH/$(DEPDIR)/$(am__dirstamp)
+ -rm -f DOH/$(am__dirstamp)
+ -rm -f Doxygen/$(DEPDIR)/$(am__dirstamp)
+ -rm -f Doxygen/$(am__dirstamp)
+ -rm -f Modules/$(DEPDIR)/$(am__dirstamp)
+ -rm -f Modules/$(am__dirstamp)
+ -rm -f Preprocessor/$(DEPDIR)/$(am__dirstamp)
+ -rm -f Preprocessor/$(am__dirstamp)
+ -rm -f Swig/$(DEPDIR)/$(am__dirstamp)
+ -rm -f Swig/$(am__dirstamp)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -rm -f CParse/parser.c
+ -rm -f CParse/parser.h
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-local mostlyclean-am
+
+distclean: distclean-am
+ -rm -f CParse/$(DEPDIR)/cscanner.Po
+ -rm -f CParse/$(DEPDIR)/parser.Po
+ -rm -f CParse/$(DEPDIR)/templ.Po
+ -rm -f CParse/$(DEPDIR)/util.Po
+ -rm -f DOH/$(DEPDIR)/base.Po
+ -rm -f DOH/$(DEPDIR)/file.Po
+ -rm -f DOH/$(DEPDIR)/fio.Po
+ -rm -f DOH/$(DEPDIR)/hash.Po
+ -rm -f DOH/$(DEPDIR)/list.Po
+ -rm -f DOH/$(DEPDIR)/memory.Po
+ -rm -f DOH/$(DEPDIR)/string.Po
+ -rm -f DOH/$(DEPDIR)/void.Po
+ -rm -f Doxygen/$(DEPDIR)/doxyentity.Po
+ -rm -f Doxygen/$(DEPDIR)/doxyparser.Po
+ -rm -f Doxygen/$(DEPDIR)/doxytranslator.Po
+ -rm -f Doxygen/$(DEPDIR)/javadoc.Po
+ -rm -f Doxygen/$(DEPDIR)/pydoc.Po
+ -rm -f Modules/$(DEPDIR)/allocate.Po
+ -rm -f Modules/$(DEPDIR)/browser.Po
+ -rm -f Modules/$(DEPDIR)/contract.Po
+ -rm -f Modules/$(DEPDIR)/csharp.Po
+ -rm -f Modules/$(DEPDIR)/d.Po
+ -rm -f Modules/$(DEPDIR)/directors.Po
+ -rm -f Modules/$(DEPDIR)/emit.Po
+ -rm -f Modules/$(DEPDIR)/go.Po
+ -rm -f Modules/$(DEPDIR)/guile.Po
+ -rm -f Modules/$(DEPDIR)/interface.Po
+ -rm -f Modules/$(DEPDIR)/java.Po
+ -rm -f Modules/$(DEPDIR)/javascript.Po
+ -rm -f Modules/$(DEPDIR)/lang.Po
+ -rm -f Modules/$(DEPDIR)/lua.Po
+ -rm -f Modules/$(DEPDIR)/main.Po
+ -rm -f Modules/$(DEPDIR)/mzscheme.Po
+ -rm -f Modules/$(DEPDIR)/nested.Po
+ -rm -f Modules/$(DEPDIR)/ocaml.Po
+ -rm -f Modules/$(DEPDIR)/octave.Po
+ -rm -f Modules/$(DEPDIR)/overload.Po
+ -rm -f Modules/$(DEPDIR)/perl5.Po
+ -rm -f Modules/$(DEPDIR)/php.Po
+ -rm -f Modules/$(DEPDIR)/python.Po
+ -rm -f Modules/$(DEPDIR)/r.Po
+ -rm -f Modules/$(DEPDIR)/ruby.Po
+ -rm -f Modules/$(DEPDIR)/scilab.Po
+ -rm -f Modules/$(DEPDIR)/swigmain.Po
+ -rm -f Modules/$(DEPDIR)/tcl8.Po
+ -rm -f Modules/$(DEPDIR)/typepass.Po
+ -rm -f Modules/$(DEPDIR)/utils.Po
+ -rm -f Modules/$(DEPDIR)/xml.Po
+ -rm -f Preprocessor/$(DEPDIR)/cpp.Po
+ -rm -f Preprocessor/$(DEPDIR)/expr.Po
+ -rm -f Swig/$(DEPDIR)/cwrap.Po
+ -rm -f Swig/$(DEPDIR)/deprecate.Po
+ -rm -f Swig/$(DEPDIR)/error.Po
+ -rm -f Swig/$(DEPDIR)/extend.Po
+ -rm -f Swig/$(DEPDIR)/fragment.Po
+ -rm -f Swig/$(DEPDIR)/getopt.Po
+ -rm -f Swig/$(DEPDIR)/include.Po
+ -rm -f Swig/$(DEPDIR)/misc.Po
+ -rm -f Swig/$(DEPDIR)/naming.Po
+ -rm -f Swig/$(DEPDIR)/parms.Po
+ -rm -f Swig/$(DEPDIR)/scanner.Po
+ -rm -f Swig/$(DEPDIR)/stype.Po
+ -rm -f Swig/$(DEPDIR)/symbol.Po
+ -rm -f Swig/$(DEPDIR)/tree.Po
+ -rm -f Swig/$(DEPDIR)/typemap.Po
+ -rm -f Swig/$(DEPDIR)/typeobj.Po
+ -rm -f Swig/$(DEPDIR)/typesys.Po
+ -rm -f Swig/$(DEPDIR)/wrapfunc.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-local distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f CParse/$(DEPDIR)/cscanner.Po
+ -rm -f CParse/$(DEPDIR)/parser.Po
+ -rm -f CParse/$(DEPDIR)/templ.Po
+ -rm -f CParse/$(DEPDIR)/util.Po
+ -rm -f DOH/$(DEPDIR)/base.Po
+ -rm -f DOH/$(DEPDIR)/file.Po
+ -rm -f DOH/$(DEPDIR)/fio.Po
+ -rm -f DOH/$(DEPDIR)/hash.Po
+ -rm -f DOH/$(DEPDIR)/list.Po
+ -rm -f DOH/$(DEPDIR)/memory.Po
+ -rm -f DOH/$(DEPDIR)/string.Po
+ -rm -f DOH/$(DEPDIR)/void.Po
+ -rm -f Doxygen/$(DEPDIR)/doxyentity.Po
+ -rm -f Doxygen/$(DEPDIR)/doxyparser.Po
+ -rm -f Doxygen/$(DEPDIR)/doxytranslator.Po
+ -rm -f Doxygen/$(DEPDIR)/javadoc.Po
+ -rm -f Doxygen/$(DEPDIR)/pydoc.Po
+ -rm -f Modules/$(DEPDIR)/allocate.Po
+ -rm -f Modules/$(DEPDIR)/browser.Po
+ -rm -f Modules/$(DEPDIR)/contract.Po
+ -rm -f Modules/$(DEPDIR)/csharp.Po
+ -rm -f Modules/$(DEPDIR)/d.Po
+ -rm -f Modules/$(DEPDIR)/directors.Po
+ -rm -f Modules/$(DEPDIR)/emit.Po
+ -rm -f Modules/$(DEPDIR)/go.Po
+ -rm -f Modules/$(DEPDIR)/guile.Po
+ -rm -f Modules/$(DEPDIR)/interface.Po
+ -rm -f Modules/$(DEPDIR)/java.Po
+ -rm -f Modules/$(DEPDIR)/javascript.Po
+ -rm -f Modules/$(DEPDIR)/lang.Po
+ -rm -f Modules/$(DEPDIR)/lua.Po
+ -rm -f Modules/$(DEPDIR)/main.Po
+ -rm -f Modules/$(DEPDIR)/mzscheme.Po
+ -rm -f Modules/$(DEPDIR)/nested.Po
+ -rm -f Modules/$(DEPDIR)/ocaml.Po
+ -rm -f Modules/$(DEPDIR)/octave.Po
+ -rm -f Modules/$(DEPDIR)/overload.Po
+ -rm -f Modules/$(DEPDIR)/perl5.Po
+ -rm -f Modules/$(DEPDIR)/php.Po
+ -rm -f Modules/$(DEPDIR)/python.Po
+ -rm -f Modules/$(DEPDIR)/r.Po
+ -rm -f Modules/$(DEPDIR)/ruby.Po
+ -rm -f Modules/$(DEPDIR)/scilab.Po
+ -rm -f Modules/$(DEPDIR)/swigmain.Po
+ -rm -f Modules/$(DEPDIR)/tcl8.Po
+ -rm -f Modules/$(DEPDIR)/typepass.Po
+ -rm -f Modules/$(DEPDIR)/utils.Po
+ -rm -f Modules/$(DEPDIR)/xml.Po
+ -rm -f Preprocessor/$(DEPDIR)/cpp.Po
+ -rm -f Preprocessor/$(DEPDIR)/expr.Po
+ -rm -f Swig/$(DEPDIR)/cwrap.Po
+ -rm -f Swig/$(DEPDIR)/deprecate.Po
+ -rm -f Swig/$(DEPDIR)/error.Po
+ -rm -f Swig/$(DEPDIR)/extend.Po
+ -rm -f Swig/$(DEPDIR)/fragment.Po
+ -rm -f Swig/$(DEPDIR)/getopt.Po
+ -rm -f Swig/$(DEPDIR)/include.Po
+ -rm -f Swig/$(DEPDIR)/misc.Po
+ -rm -f Swig/$(DEPDIR)/naming.Po
+ -rm -f Swig/$(DEPDIR)/parms.Po
+ -rm -f Swig/$(DEPDIR)/scanner.Po
+ -rm -f Swig/$(DEPDIR)/stype.Po
+ -rm -f Swig/$(DEPDIR)/symbol.Po
+ -rm -f Swig/$(DEPDIR)/tree.Po
+ -rm -f Swig/$(DEPDIR)/typemap.Po
+ -rm -f Swig/$(DEPDIR)/typeobj.Po
+ -rm -f Swig/$(DEPDIR)/typesys.Po
+ -rm -f Swig/$(DEPDIR)/wrapfunc.Po
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am all-local am--depfiles check \
+ check-am clean clean-binPROGRAMS clean-generic clean-local \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-local distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
+
+.PRECIOUS: Makefile
+
+
+# The executable is copied to the root directory for installation and running the test-suite.
+# This occurs on each invocation of make and is a step towards providing support for multiple
+# build directories.
+all-local: eswig@EXEEXT@
+ cp -f $(top_builddir)/Source/eswig@EXEEXT@ $(top_builddir)/swig@EXEEXT@
+
+clean-local:
+ rm -f $(top_builddir)/swig@EXEEXT@
+ rm -f core @EXTRA_CLEAN@
+
+distclean-local:
+ rm -f $(top_builddir)/Source/Include/swigconfig.h
+ rm -f $(top_builddir)/Source/Include/stamp-h1
+
+beautify:
+ rm -rf $(INDENTBAKSDIR)
+ mkdir $(INDENTBAKSDIR)
+ mkdir $(INDENTBAKSDIR)/CParse
+ mkdir $(INDENTBAKSDIR)/DOH
+ mkdir $(INDENTBAKSDIR)/Modules
+ mkdir $(INDENTBAKSDIR)/Preprocessor
+ mkdir $(INDENTBAKSDIR)/Swig
+ mkdir $(INDENTBAKSDIR)/Include
+ (csources=`find . -name "*.c"` && \
+ hsources=`find . -name "*.h"` && \
+ cxxsources=`find . -name "*.cxx"` && \
+ for file in $$csources $$hsources $$cxxsources; do \
+ $(MAKE) beautify-file INDENTFILE=$$file; \
+ done; )
+
+beautify-file:
+ test -e $(INDENTBAKSDIR) || (echo $(INDENTBAKSDIR) directory does not exist && exit 1;)
+ test -n "$(INDENTFILE)" || (echo INDENTFILE not defined && exit 1;)
+ test -e $(INDENTFILE) || (echo File does not exist: $(INDENTFILE) && exit 1;)
+ cp $(INDENTFILE) $(INDENTBAKSDIR)/$(INDENTFILE);
+ indent -kr --honour-newlines --line-length160 --indent-level2 --braces-on-func-def-line --leave-optional-blank-lines $(SWIGTYPEDEFS) $(INDENTFILE) -o $(INDENTFILE).tmp;
+ cat $(INDENTFILE).tmp | sed -e 's/const const /const /' > $(INDENTFILE);
+ rm $(INDENTFILE).tmp;
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Source/Modules/allegrocl.cxx b/Source/Modules/allegrocl.cxx
index 77f1319c7..97af186fe 100644
--- a/Source/Modules/allegrocl.cxx
+++ b/Source/Modules/allegrocl.cxx
@@ -471,7 +471,7 @@ void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0,
// a synonym type was found (held in variable 'match')
// Printf(stderr, "setting primary synonym of %p to %p\n", new_node, match);
if (new_node == match)
- Printf(stderr, "Hey-4 * - '%s' is a synonym of iteself!\n", Getattr(new_node, "name"));
+ Printf(stderr, "Hey-4 * - '%s' is a synonym of itself!\n", Getattr(new_node, "name"));
Setattr(new_node, "allegrocl:synonym-of", match);
// Printf(stderr,"*** 4\n");
add_linked_type(new_node);
@@ -1685,285 +1685,6 @@ int ALLEGROCL::top(Node *n) {
return SWIG_OK;
}
-/* very shamelessly 'borrowed' from overload.cxx, which
- keeps the below Swig_overload_rank() code to itself.
- We don't need a dispatch function in the C++ wrapper
- code; we want it over on the lisp side. */
-
-#define Swig_overload_rank Allegrocl_swig_overload_rank
-
-#define MAX_OVERLOAD 256
-
-/* Overload "argc" and "argv" */
-// String *argv_template_string;
-// String *argc_template_string;
-
-struct Overloaded {
- Node *n; /* Node */
- int argc; /* Argument count */
- ParmList *parms; /* Parameters used for overload check */
- int error; /* Ambiguity error */
-};
-
-/* -----------------------------------------------------------------------------
- * Swig_overload_rank()
- *
- * This function takes an overloaded declaration and creates a list that ranks
- * all overloaded methods in an order that can be used to generate a dispatch
- * function.
- * Slight difference in the way this function is used by scripting languages and
- * statically typed languages. The script languages call this method via
- * Swig_overload_dispatch() - where wrappers for all overloaded methods are generated,
- * however sometimes the code can never be executed. The non-scripting languages
- * call this method via Swig_overload_check() for each overloaded method in order
- * to determine whether or not the method should be wrapped. Note the slight
- * difference when overloading methods that differ by const only. The
- * scripting languages will ignore the const method, whereas the non-scripting
- * languages ignore the first method parsed.
- * ----------------------------------------------------------------------------- */
-
-static List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
- Overloaded nodes[MAX_OVERLOAD];
- int nnodes = 0;
- Node *o = Getattr(n, "sym:overloaded");
- Node *c;
-
- if (!o)
- return 0;
-
- c = o;
- while (c) {
- if (Getattr(c, "error")) {
- c = Getattr(c, "sym:nextSibling");
- continue;
- }
- /* if (SmartPointer && Getattr(c,"cplus:staticbase")) {
- c = Getattr(c,"sym:nextSibling");
- continue;
- } */
-
- /* Make a list of all the declarations (methods) that are overloaded with
- * this one particular method name */
- if (Getattr(c, "wrap:name")) {
- nodes[nnodes].n = c;
- nodes[nnodes].parms = Getattr(c, "wrap:parms");
- nodes[nnodes].argc = emit_num_required(nodes[nnodes].parms);
- nodes[nnodes].error = 0;
- nnodes++;
- }
- c = Getattr(c, "sym:nextSibling");
- }
-
- /* Sort the declarations by required argument count */
- {
- int i, j;
- for (i = 0; i < nnodes; i++) {
- for (j = i + 1; j < nnodes; j++) {
- if (nodes[i].argc > nodes[j].argc) {
- Overloaded t = nodes[i];
- nodes[i] = nodes[j];
- nodes[j] = t;
- }
- }
- }
- }
-
- /* Sort the declarations by argument types */
- {
- int i, j;
- for (i = 0; i < nnodes - 1; i++) {
- if (nodes[i].argc == nodes[i + 1].argc) {
- for (j = i + 1; (j < nnodes) && (nodes[j].argc == nodes[i].argc); j++) {
- Parm *p1 = nodes[i].parms;
- Parm *p2 = nodes[j].parms;
- int differ = 0;
- int num_checked = 0;
- while (p1 && p2 && (num_checked < nodes[i].argc)) {
- // Printf(stdout,"p1 = '%s', p2 = '%s'\n", Getattr(p1,"type"), Getattr(p2,"type"));
- if (checkAttribute(p1, "tmap:in:numinputs", "0")) {
- p1 = Getattr(p1, "tmap:in:next");
- continue;
- }
- if (checkAttribute(p2, "tmap:in:numinputs", "0")) {
- p2 = Getattr(p2, "tmap:in:next");
- continue;
- }
- String *t1 = Getattr(p1, "tmap:typecheck:precedence");
- String *t2 = Getattr(p2, "tmap:typecheck:precedence");
- if ((!t1) && (!nodes[i].error)) {
- Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n),
- "Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
- Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0));
- nodes[i].error = 1;
- } else if ((!t2) && (!nodes[j].error)) {
- Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n),
- "Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
- Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0));
- nodes[j].error = 1;
- }
- if (t1 && t2) {
- int t1v, t2v;
- t1v = atoi(Char(t1));
- t2v = atoi(Char(t2));
- differ = t1v - t2v;
- } else if (!t1 && t2)
- differ = 1;
- else if (t1 && !t2)
- differ = -1;
- else if (!t1 && !t2)
- differ = -1;
- num_checked++;
- if (differ > 0) {
- Overloaded t = nodes[i];
- nodes[i] = nodes[j];
- nodes[j] = t;
- break;
- } else if ((differ == 0) && (Strcmp(t1, "0") == 0)) {
- t1 = Getattr(p1, "ltype");
- if (!t1) {
- t1 = SwigType_ltype(Getattr(p1, "type"));
- if (Getattr(p1, "tmap:typecheck:SWIGTYPE")) {
- SwigType_add_pointer(t1);
- }
- Setattr(p1, "ltype", t1);
- }
- t2 = Getattr(p2, "ltype");
- if (!t2) {
- t2 = SwigType_ltype(Getattr(p2, "type"));
- if (Getattr(p2, "tmap:typecheck:SWIGTYPE")) {
- SwigType_add_pointer(t2);
- }
- Setattr(p2, "ltype", t2);
- }
-
- /* Need subtype check here. If t2 is a subtype of t1, then we need to change the
- order */
-
- if (SwigType_issubtype(t2, t1)) {
- Overloaded t = nodes[i];
- nodes[i] = nodes[j];
- nodes[j] = t;
- }
-
- if (Strcmp(t1, t2) != 0) {
- differ = 1;
- break;
- }
- } else if (differ) {
- break;
- }
- if (Getattr(p1, "tmap:in:next")) {
- p1 = Getattr(p1, "tmap:in:next");
- } else {
- p1 = nextSibling(p1);
- }
- if (Getattr(p2, "tmap:in:next")) {
- p2 = Getattr(p2, "tmap:in:next");
- } else {
- p2 = nextSibling(p2);
- }
- }
- if (!differ) {
- /* See if declarations differ by const only */
- String *d1 = Getattr(nodes[i].n, "decl");
- String *d2 = Getattr(nodes[j].n, "decl");
- if (d1 && d2) {
- String *dq1 = Copy(d1);
- String *dq2 = Copy(d2);
- if (SwigType_isconst(d1)) {
- Delete(SwigType_pop(dq1));
- }
- if (SwigType_isconst(d2)) {
- Delete(SwigType_pop(dq2));
- }
- if (Strcmp(dq1, dq2) == 0) {
-
- if (SwigType_isconst(d1) && !SwigType_isconst(d2)) {
- if (script_lang_wrapping) {
- // Swap nodes so that the const method gets ignored (shadowed by the non-const method)
- Overloaded t = nodes[i];
- nodes[i] = nodes[j];
- nodes[j] = t;
- }
- differ = 1;
- if (!nodes[j].error) {
- if (script_lang_wrapping) {
- Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[j].n), Getline(nodes[j].n),
- "Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
- Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[i].n), Getline(nodes[i].n),
- "using non-const method %s instead.\n", Swig_name_decl(nodes[i].n));
- } else {
- if (!Getattr(nodes[j].n, "overload:ignore")) {
- Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
- "Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
- Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
- "using %s instead.\n", Swig_name_decl(nodes[i].n));
- }
- }
- }
- nodes[j].error = 1;
- } else if (!SwigType_isconst(d1) && SwigType_isconst(d2)) {
- differ = 1;
- if (!nodes[j].error) {
- if (script_lang_wrapping) {
- Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[j].n), Getline(nodes[j].n),
- "Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
- Swig_warning(WARN_LANG_OVERLOAD_CONST, Getfile(nodes[i].n), Getline(nodes[i].n),
- "using non-const method %s instead.\n", Swig_name_decl(nodes[i].n));
- } else {
- if (!Getattr(nodes[j].n, "overload:ignore")) {
- Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
- "Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
- Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
- "using %s instead.\n", Swig_name_decl(nodes[i].n));
- }
- }
- }
- nodes[j].error = 1;
- }
- }
- Delete(dq1);
- Delete(dq2);
- }
- }
- if (!differ) {
- if (!nodes[j].error) {
- if (script_lang_wrapping) {
- Swig_warning(WARN_LANG_OVERLOAD_SHADOW, Getfile(nodes[j].n), Getline(nodes[j].n),
- "Overloaded method %s effectively ignored,\n", Swig_name_decl(nodes[j].n));
- Swig_warning(WARN_LANG_OVERLOAD_SHADOW, Getfile(nodes[i].n), Getline(nodes[i].n),
- "as it is shadowed by %s.\n", Swig_name_decl(nodes[i].n));
- } else {
- if (!Getattr(nodes[j].n, "overload:ignore")) {
- Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[j].n), Getline(nodes[j].n),
- "Overloaded method %s ignored,\n", Swig_name_decl(nodes[j].n));
- Swig_warning(WARN_LANG_OVERLOAD_IGNORED, Getfile(nodes[i].n), Getline(nodes[i].n),
- "using %s instead.\n", Swig_name_decl(nodes[i].n));
- }
- }
- nodes[j].error = 1;
- }
- }
- }
- }
- }
- }
- List *result = NewList();
- {
- int i;
- for (i = 0; i < nnodes; i++) {
- if (nodes[i].error)
- Setattr(nodes[i].n, "overload:ignore", "1");
- Append(result, nodes[i].n);
- // Printf(stdout,"[ %d ] %s\n", i, ParmList_errorstr(nodes[i].parms));
- // Swig_print_node(nodes[i].n);
- }
- }
- return result;
-}
-
-/* end shameless borrowing */
-
int any_varargs(ParmList *pl) {
Parm *p;
diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx
index 780246f91..23683c385 100644
--- a/Source/Modules/allocate.cxx
+++ b/Source/Modules/allocate.cxx
@@ -504,7 +504,7 @@ class Allocate:public Dispatcher {
in emit.cxx
- and is either constructued from the "feature:catches" feature
+ and is either constructed from the "feature:catches" feature
or copied from the node "throws" list.
*/
String *scatchlist = Getattr(n, "feature:catches");
diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx
index 68a42a29b..76b6455e2 100644
--- a/Source/Modules/chicken.cxx
+++ b/Source/Modules/chicken.cxx
@@ -547,7 +547,7 @@ int CHICKEN::functionWrapper(Node *n) {
}
emit_return_variable(n, d, f);
- /* Insert the argumetn output code */
+ /* Insert the argument output code */
Printv(f->code, argout, NIL);
/* Output cleanup code */
@@ -1456,7 +1456,7 @@ String *CHICKEN::chickenPrimitiveName(String *name) {
if (value)
return value;
else {
- Swig_error(input_file, line_number, "Internal Error: attempting to reference non-existant primitive name %s\n", name);
+ Swig_error(input_file, line_number, "Internal Error: attempting to reference non-existent primitive name %s\n", name);
return NewString("#f");
}
}
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index 423c5a451..17100b330 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -68,8 +68,8 @@ class CSHARP:public Language {
String *module_baseclass; //inheritance for module class from %pragma
String *imclass_interfaces; //interfaces for intermediary class class from %pragma
String *module_interfaces; //interfaces for module class from %pragma
- String *imclass_class_modifiers; //class modifiers for intermediary class overriden by %pragma
- String *module_class_modifiers; //class modifiers for module class overriden by %pragma
+ String *imclass_class_modifiers; //class modifiers for intermediary class overridden by %pragma
+ String *module_class_modifiers; //class modifiers for module class overridden by %pragma
String *upcasts_code; //C++ casts for inheritance hierarchies C++ code
String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code
String *director_callback_typedefs; // Director function pointer typedefs for callbacks
@@ -1384,7 +1384,7 @@ public:
// Wrap C/C++ enums with constant integers or use the typesafe enum pattern
SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum ");
Setattr(n, "type", typemap_lookup_type);
- const String *tm = typemapLookup(n, "cstype", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF);
+ const String *tm = typemapLookup(n, "cstype", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF);
String *return_type = Copy(tm);
substituteClassname(typemap_lookup_type, return_type);
@@ -1533,7 +1533,7 @@ public:
if (classname_substituted_flag) {
if (SwigType_isenum(t)) {
// This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on)
- Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname));
+ Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
} else {
// This handles function pointers using the %constant directive
Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
@@ -1732,7 +1732,7 @@ public:
Replaceall(cptr_method_name, ".", "_");
Replaceall(cptr_method_name, "$interfacename", interface_name);
- String *upcast_method_name = Swig_name_member(getNSpace(), proxy_class_name, cptr_method_name);
+ String *upcast_method_name = Swig_name_member(getNSpace(), getClassPrefix(), cptr_method_name);
upcastsCode(smart, upcast_method_name, c_classname, c_baseclass);
Delete(upcast_method_name);
@@ -1873,46 +1873,70 @@ public:
typemapLookup(n, "csbody", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSBODY_UNDEF), // main body of class
NIL);
- // C++ destructor is wrapped by the Dispose method
- // Note that the method name is specified in a typemap attribute called methodname
+ // C++ destructor is wrapped by the Finalize and Dispose methods
+
+ const char *tmap_method = derived ? "csdestruct_derived" : "csdestruct";
+ const String *tm = typemapExists(n, tmap_method, typemap_lookup_type);
+ if (tm) {
+ Swig_error(Getfile(tm), Getline(tm),
+ "A deprecated %s typemap was found for %s, please remove it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps.\n",
+ tmap_method, proxy_class_name);
+ }
+ tmap_method = "csfinalize";
+ tm = typemapExists(n, tmap_method, typemap_lookup_type);
+ if (tm) {
+ Swig_error(Getfile(tm), Getline(tm),
+ "A deprecated %s typemap was found for %s, please remove it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps.\n",
+ tmap_method, proxy_class_name);
+ }
+
+ tmap_method = derived ? "csdisposing_derived" : "csdisposing";
String *destruct = NewString("");
- const String *tm = NULL;
attributes = NewHash();
- String *destruct_methodname = NULL;
- String *destruct_methodmodifiers = NULL;
+ const String *destruct_methodname = NULL;
+ const String *destruct_methodmodifiers = NULL;
+ const String *destruct_parameters = NULL;
if (derived) {
- tm = typemapLookup(n, "csdestruct_derived", typemap_lookup_type, WARN_NONE, attributes);
- destruct_methodname = Getattr(attributes, "tmap:csdestruct_derived:methodname");
- destruct_methodmodifiers = Getattr(attributes, "tmap:csdestruct_derived:methodmodifiers");
+ tm = typemapLookup(n, "csdisposing_derived", typemap_lookup_type, WARN_NONE, attributes);
+ destruct_methodname = Getattr(attributes, "tmap:csdisposing_derived:methodname");
+ destruct_methodmodifiers = Getattr(attributes, "tmap:csdisposing_derived:methodmodifiers");
+ destruct_parameters = Getattr(attributes, "tmap:csdisposing_derived:parameters");
} else {
- tm = typemapLookup(n, "csdestruct", typemap_lookup_type, WARN_NONE, attributes);
- destruct_methodname = Getattr(attributes, "tmap:csdestruct:methodname");
- destruct_methodmodifiers = Getattr(attributes, "tmap:csdestruct:methodmodifiers");
+ tm = typemapLookup(n, "csdisposing", typemap_lookup_type, WARN_NONE, attributes);
+ destruct_methodname = Getattr(attributes, "tmap:csdisposing:methodname");
+ destruct_methodmodifiers = Getattr(attributes, "tmap:csdisposing:methodmodifiers");
+ destruct_parameters = Getattr(attributes, "tmap:csdisposing:parameters");
}
if (tm && *Char(tm)) {
if (!destruct_methodname) {
- Swig_error(Getfile(n), Getline(n), "No methodname attribute defined in csdestruct%s typemap for %s\n", (derived ? "_derived" : ""), proxy_class_name);
+ Swig_error(Getfile(n), Getline(n), "No methodname attribute defined in %s typemap for %s\n", tmap_method, proxy_class_name);
}
if (!destruct_methodmodifiers) {
Swig_error(Getfile(n), Getline(n),
- "No methodmodifiers attribute defined in csdestruct%s typemap for %s.\n", (derived ? "_derived" : ""), proxy_class_name);
+ "No methodmodifiers attribute defined in %s typemap for %s.\n", tmap_method, proxy_class_name);
}
+ if (!destruct_parameters)
+ destruct_parameters = empty_string;
}
// Emit the Finalize and Dispose methods
if (tm) {
- // Finalize method
- if (*Char(destructor_call)) {
- Printv(proxy_class_def, typemapLookup(n, "csfinalize", typemap_lookup_type, WARN_NONE), NIL);
- }
- // Dispose method
+ // Finalize and Dispose methods
+ Printv(proxy_class_def, typemapLookup(n, derived ? "csdispose_derived" : "csdispose", typemap_lookup_type, WARN_NONE), NIL);
+ // Dispose(bool disposing) method
Printv(destruct, tm, NIL);
if (*Char(destructor_call))
Replaceall(destruct, "$imcall", destructor_call);
else
Replaceall(destruct, "$imcall", "throw new global::System.MethodAccessException(\"C++ destructor does not have public access\")");
- if (*Char(destruct))
- Printv(proxy_class_def, "\n ", destruct_methodmodifiers, " ", derived ? "override" : "virtual", " void ", destruct_methodname, "() ", destruct, "\n",
- NIL);
+ if (*Char(destruct)) {
+ Printv(proxy_class_def, "\n ", NIL);
+ const String *methodmods = Getattr(n, "destructmethodmodifiers");
+ if (methodmods)
+ Printv(proxy_class_def, methodmods, NIL);
+ else
+ Printv(proxy_class_def, destruct_methodmodifiers, " ", derived ? "override" : "virtual", NIL);
+ Printv(proxy_class_def, " void ", destruct_methodname, "(", destruct_parameters, ") ", destruct, "\n", NIL);
+ }
}
if (*Char(interface_upcasts))
Printv(proxy_class_def, interface_upcasts, NIL);
@@ -1929,7 +1953,7 @@ public:
String *methid = Getattr(udata, "class_methodidx");
String *overname = Getattr(udata, "overname");
Printf(proxy_class_code, " if (SwigDerivedClassHasMethod(\"%s\", swigMethodTypes%s))\n", method, methid);
- Printf(proxy_class_code, " swigDelegate%s = new SwigDelegate%s_%s(SwigDirector%s);\n", methid, proxy_class_name, methid, overname);
+ Printf(proxy_class_code, " swigDelegate%s = new SwigDelegate%s_%s(SwigDirectorMethod%s);\n", methid, proxy_class_name, methid, overname);
}
String *director_connect_method_name = Swig_name_member(getNSpace(), getClassPrefix(), "director_connect");
Printf(proxy_class_code, " %s.%s(swigCPtr", imclass_name, director_connect_method_name);
@@ -2207,37 +2231,6 @@ public:
--nesting_depth;
}
- /* Output the downcast method, if necessary. Note: There's no other really
- good place to put this code, since Abstract Base Classes (ABCs) can and should have
- downcasts, making the constructorHandler() a bad place (because ABCs don't get to
- have constructors emitted.) */
- if (GetFlag(n, "feature:csdowncast")) {
- String *downcast_method = Swig_name_member(getNSpace(), proxy_class_name, "SWIGDowncast");
- String *wname = Swig_name_wrapper(downcast_method);
-
- String *norm_name = SwigType_namestr(Getattr(n, "name"));
-
- Printf(imclass_class_code, " public final static native %s %s(long cPtrBase, boolean cMemoryOwn);\n", proxy_class_name, downcast_method);
-
- Wrapper *dcast_wrap = NewWrapper();
-
- Printf(dcast_wrap->def, "SWIGEXPORT jobject SWIGSTDCALL %s(JNIEnv *jenv, jclass jcls, jlong jCPtrBase, jboolean cMemoryOwn) {", wname);
- Printf(dcast_wrap->code, " Swig::Director *director = (Swig::Director *) 0;\n");
- Printf(dcast_wrap->code, " jobject jresult = (jobject) 0;\n");
- Printf(dcast_wrap->code, " %s *obj = *((%s **)&jCPtrBase);\n", norm_name, norm_name);
- Printf(dcast_wrap->code, " if (obj) director = dynamic_cast<Swig::Director *>(obj);\n");
- Printf(dcast_wrap->code, " if (director) jresult = director->swig_get_self(jenv);\n");
- Printf(dcast_wrap->code, " return jresult;\n");
- Printf(dcast_wrap->code, "}\n");
-
- Wrapper_print(dcast_wrap, f_wrappers);
- DelWrapper(dcast_wrap);
-
- Delete(norm_name);
- Delete(wname);
- Delete(downcast_method);
- }
-
if (f_interface) {
Printv(f_interface, interface_class_code, "}\n", NIL);
addCloseNamespace(nspace, f_interface);
@@ -2813,7 +2806,8 @@ public:
/* Insert the csconstruct typemap, doing the replacement for $directorconnect, as needed */
Hash *attributes = NewHash();
- String *construct_tm = Copy(typemapLookup(n, "csconstruct", Getattr(n, "name"),
+ String *typemap_lookup_type = Getattr(getCurrentClass(), "classtypeobj");
+ String *construct_tm = Copy(typemapLookup(n, "csconstruct", typemap_lookup_type,
WARN_CSHARP_TYPEMAP_CSCONSTRUCT_UNDEF, attributes));
if (construct_tm) {
if (!feature_director) {
@@ -2891,7 +2885,11 @@ public:
if (proxy_flag) {
Printv(destructor_call, full_imclass_name, ".", Swig_name_destroy(getNSpace(), symname), "(swigCPtr)", NIL);
+ const String *methodmods = Getattr(n, "feature:cs:methodmodifiers");
+ if (methodmods)
+ Setattr(getCurrentClass(), "destructmethodmodifiers", methodmods);
}
+
return SWIG_OK;
}
@@ -3573,6 +3571,24 @@ public:
}
/* -----------------------------------------------------------------------------
+ * typemapExists()
+ * n - for input only and must contain info for Getfile(n) and Getline(n) to work
+ * tmap_method - typemap method name
+ * type - typemap type to lookup
+ * returns found typemap or NULL if not found
+ * ----------------------------------------------------------------------------- */
+
+ const String *typemapExists(Node *n, const_String_or_char_ptr tmap_method, SwigType *type) {
+ Node *node = NewHash();
+ Setattr(node, "type", type);
+ Setfile(node, Getfile(n));
+ Setline(node, Getline(n));
+ const String *tm = Swig_typemap_lookup(tmap_method, node, "", 0);
+ Delete(node);
+ return tm;
+ }
+
+ /* -----------------------------------------------------------------------------
* canThrow()
* Determine whether the code in the typemap can throw a C# exception.
* If so, note it for later when excodeSubstitute() is called.
@@ -3734,16 +3750,13 @@ public:
Printf(code_wrap->code, " %s *obj = (%s *)objarg;\n", smartptr, smartptr);
Printf(code_wrap->code, " // Keep a local instance of the smart pointer around while we are using the raw pointer\n");
Printf(code_wrap->code, " // Avoids using smart pointer specific API.\n");
- Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj->operator->());\n", dirClassName, dirClassName);
- }
- else {
+ Printf(code_wrap->code, " %s *director = static_cast<%s *>(obj->operator->());\n", dirClassName, dirClassName);
+ } else {
Printf(code_wrap->code, " %s *obj = (%s *)objarg;\n", norm_name, norm_name);
- Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj);\n", dirClassName, dirClassName);
+ Printf(code_wrap->code, " %s *director = static_cast<%s *>(obj);\n", dirClassName, dirClassName);
}
- // TODO: if statement not needed?? - Java too
- Printf(code_wrap->code, " if (director) {\n");
- Printf(code_wrap->code, " director->swig_connect_director(");
+ Printf(code_wrap->code, " director->swig_connect_director(");
for (int i = first_class_dmethod; i < curr_class_dmethod; ++i) {
UpcallData *udata = Getitem(dmethods_seq, i);
@@ -3760,7 +3773,6 @@ public:
Printf(code_wrap->def, ") {\n");
Printf(code_wrap->code, ");\n");
Printf(imclass_class_code, ");\n");
- Printf(code_wrap->code, " }\n");
Printf(code_wrap->code, "}\n");
Wrapper_print(code_wrap, f_wrappers);
@@ -3826,7 +3838,7 @@ public:
qualified_return = SwigType_rcaststr(returntype, "c_result");
- if (!is_void && !ignored_method) {
+ if (!is_void && (!ignored_method || pure_virtual)) {
if (!SwigType_isclass(returntype)) {
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
@@ -3846,15 +3858,17 @@ public:
/* If returning a reference, initialize the pointer to a sane
default - if a C# exception occurs, then the pointer returns
something other than a NULL-initialized reference. */
- String *non_ref_type = Copy(returntype);
-
- /* Remove reference and const qualifiers */
- Replaceall(non_ref_type, "r.", "");
- Replaceall(non_ref_type, "q(const).", "");
- Wrapper_add_localv(w, "result_default", "static", SwigType_str(non_ref_type, "result_default"), "=", SwigType_str(non_ref_type, "()"), NIL);
- Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= &result_default", NIL);
-
- Delete(non_ref_type);
+ SwigType *noref_type = SwigType_del_reference(Copy(returntype));
+ String *noref_ltype = SwigType_lstr(noref_type, 0);
+ String *return_ltype = SwigType_lstr(returntype, 0);
+
+ Wrapper_add_localv(w, "result_default", "static", noref_ltype, "result_default", NIL);
+ Wrapper_add_localv(w, "c_result", return_ltype, "c_result", NIL);
+ Printf(w->code, "result_default = SwigValueInit< %s >();\n", noref_ltype);
+ Printf(w->code, "c_result = &result_default;\n");
+ Delete(return_ltype);
+ Delete(noref_ltype);
+ Delete(noref_type);
}
Delete(base_typename);
@@ -3886,7 +3900,7 @@ public:
Printf(director_delegate_definitions, " %s\n", im_directoroutattributes);
}
- Printf(callback_def, " private %s SwigDirector%s(", tm, overloaded_name);
+ Printf(callback_def, " private %s SwigDirectorMethod%s(", tm, overloaded_name);
if (!ignored_method) {
const String *csdirectordelegatemodifiers = Getattr(n, "feature:csdirectordelegatemodifiers");
String *modifiers = (csdirectordelegatemodifiers ? NewStringf("%s%s", csdirectordelegatemodifiers, Len(csdirectordelegatemodifiers) > 0 ? " " : "") : NewStringf("public "));
@@ -3916,7 +3930,7 @@ public:
Swig_typemap_attach_parms("ctype", l, 0);
Swig_typemap_attach_parms("imtype", l, 0);
Swig_typemap_attach_parms("cstype", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("csdirectorin", l, 0);
Swig_typemap_attach_parms("directorargout", l, w);
@@ -3935,7 +3949,11 @@ public:
}
Delete(super_call);
} else {
- Printf(w->code, " throw Swig::DirectorPureVirtualException(\"%s::%s\");\n", SwigType_namestr(c_classname), SwigType_namestr(name));
+ Printf(w->code, "Swig::DirectorPureVirtualException::raise(\"%s::%s\");\n", SwigType_namestr(c_classname), SwigType_namestr(name));
+ if (!is_void)
+ Printf(w->code, "return %s;", qualified_return);
+ else if (!ignored_method)
+ Printf(w->code, "return;\n");
}
if (!ignored_method)
@@ -4093,15 +4111,19 @@ public:
/* header declaration, start wrapper definition */
String *target;
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
Printf(declaration, " virtual %s", target);
Delete(target);
// Add any exception specifications to the methods in the director class
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
ParmList *throw_parm_list = NULL;
if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
int gencomma = 0;
@@ -4310,7 +4332,7 @@ public:
/* constructor */
{
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, dirclassname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, dirclassname, parms, 0);
String *call = Swig_csuperclass_call(0, basetype, superparms);
Printf(f_directors, "%s::%s : %s, %s {\n", dirclassname, target, call, Getattr(parent, "director:ctor"));
@@ -4323,7 +4345,7 @@ public:
/* constructor header */
{
- String *target = Swig_method_decl(0, decl, dirclassname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, dirclassname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -4419,9 +4441,12 @@ public:
String *dirclassname = directorClassName(current_class);
Wrapper *w = NewWrapper();
- if (Getattr(n, "throw")) {
- Printf(f_directors_h, " virtual ~%s() throw ();\n", dirclassname);
- Printf(w->def, "%s::~%s() throw () {\n", dirclassname, dirclassname);
+ if (Getattr(n, "noexcept")) {
+ Printf(f_directors_h, " virtual ~%s() noexcept;\n", dirclassname);
+ Printf(w->def, "%s::~%s() noexcept {\n", dirclassname, dirclassname);
+ } else if (Getattr(n, "throw")) {
+ Printf(f_directors_h, " virtual ~%s() throw();\n", dirclassname);
+ Printf(w->def, "%s::~%s() throw() {\n", dirclassname, dirclassname);
} else {
Printf(f_directors_h, " virtual ~%s();\n", dirclassname);
Printf(w->def, "%s::~%s() {\n", dirclassname, dirclassname);
diff --git a/Source/Modules/d.cxx b/Source/Modules/d.cxx
index de7afdab1..5e82dfda3 100644
--- a/Source/Modules/d.cxx
+++ b/Source/Modules/d.cxx
@@ -989,7 +989,7 @@ public:
// Smart pointer classes do not mirror the inheritance hierarchy of the
// underlying types, so aliasing the base class methods in is not required
// for them.
- // DMD BUG: We have to emit the alias after the last function becasue
+ // DMD BUG: We have to emit the alias after the last function because
// taking a delegate in the overload checking code fails otherwise
// (http://d.puremagic.com/issues/show_bug.cgi?id=4860).
if (!Getattr(n, "sym:nextSibling") && !is_smart_pointer() &&
@@ -1227,8 +1227,9 @@ public:
// Insert the dconstructor typemap (replacing $directorconnect as needed).
Hash *attributes = NewHash();
+ String *typemap_lookup_type = Getattr(getCurrentClass(), "classtypeobj");
String *construct_tm = Copy(lookupCodeTypemap(n, "dconstructor",
- Getattr(n, "name"), WARN_D_TYPEMAP_DCONSTRUCTOR_UNDEF, attributes));
+ typemap_lookup_type, WARN_D_TYPEMAP_DCONSTRUCTOR_UNDEF, attributes));
if (construct_tm) {
const bool use_director = (parentNode(n) && Swig_directorclass(n));
if (!use_director) {
@@ -1298,7 +1299,12 @@ public:
virtual int destructorHandler(Node *n) {
Language::destructorHandler(n);
String *symname = Getattr(n, "sym:name");
+
Printv(destructor_call, im_dmodule_fq_name, ".", Swig_name_destroy(getNSpace(),symname), "(cast(void*)swigCPtr)", NIL);
+ const String *methodmods = Getattr(n, "feature:d:methodmodifiers");
+ if (methodmods)
+ Setattr(getCurrentClass(), "destructmethodmodifiers", methodmods);
+
return SWIG_OK;
}
@@ -1476,7 +1482,7 @@ public:
}
Delete(attributes);
- // Retrive the override value set via %dconstvalue, if any.
+ // Retrieve the override value set via %dconstvalue, if any.
String *override_value = Getattr(n, "feature:d:constvalue");
if (override_value) {
Printf(constants_code, "%s;\n", override_value);
@@ -1975,7 +1981,7 @@ public:
qualified_return = SwigType_rcaststr(returntype, "c_result");
- if (!is_void && !ignored_method) {
+ if (!is_void && (!ignored_method || pure_virtual)) {
if (!SwigType_isclass(returntype)) {
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
@@ -1995,15 +2001,17 @@ public:
/* If returning a reference, initialize the pointer to a sane
default - if a D exception occurs, then the pointer returns
something other than a NULL-initialized reference. */
- String *non_ref_type = Copy(returntype);
-
- /* Remove reference and const qualifiers */
- Replaceall(non_ref_type, "r.", "");
- Replaceall(non_ref_type, "q(const).", "");
- Wrapper_add_localv(w, "result_default", "static", SwigType_str(non_ref_type, "result_default"), "=", SwigType_str(non_ref_type, "()"), NIL);
- Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= &result_default", NIL);
-
- Delete(non_ref_type);
+ SwigType *noref_type = SwigType_del_reference(Copy(returntype));
+ String *noref_ltype = SwigType_lstr(noref_type, 0);
+ String *return_ltype = SwigType_lstr(returntype, 0);
+
+ Wrapper_add_localv(w, "result_default", "static", noref_ltype, "result_default", NIL);
+ Wrapper_add_localv(w, "c_result", return_ltype, "c_result", NIL);
+ Printf(w->code, "result_default = SwigValueInit< %s >();\n", noref_ltype);
+ Printf(w->code, "c_result = &result_default;\n");
+ Delete(return_ltype);
+ Delete(noref_ltype);
+ Delete(noref_type);
}
Delete(base_typename);
@@ -2058,7 +2066,7 @@ public:
Swig_typemap_attach_parms("ctype", l, 0);
Swig_typemap_attach_parms("imtype", l, 0);
Swig_typemap_attach_parms("dtype", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("ddirectorin", l, 0);
Swig_typemap_attach_parms("directorargout", l, w);
@@ -2077,7 +2085,11 @@ public:
}
Delete(super_call);
} else {
- Printf(w->code, " throw Swig::DirectorPureVirtualException(\"%s::%s\");\n", SwigType_namestr(c_classname), SwigType_namestr(name));
+ Printf(w->code, "Swig::DirectorPureVirtualException::raise(\"%s::%s\");\n", SwigType_namestr(c_classname), SwigType_namestr(name));
+ if (!is_void)
+ Printf(w->code, "return %s;", qualified_return);
+ else if (!ignored_method)
+ Printf(w->code, "return;\n");
}
if (!ignored_method)
@@ -2208,15 +2220,19 @@ public:
/* header declaration, start wrapper definition */
String *target;
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
Printf(declaration, " virtual %s", target);
Delete(target);
// Add any exception specifications to the methods in the director class
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
ParmList *throw_parm_list = NULL;
if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
int gencomma = 0;
@@ -2428,7 +2444,7 @@ public:
/* constructor */
{
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, dirclassname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, dirclassname, parms, 0);
String *call = Swig_csuperclass_call(0, basetype, superparms);
String *classtype = SwigType_namestr(Getattr(n, "name"));
@@ -2443,7 +2459,7 @@ public:
/* constructor header */
{
- String *target = Swig_method_decl(0, decl, dirclassname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, dirclassname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -2483,9 +2499,12 @@ public:
String *dirclassname = directorClassName(current_class);
Wrapper *w = NewWrapper();
- if (Getattr(n, "throw")) {
- Printf(f_directors_h, " virtual ~%s() throw ();\n", dirclassname);
- Printf(w->def, "%s::~%s() throw () {\n", dirclassname, dirclassname);
+ if (Getattr(n, "noexcept")) {
+ Printf(f_directors_h, " virtual ~%s() noexcept;\n", dirclassname);
+ Printf(w->def, "%s::~%s() noexcept {\n", dirclassname, dirclassname);
+ } else if (Getattr(n, "throw")) {
+ Printf(f_directors_h, " virtual ~%s() throw();\n", dirclassname);
+ Printf(w->def, "%s::~%s() throw() {\n", dirclassname, dirclassname);
} else {
Printf(f_directors_h, " virtual ~%s();\n", dirclassname);
Printf(w->def, "%s::~%s() {\n", dirclassname, dirclassname);
@@ -3255,17 +3274,20 @@ private:
// attribute called »methodname«.
const String *tm = NULL;
- String *dispose_methodname;
- String *dispose_methodmodifiers;
+ const String *dispose_methodname;
+ const String *dispose_methodmodifiers;
+ const String *dispose_parameters;
attributes = NewHash();
if (derived) {
tm = lookupCodeTypemap(n, "ddispose_derived", typemap_lookup_type, WARN_NONE, attributes);
dispose_methodname = Getattr(attributes, "tmap:ddispose_derived:methodname");
dispose_methodmodifiers = Getattr(attributes, "tmap:ddispose_derived:methodmodifiers");
+ dispose_parameters = Getattr(attributes, "tmap:ddispose_derived:parameters");
} else {
tm = lookupCodeTypemap(n, "ddispose", typemap_lookup_type, WARN_NONE, attributes);
dispose_methodname = Getattr(attributes, "tmap:ddispose:methodname");
dispose_methodmodifiers = Getattr(attributes, "tmap:ddispose:methodmodifiers");
+ dispose_parameters = Getattr(attributes, "tmap:ddispose:parameters");
}
if (tm && *Char(tm)) {
@@ -3279,6 +3301,8 @@ private:
"No methodmodifiers attribute defined in ddispose%s typemap for %s.\n",
(derived ? "_derived" : ""), proxy_class_name);
}
+ if (!dispose_parameters)
+ dispose_parameters = empty_string;
}
if (tm) {
@@ -3299,9 +3323,13 @@ private:
}
if (*Char(dispose_code)) {
- Printv(body, "\n", dispose_methodmodifiers,
- (derived ? " override" : ""), " void ", dispose_methodname, "() ",
- dispose_code, "\n", NIL);
+ Printv(body, "\n", NIL);
+ const String *methodmods = Getattr(n, "destructmethodmodifiers");
+ if (methodmods)
+ Printv(body, methodmods, NIL);
+ else
+ Printv(body, dispose_methodmodifiers, (derived ? " override" : ""), NIL);
+ Printv(body, " void ", dispose_methodname, "(", dispose_parameters, ") ", dispose_code, "\n", NIL);
}
}
@@ -3556,10 +3584,9 @@ private:
Printf(code_wrap->def, "SWIGEXPORT void D_%s(void *objarg, void *dobj", connect_name);
Printf(code_wrap->code, " %s *obj = (%s *)objarg;\n", norm_name, norm_name);
- Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj);\n", dirClassName, dirClassName);
+ Printf(code_wrap->code, " %s *director = static_cast<%s *>(obj);\n", dirClassName, dirClassName);
- Printf(code_wrap->code, " if (director) {\n");
- Printf(code_wrap->code, " director->swig_connect_director(dobj");
+ Printf(code_wrap->code, " director->swig_connect_director(dobj");
for (int i = first_class_dmethod; i < curr_class_dmethod; ++i) {
UpcallData *udata = Getitem(dmethods_seq, i);
@@ -3573,7 +3600,6 @@ private:
Printf(code_wrap->def, ") {\n");
Printf(code_wrap->code, ");\n");
Printf(im_dmodule_code, ") %s;\n", connect_name);
- Printf(code_wrap->code, " }\n");
Printf(code_wrap->code, "}\n");
Wrapper_print(code_wrap, f_wrappers);
@@ -4332,7 +4358,7 @@ private:
*
* Determines whether the class the passed function node belongs to overrides
* all the overlaods for the passed function node defined somewhere up the
- * inheritance hierachy.
+ * inheritance hierarchy.
* --------------------------------------------------------------------------- */
bool areAllOverloadsOverridden(Node *n) const {
List *base_list = Getattr(parentNode(n), "bases");
@@ -4357,7 +4383,7 @@ private:
}
// We try to find at least a single overload which exists in the base class
- // so we can progress up the inheritance hierachy even if there have been
+ // so we can progress up the inheritance hierarchy even if there have been
// new overloads introduced after the topmost class.
Node *base_function = NULL;
String *symname = Getattr(n, "sym:name");
@@ -4383,7 +4409,7 @@ private:
!(Swig_director_mode() && Swig_director_protected_mode() && Swig_all_protected_mode())) {
// If the base class function is »protected« and were are not in
// director mode, it is not emitted to the base class and thus we do
- // not count it. Otherwise, we would run into issues if the visiblity
+ // not count it. Otherwise, we would run into issues if the visibility
// of some functions was changed from protected to public in a child
// class with the using directive.
continue;
diff --git a/Source/Modules/directors.cxx b/Source/Modules/directors.cxx
index 2fdda5a12..a91d5fd9a 100644
--- a/Source/Modules/directors.cxx
+++ b/Source/Modules/directors.cxx
@@ -15,12 +15,12 @@
#include "swigmod.h"
-/* Swig_csuperclass_call()
+/* -----------------------------------------------------------------------------
+ * Swig_csuperclass_call()
*
* Generates a fully qualified method call, including the full parameter list.
* e.g. "base::method(i, j)"
- *
- */
+ * ----------------------------------------------------------------------------- */
String *Swig_csuperclass_call(String *base, String *method, ParmList *l) {
String *call = NewString("");
@@ -44,12 +44,12 @@ String *Swig_csuperclass_call(String *base, String *method, ParmList *l) {
return call;
}
-/* Swig_class_declaration()
+/* -----------------------------------------------------------------------------
+ * Swig_class_declaration()
*
* Generate the start of a class/struct declaration.
* e.g. "class myclass"
- *
- */
+ * ----------------------------------------------------------------------------- */
String *Swig_class_declaration(Node *n, String *name) {
if (!name) {
@@ -61,18 +61,22 @@ String *Swig_class_declaration(Node *n, String *name) {
return result;
}
+/* -----------------------------------------------------------------------------
+ * Swig_class_name()
+ * ----------------------------------------------------------------------------- */
+
String *Swig_class_name(Node *n) {
String *name;
name = Copy(Getattr(n, "sym:name"));
return name;
}
-/* Swig_director_declaration()
+/* -----------------------------------------------------------------------------
+ * Swig_director_declaration()
*
* Generate the full director class declaration, complete with base classes.
* e.g. "class SwigDirector_myclass : public myclass, public Swig::Director {"
- *
- */
+ * ----------------------------------------------------------------------------- */
String *Swig_director_declaration(Node *n) {
String *classname = Swig_class_name(n);
@@ -87,6 +91,10 @@ String *Swig_director_declaration(Node *n) {
}
+/* -----------------------------------------------------------------------------
+ * Swig_method_call()
+ * ----------------------------------------------------------------------------- */
+
String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms) {
String *func;
int i = 0;
@@ -115,153 +123,67 @@ String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms) {
return func;
}
-/* Swig_method_decl
- *
- * Misnamed and misappropriated! Taken from SWIG's type string manipulation utilities
- * and modified to generate full (or partial) type qualifiers for method declarations,
- * local variable declarations, and return value casting. More importantly, it merges
- * parameter type information with actual parameter names to produce a complete method
- * declaration that fully mirrors the original method declaration.
- *
- * There is almost certainly a saner way to do this.
- *
- * This function needs to be cleaned up and possibly split into several smaller
- * functions. For instance, attaching default names to parameters should be done in a
- * separate function.
+/* -----------------------------------------------------------------------------
+ * Swig_method_decl()
*
- */
-
-String *Swig_method_decl(SwigType *rettype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values) {
- String *result;
- List *elements;
- String *element = 0, *nextelement;
- int is_const = 0;
- int nelements, i;
- int is_func = 0;
- int arg_idx = 0;
+ * Return a stringified version of a C/C++ declaration.
+ * ----------------------------------------------------------------------------- */
- if (id) {
- result = NewString(Char(id));
- } else {
- result = NewString("");
- }
+String *Swig_method_decl(SwigType *return_base_type, SwigType *decl, const_String_or_char_ptr id, List *args, int default_args) {
+ String *result = NewString("");
+ bool conversion_operator = Strstr(id, "operator ") != 0 && !return_base_type;
- elements = SwigType_split(decl);
- nelements = Len(elements);
- if (nelements > 0) {
- element = Getitem(elements, 0);
- }
- for (i = 0; i < nelements; i++) {
- if (i < (nelements - 1)) {
- nextelement = Getitem(elements, i + 1);
- } else {
- nextelement = 0;
- }
- if (SwigType_isqualifier(element)) {
- int skip = 0;
- DOH *q = 0;
- if (!strip) {
- q = SwigType_parm(element);
- if (!Cmp(q, "const")) {
- is_const = 1;
- is_func = SwigType_isfunction(nextelement);
- if (is_func)
- skip = 1;
- skip = 1;
- }
- if (!skip) {
- Insert(result, 0, " ");
- Insert(result, 0, q);
- }
- Delete(q);
- }
- } else if (SwigType_isfunction(element)) {
- Parm *parm;
- String *p;
- Append(result, "(");
- parm = args;
- while (parm != 0) {
- String *type = Getattr(parm, "type");
- String *name = Getattr(parm, "name");
- if (!name && Cmp(type, "void")) {
- name = NewString("");
- Printf(name, "arg%d", arg_idx++);
- Setattr(parm, "name", name);
- }
- if (!name) {
- name = NewString("");
- }
- p = SwigType_str(type, name);
- Append(result, p);
- String *value = Getattr(parm, "value");
- if (values && (value != 0)) {
- Printf(result, " = %s", value);
- }
- parm = nextSibling(parm);
- if (parm != 0)
- Append(result, ", ");
- }
- Append(result, ")");
- } else if (rettype) { // This check is intended for conversion operators to a pointer/reference which needs the pointer/reference ignoring in the declaration
- if (SwigType_ispointer(element)) {
- Insert(result, 0, "*");
- if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
- Insert(result, 0, "(");
- Append(result, ")");
- }
- } else if (SwigType_ismemberpointer(element)) {
- String *q;
- q = SwigType_parm(element);
- Insert(result, 0, "::*");
- Insert(result, 0, q);
- if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
- Insert(result, 0, "(");
- Append(result, ")");
- }
- Delete(q);
- } else if (SwigType_isreference(element)) {
- Insert(result, 0, "&");
- } else if (SwigType_isarray(element)) {
- DOH *size;
- Append(result, "[");
- size = SwigType_parm(element);
- Append(result, size);
- Append(result, "]");
- Delete(size);
- } else {
- if (Strcmp(element, "v(...)") == 0) {
- Insert(result, 0, "...");
- } else {
- String *bs = SwigType_namestr(element);
- Insert(result, 0, " ");
- Insert(result, 0, bs);
- Delete(bs);
- }
- }
+ Parm *parm = args;
+ int arg_idx = 0;
+ while (parm) {
+ String *type = Getattr(parm, "type");
+ String *name = Getattr(parm, "name");
+ if (!name && Cmp(type, "void")) {
+ name = NewString("");
+ Printf(name, "arg%d", arg_idx++);
+ Setattr(parm, "name", name);
}
- element = nextelement;
+ parm = nextSibling(parm);
}
- Delete(elements);
+ String *rettype = Copy(decl);
+ String *quals = SwigType_pop_function_qualifiers(rettype);
+ String *qualifiers = 0;
+ if (quals)
+ qualifiers = SwigType_str(quals, 0);
- if (is_const) {
- if (is_func) {
- Append(result, " ");
- Append(result, "const");
- } else {
- Insert(result, 0, "const ");
- }
- }
+ String *popped_decl = SwigType_pop_function(rettype);
+ if (return_base_type)
+ Append(rettype, return_base_type);
- Chop(result);
-
- if (rettype) {
- Insert(result, 0, " ");
+ if (!conversion_operator) {
+ SwigType *rettype_stripped = SwigType_strip_qualifiers(rettype);
String *rtype = SwigType_str(rettype, 0);
- Insert(result, 0, rtype);
+ Append(result, rtype);
+ if (SwigType_issimple(rettype_stripped) && return_base_type)
+ Append(result, " ");
Delete(rtype);
+ Delete(rettype_stripped);
}
+ if (id)
+ Append(result, id);
+
+ String *args_string = default_args ? ParmList_str_defaultargs(args) : ParmList_str(args);
+ Printv(result, "(", args_string, ")", NIL);
+
+ if (qualifiers)
+ Printv(result, " ", qualifiers, NIL);
+
+ // Reformat result to how it has been historically
+ Replaceall(result, ",", ", ");
+ Replaceall(result, "=", " = ");
+
+ Delete(args_string);
+ Delete(popped_decl);
+ Delete(qualifiers);
+ Delete(quals);
+ Delete(rettype);
return result;
}
@@ -272,6 +194,7 @@ String *Swig_method_decl(SwigType *rettype, SwigType *decl, const_String_or_char
* to add an extra dynamic_cast to call the public C++ wrapper in the director class.
* Also for non-static protected members when the allprotected option is on.
* ----------------------------------------------------------------------------- */
+
void Swig_director_emit_dynamic_cast(Node *n, Wrapper *f) {
// TODO: why is the storage element removed in staticmemberfunctionHandler ??
if ((!is_public(n) && (is_member_director(n) || GetFlag(n, "explicitcall"))) ||
@@ -290,13 +213,13 @@ void Swig_director_emit_dynamic_cast(Node *n, Wrapper *f) {
}
}
-/* ------------------------------------------------------------
+/* -----------------------------------------------------------------------------
* Swig_director_parms_fixup()
*
* For each parameter in the C++ member function, copy the parameter name
* to its "lname"; this ensures that Swig_typemap_attach_parms() will do
* the right thing when it sees strings like "$1" in "directorin" typemaps.
- * ------------------------------------------------------------ */
+ * ----------------------------------------------------------------------------- */
void Swig_director_parms_fixup(ParmList *parms) {
Parm *p;
diff --git a/Source/Modules/emit.cxx b/Source/Modules/emit.cxx
index 7c2607fc8..7a4c2dcfb 100644
--- a/Source/Modules/emit.cxx
+++ b/Source/Modules/emit.cxx
@@ -12,6 +12,7 @@
* ----------------------------------------------------------------------------- */
#include "swigmod.h"
+#include "cparse.h"
/* -----------------------------------------------------------------------------
* emit_return_variable()
@@ -112,9 +113,8 @@ void emit_attach_parmmaps(ParmList *l, Wrapper *f) {
/* This is compatibility code to deal with the deprecated "ignore" typemap */
Parm *p = l;
Parm *np;
- String *tm;
while (p) {
- tm = Getattr(p, "tmap:in");
+ String *tm = Getattr(p, "tmap:in");
if (tm && checkAttribute(p, "tmap:in:numinputs", "0")) {
Replaceall(tm, "$target", Getattr(p, "lname"));
Printv(f->code, tm, "\n", NIL);
@@ -134,7 +134,6 @@ void emit_attach_parmmaps(ParmList *l, Wrapper *f) {
/* Perform a sanity check on "in" and "freearg" typemaps. These
must exactly match to avoid chaos. If a mismatch occurs, we
nuke the freearg typemap */
-
{
Parm *p = l;
Parm *npin, *npfreearg;
@@ -189,13 +188,45 @@ void emit_attach_parmmaps(ParmList *l, Wrapper *f) {
p = lp;
while (p) {
if (SwigType_isvarargs(Getattr(p, "type"))) {
+ // Mark the head of the ParmList that it has varargs
Setattr(l, "emit:varargs", lp);
+//Printf(stdout, "setting emit:varargs %s ... %s +++ %s\n", Getattr(l, "emit:varargs"), Getattr(l, "type"), Getattr(p, "type"));
break;
}
p = nextSibling(p);
}
}
}
+
+ /*
+ * An equivalent type can be used in the typecheck typemap for SWIG to detect the overloading of equivalent
+ * target language types. This is primarily for the smartptr feature, where a pointer and a smart pointer
+ * are seen as equivalent types in the target language.
+ */
+ {
+ Parm *p = l;
+ while (p) {
+ String *tm = Getattr(p, "tmap:typecheck");
+ if (tm) {
+ String *equivalent = Getattr(p, "tmap:typecheck:equivalent");
+ if (equivalent) {
+ String *precedence = Getattr(p, "tmap:typecheck:precedence");
+ if (precedence && Strcmp(precedence, "0") != 0)
+ Swig_error(Getfile(tm), Getline(tm), "The 'typecheck' typemap for %s contains an 'equivalent' attribute for a 'precedence' that is not set to SWIG_TYPECHECK_POINTER or 0.\n", SwigType_str(Getattr(p, "type"), 0));
+ SwigType *cpt = Swig_cparse_type(equivalent);
+ if (cpt) {
+ Setattr(p, "equivtype", cpt);
+ Delete(cpt);
+ } else {
+ Swig_error(Getfile(tm), Getline(tm), "Invalid type (%s) in 'equivalent' attribute in 'typecheck' typemap for type %s.\n", equivalent, SwigType_str(Getattr(p, "type"), 0));
+ }
+ }
+ p = Getattr(p, "tmap:typecheck:next");
+ } else {
+ p = nextSibling(p);
+ }
+ }
+ }
}
/* -----------------------------------------------------------------------------
@@ -300,7 +331,8 @@ int emit_num_required(ParmList *parms) {
/* -----------------------------------------------------------------------------
* emit_isvarargs()
*
- * Checks if a function is a varargs function
+ * Checks if a ParmList is a parameter list containing varargs.
+ * This function requires emit_attach_parmmaps to have been called beforehand.
* ----------------------------------------------------------------------------- */
int emit_isvarargs(ParmList *p) {
@@ -312,6 +344,28 @@ int emit_isvarargs(ParmList *p) {
}
/* -----------------------------------------------------------------------------
+ * emit_isvarargs_function()
+ *
+ * Checks for varargs in a function/constructor (can be overloaded)
+ * ----------------------------------------------------------------------------- */
+
+bool emit_isvarargs_function(Node *n) {
+ bool has_varargs = false;
+ Node *over = Getattr(n, "sym:overloaded");
+ if (over) {
+ for (Node *sibling = over; sibling; sibling = Getattr(sibling, "sym:nextSibling")) {
+ if (ParmList_has_varargs(Getattr(sibling, "parms"))) {
+ has_varargs = true;
+ break;
+ }
+ }
+ } else {
+ has_varargs = ParmList_has_varargs(Getattr(n, "parms")) ? true : false;
+ }
+ return has_varargs;
+}
+
+/* -----------------------------------------------------------------------------
* void emit_mark_vararg_parms()
*
* Marks the vararg parameters which are to be ignored.
@@ -454,29 +508,29 @@ String *emit_action(Node *n) {
if (catchlist) {
int unknown_catch = 0;
int has_varargs = 0;
- Printf(eaction, "}\n");
+ Printf(eaction, "}");
for (Parm *ep = catchlist; ep; ep = nextSibling(ep)) {
String *em = Swig_typemap_lookup("throws", ep, "_e", 0);
if (em) {
SwigType *et = Getattr(ep, "type");
SwigType *etr = SwigType_typedef_resolve_all(et);
if (SwigType_isreference(etr) || SwigType_ispointer(etr) || SwigType_isarray(etr)) {
- Printf(eaction, "catch(%s) {", SwigType_str(et, "_e"));
+ Printf(eaction, " catch(%s) {", SwigType_str(et, "_e"));
} else if (SwigType_isvarargs(etr)) {
- Printf(eaction, "catch(...) {");
+ Printf(eaction, " catch(...) {");
has_varargs = 1;
} else {
- Printf(eaction, "catch(%s) {", SwigType_str(et, "&_e"));
+ Printf(eaction, " catch(%s) {", SwigType_str(et, "&_e"));
}
Printv(eaction, em, "\n", NIL);
- Printf(eaction, "}\n");
+ Printf(eaction, "}");
} else {
Swig_warning(WARN_TYPEMAP_THROW, Getfile(n), Getline(n), "No 'throws' typemap defined for exception type '%s'\n", SwigType_str(Getattr(ep, "type"), 0));
unknown_catch = 1;
}
}
if (unknown_catch && !has_varargs) {
- Printf(eaction, "catch(...) { throw; }\n");
+ Printf(eaction, " catch(...) {\nthrow;\n}");
}
}
diff --git a/Source/Modules/go.cxx b/Source/Modules/go.cxx
index 884ae906d..0163f71df 100644
--- a/Source/Modules/go.cxx
+++ b/Source/Modules/go.cxx
@@ -125,6 +125,8 @@ class GO:public Language {
String *prefix_option;
// -fgo-pkgpath option.
String *pkgpath_option;
+ // Prefix for translating %import directive to import statements.
+ String *import_prefix;
// Whether to use a shared library.
bool use_shlib;
// Name of shared library to import.
@@ -199,11 +201,12 @@ class GO:public Language {
public:
GO():package(NULL),
module(NULL),
- cgo_flag(false),
+ cgo_flag(true),
gccgo_flag(false),
go_prefix(NULL),
prefix_option(NULL),
pkgpath_option(NULL),
+ import_prefix(NULL),
use_shlib(false),
soname(NULL),
intgo_type_size(0),
@@ -269,6 +272,9 @@ private:
} else if (strcmp(argv[i], "-cgo") == 0) {
Swig_mark_arg(i);
cgo_flag = true;
+ } else if (strcmp(argv[i], "-no-cgo") == 0) {
+ Swig_mark_arg(i);
+ cgo_flag = false;
} else if (strcmp(argv[i], "-gccgo") == 0) {
Swig_mark_arg(i);
gccgo_flag = true;
@@ -290,6 +296,15 @@ private:
} else {
Swig_arg_error();
}
+ } else if (strcmp(argv[i], "-import-prefix") == 0) {
+ if (argv[i + 1]) {
+ import_prefix = NewString(argv[i + 1]);
+ Swig_mark_arg(i);
+ Swig_mark_arg(i + 1);
+ i++;
+ } else {
+ Swig_arg_error();
+ }
} else if (strcmp(argv[i], "-use-shlib") == 0) {
Swig_mark_arg(i);
use_shlib = true;
@@ -615,6 +630,12 @@ private:
Language::top(n);
+ if (directorsEnabled()) {
+ // Insert director runtime into the f_runtime file (make it occur before %header section)
+ Swig_insert_file("director_common.swg", f_c_runtime);
+ Swig_insert_file("director.swg", f_c_runtime);
+ }
+
Delete(go_imports);
// Write out definitions for the types not defined by SWIG.
@@ -734,7 +755,11 @@ private:
if (modname) {
if (!Getattr(go_imports, modname)) {
Setattr(go_imports, modname, modname);
- Printv(f_go_imports, "import \"", modname, "\"\n", NULL);
+ Printv(f_go_imports, "import \"", NULL);
+ if (import_prefix) {
+ Printv(f_go_imports, import_prefix, "/", NULL);
+ }
+ Printv(f_go_imports, modname, "\"\n", NULL);
}
imported_package = modname;
saw_import = true;
@@ -990,7 +1015,7 @@ private:
* overname: The overload string for overloaded function.
* wname: The SWIG wrapped name--the name of the C function.
* base: A list of the names of base classes, in the case where this
- * is is a vritual method not defined in the current class.
+ * is a virtual method not defined in the current class.
* parms: The parameters.
* result: The result type.
* is_static: Whether this is a static method or member.
@@ -2806,17 +2831,25 @@ private:
return SWIG_NOWRAP;
}
- String *get = NewString("");
- Printv(get, Swig_cresult_name(), " = ", NULL);
-
String *rawval = Getattr(n, "rawval");
if (rawval && Len(rawval)) {
- if (SwigType_type(type) == T_STRING) {
- Printv(get, "(char *)", NULL);
+ // Based on Swig_VargetToFunction
+ String *nname = NewStringf("(%s)", rawval);
+ String *call;
+ if (SwigType_isclass(type)) {
+ call = NewStringf("%s", nname);
+ } else {
+ call = SwigType_lcaststr(type, nname);
}
-
- Printv(get, rawval, NULL);
+ String *cres = Swig_cresult(type, Swig_cresult_name(), call);
+ Setattr(n, "wrap:action", cres);
+ Delete(nname);
+ Delete(call);
+ Delete(cres);
} else {
+ String *get = NewString("");
+ Printv(get, Swig_cresult_name(), " = ", NULL);
+
char quote;
if (Getattr(n, "wrappedasconstant")) {
quote = '\0';
@@ -2838,11 +2871,12 @@ private:
if (quote != '\0') {
Printf(get, "%c", quote);
}
- }
- Printv(get, ";\n", NULL);
+ Printv(get, ";\n", NULL);
- Setattr(n, "wrap:action", get);
+ Setattr(n, "wrap:action", get);
+ Delete(get);
+ }
String *sname = Copy(symname);
if (class_name) {
@@ -3848,12 +3882,11 @@ private:
String *cxx_director_name = NewString("SwigDirector_");
Append(cxx_director_name, class_name);
- String *decl = Swig_method_decl(NULL, Getattr(n, "decl"),
- cxx_director_name, first_parm, 0, 0);
+ String *decl = Swig_method_decl(NULL, Getattr(n, "decl"), cxx_director_name, first_parm, 0);
Printv(f_c_directors_h, " ", decl, ";\n", NULL);
Delete(decl);
- decl = Swig_method_decl(NULL, Getattr(n, "decl"), cxx_director_name, first_parm, 0, 0);
+ decl = Swig_method_decl(NULL, Getattr(n, "decl"), cxx_director_name, first_parm, 0);
Printv(f_c_directors, cxx_director_name, "::", decl, "\n", NULL);
Delete(decl);
@@ -4578,7 +4611,7 @@ private:
Append(upcall_method_name, overname);
}
SwigType *rtype = Getattr(n, "classDirectorMethods:type");
- String *upcall_decl = Swig_method_decl(rtype, Getattr(n, "decl"), upcall_method_name, parms, 0, 0);
+ String *upcall_decl = Swig_method_decl(rtype, Getattr(n, "decl"), upcall_method_name, parms, 0);
Printv(f_c_directors_h, " ", upcall_decl, " {\n", NULL);
Delete(upcall_decl);
@@ -5026,13 +5059,13 @@ private:
// Declare the method for the director class.
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- String *decl = Swig_method_decl(rtype, Getattr(n, "decl"), Getattr(n, "name"), parms, 0, 0);
+ String *decl = Swig_method_decl(rtype, Getattr(n, "decl"), Getattr(n, "name"), parms, 0);
Printv(f_c_directors_h, " virtual ", decl, NULL);
Delete(decl);
String *qname = NewString("");
Printv(qname, "SwigDirector_", class_name, "::", Getattr(n, "name"), NULL);
- decl = Swig_method_decl(rtype, Getattr(n, "decl"), qname, parms, 0, 0);
+ decl = Swig_method_decl(rtype, Getattr(n, "decl"), qname, parms, 0);
Printv(w->def, decl, NULL);
Delete(decl);
Delete(qname);
@@ -5049,7 +5082,19 @@ private:
Printv(w->def, " {\n", NULL);
if (SwigType_type(result) != T_VOID) {
- Wrapper_add_local(w, "c_result", SwigType_lstr(result, "c_result"));
+ if (!SwigType_isclass(result)) {
+ if (!(SwigType_ispointer(result) || SwigType_isreference(result))) {
+ String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(result, 0));
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(result, "c_result"), construct_result, NIL);
+ Delete(construct_result);
+ } else {
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(result, "c_result"), "= 0", NIL);
+ }
+ } else {
+ String *cres = SwigType_lstr(result, "c_result");
+ Printf(w->code, "%s;\n", cres);
+ Delete(cres);
+ }
}
if (!is_ignored) {
@@ -5483,6 +5528,8 @@ private:
*--------------------------------------------------------------------*/
String *buildThrow(Node *n) {
+ if (Getattr(n, "noexcept"))
+ return NewString("noexcept");
ParmList *throw_parm_list = Getattr(n, "throws");
if (!throw_parm_list && !Getattr(n, "throw"))
return NULL;
@@ -5912,7 +5959,7 @@ private:
*
* Given a C/C++ name, return a name in Go which will be exported.
* If the first character is an upper case letter, this returns a
- * copy of its argment. If the first character is a lower case
+ * copy of its argument. If the first character is a lower case
* letter, this forces it to upper case. Otherwise, this prepends
* 'X'.
* ---------------------------------------------------------------------- */
@@ -6232,9 +6279,9 @@ private:
Setattr(undefined_enum_types, t, ret);
Delete(tt);
}
- } else if (SwigType_isfunctionpointer(type) || SwigType_isfunction(type)) {
+ } else if (SwigType_isfunctionpointer(t) || SwigType_isfunction(t)) {
ret = NewString("_swig_fnptr");
- } else if (SwigType_ismemberpointer(type)) {
+ } else if (SwigType_ismemberpointer(t)) {
ret = NewString("_swig_memberptr");
} else if (SwigType_issimple(t)) {
Node *cn = classLookup(t);
@@ -6951,9 +6998,11 @@ extern "C" Language *swig_go(void) {
const char * const GO::usage = "\
Go Options (available with -go)\n\
-cgo - Generate cgo input files\n\
- -gccgo - Generate code for gccgo rather than 6g/8g\n\
+ -no-cgo - Do not generate cgo input files\n\
+ -gccgo - Generate code for gccgo rather than gc\n\
-go-pkgpath <p> - Like gccgo -fgo-pkgpath option\n\
-go-prefix <p> - Like gccgo -fgo-prefix option\n\
+ -import-prefix <p> - Prefix to add to %import directives\n\
-intgosize <s> - Set size of Go int type--32 or 64 bits\n\
-package <name> - Set name of the Go package to <name>\n\
-use-shlib - Force use of a shared library\n\
diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx
index 7b42ff94f..461c69e50 100644
--- a/Source/Modules/guile.cxx
+++ b/Source/Modules/guile.cxx
@@ -255,7 +255,7 @@ public:
if (goops) {
if (linkage != GUILE_LSTYLE_PASSIVE && linkage != GUILE_LSTYLE_MODULE) {
Printf(stderr, "guile: GOOPS support requires passive or module linkage\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
diff --git a/Source/Modules/interface.cxx b/Source/Modules/interface.cxx
index f6d4c955b..fee6cd7da 100644
--- a/Source/Modules/interface.cxx
+++ b/Source/Modules/interface.cxx
@@ -151,12 +151,14 @@ void Swig_interface_propagate_methods(Node *n) {
for (Node *child = firstChild(n); child; child = nextSibling(child)) {
if (Getattr(child, "interface:owner"))
break; // at the end of the list are newly appended methods
- if (checkAttribute(child, "name", name)) {
- String *decl = SwigType_typedef_resolve_all(Getattr(child, "decl"));
- identically_overloaded_method = Strcmp(decl, this_decl_resolved) == 0;
- Delete(decl);
- if (identically_overloaded_method)
- break;
+ if (Cmp(nodeType(child), "cdecl") == 0) {
+ if (checkAttribute(child, "name", name)) {
+ String *decl = SwigType_typedef_resolve_all(Getattr(child, "decl"));
+ identically_overloaded_method = Strcmp(decl, this_decl_resolved) == 0;
+ Delete(decl);
+ if (identically_overloaded_method)
+ break;
+ }
}
}
}
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 946962447..fcc83819d 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -15,6 +15,7 @@
#include <limits.h> // for INT_MAX
#include "cparse.h"
#include <ctype.h>
+#include "javadoc.h"
/* Hash type used for upcalls from C/C++ */
typedef DOH UpcallData;
@@ -46,7 +47,9 @@ class JAVA:public Language {
bool global_variable_flag; // Flag for when wrapping a global variable
bool old_variable_names; // Flag for old style variable names in the intermediary class
bool member_func_flag; // flag set when wrapping a member function
-
+ bool doxygen; //flag for converting found doxygen to javadoc
+ bool comment_creation_chatter; //flag for getting information about where comments were created in java.cxx
+
String *imclass_name; // intermediary class name
String *module_class_name; // module class name
String *constants_interface_name; // constants interface name
@@ -72,8 +75,8 @@ class JAVA:public Language {
String *module_baseclass; //inheritance for module class from %pragma
String *imclass_interfaces; //interfaces for intermediary class class from %pragma
String *module_interfaces; //interfaces for module class from %pragma
- String *imclass_class_modifiers; //class modifiers for intermediary class overriden by %pragma
- String *module_class_modifiers; //class modifiers for module class overriden by %pragma
+ String *imclass_class_modifiers; //class modifiers for intermediary class overridden by %pragma
+ String *module_class_modifiers; //class modifiers for module class overridden by %pragma
String *upcasts_code; //C++ casts for inheritance hierarchies C++ code
String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code
String *imclass_directors; // Intermediate class director code
@@ -120,6 +123,8 @@ public:
global_variable_flag(false),
old_variable_names(false),
member_func_flag(false),
+ doxygen(false),
+ comment_creation_chatter(false),
imclass_name(NULL),
module_class_name(NULL),
constants_interface_name(NULL),
@@ -164,11 +169,15 @@ public:
director_multiple_inheritance = 0;
director_language = 1;
}
+
+ ~JAVA() {
+ delete doxygenTranslator;
+ }
/* -----------------------------------------------------------------------------
* constructIntermediateClassName()
*
- * Construct the fully qualified name of the intermidiate class and set
+ * Construct the fully qualified name of the intermediate class and set
* the full_imclass_name attribute accordingly.
* ----------------------------------------------------------------------------- */
void constructIntermediateClassName(Node *n) {
@@ -256,6 +265,8 @@ public:
SWIG_library_directory("java");
+ int doxygen_translator_flags = 0;
+
// Look for certain command line options
for (int i = 1; i < argc; i++) {
if (argv[i]) {
@@ -277,6 +288,16 @@ public:
Printf(stderr, "Deprecated command line option: %s. Proxy classes are now generated by default.\n", argv[i]);
Swig_mark_arg(i);
proxy_flag = true;
+ } else if ((strcmp(argv[i], "-doxygen") == 0)) {
+ Swig_mark_arg(i);
+ doxygen = true;
+ scan_doxygen_comments = true;
+ } else if ((strcmp(argv[i], "-debug-doxygen-translator") == 0)) {
+ Swig_mark_arg(i);
+ doxygen_translator_flags |= DoxygenTranslator::debug_translator;
+ } else if ((strcmp(argv[i], "-debug-doxygen-parser") == 0)) {
+ Swig_mark_arg(i);
+ doxygen_translator_flags |= DoxygenTranslator::debug_parser;
} else if ((strcmp(argv[i], "-noproxy") == 0)) {
Swig_mark_arg(i);
proxy_flag = false;
@@ -300,6 +321,9 @@ public:
}
}
}
+
+ if (doxygen)
+ doxygenTranslator = new JavaDocConverter(doxygen_translator_flags);
// Add a symbol to the parser for conditional compilation
Preprocessor_define("SWIGJAVA 1", 0);
@@ -567,6 +591,13 @@ public:
if (module_imports)
Printf(f_module, "%s\n", module_imports);
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, 0);
+ if (comment_creation_chatter)
+ Printf(f_module, "/* This was generated from top() */\n");
+ Printv(f_module, Char(doxygen_comments), NIL);
+ Delete(doxygen_comments);
+ }
if (Len(module_class_modifiers) > 0)
Printf(f_module, "%s ", module_class_modifiers);
Printf(f_module, "%s ", module_class_name);
@@ -1246,6 +1277,14 @@ public:
if ((enum_feature != SimpleEnum) && symname && typemap_lookup_type) {
// Wrap (non-anonymous) C/C++ enum within a typesafe, typeunsafe or proper Java enum
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, 0);
+ if (comment_creation_chatter)
+ Printf(enum_code, "/* This was generated from enumDeclaration() */\n");
+ Printv(enum_code, Char(doxygen_comments), NIL);
+ Delete(doxygen_comments);
+ }
+
String *scope = getCurrentScopeName(nspace);
if (!addSymbol(symname, n, scope))
return SWIG_ERROR;
@@ -1265,9 +1304,17 @@ public:
Replaceall(enum_code, "$static ", "");
Delete(scope);
} else {
- // Wrap C++ enum with integers - just indicate start of enum with a comment, no comment for anonymous enums of any sort
if (symname && !Getattr(n, "unnamedinstance"))
Printf(constants_code, " // %s \n", symname);
+ // Translate and write javadoc comment for the enum itself if flagged
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, " ");
+ if (comment_creation_chatter)
+ Printf(constants_code, "/* This was generated from enumDeclaration() */\n");
+ Printf(constants_code, Char(doxygen_comments));
+ Printf(constants_code, "\n");
+ Delete(doxygen_comments);
+ }
}
// Emit each enum item
@@ -1418,12 +1465,24 @@ public:
}
if (!addSymbol(symname, n, scope))
return SWIG_ERROR;
+
+ if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) {
+ if (!GetFlag(n, "firstenumitem"))
+ Printf(enum_code, ",\n");
+ }
+
+ // Translate and write javadoc comment if flagged
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, " ");
+ if (comment_creation_chatter)
+ Printf(enum_code, "/* This was generated from enumvalueDeclaration() */\n");
+ Printv(enum_code, Char(doxygen_comments), NIL);
+ Delete(doxygen_comments);
+ }
if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) {
// Wrap (non-anonymous) C/C++ enum with a proper Java enum
// Emit the enum item.
- if (!GetFlag(n, "firstenumitem"))
- Printf(enum_code, ",\n");
Printf(enum_code, " %s", symname);
if (Getattr(n, "enumvalue")) {
String *value = enumValue(n);
@@ -1497,6 +1556,15 @@ public:
String *constants_code = NewString("");
Swig_save("constantWrapper", n, "value", NIL);
+ // Translate and write javadoc comment if flagged
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, " ");
+ if (comment_creation_chatter)
+ Printf(constants_code, "/* This was generated from constantWrapper() */\n");
+ Printv(constants_code, Char(doxygen_comments), NIL);
+ Delete(doxygen_comments);
+ }
+
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
const String *itemname = (proxy_flag && wrapping_member_flag) ? variable_name : symname;
@@ -1565,7 +1633,7 @@ public:
if (classname_substituted_flag) {
if (SwigType_isenum(t)) {
// This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on)
- Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname));
+ Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
} else {
// This handles function pointers using the %constant directive
Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
@@ -1808,7 +1876,7 @@ public:
Replaceall(cptr_method_name, ".", "_");
Replaceall(cptr_method_name, "$interfacename", interface_name);
- String *upcast_method_name = Swig_name_member(getNSpace(), proxy_class_name, cptr_method_name);
+ String *upcast_method_name = Swig_name_member(getNSpace(), getClassPrefix(), cptr_method_name);
upcastsCode(smart, upcast_method_name, c_classname, c_baseclass);
Delete(upcast_method_name);
Delete(cptr_method_name);
@@ -1936,13 +2004,24 @@ public:
// Pure Java interfaces
const String *pure_interfaces = typemapLookup(n, "javainterfaces", typemap_lookup_type, WARN_NONE);
+
if (*Char(interface_list) && *Char(pure_interfaces))
Append(interface_list, ", ");
Append(interface_list, pure_interfaces);
// Start writing the proxy class
if (!has_outerclass) // Import statements
Printv(proxy_class_def, typemapLookup(n, "javaimports", typemap_lookup_type, WARN_NONE),"\n", NIL);
- else
+
+ // Translate and write javadoc comment if flagged
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, 0);
+ if (comment_creation_chatter)
+ Printf(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */\n");
+ Printv(proxy_class_def, Char(doxygen_comments), NIL);
+ Delete(doxygen_comments);
+ }
+
+ if (has_outerclass)
Printv(proxy_class_def, "static ", NIL); // C++ nested classes correspond to static java classes
Printv(proxy_class_def, typemapLookup(n, "javaclassmodifiers", typemap_lookup_type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
" $javaclassname", // Class name and bases
@@ -1956,16 +2035,19 @@ public:
String *destruct = NewString("");
const String *tm = NULL;
attributes = NewHash();
- String *destruct_methodname = NULL;
- String *destruct_methodmodifiers = NULL;
+ const String *destruct_methodname = NULL;
+ const String *destruct_methodmodifiers = NULL;
+ const String *destruct_parameters = NULL;
if (derived) {
tm = typemapLookup(n, "javadestruct_derived", typemap_lookup_type, WARN_NONE, attributes);
destruct_methodname = Getattr(attributes, "tmap:javadestruct_derived:methodname");
destruct_methodmodifiers = Getattr(attributes, "tmap:javadestruct_derived:methodmodifiers");
+ destruct_parameters = Getattr(attributes, "tmap:javadestruct_derived:parameters");
} else {
tm = typemapLookup(n, "javadestruct", typemap_lookup_type, WARN_NONE, attributes);
destruct_methodname = Getattr(attributes, "tmap:javadestruct:methodname");
destruct_methodmodifiers = Getattr(attributes, "tmap:javadestruct:methodmodifiers");
+ destruct_parameters = Getattr(attributes, "tmap:javadestruct:parameters");
}
if (tm && *Char(tm)) {
if (!destruct_methodname) {
@@ -1974,6 +2056,8 @@ public:
if (!destruct_methodmodifiers) {
Swig_error(Getfile(n), Getline(n), "No methodmodifiers attribute defined in javadestruct%s typemap for %s.\n", (derived ? "_derived" : ""), proxy_class_name);
}
+ if (!destruct_parameters)
+ destruct_parameters = empty_string;
}
// Emit the finalize and delete methods
if (tm) {
@@ -1987,8 +2071,15 @@ public:
Replaceall(destruct, "$jnicall", destructor_call);
else
Replaceall(destruct, "$jnicall", "throw new UnsupportedOperationException(\"C++ destructor does not have public access\")");
- if (*Char(destruct))
- Printv(proxy_class_def, "\n ", destruct_methodmodifiers, " void ", destruct_methodname, "()", destructor_throws_clause, " ", destruct, "\n", NIL);
+ if (*Char(destruct)) {
+ Printv(proxy_class_def, "\n ", NIL);
+ const String *methodmods = Getattr(n, "destructmethodmodifiers");
+ if (methodmods)
+ Printv(proxy_class_def, methodmods, NIL);
+ else
+ Printv(proxy_class_def, destruct_methodmodifiers, NIL);
+ Printv(proxy_class_def, " void ", destruct_methodname, "(", destruct_parameters, ")", destructor_throws_clause, " ", destruct, "\n", NIL);
+ }
}
if (*Char(interface_upcasts))
Printv(proxy_class_def, interface_upcasts, NIL);
@@ -2272,39 +2363,6 @@ public:
--nesting_depth;
}
- /* Output the downcast method, if necessary. Note: There's no other really
- good place to put this code, since Abstract Base Classes (ABCs) can and should have
- downcasts, making the constructorHandler() a bad place (because ABCs don't get to
- have constructors emitted.) */
- if (GetFlag(n, "feature:javadowncast")) {
- String *downcast_method = Swig_name_member(getNSpace(), getClassPrefix(), "SWIGDowncast");
- String *jniname = makeValidJniName(downcast_method);
- String *wname = Swig_name_wrapper(jniname);
-
- String *norm_name = SwigType_namestr(Getattr(n, "name"));
-
- Printf(imclass_class_code, " public final static native %s %s(long cPtrBase, boolean cMemoryOwn);\n", proxy_class_name, downcast_method);
-
- Wrapper *dcast_wrap = NewWrapper();
-
- Printf(dcast_wrap->def, "SWIGEXPORT jobject JNICALL %s(JNIEnv *jenv, jclass jcls, jlong jCPtrBase, jboolean cMemoryOwn) {", wname);
- Printf(dcast_wrap->code, " Swig::Director *director = (Swig::Director *) 0;\n");
- Printf(dcast_wrap->code, " jobject jresult = (jobject) 0;\n");
- Printf(dcast_wrap->code, " %s *obj = *((%s **)&jCPtrBase);\n", norm_name, norm_name);
- Printf(dcast_wrap->code, " if (obj) director = dynamic_cast<Swig::Director *>(obj);\n");
- Printf(dcast_wrap->code, " if (director) jresult = director->swig_get_self(jenv);\n");
- Printf(dcast_wrap->code, " return jresult;\n");
- Printf(dcast_wrap->code, "}\n");
-
- Wrapper_print(dcast_wrap, f_wrappers);
- DelWrapper(dcast_wrap);
-
- Delete(norm_name);
- Delete(wname);
- Delete(jniname);
- Delete(downcast_method);
- }
-
if (f_interface) {
Printv(f_interface, interface_class_code, "}\n", NIL);
Delete(f_interface);
@@ -2450,6 +2508,15 @@ public:
setter_flag = (Cmp(Getattr(n, "sym:name"), Swig_name_set(getNSpace(), Swig_name_member(0, getClassPrefix(), variable_name))) == 0);
}
+ // Translate and write javadoc comment if flagged
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, " ");
+ if (comment_creation_chatter)
+ Printf(function_code, "/* This was generated from proxyclassfunctionhandler() */\n");
+ Printv(function_code, Char(doxygen_comments), NIL);
+ Delete(doxygen_comments);
+ }
+
/* Start generating the proxy function */
const String *methodmods = Getattr(n, "feature:java:methodmodifiers");
methodmods = methodmods ? methodmods : (is_public(n) ? public_string : protected_string);
@@ -2457,7 +2524,7 @@ public:
if (static_flag)
Printf(function_code, "static ");
Printf(function_code, "%s %s(", return_type, proxy_function_name);
-
+
if (is_interface)
Printf(interface_class_code, " %s %s(", return_type, proxy_function_name);
@@ -2577,8 +2644,6 @@ public:
Printf(imcall, ")");
Printf(function_code, ")");
- if (is_interface)
- Printf(interface_class_code, ");\n");
// Transform return type used in JNI function (in intermediary class) to type used in Java wrapper function (in proxy class)
if ((tm = Swig_typemap_lookup("javaout", n, "", 0))) {
@@ -2636,8 +2701,13 @@ public:
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number, "No javaout typemap defined for %s\n", SwigType_str(t, 0));
}
+ if (is_interface) {
+ Printf(interface_class_code, ")");
+ generateThrowsClause(n, interface_class_code);
+ Printf(interface_class_code, ";\n");
+ }
generateThrowsClause(n, function_code);
- Printf(function_code, " %s\n\n", tm ? (const String *) tm : empty_string);
+ Printf(function_code, " %s\n\n", tm ? tm : empty_string);
Printv(proxy_class_code, function_code, NIL);
Delete(pre_code);
@@ -2682,6 +2752,15 @@ public:
tm = Getattr(n, "tmap:jtype"); // typemaps were attached earlier to the node
Printf(im_return_type, "%s", tm);
+ // Translate and write javadoc comment if flagged
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, " ");
+ if (comment_creation_chatter)
+ Printf(function_code, "/* This was generated from constructionhandler() */\n");
+ Printv(function_code, Char(doxygen_comments), NIL);
+ Delete(doxygen_comments);
+ }
+
Printf(function_code, " %s %s(", methodmods, proxy_class_name);
Printf(helper_code, " static private %s SwigConstruct%s(", im_return_type, proxy_class_name);
@@ -2790,7 +2869,8 @@ public:
/* Insert the javaconstruct typemap, doing the replacement for $directorconnect, as needed */
Hash *attributes = NewHash();
- String *construct_tm = Copy(typemapLookup(n, "javaconstruct", Getattr(n, "name"),
+ String *typemap_lookup_type = Getattr(getCurrentClass(), "classtypeobj");
+ String *construct_tm = Copy(typemapLookup(n, "javaconstruct", typemap_lookup_type,
WARN_JAVA_TYPEMAP_JAVACONSTRUCT_UNDEF, attributes));
if (construct_tm) {
if (!feature_director) {
@@ -2860,6 +2940,9 @@ public:
if (proxy_flag) {
Printv(destructor_call, full_imclass_name, ".", Swig_name_destroy(getNSpace(), symname), "(swigCPtr)", NIL);
generateThrowsClause(n, destructor_throws_clause);
+ const String *methodmods = Getattr(n, "feature:java:methodmodifiers");
+ if (methodmods)
+ Setattr(getCurrentClass(), "destructmethodmodifiers", methodmods);
}
return SWIG_OK;
}
@@ -2943,6 +3026,15 @@ public:
String *pre_code = NewString("");
String *post_code = NewString("");
+ // Translate and write javadoc comment if flagged
+ if (doxygen && doxygenTranslator->hasDocumentation(n)) {
+ String *doxygen_comments = doxygenTranslator->getDocumentation(n, " ");
+ if (comment_creation_chatter)
+ Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */\n");
+ Printv(function_code, doxygen_comments, NIL);
+ Delete(doxygen_comments);
+ }
+
if (l) {
if (SwigType_type(Getattr(l, "type")) == T_VOID) {
l = nextSibling(l);
@@ -3095,7 +3187,7 @@ public:
}
generateThrowsClause(n, function_code);
- Printf(function_code, " %s\n\n", tm ? (const String *) tm : empty_string);
+ Printf(function_code, " %s\n\n", tm ? tm : empty_string);
Printv(module_class_code, function_code, NIL);
Delete(pre_code);
@@ -3760,18 +3852,16 @@ public:
Printf(code_wrap->code, " (void)jcls;\n");
Printf(code_wrap->code, " // Keep a local instance of the smart pointer around while we are using the raw pointer\n");
Printf(code_wrap->code, " // Avoids using smart pointer specific API.\n");
- Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj->operator->());\n", dirClassName, dirClassName);
+ Printf(code_wrap->code, " %s *director = static_cast<%s *>(obj->operator->());\n", dirClassName, dirClassName);
}
else {
Printf(code_wrap->code, " %s *obj = *((%s **)&objarg);\n", norm_name, norm_name);
Printf(code_wrap->code, " (void)jcls;\n");
- Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj);\n", dirClassName, dirClassName);
+ Printf(code_wrap->code, " %s *director = static_cast<%s *>(obj);\n", dirClassName, dirClassName);
}
- Printf(code_wrap->code, " if (director) {\n");
- Printf(code_wrap->code, " director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), "
+ Printf(code_wrap->code, " director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), "
"(jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));\n");
- Printf(code_wrap->code, " }\n");
Printf(code_wrap->code, "}\n");
Wrapper_print(code_wrap, f_wrappers);
@@ -3790,8 +3880,17 @@ public:
Printf(code_wrap->def,
"SWIGEXPORT void JNICALL Java_%s%s_%s(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {\n",
jnipackage, jni_imclass_name, changeown_jnimethod_name);
- Printf(code_wrap->code, " %s *obj = *((%s **)&objarg);\n", norm_name, norm_name);
- Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj);\n", dirClassName, dirClassName);
+
+ if (Len(smartptr)) {
+ Printf(code_wrap->code, " %s *obj = *((%s **)&objarg);\n", smartptr, smartptr);
+ Printf(code_wrap->code, " // Keep a local instance of the smart pointer around while we are using the raw pointer\n");
+ Printf(code_wrap->code, " // Avoids using smart pointer specific API.\n");
+ Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj->operator->());\n", dirClassName, dirClassName);
+ } else {
+ Printf(code_wrap->code, " %s *obj = *((%s **)&objarg);\n", norm_name, norm_name);
+ Printf(code_wrap->code, " %s *director = dynamic_cast<%s *>(obj);\n", dirClassName, dirClassName);
+ }
+
Printf(code_wrap->code, " (void)jcls;\n");
Printf(code_wrap->code, " if (director) {\n");
Printf(code_wrap->code, " director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);\n");
@@ -3972,15 +4071,17 @@ public:
/* If returning a reference, initialize the pointer to a sane
default - if a Java exception occurs, then the pointer returns
something other than a NULL-initialized reference. */
- String *non_ref_type = Copy(returntype);
-
- /* Remove reference and const qualifiers */
- Replaceall(non_ref_type, "r.", "");
- Replaceall(non_ref_type, "q(const).", "");
- Wrapper_add_localv(w, "result_default", "static", SwigType_str(non_ref_type, "result_default"), "=", SwigType_str(non_ref_type, "()"), NIL);
- Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= &result_default", NIL);
-
- Delete(non_ref_type);
+ SwigType *noref_type = SwigType_del_reference(Copy(returntype));
+ String *noref_ltype = SwigType_lstr(noref_type, 0);
+ String *return_ltype = SwigType_lstr(returntype, 0);
+
+ Wrapper_add_localv(w, "result_default", "static", noref_ltype, "result_default", NIL);
+ Wrapper_add_localv(w, "c_result", return_ltype, "c_result", NIL);
+ Printf(w->code, "result_default = SwigValueInit< %s >();\n", noref_ltype);
+ Printf(w->code, "c_result = &result_default;\n");
+ Delete(return_ltype);
+ Delete(noref_ltype);
+ Delete(noref_type);
}
Delete(base_typename);
@@ -4071,7 +4172,7 @@ public:
Swig_typemap_attach_parms("out", l, 0);
Swig_typemap_attach_parms("jni", l, 0);
Swig_typemap_attach_parms("jtype", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("javadirectorin", l, 0);
Swig_typemap_attach_parms("directorargout", l, w);
@@ -4270,11 +4371,11 @@ public:
/* header declaration, start wrapper definition */
String *target;
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
Printf(declaration, " virtual %s", target);
Delete(target);
@@ -4293,6 +4394,10 @@ public:
}
}
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
int gencomma = 0;
@@ -4484,9 +4589,9 @@ public:
if (!directorexcept) {
directorexcept = NewString("");
Printf(directorexcept, "jthrowable $error = jenv->ExceptionOccurred();\n");
- Printf(directorexcept, "if ($error) {\n");
- Printf(directorexcept, " jenv->ExceptionClear();$directorthrowshandlers\n");
- Printf(directorexcept, " throw Swig::DirectorException(jenv, $error);\n");
+ Printf(directorexcept, "if ($error) {");
+ Printf(directorexcept, "$directorthrowshandlers\n");
+ Printf(directorexcept, " Swig::DirectorException::raise(jenv, $error);\n");
Printf(directorexcept, "}\n");
} else {
directorexcept = Copy(directorexcept);
@@ -4585,7 +4690,7 @@ public:
/* constructor */
{
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, dirclassname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, dirclassname, parms, 0);
String *call = Swig_csuperclass_call(0, basetype, superparms);
String *classtype = SwigType_namestr(Getattr(n, "name"));
@@ -4599,7 +4704,7 @@ public:
/* constructor header */
{
- String *target = Swig_method_decl(0, decl, dirclassname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, dirclassname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -4671,9 +4776,12 @@ public:
String *dirClassName = directorClassName(current_class);
Wrapper *w = NewWrapper();
- if (Getattr(n, "throw")) {
- Printf(f_directors_h, " virtual ~%s() throw ();\n", dirClassName);
- Printf(w->def, "%s::~%s() throw () {\n", dirClassName, dirClassName);
+ if (Getattr(n, "noexcept")) {
+ Printf(f_directors_h, " virtual ~%s() noexcept;\n", dirClassName);
+ Printf(w->def, "%s::~%s() noexcept {\n", dirClassName, dirClassName);
+ } else if (Getattr(n, "throw")) {
+ Printf(f_directors_h, " virtual ~%s() throw();\n", dirClassName);
+ Printf(w->def, "%s::~%s() throw() {\n", dirClassName, dirClassName);
} else {
Printf(f_directors_h, " virtual ~%s();\n", dirClassName);
Printf(w->def, "%s::~%s() {\n", dirClassName, dirClassName);
@@ -4876,6 +4984,9 @@ extern "C" Language *swig_java(void) {
const char *JAVA::usage = "\
Java Options (available with -java)\n\
+ -doxygen - Convert C++ doxygen comments to JavaDoc comments in proxy classes\n\
+ -debug-doxygen-parser - Display doxygen parser module debugging information\n\
+ -debug-doxygen-translator - Display doxygen translator module debugging information\n\
-nopgcpp - Suppress premature garbage collection prevention parameter\n\
-noproxy - Generate the low-level functional interface instead\n\
of proxy classes\n\
diff --git a/Source/Modules/javascript.cxx b/Source/Modules/javascript.cxx
index 4e7a7912f..d2b33b1b4 100644
--- a/Source/Modules/javascript.cxx
+++ b/Source/Modules/javascript.cxx
@@ -33,6 +33,7 @@ static bool js_template_enable_debug = false;
#define GETTER "getter"
#define SETTER "setter"
#define PARENT "parent"
+#define PARENT_MANGLED "parent_mangled"
#define CTOR "ctor"
#define CTOR_WRAPPERS "ctor_wrappers"
#define CTOR_DISPATCHERS "ctor_dispatchers"
@@ -197,6 +198,11 @@ public:
virtual int emitWrapperFunction(Node *n);
/**
+ * Invoked by nativeWrapper callback
+ */
+ virtual int emitNativeFunction(Node *n);
+
+ /**
* Invoked from constantWrapper after call to Language::constantWrapper.
**/
virtual int emitConstant(Node *n);
@@ -262,7 +268,7 @@ protected:
virtual int createNamespace(String *scope);
- virtual Hash *createNamespaceEntry(const char *name, const char *parent);
+ virtual Hash *createNamespaceEntry(const char *name, const char *parent, const char *parent_mangled);
virtual int emitNamespaces() = 0;
@@ -310,6 +316,7 @@ public:
virtual int classHandler(Node *n);
virtual int functionWrapper(Node *n);
virtual int constantWrapper(Node *n);
+ virtual int nativeWrapper(Node *n);
virtual void main(int argc, char *argv[]);
virtual int top(Node *n);
@@ -441,6 +448,18 @@ int JAVASCRIPT::constantWrapper(Node *n) {
}
/* ---------------------------------------------------------------------
+ * nativeWrapper()
+ *
+ * Function wrapper for generating placeholders for native functions
+ * --------------------------------------------------------------------- */
+
+int JAVASCRIPT::nativeWrapper(Node *n) {
+ emitter->emitNativeFunction(n);
+
+ return SWIG_OK;
+}
+
+/* ---------------------------------------------------------------------
* classHandler()
*
* Function handler for generating wrappers for class
@@ -462,10 +481,10 @@ int JAVASCRIPT::fragmentDirective(Node *n) {
// and register them at the emitter.
String *section = Getattr(n, "section");
- if (Equal(section, "templates")) {
+ if (Equal(section, "templates") && !ImportMode) {
emitter->registerTemplate(Getattr(n, "value"), Getattr(n, "code"));
} else {
- Swig_fragment_register(n);
+ return Language::fragmentDirective(n);
}
return SWIG_OK;
@@ -552,7 +571,7 @@ void JAVASCRIPT::main(int argc, char *argv[]) {
emitter = swig_javascript_create_V8Emitter();
Preprocessor_define("SWIG_JAVASCRIPT_V8 1", 0);
SWIG_library_directory("javascript/v8");
- // V8 API is C++, so output must be C++ compatibile even when wrapping C code
+ // V8 API is C++, so output must be C++ compatible even when wrapping C code
if (!cparse_cplusplus) {
Swig_cparse_cplusplusout(1);
}
@@ -664,7 +683,7 @@ int JSEmitter::initialize(Node * /*n */ ) {
Delete(namespaces);
}
namespaces = NewHash();
- Hash *global_namespace = createNamespaceEntry("exports", 0);
+ Hash *global_namespace = createNamespaceEntry("exports", 0, 0);
Setattr(namespaces, "::", global_namespace);
current_namespace = global_namespace;
@@ -767,6 +786,14 @@ int JSEmitter::emitWrapperFunction(Node *n) {
return ret;
}
+int JSEmitter::emitNativeFunction(Node *n) {
+ String *wrapname = Getattr(n, "wrap:name");
+ enterFunction(n);
+ state.function(WRAPPER_NAME, wrapname);
+ exitFunction(n);
+ return SWIG_OK;
+}
+
int JSEmitter::enterClass(Node *n) {
state.clazz(RESET);
state.clazz(NAME, Getattr(n, "sym:name"));
@@ -993,7 +1020,7 @@ int JSEmitter::emitDtor(Node *n) {
Also, there is a problem where destructor_action is always true for me, even when not requesting %extend as above.
So this code doesn't actually quite work as I expect. The end result is that the code still works because
- destructor_action calls free like the original template. The one caveat is the string in destructor_action casts to char* which is wierd.
+ destructor_action calls free like the original template. The one caveat is the string in destructor_action casts to char* which is weird.
I think there is a deeper underlying SWIG issue because I don't think it should be char*. However, it doesn't really matter for free.
Maybe the fix for the destructor_action always true problem is that this is supposed to be embedded in the if(Extend) block above.
@@ -1124,7 +1151,7 @@ int JSEmitter::emitConstant(Node *n) {
Template t_getter(getTemplate("js_getter"));
// call the variable methods as a constants are
- // registred in same way
+ // registered in same way
enterVariable(n);
state.variable(GETTER, wname);
// TODO: why do we need this?
@@ -1428,19 +1455,20 @@ int JSEmitter::createNamespace(String *scope) {
}
assert(parent_namespace != 0);
- Hash *new_namespace = createNamespaceEntry(Char(scope), Char(Getattr(parent_namespace, "name")));
+ Hash *new_namespace = createNamespaceEntry(Char(scope), Char(Getattr(parent_namespace, "name")), Char(Getattr(parent_namespace, "name_mangled")));
Setattr(namespaces, scope, new_namespace);
Delete(parent_scope);
return SWIG_OK;
}
-Hash *JSEmitter::createNamespaceEntry(const char *_name, const char *parent) {
+Hash *JSEmitter::createNamespaceEntry(const char *_name, const char *parent, const char *parent_mangled) {
Hash *entry = NewHash();
String *name = NewString(_name);
Setattr(entry, NAME, Swig_scopename_last(name));
Setattr(entry, NAME_MANGLED, Swig_name_mangle(name));
Setattr(entry, PARENT, NewString(parent));
+ Setattr(entry, PARENT_MANGLED, NewString(parent_mangled));
Delete(name);
return entry;
@@ -1467,7 +1495,7 @@ protected:
virtual int enterClass(Node *n);
virtual int exitClass(Node *n);
virtual void marshalInputArgs(Node *n, ParmList *parms, Wrapper *wrapper, MarshallingMode mode, bool is_member, bool is_static);
- virtual Hash *createNamespaceEntry(const char *name, const char *parent);
+ virtual Hash *createNamespaceEntry(const char *name, const char *parent, const char *parent_mangled);
virtual int emitNamespaces();
private:
@@ -1773,8 +1801,8 @@ int JSCEmitter::exitClass(Node *n) {
return SWIG_OK;
}
-Hash *JSCEmitter::createNamespaceEntry(const char *name, const char *parent) {
- Hash *entry = JSEmitter::createNamespaceEntry(name, parent);
+Hash *JSCEmitter::createNamespaceEntry(const char *name, const char *parent, const char *parent_mangled) {
+ Hash *entry = JSEmitter::createNamespaceEntry(name, parent, parent_mangled);
Setattr(entry, "functions", NewString(""));
Setattr(entry, "values", NewString(""));
return entry;
@@ -1786,8 +1814,7 @@ int JSCEmitter::emitNamespaces() {
Hash *entry = it.item;
String *name = Getattr(entry, NAME);
String *name_mangled = Getattr(entry, NAME_MANGLED);
- String *parent = Getattr(entry, PARENT);
- String *parent_mangled = Swig_name_mangle(parent);
+ String *parent_mangled = Getattr(entry, PARENT_MANGLED);
String *functions = Getattr(entry, "functions");
String *variables = Getattr(entry, "values");
@@ -2037,7 +2064,7 @@ int V8Emitter::exitClass(Node *n) {
.pretty_print(f_init_inheritance);
Delete(base_name_mangled);
}
- // emit registeration of class template
+ // emit registration of class template
Template t_register = getTemplate("jsv8_register_class");
t_register.replace("$jsmangledname", state.clazz(NAME_MANGLED))
.replace("$jsname", state.clazz(NAME))
@@ -2206,7 +2233,7 @@ int V8Emitter::emitNamespaces() {
String *name = Getattr(entry, NAME);
String *name_mangled = Getattr(entry, NAME_MANGLED);
String *parent = Getattr(entry, PARENT);
- String *parent_mangled = Swig_name_mangle(parent);
+ String *parent_mangled = Getattr(entry, PARENT_MANGLED);
bool do_create = true;
bool do_register = true;
@@ -2427,7 +2454,7 @@ Template & Template::trim() {
/* -----------------------------------------------------------------------------
* Template& Template::replace(const String* pattern, const String* repl) :
*
- * replaces all occurences of a given pattern with a given replacement.
+ * replaces all occurrences of a given pattern with a given replacement.
*
* - pattern: the pattern to be replaced
* - repl: the replacement string
diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx
index 4dc39e069..f7979b611 100644
--- a/Source/Modules/lang.cxx
+++ b/Source/Modules/lang.cxx
@@ -81,7 +81,6 @@ extern int AddExtern;
/* import modes */
#define IMPORT_MODE 1
-#define IMPORT_MODULE 2
/* ----------------------------------------------------------------------
* Dispatcher::emit_one()
@@ -308,15 +307,12 @@ int Dispatcher::namespaceDeclaration(Node *n) {
return defaultHandler(n);
}
-
/* Allocators */
Language::Language():
none_comparison(NewString("$arg != 0")),
director_ctor_code(NewString("")),
director_prot_ctor_code(0),
symtabs(NewHash()),
-classtypes(NewHash()),
-enumtypes(NewHash()),
overloading(0),
multiinput(0),
cplus_runtime(0),
@@ -337,12 +333,12 @@ directors(0) {
director_language = 0;
assert(!this_);
this_ = this;
+
+ doxygenTranslator = NULL;
}
Language::~Language() {
Delete(symtabs);
- Delete(classtypes);
- Delete(enumtypes);
Delete(director_ctor_code);
Delete(none_comparison);
this_ = 0;
@@ -625,7 +621,8 @@ int Language::constantDirective(Node *n) {
* ---------------------------------------------------------------------- */
int Language::fragmentDirective(Node *n) {
- Swig_fragment_register(n);
+ if (!(Getattr(n, "emitonly") && ImportMode))
+ Swig_fragment_register(n);
return SWIG_OK;
}
@@ -1084,6 +1081,8 @@ int Language::functionHandler(Node *n) {
globalfunctionHandler(n);
InClass = oldInClass;
} else {
+ // This is a member function, set a flag so the documentation type is correct
+ SetFlag(n, "memberfunction");
Node *explicit_n = 0;
if (directorsEnabled() && is_member_director(CurrentClass, n) && !extraDirectorProtectedCPPMethodsRequired()) {
bool virtual_but_not_pure_virtual = (!(Cmp(storage, "virtual")) && (Cmp(Getattr(n, "value"), "0") != 0));
@@ -1273,6 +1272,9 @@ int Language::memberfunctionHandler(Node *n) {
int flags = Getattr(n, "template") ? extendmember | SmartPointer : Extend | SmartPointer | DirectorExtraCall;
Swig_MethodToFunction(n, NSpace, ClassType, flags, director_type, is_member_director(CurrentClass, n));
Setattr(n, "sym:name", fname);
+ /* Explicitly save low-level and high-level documentation names */
+ Setattr(n, "doc:low:name", fname);
+ Setattr(n, "doc:high:name", symname);
functionWrapper(n);
@@ -1333,6 +1335,9 @@ int Language::staticmemberfunctionHandler(Node *n) {
Setattr(n, "name", cname);
Setattr(n, "sym:name", mrename);
+ /* Explicitly save low-level and high-level documentation names */
+ Setattr(n, "doc:low:name", mrename);
+ Setattr(n, "doc:high:name", symname);
if (cb) {
String *cbname = NewStringf(cb, symname);
@@ -1889,6 +1894,8 @@ int Language::unrollVirtualMethods(Node *n, Node *parent, List *vm, int default_
}
if (!checkAttribute(nn, "storage", "virtual"))
continue;
+ if (GetFlag(nn, "final"))
+ continue;
/* we need to add methods(cdecl) and destructor (to check for throw decl) */
int is_destructor = (Cmp(nodeType, "destructor") == 0);
if ((Cmp(nodeType, "cdecl") == 0) || is_destructor) {
@@ -1949,7 +1956,7 @@ int Language::unrollVirtualMethods(Node *n, Node *parent, List *vm, int default_
generation of 'empty' director classes.
But this has to be done outside the previous 'for'
- an the recursive loop!.
+ and the recursive loop!.
*/
if (n == parent) {
int len = Len(vm);
@@ -2078,7 +2085,7 @@ int Language::classDirectorConstructors(Node *n) {
needed, since there is a public constructor already defined.
(scottm) This code is needed here to make the director_abstract +
- test generate compilable code (Example2 in director_abastract.i).
+ test generate compilable code (Example2 in director_abstract.i).
(mmatus) This is very strange, since swig compiled with gcc3.2.3
doesn't need it here....
@@ -2104,7 +2111,7 @@ int Language::classDirectorMethods(Node *n) {
Node *item = Getitem(vtable, i);
String *method = Getattr(item, "methodNode");
String *fqdname = Getattr(item, "fqdname");
- if (GetFlag(method, "feature:nodirector"))
+ if (GetFlag(method, "feature:nodirector") || GetFlag(method, "final"))
continue;
String *wrn = Getattr(method, "feature:warnfilter");
@@ -2151,8 +2158,8 @@ int Language::classDirectorDestructor(Node *n) {
File *f_directors = Swig_filebyname("director");
File *f_directors_h = Swig_filebyname("director_h");
if (Getattr(n, "throw")) {
- Printf(f_directors_h, " virtual ~%s() throw ();\n", DirectorClassName);
- Printf(f_directors, "%s::~%s() throw () {\n}\n\n", DirectorClassName, DirectorClassName);
+ Printf(f_directors_h, " virtual ~%s() throw();\n", DirectorClassName);
+ Printf(f_directors, "%s::~%s() throw() {\n}\n\n", DirectorClassName, DirectorClassName);
} else {
Printf(f_directors_h, " virtual ~%s();\n", DirectorClassName);
Printf(f_directors, "%s::~%s() {\n}\n\n", DirectorClassName, DirectorClassName);
@@ -2193,6 +2200,16 @@ int Language::classDirector(Node *n) {
String *using_protected_members_code = NewString("");
for (ni = Getattr(n, "firstChild"); ni; ni = nextSibling(ni)) {
Node *nodeType = Getattr(ni, "nodeType");
+ if (Cmp(nodeType, "destructor") == 0 && GetFlag(ni, "final")) {
+ String *classtype = Getattr(n, "classtype");
+ SWIG_WARN_NODE_BEGIN(ni);
+ Swig_warning(WARN_LANG_DIRECTOR_FINAL, input_file, line_number, "Destructor %s is final, %s cannot be a director class.\n", Swig_name_decl(ni), classtype);
+ SWIG_WARN_NODE_END(ni);
+ SetFlag(n, "feature:nodirector");
+ Delete(vtable);
+ Delete(using_protected_members_code);
+ return SWIG_OK;
+ }
bool cdeclaration = (Cmp(nodeType, "cdecl") == 0);
if (cdeclaration && !GetFlag(ni, "feature:ignore")) {
if (isNonVirtualProtectedAccess(ni)) {
@@ -3264,11 +3281,13 @@ Node *Language::symbolLookup(const String *s, const_String_or_char_ptr scope) {
* Tries to locate a class from a type definition
* ----------------------------------------------------------------------------- */
-Node *Language::classLookup(const SwigType *s) const {
+Node *Language::classLookup(const SwigType *s) {
+ static Hash *classtypes = 0;
+
Node *n = 0;
/* Look in hash of cached values */
- n = Getattr(classtypes, s);
+ n = classtypes ? Getattr(classtypes, s) : 0;
if (!n) {
Symtab *stab = 0;
SwigType *ty1 = SwigType_typedef_resolve_all(s);
@@ -3296,6 +3315,14 @@ Node *Language::classLookup(const SwigType *s) const {
break;
if (Strcmp(nodeType(n), "class") == 0)
break;
+ Node *sibling = n;
+ while (sibling) {
+ sibling = Getattr(sibling, "csym:nextSibling");
+ if (sibling && Strcmp(nodeType(sibling), "class") == 0)
+ break;
+ }
+ if (sibling)
+ break;
n = parentNode(n);
if (!n)
break;
@@ -3308,7 +3335,7 @@ Node *Language::classLookup(const SwigType *s) const {
}
if (n) {
/* Found a match. Look at the prefix. We only allow
- the cases where where we want a proxy class for the particular type */
+ the cases where we want a proxy class for the particular type */
bool acceptable_prefix =
(Len(prefix) == 0) || // simple type (pass by value)
(Strcmp(prefix, "p.") == 0) || // pointer
@@ -3323,6 +3350,8 @@ Node *Language::classLookup(const SwigType *s) const {
}
if (acceptable_prefix) {
SwigType *cs = Copy(s);
+ if (!classtypes)
+ classtypes = NewHash();
Setattr(classtypes, cs, n);
Delete(cs);
} else {
@@ -3349,10 +3378,12 @@ Node *Language::classLookup(const SwigType *s) const {
* ----------------------------------------------------------------------------- */
Node *Language::enumLookup(SwigType *s) {
+ static Hash *enumtypes = 0;
+
Node *n = 0;
/* Look in hash of cached values */
- n = Getattr(enumtypes, s);
+ n = enumtypes ? Getattr(enumtypes, s) : 0;
if (!n) {
Symtab *stab = 0;
SwigType *lt = SwigType_ltype(s);
@@ -3393,6 +3424,8 @@ Node *Language::enumLookup(SwigType *s) {
if (n) {
/* Found a match. Look at the prefix. We only allow simple types. */
if (Len(prefix) == 0) { /* Simple type */
+ if (!enumtypes)
+ enumtypes = NewHash();
Setattr(enumtypes, Copy(s), n);
} else {
n = 0;
@@ -3513,7 +3546,7 @@ int Language::need_nonpublic_ctor(Node *n) {
Note: given all the complications here, I am always in favor to
always enable 'dirprot', since is the C++ idea of protected
- members, and use %ignore for the method you don't whan to add in
+ members, and use %ignore for the method you don't want to add in
the director class.
*/
if (directorsEnabled()) {
@@ -3589,7 +3622,7 @@ String *Language::makeParameterName(Node *n, Parm *p, int arg_num, bool setter)
String *arg = 0;
String *pn = Getattr(p, "name");
- // Use C parameter name unless it is a duplicate or an empty parameter name
+ // Check if parameter name is a duplicate.
int count = 0;
ParmList *plist = Getattr(n, "parms");
while (plist) {
@@ -3597,8 +3630,14 @@ String *Language::makeParameterName(Node *n, Parm *p, int arg_num, bool setter)
count++;
plist = nextSibling(plist);
}
- String *wrn = pn ? Swig_name_warning(p, 0, pn, 0) : 0;
- arg = (!pn || (count > 1) || wrn) ? NewStringf("arg%d", arg_num) : Copy(pn);
+
+ // If the parameter has no name at all or has a non-unique name, replace it with "argN".
+ if (!pn || count > 1) {
+ arg = NewStringf("arg%d", arg_num);
+ } else {
+ // Otherwise, try to use the original C name, but modify it if necessary to avoid conflicting with the language keywords.
+ arg = Swig_name_make(p, 0, pn, 0, 0);
+ }
if (setter && Cmp(arg, "self") != 0) {
// Some languages (C#) insist on calling the input variable "value" while
@@ -3773,7 +3812,7 @@ int Language::abstractClassTest(Node *n) {
if (dirabstract) {
if (is_public(dirabstract)) {
Swig_warning(WARN_LANG_DIRECTOR_ABSTRACT, Getfile(n), Getline(n),
- "Director class '%s' is abstract, abstract method '%s' is not accesible, maybe due to multiple inheritance or 'nodirector' feature\n",
+ "Director class '%s' is abstract, abstract method '%s' is not accessible, maybe due to multiple inheritance or 'nodirector' feature\n",
SwigType_namestr(Getattr(n, "name")), Getattr(dirabstract, "name"));
} else {
Swig_warning(WARN_LANG_DIRECTOR_ABSTRACT, Getfile(n), Getline(n),
diff --git a/Source/Modules/lua.cxx b/Source/Modules/lua.cxx
index 80ea47f3f..188b11c2b 100644
--- a/Source/Modules/lua.cxx
+++ b/Source/Modules/lua.cxx
@@ -141,7 +141,7 @@ private:
// This variable holds the name of the current class in Lua. Usually it is
// the same as C++ class name, but rename directives can change it.
String *proxy_class_name;
- // This is a so calld fully qualified symname - the above proxy class name
+ // This is a so called fully qualified symname - the above proxy class name
// prepended with class namespace. If class Lua name is the same as class C++ name,
// then it is basically C++ fully qualified name with colons replaced with dots.
String *full_proxy_class_name;
@@ -1359,7 +1359,7 @@ public:
String *rt = Copy(getClassType());
SwigType_add_pointer(rt);
- // Adding class to apropriate namespace
+ // Adding class to appropriate namespace
registerClass(nspace, wrap_class_name);
Hash *nspaceHash = getCArraysHash(nspace);
@@ -1461,7 +1461,7 @@ public:
assert(proxy_class_name);
assert(full_proxy_class_name);
- // Then print class isntance part
+ // Then print class instance part
Printv(f_wrappers, "static swig_lua_class *swig_", mangled_full_proxy_class_name, "_bases[] = {", base_class, "0};\n", NIL);
Delete(base_class);
Printv(f_wrappers, "static const char *swig_", mangled_full_proxy_class_name, "_base_names[] = {", base_class_names, "0};\n", NIL);
@@ -1755,7 +1755,7 @@ public:
*
* This is to convert the string of Lua code into a proper string, which can then be
* emitted into the C/C++ code.
- * Basically is is a lot of search & replacing of odd sequences
+ * Basically it is a lot of search & replacing of odd sequences
* ---------------------------------------------------------------------------- */
void escapeCode(String *str) {
@@ -1770,7 +1770,7 @@ public:
/* -----------------------------------------------------------------------------
* rawGetCArraysHash(String *name)
*
- * A small helper to hide impelementation of how CArrays hashes are stored
+ * A small helper to hide implementation of how CArrays hashes are stored
* ---------------------------------------------------------------------------- */
Hash *rawGetCArraysHash(const_String_or_char_ptr name) {
@@ -2110,7 +2110,7 @@ public:
// variable in resulting file
getCArraysHash(0);
}
- // Because we cant access directly 'symtabs', instead we access
+ // Because we can't directly access 'symtabs', instead we access
// top-level scope and look on all scope pseudo-symbols in it.
Hash *top_scope = symbolScopeLookup("");
assert(top_scope);
@@ -2193,7 +2193,7 @@ public:
String *luaCurrentSymbolNSpace() {
String *scope = 0;
- // If ouside class, than NSpace is used.
+ // If outside class, than NSpace is used.
// If inside class, but current[NO_CPP], then this is friend function. It belongs to NSpace
if (!getCurrentClass() || current[NO_CPP]) {
scope = getNSpace();
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
index 12b83b2e4..72b765b40 100644
--- a/Source/Modules/main.cxx
+++ b/Source/Modules/main.cxx
@@ -23,6 +23,7 @@
#include "swigwarn.h"
#include "cparse.h"
#include <ctype.h>
+#include <errno.h>
#include <limits.h> // for INT_MAX
// Global variables
@@ -38,14 +39,15 @@ int NoExcept = 0;
int SwigRuntime = 0; // 0 = no option, 1 = -runtime, 2 = -noruntime
/* Suppress warning messages for private inheritance, preprocessor evaluation etc...
- WARN_PP_EVALUATION 202
- WARN_PARSE_PRIVATE_INHERIT 309
- WARN_TYPE_ABSTRACT 403
- WARN_LANG_OVERLOAD_CONST 512
- WARN_PARSE_BUILTIN_NAME 321
- WARN_PARSE_REDUNDANT 322
+ WARN_PP_EVALUATION 202
+ WARN_PARSE_PRIVATE_INHERIT 309
+ WARN_PARSE_BUILTIN_NAME 321
+ WARN_PARSE_REDUNDANT 322
+ WARN_TYPE_ABSTRACT 403
+ WARN_TYPE_RVALUE_REF_QUALIFIER_IGNORED 405
+ WARN_LANG_OVERLOAD_CONST 512
*/
-#define EXTRA_WARNINGS "202,309,403,512,321,322"
+#define EXTRA_WARNINGS "202,309,403,405,512,321,322"
extern "C" {
extern String *ModuleName;
@@ -64,7 +66,7 @@ static const char *usage1 = (const char *) "\
-copyctor - Automatically generate copy constructors wherever possible\n\
-cpperraswarn - Treat the preprocessor #error statement as #warning (default)\n\
-cppext <ext> - Change file extension of generated C++ files to <ext>\n\
- (default is cxx, except for PHP5 which uses cpp)\n\
+ (default is cxx)\n\
-copyright - Display copyright notices\n\
-debug-classes - Display information about the classes found in the interface\n\
-debug-module <n>- Display module parse tree at stages 1-4, <n> is a csv list of stages\n\
@@ -96,7 +98,7 @@ static const char *usage2 = (const char *) "\
-Fmicrosoft - Display error/warning messages in Microsoft format\n\
-Fstandard - Display error/warning messages in commonly used format\n\
-fvirtual - Compile in virtual elimination mode\n\
- -help - This output\n\
+ -help - Display help\n\
-I- - Don't search the current directory\n\
-I<dir> - Look for SWIG files in directory <dir>\n\
-ignoremissing - Ignore missing include files\n\
@@ -129,14 +131,14 @@ static const char *usage3 = (const char *) "\
";
static const char *usage4 = (const char *) "\
- -O - Enable the optimization options: \n\
- -fastdispatch -fvirtual \n\
+ -O - Enable the optimization options:\n\
+ -fastdispatch -fvirtual\n\
-o <outfile> - Set name of C/C++ output file to <outfile>\n\
-oh <headfile> - Set name of C++ output header file for directors to <headfile>\n\
-outcurrentdir - Set default output dir to current dir instead of input file's path\n\
-outdir <dir> - Set language specific files output directory to <dir>\n\
-pcreversion - Display PCRE version information\n\
- -small - Compile in virtual elimination & compact mode\n\
+ -small - Compile in virtual elimination and compact mode\n\
-swiglib - Report location of SWIG library and exit\n\
-templatereduce - Reduce all the typedefs in templates\n\
-v - Run in verbose mode\n\
@@ -154,10 +156,14 @@ Options can also be defined using the SWIG_FEATURES environment variable, for ex
$ export SWIG_FEATURES\n\
$ swig -python interface.i\n\
\n\
-is equivalent to: \n\
+is equivalent to:\n\
\n\
- $ swig -Wall -python interface.i \n\
+ $ swig -Wall -python interface.i\n\
\n\
+Arguments may also be passed in a file, separated by whitespace. For example:\n\
+\n\
+ $ echo \"-Wall -python interface.i\" > args.txt\n\
+ $ swig @args.txt\n\
\n";
// Local variables
@@ -454,7 +460,7 @@ static void SWIG_dump_runtime() {
SWIG_exit(EXIT_SUCCESS);
}
-void SWIG_getoptions(int argc, char *argv[]) {
+static void getoptions(int argc, char *argv[]) {
int i;
// Get options
for (i = 1; i < argc; i++) {
@@ -873,7 +879,7 @@ void SWIG_getoptions(int argc, char *argv[]) {
}
}
-int SWIG_main(int argc, char *argv[], Language *l) {
+int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) {
char *c;
/* Initialize the SWIG core */
@@ -885,7 +891,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
// Initialize the preprocessor
Preprocessor_init();
- lang = l;
+ // Set lang to a dummy value if no target language was specified so we
+ // can process options enough to handle -version, etc.
+ lang = tlm ? tlm->fac() : new Language;
// Set up some default symbols (available in both SWIG interface files
// and C files)
@@ -918,9 +926,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
Wrapper_director_protected_mode_set(1);
// Inform the parser if the nested classes should be ignored unless explicitly told otherwise via feature:flatnested
- ignore_nested_classes = l->nestedClassesSupport() == Language::NCS_Unknown ? 1 : 0;
+ ignore_nested_classes = lang->nestedClassesSupport() == Language::NCS_Unknown ? 1 : 0;
- kwargs_supported = l->kwargsSupport() ? 1 : 0;
+ kwargs_supported = lang->kwargsSupport() ? 1 : 0;
// Create Library search directories
@@ -949,7 +957,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
/* Check for SWIG_FEATURES environment variable */
- SWIG_getoptions(argc, argv);
+ getoptions(argc, argv);
// Define the __cplusplus symbol
if (CPlusPlus)
@@ -962,6 +970,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
Printf(stdout, "\nNote: 'swig -<lang> -help' displays options for a specific target language.\n\n");
SWIG_exit(EXIT_SUCCESS); // Exit if we're in help mode
}
+
// Check all of the options to make sure we're cool.
// Don't check for an input file if -external-runtime is passed
Swig_check_options(external_runtime ? 0 : 1);
@@ -1057,7 +1066,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
char *cfile = Char(input_file);
if (cfile && cfile[0] == '-') {
Printf(stderr, "Unable to find option or file '%s', ", input_file);
- Printf(stderr, "use 'swig -help' for more information.\n");
+ Printf(stderr, "Use 'swig -help' for more information.\n");
} else {
Printf(stderr, "Unable to find file '%s'.\n", input_file);
}
@@ -1066,6 +1075,13 @@ int SWIG_main(int argc, char *argv[], Language *l) {
Swig_warning(WARN_DEPRECATED_INPUT_FILE, "SWIG", 1, "Use of the include path to find the input file is deprecated and will not work with ccache. Please include the path when specifying the input file.\n"); // so that behaviour is like c/c++ compilers
}
}
+
+ if (!tlm) {
+ Printf(stderr, "No target language specified.\n");
+ Printf(stderr, "Use 'swig -help' for more information.\n");
+ SWIG_exit(EXIT_FAILURE);
+ }
+
if (!no_cpp) {
fclose(df);
Printf(fs, "%%include <swig.swg>\n");
@@ -1300,6 +1316,13 @@ int SWIG_main(int argc, char *argv[], Language *l) {
// Check the extension for a c/c++ file. If so, we're going to declare everything we see as "extern"
ForceExtern = check_extension(input_file);
+ if (tlm->status == Experimental) {
+ Swig_warning(WARN_LANG_EXPERIMENTAL, "SWIG", 1, "Experimental target language. "
+ "Target language %s specified by %s is an experimental language. "
+ "Please read about SWIG experimental languages, http://swig.org/Doc4.0/Introduction.html#Introduction_experimental_status.\n",
+ tlm->help ? tlm->help : "", tlm->name);
+ }
+
lang->top(top);
if (browse) {
@@ -1354,13 +1377,15 @@ int SWIG_main(int argc, char *argv[], Language *l) {
while (freeze) {
}
- if ((werror) && (Swig_warn_count())) {
- return Swig_warn_count();
- }
-
delete lang;
- return Swig_error_count();
+ int error_count = werror ? Swig_warn_count() : 0;
+ error_count += Swig_error_count();
+
+ if (error_count != 0)
+ SWIG_exit(error_count);
+
+ return 0;
}
/* -----------------------------------------------------------------------------
@@ -1372,5 +1397,20 @@ int SWIG_main(int argc, char *argv[], Language *l) {
void SWIG_exit(int exit_code) {
while (freeze) {
}
+
+ if (exit_code > 0) {
+ CloseAllOpenFiles();
+
+ /* Remove all generated files */
+ if (all_output_files) {
+ for (int i = 0; i < Len(all_output_files); i++) {
+ String *filename = Getitem(all_output_files, i);
+ int removed = remove(Char(filename));
+ if (removed == -1)
+ fprintf(stderr, "On exit, could not delete file %s: %s\n", Char(filename), strerror(errno));
+ }
+ }
+ }
+
exit(exit_code);
}
diff --git a/Source/Modules/modula3.cxx b/Source/Modules/modula3.cxx
index 9983e69d2..c606845ea 100644
--- a/Source/Modules/modula3.cxx
+++ b/Source/Modules/modula3.cxx
@@ -219,8 +219,8 @@ private:
String *module_baseclass; //inheritance for module class from %pragma
String *m3raw_interfaces; //interfaces for intermediary class class from %pragma
String *module_interfaces; //interfaces for module class from %pragma
- String *m3raw_class_modifiers; //class modifiers for intermediary class overriden by %pragma
- String *m3wrap_modifiers; //class modifiers for module class overriden by %pragma
+ String *m3raw_class_modifiers; //class modifiers for intermediary class overridden by %pragma
+ String *m3wrap_modifiers; //class modifiers for module class overridden by %pragma
String *upcasts_code; //C++ casts for inheritance hierarchies C++ code
String *m3raw_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code
String *destructor_call; //C++ destructor call if any
@@ -822,7 +822,7 @@ MODULA3():
Printf(file, "\n");
Printf(file, "int main (int argc, char *argv[]) {\n");
Printf(file, "\
-/*This progam must work for floating point numbers and integers.\n\
+/*This program must work for floating point numbers and integers.\n\
Thus all numbers are converted to double precision floating point format.*/\n");
scanConstant(file, n);
Printf(file, " return 0;\n");
@@ -3214,7 +3214,7 @@ MODULA3():
tm = Getattr(p, "tmap:m3wrapargvar");
if (tm != NIL) {
- /* exceptions that may be raised but can't be catched,
+ /* exceptions that may be raised but can't be caught,
thus we won't count them in num_exceptions */
addImports(m3wrap_impl.import, "m3wrapargvar", p);
addThrows(throws_hash, "m3wrapargvar", p);
diff --git a/Source/Modules/module.cxx b/Source/Modules/module.cxx
deleted file mode 100644
index aa48689ab..000000000
--- a/Source/Modules/module.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -----------------------------------------------------------------------------
- * This file is part of SWIG, which is licensed as a whole under version 3
- * (or any later version) of the GNU General Public License. Some additional
- * terms also apply to certain portions of SWIG. The full details of the SWIG
- * license and copyrights can be found in the LICENSE and COPYRIGHT files
- * included with the SWIG source code as distributed by the SWIG developers
- * and at http://www.swig.org/legal.html.
- *
- * module.cxx
- *
- * This file is responsible for the module system.
- * ----------------------------------------------------------------------------- */
-
-#include "swigmod.h"
-
-struct Module {
- ModuleFactory fac;
- char *name;
- Module *next;
- Module(const char *n, ModuleFactory f) {
- fac = f;
- name = new char[strlen(n) + 1];
- strcpy(name, n);
- next = 0;
- } ~Module() {
- delete[]name;
- }
-};
-
-static Module *modules = 0;
-
-/* -----------------------------------------------------------------------------
- * void Swig_register_module()
- *
- * Register a module.
- * ----------------------------------------------------------------------------- */
-
-void Swig_register_module(const char *n, ModuleFactory f) {
- Module *m = new Module(n, f);
- m->next = modules;
- modules = m;
-}
-
-/* -----------------------------------------------------------------------------
- * Language *Swig_find_module()
- *
- * Given a command line option, locates the factory function.
- * ----------------------------------------------------------------------------- */
-
-ModuleFactory Swig_find_module(const char *name) {
- Module *m = modules;
- while (m) {
- if (strcmp(m->name, name) == 0) {
- return m->fac;
- }
- m = m->next;
- }
- return 0;
-}
diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx
index dd3aecc40..788681330 100644
--- a/Source/Modules/mzscheme.cxx
+++ b/Source/Modules/mzscheme.cxx
@@ -17,12 +17,10 @@
static const char *usage = "\
Mzscheme Options (available with -mzscheme)\n\
- -declaremodule - Create extension that declares a module\n\
- -dynamic-load <library>,[library,...] - Do not link with these libraries, dynamic load\n\
- them\n\
- -noinit - Do not emit scheme_initialize, scheme_reload,\n\
- scheme_module_name functions\n\
- -prefix <name> - Set a prefix <name> to be prepended to all names\n\
+ -declaremodule - Create extension that declares a module\n\
+ -dynamic-load <lib>,[lib,...] - Do not link with these libraries, dynamic load them\n\
+ -noinit - Do not emit module initialization code\n\
+ -prefix <name> - Set a prefix <name> to be prepended to all names\n\
";
static String *fieldnames_tab = 0;
@@ -223,7 +221,6 @@ public:
Wrapper *f = NewWrapper();
String *proc_name = NewString("");
- String *source = NewString("");
String *target = NewString("");
String *arg = NewString("");
String *cleanup = NewString("");
@@ -314,10 +311,9 @@ public:
String *ln = Getattr(p, "lname");
// Produce names of source and target
- Clear(source);
Clear(target);
Clear(arg);
- Printf(source, "argv[%d]", i);
+ String *source = NewStringf("argv[%d]", i);
Printf(target, "%s", ln);
Printv(arg, Getattr(p, "name"), NIL);
@@ -341,6 +337,7 @@ public:
if (i >= numreq) {
Printf(f->code, "}\n");
}
+ Delete(source);
}
/* Insert constraint checking code */
@@ -439,9 +436,8 @@ public:
sprintf(temp, "%d", numargs);
if (exporting_destructor) {
Printf(init_func_def, "SWIG_TypeClientData(SWIGTYPE%s, (void *) %s);\n", swigtype_ptr, wname);
- } else {
- Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, wname, proc_name, numreq, numargs);
}
+ Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, wname, proc_name, numreq, numargs);
} else {
if (!Getattr(n, "sym:nextSibling")) {
/* Emit overloading dispatch function */
@@ -457,6 +453,7 @@ public:
Printv(df->def, "static Scheme_Object *\n", dname, "(int argc, Scheme_Object **argv) {", NIL);
Printv(df->code, dispatch, "\n", NIL);
Printf(df->code, "scheme_signal_error(\"No matching function for overloaded '%s'\");\n", iname);
+ Printf(df->code, "return NULL;\n", iname);
Printv(df->code, "}\n", NIL);
Wrapper_print(df, f_wrappers);
Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, dname, proc_name, 0, maxargs);
@@ -467,7 +464,6 @@ public:
}
Delete(proc_name);
- Delete(source);
Delete(target);
Delete(arg);
Delete(outarg);
@@ -528,7 +524,7 @@ public:
Replaceall(tm, "$source", "argv[0]");
Replaceall(tm, "$target", name);
Replaceall(tm, "$input", "argv[0]");
- /* Printv(f->code, tm, "\n",NIL); */
+ Replaceall(tm, "$argnum", "1");
emit_action_code(n, f->code, tm);
} else {
throw_unhandled_mzscheme_type_error(t);
@@ -765,7 +761,7 @@ public:
/* ------------------------------------------------------------
- * validIdentifer()
+ * validIdentifier()
* ------------------------------------------------------------ */
virtual int validIdentifier(String *s) {
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx
index 73dd14f96..6f2a34962 100644
--- a/Source/Modules/ocaml.cxx
+++ b/Source/Modules/ocaml.cxx
@@ -68,7 +68,7 @@ public:
director_prot_ctor_code = NewString("");
Printv(director_prot_ctor_code,
"if ( $comparison ) { /* subclassed */\n",
- " $director_new \n", "} else {\n", " failwith(\"accessing abstract class or protected constructor\"); \n", "}\n", NIL);
+ " $director_new \n", "} else {\n", " caml_failwith(\"accessing abstract class or protected constructor\"); \n", "}\n", NIL);
director_multiple_inheritance = 1;
director_language = 1;
}
@@ -167,6 +167,12 @@ public:
return declaration;
}
+ void emitBanner(File *f) {
+ Printf(f, "(* ----------------------------------------------------------------------------\n");
+ Swig_banner_target_lang(f, " *");
+ Printf(f, " * ---------------------------------------------------------------------------- *)\n\n");
+ }
+
/* ------------------------------------------------------------
* top()
*
@@ -196,6 +202,7 @@ public:
* use %module(directors="1") modulename at the start of the
* interface file to enable director generation.
*/
+ String *mod_docstring = NULL;
{
Node *module = Getattr(n, "module");
if (module) {
@@ -210,6 +217,7 @@ public:
if (Getattr(options, "sizeof")) {
generate_sizeof = 1;
}
+ mod_docstring = Getattr(options, "docstring");
}
}
}
@@ -310,9 +318,19 @@ public:
FileErrorDisplay(mlifilen);
SWIG_exit(EXIT_FAILURE);
}
+ emitBanner(f_mlout);
+ emitBanner(f_mliout);
Language::top(n);
+ if (mod_docstring) {
+ if (Len(mod_docstring)) {
+ Printv(f_mliout, "(** ", mod_docstring, " *)\n", NIL);
+ }
+ Delete(mod_docstring);
+ mod_docstring = NULL;
+ }
+
Printf(f_enum_to_int, ") | _ -> (C_int (get_int v))\n" "let _ = Callback.register \"%s_enum_to_int\" enum_to_int\n", module);
Printf(f_mlibody, "val enum_to_int : c_enum_type -> c_obj -> Swig.c_obj\n");
@@ -417,6 +435,29 @@ public:
return SwigType_isarray(SwigType_typedef_resolve_all(t));
}
+ virtual int membervariableHandler(Node *n) {
+ String *symname = Getattr(n, "sym:name");
+ Language::membervariableHandler(n);
+
+ String *mname = Swig_name_member(NSPACE_TODO, classname, symname);
+ String *getname = Swig_name_get(NSPACE_TODO, mname);
+ String *mangled_getname = mangleNameForCaml(getname);
+ Delete(getname);
+
+ if (!GetFlag(n, "feature:immutable")) {
+ String *setname = Swig_name_set(NSPACE_TODO, mname);
+ String *mangled_setname = mangleNameForCaml(setname);
+ Delete(setname);
+ Printf(f_class_ctors, " \"[%s]\", (fun args -> " "if args = (C_list [ raw_ptr ]) then _%s args else _%s args) ;\n", symname, mangled_getname, mangled_setname);
+ Delete(mangled_setname);
+ } else {
+ Printf(f_class_ctors, " \"[%s]\", (fun args -> " "if args = (C_list [ raw_ptr ]) then _%s args else C_void) ;\n", symname, mangled_getname);
+ }
+ Delete(mangled_getname);
+ Delete(mname);
+ return SWIG_OK;
+ }
+
/* ------------------------------------------------------------
* functionWrapper()
* Create a function declaration and register it with the interpreter.
@@ -432,7 +473,6 @@ public:
Wrapper *f = NewWrapper();
String *proc_name = NewString("");
- String *source = NewString("");
String *target = NewString("");
String *arg = NewString("");
String *cleanup = NewString("");
@@ -447,6 +487,8 @@ public:
int destructor = (!Cmp(nodeType, "destructor"));
String *overname = 0;
bool isOverloaded = Getattr(n, "sym:overloaded") ? true : false;
+ // For overloaded functions, only the dispatch function needs to be exposed in the ml and mli files.
+ bool expose_func = !isOverloaded || !Getattr(n, "sym:nextSibling");
// Make a wrapper name for this
String *wname = Swig_name_wrapper(iname);
@@ -470,33 +512,19 @@ public:
Printv(proc_name, "_", iname, NIL);
String *mangled_name = mangleNameForCaml(proc_name);
- if (classmode && in_constructor) { // Emit constructor for object
+ if (classmode && in_constructor && expose_func) { // Emit constructor for object
String *mangled_name_nounder = NewString((char *) (Char(mangled_name)) + 1);
Printf(f_class_ctors_end, "let %s clst = _%s clst\n", mangled_name_nounder, mangled_name_nounder);
Printf(f_mlibody, "val %s : c_obj -> c_obj\n", mangled_name_nounder);
Delete(mangled_name_nounder);
} else if (classmode && in_destructor) {
Printf(f_class_ctors, " \"~\", %s ;\n", mangled_name);
- } else if (classmode && !in_constructor && !in_destructor && !static_member_function) {
+ } else if (classmode && !in_constructor && !in_destructor && !static_member_function &&
+ !Getattr(n, "membervariableHandler:sym:name") && expose_func) {
String *opname = Copy(Getattr(n, "memberfunctionHandler:sym:name"));
Replaceall(opname, "operator ", "");
-
- if (strstr(Char(mangled_name), "__get__")) {
- String *set_name = Copy(mangled_name);
- if (!GetFlag(n, "feature:immutable")) {
- Replaceall(set_name, "__get__", "__set__");
- Printf(f_class_ctors, " \"%s\", (fun args -> " "if args = (C_list [ raw_ptr ]) then %s args else %s args) ;\n", opname, mangled_name, set_name);
- Delete(set_name);
- } else {
- Printf(f_class_ctors, " \"%s\", (fun args -> " "if args = (C_list [ raw_ptr ]) then %s args else C_void) ;\n", opname, mangled_name);
- }
- } else if (strstr(Char(mangled_name), "__set__")) {
- ; /* Nothing ... handled by the case above */
- } else {
- Printf(f_class_ctors, " \"%s\", %s ;\n", opname, mangled_name);
- }
-
+ Printf(f_class_ctors, " \"%s\", %s ;\n", opname, mangled_name);
Delete(opname);
}
@@ -515,16 +543,6 @@ public:
// adds local variables
Wrapper_add_local(f, "args", "CAMLparam1(args)");
Wrapper_add_local(f, "ret", "SWIG_CAMLlocal2(swig_result,rv)");
- Wrapper_add_local(f, "_v", "int _v = 0");
- if (isOverloaded) {
- Wrapper_add_local(f, "i", "int i");
- Wrapper_add_local(f, "argc", "int argc = caml_list_length(args)");
- Wrapper_add_local(f, "argv", "CAML_VALUE *argv");
-
- Printv(f->code,
- "argv = (CAML_VALUE *)malloc( argc * sizeof( CAML_VALUE ) );\n"
- "for( i = 0; i < argc; i++ ) {\n" " argv[i] = caml_list_nth(args,i);\n" "}\n", NIL);
- }
d = SwigType_typedef_qualified(d);
emit_parameter_variables(l, f);
@@ -534,7 +552,18 @@ public:
numargs = emit_num_arguments(l);
numreq = emit_num_required(l);
-
+ if (!isOverloaded) {
+ if (numargs > 0) {
+ if (numreq > 0) {
+ Printf(f->code, "if (caml_list_length(args) < %d || caml_list_length(args) > %d) {\n", numreq, numargs);
+ } else {
+ Printf(f->code, "if (caml_list_length(args) > %d) {\n", numargs);
+ }
+ Printf(f->code, "caml_invalid_argument(\"Incorrect number of arguments passed to '%s'\");\n}\n", iname);
+ } else {
+ Printf(f->code, "if (caml_list_length(args) > 0) caml_invalid_argument(\"'%s' takes no arguments\");\n", iname);
+ }
+ }
Printf(f->code, "swig_result = Val_unit;\n");
// Now write code to extract the parameters (this is super ugly)
@@ -550,10 +579,9 @@ public:
pt = SwigType_typedef_qualified(pt);
// Produce names of source and target
- Clear(source);
Clear(target);
Clear(arg);
- Printf(source, "caml_list_nth(args,%d)", i);
+ String *source = NewStringf("caml_list_nth(args,%d)", i);
Printf(target, "%s", ln);
Printv(arg, Getattr(p, "name"), NIL);
@@ -577,6 +605,7 @@ public:
if (i >= numreq) {
Printf(f->code, "}\n");
}
+ Delete(source);
}
/* Insert constraint checking code */
@@ -693,8 +722,6 @@ public:
// Wrap things up (in a manner of speaking)
Printv(f->code, tab4, "swig_result = caml_list_append(swig_result,rv);\n", NIL);
- if (isOverloaded)
- Printv(f->code, "free(argv);\n", NIL);
Printv(f->code, tab4, "CAMLreturn(swig_result);\n", NIL);
Printv(f->code, "}\n", NIL);
@@ -711,7 +738,6 @@ public:
"free(argv);\n" "CAMLreturn(%s(args));\n",
&maxargs);
- Wrapper_add_local(df, "_v", "int _v = 0");
Wrapper_add_local(df, "argv", "CAML_VALUE *argv");
/* Undifferentiate name .. this is the dispatch function */
@@ -725,8 +751,19 @@ public:
Printv(df->code,
"argv = (CAML_VALUE *)malloc( argc * sizeof( CAML_VALUE ) );\n"
"for( i = 0; i < argc; i++ ) {\n" " argv[i] = caml_list_nth(args,i);\n" "}\n", NIL);
- Printv(df->code, dispatch, "\n", NIL);
- Printf(df->code, "failwith(\"No matching function for overloaded '%s'\");\n", iname);
+ Printv(df->code, dispatch, "\nfree(argv);\n", NIL);
+ Node *sibl = n;
+ while (Getattr(sibl, "sym:previousSibling"))
+ sibl = Getattr(sibl, "sym:previousSibling");
+ String *protoTypes = NewString("");
+ do {
+ String *fulldecl = Swig_name_decl(sibl);
+ Printf(protoTypes, "\n\" %s\\n\"", fulldecl);
+ Delete(fulldecl);
+ } while ((sibl = Getattr(sibl, "sym:nextSibling")));
+ Printf(df->code, "caml_failwith(\"Wrong number or type of arguments for overloaded function '%s'.\\n\""
+ "\n\" Possible C/C++ prototypes are:\\n\"%s);\n", iname, protoTypes);
+ Delete(protoTypes);
Printv(df->code, "}\n", NIL);
Wrapper_print(df, f_wrappers);
@@ -735,19 +772,20 @@ public:
}
}
- Printf(f_mlbody,
- "external %s_f : c_obj list -> c_obj list = \"%s\" ;;\n"
- "let %s arg = match %s_f (fnhelper arg) with\n"
- " [] -> C_void\n"
- "| [x] -> (if %s then Gc.finalise \n"
- " (fun x -> ignore ((invoke x) \"~\" C_void)) x) ; x\n"
- "| lst -> C_list lst ;;\n", mangled_name, wname, mangled_name, mangled_name, newobj ? "true" : "false");
+ if (expose_func) {
+ Printf(f_mlbody, "external %s_f : c_obj list -> c_obj list = \"%s\" ;;\n", mangled_name, wname);
+ Printf(f_mlbody, "let %s arg = match %s_f (%s(fnhelper arg)) with\n", mangled_name, mangled_name,
+ in_constructor && Swig_directorclass(getCurrentClass()) ? "director_core_helper " : "");
+ Printf(f_mlbody, " [] -> C_void\n"
+ "| [x] -> (if %s then Gc.finalise \n"
+ " (fun x -> ignore ((invoke x) \"~\" C_void)) x) ; x\n"
+ "| lst -> C_list lst ;;\n", newobj ? "true" : "false");
+ }
- if (!classmode || in_constructor || in_destructor || static_member_function)
+ if ((!classmode || in_constructor || in_destructor || static_member_function) && expose_func)
Printf(f_mlibody, "val %s : c_obj -> c_obj\n", mangled_name);
Delete(proc_name);
- Delete(source);
Delete(target);
Delete(arg);
Delete(outarg);
@@ -761,10 +799,11 @@ public:
* variableWrapper()
*
* Create a link to a C variable.
- * This creates a single function _wrap_swig_var_varname().
+ * This creates a single function _wrap_varname().
* This function takes a single optional argument. If supplied, it means
* we are setting this variable to some value. If omitted, it means we are
- * simply evaluating this variable. In the set case we return C_void.
+ * simply evaluating this variable. We return the value of the variable
+ * in both cases.
*
* symname is the name of the variable with respect to C. This
* may need to differ from the original name in the case of enums.
@@ -780,9 +819,6 @@ public:
String *proc_name = NewString("");
String *tm;
- String *tm2 = NewString("");
- String *argnum = NewString("0");
- String *arg = NewString("SWIG_Field(args,0)");
Wrapper *f;
if (!name) {
@@ -802,14 +838,16 @@ public:
// evaluation function names
String *var_name = Swig_name_wrapper(iname);
- // Build the name for scheme.
+ // Build the name for OCaml.
Printv(proc_name, iname, NIL);
Setattr(n, "wrap:name", proc_name);
Printf(f->def, "SWIGEXT CAML_VALUE %s(CAML_VALUE args) {\n", var_name);
// Printv(f->def, "#define FUNC_NAME \"", proc_name, "\"", NIL);
- Wrapper_add_local(f, "swig_result", "CAML_VALUE swig_result");
+ Wrapper_add_local(f, "args", "CAMLparam1(args)");
+ Wrapper_add_local(f, "swig_result", "SWIG_CAMLlocal1(swig_result)");
+ Printf(f->code, "swig_result = Val_unit;\n");
if (!GetFlag(n, "feature:immutable")) {
/* Check for a setting of the variable value */
@@ -818,13 +856,12 @@ public:
Replaceall(tm, "$source", "args");
Replaceall(tm, "$target", name);
Replaceall(tm, "$input", "args");
- /* Printv(f->code, tm, "\n",NIL); */
emit_action_code(n, f->code, tm);
} else if ((tm = Swig_typemap_lookup("in", n, name, 0))) {
Replaceall(tm, "$source", "args");
Replaceall(tm, "$target", name);
Replaceall(tm, "$input", "args");
- Printv(f->code, tm, "\n", NIL);
+ emit_action_code(n, f->code, tm);
} else {
throw_unhandled_ocaml_type_error(t, "varin/in");
}
@@ -842,12 +879,12 @@ public:
Replaceall(tm, "$source", name);
Replaceall(tm, "$target", "swig_result");
Replaceall(tm, "$result", "swig_result");
- Printf(f->code, "%s\n", tm);
+ emit_action_code(n, f->code, tm);
} else {
throw_unhandled_ocaml_type_error(t, "varout/out");
}
- Printf(f->code, "\nreturn swig_result;\n");
+ Printf(f->code, "\nCAMLreturn(swig_result);\n");
Printf(f->code, "}\n");
Wrapper_print(f, f_wrappers);
@@ -868,9 +905,6 @@ public:
Delete(var_name);
Delete(proc_name);
- Delete(argnum);
- Delete(arg);
- Delete(tm2);
DelWrapper(f);
return SWIG_OK;
}
@@ -898,10 +932,9 @@ public:
virtual int constantWrapper(Node *n) {
String *name = Getattr(n, "feature:symname");
SwigType *type = Getattr(n, "type");
- String *value = Getattr(n, "value");
+ String *rawval = Getattr(n, "rawval");
+ String *value = rawval ? rawval : Getattr(n, "value");
SwigType *qname = Getattr(n, "qualified:name");
- String *rvalue = NewString("");
- String *temp = 0;
if (qname)
value = qname;
@@ -913,31 +946,8 @@ public:
}
// See if there's a typemap
- Printv(rvalue, value, NIL);
- if ((SwigType_type(type) == T_CHAR) && (is_a_pointer(type) == 1)) {
- temp = Copy(rvalue);
- Clear(rvalue);
- Printv(rvalue, "\"", temp, "\"", NIL);
- Delete(temp);
- }
- if ((SwigType_type(type) == T_CHAR) && (is_a_pointer(type) == 0)) {
- temp = Copy(rvalue);
- Clear(rvalue);
- Printv(rvalue, "'", temp, "'", NIL);
- Delete(temp);
- }
// Create variable and assign it a value
-
- Printf(f_header, "static %s = ", SwigType_lstr(type, name));
- bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
- if ((SwigType_type(type) == T_STRING)) {
- Printf(f_header, "\"%s\";\n", value);
- } else if (SwigType_type(type) == T_CHAR && !is_enum_item) {
- Printf(f_header, "\'%s\';\n", value);
- } else {
- Printf(f_header, "%s;\n", value);
- }
-
+ Printf(f_header, "static %s = %s;\n", SwigType_str(type, name), value);
SetFlag(n, "feature:immutable");
variableWrapper(n);
return SWIG_OK;
@@ -1104,11 +1114,12 @@ public:
int classHandler(Node *n) {
String *name = Getattr(n, "name");
+ classname = Getattr(n, "sym:name");
if (!name)
return SWIG_OK;
- String *mangled_sym_name = mangleNameForCaml(name);
+ String *mangled_name = mangleNameForCaml(name);
String *this_class_def = NewString(f_classtemplate);
String *name_normalized = normalizeTemplatedClassName(name);
String *old_class_ctors = f_class_ctors;
@@ -1117,7 +1128,6 @@ public:
bool sizeof_feature = generate_sizeof && isSimpleType(name);
- classname = mangled_sym_name;
classmode = true;
int rv = Language::classHandler(n);
classmode = false;
@@ -1125,15 +1135,15 @@ public:
if (sizeof_feature) {
Printf(f_wrappers,
"SWIGEXT CAML_VALUE _wrap_%s_sizeof( CAML_VALUE args ) {\n"
- " CAMLparam1(args);\n" " CAMLreturn(Val_int(sizeof(%s)));\n" "}\n", mangled_sym_name, name_normalized);
+ " CAMLparam1(args);\n" " CAMLreturn(Val_int(sizeof(%s)));\n" "}\n", mangled_name, name_normalized);
- Printf(f_mlbody, "external __%s_sizeof : unit -> int = " "\"_wrap_%s_sizeof\"\n", classname, mangled_sym_name);
+ Printf(f_mlbody, "external __%s_sizeof : unit -> int = " "\"_wrap_%s_sizeof\"\n", mangled_name, mangled_name);
}
/* Insert sizeof operator for concrete classes */
if (sizeof_feature) {
- Printv(f_class_ctors, "\"sizeof\" , (fun args -> C_int (__", classname, "_sizeof ())) ;\n", NIL);
+ Printv(f_class_ctors, "\"sizeof\" , (fun args -> C_int (__", mangled_name, "_sizeof ())) ;\n", NIL);
}
/* Handle up-casts in a nice way */
List *baselist = Getattr(n, "bases");
@@ -1152,7 +1162,7 @@ public:
}
}
- Replaceall(this_class_def, "$classname", classname);
+ Replaceall(this_class_def, "$classname", mangled_name);
Replaceall(this_class_def, "$normalized", name_normalized);
Replaceall(this_class_def, "$realname", name);
Replaceall(this_class_def, "$baselist", base_classes);
@@ -1165,7 +1175,7 @@ public:
Multiwrite(this_class_def);
- Setattr(n, "ocaml:ctor", classname);
+ Setattr(n, "ocaml:ctor", mangled_name);
return rv;
}
@@ -1404,8 +1414,7 @@ public:
pure_virtual = true;
}
}
-
- Wrapper_add_local(w, "swig_result", "CAMLparam0();\n" "SWIG_CAMLlocal2(swig_result,args)");
+ Printf(w->locals, "CAMLparam0();\n");
/* determine if the method returns a pointer */
is_pointer = SwigType_ispointer_return(decl);
@@ -1416,44 +1425,88 @@ public:
String *pclassname = NewStringf("SwigDirector_%s", classname);
String *qualified_name = NewStringf("%s::%s", pclassname, name);
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
- Printf(w->def, "%s {", target);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
+ Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
/* header declaration */
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
- Printf(declaration, " virtual %s;", target);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
+ Printf(declaration, " virtual %s", target);
Delete(target);
+ // Get any exception classes in the throws typemap
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
+ ParmList *throw_parm_list = 0;
+ if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
+ Parm *p;
+ int gencomma = 0;
+
+ Append(w->def, " throw(");
+ Append(declaration, " throw(");
+
+ if (throw_parm_list)
+ Swig_typemap_attach_parms("throws", throw_parm_list, 0);
+ for (p = throw_parm_list; p; p = nextSibling(p)) {
+ if (Getattr(p, "tmap:throws")) {
+ if (gencomma++) {
+ Append(w->def, ", ");
+ Append(declaration, ", ");
+ }
+ String *str = SwigType_str(Getattr(p, "type"), 0);
+ Append(w->def, str);
+ Append(declaration, str);
+ Delete(str);
+ }
+ }
+ Append(w->def, ")");
+ Append(declaration, ")");
+ }
+ Append(w->def, " {");
+ Append(declaration, ";\n");
/* declare method return value
* if the return value is a reference or const reference, a specialized typemap must
* handle it, including declaration of c_result ($result).
*/
- if (!is_void) {
- if (!(ignored_method && !pure_virtual)) {
- Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), NIL);
+ if (!is_void && (!ignored_method || pure_virtual)) {
+ if (!SwigType_isclass(returntype)) {
+ if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
+ String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
+ Delete(construct_result);
+ } else {
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
+ }
+ } else {
+ String *cres = SwigType_lstr(returntype, "c_result");
+ Printf(w->code, "%s;\n", cres);
+ Delete(cres);
}
}
if (ignored_method) {
if (!pure_virtual) {
- if (!is_void)
- Printf(w->code, "return ");
String *super_call = Swig_method_call(super, l);
- Printf(w->code, "%s;\n", super_call);
+ if (is_void)
+ Printf(w->code, "%s;\n", super_call);
+ else
+ Printf(w->code, "CAMLreturn_type(%s);\n", super_call);
Delete(super_call);
} else {
Printf(w->code, "Swig::DirectorPureVirtualException::raise(\"Attempted to invoke pure virtual method %s::%s\");\n", SwigType_namestr(c_classname),
SwigType_namestr(name));
}
} else {
+ Wrapper_add_local(w, "swig_result", "SWIG_CAMLlocal2(swig_result, args)");
/* attach typemaps to arguments (C/C++ -> Ocaml) */
String *arglist = NewString("");
Swig_director_parms_fixup(l);
Swig_typemap_attach_parms("in", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("directorargout", l, w);
Parm *p;
@@ -1563,10 +1616,12 @@ public:
/* wrap complex arguments to values */
Printv(w->code, wrap_args, NIL);
- /* pass the method call on to the Python object */
+ /* pass the method call on to the OCaml object */
Printv(w->code,
"swig_result = caml_swig_alloc(1,C_list);\n" "SWIG_Store_field(swig_result,0,args);\n" "args = swig_result;\n" "swig_result = Val_unit;\n", 0);
- Printf(w->code, "swig_result = " "callback3(*caml_named_value(\"swig_runmethod\")," "swig_get_self(),copy_string(\"%s\"),args);\n", Getattr(n, "name"));
+ Printf(w->code, "static CAML_VALUE *swig_ocaml_func_val = NULL;\n" "if (!swig_ocaml_func_val) {\n");
+ Printf(w->code, " swig_ocaml_func_val = caml_named_value(\"swig_runmethod\");\n }\n");
+ Printf(w->code, "swig_result = caml_callback3(*swig_ocaml_func_val,swig_get_self(),caml_copy_string(\"%s\"),args);\n", Getattr(n, "name"));
/* exception handling */
tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
if (!tm) {
@@ -1582,7 +1637,7 @@ public:
/*
* Python method may return a simple object, or a tuple.
- * for in/out aruments, we have to extract the appropriate values from the
+ * for in/out arguments, we have to extract the appropriate values from the
* argument list, then marshal everything back to C/C++ (return value and
* output arguments).
*/
@@ -1641,6 +1696,8 @@ public:
Printf(w->code, "CAMLreturn_type(*c_result);\n");
}
}
+ } else {
+ Printf(w->code, "CAMLreturn0;\n");
}
Printf(w->code, "}\n");
@@ -1706,7 +1763,7 @@ public:
Wrapper *w = NewWrapper();
String *call;
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, classname, parms, 0);
call = Swig_csuperclass_call(0, basetype, superparms);
Printf(w->def, "%s::%s: %s, Swig::Director(self) { }", classname, target, call);
Delete(target);
@@ -1717,7 +1774,7 @@ public:
/* constructor header */
{
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, classname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -1807,9 +1864,9 @@ public:
}
String *runtimeCode() {
- String *s = Swig_include_sys("ocaml.swg");
+ String *s = Swig_include_sys("ocamlrun.swg");
if (!s) {
- Printf(stderr, "*** Unable to open 'ocaml.swg'\n");
+ Printf(stderr, "*** Unable to open 'ocamlrun.swg'\n");
s = NewString("");
}
return s;
diff --git a/Source/Modules/octave.cxx b/Source/Modules/octave.cxx
index b977609a8..1297d2445 100644
--- a/Source/Modules/octave.cxx
+++ b/Source/Modules/octave.cxx
@@ -19,10 +19,8 @@ static String *op_prefix = 0;
static const char *usage = "\
Octave Options (available with -octave)\n\
- -cppcast - Enable C++ casting operators (default)\n\
-globals <name> - Set <name> used to access C global variables [default: 'cvar']\n\
Use '.' to load C global variables into module namespace\n\
- -nocppcast - Disable C++ casting operators\n\
-opprefix <str> - Prefix <str> for global operator functions [default: 'op_']\n\
\n";
@@ -92,8 +90,7 @@ public:
}
virtual void main(int argc, char *argv[]) {
- int cppcast = 1;
-
+
for (int i = 1; i < argc; i++) {
if (argv[i]) {
if (strcmp(argv[i], "-help") == 0) {
@@ -116,12 +113,13 @@ public:
} else {
Swig_arg_error();
}
- } else if (strcmp(argv[i], "-cppcast") == 0) {
- cppcast = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nocppcast") == 0) {
- cppcast = 0;
- Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-cppcast") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
+ Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-nocppcast") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
+ Swig_mark_arg(i);
+ SWIG_exit(EXIT_FAILURE);
}
}
}
@@ -130,8 +128,6 @@ public:
global_name = NewString("cvar");
if (!op_prefix)
op_prefix = NewString("op_");
- if(cppcast)
- Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
SWIG_library_directory("octave");
Preprocessor_define("SWIGOCTAVE 1", 0);
@@ -139,7 +135,7 @@ public:
SWIG_typemap_lang("octave");
allow_overloading();
- // Octave API is C++, so output must be C++ compatibile even when wrapping C code
+ // Octave API is C++, so output must be C++ compatible even when wrapping C code
if (!cparse_cplusplus)
Swig_cparse_cplusplusout(1);
}
@@ -422,13 +418,14 @@ public:
* The "lname" attribute in each parameter in plist will be contain a parameter name
* ----------------------------------------------------------------------------- */
- void addMissingParameterNames(ParmList *plist, int arg_offset) {
+ void addMissingParameterNames(Node* n, ParmList *plist, int arg_offset) {
Parm *p = plist;
int i = arg_offset;
while (p) {
if (!Getattr(p, "lname")) {
- String *pname = Swig_cparm_name(p, i);
- Delete(pname);
+ String *name = makeParameterName(n, p, i);
+ Setattr(p, "lname", name);
+ Delete(name);
}
i++;
p = nextSibling(p);
@@ -440,14 +437,14 @@ public:
ParmList *plist = CopyParmList(Getattr(n, "parms"));
Parm *p;
Parm *pnext;
- int start_arg_num = is_wrapping_class() ? 1 : 0;
+ int arg_num = is_wrapping_class() ? 1 : 0;
- addMissingParameterNames(plist, start_arg_num); // for $1_name substitutions done in Swig_typemap_attach_parms
+ addMissingParameterNames(n, plist, arg_num); // for $1_name substitutions done in Swig_typemap_attach_parms
Swig_typemap_attach_parms("in", plist, 0);
Swig_typemap_attach_parms("doc", plist, 0);
- for (p = plist; p; p = pnext) {
+ for (p = plist; p; p = pnext, arg_num++) {
String *tm = Getattr(p, "tmap:in");
if (tm) {
@@ -469,9 +466,10 @@ public:
value = Getattr(p, "tmap:doc:value");
}
- name = name ? name : Getattr(p, "name");
- name = name ? name : Getattr(p, "lname");
- name = Swig_name_make(p, 0, name, 0, 0); // rename parameter if a keyword
+ String *made_name = 0;
+ if (!name) {
+ name = made_name = makeParameterName(n, p, arg_num);
+ }
type = type ? type : Getattr(p, "type");
value = value ? value : Getattr(p, "value");
@@ -507,7 +505,7 @@ public:
Delete(type_str);
Delete(tex_name);
- Delete(name);
+ Delete(made_name);
}
if (pdocs)
Setattr(n, "feature:pdocs", pdocs);
@@ -1234,7 +1232,7 @@ public:
Wrapper *w = NewWrapper();
String *call;
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, classname, parms, 0);
call = Swig_csuperclass_call(0, basetype, superparms);
Printf(w->def, "%s::%s: %s," "\nSwig::Director(static_cast<%s*>(this)) { \n", classname, target, call, basetype);
Append(w->def, "}\n");
@@ -1246,7 +1244,7 @@ public:
// constructor header
{
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, classname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -1310,17 +1308,21 @@ public:
String *pclassname = NewStringf("SwigDirector_%s", classname);
String *qualified_name = NewStringf("%s::%s", pclassname, name);
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
// header declaration
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
Printf(declaration, " virtual %s", target);
Delete(target);
// Get any exception classes in the throws typemap
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
ParmList *throw_parm_list = 0;
if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
@@ -1355,11 +1357,19 @@ public:
// declare method return value
// if the return value is a reference or const reference, a specialized typemap must
// handle it, including declaration of c_result ($result).
- if (!is_void) {
- if (!(ignored_method && !pure_virtual)) {
- String *cres = SwigType_lstr(returntype, "c_result");
- Printf(w->code, "%s;\n", cres);
- Delete(cres);
+ if (!is_void && (!ignored_method || pure_virtual)) {
+ if (!SwigType_isclass(returntype)) {
+ if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
+ String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
+ Delete(construct_result);
+ } else {
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
+ }
+ } else {
+ String *cres = SwigType_lstr(returntype, "c_result");
+ Printf(w->code, "%s;\n", cres);
+ Delete(cres);
}
}
@@ -1381,7 +1391,7 @@ public:
Swig_director_parms_fixup(l);
Swig_typemap_attach_parms("in", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("directorargout", l, w);
Parm *p;
diff --git a/Source/Modules/overload.cxx b/Source/Modules/overload.cxx
index 330294efd..5d278107c 100644
--- a/Source/Modules/overload.cxx
+++ b/Source/Modules/overload.cxx
@@ -185,7 +185,8 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
nodes[j] = t;
break;
} else if ((differ == 0) && (Strcmp(t1, "0") == 0)) {
- t1 = Getattr(p1, "ltype");
+ t1 = Getattr(p1, "equivtype");
+ t1 = t1 ? t1 : Getattr(p1, "ltype");
if (!t1) {
t1 = SwigType_ltype(Getattr(p1, "type"));
if (Getattr(p1, "tmap:typecheck:SWIGTYPE")) {
@@ -193,7 +194,8 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
}
Setattr(p1, "ltype", t1);
}
- t2 = Getattr(p2, "ltype");
+ t2 = Getattr(p2, "equivtype");
+ t2 = t2 ? t2 : Getattr(p2, "ltype");
if (!t2) {
t2 = SwigType_ltype(Getattr(p2, "type"));
if (Getattr(p2, "tmap:typecheck:SWIGTYPE")) {
@@ -231,9 +233,21 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
}
if (!differ) {
/* See if declarations differ by const only */
- String *d1 = Getattr(nodes[i].n, "decl");
- String *d2 = Getattr(nodes[j].n, "decl");
- if (d1 && d2) {
+ String *decl1 = Getattr(nodes[i].n, "decl");
+ String *decl2 = Getattr(nodes[j].n, "decl");
+ if (decl1 && decl2) {
+ /* Remove ref-qualifiers. Note that rvalue ref-qualifiers are already ignored and
+ * it is illegal to overload a function with and without ref-qualifiers. So with
+ * all the combinations of ref-qualifiers and cv-qualifiers, we just detect
+ * the cv-qualifier (const) overloading. */
+ String *d1 = Copy(decl1);
+ String *d2 = Copy(decl2);
+ if (SwigType_isreference(d1) || SwigType_isrvalue_reference(d1)) {
+ Delete(SwigType_pop(d1));
+ }
+ if (SwigType_isreference(d2) || SwigType_isrvalue_reference(d2)) {
+ Delete(SwigType_pop(d2));
+ }
String *dq1 = Copy(d1);
String *dq2 = Copy(d2);
if (SwigType_isconst(d1)) {
@@ -428,7 +442,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
/* Loop over the functions */
- bool emitcheck = 1;
+ bool emitcheck = true;
for (i = 0; i < nfunc; i++) {
int fn = 0;
Node *ni = Getitem(dispatch, i);
@@ -504,7 +518,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
if (tml)
Replaceid(tml, Getattr(pl, "lname"), "_v");
if (!tml || Cmp(tm, tml))
- emitcheck = 1;
+ emitcheck = true;
//printf("tmap: %s[%d] (%d) => %s\n\n",
// Char(Getattr(nk, "sym:name")),
// l, emitcheck, tml?Char(tml):0);
@@ -596,7 +610,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
/*
Fast dispatch mechanism, provided by Salvador Fandi~no Garc'ia (#930586).
*/
-String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
+static String *overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *maxargs, const_String_or_char_ptr fmt_fastdispatch) {
int i, j;
*maxargs = 1;
@@ -639,6 +653,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
// printf("overload: %s coll=%d\n", Char(Getattr(n, "sym:name")), Len(coll));
+ bool emitcheck = false;
int num_braces = 0;
bool test = (Len(coll) > 0 && num_arguments);
if (test) {
@@ -659,7 +674,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
/* if all the wrappers have the same type check on this
argument we can optimize it out */
- bool emitcheck = 0;
+ emitcheck = false;
for (int k = 0; k < Len(coll) && !emitcheck; k++) {
Node *nk = Getitem(coll, k);
Parm *pk = Getattr(nk, "wrap:parms");
@@ -681,7 +696,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
if (tml)
Replaceid(tml, Getattr(pl, "lname"), "_v");
if (!tml || Cmp(tm, tml))
- emitcheck = 1;
+ emitcheck = true;
//printf("tmap: %s[%d] (%d) => %s\n\n",
// Char(Getattr(nk, "sym:name")),
// l, emitcheck, tml?Char(tml):0);
@@ -738,8 +753,8 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
for ( /* empty */ ; num_braces > 0; num_braces--)
Printf(f, "}\n");
-
- String *lfmt = ReplaceFormat(fmt, num_arguments);
+ // The language module may want to generate different code for last overloaded function called (with same number of arguments)
+ String *lfmt = ReplaceFormat(!emitcheck && fmt_fastdispatch ? fmt_fastdispatch : fmt, num_arguments);
Printf(f, Char(lfmt), Getattr(ni, "wrap:name"));
Printf(f, "}\n"); /* braces closes "if" for this method */
@@ -756,10 +771,10 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
return f;
}
-String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
+String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *maxargs, const_String_or_char_ptr fmt_fastdispatch) {
if (fast_dispatch_mode || GetFlag(n, "feature:fastdispatch")) {
- return Swig_overload_dispatch_fast(n, fmt, maxargs);
+ return overload_dispatch_fast(n, fmt, maxargs, fmt_fastdispatch);
}
int i, j;
diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx
index 406568b16..dfa85f3c8 100644
--- a/Source/Modules/perl5.cxx
+++ b/Source/Modules/perl5.cxx
@@ -16,11 +16,9 @@
#include <ctype.h>
static const char *usage = "\
-Perl5 Options (available with -perl5)\n\
+Perl 5 Options (available with -perl5)\n\
-compat - Compatibility mode\n\
-const - Wrap constants as constants and not variables (implies -proxy)\n\
- -cppcast - Enable C++ casting operators\n\
- -nocppcast - Disable C++ casting operators, useful for generating bugs\n\
-nopm - Do not generate the .pm file\n\
-noproxy - Don't create proxy classes\n\
-proxy - Create proxy classes\n\
@@ -148,7 +146,6 @@ public:
virtual void main(int argc, char *argv[]) {
int i = 1;
- int cppcast = 1;
SWIG_library_directory("perl5");
@@ -189,25 +186,22 @@ public:
} else if (strcmp(argv[i],"-v") == 0) {
Swig_mark_arg(i);
verbose++;
- } else if (strcmp(argv[i], "-cppcast") == 0) {
- cppcast = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nocppcast") == 0) {
- cppcast = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-compat") == 0) {
compat = 1;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-help") == 0) {
fputs(usage, stdout);
+ } else if (strcmp(argv[i], "-cppcast") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
+ Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-nocppcast") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
+ Swig_mark_arg(i);
+ SWIG_exit(EXIT_FAILURE);
}
}
}
- if (cppcast) {
- Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
- }
-
Preprocessor_define("SWIGPERL 1", 0);
// SWIGPERL5 is deprecated, and no longer documented.
Preprocessor_define("SWIGPERL5 1", 0);
@@ -900,6 +894,15 @@ public:
Printf(f->code, "%s\n", tm);
}
+ if (director_method) {
+ if ((tm = Swig_typemap_lookup("directorfree", n, Swig_cresult_name(), 0))) {
+ Replaceall(tm, "$input", Swig_cresult_name());
+ Replaceall(tm, "$result", "ST(argvi)");
+ Printf(f->code, "%s\n", tm);
+ Delete(tm);
+ }
+ }
+
Printv(f->code, "XSRETURN(argvi);\n", "fail:\n", cleanup, "SWIG_croak_null();\n" "}\n" "}\n", NIL);
/* Add the dXSARGS last */
@@ -2018,7 +2021,7 @@ public:
Wrapper *w = NewWrapper();
String *call;
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, classname, parms, 0);
call = Swig_csuperclass_call(0, basetype, superparms);
Printf(w->def, "%s::%s: %s, Swig::Director(self) { \n", classname, target, call);
Printf(w->def, " SWIG_DIRECTOR_RGTR((%s *)this, this); \n", basetype);
@@ -2031,7 +2034,7 @@ public:
/* constructor header */
{
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, classname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -2080,16 +2083,20 @@ public:
String *pclassname = NewStringf("SwigDirector_%s", classname);
String *qualified_name = NewStringf("%s::%s", pclassname, name);
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
/* header declaration */
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
Printf(declaration, " virtual %s", target);
Delete(target);
// Get any exception classes in the throws typemap
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
ParmList *throw_parm_list = 0;
if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
@@ -2125,17 +2132,26 @@ public:
* if the return value is a reference or const reference, a specialized typemap must
* handle it, including declaration of c_result ($result).
*/
- if (!is_void) {
- if (!(ignored_method && !pure_virtual)) {
+ if (!is_void && (!ignored_method || pure_virtual)) {
+ if (!SwigType_isclass(returntype)) {
+ if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
+ String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
+ Delete(construct_result);
+ } else {
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
+ }
+ } else {
String *cres = SwigType_lstr(returntype, "c_result");
Printf(w->code, "%s;\n", cres);
Delete(cres);
}
- if (!ignored_method) {
- String *pres = NewStringf("SV *%s", Swig_cresult_name());
- Wrapper_add_local(w, Swig_cresult_name(), pres);
- Delete(pres);
- }
+ }
+
+ if (!is_void && !ignored_method) {
+ String *pres = NewStringf("SV *%s", Swig_cresult_name());
+ Wrapper_add_local(w, Swig_cresult_name(), pres);
+ Delete(pres);
}
if (ignored_method) {
@@ -2158,7 +2174,7 @@ public:
/* remove the wrapper 'w' since it was producing spurious temps */
Swig_typemap_attach_parms("in", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("directorargout", l, w);
Wrapper_add_local(w, "SP", "dSP");
@@ -2332,7 +2348,7 @@ public:
/*
* Python method may return a simple object, or a tuple.
- * for in/out aruments, we have to extract the appropriate PyObjects from the tuple,
+ * for in/out arguments, we have to extract the appropriate PyObjects from the tuple,
* then marshal everything back to C/C++ (return value and output arguments).
*
*/
@@ -2486,9 +2502,12 @@ public:
Delete(mangle);
Delete(ptype);
- if (Getattr(n, "throw")) {
- Printf(f_directors_h, " virtual ~%s() throw ();\n", DirectorClassName);
- Printf(f_directors, "%s::~%s() throw () {%s}\n\n", DirectorClassName, DirectorClassName, body);
+ if (Getattr(n, "noexcept")) {
+ Printf(f_directors_h, " virtual ~%s() noexcept;\n", DirectorClassName);
+ Printf(f_directors, "%s::~%s() noexcept {%s}\n\n", DirectorClassName, DirectorClassName, body);
+ } else if (Getattr(n, "throw")) {
+ Printf(f_directors_h, " virtual ~%s() throw();\n", DirectorClassName);
+ Printf(f_directors, "%s::~%s() throw() {%s}\n\n", DirectorClassName, DirectorClassName, body);
} else {
Printf(f_directors_h, " virtual ~%s();\n", DirectorClassName);
Printf(f_directors, "%s::~%s() {%s}\n\n", DirectorClassName, DirectorClassName, body);
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx
index 295039ba1..1edbd874c 100644
--- a/Source/Modules/php.cxx
+++ b/Source/Modules/php.cxx
@@ -12,7 +12,7 @@
* -----------------------------------------------------------------------------
*/
-/* FIXME: PHP5 OO wrapping TODO list:
+/* FIXME: PHP OO wrapping TODO list:
*
* Medium term:
*
@@ -43,7 +43,7 @@
#include <errno.h>
static const char *usage = "\
-PHP Options (available with -php7)\n\
+PHP 7 Options (available with -php7)\n\
-noproxy - Don't generate proxy classes.\n\
-prefix <prefix> - Prepend <prefix> to all class names in PHP wrappers\n\
\n";
@@ -96,6 +96,7 @@ static String *all_cs_entry;
static String *pragma_incl;
static String *pragma_code;
static String *pragma_phpinfo;
+static String *pragma_version;
static String *s_oowrappers;
static String *s_fakeoowrappers;
static String *s_phpclasses;
@@ -141,7 +142,7 @@ static void SwigPHP_emit_resource_registrations() {
ki = First(zend_types);
if (ki.key)
- Printf(s_oinit, "\n/* Register resource destructors for pointer types */\n");
+ Printf(s_oinit, "\n /* Register resource destructors for pointer types */\n");
while (ki.key) {
DOH *key = ki.key;
Node *class_node = ki.item;
@@ -179,11 +180,11 @@ static void SwigPHP_emit_resource_registrations() {
Printf(s_vdecl, "static int le_swig_%s=0; /* handle for %s */\n", key, human_name);
// register with php
- Printf(s_oinit, "le_swig_%s=zend_register_list_destructors_ex"
+ Printf(s_oinit, " le_swig_%s=zend_register_list_destructors_ex"
"(%s, NULL, SWIGTYPE%s->name, module_number);\n", key, rsrc_dtor_name, key);
// store php type in class struct
- Printf(s_oinit, "SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key);
+ Printf(s_oinit, " SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key);
Delete(rsrc_dtor_name);
@@ -271,8 +272,8 @@ public:
/* subsections of the init section */
s_vinit = NewStringEmpty();
s_vdecl = NewString("/* vdecl subsection */\n");
- s_cinit = NewString("/* cinit subsection */\n");
- s_oinit = NewString("/* oinit subsection */\n");
+ s_cinit = NewString(" /* cinit subsection */\n");
+ s_oinit = NewString(" /* oinit subsection */\n");
pragma_phpinfo = NewStringEmpty();
s_phpclasses = NewString("/* PHP Proxy Classes */\n");
f_directors_h = NewStringEmpty();
@@ -359,10 +360,11 @@ public:
/* sub-sections of the php file */
pragma_code = NewStringEmpty();
pragma_incl = NewStringEmpty();
+ pragma_version = NULL;
/* Initialize the rest of the module */
- Printf(s_oinit, "ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, NULL);\n", module, module);
+ Printf(s_oinit, " ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, NULL);\n", module, module);
/* start the header section */
Printf(s_header, "ZEND_BEGIN_MODULE_GLOBALS(%s)\n", module);
@@ -370,8 +372,8 @@ public:
Printf(s_header, "int error_code;\n");
Printf(s_header, "ZEND_END_MODULE_GLOBALS(%s)\n", module);
Printf(s_header, "ZEND_DECLARE_MODULE_GLOBALS(%s)\n", module);
- Printf(s_header, "#define SWIG_ErrorMsg() (%s_globals.error_msg)\n", module);
- Printf(s_header, "#define SWIG_ErrorCode() (%s_globals.error_code)\n", module);
+ Printf(s_header, "#define SWIG_ErrorMsg() ZEND_MODULE_GLOBALS_ACCESSOR(%s, error_msg)\n", module);
+ Printf(s_header, "#define SWIG_ErrorCode() ZEND_MODULE_GLOBALS_ACCESSOR(%s, error_code)\n", module);
/* The following can't go in Lib/php/phprun.swg as it uses SWIG_ErrorMsg(), etc
* which has to be dynamically generated as it depends on the module name.
@@ -515,7 +517,11 @@ public:
} else {
Printf(s_init, " NULL, /* No MINFO code */\n");
}
- Printf(s_init, " NO_VERSION_YET,\n");
+ if (Len(pragma_version) > 0) {
+ Printf(s_init, " \"%s\",\n", pragma_version);
+ } else {
+ Printf(s_init, " NO_VERSION_YET,\n");
+ }
Printf(s_init, " STANDARD_MODULE_PROPERTIES\n");
Printf(s_init, "};\n");
Printf(s_init, "zend_module_entry* SWIG_module_entry = &%s_module_entry;\n\n", module);
@@ -524,7 +530,7 @@ public:
Printf(s_init, "extern \"C\" {\n");
Printf(s_init, "#endif\n");
// We want to write "SWIGEXPORT ZEND_GET_MODULE(%s)" but ZEND_GET_MODULE
- // in PHP5 has "extern "C" { ... }" around it so we can't do that.
+ // in PHP7 has "extern "C" { ... }" around it so we can't do that.
Printf(s_init, "SWIGEXPORT zend_module_entry *get_module(void) { return &%s_module_entry; }\n", module);
Printf(s_init, "#ifdef __cplusplus\n");
Printf(s_init, "}\n");
@@ -543,17 +549,17 @@ public:
// Printv(s_init,s_resourcetypes,NIL);
/* We need this after all classes written out by ::top */
- Printf(s_oinit, "CG(active_class_entry) = NULL;\n");
- Printf(s_oinit, "/* end oinit subsection */\n");
+ Printf(s_oinit, " CG(active_class_entry) = NULL;\n");
+ Printf(s_oinit, " /* end oinit subsection */\n");
Printf(s_init, "%s\n", s_oinit);
/* Constants generated during top call */
- Printf(s_cinit, "/* end cinit subsection */\n");
+ Printf(s_cinit, " /* end cinit subsection */\n");
Printf(s_init, "%s\n", s_cinit);
Clear(s_cinit);
Delete(s_cinit);
- Printf(s_init, " return SUCCESS;\n");
+ Printf(s_init, " return SUCCESS;\n");
Printf(s_init, "}\n\n");
// Now do REQUEST init which holds any user specified %rinit, and also vinit
@@ -571,15 +577,15 @@ public:
if (Len(s_vinit) > 0) {
/* finish our init section which will have been used by class wrappers */
Printv(s_init,
- "/* vinit subsection */\n",
+ " /* vinit subsection */\n",
s_vinit, "\n"
- "/* end vinit subsection */\n",
+ " /* end vinit subsection */\n",
NIL);
Clear(s_vinit);
}
Delete(s_vinit);
- Printf(s_init, " return SUCCESS;\n");
+ Printf(s_init, " return SUCCESS;\n");
Printf(s_init, "}\n\n");
}
@@ -592,7 +598,7 @@ public:
"/* shutdown section */\n"
"{\n",
s_shutdown,
- " return SUCCESS;\n"
+ " return SUCCESS;\n"
"}\n\n", NIL);
}
@@ -670,7 +676,7 @@ public:
Delete(s_fakeoowrappers);
s_fakeoowrappers = NULL;
}
- Printf(f_phpcode, "%s\n?>\n", s_phpclasses);
+ Printf(f_phpcode, "%s\n", s_phpclasses);
Delete(f_phpcode);
return SWIG_OK;
@@ -973,7 +979,7 @@ public:
/* Insert argument output code */
bool hasargout = false;
for (i = 0, p = l; p; i++) {
- if ((tm = Getattr(p, "tmap:argout"))) {
+ if ((tm = Getattr(p, "tmap:argout")) && Len(tm)) {
hasargout = true;
Replaceall(tm, "$source", Getattr(p, "lname"));
// Replaceall(tm,"$input",Getattr(p,"lname"));
@@ -1090,11 +1096,11 @@ public:
if (constructor) {
class_has_ctor = true;
// Skip the Foo:: prefix.
- char *ptr = strrchr(GetChar(Swig_methodclass(n), "sym:name"), ':');
+ char *ptr = strrchr(GetChar(current_class, "sym:name"), ':');
if (ptr) {
ptr++;
} else {
- ptr = GetChar(Swig_methodclass(n), "sym:name");
+ ptr = GetChar(current_class, "sym:name");
}
if (strcmp(ptr, GetChar(n, "constructorHandler:sym:name")) == 0) {
methodname = "__construct";
@@ -1217,7 +1223,7 @@ public:
/* FIXME: How should this be handled? The rest of SWIG just seems
* to not bother checking for malloc failing! */
fprintf(stderr, "Malloc failed!\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
for (i = 0; i < max_num_of_arguments; ++i) {
arg_names[i] = NULL;
@@ -1229,7 +1235,7 @@ public:
/* FIXME: How should this be handled? The rest of SWIG just seems
* to not bother checking for malloc failing! */
fprintf(stderr, "Malloc failed!\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
for (i = 0; i < max_num_of_arguments; ++i) {
arg_values[i] = NULL;
@@ -1456,14 +1462,6 @@ public:
/* We need $this to refer to the current class, so can't allow it
* to be used as a parameter. */
Setattr(seen, "this", seen);
- /* We use $r to store the return value, so disallow that as a parameter
- * name in case the user uses the "call-time pass-by-reference" feature
- * (it's deprecated and off by default in PHP5, but we want to be
- * maximally portable). Similarly we use $c for the classname or new
- * stdClass object.
- */
- Setattr(seen, "r", seen);
- Setattr(seen, "c", seen);
for (int argno = 0; argno < max_num_of_arguments; ++argno) {
String *&pname = arg_names[argno];
@@ -1511,7 +1509,7 @@ public:
Replaceall(value, "$", "\\$");
}
Printf(args, "$%s=%s", arg_names[i], value);
- } else if (constructor && i >= 1 && i < min_num_of_arguments) {
+ } else if (constructor && strcmp(methodname, "__construct") == 0 && i >= 1 && i < min_num_of_arguments) {
// We need to be able to call __construct($resource).
Printf(args, "$%s=null", arg_names[i]);
} else {
@@ -1568,13 +1566,15 @@ public:
Printf(prepare, "case %d: ", ++last_handled_i);
}
if (non_void_return) {
- if ((!directorsEnabled() || !Swig_directorclass(n)) && !newobject) {
+ if ((!directorsEnabled() || !Swig_directorclass(n)) && !constructor) {
+ Append(prepare, "$r=");
+ } else if (wrapperType == staticmemberfn || wrapperType == staticmembervar) {
Append(prepare, "$r=");
} else {
Printf(prepare, "$this->%s=", SWIG_PTR);
}
}
- if (!directorsEnabled() || !Swig_directorclass(n) || !newobject) {
+ if (!directorsEnabled() || !Swig_directorclass(n) || !constructor) {
Printf(prepare, "%s(%s); break;\n", iname, invoke_args);
} else if (!i) {
Printf(prepare, "%s($_this%s); break;\n", iname, invoke_args);
@@ -1590,14 +1590,16 @@ public:
if (had_a_case)
Printf(prepare, "default: ");
if (non_void_return) {
- if ((!directorsEnabled() || !Swig_directorclass(n)) && !newobject) {
+ if ((!directorsEnabled() || !Swig_directorclass(n)) && !constructor) {
+ Append(prepare, "$r=");
+ } else if (wrapperType == staticmemberfn || wrapperType == staticmembervar) {
Append(prepare, "$r=");
} else {
Printf(prepare, "$this->%s=", SWIG_PTR);
}
}
- if (!directorsEnabled() || !Swig_directorclass(n) || !newobject) {
+ if (!directorsEnabled() || !Swig_directorclass(n) || !constructor) {
Printf(prepare, "%s(%s);\n", iname, invoke_args);
} else {
Printf(prepare, "%s($_this, %s);\n", iname, invoke_args);
@@ -1665,20 +1667,33 @@ public:
}
if (constructor) {
- const char * arg0;
+ // Discriminate between the PHP constructor and a C++ constructor
+ // renamed to become a factory function in PHP.
+ bool php_constructor = (strcmp(methodname, "__construct") == 0);
+ const char * arg0 = NULL;
if (max_num_of_arguments > 0) {
arg0 = Char(arg_names[0]);
- } else {
+ } else if (php_constructor) {
+ // The PHP constructor needs to be able to wrap a resource, but a
+ // renamed constructor doesn't.
arg0 = "res";
Delete(args);
args = NewString("$res=null");
}
String *mangled_type = SwigType_manglestr(Getattr(n, "type"));
+ if (!php_constructor) {
+ // A renamed constructor should be a static method.
+ Append(acc, "static ");
+ }
Printf(output, "\t%sfunction %s(%s) {\n", acc, methodname, args);
- Printf(output, "\t\tif (is_resource($%s) && get_resource_type($%s) === '%s') {\n", arg0, arg0, mangled_type);
- Printf(output, "\t\t\t$this->%s=$%s;\n", SWIG_PTR, arg0);
- Printf(output, "\t\t\treturn;\n");
- Printf(output, "\t\t}\n");
+ if (php_constructor) {
+ // The PHP constructor needs to be able to wrap a resource, but a
+ // renamed constructor doesn't.
+ Printf(output, "\t\tif (is_resource($%s) && get_resource_type($%s) === '%s') {\n", arg0, arg0, mangled_type);
+ Printf(output, "\t\t\t$this->%s=$%s;\n", SWIG_PTR, arg0);
+ Printf(output, "\t\t\treturn;\n");
+ Printf(output, "\t\t}\n");
+ }
} else {
Printf(output, "\t%sfunction %s(%s) {\n", acc, methodname, args);
}
@@ -1707,7 +1722,7 @@ public:
Printf(output, "\tstatic function %s(%s) {\n", methodname, args);
}
- if (!newobject)
+ if (!constructor)
Printf(output, "%s", prepare);
if (constructor) {
if (!directorsEnabled() || !Swig_directorclass(n)) {
@@ -1835,7 +1850,7 @@ public:
Delete(wrapobj);
}
} else {
- if (non_void_return) {
+ if (non_void_return || hasargout) {
Printf(output, "\t\treturn %s;\n", invoke);
} else if (Cmp(invoke, "$r") != 0) {
Printf(output, "\t\t%s;\n", invoke);
@@ -1994,7 +2009,7 @@ done:
String *type = Getattr(n, "name");
String *value = Getattr(n, "value");
- if (Strcmp(lang, "php") == 0 || Strcmp(lang, "php4") == 0) {
+ if (Strcmp(lang, "php") == 0) {
if (Strcmp(type, "code") == 0) {
if (value) {
Printf(pragma_code, "%s\n", value);
@@ -2007,6 +2022,10 @@ done:
if (value) {
Printf(pragma_phpinfo, "%s\n", value);
}
+ } else if (Strcmp(type, "version") == 0) {
+ if (value) {
+ pragma_version = value;
+ }
} else {
Swig_warning(WARN_PHP_UNKNOWN_PRAGMA, input_file, line_number, "Unrecognized pragma <%s>.\n", type);
}
@@ -2193,7 +2212,6 @@ done:
}
Printf(s_phpclasses, "\t}\n");
- /* Create __isset for PHP 5.1 and later; PHP 5.0 will just ignore it. */
/* __isset() should return true for read-only properties, so check for
* *_get() not *_set(). */
Printf(s_phpclasses, "\n\tfunction __isset($var) {\n");
@@ -2464,7 +2482,7 @@ done:
String *call;
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, classname, parms, 0);
call = Swig_csuperclass_call(0, basetype, superparms);
Printf(w->def, "%s::%s: %s, Swig::Director(self) {", classname, target, call);
Append(w->def, "}");
@@ -2476,7 +2494,7 @@ done:
/* constructor header */
{
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, classname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -2520,16 +2538,20 @@ done:
String *pclassname = NewStringf("SwigDirector_%s", classname);
String *qualified_name = NewStringf("%s::%s", pclassname, name);
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
/* header declaration */
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
Printf(declaration, " virtual %s", target);
Delete(target);
// Get any exception classes in the throws typemap
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
ParmList *throw_parm_list = 0;
if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
@@ -2565,8 +2587,16 @@ done:
* if the return value is a reference or const reference, a specialized typemap must
* handle it, including declaration of c_result ($result).
*/
- if (!is_void) {
- if (!(ignored_method && !pure_virtual)) {
+ if (!is_void && (!ignored_method || pure_virtual)) {
+ if (!SwigType_isclass(returntype)) {
+ if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
+ String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
+ Delete(construct_result);
+ } else {
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
+ }
+ } else {
String *cres = SwigType_lstr(returntype, "c_result");
Printf(w->code, "%s;\n", cres);
Delete(cres);
@@ -2592,7 +2622,7 @@ done:
/* remove the wrapper 'w' since it was producing spurious temps */
Swig_typemap_attach_parms("in", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("directorargout", l, w);
Parm *p;
diff --git a/Source/Modules/php5.cxx b/Source/Modules/php5.cxx
deleted file mode 100644
index bf3ce4fa4..000000000
--- a/Source/Modules/php5.cxx
+++ /dev/null
@@ -1,2858 +0,0 @@
-/* -----------------------------------------------------------------------------
- * This file is part of SWIG, which is licensed as a whole under version 3
- * (or any later version) of the GNU General Public License. Some additional
- * terms also apply to certain portions of SWIG. The full details of the SWIG
- * license and copyrights can be found in the LICENSE and COPYRIGHT files
- * included with the SWIG source code as distributed by the SWIG developers
- * and at http://www.swig.org/legal.html.
- *
- * php5.cxx
- *
- * PHP5 language module for SWIG.
- * -----------------------------------------------------------------------------
- */
-
-/* FIXME: PHP5 OO wrapping TODO list:
- *
- * Medium term:
- *
- * Handle default parameters on overloaded methods in PHP where possible.
- * (Mostly done - just need to handle cases of overloaded methods with
- * default parameters...)
- * This is an optimisation - we could handle this case using a PHP
- * default value, but currently we treat it as we would for a default
- * value which is a compound C++ expression (i.e. as if we had a
- * method with two overloaded forms instead of a single method with
- * a default parameter value).
- *
- * Long term:
- *
- * Sort out locale-dependent behaviour of strtod() - it's harmless unless
- * SWIG ever sets the locale and DOH/base.c calls atof, so we're probably
- * OK currently at least.
- */
-
-/*
- * TODO: Replace remaining stderr messages with Swig_error or Swig_warning
- * (may need to add more WARN_PHP_xxx codes...)
- */
-
-#include "swigmod.h"
-
-#include <ctype.h>
-#include <errno.h>
-
-static const char *usage = "\
-PHP5 Options (available with -php5)\n\
- -noproxy - Don't generate proxy classes.\n\
- -prefix <prefix> - Prepend <prefix> to all class names in PHP wrappers\n\
-\n";
-
-/* The original class wrappers for PHP stored the pointer to the C++ class in
- * the object property _cPtr. If we use the same name for the member variable
- * which we put the pointer to the C++ class in, then the flat function
- * wrappers will automatically pull it out without any changes being required.
- * FIXME: Isn't using a leading underscore a bit suspect here?
- */
-#define SWIG_PTR "_cPtr"
-
-/* This is the name of the hash where the variables existing only in PHP
- * classes are stored.
- */
-#define SWIG_DATA "_pData"
-
-static int constructors = 0;
-static String *NOTCLASS = NewString("Not a class");
-static Node *classnode = 0;
-static String *module = 0;
-static String *cap_module = 0;
-static String *prefix = 0;
-
-static String *shadow_classname = 0;
-
-static File *f_begin = 0;
-static File *f_runtime = 0;
-static File *f_runtime_h = 0;
-static File *f_h = 0;
-static File *f_phpcode = 0;
-static File *f_directors = 0;
-static File *f_directors_h = 0;
-static String *phpfilename = 0;
-
-static String *s_header;
-static String *s_wrappers;
-static String *s_init;
-static String *r_init; // RINIT user code
-static String *s_shutdown; // MSHUTDOWN user code
-static String *r_shutdown; // RSHUTDOWN user code
-static String *s_vinit; // varinit initialization code.
-static String *s_vdecl;
-static String *s_cinit; // consttab initialization code.
-static String *s_oinit;
-static String *s_arginfo;
-static String *s_entry;
-static String *cs_entry;
-static String *all_cs_entry;
-static String *pragma_incl;
-static String *pragma_code;
-static String *pragma_phpinfo;
-static String *s_oowrappers;
-static String *s_fakeoowrappers;
-static String *s_phpclasses;
-
-/* To reduce code size (generated and compiled) we only want to emit each
- * different arginfo once, so we need to track which have been used.
- */
-static Hash *arginfo_used;
-
-/* Variables for using PHP classes */
-static Node *current_class = 0;
-
-static Hash *shadow_get_vars;
-static Hash *shadow_set_vars;
-static Hash *zend_types = 0;
-
-static int shadow = 1;
-
-static bool class_has_ctor = false;
-static String *wrapping_member_constant = NULL;
-
-// These static variables are used to pass some state from Handlers into functionWrapper
-static enum {
- standard = 0,
- memberfn,
- staticmemberfn,
- membervar,
- staticmembervar,
- constructor,
- directorconstructor
-} wrapperType = standard;
-
-extern "C" {
- static void (*r_prevtracefunc) (const SwigType *t, String *mangled, String *clientdata) = 0;
-}
-
-static void SwigPHP_emit_resource_registrations() {
- Iterator ki;
- bool emitted_default_dtor = false;
-
- if (!zend_types)
- return;
-
- ki = First(zend_types);
- if (ki.key)
- Printf(s_oinit, "\n/* Register resource destructors for pointer types */\n");
- while (ki.key) {
- DOH *key = ki.key;
- Node *class_node = ki.item;
- String *human_name = key;
- String *rsrc_dtor_name = NULL;
-
- // write out body
- if (class_node != NOTCLASS) {
- String *destructor = Getattr(class_node, "destructor");
- human_name = Getattr(class_node, "sym:name");
- if (!human_name)
- human_name = Getattr(class_node, "name");
- // Do we have a known destructor for this type?
- if (destructor) {
- rsrc_dtor_name = NewStringf("_wrap_destroy%s", key);
- // Write out custom destructor function
- Printf(s_wrappers, "static ZEND_RSRC_DTOR_FUNC(%s) {\n", rsrc_dtor_name);
- Printf(s_wrappers, " %s(rsrc, SWIGTYPE%s->name TSRMLS_CC);\n", destructor, key);
- Printf(s_wrappers, "}\n");
- }
- }
-
- if (!rsrc_dtor_name) {
- rsrc_dtor_name = NewString("_swig_default_rsrc_destroy");
- if (!emitted_default_dtor) {
- // Write out custom destructor function
- Printf(s_wrappers, "static ZEND_RSRC_DTOR_FUNC(%s) {\n", rsrc_dtor_name);
- Printf(s_wrappers, " efree(rsrc->ptr);\n");
- Printf(s_wrappers, "}\n");
- emitted_default_dtor = true;
- }
- }
-
- // declare le_swig_<mangled> to store php registration
- Printf(s_vdecl, "static int le_swig_%s=0; /* handle for %s */\n", key, human_name);
-
- // register with php
- Printf(s_oinit, "le_swig_%s=zend_register_list_destructors_ex"
- "(%s, NULL, (char *)SWIGTYPE%s->name, module_number);\n", key, rsrc_dtor_name, key);
-
- // store php type in class struct
- Printf(s_oinit, "SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key);
-
- Delete(rsrc_dtor_name);
-
- ki = Next(ki);
- }
-}
-
-class PHP5 : public Language {
- String *emit_action(Node *n) {
- // Adjust wrap:action to add TSRMLS_CC.
- String * action = Getattr(n, "wrap:action");
- if (action) {
- char * p = Strstr(action, "Swig::DirectorPureVirtualException::raise(\"");
- if (p) {
- p += strlen("Swig::DirectorPureVirtualException::raise(\"");
- p = strchr(p, '"');
- if (p) {
- ++p;
- Insert(action, (int)(p - Char(action)), " TSRMLS_CC");
- }
- }
- }
- return ::emit_action(n);
- }
-
-public:
- PHP5() {
- director_language = 1;
- }
-
- /* ------------------------------------------------------------
- * main()
- * ------------------------------------------------------------ */
-
- virtual void main(int argc, char *argv[]) {
- SWIG_library_directory("php5");
- SWIG_config_cppext("cpp");
-
- for (int i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-prefix") == 0) {
- if (argv[i + 1]) {
- prefix = NewString(argv[i + 1]);
- Swig_mark_arg(i);
- Swig_mark_arg(i + 1);
- i++;
- } else {
- Swig_arg_error();
- }
- } else if ((strcmp(argv[i], "-noshadow") == 0) || (strcmp(argv[i], "-noproxy") == 0)) {
- shadow = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-help") == 0) {
- fputs(usage, stdout);
- } else if (strcmp(argv[i], "-make") == 0 ||
- strcmp(argv[i], "-withc") == 0 ||
- strcmp(argv[i], "-withcxx") == 0) {
- Printf(stderr, "*** %s is no longer supported.\n", argv[i]);
- SWIG_exit(EXIT_FAILURE);
- } else if (strcmp(argv[i], "-phpfull") == 0 ||
- strcmp(argv[i], "-withlibs") == 0 ||
- strcmp(argv[i], "-withincs") == 0) {
- Printf(stderr, "*** %s is no longer supported.\n*** We recommend building as a dynamically loadable module.\n", argv[i]);
- SWIG_exit(EXIT_FAILURE);
- } else if (strcmp(argv[i], "-dlname") == 0) {
- Printf(stderr, "*** -dlname is no longer supported.\n*** If you want to change the module name, use -module instead.\n");
- SWIG_exit(EXIT_FAILURE);
- }
- }
-
- Preprocessor_define("SWIGPHP 1", 0);
- // SWIGPHP5 is deprecated, and no longer documented.
- Preprocessor_define("SWIGPHP5 1", 0);
- SWIG_typemap_lang("php");
- SWIG_config_file("php.swg");
- allow_overloading();
- }
-
- /* ------------------------------------------------------------
- * top()
- * ------------------------------------------------------------ */
-
- virtual int top(Node *n) {
-
- String *filen;
-
- /* Check if directors are enabled for this module. */
- Node *mod = Getattr(n, "module");
- if (mod) {
- Node *options = Getattr(mod, "options");
- if (options && Getattr(options, "directors")) {
- allow_directors();
- }
- }
-
- /* Set comparison with null for ConstructorToFunction */
- setSubclassInstanceCheck(NewString("$arg->type != IS_NULL"));
-
- /* Initialize all of the output files */
- String *outfile = Getattr(n, "outfile");
- String *outfile_h = Getattr(n, "outfile_h");
-
- /* main output file */
- f_begin = NewFile(outfile, "w", SWIG_output_files());
- if (!f_begin) {
- FileErrorDisplay(outfile);
- SWIG_exit(EXIT_FAILURE);
- }
- f_runtime = NewStringEmpty();
-
- /* sections of the output file */
- s_init = NewString("/* init section */\n");
- r_init = NewString("/* rinit section */\n");
- s_shutdown = NewString("/* shutdown section */\n");
- r_shutdown = NewString("/* rshutdown section */\n");
- s_header = NewString("/* header section */\n");
- s_wrappers = NewString("/* wrapper section */\n");
- /* subsections of the init section */
- s_vinit = NewString("/* vinit subsection */\n");
- s_vdecl = NewString("/* vdecl subsection */\n");
- s_cinit = NewString("/* cinit subsection */\n");
- s_oinit = NewString("/* oinit subsection */\n");
- pragma_phpinfo = NewStringEmpty();
- s_phpclasses = NewString("/* PHP Proxy Classes */\n");
- f_directors_h = NewStringEmpty();
- f_directors = NewStringEmpty();
-
- if (directorsEnabled()) {
- f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files());
- if (!f_runtime_h) {
- FileErrorDisplay(outfile_h);
- SWIG_exit(EXIT_FAILURE);
- }
- }
-
- /* Register file targets with the SWIG file handler */
- Swig_register_filebyname("begin", f_begin);
- Swig_register_filebyname("runtime", f_runtime);
- Swig_register_filebyname("init", s_init);
- Swig_register_filebyname("rinit", r_init);
- Swig_register_filebyname("shutdown", s_shutdown);
- Swig_register_filebyname("rshutdown", r_shutdown);
- Swig_register_filebyname("header", s_header);
- Swig_register_filebyname("wrapper", s_wrappers);
- Swig_register_filebyname("director", f_directors);
- Swig_register_filebyname("director_h", f_directors_h);
-
- Swig_banner(f_begin);
-
- Printf(f_runtime, "\n\n#ifndef SWIGPHP\n#define SWIGPHP\n#endif\n\n");
-
- if (directorsEnabled()) {
- Printf(f_runtime, "#define SWIG_DIRECTORS\n");
- }
-
- /* Set the module name */
- module = Copy(Getattr(n, "name"));
- cap_module = NewStringf("%(upper)s", module);
- if (!prefix)
- prefix = NewStringEmpty();
-
- Printf(f_runtime, "#define SWIG_PREFIX \"%s\"\n", prefix);
- Printf(f_runtime, "#define SWIG_PREFIX_LEN %lu\n", (unsigned long)Len(prefix));
-
- if (directorsEnabled()) {
- Swig_banner(f_directors_h);
- Printf(f_directors_h, "\n");
- Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", cap_module);
- Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", cap_module);
-
- String *filename = Swig_file_filename(outfile_h);
- Printf(f_directors, "\n#include \"%s\"\n\n", filename);
- Delete(filename);
- }
-
- /* PHP module file */
- filen = NewStringEmpty();
- Printv(filen, SWIG_output_directory(), module, ".php", NIL);
- phpfilename = NewString(filen);
-
- f_phpcode = NewFile(filen, "w", SWIG_output_files());
- if (!f_phpcode) {
- FileErrorDisplay(filen);
- SWIG_exit(EXIT_FAILURE);
- }
-
- Printf(f_phpcode, "<?php\n\n");
-
- Swig_banner(f_phpcode);
-
- Printf(f_phpcode, "\n");
- Printf(f_phpcode, "// Try to load our extension if it's not already loaded.\n");
- Printf(f_phpcode, "if (!extension_loaded('%s')) {\n", module);
- Printf(f_phpcode, " if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {\n");
- Printf(f_phpcode, " if (!dl('php_%s.dll')) return;\n", module);
- Printf(f_phpcode, " } else {\n");
- Printf(f_phpcode, " // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.\n");
- Printf(f_phpcode, " if (PHP_SHLIB_SUFFIX === 'dylib') {\n");
- Printf(f_phpcode, " if (!dl('%s.so')) return;\n", module);
- Printf(f_phpcode, " } else {\n");
- Printf(f_phpcode, " if (!dl('%s.'.PHP_SHLIB_SUFFIX)) return;\n", module);
- Printf(f_phpcode, " }\n");
- Printf(f_phpcode, " }\n");
- Printf(f_phpcode, "}\n\n");
-
- /* sub-sections of the php file */
- pragma_code = NewStringEmpty();
- pragma_incl = NewStringEmpty();
-
- /* Initialize the rest of the module */
-
- Printf(s_oinit, "ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, NULL);\n", module, module);
-
- /* start the header section */
- Printf(s_header, "ZEND_BEGIN_MODULE_GLOBALS(%s)\n", module);
- Printf(s_header, "const char *error_msg;\n");
- Printf(s_header, "int error_code;\n");
- Printf(s_header, "ZEND_END_MODULE_GLOBALS(%s)\n", module);
- Printf(s_header, "ZEND_DECLARE_MODULE_GLOBALS(%s)\n", module);
- Printf(s_header, "#ifdef ZTS\n");
- Printf(s_header, "#define SWIG_ErrorMsg() TSRMG(%s_globals_id, zend_%s_globals *, error_msg )\n", module, module);
- Printf(s_header, "#define SWIG_ErrorCode() TSRMG(%s_globals_id, zend_%s_globals *, error_code )\n", module, module);
- Printf(s_header, "#else\n");
- Printf(s_header, "#define SWIG_ErrorMsg() (%s_globals.error_msg)\n", module);
- Printf(s_header, "#define SWIG_ErrorCode() (%s_globals.error_code)\n", module);
- Printf(s_header, "#endif\n\n");
-
- /* The following can't go in Lib/php/phprun.swg as it uses SWIG_ErrorMsg(), etc
- * which has to be dynamically generated as it depends on the module name.
- */
- Append(s_header, "#ifdef __GNUC__\n");
- Append(s_header, "static void SWIG_FAIL(TSRMLS_D) __attribute__ ((__noreturn__));\n");
- Append(s_header, "#endif\n\n");
- Append(s_header, "static void SWIG_FAIL(TSRMLS_D) {\n");
- Append(s_header, " zend_error(SWIG_ErrorCode(), \"%s\", SWIG_ErrorMsg());\n");
- // zend_error() should never return with the parameters we pass, but if it
- // does, we really don't want to let SWIG_FAIL() return. This also avoids
- // a warning about returning from a function marked as "__noreturn__".
- Append(s_header, " abort();\n");
- Append(s_header, "}\n\n");
-
- Printf(s_header, "static void %s_init_globals(zend_%s_globals *globals ) {\n", module, module);
- Printf(s_header, " globals->error_msg = default_error_msg;\n");
- Printf(s_header, " globals->error_code = default_error_code;\n");
- Printf(s_header, "}\n");
-
- Printf(s_header, "static void SWIG_ResetError(TSRMLS_D) {\n");
- Printf(s_header, " SWIG_ErrorMsg() = default_error_msg;\n");
- Printf(s_header, " SWIG_ErrorCode() = default_error_code;\n");
- Printf(s_header, "}\n");
-
- Append(s_header, "\n");
- Printf(s_header, "ZEND_NAMED_FUNCTION(_wrap_swig_%s_alter_newobject) {\n", module);
- Append(s_header, " zval **args[2];\n");
- Append(s_header, " swig_object_wrapper *value;\n");
- Append(s_header, " int type;\n");
- Append(s_header, "\n");
- Append(s_header, " SWIG_ResetError(TSRMLS_C);\n");
- Append(s_header, " if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {\n");
- Append(s_header, " WRONG_PARAM_COUNT;\n");
- Append(s_header, " }\n");
- Append(s_header, "\n");
- Append(s_header, " value = (swig_object_wrapper *) zend_list_find((*args[0])->value.lval, &type);\n");
- Append(s_header, " value->newobject = zval_is_true(*args[1]);\n");
- Append(s_header, "\n");
- Append(s_header, " return;\n");
- Append(s_header, "}\n");
- Printf(s_header, "ZEND_NAMED_FUNCTION(_wrap_swig_%s_get_newobject) {\n", module);
- Append(s_header, " zval **args[1];\n");
- Append(s_header, " swig_object_wrapper *value;\n");
- Append(s_header, " int type;\n");
- Append(s_header, "\n");
- Append(s_header, " SWIG_ResetError(TSRMLS_C);\n");
- Append(s_header, " if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {\n");
- Append(s_header, " WRONG_PARAM_COUNT;\n");
- Append(s_header, " }\n");
- Append(s_header, "\n");
- Append(s_header, " value = (swig_object_wrapper *) zend_list_find((*args[0])->value.lval, &type);\n");
- Append(s_header, " RETVAL_LONG(value->newobject);\n");
- Append(s_header, "\n");
- Append(s_header, " return;\n");
- Append(s_header, "}\n");
-
- Printf(s_header, "#define SWIG_name \"%s\"\n", module);
- Printf(s_header, "#ifdef __cplusplus\n");
- Printf(s_header, "extern \"C\" {\n");
- Printf(s_header, "#endif\n");
- Printf(s_header, "#include \"php.h\"\n");
- Printf(s_header, "#include \"php_ini.h\"\n");
- Printf(s_header, "#include \"ext/standard/info.h\"\n");
- Printf(s_header, "#include \"php_%s.h\"\n", module);
- Printf(s_header, "#ifdef __cplusplus\n");
- Printf(s_header, "}\n");
- Printf(s_header, "#endif\n\n");
-
- if (directorsEnabled()) {
- // Insert director runtime
- Swig_insert_file("director_common.swg", s_header);
- Swig_insert_file("director.swg", s_header);
- }
-
- /* Create the .h file too */
- filen = NewStringEmpty();
- Printv(filen, SWIG_output_directory(), "php_", module, ".h", NIL);
- f_h = NewFile(filen, "w", SWIG_output_files());
- if (!f_h) {
- FileErrorDisplay(filen);
- SWIG_exit(EXIT_FAILURE);
- }
-
- Swig_banner(f_h);
-
- Printf(f_h, "\n");
- Printf(f_h, "#ifndef PHP_%s_H\n", cap_module);
- Printf(f_h, "#define PHP_%s_H\n\n", cap_module);
- Printf(f_h, "extern zend_module_entry %s_module_entry;\n", module);
- Printf(f_h, "#define phpext_%s_ptr &%s_module_entry\n\n", module, module);
- Printf(f_h, "#ifdef PHP_WIN32\n");
- Printf(f_h, "# define PHP_%s_API __declspec(dllexport)\n", cap_module);
- Printf(f_h, "#else\n");
- Printf(f_h, "# define PHP_%s_API\n", cap_module);
- Printf(f_h, "#endif\n\n");
- Printf(f_h, "#ifdef ZTS\n");
- Printf(f_h, "#include \"TSRM.h\"\n");
- Printf(f_h, "#endif\n\n");
- Printf(f_h, "PHP_MINIT_FUNCTION(%s);\n", module);
- Printf(f_h, "PHP_MSHUTDOWN_FUNCTION(%s);\n", module);
- Printf(f_h, "PHP_RINIT_FUNCTION(%s);\n", module);
- Printf(f_h, "PHP_RSHUTDOWN_FUNCTION(%s);\n", module);
- Printf(f_h, "PHP_MINFO_FUNCTION(%s);\n\n", module);
-
- /* start the arginfo section */
- s_arginfo = NewString("/* arginfo subsection */\n");
- arginfo_used = NewHash();
-
- /* start the function entry section */
- s_entry = NewString("/* entry subsection */\n");
-
- /* holds all the per-class function entry sections */
- all_cs_entry = NewString("/* class entry subsection */\n");
- cs_entry = NULL;
-
- Printf(s_entry, "/* Every non-class user visible function must have an entry here */\n");
- Printf(s_entry, "static zend_function_entry %s_functions[] = {\n", module);
-
- /* start the init section */
- Append(s_init, "#if ZEND_MODULE_API_NO <= 20090626\n");
- Append(s_init, "#undef ZEND_MODULE_BUILD_ID\n");
- Append(s_init, "#define ZEND_MODULE_BUILD_ID (char*)\"API\" ZEND_TOSTR(ZEND_MODULE_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA\n");
- Append(s_init, "#endif\n");
- Printv(s_init, "zend_module_entry ", module, "_module_entry = {\n", NIL);
- Printf(s_init, " STANDARD_MODULE_HEADER,\n");
- Printf(s_init, " (char*)\"%s\",\n", module);
- Printf(s_init, " %s_functions,\n", module);
- Printf(s_init, " PHP_MINIT(%s),\n", module);
- Printf(s_init, " PHP_MSHUTDOWN(%s),\n", module);
- Printf(s_init, " PHP_RINIT(%s),\n", module);
- Printf(s_init, " PHP_RSHUTDOWN(%s),\n", module);
- Printf(s_init, " PHP_MINFO(%s),\n", module);
- Printf(s_init, " NO_VERSION_YET,\n");
- Printf(s_init, " STANDARD_MODULE_PROPERTIES\n");
- Printf(s_init, "};\n");
- Printf(s_init, "zend_module_entry* SWIG_module_entry = &%s_module_entry;\n\n", module);
-
- Printf(s_init, "#ifdef __cplusplus\n");
- Printf(s_init, "extern \"C\" {\n");
- Printf(s_init, "#endif\n");
- // We want to write "SWIGEXPORT ZEND_GET_MODULE(%s)" but ZEND_GET_MODULE
- // in PHP5 has "extern "C" { ... }" around it so we can't do that.
- Printf(s_init, "SWIGEXPORT zend_module_entry *get_module(void) { return &%s_module_entry; }\n", module);
- Printf(s_init, "#ifdef __cplusplus\n");
- Printf(s_init, "}\n");
- Printf(s_init, "#endif\n\n");
-
- /* We have to register the constants before they are (possibly) used
- * by the pointer typemaps. This all needs re-arranging really as
- * things are being called in the wrong order
- */
- Printf(s_init, "#define SWIG_php_minit PHP_MINIT_FUNCTION(%s)\n", module);
-
- /* Emit all of the code */
- Language::top(n);
-
- SwigPHP_emit_resource_registrations();
- // Printv(s_init,s_resourcetypes,NIL);
- /* We need this after all classes written out by ::top */
- Printf(s_oinit, "CG(active_class_entry) = NULL;\n");
- Printf(s_oinit, "/* end oinit subsection */\n");
- Printf(s_init, "%s\n", s_oinit);
-
- /* Constants generated during top call */
- Printf(s_cinit, "/* end cinit subsection */\n");
- Printf(s_init, "%s\n", s_cinit);
- Clear(s_cinit);
- Delete(s_cinit);
-
- Printf(s_init, " return SUCCESS;\n");
- Printf(s_init, "}\n\n");
-
- // Now do REQUEST init which holds any user specified %rinit, and also vinit
- Printf(s_init, "PHP_RINIT_FUNCTION(%s)\n{\n", module);
- Printf(s_init, "%s\n", r_init);
-
- /* finish our init section which will have been used by class wrappers */
- Printf(s_vinit, "/* end vinit subsection */\n");
- Printf(s_init, "%s\n", s_vinit);
- Clear(s_vinit);
- Delete(s_vinit);
-
- Printf(s_init, " return SUCCESS;\n");
- Printf(s_init, "}\n\n");
-
- Printv(s_init, "PHP_MSHUTDOWN_FUNCTION(", module, ")\n"
- "{\n",
- s_shutdown,
- "#ifdef ZTS\n"
- " ts_free_id(", module, "_globals_id);\n"
- "#endif\n"
- " return SUCCESS;\n"
- "}\n\n", NIL);
-
- Printf(s_init, "PHP_RSHUTDOWN_FUNCTION(%s)\n{\n", module);
- Printf(s_init, "%s\n", r_shutdown);
- Printf(s_init, " return SUCCESS;\n");
- Printf(s_init, "}\n\n");
-
- Printf(s_init, "PHP_MINFO_FUNCTION(%s)\n{\n", module);
- Printf(s_init, "%s", pragma_phpinfo);
- Printf(s_init, "}\n");
- Printf(s_init, "/* end init section */\n");
-
- Printf(f_h, "#endif /* PHP_%s_H */\n", cap_module);
-
- Delete(f_h);
-
- String *type_table = NewStringEmpty();
- SwigType_emit_type_table(f_runtime, type_table);
- Printf(s_header, "%s", type_table);
- Delete(type_table);
-
- /* Oh dear, more things being called in the wrong order. This whole
- * function really needs totally redoing.
- */
-
- if (directorsEnabled()) {
- Dump(f_directors_h, f_runtime_h);
- Printf(f_runtime_h, "\n");
- Printf(f_runtime_h, "#endif\n");
- Delete(f_runtime_h);
- }
-
- Printf(s_header, "/* end header section */\n");
- Printf(s_wrappers, "/* end wrapper section */\n");
- Printf(s_vdecl, "/* end vdecl subsection */\n");
-
- Dump(f_runtime, f_begin);
- Printv(f_begin, s_header, NIL);
- if (directorsEnabled()) {
- Dump(f_directors, f_begin);
- }
- Printv(f_begin, s_vdecl, s_wrappers, NIL);
- Printv(f_begin, all_cs_entry, "\n\n", s_arginfo, "\n\n", s_entry,
- " SWIG_ZEND_NAMED_FE(swig_", module, "_alter_newobject,_wrap_swig_", module, "_alter_newobject,NULL)\n"
- " SWIG_ZEND_NAMED_FE(swig_", module, "_get_newobject,_wrap_swig_", module, "_get_newobject,NULL)\n"
- " ZEND_FE_END\n};\n\n", NIL);
- Printv(f_begin, s_init, NIL);
- Delete(s_header);
- Delete(s_wrappers);
- Delete(s_init);
- Delete(s_vdecl);
- Delete(all_cs_entry);
- Delete(s_entry);
- Delete(s_arginfo);
- Delete(f_runtime);
- Delete(f_begin);
- Delete(arginfo_used);
-
- Printf(f_phpcode, "%s\n%s\n", pragma_incl, pragma_code);
- if (s_fakeoowrappers) {
- Printf(f_phpcode, "abstract class %s {", Len(prefix) ? prefix : module);
- Printf(f_phpcode, "%s", s_fakeoowrappers);
- Printf(f_phpcode, "}\n\n");
- Delete(s_fakeoowrappers);
- s_fakeoowrappers = NULL;
- }
- Printf(f_phpcode, "%s\n?>\n", s_phpclasses);
- Delete(f_phpcode);
-
- return SWIG_OK;
- }
-
- /* Just need to append function names to function table to register with PHP. */
- void create_command(String *cname, String *iname, Node *n) {
- // This is for the single main zend_function_entry record
- Printf(f_h, "ZEND_NAMED_FUNCTION(%s);\n", iname);
-
- // We want to only emit each different arginfo once, as that reduces the
- // size of both the generated source code and the compiled extension
- // module. To do this, we name the arginfo to encode the number of
- // parameters and which (if any) are passed by reference by using a
- // sequence of 0s (for non-reference) and 1s (for by references).
- ParmList *l = Getattr(n, "parms");
- String * arginfo_code = NewStringEmpty();
- for (Parm *p = l; p; p = Getattr(p, "tmap:in:next")) {
- /* Ignored parameters */
- if (checkAttribute(p, "tmap:in:numinputs", "0")) {
- continue;
- }
- Append(arginfo_code, GetFlag(p, "tmap:in:byref") ? "1" : "0");
- }
-
- if (!GetFlag(arginfo_used, arginfo_code)) {
- // Not had this one before, so emit it.
- SetFlag(arginfo_used, arginfo_code);
- Printf(s_arginfo, "ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_%s, 0, 0, 0)\n", arginfo_code);
- for (const char * p = Char(arginfo_code); *p; ++p) {
- Printf(s_arginfo, " ZEND_ARG_PASS_INFO(%c)\n", *p);
- }
- Printf(s_arginfo, "ZEND_END_ARG_INFO()\n");
- }
-
- String * s = cs_entry;
- if (!s) s = s_entry;
- Printf(s, " SWIG_ZEND_NAMED_FE(%(lower)s,%s,swig_arginfo_%s)\n", cname, iname, arginfo_code);
- Delete(arginfo_code);
- }
-
- /* ------------------------------------------------------------
- * dispatchFunction()
- * ------------------------------------------------------------ */
- void dispatchFunction(Node *n) {
- /* Last node in overloaded chain */
-
- int maxargs;
- String *tmp = NewStringEmpty();
- if (Swig_directorclass(n) && wrapperType == directorconstructor) {
- /* We have an extra 'this' parameter. */
- SetFlag(n, "wrap:this");
- }
- String *dispatch = Swig_overload_dispatch(n, "%s(INTERNAL_FUNCTION_PARAM_PASSTHRU); return;", &maxargs);
-
- /* Generate a dispatch wrapper for all overloaded functions */
-
- Wrapper *f = NewWrapper();
- String *symname = Getattr(n, "sym:name");
- String *wname = Swig_name_wrapper(symname);
-
- create_command(symname, wname, n);
- Printv(f->def, "ZEND_NAMED_FUNCTION(", wname, ") {\n", NIL);
-
- Wrapper_add_local(f, "argc", "int argc");
-
- Printf(tmp, "zval **argv[%d]", maxargs);
- Wrapper_add_local(f, "argv", tmp);
-
- Printf(f->code, "argc = ZEND_NUM_ARGS();\n");
-
- Printf(f->code, "zend_get_parameters_array_ex(argc,argv);\n");
-
- Replaceall(dispatch, "$args", "self,args");
-
- Printv(f->code, dispatch, "\n", NIL);
-
- Printf(f->code, "SWIG_ErrorCode() = E_ERROR;\n");
- Printf(f->code, "SWIG_ErrorMsg() = \"No matching function for overloaded '%s'\";\n", symname);
- Printv(f->code, "SWIG_FAIL(TSRMLS_C);\n", NIL);
-
- Printv(f->code, "}\n", NIL);
- Wrapper_print(f, s_wrappers);
-
- DelWrapper(f);
- Delete(dispatch);
- Delete(tmp);
- Delete(wname);
- }
-
- /* ------------------------------------------------------------
- * functionWrapper()
- * ------------------------------------------------------------ */
-
- /* Helper method for PHP5::functionWrapper */
- bool is_class(SwigType *t) {
- Node *n = classLookup(t);
- if (n) {
- String *r = Getattr(n, "php:proxy"); // Set by classDeclaration()
- if (!r)
- r = Getattr(n, "sym:name"); // Not seen by classDeclaration yet, but this is the name
- if (r)
- return true;
- }
- return false;
- }
-
- virtual int functionWrapper(Node *n) {
- String *name = GetChar(n, "name");
- String *iname = GetChar(n, "sym:name");
- SwigType *d = Getattr(n, "type");
- ParmList *l = Getattr(n, "parms");
- String *nodeType = Getattr(n, "nodeType");
- int newobject = GetFlag(n, "feature:new");
- int constructor = (Cmp(nodeType, "constructor") == 0);
-
- Parm *p;
- int i;
- int numopt;
- String *tm;
- Wrapper *f;
-
- String *wname;
- int overloaded = 0;
- String *overname = 0;
-
- if (Cmp(nodeType, "destructor") == 0) {
- // We just generate the Zend List Destructor and let Zend manage the
- // reference counting. There's no explicit destructor, but the user can
- // just do `$obj = null;' to remove a reference to an object.
- return CreateZendListDestructor(n);
- }
- // Test for overloading;
- if (Getattr(n, "sym:overloaded")) {
- overloaded = 1;
- overname = Getattr(n, "sym:overname");
- } else {
- if (!addSymbol(iname, n))
- return SWIG_ERROR;
- }
-
- wname = Swig_name_wrapper(iname);
- if (overname) {
- Printf(wname, "%s", overname);
- }
-
- f = NewWrapper();
-
- String *outarg = NewStringEmpty();
- String *cleanup = NewStringEmpty();
-
- Printv(f->def, "ZEND_NAMED_FUNCTION(", wname, ") {\n", NIL);
-
- emit_parameter_variables(l, f);
- /* Attach standard typemaps */
-
- emit_attach_parmmaps(l, f);
- // Not issued for overloaded functions.
- if (!overloaded) {
- create_command(iname, wname, n);
- }
-
- // wrap:parms is used by overload resolution.
- Setattr(n, "wrap:parms", l);
-
- int num_arguments = emit_num_arguments(l);
- int num_required = emit_num_required(l);
- numopt = num_arguments - num_required;
-
- if (wrapperType == directorconstructor)
- num_arguments++;
-
- if (num_arguments > 0) {
- String *args = NewStringEmpty();
- if (wrapperType == directorconstructor)
- Wrapper_add_local(f, "arg0", "zval *arg0");
- Printf(args, "zval **args[%d]", num_arguments);
- Wrapper_add_local(f, "args", args);
- Delete(args);
- args = NULL;
- }
-
- // This generated code may be called:
- // 1) as an object method, or
- // 2) as a class-method/function (without a "this_ptr")
- // Option (1) has "this_ptr" for "this", option (2) needs it as
- // first parameter
-
- // NOTE: possible we ignore this_ptr as a param for native constructor
-
- Printf(f->code, "SWIG_ResetError(TSRMLS_C);\n");
-
- if (numopt > 0) { // membervariable wrappers do not have optional args
- Wrapper_add_local(f, "arg_count", "int arg_count");
- Printf(f->code, "arg_count = ZEND_NUM_ARGS();\n");
- Printf(f->code, "if(arg_count<%d || arg_count>%d ||\n", num_required, num_arguments);
- Printf(f->code, " zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)\n");
- Printf(f->code, "\tWRONG_PARAM_COUNT;\n\n");
- } else {
- if (num_arguments == 0) {
- Printf(f->code, "if(ZEND_NUM_ARGS() != 0) {\n");
- } else {
- Printf(f->code, "if(ZEND_NUM_ARGS() != %d || zend_get_parameters_array_ex(%d, args) != SUCCESS) {\n", num_arguments, num_arguments);
- }
- Printf(f->code, "WRONG_PARAM_COUNT;\n}\n\n");
- }
- if (wrapperType == directorconstructor)
- Printf(f->code, "arg0 = *args[0];\n \n");
-
- /* Now convert from PHP to C variables */
- // At this point, argcount if used is the number of deliberately passed args
- // not including this_ptr even if it is used.
- // It means error messages may be out by argbase with error
- // reports. We can either take argbase into account when raising
- // errors, or find a better way of dealing with _thisptr.
- // I would like, if objects are wrapped, to assume _thisptr is always
- // _this and not the first argument.
- // This may mean looking at Language::memberfunctionHandler
-
- int limit = num_arguments;
- if (wrapperType == directorconstructor)
- limit--;
- for (i = 0, p = l; i < limit; i++) {
- String *source;
-
- /* Skip ignored arguments */
- //while (Getattr(p,"tmap:ignore")) { p = Getattr(p,"tmap:ignore:next");}
- while (checkAttribute(p, "tmap:in:numinputs", "0")) {
- p = Getattr(p, "tmap:in:next");
- }
-
- SwigType *pt = Getattr(p, "type");
-
- if (wrapperType == directorconstructor) {
- source = NewStringf("args[%d]", i+1);
- } else {
- source = NewStringf("args[%d]", i);
- }
-
- String *ln = Getattr(p, "lname");
-
- /* Check if optional */
- if (i >= num_required) {
- Printf(f->code, "\tif(arg_count > %d) {\n", i);
- }
-
- if ((tm = Getattr(p, "tmap:in"))) {
- Replaceall(tm, "$source", source);
- Replaceall(tm, "$target", ln);
- Replaceall(tm, "$input", source);
- Setattr(p, "emit:input", source);
- Printf(f->code, "%s\n", tm);
- if (i == 0 && Getattr(p, "self")) {
- Printf(f->code, "\tif(!arg1) SWIG_PHP_Error(E_ERROR, \"this pointer is NULL\");\n");
- }
- p = Getattr(p, "tmap:in:next");
- if (i >= num_required) {
- Printf(f->code, "}\n");
- }
- continue;
- } else {
- Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
- }
- if (i >= num_required) {
- Printf(f->code, "\t}\n");
- }
- Delete(source);
- }
-
- if (is_member_director(n)) {
- Wrapper_add_local(f, "upcall", "bool upcall = false");
- Printf(f->code, "upcall = !Swig::Director::swig_is_overridden_method((char *)\"%s%s\", (char *)\"%s\" TSRMLS_CC);\n",
- prefix, Swig_class_name(Swig_methodclass(n)), name);
- }
-
- Swig_director_emit_dynamic_cast(n, f);
-
- /* Insert constraint checking code */
- for (p = l; p;) {
- if ((tm = Getattr(p, "tmap:check"))) {
- Replaceall(tm, "$target", Getattr(p, "lname"));
- Printv(f->code, tm, "\n", NIL);
- p = Getattr(p, "tmap:check:next");
- } else {
- p = nextSibling(p);
- }
- }
-
- /* Insert cleanup code */
- for (i = 0, p = l; p; i++) {
- if ((tm = Getattr(p, "tmap:freearg"))) {
- Replaceall(tm, "$source", Getattr(p, "lname"));
- Printv(cleanup, tm, "\n", NIL);
- p = Getattr(p, "tmap:freearg:next");
- } else {
- p = nextSibling(p);
- }
- }
-
- /* Insert argument output code */
- bool hasargout = false;
- for (i = 0, p = l; p; i++) {
- if ((tm = Getattr(p, "tmap:argout"))) {
- hasargout = true;
- Replaceall(tm, "$source", Getattr(p, "lname"));
- // Replaceall(tm,"$input",Getattr(p,"lname"));
- Replaceall(tm, "$target", "return_value");
- Replaceall(tm, "$result", "return_value");
- Replaceall(tm, "$arg", Getattr(p, "emit:input"));
- Replaceall(tm, "$input", Getattr(p, "emit:input"));
- Printv(outarg, tm, "\n", NIL);
- p = Getattr(p, "tmap:argout:next");
- } else {
- p = nextSibling(p);
- }
- }
-
- Setattr(n, "wrap:name", wname);
-
- /* emit function call */
- String *actioncode = emit_action(n);
-
- if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
- Replaceall(tm, "$input", Swig_cresult_name());
- Replaceall(tm, "$source", Swig_cresult_name());
- Replaceall(tm, "$target", "return_value");
- Replaceall(tm, "$result", "return_value");
- Replaceall(tm, "$owner", newobject ? "1" : "0");
- Printf(f->code, "%s\n", tm);
- } else {
- Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), name);
- }
- emit_return_variable(n, d, f);
-
- if (outarg) {
- Printv(f->code, outarg, NIL);
- }
-
- if (cleanup) {
- Printv(f->code, cleanup, NIL);
- }
-
- /* Look to see if there is any newfree cleanup code */
- if (GetFlag(n, "feature:new")) {
- if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
- Printf(f->code, "%s\n", tm);
- Delete(tm);
- }
- }
-
- /* See if there is any return cleanup code */
- if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
- Printf(f->code, "%s\n", tm);
- Delete(tm);
- }
-
- Printf(f->code, "thrown:\n");
- Printf(f->code, "return;\n");
-
- /* Error handling code */
- Printf(f->code, "fail:\n");
- Printv(f->code, cleanup, NIL);
- Append(f->code, "SWIG_FAIL(TSRMLS_C);\n");
-
- Printf(f->code, "}\n");
-
- Replaceall(f->code, "$cleanup", cleanup);
- Replaceall(f->code, "$symname", iname);
-
- Wrapper_print(f, s_wrappers);
- DelWrapper(f);
- f = NULL;
-
- if (overloaded && !Getattr(n, "sym:nextSibling")) {
- dispatchFunction(n);
- }
-
- Delete(wname);
- wname = NULL;
-
- if (!shadow) {
- return SWIG_OK;
- }
-
- // Handle getters and setters.
- if (wrapperType == membervar) {
- const char *p = Char(iname);
- if (strlen(p) > 4) {
- p += strlen(p) - 4;
- String *varname = Getattr(n, "membervariableHandler:sym:name");
- if (strcmp(p, "_get") == 0) {
- Setattr(shadow_get_vars, varname, Getattr(n, "type"));
- } else if (strcmp(p, "_set") == 0) {
- Setattr(shadow_set_vars, varname, iname);
- }
- }
- return SWIG_OK;
- }
-
- // Only look at non-overloaded methods and the last entry in each overload
- // chain (we check the last so that wrap:parms and wrap:name have been set
- // for them all).
- if (overloaded && Getattr(n, "sym:nextSibling") != 0)
- return SWIG_OK;
-
- if (!s_oowrappers)
- s_oowrappers = NewStringEmpty();
-
- if (newobject || wrapperType == memberfn || wrapperType == staticmemberfn || wrapperType == standard || wrapperType == staticmembervar) {
- bool handle_as_overload = false;
- String **arg_names;
- String **arg_values;
- // Method or static method or plain function.
- const char *methodname = 0;
- String *output = s_oowrappers;
- if (constructor) {
- class_has_ctor = true;
- // Skip the Foo:: prefix.
- char *ptr = strrchr(GetChar(Swig_methodclass(n), "sym:name"), ':');
- if (ptr) {
- ptr++;
- } else {
- ptr = GetChar(Swig_methodclass(n), "sym:name");
- }
- if (strcmp(ptr, GetChar(n, "constructorHandler:sym:name")) == 0) {
- methodname = "__construct";
- } else {
- // The class has multiple constructors and this one is
- // renamed, so this will be a static factory function
- methodname = GetChar(n, "constructorHandler:sym:name");
- }
- } else if (wrapperType == memberfn) {
- methodname = Char(Getattr(n, "memberfunctionHandler:sym:name"));
- } else if (wrapperType == staticmemberfn) {
- methodname = Char(Getattr(n, "staticmemberfunctionHandler:sym:name"));
- } else if (wrapperType == staticmembervar) {
- // Static member variable, wrapped as a function due to PHP limitations.
- methodname = Char(Getattr(n, "staticmembervariableHandler:sym:name"));
- } else { // wrapperType == standard
- methodname = Char(iname);
- if (!s_fakeoowrappers)
- s_fakeoowrappers = NewStringEmpty();
- output = s_fakeoowrappers;
- }
-
- bool really_overloaded = overloaded ? true : false;
- int min_num_of_arguments = emit_num_required(l);
- int max_num_of_arguments = emit_num_arguments(l);
-
- Hash *ret_types = NewHash();
- Setattr(ret_types, d, d);
-
- bool non_void_return = (Cmp(d, "void") != 0);
-
- if (overloaded) {
- // Look at all the overloaded versions of this method in turn to
- // decide if it's really an overloaded method, or just one where some
- // parameters have default values.
- Node *o = Getattr(n, "sym:overloaded");
- while (o) {
- if (o == n) {
- o = Getattr(o, "sym:nextSibling");
- continue;
- }
-
- SwigType *d2 = Getattr(o, "type");
- if (!d2) {
- assert(constructor);
- } else if (!Getattr(ret_types, d2)) {
- Setattr(ret_types, d2, d2);
- non_void_return = non_void_return || (Cmp(d2, "void") != 0);
- }
-
- ParmList *l2 = Getattr(o, "wrap:parms");
- int num_arguments = emit_num_arguments(l2);
- int num_required = emit_num_required(l2);
- if (num_required < min_num_of_arguments)
- min_num_of_arguments = num_required;
-
- if (num_arguments > max_num_of_arguments) {
- max_num_of_arguments = num_arguments;
- }
- o = Getattr(o, "sym:nextSibling");
- }
-
- o = Getattr(n, "sym:overloaded");
- while (o) {
- if (o == n) {
- o = Getattr(o, "sym:nextSibling");
- continue;
- }
-
- ParmList *l2 = Getattr(o, "wrap:parms");
- Parm *p = l, *p2 = l2;
- if (wrapperType == memberfn) {
- p = nextSibling(p);
- p2 = nextSibling(p2);
- }
- while (p && p2) {
- if (Cmp(Getattr(p, "type"), Getattr(p2, "type")) != 0)
- break;
- if (Cmp(Getattr(p, "name"), Getattr(p2, "name")) != 0)
- break;
- String *value = Getattr(p, "value");
- String *value2 = Getattr(p2, "value");
- if (value && !value2)
- break;
- if (!value && value2)
- break;
- if (value) {
- if (Cmp(value, value2) != 0)
- break;
- }
- p = nextSibling(p);
- p2 = nextSibling(p2);
- }
- if (p && p2)
- break;
- // One parameter list is a prefix of the other, so check that all
- // remaining parameters of the longer list are optional.
- if (p2)
- p = p2;
- while (p && Getattr(p, "value"))
- p = nextSibling(p);
- if (p)
- break;
- o = Getattr(o, "sym:nextSibling");
- }
- if (!o) {
- // This "overloaded method" is really just one with default args.
- really_overloaded = false;
- }
- }
-
- if (wrapperType == memberfn) {
- // Allow for the "this" pointer.
- --min_num_of_arguments;
- --max_num_of_arguments;
- }
-
- arg_names = (String **) malloc(max_num_of_arguments * sizeof(String *));
- if (!arg_names) {
- /* FIXME: How should this be handled? The rest of SWIG just seems
- * to not bother checking for malloc failing! */
- fprintf(stderr, "Malloc failed!\n");
- exit(1);
- }
- for (i = 0; i < max_num_of_arguments; ++i) {
- arg_names[i] = NULL;
- }
-
- arg_values = (String **) malloc(max_num_of_arguments * sizeof(String *));
- if (!arg_values) {
- /* FIXME: How should this be handled? The rest of SWIG just seems
- * to not bother checking for malloc failing! */
- fprintf(stderr, "Malloc failed!\n");
- exit(1);
- }
- for (i = 0; i < max_num_of_arguments; ++i) {
- arg_values[i] = NULL;
- }
-
- Node *o;
- if (overloaded) {
- o = Getattr(n, "sym:overloaded");
- } else {
- o = n;
- }
- while (o) {
- int argno = 0;
- Parm *p = Getattr(o, "wrap:parms");
- if (wrapperType == memberfn)
- p = nextSibling(p);
- while (p) {
- if (GetInt(p, "tmap:in:numinputs") == 0) {
- p = nextSibling(p);
- continue;
- }
- assert(0 <= argno && argno < max_num_of_arguments);
- String *&pname = arg_names[argno];
- const char *pname_cstr = GetChar(p, "name");
- // Just get rid of the C++ namespace part for now.
- const char *ptr = NULL;
- if (pname_cstr && (ptr = strrchr(pname_cstr, ':'))) {
- pname_cstr = ptr + 1;
- }
- if (!pname_cstr) {
- // Unnamed parameter, e.g. int foo(int);
- } else if (!pname) {
- pname = NewString(pname_cstr);
- } else {
- size_t len = strlen(pname_cstr);
- size_t spc = 0;
- size_t len_pname = strlen(Char(pname));
- while (spc + len <= len_pname) {
- if (strncmp(pname_cstr, Char(pname) + spc, len) == 0) {
- char ch = ((char *) Char(pname))[spc + len];
- if (ch == '\0' || ch == ' ') {
- // Already have this pname_cstr.
- pname_cstr = NULL;
- break;
- }
- }
- char *p = strchr(Char(pname) + spc, ' ');
- if (!p)
- break;
- spc = (p + 4) - Char(pname);
- }
- if (pname_cstr) {
- Printf(pname, " or_%s", pname_cstr);
- }
- }
- String *value = NewString(Getattr(p, "value"));
- if (Len(value)) {
- /* Check that value is a valid constant in PHP (and adjust it if
- * necessary, or replace it with "?" if it's just not valid). */
- SwigType *type = Getattr(p, "type");
- switch (SwigType_type(type)) {
- case T_BOOL: {
- if (Strcmp(value, "true") == 0 || Strcmp(value, "false") == 0)
- break;
- char *p;
- errno = 0;
- long n = strtol(Char(value), &p, 0);
- Clear(value);
- if (errno || *p) {
- Append(value, "?");
- } else if (n) {
- Append(value, "true");
- } else {
- Append(value, "false");
- }
- break;
- }
- case T_CHAR:
- case T_SCHAR:
- case T_SHORT:
- case T_INT:
- case T_LONG:
- case T_LONGLONG: {
- char *p;
- errno = 0;
- long n = strtol(Char(value), &p, 0);
- (void) n;
- if (errno || *p) {
- Clear(value);
- Append(value, "?");
- }
- break;
- }
- case T_UCHAR:
- case T_USHORT:
- case T_UINT:
- case T_ULONG:
- case T_ULONGLONG: {
- char *p;
- errno = 0;
- unsigned int n = strtoul(Char(value), &p, 0);
- (void) n;
- if (errno || *p) {
- Clear(value);
- Append(value, "?");
- }
- break;
- }
- case T_FLOAT:
- case T_DOUBLE:
- case T_LONGDOUBLE: {
- char *p;
- errno = 0;
- /* FIXME: strtod is locale dependent... */
- double val = strtod(Char(value), &p);
- if (errno || *p) {
- Clear(value);
- Append(value, "?");
- } else if (strchr(Char(value), '.') == 0) {
- // Ensure value is a double constant, not an integer one.
- Append(value, ".0");
- double val2 = strtod(Char(value), &p);
- if (errno || *p || val != val2) {
- Clear(value);
- Append(value, "?");
- }
- }
- break;
- }
- case T_STRING:
- if (Len(value) < 2) {
- // How can a string (including "" be less than 2 characters?)
- Clear(value);
- Append(value, "?");
- } else {
- const char *v = Char(value);
- if (v[0] != '"' || v[Len(value) - 1] != '"') {
- Clear(value);
- Append(value, "?");
- }
- // Strings containing "$" require special handling, but we do
- // that later.
- }
- break;
- case T_VOID:
- assert(false);
- break;
- case T_POINTER: {
- const char *v = Char(value);
- if (v[0] == '(') {
- // Handle "(void*)0", "(TYPE*)0", "(char*)NULL", etc.
- v += strcspn(v + 1, "*()") + 1;
- if (*v == '*') {
- do {
- v++;
- v += strspn(v, " \t");
- } while (*v == '*');
- if (*v++ == ')') {
- v += strspn(v, " \t");
- String * old = value;
- value = NewString(v);
- Delete(old);
- }
- }
- }
- if (Strcmp(value, "NULL") == 0 ||
- Strcmp(value, "nullptr") == 0 ||
- Strcmp(value, "0") == 0 ||
- Strcmp(value, "0L") == 0) {
- Clear(value);
- Append(value, "null");
- } else {
- Clear(value);
- Append(value, "?");
- }
- break;
- }
- default:
- /* Safe default */
- Clear(value);
- Append(value, "?");
- break;
- }
-
- if (!arg_values[argno]) {
- arg_values[argno] = value;
- value = NULL;
- } else if (Cmp(arg_values[argno], value) != 0) {
- // If a parameter has two different default values in
- // different overloaded forms of the function, we can't
- // set its default in PHP. Flag this by setting its
- // default to `?'.
- Delete(arg_values[argno]);
- arg_values[argno] = NewString("?");
- }
- } else if (arg_values[argno]) {
- // This argument already has a default value in another overloaded
- // form, but doesn't in this form. So don't try to do anything
- // clever, just let the C wrappers resolve the overload and set the
- // default values.
- //
- // This handling is safe, but I'm wondering if it may be overly
- // conservative (FIXME) in some cases. It seems it's only bad when
- // there's an overloaded form with the appropriate number of
- // parameters which doesn't want the default value, but I need to
- // think about this more.
- Delete(arg_values[argno]);
- arg_values[argno] = NewString("?");
- }
- Delete(value);
- p = nextSibling(p);
- ++argno;
- }
- if (!really_overloaded)
- break;
- o = Getattr(o, "sym:nextSibling");
- }
-
- /* Clean up any parameters which haven't yet got names, or whose
- * names clash. */
- Hash *seen = NewHash();
- /* We need $this to refer to the current class, so can't allow it
- * to be used as a parameter. */
- Setattr(seen, "this", seen);
- /* We use $r to store the return value, so disallow that as a parameter
- * name in case the user uses the "call-time pass-by-reference" feature
- * (it's deprecated and off by default in PHP5, but we want to be
- * maximally portable). Similarly we use $c for the classname or new
- * stdClass object.
- */
- Setattr(seen, "r", seen);
- Setattr(seen, "c", seen);
-
- for (int argno = 0; argno < max_num_of_arguments; ++argno) {
- String *&pname = arg_names[argno];
- if (pname) {
- Replaceall(pname, " ", "_");
- } else {
- /* We get here if the SWIG .i file has "int foo(int);" */
- pname = NewStringEmpty();
- Printf(pname, "arg%d", argno + 1);
- }
- // Check if we've already used this parameter name.
- while (Getattr(seen, pname)) {
- // Append "_" to clashing names until they stop clashing...
- Printf(pname, "_");
- }
- Setattr(seen, Char(pname), seen);
-
- if (arg_values[argno] && Cmp(arg_values[argno], "?") == 0) {
- handle_as_overload = true;
- }
- }
- Delete(seen);
- seen = NULL;
-
- String *invoke = NewStringEmpty();
- String *prepare = NewStringEmpty();
- String *args = NewStringEmpty();
-
- if (!handle_as_overload && !(really_overloaded && max_num_of_arguments > min_num_of_arguments)) {
- Printf(invoke, "%s(", iname);
- if (wrapperType == memberfn) {
- Printf(invoke, "$this->%s", SWIG_PTR);
- }
- for (int i = 0; i < max_num_of_arguments; ++i) {
- if (i)
- Printf(args, ",");
- if (i || wrapperType == memberfn)
- Printf(invoke, ",");
- String *value = arg_values[i];
- if (value) {
- const char *v = Char(value);
- if (v[0] == '"') {
- /* In a PHP double quoted string, $ needs to be escaped as \$. */
- Replaceall(value, "$", "\\$");
- }
- Printf(args, "$%s=%s", arg_names[i], value);
- } else {
- Printf(args, "$%s", arg_names[i]);
- }
- Printf(invoke, "$%s", arg_names[i]);
- }
- Printf(invoke, ")");
- } else {
- int i;
- for (i = 0; i < min_num_of_arguments; ++i) {
- if (i)
- Printf(args, ",");
- Printf(args, "$%s", arg_names[i]);
- }
- String *invoke_args = NewStringEmpty();
- if (wrapperType == memberfn) {
- Printf(invoke_args, "$this->%s", SWIG_PTR);
- if (min_num_of_arguments > 0)
- Printf(invoke_args, ",");
- }
- Printf(invoke_args, "%s", args);
- bool had_a_case = false;
- int last_handled_i = i - 1;
- for (; i < max_num_of_arguments; ++i) {
- if (i)
- Printf(args, ",");
- const char *value = Char(arg_values[i]);
- // FIXME: (really_overloaded && handle_as_overload) is perhaps a
- // little conservative, but it doesn't hit any cases that it
- // shouldn't for Xapian at least (and we need it to handle
- // "Enquire::get_mset()" correctly).
- bool non_php_default = ((really_overloaded && handle_as_overload) ||
- !value || strcmp(value, "?") == 0);
- if (non_php_default)
- value = "null";
- Printf(args, "$%s=%s", arg_names[i], value);
- if (non_php_default) {
- if (!had_a_case) {
- Printf(prepare, "\t\tswitch (func_num_args()) {\n");
- had_a_case = true;
- }
- Printf(prepare, "\t\t");
- while (last_handled_i < i) {
- Printf(prepare, "case %d: ", ++last_handled_i);
- }
- if (non_void_return) {
- if ((!directorsEnabled() || !Swig_directorclass(n)) && !newobject) {
- Append(prepare, "$r=");
- } else {
- Printf(prepare, "$this->%s=", SWIG_PTR);
- }
- }
- if (!directorsEnabled() || !Swig_directorclass(n) || !newobject) {
- Printf(prepare, "%s(%s); break;\n", iname, invoke_args);
- } else if (!i) {
- Printf(prepare, "%s($_this%s); break;\n", iname, invoke_args);
- } else {
- Printf(prepare, "%s($_this, %s); break;\n", iname, invoke_args);
- }
- }
- if (i || wrapperType == memberfn)
- Printf(invoke_args, ",");
- Printf(invoke_args, "$%s", arg_names[i]);
- }
- Printf(prepare, "\t\t");
- if (had_a_case)
- Printf(prepare, "default: ");
- if (non_void_return) {
- if ((!directorsEnabled() || !Swig_directorclass(n)) && !newobject) {
- Append(prepare, "$r=");
- } else {
- Printf(prepare, "$this->%s=", SWIG_PTR);
- }
- }
-
- if (!directorsEnabled() || !Swig_directorclass(n) || !newobject) {
- Printf(prepare, "%s(%s);\n", iname, invoke_args);
- } else {
- Printf(prepare, "%s($_this, %s);\n", iname, invoke_args);
- }
- if (had_a_case)
- Printf(prepare, "\t\t}\n");
- Delete(invoke_args);
- Printf(invoke, "$r");
- }
-
- Printf(output, "\n");
- // If it's a member function or a class constructor...
- if (wrapperType == memberfn || (constructor && current_class)) {
- String *acc = NewString(Getattr(n, "access"));
- // If a base has the same method with public access, then PHP
- // requires to have it here as public as well
- Node *bases = Getattr(Swig_methodclass(n), "bases");
- if (bases && Strcmp(acc, "public") != 0) {
- String *warnmsg = 0;
- int haspublicbase = 0;
- Iterator i = First(bases);
- while (i.item) {
- Node *j = firstChild(i.item);
- while (j) {
- String *jname = Getattr(j, "name");
- if (!jname || Strcmp(jname, Getattr(n, "name")) != 0) {
- j = nextSibling(j);
- continue;
- }
- if (Strcmp(nodeType(j), "cdecl") == 0) {
- if (!Getattr(j, "access") || checkAttribute(j, "access", "public")) {
- haspublicbase = 1;
- }
- } else if (Strcmp(nodeType(j), "using") == 0 && firstChild(j) && Strcmp(nodeType(firstChild(j)), "cdecl") == 0) {
- if (!Getattr(firstChild(j), "access") || checkAttribute(firstChild(j), "access", "public")) {
- haspublicbase = 1;
- }
- }
- if (haspublicbase) {
- warnmsg = NewStringf("Modifying the access of '%s::%s' to public, as the base '%s' has it as public as well.\n", Getattr(current_class, "classtype"), Getattr(n, "name"), Getattr(i.item, "classtype"));
- break;
- }
- j = nextSibling(j);
- }
- i = Next(i);
- if (haspublicbase) {
- break;
- }
- }
- if (Getattr(n, "access") && haspublicbase) {
- Delete(acc);
- acc = NewStringEmpty(); // implicitly public
- Swig_warning(WARN_PHP_PUBLIC_BASE, input_file, line_number, Char(warnmsg));
- Delete(warnmsg);
- }
- }
-
- if (Cmp(acc, "public") == 0) {
- // The default visibility for methods is public, so don't specify
- // that explicitly to keep the wrapper size down.
- Delete(acc);
- acc = NewStringEmpty();
- } else if (Cmp(acc, "") != 0) {
- Append(acc, " ");
- }
-
- if (constructor) {
- const char * arg0;
- if (max_num_of_arguments > 0) {
- arg0 = Char(arg_names[0]);
- } else {
- arg0 = "res";
- Delete(args);
- args = NewString("$res=null");
- }
- String *mangled_type = SwigType_manglestr(Getattr(n, "type"));
- Printf(output, "\t%sfunction %s(%s) {\n", acc, methodname, args);
- Printf(output, "\t\tif (is_resource($%s) && get_resource_type($%s) === '%s') {\n", arg0, arg0, mangled_type);
- Printf(output, "\t\t\t$this->%s=$%s;\n", SWIG_PTR, arg0);
- Printf(output, "\t\t\treturn;\n");
- Printf(output, "\t\t}\n");
- } else {
- Printf(output, "\t%sfunction %s(%s) {\n", acc, methodname, args);
- }
- Delete(acc);
- } else if (wrapperType == staticmembervar) {
- // We're called twice for a writable static member variable - first
- // with "foo_set" and then with "foo_get" - so generate half the
- // wrapper function each time.
- //
- // For a const static member, we only get called once.
- static bool started = false;
- if (!started) {
- Printf(output, "\tstatic function %s() {\n", methodname);
- if (max_num_of_arguments) {
- // Setter.
- Printf(output, "\t\tif (func_num_args()) {\n");
- Printf(output, "\t\t\t%s(func_get_arg(0));\n", iname);
- Printf(output, "\t\t\treturn;\n");
- Printf(output, "\t\t}\n");
- started = true;
- goto done;
- }
- }
- started = false;
- } else {
- Printf(output, "\tstatic function %s(%s) {\n", methodname, args);
- }
-
- if (!newobject)
- Printf(output, "%s", prepare);
- if (constructor) {
- if (!directorsEnabled() || !Swig_directorclass(n)) {
- if (!Len(prepare)) {
- if (strcmp(methodname, "__construct") == 0) {
- Printf(output, "\t\t$this->%s=%s;\n", SWIG_PTR, invoke);
- } else {
- String *classname = Swig_class_name(current_class);
- Printf(output, "\t\treturn new %s%s(%s);\n", prefix, classname, invoke);
- }
- }
- } else {
- Node *parent = Swig_methodclass(n);
- String *classname = Swig_class_name(parent);
- Printf(output, "\t\tif (get_class($this) === '%s%s') {\n", prefix, classname);
- Printf(output, "\t\t\t$_this = null;\n");
- Printf(output, "\t\t} else {\n");
- Printf(output, "\t\t\t$_this = $this;\n");
- Printf(output, "\t\t}\n");
- if (!Len(prepare)) {
- if (num_arguments > 1) {
- Printf(output, "\t\t$this->%s=%s($_this, %s);\n", SWIG_PTR, iname, args);
- } else {
- Printf(output, "\t\t$this->%s=%s($_this);\n", SWIG_PTR, iname);
- }
- }
- }
- Printf(output, "%s", prepare);
- } else if (!non_void_return && !hasargout) {
- if (Cmp(invoke, "$r") != 0)
- Printf(output, "\t\t%s;\n", invoke);
- } else if (is_class(d)) {
- if (Cmp(invoke, "$r") != 0)
- Printf(output, "\t\t$r=%s;\n", invoke);
- if (Len(ret_types) == 1) {
- /* If d is abstract we can't create a new wrapper type d. */
- Node *d_class = classLookup(d);
- int is_abstract = 0;
- if (Getattr(d_class, "abstracts")) {
- is_abstract = 1;
- }
- if (newobject || !is_abstract) {
- Printf(output, "\t\tif (is_resource($r)) {\n");
- if (Getattr(classLookup(Getattr(n, "type")), "module")) {
- /*
- * _p_Foo -> Foo, _p_ns__Bar -> Bar
- * TODO: do this in a more elegant way
- */
- if (Len(prefix) == 0) {
- Printf(output, "\t\t\t$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));\n");
- } else {
- Printf(output, "\t\t\t$c='%s'.substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));\n", prefix);
- }
- Printf(output, "\t\t\tif (class_exists($c)) return new $c($r);\n");
- Printf(output, "\t\t\treturn new %s%s($r);\n", prefix, Getattr(classLookup(d), "sym:name"));
- } else {
- Printf(output, "\t\t\t$c = new stdClass();\n");
- Printf(output, "\t\t\t$c->" SWIG_PTR " = $r;\n");
- Printf(output, "\t\t\treturn $c;\n");
- }
- Printf(output, "\t\t}\n\t\treturn $r;\n");
- } else {
- Printf(output, "\t\t$this->%s = $r;\n", SWIG_PTR);
- Printf(output, "\t\treturn $this;\n");
- }
- } else {
- Printf(output, "\t\tif (!is_resource($r)) return $r;\n");
- String *wrapobj = NULL;
- String *common = NULL;
- Iterator i = First(ret_types);
- while (i.item) {
- SwigType *ret_type = i.item;
- i = Next(i);
- String *mangled = NewString("_p");
- Printf(mangled, "%s", SwigType_manglestr(ret_type));
- Node *class_node = Getattr(zend_types, mangled);
- if (!class_node) {
- /* This is needed when we're returning a pointer to a type
- * rather than returning the type by value or reference. */
- Delete(mangled);
- mangled = NewString(SwigType_manglestr(ret_type));
- class_node = Getattr(zend_types, mangled);
- if (!class_node) {
- // Return type isn't an object, so will be handled by the
- // !is_resource() check before the switch.
- continue;
- }
- }
- const char *classname = GetChar(class_node, "sym:name");
- if (!classname)
- classname = GetChar(class_node, "name");
- String * action = NewStringEmpty();
- if (classname)
- Printf(action, "return new %s%s($r);\n", prefix, classname);
- else
- Printf(action, "return $r;\n");
- if (!wrapobj) {
- wrapobj = NewString("\t\tswitch (get_resource_type($r)) {\n");
- common = action;
- } else {
- if (common && Cmp(common, action) != 0) {
- Delete(common);
- common = NULL;
- }
- }
- Printf(wrapobj, "\t\t");
- if (i.item) {
- Printf(wrapobj, "case '%s': ", mangled);
- } else {
- Printf(wrapobj, "default: ");
- }
- Printv(wrapobj, action, NIL);
- if (action != common) Delete(action);
- Delete(mangled);
- }
- Printf(wrapobj, "\t\t}\n");
- if (common) {
- // All cases have the same action, so eliminate the switch
- // wrapper.
- Printf(output, "\t\t%s", common);
- Delete(common);
- } else {
- Printv(output, wrapobj, NIL);
- }
- Delete(wrapobj);
- }
- } else {
- if (non_void_return) {
- Printf(output, "\t\treturn %s;\n", invoke);
- } else if (Cmp(invoke, "$r") != 0) {
- Printf(output, "\t\t%s;\n", invoke);
- }
- }
- Printf(output, "\t}\n");
-
-done:
- Delete(prepare);
- Delete(invoke);
- free(arg_values);
-
- Delete(args);
- args = NULL;
-
- for (int i = 0; i < max_num_of_arguments; ++i) {
- Delete(arg_names[i]);
- }
- free(arg_names);
- arg_names = NULL;
- }
-
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * globalvariableHandler()
- * ------------------------------------------------------------ */
-
- virtual int globalvariableHandler(Node *n) {
- char *name = GetChar(n, "name");
- char *iname = GetChar(n, "sym:name");
- SwigType *t = Getattr(n, "type");
- String *tm;
-
- /* First do the wrappers such as name_set(), name_get()
- * as provided by the baseclass's implementation of variableWrapper
- */
- if (Language::globalvariableHandler(n) == SWIG_NOWRAP) {
- return SWIG_NOWRAP;
- }
-
- if (!addSymbol(iname, n))
- return SWIG_ERROR;
-
- /* First link C variables to PHP */
-
- tm = Swig_typemap_lookup("varinit", n, name, 0);
- if (tm) {
- Replaceall(tm, "$target", name);
- Printf(s_vinit, "%s\n", tm);
- } else {
- Swig_error(input_file, line_number, "Unable to link with type %s\n", SwigType_str(t, 0));
- }
-
- /* Now generate PHP -> C sync blocks */
- /*
- tm = Swig_typemap_lookup("varin", n, name, 0);
- if(tm) {
- Replaceall(tm, "$symname", iname);
- Printf(f_c->code, "%s\n", tm);
- } else {
- Swig_error(input_file, line_number, "Unable to link with type %s\n", SwigType_str(t, 0));
- }
- */
- /* Now generate C -> PHP sync blocks */
- /*
- if(!GetFlag(n,"feature:immutable")) {
-
- tm = Swig_typemap_lookup("varout", n, name, 0);
- if(tm) {
- Replaceall(tm, "$symname", iname);
- Printf(f_php->code, "%s\n", tm);
- } else {
- Swig_error(input_file, line_number, "Unable to link with type %s\n", SwigType_str(t, 0));
- }
- }
- */
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * constantWrapper()
- * ------------------------------------------------------------ */
-
- virtual int constantWrapper(Node *n) {
- String *name = GetChar(n, "name");
- String *iname = GetChar(n, "sym:name");
- SwigType *type = Getattr(n, "type");
- String *rawval = Getattr(n, "rawval");
- String *value = rawval ? rawval : Getattr(n, "value");
- String *tm;
-
- if (!addSymbol(iname, n))
- return SWIG_ERROR;
-
- SwigType_remember(type);
-
- if ((tm = Swig_typemap_lookup("consttab", n, name, 0))) {
- Replaceall(tm, "$source", value);
- Replaceall(tm, "$target", name);
- Replaceall(tm, "$value", value);
- Printf(s_cinit, "%s\n", tm);
- }
-
- if (shadow) {
- String *enumvalue = GetChar(n, "enumvalue");
- String *set_to = iname;
-
- if (!enumvalue) {
- enumvalue = GetChar(n, "enumvalueex");
- }
-
- if (enumvalue && *Char(enumvalue)) {
- // Check for a simple constant expression which is valid in PHP.
- // If we find one, initialise the const member with it; otherwise
- // we initialise it using the C/C++ wrapped constant.
- const char *p;
- for (p = Char(enumvalue); *p; ++p) {
- if (!isdigit((unsigned char)*p) && !strchr(" +-", *p)) {
- // FIXME: enhance to handle `<previous_enum> + 1' which is what
- // we get for enums that don't have an explicit value set.
- break;
- }
- }
- if (!*p)
- set_to = enumvalue;
- }
-
- if (wrapping_member_constant) {
- if (!s_oowrappers)
- s_oowrappers = NewStringEmpty();
- Printf(s_oowrappers, "\n\tconst %s = %s;\n", wrapping_member_constant, set_to);
- } else {
- if (!s_fakeoowrappers)
- s_fakeoowrappers = NewStringEmpty();
- Printf(s_fakeoowrappers, "\n\tconst %s = %s;\n", iname, set_to);
- }
- }
-
- return SWIG_OK;
- }
-
- /*
- * PHP5::pragma()
- *
- * Pragma directive.
- *
- * %pragma(php) code="String" # Includes a string in the .php file
- * %pragma(php) include="file.php" # Includes a file in the .php file
- */
-
- virtual int pragmaDirective(Node *n) {
- if (!ImportMode) {
- String *lang = Getattr(n, "lang");
- String *type = Getattr(n, "name");
- String *value = Getattr(n, "value");
-
- if (Strcmp(lang, "php") == 0 || Strcmp(lang, "php4") == 0) {
- if (Strcmp(type, "code") == 0) {
- if (value) {
- Printf(pragma_code, "%s\n", value);
- }
- } else if (Strcmp(type, "include") == 0) {
- if (value) {
- Printf(pragma_incl, "include '%s';\n", value);
- }
- } else if (Strcmp(type, "phpinfo") == 0) {
- if (value) {
- Printf(pragma_phpinfo, "%s\n", value);
- }
- } else {
- Swig_warning(WARN_PHP_UNKNOWN_PRAGMA, input_file, line_number, "Unrecognized pragma <%s>.\n", type);
- }
- }
- }
- return Language::pragmaDirective(n);
- }
-
- /* ------------------------------------------------------------
- * classDeclaration()
- * ------------------------------------------------------------ */
-
- virtual int classDeclaration(Node *n) {
- if (!Getattr(n, "feature:onlychildren")) {
- String *symname = Getattr(n, "sym:name");
- Setattr(n, "php:proxy", symname);
- }
-
- return Language::classDeclaration(n);
- }
-
- /* ------------------------------------------------------------
- * classHandler()
- * ------------------------------------------------------------ */
-
- virtual int classHandler(Node *n) {
- constructors = 0;
- current_class = n;
-
- if (shadow) {
- char *rename = GetChar(n, "sym:name");
-
- if (!addSymbol(rename, n))
- return SWIG_ERROR;
- shadow_classname = NewString(rename);
-
- shadow_get_vars = NewHash();
- shadow_set_vars = NewHash();
-
- /* Deal with inheritance */
- List *baselist = Getattr(n, "bases");
- if (baselist) {
- Iterator base = First(baselist);
- while (base.item && GetFlag(base.item, "feature:ignore")) {
- base = Next(base);
- }
- base = Next(base);
- if (base.item) {
- /* Warn about multiple inheritance for additional base class(es) */
- while (base.item) {
- if (GetFlag(base.item, "feature:ignore")) {
- base = Next(base);
- continue;
- }
- String *proxyclassname = SwigType_str(Getattr(n, "classtypeobj"), 0);
- String *baseclassname = SwigType_str(Getattr(base.item, "name"), 0);
- Swig_warning(WARN_PHP_MULTIPLE_INHERITANCE, input_file, line_number,
- "Warning for %s, base %s ignored. Multiple inheritance is not supported in PHP.\n", proxyclassname, baseclassname);
- base = Next(base);
- }
- }
- }
- }
-
- classnode = n;
- Language::classHandler(n);
- classnode = 0;
-
- if (shadow) {
- List *baselist = Getattr(n, "bases");
- Iterator ki, base;
-
- if (baselist) {
- base = First(baselist);
- while (base.item && GetFlag(base.item, "feature:ignore")) {
- base = Next(base);
- }
- } else {
- base.item = NULL;
- }
-
- if (Getattr(n, "abstracts") && !GetFlag(n, "feature:notabstract")) {
- Printf(s_phpclasses, "abstract ");
- }
-
- Printf(s_phpclasses, "class %s%s ", prefix, shadow_classname);
- String *baseclass = NULL;
- if (base.item && Getattr(base.item, "module")) {
- baseclass = Getattr(base.item, "sym:name");
- if (!baseclass)
- baseclass = Getattr(base.item, "name");
- Printf(s_phpclasses, "extends %s%s ", prefix, baseclass);
- } else if (GetFlag(n, "feature:exceptionclass")) {
- Append(s_phpclasses, "extends Exception ");
- }
- {
- Node *node = NewHash();
- Setattr(node, "type", Getattr(n, "name"));
- Setfile(node, Getfile(n));
- Setline(node, Getline(n));
- String * interfaces = Swig_typemap_lookup("phpinterfaces", node, "", 0);
- if (interfaces) {
- Printf(s_phpclasses, "implements %s ", interfaces);
- }
- Delete(node);
- }
- Printf(s_phpclasses, "{\n\tpublic $%s=null;\n", SWIG_PTR);
- if (!baseclass) {
- // Only store this in the base class (NB !baseclass means we *are*
- // a base class...)
- Printf(s_phpclasses, "\tprotected $%s=array();\n", SWIG_DATA);
- }
-
- // Write property SET handlers
- ki = First(shadow_set_vars);
- if (ki.key) {
- // This class has setters.
- Printf(s_phpclasses, "\n\tfunction __set($var,$value) {\n");
- // FIXME: tune this threshold...
- if (Len(shadow_set_vars) <= 2) {
- // Not many setters, so avoid call_user_func.
- for (; ki.key; ki = Next(ki)) {
- DOH *key = ki.key;
- String *iname = ki.item;
- Printf(s_phpclasses, "\t\tif ($var === '%s') return %s($this->%s,$value);\n", key, iname, SWIG_PTR);
- }
- } else {
- Printf(s_phpclasses, "\t\t$func = '%s_'.$var.'_set';\n", shadow_classname);
- Printf(s_phpclasses, "\t\tif (function_exists($func)) return call_user_func($func,$this->%s,$value);\n", SWIG_PTR);
- }
- Printf(s_phpclasses, "\t\tif ($var === 'thisown') return swig_%s_alter_newobject($this->%s,$value);\n", module, SWIG_PTR);
- if (baseclass) {
- Printf(s_phpclasses, "\t\t%s%s::__set($var,$value);\n", prefix, baseclass);
- } else {
- Printf(s_phpclasses, "\t\t$this->%s[$var] = $value;\n", SWIG_DATA);
- }
- Printf(s_phpclasses, "\t}\n");
- } else {
- Printf(s_phpclasses, "\n\tfunction __set($var,$value) {\n");
- Printf(s_phpclasses, "\t\tif ($var === 'thisown') return swig_%s_alter_newobject($this->%s,$value);\n", module, SWIG_PTR);
- if (baseclass) {
- Printf(s_phpclasses, "\t\t%s%s::__set($var,$value);\n", prefix, baseclass);
- } else {
- Printf(s_phpclasses, "\t\t$this->%s[$var] = $value;\n", SWIG_DATA);
- }
- Printf(s_phpclasses, "\t}\n");
- }
-
- // Write property GET handlers
- ki = First(shadow_get_vars);
- if (ki.key) {
- // This class has getters.
- Printf(s_phpclasses, "\n\tfunction __get($var) {\n");
- int non_class_getters = 0;
- for (; ki.key; ki = Next(ki)) {
- DOH *key = ki.key;
- SwigType *d = ki.item;
- if (!is_class(d)) {
- ++non_class_getters;
- continue;
- }
- Printv(s_phpclasses, "\t\tif ($var === '", key, "') return new ", prefix, Getattr(classLookup(d), "sym:name"), "(", shadow_classname, "_", key, "_get($this->", SWIG_PTR, "));\n", NIL);
- }
- // FIXME: tune this threshold...
- if (non_class_getters <= 2) {
- // Not many non-class getters, so avoid call_user_func.
- for (ki = First(shadow_get_vars); non_class_getters && ki.key; ki = Next(ki)) {
- DOH *key = ki.key;
- SwigType *d = ki.item;
- if (is_class(d)) continue;
- Printv(s_phpclasses, "\t\tif ($var === '", key, "') return ", shadow_classname, "_", key, "_get($this->", SWIG_PTR, ");\n", NIL);
- --non_class_getters;
- }
- } else {
- Printf(s_phpclasses, "\t\t$func = '%s_'.$var.'_get';\n", shadow_classname);
- Printf(s_phpclasses, "\t\tif (function_exists($func)) return call_user_func($func,$this->%s);\n", SWIG_PTR);
- }
- Printf(s_phpclasses, "\t\tif ($var === 'thisown') return swig_%s_get_newobject($this->%s);\n", module, SWIG_PTR);
- if (baseclass) {
- Printf(s_phpclasses, "\t\treturn %s%s::__get($var);\n", prefix, baseclass);
- } else {
- // Reading an unknown property name gives null in PHP.
- Printf(s_phpclasses, "\t\treturn $this->%s[$var];\n", SWIG_DATA);
- }
- Printf(s_phpclasses, "\t}\n");
-
- /* Create __isset for PHP 5.1 and later; PHP 5.0 will just ignore it. */
- /* __isset() should return true for read-only properties, so check for
- * *_get() not *_set(). */
- Printf(s_phpclasses, "\n\tfunction __isset($var) {\n");
- Printf(s_phpclasses, "\t\tif (function_exists('%s_'.$var.'_get')) return true;\n", shadow_classname);
- Printf(s_phpclasses, "\t\tif ($var === 'thisown') return true;\n");
- if (baseclass) {
- Printf(s_phpclasses, "\t\treturn %s%s::__isset($var);\n", prefix, baseclass);
- } else {
- Printf(s_phpclasses, "\t\treturn array_key_exists($var, $this->%s);\n", SWIG_DATA);
- }
- Printf(s_phpclasses, "\t}\n");
- } else {
- Printf(s_phpclasses, "\n\tfunction __get($var) {\n");
- Printf(s_phpclasses, "\t\tif ($var === 'thisown') return swig_%s_get_newobject($this->%s);\n", module, SWIG_PTR);
- if (baseclass) {
- Printf(s_phpclasses, "\t\treturn %s%s::__get($var);\n", prefix, baseclass);
- } else {
- Printf(s_phpclasses, "\t\treturn $this->%s[$var];\n", SWIG_DATA);
- }
- Printf(s_phpclasses, "\t}\n");
- Printf(s_phpclasses, "\n\tfunction __isset($var) {\n");
- Printf(s_phpclasses, "\t\tif ($var === 'thisown') return true;\n");
- if (baseclass) {
- Printf(s_phpclasses, "\t\treturn %s%s::__isset($var);\n", prefix, baseclass);
- } else {
- Printf(s_phpclasses, "\t\treturn array_key_exists($var, $this->%s);\n", SWIG_DATA);
- }
- Printf(s_phpclasses, "\t}\n");
- }
-
- if (!class_has_ctor) {
- Printf(s_phpclasses, "\tfunction __construct($h) {\n");
- Printf(s_phpclasses, "\t\t$this->%s=$h;\n", SWIG_PTR);
- Printf(s_phpclasses, "\t}\n");
- }
-
- if (s_oowrappers) {
- Printf(s_phpclasses, "%s", s_oowrappers);
- Delete(s_oowrappers);
- s_oowrappers = NULL;
- }
- class_has_ctor = false;
-
- Printf(s_phpclasses, "}\n\n");
-
- Delete(shadow_classname);
- shadow_classname = NULL;
-
- Delete(shadow_set_vars);
- shadow_set_vars = NULL;
- Delete(shadow_get_vars);
- shadow_get_vars = NULL;
- }
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * memberfunctionHandler()
- * ------------------------------------------------------------ */
-
- virtual int memberfunctionHandler(Node *n) {
- wrapperType = memberfn;
- Language::memberfunctionHandler(n);
- wrapperType = standard;
-
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * membervariableHandler()
- * ------------------------------------------------------------ */
-
- virtual int membervariableHandler(Node *n) {
- wrapperType = membervar;
- Language::membervariableHandler(n);
- wrapperType = standard;
-
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * staticmembervariableHandler()
- * ------------------------------------------------------------ */
-
- virtual int staticmembervariableHandler(Node *n) {
- wrapperType = staticmembervar;
- Language::staticmembervariableHandler(n);
- wrapperType = standard;
-
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * staticmemberfunctionHandler()
- * ------------------------------------------------------------ */
-
- virtual int staticmemberfunctionHandler(Node *n) {
- wrapperType = staticmemberfn;
- Language::staticmemberfunctionHandler(n);
- wrapperType = standard;
-
- return SWIG_OK;
- }
-
- int abstractConstructorHandler(Node *) {
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * constructorHandler()
- * ------------------------------------------------------------ */
-
- virtual int constructorHandler(Node *n) {
- constructors++;
- if (Swig_directorclass(n)) {
- String *name = GetChar(Swig_methodclass(n), "name");
- String *ctype = GetChar(Swig_methodclass(n), "classtype");
- String *sname = GetChar(Swig_methodclass(n), "sym:name");
- String *args = NewStringEmpty();
- ParmList *p = Getattr(n, "parms");
- int i;
-
- for (i = 0; p; p = nextSibling(p), i++) {
- if (i) {
- Printf(args, ", ");
- }
- if (Strcmp(GetChar(p, "type"), SwigType_str(GetChar(p, "type"), 0))) {
- SwigType *t = Getattr(p, "type");
- Printf(args, "%s", SwigType_rcaststr(t, 0));
- if (SwigType_isreference(t)) {
- Append(args, "*");
- }
- }
- Printf(args, "arg%d", i+1);
- }
-
- /* director ctor code is specific for each class */
- Delete(director_ctor_code);
- director_ctor_code = NewStringEmpty();
- director_prot_ctor_code = NewStringEmpty();
- Printf(director_ctor_code, "if ( arg0->type == IS_NULL ) { /* not subclassed */\n");
- Printf(director_prot_ctor_code, "if ( arg0->type == IS_NULL ) { /* not subclassed */\n");
- Printf(director_ctor_code, " %s = (%s *)new %s(%s);\n", Swig_cresult_name(), ctype, ctype, args);
- Printf(director_prot_ctor_code, " SWIG_PHP_Error(E_ERROR, \"accessing abstract class or protected constructor\");\n", name, name, args);
- if (i) {
- Insert(args, 0, ", ");
- }
- Printf(director_ctor_code, "} else {\n %s = (%s *)new SwigDirector_%s(arg0 TSRMLS_CC%s);\n}\n", Swig_cresult_name(), ctype, sname, args);
- Printf(director_prot_ctor_code, "} else {\n %s = (%s *)new SwigDirector_%s(arg0 TSRMLS_CC%s);\n}\n", Swig_cresult_name(), ctype, sname, args);
- Delete(args);
-
- wrapperType = directorconstructor;
- } else {
- wrapperType = constructor;
- }
- Language::constructorHandler(n);
- wrapperType = standard;
-
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * CreateZendListDestructor()
- * ------------------------------------------------------------ */
- //virtual int destructorHandler(Node *n) {
- //}
- int CreateZendListDestructor(Node *n) {
- String *name = GetChar(Swig_methodclass(n), "name");
- String *iname = GetChar(n, "sym:name");
- ParmList *l = Getattr(n, "parms");
-
- String *destructorname = NewStringEmpty();
- Printf(destructorname, "_%s", Swig_name_wrapper(iname));
- Setattr(classnode, "destructor", destructorname);
-
- Wrapper *f = NewWrapper();
- Printf(f->def, "/* This function is designed to be called by the zend list destructors */\n");
- Printf(f->def, "/* to typecast and do the actual destruction */\n");
- Printf(f->def, "static void %s(zend_rsrc_list_entry *rsrc, const char *type_name TSRMLS_DC) {\n", destructorname);
-
- Wrapper_add_localv(f, "value", "swig_object_wrapper *value=(swig_object_wrapper *) rsrc->ptr", NIL);
- Wrapper_add_localv(f, "ptr", "void *ptr=value->ptr", NIL);
- Wrapper_add_localv(f, "newobject", "int newobject=value->newobject", NIL);
-
- emit_parameter_variables(l, f);
- emit_attach_parmmaps(l, f);
-
- // Get type of first arg, thing to be destructed
- // Skip ignored arguments
- Parm *p = l;
- //while (Getattr(p,"tmap:ignore")) {p = Getattr(p,"tmap:ignore:next");}
- while (checkAttribute(p, "tmap:in:numinputs", "0")) {
- p = Getattr(p, "tmap:in:next");
- }
- SwigType *pt = Getattr(p, "type");
-
- Printf(f->code, " efree(value);\n");
- Printf(f->code, " if (! newobject) return; /* can't delete it! */\n");
- Printf(f->code, " arg1 = (%s)SWIG_ZTS_ConvertResourceData(ptr,type_name,SWIGTYPE%s TSRMLS_CC);\n", SwigType_lstr(pt, 0), SwigType_manglestr(pt));
- Printf(f->code, " if (! arg1) zend_error(E_ERROR, \"%s resource already free'd\");\n", Char(name));
-
- Setattr(n, "wrap:name", destructorname);
-
- String *actioncode = emit_action(n);
- Append(f->code, actioncode);
- Delete(actioncode);
-
- Printf(f->code, "thrown:\n");
- Append(f->code, "return;\n");
- Append(f->code, "fail:\n");
- Append(f->code, "SWIG_FAIL(TSRMLS_C);\n");
- Printf(f->code, "}\n");
-
- Wrapper_print(f, s_wrappers);
- DelWrapper(f);
-
- return SWIG_OK;
- }
-
- /* ------------------------------------------------------------
- * memberconstantHandler()
- * ------------------------------------------------------------ */
-
- virtual int memberconstantHandler(Node *n) {
- wrapping_member_constant = Getattr(n, "sym:name");
- Language::memberconstantHandler(n);
- wrapping_member_constant = NULL;
- return SWIG_OK;
- }
-
- int classDirectorInit(Node *n) {
- String *declaration = Swig_director_declaration(n);
- Printf(f_directors_h, "%s\n", declaration);
- Printf(f_directors_h, "public:\n");
- Delete(declaration);
- return Language::classDirectorInit(n);
- }
-
- int classDirectorEnd(Node *n) {
- Printf(f_directors_h, "};\n");
- return Language::classDirectorEnd(n);
- }
-
- int classDirectorConstructor(Node *n) {
- Node *parent = Getattr(n, "parentNode");
- String *decl = Getattr(n, "decl");
- String *supername = Swig_class_name(parent);
- String *classname = NewStringEmpty();
- Printf(classname, "SwigDirector_%s", supername);
-
- /* insert self parameter */
- Parm *p;
- ParmList *superparms = Getattr(n, "parms");
- ParmList *parms = CopyParmList(superparms);
- String *type = NewString("zval");
- SwigType_add_pointer(type);
- p = NewParm(type, NewString("self"), n);
- set_nextSibling(p, parms);
- parms = p;
-
- if (!Getattr(n, "defaultargs")) {
- // There should always be a "self" parameter first.
- assert(ParmList_len(parms) > 0);
-
- /* constructor */
- {
- Wrapper *w = NewWrapper();
- String *call;
- String *basetype = Getattr(parent, "classtype");
-
- // We put TSRMLS_DC after the self parameter in order to cope with
- // any default parameters.
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
- const char * p = Char(target);
- const char * comma = strchr(p, ',');
- int ins = comma ? (int)(comma - p) : Len(target) - 1;
- Insert(target, ins, " TSRMLS_DC");
-
- call = Swig_csuperclass_call(0, basetype, superparms);
- Printf(w->def, "%s::%s: %s, Swig::Director(self TSRMLS_CC) {", classname, target, call);
- Append(w->def, "}");
- Delete(target);
- Wrapper_print(w, f_directors);
- Delete(call);
- DelWrapper(w);
- }
-
- /* constructor header */
- {
- // We put TSRMLS_DC after the self parameter in order to cope with
- // any default parameters.
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
- const char * p = Char(target);
- const char * comma = strchr(p, ',');
- int ins = comma ? (int)(comma - p) : Len(target) - 1;
- Insert(target, ins, " TSRMLS_DC");
-
- Printf(f_directors_h, " %s;\n", target);
- Delete(target);
- }
- }
- return Language::classDirectorConstructor(n);
- }
-
- int classDirectorMethod(Node *n, Node *parent, String *super) {
- int is_void = 0;
- int is_pointer = 0;
- String *decl = Getattr(n, "decl");
- String *returntype = Getattr(n, "type");
- String *name = Getattr(n, "name");
- String *classname = Getattr(parent, "sym:name");
- String *c_classname = Getattr(parent, "name");
- String *symname = Getattr(n, "sym:name");
- String *declaration = NewStringEmpty();
- ParmList *l = Getattr(n, "parms");
- Wrapper *w = NewWrapper();
- String *tm;
- String *wrap_args = NewStringEmpty();
- String *value = Getattr(n, "value");
- String *storage = Getattr(n, "storage");
- bool pure_virtual = false;
- int status = SWIG_OK;
- int idx;
- bool ignored_method = GetFlag(n, "feature:ignore") ? true : false;
-
- if (Cmp(storage, "virtual") == 0) {
- if (Cmp(value, "0") == 0) {
- pure_virtual = true;
- }
- }
-
- /* determine if the method returns a pointer */
- is_pointer = SwigType_ispointer_return(decl);
- is_void = (Cmp(returntype, "void") == 0 && !is_pointer);
-
- /* virtual method definition */
- String *target;
- String *pclassname = NewStringf("SwigDirector_%s", classname);
- String *qualified_name = NewStringf("%s::%s", pclassname, name);
- SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
- Printf(w->def, "%s", target);
- Delete(qualified_name);
- Delete(target);
- /* header declaration */
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
- Printf(declaration, " virtual %s", target);
- Delete(target);
-
- // Get any exception classes in the throws typemap
- ParmList *throw_parm_list = 0;
-
- if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
- Parm *p;
- int gencomma = 0;
-
- Append(w->def, " throw(");
- Append(declaration, " throw(");
-
- if (throw_parm_list)
- Swig_typemap_attach_parms("throws", throw_parm_list, 0);
- for (p = throw_parm_list; p; p = nextSibling(p)) {
- if (Getattr(p, "tmap:throws")) {
- if (gencomma++) {
- Append(w->def, ", ");
- Append(declaration, ", ");
- }
- String *str = SwigType_str(Getattr(p, "type"), 0);
- Append(w->def, str);
- Append(declaration, str);
- Delete(str);
- }
- }
-
- Append(w->def, ")");
- Append(declaration, ")");
- }
-
- Append(w->def, " {");
- Append(declaration, ";\n");
-
- Printf(w->code, "TSRMLS_FETCH_FROM_CTX(swig_zts_ctx);\n");
-
- /* declare method return value
- * if the return value is a reference or const reference, a specialized typemap must
- * handle it, including declaration of c_result ($result).
- */
- if (!is_void) {
- if (!(ignored_method && !pure_virtual)) {
- String *cres = SwigType_lstr(returntype, "c_result");
- Printf(w->code, "%s;\n", cres);
- Delete(cres);
- }
- }
-
- if (ignored_method) {
- if (!pure_virtual) {
- if (!is_void)
- Printf(w->code, "return ");
- String *super_call = Swig_method_call(super, l);
- Printf(w->code, "%s;\n", super_call);
- Delete(super_call);
- } else {
- Printf(w->code, "Swig::DirectorPureVirtualException::raise(\"Attempted to invoke pure virtual method %s::%s\" TSRMLS_CC);\n", SwigType_namestr(c_classname),
- SwigType_namestr(name));
- }
- } else {
- /* attach typemaps to arguments (C/C++ -> PHP) */
- String *parse_args = NewStringEmpty();
-
- Swig_director_parms_fixup(l);
-
- /* remove the wrapper 'w' since it was producing spurious temps */
- Swig_typemap_attach_parms("in", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
- Swig_typemap_attach_parms("directorargout", l, w);
-
- Parm *p;
- char source[256];
-
- int outputs = 0;
- if (!is_void)
- outputs++;
-
- /* build argument list and type conversion string */
- idx = 0;
- p = l;
- while (p) {
- if (checkAttribute(p, "tmap:in:numinputs", "0")) {
- p = Getattr(p, "tmap:in:next");
- continue;
- }
-
- if (Getattr(p, "tmap:directorargout") != 0)
- outputs++;
-
- String *pname = Getattr(p, "name");
- String *ptype = Getattr(p, "type");
-
- if ((tm = Getattr(p, "tmap:directorin")) != 0) {
- String *parse = Getattr(p, "tmap:directorin:parse");
- if (!parse) {
- sprintf(source, "obj%d", idx++);
- String *input = NewStringf("&%s", source);
- Setattr(p, "emit:directorinput", input);
- Replaceall(tm, "$input", input);
- Delete(input);
- Replaceall(tm, "$owner", "0");
- Printv(wrap_args, "zval ", source, ";\n", NIL);
- Printf(wrap_args, "args[%d] = &%s;\n", idx - 1, source);
- Printv(wrap_args, "INIT_ZVAL(", source, ");\n", NIL);
-
- Printv(wrap_args, tm, "\n", NIL);
- Putc('O', parse_args);
- } else {
- Append(parse_args, parse);
- Setattr(p, "emit:directorinput", pname);
- Replaceall(tm, "$input", pname);
- Replaceall(tm, "$owner", "0");
- if (Len(tm) == 0)
- Append(tm, pname);
- }
- p = Getattr(p, "tmap:directorin:next");
- continue;
- } else if (Cmp(ptype, "void")) {
- Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number,
- "Unable to use type %s as a function argument in director method %s::%s (skipping method).\n", SwigType_str(ptype, 0),
- SwigType_namestr(c_classname), SwigType_namestr(name));
- status = SWIG_NOWRAP;
- break;
- }
- p = nextSibling(p);
- }
-
- /* exception handling */
- bool error_used_in_typemap = false;
- tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
- if (!tm) {
- tm = Getattr(n, "feature:director:except");
- if (tm)
- tm = Copy(tm);
- }
- if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) {
- if (Replaceall(tm, "$error", "error")) {
- /* Only declare error if it is used by the typemap. */
- error_used_in_typemap = true;
- Append(w->code, "int error;\n");
- }
- } else {
- Delete(tm);
- tm = NULL;
- }
-
- if (!idx) {
- Printf(w->code, "zval **args = NULL;\n");
- } else {
- Printf(w->code, "zval *args[%d];\n", idx);
- }
- Printf(w->code, "zval *%s, funcname;\n", Swig_cresult_name());
- Append(w->code, "if (!swig_self) {\n");
- Append(w->code, " SWIG_PHP_Error(E_ERROR, \"this pointer is NULL\");");
- Append(w->code, "}\n\n");
- Printf(w->code, "MAKE_STD_ZVAL(%s);\n", Swig_cresult_name());
- const char * funcname = GetChar(n, "sym:name");
- Printf(w->code, "ZVAL_STRINGL(&funcname, (char *)\"%s\", %d, 0);\n", funcname, strlen(funcname));
-
- /* wrap complex arguments to zvals */
- Printv(w->code, wrap_args, NIL);
-
- if (error_used_in_typemap) {
- Append(w->code, "error = ");
- }
- Append(w->code, "call_user_function(EG(function_table), (zval**)&swig_self, &funcname,");
- Printf(w->code, " %s, %d, args TSRMLS_CC);\n", Swig_cresult_name(), idx);
-
- if (tm) {
- Printv(w->code, Str(tm), "\n", NIL);
- Delete(tm);
- }
-
- /* marshal return value from PHP to C/C++ type */
-
- String *cleanup = NewStringEmpty();
- String *outarg = NewStringEmpty();
-
- idx = 0;
-
- /* marshal return value */
- if (!is_void) {
- tm = Swig_typemap_lookup("directorout", n, Swig_cresult_name(), w);
- if (tm != 0) {
- Replaceall(tm, "$input", Swig_cresult_name());
- char temp[24];
- sprintf(temp, "%d", idx);
- Replaceall(tm, "$argnum", temp);
-
- /* TODO check this */
- if (Getattr(n, "wrap:disown")) {
- Replaceall(tm, "$disown", "SWIG_POINTER_DISOWN");
- } else {
- Replaceall(tm, "$disown", "0");
- }
- Replaceall(tm, "$result", "c_result");
- Printv(w->code, tm, "\n", NIL);
- Delete(tm);
- } else {
- Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number,
- "Unable to use return type %s in director method %s::%s (skipping method).\n", SwigType_str(returntype, 0), SwigType_namestr(c_classname),
- SwigType_namestr(name));
- status = SWIG_ERROR;
- }
- }
-
- /* marshal outputs */
- for (p = l; p;) {
- if ((tm = Getattr(p, "tmap:directorargout")) != 0) {
- Replaceall(tm, "$result", Swig_cresult_name());
- Replaceall(tm, "$input", Getattr(p, "emit:directorinput"));
- Printv(w->code, tm, "\n", NIL);
- p = Getattr(p, "tmap:directorargout:next");
- } else {
- p = nextSibling(p);
- }
- }
-
- Printf(w->code, "FREE_ZVAL(%s);\n", Swig_cresult_name());
-
- Delete(parse_args);
- Delete(cleanup);
- Delete(outarg);
- }
-
- Append(w->code, "thrown:\n");
- if (!is_void) {
- if (!(ignored_method && !pure_virtual)) {
- String *rettype = SwigType_str(returntype, 0);
- if (!SwigType_isreference(returntype)) {
- Printf(w->code, "return (%s) c_result;\n", rettype);
- } else {
- Printf(w->code, "return (%s) *c_result;\n", rettype);
- }
- Delete(rettype);
- }
- } else {
- Append(w->code, "return;\n");
- }
-
- Append(w->code, "fail:\n");
- Append(w->code, "SWIG_FAIL(TSRMLS_C);\n");
- Append(w->code, "}\n");
-
- // We expose protected methods via an extra public inline method which makes a straight call to the wrapped class' method
- String *inline_extra_method = NewStringEmpty();
- if (dirprot_mode() && !is_public(n) && !pure_virtual) {
- Printv(inline_extra_method, declaration, NIL);
- String *extra_method_name = NewStringf("%sSwigPublic", name);
- Replaceall(inline_extra_method, name, extra_method_name);
- Replaceall(inline_extra_method, ";\n", " {\n ");
- if (!is_void)
- Printf(inline_extra_method, "return ");
- String *methodcall = Swig_method_call(super, l);
- Printv(inline_extra_method, methodcall, ";\n }\n", NIL);
- Delete(methodcall);
- Delete(extra_method_name);
- }
-
- /* emit the director method */
- if (status == SWIG_OK) {
- if (!Getattr(n, "defaultargs")) {
- Replaceall(w->code, "$symname", symname);
- Wrapper_print(w, f_directors);
- Printv(f_directors_h, declaration, NIL);
- Printv(f_directors_h, inline_extra_method, NIL);
- }
- }
-
- /* clean up */
- Delete(wrap_args);
- Delete(pclassname);
- DelWrapper(w);
- return status;
- }
-
- int classDirectorDisown(Node *) {
- return SWIG_OK;
- }
-}; /* class PHP */
-
-static PHP5 *maininstance = 0;
-
-// We use this function to be able to write out zend_register_list_destructor_ex
-// lines for most things in the type table
-// NOTE: it's a function NOT A PHP5::METHOD
-extern "C" {
-static void typetrace(const SwigType *ty, String *mangled, String *clientdata) {
- Node *class_node;
- if (!zend_types) {
- zend_types = NewHash();
- }
- // we want to know if the type which reduced to this has a constructor
- if ((class_node = maininstance->classLookup(ty))) {
- if (!Getattr(zend_types, mangled)) {
- // OK it may have been set before by a different SwigType but it would
- // have had the same underlying class node I think
- // - it is certainly required not to have different originating class
- // nodes for the same SwigType
- Setattr(zend_types, mangled, class_node);
- }
- } else { // a non-class pointer
- Setattr(zend_types, mangled, NOTCLASS);
- }
- if (r_prevtracefunc)
- (*r_prevtracefunc) (ty, mangled, (String *) clientdata);
-}
-}
-
-/* -----------------------------------------------------------------------------
- * new_swig_php5() - Instantiate module
- * ----------------------------------------------------------------------------- */
-
-static Language *new_swig_php5() {
- maininstance = new PHP5;
- if (!r_prevtracefunc) {
- r_prevtracefunc = SwigType_remember_trace(typetrace);
- } else {
- Printf(stderr, "php Typetrace vector already saved!\n");
- assert(0);
- }
- return maininstance;
-}
-
-extern "C" Language *swig_php4(void) {
- Printf(stderr, "*** -php4 is no longer supported.\n"
- "*** Either upgrade to PHP5 or use SWIG 1.3.36 or earlier.\n");
- SWIG_exit(EXIT_FAILURE);
- return NULL; // To avoid compiler warnings.
-}
-
-extern "C" Language *swig_php5(void) {
- return new_swig_php5();
-}
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index a6801fc4e..ea31af029 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------------
- * This file is part of SWIG, which is licensed as a whole under version 3
+ * This file is part of SWIG, which is licensed as a whole under version 3
* (or any later version) of the GNU General Public License. Some additional
* terms also apply to certain portions of SWIG. The full details of the SWIG
* license and copyrights can be found in the LICENSE and COPYRIGHT files
@@ -16,11 +16,16 @@
#include "cparse.h"
#include <ctype.h>
#include <errno.h>
-#include <stdlib.h>
+#include "pydoc.h"
+
+#include <stdint.h>
#define PYSHADOW_MEMBER 0x2
#define WARN_PYTHON_MULTIPLE_INH 405
+#define PYTHON_INT_MAX (2147483647)
+#define PYTHON_INT_MIN (-2147483647-1)
+
static String *const_code = 0;
static String *module = 0;
static String *package = 0;
@@ -56,12 +61,10 @@ static String *builtin_default_unref = 0;
static String *builtin_closures_code = 0;
static String *methods;
+static String *methods_proxydocs;
static String *class_name;
static String *shadow_indent = 0;
static int in_class = 0;
-static int classic = 0;
-static int modern = 0;
-static int new_repr = 1;
static int no_header_file = 0;
static int max_bases = 0;
static int builtin_bases_needed = 0;
@@ -77,24 +80,15 @@ static String *real_classname;
/* Thread Support */
static int threads = 0;
static int nothreads = 0;
-static int classptr = 0;
+
/* Other options */
-static int shadowimport = 1;
-static int buildnone = 0;
-static int nobuildnone = 0;
-static int safecstrings = 0;
static int dirvtable = 0;
-static int proxydel = 1;
-static int fastunpack = 0;
+static int doxygen = 0;
+static int fastunpack = 1;
static int fastproxy = 0;
-static int fastquery = 0;
-static int fastinit = 0;
static int olddefs = 0;
-static int modernargs = 0;
-static int aliasobj0 = 0;
static int castmode = 0;
static int extranative = 0;
-static int outputtuple = 0;
static int nortti = 0;
static int relativeimport = 0;
@@ -105,68 +99,38 @@ enum autodoc_t {
AUTODOC_DTOR,
AUTODOC_STATICFUNC,
AUTODOC_FUNC,
- AUTODOC_METHOD
+ AUTODOC_METHOD,
+ AUTODOC_CONST,
+ AUTODOC_VAR
};
static const char *usage1 = "\
Python Options (available with -python)\n\
- -aliasobj0 - Alias obj0 when using fastunpack, needed for some old typemaps \n\
- -buildnone - Use Py_BuildValue(" ") to obtain Py_None (default in Windows)\n\
- -builtin - Create new python built-in types, rather than proxy classes, for better performance\n\
- -castmode - Enable the casting mode, which allows implicit cast between types in python\n\
- -classic - Use classic classes only\n\
- -classptr - Generate shadow 'ClassPtr' as in older swig versions\n\
- -cppcast - Enable C++ casting operators (default) \n\
- -dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\
- -extranative - Return extra native C++ wraps for std containers when possible \n\
- -fastinit - Use fast init mechanism for classes (default)\n\
- -fastunpack - Use fast unpack mechanism to parse the argument functions \n\
- -fastproxy - Use fast proxy mechanism for member methods \n\
- -fastquery - Use fast query mechanism for types \n\
- -globals <name> - Set <name> used to access C global variable [default: 'cvar']\n\
- -interface <lib>- Set the lib name to <lib>\n\
- -keyword - Use keyword arguments\n\
- -modern - Use modern python features only, without compatibility code\n\
- -modernargs - Use \"modern\" args mechanism to pack/unpack the function arguments\n";
+ -builtin - Create Python built-in types rather than proxy classes, for better performance\n\
+ -castmode - Enable the casting mode, which allows implicit cast between types in Python\n\
+ -debug-doxygen-parser - Display doxygen parser module debugging information\n\
+ -debug-doxygen-translator - Display doxygen translator module debugging information\n\
+ -dirvtable - Generate a pseudo virtual table for directors for faster dispatch\n\
+ -doxygen - Convert C++ doxygen comments to pydoc comments in proxy classes\n\
+ -extranative - Return extra native wrappers for C++ std containers wherever possible\n\
+ -fastproxy - Use fast proxy mechanism for member methods\n\
+ -globals <name> - Set <name> used to access C global variable (default: 'cvar')\n\
+ -interface <mod>- Set low-level C/C++ module name to <mod> (default: module name prefixed by '_')\n\
+ -keyword - Use keyword arguments\n";
static const char *usage2 = "\
- -newrepr - Use more informative version of __repr__ in proxy classes (default) \n\
- -newvwm - New value wrapper mode, use only when everything else fails \n\
- -noaliasobj0 - Don't generate an obj0 alias when using fastunpack (default) \n\
- -nobuildnone - Access Py_None directly (default in non-Windows systems)\n\
- -nocastmode - Disable the casting mode (default)\n\
- -nocppcast - Disable C++ casting operators, useful for generating bugs\n\
- -nodirvtable - Don't use the virtual table feature, resolve the python method each time (default)\n\
- -noexcept - No automatic exception handling\n\
- -noextranative - Don't use extra native C++ wraps for std containers when possible (default) \n\
- -nofastinit - Use traditional init mechanism for classes \n\
- -nofastunpack - Use traditional UnpackTuple method to parse the argument functions (default) \n\
- -nofastproxy - Use traditional proxy mechanism for member methods (default) \n\
- -nofastquery - Use traditional query mechanism for types (default) \n\
- -noh - Don't generate the output header file\n\
- -nomodern - Don't use modern python features which are not backwards compatible \n\
- -nomodernargs - Use classic ParseTuple/CallFunction methods to pack/unpack the function arguments (default) \n";
+ -nofastunpack - Use traditional UnpackTuple method to parse the argument functions\n\
+ -noh - Don't generate the output header file\n";
static const char *usage3 = "\
- -noolddefs - Don't emit the old method definitions even when using fastproxy (default) \n\
- -nooutputtuple - Use a PyList for appending output values (default) \n\
- -noproxy - Don't generate proxy classes \n\
- -noproxydel - Don't generate the redundant __del__ method \n\
- -noproxyimport - Don't insert proxy import statements derived from the %import directive \n\
+ -noproxy - Don't generate proxy classes\n\
-nortti - Disable the use of the native C++ RTTI with directors\n\
- -nosafecstrings - Avoid extra strings copies when possible (default)\n\
-nothreads - Disable thread support for the entire interface\n\
- -olddefs - Keep the old method definitions even when using fastproxy\n\
- -oldrepr - Use shorter and old version of __repr__ in proxy classes\n\
- -outputtuple - Use a PyTuple for outputs instead of a PyList (use carefully with legacy interfaces) \n\
- -proxydel - Generate a __del__ method even though it is now redundant (default) \n\
- -relativeimport - Use relative python imports \n\
- -safecstrings - Use safer (but slower) C string mapping, generating copies from Python -> C/C++\n\
+ -olddefs - Keep the old method definitions when using -fastproxy\n\
+ -py3 - Generate code with Python 3 specific features and syntax\n\
+ -relativeimport - Use relative Python imports\n\
-threads - Add thread support for all the interface\n\
- -O - Enable the following optimization options: \n\
- -modern -fastdispatch -nosafecstrings -fvirtual -noproxydel \n\
- -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone \n\
- -py3 - Generate code with Python 3 specific features:\n\
- Function annotation \n\
+ -O - Enable the following optimization options:\n\
+ -fastdispatch -fastproxy -fvirtual\n\
\n";
static String *getSlot(Node *n = NULL, const char *key = NULL, String *default_slot = NULL) {
@@ -177,7 +141,7 @@ static String *getSlot(Node *n = NULL, const char *key = NULL, String *default_s
static void printSlot(File *f, String *slotval, const char *slotname, const char *functype = NULL) {
String *slotval_override = 0;
- if (functype)
+ if (functype && Strcmp(slotval, "0") == 0)
slotval = slotval_override = NewStringf("(%s) %s", functype, slotval);
int len = Len(slotval);
int fieldwidth = len > 41 ? (len > 61 ? 0 : 61 - len) : 41 - len;
@@ -199,6 +163,7 @@ static String *getClosure(String *functype, String *wrapper, int funpack = 0) {
"ssizessizeargfunc", "SWIGPY_SSIZESSIZEARGFUNC_CLOSURE",
"ssizeobjargproc", "SWIGPY_SSIZEOBJARGPROC_CLOSURE",
"ssizessizeobjargproc", "SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE",
+ "objobjproc", "SWIGPY_OBJOBJPROC_CLOSURE",
"objobjargproc", "SWIGPY_OBJOBJARGPROC_CLOSURE",
"reprfunc", "SWIGPY_REPRFUNC_CLOSURE",
"hashfunc", "SWIGPY_HASHFUNC_CLOSURE",
@@ -218,6 +183,7 @@ static String *getClosure(String *functype, String *wrapper, int funpack = 0) {
"ssizessizeargfunc", "SWIGPY_SSIZESSIZEARGFUNC_CLOSURE",
"ssizeobjargproc", "SWIGPY_SSIZEOBJARGPROC_CLOSURE",
"ssizessizeobjargproc", "SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE",
+ "objobjproc", "SWIGPY_FUNPACK_OBJOBJPROC_CLOSURE",
"objobjargproc", "SWIGPY_OBJOBJARGPROC_CLOSURE",
"reprfunc", "SWIGPY_REPRFUNC_CLOSURE",
"hashfunc", "SWIGPY_HASHFUNC_CLOSURE",
@@ -255,6 +221,11 @@ public:
director_multiple_inheritance = 1;
director_language = 1;
}
+
+ ~PYTHON() {
+ delete doxygenTranslator;
+ }
+
/* ------------------------------------------------------------
* Thread Implementation
* ------------------------------------------------------------ */
@@ -326,10 +297,11 @@ public:
* ------------------------------------------------------------ */
virtual void main(int argc, char *argv[]) {
- int cppcast = 1;
SWIG_library_directory("python");
+ int doxygen_translator_flags = 0;
+
for (int i = 1; i < argc; i++) {
if (argv[i]) {
if (strcmp(argv[i], "-interface") == 0) {
@@ -354,42 +326,13 @@ public:
} else if ((strcmp(argv[i], "-shadow") == 0) || ((strcmp(argv[i], "-proxy") == 0))) {
shadow = 1;
Swig_mark_arg(i);
- } else if ((strcmp(argv[i], "-new_repr") == 0) || (strcmp(argv[i], "-newrepr") == 0)) {
- new_repr = 1;
- Swig_mark_arg(i);
- } else if ((strcmp(argv[i], "-old_repr") == 0) || (strcmp(argv[i], "-oldrepr") == 0)) {
- new_repr = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-classptr") == 0) {
- classptr = 1;
- Swig_mark_arg(i);
} else if ((strcmp(argv[i], "-noproxy") == 0)) {
shadow = 0;
Swig_mark_arg(i);
- } else if ((strcmp(argv[i], "-noproxyimport") == 0)) {
- shadowimport = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-keyword") == 0) {
use_kw = 1;
SWIG_cparse_set_compact_default_args(1);
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-classic") == 0) {
- classic = 1;
- modernargs = 0;
- modern = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-cppcast") == 0) {
- cppcast = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nocppcast") == 0) {
- cppcast = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-outputtuple") == 0) {
- outputtuple = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nooutputtuple") == 0) {
- outputtuple = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-nortti") == 0) {
nortti = 1;
Swig_mark_arg(i);
@@ -397,31 +340,21 @@ public:
threads = 1;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-nothreads") == 0) {
- /* Turn off thread suppor mode */
+ /* Turn off thread support mode */
nothreads = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-safecstrings") == 0) {
- safecstrings = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nosafecstrings") == 0) {
- safecstrings = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-buildnone") == 0) {
- buildnone = 1;
- nobuildnone = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nobuildnone") == 0) {
- buildnone = 0;
- nobuildnone = 1;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-dirvtable") == 0) {
dirvtable = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nodirvtable") == 0) {
- dirvtable = 0;
+ } else if (strcmp(argv[i], "-doxygen") == 0) {
+ doxygen = 1;
+ scan_doxygen_comments = 1;
+ Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-debug-doxygen-translator") == 0) {
+ doxygen_translator_flags |= DoxygenTranslator::debug_translator;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-fastunpack") == 0) {
- fastunpack = 1;
+ } else if (strcmp(argv[i], "-debug-doxygen-parser") == 0) {
+ doxygen_translator_flags |= DoxygenTranslator::debug_parser;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-nofastunpack") == 0) {
fastunpack = 0;
@@ -429,87 +362,26 @@ public:
} else if (strcmp(argv[i], "-fastproxy") == 0) {
fastproxy = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nofastproxy") == 0) {
- fastproxy = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-fastquery") == 0) {
- fastquery = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nofastquery") == 0) {
- fastquery = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-fastinit") == 0) {
- fastinit = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nofastinit") == 0) {
- fastinit = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-olddefs") == 0) {
olddefs = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-noolddefs") == 0) {
- olddefs = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-castmode") == 0) {
castmode = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nocastmode") == 0) {
- castmode = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-extranative") == 0) {
extranative = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-noextranative") == 0) {
- extranative = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-modernargs") == 0) {
- modernargs = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nomodernargs") == 0) {
- modernargs = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-aliasobj0") == 0) {
- aliasobj0 = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-noaliasobj0") == 0) {
- aliasobj0 = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-proxydel") == 0) {
- proxydel = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-noproxydel") == 0) {
- proxydel = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-modern") == 0) {
- classic = 0;
- modern = 1;
- modernargs = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nomodern") == 0) {
- modern = 0;
- modernargs = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-noh") == 0) {
no_header_file = 1;
Swig_mark_arg(i);
- } else if ((strcmp(argv[i], "-new_vwm") == 0) || (strcmp(argv[i], "-newvwm") == 0)) {
- /* Turn on new value wrapper mpde */
+ } else if (strcmp(argv[i], "-newvwm") == 0) {
+ /* Turn on new value wrapper mode */
+ /* Undocumented option, did have -help text: New value wrapper mode, use only when everything else fails */
Swig_value_wrapper_mode(1);
no_header_file = 1;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-O") == 0) {
- classic = 0;
- modern = 1;
- safecstrings = 0;
- buildnone = 0;
- nobuildnone = 1;
- classptr = 0;
- proxydel = 0;
- fastunpack = 1;
fastproxy = 1;
- fastinit = 1;
- fastquery = 1;
- modernargs = 1;
Wrapper_fast_dispatch_mode_set(1);
Wrapper_virtual_elimination_mode_set(1);
Swig_mark_arg(i);
@@ -528,19 +400,52 @@ public:
} else if (strcmp(argv[i], "-relativeimport") == 0) {
relativeimport = 1;
Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-cppcast") == 0 ||
+ strcmp(argv[i], "-fastinit") == 0 ||
+ strcmp(argv[i], "-fastquery") == 0 ||
+ strcmp(argv[i], "-fastunpack") == 0 ||
+ strcmp(argv[i], "-modern") == 0 ||
+ strcmp(argv[i], "-modernargs") == 0 ||
+ strcmp(argv[i], "-noproxydel") == 0 ||
+ strcmp(argv[i], "-safecstrings") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
+ Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-aliasobj0") == 0 ||
+ strcmp(argv[i], "-buildnone") == 0 ||
+ strcmp(argv[i], "-classic") == 0 ||
+ strcmp(argv[i], "-classptr") == 0 ||
+ strcmp(argv[i], "-new_repr") == 0 ||
+ strcmp(argv[i], "-new_vwm") == 0 ||
+ strcmp(argv[i], "-newrepr") == 0 ||
+ strcmp(argv[i], "-noaliasobj0") == 0 ||
+ strcmp(argv[i], "-nobuildnone") == 0 ||
+ strcmp(argv[i], "-nocastmode") == 0 ||
+ strcmp(argv[i], "-nocppcast") == 0 ||
+ strcmp(argv[i], "-nodirvtable") == 0 ||
+ strcmp(argv[i], "-noextranative") == 0 ||
+ strcmp(argv[i], "-nofastinit") == 0 ||
+ strcmp(argv[i], "-nofastproxy") == 0 ||
+ strcmp(argv[i], "-nofastquery") == 0 ||
+ strcmp(argv[i], "-nomodern") == 0 ||
+ strcmp(argv[i], "-nomodernargs") == 0 ||
+ strcmp(argv[i], "-noolddefs") == 0 ||
+ strcmp(argv[i], "-nooutputtuple") == 0 ||
+ strcmp(argv[i], "-noproxyimport") == 0 ||
+ strcmp(argv[i], "-nosafecstrings") == 0 ||
+ strcmp(argv[i], "-old_repr") == 0 ||
+ strcmp(argv[i], "-oldrepr") == 0 ||
+ strcmp(argv[i], "-outputtuple") == 0 ||
+ strcmp(argv[i], "-proxydel") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
+ Swig_mark_arg(i);
+ SWIG_exit(EXIT_FAILURE);
}
}
}
- if (py3) {
- /* force disable features that not compatible with Python 3.x */
- classic = 0;
- }
-
- if (cppcast) {
- Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
- }
+ if (doxygen)
+ doxygenTranslator = new PyDocConverter(doxygen_translator_flags);
if (!global_name)
global_name = NewString("cvar");
@@ -556,12 +461,12 @@ public:
* ------------------------------------------------------------ */
virtual int top(Node *n) {
- /* check if directors are enabled for this module. note: this
+ /* check if directors are enabled for this module. note: this
* is a "master" switch, without which no director code will be
* emitted. %feature("director") statements are also required
* to enable directors for individual classes or methods.
*
- * use %module(directors="1") modulename at the start of the
+ * use %module(directors="1") modulename at the start of the
* interface file to enable director generation.
*/
String *mod_docstring = NULL;
@@ -590,19 +495,23 @@ public:
castmode = 1;
}
if (Getattr(options, "nocastmode")) {
- castmode = 0;
+ Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "nocastmode");
+ SWIG_exit(EXIT_FAILURE);
}
if (Getattr(options, "extranative")) {
extranative = 1;
}
if (Getattr(options, "noextranative")) {
- extranative = 0;
+ Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "noextranative");
+ SWIG_exit(EXIT_FAILURE);
}
if (Getattr(options, "outputtuple")) {
- outputtuple = 1;
+ Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "outputtuple");
+ SWIG_exit(EXIT_FAILURE);
}
if (Getattr(options, "nooutputtuple")) {
- outputtuple = 0;
+ Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "nooutputtuple");
+ SWIG_exit(EXIT_FAILURE);
}
mod_docstring = Getattr(options, "docstring");
package = Getattr(options, "package");
@@ -663,6 +572,7 @@ public:
const_code = NewString("");
methods = NewString("");
+ methods_proxydocs = NewString("");
Swig_banner(f_begin);
@@ -678,26 +588,10 @@ public:
Printf(f_runtime, "#define SWIG_PYTHON_THREADS\n");
}
- if (safecstrings) {
- Printf(f_runtime, "#define SWIG_PYTHON_SAFE_CSTRINGS\n");
- }
-
- if (buildnone) {
- Printf(f_runtime, "#define SWIG_PYTHON_BUILD_NONE\n");
- }
-
- if (nobuildnone) {
- Printf(f_runtime, "#define SWIG_PYTHON_NO_BUILD_NONE\n");
- }
-
if (!dirvtable) {
Printf(f_runtime, "#define SWIG_PYTHON_DIRECTOR_NO_VTABLE\n");
}
- if (outputtuple) {
- Printf(f_runtime, "#define SWIG_PYTHON_OUTPUT_TUPLE\n");
- }
-
if (nortti) {
Printf(f_runtime, "#ifndef SWIG_DIRECTOR_NORTTI\n");
Printf(f_runtime, "#define SWIG_DIRECTOR_NORTTI\n");
@@ -713,46 +607,16 @@ public:
Printf(f_runtime, "#define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS\n");
}
- if (classic) {
- Printf(f_runtime, "#define SWIG_PYTHON_CLASSIC\n");
- }
-
if (builtin) {
Printf(f_runtime, "#define SWIGPYTHON_BUILTIN\n");
}
Printf(f_runtime, "\n");
- Printf(f_header, "#if (PY_VERSION_HEX <= 0x02000000)\n");
- Printf(f_header, "# if !defined(SWIG_PYTHON_CLASSIC)\n");
- Printf(f_header, "# error \"This python version requires swig to be run with the '-classic' option\"\n");
- Printf(f_header, "# endif\n");
+ Printf(f_header, "#ifdef SWIG_TypeQuery\n");
+ Printf(f_header, "# undef SWIG_TypeQuery\n");
Printf(f_header, "#endif\n");
-
- if (modern) {
- Printf(f_header, "#if (PY_VERSION_HEX <= 0x02020000)\n");
- Printf(f_header, "# error \"This python version requires swig to be run with the '-nomodern' option\"\n");
- Printf(f_header, "#endif\n");
- }
-
- if (modernargs) {
- Printf(f_header, "#if (PY_VERSION_HEX <= 0x02020000)\n");
- Printf(f_header, "# error \"This python version requires swig to be run with the '-nomodernargs' option\"\n");
- Printf(f_header, "#endif\n");
- }
-
- if (fastunpack) {
- Printf(f_header, "#ifndef METH_O\n");
- Printf(f_header, "# error \"This python version requires swig to be run with the '-nofastunpack' option\"\n");
- Printf(f_header, "#endif\n");
- }
-
- if (fastquery) {
- Printf(f_header, "#ifdef SWIG_TypeQuery\n");
- Printf(f_header, "# undef SWIG_TypeQuery\n");
- Printf(f_header, "#endif\n");
- Printf(f_header, "#define SWIG_TypeQuery SWIG_Python_TypeQuery\n");
- }
+ Printf(f_header, "#define SWIG_TypeQuery SWIG_Python_TypeQuery\n");
/* Set module name */
@@ -805,184 +669,95 @@ public:
Swig_register_filebyname("shadow", f_shadow);
Swig_register_filebyname("python", f_shadow);
- if (mod_docstring) {
- if (Len(mod_docstring)) {
- const char *triple_double = "\"\"\"";
- // follow PEP257 rules: https://www.python.org/dev/peps/pep-0257/
- // reported by pep257: https://github.com/GreenSteam/pep257
- bool multi_line_ds = Strchr(mod_docstring, '\n') != 0;
- Printv(f_shadow_after_begin, "\n", triple_double, multi_line_ds ? "\n":"", mod_docstring, multi_line_ds ? "\n":"", triple_double, "\n", NIL);
- }
- Delete(mod_docstring);
- mod_docstring = NULL;
- }
-
- Printv(default_import_code, "\nfrom sys import version_info as _swig_python_version_info\n", NULL);
-
- if (!builtin && fastproxy) {
- Printv(default_import_code, "if _swig_python_version_info >= (3, 0, 0):\n", NULL);
- Printf(default_import_code, tab4 "new_instancemethod = lambda func, inst, cls: %s.SWIG_PyInstanceMethod_New(func)\n", module);
- Printv(default_import_code, "else:\n", NULL);
- Printv(default_import_code, tab4, "from new import instancemethod as new_instancemethod\n", NULL);
- }
-
- /* Import the C-extension module. This should be a relative import,
- * since the shadow module may also have been imported by a relative
- * import, and there is thus no guarantee that the C-extension is on
- * sys.path. Relative imports must be explicitly specified from 2.6.0
- * onwards (implicit relative imports will raise a DeprecationWarning
- * in 2.6, and fail in 2.7 onwards), but the relative import syntax
- * isn't available in python 2.4 or earlier, so we have to write some
- * code conditional on the python version.
- *
- * For python 2.7.0 and newer, first determine the shadow wrappers package
- * based on the __name__ it was given by the importer that loaded it.
- * Then construct a name for the module based on the package name and the
- * module name (we know the module name). Use importlib to try and load
- * it. If an attempt to load the module with importlib fails with an
- * ImportError then fallback and try and load just the module name from
- * the global namespace.
- */
- Printv(default_import_code, "if _swig_python_version_info >= (2, 7, 0):\n", NULL);
- Printv(default_import_code, tab4, "def swig_import_helper():\n", NULL);
- Printv(default_import_code, tab8, "import importlib\n", NULL);
- Printv(default_import_code, tab8, "pkg = __name__.rpartition('.')[0]\n", NULL);
- Printf(default_import_code, tab8 "mname = '.'.join((pkg, '%s')).lstrip('.')\n", module);
- Printv(default_import_code, tab8, "try:\n", NULL);
- Printv(default_import_code, tab8, tab4, "return importlib.import_module(mname)\n", NULL);
- Printv(default_import_code, tab8, "except ImportError:\n", NULL);
- Printf(default_import_code, tab8 tab4 "return importlib.import_module('%s')\n", module);
- Printf(default_import_code, tab4 "%s = swig_import_helper()\n", module);
- Printv(default_import_code, tab4, "del swig_import_helper\n", NULL);
- Printv(default_import_code, "elif _swig_python_version_info >= (2, 6, 0):\n", NULL);
- Printv(default_import_code, tab4, "def swig_import_helper():\n", NULL);
- Printv(default_import_code, tab8, "from os.path import dirname\n", NULL);
- Printv(default_import_code, tab8, "import imp\n", NULL);
- Printv(default_import_code, tab8, "fp = None\n", NULL);
- Printv(default_import_code, tab8, "try:\n", NULL);
- Printf(default_import_code, tab4 tab8 "fp, pathname, description = imp.find_module('%s', [dirname(__file__)])\n", module);
- Printf(default_import_code, tab8 "except ImportError:\n");
- /* At here, the module may already loaded, so simply import it. */
- Printf(default_import_code, tab4 tab8 "import %s\n", module);
- Printf(default_import_code, tab4 tab8 "return %s\n", module);
- Printv(default_import_code, tab8 "try:\n", NULL);
- /* imp.load_module() handles fp being None. */
- Printf(default_import_code, tab4 tab8 "_mod = imp.load_module('%s', fp, pathname, description)\n", module);
- Printv(default_import_code, tab8, "finally:\n", NULL);
- Printv(default_import_code, tab4 tab8 "if fp is not None:\n", NULL);
- Printv(default_import_code, tab8 tab8, "fp.close()\n", NULL);
- Printv(default_import_code, tab8, "return _mod\n", NULL);
- Printf(default_import_code, tab4 "%s = swig_import_helper()\n", module);
- Printv(default_import_code, tab4, "del swig_import_helper\n", NULL);
- Printv(default_import_code, "else:\n", NULL);
- Printf(default_import_code, tab4 "import %s\n", module);
-
- if (builtin) {
- /*
- * Pull in all the attributes from the C module.
- *
- * An alternative approach to doing this if/else chain was
- * proposed by Michael Thon. Someone braver than I may try it out.
- * I fear some current swig user may depend on some side effect
- * of from _foo import *
- *
- * for attr in _foo.__all__:
- * globals()[attr] = getattr(_foo, attr)
- *
- */
- Printf(default_import_code, "# pull in all the attributes from %s\n", module);
- Printv(default_import_code, "if __name__.rpartition('.')[0] != '':\n", NULL);
- Printv(default_import_code, tab4, "if _swig_python_version_info >= (2, 7, 0):\n", NULL);
- Printv(default_import_code, tab8, "try:\n", NULL);
- Printf(default_import_code, tab8 tab4 "from .%s import *\n", module);
- Printv(default_import_code, tab8 "except ImportError:\n", NULL);
- Printf(default_import_code, tab8 tab4 "from %s import *\n", module);
- Printv(default_import_code, tab4, "else:\n", NULL);
- Printf(default_import_code, tab8 "from %s import *\n", module);
+ if (!builtin) {
+ /* Import the low-level C/C++ module. This should be a relative import,
+ * since the shadow module may also have been imported by a relative
+ * import, and there is thus no guarantee that the low-level C/C++ module is on
+ * sys.path. Relative imports must be explicitly specified from 2.6.0
+ * onwards (implicit relative imports raised a DeprecationWarning in 2.6,
+ * and fail in 2.7 onwards).
+ *
+ * First check for __package__ which is available from 2.6 onwards, see PEP366.
+ * Next try determine the shadow wrapper's package based on the __name__ it
+ * was given by the importer that loaded it.
+ * If the module is in a package, load the low-level C/C++ module from the
+ * same package, otherwise load it as a global module.
+ */
+ Printv(default_import_code, "# Import the low-level C/C++ module\n", NULL);
+ Printv(default_import_code, "if __package__ or \".\" in __name__:\n", NULL);
+ Printv(default_import_code, tab4, "from . import ", module, "\n", NULL);
Printv(default_import_code, "else:\n", NULL);
- Printf(default_import_code, tab4 "from %s import *\n", module);
- }
-
- /* Delete the _swig_python_version_info symbol since we don't use it elsewhere in the
- * module. */
- Printv(default_import_code, "del _swig_python_version_info\n\n", NULL);
-
- if (modern || !classic) {
- Printv(f_shadow, "try:\n", tab4, "_swig_property = property\n", "except NameError:\n", tab4, "pass # Python < 2.2 doesn't have 'property'.\n\n", NULL);
+ Printv(default_import_code, tab4, "import ", module, "\n", NULL);
+ } else {
+ Printv(default_import_code, "# Pull in all the attributes from the low-level C/C++ module\n", NULL);
+ Printv(default_import_code, "if __package__ or \".\" in __name__:\n", NULL);
+ Printv(default_import_code, tab4, "from .", module, " import *\n", NULL);
+ Printv(default_import_code, "else:\n", NULL);
+ Printv(default_import_code, tab4, "from ", module, " import *\n", NULL);
}
/* Need builtins to qualify names like Exception that might also be
defined in this module (try both Python 3 and Python 2 names) */
Printv(f_shadow, "try:\n", tab4, "import builtins as __builtin__\n", "except ImportError:\n", tab4, "import __builtin__\n", NULL);
- /* if (!modern) */
- /* always needed, a class can be forced to be no-modern, such as an exception */
- {
- // Python-2.2 object hack
- Printv(f_shadow,
- "\n", "def _swig_setattr_nondynamic(self, class_type, name, value, static=1):\n",
- tab4, "if (name == \"thisown\"):\n", tab8, "return self.this.own(value)\n",
- tab4, "if (name == \"this\"):\n", tab8, "if type(value).__name__ == 'SwigPyObject':\n", tab4, tab8, "self.__dict__[name] = value\n",
-#ifdef USE_THISOWN
- tab4, tab8, "if hasattr(value,\"thisown\"):\n", tab8, tab8, "self.__dict__[\"thisown\"] = value.thisown\n", tab4, tab8, "del value.thisown\n",
-#endif
- tab4, tab8, "return\n", tab4, "method = class_type.__swig_setmethods__.get(name, None)\n", tab4, "if method:\n", tab4, tab4, "return method(self, value)\n",
-#ifdef USE_THISOWN
- tab4, "if (not static) or (name == \"thisown\"):\n",
-#else
- tab4, "if (not static):\n",
-#endif
- NIL);
- if (!classic) {
- if (!modern)
- Printv(f_shadow, tab4, tab4, "if _newclass:\n", tab4, NIL);
- Printv(f_shadow, tab4, tab4, "object.__setattr__(self, name, value)\n", NIL);
- if (!modern)
- Printv(f_shadow, tab4, tab4, "else:\n", tab4, NIL);
- }
- if (classic || !modern)
- Printv(f_shadow, tab4, tab4, "self.__dict__[name] = value\n", NIL);
- Printv(f_shadow,
- tab4, "else:\n",
- tab4, tab4, "raise AttributeError(\"You cannot add attributes to %s\" % self)\n\n",
- "\n", "def _swig_setattr(self, class_type, name, value):\n", tab4, "return _swig_setattr_nondynamic(self, class_type, name, value, 0)\n\n", NIL);
-
- Printv(f_shadow,
- "\n", "def _swig_getattr(self, class_type, name):\n",
- tab4, "if (name == \"thisown\"):\n", tab8, "return self.this.own()\n",
- tab4, "method = class_type.__swig_getmethods__.get(name, None)\n",
- tab4, "if method:\n", tab8, "return method(self)\n",
- tab4, "raise AttributeError(\"'%s' object has no attribute '%s'\" % (class_type.__name__, name))\n\n", NIL);
-
- Printv(f_shadow,
- "\n", "def _swig_repr(self):\n",
- tab4, "try:\n", tab8, "strthis = \"proxy of \" + self.this.__repr__()\n",
- tab4, "except __builtin__.Exception:\n", tab8, "strthis = \"\"\n", tab4, "return \"<%s.%s; %s >\" % (self.__class__.__module__, self.__class__.__name__, strthis,)\n\n", NIL);
-
- if (!classic && !modern) {
- Printv(f_shadow,
- "try:\n",
- tab4, "_object = object\n", tab4, "_newclass = 1\n",
- "except __builtin__.Exception:\n",
- tab4, "class _object:\n", tab8, "pass\n", tab4, "_newclass = 0\n\n", NIL);
- }
- }
- if (modern) {
- Printv(f_shadow, "\n", "def _swig_setattr_nondynamic_method(set):\n", tab4, "def set_attr(self, name, value):\n",
+ if (!builtin && fastproxy) {
+ Printf(f_shadow, "\n");
+ Printf(f_shadow, "_swig_new_instance_method = %s.SWIG_PyInstanceMethod_New\n", module);
+ Printf(f_shadow, "_swig_new_static_method = %s.SWIG_PyStaticMethod_New\n", module);
+ }
+
+ Printv(f_shadow, "\n",
+ "def _swig_repr(self):\n",
+ tab4, "try:\n",
+ tab4, tab4, "strthis = \"proxy of \" + self.this.__repr__()\n",
+ tab4, "except __builtin__.Exception:\n",
+ tab4, tab4, "strthis = \"\"\n",
+ tab4, "return \"<%s.%s; %s >\" % (self.__class__.__module__, self.__class__.__name__, strthis,)\n\n", NIL);
+
+ Printv(f_shadow, "\n",
+ "def _swig_setattr_nondynamic_instance_variable(set):\n",
+ tab4, "def set_instance_attr(self, name, value):\n",
#ifdef USE_THISOWN
- tab4, tab4, "if hasattr(self, name) or (name in (\"this\", \"thisown\")):\n",
+ tab4, tab4, "if name in (\"this\", \"thisown\"):\n",
+ tab4, tab4, tab4, "set(self, name, value)\n",
#else
- tab4, tab4, "if (name == \"thisown\"):\n", tab8, tab4, "return self.this.own(value)\n", tab4, tab4, "if hasattr(self, name) or (name == \"this\"):\n",
+ tab4, tab4, "if name == \"thisown\":\n",
+ tab4, tab4, tab4, "self.this.own(value)\n",
+ tab4, tab4, "elif name == \"this\":\n",
+ tab4, tab4, tab4, "set(self, name, value)\n",
#endif
- tab4, tab4, tab4, "set(self, name, value)\n",
- tab4, tab4, "else:\n",
- tab4, tab4, tab4, "raise AttributeError(\"You cannot add attributes to %s\" % self)\n", tab4, "return set_attr\n\n\n", NIL);
- }
+ tab4, tab4, "elif hasattr(self, name) and isinstance(getattr(type(self), name), property):\n",
+ tab4, tab4, tab4, "set(self, name, value)\n",
+ tab4, tab4, "else:\n",
+ tab4, tab4, tab4, "raise AttributeError(\"You cannot add instance attributes to %s\" % self)\n",
+ tab4, "return set_instance_attr\n\n", NIL);
+
+ Printv(f_shadow, "\n",
+ "def _swig_setattr_nondynamic_class_variable(set):\n",
+ tab4, "def set_class_attr(cls, name, value):\n",
+ tab4, tab4, "if hasattr(cls, name) and not isinstance(getattr(cls, name), property):\n",
+ tab4, tab4, tab4, "set(cls, name, value)\n",
+ tab4, tab4, "else:\n",
+ tab4, tab4, tab4, "raise AttributeError(\"You cannot add class attributes to %s\" % cls)\n",
+ tab4, "return set_class_attr\n\n", NIL);
+
+ Printv(f_shadow, "\n",
+ "def _swig_add_metaclass(metaclass):\n",
+ tab4, "\"\"\"Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass\"\"\"\n",
+ tab4, "def wrapper(cls):\n",
+ tab4, tab4, "return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())\n",
+ tab4, "return wrapper\n\n", NIL);
+
+ Printv(f_shadow, "\n",
+ "class _SwigNonDynamicMeta(type):\n",
+ tab4, "\"\"\"Meta class to enforce nondynamic attributes (no new attributes) for a class\"\"\"\n",
+ tab4, "__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)\n",
+ "\n", NIL);
+
+ Printv(f_shadow, "\n", NIL);
if (directorsEnabled()) {
- // Try loading weakref.proxy, which is only available in Python 2.1 and higher
- Printv(f_shadow,
- "try:\n", tab4, "import weakref\n", tab4, "weakref_proxy = weakref.proxy\n", "except __builtin__.Exception:\n", tab4, "weakref_proxy = lambda x: x\n", "\n\n", NIL);
+ Printv(f_shadow, "import weakref\n\n", NIL);
}
}
// Include some information in the code
@@ -1001,9 +776,11 @@ public:
Printf(f_wrappers, "#endif\n");
Append(const_code, "static swig_const_info swig_const_table[] = {\n");
Append(methods, "static PyMethodDef SwigMethods[] = {\n");
+ Append(methods_proxydocs, "static PyMethodDef SwigMethods_proxydocs[] = {\n");
/* the method exported for replacement of new.instancemethod in Python 3 */
add_pyinstancemethod_new();
+ add_pystaticmethod_new();
if (builtin) {
SwigType *s = NewString("SwigPyObject");
@@ -1025,6 +802,9 @@ public:
Append(methods, "\t { NULL, NULL, 0, NULL }\n");
Append(methods, "};\n");
Printf(f_wrappers, "%s\n", methods);
+ Append(methods_proxydocs, "\t { NULL, NULL, 0, NULL }\n");
+ Append(methods_proxydocs, "};\n");
+ Printf(f_wrappers, "%s\n", methods_proxydocs);
if (builtin) {
Dump(f_builtins, f_wrappers);
@@ -1049,20 +829,37 @@ public:
if (shadow) {
Swig_banner_target_lang(f_shadow_py, "#");
- if (!modern && !classic) {
- Printv(f_shadow, "# This file is compatible with both classic and new-style classes.\n", NIL);
+
+ if (mod_docstring) {
+ if (Len(mod_docstring)) {
+ const char *triple_double = "\"\"\"";
+ // follow PEP257 rules: https://www.python.org/dev/peps/pep-0257/
+ // reported by pep257: https://github.com/GreenSteam/pep257
+ bool multi_line_ds = Strchr(mod_docstring, '\n') != 0;
+ Printv(f_shadow_py, "\n", triple_double, multi_line_ds ? "\n":"", mod_docstring, multi_line_ds ? "\n":"", triple_double, "\n", NIL);
+ }
+ Delete(mod_docstring);
+ mod_docstring = NULL;
}
+
if (Len(f_shadow_begin) > 0)
Printv(f_shadow_py, "\n", f_shadow_begin, "\n", NIL);
+
+ Printv(f_shadow_py, "\nfrom sys import version_info as _swig_python_version_info\n", NULL);
+ Printv(f_shadow_py, "if _swig_python_version_info < (2, 7, 0):\n", NULL);
+ Printv(f_shadow_py, tab4, "raise RuntimeError(\"Python 2.7 or later required\")\n\n", NULL);
+
if (Len(f_shadow_after_begin) > 0)
- Printv(f_shadow_py, f_shadow_after_begin, "\n", NIL);
+ Printv(f_shadow_py, f_shadow_after_begin, "\n", NIL);
+
if (moduleimport) {
Replaceall(moduleimport, "$module", module);
- Printv(f_shadow_py, "\n", moduleimport, "\n", NIL);
+ Printv(f_shadow_py, moduleimport, "\n", NIL);
} else {
Printv(f_shadow_py, default_import_code, NIL);
}
- Printv(f_shadow_py, f_shadow, "\n", NIL);
+
+ Printv(f_shadow_py, "\n", f_shadow, "\n", NIL);
Printv(f_shadow_py, f_shadow_stubs, "\n", NIL);
Delete(f_shadow_py);
}
@@ -1109,12 +906,36 @@ public:
* ------------------------------------------------------------ */
int add_pyinstancemethod_new() {
String *name = NewString("SWIG_PyInstanceMethod_New");
- Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, NULL},\n", name, name);
+ String *line = NewString("");
+ Printf(line, "\t { \"%s\", %s, METH_O, NULL},\n", name, name);
+ Append(methods, line);
+ if (fastproxy) {
+ Append(methods_proxydocs, line);
+ }
+ Delete(line);
Delete(name);
return 0;
}
/* ------------------------------------------------------------
+ * Emit the wrapper for PyStaticMethod_New to MethodDef array.
+ * This wrapper is used to ensure the correct documentation is
+ * generated for static methods when using -fastproxy
+ * ------------------------------------------------------------ */
+ int add_pystaticmethod_new() {
+ if (fastproxy) {
+ String *name = NewString("SWIG_PyStaticMethod_New");
+ String *line = NewString("");
+ Printf(line, "\t { \"%s\", %s, METH_O, NULL},\n", name, name);
+ Append(methods, line);
+ Append(methods_proxydocs, line);
+ Delete(line);
+ Delete(name);
+ }
+ return 0;
+ }
+
+ /* ------------------------------------------------------------
* subpkg_tail()
*
* Return the name of 'other' package relative to 'base'.
@@ -1269,14 +1090,9 @@ public:
Printf(out, "import %s%s%s%s\n", apkg, *Char(apkg) ? "." : "", pfx, mod);
Delete(apkg);
} else {
- Printf(out, "from sys import version_info as _swig_python_version_info\n");
- Printf(out, "if _swig_python_version_info >= (2, 7, 0):\n");
if (py3_rlen1)
- Printf(out, tab4 "from . import %.*s\n", py3_rlen1, rpkg);
- Printf(out, tab4 "from .%s import %s%s\n", rpkg, pfx, mod);
- Printf(out, "else:\n");
- Printf(out, tab4 "import %s%s%s%s\n", rpkg, *Char(rpkg) ? "." : "", pfx, mod);
- Printf(out, "del _swig_python_version_info\n");
+ Printf(out, "from . import %.*s\n", py3_rlen1, rpkg);
+ Printf(out, "from .%s import %s%s\n", rpkg, pfx, mod);
Delete(rpkg);
}
return out;
@@ -1393,18 +1209,18 @@ public:
Node *options = Getattr(mod, "options");
String *pkg = options ? Getattr(options, "package") : 0;
- if (shadowimport) {
- if (!options || (!Getattr(options, "noshadow") && !Getattr(options, "noproxy"))) {
- String *_import = import_directive_string(package, pkg, modname, "_");
- if (!GetFlagAttr(f_shadow_imports, _import)) {
- String *import = import_directive_string(package, pkg, modname);
- Printf(builtin ? f_shadow_after_begin : f_shadow, "%s", import);
- Delete(import);
- SetFlag(f_shadow_imports, _import);
- }
- Delete(_import);
+
+ if (!options || (!Getattr(options, "noshadow") && !Getattr(options, "noproxy"))) {
+ String *_import = import_directive_string(package, pkg, modname, "_");
+ if (!GetFlagAttr(f_shadow_imports, _import)) {
+ String *import = import_directive_string(package, pkg, modname);
+ Printf(builtin ? f_shadow_after_begin : f_shadow, "%s", import);
+ Delete(import);
+ SetFlag(f_shadow_imports, _import);
}
+ Delete(_import);
}
+
}
}
return Language::importDirective(n);
@@ -1648,37 +1464,76 @@ public:
bool have_docstring(Node *n) {
String *str = Getattr(n, "feature:docstring");
- return (str && Len(str) > 0) || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc"));
+ return ((str && Len(str) > 0)
+ || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc"))
+ || (doxygen && doxygenTranslator->hasDocumentation(n))
+ );
}
/* ------------------------------------------------------------
- * docstring()
+ * build_combined_docstring()
*
- * Get the docstring text, stripping off {} if necessary,
- * and enclose in triple double quotes. If autodoc is also
- * set then it will build a combined docstring.
+ * Build the full docstring which may be a combination of the
+ * explicit docstring and autodoc string or, if none of them
+ * is specified, obtained by translating Doxygen comment to
+ * Python.
+ *
+ * Return new string to be deleted by caller (never NIL but
+ * may be empty if there is no docstring).
* ------------------------------------------------------------ */
- String *docstring(Node *n, autodoc_t ad_type, const String *indent, bool use_triple = true) {
- String *str = Getattr(n, "feature:docstring");
- bool have_ds = (str && Len(str) > 0);
- bool have_auto = (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc"));
- const char *triple_double = use_triple ? "\"\"\"" : "";
- String *autodoc = NULL;
- String *doc = NULL;
-
- if (have_ds) {
- char *t = Char(str);
+ String *build_combined_docstring(Node *n, autodoc_t ad_type, const String *indent = "", bool low_level = false) {
+ String *docstr = Getattr(n, "feature:docstring");
+ if (docstr && Len(docstr)) {
+ docstr = Copy(docstr);
+ char *t = Char(docstr);
if (*t == '{') {
- Delitem(str, 0);
- Delitem(str, DOH_END);
+ Delitem(docstr, 0);
+ Delitem(docstr, DOH_END);
+ }
+ }
+
+ if (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")) {
+ String *autodoc = make_autodoc(n, ad_type, low_level);
+ if (autodoc && Len(autodoc) > 0) {
+ if (docstr && Len(docstr)) {
+ Append(autodoc, "\n");
+ Append(autodoc, docstr);
+ }
+
+ String *tmp = autodoc;
+ autodoc = docstr;
+ docstr = tmp;
}
+
+ Delete(autodoc);
}
- if (have_auto) {
- autodoc = make_autodoc(n, ad_type);
- have_auto = (autodoc && Len(autodoc) > 0);
+ if (!docstr || !Len(docstr)) {
+ if (doxygen) {
+ docstr = Getattr(n, "python:docstring");
+ if (!docstr && doxygenTranslator->hasDocumentation(n)) {
+ docstr = doxygenTranslator->getDocumentation(n, 0);
+
+ // Avoid rebuilding it again the next time: notice that we can't do
+ // this for the combined doc string as autodoc part of it depends on
+ // the sym:name of the node and it is changed while handling it, so
+ // the cached results become incorrect. But Doxygen docstring only
+ // depends on the comment which is not going to change, so we can
+ // safely cache it.
+ Setattr(n, "python:docstring", Copy(docstr));
+ } else {
+ // Must copy here since if the docstring is multi-line, the String*
+ // here will get Deleted below, which is bad if it is a pointer to
+ // the cached object!
+ docstr = Copy(docstr);
+ }
+ }
}
+
+ if (!docstr)
+ docstr = NewString("");
+
// If there is more than one line then make docstrings like this:
//
// """
@@ -1687,82 +1542,79 @@ public:
// """
//
// otherwise, put it all on a single line
+ if (Strchr(docstr, '\n')) {
+ String *tmp = NewString("");
+ Append(tmp, "\n");
+ Append(tmp, indent_docstring(docstr, indent));
+ Append(tmp, indent);
+ Delete(docstr);
+ docstr = tmp;
+ }
+
+ return docstr;
+ }
+
+ /* ------------------------------------------------------------
+ * docstring()
+ *
+ * Get the docstring text, stripping off {} if necessary,
+ * and enclose in triple double quotes. If autodoc is also
+ * set then it will build a combined docstring.
+ * ------------------------------------------------------------ */
+
+ String *docstring(Node *n, autodoc_t ad_type, const String *indent, bool low_level = false) {
+ String *docstr = build_combined_docstring(n, ad_type, indent, low_level);
+ if (!Len(docstr))
+ return docstr;
+
+ // Notice that all comments are created as raw strings (prefix "r"),
+ // because '\' is used often in comments, but may break Python module from
+ // loading. For example, in doxy comment one may write path in quotes:
//
- if (have_auto && have_ds) { // Both autodoc and docstring are present
- doc = NewString("");
- Printv(doc, triple_double, "\n",
- indent_docstring(autodoc, indent), "\n",
- indent_docstring(str, indent), indent, triple_double, NIL);
- } else if (!have_auto && have_ds) { // only docstring
- if (Strchr(str, '\n') == 0) {
- doc = NewStringf("%s%s%s", triple_double, str, triple_double);
- } else {
- doc = NewString("");
- Printv(doc, triple_double, "\n", indent_docstring(str, indent), indent, triple_double, NIL);
- }
- } else if (have_auto && !have_ds) { // only autodoc
- if (Strchr(autodoc, '\n') == 0) {
- doc = NewStringf("%s%s%s", triple_double, autodoc, triple_double);
- } else {
- doc = NewString("");
- Printv(doc, triple_double, "\n", indent_docstring(autodoc, indent), indent, triple_double, NIL);
- }
- } else
- doc = NewString("");
+ // This is path to file "C:\x\file.txt"
+ //
+ // Python will not load the module with such comment because of illegal
+ // escape '\x'. '\' may additionally appear in verbatim or htmlonly sections
+ // of doxygen doc, Latex expressions, ...
+ String *doc = NewString("");
+ Append(doc, "r\"\"\"");
+ Append(doc, docstr);
+ Append(doc, "\"\"\"");
+ Delete(docstr);
- // Save the generated strings in the parse tree in case they are used later
- // by post processing tools
- Setattr(n, "python:docstring", doc);
- Setattr(n, "python:autodoc", autodoc);
return doc;
- }
+ }
/* ------------------------------------------------------------
* cdocstring()
*
* Get the docstring text as it would appear in C-language
- * source code.
+ * source code (but without quotes around it).
* ------------------------------------------------------------ */
- String *cdocstring(Node *n, autodoc_t ad_type)
- {
- String *ds = docstring(n, ad_type, "", false);
+ String *cdocstring(Node *n, autodoc_t ad_type, bool low_level = false) {
+ String *ds = build_combined_docstring(n, ad_type, "", low_level);
Replaceall(ds, "\\", "\\\\");
Replaceall(ds, "\"", "\\\"");
Replaceall(ds, "\n", "\\n\"\n\t\t\"");
return ds;
}
- virtual String *makeParameterName(Node *n, Parm *p, int arg_num, bool = false) const {
- // For the keyword arguments, we want to preserve the names as much as possible,
- // so we only minimally rename them in Swig_name_make(), e.g. replacing "keyword"
- // with "_keyword" if they have any name at all.
- if (check_kwargs(n)) {
- String *name = Getattr(p, "name");
- if (name)
- return Swig_name_make(p, 0, name, 0, 0);
- }
-
- // For the other cases use the general function which replaces arguments whose
- // names clash with keywords with (less useful) "argN".
- return Language::makeParameterName(n, p, arg_num);
- }
-
/* -----------------------------------------------------------------------------
* addMissingParameterNames()
*
* For functions that have not had nameless parameters set in the Language class.
*
- * Inputs:
+ * Inputs:
* plist - entire parameter list
- * arg_offset - argument number for first parameter
+ * arg_num - the number to start from when naming arguments
* Side effects:
* The "lname" attribute in each parameter in plist will be contain a parameter name
* ----------------------------------------------------------------------------- */
- void addMissingParameterNames(Node *n, ParmList *plist, int arg_offset) {
+ void addMissingParameterNames(Node *n, ParmList *plist, int arg_num) {
Parm *p = plist;
- int i = arg_offset;
+ int i = arg_num;
while (p) {
if (!Getattr(p, "lname")) {
String *name = makeParameterName(n, p, i);
@@ -1779,10 +1631,11 @@ public:
*
* Generate the documentation for the function parameters
* Parameters:
+ * arg_num: The number to start assigning unnamed arguments from
* func_annotation: Function annotation support
* ------------------------------------------------------------ */
- String *make_autodocParmList(Node *n, bool showTypes, bool calling = false, bool func_annotation = false) {
+ String *make_autodocParmList(Node *n, bool showTypes, int arg_num = 1, bool calling = false, bool func_annotation = false) {
String *doc = NewString("");
String *pdocs = 0;
@@ -1790,15 +1643,6 @@ public:
Parm *p;
Parm *pnext;
-
- // Normally we start counting auto-generated argument names from 1, but we should do it from 2
- // if the first argument is "self", i.e. if we're handling a non-static member function.
- int arg_num = 1;
- if (is_wrapping_class()) {
- if (Cmp(Getattr(n, "storage"), "static") != 0)
- arg_num++;
- }
-
if (calling)
func_annotation = false;
@@ -1811,8 +1655,7 @@ public:
return doc;
}
- for (p = plist; p; p = pnext, arg_num++) {
-
+ for (p = plist; p; p = pnext) {
String *tm = Getattr(p, "tmap:in");
if (tm) {
pnext = Getattr(p, "tmap:in:next");
@@ -1833,12 +1676,21 @@ public:
value = Getattr(p, "tmap:doc:value");
}
+ // Skip the "self" argument - it is added to the parameter list automatically
+ // and shouldn't be included in the Parameters block
+ if (Getattr(p, "self")) {
+ continue;
+ }
+
// Note: the generated name should be consistent with that in kwnames[]
String *made_name = 0;
if (!name) {
name = made_name = makeParameterName(n, p, arg_num);
}
+ // Increment the argument number once we are sure this is a real argument to count
+ arg_num++;
+
type = type ? type : Getattr(p, "type");
value = value ? value : Getattr(p, "value");
@@ -1867,13 +1719,24 @@ public:
}
// Write the function annotation
if (func_annotation)
- Printf(doc, ": '%s'", type_str);
+ Printf(doc, ": \"%s\"", type_str);
// Write default value
if (value && !calling) {
String *new_value = convertValue(value, Getattr(p, "type"));
+ if (new_value) {
+ value = new_value;
+ } else {
+ // Even if the value is not representable in the target language, still use it in the documentation, for compatibility with the previous SWIG versions
+ // and because it can still be useful to see the C++ expression there.
+ Node *lookup = Swig_symbol_clookup(value, 0);
+ if (lookup)
+ value = Getattr(lookup, "sym:name");
+ }
+ Printf(doc, "=%s", value);
+
if (new_value)
- Printf(doc, "=%s", new_value);
+ Delete(new_value);
}
Delete(type_str);
Delete(made_name);
@@ -1895,8 +1758,9 @@ public:
* and use it directly.
* ------------------------------------------------------------ */
- String *make_autodoc(Node *n, autodoc_t ad_type) {
+ String *make_autodoc(Node *n, autodoc_t ad_type, bool low_level = false) {
int extended = 0;
+ bool first_func = true;
// If the function is overloaded then this function is called
// for the last one. Rewind to the first so the docstrings are
// in order.
@@ -1933,10 +1797,24 @@ public:
}
if (!skipAuto) {
- String *symname = Getattr(n, "sym:name");
+ /* Check if a documentation name was given for either the low-level C API or high-level Python shadow API */
+ String *symname = Getattr(n, low_level ? "doc:low:name" : "doc:high:name");
+ if (!symname) {
+ symname = Getattr(n, "sym:name");
+ }
+
SwigType *type = Getattr(n, "type");
String *type_str = NULL;
+ // If the function has default arguments, then that documentation covers this version too
+ if (Getattr(n, "defaultargs") != NULL) {
+ n = Getattr(n, "sym:nextSibling");
+ continue;
+ }
+
+ if (!first_func)
+ Append(doc, "\n");
+
if (type) {
if (Strcmp(type, "void") == 0) {
type_str = NULL;
@@ -1946,6 +1824,21 @@ public:
}
}
+ /* Treat the low-level C API functions for getting/setting variables as methods for documentation purposes */
+ String *kind = Getattr(n, "kind");
+ if (kind && Strcmp(kind, "variable") == 0) {
+ if (ad_type == AUTODOC_FUNC) {
+ ad_type = AUTODOC_METHOD;
+ }
+ }
+ /* Treat destructors as methods for documentation purposes */
+ String *nodeType = Getattr(n, "nodeType");
+ if (nodeType && Strcmp(nodeType, "destructor") == 0) {
+ if (ad_type == AUTODOC_FUNC) {
+ ad_type = AUTODOC_METHOD;
+ }
+ }
+
switch (ad_type) {
case AUTODOC_CLASS:
{
@@ -1959,9 +1852,9 @@ public:
Delete(rname);
} else {
if (CPlusPlus) {
- Printf(doc, "Proxy of C++ %s class.", real_classname);
+ Printf(doc, "Proxy of C++ %s class.", SwigType_namestr(real_classname));
} else {
- Printf(doc, "Proxy of C %s struct.", real_classname);
+ Printf(doc, "Proxy of C %s struct.", SwigType_namestr(real_classname));
}
}
}
@@ -1969,10 +1862,10 @@ public:
break;
case AUTODOC_CTOR:
if (Strcmp(class_name, symname) == 0) {
- String *paramList = make_autodocParmList(n, showTypes);
+ String *paramList = make_autodocParmList(n, showTypes, 2);
Printf(doc, "__init__(");
if (showTypes)
- Printf(doc, "%s ", getClassName());
+ Printf(doc, "%s ", class_name);
if (Len(paramList))
Printf(doc, "self, %s) -> %s", paramList, class_name);
else
@@ -1983,7 +1876,7 @@ public:
case AUTODOC_DTOR:
if (showTypes)
- Printf(doc, "__del__(%s self)", getClassName());
+ Printf(doc, "__del__(%s self)", class_name);
else
Printf(doc, "__del__(self)");
break;
@@ -2001,36 +1894,134 @@ public:
break;
case AUTODOC_METHOD:
- String *paramList = make_autodocParmList(n, showTypes);
- Printf(doc, "%s(", symname);
- if (showTypes)
- Printf(doc, "%s ", class_name);
- if (Len(paramList))
- Printf(doc, "self, %s)", paramList);
- else
- Printf(doc, "self)");
- if (type_str)
- Printf(doc, " -> %s", type_str);
+ {
+ String *paramList = make_autodocParmList(n, showTypes, 2);
+ Printf(doc, "%s(", symname);
+ if (showTypes)
+ Printf(doc, "%s ", class_name);
+ if (Len(paramList))
+ Printf(doc, "self, %s)", paramList);
+ else
+ Printf(doc, "self)");
+ if (type_str)
+ Printf(doc, " -> %s", type_str);
+ }
+ break;
+
+ case AUTODOC_CONST:
+ // There is no autodoc support for constants currently, this enum
+ // element only exists to allow calling docstring() with it.
+ return NULL;
+ case AUTODOC_VAR:
+ // Variables can also be documented (e.g. through the property() function in python)
+ Printf(doc, "%s", symname);
+ if (showTypes) {
+ String *type = Getattr(n, "tmap:doc:type");
+ if (!type)
+ type = Getattr(n, "membervariableHandler:type");
+ if (!type)
+ type = Getattr(n, "type");
+ Printf(doc, " : %s", type);
+ }
break;
}
Delete(type_str);
- }
- if (extended) {
- String *pdocs = Getattr(n, "feature:pdocs");
- if (pdocs) {
- Printv(doc, "\n", pdocs, NULL);
+
+ // Special case: wrapper functions to get a variable should have no parameters.
+ // Because the node is re-used for the setter and getter, the feature:pdocs field will
+ // exist for the getter function, so explicitly avoid printing parameters in this case.
+ bool variable_getter = kind && Strcmp(kind, "variable") == 0 && Getattr(n, "memberget");
+ if (extended && ad_type != AUTODOC_VAR && !variable_getter) {
+ String *pdocs = Getattr(n, "feature:pdocs");
+ if (pdocs) {
+ Printv(doc, "\n", pdocs, NULL);
+ }
}
}
// if it's overloaded then get the next decl and loop around again
n = Getattr(n, "sym:nextSibling");
if (n)
- Append(doc, "\n");
+ first_func = false;
}
return doc;
}
/* ------------------------------------------------------------
+ * convertIntegerValue()
+ *
+ * Check if string v is an integer and can be represented in
+ * Python. If so, return an appropriate Python representation,
+ * otherwise (or if we are unsure), return NIL.
+ * ------------------------------------------------------------ */
+ String *convertIntegerValue(String *v, SwigType *resolved_type) {
+ const char *const s = Char(v);
+ char *end;
+ String *result = NIL;
+
+ // Check if this is an integer number in any base.
+ errno = 0;
+ long value = strtol(s, &end, 0);
+ if (errno == ERANGE || end == s)
+ return NIL;
+
+ if (*end != '\0') {
+ // If there is a suffix after the number, we can safely ignore "l"
+ // and (provided the number is unsigned) "u", and also combinations of
+ // these, but not anything else.
+ for (char *p = end; *p != '\0'; ++p) {
+ switch (*p) {
+ case 'l':
+ case 'L':
+ break;
+ case 'u':
+ case 'U':
+ if (value < 0)
+ return NIL;
+ break;
+ default:
+ return NIL;
+ }
+ }
+ }
+ // So now we are certain that we are indeed dealing with an integer
+ // that has a representation as long given by value.
+
+ // Restrict to guaranteed supported range in Python, see maxint docs: https://docs.python.org/2/library/sys.html#sys.maxint
+ // Don't do this pointless check when long is 32 bits or smaller as strtol will have already failed with ERANGE
+#if LONG_MAX > PYTHON_INT_MAX || LONG_MIN < PYTHON_INT_MIN
+ if (value > PYTHON_INT_MAX || value < PYTHON_INT_MIN) {
+ return NIL;
+ }
+#endif
+
+ if (Cmp(resolved_type, "bool") == 0)
+ // Allow integers as the default value for a bool parameter.
+ return NewString(value ? "True" : "False");
+
+ if (value == 0)
+ return NewString(SwigType_ispointer(resolved_type) ? "None" : "0");
+
+ // v may still be octal or hexadecimal:
+ const char *p = s;
+ if (*p == '+' || *p == '-')
+ ++p;
+ if (*p == '0' && *(p+1) != 'x' && *(p+1) != 'X') {
+ // This must have been an octal number. This is the only case we
+ // cannot use in Python directly, since Python 2 and 3 use non-
+ // compatible representations.
+ result = NewString(*s == '-' ? "int(\"-" : "int(\"");
+ String *octal_string = NewStringWithSize(p, (int) (end - p));
+ Append(result, octal_string);
+ Append(result, "\", 8)");
+ Delete(octal_string);
+ return result;
+ }
+ result = *end == '\0' ? Copy(v) : NewStringWithSize(s, (int) (end - s));
+ return result;
+ }
+
+ /* ------------------------------------------------------------
* convertDoubleValue()
*
* Check if the given string looks like a decimal floating point constant
@@ -2040,6 +2031,7 @@ public:
const char *const s = Char(v);
char *end;
+ errno = 0;
double value = strtod(s, &end);
(void) value;
if (errno != ERANGE && end != s) {
@@ -2068,7 +2060,7 @@ public:
// Avoid unnecessary string allocation in the common case when we don't
// need to remove any suffix.
- return *end == '\0' ? v : NewStringWithSize(s, (int)(end - s));
+ return *end == '\0' ? Copy(v) : NewStringWithSize(s, (int)(end - s));
}
return NIL;
@@ -2078,109 +2070,24 @@ public:
* convertValue()
*
* Check if string v can be a Python value literal or a
- * constant. Return NIL if it isn't.
+ * constant. Return an equivalent Python representation,
+ * or NIL if it isn't, or we are unsure.
* ------------------------------------------------------------ */
String *convertValue(String *v, SwigType *type) {
const char *const s = Char(v);
- char *end;
String *result = NIL;
- bool fail = false;
- SwigType *resolved_type = 0;
-
- // Check if this is a number in any base.
- long value = strtol(s, &end, 0);
- (void) value;
- if (end != s) {
- if (errno == ERANGE) {
- // There was an overflow, we could try representing the value as Python
- // long integer literal, but for now don't bother with it.
- fail = true;
- } else {
- if (*end != '\0') {
- // If there is a suffix after the number, we can safely ignore any
- // combination of "l" and "u", but not anything else (again, stuff like
- // "LL" could be handled, but we don't bother to do it currently).
- bool seen_long = false;
- for (char * p = end; *p != '\0'; ++p) {
- switch (*p) {
- case 'l':
- case 'L':
- // Bail out on "LL".
- if (seen_long) {
- fail = true;
- break;
- }
- seen_long = true;
- break;
-
- case 'u':
- case 'U':
- break;
-
- default:
- // Except that our suffix could actually be the fractional part of
- // a floating point number, so we still have to check for this.
- result = convertDoubleValue(v);
- }
- }
- }
-
- if (!fail) {
- // Allow integers as the default value for a bool parameter.
- resolved_type = SwigType_typedef_resolve_all(type);
- if (Cmp(resolved_type, "bool") == 0) {
- result = NewString(value ? "True" : "False");
- } else {
- // Deal with the values starting with 0 first as they can be octal or
- // hexadecimal numbers or even pointers.
- if (s[0] == '0') {
- if (Len(v) == 1) {
- // This is just a lone 0, but it needs to be represented differently
- // in Python depending on whether it's a zero or a null pointer.
- if (SwigType_ispointer(resolved_type))
- result = NewString("None");
- else
- result = v;
- } else if (s[1] == 'x' || s[1] == 'X') {
- // This must have been a hex number, we can use it directly in Python,
- // so nothing to do here.
- } else {
- // This must have been an octal number, we have to change its prefix
- // to be "0o" in Python 3 only (and as long as we still support Python
- // 2.5, this can't be done unconditionally).
- if (py3) {
- if (end - s > 1) {
- result = NewString("0o");
- Append(result, NewStringWithSize(s + 1, (int)(end - s - 1)));
- }
- }
- }
- }
-
- // Avoid unnecessary string allocation in the common case when we don't
- // need to remove any suffix.
- if (!result)
- result = *end == '\0' ? v : NewStringWithSize(s, (int)(end - s));
- }
- }
- }
- }
+ SwigType *resolved_type = SwigType_typedef_resolve_all(type);
- // Check if this is a floating point number (notice that it wasn't
- // necessarily parsed as a long above, consider e.g. ".123").
- if (!fail && !result) {
+ result = convertIntegerValue(v, resolved_type);
+ if (!result) {
result = convertDoubleValue(v);
if (!result) {
- if (Strcmp(v, "true") == 0 || Strcmp(v, "TRUE") == 0)
+ if (Strcmp(v, "true") == 0)
result = NewString("True");
- else if (Strcmp(v, "false") == 0 || Strcmp(v, "FALSE") == 0)
+ else if (Strcmp(v, "false") == 0)
result = NewString("False");
- else if (Strcmp(v, "NULL") == 0 || Strcmp(v, "nullptr") == 0) {
- if (!resolved_type)
- resolved_type = SwigType_typedef_resolve_all(type);
+ else if (Strcmp(v, "NULL") == 0 || Strcmp(v, "nullptr") == 0)
result = SwigType_ispointer(resolved_type) ? NewString("None") : NewString("0");
- }
-
// This could also be an enum type, default value of which could be
// representable in Python if it doesn't include any scope (which could,
// but currently is not, translated).
@@ -2188,7 +2095,7 @@ public:
Node *lookup = Swig_symbol_clookup(v, 0);
if (lookup) {
if (Cmp(Getattr(lookup, "nodeType"), "enumitem") == 0)
- result = Getattr(lookup, "sym:name");
+ result = Copy(Getattr(lookup, "sym:name"));
}
}
}
@@ -2235,10 +2142,12 @@ public:
if (Getattr(p, "tmap:default"))
return false;
- if (String *value = Getattr(p, "value")) {
- String *type = Getattr(p, "type");
- if (!convertValue(value, type))
+ String *value = Getattr(p, "value");
+ if (value) {
+ String *convertedValue = convertValue(value, Getattr(p, "type"));
+ if (!convertedValue)
return false;
+ Delete(convertedValue);
}
}
@@ -2250,7 +2159,7 @@ public:
* is_real_overloaded()
*
* Check if the function is overloaded, but not just have some
- * siblings generated due to the original function have
+ * siblings generated due to the original function having
* default arguments.
* ------------------------------------------------------------ */
bool is_real_overloaded(Node *n) {
@@ -2263,7 +2172,7 @@ public:
while (i) {
Node *nn = Getattr(i, "defaultargs");
if (nn != h) {
- /* Check if overloaded function has defaultargs and
+ /* Check if overloaded function has defaultargs and
* pointed to the first overloaded. */
return true;
}
@@ -2279,13 +2188,16 @@ public:
* Generate parameter list for Python functions or methods,
* reuse make_autodocParmList() to do so.
* ------------------------------------------------------------ */
- String *make_pyParmList(Node *n, bool in_class, bool is_calling, int kw) {
- /* Get the original function for a defaultargs copy,
+ String *make_pyParmList(Node *n, bool in_class, bool is_calling, int kw, bool has_self_for_count = false) {
+ /* Get the original function for a defaultargs copy,
* see default_arguments() in parser.y. */
Node *nn = Getattr(n, "defaultargs");
if (nn)
n = nn;
+ Parm *parms = Getattr(n, "parms");
+ int varargs = parms ? emit_isvarargs(parms) : 0;
+
/* We prefer to explicitly list all parameters of the C function in the
generated Python code as this makes the function more convenient to use,
however in some cases we must replace the real parameters list with just
@@ -2295,8 +2207,9 @@ public:
2. We were explicitly asked to use the "compact" arguments form.
3. We were explicitly asked to use default args from C via the "python:cdefaultargs" feature.
4. One of the default argument values can't be represented in Python.
+ 5. Varargs that haven't been forced to use a fixed number of arguments with %varargs.
*/
- if (is_real_overloaded(n) || GetFlag(n, "feature:compactdefaultargs") || GetFlag(n, "feature:python:cdefaultargs") || !is_representable_as_pyargs(n)) {
+ if (is_real_overloaded(n) || GetFlag(n, "feature:compactdefaultargs") || GetFlag(n, "feature:python:cdefaultargs") || !is_representable_as_pyargs(n) || varargs) {
String *parms = NewString("");
if (in_class)
Printf(parms, "self, ");
@@ -2308,7 +2221,7 @@ public:
bool funcanno = py3 ? true : false;
String *params = NewString("");
- String *_params = make_autodocParmList(n, false, is_calling, funcanno);
+ String *_params = make_autodocParmList(n, false, ((in_class || has_self_for_count)? 2 : 1), is_calling, funcanno);
if (in_class) {
Printf(params, "self");
@@ -2387,7 +2300,7 @@ public:
* ------------------------------------------------------------ */
bool have_addtofunc(Node *n) {
- return have_pythonappend(n) || have_pythonprepend(n) || have_docstring(n);
+ return have_pythonappend(n) || have_pythonprepend(n);
}
@@ -2437,21 +2350,28 @@ public:
void emitFunctionShadowHelper(Node *n, File *f_dest, String *name, int kw) {
String *parms = make_pyParmList(n, false, false, kw);
String *callParms = make_pyParmList(n, false, true, kw);
- /* Make a wrapper function to insert the code into */
- Printv(f_dest, "\ndef ", name, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL);
- if (have_docstring(n))
- Printv(f_dest, tab4, docstring(n, AUTODOC_FUNC, tab4), "\n", NIL);
- if (have_pythonprepend(n))
- Printv(f_dest, indent_pythoncode(pythonprepend(n), tab4, Getfile(n), Getline(n), "%pythonprepend or %feature(\"pythonprepend\")"), "\n", NIL);
- if (have_pythonappend(n)) {
- Printv(f_dest, tab4 "val = ", funcCall(name, callParms), "\n", NIL);
- Printv(f_dest, indent_pythoncode(pythonappend(n), tab4, Getfile(n), Getline(n), "%pythonappend or %feature(\"pythonappend\")"), "\n", NIL);
- Printv(f_dest, tab4 "return val\n", NIL);
- } else {
- Printv(f_dest, tab4 "return ", funcCall(name, callParms), "\n", NIL);
+
+ // Callbacks need the C function in order to extract the pointer from the swig_ptr: string
+ bool fast = (fastproxy && !have_addtofunc(n)) || Getattr(n, "feature:callback");
+
+ if (!fast || olddefs) {
+ /* Make a wrapper function to insert the code into */
+ Printv(f_dest, "\n", "def ", name, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL);
+ if (have_docstring(n))
+ Printv(f_dest, tab4, docstring(n, AUTODOC_FUNC, tab4, true), "\n", NIL);
+ if (have_pythonprepend(n))
+ Printv(f_dest, indent_pythoncode(pythonprepend(n), tab4, Getfile(n), Getline(n), "%pythonprepend or %feature(\"pythonprepend\")"), "\n", NIL);
+ if (have_pythonappend(n)) {
+ Printv(f_dest, tab4 "val = ", funcCall(name, callParms), "\n", NIL);
+ Printv(f_dest, indent_pythoncode(pythonappend(n), tab4, Getfile(n), Getline(n), "%pythonappend or %feature(\"pythonappend\")"), "\n", NIL);
+ Printv(f_dest, tab4 "return val\n", NIL);
+ } else {
+ Printv(f_dest, tab4 "return ", funcCall(name, callParms), "\n", NIL);
+ }
}
- if (!have_addtofunc(n)) {
+ // Below may result in a 2nd definition of the method when -olddefs is used. The Python interpreter will use the second definition as it overwrites the first.
+ if (fast) {
/* If there is no addtofunc directive then just assign from the extension module (for speed up) */
Printv(f_dest, name, " = ", module, ".", name, "\n", NIL);
}
@@ -2475,36 +2395,64 @@ public:
* add_method()
* ------------------------------------------------------------ */
- void add_method(String *name, String *function, int kw, Node *n = 0, int funpack= 0, int num_required= -1, int num_arguments = -1) {
+ void add_method(String *name, String *function, int kw, Node *n = 0, int funpack = 0, int num_required = -1, int num_arguments = -1) {
+ String * meth_str = NewString("");
if (!kw) {
- if (n && funpack) {
+ if (funpack) {
if (num_required == 0 && num_arguments == 0) {
- Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_NOARGS, ", name, function);
+ Printf(meth_str, "\t { \"%s\", %s, METH_NOARGS, ", name, function);
} else if (num_required == 1 && num_arguments == 1) {
- Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, ", name, function);
+ Printf(meth_str, "\t { \"%s\", %s, METH_O, ", name, function);
} else {
- Printf(methods, "\t { (char *)\"%s\", %s, METH_VARARGS, ", name, function);
+ Printf(meth_str, "\t { \"%s\", %s, METH_VARARGS, ", name, function);
}
} else {
- Printf(methods, "\t { (char *)\"%s\", %s, METH_VARARGS, ", name, function);
+ Printf(meth_str, "\t { \"%s\", %s, METH_VARARGS, ", name, function);
}
} else {
- Printf(methods, "\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function);
+ // Cast via void(*)(void) to suppress GCC -Wcast-function-type warning.
+ // Python should always call the function correctly, but the Python C API
+ // requires us to store it in function pointer of a different type.
+ Printf(meth_str, "\t { \"%s\", (PyCFunction)(void(*)(void))%s, METH_VARARGS|METH_KEYWORDS, ", name, function);
+ }
+ Append(methods, meth_str);
+ if (fastproxy) {
+ Append(methods_proxydocs, meth_str);
}
+ Delete(meth_str);
if (!n) {
Append(methods, "NULL");
+ if (fastproxy) {
+ Append(methods_proxydocs, "NULL");
+ }
} else if (have_docstring(n)) {
- String *ds = cdocstring(n, AUTODOC_FUNC);
- Printf(methods, "(char *)\"%s\"", ds);
+ /* Use the low-level docstring here since this is the docstring that will be used for the C API */
+ String *ds = cdocstring(n, Getattr(n, "memberfunction") ? AUTODOC_METHOD : AUTODOC_FUNC, true);
+ Printf(methods, "\"%s\"", ds);
+ if (fastproxy) {
+ /* In the fastproxy case, we must also record the high-level docstring for use in the Python shadow API */
+ Delete(ds);
+ ds = cdocstring(n, Getattr(n, "memberfunction") ? AUTODOC_METHOD : AUTODOC_FUNC);
+ Printf(methods_proxydocs, "\"%s\"", ds);
+ }
Delete(ds);
} else if (Getattr(n, "feature:callback")) {
- Printf(methods, "(char *)\"swig_ptr: %s\"", Getattr(n, "feature:callback:name"));
+ Printf(methods, "\"swig_ptr: %s\"", Getattr(n, "feature:callback:name"));
+ if (fastproxy) {
+ Printf(methods_proxydocs, "\"swig_ptr: %s\"", Getattr(n, "feature:callback:name"));
+ }
} else {
Append(methods, "NULL");
+ if (fastproxy) {
+ Append(methods_proxydocs, "NULL");
+ }
}
Append(methods, "},\n");
+ if (fastproxy) {
+ Append(methods_proxydocs, "},\n");
+ }
}
/* ------------------------------------------------------------
@@ -2519,12 +2467,24 @@ public:
String *tmp = NewString("");
String *dispatch;
- const char *dispatch_code = funpack ? "return %s(self, argc, argv);" : "return %s(self, args);";
+
+ const char *dispatch_call = funpack ? "%s(self, argc, argv);" : (builtin_ctor ? "%s(self, args, NULL);" : "%s(self, args);");
+ String *dispatch_code = NewStringf("return %s", dispatch_call);
if (castmode) {
dispatch = Swig_overload_dispatch_cast(n, dispatch_code, &maxargs);
} else {
- dispatch = Swig_overload_dispatch(n, dispatch_code, &maxargs);
+ String *fastdispatch_code;
+ if (builtin_ctor)
+ fastdispatch_code = NewStringf("int retval = %s\nif (retval == 0 || !SWIG_Python_TypeErrorOccurred(NULL)) return retval;\nSWIG_fail;", dispatch_call);
+ else
+ fastdispatch_code = NewStringf("PyObject *retobj = %s\nif (!SWIG_Python_TypeErrorOccurred(retobj)) return retobj;\nSWIG_fail;", dispatch_call);
+ if (!CPlusPlus) {
+ Insert(fastdispatch_code, 0, "{\n");
+ Append(fastdispatch_code, "\n}");
+ }
+ dispatch = Swig_overload_dispatch(n, dispatch_code, &maxargs, fastdispatch_code);
+ Delete(fastdispatch_code);
}
/* Generate a dispatch wrapper for all overloaded functions */
@@ -2533,7 +2493,8 @@ public:
String *symname = Getattr(n, "sym:name");
String *wname = Swig_name_wrapper(symname);
- Printv(f->def, linkage, builtin_ctor ? "int " : "PyObject *", wname, "(PyObject *self, PyObject *args) {", NIL);
+ const char *builtin_kwargs = builtin_ctor ? ", PyObject *SWIGUNUSEDPARM(kwargs)" : "";
+ Printv(f->def, linkage, builtin_ctor ? "int " : "PyObject *", wname, "(PyObject *self, PyObject *args", builtin_kwargs, ") {", NIL);
Wrapper_add_local(f, "argc", "Py_ssize_t argc");
Printf(tmp, "PyObject *argv[%d] = {0}", maxargs + 1);
@@ -2541,9 +2502,14 @@ public:
if (!fastunpack) {
Wrapper_add_local(f, "ii", "Py_ssize_t ii");
- if (maxargs - (add_self ? 1 : 0) > 0)
- Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n");
- Append(f->code, "argc = args ? PyObject_Length(args) : 0;\n");
+
+ if (maxargs - (add_self ? 1 : 0) > 0) {
+ Append(f->code, "if (!PyTuple_Check(args)) SWIG_fail;\n");
+ Append(f->code, "argc = PyObject_Length(args);\n");
+ } else {
+ Append(f->code, "argc = args ? PyObject_Length(args) : 0;\n");
+ }
+
if (add_self)
Append(f->code, "argv[0] = self;\n");
Printf(f->code, "for (ii = 0; (ii < %d) && (ii < argc); ii++) {\n", add_self ? maxargs - 1 : maxargs);
@@ -2553,7 +2519,7 @@ public:
Append(f->code, "argc++;\n");
} else {
String *iname = Getattr(n, "sym:name");
- Printf(f->code, "if (!(argc = SWIG_Python_UnpackTuple(args,\"%s\",0,%d,argv%s))) SWIG_fail;\n", iname, maxargs, add_self ? "+1" : "");
+ Printf(f->code, "if (!(argc = SWIG_Python_UnpackTuple(args, \"%s\", 0, %d, argv%s))) SWIG_fail;\n", iname, maxargs, add_self ? "+1" : "");
if (add_self)
Append(f->code, "argv[0] = self;\n");
else
@@ -2566,8 +2532,8 @@ public:
if (GetFlag(n, "feature:python:maybecall")) {
Append(f->code, "fail:\n");
- Append(f->code, "Py_INCREF(Py_NotImplemented);\n");
- Append(f->code, "return Py_NotImplemented;\n");
+ Append(f->code, " Py_INCREF(Py_NotImplemented);\n");
+ Append(f->code, " return Py_NotImplemented;\n");
} else {
Node *sibl = n;
while (Getattr(sibl, "sym:previousSibling"))
@@ -2579,7 +2545,7 @@ public:
Delete(fulldecl);
} while ((sibl = Getattr(sibl, "sym:nextSibling")));
Append(f->code, "fail:\n");
- Printf(f->code, "SWIG_SetErrorMsg(PyExc_NotImplementedError,"
+ Printf(f->code, " SWIG_Python_RaiseOrModifyTypeError("
"\"Wrong number or type of arguments for overloaded function '%s'.\\n\"" "\n\" Possible C/C++ prototypes are:\\n\"%s);\n", symname, protoTypes);
Printf(f->code, "return %s;\n", builtin_ctor ? "-1" : "0");
Delete(protoTypes);
@@ -2596,6 +2562,7 @@ public:
}
DelWrapper(f);
Delete(dispatch);
+ Delete(dispatch_code);
Delete(tmp);
Delete(wname);
}
@@ -2688,12 +2655,12 @@ public:
builtin_self = false;
else
builtin_ctor = true;
+ Delete(mrename);
}
bool director_class = (getCurrentClass() && Swig_directorclass(getCurrentClass()));
bool add_self = builtin_self && (!builtin_ctor || director_class);
bool builtin_getter = (builtin && GetFlag(n, "memberget"));
bool builtin_setter = (builtin && GetFlag(n, "memberset") && !builtin_getter);
- bool over_varargs = false;
char const *self_param = builtin ? "self" : "SWIGUNUSEDPARM(self)";
char const *wrap_return = builtin_ctor ? "int " : "PyObject *";
String *linkage = NewString("SWIGINTERN ");
@@ -2742,9 +2709,10 @@ public:
Append(wname, overname);
}
+ const char *builtin_kwargs = builtin_ctor ? ", PyObject *SWIGUNUSEDPARM(kwargs)" : "";
if (!allow_kwargs || overname) {
if (!varargs) {
- Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args) {", NIL);
+ Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args", builtin_kwargs, ") {", NIL);
} else {
Printv(f->def, linkage, wrap_return, wname, "__varargs__", "(PyObject *", self_param, ", PyObject *args, PyObject *varargs) {", NIL);
}
@@ -2761,53 +2729,33 @@ public:
}
if (!builtin || !in_class || tuple_arguments > 0) {
if (!allow_kwargs) {
- Append(parse_args, " if (!PyArg_ParseTuple(args,(char *)\"");
+ Append(parse_args, " if (!PyArg_ParseTuple(args, \"");
} else {
- Append(parse_args, " if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)\"");
- Append(arglist, ",kwnames");
+ Append(parse_args, " if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"");
+ Append(arglist, ", kwnames");
}
}
- if (overname) {
- String *over_varargs_attr = Getattr(n, "python:overvarargs");
- if (!over_varargs_attr) {
- for (Node *sibling = n; sibling; sibling = Getattr(sibling, "sym:nextSibling")) {
- if (emit_isvarargs(Getattr(sibling, "parms"))) {
- over_varargs = true;
- break;
- }
- }
- over_varargs_attr = NewString(over_varargs ? "1" : "0");
- for (Node *sibling = n; sibling; sibling = Getattr(sibling, "sym:nextSibling"))
- Setattr(sibling, "python:overvarargs", over_varargs_attr);
- }
- if (Strcmp(over_varargs_attr, "0") != 0)
- over_varargs = true;
- }
+ bool over_varargs = emit_isvarargs_function(n);
- int funpack = modernargs && fastunpack && !varargs && !over_varargs && !allow_kwargs;
+ int funpack = fastunpack && !varargs && !over_varargs && !allow_kwargs;
int noargs = funpack && (tuple_required == 0 && tuple_arguments == 0);
int onearg = funpack && (tuple_required == 1 && tuple_arguments == 1);
- if (builtin && funpack && !overname && !builtin_ctor &&
- !(GetFlag(n, "feature:compactdefaultargs") && (tuple_arguments > tuple_required || varargs))) {
- String *argattr = NewStringf("%d", tuple_arguments);
- Setattr(n, "python:argcount", argattr);
- Delete(argattr);
+ if (builtin && funpack && !overname && !builtin_ctor) {
+ int compactdefargs = ParmList_is_compactdefargs(l);
+ if (!(compactdefargs && (tuple_arguments > tuple_required || varargs))) {
+ String *argattr = NewStringf("%d", tuple_arguments);
+ Setattr(n, "python:argcount", argattr);
+ Delete(argattr);
+ }
}
/* Generate code for argument marshalling */
if (funpack) {
- if (overname) {
- if (aliasobj0) {
- Append(f->code, "#define obj0 (swig_obj[0])\n");
- }
- } else if (num_arguments) {
+ if (num_arguments > 0 && !overname) {
sprintf(source, "PyObject *swig_obj[%d]", num_arguments);
Wrapper_add_localv(f, "swig_obj", source, NIL);
- if (aliasobj0) {
- Append(f->code, "#define obj0 (swig_obj[0])\n");
- }
}
}
@@ -2852,7 +2800,7 @@ public:
sprintf(source, "obj%d", builtin_ctor ? i + 1 : i);
if (parse_from_tuple) {
- Putc(',', arglist);
+ Printf(arglist, ", ");
if (i == num_required)
Putc('|', parse_args); /* Optional argument separator */
}
@@ -2860,7 +2808,7 @@ public:
/* Keyword argument handling */
if (allow_kwargs && parse_from_tuple) {
String *name = makeParameterName(n, p, i + 1);
- Printf(kwargs, "(char *) \"%s\",", name);
+ Printf(kwargs, " (char *)\"%s\", ", name);
Delete(name);
}
@@ -2925,12 +2873,12 @@ public:
/* finish argument marshalling */
Append(kwargs, " NULL }");
if (allow_kwargs) {
- Printv(f->locals, " char * kwnames[] = ", kwargs, ";\n", NIL);
+ Printv(f->locals, " char * kwnames[] = ", kwargs, ";\n", NIL);
}
if (builtin && !funpack && in_class && tuple_arguments == 0) {
Printf(parse_args, " if (args && PyTuple_Check(args) && PyTuple_GET_SIZE(args) > 0) SWIG_exception_fail(SWIG_TypeError, \"%s takes no arguments\");\n", iname);
- } else if (use_parse || allow_kwargs || !modernargs) {
+ } else if (use_parse || allow_kwargs) {
Printf(parse_args, ":%s\"", iname);
Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
funpack = 0;
@@ -2940,28 +2888,25 @@ public:
Clear(f->def);
if (overname) {
if (noargs) {
- Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {", NIL);
+ Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {", NIL);
} else {
- Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", int nobjs, PyObject **swig_obj) {", NIL);
+ Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", Py_ssize_t nobjs, PyObject **swig_obj) {", NIL);
}
Printf(parse_args, "if ((nobjs < %d) || (nobjs > %d)) SWIG_fail;\n", num_required, num_arguments);
} else {
- if (noargs) {
- Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args) {", NIL);
- } else {
- Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args) {", NIL);
- }
- if (onearg && !builtin_ctor) {
+ int is_tp_call = Equal(Getattr(n, "feature:python:slot"), "tp_call");
+ Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args", builtin_kwargs, ") {", NIL);
+ if (onearg && !builtin_ctor && !is_tp_call) {
Printf(parse_args, "if (!args) SWIG_fail;\n");
Append(parse_args, "swig_obj[0] = args;\n");
} else if (!noargs) {
- Printf(parse_args, "if (!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,swig_obj)) SWIG_fail;\n", iname, num_fixed_arguments, tuple_arguments);
+ Printf(parse_args, "if (!SWIG_Python_UnpackTuple(args, \"%s\", %d, %d, swig_obj)) SWIG_fail;\n", iname, num_fixed_arguments, tuple_arguments);
} else if (noargs) {
- Printf(parse_args, "if (!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,0)) SWIG_fail;\n", iname, num_fixed_arguments, tuple_arguments);
+ Printf(parse_args, "if (!SWIG_Python_UnpackTuple(args, \"%s\", %d, %d, 0)) SWIG_fail;\n", iname, num_fixed_arguments, tuple_arguments);
}
}
} else {
- Printf(parse_args, "if(!PyArg_UnpackTuple(args,(char *)\"%s\",%d,%d", iname, num_fixed_arguments, tuple_arguments);
+ Printf(parse_args, "if (!PyArg_UnpackTuple(args, \"%s\", %d, %d", iname, num_fixed_arguments, tuple_arguments);
Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
}
}
@@ -3026,9 +2971,9 @@ public:
}
/* if the object is a director, and the method call originated from its
- * underlying python object, resolve the call by going up the c++
- * inheritance chain. otherwise try to resolve the method in python.
- * without this check an infinite loop is set up between the director and
+ * underlying python object, resolve the call by going up the c++
+ * inheritance chain. otherwise try to resolve the method in python.
+ * without this check an infinite loop is set up between the director and
* shadow class method calls.
*/
@@ -3122,7 +3067,7 @@ public:
// base class pointers!
/* New addition to unwrap director return values so that the original
- * python object is returned instead.
+ * python object is returned instead.
*/
#if 1
int unwrap = 0;
@@ -3204,21 +3149,18 @@ public:
if (need_cleanup) {
Printv(f->code, cleanup, NIL);
}
- if (builtin_ctor)
+ if (builtin_ctor) {
Printv(f->code, " return -1;\n", NIL);
- else
- Printv(f->code, " return NULL;\n", NIL);
-
-
- if (funpack) {
- if (aliasobj0) {
- Append(f->code, "#if defined(obj0)\n");
- Append(f->code, "#undef obj0\n");
- Append(f->code, "#endif\n");
+ } else {
+ if (GetFlag(n, "feature:python:maybecall")) {
+ Append(f->code, " PyErr_Clear();\n");
+ Append(f->code, " Py_INCREF(Py_NotImplemented);\n");
+ Append(f->code, " return Py_NotImplemented;\n");
+ } else {
+ Printv(f->code, " return NULL;\n", NIL);
}
}
-
Append(f->code, "}\n");
/* Substitute the cleanup code */
@@ -3244,9 +3186,10 @@ public:
DelWrapper(f);
f = NewWrapper();
if (funpack) {
- Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", int nobjs, PyObject **swig_obj) {", NIL);
+ // Note: funpack is currently always false for varargs
+ Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", Py_ssize_t nobjs, PyObject **swig_obj) {", NIL);
} else {
- Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args) {", NIL);
+ Printv(f->def, linkage, wrap_return, wname, "(PyObject *", self_param, ", PyObject *args", builtin_kwargs, ") {", NIL);
}
Wrapper_add_local(f, "resultobj", builtin_ctor ? "int resultobj" : "PyObject *resultobj");
Wrapper_add_local(f, "varargs", "PyObject *varargs");
@@ -3309,6 +3252,10 @@ public:
Delete(h);
}
Setattr(h, "getter", "SwigPyObject_get___dict__");
+ if (!Getattr(h, "doc")) {
+ Setattr(n, "doc:high:name", Getattr(n, "name"));
+ Setattr(h, "doc", cdocstring(n, AUTODOC_VAR));
+ }
}
if (builtin_getter) {
@@ -3323,6 +3270,12 @@ public:
}
Setattr(h, "getter", wrapper_name);
Delattr(n, "memberget");
+ if (!Getattr(h, "doc")) {
+ Setattr(n, "doc:high:name", Getattr(n, "name"));
+ String *ds = cdocstring(n, AUTODOC_VAR);
+ Setattr(h, "doc", ds);
+ Delete(ds);
+ }
}
if (builtin_setter) {
String *memname = Getattr(n, "membervariableHandler:sym:name");
@@ -3336,6 +3289,12 @@ public:
}
Setattr(h, "setter", wrapper_name);
Delattr(n, "memberset");
+ if (!Getattr(h, "doc")) {
+ Setattr(n, "doc:high:name", Getattr(n, "name"));
+ String *ds = cdocstring(n, AUTODOC_VAR);
+ Setattr(h, "doc", ds);
+ Delete(ds);
+ }
}
if (in_class && builtin) {
@@ -3356,7 +3315,7 @@ public:
closure_name = Copy(wrapper_name);
}
if (func_type) {
- String *s = NewStringf("(%s) %s", func_type, closure_name);
+ String *s = NewStringf("%s", closure_name);
Delete(closure_name);
closure_name = s;
}
@@ -3413,7 +3372,17 @@ public:
Python dictionary. */
if (!have_globals) {
- Printf(f_init, "\t PyDict_SetItemString(md,(char *)\"%s\", SWIG_globals());\n", global_name);
+ Printf(f_init, "\t globals = SWIG_globals();\n");
+ Printf(f_init, "\t if (!globals) {\n");
+ Printf(f_init, " PyErr_SetString(PyExc_TypeError, \"Failure to create SWIG globals.\");\n");
+ Printf(f_init, "#if PY_VERSION_HEX >= 0x03000000\n");
+ Printf(f_init, "\t return NULL;\n");
+ Printf(f_init, "#else\n");
+ Printf(f_init, "\t return;\n");
+ Printf(f_init, "#endif\n");
+ Printf(f_init, "\t }\n");
+ Printf(f_init, "\t PyDict_SetItemString(md, \"%s\", globals);\n", global_name);
+ Printf(f_init, "\t Py_DECREF(globals);\n");
if (builtin)
Printf(f_init, "\t SwigPyBuiltin_AddPublicSymbol(public_interface, \"%s\");\n", global_name);
have_globals = 1;
@@ -3501,9 +3470,9 @@ public:
Wrapper_print(getf, f_wrappers);
/* Now add this to the variable linking mechanism */
- Printf(f_init, "\t SWIG_addvarlink(SWIG_globals(),(char *)\"%s\",%s, %s);\n", iname, vargetname, varsetname);
+ Printf(f_init, "\t SWIG_addvarlink(globals, \"%s\", %s, %s);\n", iname, vargetname, varsetname);
if (builtin && shadow && !assignable && !in_class) {
- Printf(f_init, "\t PyDict_SetItemString(md, (char *)\"%s\", PyObject_GetAttrString(SWIG_globals(), \"%s\"));\n", iname, iname);
+ Printf(f_init, "\t PyDict_SetItemString(md, \"%s\", PyObject_GetAttrString(globals, \"%s\"));\n", iname, iname);
Printf(f_init, "\t SwigPyBuiltin_AddPublicSymbol(public_interface, \"%s\");\n", iname);
}
Delete(vargetname);
@@ -3529,7 +3498,7 @@ public:
/* Note, that we need special handling for function pointers, as
* SwigType_base(fptr) does not return the underlying pointer-to-function
* type but the return-type of function. */
- if(!SwigType_isfunction(uqtype) && !SwigType_isfunctionpointer(uqtype)) {
+ if (!SwigType_isfunction(uqtype) && !SwigType_isfunctionpointer(uqtype)) {
SwigType *basetype = SwigType_base(uqtype);
result = SwigType_isclass(basetype) != 0;
Delete(basetype);
@@ -3595,15 +3564,7 @@ public:
Printf(f_wrappers, "SWIGINTERN PyObject *%s_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", iname);
Printf(f_wrappers, tab2 "PyObject *module;\n", tm);
Printf(f_wrappers, tab2 "PyObject *d;\n");
- if (modernargs) {
- if (fastunpack) {
- Printf(f_wrappers, tab2 "if (!SWIG_Python_UnpackTuple(args,(char *)\"swigconstant\", 1, 1,&module)) return NULL;\n");
- } else {
- Printf(f_wrappers, tab2 "if (!PyArg_UnpackTuple(args,(char *)\"swigconstant\", 1, 1,&module)) return NULL;\n");
- }
- } else {
- Printf(f_wrappers, tab2 "if (!PyArg_ParseTuple(args,(char *)\"O:swigconstant\", &module)) return NULL;\n");
- }
+ Printf(f_wrappers, tab2 "if (!SWIG_Python_UnpackTuple(args, \"swigconstant\", 1, 1, &module)) return NULL;\n");
Printf(f_wrappers, tab2 "d = PyModule_GetDict(module);\n");
Printf(f_wrappers, tab2 "if (!d) return NULL;\n");
Printf(f_wrappers, tab2 "%s\n", tm);
@@ -3612,7 +3573,7 @@ public:
// Register the method in SwigMethods array
String *cname = NewStringf("%s_swigconstant", iname);
- add_method(cname, cname, 0);
+ add_method(cname, cname, 0, 0, 1, 1, 1);
Delete(cname);
} else {
Printf(f_init, "%s\n", tm);
@@ -3630,27 +3591,28 @@ public:
}
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER))) {
+ String *f_s;
if (!in_class) {
- if(needs_swigconstant(n)) {
- Printv(f_shadow, "\n",NIL);
- Printv(f_shadow, module, ".", iname, "_swigconstant(",module,")\n", NIL);
- }
- Printv(f_shadow, iname, " = ", module, ".", iname, "\n", NIL);
+ f_s = f_shadow;
} else {
- if (!(Getattr(n, "feature:python:callback"))) {
- if(needs_swigconstant(n)) {
- Printv(f_shadow_stubs, "\n",NIL);
- Printv(f_shadow_stubs, module, ".", iname, "_swigconstant(", module, ")\n", NIL);
- }
- Printv(f_shadow_stubs, iname, " = ", module, ".", iname, "\n", NIL);
+ f_s = Getattr(n, "feature:python:callback") ? NIL : f_shadow_stubs;
+ }
+
+ if (f_s) {
+ if (needs_swigconstant(n)) {
+ Printv(f_s, "\n",NIL);
+ Printv(f_s, module, ".", iname, "_swigconstant(",module,")\n", NIL);
}
+ Printv(f_s, iname, " = ", module, ".", iname, "\n", NIL);
+ if (have_docstring(n))
+ Printv(f_s, docstring(n, AUTODOC_CONST, tab4), "\n", NIL);
}
}
return SWIG_OK;
}
- /* ------------------------------------------------------------
+ /* ------------------------------------------------------------
* nativeWrapper()
* ------------------------------------------------------------ */
@@ -3685,7 +3647,7 @@ public:
/* ---------------------------------------------------------------
* classDirectorMethod()
*
- * Emit a virtual director method to pass a method call on to the
+ * Emit a virtual director method to pass a method call on to the
* underlying Python object.
* ** Moved down due to gcc-2.96 internal error **
* --------------------------------------------------------------- */
@@ -3722,7 +3684,7 @@ public:
Wrapper *w = NewWrapper();
String *call;
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, classname, parms, 0);
call = Swig_csuperclass_call(0, basetype, superparms);
Printf(w->def, "%s::%s: %s, Swig::Director(self) { \n", classname, target, call);
Printf(w->def, " SWIG_DIRECTOR_RGTR((%s *)this, this); \n", basetype);
@@ -3735,7 +3697,7 @@ public:
/* constructor header */
{
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, classname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -3857,7 +3819,7 @@ public:
if (shadow) {
if (builtin) {
String *rname = SwigType_namestr(real_classname);
- Printf(builtin_methods, " { \"__disown__\", (PyCFunction) Swig::Director::swig_pyobj_disown< %s >, METH_NOARGS, \"\" },\n", rname);
+ Printf(builtin_methods, " { \"__disown__\", Swig::Director::swig_pyobj_disown< %s >, METH_NOARGS, \"\" },\n", rname);
Delete(rname);
} else {
String *symname = Getattr(n, "sym:name");
@@ -3869,7 +3831,7 @@ public:
Printv(f_shadow, tab8, "self.this.disown()\n", NIL);
#endif
Printv(f_shadow, tab8, module, ".", mrename, "(self)\n", NIL);
- Printv(f_shadow, tab8, "return weakref_proxy(self)\n", NIL);
+ Printv(f_shadow, tab8, "return weakref.proxy(self)\n", NIL);
Delete(mrename);
}
}
@@ -3937,7 +3899,7 @@ public:
String *mname = SwigType_manglestr(rname);
String *pmname = SwigType_manglestr(pname);
String *templ = NewStringf("SwigPyBuiltin_%s", mname);
- int funpack = modernargs && fastunpack;
+ int funpack = fastunpack;
static String *tp_new = NewString("PyType_GenericNew");
Printv(f_init, " SwigPyBuiltin_SetMetaType(builtin_pytype, metatype);\n", NIL);
@@ -4003,9 +3965,10 @@ public:
const char *setter_closure = setter ? funpack ? "SwigPyBuiltin_FunpackSetterClosure" : "SwigPyBuiltin_SetterClosure" : "0";
String *gspair = NewStringf("%s_%s_getset", symname, memname);
Printf(f, "static SwigPyGetSet %s = { %s, %s };\n", gspair, getter ? getter : "0", setter ? setter : "0");
- String *entry =
- NewStringf("{ (char *) \"%s\", (getter) %s, (setter) %s, (char *)\"%s.%s\", (void *) &%s }\n", memname, getter_closure,
- setter_closure, name, memname, gspair);
+ String *doc = Getattr(mgetset, "doc");
+ if (!doc)
+ doc = NewStringf("%s.%s", name, memname);
+ String *entry = NewStringf("{ (char *)\"%s\", %s, %s, (char *)\"%s\", &%s }", memname, getter_closure, setter_closure, doc, gspair);
if (GetFlag(mgetset, "static")) {
Printf(f, "static PyGetSetDef %s_def = %s;\n", gspair, entry);
Printf(f_init, "static_getset = SwigPyStaticVar_new_getset(metatype, &%s_def);\n", gspair);
@@ -4017,7 +3980,7 @@ public:
Delete(gspair);
Delete(entry);
}
- Printv(f, getset_def, " {NULL, NULL, NULL, NULL, NULL} /* Sentinel */\n", "};\n\n", NIL);
+ Printv(f, getset_def, " { NULL, NULL, NULL, NULL, NULL } /* Sentinel */\n", "};\n\n", NIL);
// Rich compare function
Hash *richcompare = Getattr(n, "python:richcompare");
@@ -4126,7 +4089,16 @@ public:
Printv(f, "#else\n", NIL);
printSlot(f, getSlot(n, "feature:python:tp_flags", tp_flags), "tp_flags");
Printv(f, "#endif\n", NIL);
- printSlot(f, quoted_tp_doc_str, "tp_doc");
+ if (have_docstring(n)) {
+ String *ds = cdocstring(n, AUTODOC_CLASS);
+ String *tp_doc = NewString("");
+ Printf(tp_doc, "\"%s\"", ds);
+ Delete(ds);
+ printSlot(f, tp_doc, "tp_doc");
+ Delete(tp_doc);
+ } else {
+ printSlot(f, quoted_tp_doc_str, "tp_doc");
+ }
printSlot(f, getSlot(n, "feature:python:tp_traverse"), "tp_traverse", "traverseproc");
printSlot(f, getSlot(n, "feature:python:tp_clear"), "tp_clear", "inquiry");
printSlot(f, getSlot(n, "feature:python:tp_richcompare", richcompare_func), "tp_richcompare", "richcmpfunc");
@@ -4152,9 +4124,7 @@ public:
printSlot(f, getSlot(n, "feature:python:tp_subclasses"), "tp_subclasses", "PyObject *");
printSlot(f, getSlot(n, "feature:python:tp_weaklist"), "tp_weaklist", "PyObject *");
printSlot(f, getSlot(n, "feature:python:tp_del"), "tp_del", "destructor");
- Printv(f, "#if PY_VERSION_HEX >= 0x02060000\n", NIL);
printSlot(f, getSlot(n, "feature:python:tp_version_tag"), "tp_version_tag", "int");
- Printv(f, "#endif\n", NIL);
Printv(f, "#if PY_VERSION_HEX >= 0x03040000\n", NIL);
printSlot(f, getSlot(n, "feature:python:tp_finalize"), "tp_finalize", "destructor");
Printv(f, "#endif\n", NIL);
@@ -4162,9 +4132,7 @@ public:
printSlot(f, getSlot(n, "feature:python:tp_allocs"), "tp_allocs", "Py_ssize_t");
printSlot(f, getSlot(n, "feature:python:tp_frees"), "tp_frees", "Py_ssize_t");
printSlot(f, getSlot(n, "feature:python:tp_maxalloc"), "tp_maxalloc", "Py_ssize_t");
- Printv(f, "#if PY_VERSION_HEX >= 0x02050000\n", NIL);
printSlot(f, getSlot(n, "feature:python:tp_prev"), "tp_prev");
- Printv(f, "#endif\n", NIL);
printSlot(f, getSlot(n, "feature:python:tp_next"), "tp_next");
Printv(f, "#endif\n", NIL);
Printf(f, " },\n");
@@ -4230,9 +4198,7 @@ public:
printSlot(f, getSlot(n, "feature:python:nb_divide"), "nb_true_divide", "binaryfunc");
printSlot(f, getSlot(n, "feature:python:nb_inplace_floor_divide"), "nb_inplace_floor_divide", "binaryfunc");
printSlot(f, getSlot(n, "feature:python:nb_inplace_divide"), "nb_inplace_true_divide", "binaryfunc");
- Printv(f, "#if PY_VERSION_HEX >= 0x02050000\n", NIL);
printSlot(f, getSlot(n, "feature:python:nb_index"), "nb_index", "unaryfunc");
- Printv(f, "#endif\n", NIL);
Printv(f, "#if PY_VERSION_HEX >= 0x03050000\n", NIL);
printSlot(f, getSlot(n, "feature:python:nb_matrix_multiply"), "nb_matrix_multiply", "binaryfunc");
printSlot(f, getSlot(n, "feature:python:nb_inplace_matrix_multiply"), "nb_inplace_matrix_multiply", "binaryfunc");
@@ -4276,10 +4242,8 @@ public:
printSlot(f, getSlot(n, "feature:python:bf_getsegcount"), "bf_getsegcount", "segcountproc");
printSlot(f, getSlot(n, "feature:python:bf_getcharbuffer"), "bf_getcharbuffer", "charbufferproc");
Printv(f, "#endif\n", NIL);
- Printv(f, "#if PY_VERSION_HEX >= 0x02060000\n", NIL);
printSlot(f, getSlot(n, "feature:python:bf_getbuffer"), "bf_getbuffer", "getbufferproc");
printSlot(f, getSlot(n, "feature:python:bf_releasebuffer"), "bf_releasebuffer", "releasebufferproc");
- Printv(f, "#endif\n", NIL);
Printf(f, " },\n");
// PyObject *ht_name, *ht_slots, *ht_qualname;
@@ -4349,8 +4313,6 @@ public:
}
virtual int classHandler(Node *n) {
- int oldclassic = classic;
- int oldmodern = modern;
File *f_shadow_file = f_shadow;
Node *base_node = NULL;
@@ -4360,19 +4322,6 @@ public:
have_constructor = 0;
have_repr = 0;
- if (GetFlag(n, "feature:classic")) {
- classic = 1;
- modern = 0;
- }
- if (GetFlag(n, "feature:modern")) {
- classic = 0;
- modern = 1;
- }
- if (GetFlag(n, "feature:exceptionclass")) {
- classic = 1;
- modern = 0;
- }
-
class_name = Getattr(n, "sym:name");
real_classname = Getattr(n, "name");
@@ -4438,9 +4387,9 @@ public:
if (builtin) {
if (have_docstring(n)) {
- String *str = cdocstring(n, AUTODOC_CLASS);
- Setattr(n, "feature:python:tp_doc", str);
- Delete(str);
+ String *ds = cdocstring(n, AUTODOC_CLASS);
+ Setattr(n, "feature:python:tp_doc", ds);
+ Delete(ds);
} else {
String *name = Getattr(n, "name");
String *rname = add_explicit_scope(SwigType_namestr(name));
@@ -4448,52 +4397,37 @@ public:
Delete(rname);
}
} else {
+ if (!py3) {
+ if (GetFlag(n, "feature:python:nondynamic"))
+ Printv(f_shadow, "@_swig_add_metaclass(_SwigNonDynamicMeta)\n", NIL);
+ }
Printv(f_shadow, "class ", class_name, NIL);
if (Len(base_class)) {
Printf(f_shadow, "(%s)", base_class);
} else {
- if (!classic) {
- Printf(f_shadow, modern ? "(object)" : "(_object)");
- }
if (GetFlag(n, "feature:exceptionclass")) {
Printf(f_shadow, "(Exception)");
+ } else {
+ Printf(f_shadow, "(object");
+ Printf(f_shadow, py3 && GetFlag(n, "feature:python:nondynamic") ? ", metaclass=_SwigNonDynamicMeta" : "", ")");
+ Printf(f_shadow, ")");
}
}
Printf(f_shadow, ":\n");
+
+ // write docstrings if requested
if (have_docstring(n)) {
String *str = docstring(n, AUTODOC_CLASS, tab4);
if (str && Len(str))
Printv(f_shadow, tab4, str, "\n\n", NIL);
}
- if (!modern) {
- Printv(f_shadow, tab4, "__swig_setmethods__ = {}\n", NIL);
- if (Len(base_class)) {
- Printv(f_shadow, tab4, "for _s in [", base_class, "]:\n", tab8, "__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))\n", NIL);
- }
-
- if (!GetFlag(n, "feature:python:nondynamic")) {
- Printv(f_shadow, tab4, "__setattr__ = lambda self, name, value: _swig_setattr(self, ", class_name, ", name, value)\n", NIL);
- } else {
- Printv(f_shadow, tab4, "__setattr__ = lambda self, name, value: _swig_setattr_nondynamic(self, ", class_name, ", name, value)\n", NIL);
- }
-
- Printv(f_shadow, tab4, "__swig_getmethods__ = {}\n", NIL);
- if (Len(base_class)) {
- Printv(f_shadow, tab4, "for _s in [", base_class, "]:\n", tab8, "__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))\n", NIL);
- }
-
- Printv(f_shadow, tab4, "__getattr__ = lambda self, name: _swig_getattr(self, ", class_name, ", name)\n", NIL);
- } else {
- Printv(f_shadow, tab4, "thisown = _swig_property(lambda x: x.this.own(), ", "lambda x, v: x.this.own(v), doc='The membership flag')\n", NIL);
- /* Add static attribute */
- if (GetFlag(n, "feature:python:nondynamic")) {
- Printv(f_shadow_file,
- tab4, "__setattr__ = _swig_setattr_nondynamic_method(object.__setattr__)\n",
- tab4, "class __metaclass__(type):\n", tab4, tab4, "__setattr__ = _swig_setattr_nondynamic_method(type.__setattr__)\n", NIL);
- }
+ Printv(f_shadow, tab4, "thisown = property(lambda x: x.this.own(), ", "lambda x, v: x.this.own(v), doc=\"The membership flag\")\n", NIL);
+ /* Add static attribute */
+ if (GetFlag(n, "feature:python:nondynamic")) {
+ Printv(f_shadow_file, tab4, "__setattr__ = _swig_setattr_nondynamic_instance_variable(object.__setattr__)\n", NIL);
}
}
}
@@ -4544,20 +4478,12 @@ public:
} else {
Printv(f_wrappers, "SWIGINTERN PyObject *", class_name, "_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", NIL);
Printv(f_wrappers, " PyObject *obj;\n", NIL);
- if (modernargs) {
- if (fastunpack) {
- Printv(f_wrappers, " if (!SWIG_Python_UnpackTuple(args,(char *)\"swigregister\", 1, 1,&obj)) return NULL;\n", NIL);
- } else {
- Printv(f_wrappers, " if (!PyArg_UnpackTuple(args,(char *)\"swigregister\", 1, 1,&obj)) return NULL;\n", NIL);
- }
- } else {
- Printv(f_wrappers, " if (!PyArg_ParseTuple(args,(char *)\"O:swigregister\", &obj)) return NULL;\n", NIL);
- }
+ Printv(f_wrappers, " if (!SWIG_Python_UnpackTuple(args, \"swigregister\", 1, 1, &obj)) return NULL;\n", NIL);
Printv(f_wrappers,
" SWIG_TypeNewClientData(SWIGTYPE", SwigType_manglestr(ct), ", SWIG_NewClientData(obj));\n", " return SWIG_Py_Void();\n", "}\n\n", NIL);
String *cname = NewStringf("%s_swigregister", class_name);
- add_method(cname, cname, 0);
+ add_method(cname, cname, 0, 0, 1, 1, 1);
Delete(cname);
}
Delete(smart);
@@ -4567,7 +4493,7 @@ public:
if (!builtin)
Printv(f_shadow_file, "\n", tab4, "def __init__(self, *args, **kwargs):\n", tab8, "raise AttributeError(\"", "No constructor defined",
(Getattr(n, "abstracts") ? " - class is abstract" : ""), "\")\n", NIL);
- } else if (fastinit && !builtin) {
+ } else if (!builtin) {
Printv(f_wrappers, "SWIGINTERN PyObject *", class_name, "_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", NIL);
Printv(f_wrappers, " return SWIG_Python_InitShadowInstance(args);\n", "}\n\n", NIL);
@@ -4578,11 +4504,7 @@ public:
if (!have_repr && !builtin) {
/* Supply a repr method for this class */
String *rname = SwigType_namestr(real_classname);
- if (new_repr) {
- Printv(f_shadow_file, tab4, "__repr__ = _swig_repr\n", NIL);
- } else {
- Printv(f_shadow_file, tab4, "def __repr__(self):\n", tab8, "return \"<C ", rname, " instance at %p>\" % (self.this,)\n", NIL);
- }
+ Printv(f_shadow_file, tab4, "__repr__ = _swig_repr\n", NIL);
Delete(rname);
}
@@ -4594,35 +4516,12 @@ public:
builtin_tp_init = 0;
}
- /* Now emit methods */
- if (!builtin)
- Printv(f_shadow_file, f_shadow, NIL);
-
- /* Now the Ptr class */
- if (classptr && !builtin) {
- Printv(f_shadow_file, "\nclass ", class_name, "Ptr(", class_name, "):\n", tab4, "def __init__(self, this):\n", NIL);
- if (!modern) {
- Printv(f_shadow_file,
- tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
- tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n\n", NIL);
- } else {
- Printv(f_shadow_file,
- tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
- tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n\n", NIL);
- }
- }
-
if (!builtin) {
- if (fastproxy) {
- List *shadow_list = Getattr(n, "shadow_methods");
- for (int i = 0; i < Len(shadow_list); ++i) {
- String *symname = Getitem(shadow_list, i);
- Printf(f_shadow_file, "%s.%s = new_instancemethod(%s.%s, None, %s)\n", class_name, symname, module, Swig_name_member(NSPACE_TODO, class_name, symname),
- class_name);
- }
- }
- Printf(f_shadow_file, "%s_swigregister = %s.%s_swigregister\n", class_name, module, class_name);
- Printf(f_shadow_file, "%s_swigregister(%s)\n", class_name, class_name);
+ /* Now emit methods */
+ Printv(f_shadow_file, f_shadow, NIL);
+ Printf(f_shadow_file, "\n");
+ Printf(f_shadow_file, "# Register %s in %s:\n", class_name, module);
+ Printf(f_shadow_file, "%s.%s_swigregister(%s)\n", module, class_name, class_name);
}
shadow_indent = 0;
@@ -4636,9 +4535,6 @@ public:
Clear(builtin_methods);
}
- classic = oldclassic;
- modern = oldmodern;
-
/* Restore shadow file back to original version */
Delete(f_shadow);
f_shadow = f_shadow_file;
@@ -4692,15 +4588,19 @@ public:
String *wname = Swig_name_wrapper(fullname);
Setattr(class_members, symname, n);
int argcount = Getattr(n, "python:argcount") ? atoi(Char(Getattr(n, "python:argcount"))) : 2;
- String *ds = have_docstring(n) ? cdocstring(n, AUTODOC_FUNC) : NewString("");
+ String *ds = have_docstring(n) ? cdocstring(n, AUTODOC_METHOD) : NewString("");
if (check_kwargs(n)) {
- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_VARARGS|METH_KEYWORDS, (char *) \"%s\" },\n", symname, wname, ds);
+ // Cast via void(*)(void) to suppress GCC -Wcast-function-type
+ // warning. Python should always call the function correctly, but
+ // the Python C API requires us to store it in function pointer of a
+ // different type.
+ Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, METH_VARARGS|METH_KEYWORDS, \"%s\" },\n", symname, wname, ds);
} else if (argcount == 0) {
- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_NOARGS, (char *) \"%s\" },\n", symname, wname, ds);
+ Printf(builtin_methods, " { \"%s\", %s, METH_NOARGS, \"%s\" },\n", symname, wname, ds);
} else if (argcount == 1) {
- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_O, (char *) \"%s\" },\n", symname, wname, ds);
+ Printf(builtin_methods, " { \"%s\", %s, METH_O, \"%s\" },\n", symname, wname, ds);
} else {
- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_VARARGS, (char *) \"%s\" },\n", symname, wname, ds);
+ Printf(builtin_methods, " { \"%s\", %s, METH_VARARGS, \"%s\" },\n", symname, wname, ds);
}
Delete(fullname);
Delete(wname);
@@ -4733,6 +4633,8 @@ public:
if (!have_addtofunc(n)) {
if (!fastproxy || olddefs) {
Printv(f_shadow, "\n", tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL);
+ if (have_docstring(n))
+ Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL);
Printv(f_shadow, tab8, "return ", funcCall(fullname, callParms), "\n", NIL);
}
} else {
@@ -4754,13 +4656,8 @@ public:
}
}
if (fproxy) {
- List *shadow_list = Getattr(getCurrentClass(), "shadow_methods");
- if (!shadow_list) {
- shadow_list = NewList();
- Setattr(getCurrentClass(), "shadow_methods", shadow_list);
- Delete(shadow_list);
- }
- Append(shadow_list, symname);
+ Printf(f_shadow, tab4);
+ Printf(f_shadow, "%s = _swig_new_instance_method(%s.%s)\n", symname, module, Swig_name_member(NSPACE_TODO, class_name, symname));
}
Delete(fullname);
}
@@ -4790,7 +4687,7 @@ public:
String *fullname = Swig_name_member(NSPACE_TODO, class_name, symname);
String *wname = Swig_name_wrapper(fullname);
Setattr(class_members, symname, n);
- int funpack = modernargs && fastunpack && !Getattr(n, "sym:overloaded");
+ int funpack = fastunpack && !Getattr(n, "sym:overloaded");
String *pyflags = NewString("METH_STATIC|");
int argcount = Getattr(n, "python:argcount") ? atoi(Char(Getattr(n, "python:argcount"))) : 2;
if (funpack && argcount == 0)
@@ -4799,12 +4696,15 @@ public:
Append(pyflags, "METH_O");
else
Append(pyflags, "METH_VARARGS");
+ // Cast via void(*)(void) to suppress GCC -Wcast-function-type warning.
+ // Python should always call the function correctly, but the Python C
+ // API requires us to store it in function pointer of a different type.
if (have_docstring(n)) {
String *ds = cdocstring(n, AUTODOC_STATICFUNC);
- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, %s, (char *) \"%s\" },\n", symname, wname, pyflags, ds);
+ Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, %s, \"%s\" },\n", symname, wname, pyflags, ds);
Delete(ds);
} else {
- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, %s, \"\" },\n", symname, wname, pyflags);
+ Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, %s, \"\" },\n", symname, wname, pyflags);
}
Delete(fullname);
Delete(wname);
@@ -4818,10 +4718,13 @@ public:
}
if (shadow) {
- if (!Getattr(n, "feature:python:callback") && have_addtofunc(n)) {
+ String *staticfunc_name = NewString(fastproxy ? "_swig_new_static_method" : "staticmethod");
+ bool fast = (fastproxy && !have_addtofunc(n)) || Getattr(n, "feature:callback");
+ if (!fast || olddefs) {
int kw = (check_kwargs(n) && !Getattr(n, "sym:overloaded")) ? 1 : 0;
String *parms = make_pyParmList(n, false, false, kw);
String *callParms = make_pyParmList(n, false, true, kw);
+ Printv(f_shadow, "\n", tab4, "@staticmethod", NIL);
Printv(f_shadow, "\n", tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL);
if (have_docstring(n))
Printv(f_shadow, tab8, docstring(n, AUTODOC_STATICFUNC, tab8), "\n", NIL);
@@ -4830,24 +4733,18 @@ public:
if (have_pythonappend(n)) {
Printv(f_shadow, tab8, "val = ", funcCall(Swig_name_member(NSPACE_TODO, class_name, symname), callParms), "\n", NIL);
Printv(f_shadow, indent_pythoncode(pythonappend(n), tab8, Getfile(n), Getline(n), "%pythonappend or %feature(\"pythonappend\")"), "\n", NIL);
- Printv(f_shadow, tab8, "return val\n\n", NIL);
+ Printv(f_shadow, tab8, "return val\n", NIL);
} else {
- Printv(f_shadow, tab8, "return ", funcCall(Swig_name_member(NSPACE_TODO, class_name, symname), callParms), "\n\n", NIL);
- }
- Printv(f_shadow, tab4, symname, " = staticmethod(", symname, ")\n", NIL);
- } else {
- if (!classic) {
- if (!modern)
- Printv(f_shadow, tab4, "if _newclass:\n", tab4, NIL);
- Printv(f_shadow, tab4, symname, " = staticmethod(", module, ".", Swig_name_member(NSPACE_TODO, class_name, symname),
- ")\n", NIL);
- }
- if (classic || !modern) {
- if (!classic)
- Printv(f_shadow, tab4, "else:\n", tab4, NIL);
- Printv(f_shadow, tab4, symname, " = ", module, ".", Swig_name_member(NSPACE_TODO, class_name, symname), "\n", NIL);
+ Printv(f_shadow, tab8, "return ", funcCall(Swig_name_member(NSPACE_TODO, class_name, symname), callParms), "\n", NIL);
}
}
+
+ // Below may result in a 2nd definition of the method when -olddefs is used. The Python interpreter will use the second definition as it overwrites the first.
+ if (fast) {
+ Printv(f_shadow, tab4, symname, " = ", staticfunc_name, "(", module, ".", Swig_name_member(NSPACE_TODO, class_name, symname),
+ ")\n", NIL);
+ }
+ Delete(staticfunc_name);
}
return SWIG_OK;
}
@@ -4861,7 +4758,7 @@ public:
int oldshadow = shadow;
int use_director = Swig_directorclass(n);
- /*
+ /*
* If we're wrapping the constructor of a C++ director class, prepend a new parameter
* to receive the scripting language object (e.g. 'self')
*
@@ -4905,11 +4802,12 @@ public:
Delete(cname);
}
+ String *subfunc = Swig_name_construct(NSPACE_TODO, symname);
if (!have_constructor && handled_as_init) {
if (!builtin) {
if (Getattr(n, "feature:shadow")) {
String *pycode = indent_pythoncode(Getattr(n, "feature:shadow"), tab4, Getfile(n), Getline(n), "%feature(\"shadow\")");
- String *pyaction = NewStringf("%s.%s", module, Swig_name_construct(NSPACE_TODO, symname));
+ String *pyaction = NewStringf("%s.%s", module, subfunc);
Replaceall(pycode, "$action", pyaction);
Delete(pyaction);
Printv(f_shadow, pycode, "\n", NIL);
@@ -4923,7 +4821,7 @@ public:
String *parms = make_pyParmList(n, true, false, allow_kwargs);
/* Pass 'self' only if using director */
- String *callParms = make_pyParmList(n, false, true, allow_kwargs);
+ String *callParms = make_pyParmList(n, false, true, allow_kwargs, true);
if (use_director) {
Insert(callParms, 0, "_self, ");
@@ -4939,13 +4837,7 @@ public:
if (have_pythonprepend(n))
Printv(f_shadow, indent_pythoncode(pythonprepend(n), tab8, Getfile(n), Getline(n), "%pythonprepend or %feature(\"pythonprepend\")"), "\n", NIL);
Printv(f_shadow, pass_self, NIL);
- if (fastinit) {
- Printv(f_shadow, tab8, module, ".", class_name, "_swiginit(self, ", funcCall(Swig_name_construct(NSPACE_TODO, symname), callParms), ")\n", NIL);
- } else {
- Printv(f_shadow,
- tab8, "this = ", funcCall(Swig_name_construct(NSPACE_TODO, symname), callParms), "\n",
- tab8, "try:\n", tab8, tab4, "self.this.append(this)\n", tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", NIL);
- }
+ Printv(f_shadow, tab8, module, ".", class_name, "_swiginit(self, ", funcCall(subfunc, callParms), ")\n", NIL);
if (have_pythonappend(n))
Printv(f_shadow, indent_pythoncode(pythonappend(n), tab8, Getfile(n), Getline(n), "%pythonappend or %feature(\"pythonappend\")"), "\n\n", NIL);
Delete(pass_self);
@@ -4955,39 +4847,36 @@ public:
} else {
/* Hmmm. We seem to be creating a different constructor. We're just going to create a
function for it. */
- if (Getattr(n, "feature:shadow")) {
- String *pycode = indent_pythoncode(Getattr(n, "feature:shadow"), "", Getfile(n), Getline(n), "%feature(\"shadow\")");
- String *pyaction = NewStringf("%s.%s", module, Swig_name_construct(NSPACE_TODO, symname));
- Replaceall(pycode, "$action", pyaction);
- Delete(pyaction);
- Printv(f_shadow_stubs, pycode, "\n", NIL);
- Delete(pycode);
- } else {
- String *parms = make_pyParmList(n, false, false, allow_kwargs);
- String *callParms = make_pyParmList(n, false, true, allow_kwargs);
+ if (!builtin) {
+ if (Getattr(n, "feature:shadow")) {
+ String *pycode = indent_pythoncode(Getattr(n, "feature:shadow"), "", Getfile(n), Getline(n), "%feature(\"shadow\")");
+ String *pyaction = NewStringf("%s.%s", module, subfunc);
+ Replaceall(pycode, "$action", pyaction);
+ Delete(pyaction);
+ Printv(f_shadow_stubs, pycode, "\n", NIL);
+ Delete(pycode);
+ } else {
+ String *parms = make_pyParmList(n, false, false, allow_kwargs);
+ String *callParms = make_pyParmList(n, false, true, allow_kwargs);
- Printv(f_shadow_stubs, "\ndef ", symname, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL);
- if (have_docstring(n))
- Printv(f_shadow_stubs, tab4, docstring(n, AUTODOC_CTOR, tab4), "\n", NIL);
- if (have_pythonprepend(n))
- Printv(f_shadow_stubs, indent_pythoncode(pythonprepend(n), tab4, Getfile(n), Getline(n), "%pythonprepend or %feature(\"pythonprepend\")"), "\n", NIL);
- String *subfunc = NULL;
- /*
- if (builtin)
- subfunc = Copy(Getattr(getCurrentClass(), "sym:name"));
- else
- */
- subfunc = Swig_name_construct(NSPACE_TODO, symname);
- Printv(f_shadow_stubs, tab4, "val = ", funcCall(subfunc, callParms), "\n", NIL);
+ Printv(f_shadow_stubs, "\ndef ", symname, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL);
+ if (have_docstring(n))
+ Printv(f_shadow_stubs, tab4, docstring(n, AUTODOC_CTOR, tab4), "\n", NIL);
+ if (have_pythonprepend(n))
+ Printv(f_shadow_stubs, indent_pythoncode(pythonprepend(n), tab4, Getfile(n), Getline(n), "%pythonprepend or %feature(\"pythonprepend\")"), "\n", NIL);
+ Printv(f_shadow_stubs, tab4, "val = ", funcCall(subfunc, callParms), "\n", NIL);
#ifdef USE_THISOWN
- Printv(f_shadow_stubs, tab4, "val.thisown = 1\n", NIL);
+ Printv(f_shadow_stubs, tab4, "val.thisown = 1\n", NIL);
#endif
- if (have_pythonappend(n))
- Printv(f_shadow_stubs, indent_pythoncode(pythonappend(n), tab4, Getfile(n), Getline(n), "%pythonappend or %feature(\"pythonappend\")"), "\n", NIL);
- Printv(f_shadow_stubs, tab4, "return val\n", NIL);
- Delete(subfunc);
+ if (have_pythonappend(n))
+ Printv(f_shadow_stubs, indent_pythoncode(pythonappend(n), tab4, Getfile(n), Getline(n), "%pythonappend or %feature(\"pythonappend\")"), "\n", NIL);
+ Printv(f_shadow_stubs, tab4, "return val\n", NIL);
+ }
+ } else {
+ Printf(f_shadow_stubs, "%s = %s\n", symname, subfunc);
}
}
+ Delete(subfunc);
}
}
return SWIG_OK;
@@ -5027,9 +4916,6 @@ public:
} else {
Printv(f_shadow, tab4, "__swig_destroy__ = ", module, ".", Swig_name_destroy(NSPACE_TODO, symname), "\n", NIL);
if (!have_pythonprepend(n) && !have_pythonappend(n)) {
- if (proxydel) {
- Printv(f_shadow, tab4, "__del__ = lambda self: None\n", NIL);
- }
return SWIG_OK;
}
Printv(f_shadow, tab4, "def __del__(self):\n", NIL);
@@ -5070,20 +4956,12 @@ public:
String *setname = Swig_name_set(NSPACE_TODO, mname);
String *getname = Swig_name_get(NSPACE_TODO, mname);
int assignable = is_assignable(n);
- if (!modern) {
- if (assignable) {
- Printv(f_shadow, tab4, "__swig_setmethods__[\"", symname, "\"] = ", module, ".", setname, "\n", NIL);
- }
- Printv(f_shadow, tab4, "__swig_getmethods__[\"", symname, "\"] = ", module, ".", getname, "\n", NIL);
- }
- if (!classic) {
- if (!modern)
- Printv(f_shadow, tab4, "if _newclass:\n", tab4, NIL);
- Printv(f_shadow, tab4, symname, " = _swig_property(", module, ".", getname, NIL);
- if (assignable)
- Printv(f_shadow, ", ", module, ".", setname, NIL);
- Printv(f_shadow, ")\n", NIL);
- }
+ Printv(f_shadow, tab4, symname, " = property(", module, ".", getname, NIL);
+ if (assignable)
+ Printv(f_shadow, ", ", module, ".", setname, NIL);
+ if (have_docstring(n))
+ Printv(f_shadow, ", doc=", docstring(n, AUTODOC_VAR, tab4), NIL);
+ Printv(f_shadow, ")\n", NIL);
Delete(mname);
Delete(setname);
Delete(getname);
@@ -5129,13 +5007,13 @@ public:
DelWrapper(f);
int assignable = is_assignable(n);
if (assignable) {
- int funpack = modernargs && fastunpack;
+ int funpack = fastunpack;
Wrapper *f = NewWrapper();
Printv(f->def, "SWIGINTERN PyObject *", wrapsetname, "(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {", NIL);
Wrapper_add_local(f, "res", "int res");
if (!funpack) {
Wrapper_add_local(f, "value", "PyObject *value");
- Append(f->code, "if (!PyArg_ParseTuple(args,(char *)\"O:set\",&value)) return NULL;\n");
+ Append(f->code, "if (!PyArg_ParseTuple(args, \"O:set\", &value)) return NULL;\n");
}
Printf(f->code, "res = %s(%s);\n", varsetname, funpack ? "args" : "value");
Append(f->code, "return !res ? SWIG_Py_Void() : NULL;\n");
@@ -5144,18 +5022,12 @@ public:
add_method(setname, wrapsetname, 0, 0, funpack, 1, 1);
DelWrapper(f);
}
- if (!modern && !builtin) {
- if (assignable) {
- Printv(f_shadow, tab4, "__swig_setmethods__[\"", symname, "\"] = ", module, ".", setname, "\n", NIL);
- }
- Printv(f_shadow, tab4, "__swig_getmethods__[\"", symname, "\"] = ", module, ".", getname, "\n", NIL);
- }
- if (!classic && !builtin) {
- if (!modern)
- Printv(f_shadow, tab4, "if _newclass:\n", tab4, NIL);
- Printv(f_shadow, tab4, symname, " = _swig_property(", module, ".", getname, NIL);
+ if (!builtin) {
+ Printv(f_shadow, tab4, symname, " = property(", module, ".", getname, NIL);
if (assignable)
Printv(f_shadow, ", ", module, ".", setname, NIL);
+ if (have_docstring(n))
+ Printv(f_shadow, ", doc=", docstring(n, AUTODOC_VAR, tab4), NIL);
Printv(f_shadow, ")\n", NIL);
}
String *getter = Getattr(n, "pybuiltin:getter");
@@ -5207,13 +5079,15 @@ public:
Swig_restore(n);
} else if (shadow) {
Printv(f_shadow, tab4, symname, " = ", module, ".", Swig_name_member(NSPACE_TODO, class_name, symname), "\n", NIL);
+ if (have_docstring(n))
+ Printv(f_shadow, tab4, docstring(n, AUTODOC_CONST, tab4), "\n", NIL);
}
return SWIG_OK;
}
/* ------------------------------------------------------------
* insertDirective()
- *
+ *
* Hook for %insert directive. We're going to look for special %shadow inserts
* as a special case so we can do indenting correctly
* ------------------------------------------------------------ */
@@ -5229,9 +5103,11 @@ public:
Delete(pycode);
}
} else if (!ImportMode && (Cmp(section, "pythonbegin") == 0)) {
- String *pycode = indent_pythoncode(code, "", Getfile(n), Getline(n), "%pythonbegin or %insert(\"pythonbegin\") block");
- Printv(f_shadow_begin, pycode, NIL);
- Delete(pycode);
+ if (shadow) {
+ String *pycode = indent_pythoncode(code, "", Getfile(n), Getline(n), "%pythonbegin or %insert(\"pythonbegin\") block");
+ Printv(f_shadow_begin, pycode, NIL);
+ Delete(pycode);
+ }
} else {
Language::insertDirective(n);
}
@@ -5294,7 +5170,7 @@ public:
/* ---------------------------------------------------------------
* classDirectorMethod()
*
- * Emit a virtual director method to pass a method call on to the
+ * Emit a virtual director method to pass a method call on to the
* underlying Python object.
*
* ** Moved it here due to internal error on gcc-2.96 **
@@ -5351,18 +5227,21 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
String *pclassname = NewStringf("SwigDirector_%s", classname);
String *qualified_name = NewStringf("%s::%s", pclassname, name);
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
/* header declaration */
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
Printf(declaration, " virtual %s", target);
Delete(target);
// Get any exception classes in the throws typemap
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
ParmList *throw_parm_list = 0;
-
if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
Parm *p;
int gencomma = 0;
@@ -5392,12 +5271,20 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
Append(w->def, " {");
Append(declaration, ";\n");
- /* declare method return value
+ /* declare method return value
* if the return value is a reference or const reference, a specialized typemap must
* handle it, including declaration of c_result ($result).
*/
- if (!is_void) {
- if (!(ignored_method && !pure_virtual)) {
+ if (!is_void && (!ignored_method || pure_virtual)) {
+ if (!SwigType_isclass(returntype)) {
+ if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
+ String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
+ Delete(construct_result);
+ } else {
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
+ }
+ } else {
String *cres = SwigType_lstr(returntype, "c_result");
Printf(w->code, "%s;\n", cres);
Delete(cres);
@@ -5429,7 +5316,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
/* remove the wrapper 'w' since it was producing spurious temps */
Swig_typemap_attach_parms("in", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("directorargout", l, w);
Parm *p;
@@ -5544,7 +5431,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
} else {
Wrapper_add_localv(w, source, "swig::SwigVar_PyObject", source, "= 0", NIL);
Printf(wrap_args, "%s = SWIG_InternalNewPointerObj(%s, SWIGTYPE%s, 0);\n", source, nonconst, mangle);
- //Printf(wrap_args, "%s = SWIG_NewPointerObj(%s, SWIGTYPE_p_%s, 0);\n",
+ //Printf(wrap_args, "%s = SWIG_NewPointerObj(%s, SWIGTYPE_p_%s, 0);\n",
// source, nonconst, base);
Printv(arglist, source, NIL);
}
@@ -5590,34 +5477,26 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
Append(w->code, "PyObject *method = swig_get_method(swig_method_index, swig_method_name);\n");
if (Len(parse_args) > 0) {
- if (use_parse || !modernargs) {
+ if (use_parse) {
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunction(method, (char *)\"(%s)\" %s);\n", Swig_cresult_name(), parse_args, arglist);
} else {
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunctionObjArgs(method %s, NULL);\n", Swig_cresult_name(), arglist);
}
} else {
- if (modernargs) {
- Append(w->code, "swig::SwigVar_PyObject args = PyTuple_New(0);\n");
- Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_Call(method, (PyObject *) args, NULL);\n", Swig_cresult_name());
- } else {
- Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunction(method, NULL, NULL);\n", Swig_cresult_name());
- }
+ Append(w->code, "swig::SwigVar_PyObject args = PyTuple_New(0);\n");
+ Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_Call(method, (PyObject *) args, NULL);\n", Swig_cresult_name());
}
Append(w->code, "#else\n");
if (Len(parse_args) > 0) {
- if (use_parse || !modernargs) {
+ if (use_parse) {
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethod(swig_get_self(), (char *)\"%s\", (char *)\"(%s)\" %s);\n", Swig_cresult_name(), pyname, parse_args, arglist);
} else {
- Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
+ Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar(\"%s\");\n", pyname);
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name %s, NULL);\n", Swig_cresult_name(), arglist);
}
} else {
- if (!modernargs) {
- Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethod(swig_get_self(), (char *) \"%s\", NULL);\n", Swig_cresult_name(), pyname);
- } else {
- Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
- Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n", Swig_cresult_name());
- }
+ Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar(\"%s\");\n", pyname);
+ Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n", Swig_cresult_name());
}
Append(w->code, "#endif\n");
@@ -5646,7 +5525,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
/*
* Python method may return a simple object, or a tuple.
- * for in/out aruments, we have to extract the appropriate PyObjects from the tuple,
+ * for in/out arguments, we have to extract the appropriate PyObjects from the tuple,
* then marshal everything back to C/C++ (return value and output arguments).
*
*/
diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx
index 74130aac3..bb43dad48 100644
--- a/Source/Modules/r.cxx
+++ b/Source/Modules/r.cxx
@@ -1,5 +1,6 @@
+
/* -----------------------------------------------------------------------------
- * This file is part of SWIG, which is licensed as a whole under version 3
+ * This file is part of SWIG, which is licensed as a whole under version 3
* (or any later version) of the GNU General Public License. Some additional
* terms also apply to certain portions of SWIG. The full details of the SWIG
* license and copyrights can be found in the LICENSE and COPYRIGHT files
@@ -12,8 +13,7 @@
* ----------------------------------------------------------------------------- */
#include "swigmod.h"
-
-static const double DEFAULT_NUMBER = .0000123456712312312323;
+#include "cparse.h"
static String* replaceInitialDash(const String *name)
{
@@ -32,15 +32,15 @@ static String * getRTypeName(SwigType *t, int *outCount = NULL) {
List *els = SwigType_split(t);
int count = 0;
int i;
-
- if(Strncmp(b, "struct ", 7) == 0)
+
+ if(Strncmp(b, "struct ", 7) == 0)
Replace(b, "struct ", "", DOH_REPLACE_FIRST);
-
+
/* Printf(stdout, "<getRTypeName> %s,base = %s\n", t, b);
- for(i = 0; i < Len(els); i++)
+ for(i = 0; i < Len(els); i++)
Printf(stdout, "%d) %s, ", i, Getitem(els,i));
Printf(stdout, "\n"); */
-
+
for(i = 0; i < Len(els); i++) {
String *el = Getitem(els, i);
if(Strcmp(el, "p.") == 0 || Strncmp(el, "a(", 2) == 0) {
@@ -50,96 +50,57 @@ static String * getRTypeName(SwigType *t, int *outCount = NULL) {
}
if(outCount)
*outCount = count;
-
+
String *tmp = NewString("");
char *retName = Char(SwigType_manglestr(t));
Insert(tmp, 0, retName);
return tmp;
-
+
/*
- if(count)
+ if(count)
return(b);
-
- Delete(b);
- return(NewString(""));
+
+ Delete(b);
+ return(NewString(""));
*/
}
-/*********************
- Tries to get the name of the R class corresponding to the given type
- e.g. struct A * is ARef, struct A** is ARefRef.
- Now handles arrays, i.e. struct A[2]
-****************/
+/* --------------------------------------------------------------
+ * Tries to get the resolved name, with options of adding
+ * or removing a layer of references. Take care not
+ * to request both
+ * --------------------------------------------------------------*/
-static String *getRClassName(String *retType, int /*addRef*/ = 1, int upRef=0) {
- String *tmp = NewString("");
+static String *getRClassName(String *retType, int deRef=0, int upRef=0) {
SwigType *resolved = SwigType_typedef_resolve_all(retType);
- char *retName = Char(SwigType_manglestr(resolved));
+ int ispointer = SwigType_ispointer(resolved);
+ int isreference = SwigType_isreference(resolved);
if (upRef) {
- Printf(tmp, "_p%s", retName);
- } else{
- Insert(tmp, 0, retName);
- }
-
- return tmp;
-/*
-#if 1
- List *l = SwigType_split(retType);
- int n = Len(l);
- if(!l || n == 0) {
-#ifdef R_SWIG_VERBOSE
- if (debugMode)
- Printf(stdout, "SwigType_split return an empty list for %s\n",
- retType);
-#endif
- return(tmp);
+ SwigType_add_pointer(resolved);
}
-
-
- String *el = Getitem(l, n-1);
- char *ptr = Char(el);
- if(strncmp(ptr, "struct ", 7) == 0)
- ptr += 7;
-
- Printf(tmp, "%s", ptr);
-
- if(addRef) {
- for(int i = 0; i < n; i++) {
- if(Strcmp(Getitem(l, i), "p.") == 0 ||
- Strncmp(Getitem(l, i), "a(", 2) == 0)
- Printf(tmp, "Ref");
+ if (deRef) {
+ if (ispointer) {
+ SwigType_del_pointer(resolved);
}
- }
-
-#else
- char *retName = Char(SwigType_manglestr(retType));
- if(!retName)
- return(tmp);
-
- if(addRef) {
- while(retName && strlen(retName) > 1 && strncmp(retName, "_p", 2) == 0) {
- retName += 2;
- Printf(tmp, "Ref");
+ if (isreference) {
+ SwigType_del_reference(resolved);
}
- }
- if(retName[0] == '_')
- retName ++;
- Insert(tmp, 0, retName);
-#endif
-
- return tmp;
-*/
+ }
+ String *tmp = NewString("");
+ Insert(tmp, 0, Char(SwigType_manglestr(resolved)));
+ return(tmp);
}
-/*********************
- Tries to get the name of the R class corresponding to the given type
- e.g. struct A * is ARef, struct A** is ARefRef.
- Now handles arrays, i.e. struct A[2]
-****************/
+/* --------------------------------------------------------------
+ * Tries to get the name of the R class corresponding to the given type
+ * e.g. struct A * is ARef, struct A** is ARefRef.
+ * Now handles arrays, i.e. struct A[2]
+ * --------------------------------------------------------------*/
+
static String * getRClassNameCopyStruct(String *retType, int addRef) {
String *tmp = NewString("");
-
+
#if 1
List *l = SwigType_split(retType);
int n = Len(l);
@@ -149,36 +110,36 @@ static String * getRClassNameCopyStruct(String *retType, int addRef) {
#endif
return(tmp);
}
-
-
+
+
String *el = Getitem(l, n-1);
char *ptr = Char(el);
if(strncmp(ptr, "struct ", 7) == 0)
ptr += 7;
-
+
Printf(tmp, "%s", ptr);
-
+
if(addRef) {
for(int i = 0; i < n; i++) {
- if(Strcmp(Getitem(l, i), "p.") == 0 ||
+ if(Strcmp(Getitem(l, i), "p.") == 0 ||
Strncmp(Getitem(l, i), "a(", 2) == 0)
Printf(tmp, "Ref");
}
}
-
+
#else
char *retName = Char(SwigType_manglestr(retType));
if(!retName)
return(tmp);
-
+
if(addRef) {
- while(retName && strlen(retName) > 1 &&
+ while(retName && strlen(retName) > 1 &&
strncmp(retName, "_p", 2) == 0) {
retName += 2;
Printf(tmp, "Ref");
}
}
-
+
if(retName[0] == '_')
retName ++;
Insert(tmp, 0, retName);
@@ -188,19 +149,20 @@ static String * getRClassNameCopyStruct(String *retType, int addRef) {
}
-/*********************************
- Write the elements of a list to the File*, one element per line.
- If quote is true, surround the element with "element".
- This takes care of inserting a tab in front of each line and also
- a comma after each element, except the last one.
-**********************************/
+/* -------------------------------------------------------------
+ * Write the elements of a list to the File*, one element per line.
+ * If quote is true, surround the element with "element".
+ * This takes care of inserting a tab in front of each line and also
+ * a comma after each element, except the last one.
+ * --------------------------------------------------------------*/
+
static void writeListByLine(List *l, File *out, bool quote = 0) {
int i, n = Len(l);
- for(i = 0; i < n; i++)
- Printf(out, "%s%s%s%s%s\n", tab8,
- quote ? "\"" :"",
- Getitem(l, i),
+ for(i = 0; i < n; i++)
+ Printf(out, "%s%s%s%s%s\n", tab8,
+ quote ? "\"" :"",
+ Getitem(l, i),
quote ? "\"" :"", i < n-1 ? "," : "");
}
@@ -208,24 +170,24 @@ static void writeListByLine(List *l, File *out, bool quote = 0) {
static const char *usage = "\
R Options (available with -r)\n\
-copystruct - Emit R code to copy C structs (on by default)\n\
- -cppcast - Enable C++ casting operators (default) \n\
-debug - Output debug\n\
-dll <name> - Name of the DLL (without the .dll or .so suffix).\n\
- Default is the module name.\n\
+ Default is the module name.\n\
-gc - Aggressive garbage collection\n\
-memoryprof - Add memory profile\n\
-namespace - Output NAMESPACE file\n\
-no-init-code - Turn off the generation of the R_init_<pkgname> code\n\
- (registration information still generated)\n\
+ (registration information still generated)\n\
-package <name> - Package name for the PACKAGE argument of the R .Call()\n\
- invocations. Default is the module name.\n\
+ invocations. Default is the module name.\n\
";
-/************
- Display the help for this module on the screen/console.
-*************/
+/* -------------------------------------------------------------
+ * Display the help for this module on the screen/console.
+ * --------------------------------------------------------------*/
+
static void showUsage() {
fputs(usage, stdout);
}
@@ -239,10 +201,11 @@ static bool expandTypedef(SwigType *t) {
}
-/*****
- Determine whether we should add a .copy argument to the S function
- that wraps/interfaces to the routine that returns the given type.
-*****/
+/* -------------------------------------------------------------
+ * Determine whether we should add a .copy argument to the S function
+ * that wraps/interfaces to the routine that returns the given type.
+ * --------------------------------------------------------------*/
+
static int addCopyParameter(SwigType *type) {
int ok = 0;
ok = Strncmp(type, "struct ", 7) == 0 || Strncmp(type, "p.struct ", 9) == 0;
@@ -254,31 +217,22 @@ static int addCopyParameter(SwigType *type) {
}
static void replaceRClass(String *tm, SwigType *type) {
- String *tmp = getRClassName(type);
- String *tmp_base = getRClassName(type, 0);
- String *tmp_ref = getRClassName(type, 1, 1);
+ String *tmp = getRClassName(type, 0, 0);
+ String *tmp_base = getRClassName(type, 1, 0);
+ String *tmp_ref = getRClassName(type, 0, 1);
Replaceall(tm, "$R_class", tmp);
Replaceall(tm, "$*R_class", tmp_base);
Replaceall(tm, "$&R_class", tmp_ref);
Delete(tmp); Delete(tmp_base); Delete(tmp_ref);
}
-static double getNumber(String *value) {
- double d = DEFAULT_NUMBER;
- if(Char(value)) {
- if(sscanf(Char(value), "%lf", &d) != 1)
- return(DEFAULT_NUMBER);
- }
- return(d);
-}
-
class R : public Language {
public:
R();
void registerClass(Node *n);
void main(int argc, char *argv[]);
int top(Node *n);
-
+
void dispatchFunction(Node *n);
int functionWrapper(Node *n);
int constantWrapper(Node *n);
@@ -286,57 +240,59 @@ public:
int classDeclaration(Node *n);
int enumDeclaration(Node *n);
-
+ String *enumValue(Node *n);
+ virtual int enumvalueDeclaration(Node *n);
int membervariableHandler(Node *n);
int typedefHandler(Node *n);
+
static List *Swig_overload_rank(Node *n,
- bool script_lang_wrapping);
+ bool script_lang_wrapping);
int memberfunctionHandler(Node *n) {
if (debugMode)
- Printf(stdout, "<memberfunctionHandler> %s %s\n",
+ Printf(stdout, "<memberfunctionHandler> %s %s\n",
Getattr(n, "name"),
Getattr(n, "type"));
member_name = Getattr(n, "sym:name");
processing_class_member_function = 1;
- int status = Language::memberfunctionHandler(n);
+ int status = Language::memberfunctionHandler(n);
processing_class_member_function = 0;
return status;
}
- /* Grab the name of the current class being processed so that we can
+ /* Grab the name of the current class being processed so that we can
deal with members of that class. */
int classHandler(Node *n){
- if(!ClassMemberTable)
+ if(!ClassMemberTable)
ClassMemberTable = NewHash();
-
+
class_name = Getattr(n, "name");
int status = Language::classHandler(n);
-
+
class_name = NULL;
return status;
}
// Not used:
String *runtimeCode();
-
+
protected:
int addRegistrationRoutine(String *rname, int nargs);
int outputRegistrationRoutines(File *out);
-
+
int outputCommandLineArguments(File *out);
- int generateCopyRoutines(Node *n);
+ int generateCopyRoutines(Node *n);
int DumpCode(Node *n);
-
+
int OutputMemberReferenceMethod(String *className, int isSet, List *el, File *out);
int OutputArrayMethod(String *className, List *el, File *out);
int OutputClassMemberTable(Hash *tb, File *out);
int OutputClassMethodsTable(File *out);
int OutputClassAccessInfo(Hash *tb, File *out);
-
+
int defineArrayAccessors(SwigType *type);
-
+
void addNamespaceFunction(String *name) {
if(!namespaceFunctions)
namespaceFunctions = NewList();
@@ -348,47 +304,49 @@ protected:
namespaceMethods = NewList();
Append(namespaceMethods, name);
}
-
+
String* processType(SwigType *t, Node *n, int *nargs = NULL);
String *createFunctionPointerHandler(SwigType *t, Node *n, int *nargs);
int addFunctionPointerProxy(String *name, Node *n, SwigType *t, String *s_paramTypes) {
/*XXX Do we need to put the t in there to get the return type later. */
- if(!functionPointerProxyTable)
+ if(!functionPointerProxyTable)
functionPointerProxyTable = NewHash();
-
+
Setattr(functionPointerProxyTable, name, n);
-
+
Setattr(SClassDefs, name, name);
- Printv(s_classes, "setClass('",
+ Printv(s_classes, "setClass('",
name,
- "',\n", tab8,
+ "',\n", tab8,
"prototype = list(parameterTypes = c(", s_paramTypes, "),\n",
tab8, tab8, tab8,
- "returnType = '", SwigType_manglestr(t), "'),\n", tab8,
+ "returnType = '", SwigType_manglestr(t), "'),\n", tab8,
"contains = 'CRoutinePointer')\n\n##\n", NIL);
-
+
return SWIG_OK;
}
-
- void addSMethodInfo(String *name,
+
+ void addSMethodInfo(String *name,
String *argType, int nargs);
- // Simple initialization such as constant strings that can be reused.
- void init();
-
-
- void addAccessor(String *memberName, Wrapper *f,
+ // Simple initialization such as constant strings that can be reused.
+ void init();
+
+
+ void addAccessor(String *memberName, Wrapper *f,
String *name, int isSet = -1);
-
+
static int getFunctionPointerNumArgs(Node *n, SwigType *tt);
-protected:
+protected:
bool copyStruct;
bool memoryProfile;
bool aggressiveGc;
// Strings into which we cumulate the generated code that is to be written
//vto the files.
+ String *enum_values;
+ String *enum_def_calls;
String *sfile;
String *f_init;
String *s_classes;
@@ -400,49 +358,49 @@ protected:
String *s_init;
String *s_init_routine;
String *s_namespace;
-
- // State variables that carry information across calls to functionWrapper()
- // from member accessors and class declarations.
+
+ // State variables that carry information across calls to functionWrapper()
+ // from member accessors and class declarations.
String *opaqueClassDeclaration;
int processing_variable;
int processing_member_access_function;
String *member_name;
String *class_name;
-
-
+
+
int processing_class_member_function;
List *class_member_functions;
List *class_member_set_functions;
-
+
/* */
Hash *ClassMemberTable;
Hash *ClassMethodsTable;
Hash *SClassDefs;
Hash *SMethodInfo;
-
- // Information about routines that are generated and to be registered with
- // R for dynamic lookup.
+
+ // Information about routines that are generated and to be registered with
+ // R for dynamic lookup.
Hash *registrationTable;
Hash *functionPointerProxyTable;
-
+
List *namespaceFunctions;
List *namespaceMethods;
List *namespaceClasses; // Probably can do this from ClassMemberTable.
-
-
- // Store a copy of the command line.
- // Need only keep a string that has it formatted.
+
+
+ // Store a copy of the command line.
+ // Need only keep a string that has it formatted.
char **Argv;
int Argc;
bool inCPlusMode;
-
+
// State variables that we remember from the command line settings
// potentially that govern the code we generate.
String *DllName;
String *Rpackage;
bool noInitializationCode;
bool outputNamespaceInfo;
-
+
String *UnProtectWrapupCode;
// Static members
@@ -453,6 +411,8 @@ R::R() :
copyStruct(false),
memoryProfile(false),
aggressiveGc(false),
+ enum_values(0),
+ enum_def_calls(0),
sfile(0),
f_init(0),
s_classes(0),
@@ -508,7 +468,7 @@ int R::getFunctionPointerNumArgs(Node *n, SwigType *tt) {
void R::addSMethodInfo(String *name, String *argType, int nargs) {
(void) argType;
-
+
if(!SMethodInfo)
SMethodInfo = NewHash();
if (debugMode)
@@ -531,20 +491,21 @@ void R::addSMethodInfo(String *name, String *argType, int nargs) {
Setattr(tb, "max", str);
}
}
-
-/*
-Returns the name of the new routine.
-*/
+
+/* ----------------------------------------
+ * Returns the name of the new routine.
+ * ------------------------------------------ */
+
String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
String *funName = SwigType_manglestr(t);
-
+
/* See if we have already processed this one. */
if(functionPointerProxyTable && Getattr(functionPointerProxyTable, funName))
return funName;
-
+
if (debugMode)
Printf(stdout, "<createFunctionPointerHandler> Defining %s\n", t);
-
+
SwigType *rettype = Copy(Getattr(n, "type"));
SwigType *funcparams = SwigType_functionpointer_decompose(rettype);
String *rtype = SwigType_str(rettype, 0);
@@ -558,29 +519,28 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
Printf(stdout, "Type: %s\n", t);
Printf(stdout, "Return type: %s\n", SwigType_base(t));
}
-
+
bool isVoidType = Strcmp(rettype, "void") == 0;
if (debugMode)
Printf(stdout, "%s is void ? %s (%s)\n", funName, isVoidType ? "yes" : "no", rettype);
-
+
Wrapper *f = NewWrapper();
-
+
/* Go through argument list, attach lnames for arguments */
int i = 0;
Parm *p = parms;
for (i = 0; p; p = nextSibling(p), ++i) {
String *arg = Getattr(p, "name");
String *lname;
-
if (!arg && Cmp(Getattr(p, "type"), "void")) {
- lname = NewStringf("s_arg%d", i+1);
+ lname = NewStringf("arg%d", i+1);
Setattr(p, "name", lname);
} else
lname = arg;
Setattr(p, "lname", lname);
}
-
+
Swig_typemap_attach_parms("out", parms, f);
Swig_typemap_attach_parms("scoerceout", parms, f);
Swig_typemap_attach_parms("scheck", parms, f);
@@ -589,7 +549,7 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
emit_parameter_variables(parms, f);
emit_return_variable(n, rettype, f);
-// emit_attach_parmmaps(parms,f);
+ // emit_attach_parmmaps(parms,f);
/* Using weird name and struct to avoid potential conflicts. */
Wrapper_add_local(f, "r_swig_cb_data", "RCallbackFunctionData *r_swig_cb_data = R_SWIG_getCallbackFunctionData()");
@@ -609,60 +569,69 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
*numArgs = nargs;
if (debugMode)
Printf(stdout, "Setting number of parameters to %d\n", *numArgs);
- }
+ }
String *setExprElements = NewString("");
-
+
String *s_paramTypes = NewString("");
for(i = 0; p; i++) {
SwigType *tt = Getattr(p, "type");
SwigType *name = Getattr(p, "name");
+ SwigType *swig_parm_name = NewStringf("swigarg_%s", name);
String *tm = Getattr(p, "tmap:out");
- Printf(f->def, "%s %s", SwigType_str(tt, 0), name);
- if(tm) {
- Replaceall(tm, "$1", name);
- if (SwigType_isreference(tt)) {
- String *tmp = NewString("");
- Append(tmp, "*");
- Append(tmp, name);
- Replaceall(tm, tmp, name);
+ bool isVoidParm = Strcmp(tt, "void") == 0;
+ if (isVoidParm)
+ Printf(f->def, "%s", SwigType_str(tt, 0));
+ else
+ Printf(f->def, "%s %s", SwigType_str(tt, 0), swig_parm_name);
+ if (tm) {
+ String *lstr = SwigType_lstr(tt, 0);
+ if (SwigType_isreference(tt) || SwigType_isrvalue_reference(tt)) {
+ Printf(f->code, "%s = (%s) &%s;\n", Getattr(p, "lname"), lstr, swig_parm_name);
+ } else if (!isVoidParm) {
+ Printf(f->code, "%s = (%s) %s;\n", Getattr(p, "lname"), lstr, swig_parm_name);
}
+ Replaceall(tm, "$1", name);
Replaceall(tm, "$result", "r_tmp");
+ if (debugMode) {
+ Printf(stdout, "Calling Replace A: %s\n", Getattr(p,"type"));
+ }
replaceRClass(tm, Getattr(p,"type"));
- Replaceall(tm,"$owner", "R_SWIG_EXTERNAL");
+ Replaceall(tm,"$owner", "0");
+ Delete(lstr);
}
Printf(setExprElements, "%s\n", tm);
Printf(setExprElements, "SETCAR(r_swig_cb_data->el, %s);\n", "r_tmp");
Printf(setExprElements, "r_swig_cb_data->el = CDR(r_swig_cb_data->el);\n\n");
-
+
Printf(s_paramTypes, "'%s'", SwigType_manglestr(tt));
-
-
+
+
p = nextSibling(p);
if(p) {
Printf(f->def, ", ");
Printf(s_paramTypes, ", ");
}
}
-
+
Printf(f->def, ") {\n");
-
+
Printf(f->code, "Rf_protect(%s->expr = Rf_allocVector(LANGSXP, %d));\n", lvar, nargs + 1);
Printf(f->code, "r_nprotect++;\n");
Printf(f->code, "r_swig_cb_data->el = r_swig_cb_data->expr;\n\n");
-
+
Printf(f->code, "SETCAR(r_swig_cb_data->el, r_swig_cb_data->fun);\n");
Printf(f->code, "r_swig_cb_data->el = CDR(r_swig_cb_data->el);\n\n");
-
+
Printf(f->code, "%s\n\n", setExprElements);
-
- Printv(f->code, "r_swig_cb_data->retValue = R_tryEval(",
+
+ Printv(f->code, "r_swig_cb_data->retValue = R_tryEval(",
"r_swig_cb_data->expr,",
" R_GlobalEnv,",
" &r_swig_cb_data->errorOccurred",
- ");\n",
+ ");\n",
NIL);
-
+
Printv(f->code, "\n",
"if(r_swig_cb_data->errorOccurred) {\n",
"R_SWIG_popCallbackFunctionData(1);\n",
@@ -671,11 +640,11 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
")\");\n",
"}\n",
NIL);
-
-
-
+
+
+
if(!isVoidType) {
- /* Need to deal with the return type of the function pointer, not the function pointer itself.
+ /* Need to deal with the return type of the function pointer, not the function pointer itself.
So build a new node that has the relevant pieces.
XXX Have to be a little more clever so that we can deal with struct A * - the * is getting lost.
Is this still true? If so, will a SwigType_push() solve things?
@@ -687,54 +656,57 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
Replaceall(tm,"$input", "r_swig_cb_data->retValue");
Replaceall(tm,"$target", Swig_cresult_name());
replaceRClass(tm, rettype);
- Replaceall(tm,"$owner", "R_SWIG_EXTERNAL");
+ Replaceall(tm,"$owner", "0");
Replaceall(tm,"$disown","0");
Printf(f->code, "%s\n", tm);
}
Delete(bbase);
}
-
+
Printv(f->code, "R_SWIG_popCallbackFunctionData(1);\n", NIL);
Printv(f->code, "\n", UnProtectWrapupCode, NIL);
- if (SwigType_isreference(rettype)) {
+ if (SwigType_isreference(rettype)) {
Printv(f->code, "return *", Swig_cresult_name(), ";\n", NIL);
- } else if(!isVoidType)
+ } else if (SwigType_isrvalue_reference(rettype)) {
+ Printv(f->code, "return std::move(*", Swig_cresult_name(), ");\n", NIL);
+ } else if (!isVoidType) {
Printv(f->code, "return ", Swig_cresult_name(), ";\n", NIL);
-
+ }
+
Printv(f->code, "\n}\n", NIL);
Replaceall(f->code, "SWIG_exception_fail", "SWIG_exception_noreturn");
-
+
/* To coerce correctly in S, we really want to have an extra/intermediate
- function that handles the scoerceout.
+ function that handles the scoerceout.
We need to check if any of the argument types have an entry in
that map. If none do, the ignore and call the function straight.
- Otherwise, generate the a marshalling function.
+ Otherwise, generate a marshalling function.
Need to be able to find it in S. Or use an entirely generic one
that evaluates the expressions.
Handle errors in the evaluation of the function by restoring
- the stack, if there is one in use for this function (i.e. no
+ the stack, if there is one in use for this function (i.e. no
userData).
*/
-
+
Wrapper_print(f, f_wrapper);
-
+
addFunctionPointerProxy(funName, n, t, s_paramTypes);
Delete(s_paramTypes);
Delete(rtype);
Delete(rettype);
Delete(funcparams);
DelWrapper(f);
-
+
return funName;
}
void R::init() {
- UnProtectWrapupCode =
+ UnProtectWrapupCode =
NewStringf("%s", "vmaxset(r_vmax);\nif(r_nprotect) Rf_unprotect(r_nprotect);\n\n");
-
+
SClassDefs = NewHash();
-
+
sfile = NewString("");
f_init = NewString("");
s_header = NewString("");
@@ -744,6 +716,7 @@ void R::init() {
s_classes = NewString("");
s_init = NewString("");
s_init_routine = NewString("");
+ enum_def_calls = NewString("");
}
@@ -759,15 +732,20 @@ int R::cDeclaration(Node *n) {
#endif
-/**
- Method from Language that is called to start the entire
- processing off, i.e. the generation of the code.
- It is called after the input has been read and parsed.
- Here we open the output streams and generate the code.
-***/
+/* -------------------------------------------------------------
+ * Method from Language that is called to start the entire
+ * processing off, i.e. the generation of the code.
+ * It is called after the input has been read and parsed.
+ * Here we open the output streams and generate the code.
+ * ------------------------------------------------------------- */
int R::top(Node *n) {
String *module = Getattr(n, "name");
- if(!Rpackage)
+
+ if (debugMode) {
+ Printf(stdout, "<Top> %s\n", module);
+ }
+
+ if(!Rpackage)
Rpackage = Copy(module);
if(!DllName)
DllName = Copy(module);
@@ -795,7 +773,7 @@ int R::top(Node *n) {
Printf(f_runtime, "\n\n#ifndef SWIGR\n#define SWIGR\n#endif\n\n");
-
+
Swig_banner_target_lang(s_init, "#");
outputCommandLineArguments(s_init);
@@ -841,32 +819,33 @@ int R::top(Node *n) {
}
-/*****************************************************
- Write the generated code to the .S and the .c files.
-****************************************************/
+/* -------------------------------------------------------------
+ * Write the generated code to the .S and the .c files.
+ * ------------------------------------------------------------- */
int R::DumpCode(Node *n) {
String *output_filename = NewString("");
-
-
+
+
/* The name of the file in which we will generate the S code. */
Printf(output_filename, "%s%s.R", SWIG_output_directory(), Rpackage);
-
+
#ifdef R_SWIG_VERBOSE
Printf(stdout, "Writing S code to %s\n", output_filename);
#endif
-
+
File *scode = NewFile(output_filename, "w", SWIG_output_files());
if (!scode) {
FileErrorDisplay(output_filename);
SWIG_exit(EXIT_FAILURE);
}
Delete(output_filename);
-
-
+
+
Printf(scode, "%s\n\n", s_init);
Printf(scode, "%s\n\n", s_classes);
Printf(scode, "%s\n", sfile);
-
+ Printf(scode, "%s\n", enum_def_calls);
+
Delete(scode);
String *outfile = Getattr(n,"outfile");
File *runtime = NewFile(outfile,"w", SWIG_output_files());
@@ -874,7 +853,7 @@ int R::DumpCode(Node *n) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
-
+
Printf(runtime, "%s", f_begin);
Printf(runtime, "%s\n", f_runtime);
Printf(runtime, "%s\n", s_header);
@@ -892,14 +871,14 @@ int R::DumpCode(Node *n) {
SWIG_exit(EXIT_FAILURE);
}
Delete(output_filename);
-
+
Printf(ns, "%s\n", s_namespace);
Printf(ns, "\nexport(\n");
writeListByLine(namespaceFunctions, ns);
Printf(ns, ")\n");
Printf(ns, "\nexportMethods(\n");
- writeListByLine(namespaceFunctions, ns, 1);
+ writeListByLine(namespaceMethods, ns, 1);
Printf(ns, ")\n");
Delete(ns);
Delete(s_namespace);
@@ -910,28 +889,29 @@ int R::DumpCode(Node *n) {
-/*
- We may need to do more.... so this is left as a
- stub for the moment.
-*/
+/* -------------------------------------------------------------
+ * We may need to do more.... so this is left as a
+ * stub for the moment.
+ * -------------------------------------------------------------*/
int R::OutputClassAccessInfo(Hash *tb, File *out) {
int n = OutputClassMemberTable(tb, out);
OutputClassMethodsTable(out);
return n;
}
-/************************************************************************
- Currently this just writes the information collected about the
- different methods of the C++ classes that have been processed
- to the console.
- This will be used later to define S4 generics and methods.
-**************************************************************************/
+/* -------------------------------------------------------------
+ * Currently this just writes the information collected about the
+ * different methods of the C++ classes that have been processed
+ * to the console.
+ * This will be used later to define S4 generics and methods.
+ * --------------------------------------------------------------*/
+
int R::OutputClassMethodsTable(File *) {
Hash *tb = ClassMethodsTable;
-
+
if(!tb)
return SWIG_OK;
-
+
List *keys = Keys(tb);
String *key;
int i, n = Len(keys);
@@ -954,36 +934,38 @@ int R::OutputClassMethodsTable(File *) {
}
-/*
- Iterate over the <class name>_set and <>_get
- elements and generate the $ and $<- functions
- that provide constrained access to the member
- fields in these elements.
-
- tb - a hash table that is built up in functionWrapper
- as we process each membervalueHandler.
- The entries are indexed by <class name>_set and
- <class_name>_get. Each entry is a List *.
-
- out - the stram where the code is to be written. This is the S
- code stream as we generate only S code here..
-*/
+/* --------------------------------------------------------------
+ * Iterate over the <class name>_set and <>_get
+ * elements and generate the $ and $<- functions
+ * that provide constrained access to the member
+ * fields in these elements.
+
+ * tb - a hash table that is built up in functionWrapper
+ * as we process each membervalueHandler.
+ * The entries are indexed by <class name>_set and
+ * <class_name>_get. Each entry is a List *.
+
+ * out - the stram where the code is to be written. This is the S
+ * code stream as we generate only S code here.
+ * --------------------------------------------------------------*/
+
int R::OutputClassMemberTable(Hash *tb, File *out) {
List *keys = Keys(tb), *el;
-
+
String *key;
int i, n = Len(keys);
/* Loop over all the <Class>_set and <Class>_get entries in the table. */
/* This function checks for names ending in _set - perhaps it should */
/* use attributes of some other form, as it potentially clashes with */
/* methods ending in _set */
+
if(n && outputNamespaceInfo) {
Printf(s_namespace, "exportClasses(");
}
for(i = 0; i < n; i++) {
key = Getitem(keys, i);
el = Getattr(tb, key);
-
+
String *className = Getitem(el, 0);
char *ptr = Char(key);
int klen = Len(key);
@@ -993,42 +975,43 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
isSet = strcmp(ptr, "_set") == 0;
}
- // OutputArrayMethod(className, el, out);
+ // OutputArrayMethod(className, el, out);
OutputMemberReferenceMethod(className, isSet, el, out);
-
- if(outputNamespaceInfo)
+
+ if(outputNamespaceInfo)
Printf(s_namespace, "\"%s\"%s", className, i < n-1 ? "," : "");
}
- if(n && outputNamespaceInfo) {
+ if(n && outputNamespaceInfo) {
Printf(s_namespace, ")\n");
}
-
+
return n;
}
-/*******************************************************************
- Write the methods for $ or $<- for accessing a member field in an
- struct or union (or class).
- className - the name of the struct or union (e.g. Bar for struct Bar)
- isSet - a logical value indicating whether the method is for
- modifying ($<-) or accessing ($) the member field.
- el - a list of length 2 * # accessible member elements + 1.
- The first element is the name of the class.
- The other pairs are member name and the name of the R function to access it.
- out - the stream where we write the code.
-********************************************************************/
-int R::OutputMemberReferenceMethod(String *className, int isSet,
+/* --------------------------------------------------------------
+ * Write the methods for $ or $<- for accessing a member field in an
+ * struct or union (or class).
+ * className - the name of the struct or union (e.g. Bar for struct Bar)
+ * isSet - a logical value indicating whether the method is for
+ * modifying ($<-) or accessing ($) the member field.
+ * el - a list of length 2 * # accessible member elements + 1.
+ * The first element is the name of the class.
+ * The other pairs are member name and the name of the R function to access it.
+ * out - the stream where we write the code.
+ * --------------------------------------------------------------*/
+
+int R::OutputMemberReferenceMethod(String *className, int isSet,
List *el, File *out) {
int numMems = Len(el), j;
int varaccessor = 0;
- if (numMems == 0)
+ if (numMems == 0)
return SWIG_OK;
-
+
Wrapper *f = NewWrapper(), *attr = NewWrapper();
-
+
Printf(f->def, "function(x, name%s)", isSet ? ", value" : "");
Printf(attr->def, "function(x, i, j, ...%s)", isSet ? ", value" : "");
-
+
Printf(f->code, "{\n");
Printf(f->code, "%saccessorFuns = list(", tab8);
@@ -1036,17 +1019,17 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
bool has_prev = false;
for(j = 0; j < numMems; j+=3) {
String *item = Getitem(el, j);
- if (Getattr(itemList, item))
- continue;
- Setattr(itemList, item, "1");
-
String *dup = Getitem(el, j + 1);
char *ptr = Char(dup);
ptr = &ptr[Len(dup) - 3];
-
+
if (!strcmp(ptr, "get"))
varaccessor++;
+ if (Getattr(itemList, item))
+ continue;
+ Setattr(itemList, item, "1");
+
String *pitem;
if (!Strcmp(item, "operator ()")) {
pitem = NewString("call");
@@ -1059,7 +1042,7 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
} else {
pitem = Copy(item);
}
- if (has_prev)
+ if (has_prev)
Printf(f->code, ", ");
Printf(f->code, "'%s' = %s", pitem, dup);
has_prev = true;
@@ -1067,7 +1050,7 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
}
Delete(itemList);
Printf(f->code, ");\n");
-
+
if (!isSet && varaccessor > 0) {
Printf(f->code, "%svaccessors = c(", tab8);
int first = 1;
@@ -1076,7 +1059,7 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
String *dup = Getitem(el, j + 1);
char *ptr = Char(dup);
ptr = &ptr[Len(dup) - 3];
-
+
if (!strcmp(ptr, "get")) {
Printf(f->code, "%s'%s'", first ? "" : ", ", item);
first = 0;
@@ -1084,15 +1067,15 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
}
Printf(f->code, ");\n");
}
-
-
+
+
/* Printv(f->code, tab8,
"idx = pmatch(name, names(accessorFuns))\n",
tab8,
"if(is.na(idx)) {\n",
- tab8, tab4,
+ tab8, tab4,
"stop(\"No ", (isSet ? "modifiable" : "accessible"), " field named \", name, \" in ", className,
- ": fields are \", paste(names(accessorFuns), sep = \", \")",
+ ": fields are \", paste(names(accessorFuns), sep = \", \")",
")", "\n}\n", NIL); */
Printv(f->code, ";", tab8,
"idx = pmatch(name, names(accessorFuns));\n",
@@ -1114,156 +1097,227 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
}
}
Printf(f->code, "}\n");
-
-
+
+
Printf(out, "# Start of accessor method for %s\n", className);
Printf(out, "setMethod('$%s', '_p%s', ",
- isSet ? "<-" : "",
- getRClassName(className));
+ isSet ? "<-" : "",
+ getRClassName(className));
Wrapper_print(f, out);
Printf(out, ");\n");
-
+
if(isSet) {
- Printf(out, "setMethod('[[<-', c('_p%s', 'character'),",
- getRClassName(className));
+ Printf(out, "setMethod('[[<-', c('_p%s', 'character'),",
+ getRClassName(className));
Insert(f->code, 2, "name = i;\n");
Printf(attr->code, "%s", f->code);
Wrapper_print(attr, out);
Printf(out, ");\n");
}
-
+
DelWrapper(attr);
DelWrapper(f);
-
+
Printf(out, "# end of accessor method for %s\n", className);
-
+
return SWIG_OK;
}
-/*******************************************************************
- Write the methods for [ or [<- for accessing a member field in an
- struct or union (or class).
- className - the name of the struct or union (e.g. Bar for struct Bar)
- el - a list of length 2 * # accessible member elements + 1.
- The first element is the name of the class.
- The other pairs are member name and the name of the R function to access it.
- out - the stream where we write the code.
-********************************************************************/
+/* -------------------------------------------------------------
+ * Write the methods for [ or [<- for accessing a member field in an
+ * struct or union (or class).
+ * className - the name of the struct or union (e.g. Bar for struct Bar)
+ * el - a list of length 2 * # accessible member elements + 1.
+ * The first element is the name of the class.
+ * The other pairs are member name and the name of the R function to access it.
+ * out - the stream where we write the code.
+ * --------------------------------------------------------------*/
+
int R::OutputArrayMethod(String *className, List *el, File *out) {
int numMems = Len(el), j;
-
+
if(!el || numMems == 0)
return(0);
-
+
Printf(out, "# start of array methods for %s\n", className);
for(j = 0; j < numMems; j+=3) {
String *item = Getitem(el, j);
String *dup = Getitem(el, j + 1);
if (!Strcmp(item, "__getitem__")) {
- Printf(out,
- "setMethod('[', '_p%s', function(x, i, j, ..., drop =TRUE) ",
+ Printf(out,
+ "setMethod('[', '_p%s', function(x, i, j, ..., drop =TRUE) ",
getRClassName(className));
Printf(out, " sapply(i, function (n) %s(x, as.integer(n-1))))\n\n", dup);
}
if (!Strcmp(item, "__setitem__")) {
- Printf(out, "setMethod('[<-', '_p%s', function(x, i, j, ..., value)",
+ Printf(out, "setMethod('[<-', '_p%s', function(x, i, j, ..., value)",
getRClassName(className));
Printf(out, " sapply(1:length(i), function(n) %s(x, as.integer(i[n]-1), value[n])))\n\n", dup);
}
-
+
}
-
+
Printf(out, "# end of array methods for %s\n", className);
-
+
return SWIG_OK;
}
-/************************************************************
- Called when a enumeration is to be processed.
- We want to call the R function defineEnumeration().
- tdname is the typedef of the enumeration, i.e. giving its name.
-*************************************************************/
+/* -------------------------------------------------------------
+ * Called when a enumeration is to be processed.
+ * We want to call the R function defineEnumeration().
+ * tdname is the typedef of the enumeration, i.e. giving its name.
+ * --------------------------------------------------------------*/
+
int R::enumDeclaration(Node *n) {
- if (getCurrentClass() && (cplus_mode != PUBLIC))
- return SWIG_NOWRAP;
+ if (!ImportMode) {
+ if (getCurrentClass() && (cplus_mode != PUBLIC))
+ return SWIG_NOWRAP;
- String *name = Getattr(n, "name");
- String *tdname = Getattr(n, "tdname");
-
- /* Using name if tdname is empty. */
-
- if(Len(tdname) == 0)
- tdname = name;
+ String *symname = Getattr(n, "sym:name");
+ // TODO - deal with anonymous enumerations
+ // Previous enum code for R didn't wrap them
+ if (!symname || Getattr(n, "unnamedinstance"))
+ return SWIG_NOWRAP;
- if(!tdname || Strcmp(tdname, "") == 0) {
+ // create mangled name for the enum
+ // This will have content if the %nspace feature is set on
+ // the input file
+ String *nspace = Getattr(n, "sym:nspace"); // NSpace/getNSpace() only works during Language::enumDeclaration call
+ String *ename;
+
+ String *name = Getattr(n, "name");
+ ename = getRClassName(name);
+ if (debugMode) {
+ Node *current_class = getCurrentClass();
+ String *cl = NewString("");
+ if (current_class) {
+ cl = getEnumClassPrefix();
+ }
+ Printf(stdout, "enumDeclaration: %s, %s, %s, %s, %s\n", name, symname, nspace, ename, cl);
+ }
+ Delete(name);
+ // set up a call to create the R enum structure. The list of
+ // individual elements will be built in enum_code
+ enum_values = 0;
+ // Emit each enum item
Language::enumDeclaration(n);
- return SWIG_OK;
+
+ Printf(enum_def_calls, "defineEnumeration(\"%s\",\n .values=c(%s))\n\n", ename, enum_values);
+ Delete(enum_values);
+ Delete(ename);
+ //Delete(symname);
}
-
- String *mangled_tdname = SwigType_manglestr(tdname);
- String *scode = NewString("");
-
- Printv(scode, "defineEnumeration('", mangled_tdname, "'",
- ",\n", tab8, tab8, tab4, ".values = c(\n", NIL);
-
- Node *c;
- int value = -1; // First number is zero
- for (c = firstChild(n); c; c = nextSibling(c)) {
- // const char *tag = Char(nodeType(c));
- // if (Strcmp(tag,"cdecl") == 0) {
- name = Getattr(c, "name");
- String *val = Getattr(c, "enumvalue");
- if(val && Char(val)) {
- int inval = (int) getNumber(val);
- if(inval == DEFAULT_NUMBER)
- value++;
- else
- value = inval;
- } else
- value++;
+ return SWIG_OK;
+}
+
+/* -------------------------------------------------------------
+* --------------------------------------------------------------*/
+
+int R::enumvalueDeclaration(Node *n) {
+ if (getCurrentClass() && (cplus_mode != PUBLIC)) {
+ Printf(stdout, "evd: Not public\n");
+ return SWIG_NOWRAP;
+ }
+
+ Swig_require("enumvalueDeclaration", n, "*name", "?value", NIL);
+ String *symname = Getattr(n, "sym:name");
+ String *value = Getattr(n, "value");
+ String *name = Getattr(n, "name");
+ Node *parent = parentNode(n);
+ String *parent_name = Getattr(parent, "name");
+ String *newsymname = 0;
+ String *tmpValue;
+
+ // Strange hack from parent method
+ if (value)
+ tmpValue = NewString(value);
+ else
+ tmpValue = NewString(name);
+ // Note that this is used in enumValue() amongst other places
+ Setattr(n, "value", tmpValue);
+
+ // Deal with enum values that are not int
+ int swigtype = SwigType_type(Getattr(n, "type"));
+ if (swigtype == T_BOOL) {
+ const char *val = Equal(Getattr(n, "enumvalue"), "true") ? "1" : "0";
+ Setattr(n, "enumvalue", val);
+ } else if (swigtype == T_CHAR) {
+ String *val = NewStringf("'%s'", Getattr(n, "enumvalue"));
+ Setattr(n, "enumvalue", val);
+ Delete(val);
+ }
+
+ if (GetFlag(parent, "scopedenum")) {
+ newsymname = Swig_name_member(0, Getattr(parent, "sym:name"), symname);
+ symname = newsymname;
+ }
+
+ {
+ // Wrap C/C++ enums with constant integers or use the typesafe enum pattern
+ SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum ");
+ if (debugMode) {
+ Printf(stdout, "Setting type: %s\n", Copy(typemap_lookup_type));
+ }
+ Setattr(n, "type", typemap_lookup_type);
- Printf(scode, "%s%s%s'%s' = %d%s\n", tab8, tab8, tab8, name, value,
- nextSibling(c) ? ", " : "");
- // }
+ // Simple integer constants
+ // Note these are always generated for anonymous enums, no matter what enum_feature is specified
+ // Code generated is the same for SimpleEnum and TypeunsafeEnum -> the class it is generated into is determined later
+
+ String *value = enumValue(n);
+ if (enum_values) {
+ Printf(enum_values, ",\n\"%s\" = %s", name, value);
+ } else {
+ enum_values = NewString("");
+ Printf(enum_values, "\"%s\" = %s", name, value);
+ }
+
+ Delete(value);
}
-
- Printv(scode, "))", NIL);
- Printf(sfile, "%s\n", scode);
-
- Delete(scode);
- Delete(mangled_tdname);
-
+
return SWIG_OK;
}
-/*************************************************************
-**************************************************************/
+/* -------------------------------------------------------------
+ * Create accessor functions for variables.
+ * Does not create equivalent wrappers for enumerations,
+ * which are handled differently
+ * --------------------------------------------------------------*/
+
int R::variableWrapper(Node *n) {
String *name = Getattr(n, "sym:name");
-
+ if (debugMode) {
+ Printf(stdout, "variableWrapper %s\n", n);
+ }
processing_variable = 1;
Language::variableWrapper(n); // Force the emission of the _set and _get function wrappers.
processing_variable = 0;
-
-
+
+
SwigType *ty = Getattr(n, "type");
+ String *nodeType = nodeType(n);
int addCopyParam = addCopyParameter(ty);
-
+
//XXX
processType(ty, n);
-
- if(!SwigType_isconst(ty)) {
+
+ if (nodeType && !Strcmp(nodeType, "enumitem")) {
+ /* special wrapper for enums - don't want the R _set, _get functions*/
+ if (debugMode) {
+ Printf(stdout, "variableWrapper enum branch\n");
+ }
+ } else if(!SwigType_isconst(ty)) {
Wrapper *f = NewWrapper();
- Printf(f->def, "%s = \nfunction(value%s)\n{\n",
+ Printf(f->def, "%s = \nfunction(value%s)\n{\n",
name, addCopyParam ? ", .copy = FALSE" : "");
- Printv(f->code, "if(missing(value)) {\n",
+ Printv(f->code, "if(missing(value)) {\n",
name, "_get(", addCopyParam ? ".copy" : "", ")\n}", NIL);
- Printv(f->code, " else {\n",
+ Printv(f->code, " else {\n",
name, "_set(value)\n}\n}", NIL);
-
+
Wrapper_print(f, sfile);
DelWrapper(f);
} else {
@@ -1273,8 +1327,14 @@ int R::variableWrapper(Node *n) {
return SWIG_OK;
}
+/* -------------------------------------------------------------
+ * Creates accessor functions for class members.
-void R::addAccessor(String *memberName, Wrapper *wrapper, String *name,
+ * ToDo - this version depends on naming conventions and needs
+ * to be replaced.
+ * --------------------------------------------------------------*/
+
+void R::addAccessor(String *memberName, Wrapper *wrapper, String *name,
int isSet) {
if(isSet < 0) {
int n = Len(name);
@@ -1283,9 +1343,9 @@ void R::addAccessor(String *memberName, Wrapper *wrapper, String *name,
isSet = Strcmp(NewString(&ptr[n-4]), "_set") == 0;
}
}
-
+
List *l = isSet ? class_member_set_functions : class_member_functions;
-
+
if(!l) {
l = NewList();
if(isSet)
@@ -1293,10 +1353,10 @@ void R::addAccessor(String *memberName, Wrapper *wrapper, String *name,
else
class_member_functions = l;
}
-
+
Append(l, memberName);
Append(l, name);
-
+
String *tmp = NewString("");
Wrapper_print(wrapper, tmp);
Append(l, tmp);
@@ -1315,8 +1375,8 @@ struct Overloaded {
};
-List * R::Swig_overload_rank(Node *n,
- bool script_lang_wrapping) {
+List * R::Swig_overload_rank(Node *n,
+ bool script_lang_wrapping) {
Overloaded nodes[MAX_OVERLOAD];
int nnodes = 0;
Node *o = Getattr(n,"sym:overloaded");
@@ -1347,7 +1407,7 @@ List * R::Swig_overload_rank(Node *n,
}
c = Getattr(c,"sym:nextSibling");
}
-
+
/* Sort the declarations by required argument count */
{
int i,j;
@@ -1434,7 +1494,7 @@ List * R::Swig_overload_rank(Node *n,
}
/* Need subtype check here. If t2 is a subtype of t1, then we need to change the
- order */
+ order */
if (SwigType_issubtype(t2,t1)) {
Overloaded t = nodes[i];
@@ -1550,7 +1610,7 @@ List * R::Swig_overload_rank(Node *n,
int i;
for (i = 0; i < nnodes; i++) {
if (nodes[i].error)
- Setattr(nodes[i].n, "overload:ignore", "1");
+ Setattr(nodes[i].n, "overload:ignore", "1");
Append(result,nodes[i].n);
// Printf(stdout,"[ %d ] %s\n", i, ParmList_errorstr(nodes[i].parms));
// Swig_print_node(nodes[i].n);
@@ -1563,7 +1623,7 @@ void R::dispatchFunction(Node *n) {
Wrapper *f = NewWrapper();
String *symname = Getattr(n, "sym:name");
String *nodeType = Getattr(n, "nodeType");
- bool constructor = (!Cmp(nodeType, "constructor"));
+ bool constructor = (!Cmp(nodeType, "constructor"));
String *sfname = NewString(symname);
@@ -1577,7 +1637,7 @@ void R::dispatchFunction(Node *n) {
}
List *dispatch = Swig_overload_rank(n, true);
int nfunc = Len(dispatch);
- Printv(f->code,
+ Printv(f->code,
"argtypes <- mapply(class, list(...));\n",
"argv <- list(...);\n",
"argc <- length(argtypes);\n", NIL );
@@ -1590,7 +1650,7 @@ void R::dispatchFunction(Node *n) {
Parm *pi = Getattr(ni,"wrap:parms");
int num_arguments = emit_num_arguments(pi);
- String *overname = Getattr(ni,"sym:overname");
+ String *overname = Getattr(ni,"sym:overname");
if (cur_args != num_arguments) {
if (cur_args != -1) {
Printv(f->code, "} else ", NIL);
@@ -1631,37 +1691,29 @@ void R::dispatchFunction(Node *n) {
Printf(stdout, "<rtypecheck>%s\n", tmcheck);
}
Printf(f->code, "%s(%s)",
- j == 0? "" : " && ",
+ j == 0 ? "" : " && ",
tmcheck);
p = Getattr(p, "tmap:in:next");
continue;
}
+ // Below should be migrated into rtypecheck typemaps
if (tm) {
- if (Strcmp(tm,"numeric")==0) {
- Printf(f->code, "%sis.numeric(argv[[%d]])",
- j == 0 ? "" : " && ",
- j+1);
- }
- else if (Strcmp(tm,"integer")==0) {
- Printf(f->code, "%s(is.integer(argv[[%d]]) || is.numeric(argv[[%d]]))",
- j == 0 ? "" : " && ",
- j+1, j+1);
- }
- else if (Strcmp(tm,"character")==0) {
- Printf(f->code, "%sis.character(argv[[%d]])",
- j == 0 ? "" : " && ",
- j+1);
- }
- else {
- Printf(f->code, "%sextends(argtypes[%d], '%s')",
- j == 0 ? "" : " && ",
- j+1,
- tm);
+ Printf(f->code, "%s", j == 0 ? "" : " && ");
+ if (Strcmp(tm, "numeric") == 0) {
+ Printf(f->code, "is.numeric(argv[[%d]])", j+1);
+ } else if (Strcmp(tm, "integer") == 0) {
+ Printf(f->code, "(is.integer(argv[[%d]]) || is.numeric(argv[[%d]]))", j+1, j+1);
+ } else if (Strcmp(tm, "character") == 0) {
+ Printf(f->code, "is.character(argv[[%d]])", j+1);
+ } else {
+ if (SwigType_ispointer(Getattr(p, "type")))
+ Printf(f->code, "(extends(argtypes[%d], '%s') || is.null(argv[[%d]]))", j+1, tm, j+1);
+ else
+ Printf(f->code, "extends(argtypes[%d], '%s')", j+1, tm);
}
}
if (!SwigType_ispointer(Getattr(p, "type"))) {
- Printf(f->code, " && length(argv[[%d]]) == 1",
- j+1);
+ Printf(f->code, " && length(argv[[%d]]) == 1", j+1);
}
p = Getattr(p, "tmap:in:next");
}
@@ -1683,91 +1735,95 @@ void R::dispatchFunction(Node *n) {
DelWrapper(f);
}
-/******************************************************************
+/*--------------------------------------------------------------
+
+* --------------------------------------------------------------*/
-*******************************************************************/
int R::functionWrapper(Node *n) {
String *fname = Getattr(n, "name");
String *iname = Getattr(n, "sym:name");
- String *type = Getattr(n, "type");
-
+ String *type = Getattr(n, "type");
+
if (debugMode) {
- Printf(stdout,
+ Printf(stdout,
"<functionWrapper> %s %s %s\n", fname, iname, type);
}
String *overname = 0;
String *nodeType = Getattr(n, "nodeType");
- bool constructor = (!Cmp(nodeType, "constructor"));
- bool destructor = (!Cmp(nodeType, "destructor"));
-
+ bool constructor = (!Cmp(nodeType, "constructor"));
+ bool destructor = (!Cmp(nodeType, "destructor"));
+
String *sfname = NewString(iname);
-
+
if (constructor)
Replace(sfname, "new_", "", DOH_REPLACE_FIRST);
-
+
if (Getattr(n,"sym:overloaded")) {
- overname = Getattr(n,"sym:overname");
+ overname = Getattr(n,"sym:overname");
Append(sfname, overname);
}
-
- if (debugMode)
- Printf(stdout,
+
+ if (debugMode)
+ Printf(stdout,
"<functionWrapper> processing parameters\n");
-
-
+
+
ParmList *l = Getattr(n, "parms");
Parm *p;
String *tm;
-
+
p = l;
while(p) {
SwigType *resultType = Getattr(p, "type");
- if (expandTypedef(resultType) &&
+ if (expandTypedef(resultType) &&
SwigType_istypedef(resultType)) {
SwigType *resolved =
SwigType_typedef_resolve_all(resultType);
if (expandTypedef(resolved)) {
+ if (debugMode) {
+ Printf(stdout, "Setting type: %s\n", resolved);
+ }
Setattr(p, "type", Copy(resolved));
}
}
p = nextSibling(p);
- }
+ }
- String *unresolved_return_type =
+ String *unresolved_return_type =
Copy(type);
if (expandTypedef(type) &&
SwigType_istypedef(type)) {
- SwigType *resolved =
+ SwigType *resolved =
SwigType_typedef_resolve_all(type);
+ if (debugMode)
+ Printf(stdout, "<functionWrapper> resolved %s\n", Copy(unresolved_return_type));
if (expandTypedef(resolved)) {
type = Copy(resolved);
Setattr(n, "type", type);
}
}
- if (debugMode)
- Printf(stdout, "<functionWrapper> unresolved_return_type %s\n",
- unresolved_return_type);
+ if (debugMode)
+ Printf(stdout, "<functionWrapper> unresolved_return_type %s\n", unresolved_return_type);
if(processing_member_access_function) {
if (debugMode)
- Printf(stdout, "<functionWrapper memberAccess> '%s' '%s' '%s' '%s'\n",
- fname, iname, member_name, class_name);
-
+ Printf(stdout, "<functionWrapper memberAccess> '%s' '%s' '%s' '%s'\n", fname, iname, member_name, class_name);
+
if(opaqueClassDeclaration)
return SWIG_OK;
-
-
- /* Add the name of this member to a list for this class_name.
+
+
+ /* Add the name of this member to a list for this class_name.
We will dump all these at the end. */
-
+
int n = Len(iname);
char *ptr = Char(iname);
bool isSet(0);
if (n > 4) isSet = Strcmp(NewString(&ptr[n-4]), "_set") == 0;
-
-
+
+
String *tmp = NewString("");
Printf(tmp, "%s_%s", class_name, isSet ? "set" : "get");
-
+
List *memList = Getattr(ClassMemberTable, tmp);
if(!memList) {
memList = NewList();
@@ -1778,29 +1834,29 @@ int R::functionWrapper(Node *n) {
Append(memList, member_name);
Append(memList, iname);
}
-
+
int i;
int nargs;
-
+
String *wname = Swig_name_wrapper(iname);
Replace(wname, "_wrap", "R_swig", DOH_REPLACE_FIRST);
- if(overname)
+ if(overname)
Append(wname, overname);
Setattr(n,"wrap:name", wname);
Wrapper *f = NewWrapper();
Wrapper *sfun = NewWrapper();
-
+
int isVoidReturnType = (Strcmp(type, "void") == 0);
- // Need to use the unresolved return type since
- // typedef resolution removes the const which causes a
+ // Need to use the unresolved return type since
+ // typedef resolution removes the const which causes a
// mismatch with the function action
emit_return_variable(n, unresolved_return_type, f);
SwigType *rtype = Getattr(n, "type");
int addCopyParam = 0;
- if(!isVoidReturnType)
+ if(!isVoidReturnType)
addCopyParam = addCopyParameter(rtype);
@@ -1809,16 +1865,24 @@ int R::functionWrapper(Node *n) {
// if(addCopyParam)
if (debugMode)
- Printf(stdout, "Adding a .copy argument to %s for %s = %s\n",
+ Printf(stdout, "Adding a .copy argument to %s for %s = %s\n",
iname, type, addCopyParam ? "yes" : "no");
Printv(f->def, "SWIGEXPORT SEXP\n", wname, " ( ", NIL);
- Printf(sfun->def, "# Start of %s\n", iname);
+ Printf(sfun->def, "# Start of %s\n", iname);
Printv(sfun->def, "\n`", sfname, "` = function(", NIL);
- if(outputNamespaceInfo) //XXX Need to be a little more discriminating
- addNamespaceFunction(iname);
+ if(outputNamespaceInfo) {//XXX Need to be a little more discriminating
+ if (constructor) {
+ String *niname = Copy(iname);
+ Replace(niname, "new_", "", DOH_REPLACE_FIRST);
+ addNamespaceFunction(niname);
+ Delete(niname);
+ } else {
+ addNamespaceFunction(iname);
+ }
+ }
Swig_typemap_attach_parms("scoercein", l, f);
Swig_typemap_attach_parms("scoerceout", l, f);
@@ -1880,7 +1944,7 @@ int R::functionWrapper(Node *n) {
name = Copy(name);
Insert(name, 0, "s_");
}
-
+
if(processing_variable) {
name = Copy(name);
Insert(name, 0, "s_");
@@ -1905,7 +1969,7 @@ int R::functionWrapper(Node *n) {
String *snargs = NewStringf("%d", nargs);
Printv(sfun->code, "if(is.function(", name, ")) {", "\n",
- "assert('...' %in% names(formals(", name,
+ "assert('...' %in% names(formals(", name,
")) || length(formals(", name, ")) >= ", snargs, ");\n} ", NIL);
Delete(snargs);
@@ -1960,11 +2024,11 @@ int R::functionWrapper(Node *n) {
Printf(f->code,"%s\n",tm);
- if(funcptr_name)
- Printf(f->code, "} else {\n%s = %s;\nR_SWIG_pushCallbackFunctionData(%s, NULL);\n}\n",
+ if(funcptr_name)
+ Printf(f->code, "} else {\n%s = %s;\nR_SWIG_pushCallbackFunctionData(%s, NULL);\n}\n",
lname, funcptr_name, name);
Printv(f->def, inFirstArg ? "" : ", ", "SEXP ", name, NIL);
- if (Len(name) != 0)
+ if (Len(name) != 0)
inFirstArg = false;
p = Getattr(p,"tmap:in:next");
@@ -1981,7 +2045,7 @@ int R::functionWrapper(Node *n) {
Printf(s_inputMap, "%s%s='%s'", inFirstType ? "" : ", ", name, tm);
inFirstType = false;
- if(funcptr_name)
+ if(funcptr_name)
Delete(funcptr_name);
} /* end of looping over parameters. */
@@ -2020,7 +2084,7 @@ int R::functionWrapper(Node *n) {
Replaceall(tm,"$n", pos); // The position into which to store the answer.
Replaceall(tm,"$arg", Getattr(p, "emit:input"));
Replaceall(tm,"$input", Getattr(p, "emit:input"));
- Replaceall(tm,"$owner", "R_SWIG_EXTERNAL");
+ Replaceall(tm,"$owner", "0");
Printf(outargs, "%s\n", tm);
@@ -2032,22 +2096,20 @@ int R::functionWrapper(Node *n) {
String *actioncode = emit_action(n);
/* Deal with the explicit return value. */
- if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
+ if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
SwigType *retType = Getattr(n, "type");
- //Printf(stdout, "Return Value for %s, array? %s\n", retType, SwigType_isarray(retType) ? "yes" : "no");
- /* if(SwigType_isarray(retType)) {
- defineArrayAccessors(retType);
- } */
-
-
+
Replaceall(tm,"$1", Swig_cresult_name());
Replaceall(tm,"$result", "r_ans");
+ if (debugMode){
+ Printf(stdout, "Calling replace D: %s, %s, %s\n", retType, n, tm);
+ }
replaceRClass(tm, retType);
if (GetFlag(n,"feature:new")) {
- Replaceall(tm, "$owner", "R_SWIG_OWNER");
+ Replaceall(tm, "$owner", "SWIG_POINTER_OWN");
} else {
- Replaceall(tm,"$owner", "R_SWIG_EXTERNAL");
+ Replaceall(tm,"$owner", "0");
}
#if 0
@@ -2055,11 +2117,11 @@ int R::functionWrapper(Node *n) {
Printf(f->code, "if(LOGICAL(s_swig_copy)[0]) {\n");
Printf(f->code, "/* Deal with returning a reference. */\nr_ans = R_NilValue;\n");
Printf(f->code, "}\n else {\n");
- }
+ }
#endif
Printf(f->code, "%s\n", tm);
#if 0
- if(addCopyParam)
+ if(addCopyParam)
Printf(f->code, "}\n"); /* end of if(s_swig_copy) ... else { ... } */
#endif
@@ -2076,8 +2138,8 @@ int R::functionWrapper(Node *n) {
if(!isVoidReturnType)
Printf(tmp, "Rf_protect(r_ans);\n");
- Printf(tmp, "Rf_protect(R_OutputValues = Rf_allocVector(VECSXP,%d));\nr_nprotect += %d;\n",
- numOutArgs + !isVoidReturnType,
+ Printf(tmp, "Rf_protect(R_OutputValues = Rf_allocVector(VECSXP,%d));\nr_nprotect += %d;\n",
+ numOutArgs + !isVoidReturnType,
isVoidReturnType ? 1 : 2);
if(!isVoidReturnType)
@@ -2085,7 +2147,7 @@ int R::functionWrapper(Node *n) {
Printf(tmp, "r_ans = R_OutputValues;\n");
Insert(outargs, 0, tmp);
- Delete(tmp);
+ Delete(tmp);
@@ -2119,22 +2181,34 @@ int R::functionWrapper(Node *n) {
if ((tm = Swig_typemap_lookup("scoerceout", n, Swig_cresult_name(), sfun))) {
Replaceall(tm,"$source","ans");
Replaceall(tm,"$result","ans");
+ if (constructor) {
+ Node * parent = Getattr(n, "parentNode");
+ String * smartname = Getattr(parent, "feature:smartptr");
+ if (smartname) {
+ smartname = getRClassName(smartname, 1, 1);
+ Replaceall(tm, "$R_class", smartname);
+ Delete(smartname);
+ }
+ }
+ if (debugMode) {
+ Printf(stdout, "Calling replace B: %s, %s, %s\n", Getattr(n, "type"), Getattr(n, "sym:name"), getNSpace());
+ }
replaceRClass(tm, Getattr(n, "type"));
Chop(tm);
}
- Printv(sfun->code, ";", (Len(tm) ? "ans = " : ""), ".Call('", wname,
+ Printv(sfun->code, ";", (Len(tm) ? "ans = " : ""), ".Call('", wname,
"', ", sargs, "PACKAGE='", Rpackage, "');\n", NIL);
if(Len(tm))
{
- Printf(sfun->code, "%s\n\n", tm);
+ Printf(sfun->code, "%s\n\n", tm);
if (constructor)
- {
+ {
String *finalizer = NewString(iname);
Replace(finalizer, "new_", "", DOH_REPLACE_FIRST);
Printf(sfun->code, "reg.finalizer(ans@ref, delete_%s)\n", finalizer);
- }
+ }
Printf(sfun->code, "ans\n");
}
@@ -2154,18 +2228,21 @@ int R::functionWrapper(Node *n) {
tm = Swig_typemap_lookup("rtype", n, "", 0);
if(tm) {
SwigType *retType = Getattr(n, "type");
+ if (debugMode) {
+ Printf(stdout, "Calling replace C: %s\n", Copy(retType));
+ }
replaceRClass(tm, retType);
- }
-
- Printv(sfile, "attr(`", sfname, "`, 'returnType') = '",
- isVoidReturnType ? "void" : (tm ? tm : ""),
- "'\n", NIL);
-
+ }
+
+ Printv(sfile, "attr(`", sfname, "`, 'returnType') = '",
+ isVoidReturnType ? "void" : (tm ? tm : ""),
+ "'\n", NIL);
+
if(nargs > 0)
Printv(sfile, "attr(`", sfname, "`, \"inputTypes\") = c(",
s_inputTypes, ")\n", NIL);
- Printv(sfile, "class(`", sfname, "`) = c(\"SWIGFunction\", class('",
- sfname, "'))\n\n", NIL);
+ Printv(sfile, "class(`", sfname, "`) = c(\"SWIGFunction\", class('",
+ sfname, "'))\n\n", NIL);
if (memoryProfile) {
Printv(sfile, "memory.profile()\n", NIL);
@@ -2178,8 +2255,8 @@ int R::functionWrapper(Node *n) {
- /* If we are dealing with a method in an C++ class, then
- add the name of the R function and its definition.
+ /* If we are dealing with a method in an C++ class, then
+ add the name of the R function and its definition.
XXX need to figure out how to store the Wrapper if possible in the hash/list.
Would like to be able to do this so that we can potentially insert
*/
@@ -2212,45 +2289,47 @@ int R::constantWrapper(Node *n) {
return SWIG_OK;
}
-/*****************************************************
- Add the specified routine name to the collection of
- generated routines that are called from R functions.
- This is used to register the routines with R for
- resolving symbols.
+/*--------------------------------------------------------------
+ * Add the specified routine name to the collection of
+ * generated routines that are called from R functions.
+ * This is used to register the routines with R for
+ * resolving symbols.
+
+ * rname - the name of the routine
+ * nargs - the number of arguments it expects.
+ * --------------------------------------------------------------*/
- rname - the name of the routine
- nargs - the number of arguments it expects.
-******************************************************/
int R::addRegistrationRoutine(String *rname, int nargs) {
- if(!registrationTable)
+ if(!registrationTable)
registrationTable = NewHash();
- String *el =
+ String *el =
NewStringf("{\"%s\", (DL_FUNC) &%s, %d}", rname, rname, nargs);
-
+
Setattr(registrationTable, rname, el);
return SWIG_OK;
}
-/*****************************************************
- Write the registration information to an array and
- create the initialization routine for registering
- these.
-******************************************************/
+/* -------------------------------------------------------------
+ * Write the registration information to an array and
+ * create the initialization routine for registering
+ * these.
+ * --------------------------------------------------------------*/
+
int R::outputRegistrationRoutines(File *out) {
int i, n;
- if(!registrationTable)
+ if(!registrationTable)
return(0);
- if(inCPlusMode)
+ if(inCPlusMode)
Printf(out, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
Printf(out, "#include <R_ext/Rdynload.h>\n\n");
- if(inCPlusMode)
+ if(inCPlusMode)
Printf(out, "#ifdef __cplusplus\n}\n#endif\n\n");
Printf(out, "SWIGINTERN R_CallMethodDef CallEntries[] = {\n");
-
+
List *keys = Keys(registrationTable);
n = Len(keys);
for(i = 0; i < n; i++)
@@ -2261,7 +2340,13 @@ int R::outputRegistrationRoutines(File *out) {
if(!noInitializationCode) {
if (inCPlusMode)
Printv(out, "extern \"C\" ", NIL);
- Printf(out, "SWIGEXPORT void R_init_%s(DllInfo *dll) {\n", Rpackage);
+ { /* R allows pckage names to have '.' in the name, which is not allowed in C++ var names
+ we simply replace all occurrences of '.' with '_' to construct the var name */
+ String * Rpackage_sane = Copy(Rpackage);
+ Replace(Rpackage_sane, ".", "_", DOH_REPLACE_ANY);
+ Printf(out, "SWIGEXPORT void R_init_%s(DllInfo *dll) {\n", Rpackage_sane);
+ Delete(Rpackage_sane);
+ }
Printf(out, "%sR_registerRoutines(dll, NULL, CallEntries, NULL, NULL);\n", tab4);
if(Len(s_init_routine)) {
Printf(out, "\n%s\n", s_init_routine);
@@ -2274,17 +2359,17 @@ int R::outputRegistrationRoutines(File *out) {
-/****************************************************************************
- Process a struct, union or class declaration in the source code,
- or an anonymous typedef struct
-
-*****************************************************************************/
-//XXX What do we need to do here -
+/* -------------------------------------------------------------
+ * Process a struct, union or class declaration in the source code,
+ * or an anonymous typedef struct
+ * --------------------------------------------------------------*/
+
+//XXX What do we need to do here -
// Define an S4 class to refer to this.
void R::registerClass(Node *n) {
- String *name = Getattr(n, "name");
- String *kind = Getattr(n, "kind");
+ String *name = Getattr(n, "name");
+ String *kind = Getattr(n, "kind");
if (debugMode)
Swig_print_node(n);
@@ -2300,33 +2385,57 @@ void R::registerClass(Node *n) {
Printf(base, "c(");
for(int i = 0; i < Len(l); i++) {
registerClass(Getitem(l, i));
- Printf(base, "'_p%s'%s",
- SwigType_manglestr(Getattr(Getitem(l, i), "name")),
- i < Len(l)-1 ? ", " : "");
+ Printf(base, "'_p%s'%s",
+ SwigType_manglestr(Getattr(Getitem(l, i), "name")),
+ i < Len(l)-1 ? ", " : "");
}
Printf(base, ")");
} else {
base = NewString("'C++Reference'");
}
- } else
+ } else
base = NewString("'ExternalReference'");
Printf(s_classes, "setClass('%s', contains = %s)\n", sname, base);
Delete(base);
+ String *smartptr = Getattr(n, "feature:smartptr");
+ if (smartptr) {
+ List *l = Getattr(n, "bases");
+ SwigType *spt = Swig_cparse_type(smartptr);
+ String *smart = SwigType_typedef_resolve_all(spt);
+ String *smart_rname = SwigType_manglestr(smart);
+ Printf(s_classes, "setClass('_p%s', contains = c('%s'", smart_rname, sname);
+ Delete(spt);
+ Delete(smart);
+ Delete(smart_rname);
+ for(int i = 0; i < Len(l); i++) {
+ Node * b = Getitem(l, i);
+ smartptr = Getattr(b, "feature:smartptr");
+ if (smartptr) {
+ spt = Swig_cparse_type(smartptr);
+ smart = SwigType_typedef_resolve_all(spt);
+ smart_rname = SwigType_manglestr(smart);
+ Printf(s_classes, ", '_p%s'", smart_rname);
+ Delete(spt);
+ Delete(smart);
+ Delete(smart_rname);
+ }
+ }
+ Printf(s_classes, "))\n");
+ }
}
-
}
int R::classDeclaration(Node *n) {
- String *name = Getattr(n, "name");
- String *kind = Getattr(n, "kind");
+ String *name = Getattr(n, "name");
+ String *kind = Getattr(n, "kind");
if (debugMode)
Swig_print_node(n);
registerClass(n);
-
+
/* If we have a typedef union { ... } U, then we never get to see the typedef
via a regular call to typedefHandler. Instead, */
if(Getattr(n, "unnamed") && Getattr(n, "storage") && Strcmp(Getattr(n, "storage"), "typedef") == 0
@@ -2346,7 +2455,7 @@ int R::classDeclaration(Node *n) {
opaqueClassDeclaration = NULL;
- // OutputArrayMethod(name, class_member_functions, sfile);
+ // OutputArrayMethod(name, class_member_functions, sfile);
if (class_member_functions)
OutputMemberReferenceMethod(name, 0, class_member_functions, sfile);
if (class_member_set_functions)
@@ -2361,14 +2470,12 @@ int R::classDeclaration(Node *n) {
class_member_set_functions = NULL;
}
if (Getattr(n, "has_destructor")) {
- Printf(sfile, "setMethod('delete', '_p%s', function(obj) {delete%s(obj)})\n",
- getRClassName(Getattr(n, "name")),
- getRClassName(Getattr(n, "name")));
+ Printf(sfile, "setMethod('delete', '_p%s', function(obj) {delete%s(obj)})\n", getRClassName(name), getRClassName(name));
}
if(!opaque && !Strcmp(kind, "struct") && copyStruct) {
- String *def =
+ String *def =
NewStringf("setClass(\"%s\",\n%srepresentation(\n", name, tab4);
bool firstItem = true;
@@ -2377,7 +2484,7 @@ int R::classDeclaration(Node *n) {
String *tp;
elName = Getattr(c, "name");
-
+
String *elKind = Getattr(c, "kind");
if (!Equal(elKind, "variable")) {
c = nextSibling(c);
@@ -2407,12 +2514,12 @@ int R::classDeclaration(Node *n) {
if (!firstItem) {
Printf(def, ",\n");
- }
- // else
+ }
+ // else
//XXX How can we tell if this is already done.
// SwigType_push(elType, elDecl);
-
-
+
+
// returns "" tp = processType(elType, c, NULL);
// Printf(stdout, "<classDeclaration> elType %p\n", elType);
// tp = getRClassNameCopyStruct(Getattr(c, "type"), 1);
@@ -2437,12 +2544,13 @@ int R::classDeclaration(Node *n) {
-/***************************************************************
- Create the C routines that copy an S object of the class given
- by the given struct definition in Node *n to the C value
- and also the routine that goes from the C routine to an object
- of this S class.
-****************************************************************/
+/* -------------------------------------------------------------
+ * Create the C routines that copy an S object of the class given
+ * by the given struct definition in Node *n to the C value
+ * and also the routine that goes from the C routine to an object
+ * of this S class.
+ * --------------------------------------------------------------*/
+
/*XXX
Clean up the toCRef - make certain the names are correct for the types, etc.
in all cases.
@@ -2451,7 +2559,7 @@ int R::classDeclaration(Node *n) {
int R::generateCopyRoutines(Node *n) {
Wrapper *copyToR = NewWrapper();
Wrapper *copyToC = NewWrapper();
-
+
String *name = Getattr(n, "name");
String *tdname = Getattr(n, "tdname");
String *kind = Getattr(n, "kind");
@@ -2468,9 +2576,9 @@ int R::generateCopyRoutines(Node *n) {
if (debugMode)
Printf(stdout, "generateCopyRoutines: name = %s, %s\n", name, type);
- Printf(copyToR->def, "CopyToR%s = function(value, obj = new(\"%s\"))\n{\n",
+ Printf(copyToR->def, "CopyToR%s = function(value, obj = new(\"%s\"))\n{\n",
mangledName, name);
- Printf(copyToC->def, "CopyToC%s = function(value, obj)\n{\n",
+ Printf(copyToC->def, "CopyToC%s = function(value, obj)\n{\n",
mangledName);
Node *c = firstChild(n);
@@ -2506,22 +2614,22 @@ int R::generateCopyRoutines(Node *n) {
}
Printf(copyToR->code, "obj;\n}\n\n");
String *rclassName = getRClassNameCopyStruct(type, 0); // without the Ref.
- Printf(sfile, "# Start definition of copy functions & methods for %s\n", rclassName);
-
+ Printf(sfile, "# Start definition of copy functions & methods for %s\n", rclassName);
+
Wrapper_print(copyToR, sfile);
Printf(copyToC->code, "obj\n}\n\n");
Wrapper_print(copyToC, sfile);
-
-
- Printf(sfile, "# Start definition of copy methods for %s\n", rclassName);
- Printf(sfile, "setMethod('copyToR', '_p_%s', CopyToR%s);\n", rclassName,
+
+
+ Printf(sfile, "# Start definition of copy methods for %s\n", rclassName);
+ Printf(sfile, "setMethod('copyToR', '_p_%s', CopyToR%s);\n", rclassName,
mangledName);
- Printf(sfile, "setMethod('copyToC', '%s', CopyToC%s);\n\n", rclassName,
+ Printf(sfile, "setMethod('copyToC', '%s', CopyToC%s);\n\n", rclassName,
mangledName);
-
- Printf(sfile, "# End definition of copy methods for %s\n", rclassName);
- Printf(sfile, "# End definition of copy functions & methods for %s\n", rclassName);
-
+
+ Printf(sfile, "# End definition of copy methods for %s\n", rclassName);
+ Printf(sfile, "# End definition of copy functions & methods for %s\n", rclassName);
+
String *m = NewStringf("%sCopyToR", name);
addNamespaceMethod(m);
char *tt = Char(m); tt[Len(m)-1] = 'C';
@@ -2537,13 +2645,14 @@ int R::generateCopyRoutines(Node *n) {
-/*****
- Called when there is a typedef to be invoked.
+/* -------------------------------------------------------------
+ * Called when there is a typedef to be invoked.
+ *
+ * XXX Needs to be enhanced or split to handle the case where we have a
+ * typedef within a classDeclaration emission because the struct/union/etc.
+ * is anonymous.
+ * --------------------------------------------------------------*/
- XXX Needs to be enhanced or split to handle the case where we have a
- typedef within a classDeclaration emission because the struct/union/etc.
- is anonymous.
-******/
int R::typedefHandler(Node *n) {
SwigType *tp = Getattr(n, "type");
String *type = Getattr(n, "type");
@@ -2558,7 +2667,7 @@ int R::typedefHandler(Node *n) {
trueName += 7;
if (debugMode)
Printf(stdout, "<typedefHandler> Defining S class %s\n", trueName);
- Printf(s_classes, "setClass('_p%s', contains = 'ExternalReference')\n",
+ Printf(s_classes, "setClass('_p%s', contains = 'ExternalReference')\n",
SwigType_manglestr(name));
}
@@ -2567,19 +2676,20 @@ int R::typedefHandler(Node *n) {
-/*********************
- Called when processing a field in a "class", i.e. struct, union or
- actual class. We set a state variable so that we can correctly
- interpret the resulting functionWrapper() call and understand that
- it is for a field element.
-**********************/
+/* --------------------------------------------------------------
+ * Called when processing a field in a "class", i.e. struct, union or
+ * actual class. We set a state variable so that we can correctly
+ * interpret the resulting functionWrapper() call and understand that
+ * it is for a field element.
+ * --------------------------------------------------------------*/
+
int R::membervariableHandler(Node *n) {
SwigType *t = Getattr(n, "type");
processType(t, n, NULL);
processing_member_access_function = 1;
member_name = Getattr(n,"sym:name");
if (debugMode)
- Printf(stdout, "<membervariableHandler> name = %s, sym:name = %s\n",
+ Printf(stdout, "<membervariableHandler> name = %s, sym:name = %s\n",
Getattr(n, "name"), member_name);
int status(Language::membervariableHandler(n));
@@ -2607,14 +2717,15 @@ String * R::runtimeCode() {
}
-/**
- Called when SWIG wants to initialize this
- We initialize anythin we want here.
- Most importantly, tell SWIG where to find the files (e.g. r.swg) for this module.
- Use Swig_mark_arg() to tell SWIG that it is understood and not to throw an error.
-**/
+/* -----------------------------------------------------------------------
+ * Called when SWIG wants to initialize this
+ * We initialize anythin we want here.
+ * Most importantly, tell SWIG where to find the files (e.g. r.swg) for this module.
+ * Use Swig_mark_arg() to tell SWIG that it is understood and not to
+ * throw an error.
+ * --------------------------------------------------------------*/
+
void R::main(int argc, char *argv[]) {
- bool cppcast = true;
init();
Preprocessor_define("SWIGR 1", 0);
SWIG_library_directory("r");
@@ -2630,7 +2741,7 @@ void R::main(int argc, char *argv[]) {
this->Argc = argc;
this->Argv = argv;
- allow_overloading();// can we support this?
+ allow_overloading();// can we support this?
for(int i = 0; i < argc; i++) {
if(strcmp(argv[i], "-package") == 0) {
@@ -2658,12 +2769,6 @@ void R::main(int argc, char *argv[]) {
} else if(!strcmp(argv[i], "-debug")) {
debugMode = true;
Swig_mark_arg(i);
- } else if (!strcmp(argv[i],"-cppcast")) {
- cppcast = true;
- Swig_mark_arg(i);
- } else if (!strcmp(argv[i],"-nocppcast")) {
- cppcast = false;
- Swig_mark_arg(i);
} else if (!strcmp(argv[i],"-copystruct")) {
copyStruct = true;
Swig_mark_arg(i);
@@ -2682,10 +2787,13 @@ void R::main(int argc, char *argv[]) {
} else if (!strcmp(argv[i], "-noaggressivegc")) {
aggressiveGc = false;
Swig_mark_arg(i);
- }
-
- if (cppcast) {
- Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
+ } else if (strcmp(argv[i], "-cppcast") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
+ Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-nocppcast") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
+ Swig_mark_arg(i);
+ SWIG_exit(EXIT_FAILURE);
}
if (debugMode) {
@@ -2699,10 +2807,10 @@ void R::main(int argc, char *argv[]) {
}
}
-/*
- Could make this work for String or File and then just store the resulting string
- rather than the collection of arguments and argc.
-*/
+/* -----------------------------------------------------------------------
+ * Could make this work for String or File and then just store the resulting string
+ * rather than the collection of arguments and argc.
+ * ----------------------------------------------------------------------- */
int R::outputCommandLineArguments(File *out)
{
if(Argc < 1 || !Argv || !Argv[0])
@@ -2719,32 +2827,31 @@ int R::outputCommandLineArguments(File *out)
-/* How SWIG instantiates an object from this module.
+/* How SWIG instantiates an object from this module.
See swigmain.cxx */
-extern "C"
+extern "C"
Language *swig_r(void) {
return new R();
}
-/*************************************************************************************/
-/*
- Needs to be reworked.
-*/
+/* -----------------------------------------------------------------------
+ * Needs to be reworked.
+ *----------------------------------------------------------------------- */
String * R::processType(SwigType *t, Node *n, int *nargs) {
//XXX Need to handle typedefs, e.g.
// a type which is a typedef to a function pointer.
SwigType *tmp = Getattr(n, "tdname");
if (debugMode)
- Printf(stdout, "processType %s (tdname = %s)\n", Getattr(n, "name"), tmp);
-
+ Printf(stdout, "processType %s (tdname = %s)(SwigType = %s)\n", Getattr(n, "name"), tmp, Copy(t));
+
SwigType *td = t;
if (expandTypedef(t) &&
SwigType_istypedef(t)) {
- SwigType *resolved =
+ SwigType *resolved =
SwigType_typedef_resolve_all(t);
if (expandTypedef(resolved)) {
td = Copy(resolved);
@@ -2758,10 +2865,10 @@ String * R::processType(SwigType *t, Node *n, int *nargs) {
if (debugMode)
Printf(stdout, "<processType> Defining class %s\n", b);
- Printf(s_classes, "setClass('%s', contains = 'ExternalReference')\n", b);
+ Printf(s_classes, "setClass('%s', contains = 'ExternalReference')\n", b);
Setattr(SClassDefs, b, b);
}
-
+
}
@@ -2770,9 +2877,9 @@ String * R::processType(SwigType *t, Node *n, int *nargs) {
if(SwigType_isfunctionpointer(t)) {
if (debugMode)
- Printf(stdout,
+ Printf(stdout,
"<processType> Defining pointer handler %s\n", t);
-
+
String *tmp = createFunctionPointerHandler(t, n, nargs);
return tmp;
}
@@ -2785,16 +2892,54 @@ String * R::processType(SwigType *t, Node *n, int *nargs) {
}
+/* -----------------------------------------------------------------------
+ * enumValue()
+ * This method will return a string with an enum value to use in from R when
+ * setting up an enum variable
+ * ------------------------------------------------------------------------ */
+String *R::enumValue(Node *n) {
+ String *symname = Getattr(n, "sym:name");
+ String *value = Getattr(n, "value");
+ String *newsymname = 0;
+ Node *parent = parentNode(n);
+ symname = Getattr(n, "sym:name");
+
+ // parent enumtype has namespace mangled in
+ String *etype = Getattr(parent, "enumtype");
+ // we have to directly call the c wrapper function, as the
+ // R wrapper to the enum is designed to be used after the enum
+ // structures have been created on the R side. This means
+ // that we'll need to construct a .Call expression
+ // change the type for variableWrapper
+ if (debugMode) {
+ Printf(stdout, "<enumValue> type set: %s\n", etype);
+ }
+ Setattr(n, "type", etype);
-
-
-/*************************************************************************************/
-
-
-
-
-
+ if (!getCurrentClass()) {
+ newsymname = Swig_name_member(0, Getattr(parent, "sym:name"), symname);
+ // Strange hack to change the name
+ Setattr(n, "name", Getattr(n, "value"));
+ Setattr(n, "sym:name", newsymname);
+ variableWrapper(n);
+ value = Swig_name_get(NSPACE_TODO, newsymname);
+ } else {
+ String *enumClassPrefix = getEnumClassPrefix();
+ newsymname = Swig_name_member(0, enumClassPrefix, symname);
+ Setattr(n, "name", Getattr(n, "value"));
+ Setattr(n, "sym:name", newsymname);
+ variableWrapper(n);
+ value = Swig_name_get(NSPACE_TODO, newsymname);
+ }
+ value = Swig_name_wrapper(value);
+ Replace(value, "_wrap", "R_swig", DOH_REPLACE_FIRST);
+
+ String *valuecall=NewString("");
+ Printv(valuecall, ".Call('", value, "',FALSE, PACKAGE='", Rpackage, "')", NIL);
+ Delete(value);
+ return valuecall;
+}
diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx
index b9ac11546..6a1e16d5d 100644
--- a/Source/Modules/ruby.cxx
+++ b/Source/Modules/ruby.cxx
@@ -131,12 +131,10 @@ enum autodoc_t {
static const char *usage = "\
Ruby Options (available with -ruby)\n\
-autorename - Enable renaming of classes and methods to follow Ruby coding standards\n\
- -cppcast - Enable C++ casting operators (default)\n\
-globalmodule - Wrap everything into the global module\n\
-initname <name>- Set entry function to Init_<name> (used by `require')\n\
-minherit - Attempt to support multiple inheritance\n\
-noautorename - Disable renaming of classes and methods (default)\n\
- -nocppcast - Disable C++ casting operators, useful for generating bugs\n\
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
";
@@ -257,32 +255,22 @@ private:
autodoc = make_autodoc(n, ad_type);
have_auto = (autodoc && Len(autodoc) > 0);
}
- // If there is more than one line then make docstrings like this:
- //
- // This is line1
- // And here is line2 followed by the rest of them
- //
- // otherwise, put it all on a single line
- //
+
+ if (have_auto || have_ds)
+ doc = NewString("/*");
+
if (have_auto && have_ds) { // Both autodoc and docstring are present
- doc = NewString("");
- Printv(doc, "\n", autodoc, "\n", str, NIL);
+ Printv(doc, "\n", autodoc, "\n", str, "\n", NIL);
} else if (!have_auto && have_ds) { // only docstring
- if (Strchr(str, '\n') == 0) {
- doc = NewString(str);
- } else {
- doc = NewString("");
- Printv(doc, str, NIL);
- }
+ Printv(doc, str, NIL);
} else if (have_auto && !have_ds) { // only autodoc
- if (Strchr(autodoc, '\n') == 0) {
- doc = NewStringf("%s", autodoc);
- } else {
- doc = NewString("");
- Printv(doc, "\n", autodoc, NIL);
- }
- } else
+ Printv(doc, "\n", autodoc, "\n", NIL);
+ } else {
doc = NewString("");
+ }
+
+ if (have_auto || have_ds)
+ Append(doc, "*/\n");
// Save the generated strings in the parse tree in case they are used later
// by post processing tools
@@ -302,13 +290,14 @@ private:
* The "lname" attribute in each parameter in plist will be contain a parameter name
* ----------------------------------------------------------------------------- */
- void addMissingParameterNames(ParmList *plist, int arg_offset) {
+ void addMissingParameterNames(Node* n, ParmList *plist, int arg_offset) {
Parm *p = plist;
int i = arg_offset;
while (p) {
if (!Getattr(p, "lname")) {
- String *pname = Swig_cparm_name(p, i);
- Delete(pname);
+ String *name = makeParameterName(n, p, i);
+ Setattr(p, "lname", name);
+ Delete(name);
}
i++;
p = nextSibling(p);
@@ -327,10 +316,10 @@ private:
Parm *p;
Parm *pnext;
int lines = 0;
- int start_arg_num = is_wrapping_class() ? 1 : 0;
+ int arg_num = is_wrapping_class() ? 1 : 0;
const int maxwidth = 80;
- addMissingParameterNames(plist, start_arg_num); // for $1_name substitutions done in Swig_typemap_attach_parms
+ addMissingParameterNames(n, plist, arg_num); // for $1_name substitutions done in Swig_typemap_attach_parms
Swig_typemap_attach_parms("in", plist, 0);
Swig_typemap_attach_parms("doc", plist, 0);
@@ -340,7 +329,7 @@ private:
return doc;
}
- for (p = plist; p; p = pnext) {
+ for (p = plist; p; p = pnext, arg_num++) {
String *tm = Getattr(p, "tmap:in");
if (tm) {
@@ -363,9 +352,10 @@ private:
}
// Note: the generated name should be consistent with that in kwnames[]
- name = name ? name : Getattr(p, "name");
- name = name ? name : Getattr(p, "lname");
- name = Swig_name_make(p, 0, name, 0, 0); // rename parameter if a keyword
+ String *made_name = 0;
+ if (!name) {
+ name = made_name = makeParameterName(n, p, arg_num);
+ }
type = type ? type : Getattr(p, "type");
value = value ? value : Getattr(p, "value");
@@ -416,7 +406,7 @@ private:
Printf(doc, "=%s", value);
}
Delete(type_str);
- Delete(name);
+ Delete(made_name);
}
if (pdocs)
Setattr(n, "feature:pdocs", pdocs);
@@ -436,7 +426,7 @@ private:
String *make_autodoc(Node *n, autodoc_t ad_type) {
int extended = 0;
- // If the function is overloaded then this funciton is called
+ // If the function is overloaded then this function is called
// for the last one. Rewind to the first so the docstrings are
// in order.
while (Getattr(n, "sym:previousSibling"))
@@ -522,7 +512,7 @@ private:
last_mode = ad_type;
last_autodoc = Copy(methodName);
- String *doc = NewString("/*\n");
+ String *doc = NewString("");
int counter = 0;
bool skipAuto = false;
Node* on = n;
@@ -762,7 +752,6 @@ private:
n = Getattr(n, "sym:nextSibling");
}
- Append(doc, "\n*/\n");
Delete(full_name);
Delete(class_name);
Delete(super_names);
@@ -844,7 +833,6 @@ public:
virtual void main(int argc, char *argv[]) {
- int cppcast = 1;
int autorename = 0;
/* Set location of SWIG library */
@@ -883,12 +871,6 @@ public:
multipleInheritance = true;
director_multiple_inheritance = 1;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-cppcast") == 0) {
- cppcast = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nocppcast") == 0) {
- cppcast = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-autorename") == 0) {
autorename = 1;
Swig_mark_arg(i);
@@ -907,15 +889,17 @@ public:
}
} else if (strcmp(argv[i], "-help") == 0) {
Printf(stdout, "%s\n", usage);
+ } else if (strcmp(argv[i], "-cppcast") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
+ Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-nocppcast") == 0) {
+ Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
+ Swig_mark_arg(i);
+ SWIG_exit(EXIT_FAILURE);
}
}
}
- if (cppcast) {
- /* Turn on cppcast mode */
- Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
- }
-
if (autorename) {
/* Turn on the autorename mode */
Preprocessor_define((DOH *) "SWIG_RUBY_AUTORENAME", 0);
@@ -1316,7 +1300,13 @@ public:
Iterator alias = First(aliases);
while (alias.item) {
if (Len(alias.item) > 0) {
- if (multipleInheritance) {
+ if (current == NO_CPP) {
+ if (useGlobalModule) {
+ Printv(f_init, tab4, "rb_define_alias(rb_cObject, \"", alias.item, "\", \"", iname, "\");\n", NIL);
+ } else {
+ Printv(f_init, tab4, "rb_define_alias(rb_singleton_class(", modvar, "), \"", alias.item, "\", \"", iname, "\");\n", NIL);
+ }
+ } else if (multipleInheritance) {
Printv(klass->init, tab4, "rb_define_alias(", klass->mImpl, ", \"", alias.item, "\", \"", iname, "\");\n", NIL);
} else {
Printv(klass->init, tab4, "rb_define_alias(", klass->vname, ", \"", alias.item, "\", \"", iname, "\");\n", NIL);
@@ -2925,7 +2915,7 @@ public:
Wrapper *w = NewWrapper();
String *call;
String *basetype = Getattr(parent, "classtype");
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
+ String *target = Swig_method_decl(0, decl, classname, parms, 0);
call = Swig_csuperclass_call(0, basetype, superparms);
Printf(w->def, "%s::%s: %s, Swig::Director(self) { }", classname, target, call);
Delete(target);
@@ -2936,7 +2926,7 @@ public:
/* constructor header */
{
- String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
+ String *target = Swig_method_decl(0, decl, classname, parms, 1);
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@@ -3046,7 +3036,7 @@ public:
if (argc > 0) {
Printf(w->code, "%s = rb_funcall(swig_get_self(), rb_intern(\"%s\"), %d%s);\n", Swig_cresult_name(), methodName, argc, args);
} else {
- Printf(w->code, "%s = rb_funcall(swig_get_self(), rb_intern(\"%s\"), 0, NULL);\n", Swig_cresult_name(), methodName);
+ Printf(w->code, "%s = rb_funcall(swig_get_self(), rb_intern(\"%s\"), 0, Qnil);\n", Swig_cresult_name(), methodName);
}
if ( initstack ) Printf(w->code, "SWIG_RELEASE_STACK;\n");
}
@@ -3102,16 +3092,20 @@ public:
String *pclassname = NewStringf("SwigDirector_%s", classname);
String *qualified_name = NewStringf("%s::%s", pclassname, name);
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
- target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
+ target = Swig_method_decl(rtype, decl, qualified_name, l, 0);
Printf(w->def, "%s", target);
Delete(qualified_name);
Delete(target);
/* header declaration */
- target = Swig_method_decl(rtype, decl, name, l, 0, 1);
+ target = Swig_method_decl(rtype, decl, name, l, 1);
Printf(declaration, " virtual %s", target);
Delete(target);
// Get any exception classes in the throws typemap
+ if (Getattr(n, "noexcept")) {
+ Append(w->def, " noexcept");
+ Append(declaration, " noexcept");
+ }
ParmList *throw_parm_list = 0;
if ((throw_parm_list = Getattr(n, "throws")) || Getattr(n, "throw")) {
@@ -3150,9 +3144,19 @@ public:
* if the return value is a reference or const reference, a specialized typemap must
* handle it, including declaration of c_result ($result).
*/
- if (!is_void) {
- if (!(ignored_method && !pure_virtual)) {
- Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), NIL);
+ if (!is_void && (!ignored_method || pure_virtual)) {
+ if (!SwigType_isclass(returntype)) {
+ if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
+ String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
+ Delete(construct_result);
+ } else {
+ Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
+ }
+ } else {
+ String *cres = SwigType_lstr(returntype, "c_result");
+ Printf(w->code, "%s;\n", cres);
+ Delete(cres);
}
}
@@ -3174,7 +3178,7 @@ public:
Swig_director_parms_fixup(l);
Swig_typemap_attach_parms("in", l, 0);
- Swig_typemap_attach_parms("directorin", l, 0);
+ Swig_typemap_attach_parms("directorin", l, w);
Swig_typemap_attach_parms("directorargout", l, w);
char source[256];
diff --git a/Source/Modules/scilab.cxx b/Source/Modules/scilab.cxx
index 5997b5876..23e45f787 100644
--- a/Source/Modules/scilab.cxx
+++ b/Source/Modules/scilab.cxx
@@ -18,13 +18,14 @@ static const int SCILAB_VARIABLE_NAME_CHAR_MAX = SCILAB_IDENTIFIER_NAME_CHAR_MAX
static const char *usage = (char *) " \
Scilab options (available with -scilab)\n \
- -builder - Generate a Scilab builder script\n \
- -buildercflags <cflags> - Add <cflags> to the builder compiler flags\n \
- -builderflagscript <file> - Set the Scilab script <file> to use by builder to configure the build flags\n \
- -builderldflags <ldflags> - Add <ldflags> to the builder linker flags\n \
- -buildersources <files> - Add the (comma separated) files <files> to the builder sources\n \
- -builderverbositylevel <level> - Set the builder verbosity level to <level> (default 0: off, 2: high)\n \
- -gatewayxml <gateway_id> - Generate gateway xml with the given <gateway_id>\n \
+ -builder - Generate a Scilab builder script\n \
+ -buildercflags <cflags> - Add <cflags> to the builder compiler flags\n \
+ -builderflagscript <file> - Set the Scilab script <file> to use by builder to configure the build flags\n \
+ -builderldflags <ldflags> - Add <ldflags> to the builder linker flags\n \
+ -buildersources <files> - Add the (comma separated) files <files> to the builder sources\n \
+ -builderverbositylevel <level> - Set the builder verbosity level to <level> (default 0: off, 2: high)\n \
+ -gatewayxml <gateway_id> - Generate gateway xml with the given <gateway_id>\n \
+ -targetversion <scilab_major_version> - Generate for Scilab target (major) version (default: 5)\n \
\n";
@@ -39,6 +40,8 @@ protected:
String *variablesCode;
+ int targetVersion;
+
bool generateBuilder;
File *builderFile;
String *builderCode;
@@ -71,6 +74,7 @@ public:
* ----------------------------------------------------------------------*/
virtual void main(int argc, char *argv[]) {
+ targetVersion = 5;
generateBuilder = false;
sourceFileList = NewList();
@@ -95,48 +99,54 @@ public:
/* Manage command line arguments */
for (int argIndex = 1; argIndex < argc; argIndex++) {
if (argv[argIndex] != NULL) {
- if (strcmp(argv[argIndex], "-help") == 0) {
- Printf(stdout, "%s\n", usage);
- } else if (strcmp(argv[argIndex], "-builder") == 0) {
- Swig_mark_arg(argIndex);
- generateBuilder = true;
- createLoader = false;
- } else if (strcmp(argv[argIndex], "-buildersources") == 0) {
- if (argv[argIndex + 1] != NULL) {
- Swig_mark_arg(argIndex);
- char *sourceFile = strtok(argv[argIndex + 1], ",");
- while (sourceFile != NULL) {
- Insert(sourceFileList, Len(sourceFileList), sourceFile);
- sourceFile = strtok(NULL, ",");
- }
- Swig_mark_arg(argIndex + 1);
- }
- } else if (strcmp(argv[argIndex], "-buildercflags") == 0) {
- Swig_mark_arg(argIndex);
- if (argv[argIndex + 1] != NULL) {
- Insert(cflags, Len(cflags), argv[argIndex + 1]);
- Swig_mark_arg(argIndex + 1);
- }
- } else if (strcmp(argv[argIndex], "-builderldflags") == 0) {
- Swig_mark_arg(argIndex);
- if (argv[argIndex + 1] != NULL) {
- Insert(ldflags, Len(ldflags), argv[argIndex + 1]);
- Swig_mark_arg(argIndex + 1);
- }
- } else if (strcmp(argv[argIndex], "-builderverbositylevel") == 0) {
- Swig_mark_arg(argIndex);
- verboseBuildLevel = NewString(argv[argIndex + 1]);
- Swig_mark_arg(argIndex + 1);
- } else if (strcmp(argv[argIndex], "-builderflagscript") == 0) {
- Swig_mark_arg(argIndex);
- buildFlagsScript = NewString(argv[argIndex + 1]);
- Swig_mark_arg(argIndex + 1);
- } else if (strcmp(argv[argIndex], "-gatewayxml") == 0) {
- Swig_mark_arg(argIndex);
- createGatewayXML = true;
- gatewayID = NewString(argv[argIndex + 1]);
- Swig_mark_arg(argIndex + 1);
- }
+ if (strcmp(argv[argIndex], "-help") == 0) {
+ Printf(stdout, "%s\n", usage);
+ } else if (strcmp(argv[argIndex], "-builder") == 0) {
+ Swig_mark_arg(argIndex);
+ generateBuilder = true;
+ createLoader = false;
+ } else if (strcmp(argv[argIndex], "-buildersources") == 0) {
+ if (argv[argIndex + 1] != NULL) {
+ Swig_mark_arg(argIndex);
+ char *sourceFile = strtok(argv[argIndex + 1], ",");
+ while (sourceFile != NULL) {
+ Insert(sourceFileList, Len(sourceFileList), sourceFile);
+ sourceFile = strtok(NULL, ",");
+ }
+ Swig_mark_arg(argIndex + 1);
+ }
+ } else if (strcmp(argv[argIndex], "-buildercflags") == 0) {
+ Swig_mark_arg(argIndex);
+ if (argv[argIndex + 1] != NULL) {
+ Insert(cflags, Len(cflags), argv[argIndex + 1]);
+ Swig_mark_arg(argIndex + 1);
+ }
+ } else if (strcmp(argv[argIndex], "-builderldflags") == 0) {
+ Swig_mark_arg(argIndex);
+ if (argv[argIndex + 1] != NULL) {
+ Insert(ldflags, Len(ldflags), argv[argIndex + 1]);
+ Swig_mark_arg(argIndex + 1);
+ }
+ } else if (strcmp(argv[argIndex], "-builderverbositylevel") == 0) {
+ Swig_mark_arg(argIndex);
+ verboseBuildLevel = NewString(argv[argIndex + 1]);
+ Swig_mark_arg(argIndex + 1);
+ } else if (strcmp(argv[argIndex], "-builderflagscript") == 0) {
+ Swig_mark_arg(argIndex);
+ buildFlagsScript = NewString(argv[argIndex + 1]);
+ Swig_mark_arg(argIndex + 1);
+ } else if (strcmp(argv[argIndex], "-gatewayxml") == 0) {
+ Swig_mark_arg(argIndex);
+ createGatewayXML = true;
+ gatewayID = NewString(argv[argIndex + 1]);
+ Swig_mark_arg(argIndex + 1);
+ } else if (strcmp(argv[argIndex], "-targetversion") == 0) {
+ if (argv[argIndex + 1] != NULL) {
+ Swig_mark_arg(argIndex);
+ targetVersion = atoi(argv[argIndex + 1]);
+ Swig_mark_arg(argIndex + 1);
+ }
+ }
}
}
@@ -486,7 +496,7 @@ public:
/* Add the failure cleanup code */
/* TODO */
- /* Final substititions if applicable */
+ /* Final substitutions if applicable */
Replaceall(wrapper->code, "$symname", functionName);
/* Set CheckInputArgument and CheckOutputArgument input arguments */
@@ -784,57 +794,61 @@ public:
/* -----------------------------------------------------------------------
* checkIdentifierName()
- * Truncates (and displays a warning) for too long identifier names
- * (applies on functions, variables, constants...)
- * (Scilab identifiers names are limited to 24 chars max)
+ * If Scilab target version is lower than 6:
+ * truncates (and displays a warning) too long member identifier names
+ * (applies on members of structs, classes...)
+ * (Scilab 5 identifier names are limited to 24 chars max)
* ----------------------------------------------------------------------- */
String *checkIdentifierName(String *name, int char_size_max) {
String *scilabIdentifierName;
- if (Len(name) > char_size_max) {
- scilabIdentifierName = DohNewStringWithSize(name, char_size_max);
- Swig_warning(WARN_SCILAB_TRUNCATED_NAME, input_file, line_number,
- "Identifier name '%s' exceeds 24 characters and has been truncated to '%s'.\n", name, scilabIdentifierName);
- } else
+ if (targetVersion <= 5) {
+ if (Len(name) > char_size_max) {
+ scilabIdentifierName = DohNewStringWithSize(name, char_size_max);
+ Swig_warning(WARN_SCILAB_TRUNCATED_NAME, input_file, line_number,
+ "Identifier name '%s' exceeds 24 characters and has been truncated to '%s'.\n", name, scilabIdentifierName);
+ } else
scilabIdentifierName = name;
- return scilabIdentifierName;
+ } else {
+ scilabIdentifierName = DohNewString(name);
+ }
+ return scilabIdentifierName;
}
/* -----------------------------------------------------------------------
* checkMemberIdentifierName()
- * Truncates (and displays a warning) too long member identifier names
- * (applies on members of structs, classes...)
- * (Scilab identifiers names are limited to 24 chars max)
+ * If Scilab target version is lower than 6:
+ * truncates (and displays a warning) too long member identifier names
+ * (applies on members of structs, classes...)
+ * (Scilab 5 identifier names are limited to 24 chars max)
* ----------------------------------------------------------------------- */
void checkMemberIdentifierName(Node *node, int char_size_max) {
-
- String *memberName = Getattr(node, "sym:name");
-
- Node *containerNode = parentNode(node);
- String *containerName = Getattr(containerNode, "sym:name");
-
- int lenContainerName = Len(containerName);
- int lenMemberName = Len(memberName);
-
- if (lenContainerName + lenMemberName + 1 > char_size_max) {
- int lenScilabMemberName = char_size_max - lenContainerName - 1;
-
- if (lenScilabMemberName > 0) {
- String *scilabMemberName = DohNewStringWithSize(memberName, lenScilabMemberName);
- Setattr(node, "sym:name", scilabMemberName);
- Swig_warning(WARN_SCILAB_TRUNCATED_NAME, input_file, line_number,
- "Wrapping functions names for member '%s.%s' will exceed 24 characters, "
- "so member name has been truncated to '%s'.\n", containerName, memberName, scilabMemberName);
- } else
- Swig_error(input_file, line_number,
- "Wrapping functions names for member '%s.%s' will exceed 24 characters, "
- "please rename the container of member '%s'.\n", containerName, memberName, containerName);
+ if (targetVersion <= 5) {
+ String *memberName = Getattr(node, "sym:name");
+ Node *containerNode = parentNode(node);
+ String *containerName = Getattr(containerNode, "sym:name");
+ int lenContainerName = Len(containerName);
+ int lenMemberName = Len(memberName);
+
+ if (lenContainerName + lenMemberName + 1 > char_size_max) {
+ int lenScilabMemberName = char_size_max - lenContainerName - 1;
+
+ if (lenScilabMemberName > 0) {
+ String *scilabMemberName = DohNewStringWithSize(memberName, lenScilabMemberName);
+ Setattr(node, "sym:name", scilabMemberName);
+ Swig_warning(WARN_SCILAB_TRUNCATED_NAME, input_file, line_number,
+ "Wrapping functions names for member '%s.%s' will exceed 24 characters, "
+ "so member name has been truncated to '%s'.\n", containerName, memberName, scilabMemberName);
+ } else {
+ Swig_error(input_file, line_number,
+ "Wrapping functions names for member '%s.%s' will exceed 24 characters, "
+ "please rename the container of member '%s'.\n", containerName, memberName, containerName);
+ }
+ }
}
}
-
-
/* -----------------------------------------------------------------------
* addHelperFunctions()
* ----------------------------------------------------------------------- */
@@ -1013,8 +1027,14 @@ public:
Printf(gatewayHeader, "\n");
gatewayHeaderV6 = NewString("");
+ Printf(gatewayHeaderV6, "#ifdef __cplusplus\n");
+ Printf(gatewayHeaderV6, "extern \"C\" {\n");
+ Printf(gatewayHeaderV6, "#endif\n");
Printf(gatewayHeaderV6, "#include \"c_gateway_prototype.h\"\n");
Printf(gatewayHeaderV6, "#include \"addfunction.h\"\n");
+ Printf(gatewayHeaderV6, "#ifdef __cplusplus\n");
+ Printf(gatewayHeaderV6, "}\n");
+ Printf(gatewayHeaderV6, "#endif\n");
Printf(gatewayHeaderV6, "\n");
Printf(gatewayHeaderV6, "#define MODULE_NAME L\"%s\"\n", gatewayLibraryName);
Printf(gatewayHeaderV6, "#ifdef __cplusplus\n");
diff --git a/Source/Modules/swigmain.cxx b/Source/Modules/swigmain.cxx
index 397677fc5..8d52af194 100644
--- a/Source/Modules/swigmain.cxx
+++ b/Source/Modules/swigmain.cxx
@@ -26,79 +26,62 @@
can be dynamically loaded in future versions. */
extern "C" {
- Language *swig_tcl(void);
- Language *swig_python(void);
- Language *swig_perl5(void);
- Language *swig_ruby(void);
+ Language *swig_csharp(void);
+ Language *swig_d(void);
+ Language *swig_go(void);
Language *swig_guile(void);
- Language *swig_modula3(void);
- Language *swig_mzscheme(void);
Language *swig_java(void);
- Language *swig_php(void);
- Language *swig_php4(void);
- Language *swig_php5(void);
+ Language *swig_javascript(void);
+ Language *swig_lua(void);
+ Language *swig_mzscheme(void);
Language *swig_ocaml(void);
Language *swig_octave(void);
- Language *swig_pike(void);
- Language *swig_sexp(void);
- Language *swig_xml(void);
- Language *swig_chicken(void);
- Language *swig_csharp(void);
- Language *swig_allegrocl(void);
- Language *swig_lua(void);
- Language *swig_clisp(void);
- Language *swig_cffi(void);
- Language *swig_uffi(void);
+ Language *swig_perl5(void);
+ Language *swig_php(void);
+ Language *swig_python(void);
Language *swig_r(void);
+ Language *swig_ruby(void);
Language *swig_scilab(void);
- Language *swig_go(void);
- Language *swig_d(void);
- Language *swig_javascript(void);
+ Language *swig_tcl(void);
+ Language *swig_xml(void);
}
-struct swig_module {
- const char *name;
- ModuleFactory fac;
- const char *help;
-};
-
/* Association of command line options to language modules.
Place an entry for new language modules here, keeping the
list sorted alphabetically. */
-static swig_module modules[] = {
- {"-allegrocl", swig_allegrocl, "ALLEGROCL"},
- {"-chicken", swig_chicken, "CHICKEN"},
- {"-clisp", swig_clisp, "CLISP"},
- {"-cffi", swig_cffi, "CFFI"},
- {"-csharp", swig_csharp, "C#"},
- {"-d", swig_d, "D"},
- {"-go", swig_go, "Go"},
- {"-guile", swig_guile, "Guile"},
- {"-java", swig_java, "Java"},
- {"-javascript", swig_javascript, "Javascript"},
- {"-lua", swig_lua, "Lua"},
- {"-modula3", swig_modula3, "Modula 3"},
- {"-mzscheme", swig_mzscheme, "Mzscheme"},
- {"-ocaml", swig_ocaml, "Ocaml"},
- {"-octave", swig_octave, "Octave"},
- {"-perl", swig_perl5, "Perl"},
- {"-perl5", swig_perl5, 0},
- {"-php", swig_php5, 0},
- {"-php4", swig_php4, 0},
- {"-php5", swig_php5, "PHP5"},
- {"-php7", swig_php, "PHP7"},
- {"-pike", swig_pike, "Pike"},
- {"-python", swig_python, "Python"},
- {"-r", swig_r, "R (aka GNU S)"},
- {"-ruby", swig_ruby, "Ruby"},
- {"-scilab", swig_scilab, "Scilab"},
- {"-sexp", swig_sexp, "Lisp S-Expressions"},
- {"-tcl", swig_tcl, "Tcl"},
- {"-tcl8", swig_tcl, 0},
- {"-uffi", swig_uffi, "Common Lisp / UFFI"},
- {"-xml", swig_xml, "XML"},
- {NULL, NULL, NULL}
+static TargetLanguageModule modules[] = {
+ {"-allegrocl", NULL, "ALLEGROCL", Disabled},
+ {"-chicken", NULL, "CHICKEN", Disabled},
+ {"-clisp", NULL, "CLISP", Disabled},
+ {"-cffi", NULL, "CFFI", Disabled},
+ {"-csharp", swig_csharp, "C#", Supported},
+ {"-d", swig_d, "D", Supported},
+ {"-go", swig_go, "Go", Supported},
+ {"-guile", swig_guile, "Guile", Supported},
+ {"-java", swig_java, "Java", Supported},
+ {"-javascript", swig_javascript, "Javascript", Supported},
+ {"-lua", swig_lua, "Lua", Supported},
+ {"-modula3", NULL, "Modula 3", Disabled},
+ {"-mzscheme", swig_mzscheme, "MzScheme/Racket", Experimental},
+ {"-ocaml", swig_ocaml, "OCaml", Experimental},
+ {"-octave", swig_octave, "Octave", Supported},
+ {"-perl", swig_perl5, NULL, Supported},
+ {"-perl5", swig_perl5, "Perl 5", Supported},
+ {"-php", swig_php, NULL, Supported},
+ {"-php5", NULL, "PHP 5", Disabled},
+ {"-php7", swig_php, "PHP 7", Supported},
+ {"-pike", NULL, "Pike", Disabled},
+ {"-python", swig_python, "Python", Supported},
+ {"-r", swig_r, "R (aka GNU S)", Supported},
+ {"-ruby", swig_ruby, "Ruby", Supported},
+ {"-scilab", swig_scilab, "Scilab", Supported},
+ {"-sexp", NULL, "Lisp S-Expressions", Disabled},
+ {"-tcl", swig_tcl, NULL, Supported},
+ {"-tcl8", swig_tcl, "Tcl 8", Supported},
+ {"-uffi", NULL, "Common Lisp / UFFI", Disabled},
+ {"-xml", swig_xml, "XML", Supported},
+ {NULL, NULL, NULL, Disabled}
};
#ifdef MACSWIG
@@ -106,10 +89,6 @@ static swig_module modules[] = {
#include <SIOUX.h>
#endif
-#ifndef SWIG_LANG
-#define SWIG_LANG "-python"
-#endif
-
//-----------------------------------------------------------------
// main()
//
@@ -119,13 +98,14 @@ static swig_module modules[] = {
void SWIG_merge_envopt(const char *env, int oargc, char *oargv[], int *nargc, char ***nargv) {
if (!env) {
*nargc = oargc;
- *nargv = oargv;
+ *nargv = (char **)malloc(sizeof(char *) * (oargc + 1));
+ memcpy(*nargv, oargv, sizeof(char *) * (oargc + 1));
return;
}
int argc = 1;
int arge = oargc + 1024;
- char **argv = (char **) malloc(sizeof(char *) * (arge));
+ char **argv = (char **) malloc(sizeof(char *) * (arge + 1));
char *buffer = (char *) malloc(2048);
char *b = buffer;
char *be = b + 1023;
@@ -147,49 +127,139 @@ void SWIG_merge_envopt(const char *env, int oargc, char *oargv[], int *nargc, ch
for (int i = 1; (i < oargc) && (argc < arge); ++i, ++argc) {
argv[argc] = oargv[i];
}
+ argv[argc] = NULL;
*nargc = argc;
*nargv = argv;
}
+static void insert_option(int *argc, char ***argv, int index, char const *start, char const *end) {
+ int new_argc = *argc;
+ char **new_argv = *argv;
+ size_t option_len = end - start;
+
+ // Preserve the NULL pointer at argv[argc]
+ new_argv = (char **)realloc(new_argv, (new_argc + 2) * sizeof(char *));
+ memmove(&new_argv[index + 1], &new_argv[index], sizeof(char *) * (new_argc + 1 - index));
+ new_argc++;
+
+ new_argv[index] = (char *)malloc(option_len + 1);
+ memcpy(new_argv[index], start, option_len);
+ new_argv[index][option_len] = '\0';
+
+ *argc = new_argc;
+ *argv = new_argv;
+}
+
+static void merge_options_files(int *argc, char ***argv) {
+ static const int BUFFER_SIZE = 4096;
+ char buffer[BUFFER_SIZE];
+ int i;
+ int insert;
+ char **new_argv = *argv;
+ int new_argc = *argc;
+ FILE *f;
+
+ i = 1;
+ while (i < new_argc) {
+ if (new_argv[i] && new_argv[i][0] == '@' && (f = fopen(&new_argv[i][1], "r"))) {
+ char c;
+ char *b;
+ char *be = &buffer[BUFFER_SIZE];
+ int quote = 0;
+ bool escape = false;
+
+ new_argc--;
+ memmove(&new_argv[i], &new_argv[i + 1], sizeof(char *) * (new_argc - i));
+ insert = i;
+ b = buffer;
+
+ while ((c = fgetc(f)) != EOF) {
+ if (escape) {
+ if (b != be) {
+ *b = c;
+ ++b;
+ }
+ escape = false;
+ } else if (c == '\\') {
+ escape = true;
+ } else if (!quote && (c == '\'' || c == '"')) {
+ quote = c;
+ } else if (quote && c == quote) {
+ quote = 0;
+ } else if (isspace(c) && !quote) {
+ if (b != buffer) {
+ insert_option(&new_argc, &new_argv, insert, buffer, b);
+ insert++;
+
+ b = buffer;
+ }
+ } else if (b != be) {
+ *b = c;
+ ++b;
+ }
+ }
+ if (b != buffer)
+ insert_option(&new_argc, &new_argv, insert, buffer, b);
+ fclose(f);
+ } else {
+ ++i;
+ }
+ }
+
+ *argv = new_argv;
+ *argc = new_argc;
+}
+
int main(int margc, char **margv) {
int i;
- Language *dl = 0;
- ModuleFactory fac = 0;
+ const TargetLanguageModule *language_module = 0;
int argc;
char **argv;
SWIG_merge_envopt(getenv("SWIG_FEATURES"), margc, margv, &argc, &argv);
+ merge_options_files(&argc, &argv);
#ifdef MACSWIG
SIOUXSettings.asktosaveonclose = false;
argc = ccommand(&argv);
#endif
- /* Register built-in modules */
- for (i = 0; modules[i].name; i++) {
- Swig_register_module(modules[i].name, modules[i].fac);
- }
-
Swig_init_args(argc, argv);
/* Get options */
for (i = 1; i < argc; i++) {
if (argv[i]) {
- fac = Swig_find_module(argv[i]);
- if (fac) {
- dl = (fac) ();
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nolang") == 0) {
- dl = new Language;
+ bool is_target_language_module = false;
+ for (int j = 0; modules[j].name; j++) {
+ if (strcmp(modules[j].name, argv[i]) == 0) {
+ language_module = &modules[j];
+ is_target_language_module = true;
+ break;
+ }
+ }
+ if (is_target_language_module) {
Swig_mark_arg(i);
+ if (language_module->status == Disabled) {
+ if (language_module->help)
+ Printf(stderr, "Target language option %s (%s) is no longer supported.\n", language_module->name, language_module->help);
+ else
+ Printf(stderr, "Target language option %s is no longer supported.\n", language_module->name);
+ SWIG_exit(EXIT_FAILURE);
+ }
} else if ((strcmp(argv[i], "-help") == 0) || (strcmp(argv[i], "--help") == 0)) {
if (strcmp(argv[i], "--help") == 0)
strcpy(argv[i], "-help");
- Printf(stdout, "Target Language Options\n");
+ Printf(stdout, "Supported Target Language Options\n");
for (int j = 0; modules[j].name; j++) {
- if (modules[j].help) {
+ if (modules[j].help && modules[j].status == Supported) {
+ Printf(stdout, " %-15s - Generate %s wrappers\n", modules[j].name, modules[j].help);
+ }
+ }
+ Printf(stdout, "\nExperimental Target Language Options\n");
+ for (int j = 0; modules[j].name; j++) {
+ if (modules[j].help && modules[j].status == Experimental) {
Printf(stdout, " %-15s - Generate %s wrappers\n", modules[j].name, modules[j].help);
}
}
@@ -197,14 +267,8 @@ int main(int margc, char **margv) {
}
}
}
- if (!dl) {
- fac = Swig_find_module(SWIG_LANG);
- if (fac) {
- dl = (fac) ();
- }
- }
- int res = SWIG_main(argc, argv, dl);
+ int res = SWIG_main(argc, argv, language_module);
return res;
}
diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h
index 34763cc09..bfb93d1a7 100644
--- a/Source/Modules/swigmod.h
+++ b/Source/Modules/swigmod.h
@@ -214,8 +214,8 @@ public:
virtual Hash* symbolAddScope(const_String_or_char_ptr scope);
virtual Hash* symbolScopeLookup(const_String_or_char_ptr scope);
virtual Hash* symbolScopePseudoSymbolLookup(const_String_or_char_ptr scope);
- virtual Node *classLookup(const SwigType *s) const; /* Class lookup */
- virtual Node *enumLookup(SwigType *s); /* Enum lookup */
+ static Node *classLookup(const SwigType *s); /* Class lookup */
+ static Node *enumLookup(SwigType *s); /* Enum lookup */
virtual int abstractClassTest(Node *n); /* Is class really abstract? */
virtual int is_assignable(Node *n); /* Is variable assignable? */
virtual String *runtimeCode(); /* returns the language specific runtime code */
@@ -342,10 +342,11 @@ protected:
/* Director language module */
int director_language;
+ /* Used to translate Doxygen comments to target documentation format */
+ class DoxygenTranslator *doxygenTranslator;
+
private:
Hash *symtabs; /* symbol tables */
- Hash *classtypes;
- Hash *enumtypes;
int overloading;
int multiinput;
int cplus_runtime;
@@ -353,10 +354,23 @@ private:
static Language *this_;
};
-int SWIG_main(int, char **, Language *);
+extern "C" {
+ void SWIG_typemap_lang(const char *);
+ typedef Language *(*ModuleFactory) (void);
+}
+
+enum Status {Disabled, Experimental, Supported};
+
+struct TargetLanguageModule {
+ const char *name;
+ ModuleFactory fac;
+ const char *help;
+ Status status;
+};
+
+int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm);
void emit_parameter_variables(ParmList *l, Wrapper *f);
void emit_return_variable(Node *n, SwigType *rt, Wrapper *f);
-void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */
void SWIG_config_file(const_String_or_char_ptr );
const String *SWIG_output_directory();
void SWIG_config_cppext(const char *ext);
@@ -368,15 +382,15 @@ List *SWIG_output_files();
void SWIG_library_directory(const char *);
int emit_num_arguments(ParmList *);
int emit_num_required(ParmList *);
-int emit_isvarargs(ParmList *);
+int emit_isvarargs(ParmList *p);
+bool emit_isvarargs_function(Node *n);
void emit_attach_parmmaps(ParmList *, Wrapper *f);
void emit_mark_varargs(ParmList *l);
String *emit_action(Node *n);
int emit_action_code(Node *n, String *wrappercode, String *action);
void Swig_overload_check(Node *n);
-String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *);
+String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *, const_String_or_char_ptr fmt_fastdispatch = 0);
String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *);
-String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *);
List *Swig_overload_rank(Node *n, bool script_lang_wrapping);
SwigType *cplus_value_type(SwigType *t);
@@ -385,20 +399,12 @@ String *Swig_csuperclass_call(String *base, String *method, ParmList *l);
String *Swig_class_declaration(Node *n, String *name);
String *Swig_class_name(Node *n);
String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms);
-String *Swig_method_decl(SwigType *rtype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values);
+String *Swig_method_decl(SwigType *return_base_type, SwigType *decl, const_String_or_char_ptr id, List *args, int default_args);
String *Swig_director_declaration(Node *n);
void Swig_director_emit_dynamic_cast(Node *n, Wrapper *f);
void Swig_director_parms_fixup(ParmList *parms);
/* directors.cxx end */
-extern "C" {
- void SWIG_typemap_lang(const char *);
- typedef Language *(*ModuleFactory) (void);
-}
-
-void Swig_register_module(const char *name, ModuleFactory fac);
-ModuleFactory Swig_find_module(const char *name);
-
/* Utilities */
int is_public(Node *n);
diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx
index 1227af79c..7a78ede9b 100644
--- a/Source/Modules/tcl8.cxx
+++ b/Source/Modules/tcl8.cxx
@@ -15,7 +15,7 @@
#include "cparse.h"
static const char *usage = "\
-Tcl 8 Options (available with -tcl)\n\
+Tcl 8 Options (available with -tcl8)\n\
-itcl - Enable ITcl support\n\
-nosafe - Leave out SafeInit module function.\n\
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
@@ -76,7 +76,6 @@ public:
* ------------------------------------------------------------ */
virtual void main(int argc, char *argv[]) {
- int cppcast = 1;
SWIG_library_directory("tcl");
@@ -106,22 +105,19 @@ public:
} else if (strcmp(argv[i], "-nosafe") == 0) {
nosafe = 1;
Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-help") == 0) {
+ fputs(usage, stdout);
} else if (strcmp(argv[i], "-cppcast") == 0) {
- cppcast = 1;
+ Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-nocppcast") == 0) {
- cppcast = 0;
+ Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-help") == 0) {
- fputs(usage, stdout);
+ SWIG_exit(EXIT_FAILURE);
}
}
}
- if (cppcast) {
- Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
- }
-
Preprocessor_define("SWIGTCL 1", 0);
// SWIGTCL8 is deprecated, and no longer documented.
Preprocessor_define("SWIGTCL8 1", 0);
diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx
index bf8028c29..8dbf0865e 100644
--- a/Source/Modules/typepass.cxx
+++ b/Source/Modules/typepass.cxx
@@ -187,8 +187,10 @@ class TypePass:private Dispatcher {
ilist = alist = NewList();
Append(ilist, bcls);
} else {
- Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bname), Getline(bname), "Base class '%s' has no name as it is an empty template instantiated with '%%template()'. Ignored.\n", SwigType_namestr(bname));
- Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bcls), Getline(bcls), "The %%template directive must be written before '%s' is used as a base class and be declared with a name.\n", SwigType_namestr(bname));
+ if (!GetFlag(bcls, "feature:ignore")) {
+ Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bname), Getline(bname), "Base class '%s' has no name as it is an empty template instantiated with '%%template()'. Ignored.\n", SwigType_namestr(bname));
+ Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bcls), Getline(bcls), "The %%template directive must be written before '%s' is used as a base class and be declared with a name.\n", SwigType_namestr(bname));
+ }
}
}
break;
@@ -209,8 +211,10 @@ class TypePass:private Dispatcher {
ilist = alist = NewList();
Append(ilist, bcls);
} else {
- Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bname), Getline(bname), "Base class '%s' has no name as it is an empty template instantiated with '%%template()'. Ignored.\n", SwigType_namestr(bname));
- Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bcls), Getline(bcls), "The %%template directive must be written before '%s' is used as a base class and be declared with a name.\n", SwigType_namestr(bname));
+ if (!GetFlag(bcls, "feature:ignore")) {
+ Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bname), Getline(bname), "Base class '%s' has no name as it is an empty template instantiated with '%%template()'. Ignored.\n", SwigType_namestr(bname));
+ Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bcls), Getline(bcls), "The %%template directive must be written before '%s' is used as a base class and be declared with a name.\n", SwigType_namestr(bname));
+ }
}
} else {
Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(bname), Getline(bname), "Base class '%s' undefined.\n", SwigType_namestr(bname));
@@ -957,7 +961,7 @@ class TypePass:private Dispatcher {
if (Getattr(c, "sym:overloaded") != checkoverloaded) {
Printf(stdout, "sym:overloaded error c:%p checkoverloaded:%p\n", c, checkoverloaded);
Swig_print_node(c);
- exit (1);
+ SWIG_exit(EXIT_FAILURE);
}
String *decl = Strcmp(nodeType(c), "using") == 0 ? NewString("------") : Getattr(c, "decl");
@@ -965,7 +969,7 @@ class TypePass:private Dispatcher {
if (!Getattr(c, "sym:overloaded")) {
Printf(stdout, "sym:overloaded error.....%p\n", c);
Swig_print_node(c);
- exit (1);
+ SWIG_exit(EXIT_FAILURE);
}
c = Getattr(c, "sym:nextSibling");
}
@@ -1199,10 +1203,7 @@ class TypePass:private Dispatcher {
} else if (Strcmp(ntype, "enum") == 0) {
SwigType_typedef_using(Getattr(n, "uname"));
} else if (Strcmp(ntype, "template") == 0) {
- /*
- Printf(stdout, "usingDeclaration template %s --- %s\n", Getattr(n, "name"), Getattr(n, "uname"));
SwigType_typedef_using(Getattr(n, "uname"));
- */
}
}
}
diff --git a/Source/Modules/uffi.cxx b/Source/Modules/uffi.cxx
index d56ed3b1f..10a53a561 100644
--- a/Source/Modules/uffi.cxx
+++ b/Source/Modules/uffi.cxx
@@ -363,23 +363,24 @@ int UFFI::classHandler(Node *n) {
for (c = firstChild(n); c; c = nextSibling(c)) {
SwigType *type = Getattr(c, "type");
SwigType *decl = Getattr(c, "decl");
- type = Copy(type);
- SwigType_push(type, decl);
- String *lisp_type;
-
- if (Strcmp(nodeType(c), "cdecl")) {
- Printf(stderr, "Structure %s has a slot that we can't deal with.\n", name);
- Printf(stderr, "nodeType: %s, name: %s, type: %s\n", nodeType(c), Getattr(c, "name"), Getattr(c, "type"));
- SWIG_exit(EXIT_FAILURE);
- }
-
+ if (type) {
+ type = Copy(type);
+ SwigType_push(type, decl);
+ String *lisp_type;
+
+ if (Strcmp(nodeType(c), "cdecl")) {
+ Printf(stderr, "Structure %s has a slot that we can't deal with.\n", name);
+ Printf(stderr, "nodeType: %s, name: %s, type: %s\n", nodeType(c), Getattr(c, "name"), Getattr(c, "type"));
+ SWIG_exit(EXIT_FAILURE);
+ }
- /* Printf(stdout, "Converting %s in %s\n", type, name); */
- lisp_type = get_ffi_type(n, type, Getattr(c, "sym:name"));
+ /* Printf(stdout, "Converting %s in %s\n", type, name); */
+ lisp_type = get_ffi_type(n, type, Getattr(c, "sym:name"));
- Printf(f_cl, " (#.(%s \"%s\" :type :slot) %s)\n", identifier_converter, Getattr(c, "sym:name"), lisp_type);
+ Printf(f_cl, " (#.(%s \"%s\" :type :slot) %s)\n", identifier_converter, Getattr(c, "sym:name"), lisp_type);
- Delete(lisp_type);
+ Delete(lisp_type);
+ }
}
// Language::classHandler(n);
diff --git a/Source/Modules/utils.cxx b/Source/Modules/utils.cxx
index a91ebe098..2964ed3a6 100644
--- a/Source/Modules/utils.cxx
+++ b/Source/Modules/utils.cxx
@@ -59,7 +59,7 @@ int is_non_virtual_protected_access(Node *n) {
// When vtable is empty, the director class does not get emitted, so a check for an empty vtable should be done.
// However, vtable is set in Language and so is not yet set when methods in Typepass call clean_overloaded()
// which calls is_non_virtual_protected_access. So commented out below.
- // Moving the director vtable creation into into Typepass should solve this problem.
+ // Moving the director vtable creation into Typepass should solve this problem.
if (is_member_director_helper(parentNode, n) /* && Getattr(parentNode, "vtable")*/)
result = 1;
}
diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c
index 12d27c316..557b5482b 100644
--- a/Source/Preprocessor/cpp.c
+++ b/Source/Preprocessor/cpp.c
@@ -109,6 +109,19 @@ static String *cpp_include(const_String_or_char_ptr fn, int sysfile) {
return s;
}
+static int is_digits(const String *str) {
+ const char *s = Char(str);
+ int isdigits = (*s != 0);
+ while (*s) {
+ if (!isdigit(*s)) {
+ isdigits = 0;
+ break;
+ }
+ s++;
+ }
+ return isdigits;
+}
+
List *Preprocessor_depend(void) {
return dependencies;
}
@@ -607,6 +620,34 @@ static List *find_args(String *s, int ismacro, String *macro_name) {
skip_tochar(s, '\'', str);
c = Getc(s);
continue;
+ } else if (c == '/') {
+ /* Ensure comments are ignored by eating up the characters */
+ c = Getc(s);
+ /* Handle / * ... * / type comments (multi-line) */
+ if (c == '*') {
+ while ((c = Getc(s)) != EOF) {
+ if (c == '*') {
+ c = Getc(s);
+ if (c == '/' || c == EOF)
+ break;
+ }
+ }
+ c = Getc(s);
+ continue;
+ }
+ /* Handle // ... type comments (single-line) */
+ if (c == '/') {
+ while ((c = Getc(s)) != EOF) {
+ if (c == '\n') {
+ break;
+ }
+ }
+ c = Getc(s);
+ continue;
+ }
+ /* ensure char is available in the stream as this was not a comment*/
+ Ungetc(c, s);
+ c = '/';
}
if ((c == ',') && (level == 0))
break;
@@ -623,13 +664,8 @@ static List *find_args(String *s, int ismacro, String *macro_name) {
goto unterm;
}
Chop(str);
- if (Len(args) || Len(str))
- Append(args, str);
+ Append(args, str);
Delete(str);
-
- /* if (Len(str) && (c != ')'))
- Append(args,str); */
-
if (c == ')')
return args;
c = Getc(s);
@@ -800,11 +836,24 @@ static String *expand_macro(String *name, List *args, String *line_file) {
Delete(vararg);
}
}
+
+ if (args && margs && Len(margs) == 0 && Len(args) == 1 && Len(Getitem(args, 0)) == 0) {
+ /* FOO() can invoke a macro defined as FOO(X) as well as one defined FOO().
+ *
+ * Handle this by removing the only argument if it's empty and the macro
+ * expects no arguments.
+ *
+ * We don't need to worry about varargs here - a varargs macro will always have
+ * Len(margs) >= 1, since the varargs are put in the final macro argument.
+ */
+ Delitem(args, 0);
+ }
+
/* If there are arguments, see if they match what we were given */
- if (args && (margs) && (Len(margs) != Len(args))) {
- if (Len(margs) > (1 + isvarargs))
+ if (args && (!margs || Len(margs) != Len(args))) {
+ if (margs && Len(margs) > (1 + isvarargs))
Swig_error(macro_start_file, macro_start_line, "Macro '%s' expects %d arguments\n", name, Len(margs) - isvarargs);
- else if (Len(margs) == (1 + isvarargs))
+ else if (margs && Len(margs) == (1 + isvarargs))
Swig_error(macro_start_file, macro_start_line, "Macro '%s' expects 1 argument\n", name);
else
Swig_error(macro_start_file, macro_start_line, "Macro '%s' expects no arguments\n", name);
@@ -813,7 +862,7 @@ static String *expand_macro(String *name, List *args, String *line_file) {
}
/* If the macro expects arguments, but none were supplied, we leave it in place */
- if (!args && (margs) && Len(margs) > 0) {
+ if (!args && margs) {
macro_level--;
return NewString(name);
}
@@ -905,19 +954,21 @@ static String *expand_macro(String *name, List *args, String *line_file) {
namelen = Len(aname);
a = strstr(s, name);
while (a) {
- char ca = a[namelen + 1];
+ char ca = a[namelen];
if (!isidchar((int) ca)) {
/* Matched the entire vararg name, not just a prefix */
- t = a - 1;
- if (*t == '\002') {
- t--;
- while (t >= s) {
- if (isspace((int) *t))
- t--;
- else if (*t == ',') {
- *t = ' ';
- } else
- break;
+ if (a > s) {
+ t = a - 1;
+ if (*t == '\002') {
+ t--;
+ while (t >= s) {
+ if (isspace((int) *t))
+ t--;
+ else if (*t == ',') {
+ *t = ' ';
+ } else
+ break;
+ }
}
}
}
@@ -1139,10 +1190,6 @@ static DOH *Preprocessor_replace(DOH *s) {
args = find_args(s, 1, id);
macro_additional_lines = Getline(s) - line;
assert(macro_additional_lines >= 0);
- if (!Len(args)) {
- Delete(args);
- args = 0;
- }
} else {
args = 0;
}
@@ -1431,7 +1478,7 @@ String *Preprocessor_parse(String *s) {
break;
case 41: /* Build up the name of the preprocessor directive */
- if ((isspace(c) || (!isalpha(c)))) {
+ if ((isspace(c) || (!isidchar(c)))) {
Clear(value);
Clear(comment);
if (c == '\n') {
@@ -1450,7 +1497,7 @@ String *Preprocessor_parse(String *s) {
Putc(c, id);
break;
- case 42: /* Strip any leading space before preprocessor value */
+ case 42: /* Strip any leading space after the preprocessor directive (before preprocessor value) */
if (isspace(c)) {
if (c == '\n') {
Ungetc(c, s);
@@ -1770,6 +1817,8 @@ String *Preprocessor_parse(String *s) {
Swig_error(Getfile(s), Getline(id), "cpp debug: level = %d, startlevel = %d\n", level, start_level);
} else if (Equal(id, "")) {
/* Null directive */
+ } else if (is_digits(id)) {
+ /* A gcc linemarker of the form '# linenum filename flags' (resulting from running gcc -E) */
} else {
/* Ignore unknown preprocessor directives which are inside an inactive
* conditional (github issue #394). */
diff --git a/Source/Preprocessor/expr.c b/Source/Preprocessor/expr.c
index 6d22c8c5e..a36588983 100644
--- a/Source/Preprocessor/expr.c
+++ b/Source/Preprocessor/expr.c
@@ -188,12 +188,22 @@ static int reduce_op() {
sp--;
break;
case SWIG_TOKEN_SLASH:
- stack[sp - 2].value = stack[sp - 2].value / stack[sp].value;
- sp -= 2;
+ if (stack[sp].value != 0) {
+ stack[sp - 2].value = stack[sp - 2].value / stack[sp].value;
+ sp -= 2;
+ } else {
+ errmsg = "Division by zero in expression";
+ return 0;
+ }
break;
case SWIG_TOKEN_PERCENT:
- stack[sp - 2].value = stack[sp - 2].value % stack[sp].value;
- sp -= 2;
+ if (stack[sp].value != 0) {
+ stack[sp - 2].value = stack[sp - 2].value % stack[sp].value;
+ sp -= 2;
+ } else {
+ errmsg = "Modulo by zero in expression";
+ return 0;
+ }
break;
case SWIG_TOKEN_LSHIFT:
stack[sp - 2].value = stack[sp - 2].value << stack[sp].value;
@@ -309,6 +319,10 @@ int Preprocessor_expr(DOH *s, int *error) {
stack[sp].value = 0;
stack[sp].svalue = 0;
stack[sp].op = EXPR_VALUE;
+ } else if ((token == SWIG_TOKEN_FLOAT) || (token == SWIG_TOKEN_DOUBLE)) {
+ errmsg = "Floating point constant in preprocessor expression";
+ *error = 1;
+ return 0;
} else
goto syntax_error;
break;
diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c
index 9da4e0829..d6e5e0cdc 100644
--- a/Source/Swig/cwrap.c
+++ b/Source/Swig/cwrap.c
@@ -277,7 +277,7 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
SwigType_del_rvalue_reference(tvalue);
tycode = SwigType_type(tvalue);
if (tycode != T_USER) {
- /* plain primitive type, we copy the the def value */
+ /* plain primitive type, we copy the def value */
String *lstr = SwigType_lstr(tvalue, defname);
defvalue = NewStringf("%s = %s", lstr, qvalue);
Delete(lstr);
@@ -1024,6 +1024,15 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
}
}
+ if (!self && SwigType_isrvalue_reference(Getattr(n, "refqualifier"))) {
+ String *memory_header = NewString("<memory>");
+ Setfile(memory_header, Getfile(n));
+ Setline(memory_header, Getline(n));
+ Swig_fragment_emit(memory_header);
+ self = NewString("std::move(*this).");
+ Delete(memory_header);
+ }
+
call = Swig_cmethod_call(explicitcall_name ? explicitcall_name : name, p, self, explicit_qualifier, director_type);
cres = Swig_cresult(Getattr(n, "type"), Swig_cresult_name(), call);
diff --git a/Source/Swig/error.c b/Source/Swig/error.c
index 2c93cfb21..1dde06652 100644
--- a/Source/Swig/error.c
+++ b/Source/Swig/error.c
@@ -106,13 +106,16 @@ void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const c
}
if (warnall || wrn) {
String *formatted_filename = format_filename(filename);
+ String *full_message = NewString("");
if (wnum) {
- Printf(stderr, wrn_wnum_fmt, formatted_filename, line, wnum);
+ Printf(full_message, wrn_wnum_fmt, formatted_filename, line, wnum);
} else {
- Printf(stderr, wrn_nnum_fmt, formatted_filename, line);
+ Printf(full_message, wrn_nnum_fmt, formatted_filename, line);
}
- Printf(stderr, "%s", msg);
+ Printf(full_message, "%s", msg);
+ Printv(stderr, full_message, NIL);
nwarning++;
+ Delete(full_message);
Delete(formatted_filename);
}
Delete(out);
@@ -128,6 +131,7 @@ void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const c
void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ...) {
va_list ap;
String *formatted_filename = NULL;
+ String *full_message = NULL;
if (silence)
return;
@@ -136,14 +140,17 @@ void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ..
va_start(ap, fmt);
formatted_filename = format_filename(filename);
+ full_message = NewString("");
if (line > 0) {
- Printf(stderr, err_line_fmt, formatted_filename, line);
+ Printf(full_message, err_line_fmt, formatted_filename, line);
} else {
- Printf(stderr, err_eof_fmt, formatted_filename);
+ Printf(full_message, err_eof_fmt, formatted_filename);
}
- vPrintf(stderr, fmt, ap);
+ vPrintf(full_message, fmt, ap);
+ Printv(stderr, full_message, NIL);
va_end(ap);
nerrors++;
+ Delete(full_message);
Delete(formatted_filename);
}
diff --git a/Source/Swig/extend.c b/Source/Swig/extend.c
index 30097b434..70355a245 100644
--- a/Source/Swig/extend.c
+++ b/Source/Swig/extend.c
@@ -106,10 +106,10 @@ void Swig_extend_append_previous(Node *cls, Node *am) {
set_nextSibling(n,0);
/* typemaps and fragments need to be prepended */
if (((Cmp(nodeType(n),"typemap") == 0) || (Cmp(nodeType(n),"fragment") == 0))) {
- if (!pe) pe = new_node("extend");
+ if (!pe) pe = Swig_cparse_new_node("extend");
appendChild(pe, n);
} else {
- if (!ae) ae = new_node("extend");
+ if (!ae) ae = Swig_cparse_new_node("extend");
appendChild(ae, n);
}
n = ne;
diff --git a/Source/Swig/getopt.c b/Source/Swig/getopt.c
index 74076a5f0..6970dc177 100644
--- a/Source/Swig/getopt.c
+++ b/Source/Swig/getopt.c
@@ -16,7 +16,6 @@
* sure there are no unmarked options.
*
* TODO:
- * - This module needs to be modified so that it doesn't call exit().
* Should have cleaner error handling in general.
* ----------------------------------------------------------------------------- */
@@ -88,11 +87,11 @@ void Swig_check_options(int check_input) {
}
if (error) {
Printf(stderr, "Use 'swig -help' for available options.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
if (check_input && marked[numargs - 1]) {
Printf(stderr, "Must specify an input file. Use -help for available options.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
@@ -105,5 +104,5 @@ void Swig_check_options(int check_input) {
void Swig_arg_error(void) {
Printf(stderr, "SWIG : Unable to parse command line options.\n");
Printf(stderr, "Use 'swig -help' for available options.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c
index 91f05c0a2..7b818478f 100644
--- a/Source/Swig/misc.c
+++ b/Source/Swig/misc.c
@@ -523,7 +523,7 @@ String *Swig_string_ucase(String *s) {
/* We insert a underscore when:
1. Lower case char followed by upper case char
getFoo > get_foo; getFOo > get_foo; GETFOO > getfoo
- 2. Number proceded by char and not end of string
+ 2. Number preceded by char and not end of string
get2D > get_2d; get22D > get_22d; GET2D > get_2d
but:
asFloat2 > as_float2
@@ -823,10 +823,11 @@ String *Swig_string_emangle(String *s) {
/* -----------------------------------------------------------------------------
- * Swig_scopename_prefix()
+ * Swig_scopename_split()
*
- * Take a qualified name like "A::B::C" and return the scope name.
- * In this case, "A::B". Returns NULL if there is no base.
+ * Take a qualified name like "A::B::C" and splits off the last name.
+ * In this case, returns "C" as last and "A::B" as prefix.
+ * Always returns non NULL for last, but prefix may be NULL if there is no prefix.
* ----------------------------------------------------------------------------- */
void Swig_scopename_split(const String *s, String **rprefix, String **rlast) {
@@ -882,6 +883,12 @@ void Swig_scopename_split(const String *s, String **rprefix, String **rlast) {
}
}
+/* -----------------------------------------------------------------------------
+ * Swig_scopename_prefix()
+ *
+ * Take a qualified name like "A::B::C" and return the scope name.
+ * In this case, "A::B". Returns NULL if there is no base.
+ * ----------------------------------------------------------------------------- */
String *Swig_scopename_prefix(const String *s) {
char *tmp = Char(s);
@@ -1068,6 +1075,31 @@ String *Swig_scopename_suffix(const String *s) {
}
/* -----------------------------------------------------------------------------
+ * Swig_scopename_tolist()
+ *
+ * Take a qualified scope name like "A::B::C" and convert it to a list.
+ * In this case, return a list of 3 elements "A", "B", "C".
+ * Returns an empty list if the input is empty.
+ * ----------------------------------------------------------------------------- */
+
+List *Swig_scopename_tolist(const String *s) {
+ List *scopes = NewList();
+ String *name = Len(s) == 0 ? 0 : NewString(s);
+
+ while (name) {
+ String *last = 0;
+ String *prefix = 0;
+ Swig_scopename_split(name, &prefix, &last);
+ Insert(scopes, 0, last);
+ Delete(last);
+ Delete(name);
+ name = prefix;
+ }
+ Delete(name);
+ return scopes;
+}
+
+/* -----------------------------------------------------------------------------
* Swig_scopename_check()
*
* Checks to see if a name is qualified with a scope name, examples:
@@ -1117,19 +1149,17 @@ int Swig_scopename_check(const String *s) {
*
* Printf(stderr,"%(command:sed 's/[a-z]/\U\\1/' <<<)s","hello") -> Hello
* ----------------------------------------------------------------------------- */
-#if defined(HAVE_POPEN)
-# if defined(_MSC_VER)
-# define popen _popen
-# define pclose _pclose
-# else
-extern FILE *popen(const char *command, const char *type);
-extern int pclose(FILE *stream);
+#if defined(_MSC_VER)
+# define popen _popen
+# define pclose _pclose
+# if !defined(HAVE_POPEN)
+# define HAVE_POPEN 1
# endif
#else
-# if defined(_MSC_VER)
-# define HAVE_POPEN 1
-# define popen _popen
-# define pclose _pclose
+# if !defined(_WIN32)
+/* These Posix functions are not ISO C and so are not always defined in stdio.h */
+extern FILE *popen(const char *command, const char *type);
+extern int pclose(FILE *stream);
# endif
#endif
@@ -1147,7 +1177,7 @@ String *Swig_string_command(String *s) {
pclose(fp);
} else {
Swig_error("SWIG", Getline(s), "Command encoder fails attempting '%s'.\n", s);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
#endif
@@ -1208,7 +1238,7 @@ String *Swig_string_rstrip(String *s) {
String *suffix = NewStringf(fmt, cs+1);
int suffix_len = Len(suffix);
if (0 == Strncmp(cs+len-suffix_len, suffix, suffix_len)) {
- int copy_len = len-suffix_len-(ce+1-cs);
+ int copy_len = len-suffix_len-(int)(ce+1-cs);
ns = NewStringWithSize(ce+1, copy_len);
} else {
ns = NewString(ce+1);
@@ -1297,7 +1327,8 @@ static int split_regex_pattern_subst(String *s, String **pattern, String **subst
err_out:
Swig_error("SWIG", Getline(s), "Invalid regex substitution: '%s'.\n", s);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
+ return 0;
}
/* This function copies len characters from src to dst, possibly applying case conversions to them: if convertCase is 1, to upper case and if it is -1, to lower
@@ -1419,7 +1450,7 @@ String *Swig_string_regex(String *s) {
if (!compiled_pat) {
Swig_error("SWIG", Getline(s), "PCRE compilation failed: '%s' in '%s':%i.\n",
pcre_error, Char(pattern), pcre_errorpos);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
rc = pcre_exec(compiled_pat, NULL, input, (int)strlen(input), 0, 0, captures, 30);
if (rc >= 0) {
@@ -1427,7 +1458,7 @@ String *Swig_string_regex(String *s) {
} else if (rc != PCRE_ERROR_NOMATCH) {
Swig_error("SWIG", Getline(s), "PCRE execution failed: error %d while matching \"%s\" using \"%s\".\n",
rc, Char(pattern), input);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
}
@@ -1445,7 +1476,8 @@ String *Swig_pcre_version(void) {
String *Swig_string_regex(String *s) {
Swig_error("SWIG", Getline(s), "PCRE regex support not enabled in this SWIG build.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
+ return 0;
}
String *Swig_pcre_version(void) {
@@ -1454,6 +1486,17 @@ String *Swig_pcre_version(void) {
#endif
+/* ------------------------------------------------------------
+ * Swig_is_generated_overload()
+ * Check if the function is an automatically generated
+ * overload created because a method has default parameters.
+ * ------------------------------------------------------------ */
+int Swig_is_generated_overload(Node *n) {
+ Node *base_method = Getattr(n, "sym:overloaded");
+ Node *default_args = Getattr(n, "defaultargs");
+ return ((base_method != NULL) && (default_args != NULL) && (base_method == default_args));
+}
+
/* -----------------------------------------------------------------------------
* Swig_init()
*
diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c
index ce1dbe806..6689ceb7a 100644
--- a/Source/Swig/naming.c
+++ b/Source/Swig/naming.c
@@ -439,8 +439,8 @@ DOH *Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType
rn = name_object_get(namehash, name, decl, ncdecl);
}
if (!rn && Swig_scopename_check(name)) {
- String *nprefix = NewStringEmpty();
- String *nlast = NewStringEmpty();
+ String *nprefix = 0;
+ String *nlast = 0;
Swig_scopename_split(name, &nprefix, &nlast);
rn = name_object_get(namehash, nlast, decl, ncdecl);
Delete(nlast);
@@ -579,8 +579,8 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
if (name && SwigType_istemplate(name)) {
String *nodetype = nodeType(node);
if (nodetype && (Equal(nodetype, "constructor") || Equal(nodetype, "destructor"))) {
- String *nprefix = NewStringEmpty();
- String *nlast = NewStringEmpty();
+ String *nprefix = 0;
+ String *nlast = 0;
String *tprefix;
Swig_scopename_split(name, &nprefix, &nlast);
tprefix = SwigType_templateprefix(nlast);
@@ -1055,7 +1055,7 @@ static void name_nameobj_add(Hash *name_hash, List *name_list, String *prefix, S
Setattr(nameobj, "decl", decl);
if (nname && Len(nname))
Setattr(nameobj, "targetname", nname);
- /* put the new nameobj at the beginnig of the list, such that the
+ /* put the new nameobj at the beginning of the list, such that the
last inserted rule take precedence */
Insert(name_list, 0, nameobj);
} else {
@@ -1105,7 +1105,7 @@ static int name_regexmatch_value(Node *n, String *pattern, String *s) {
Swig_error("SWIG", Getline(n),
"Invalid regex \"%s\": compilation failed at %d: %s\n",
Char(pattern), errpos, err);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
rc = pcre_exec(compiled_pat, NULL, Char(s), Len(s), 0, 0, NULL, 0);
@@ -1118,7 +1118,7 @@ static int name_regexmatch_value(Node *n, String *pattern, String *s) {
Swig_error("SWIG", Getline(n),
"Matching \"%s\" against regex \"%s\" failed: %d\n",
Char(s), Char(pattern), rc);
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
return 1;
@@ -1131,7 +1131,7 @@ static int name_regexmatch_value(Node *n, String *pattern, String *s) {
(void)s;
Swig_error("SWIG", Getline(n),
"PCRE regex matching is not available in this SWIG build.\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
}
#endif /* HAVE_PCRE/!HAVE_PCRE */
@@ -1377,12 +1377,15 @@ void Swig_name_rename_add(String *prefix, String *name, SwigType *decl, Hash *ne
}
-/* Create a name applying rename/namewarn if needed */
-static String *apply_rename(String *newname, int fullname, String *prefix, String *name) {
+/* Create a name for the given node applying rename/namewarn if needed */
+static String *apply_rename(Node* n, String *newname, int fullname, String *prefix, String *name) {
String *result = 0;
if (newname && Len(newname)) {
if (Strcmp(newname, "$ignore") == 0) {
- result = Copy(newname);
+ /* $ignore doesn't apply to parameters and while it's rare to explicitly write %ignore directives for them they could be caught by a wildcard ignore using
+ regex match, just ignore the attempt to ignore them in this case */
+ if (!Equal(nodeType(n), "parm"))
+ result = Copy(newname);
} else {
char *cnewname = Char(newname);
if (cnewname) {
@@ -1431,8 +1434,8 @@ String *Swig_name_make(Node *n, String *prefix, const_String_or_char_ptr cname,
if (name && n && SwigType_istemplate(name)) {
String *nodetype = nodeType(n);
if (nodetype && (Equal(nodetype, "constructor") || Equal(nodetype, "destructor"))) {
- String *nprefix = NewStringEmpty();
- String *nlast = NewStringEmpty();
+ String *nprefix = 0;
+ String *nlast = 0;
String *tprefix;
Swig_scopename_split(name, &nprefix, &nlast);
tprefix = SwigType_templateprefix(nlast);
@@ -1480,7 +1483,7 @@ String *Swig_name_make(Node *n, String *prefix, const_String_or_char_ptr cname,
if (rn) {
String *newname = Getattr(rn, "name");
int fullname = GetFlag(rn, "fullname");
- result = apply_rename(newname, fullname, prefix, name);
+ result = apply_rename(n, newname, fullname, prefix, name);
}
if (result && !Equal(result, name)) {
/* operators in C++ allow aliases, we look for them */
@@ -1504,13 +1507,19 @@ String *Swig_name_make(Node *n, String *prefix, const_String_or_char_ptr cname,
int fullname = GetFlag(wrn, "fullname");
if (result)
Delete(result);
- result = apply_rename(rename, fullname, prefix, name);
+ result = apply_rename(n, rename, fullname, prefix, name);
if ((msg) && (Len(msg))) {
if (!Getmeta(nname, "already_warned")) {
if (n) {
- SWIG_WARN_NODE_BEGIN(n);
- Swig_warning(0, Getfile(n), Getline(n), "%s\n", msg);
- SWIG_WARN_NODE_END(n);
+ /* Parameter renaming is not fully implemented. Mainly because there is no C/C++ syntax to
+ * for %rename to fully qualify a function's parameter name from outside the function. Hence it
+ * is not possible to implemented targetted warning suppression on one parameter in one function. */
+ int suppress_parameter_rename_warning = Equal(nodeType(n), "parm");
+ if (!suppress_parameter_rename_warning) {
+ SWIG_WARN_NODE_BEGIN(n);
+ Swig_warning(0, Getfile(n), Getline(n), "%s\n", msg);
+ SWIG_WARN_NODE_END(n);
+ }
} else {
Swig_warning(0, Getfile(name), Getline(name), "%s\n", msg);
}
@@ -1650,12 +1659,13 @@ String *Swig_name_str(Node *n) {
if (SwigType_istemplate(name)) {
String *nodetype = nodeType(n);
if (nodetype && (Equal(nodetype, "constructor") || Equal(nodetype, "destructor"))) {
- String *nprefix = NewStringEmpty();
- String *nlast = NewStringEmpty();
+ String *nprefix = 0;
+ String *nlast = 0;
String *tprefix;
Swig_scopename_split(name, &nprefix, &nlast);
tprefix = SwigType_templateprefix(nlast);
Delete(nlast);
+ Delete(nprefix);
Delete(name);
name = tprefix;
}
@@ -1681,6 +1691,7 @@ String *Swig_name_str(Node *n) {
* "MyNameSpace::MyTemplate<MyNameSpace::ABC >::~MyTemplate()"
* "MyNameSpace::ABC::ABC(int,double)"
* "MyNameSpace::ABC::constmethod(int) const"
+ * "MyNameSpace::ABC::refqualifiermethod(int) const &"
* "MyNameSpace::ABC::variablename"
*
* ----------------------------------------------------------------------------- */
@@ -1690,11 +1701,22 @@ String *Swig_name_decl(Node *n) {
String *decl;
qname = Swig_name_str(n);
-
- if (checkAttribute(n, "kind", "variable"))
- decl = NewStringf("%s", qname);
- else
- decl = NewStringf("%s(%s)%s", qname, ParmList_errorstr(Getattr(n, "parms")), SwigType_isconst(Getattr(n, "decl")) ? " const" : "");
+ decl = NewStringf("%s", qname);
+
+ if (!checkAttribute(n, "kind", "variable")) {
+ String *d = Getattr(n, "decl");
+ Printv(decl, "(", ParmList_errorstr(Getattr(n, "parms")), ")", NIL);
+ if (SwigType_isfunction(d)) {
+ SwigType *decl_temp = Copy(d);
+ SwigType *qualifiers = SwigType_pop_function_qualifiers(decl_temp);
+ if (qualifiers) {
+ String *qualifiers_string = SwigType_str(qualifiers, 0);
+ Printv(decl, " ", qualifiers_string, NIL);
+ Delete(qualifiers_string);
+ }
+ Delete(decl_temp);
+ }
+ }
Delete(qname);
diff --git a/Source/Swig/parms.c b/Source/Swig/parms.c
index bec1e63fa..3e832c361 100644
--- a/Source/Swig/parms.c
+++ b/Source/Swig/parms.c
@@ -254,3 +254,19 @@ int ParmList_has_defaultargs(ParmList *p) {
}
return 0;
}
+
+/* ---------------------------------------------------------------------
+ * ParmList_has_varargs()
+ *
+ * Returns 1 if the parameter list passed in has varargs.
+ * Otherwise returns 0.
+ * ---------------------------------------------------------------------- */
+
+int ParmList_has_varargs(ParmList *p) {
+ Parm *lp = 0;
+ while (p) {
+ lp = p;
+ p = nextSibling(p);
+ }
+ return lp ? SwigType_isvarargs(Getattr(lp, "type")) : 0;
+}
diff --git a/Source/Swig/scanner.c b/Source/Swig/scanner.c
index 227a1d00c..e5a267ae5 100644
--- a/Source/Swig/scanner.c
+++ b/Source/Swig/scanner.c
@@ -749,11 +749,18 @@ static int look(Scanner *s) {
}
if (Strcmp( str_delimiter, end_delimiter )==0) {
- Delete( end_delimiter ); /* Correct end delimiter )XXXX" occured */
+ int len = Len(s->text);
+ Delslice(s->text, len - 2 - Len(str_delimiter), len); /* Delete ending )XXXX" */
+ Delslice(s->text, 0, Len(str_delimiter) + 1); /* Delete starting XXXX( */
+ Delete( end_delimiter ); /* Correct end delimiter )XXXX" occurred */
Delete( str_delimiter );
str_delimiter = 0;
return SWIG_TOKEN_STRING;
- } else { /* Incorrect end delimiter occured */
+ } else { /* Incorrect end delimiter occurred */
+ if (c == 0) {
+ Swig_error(cparse_file, cparse_start_line, "Unterminated raw string, started with R\"%s( is not terminated by )%s\"\n", str_delimiter, str_delimiter);
+ return SWIG_TOKEN_ERROR;
+ }
retract( s, i );
Delete( end_delimiter );
}
@@ -826,7 +833,7 @@ static int look(Scanner *s) {
return SWIG_TOKEN_MODEQUAL;
} else if (c == '}') {
Swig_error(cparse_file, cparse_line, "Syntax error. Extraneous '%%}'\n");
- exit(1);
+ SWIG_exit(EXIT_FAILURE);
} else {
retract(s, 1);
return SWIG_TOKEN_PERCENT;
@@ -931,10 +938,14 @@ static int look(Scanner *s) {
retract(s, 1);
state = 1000;
}
+ else if (c == '\'') { /* Definitely u, U or L char */
+ retract(s, 1);
+ state = 77;
+ }
else if (c == 'R') { /* Possibly CUSTOM DELIMITER u, U, L string */
state = 73;
}
- else if (c == '8') { /* Possibly u8 string */
+ else if (c == '8') { /* Possibly u8 string/char */
state = 71;
}
else {
@@ -954,7 +965,7 @@ static int look(Scanner *s) {
}
break;
- case 71: /* Possibly u8 string */
+ case 71: /* Possibly u8 string/char */
if ((c = nextchar(s)) == 0) {
state = 76;
}
@@ -962,6 +973,10 @@ static int look(Scanner *s) {
retract(s, 1); /* Definitely u8 string */
state = 1000;
}
+ else if (c=='\'') {
+ retract(s, 1); /* Definitely u8 char */
+ state = 77;
+ }
else if (c=='R') {
state = 74; /* Possibly CUSTOM DELIMITER u8 string */
}
@@ -1114,27 +1129,29 @@ static int look(Scanner *s) {
break;
case 82:
if ((c = nextchar(s)) == 0) {
- retract(s, 1);
- return SWIG_TOKEN_INT;
+ Swig_error(cparse_file, cparse_start_line, "Exponent does not have any digits\n");
+ return SWIG_TOKEN_ERROR;
}
if ((isdigit(c)) || (c == '-') || (c == '+'))
state = 86;
else {
retract(s, 2);
- return (SWIG_TOKEN_INT);
+ Swig_error(cparse_file, cparse_start_line, "Exponent does not have any digits\n");
+ return SWIG_TOKEN_ERROR;
}
break;
case 820:
/* Like case 82, but we've seen a decimal point. */
if ((c = nextchar(s)) == 0) {
- retract(s, 1);
- return SWIG_TOKEN_DOUBLE;
+ Swig_error(cparse_file, cparse_start_line, "Exponent does not have any digits\n");
+ return SWIG_TOKEN_ERROR;
}
if ((isdigit(c)) || (c == '-') || (c == '+'))
state = 86;
else {
retract(s, 2);
- return (SWIG_TOKEN_DOUBLE);
+ Swig_error(cparse_file, cparse_start_line, "Exponent does not have any digits\n");
+ return SWIG_TOKEN_ERROR;
}
break;
case 83:
@@ -1143,8 +1160,12 @@ static int look(Scanner *s) {
return SWIG_TOKEN_INT;
if (isdigit(c))
state = 84;
+ else if ((c == 'e') || (c == 'E'))
+ state = 82;
else if ((c == 'x') || (c == 'X'))
state = 85;
+ else if ((c == 'b') || (c == 'B'))
+ state = 850;
else if (c == '.')
state = 81;
else if ((c == 'l') || (c == 'L')) {
@@ -1162,6 +1183,10 @@ static int look(Scanner *s) {
return SWIG_TOKEN_INT;
if (isdigit(c))
state = 84;
+ else if (c == '.')
+ state = 81;
+ else if ((c == 'e') || (c == 'E'))
+ state = 82;
else if ((c == 'l') || (c == 'L')) {
state = 87;
} else if ((c == 'u') || (c == 'U')) {
@@ -1177,6 +1202,10 @@ static int look(Scanner *s) {
return SWIG_TOKEN_INT;
if (isxdigit(c))
state = 85;
+ else if (c == '.') /* hexadecimal float */
+ state = 860;
+ else if ((c == 'p') || (c == 'P')) /* hexadecimal float */
+ state = 820;
else if ((c == 'l') || (c == 'L')) {
state = 87;
} else if ((c == 'u') || (c == 'U')) {
@@ -1186,7 +1215,37 @@ static int look(Scanner *s) {
return SWIG_TOKEN_INT;
}
break;
-
+ case 850:
+ /* This is a binary number */
+ if ((c = nextchar(s)) == 0)
+ return SWIG_TOKEN_INT;
+ if ((c == '0') || (c == '1'))
+ state = 850;
+ else if ((c == 'l') || (c == 'L')) {
+ state = 87;
+ } else if ((c == 'u') || (c == 'U')) {
+ state = 88;
+ } else {
+ retract(s, 1);
+ return SWIG_TOKEN_INT;
+ }
+ break;
+ case 860:
+ /* hexadecimal float */
+ if ((c = nextchar(s)) == 0) {
+ Swig_error(cparse_file, cparse_start_line, "Hexadecimal floating literals require an exponent\n");
+ return SWIG_TOKEN_ERROR;
+ }
+ if (isxdigit(c))
+ state = 860;
+ else if ((c == 'p') || (c == 'P'))
+ state = 820;
+ else {
+ retract(s, 2);
+ Swig_error(cparse_file, cparse_start_line, "Hexadecimal floating literals require an exponent\n");
+ return SWIG_TOKEN_ERROR;
+ }
+ break;
case 86:
/* Rest of floating point number */
diff --git a/Source/Swig/stype.c b/Source/Swig/stype.c
index a57222745..66518f50c 100644
--- a/Source/Swig/stype.c
+++ b/Source/Swig/stype.c
@@ -44,8 +44,8 @@
* 'z.' = Rvalue reference (&&)
* 'a(n).' = Array of size n [n]
* 'f(..,..).' = Function with arguments (args)
- * 'q(str).' = Qualifier (such as const or volatile) (const, volatile)
- * 'm(qual).' = Pointer to member (qual::*)
+ * 'q(str).' = Qualifier, such as const or volatile (cv-qualifier)
+ * 'm(cls).' = Pointer to member (cls::*)
*
* The encoding follows the order that you might describe a type in words.
* For example "p.a(200).int" is "A pointer to array of int's" and
@@ -62,6 +62,22 @@
*
* Replace(t,"q(const).","",DOH_REPLACE_ANY)
*
+ * More examples:
+ *
+ * String Encoding C++ Example
+ * --------------- -----------
+ * p.f(bool).r.q(const).long const long & (*)(bool)
+ * m(Funcs).q(const).f(bool).long long (Funcs::*)(bool) const
+ * r.q(const).m(Funcs).f(int).long long (Funcs::*const &)(int)
+ * m(Funcs).z.q(const).f(bool).long long (Funcs::*)(bool) const &&
+ *
+ * Function decl examples:
+ *
+ * f(bool). long a(bool);
+ * r.f(bool). long b(bool) &;
+ * z.f(bool). long c(bool) &&;
+ * z.q(const).f(bool). long d(bool) const &&;
+ *
* For the most part, this module tries to minimize the use of special
* characters (*, [, <, etc...) in its type encoding. One reason for this
* is that SWIG might be extended to encode data in formats such as XML
@@ -372,7 +388,7 @@ SwigType *SwigType_default_create(const SwigType *ty) {
* and is very close to the type deduction used in partial template class
* specialization matching in that the most specialized type is always chosen.
* SWIGTYPE is used as the generic type. The basic idea is to repeatedly call
- * this function to find a deduced type unless until nothing matches.
+ * this function to find a deduced type until nothing matches.
*
* The type t must have already been converted to the default type via a call to
* SwigType_default_create() before calling this function.
@@ -528,6 +544,7 @@ String *SwigType_str(const SwigType *s, const_String_or_char_ptr id) {
String *element = 0;
String *nextelement;
String *forwardelement;
+ SwigType *member_function_qualifiers = 0;
List *elements;
int nelements, i;
@@ -560,11 +577,13 @@ String *SwigType_str(const SwigType *s, const_String_or_char_ptr id) {
forwardelement = 0;
}
if (SwigType_isqualifier(element)) {
- DOH *q = 0;
- q = SwigType_parm(element);
- Insert(result, 0, " ");
- Insert(result, 0, q);
- Delete(q);
+ if (!member_function_qualifiers) {
+ DOH *q = 0;
+ q = SwigType_parm(element);
+ Insert(result, 0, " ");
+ Insert(result, 0, q);
+ Delete(q);
+ }
} else if (SwigType_ispointer(element)) {
Insert(result, 0, "*");
if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
@@ -580,16 +599,28 @@ String *SwigType_str(const SwigType *s, const_String_or_char_ptr id) {
Insert(result, 0, "(");
Append(result, ")");
}
+ {
+ String *next3elements = NewStringEmpty();
+ int j;
+ for (j = i + 1; j < i + 4 && j < nelements; j++) {
+ Append(next3elements, Getitem(elements, j));
+ }
+ if (SwigType_isfunction(next3elements))
+ member_function_qualifiers = SwigType_pop_function_qualifiers(next3elements);
+ Delete(next3elements);
+ }
Delete(q);
} else if (SwigType_isreference(element)) {
- Insert(result, 0, "&");
+ if (!member_function_qualifiers)
+ Insert(result, 0, "&");
if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
Insert(result, 0, "(");
Append(result, ")");
}
} else if (SwigType_isrvalue_reference(element)) {
- Insert(result, 0, "&&");
- if ((nextelement) && ((SwigType_isfunction(nextelement) || (SwigType_isarray(nextelement))))) {
+ if (!member_function_qualifiers)
+ Insert(result, 0, "&&");
+ if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
Insert(result, 0, "(");
Append(result, ")");
}
@@ -613,6 +644,14 @@ String *SwigType_str(const SwigType *s, const_String_or_char_ptr id) {
Append(result, ",");
}
Append(result, ")");
+ if (member_function_qualifiers) {
+ String *p = SwigType_str(member_function_qualifiers, 0);
+ Append(result, " ");
+ Append(result, p);
+ Delete(p);
+ Delete(member_function_qualifiers);
+ member_function_qualifiers = 0;
+ }
Delete(parms);
} else {
if (strcmp(Char(element), "v(...)") == 0) {
@@ -645,6 +684,7 @@ SwigType *SwigType_ltype(const SwigType *s) {
int nelements, i;
int firstarray = 1;
int notypeconv = 0;
+ int ignore_member_function_qualifiers = 0;
result = NewStringEmpty();
tc = Copy(s);
@@ -671,6 +711,7 @@ SwigType *SwigType_ltype(const SwigType *s) {
tc = td;
}
}
+
elements = SwigType_split(tc);
nelements = Len(elements);
@@ -680,14 +721,33 @@ SwigType *SwigType_ltype(const SwigType *s) {
/* when we see a function, we need to preserve the following types */
if (SwigType_isfunction(element)) {
notypeconv = 1;
+ ignore_member_function_qualifiers = 0;
}
- if (SwigType_isqualifier(element)) {
- /* Do nothing. Ignore */
+ if (ignore_member_function_qualifiers) {
+ /* cv-qualifiers and ref-qualifiers up until the f() element have already been added */
+ } else if (SwigType_isqualifier(element)) {
+ /* swallow cv-qualifiers */
} else if (SwigType_ispointer(element)) {
Append(result, element);
firstarray = 0;
} else if (SwigType_ismemberpointer(element)) {
Append(result, element);
+ {
+ String *next3elements = NewStringEmpty();
+ int j;
+ for (j = i + 1; j < i + 4 && j < nelements; j++) {
+ Append(next3elements, Getitem(elements, j));
+ }
+ if (SwigType_isfunction(next3elements)) {
+ SwigType *member_function_qualifiers = SwigType_pop_function_qualifiers(next3elements);
+ /* compilers won't let us cast from a member function without qualifiers to one with qualifiers, so the qualifiers are kept in the ltype */
+ if (member_function_qualifiers)
+ Append(result, member_function_qualifiers);
+ Delete(member_function_qualifiers);
+ ignore_member_function_qualifiers = 1;
+ }
+ Delete(next3elements);
+ }
firstarray = 0;
} else if (SwigType_isreference(element)) {
if (notypeconv) {
@@ -727,13 +787,14 @@ SwigType *SwigType_ltype(const SwigType *s) {
}
/* -----------------------------------------------------------------------------
- * SwigType_lstr(DOH *s, DOH *id)
+ * SwigType_lstr()
*
* Produces a type-string that is suitable as a lvalue in an expression.
* That is, a type that can be freely assigned a value without violating
* any C assignment rules.
*
* - Qualifiers such as 'const' and 'volatile' are stripped.
+ * Except for member function cv-qualifiers and ref-qualifiers.
* - Arrays are converted into a *single* pointer (i.e.,
* double [][] becomes double *).
* - References are converted into a pointer.
@@ -763,6 +824,7 @@ String *SwigType_rcaststr(const SwigType *s, const_String_or_char_ptr name) {
String *element = 0;
String *nextelement;
String *forwardelement;
+ String *member_function_qualifiers = 0;
SwigType *td, *tc = 0;
const SwigType *rs;
List *elements;
@@ -777,7 +839,10 @@ String *SwigType_rcaststr(const SwigType *s, const_String_or_char_ptr name) {
if (SwigType_isconst(s)) {
tc = Copy(s);
Delete(SwigType_pop(tc));
- rs = tc;
+ if (SwigType_ismemberpointer(tc))
+ rs = s;
+ else
+ rs = tc;
} else {
rs = s;
}
@@ -816,12 +881,14 @@ String *SwigType_rcaststr(const SwigType *s, const_String_or_char_ptr name) {
forwardelement = 0;
}
if (SwigType_isqualifier(element)) {
- DOH *q = 0;
- q = SwigType_parm(element);
- Insert(result, 0, " ");
- Insert(result, 0, q);
- Delete(q);
- clear = 0;
+ if (!member_function_qualifiers) {
+ DOH *q = 0;
+ q = SwigType_parm(element);
+ Insert(result, 0, " ");
+ Insert(result, 0, q);
+ Delete(q);
+ clear = 0;
+ }
} else if (SwigType_ispointer(element)) {
Insert(result, 0, "*");
if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
@@ -834,28 +901,42 @@ String *SwigType_rcaststr(const SwigType *s, const_String_or_char_ptr name) {
Insert(result, 0, "::*");
q = SwigType_parm(element);
Insert(result, 0, q);
- Delete(q);
if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
Insert(result, 0, "(");
Append(result, ")");
}
+ {
+ String *next3elements = NewStringEmpty();
+ int j;
+ for (j = i + 1; j < i + 4 && j < nelements; j++) {
+ Append(next3elements, Getitem(elements, j));
+ }
+ if (SwigType_isfunction(next3elements))
+ member_function_qualifiers = SwigType_pop_function_qualifiers(next3elements);
+ Delete(next3elements);
+ }
firstarray = 0;
+ Delete(q);
} else if (SwigType_isreference(element)) {
- Insert(result, 0, "&");
+ if (!member_function_qualifiers) {
+ Insert(result, 0, "&");
+ if (!isfunction)
+ isreference = 1;
+ }
if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
Insert(result, 0, "(");
Append(result, ")");
}
- if (!isfunction)
- isreference = 1;
} else if (SwigType_isrvalue_reference(element)) {
- Insert(result, 0, "&&");
+ if (!member_function_qualifiers) {
+ Insert(result, 0, "&&");
+ if (!isfunction)
+ isreference = 1;
+ }
if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
Insert(result, 0, "(");
Append(result, ")");
}
- if (!isfunction)
- isreference = 1;
clear = 0;
} else if (SwigType_isarray(element)) {
DOH *size;
@@ -885,6 +966,15 @@ String *SwigType_rcaststr(const SwigType *s, const_String_or_char_ptr name) {
}
Append(result, ")");
Delete(parms);
+ if (member_function_qualifiers) {
+ String *p = SwigType_str(member_function_qualifiers, 0);
+ Append(result, " ");
+ Append(result, p);
+ Delete(p);
+ Delete(member_function_qualifiers);
+ member_function_qualifiers = 0;
+ clear = 0;
+ }
isfunction = 1;
} else {
String *bs = SwigType_namestr(element);
@@ -1220,6 +1310,7 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
Putc(',', nt);
}
tsuffix = SwigType_templatesuffix(e);
+ SwigType_typename_replace(tsuffix, pat, rep);
Printf(nt, ")>%s", tsuffix);
Delete(tsuffix);
Clear(e);
@@ -1228,13 +1319,24 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
Delete(tparms);
}
} else if (Swig_scopename_check(e)) {
- String *first, *rest;
- first = Swig_scopename_first(e);
- rest = Swig_scopename_suffix(e);
- SwigType_typename_replace(rest, pat, rep);
- SwigType_typename_replace(first, pat, rep);
+ String *first = 0;
+ String *rest = 0;
+ Swig_scopename_split(e, &first, &rest);
+
+ /* Swig_scopename_split doesn't handle :: prefix very well ... could do with a rework */
+ if (Strncmp(rest, "::", 2) == 0) {
+ String *tmp = NewString(Char(rest) + 2);
+ Clear(rest);
+ Printv(rest, tmp, NIL);
+ Delete(tmp);
+ assert(!first);
+ }
+
Clear(e);
- Printv(e, first, "::", rest, NIL);
+ if (first)
+ SwigType_typename_replace(first, pat, rep);
+ SwigType_typename_replace(rest, pat, rep);
+ Printv(e, first ? first : "", "::", rest, NIL);
Delete(first);
Delete(rest);
}
diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h
index f25f0993e..e0783dae1 100644
--- a/Source/Swig/swig.h
+++ b/Source/Swig/swig.h
@@ -136,6 +136,7 @@ extern "C" {
extern SwigType *SwigType_add_function(SwigType *t, ParmList *parms);
extern SwigType *SwigType_add_template(SwigType *t, ParmList *parms);
extern SwigType *SwigType_pop_function(SwigType *t);
+ extern SwigType *SwigType_pop_function_qualifiers(SwigType *t);
extern ParmList *SwigType_function_parms(const SwigType *t, Node *file_line_node);
extern List *SwigType_split(const SwigType *t);
extern String *SwigType_pop(SwigType *t);
@@ -187,7 +188,7 @@ extern "C" {
extern SwigType *SwigType_remove_global_scope_prefix(const SwigType *t);
extern SwigType *SwigType_alttype(const SwigType *t, int ltmap);
-/* --- Type-system managment --- */
+/* --- Type-system management --- */
extern void SwigType_typesystem_init(void);
extern int SwigType_typedef(const SwigType *type, const_String_or_char_ptr name);
extern int SwigType_typedef_class(const_String_or_char_ptr name);
@@ -326,6 +327,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
extern String *Swig_scopename_last(const String *s);
extern String *Swig_scopename_first(const String *s);
extern String *Swig_scopename_suffix(const String *s);
+ extern List *Swig_scopename_tolist(const String *s);
extern int Swig_scopename_check(const String *s);
extern String *Swig_string_lower(String *s);
extern String *Swig_string_upper(String *s);
@@ -333,7 +335,9 @@ extern int ParmList_is_compactdefargs(ParmList *p);
extern void Swig_offset_string(String *s, int number);
extern String *Swig_pcre_version(void);
extern void Swig_init(void);
+
extern int Swig_value_wrapper_mode(int mode);
+ extern int Swig_is_generated_overload(Node *n);
typedef enum { EMF_STANDARD, EMF_MICROSOFT } ErrorMessageFormat;
@@ -434,6 +438,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
extern void Language_replace_special_variables(String *method, String *tm, Parm *parm);
extern void Swig_print(DOH *object, int count);
extern void Swig_print_with_location(DOH *object, int count);
+ extern void SWIG_exit(int exit_code);
/* -- template init -- */
diff --git a/Source/Swig/swigparm.h b/Source/Swig/swigparm.h
index 368b4d26b..7b27df5f6 100644
--- a/Source/Swig/swigparm.h
+++ b/Source/Swig/swigparm.h
@@ -24,6 +24,7 @@ extern ParmList *CopyParmListMax(ParmList *, int count);
extern int ParmList_len(ParmList *);
extern int ParmList_numrequired(ParmList *);
extern int ParmList_has_defaultargs(ParmList *p);
+extern int ParmList_has_varargs(ParmList *p);
/* Output functions */
extern String *ParmList_str(ParmList *);
diff --git a/Source/Swig/swigscan.h b/Source/Swig/swigscan.h
index 6a181f86f..740a93610 100644
--- a/Source/Swig/swigscan.h
+++ b/Source/Swig/swigscan.h
@@ -50,7 +50,7 @@ extern void Scanner_locator(Scanner *, String *loc);
#define SWIG_TOKEN_COLON 12 /* : */
#define SWIG_TOKEN_DCOLON 13 /* :: */
#define SWIG_TOKEN_DCOLONSTAR 14 /* ::* */
-#define SWIG_TOKEN_ID 15 /* identifer */
+#define SWIG_TOKEN_ID 15 /* identifier */
#define SWIG_TOKEN_FLOAT 16 /* 3.1415F */
#define SWIG_TOKEN_DOUBLE 17 /* 3.1415 */
#define SWIG_TOKEN_INT 18 /* 314 */
diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c
index c548a0670..aacaf24be 100644
--- a/Source/Swig/symbol.c
+++ b/Source/Swig/symbol.c
@@ -210,9 +210,10 @@ void Swig_symbol_print_tables_summary(void) {
* symbol_print_symbols()
* ----------------------------------------------------------------------------- */
-static void symbol_print_symbols(const char *symboltabletype) {
+static void symbol_print_symbols(const char *symboltabletype, const char *nextSibling) {
Node *table = symtabs;
Iterator ki = First(table);
+ int show_pointers = 0;
while (ki.key) {
String *k = ki.key;
Printf(stdout, "===================================================\n");
@@ -222,10 +223,20 @@ static void symbol_print_symbols(const char *symboltabletype) {
Iterator it = First(symtab);
while (it.key) {
String *symname = it.key;
- Printf(stdout, " %s (%s)\n", symname, nodeType(it.item));
- /*
- Printf(stdout, " %s - %p (%s)\n", symname, it.item, Getattr(it.item, "name"));
- */
+ Printf(stdout, " %s (%s)", symname, nodeType(it.item));
+ if (show_pointers)
+ Printf(stdout, " %p", it.item);
+ Printf(stdout, "\n");
+ {
+ Node *sibling = Getattr(it.item, nextSibling);
+ while (sibling) {
+ Printf(stdout, " %s (%s)", symname, nodeType(sibling));
+ if (show_pointers)
+ Printf(stdout, " %p", sibling);
+ Printf(stdout, "\n");
+ sibling = Getattr(sibling, nextSibling);
+ }
+ }
it = Next(it);
}
}
@@ -241,7 +252,7 @@ static void symbol_print_symbols(const char *symboltabletype) {
void Swig_symbol_print_symbols(void) {
Printf(stdout, "SYMBOLS start =======================================\n");
- symbol_print_symbols("symtab");
+ symbol_print_symbols("symtab", "sym:nextSibling");
Printf(stdout, "SYMBOLS finish =======================================\n");
}
@@ -253,7 +264,7 @@ void Swig_symbol_print_symbols(void) {
void Swig_symbol_print_csymbols(void) {
Printf(stdout, "CSYMBOLS start =======================================\n");
- symbol_print_symbols("csymtab");
+ symbol_print_symbols("csymtab", "csym:nextSibling");
Printf(stdout, "CSYMBOLS finish =======================================\n");
}
@@ -599,7 +610,7 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
Setattr(ccurrent, name, n);
}
- /* Multiple entries in the C symbol table. We append to to the symbol table */
+ /* Multiple entries in the C symbol table. We append to the symbol table */
if (append) {
Node *fn, *pn = 0;
cn = Getattr(ccurrent, name);
@@ -690,7 +701,7 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
- Hash *c, *cn, *cl = 0;
+ Hash *c, *cl = 0;
SwigType *decl, *ndecl;
String *cstorage, *nstorage;
int nt = 0, ct = 0;
@@ -756,10 +767,9 @@ Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
(1) A conflict between a class/enum and a typedef declaration is okay.
In this case, the symbol table entry is set to the class/enum declaration
itself, not the typedef.
-
(2) A conflict between namespaces is okay--namespaces are open
-
(3) Otherwise, overloading is only allowed for functions
+ (4) This special case is okay: a class template instantiated with same name as the template's name
*/
/* Check for namespaces */
@@ -777,6 +787,25 @@ Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
Setattr(n, "sym:previousSibling", pcl);
return n;
}
+
+ /* Special case: class template instantiated with same name as the template's name eg: %template(X) X<int>; */
+ if (Equal(nodeType(c), "template")) {
+ String *nt1 = Getattr(c, "templatetype");
+ String *nt2 = nodeType(n);
+ if (Equal(nt1, "class") && Equal(nt1, nt2)) {
+ if (Getattr(n, "template")) {
+ /* Finally check that another %template with same name doesn't already exist */
+ if (!Getattr(c, "sym:nextSibling")) {
+ Setattr(c, "sym:nextSibling", n);
+ Setattr(n, "sym:symtab", current_symtab);
+ Setattr(n, "sym:name", symname);
+ Setattr(n, "sym:previousSibling", c);
+ return n;
+ }
+ }
+ }
+ }
+
if (Getattr(n, "allows_typedef"))
nt = 1;
if (Getattr(c, "allows_typedef"))
@@ -857,7 +886,7 @@ Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
String *nt = Getattr(n, "nodeType");
int n_template = Equal(nt, "template") && Checkattr(n, "templatetype", "cdecl");
int n_plain_cdecl = Equal(nt, "cdecl");
- cn = c;
+ Node *cn = c;
pn = 0;
while (cn) {
decl = Getattr(cn, "decl");
@@ -1010,8 +1039,8 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
return 0;
if (!prefix) {
Node *n;
- String *bname;
- String *prefix;
+ String *bname = 0;
+ String *prefix = 0;
Swig_scopename_split(name, &prefix, &bname);
n = symbol_lookup_qualified(bname, symtab, prefix, local, checkfunc);
Delete(bname);
diff --git a/Source/Swig/tree.c b/Source/Swig/tree.c
index 78c04dc90..46571fc09 100644
--- a/Source/Swig/tree.c
+++ b/Source/Swig/tree.c
@@ -75,9 +75,11 @@ void Swig_print_node(Node *obj) {
if ((Cmp(k, "nodeType") == 0) || (Cmp(k, "firstChild") == 0) || (Cmp(k, "lastChild") == 0) ||
(Cmp(k, "parentNode") == 0) || (Cmp(k, "nextSibling") == 0) || (Cmp(k, "previousSibling") == 0) || (*(Char(k)) == '$')) {
/* Do nothing */
- } else if (Cmp(k, "parms") == 0 || Cmp(k, "wrap:parms") == 0) {
+ } else if (Cmp(k, "kwargs") == 0 || Cmp(k, "parms") == 0 || Cmp(k, "wrap:parms") == 0 ||
+ Cmp(k, "pattern") == 0 || Cmp(k, "templateparms") == 0 || Cmp(k, "throws") == 0) {
print_indent(2);
- Printf(stdout, "%-12s - %s\n", k, ParmList_str_defaultargs(Getattr(obj, k)));
+ /* Differentiate parameter lists by displaying within single quotes */
+ Printf(stdout, "%-12s - \'%s\'\n", k, ParmList_str_defaultargs(Getattr(obj, k)));
} else {
DOH *o;
const char *trunc = "";
diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c
index 8970c719d..c0f5397c1 100644
--- a/Source/Swig/typemap.c
+++ b/Source/Swig/typemap.c
@@ -61,13 +61,44 @@ static void replace_embedded_typemap(String *s, ParmList *parm_sublist, Wrapper
static Hash *typemaps;
+/* -----------------------------------------------------------------------------
+ * typemap_identifier_fix()
+ *
+ * Create a type that can be used as a hash key lookup independent of the various
+ * ways a template parameter list can be defined. This is achieved by fully
+ * resolving the template parameters.
+ *
+ * This is a copy and modification of feature_identifier_fix in parser.y.
+ * ----------------------------------------------------------------------------- */
+
+static SwigType *typemap_identifier_fix(const SwigType *s) {
+ String *tp = SwigType_istemplate_templateprefix(s);
+ if (tp) {
+ String *ts, *ta, *tq, *tr;
+ ts = SwigType_templatesuffix(s);
+ ta = SwigType_templateargs(s);
+ tq = Swig_symbol_type_qualify(ta, 0);
+ tr = SwigType_typedef_resolve_all(ta);
+ Append(tp,tr);
+ Append(tp,ts);
+ Delete(ts);
+ Delete(ta);
+ Delete(tq);
+ Delete(tr);
+ return tp;
+ } else {
+ return NewString(s);
+ }
+}
+
static Hash *get_typemap(const SwigType *type) {
Hash *tm = 0;
SwigType *dtype = 0;
SwigType *hashtype;
if (SwigType_istemplate(type)) {
- String *ty = Swig_symbol_template_deftype(type, 0);
+ SwigType *rty = typemap_identifier_fix(type);
+ String *ty = Swig_symbol_template_deftype(rty, 0);
dtype = Swig_symbol_type_qualify(ty, 0);
type = dtype;
Delete(ty);
@@ -88,7 +119,7 @@ static void set_typemap(const SwigType *type, Hash **tmhash) {
Hash *new_tm = 0;
assert(*tmhash == 0);
if (SwigType_istemplate(type)) {
- SwigType *rty = SwigType_typedef_resolve_all(type);
+ SwigType *rty = typemap_identifier_fix(type);
String *ty = Swig_symbol_template_deftype(rty, 0);
String *tyq = Swig_symbol_type_qualify(ty, 0);
hashtype = SwigType_remove_global_scope_prefix(tyq);
@@ -733,6 +764,7 @@ static Hash *typemap_search(const_String_or_char_ptr tmap_method, SwigType *type
SwigType *oldctype = ctype;
ctype = SwigType_typedef_resolve(ctype_unstripped);
Delete(oldctype);
+ Delete(ctype_unstripped);
ctype_unstripped = Copy(ctype);
}
}
diff --git a/Source/Swig/typeobj.c b/Source/Swig/typeobj.c
index b2832b6a9..69fb6662b 100644
--- a/Source/Swig/typeobj.c
+++ b/Source/Swig/typeobj.c
@@ -43,12 +43,12 @@
* All type constructors are denoted by a trailing '.':
*
* 'p.' = Pointer (*)
- * 'r.' = Reference (&)
- * 'z.' = Rvalue reference (&&)
+ * 'r.' = Reference or ref-qualifier (&)
+ * 'z.' = Rvalue reference or ref-qualifier (&&)
* 'a(n).' = Array of size n [n]
* 'f(..,..).' = Function with arguments (args)
- * 'q(str).' = Qualifier (such as const or volatile) (const, volatile)
- * 'm(qual).' = Pointer to member (qual::*)
+ * 'q(str).' = Qualifier, such as const or volatile (cv-qualifier)
+ * 'm(cls).' = Pointer to member (cls::*)
*
* The complete type representation for varargs is:
* 'v(...)'
@@ -183,9 +183,10 @@ SwigType *SwigType_del_element(SwigType *t) {
* SwigType_pop()
*
* Pop one type element off the type.
- * Example: t in: q(const).p.Integer
- * t out: p.Integer
- * result: q(const).
+ * For example:
+ * t in: q(const).p.Integer
+ * t out: p.Integer
+ * result: q(const).
* ----------------------------------------------------------------------------- */
SwigType *SwigType_pop(SwigType *t) {
@@ -771,7 +772,6 @@ SwigType *SwigType_array_type(const SwigType *ty) {
* Functions
*
* SwigType_add_function()
- * SwigType_del_function()
* SwigType_isfunction()
* SwigType_pop_function()
*
@@ -795,14 +795,36 @@ SwigType *SwigType_add_function(SwigType *t, ParmList *parms) {
return t;
}
+/* -----------------------------------------------------------------------------
+ * SwigType_pop_function()
+ *
+ * Pop and return the function from the input type leaving the function's return
+ * type, if any.
+ * For example:
+ * t in: q(const).f().p.
+ * t out: p.
+ * result: q(const).f().
+ * ----------------------------------------------------------------------------- */
+
SwigType *SwigType_pop_function(SwigType *t) {
SwigType *f = 0;
SwigType *g = 0;
char *c = Char(t);
- if (strncmp(c, "q(", 2) == 0) {
+ if (strncmp(c, "r.", 2) == 0 || strncmp(c, "z.", 2) == 0) {
+ /* Remove ref-qualifier */
f = SwigType_pop(t);
c = Char(t);
}
+ if (strncmp(c, "q(", 2) == 0) {
+ /* Remove cv-qualifier */
+ String *qual = SwigType_pop(t);
+ if (f) {
+ SwigType_push(qual, f);
+ Delete(f);
+ }
+ f = qual;
+ c = Char(t);
+ }
if (strncmp(c, "f(", 2)) {
printf("Fatal error. SwigType_pop_function applied to non-function.\n");
abort();
@@ -814,14 +836,54 @@ SwigType *SwigType_pop_function(SwigType *t) {
return g;
}
+/* -----------------------------------------------------------------------------
+ * SwigType_pop_function_qualifiers()
+ *
+ * Pop and return the function qualifiers from the input type leaving the rest of
+ * function declaration. Returns NULL if no qualifiers.
+ * For example:
+ * t in: r.q(const).f().p.
+ * t out: f().p.
+ * result: r.q(const)
+ * ----------------------------------------------------------------------------- */
+
+SwigType *SwigType_pop_function_qualifiers(SwigType *t) {
+ SwigType *qualifiers = 0;
+ char *c = Char(t);
+ if (strncmp(c, "r.", 2) == 0 || strncmp(c, "z.", 2) == 0) {
+ /* Remove ref-qualifier */
+ String *qual = SwigType_pop(t);
+ qualifiers = qual;
+ c = Char(t);
+ }
+ if (strncmp(c, "q(", 2) == 0) {
+ /* Remove cv-qualifier */
+ String *qual = SwigType_pop(t);
+ if (qualifiers) {
+ SwigType_push(qual, qualifiers);
+ Delete(qualifiers);
+ }
+ qualifiers = qual;
+ }
+ assert(Strncmp(t, "f(", 2) == 0);
+
+ return qualifiers;
+}
+
int SwigType_isfunction(const SwigType *t) {
char *c;
if (!t) {
return 0;
}
c = Char(t);
+ if (strncmp(c, "r.", 2) == 0 || strncmp(c, "z.", 2) == 0) {
+ /* Might be a function with a ref-qualifier, skip over */
+ c += 2;
+ if (!*c)
+ return 0;
+ }
if (strncmp(c, "q(", 2) == 0) {
- /* Might be a 'const' function. Try to skip over the 'const' */
+ /* Might be a function with a cv-qualifier, skip over */
c = strchr(c, '.');
if (c)
c++;
diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c
index e11fc781a..7564db1a6 100644
--- a/Source/Swig/typesys.c
+++ b/Source/Swig/typesys.c
@@ -42,10 +42,15 @@
* "name" - Scope name
* "qname" - Fully qualified typename
* "typetab" - Type table containing typenames and typedef information
+ * For a given key in the typetab table, the value is a fully
+ * qualified name if not pointing to itself.
* "symtab" - Hash table of symbols defined in a scope
* "inherit" - List of inherited scopes
* "parent" - Parent scope
*
+ * The contents of these tables can be viewed for debugging using the -debug-typedef
+ * option which calls SwigType_print_scope().
+ *
* Typedef information is stored in the "typetab" hash table. For example,
* if you have these declarations:
*
@@ -53,8 +58,7 @@
* typedef A B;
* typedef B *C;
*
- * typetab is built as follows:
- *
+ * typetab in scope '' contains:
* "A" : "int"
* "B" : "A"
* "C" : "p.B"
@@ -67,31 +71,76 @@
* ---> a(40).p.p.A (B --> A)
* ---> a(40).p.p.int (A --> int)
*
+ *
+ * Using declarations are stored in the "typetab" hash table. For example,
+ *
+ * namespace NN {
+ * struct SS {};
+ * }
+ * namespace N {
+ * struct S {};
+ * using NN::SS;
+ * }
+ * using N::S;
+ *
+ * typetab in scope '' contains:
+ * "S" : "N::S"
+ *
+ * and typetab in scope 'N' contains:
+ * "SS" : "NN::SS"
+ * "S" : "S"
+ *
+ *
* For inheritance, SWIG tries to resolve types back to the base class. For instance, if
* you have this:
*
- * class Foo {
- * public:
- * typedef int Integer;
- * };
+ * class Foo {
+ * public:
+ * typedef int Integer;
+ * };
+ * struct Bar : public Foo {
+ * void blah(Integer x);
+ * };
*
- * class Bar : public Foo {
- * void blah(Integer x);
- * };
+ * In this case typetab in scope '' contains:
+ * "Foo" : "Foo"
+ * "Bar" : "Bar"
+ * and scope 'Foo' contains:
+ * "Integer" : "int"
+ * and scope 'Bar' inherits from 'Foo' but is empty (observe that blah is not a scope or typedef)
*
* The argument type of Bar::blah will be set to Foo::Integer.
*
+ *
+ * The scope-inheritance mechanism is used to manage C++ using directives.
+ *
+ * namespace XX {
+ * class CC {};
+ * }
+ * namespace X {
+ * class C {};
+ * using namespace XX;
+ * }
+ * using namespace X;
+ *
+ * typetab in scope '' inherits from 'X'
+ * typetab in scope 'X' inherits from 'XX' and contains:
+ * "C" : "C"
+ * typetab in scope 'XX' contains:
+ * "CC" : "CC"
+ *
+ *
* The scope-inheritance mechanism is used to manage C++ namespace aliases.
* For example, if you have this:
*
- * namespace Foo {
- * typedef int Integer;
- * }
+ * namespace Foo {
+ * typedef int Integer;
+ * }
*
- * namespace F = Foo;
+ * namespace F = Foo;
*
- * In this case, "F::" is defined as a scope that "inherits" from Foo. Internally,
- * "F::" will merely be an empty scope that refers to Foo. SWIG will never
+ * In this case, F is defined as a scope that "inherits" from Foo. Internally,
+ * F will merely be an empty scope that points to Foo. SWIG will never
* place new type information into a namespace alias---attempts to do so
* will generate a warning message (in the parser) and will place information into
* Foo instead.
@@ -166,6 +215,7 @@ void SwigType_typesystem_init() {
* ----------------------------------------------------------------------------- */
int SwigType_typedef(const SwigType *type, const_String_or_char_ptr name) {
+ /* Printf(stdout, "typedef %s %s\n", type, name); */
if (Getattr(current_typetab, name))
return -1; /* Already defined */
if (Strcmp(type, name) == 0) { /* Can't typedef a name to itself */
@@ -248,10 +298,26 @@ void SwigType_new_scope(const_String_or_char_ptr name) {
ttab = NewHash();
Setattr(s, "typetab", ttab);
- /* Build fully qualified name and */
+ /* Build fully qualified name */
qname = SwigType_scope_name(s);
+#if 1
+ {
+ /* TODO: only do with templates? What happens with non-templates with code below? */
+ String *stripped_qname;
+ stripped_qname = SwigType_remove_global_scope_prefix(qname);
+ /* Use fully qualified name for hash key without unary scope prefix, qname may contain unary scope */
+ Setattr(scopes, stripped_qname, s);
+ Setattr(s, "qname", qname);
+ /*
+ Printf(stdout, "SwigType_new_scope stripped %s %s\n", qname, stripped_qname);
+ */
+ Delete(stripped_qname);
+ }
+#else
+ Printf(stdout, "SwigType_new_scope %s\n", qname);
Setattr(scopes, qname, s);
Setattr(s, "qname", qname);
+#endif
Delete(qname);
current_scope = s;
@@ -418,12 +484,14 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) {
Typetab *s_orig = s;
String *nnameprefix = 0;
static int check_parent = 1;
+ int is_template = 0;
if (Getmark(s))
return 0;
Setmark(s, 1);
- if (SwigType_istemplate(nameprefix)) {
+ is_template = SwigType_istemplate(nameprefix);
+ if (is_template) {
nnameprefix = SwigType_typedef_resolve_all(nameprefix);
nameprefix = nnameprefix;
}
@@ -437,10 +505,12 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) {
} else {
full = NewString(nameprefix);
}
- if (Getattr(scopes, full)) {
- s = Getattr(scopes, full);
- } else {
- s = 0;
+ s = Getattr(scopes, full);
+ if (!s && is_template) {
+ /* try look up scope with all the unary scope operators within the template parameter list removed */
+ SwigType *full_stripped = SwigType_remove_global_scope_prefix(full);
+ s = Getattr(scopes, full_stripped);
+ Delete(full_stripped);
}
Delete(full);
if (s) {
@@ -500,7 +570,7 @@ static SwigType *_typedef_resolve(Typetab *s, String *base, int look_parent) {
List *inherit;
Typetab *parent;
- /* if (!s) return 0; *//* now is checked bellow */
+ /* if (!s) return 0; *//* now is checked below */
/* Printf(stdout,"Typetab %s : %s\n", Getattr(s,"name"), base); */
if (!Getmark(s)) {
@@ -541,8 +611,11 @@ static SwigType *_typedef_resolve(Typetab *s, String *base, int look_parent) {
/* -----------------------------------------------------------------------------
* template_parameters_resolve()
*
- * For use with templates only. The template parameters are resolved. If none
- * of the parameters can be resolved, zero is returned.
+ * For use with templates only. Attempts to resolve one template parameter.
+ *
+ * If one of the template parameters can be resolved, the type is returned with
+ * just the one parameter resolved and the remaining parameters left as is.
+ * If none of the template parameters can be resolved, zero is returned.
* ----------------------------------------------------------------------------- */
static String *template_parameters_resolve(const String *base) {
@@ -574,14 +647,15 @@ static String *template_parameters_resolve(const String *base) {
if ((i + 1) < sz)
Append(type, ",");
}
- Append(type, ")>");
- Append(type, suffix);
- Delete(suffix);
- Delete(tparms);
- if (!rep) {
+ if (rep) {
+ Append(type, ")>");
+ Append(type, suffix);
+ } else {
Delete(type);
type = 0;
}
+ Delete(suffix);
+ Delete(tparms);
return type;
}
@@ -592,6 +666,17 @@ static SwigType *typedef_resolve(Typetab *s, String *base) {
/* -----------------------------------------------------------------------------
* SwigType_typedef_resolve()
+ *
+ * Given a type declaration, this function looks to reduce/resolve the type via a
+ * typedef (including via C++ using declarations).
+ *
+ * If it is able to find a typedef, the resolved type is returned. If no typedef
+ * is found NULL is returned. The type name is resolved in the current scope.
+ * The type returned is not always fully qualified for the global scope, it is
+ * valid for use in the current scope. If the current scope is global scope, a
+ * fully qualified type should be returned.
+ *
+ * Some additional notes are in Doc/Manual/Extending.html.
* ----------------------------------------------------------------------------- */
/* #define SWIG_DEBUG */
@@ -718,6 +803,25 @@ SwigType *SwigType_typedef_resolve(const SwigType *t) {
}
}
+ if (!type && SwigType_istemplate(base)) {
+ String *tprefix = SwigType_templateprefix(base);
+ String *rtprefix = SwigType_typedef_resolve(tprefix);
+ /* We're looking for a using declaration on the template prefix to resolve the template prefix
+ * in another scope. Using declaration do not have template parameters. */
+ if (rtprefix && !SwigType_istemplate(rtprefix)) {
+ String *tsuffix = SwigType_templatesuffix(base);
+ String *targs = SwigType_templateargs(base);
+ type = NewString(rtprefix);
+ newtype = 1;
+ Append(type, targs);
+ Append(type, tsuffix);
+ Delete(targs);
+ Delete(tsuffix);
+ Delete(rtprefix);
+ }
+ Delete(tprefix);
+ }
+
if (type && (Equal(base, type))) {
if (newtype)
Delete(type);
@@ -735,10 +839,8 @@ SwigType *SwigType_typedef_resolve(const SwigType *t) {
newtype = 1;
type = template_parameters_resolve(base);
}
- if (namebase)
- Delete(namebase);
- if (nameprefix)
- Delete(nameprefix);
+ Delete(namebase);
+ Delete(nameprefix);
} else {
if (SwigType_isfunction(base)) {
List *parms;
@@ -911,6 +1013,9 @@ SwigType *SwigType_typedef_resolve_all(const SwigType *t) {
return Copy(r);
}
+#ifdef SWIG_DEBUG
+ Printf(stdout, "SwigType_typedef_resolve_all start ... %s\n", t);
+#endif
/* Recursively resolve the typedef */
r = NewString(t);
while ((n = SwigType_typedef_resolve(r))) {
@@ -931,6 +1036,9 @@ SwigType *SwigType_typedef_resolve_all(const SwigType *t) {
Delete(key);
Delete(rr);
}
+#ifdef SWIG_DEBUG
+ Printf(stdout, "SwigType_typedef_resolve_all end === %s => %s\n", t, r);
+#endif
return r;
}
@@ -938,8 +1046,17 @@ SwigType *SwigType_typedef_resolve_all(const SwigType *t) {
/* -----------------------------------------------------------------------------
* SwigType_typedef_qualified()
*
- * Given a type declaration, this function tries to fully qualify it according to
- * typedef scope rules.
+ * Given a type declaration, this function tries to fully qualify it so that the
+ * resulting type can be used in the global scope. The type name is resolved in
+ * the current scope.
+ *
+ * It provides a fully qualified name, not necessarily a fully expanded name.
+ * When a using declaration or using directive is found the type may not be fully
+ * expanded, but it will be resolved and fully qualified for use in the global scope.
+ *
+ * This function is for looking up scopes to qualify a type. It does not resolve
+ * C typedefs, it just qualifies them. See SwigType_typedef_resolve for resolving.
+ *
* If the unary scope operator (::) is used as a prefix to the type to denote global
* scope, it is left in place.
* ----------------------------------------------------------------------------- */
@@ -1000,20 +1117,14 @@ SwigType *SwigType_typedef_qualified(const SwigType *t) {
out of the current scope */
Typetab *cs = current_scope;
- while (cs) {
- String *qs = SwigType_scope_name(cs);
- if (Len(qs)) {
- Append(qs, "::");
- }
- Append(qs, e);
- if (Getattr(scopes, qs)) {
+ if (cs) {
+ Typetab *found_scope = SwigType_find_scope(cs, e);
+ if (found_scope) {
+ String *qs = SwigType_scope_name(found_scope);
Clear(e);
Append(e, qs);
Delete(qs);
- break;
}
- Delete(qs);
- cs = Getattr(cs, "parent");
}
}
}
@@ -1029,10 +1140,6 @@ SwigType *SwigType_typedef_qualified(const SwigType *t) {
Parm *p;
List *parms;
ty = Swig_symbol_template_deftype(e, current_symtab);
- /*
- String *dt = Swig_symbol_template_deftype(e, current_symtab);
- ty = Swig_symbol_type_qualify(dt, 0);
- */
e = ty;
parms = SwigType_parmlist(e);
tprefix = SwigType_templateprefix(e);
@@ -1099,9 +1206,6 @@ SwigType *SwigType_typedef_qualified(const SwigType *t) {
Delete(tprefix);
Delete(qprefix);
Delete(parms);
- /*
- Delete(dt);
- */
}
Append(result, e);
Delete(ty);
@@ -1181,7 +1285,7 @@ int SwigType_typedef_using(const_String_or_char_ptr name) {
String *defined_name = 0;
- /* Printf(stdout,"using %s\n", name); */
+ /* Printf(stdout, "using %s\n", name); */
if (!Swig_scopename_check(name))
return -1; /* Not properly qualified */
@@ -1436,7 +1540,7 @@ SwigType *SwigType_alttype(const SwigType *t, int local_tmap) {
}
} else {
if (SwigType_issimple(td) && SwigType_istemplate(td)) {
- use_wrapper = !n || !GetFlag(n, "feature:novaluewrapper");
+ use_wrapper = 1;
}
}
}
diff --git a/TODO b/TODO
index 01d9a8d78..38ab4605d 100644
--- a/TODO
+++ b/TODO
@@ -275,74 +275,6 @@ Mzscheme
** Add shadow class support for the Swindle system.
-Pike
-----
-
-* Decide how to handle global variables (probably using something
- like the Python module's cvar). Affects Examples/pike/simple.
-
-* Decide how to handle static class member functions and member
- variables.
-
-* Should investigate the possibility of generating .cmod files
- in addition to straight C/C++ code for extensions.
-
-Common Lisp
------------
-
-* Random thoughts by mkoeppe on supporting Common Lisp implementations:
-
- There are many different Foreign Function Interfaces (FFI) for
- the various CL implementations. Probably SWIG should interface
- to UFFI, a least-common-denominator FFI that supports many
- implementations.
-
- Via the s-expression SWIG module we can export SWIG's parse
- tree and import it into CL. It remains to check if all
- relevant information is dumped (for instance, the type
- information). Experimental code is available to generate
- low-level UFFI declarations from this parse tree.
-
- However, for wrapping C++, we also need to create C wrappers
- because most FFIs cannot directly import C++. A CL SWIG module
- could be exporting both these wrappers and UFFI declarations.
- I have experimental code (not checked in yet) that does this.
-
- This is fine for generating low-level wrappers. But how do we
- support user typemaps (like converting lists and vectors to C
- arrays on input)? We have to generate Lisp code that does the
- conversion and then calls the low-level wrapper. If we
- generate Lisp code, it should be beautiful and readable.
- Therefore, we need at least a Lisp pretty printer. A Lisp
- pretty printer works best when the Lisp program is represented
- not as text but as Lisp data. Moreover, typemap writers will
- feel very much constrained by SWIG's capabilities for
- generating wrapper code, when compared to writing Lisp macros.
- Thus we would need half a re-implementation of Lisp in SWIG to
- make users happy.
-
- The solution could be the following:
-
-** Build a SWIG library (again) and load it into a Common Lisp
- implementation.
-
- The FFI declarations could be written manually, or this could
- be bootstrapped via the s-expression module or the primitive
- UFFI wrappers. This should be easy because SWIG's API is quite
- simple.
-
- The embedded SWIG would be driven by a CL program. High-level
- typemaps would be written as Lisp programs that generate Lisp
- code.
-
-ALLEGROCL
------
-These first three will remove most of the warnings from most of the
-remaining checkpartial tests that are failing.
-**** Throws typemap support
-**** const typemaps
-**** long long typemaps
-
Ocaml
-----
** I've been working with my camlp4 module and type information
diff --git a/Tools/config/ax_boost_base.m4 b/Tools/config/ax_boost_base.m4
index f3279f2b7..f5a935cd6 100644
--- a/Tools/config/ax_boost_base.m4
+++ b/Tools/config/ax_boost_base.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
+# https://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# ===========================================================================
#
# SYNOPSIS
@@ -33,7 +33,15 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 26
+#serial 45
+
+# example boost program (need to pass version)
+m4_define([_AX_BOOST_BASE_PROGRAM],
+ [AC_LANG_PROGRAM([[
+#include <boost/version.hpp>
+]],[[
+(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))]));
+]])])
AC_DEFUN([AX_BOOST_BASE],
[
@@ -44,104 +52,121 @@ AC_ARG_WITH([boost],
or disable it (ARG=no)
@<:@ARG=yes@:>@ ])],
[
- if test "$withval" = "no"; then
- want_boost="no"
- elif test "$withval" = "yes"; then
- want_boost="yes"
- ac_boost_path=""
- else
- want_boost="yes"
- ac_boost_path="$withval"
- fi
+ AS_CASE([$withval],
+ [no],[want_boost="no";_AX_BOOST_BASE_boost_path=""],
+ [yes],[want_boost="yes";_AX_BOOST_BASE_boost_path=""],
+ [want_boost="yes";_AX_BOOST_BASE_boost_path="$withval"])
],
[want_boost="yes"])
AC_ARG_WITH([boost-libdir],
- AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
- [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
- [
- if test -d "$withval"
- then
- ac_boost_lib_path="$withval"
- else
- AC_MSG_ERROR(--with-boost-libdir expected directory name)
- fi
- ],
- [ac_boost_lib_path=""]
-)
+ [AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
+ [Force given directory for boost libraries.
+ Note that this will override library path detection,
+ so use this parameter only if default library detection fails
+ and you know exactly where your boost libraries are located.])],
+ [
+ AS_IF([test -d "$withval"],
+ [_AX_BOOST_BASE_boost_lib_path="$withval"],
+ [AC_MSG_ERROR([--with-boost-libdir expected directory name])])
+ ],
+ [_AX_BOOST_BASE_boost_lib_path=""])
-if test "x$want_boost" = "xyes"; then
- boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
- boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
- boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
- boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
- boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
- if test "x$boost_lib_version_req_sub_minor" = "x" ; then
- boost_lib_version_req_sub_minor="0"
- fi
- WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
- AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
+BOOST_LDFLAGS=""
+BOOST_CPPFLAGS=""
+AS_IF([test "x$want_boost" = "xyes"],
+ [_AX_BOOST_BASE_RUNDETECT([$1],[$2],[$3])])
+AC_SUBST(BOOST_CPPFLAGS)
+AC_SUBST(BOOST_LDFLAGS)
+])
+
+
+# convert a version string in $2 to numeric and affect to polymorphic var $1
+AC_DEFUN([_AX_BOOST_BASE_TONUMERICVERSION],[
+ AS_IF([test "x$2" = "x"],[_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"],[_AX_BOOST_BASE_TONUMERICVERSION_req="$2"])
+ _AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\.[[0-9]]*\)'`
+ _AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\)'`
+ AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"],
+ [AC_MSG_ERROR([You should at least specify libboost major version])])
+ _AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.\([[0-9]]*\)'`
+ AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"],
+ [_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"])
+ _AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+ AS_IF([test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"],
+ [_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"])
+ _AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor`
+ AS_VAR_SET($1,$_AX_BOOST_BASE_TONUMERICVERSION_RET)
+])
+
+dnl Run the detection of boost should be run only if $want_boost
+AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
+ _AX_BOOST_BASE_TONUMERICVERSION(WANT_BOOST_VERSION,[$1])
succeeded=no
+
+ AC_REQUIRE([AC_CANONICAL_HOST])
dnl On 64-bit systems check for system libraries in both lib64 and lib.
dnl The former is specified by FHS, but e.g. Debian does not adhere to
dnl this (as it rises problems for generic multi-arch support).
dnl The last entry in the list is chosen by default when no libraries
dnl are found, e.g. when only header-only libraries are installed!
- libsubdirs="lib"
- ax_arch=`uname -m`
- case $ax_arch in
- x86_64)
- libsubdirs="lib64 libx32 lib lib64"
- ;;
- ppc64|s390x|sparc64|aarch64|ppc64le)
- libsubdirs="lib64 lib lib64 ppc64le"
- ;;
- esac
+ AS_CASE([${host_cpu}],
+ [x86_64],[libsubdirs="lib64 libx32 lib lib64"],
+ [ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64],[libsubdirs="lib64 lib lib64"],
+ [libsubdirs="lib"]
+ )
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
dnl them priority over the other paths since, if libs are found there, they
dnl are almost assuredly the ones desired.
- AC_REQUIRE([AC_CANONICAL_HOST])
- libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
-
- case ${host_cpu} in
- i?86)
- libsubdirs="lib/i386-${host_os} $libsubdirs"
- ;;
- esac
+ AS_CASE([${host_cpu}],
+ [i?86],[multiarch_libsubdir="lib/i386-${host_os}"],
+ [multiarch_libsubdir="lib/${host_cpu}-${host_os}"]
+ )
dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
- if test "$ac_boost_path" != ""; then
- BOOST_CPPFLAGS="-I$ac_boost_path/include"
- for ac_boost_path_tmp in $libsubdirs; do
- if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
- BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
- break
- fi
- done
- elif test "$cross_compiling" != yes; then
- for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
- if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
- for libsubdir in $libsubdirs ; do
- if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ AS_IF([test "x$_AX_BOOST_BASE_boost_path" != "x"],[
+ AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) includes in "$_AX_BOOST_BASE_boost_path/include"])
+ AS_IF([test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"],[
+ AC_MSG_RESULT([yes])
+ BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
+ for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
+ AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) lib path in "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"])
+ AS_IF([test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ],[
+ AC_MSG_RESULT([yes])
+ BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp";
+ break;
+ ],
+ [AC_MSG_RESULT([no])])
+ done],[
+ AC_MSG_RESULT([no])])
+ ],[
+ if test X"$cross_compiling" = Xyes; then
+ search_libsubdirs=$multiarch_libsubdir
+ else
+ search_libsubdirs="$multiarch_libsubdir $libsubdirs"
+ fi
+ for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+ if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then
+ for libsubdir in $search_libsubdirs ; do
+ if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
- BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
- BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+ BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir"
+ BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include"
break;
fi
done
- fi
+ ])
dnl overwrite ld flags if we have required special directory with
dnl --with-boost-libdir parameter
- if test "$ac_boost_lib_path" != ""; then
- BOOST_LDFLAGS="-L$ac_boost_lib_path"
- fi
+ AS_IF([test "x$_AX_BOOST_BASE_boost_lib_path" != "x"],
+ [BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"])
+ AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION)])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
@@ -152,60 +177,61 @@ if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CXX])
AC_LANG_PUSH(C++)
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- @%:@include <boost/version.hpp>
- ]], [[
- #if BOOST_VERSION >= $WANT_BOOST_VERSION
- // Everything is okay
- #else
- # error Boost version is too old
- #endif
- ]])],[
+ AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
- ],[
- ])
+ ],[])
AC_LANG_POP([C++])
dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version
- if test "x$succeeded" != "xyes"; then
+ if test "x$succeeded" != "xyes" ; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
BOOST_CPPFLAGS=
- BOOST_LDFLAGS=
+ if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
+ BOOST_LDFLAGS=
+ fi
_version=0
- if test "$ac_boost_path" != ""; then
- if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
- for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
- _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+ if test -n "$_AX_BOOST_BASE_boost_path" ; then
+ if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then
+ for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
- if test "$V_CHECK" = "1" ; then
+ if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
- BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
+ BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE"
done
dnl if nothing found search for layout used in Windows distributions
if test -z "$BOOST_CPPFLAGS"; then
- if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
- BOOST_CPPFLAGS="-I$ac_boost_path"
+ if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then
+ BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path"
fi
fi
+ dnl if we found something and BOOST_LDFLAGS was unset before
+ dnl (because "$_AX_BOOST_BASE_boost_lib_path" = ""), set it here.
+ if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then
+ for libsubdir in $libsubdirs ; do
+ if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ done
+ BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir"
+ fi
fi
else
- if test "$cross_compiling" != yes; then
- for ac_boost_path in /usr /usr/local /opt /opt/local ; do
- if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
- for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
- _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+ if test "x$cross_compiling" != "xyes" ; then
+ for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do
+ if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then
+ for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
- if test "$V_CHECK" = "1" ; then
+ if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
- best_path=$ac_boost_path
+ best_path=$_AX_BOOST_BASE_boost_path
fi
done
fi
@@ -213,7 +239,7 @@ if test "x$want_boost" = "xyes"; then
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
- if test "$ac_boost_lib_path" = ""; then
+ if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
@@ -221,7 +247,7 @@ if test "x$want_boost" = "xyes"; then
fi
fi
- if test "x$BOOST_ROOT" != "x"; then
+ if test -n "$BOOST_ROOT" ; then
for libsubdir in $libsubdirs ; do
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
@@ -230,7 +256,7 @@ if test "x$want_boost" = "xyes"; then
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
- if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
+ if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
@@ -245,34 +271,23 @@ if test "x$want_boost" = "xyes"; then
export LDFLAGS
AC_LANG_PUSH(C++)
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- @%:@include <boost/version.hpp>
- ]], [[
- #if BOOST_VERSION >= $WANT_BOOST_VERSION
- // Everything is okay
- #else
- # error Boost version is too old
- #endif
- ]])],[
+ AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
- ],[
- ])
+ ],[])
AC_LANG_POP([C++])
fi
- if test "$succeeded" != "yes" ; then
- if test "$_version" = "0" ; then
- AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
+ if test "x$succeeded" != "xyes" ; then
+ if test "x$_version" = "x0" ; then
+ AC_MSG_NOTICE([[We could not detect the boost libraries (version $1 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
fi
# execute ACTION-IF-NOT-FOUND (if present):
ifelse([$3], , :, [$3])
else
- AC_SUBST(BOOST_CPPFLAGS)
- AC_SUBST(BOOST_LDFLAGS)
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
# execute ACTION-IF-FOUND (if present):
ifelse([$2], , :, [$2])
@@ -280,6 +295,5 @@ if test "x$want_boost" = "xyes"; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
-fi
])
diff --git a/Tools/config/ax_compare_version.m4 b/Tools/config/ax_compare_version.m4
index 74dc0fdd9..ffb4997e8 100644
--- a/Tools/config/ax_compare_version.m4
+++ b/Tools/config/ax_compare_version.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
# ===========================================================================
#
# SYNOPSIS
@@ -79,7 +79,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 11
+#serial 13
dnl #########################################################################
AC_DEFUN([AX_COMPARE_VERSION], [
@@ -146,7 +146,7 @@ x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],
[.+],[
AC_WARNING(
- [illegal OP numeric parameter: $2])
+ [invalid OP numeric parameter: $2])
],[])
# Pad zeros at end of numbers to make same length.
@@ -162,7 +162,7 @@ x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
[ne],[
test "x$A" != "x$B" && ax_compare_version=true
],[
- AC_WARNING([illegal OP parameter: $2])
+ AC_WARNING([invalid OP parameter: $2])
])
])
diff --git a/Tools/config/ax_path_generic.m4 b/Tools/config/ax_path_generic.m4
index f77fc78d6..87966890b 100644
--- a/Tools/config/ax_path_generic.m4
+++ b/Tools/config/ax_path_generic.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_path_generic.html
+# https://www.gnu.org/software/autoconf-archive/ax_path_generic.html
# ===========================================================================
#
# SYNOPSIS
@@ -14,11 +14,11 @@
# The script must support `--cflags' and `--libs' args. If MINIMUM-VERSION
# is specified, the script must also support the `--version' arg. If the
# `--with-library-[exec-]prefix' arguments to ./configure are given, it
-# must also support `--prefix' and `--exec-prefix'. Prefereable use
+# must also support `--prefix' and `--exec-prefix'. Preferably use
# CONFIG-SCRIPTS as config script, CFLAGS-ARG instead of `--cflags` and
# LIBS-ARG instead of `--libs`, if given.
#
-# The SED-EXPR-EXTRACTOR parameter representes the expression used in sed
+# The SED-EXPR-EXTRACTOR parameter represents the expression used in sed
# to extract the version number. Use it if your 'foo-config --version'
# dumps something like 'Foo library v1.0.0 (alfa)' instead of '1.0.0'.
#
@@ -69,7 +69,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 13
+#serial 17
AU_ALIAS([AC_PATH_GENERIC], [AX_PATH_GENERIC])
AC_DEFUN([AX_PATH_GENERIC],[
diff --git a/Tools/config/compile b/Tools/config/compile
new file mode 100755
index 000000000..99e50524b
--- /dev/null
+++ b/Tools/config/compile
@@ -0,0 +1,348 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2018-03-07.03; # UTC
+
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+ func_file_conv "$1"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+ lib=$1
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ lib=$dir/$lib.dll.lib
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ lib=$dir/$lib.lib
+ break
+ fi
+ if test -f "$dir/lib$lib.a"; then
+ found=yes
+ lib=$dir/lib$lib.a
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ if test "$found" != yes; then
+ lib=$lib.lib
+ fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I)
+ eat=1
+ func_file_conv "$2" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l)
+ eat=1
+ func_cl_dashl "$2"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -l*)
+ func_cl_dashl "${1#-l}"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -L)
+ eat=1
+ func_cl_dashL "$2"
+ ;;
+ -L*)
+ func_cl_dashL "${1#-L}"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
+ eat=1
+ linker_opts="$linker_opts $2"
+ ;;
+ -*)
+ set x "$@" "$1"
+ shift
+ ;;
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+ func_file_conv "$1"
+ set x "$@" -Tp"$file"
+ shift
+ ;;
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+ func_file_conv "$1" mingw
+ set x "$@" "$file"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+ done
+ if test -n "$linker_opts"; then
+ linker_opts="-link$linker_opts"
+ fi
+ exec "$@" $linker_opts
+ exit 1
+}
+
+eat=
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
+ func_cl_wrapper "$@" # Doesn't return...
+ ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ # So we strip '-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no '-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # '.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/Tools/config/config.guess b/Tools/config/config.guess
new file mode 100755
index 000000000..f50dcdb6d
--- /dev/null
+++ b/Tools/config/config.guess
@@ -0,0 +1,1480 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright 1992-2018 Free Software Foundation, Inc.
+
+timestamp='2018-02-24'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+#
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
+#
+# You can get the latest version of this script from:
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+#
+# Please send patches to <config-patches@gnu.org>.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Options:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright 1992-2018 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > "$dummy.c" ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "$UNAME_SYSTEM" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ LIBC=gnu
+
+ eval "$set_cc_for_build"
+ cat <<-EOF > "$dummy.c"
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #else
+ LIBC=gnu
+ #endif
+ EOF
+ eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
+
+ # If ldd exists, use it to detect musl libc.
+ if command -v ldd >/dev/null && \
+ ldd --version 2>&1 | grep -q ^musl
+ then
+ LIBC=musl
+ fi
+ ;;
+esac
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+ "/sbin/$sysctl" 2>/dev/null || \
+ "/usr/sbin/$sysctl" 2>/dev/null || \
+ echo unknown)`
+ case "$UNAME_MACHINE_ARCH" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ earmv*)
+ arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+ endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
+ machine="${arch}${endian}"-unknown
+ ;;
+ *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently (or will in the future) and ABI.
+ case "$UNAME_MACHINE_ARCH" in
+ earm*)
+ os=netbsdelf
+ ;;
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval "$set_cc_for_build"
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # Determine ABI tags.
+ case "$UNAME_MACHINE_ARCH" in
+ earm*)
+ expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+ abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "$UNAME_VERSION" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "$machine-${os}${release}${abi}"
+ exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
+ exit ;;
+ *:LibertyBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+ echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
+ exit ;;
+ *:MidnightBSD:*:*)
+ echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
+ exit ;;
+ *:SolidBSD:*:*)
+ echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
+ exit ;;
+ *:MirBSD:*:*)
+ echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
+ exit ;;
+ *:Sortix:*:*)
+ echo "$UNAME_MACHINE"-unknown-sortix
+ exit ;;
+ *:Redox:*:*)
+ echo "$UNAME_MACHINE"-unknown-redox
+ exit ;;
+ mips:OSF1:*.*)
+ echo mips-dec-osf1
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE=alpha ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE=alpha ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE=alpha ;;
+ "EV5 (21164)")
+ UNAME_MACHINE=alphaev5 ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE=alphaev56 ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE=alphapca56 ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE=alphapca57 ;;
+ "EV6 (21264)")
+ UNAME_MACHINE=alphaev6 ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE=alphaev67 ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE=alphaev68 ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE=alphaev68 ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE=alphaev68 ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE=alphaev69 ;;
+ "EV7 (21364)")
+ UNAME_MACHINE=alphaev7 ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE=alphaev79 ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ exitcode=$?
+ trap '' 0
+ exit $exitcode ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo "$UNAME_MACHINE"-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo "$UNAME_MACHINE"-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix"$UNAME_RELEASE"
+ exit ;;
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ s390x:SunOS:*:*)
+ echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
+ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
+ exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux"$UNAME_RELEASE"
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval "$set_cc_for_build"
+ SUN_ARCH=i386
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH=x86_64
+ fi
+ fi
+ echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos"$UNAME_RELEASE"
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos"$UNAME_RELEASE"
+ ;;
+ sun4)
+ echo sparc-sun-sunos"$UNAME_RELEASE"
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos"$UNAME_RELEASE"
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint"$UNAME_RELEASE"
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint"$UNAME_RELEASE"
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint"$UNAME_RELEASE"
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint"$UNAME_RELEASE"
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint"$UNAME_RELEASE"
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint"$UNAME_RELEASE"
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten"$UNAME_RELEASE"
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten"$UNAME_RELEASE"
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix"$UNAME_RELEASE"
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix"$UNAME_RELEASE"
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix"$UNAME_RELEASE"
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
+ dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos"$UNAME_RELEASE"
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
+ then
+ if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
+ [ "$TARGET_BINARY_INTERFACE"x = x ]
+ then
+ echo m88k-dg-dgux"$UNAME_RELEASE"
+ else
+ echo m88k-dg-dguxbcs"$UNAME_RELEASE"
+ fi
+ else
+ echo i586-dg-dgux"$UNAME_RELEASE"
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+ fi
+ echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/lslpp ] ; then
+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
+ else
+ IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+ fi
+ echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+ case "$UNAME_MACHINE" in
+ 9000/31?) HP_ARCH=m68000 ;;
+ 9000/[34]??) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "$sc_cpu_version" in
+ 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "$sc_kernel_bits" in
+ 32) HP_ARCH=hppa2.0n ;;
+ 64) HP_ARCH=hppa2.0w ;;
+ '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "$HP_ARCH" = "" ]; then
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ "$HP_ARCH" = hppa2.0w ]
+ then
+ eval "$set_cc_for_build"
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep -q __LP64__
+ then
+ HP_ARCH=hppa2.0w
+ else
+ HP_ARCH=hppa64
+ fi
+ fi
+ echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux"$HPUX_REV"
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo "$UNAME_MACHINE"-unknown-osf1mk
+ else
+ echo "$UNAME_MACHINE"-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi"$UNAME_RELEASE"
+ exit ;;
+ *:BSD/OS:*:*)
+ echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
+ exit ;;
+ *:FreeBSD:*:*)
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case "$UNAME_PROCESSOR" in
+ amd64)
+ UNAME_PROCESSOR=x86_64 ;;
+ i386)
+ UNAME_PROCESSOR=i586 ;;
+ esac
+ echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
+ exit ;;
+ i*:CYGWIN*:*)
+ echo "$UNAME_MACHINE"-pc-cygwin
+ exit ;;
+ *:MINGW64*:*)
+ echo "$UNAME_MACHINE"-pc-mingw64
+ exit ;;
+ *:MINGW*:*)
+ echo "$UNAME_MACHINE"-pc-mingw32
+ exit ;;
+ *:MSYS*:*)
+ echo "$UNAME_MACHINE"-pc-msys
+ exit ;;
+ i*:PW*:*)
+ echo "$UNAME_MACHINE"-pc-pw32
+ exit ;;
+ *:Interix*:*)
+ case "$UNAME_MACHINE" in
+ x86)
+ echo i586-pc-interix"$UNAME_RELEASE"
+ exit ;;
+ authenticamd | genuineintel | EM64T)
+ echo x86_64-unknown-interix"$UNAME_RELEASE"
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix"$UNAME_RELEASE"
+ exit ;;
+ esac ;;
+ i*:UWIN*:*)
+ echo "$UNAME_MACHINE"-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
+ exit ;;
+ i*86:Minix:*:*)
+ echo "$UNAME_MACHINE"-pc-minix
+ exit ;;
+ aarch64:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ arm*:Linux:*:*)
+ eval "$set_cc_for_build"
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ else
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
+ else
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
+ fi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ cris:Linux:*:*)
+ echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
+ exit ;;
+ crisv32:Linux:*:*)
+ echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
+ exit ;;
+ e2k:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ frv:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ hexagon:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ i*86:Linux:*:*)
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
+ exit ;;
+ ia64:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ k1om:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ m32r*:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ m68*:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ mips:Linux:*:* | mips64:Linux:*:*)
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
+ #undef CPU
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=${UNAME_MACHINE}el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=${UNAME_MACHINE}
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
+ test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
+ ;;
+ mips64el:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ openrisc*:Linux:*:*)
+ echo or1k-unknown-linux-"$LIBC"
+ exit ;;
+ or32:Linux:*:* | or1k*:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-"$LIBC"
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-"$LIBC"
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
+ PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
+ *) echo hppa-unknown-linux-"$LIBC" ;;
+ esac
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-"$LIBC"
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-"$LIBC"
+ exit ;;
+ ppc64le:Linux:*:*)
+ echo powerpc64le-unknown-linux-"$LIBC"
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-"$LIBC"
+ exit ;;
+ riscv32:Linux:*:* | riscv64:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
+ exit ;;
+ sh64*:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ sh*:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ tile*:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ vax:Linux:*:*)
+ echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
+ exit ;;
+ x86_64:Linux:*:*)
+ if objdump -f /bin/sh | grep -q elf32-x86-64; then
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32
+ else
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
+ fi
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ exit ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo "$UNAME_MACHINE"-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo "$UNAME_MACHINE"-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo "$UNAME_MACHINE"-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo "$UNAME_MACHINE"-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ echo i386-unknown-lynxos"$UNAME_RELEASE"
+ exit ;;
+ i*86:*DOS:*:*)
+ echo "$UNAME_MACHINE"-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:*)
+ UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
+ else
+ echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
+ else
+ echo "$UNAME_MACHINE"-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configure will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos"$UNAME_RELEASE"
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos"$UNAME_RELEASE"
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos"$UNAME_RELEASE"
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ echo powerpc-unknown-lynxos"$UNAME_RELEASE"
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv"$UNAME_RELEASE"
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo "$UNAME_MACHINE"-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo "$UNAME_MACHINE"-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux"$UNAME_RELEASE"
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv"$UNAME_RELEASE"
+ else
+ echo mips-unknown-sysv"$UNAME_RELEASE"
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux"$UNAME_RELEASE"
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux"$UNAME_RELEASE"
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux"$UNAME_RELEASE"
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux"$UNAME_RELEASE"
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux"$UNAME_RELEASE"
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux"$UNAME_RELEASE"
+ exit ;;
+ SX-ACE:SUPER-UX:*:*)
+ echo sxace-nec-superux"$UNAME_RELEASE"
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody"$UNAME_RELEASE"
+ exit ;;
+ *:Rhapsody:*:*)
+ echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ eval "$set_cc_for_build"
+ if test "$UNAME_PROCESSOR" = unknown ; then
+ UNAME_PROCESSOR=powerpc
+ fi
+ if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
+ fi
+ fi
+ elif test "$UNAME_PROCESSOR" = i386 ; then
+ # Avoid executing cc on OS X 10.9, as it ships with a stub
+ # that puts up a graphical alert prompting to install
+ # developer tools. Any system running Mac OS X 10.7 or
+ # later (Darwin 11 and later) is required to have a 64-bit
+ # processor. This is not true of the ARM version of Darwin
+ # that Apple uses in portable devices.
+ UNAME_PROCESSOR=x86_64
+ fi
+ echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = x86; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NEO-*:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk"$UNAME_RELEASE"
+ exit ;;
+ NSE-*:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk"$UNAME_RELEASE"
+ exit ;;
+ NSR-*:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk"$UNAME_RELEASE"
+ exit ;;
+ NSV-*:NONSTOP_KERNEL:*:*)
+ echo nsv-tandem-nsk"$UNAME_RELEASE"
+ exit ;;
+ NSX-*:NONSTOP_KERNEL:*:*)
+ echo nsx-tandem-nsk"$UNAME_RELEASE"
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = 386; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo "$UNAME_MACHINE"-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux"$UNAME_RELEASE"
+ exit ;;
+ *:DragonFly:*:*)
+ echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "$UNAME_MACHINE" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
+ exit ;;
+ i*86:rdos:*:*)
+ echo "$UNAME_MACHINE"-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo "$UNAME_MACHINE"-pc-aros
+ exit ;;
+ x86_64:VMkernel:*:*)
+ echo "$UNAME_MACHINE"-unknown-esx
+ exit ;;
+ amd64:Isilon\ OneFS:*:*)
+ echo x86_64-unknown-onefs
+ exit ;;
+esac
+
+echo "$0: unable to guess system type" >&2
+
+case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+ mips:Linux | mips64:Linux)
+ # If we got here on MIPS GNU/Linux, output extra information.
+ cat >&2 <<EOF
+
+NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
+the system type. Please install a C compiler and try again.
+EOF
+ ;;
+esac
+
+cat >&2 <<EOF
+
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite *all*
+copies of config.guess and config.sub with the latest versions from:
+
+ https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+and
+ https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = "$UNAME_MACHINE"
+UNAME_RELEASE = "$UNAME_RELEASE"
+UNAME_SYSTEM = "$UNAME_SYSTEM"
+UNAME_VERSION = "$UNAME_VERSION"
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-functions 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/Tools/config/config.sub b/Tools/config/config.sub
new file mode 100755
index 000000000..1d8e98bce
--- /dev/null
+++ b/Tools/config/config.sub
@@ -0,0 +1,1801 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright 1992-2018 Free Software Foundation, Inc.
+
+timestamp='2018-02-22'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches to <config-patches@gnu.org>.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
+
+Canonicalize a configuration name.
+
+Options:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2018 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo "$1"
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+ kopensolaris*-gnu* | cloudabi*-eabi* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
+ *)
+ basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
+ if [ "$basic_machine" != "$1" ]
+ then os=`echo "$1" | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray | -microblaze*)
+ os=
+ basic_machine=$1
+ ;;
+ -bluegene*)
+ os=-cnk
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | ba \
+ | be32 | be64 \
+ | bfin \
+ | c4x | c8051 | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | e2k | epiphany \
+ | fido | fr30 | frv | ft32 \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i860 | i960 | ia16 | ia64 \
+ | ip2k | iq2000 \
+ | k1om \
+ | le32 | le64 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r6 | mipsisa32r6el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r6 | mipsisa64r6el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nios | nios2 | nios2eb | nios2el \
+ | ns16k | ns32k \
+ | open8 | or1k | or1knd | or32 \
+ | pdp10 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pru \
+ | pyramid \
+ | riscv32 | riscv64 \
+ | rl78 | rx \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu \
+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | visium \
+ | wasm32 \
+ | x86 | xc16x | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ c54x)
+ basic_machine=tic54x-unknown
+ ;;
+ c55x)
+ basic_machine=tic55x-unknown
+ ;;
+ c6x)
+ basic_machine=tic6x-unknown
+ ;;
+ leon|leon[3-9])
+ basic_machine=sparc-$basic_machine
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ strongarm | thumb | xscale)
+ basic_machine=arm-unknown
+ ;;
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ xscaleeb)
+ basic_machine=armeb-unknown
+ ;;
+
+ xscaleel)
+ basic_machine=armel-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | aarch64-* | aarch64_be-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | ba-* \
+ | be32-* | be64-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | e2k-* | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
+ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | k1om-* \
+ | le32-* | le64-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa32r6-* | mipsisa32r6el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64r6-* | mipsisa64r6el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | open8-* \
+ | or1k*-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pru-* \
+ | pyramid-* \
+ | riscv32-* | riscv64-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
+ | tahoe-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile*-* \
+ | tron-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
+ | visium-* \
+ | wasm32-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-pc
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ asmjs)
+ basic_machine=asmjs-unknown
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
+ c54x-*)
+ basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ c55x-*)
+ basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ c6x-*)
+ basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16 | cr16-*)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2*)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ e500v[12])
+ basic_machine=powerpc-unknown
+ os=$os"spe"
+ ;;
+ e500v[12]-*)
+ basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ os=$os"spe"
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+ i*86v32)
+ basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ leon-*|leon[3-9]-*)
+ basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ microblaze*)
+ basic_machine=microblaze-xilinx
+ ;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
+ mingw32)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ os=-moxiebox
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
+ ;;
+ msys)
+ basic_machine=i686-pc
+ os=-msys
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next)
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ nsv-tandem)
+ basic_machine=nsv-tandem
+ ;;
+ nsx-tandem)
+ basic_machine=nsx-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc | ppcbe) basic_machine=powerpc-unknown
+ ;;
+ ppc-* | ppcbe-*)
+ basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ strongarm-* | thumb-*)
+ basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tile*)
+ basic_machine=$basic_machine-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ x64)
+ basic_machine=x86_64-pc
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ xscale-* | xscalee[bl]-*)
+ basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases that might get confused
+ # with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # es1800 is here to avoid being matched by es* (a different OS)
+ -es1800*)
+ os=-ose
+ ;;
+ # Now accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST end in a * to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* | -plan9* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* | -cloudabi* | -sortix* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
+ | -midnightbsd*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -xray | -os68k* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo "$os" | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2)
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -pikeos*)
+ # Until real need of OS specific support for
+ # particular features comes up, bare metal
+ # configurations are quite functional.
+ case $basic_machine in
+ arm*)
+ os=-eabi
+ ;;
+ *)
+ os=-elf
+ ;;
+ esac
+ ;;
+ -nacl*)
+ ;;
+ -ios)
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ c8051-*)
+ os=-elf
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
+ tic54x-*)
+ os=-coff
+ ;;
+ tic55x-*)
+ os=-coff
+ ;;
+ tic6x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ pru-*)
+ os=-elf
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next)
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -cnk*|-aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo "$basic_machine$os"
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-functions 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/Tools/config/depcomp b/Tools/config/depcomp
new file mode 100755
index 000000000..65cbf7093
--- /dev/null
+++ b/Tools/config/depcomp
@@ -0,0 +1,791 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2018-03-07.03; # UTC
+
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputting dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'. Note that this directory component will
+# be either empty or ending with a '/' character. This is deliberate.
+set_dir_from ()
+{
+ case $1 in
+ */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+ *) dir=;;
+ esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+ base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+ echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+ # If the compiler actually managed to produce a dependency file,
+ # post-process it.
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependency.h'.
+ # Do two passes, one to just change these to
+ # $object: dependency.h
+ # and one to simply output
+ # dependency.h:
+ # which is needed to avoid the deleted-header problem.
+ { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+ sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+ } > "$depfile"
+ rm -f "$tmpdepfile"
+ else
+ make_dummy_depfile
+ fi
+}
+
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say). Also, it might not be
+## supported by the other compilers which use the 'gcc' depmode.
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The second -e expression handles DOS-style file names with drive
+ # letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the "deleted header file" problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+## Some versions of gcc put a space before the ':'. On the theory
+## that the space means something, we add a space to the output as
+## well. hp depmode also adds that space, but also prefixes the VPATH
+## to the object. Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like '#:fec' to the end of the
+ # dependency line.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+ | tr "$nl" ' ' >> "$depfile"
+ echo >> "$depfile"
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
+ else
+ make_dummy_depfile
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts '$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ set_dir_from "$object"
+ set_base_from "$object"
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ aix_post_process_depfile
+ ;;
+
+tcc)
+ # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+ # FIXME: That version still under development at the moment of writing.
+ # Make that this statement remains true also for stable, released
+ # versions.
+ # It will wrap lines (doesn't matter whether long or short) with a
+ # trailing '\', as in:
+ #
+ # foo.o : \
+ # foo.c \
+ # foo.h \
+ #
+ # It will put a trailing '\' even on the last line, and will use leading
+ # spaces rather than leading tabs (at least since its commit 0394caf7
+ # "Emit spaces for -MD").
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+ # We have to change lines of the first kind to '$object: \'.
+ sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+ # And for each line of the second kind, we have to emit a 'dep.h:'
+ # dummy dependency, to avoid the deleted-header problem.
+ sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file. A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+ # Portland's C compiler understands '-MD'.
+ # Will always output deps to 'file.d' where file is the root name of the
+ # source file under compilation, even if file resides in a subdirectory.
+ # The object file name does not affect the name of the '.d' file.
+ # pgcc 10.2 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using '\' :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+ set_dir_from "$object"
+ # Use the source, not the object, to determine the base name, since
+ # that's sadly what pgcc will do too.
+ set_base_from "$source"
+ tmpdepfile=$base.d
+
+ # For projects that build the same source file twice into different object
+ # files, the pgcc approach of using the *source* file root name can cause
+ # problems in parallel builds. Use a locking strategy to avoid stomping on
+ # the same $tmpdepfile.
+ lockdir=$base.d-lock
+ trap "
+ echo '$0: caught signal, cleaning up...' >&2
+ rmdir '$lockdir'
+ exit 1
+ " 1 2 13 15
+ numtries=100
+ i=$numtries
+ while test $i -gt 0; do
+ # mkdir is a portable test-and-set.
+ if mkdir "$lockdir" 2>/dev/null; then
+ # This process acquired the lock.
+ "$@" -MD
+ stat=$?
+ # Release the lock.
+ rmdir "$lockdir"
+ break
+ else
+ # If the lock is being held by a different process, wait
+ # until the winning process is done or we timeout.
+ while test -d "$lockdir" && test $i -gt 0; do
+ sleep 1
+ i=`expr $i - 1`
+ done
+ fi
+ i=`expr $i - 1`
+ done
+ trap - 1 2 13 15
+ if test $i -le 0; then
+ echo "$0: failed to acquire lock after $numtries attempts" >&2
+ echo "$0: check lockdir '$lockdir'" >&2
+ exit 1
+ fi
+
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ set_dir_from "$object"
+ set_base_from "$object"
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add 'dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ make_dummy_depfile
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in 'foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ set_dir_from "$object"
+ set_base_from "$object"
+
+ if test "$libtool" = yes; then
+ # Libtool generates 2 separate objects for the 2 libraries. These
+ # two compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir$base.o.d # libtool 1.5
+ tmpdepfile2=$dir.libs/$base.o.d # Likewise.
+ tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ # Same post-processing that is required for AIX mode.
+ aix_post_process_depfile
+ ;;
+
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/'"$tab"'/
+ G
+ p
+}' >> "$depfile"
+ echo >> "$depfile" # make sure the fragment doesn't end with a backslash
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for ':'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
+ "$@" $dashmflag |
+ sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this sed invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no eat=no
+ for arg
+ do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ # makedepend may prepend the VPATH from the source file name to the object.
+ # No need to regex-escape $object, excess matching of '.' is harmless.
+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process the last invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed '1,2d' "$tmpdepfile" \
+ | tr ' ' "$nl" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E \
+ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ | sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+ echo "$tab" >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/Tools/config/install-sh b/Tools/config/install-sh
new file mode 100755
index 000000000..8175c640f
--- /dev/null
+++ b/Tools/config/install-sh
@@ -0,0 +1,518 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2018-03-11.20; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+tab=' '
+nl='
+'
+IFS=" $tab$nl"
+
+# Set DOITPROG to "echo" to test this script.
+
+doit=${DOITPROG-}
+doit_exec=${doit:-exec}
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+is_target_a_directory=possibly
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
+
+ -T) is_target_a_directory=never;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call 'install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names problematic for 'test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename.
+ if test -d "$dst"; then
+ if test "$is_target_a_directory" = never; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dstbase=`basename "$src"`
+ case $dst in
+ */) dst=$dst$dstbase;;
+ *) dst=$dst/$dstbase;;
+ esac
+ dstdir_status=0
+ else
+ dstdir=`dirname "$dst"`
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ case $dstdir in
+ */) dstdirslash=$dstdir;;
+ *) dstdirslash=$dstdir/;;
+ esac
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ # Note that $RANDOM variable is not portable (e.g. dash); Use it
+ # here however when possible just to lower collision chance.
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ # Because "mkdir -p" follows existing symlinks and we likely work
+ # directly in world-writeable /tmp, make sure that the '$tmpdir'
+ # directory is successfully created first before we actually test
+ # 'mkdir -p' feature.
+ if (umask $mkdir_umask &&
+ $mkdirprog $mkdir_mode "$tmpdir" &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ test_tmpdir="$tmpdir/a"
+ ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ oIFS=$IFS
+ IFS=/
+ set -f
+ set fnord $dstdir
+ shift
+ set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=${dstdirslash}_inst.$$_
+ rmtmp=${dstdirslash}_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+ set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ set +f &&
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/Tools/config/missing b/Tools/config/missing
new file mode 100755
index 000000000..625aeb118
--- /dev/null
+++ b/Tools/config/missing
@@ -0,0 +1,215 @@
+#! /bin/sh
+# Common wrapper for a few potentially missing GNU programs.
+
+scriptversion=2018-03-07.03; # UTC
+
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try '$0 --help' for more information"
+ exit 1
+fi
+
+case $1 in
+
+ --is-lightweight)
+ # Used by our autoconf macros to check whether the available missing
+ # script is modern enough.
+ exit 0
+ ;;
+
+ --run)
+ # Back-compat with the calling convention used by older automake.
+ shift
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal autoconf autoheader autom4te automake makeinfo
+ bison yacc flex lex help2man
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch. This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+ msg="probably too old"
+elif test $st -eq 127; then
+ # Program was missing.
+ msg="missing on your system"
+else
+ # Program was found and executed, but failed. Give up.
+ exit $st
+fi
+
+perl_URL=https://www.perl.org/
+flex_URL=https://github.com/westes/flex
+gnu_software_URL=https://www.gnu.org/software
+
+program_details ()
+{
+ case $1 in
+ aclocal|automake)
+ echo "The '$1' program is part of the GNU Automake package:"
+ echo "<$gnu_software_URL/automake>"
+ echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/autoconf>"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ autoconf|autom4te|autoheader)
+ echo "The '$1' program is part of the GNU Autoconf package:"
+ echo "<$gnu_software_URL/autoconf/>"
+ echo "It also requires GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ esac
+}
+
+give_advice ()
+{
+ # Normalize program name to check for.
+ normalized_program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+ printf '%s\n' "'$1' is $msg."
+
+ configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+ case $normalized_program in
+ autoconf*)
+ echo "You should only need it if you modified 'configure.ac',"
+ echo "or m4 files included by it."
+ program_details 'autoconf'
+ ;;
+ autoheader*)
+ echo "You should only need it if you modified 'acconfig.h' or"
+ echo "$configure_deps."
+ program_details 'autoheader'
+ ;;
+ automake*)
+ echo "You should only need it if you modified 'Makefile.am' or"
+ echo "$configure_deps."
+ program_details 'automake'
+ ;;
+ aclocal*)
+ echo "You should only need it if you modified 'acinclude.m4' or"
+ echo "$configure_deps."
+ program_details 'aclocal'
+ ;;
+ autom4te*)
+ echo "You might have modified some maintainer files that require"
+ echo "the 'autom4te' program to be rebuilt."
+ program_details 'autom4te'
+ ;;
+ bison*|yacc*)
+ echo "You should only need it if you modified a '.y' file."
+ echo "You may want to install the GNU Bison package:"
+ echo "<$gnu_software_URL/bison/>"
+ ;;
+ lex*|flex*)
+ echo "You should only need it if you modified a '.l' file."
+ echo "You may want to install the Fast Lexical Analyzer package:"
+ echo "<$flex_URL>"
+ ;;
+ help2man*)
+ echo "You should only need it if you modified a dependency" \
+ "of a man page."
+ echo "You may want to install the GNU Help2man package:"
+ echo "<$gnu_software_URL/help2man/>"
+ ;;
+ makeinfo*)
+ echo "You should only need it if you modified a '.texi' file, or"
+ echo "any other file indirectly affecting the aspect of the manual."
+ echo "You might want to install the Texinfo package:"
+ echo "<$gnu_software_URL/texinfo/>"
+ echo "The spurious makeinfo call might also be the consequence of"
+ echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+ echo "want to install GNU make:"
+ echo "<$gnu_software_URL/make/>"
+ ;;
+ *)
+ echo "You might have modified some files without having the proper"
+ echo "tools for further handling them. Check the 'README' file, it"
+ echo "often tells you about the needed prerequisites for installing"
+ echo "this package. You may also peek at any GNU archive site, in"
+ echo "case some other package contains this missing '$1' program."
+ ;;
+ esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+ -e '2,$s/^/ /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/Tools/config/ylwrap b/Tools/config/ylwrap
new file mode 100755
index 000000000..5943168da
--- /dev/null
+++ b/Tools/config/ylwrap
@@ -0,0 +1,247 @@
+#! /bin/sh
+# ylwrap - wrapper for lex/yacc invocations.
+
+scriptversion=2018-03-07.03; # UTC
+
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+#
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+get_dirname ()
+{
+ case $1 in
+ */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';;
+ # Otherwise, we want the empty string (not ".").
+ esac
+}
+
+# guard FILE
+# ----------
+# The CPP macro used to guard inclusion of FILE.
+guard ()
+{
+ printf '%s\n' "$1" \
+ | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \
+ -e 's/__*/_/g'
+}
+
+# quote_for_sed [STRING]
+# ----------------------
+# Return STRING (or stdin) quoted to be used as a sed pattern.
+quote_for_sed ()
+{
+ case $# in
+ 0) cat;;
+ 1) printf '%s\n' "$1";;
+ esac \
+ | sed -e 's|[][\\.*]|\\&|g'
+}
+
+case "$1" in
+ '')
+ echo "$0: No files given. Try '$0 --help' for more information." 1>&2
+ exit 1
+ ;;
+ --basedir)
+ basedir=$2
+ shift 2
+ ;;
+ -h|--h*)
+ cat <<\EOF
+Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
+
+Wrapper for lex/yacc invocations, renaming files as desired.
+
+ INPUT is the input file
+ OUTPUT is one file PROG generates
+ DESIRED is the file we actually want instead of OUTPUT
+ PROGRAM is program to run
+ ARGS are passed to PROG
+
+Any number of OUTPUT,DESIRED pairs may be used.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v|--v*)
+ echo "ylwrap $scriptversion"
+ exit $?
+ ;;
+esac
+
+
+# The input.
+input=$1
+shift
+# We'll later need for a correct munging of "#line" directives.
+input_sub_rx=`get_dirname "$input" | quote_for_sed`
+case $input in
+ [\\/]* | ?:[\\/]*)
+ # Absolute path; do nothing.
+ ;;
+ *)
+ # Relative path. Make it absolute.
+ input=`pwd`/$input
+ ;;
+esac
+input_rx=`get_dirname "$input" | quote_for_sed`
+
+# Since DOS filename conventions don't allow two dots,
+# the DOS version of Bison writes out y_tab.c instead of y.tab.c
+# and y_tab.h instead of y.tab.h. Test to see if this is the case.
+y_tab_nodot=false
+if test -f y_tab.c || test -f y_tab.h; then
+ y_tab_nodot=true
+fi
+
+# The parser itself, the first file, is the destination of the .y.c
+# rule in the Makefile.
+parser=$1
+
+# A sed program to s/FROM/TO/g for all the FROM/TO so that, for
+# instance, we rename #include "y.tab.h" into #include "parse.h"
+# during the conversion from y.tab.c to parse.c.
+sed_fix_filenames=
+
+# Also rename header guards, as Bison 2.7 for instance uses its header
+# guard in its implementation file.
+sed_fix_header_guards=
+
+while test $# -ne 0; do
+ if test x"$1" = x"--"; then
+ shift
+ break
+ fi
+ from=$1
+ # Handle y_tab.c and y_tab.h output by DOS
+ if $y_tab_nodot; then
+ case $from in
+ "y.tab.c") from=y_tab.c;;
+ "y.tab.h") from=y_tab.h;;
+ esac
+ fi
+ shift
+ to=$1
+ shift
+ sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;"
+ sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;"
+done
+
+# The program to run.
+prog=$1
+shift
+# Make any relative path in $prog absolute.
+case $prog in
+ [\\/]* | ?:[\\/]*) ;;
+ *[\\/]*) prog=`pwd`/$prog ;;
+esac
+
+dirname=ylwrap$$
+do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
+trap "ret=129; $do_exit" 1
+trap "ret=130; $do_exit" 2
+trap "ret=141; $do_exit" 13
+trap "ret=143; $do_exit" 15
+mkdir $dirname || exit 1
+
+cd $dirname
+
+case $# in
+ 0) "$prog" "$input" ;;
+ *) "$prog" "$@" "$input" ;;
+esac
+ret=$?
+
+if test $ret -eq 0; then
+ for from in *
+ do
+ to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"`
+ if test -f "$from"; then
+ # If $2 is an absolute path name, then just use that,
+ # otherwise prepend '../'.
+ case $to in
+ [\\/]* | ?:[\\/]*) target=$to;;
+ *) target=../$to;;
+ esac
+
+ # Do not overwrite unchanged header files to avoid useless
+ # recompilations. Always update the parser itself: it is the
+ # destination of the .y.c rule in the Makefile. Divert the
+ # output of all other files to a temporary file so we can
+ # compare them to existing versions.
+ if test $from != $parser; then
+ realtarget=$target
+ target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'`
+ fi
+
+ # Munge "#line" or "#" directives. Don't let the resulting
+ # debug information point at an absolute srcdir. Use the real
+ # output file name, not yy.lex.c for instance. Adjust the
+ # include guards too.
+ sed -e "/^#/!b" \
+ -e "s|$input_rx|$input_sub_rx|" \
+ -e "$sed_fix_filenames" \
+ -e "$sed_fix_header_guards" \
+ "$from" >"$target" || ret=$?
+
+ # Check whether files must be updated.
+ if test "$from" != "$parser"; then
+ if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
+ echo "$to is unchanged"
+ rm -f "$target"
+ else
+ echo "updating $to"
+ mv -f "$target" "$realtarget"
+ fi
+ fi
+ else
+ # A missing file is only an error for the parser. This is a
+ # blatant hack to let us support using "yacc -d". If -d is not
+ # specified, don't fail when the header file is "missing".
+ if test "$from" = "$parser"; then
+ ret=1
+ fi
+ fi
+ done
+fi
+
+# Remove the directory.
+cd ..
+rm -rf $dirname
+
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/Tools/mkdist.py b/Tools/mkdist.py
index 11a0dd6cd..47cf8e765 100755
--- a/Tools/mkdist.py
+++ b/Tools/mkdist.py
@@ -1,100 +1,103 @@
#!/usr/bin/env python
-# This script builds a swig-x.y.z distribution.
-# Usage: mkdist.py version branch, where version should be x.y.z and branch is normally 'master'
-
import sys
-import string
import os
import subprocess
def failed():
- print "mkdist.py failed to complete"
- sys.exit(2)
-
-
-try:
- version = sys.argv[1]
- dirname = "swig-" + version
- branch = sys.argv[2]
-except:
- print "Usage: mkdist.py version branch, where version should be x.y.z and branch is normally 'master'"
- sys.exit(1)
+ print("mkdist.py failed to complete")
+ sys.exit(2)
+
+import argparse
+parser = argparse.ArgumentParser(description="Build a SWIG distribution tarball swig-x.y.z.tar.gz")
+parser.add_argument("version", help="version string in format x.y.z")
+parser.add_argument("-b", "--branch", required=False, default="master", help="git branch name to create tarball from [master]")
+parser.add_argument("-f", "--force-tag", required=False, action="store_true", help="force tag (replace git tag if it already exists)")
+parser.add_argument("-s", "--skip-checks", required=False, action="store_true", help="skip checks (that local and remote repos are in sync)")
+args = parser.parse_args()
+
+version = args.version
+branch = args.branch
+dirname = "swig-" + version
+force_tag = args.force_tag
+skip_checks = args.skip_checks
if sys.version_info[0:2] < (2, 7):
- print "Error: Python 2.7 is required"
- sys.exit(3)
-
+ print("Error: Python 2.7 or higher is required")
+ sys.exit(3)
# Check name matches normal unix conventions
-if string.lower(dirname) != dirname:
- print "directory name ("+dirname+") should be in lowercase"
- sys.exit(3)
+if dirname.lower() != dirname:
+ print("directory name (" + dirname + ") should be in lowercase")
+ sys.exit(3)
# If directory and tarball exist, remove it
-print "Removing ", dirname
-os.system("rm -rf "+dirname)
+print("Removing " + dirname)
+os.system("rm -rf " + dirname)
-print "Removing "+dirname+".tar if exists"
-os.system("rm -f "+dirname+".tar.gz")
+print("Removing " + dirname + ".tar if exists")
+os.system("rm -f " + dirname + ".tar.gz")
-print "Removing "+dirname+".tar.gz if exists"
-os.system("rm -f "+dirname+".tar")
+print("Removing " + dirname + ".tar.gz if exists")
+os.system("rm -f " + dirname + ".tar")
# Grab the code from git
-print "Checking git repository is in sync with remote repository"
+print("Checking there are no local changes in git repo")
os.system("git remote update origin") == 0 or failed()
command = ["git", "status", "--porcelain", "-uno"]
out = subprocess.check_output(command)
if out.strip() != "":
- print "Local git repository has modifications"
- print " ".join(command)
- print out
- sys.exit(3)
-
-command = ["git", "log", "--oneline", branch + "..origin/" + branch]
-out = subprocess.check_output(command)
-if out.strip() != "":
- print "Remote repository has additional modifications to local repository"
- print " ".join(command)
- print out
- sys.exit(3)
-
-command = ["git", "log", "--oneline", "origin/" + branch + ".." + branch]
-out = subprocess.check_output(command)
-if out.strip() != "":
- print "Local repository has modifications not pushed to the remote repository"
- print "These should be pushed and checked that they pass Continuous Integration testing before continuing"
- print " ".join(command)
- print out
- sys.exit(3)
-
-print "Tagging release"
+ print("Local git repository has modifications")
+ print(" ".join(command))
+ print(out)
+ sys.exit(3)
+
+if not skip_checks:
+ print("Checking git repository is in sync with remote repository")
+ command = ["git", "log", "--oneline", branch + "..origin/" + branch]
+ out = subprocess.check_output(command)
+ if out.strip() != "":
+ print("Remote repository has additional modifications to local repository")
+ print(" ".join(command))
+ print(out)
+ sys.exit(3)
+
+ command = ["git", "log", "--oneline", "origin/" + branch + ".." + branch]
+ out = subprocess.check_output(command)
+ if out.strip() != "":
+ print("Local repository has modifications not pushed to the remote repository")
+ print("These should be pushed and checked that they pass Continuous Integration testing before continuing")
+ print(" ".join(command))
+ print(out)
+ sys.exit(3)
+
+print("Tagging release")
tag = "'rel-" + version + "'"
-os.system("git tag -a -m " + tag + " " + tag) == 0 or failed()
+force = "-f " if force_tag else ""
+os.system("git tag -a -m " + tag + " " + force + tag) == 0 or failed()
outdir = os.path.basename(os.getcwd()) + "/" + dirname + "/"
-print "Grabbing tagged release git repository using 'git archive' into " + outdir
+print("Grabbing tagged release git repository using 'git archive' into " + outdir)
os.system("(cd .. && git archive --prefix=" + outdir + " " + tag + " . | tar -xf -)") == 0 or failed()
# Go build the system
-print "Building system"
-os.system("cd "+dirname+" && ./autogen.sh") == 0 or failed()
-os.system("cd "+dirname+"/Source/CParse && bison -y -d parser.y && mv y.tab.c parser.c && mv y.tab.h parser.h") == 0 or failed()
-os.system("cd "+dirname+" && make -f Makefile.in libfiles srcdir=./") == 0 or failed()
+print("Building system")
+os.system("cd " + dirname + " && ./autogen.sh") == 0 or failed()
+os.system("cd " + dirname + "/Source/CParse && bison -y -d parser.y && mv y.tab.c parser.c && mv y.tab.h parser.h") == 0 or failed()
+os.system("cd " + dirname + " && make -f Makefile.in libfiles srcdir=./") == 0 or failed()
# Remove autoconf files
-os.system("find "+dirname+" -name autom4te.cache -exec rm -rf {} \\;")
+os.system("find " + dirname + " -name autom4te.cache -exec rm -rf {} \\;")
# Build documentation
-print "Building html documentation"
-os.system("cd "+dirname+"/Doc/Manual && make all clean-baks") == 0 or failed()
+print("Building html documentation")
+os.system("cd " + dirname + "/Doc/Manual && make all clean-baks") == 0 or failed()
# Build the tar-ball
-os.system("tar -cf "+dirname+".tar "+dirname) == 0 or failed()
-os.system("gzip "+dirname+".tar") == 0 or failed()
+os.system("tar -cf " + dirname + ".tar " + dirname) == 0 or failed()
+os.system("gzip " + dirname + ".tar") == 0 or failed()
-print "Finished building "+dirname+".tar.gz"
+print("Finished building " + dirname + ".tar.gz")
diff --git a/Tools/mkrelease.py b/Tools/mkrelease.py
index ec9a2b76a..014cef227 100755
--- a/Tools/mkrelease.py
+++ b/Tools/mkrelease.py
@@ -1,49 +1,56 @@
#!/usr/bin/env python
-# This script builds the SWIG source tarball, creates the Windows executable and the Windows zip package
-# and uploads them both to SF ready for release. Also uploaded are the release notes.
import sys
-import string
import os
def failed(message):
if message == "":
- print "mkrelease.py failed to complete"
+ print("mkrelease.py failed to complete")
else:
- print message
+ print(message)
sys.exit(2)
-try:
- version = sys.argv[1]
- branch = sys.argv[2]
- username = sys.argv[3]
-except:
- print "Usage: python mkrelease.py version branch username"
- print "where version should be x.y.z and username is your SF username"
- sys.exit(1)
-
-print "Looking for rsync"
+import argparse
+parser = argparse.ArgumentParser(description="Build a SWIG distribution source tarball swig-x.y.z.tar.gz and the Windows zip package swigwin-x.y.z.zip.\nUpload them both to SourceForge ready for release.\nThe release notes are also uploaded.")
+parser.add_argument("version", help="version string in format x.y.z")
+parser.add_argument("-b", "--branch", required=False, default="master", help="git branch name to create tarball from [master]")
+parser.add_argument("-f", "--force-tag", required=False, action="store_true", help="force tag (replace git tag if it already exists)")
+parser.add_argument("-s", "--skip-checks", required=False, action="store_true", help="skip checks (that local and remote repos are in sync)")
+parser.add_argument("-u", "--username", required=False, help="SourceForge username (upload to SourceForge will be skipped if not provided)")
+args = parser.parse_args()
+
+version = args.version
+branch = args.branch
+dirname = "swig-" + version
+force_tag = args.force_tag
+skip_checks = args.skip_checks
+username = args.username
+
+print("Looking for rsync")
os.system("which rsync") and failed("rsync not installed/found. Please install.")
-print "Making source tarball"
-os.system("python ./mkdist.py " + version + " " + branch) and failed("")
+print("Making source tarball")
+force = "--force-tag" if force_tag else ""
+skip = "--skip-checks" if skip_checks else ""
+os.system("python ./mkdist.py {} {} --branch {} {}".format(force, skip, branch, version)) and failed("")
-print "Build Windows package"
+print("Build Windows package")
os.system("./mkwindows.sh " + version) and failed("")
-print "Uploading to SourceForge"
+if username:
+ print("Uploading to SourceForge")
-swig_dir_sf = username + ",swig@frs.sourceforge.net:/home/frs/project/s/sw/swig/swig/swig-" + version + "/"
-swigwin_dir_sf = username + ",swig@frs.sourceforge.net:/home/frs/project/s/sw/swig/swigwin/swigwin-" + version + "/"
+ swig_dir_sf = username + ",swig@frs.sourceforge.net:/home/frs/project/s/sw/swig/swig/swig-" + version + "/"
+ swigwin_dir_sf = username + ",swig@frs.sourceforge.net:/home/frs/project/s/sw/swig/swigwin/swigwin-" + version + "/"
-# If a file with 'readme' in the name exists in the same folder as the zip/tarball, it gets automatically displayed as the release notes by SF
-full_readme_file = "readme-" + version + ".txt"
-os.system("rm -f " + full_readme_file)
-os.system("cat swig-" + version + "/README " + "swig-" + version + "/CHANGES.current " + "swig-" + version + "/RELEASENOTES " + "> " + full_readme_file)
+ # If a file with 'readme' in the name exists in the same folder as the zip/tarball, it gets automatically displayed as the release notes by SF
+ full_readme_file = "readme-" + version + ".txt"
+ os.system("rm -f " + full_readme_file)
+ os.system("cat swig-" + version + "/README " + "swig-" + version + "/CHANGES.current " + "swig-" + version + "/RELEASENOTES " + "> " + full_readme_file)
-os.system("rsync --archive --verbose -P --times -e ssh " + "swig-" + version + ".tar.gz " + full_readme_file + " " + swig_dir_sf) and failed("")
-os.system("rsync --archive --verbose -P --times -e ssh " + "swigwin-" + version + ".zip " + full_readme_file + " " + swigwin_dir_sf) and failed("")
+ os.system("rsync --archive --verbose -P --times -e ssh " + "swig-" + version + ".tar.gz " + full_readme_file + " " + swig_dir_sf) and failed("")
+ os.system("rsync --archive --verbose -P --times -e ssh " + "swigwin-" + version + ".zip " + full_readme_file + " " + swigwin_dir_sf) and failed("")
-print "Finished"
+ print("Finished")
-print "Now log in to SourceForge and set the operating systems applicable to the newly uploaded tarball and zip file. Also remember to do a 'git push --tags'."
+ print("Now log in to SourceForge and set the operating systems applicable to the newly uploaded tarball and zip file. Also remember to do a 'git push --tags'.")
diff --git a/Tools/mkwindows.sh b/Tools/mkwindows.sh
index 0651bbd60..e6ae84350 100755
--- a/Tools/mkwindows.sh
+++ b/Tools/mkwindows.sh
@@ -9,6 +9,8 @@
# path to zip program
zip=
+wine=
+
# options for configure
extraconfigureoptions=
compileflags="-O2 -Wall -Wextra"
@@ -41,6 +43,11 @@ else
echo "Building native Windows executable on Linux"
if test x$zip = x; then
zip=zip
+ wine=$(which wine)
+ fi
+ if test x$wine = x; then
+ echo "Could not detect wine - please install wine-stable package."
+ exit 1;
fi
echo "Checking that mingw 32-bit gcc is installed/available"
if test -n "`which i686-w64-mingw32-gcc`" ; then
@@ -109,9 +116,9 @@ if test -f "$tarball"; then
echo "Compiling (quietly)..."
make > build.log
echo "Simple check to see if swig.exe runs..."
- env LD_LIBRARY_PATH= PATH= ./swig.exe -version || exit 1
+ env LD_LIBRARY_PATH= PATH= $wine ./swig.exe -version || exit 1
echo "Simple check to see if ccache-swig.exe runs..."
- env LD_LIBRARY_PATH= PATH= ./CCache/ccache-swig.exe -V || exit 1
+ env LD_LIBRARY_PATH= PATH= $wine ./CCache/ccache-swig.exe -V || exit 1
echo "Creating $swigwinbasename.zip..."
cd ..
cp $swigbasename/swig.exe $swigwinbasename
diff --git a/Tools/nuget-install.cmd b/Tools/nuget-install.cmd
index 08caea7e0..eec7f8787 100644
--- a/Tools/nuget-install.cmd
+++ b/Tools/nuget-install.cmd
@@ -1,5 +1,4 @@
rem Workaround 'nuget install' not being reliable by retrying a few times
-
@echo off
rem initiate the retry number
set errorCode=1
@@ -13,6 +12,7 @@ rem problem?
IF ERRORLEVEL %errorCode% GOTO :RETRY
rem everything is fine!
+@echo Installed nuget, retries: %reTryNumber%
GOTO :EXIT
:RETRY
diff --git a/Tools/obs-buildlogs.py b/Tools/obs-buildlogs.py
index eaf0f613b..1c77e80c4 100755
--- a/Tools/obs-buildlogs.py
+++ b/Tools/obs-buildlogs.py
@@ -11,11 +11,11 @@ def remove_old_files():
os.remove(file)
def download():
- repos = subprocess.Popen(['osc', 'repositories'], stdout=subprocess.PIPE)
+ repos = subprocess.Popen(["osc", "repositories"], stdout=subprocess.PIPE)
for line in repos.stdout:
- command = ['osc', 'buildlog', '--last'] + line.split()
+ command = ["osc", "buildlog", "--last"] + line.split()
filename = "-".join(line.split()) + ".log"
- print "Downloading logs using: {}".format(" ".join(command))
+ print("Downloading logs using: {}".format(" ".join(command)))
buildlog = subprocess.Popen(command, stdout=subprocess.PIPE)
print("Writing log to {}".format(filename))
diff --git a/Tools/swig.gdb b/Tools/swig.gdb
index 61872c5d6..5a652cae8 100644
--- a/Tools/swig.gdb
+++ b/Tools/swig.gdb
@@ -15,7 +15,7 @@ define swigprint
else
set $expand_count = -1
end
- Printf "%s\n", Swig_to_string($arg0, $expand_count)
+ printf "%s\n", Swig_to_string($arg0, $expand_count)
end
document swigprint
Displays any SWIG DOH object
@@ -31,7 +31,7 @@ define locswigprint
else
set $expand_count = -1
end
- Printf "%s\n", Swig_to_string_with_location($arg0, $expand_count)
+ printf "%s\n", Swig_to_string_with_location($arg0, $expand_count)
end
document locswigprint
Displays any SWIG DOH object prefixed with file and line location
diff --git a/Tools/testflags.py b/Tools/testflags.py
index 564bc91e6..f3d216b59 100755
--- a/Tools/testflags.py
+++ b/Tools/testflags.py
@@ -12,17 +12,18 @@ def get_cflags(language, std, compiler):
"java":"-Werror " + c_common,
"javascript":"-Werror " + c_common,
"lua":"-Werror " + c_common,
+ "mzscheme":"-Werror " + c_common,
+ "ocaml":"-Werror " + c_common,
"octave":"-Werror " + c_common,
"perl5":"-Werror " + c_common,
"php":"-Werror " + c_common,
- "php5":"-Werror " + c_common,
"python":"-Werror " + c_common,
"r":"-Werror " + c_common,
"ruby":"-Werror " + c_common,
"scilab":"-Werror " + c_common,
"tcl":"-Werror " + c_common,
}
- if compiler == 'clang':
+ if compiler == "clang":
cflags["guile"] += " -Wno-attributes" # -Wno-attributes is for clang LLVM 3.5 and bdw-gc < 7.5 used by guile
if language not in cflags:
@@ -42,17 +43,18 @@ def get_cxxflags(language, std, compiler):
"java":"-Werror " + cxx_common,
"javascript":"-Werror " + cxx_common + " -Wno-error=unused-function", # Until overload_rename is fixed for node
"lua":"-Werror " + cxx_common,
+ "mzscheme":"-Werror " + cxx_common,
+ "ocaml":"-Werror " + cxx_common,
"octave":"-Werror " + cxx_common,
"perl5":"-Werror " + cxx_common,
"php":"-Werror " + cxx_common,
- "php5":"-Werror " + cxx_common,
"python":"-Werror " + cxx_common,
"r":"-Werror " + cxx_common,
- "ruby":"-Werror " + cxx_common,
+ "ruby":"-Werror " + cxx_common + " -Wno-deprecated-declarations", # For Ruby on MacOS Xcode 9.4 misconfiguration defining 'isfinite' to deprecated 'finite'
"scilab":"-Werror " + cxx_common,
"tcl":"-Werror " + cxx_common,
}
- if compiler == 'clang':
+ if compiler == "clang":
cxxflags["guile"] += " -Wno-attributes" # -Wno-attributes is for clang LLVM 3.5 and bdw-gc < 7.5 used by guile
if language not in cxxflags:
@@ -62,12 +64,12 @@ def get_cxxflags(language, std, compiler):
import argparse
parser = argparse.ArgumentParser(description="Display CFLAGS or CXXFLAGS to use for testing the SWIG examples and test-suite.")
-parser.add_argument('-l', '--language', required=True, help='set language to show flags for')
+parser.add_argument("-l", "--language", required=True, help="set language to show flags for")
flags = parser.add_mutually_exclusive_group(required=True)
-flags.add_argument('-c', '--cflags', action='store_true', default=False, help='show CFLAGS')
-flags.add_argument('-x', '--cxxflags', action='store_true', default=False, help='show CXXFLAGS')
-parser.add_argument('-s', '--std', required=False, help='language standard flags for the -std= option')
-parser.add_argument('-C', '--compiler', required=False, help='compiler used (clang or gcc)')
+flags.add_argument("-c", "--cflags", action="store_true", default=False, help="show CFLAGS")
+flags.add_argument("-x", "--cxxflags", action="store_true", default=False, help="show CXXFLAGS")
+parser.add_argument("-s", "--std", required=False, help="language standard flags for the -std= option")
+parser.add_argument("-C", "--compiler", required=False, help="compiler used (clang or gcc)")
args = parser.parse_args()
if args.cflags:
diff --git a/Tools/travis-linux-install.sh b/Tools/travis-linux-install.sh
index 2510a791f..37ef841dd 100755
--- a/Tools/travis-linux-install.sh
+++ b/Tools/travis-linux-install.sh
@@ -1,110 +1,127 @@
#!/bin/bash
+# Install Linux packages where the version has been overidden in .travis.yml
+
set -e # exit on failure (same as -o errexit)
lsb_release -a
-sudo apt-get -qq update
+travis_retry sudo apt-get -qq update
-if [[ "$CC" == gcc-5 ]]; then
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get -qq update
- sudo apt-get install -qq g++-5
-elif [[ "$CC" == gcc-6 ]]; then
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get -qq update
- sudo apt-get install -qq g++-6
+if [[ -n "$GCC" ]]; then
+ travis_retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+ travis_retry sudo apt-get -qq update
+ travis_retry sudo apt-get install -qq g++-$GCC
fi
-sudo apt-get -qq install libboost-dev
+travis_retry sudo apt-get -qq install libboost-dev
WITHLANG=$SWIGLANG
case "$SWIGLANG" in
"") ;;
"csharp")
- sudo apt-get -qq install mono-devel
+ travis_retry sudo apt-get -qq install mono-devel
;;
"d")
- wget http://downloads.dlang.org/releases/2014/dmd_2.066.0-0_amd64.deb
- sudo dpkg -i dmd_2.066.0-0_amd64.deb
+ travis_retry wget http://downloads.dlang.org/releases/2014/dmd_2.066.0-0_amd64.deb
+ travis_retry sudo dpkg -i dmd_2.066.0-0_amd64.deb
;;
"go")
+ if [[ "$VER" ]]; then
+ eval "$(gimme ${VER}.x)"
+ fi
;;
"javascript")
case "$ENGINE" in
"node")
- sudo add-apt-repository -y ppa:chris-lea/node.js
- sudo apt-get -qq update
- sudo apt-get install -qq nodejs rlwrap
- sudo npm install -g node-gyp
+ travis_retry wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.10/install.sh | bash
+ export NVM_DIR="$HOME/.nvm"
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
+ travis_retry nvm install ${VER}
+ nvm use ${VER}
+ if [ "$VER" == "0.10" ] || [ "$VER" == "0.12" ] || [ "$VER" == "4" ] ; then
+# travis_retry sudo apt-get install -qq nodejs node-gyp
+ travis_retry npm install -g node-gyp@$VER
+ else
+ travis_retry npm install -g node-gyp
+ fi
;;
"jsc")
- sudo apt-get install -qq libwebkitgtk-dev
+ travis_retry sudo apt-get install -qq libwebkitgtk-dev
;;
"v8")
- sudo apt-get install -qq libv8-dev
+ travis_retry sudo apt-get install -qq libv8-dev
;;
esac
;;
"guile")
- sudo apt-get -qq install guile-2.0-dev
+ travis_retry sudo apt-get -qq install guile-2.0-dev
;;
"lua")
if [[ -z "$VER" ]]; then
- sudo apt-get -qq install lua5.2 liblua5.2-dev
+ travis_retry sudo apt-get -qq install lua5.2 liblua5.2-dev
else
- sudo add-apt-repository -y ppa:ubuntu-cloud-archive/mitaka-staging
- sudo apt-get -qq update
- sudo apt-get -qq install lua${VER} liblua${VER}-dev
+ travis_retry sudo apt-get -qq install lua${VER} liblua${VER}-dev
fi
;;
+ "mzscheme")
+ travis_retry sudo apt-get -qq install racket
+ ;;
"ocaml")
- # configure also looks for ocamldlgen, but this isn't packaged. But it isn't used by default so this doesn't matter.
- sudo apt-get -qq install ocaml ocaml-findlib
+ travis_retry sudo apt-get -qq install ocaml camlp4
;;
"octave")
if [[ -z "$VER" ]]; then
- sudo apt-get -qq install liboctave-dev
+ travis_retry sudo apt-get -qq install liboctave-dev
else
- sudo add-apt-repository -y ppa:kwwette/octaves
- sudo apt-get -qq update
- sudo apt-get -qq install liboctave${VER}-dev
+ # Travis adds external PPAs which contain newer versions of packages
+ # than in baseline trusty. These newer packages prevent some of the
+ # Octave packages in ppa:kwwette/octave, which rely on the older
+ # packages in trusty, from installing. To prevent these kind of
+ # interactions arising, clean out all external PPAs added by Travis
+ # before installing Octave
+ sudo rm -rf /etc/apt/sources.list.d/*
+ travis_retry sudo apt-get -qq update
+ travis_retry sudo add-apt-repository -y ppa:kwwette/octaves
+ travis_retry sudo apt-get -qq update
+ travis_retry sudo apt-get -qq install liboctave${VER}-dev
fi
;;
- "php5")
- sudo apt-get -qq install php5-cli php5-dev
- ;;
"php")
- sudo add-apt-repository -y ppa:ondrej/php
- sudo apt-get -qq update
- sudo apt-get -qq install php$VER-cli php$VER-dev
+ travis_retry sudo add-apt-repository -y ppa:ondrej/php
+ travis_retry sudo apt-get -qq update
+ travis_retry sudo apt-get -qq install php$VER-cli php$VER-dev
;;
"python")
- pip install pep8
+ pip install --user pycodestyle
if [[ "$PY3" ]]; then
- sudo apt-get install -qq python3-dev
+ travis_retry sudo apt-get install -qq python3-dev
fi
WITHLANG=$SWIGLANG$PY3
if [[ "$VER" ]]; then
- sudo add-apt-repository -y ppa:fkrull/deadsnakes
- sudo apt-get -qq update
- sudo apt-get -qq install python${VER}-dev
+ travis_retry sudo add-apt-repository -y ppa:deadsnakes/ppa
+ travis_retry sudo apt-get -qq update
+ travis_retry sudo apt-get -qq install python${VER}-dev
WITHLANG=$SWIGLANG$PY3=$SWIGLANG$VER
fi
;;
"r")
- sudo apt-get -qq install r-base
+ travis_retry sudo apt-get -qq install r-base
;;
"ruby")
if [[ "$VER" ]]; then
- rvm install $VER
+ travis_retry rvm install $VER
fi
;;
"scilab")
- sudo apt-get -qq install scilab
+ # Travis has the wrong version of Java pre-installed resulting in error using scilab:
+ # /usr/bin/scilab-bin: error while loading shared libraries: libjava.so: cannot open shared object file: No such file or directory
+ echo "JAVA_HOME was set to $JAVA_HOME"
+ unset JAVA_HOME
+ travis_retry sudo apt-get -qq install scilab
;;
"tcl")
- sudo apt-get -qq install tcl-dev
+ travis_retry sudo apt-get -qq install tcl-dev
;;
esac
diff --git a/Tools/travis-osx-install.sh b/Tools/travis-osx-install.sh
index 85183722b..393d96e60 100755
--- a/Tools/travis-osx-install.sh
+++ b/Tools/travis-osx-install.sh
@@ -1,31 +1,32 @@
#!/bin/bash
+# Install MacOS packages where the version has been overidden in .travis.yml
+
set -e # exit on failure (same as -o errexit)
sw_vers
-brew update
-brew list
-# brew install pcre # Travis Xcode-7.3 has pcre
-# brew install boost
+travis_retry brew update
+travis_retry brew list
+# travis_retry brew install pcre # Travis Xcode-7.3 has pcre
+# travis_retry brew install boost
WITHLANG=$SWIGLANG
case "$SWIGLANG" in
"csharp")
- brew install mono
+ travis_retry brew install mono
;;
"guile")
- Tools/brew-install guile
+ travis_retry Tools/brew-install guile
;;
"lua")
- brew install lua
+ travis_retry brew install lua
+ ;;
+ "octave")
+ travis_retry brew install octave
;;
"python")
WITHLANG=$SWIGLANG$PY3
- if [[ "$PY3" ]]; then
- brew install python3
- brew list -v python3
- fi
;;
esac
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 000000000..7a18418be
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,1141 @@
+# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
+
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.16'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.16.1], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.16.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ # TODO: see whether this extra hack can be removed once we start
+ # requiring Autoconf 2.70 or later.
+ AS_CASE([$CONFIG_FILES],
+ [*\'*], [eval set x "$CONFIG_FILES"],
+ [*], [set x $CONFIG_FILES])
+ shift
+ # Used to flag and report bootstrapping failures.
+ am_rc=0
+ for am_mf
+ do
+ # Strip MF so we end up with the name of the file.
+ am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile which includes
+ # dependency-tracking related rules and includes.
+ # Grep'ing the whole file directly is not great: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+ || continue
+ am_dirpart=`AS_DIRNAME(["$am_mf"])`
+ am_filepart=`AS_BASENAME(["$am_mf"])`
+ AM_RUN_LOG([cd "$am_dirpart" \
+ && sed -e '/# am--include-marker/d' "$am_filepart" \
+ | $MAKE -f - am--depfiles]) || am_rc=$?
+ done
+ if test $am_rc -ne 0; then
+ AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
+ for automatic dependency tracking. Try re-running configure with the
+ '--disable-dependency-tracking' option to at least be able to build
+ the package (albeit without support for automatic dependency tracking).])
+ fi
+ AS_UNSET([am_dirpart])
+ AS_UNSET([am_filepart])
+ AS_UNSET([am_mf])
+ AS_UNSET([am_rc])
+ rm -f conftest-deps.mk
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking is enabled.
+# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
+# order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.65])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+ [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# We need awk for the "check" target (and possibly the TAP driver). The
+# system "awk" is bad on some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES([CC])],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES([CXX])],
+ [m4_define([AC_PROG_CXX],
+ m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES([OBJC])],
+ [m4_define([AC_PROG_OBJC],
+ m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+ [_AM_DEPENDENCIES([OBJCXX])],
+ [m4_define([AC_PROG_OBJCXX],
+ m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
+])
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+ fi
+fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
+])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST([install_sh])])
+
+# Copyright (C) 2003-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check whether make has an 'include' directive that can support all
+# the idioms we need for our automatic dependency tracking code.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
+cat > confinc.mk << 'END'
+am__doit:
+ @echo this is the am__doit target >confinc.out
+.PHONY: am__doit
+END
+am__include="#"
+am__quote=
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+ AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
+ AS_CASE([$?:`cat confinc.out 2>/dev/null`],
+ ['0:this is the am__doit target'],
+ [AS_CASE([$s],
+ [BSD], [am__include='.include' am__quote='"'],
+ [am__include='include' am__quote=''])])
+ if test "$am__include" != "#"; then
+ _am_result="yes ($s style)"
+ break
+ fi
+done
+rm -f confinc.* confmf.*
+AC_MSG_RESULT([${_am_result}])
+AC_SUBST([am__include])])
+AC_SUBST([am__quote])])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+ [whether $CC understands -c and -o together],
+ [am_cv_prog_cc_c_o],
+ [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+ ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2009-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+ [--enable-silent-rules],
+ [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+ [--disable-silent-rules],
+ [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+ [am_cv_make_support_nested_variables],
+ [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004-2018 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+#
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+ [m4_case([$1],
+ [ustar],
+ [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+ # There is notably a 21 bits limit for the UID and the GID. In fact,
+ # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+ # and bug#13588).
+ am_max_uid=2097151 # 2^21 - 1
+ am_max_gid=$am_max_uid
+ # The $UID and $GID variables are not portable, so we need to resort
+ # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
+ # below are definitely unexpected, so allow the users to see them
+ # (that is, avoid stderr redirection).
+ am_uid=`id -u || echo unknown`
+ am_gid=`id -g || echo unknown`
+ AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+ if test $am_uid -le $am_max_uid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi
+ AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+ if test $am_gid -le $am_max_gid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi],
+
+ [pax],
+ [],
+
+ [m4_fatal([Unknown tar format])])
+
+ AC_MSG_CHECKING([how to create a $1 tar archive])
+
+ # Go ahead even if we have the value already cached. We do so because we
+ # need to set the values for the 'am__tar' and 'am__untar' variables.
+ _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+ for _am_tool in $_am_tools; do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar; do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ AM_RUN_LOG([cat conftest.dir/file])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+ done
+ rm -rf conftest.dir
+
+ AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+ AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([Tools/config/ac_compile_warnings.m4])
+m4_include([Tools/config/ac_define_dir.m4])
+m4_include([Tools/config/ax_boost_base.m4])
+m4_include([Tools/config/ax_compare_version.m4])
+m4_include([Tools/config/ax_cxx_compile_stdcxx_11.m4])
+m4_include([Tools/config/ax_path_generic.m4])
diff --git a/appveyor.yml b/appveyor.yml
index d7be4a3d5..42eaa36f4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,6 +3,9 @@ platform:
- x64
environment:
+ global:
+ MAKEJOBS: 2
+
matrix:
- SWIGLANG: csharp
VSVER: 12
@@ -15,64 +18,112 @@ environment:
VER: 27
- SWIGLANG: python
VSVER: 14
- VER: 35
- PY3: 1
+ VER: 36
+ PY3: 3
+ - SWIGLANG: python
+ OSVARIANT: cygwin
+ - SWIGLANG: python
+ OSVARIANT: mingw
+ VER: 27
+ - SWIGLANG: python
+ OSVARIANT: mingw
+ WITHLANG: python
+ VER: 37
+ PY3: 3
install:
- date /T & time /T
-- set PATH=C:\cygwin\bin;%PATH%
-- set CYGWIN=nodosfilewarning
-- git clone -q --depth=1 --single-branch --branch cccl-1.0 git://github.com/swig/cccl.git C:\cccl-1.0
-- bash -c "cp C:/cccl-1.0/cccl /usr/bin"
- ps: >-
- If ($env:Platform -Match "x86") {
+ if ($env:Platform -eq "x86") {
$env:PCRE_PLATFORM="Win32"
$env:JAVA_HOME="C:/Program Files (x86)/Java/jdk1.8.0"
$env:VCVARS_PLATFORM="x86"
$env:LANG_PLATFORM=""
- } Else {
+ $env:CYGWINBIN="C:\cygwin\bin"
+ $env:CYGWINSETUP="C:/cygwin/setup-x86.exe"
+ $env:MSYSBIN="C:\msys64\usr\bin"
+ $env:MINGWBIN="C:\msys64\mingw32\bin"
+ $env:MBITS="32"
+ $env:MARCH="i686"
+ } else {
$env:PCRE_PLATFORM="x64"
$env:JAVA_HOME="C:/Program Files/Java/jdk1.8.0"
$env:VCVARS_PLATFORM="amd64"
$env:LANG_PLATFORM="-x64"
+ $env:CYGWINBIN="C:\cygwin64\bin"
+ $env:CYGWINSETUP="C:/cygwin64/setup-x86_64.exe"
+ $env:MSYSBIN="C:\msys64\usr\bin"
+ $env:MINGWBIN="C:\msys64\mingw64\bin"
+ $env:MBITS="64"
+ $env:MARCH="x86_64"
}
-- ps: $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:VSVER" + "0COMNTOOLS"))
-- echo "Using Visual Studio %VSVER%.0 at %VSCOMNTOOLS%"
-- call "%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
-- Tools\nuget-install.cmd pcre -Verbosity detailed -Version 8.33.0.1 -OutputDirectory C:\pcre
-- set PCRE_ROOT=C:/pcre/pcre.8.33.0.1/build/native
-- set PATH=C:\Python%VER%%LANG_PLATFORM%;%PATH%
-- python -V
+- ps: >-
+ if (!$env:OSVARIANT) {
+ $env:PATH="$env:CYGWINBIN;$env:PATH"
+ $env:CYGWIN="nodosfilewarning"
+ $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:VSVER" + "0COMNTOOLS"))
+ $env:CC="cccl"
+ $env:CXX="cccl"
+ } elseif ($env:OSVARIANT -eq "cygwin") {
+ $env:PATH="$env:CYGWINBIN;$env:PATH"
+ $env:CYGWIN="nodosfilewarning"
+ $env:CC="gcc"
+ $env:CXX="g++"
+ } elseif ($env:OSVARIANT -eq "mingw") {
+ # Note mingw setup tests the native Windows Python distribution (not MinGW Python) with gcc
+ $env:PATH="$env:MINGWBIN;$env:MSYSBIN;$env:PATH"
+ $env:MSYSTEM="MINGW$env:MBITS" # This is important for msys2
+ $env:CC="gcc"
+ $env:CXX="g++"
+ if ($env:MBITS -eq "64" -and $env:SWIGLANG -eq "python") {
+ $env:CHECK_OPTIONS2="CFLAGS+=-DMS_WIN64 CXXFLAGS+=-DMS_WIN64"
+ }
+ }
+- if "%OSVARIANT%"=="" bash -c "cd /usr/bin && curl --retry 15 -s -L https://github.com/swig/cccl/archive/cccl-1.0.tar.gz | tar -xz --strip 1 cccl-cccl-1.0/cccl"
+- if "%OSVARIANT%"=="" echo Using Visual Studio %VSVER%.0 at %VSCOMNTOOLS%
+- if "%OSVARIANT%"=="" call "%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
+- if "%OSVARIANT%"=="" Tools\nuget-install.cmd pcre -Verbosity quiet -Version 8.33.0.1 -OutputDirectory C:\pcre
+- if "%OSVARIANT%"=="" set PCRE_ROOT=C:/pcre/pcre.8.33.0.1/build/native
+- if not "%OSVARIANT%"=="cygwin" set PATH=C:\Python%VER%%LANG_PLATFORM%;%PATH%
+- if "%OSVARIANT%"=="" bash -c "which cl.exe"
+- if "%OSVARIANT%"=="" bash -c "cl.exe /? 2>&1 | head -n 1"
+- if "%OSVARIANT%"=="" bash -c "which csc.exe"
+- if "%OSVARIANT%"=="" bash -c "csc.exe /? | head -n 1"
+- if "%OSVARIANT%"=="cygwin" %CYGWINSETUP% --quiet-mode --packages python2-devel,libpcre-devel,libboost-devel > cygwin-install.txt || bash -c "cat cygwin-install.txt"
+- if "%OSVARIANT%"=="mingw" bash -c "pacman --noconfirm --sync mingw%MBITS%/mingw-w64-%MARCH%-pcre mingw%MBITS%/mingw-w64-%MARCH%-boost"
+- if not "%WITHLANG%"=="" set SWIGWITHLANG==%WITHLANG%
+- if not "%WITHLANG%"=="" where %WITHLANG%
+- bash -c "which $CC"
+- bash -c "which $CXX"
+- bash -c "$CC --version | head -n 1"
+- bash -c "$CXX --version | head -n 1"
- bash -c "which python"
- bash -c "python -V"
-- bash -c "which cl.exe"
-- bash -c "cl.exe /? 2>&1 | head -n 2"
-- bash -c "which csc.exe"
-- bash -c "csc.exe /? | head -n 2"
-- bash -c "which cccl"
-- bash -c "cccl --version"
-- make --version
+- bash -c "make --version | head -n 2"
+- pwd
+- echo MAKEJOBS=%MAKEJOBS%
- uname -a
build_script:
-- set CCCL_OPTIONS=--cccl-muffle /W3
+- set CCCL_OPTIONS=--cccl-muffle /W3 /EHsc
- set CHECK_OPTIONS=CSHARPOPTIONS=-platform:%Platform%
# Open dummy file descriptor to fix error on cygwin: ./configure: line 560: 0: Bad file descriptor
-- bash -c "exec 0</dev/null && ./autogen.sh && time ./configure --disable-dependency-tracking --disable-ccache CC=cccl CXX=cccl CFLAGS='-O2' CXXFLAGS='-O2' LDFLAGS='--cccl-link /LTCG' PCRE_CFLAGS='-I%PCRE_ROOT%/include -DPCRE_STATIC' PCRE_LIBS='-L%PCRE_ROOT%/lib/v110/%PCRE_PLATFORM%/Release/static/utf8 -lpcre8' --without-perl5 --without-go --with-boost=C:/Libraries/boost || cat config.log"
-- bash -c "time make -s"
+- if "%OSVARIANT%"=="" bash -c "exec 0</dev/null && ./autogen.sh && time ./configure --disable-dependency-tracking --disable-ccache CC=$CC CXX=$CXX CFLAGS='-O2' CXXFLAGS='-O2' LDFLAGS='--cccl-link /LTCG' PCRE_CFLAGS='-I%PCRE_ROOT%/include -DPCRE_STATIC' PCRE_LIBS='-L%PCRE_ROOT%/lib/v110/%PCRE_PLATFORM%/Release/static/utf8 -lpcre8' --without-perl5 --without-go --with-boost=C:/Libraries/boost_1_67_0 || cat config.log"
+- if not "%OSVARIANT%"=="" bash -c "exec 0</dev/null && ./autogen.sh && time ./configure CC=%CC% CXX=%CXX% --without-alllang --with-$SWIGLANG$PY3$SWIGWITHLANG --enable-cpp11-testing || cat config.log"
+- bash -c "time make -s -j%MAKEJOBS%"
test_script:
- set CCCL_OPTIONS=--cccl-muffle /W3 /EHsc
-# (Warning below is fixed in newer versions of Python (2.7.9)) '_hypot' : recursive on all control paths, function will cause runtime stack overflow
-- ps: >-
- If ("$env:SWIGLANG$env:VER" -Match "python27") {
- $env:CCCL_OPTIONS="$env:CCCL_OPTIONS /wd4717"
- }
- .\swig.exe -version
+- if not "%OSVARIANT%"=="" CCache\ccache-swig -V
- bash -c "file ./swig.exe"
-- bash -c "time make -k check-%SWIGLANG%-version"
-- bash -c "time make -k check-%SWIGLANG%-examples %CHECK_OPTIONS%"
-- bash -c "time make -k check-%SWIGLANG%-test-suite %CHECK_OPTIONS%"
+- bash -c "make check-%SWIGLANG%-version"
+- bash -c "make check-%SWIGLANG%-enabled"
+- bash -c "time make -k check-%SWIGLANG%-examples %CHECK_OPTIONS% %CHECK_OPTIONS2%"
+- bash -c "time make -k check-%SWIGLANG%-test-suite -j%MAKEJOBS% %CHECK_OPTIONS% %CHECK_OPTIONS2%"
# Do not build on tags (GitHub only)
skip_tags: true
+
+#on_finish: # Display RDP connection information
+# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
diff --git a/configure b/configure
new file mode 100755
index 000000000..6406776b4
--- /dev/null
+++ b/configure
@@ -0,0 +1,13300 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for swig 4.0.1.
+#
+# Report bugs to <http://www.swig.org>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: http://www.swig.org about your system, including any
+$0: error possibly output before this message. Then install
+$0: a modern shell, or manually run the script under such a
+$0: shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='swig'
+PACKAGE_TARNAME='swig'
+PACKAGE_VERSION='4.0.1'
+PACKAGE_STRING='swig 4.0.1'
+PACKAGE_BUGREPORT='http://www.swig.org'
+PACKAGE_URL=''
+
+ac_unique_file="Source/Swig/swig.h"
+enable_option_checking=no
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+SWIG_LIB_SET
+SWIG_LIB_PREINST
+SWIG_LIB
+SWIG_LIB_INSTALL
+ac_aux_dir
+EXTRA_CLEAN
+ROOT_DIR
+SKIP_ANDROID
+SKIP_D
+SKIP_GO
+SKIP_SCILAB
+SKIP_R
+SKIP_LUA
+SKIP_CSHARP
+SKIP_OCAML
+SKIP_PHP
+SKIP_RUBY
+SKIP_MZSCHEME
+SKIP_GUILE
+SKIP_JAVASCRIPT
+SKIP_JAVA
+SKIP_PYTHON3
+SKIP_PYTHON
+SKIP_OCTAVE
+SKIP_PERL5
+SKIP_TCL
+DLIBPREFIX
+DDEFAULTVERSION
+D2COMPILER
+D1COMPILER
+GOVERSIONOPTION
+GCCGOOPT
+GOOPT
+GO15
+GO13
+GO12
+GO1
+GOC
+GOGCC
+GCCGO
+GO
+RBIN
+LUALINK
+LUAFLAGS
+LUADYNAMICLINKING
+LUABIN
+CSHARPSO
+CSHARPCFLAGS
+CSHARPLIBRARYPREFIX
+CSHARPDYNAMICLINKING
+CSHARPCONVERTPATH
+CSHARPCILINTERPRETER_FLAGS
+CSHARPCILINTERPRETER
+CSHARPCOMPILER
+OCAMLMKTOP
+OCAMLFIND
+OCAMLDLGEN
+CAMLP4
+OCAMLC
+PHPINC
+PHP
+RUBYDYNAMICLINKING
+RUBYSO
+RUBYCCDLFLAGS
+RUBYLINK
+RUBYLIB
+RUBYINCLUDE
+RUBY
+MZDYNOBJ
+MZC
+MZSCHEME
+GUILE_LIBS
+GUILE_CFLAGS
+GUILE
+GUILE_CONFIG
+NDKBUILD
+ANT
+ADB
+ANDROID
+JSV8ENABLED
+JSCENABLED
+JSV8DYNAMICLINKING
+JSV8INC
+JSCOREVERSION
+JSCOREDYNAMICLINKING
+JSCOREINC
+JSINTERPRETERLINKFLAGS
+JSINTERPRETERCXX
+NODEGYP
+NODEJS
+JAVACFLAGS
+JAVAFLAGS
+JAVACXXSHARED
+JAVALDSHARED
+JAVASO
+JAVALIBRARYPREFIX
+JAVADYNAMICLINKING
+JAVA_TOOLS_JAR
+JAVA_CLASSPATH_SEP
+JAVAINC
+JAVAC
+JAVA
+SCILABOPT
+SCILABINCLUDE
+SCILAB
+OCTAVE_LDFLAGS
+OCTAVE_CXXFLAGS
+OCTAVE_CPPFLAGS
+OCTAVE_SO
+OCTAVE
+PERL5LDFLAGS
+PERL5CCCDLFLAGS
+PERL5CCDLFLAGS
+PERL5CCFLAGS
+PERL5LIB
+PERL5DYNAMICLINKING
+PERL5EXT
+PERL
+PY2TO3
+PYCODESTYLE
+PYTHON3DYNAMICLINKING
+PY3LINK
+PY3LIB
+PY3INCLUDE
+PY3CONFIG
+PYTHON3
+PYTHONDYNAMICLINKING
+PYLINK
+PYLIB
+PYINCLUDE
+PYTHON
+TCLCXXSHARED
+TCLLDSHARED
+TCLDYNAMICLINKING
+TCLLIB
+TCLINCLUDE
+PKGCONFIG
+LIBC
+LIBCRYPT
+LIBM
+SWILL
+SWIGLIBS
+LUA_SO
+MZSCHEME_SO
+PHP_SO
+GUILE_SO
+TCL_SO
+PYTHON_SO
+LINKFORSHARED
+HAVE_CXX11_COMPILER
+PLATCXXFLAGS
+PLATCFLAGS
+RPATH
+TRYLINKINGWITHCXX
+CXXSHARED
+CCSHARED
+LDSHARED
+SO
+BOOST_LDFLAGS
+BOOST_CPPFLAGS
+YFLAGS
+YACC
+ENABLE_CCACHE
+subdirs
+PCRE_LIBS
+PCRE_CFLAGS
+PCRE_CONFIG
+SED
+EGREP
+GREP
+CPP
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+runstatedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL
+am__quote'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_silent_rules
+enable_dependency_tracking
+with_maximum_compile_warnings
+with_popen
+with_pcre
+with_pcre_prefix
+with_pcre_exec_prefix
+enable_ccache
+with_boost
+with_boost_libdir
+enable_cpp11_testing
+with_libm
+with_libc
+with_alllang
+with_tclconfig
+with_tcl
+with_tclincl
+with_tcllib
+with_python
+with_python3
+with_2to3
+with_perl5
+with_octave
+with_scilab
+with_scilab_inc
+with_java
+with_javac
+with_javaincl
+with_javascript
+with_jscoreinc
+with_jscorelib
+with_jsv8inc
+with_jsv8lib
+with_android
+with_adb
+with_ant
+with_ndk_build
+with_guile_config
+with_guile
+with_guile_cflags
+with_guile_libs
+with_mzscheme
+with_mzc
+with_ruby
+with_php
+with_ocaml
+with_ocamlc
+with_ocamldlgen
+with_ocamlfind
+with_ocamlmktop
+with_camlp4
+with_csharp
+with_cil_interpreter
+with_csharp_compiler
+with_lua
+with_luaincl
+with_lualib
+with_r
+with_go
+with_d
+with_d1_compiler
+with_d2_compiler
+with_swiglibdir
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC
+CPP
+PCRE_CONFIG
+PCRE_CFLAGS
+PCRE_LIBS
+YACC
+YFLAGS'
+ac_subdirs_all='CCache'
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir runstatedir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures swig 4.0.1 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/swig]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of swig 4.0.1:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-silent-rules less verbose build output (undo: "make V=1")
+ --disable-silent-rules verbose build output (undo: "make V=0")
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
+ --disable-ccache disable building and installation of ccache-swig
+ executable (default enabled)
+ --enable-cpp11-testing enable C++11 testing if supported by compiler
+ (default disabled)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --without-maximum-compile-warnings
+ Disable maximum warning verbosity
+ --without-popen Disable popen
+ --without-pcre Disable support for regular expressions using PCRE
+ --with-pcre-prefix=PREFIX
+ Prefix where pcre is installed (optional)
+ --with-pcre-exec-prefix=EPREFIX
+ Exec prefix where pcre is installed (optional)
+ --with-boost[=ARG] use Boost library from a standard location
+ (ARG=yes), from the specified location (ARG=<path>),
+ or disable it (ARG=no) [ARG=yes]
+ --with-boost-libdir=LIB_DIR
+ Force given directory for boost libraries. Note that
+ this will override library path detection, so use
+ this parameter only if default library detection
+ fails and you know exactly where your boost
+ libraries are located.
+ --with-libm=STRING math library
+ --with-libc=STRING C library
+ --without-alllang Disable all languages
+ --without-tcl Disable Tcl
+ --with-tclconfig=path Set location of tclConfig.sh
+ --with-tcl=path Set location of Tcl package
+ --with-tclincl=path Set location of Tcl include directory
+ --with-tcllib=path Set location of Tcl library directory
+ --without-python Disable Python
+ --with-python=path Set location of Python executable
+ --without-python3 Disable Python 3.x support
+ --with-python3=path Set location of Python 3.x executable
+ --with-2to3=path Set location of Python 2to3 tool
+ --without-perl5 Disable Perl5
+ --with-perl5=path Set location of Perl5 executable
+ --without-octave Disable Octave
+ --with-octave=path Set location of Octave executable
+ --without-scilab Disable Scilab
+ --with-scilab=path Set location of Scilab executable
+ --with-scilab-inc=path Set location of Scilab include directory
+ --without-java Disable Java
+ --with-java=path Set location of java executable
+ --with-javac=path Set location of javac executable
+ --with-javaincl=path Set location of Java include directory
+ --without-javascript Disable Javascript
+ --with-jscoreinc=path Set location of Javascript include directory
+ --with-jscorelib=path Set location of the JavaScriptCore/Webkit library directory
+ --with-jsv8inc=path Set location of Javascript v8 include directory
+ --with-jsv8lib=path Set location of V8 Javascript library directory
+ --without-android Disable Android
+ --with-android=path Set location of android executable
+ --with-adb=path Set location of adb executable - Android Debug Bridge
+ --with-ant=path Set location of ant executable for Android
+ --with-ndk-build=path Set location of Android ndk-build executable
+ --without-guile Disable Guile
+ --with-guile-config=path
+ Set location of guile-config
+ --with-guile=path Set location of Guile executable
+ --with-guile-cflags=cflags Set cflags required to compile against Guile
+ --with-guile-libs=ldflags Set ldflags needed to link with Guile
+ --without-mzscheme Disable MzScheme
+ --with-mzscheme=path Set location of MzScheme executable
+ --with-mzc=path Set location of MzScheme's mzc
+ --without-ruby Disable Ruby
+ --with-ruby=path Set location of Ruby executable
+ --without-php Disable PHP
+ --with-php=path Set location of PHP executable
+ --without-ocaml Disable OCaml
+ --with-ocamlc=path Set location of ocamlc executable
+ --with-ocamldlgen=path Set location of ocamldlgen
+ --with-ocamlfind=path Set location of ocamlfind
+ --with-ocamlmktop=path Set location of ocamlmktop executable
+ --with-camlp4=path Set location of camlp4 executable
+ --without-csharp Disable CSharp
+ --with-cil-interpreter=path Set location of CIL interpreter for CSharp
+ --with-csharp-compiler=path Set location of CSharp compiler
+ --without-lua Disable Lua
+ --with-lua=path Set location of Lua executable
+ --with-luaincl=path Set location of Lua include directory
+ --with-lualib=path Set location of Lua library directory
+ --without-r Disable R
+ --with-r=path Set location of R executable (r)
+ --without-go Disable Go
+ --with-go=path Set location of Go compiler
+ --without-d Disable D
+ --with-d1-compiler=path Set location of D1/Tango compiler (DMD compatible)
+ --with-d2-compiler=path Set location of D2 compiler (DMD compatible)
+ --with-swiglibdir=DIR Put SWIG system-independent libraries into DIR.
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ CPP C preprocessor
+ PCRE_CONFIG config script used for pcre
+ PCRE_CFLAGS CFLAGS used for pcre
+ PCRE_LIBS LIBS used for pcre
+ YACC The `Yet Another Compiler Compiler' implementation to use.
+ Defaults to the first program found out of: `bison -y', `byacc',
+ `yacc'.
+ YFLAGS The list of arguments that will be passed by default to $YACC.
+ This script will default YFLAGS to the empty string to avoid a
+ default value of `-d' given by some make applications.
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <http://www.swig.org>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+swig configure 4.0.1
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ---------------------------------- ##
+## Report this to http://www.swig.org ##
+## ---------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
+else
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=$ac_mid; break
+else
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+ ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+ fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by swig $as_me 4.0.1, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in Tools/config "$srcdir"/Tools/config; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in Tools/config \"$srcdir\"/Tools/config" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+ac_config_headers="$ac_config_headers Source/Include/swigconfig.h"
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+am__api_version='1.16'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+ alias in your environment" "$LINENO" 5
+ fi
+ if test "$2" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='swig'
+ VERSION='4.0.1'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target (and possibly the TAP driver). The
+# system "awk" is bad on some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar pax cpio none'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+ fi
+fi
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+ ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
+$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
+cat > confinc.mk << 'END'
+am__doit:
+ @echo this is the am__doit target >confinc.out
+.PHONY: am__doit
+END
+am__include="#"
+am__quote=
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+ { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
+ (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ case $?:`cat confinc.out 2>/dev/null` in #(
+ '0:this is the am__doit target') :
+ case $s in #(
+ BSD) :
+ am__include='.include' am__quote='"' ;; #(
+ *) :
+ am__include='include' am__quote='' ;;
+esac ;; #(
+ *) :
+ ;;
+esac
+ if test "$am__include" != "#"; then
+ _am_result="yes ($s style)"
+ break
+ fi
+done
+rm -f confinc.* confmf.*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
+$as_echo "${_am_result}" >&6; }
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+else
+ CXXFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+ # Needed for subdir-objects in AUTOMAKE_OPTIONS
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking maximum warning verbosity option" >&5
+$as_echo_n "checking maximum warning verbosity option... " >&6; }
+
+
+
+
+# Check whether --with-maximum-compile-warnings was given.
+if test "${with_maximum_compile_warnings+set}" = set; then :
+ withval=$with_maximum_compile_warnings; ac_compile_warnings_on="$withval"
+else
+ ac_compile_warnings_on=""
+fi
+
+
+ if test x"$ac_compile_warnings_on" = xno
+ then
+ ac_compile_warnings_msg=no
+ else
+ if test -n "$CXX"
+ then
+ if test "$GXX" = "yes"
+ then
+ ac_compile_warnings_opt='-Wall -W -ansi -pedantic'
+ fi
+ CXXFLAGS="$CXXFLAGS $ac_compile_warnings_opt"
+ ac_compile_warnings_msg="$ac_compile_warnings_opt for C++"
+ fi
+
+ if test -n "$CC"
+ then
+ if test "$GCC" = "yes"
+ then
+ ac_compile_warnings_opt='-Wall -W -ansi -pedantic'
+ fi
+ CFLAGS="$CFLAGS $ac_compile_warnings_opt"
+ ac_compile_warnings_msg="$ac_compile_warnings_msg $ac_compile_warnings_opt for C"
+ fi
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_compile_warnings_msg" >&5
+$as_echo "$ac_compile_warnings_msg" >&6; }
+ unset ac_compile_warnings_msg
+ unset ac_compile_warnings_opt
+ # Increase warning levels
+
+
+cat >>confdefs.h <<_ACEOF
+#define SWIG_CXX "$CXX"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SWIG_PLATFORM "$host"
+_ACEOF
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+
+
+# Check whether --with-popen was given.
+if test "${with_popen+set}" = set; then :
+ withval=$with_popen; with_popen="$withval"
+fi
+
+if test x"${with_popen}" = xno ; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling popen" >&5
+$as_echo "$as_me: Disabling popen" >&6;}
+else
+ac_fn_c_check_func "$LINENO" "popen" "ac_cv_func_popen"
+if test "x$ac_cv_func_popen" = xyes; then :
+
+$as_echo "#define HAVE_POPEN 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling popen" >&5
+$as_echo "$as_me: Disabling popen" >&6;}
+fi
+
+fi
+
+
+# Check whether --with-pcre was given.
+if test "${with_pcre+set}" = set; then :
+ withval=$with_pcre;
+else
+ with_pcre=yes
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable PCRE support" >&5
+$as_echo_n "checking whether to enable PCRE support... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_pcre" >&5
+$as_echo "$with_pcre" >&6; }
+
+if test x"${with_pcre}" = xyes ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use local PCRE" >&5
+$as_echo_n "checking whether to use local PCRE... " >&6; }
+ local_pcre_config=no
+ if test -z $PCRE_CONFIG; then
+ if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
+ PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
+ local_pcre_config=$PCRE_CONFIG
+ fi
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $local_pcre_config" >&5
+$as_echo "$local_pcre_config" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+if test "x$with_pcre" != xno; then :
+
+
+
+
+
+# Check whether --with-pcre-prefix was given.
+if test "${with_pcre_prefix+set}" = set; then :
+ withval=$with_pcre_prefix; pcre_config_prefix="$withval"
+else
+ pcre_config_prefix=""
+fi
+
+
+# Check whether --with-pcre-exec-prefix was given.
+if test "${with_pcre_exec_prefix+set}" = set; then :
+ withval=$with_pcre_exec_prefix; pcre_config_exec_prefix="$withval"
+else
+ pcre_config_exec_prefix=""
+fi
+
+
+
+
+
+
+ if test x"$PCRE_CFLAGS" != x -o x"$PCRE_LIBS" != x; then :
+
+
+
+ :
+
+$as_echo "#define HAVE_PCRE 1" >>confdefs.h
+
+ LIBS="$LIBS $PCRE_LIBS"
+ CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
+
+
+else
+
+ if test x$pcre_config_exec_prefix != x; then :
+
+ pcre_config_args="$pcre_config_args --exec-prefix=$pcre_config_exec_prefix"
+ if test x${PCRE_CONFIG+set} != xset; then :
+
+ PCRE_CONFIG=$pcre_config_exec_prefix/bin/pcre-config
+
+fi
+
+fi
+ if test x$pcre_config_prefix != x; then :
+
+ pcre_config_args="$pcre_config_args --prefix=$pcre_config_prefix"
+ if test x${PCRE_CONFIG+set} != xset; then :
+
+ PCRE_CONFIG=$pcre_config_prefix/bin/pcre-config
+
+fi
+
+fi
+
+ for ac_prog in pcre-config
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PCRE_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PCRE_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PCRE_CONFIG="$PCRE_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PCRE_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PCRE_CONFIG=$ac_cv_path_PCRE_CONFIG
+if test -n "$PCRE_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCRE_CONFIG" >&5
+$as_echo "$PCRE_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PCRE_CONFIG" && break
+done
+test -n "$PCRE_CONFIG" || PCRE_CONFIG="no"
+
+ if test "$PCRE_CONFIG" = "no"; then :
+
+ :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "
+ Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
+ library package. This dependency is needed for configure to complete,
+ Either:
+ - Install the PCRE developer package on your system (preferred approach).
+ - Download the PCRE source tarball, build and install on your system
+ as you would for any package built from source distribution.
+ - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
+ link against. Run 'Tools/pcre-build.sh --help' for instructions.
+ (quite easy and does not require privileges to install PCRE on your system)
+ - Use configure --without-pcre to disable regular expressions support in SWIG
+ (not recommended).
+See \`config.log' for more details" "$LINENO" 5; }
+
+
+else
+
+ if test x"" = x; then :
+
+ PCRE_CFLAGS="`$PCRE_CONFIG $pcre_config_args --cflags`"
+
+else
+
+ PCRE_CFLAGS="`$PCRE_CONFIG $pcre_config_args `"
+
+fi
+
+ if test x"" = x; then :
+
+ PCRE_LIBS="`$PCRE_CONFIG $pcre_config_args --libs`"
+
+else
+
+ PCRE_LIBS="`$PCRE_CONFIG $pcre_config_args `"
+
+fi
+
+ if test x"" != x; then :
+
+ if test x" " != x; then :
+
+ pcre_version="`$PCRE_CONFIG $pcre_config_args --version | $SED -e `"
+
+else
+
+ pcre_version="`$PCRE_CONFIG $pcre_config_args --version | $SED -e 's/^\ *\(.*\)\ *$/\1/'`"
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre ($pcre_version) >= " >&5
+$as_echo_n "checking for pcre ($pcre_version) >= ... " >&6; }
+
+
+
+ # Used to indicate true or false condition
+ ax_compare_version=false
+
+ # Convert the two version strings to be compared into a format that
+ # allows a simple string comparison. The end result is that a version
+ # string of the form 1.12.5-r617 will be converted to the form
+ # 0001001200050617. In other words, each number is zero padded to four
+ # digits, and non digits are removed.
+
+ ax_compare_version_A=`echo "$pcre_version" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+ -e 's/[^0-9]//g'`
+
+
+ ax_compare_version_B=`echo "" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+ -e 's/[^0-9]//g'`
+
+
+ ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"`
+
+
+
+ if test "$ax_compare_version" = "true" ; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+
+ :
+
+$as_echo "#define HAVE_PCRE 1" >>confdefs.h
+
+ LIBS="$LIBS $PCRE_LIBS"
+ CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
+
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "
+ Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
+ library package. This dependency is needed for configure to complete,
+ Either:
+ - Install the PCRE developer package on your system (preferred approach).
+ - Download the PCRE source tarball, build and install on your system
+ as you would for any package built from source distribution.
+ - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
+ link against. Run 'Tools/pcre-build.sh --help' for instructions.
+ (quite easy and does not require privileges to install PCRE on your system)
+ - Use configure --without-pcre to disable regular expressions support in SWIG
+ (not recommended).
+See \`config.log' for more details" "$LINENO" 5; }
+
+
+ fi
+
+
+else
+
+
+
+ :
+
+$as_echo "#define HAVE_PCRE 1" >>confdefs.h
+
+ LIBS="$LIBS $PCRE_LIBS"
+ CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
+
+
+fi
+
+fi
+
+fi
+
+
+
+
+
+fi
+
+
+# Check whether --enable-ccache was given.
+if test "${enable_ccache+set}" = set; then :
+ enableval=$enable_ccache; enable_ccache=$enableval
+else
+ enable_ccache=yes
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable ccache-swig" >&5
+$as_echo_n "checking whether to enable ccache-swig... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_ccache" >&5
+$as_echo "$enable_ccache" >&6; }
+
+if test "$enable_ccache" = yes; then
+
+
+subdirs="$subdirs CCache"
+
+ ENABLE_CCACHE=1
+fi
+
+
+
+echo ""
+echo "Checking packages required for SWIG developers."
+echo "Note : None of the following packages are required for users to compile and install SWIG from the distributed tarball"
+echo ""
+
+for ac_prog in 'bison -y' byacc
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_YACC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$YACC"; then
+ ac_cv_prog_YACC="$YACC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_YACC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+YACC=$ac_cv_prog_YACC
+if test -n "$YACC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
+$as_echo "$YACC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$YACC" && break
+done
+test -n "$YACC" || YACC="yacc"
+
+
+echo ""
+echo "Checking for installed target languages and other information in order to compile and run"
+echo "the examples and test-suite invoked by 'make check'."
+echo "Note : None of the following packages are required for users to compile and install SWIG from the distributed tarball"
+echo ""
+
+
+
+
+# Check whether --with-boost was given.
+if test "${with_boost+set}" = set; then :
+ withval=$with_boost;
+ case $withval in #(
+ no) :
+ want_boost="no";_AX_BOOST_BASE_boost_path="" ;; #(
+ yes) :
+ want_boost="yes";_AX_BOOST_BASE_boost_path="" ;; #(
+ *) :
+ want_boost="yes";_AX_BOOST_BASE_boost_path="$withval" ;;
+esac
+
+else
+ want_boost="yes"
+fi
+
+
+
+
+# Check whether --with-boost-libdir was given.
+if test "${with_boost_libdir+set}" = set; then :
+ withval=$with_boost_libdir;
+ if test -d "$withval"; then :
+ _AX_BOOST_BASE_boost_lib_path="$withval"
+else
+ as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5
+fi
+
+else
+ _AX_BOOST_BASE_boost_lib_path=""
+fi
+
+
+BOOST_LDFLAGS=""
+BOOST_CPPFLAGS=""
+if test "x$want_boost" = "xyes"; then :
+
+
+ if test "x" = "x"; then :
+ _AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"
+else
+ _AX_BOOST_BASE_TONUMERICVERSION_req=""
+fi
+ _AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([0-9]*\.[0-9]*\)'`
+ _AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([0-9]*\)'`
+ if test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"; then :
+ as_fn_error $? "You should at least specify libboost major version" "$LINENO" 5
+fi
+ _AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[0-9]*\.\([0-9]*\)'`
+ if test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"; then :
+ _AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"
+fi
+ _AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+ if test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"; then :
+ _AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"
+fi
+ _AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor`
+ WANT_BOOST_VERSION=$_AX_BOOST_BASE_TONUMERICVERSION_RET
+
+ succeeded=no
+
+
+
+ case ${host_cpu} in #(
+ x86_64) :
+ libsubdirs="lib64 libx32 lib lib64" ;; #(
+ ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64) :
+ libsubdirs="lib64 lib lib64" ;; #(
+ *) :
+ libsubdirs="lib"
+ ;;
+esac
+
+ case ${host_cpu} in #(
+ i?86) :
+ multiarch_libsubdir="lib/i386-${host_os}" ;; #(
+ *) :
+ multiarch_libsubdir="lib/${host_cpu}-${host_os}"
+ ;;
+esac
+
+ if test "x$_AX_BOOST_BASE_boost_path" != "x"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= ($WANT_BOOST_VERSION) includes in \"$_AX_BOOST_BASE_boost_path/include\"" >&5
+$as_echo_n "checking for boostlib >= ($WANT_BOOST_VERSION) includes in \"$_AX_BOOST_BASE_boost_path/include\"... " >&6; }
+ if test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
+ for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= ($WANT_BOOST_VERSION) lib path in \"$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp\"" >&5
+$as_echo_n "checking for boostlib >= ($WANT_BOOST_VERSION) lib path in \"$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp\"... " >&6; }
+ if test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp";
+ break;
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+ done
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+else
+
+ if test X"$cross_compiling" = Xyes; then
+ search_libsubdirs=$multiarch_libsubdir
+ else
+ search_libsubdirs="$multiarch_libsubdir $libsubdirs"
+ fi
+ for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+ if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then
+ for libsubdir in $search_libsubdirs ; do
+ if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ done
+ BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir"
+ BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include"
+ break;
+ fi
+ done
+
+fi
+
+ if test "x$_AX_BOOST_BASE_boost_lib_path" != "x"; then :
+ BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= ($WANT_BOOST_VERSION)" >&5
+$as_echo_n "checking for boostlib >= ($WANT_BOOST_VERSION)... " >&6; }
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <boost/version.hpp>
+
+int
+main ()
+{
+
+(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($WANT_BOOST_VERSION))]));
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ succeeded=yes
+ found_system=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+ if test "x$succeeded" != "xyes" ; then
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+ BOOST_CPPFLAGS=
+ if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
+ BOOST_LDFLAGS=
+ fi
+ _version=0
+ if test -n "$_AX_BOOST_BASE_boost_path" ; then
+ if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then
+ for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+ V_CHECK=`expr $_version_tmp \> $_version`
+ if test "x$V_CHECK" = "x1" ; then
+ _version=$_version_tmp
+ fi
+ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+ BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE"
+ done
+ if test -z "$BOOST_CPPFLAGS"; then
+ if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then
+ BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path"
+ fi
+ fi
+ if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then
+ for libsubdir in $libsubdirs ; do
+ if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ done
+ BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir"
+ fi
+ fi
+ else
+ if test "x$cross_compiling" != "xyes" ; then
+ for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do
+ if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then
+ for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+ V_CHECK=`expr $_version_tmp \> $_version`
+ if test "x$V_CHECK" = "x1" ; then
+ _version=$_version_tmp
+ best_path=$_AX_BOOST_BASE_boost_path
+ fi
+ done
+ fi
+ done
+
+ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+ BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+ if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
+ for libsubdir in $libsubdirs ; do
+ if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ done
+ BOOST_LDFLAGS="-L$best_path/$libsubdir"
+ fi
+ fi
+
+ if test -n "$BOOST_ROOT" ; then
+ for libsubdir in $libsubdirs ; do
+ if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ done
+ if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
+ version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
+ stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
+ stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'`
+ V_CHECK=`expr $stage_version_shorten \>\= $_version`
+ if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: We will use a staged boost library from $BOOST_ROOT" >&5
+$as_echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;}
+ BOOST_CPPFLAGS="-I$BOOST_ROOT"
+ BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
+ fi
+ fi
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <boost/version.hpp>
+
+int
+main ()
+{
+
+(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($WANT_BOOST_VERSION))]));
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ succeeded=yes
+ found_system=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ fi
+
+ if test "x$succeeded" != "xyes" ; then
+ if test "x$_version" = "x0" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
+$as_echo "$as_me: We could not detect the boost libraries (version or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&6;}
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5
+$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
+ fi
+ # execute ACTION-IF-NOT-FOUND (if present):
+ :
+ else
+
+$as_echo "#define HAVE_BOOST /**/" >>confdefs.h
+
+ # execute ACTION-IF-FOUND (if present):
+ :
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+
+
+fi
+
+
+
+
+
+# -I should not be used on system directories (GCC)
+if test "$GCC" = yes; then
+ ISYSTEM="-isystem "
+else
+ ISYSTEM="-I"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: ISYSTEM: $ISYSTEM" >&5
+$as_echo "$as_me: ISYSTEM: $ISYSTEM" >&6;}
+
+
+# SO is the extension of shared libraries (including the dot!)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SO" >&5
+$as_echo_n "checking SO... " >&6; }
+if test -z "$SO"
+then
+ case $host in
+ *-*-hp*) SO=.sl;;
+ *-*-darwin*) SO=.bundle;;
+ *-*-cygwin* | *-*-mingw*) SO=.dll;;
+ *) SO=.so;;
+ esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SO" >&5
+$as_echo "$SO" >&6; }
+
+# LDSHARED is the ld *command* used to create shared library
+# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
+# (Shared libraries in this instance are shared modules to be loaded into
+# Python, as opposed to building Python itself as a shared library.)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LDSHARED" >&5
+$as_echo_n "checking LDSHARED... " >&6; }
+if test -z "$LDSHARED"
+then
+ case $host in
+ *-*-aix*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
+ *-*-cygwin* | *-*-mingw*)
+ if test "$GCC" = yes; then
+ LDSHARED="$CC -shared"
+ else
+ if test "cl" = $CC ; then
+ # Microsoft Visual C++ (MSVC)
+ LDSHARED="$CC -nologo -LD"
+ else
+ # Unknown compiler try gcc approach
+ LDSHARED="$CC -shared"
+ fi
+ fi ;;
+ *-*-irix5*) LDSHARED="ld -shared";;
+ *-*-irix6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
+ *-*-sunos4*) LDSHARED="ld";;
+ *-*-solaris*) LDSHARED="ld -G";;
+ *-*-hp*) LDSHARED="ld -b";;
+ *-*-osf*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
+ *-sequent-sysv4) LDSHARED="ld -G";;
+ *-*-next*)
+ if test "$ns_dyld"
+ then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
+ else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'
+ fi
+ if test "$with_next_framework" ; then
+ LDSHARED="$LDSHARED \$(LDLIBRARY)"
+ fi ;;
+ *-*-linux*) LDSHARED="$CC -shared";;
+ *-*-dgux*) LDSHARED="ld -G";;
+ *-*-freebsd3*) LDSHARED="$CC -shared";;
+ *-*-freebsd* | *-*-openbsd*) LDSHARED="ld -Bshareable";;
+ *-*-netbsd*)
+ if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
+ then
+ LDSHARED="$CC -shared"
+ else
+ LDSHARED="ld -Bshareable"
+ fi;;
+ *-sco-sysv*) LDSHARED="$CC -G -KPIC -Ki486 -belf -Wl,-Bexport";;
+ *-*-darwin*) LDSHARED="$CC -bundle -undefined suppress -flat_namespace";;
+ *) LDSHARED="ld";;
+ esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDSHARED" >&5
+$as_echo "$LDSHARED" >&6; }
+# CXXSHARED is the ld *command* used to create C++ shared library
+# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
+# (Shared libraries in this instance are shared modules to be loaded into
+# Python, as opposed to building Python itself as a shared library.)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CXXSHARED" >&5
+$as_echo_n "checking CXXSHARED... " >&6; }
+if test -z "$CXXSHARED"
+then
+ CXXSHARED="$LDSHARED"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXSHARED" >&5
+$as_echo "$CXXSHARED" >&6; }
+
+#
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking TRYLINKINGWITHCXX" >&5
+$as_echo_n "checking TRYLINKINGWITHCXX... " >&6; }
+if test -z "$TRYLINKINGWITHCXX"
+then
+ case $host in
+ *-*-solaris*) if test "$GCC" = yes
+ then TRYLINKINGWITHCXX="CXXSHARED= $CXX -Wl,-G"
+ else TRYLINKINGWITHCXX="CXXSHARED= $CXX -G -L/opt/SUNWspro/lib -lCrun -lCstd"
+ fi;;
+ *-*-hp*) TRYLINKINGWITHCXX="CXXSHARED= $CXX +z ";;
+ *-*-darwin*) TRYLINKINGWITHCXX="CXXSHARED= $CXX -bundle -undefined suppress -flat_namespace";;
+ *-*-cygwin* | *-*-mingw*)
+ if test "$GCC" = yes; then
+ TRYLINKINGWITHCXX="CXXSHARED= $CXX -shared "
+ else
+ if test "cl" = $CXX ; then
+ # Microsoft Visual C++ (MSVC)
+ TRYLINKINGWITHCXX="CXXSHARED= $CXX -nologo -LD"
+ else
+ TRYLINKINGWITHCXX="#unknown Windows compiler"
+ fi
+ fi ;;
+ *) TRYLINKINGWITHCXX="CXXSHARED= $CXX -shared ";;
+ esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TRYLINKINGWITHCXX" >&5
+$as_echo "$TRYLINKINGWITHCXX" >&6; }
+# CCSHARED are the C *flags* used to create objects to go into a shared
+# library (module) -- this is only needed for a few systems
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CCSHARED" >&5
+$as_echo_n "checking CCSHARED... " >&6; }
+if test -z "$CCSHARED"
+then
+ case $host in
+ *-*-hp*) if test "$GCC" = yes
+ then CCSHARED="-fpic"
+ else CCSHARED="+z"
+ fi;;
+ s390x*-*-*) CCSHARED="-fpic" ;;
+ s390*-*-*) CCSHARED="-fPIC" ;;
+ *-*-linux*) CCSHARED="-fpic";;
+ *-*-freebsd* | *-*-openbsd*) CCSHARED="-fpic";;
+ *-*-netbsd*) CCSHARED="-fPIC";;
+ *-sco-sysv*) CCSHARED="-KPIC -dy -Bdynamic";;
+ *-*-irix6*) case $CC in
+ *gcc*) CCSHARED="-shared";;
+ *) CCSHARED="";;
+ esac;;
+ esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CCSHARED" >&5
+$as_echo "$CCSHARED" >&6; }
+
+# RPATH is the path used to look for shared library files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking RPATH" >&5
+$as_echo_n "checking RPATH... " >&6; }
+if test -z "$RPATH"
+then
+ case $host in
+ *-*-solaris*) RPATH='-R. -R$(exec_prefix)/lib';;
+ *-*-irix*) RPATH='-rpath .:$(exec_prefix)/lib';;
+ *-*-linux*) RPATH='-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .';;
+ *) RPATH='';;
+ esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RPATH" >&5
+$as_echo "$RPATH" >&6; }
+
+# LINKFORSHARED are the flags passed to the $(CC) command that links
+# a few executables -- this is only needed for a few systems
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LINKFORSHARED" >&5
+$as_echo_n "checking LINKFORSHARED... " >&6; }
+if test -z "$LINKFORSHARED"
+then
+ case $host in
+ *-*-aix*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';;
+ *-*-hp*)
+ LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
+ *-*-linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
+ *-*-next*) LINKFORSHARED="-u libsys_s";;
+ *-sco-sysv*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
+ *-*-irix6*) LINKFORSHARED="-all";;
+ esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKFORSHARED" >&5
+$as_echo "$LINKFORSHARED" >&6; }
+
+# Optional CFLAGS used to silence/enhance compiler warnings on some platforms.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking PLATCFLAGS" >&5
+$as_echo_n "checking PLATCFLAGS... " >&6; }
+case $host in
+ *-*-solaris*) if test "$GCC" = yes
+ then PLATCFLAGS=
+ else PLATCFLAGS=
+ # else PLATCFLAGS="-errtags=yes" # Need more work as C examples use ld for linking
+ fi;;
+ *) PLATCFLAGS=
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PLATCFLAGS" >&5
+$as_echo "$PLATCFLAGS" >&6; }
+
+# Add switch if necessary to enable C++11 support - just for tests
+# Check whether --enable-cpp11-testing was given.
+if test "${enable_cpp11_testing+set}" = set; then :
+ enableval=$enable_cpp11_testing; enable_cpp11_testing=$enableval
+else
+ enable_cpp11_testing=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable C++11 testing" >&5
+$as_echo_n "checking whether to enable C++11 testing... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_cpp11_testing" >&5
+$as_echo "$enable_cpp11_testing" >&6; }
+
+PLATCXXFLAGS="$PLATCFLAGS"
+if test x"$enable_cpp11_testing" = xyes; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ CXXFLAGS_SAVED=$CXXFLAGS
+ CXXFLAGS=
+ ac_success=no
+ CXX11FLAGS=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5
+$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; }
+if ${ax_cv_cxx_compile_cxx11+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = static_cast<check_type&&>(c);
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ax_cv_cxx_compile_cxx11=yes
+else
+ ax_cv_cxx_compile_cxx11=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5
+$as_echo "$ax_cv_cxx_compile_cxx11" >&6; }
+ if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+ ac_success=yes
+ fi
+
+
+
+ if test x$ac_success = xno; then
+ for switch in -std=c++11 -std=c++0x; do
+ cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
+$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; }
+if eval \${$cachevar+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $switch"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = static_cast<check_type&&>(c);
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ eval $cachevar=yes
+else
+ eval $cachevar=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CXXFLAGS="$ac_save_CXXFLAGS"
+fi
+eval ac_res=\$$cachevar
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ if eval test x\$$cachevar = xyes; then
+ CXXFLAGS="$CXXFLAGS $switch"
+ CXX11FLAGS=$switch
+ ac_success=yes
+ break
+ fi
+ done
+ fi
+
+ if test x$ac_success = xno; then
+ if test xnostop != xnostop; then
+ as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5
+ fi
+ else
+ HAVE_CXX11_COMPILER=yes
+ fi
+
+ CXXFLAGS=$CXXFLAGS_SAVED
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ if test x"$CXX11FLAGS" != x; then
+ PLATCXXFLAGS="$CXX11FLAGS $PLATCXXFLAGS"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++11 enabled compiler" >&5
+$as_echo_n "checking for C++11 enabled compiler... " >&6; }
+ if test x"$HAVE_CXX11_COMPILER" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_CXX11_COMPILER" >&5
+$as_echo "$HAVE_CXX11_COMPILER" >&6; }
+ fi
+fi
+
+# On darwin 10.7,10.8,10.9 using clang++, need to ensure using
+# libc++ for tests and examples to run under mono. May affect
+# other language targets as well - problem is a Mac OS X incompatibility
+# between libraries depending on libstdc++ and libc++.
+CLANGXX=
+$CXX -v 2>&1 | grep -i clang >/dev/null && CLANGXX=yes
+case $host in
+ *-*-darwin11* | *-*-darwin12* |*-*-darwin13* ) if test "$CLANGXX" = "yes";
+ then PLATCXXFLAGS="$PLATCXXFLAGS -stdlib=libc++"
+ fi;;
+ *) ;;
+esac
+
+# Set info about shared libraries.
+
+
+
+
+
+
+
+
+
+
+
+# This variation is needed on OS-X because there is no (apparent) consistency in shared library naming.
+# Sometimes .bundle works, but sometimes .so is needed. It depends on the target language
+
+
+case $host in
+ *-*-mingw*) PYTHON_SO=.pyd;;
+ *-*-darwin*) PYTHON_SO=.so;;
+ *) PYTHON_SO=$SO;;
+esac
+
+
+case $host in
+ *-*-darwin*) TCL_SO=.dylib;;
+ *) TCL_SO=$SO;;
+esac
+
+
+case $host in
+ *-*-darwin*) GUILE_SO=.so;;
+ *) GUILE_SO=$SO;;
+esac
+
+
+case $host in
+ *-*-darwin*) PHP_SO=.so;;
+ *) PHP_SO=$SO;;
+esac
+
+
+case $host in
+ *) MZSCHEME_SO=.so;;
+esac
+
+
+case $host in
+ *-*-darwin*) LUA_SO=.so;;
+ *) LUA_SO=$SO;;
+esac
+
+# Check for specific libraries. Used for SWIG examples
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+ # Dynamic linking for SunOS/Solaris and SYSV
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDLD 1
+_ACEOF
+
+ LIBS="-ldld $LIBS"
+
+fi
+ # Dynamic linking for HP-UX
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing t_open" >&5
+$as_echo_n "checking for library containing t_open... " >&6; }
+if ${ac_cv_search_t_open+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char t_open ();
+int
+main ()
+{
+return t_open ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' nsl; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_t_open=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_t_open+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_t_open+:} false; then :
+
+else
+ ac_cv_search_t_open=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_t_open" >&5
+$as_echo "$ac_cv_search_t_open" >&6; }
+ac_res=$ac_cv_search_t_open
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+ # SVR4
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5
+$as_echo_n "checking for library containing gethostbyname... " >&6; }
+if ${ac_cv_search_gethostbyname+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gethostbyname ();
+int
+main ()
+{
+return gethostbyname ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' inet; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_gethostbyname=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_gethostbyname+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_gethostbyname+:} false; then :
+
+else
+ ac_cv_search_gethostbyname=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5
+$as_echo "$ac_cv_search_gethostbyname" >&6; }
+ac_res=$ac_cv_search_gethostbyname
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+ # Sequent
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5
+$as_echo_n "checking for library containing socket... " >&6; }
+if ${ac_cv_search_socket+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char socket ();
+int
+main ()
+{
+return socket ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' socket; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_socket=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_socket+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_socket+:} false; then :
+
+else
+ ac_cv_search_socket=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5
+$as_echo "$ac_cv_search_socket" >&6; }
+ac_res=$ac_cv_search_socket
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+ # SVR4 sockets
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for swill_init in -lswill" >&5
+$as_echo_n "checking for swill_init in -lswill... " >&6; }
+if ${ac_cv_lib_swill_swill_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lswill $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char swill_init ();
+int
+main ()
+{
+return swill_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_swill_swill_init=yes
+else
+ ac_cv_lib_swill_swill_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_swill_swill_init" >&5
+$as_echo "$ac_cv_lib_swill_swill_init" >&6; }
+if test "x$ac_cv_lib_swill_swill_init" = xyes; then :
+ SWIGLIBS="-lswill $LIBS" SWILL="-DSWIG_SWILL"
+fi
+
+
+
+
+# check for --with-libm=...
+
+LIBM=-lm
+
+# Check whether --with-libm was given.
+if test "${with_libm+set}" = set; then :
+ withval=$with_libm;
+if test "$withval" != yes
+then LIBM=$withval
+else as_fn_error $? "proper usage is --with-libm=STRING" "$LINENO" 5
+fi
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lieee" >&5
+$as_echo_n "checking for main in -lieee... " >&6; }
+if ${ac_cv_lib_ieee_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lieee $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ieee_main=yes
+else
+ ac_cv_lib_ieee_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee_main" >&5
+$as_echo "$ac_cv_lib_ieee_main" >&6; }
+if test "x$ac_cv_lib_ieee_main" = xyes; then :
+ LIBM="-lieee $LIBM"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5
+$as_echo_n "checking for crypt in -lcrypt... " >&6; }
+if ${ac_cv_lib_crypt_crypt+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypt $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char crypt ();
+int
+main ()
+{
+return crypt ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_crypt_crypt=yes
+else
+ ac_cv_lib_crypt_crypt=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5
+$as_echo "$ac_cv_lib_crypt_crypt" >&6; }
+if test "x$ac_cv_lib_crypt_crypt" = xyes; then :
+ LIBCRYPT="-lcrypt"
+fi
+
+
+
+# check for --with-libc=...
+
+
+# Check whether --with-libc was given.
+if test "${with_libc+set}" = set; then :
+ withval=$with_libc;
+if test "$withval" != yes
+then LIBC=$withval
+else as_fn_error $? "proper usage is --with-libc=STRING" "$LINENO" 5
+fi
+fi
+
+
+#--------------------------------------------------------------------
+# Target languages
+#--------------------------------------------------------------------
+
+
+# Check whether --with-alllang was given.
+if test "${with_alllang+set}" = set; then :
+ withval=$with_alllang; with_alllang="$withval"
+fi
+
+
+if test "$with_alllang" = "no"; then
+ alllang_default=no
+else
+ alllang_default=yes
+fi
+
+for ac_prog in pkg-config
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PKGCONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PKGCONFIG"; then
+ ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PKGCONFIG="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PKGCONFIG=$ac_cv_prog_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
+$as_echo "$PKGCONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PKGCONFIG" && break
+done
+
+
+#--------------------------------------------------------------------
+# Look for Tcl
+#--------------------------------------------------------------------
+
+TCLINCLUDE=
+TCLLIB=
+TCLPACKAGE=
+
+
+# Check whether --with-tclconfig was given.
+if test "${with_tclconfig+set}" = set; then :
+ withval=$with_tclconfig; with_tclconfig="$withval"
+else
+ with_tclconfig=
+fi
+
+
+# Check whether --with-tcl was given.
+if test "${with_tcl+set}" = set; then :
+ withval=$with_tcl;
+ TCLPACKAGE="$withval"
+else
+ TCLPACKAGE="$alllang_default"
+fi
+
+
+# Check whether --with-tclincl was given.
+if test "${with_tclincl+set}" = set; then :
+ withval=$with_tclincl;
+ TCLINCLUDE="$ISYSTEM$withval"
+else
+ TCLINCLUDE=
+fi
+
+
+# Check whether --with-tcllib was given.
+if test "${with_tcllib+set}" = set; then :
+ withval=$with_tcllib;
+ TCLLIB="-L$withval"
+else
+ TCLLIB=
+fi
+
+
+# First, check for "--without-tcl" or "--with-tcl=no".
+if test x"${TCLPACKAGE}" = xno; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Tcl" >&5
+$as_echo "$as_me: Disabling Tcl" >&6;}
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
+$as_echo_n "checking for Tcl configuration... " >&6; }
+# First check to see if --with-tclconfig was specified.
+if test x"${with_tclconfig}" != x ; then
+ if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ TCLCONFIG=`(cd ${with_tclconfig}; pwd)`
+ else
+ as_fn_error $? "${with_tcl} directory does not contain tclConfig.sh" "$LINENO" 5
+ fi
+fi
+# check in a few common install locations
+dirs="/usr/lib*/ /usr/lib*/tcl*/ /usr/local/lib*/ /usr/local/lib*/tcl*/"
+case $host in
+*-*-darwin*)
+ dirs="/System/Library/Frameworks/Tcl.framework/ $dirs"
+ ;;
+*)
+ ;;
+esac
+if test x"${TCLCONFIG}" = x ; then
+ for d in $dirs ; do
+ for i in `ls -d -r $d 2>/dev/null` ; do
+ if test -f $i"tclConfig.sh" ; then
+ TCLCONFIG=`(cd $i; pwd)`
+ break
+ fi
+ done
+ done
+fi
+if test x"${TCLCONFIG}" = x ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $TCLCONFIG/tclConfig.sh" >&5
+$as_echo "found $TCLCONFIG/tclConfig.sh" >&6; }
+ . $TCLCONFIG/tclConfig.sh
+ if test -z "$TCLINCLUDE"; then
+ TCLINCLUDE=`echo $TCL_INCLUDE_SPEC | sed "s/-I/$ISYSTEM/"`
+ fi
+ if test -z "$TCLLIB"; then
+ TCLLIB=$TCL_LIB_SPEC
+ fi
+fi
+
+if test -z "$TCLINCLUDE"; then
+ if test "x$TCLPACKAGE" != xyes; then
+ TCLINCLUDE="$ISYSTEM$TCLPACKAGE/include"
+ fi
+fi
+
+if test -z "$TCLLIB"; then
+ if test "x$TCLPACKAGE" != xyes; then
+ TCLLIB="-L$TCLPACKAGE/lib -ltcl"
+ fi
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl header files" >&5
+$as_echo_n "checking for Tcl header files... " >&6; }
+if test -z "$TCLINCLUDE"; then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <tcl.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ TCLINCLUDE=""
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+if test -z "$TCLINCLUDE"; then
+ dirs="/usr/local/include /usr/include /opt/local/include"
+ for i in $dirs ; do
+ if test -r $i/tcl.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i" >&5
+$as_echo "$i" >&6; }
+ TCLINCLUDE="$ISYSTEM$i"
+ break
+ fi
+ done
+fi
+if test -z "$TCLINCLUDE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLINCLUDE" >&5
+$as_echo "$TCLINCLUDE" >&6; }
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl library" >&5
+$as_echo_n "checking for Tcl library... " >&6; }
+if test -z "$TCLLIB"; then
+dirs="/usr/local/lib /usr/lib /opt/local/lib"
+for i in $dirs ; do
+ if test -r $i/libtcl.a; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i" >&5
+$as_echo "$i" >&6; }
+ TCLLIB="-L$i -ltcl"
+ break
+ fi
+done
+if test -z "$TCLLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+fi
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLLIB" >&5
+$as_echo "$TCLLIB" >&6; }
+fi
+
+# Cygwin (Windows) needs the library for dynamic linking
+case $host in
+*-*-cygwin* | *-*-mingw*) TCLDYNAMICLINKING="$TCLLIB";;
+*)TCLDYNAMICLINKING="";;
+esac
+
+case $host in
+*-*-darwin*)
+ TCLLDSHARED='$(CC) -dynamiclib -undefined suppress -flat_namespace'
+ TCLCXXSHARED='$(CXX) -dynamiclib -undefined suppress -flat_namespace'
+ ;;
+*)
+ TCLLDSHARED='$(LDSHARED)'
+ TCLCXXSHARED='$(CXXSHARED)'
+ ;;
+esac
+
+fi
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for Python
+#----------------------------------------------------------------
+
+PYINCLUDE=
+PYLIB=
+PYLINK=
+PYPACKAGE=
+
+
+# Check whether --with-python was given.
+if test "${with_python+set}" = set; then :
+ withval=$with_python; PYBIN="$withval"
+else
+ PYBIN="$alllang_default"
+fi
+
+
+# First, check for "--without-python" or "--with-python=no".
+if test x"${PYBIN}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Python" >&5
+$as_echo "$as_me: Disabling Python" >&6;}
+else
+ # First figure out the name of the Python executable
+ if test "x$PYBIN" = xyes; then
+ for ac_prog in python python2.7
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PYTHON+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PYTHON"; then
+ ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PYTHON="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PYTHON=$ac_cv_prog_PYTHON
+if test -n "$PYTHON"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PYTHON" && break
+done
+
+ else
+ PYTHON="$PYBIN"
+ fi
+
+ PYVER=0
+ if test -n "$PYTHON"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $PYTHON major version number" >&5
+$as_echo_n "checking for $PYTHON major version number... " >&6; }
+ PYVER=`($PYTHON -c "import sys; sys.stdout.write(sys.version[0])") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYVER" >&5
+$as_echo "$PYVER" >&6; }
+ if test -z "$PYVER"; then
+ PYVER=0
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python os.name" >&5
+$as_echo_n "checking for Python os.name... " >&6; }
+ PYOSNAME=`($PYTHON -c "import sys, os; sys.stdout.write(os.name)") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYOSNAME" >&5
+$as_echo "$PYOSNAME" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python path separator" >&5
+$as_echo_n "checking for Python path separator... " >&6; }
+ PYSEPARATOR=`($PYTHON -c "import sys, os; sys.stdout.write(os.sep)") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYSEPARATOR" >&5
+$as_echo "$PYSEPARATOR" >&6; }
+ fi
+ fi
+
+ if test $PYVER -eq 1 -o $PYVER -eq 2; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python prefix" >&5
+$as_echo_n "checking for Python prefix... " >&6; }
+ PYPREFIX=`($PYTHON -c "import sys; sys.stdout.write(sys.prefix)") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYPREFIX" >&5
+$as_echo "$PYPREFIX" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python exec-prefix" >&5
+$as_echo_n "checking for Python exec-prefix... " >&6; }
+ PYEPREFIX=`($PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYEPREFIX" >&5
+$as_echo "$PYEPREFIX" >&6; }
+
+ if test x"$PYOSNAME" = x"nt" -a x"$PYSEPARATOR" = x"\\"; then
+ # Windows installations are quite different to posix installations (MinGW path separator is a forward slash)
+ PYPREFIX=`echo "$PYPREFIX" | sed -e 's,\\\\,/,g'` # Forward slashes are easier to use and even work on Windows most of the time
+ PYTHON_SO=.pyd
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python header files" >&5
+$as_echo_n "checking for Python header files... " >&6; }
+ if test -r $PYPREFIX/include/Python.h; then
+ PYINCLUDE="-I$PYPREFIX/include"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYINCLUDE" >&5
+$as_echo "$PYINCLUDE" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library directory" >&5
+$as_echo_n "checking for Python library directory... " >&6; }
+ if test -d $PYPREFIX/libs; then
+ PYLIB=$PYPREFIX/libs
+ PYLINKFILE=`ls $PYLIB/python*.lib | grep "python[0-9][0-9]\.lib"`
+ if test -r "$PYLINKFILE"; then
+ PYLINK=-l`basename $PYLINKFILE | sed -e 's/\.lib$//'`
+ else
+ PYLIB=
+ fi
+ fi
+ else
+ # Note: I could not think of a standard way to get the version string from different versions.
+ # This trick pulls it out of the file location for a standard library file.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python version" >&5
+$as_echo_n "checking for Python version... " >&6; }
+
+ # Need to do this hack since autoconf replaces __file__ with the name of the configure file
+ filehack="file__"
+ PYVERSION=`($PYTHON -c "import sys,string,operator,os.path; sys.stdout.write(operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1))") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYVERSION" >&5
+$as_echo "$PYVERSION" >&6; }
+
+ # Find the directory for libraries this is necessary to deal with
+ # platforms that can have apps built for multiple archs: e.g. x86_64
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python lib dir" >&5
+$as_echo_n "checking for Python lib dir... " >&6; }
+ PYLIBDIR=`($PYTHON -c "import sys; sys.stdout.write(sys.lib)") 2>/dev/null`
+ if test -z "$PYLIBDIR"; then
+ # Fedora patch Python to add sys.lib, for other distros we assume "lib".
+ PYLIBDIR="lib"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYLIBDIR" >&5
+$as_echo "$PYLIBDIR" >&6; }
+
+ # Set the include directory
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python header files" >&5
+$as_echo_n "checking for Python header files... " >&6; }
+ if test -r $PYPREFIX/include/$PYVERSION/Python.h; then
+ PYINCLUDE="-I$PYPREFIX/include/$PYVERSION -I$PYEPREFIX/$PYLIBDIR/$PYVERSION/config"
+ fi
+ if test -z "$PYINCLUDE"; then
+ if test -r $PYPREFIX/include/Py/Python.h; then
+ PYINCLUDE="-I$PYPREFIX/include/Py -I$PYEPREFIX/$PYLIBDIR/python/lib"
+ fi
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYINCLUDE" >&5
+$as_echo "$PYINCLUDE" >&6; }
+
+ # Set the library directory blindly. This probably won't work with older versions
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library directory" >&5
+$as_echo_n "checking for Python library directory... " >&6; }
+ dirs="$PYVERSION/config $PYVERSION/$PYLIBDIR python/$PYLIBDIR"
+ for i in $dirs; do
+ if test -d $PYEPREFIX/$PYLIBDIR/$i; then
+ PYLIB="$PYEPREFIX/$PYLIBDIR/$i"
+ break
+ fi
+ done
+
+ PYLINK="-l$PYVERSION"
+ fi
+
+ if test -z "$PYLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5
+$as_echo "Not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYLIB" >&5
+$as_echo "$PYLIB" >&6; }
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library" >&5
+$as_echo_n "checking for Python library... " >&6; }
+ if test -z "$PYLINK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5
+$as_echo "Not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYLINK" >&5
+$as_echo "$PYLINK" >&6; }
+ fi
+ fi
+
+ # Cygwin (Windows) needs the library for dynamic linking
+ case $host in
+ *-*-cygwin* | *-*-mingw*)
+ PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK"
+ DEFS="-DUSE_DL_IMPORT $DEFS"
+ ;;
+ *)PYTHONDYNAMICLINKING="";;
+ esac
+fi
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for Python 3.x
+#----------------------------------------------------------------
+
+PY3INCLUDE=
+PY3LIB=
+PY3LINK=
+PY3PACKAGE=
+
+
+# Check whether --with-python3 was given.
+if test "${with_python3+set}" = set; then :
+ withval=$with_python3; PY3BIN="$withval"
+else
+ PY3BIN="$alllang_default"
+fi
+
+
+# First, check for "--without-python3" or "--with-python3=no".
+if test x"${PY3BIN}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Python 3.x support" >&5
+$as_echo "$as_me: Disabling Python 3.x support" >&6;}
+else
+ if test -z "$PYVER"; then
+ PYVER=0
+ fi
+ if test "x$PY3BIN" = xyes; then
+ if test x"$PYOSNAME" = x"nt" -a x"$PYSEPARATOR" = x"\\" -a $PYVER -ge 3; then
+ PYTHON3="$PYTHON"
+ else
+ for py_ver in 3 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 ""; do
+ for ac_prog in python$py_ver
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PYTHON3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PYTHON3"; then
+ ac_cv_prog_PYTHON3="$PYTHON3" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PYTHON3="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PYTHON3=$ac_cv_prog_PYTHON3
+if test -n "$PYTHON3"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON3" >&5
+$as_echo "$PYTHON3" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PYTHON3" && break
+done
+
+ if test -n "$PYTHON3"; then
+ for ac_prog in $PYTHON3-config
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PY3CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PY3CONFIG"; then
+ ac_cv_prog_PY3CONFIG="$PY3CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PY3CONFIG="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PY3CONFIG=$ac_cv_prog_PY3CONFIG
+if test -n "$PY3CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3CONFIG" >&5
+$as_echo "$PY3CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PY3CONFIG" && break
+done
+
+ if test -n "$PY3CONFIG"; then
+ break
+ fi
+ fi
+ done
+ fi
+ else
+ PYTHON3="$PY3BIN"
+ for ac_prog in $PYTHON3-config
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PY3CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PY3CONFIG"; then
+ ac_cv_prog_PY3CONFIG="$PY3CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PY3CONFIG="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PY3CONFIG=$ac_cv_prog_PY3CONFIG
+if test -n "$PY3CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3CONFIG" >&5
+$as_echo "$PY3CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PY3CONFIG" && break
+done
+
+ fi
+
+ if test -n "$PYTHON3"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $PYTHON3 major version number" >&5
+$as_echo_n "checking for $PYTHON3 major version number... " >&6; }
+ PYVER=`($PYTHON3 -c "import sys; sys.stdout.write(sys.version[0])") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYVER" >&5
+$as_echo "$PYVER" >&6; }
+ if test -z "$PYVER"; then
+ PYVER=0
+ fi
+ fi
+
+ if test $PYVER -ge 3; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x os.name" >&5
+$as_echo_n "checking for Python 3.x os.name... " >&6; }
+ PY3OSNAME=`($PYTHON3 -c "import sys, os; sys.stdout.write(os.name)") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3OSNAME" >&5
+$as_echo "$PY3OSNAME" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x path separator" >&5
+$as_echo_n "checking for Python 3.x path separator... " >&6; }
+ PYSEPARATOR=`($PYTHON3 -c "import sys, os; sys.stdout.write(os.sep)") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYSEPARATOR" >&5
+$as_echo "$PYSEPARATOR" >&6; }
+
+ if test x"$PY3OSNAME" = x"nt" -a x"$PYSEPARATOR" = x"\\"; then
+ # Windows installations are quite different to posix installations
+ # There is no python-config to use
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x prefix" >&5
+$as_echo_n "checking for Python 3.x prefix... " >&6; }
+ PY3PREFIX=`($PYTHON3 -c "import sys; sys.stdout.write(sys.prefix)") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3PREFIX" >&5
+$as_echo "$PY3PREFIX" >&6; }
+ PY3PREFIX=`echo "$PY3PREFIX" | sed -e 's,\\\\,/,g'` # Forward slashes are easier to use and even work on Windows most of the time
+ PYTHON_SO=.pyd
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x header files" >&5
+$as_echo_n "checking for Python 3.x header files... " >&6; }
+ if test -r $PY3PREFIX/include/Python.h; then
+ PY3INCLUDE="-I$PY3PREFIX/include"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3INCLUDE" >&5
+$as_echo "$PY3INCLUDE" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x library directory" >&5
+$as_echo_n "checking for Python 3.x library directory... " >&6; }
+ if test -d $PY3PREFIX/libs; then
+ PY3LIB=$PY3PREFIX/libs
+ PY3LINKFILE=`ls $PY3LIB/python*.lib | grep "python[0-9][0-9]\.lib"`
+ if test -r "$PY3LINKFILE"; then
+ PY3LINK=-l`basename $PY3LINKFILE | sed -e 's/\.lib$//'`
+ else
+ PY3LIB=
+ fi
+ fi
+ if test -z "$PY3LIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5
+$as_echo "Not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3LIB" >&5
+$as_echo "$PY3LIB" >&6; }
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x library" >&5
+$as_echo_n "checking for Python 3.x library... " >&6; }
+ if test -z "$PY3LINK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5
+$as_echo "Not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3LINK" >&5
+$as_echo "$PY3LINK" >&6; }
+ fi
+ elif test -n "$PY3CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x prefix" >&5
+$as_echo_n "checking for Python 3.x prefix... " >&6; }
+ PY3PREFIX=`($PY3CONFIG --prefix) 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3PREFIX" >&5
+$as_echo "$PY3PREFIX" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x exec-prefix" >&5
+$as_echo_n "checking for Python 3.x exec-prefix... " >&6; }
+ # Piped through xargs to strip trailing whitespace (bug in msys2 + mingw Python)
+ PY3EPREFIX=`($PY3CONFIG --exec-prefix | xargs) 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3EPREFIX" >&5
+$as_echo "$PY3EPREFIX" >&6; }
+
+ # Note: I could not think of a standard way to get the version string from different versions.
+ # This trick pulls it out of the file location for a standard library file.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x version" >&5
+$as_echo_n "checking for Python 3.x version... " >&6; }
+
+ # Need to do this hack since autoconf replaces __file__ with the name of the configure file
+ filehack="file__"
+ PY3VERSION=`($PYTHON3 -c "import string,operator,os.path; print(operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1))") 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3VERSION" >&5
+$as_echo "$PY3VERSION" >&6; }
+
+ # Find the directory for libraries this is necessary to deal with
+ # platforms that can have apps built for multiple archs: e.g. x86_64
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x lib dir" >&5
+$as_echo_n "checking for Python 3.x lib dir... " >&6; }
+ PY3LIBDIR=`($PYTHON3 -c "import sys; print(sys.lib)") 2>/dev/null`
+ if test -z "$PY3LIBDIR"; then
+ # some dists don't have sys.lib so the best we can do is assume lib
+ PY3LIBDIR="lib"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3LIBDIR" >&5
+$as_echo "$PY3LIBDIR" >&6; }
+
+ # Set the include directory
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x header files" >&5
+$as_echo_n "checking for Python 3.x header files... " >&6; }
+ PY3INCLUDE=`($PY3CONFIG --includes) 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3INCLUDE" >&5
+$as_echo "$PY3INCLUDE" >&6; }
+
+ # Set the library directory blindly. This probably won't work with older versions
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x library directory" >&5
+$as_echo_n "checking for Python 3.x library directory... " >&6; }
+ dirs="$PY3VERSION/config $PY3VERSION/$PY3LIBDIR python/$PY3LIBDIR"
+ for i in $dirs; do
+ if test -d $PY3EPREFIX/$PY3LIBDIR/$i; then
+ PY3LIB="$PY3EPREFIX/$PY3LIBDIR/$i"
+ break
+ fi
+ done
+ if test -z "$PY3LIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5
+$as_echo "Not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3LIB" >&5
+$as_echo "$PY3LIB" >&6; }
+ fi
+
+ PY3LINK="-l$PY3VERSION"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python 3.x library" >&5
+$as_echo_n "checking for Python 3.x library... " >&6; }
+ if test -z "$PY3LINK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5
+$as_echo "Not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY3LINK" >&5
+$as_echo "$PY3LINK" >&6; }
+ fi
+ fi
+ fi
+
+ # Cygwin (Windows) needs the library for dynamic linking
+ case $host in
+ *-*-cygwin* | *-*-mingw*)
+ PYTHON3DYNAMICLINKING="-L$PY3LIB $PY3LINK"
+ DEFS="-DUSE_DL_IMPORT $DEFS"
+ ;;
+ *)PYTHON3DYNAMICLINKING="";;
+ esac
+
+
+
+
+
+fi
+
+if test -n "$PYINCLUDE" || test -n "$PY3INCLUDE" ; then
+ for ac_prog in pycodestyle
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PYCODESTYLE+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PYCODESTYLE"; then
+ ac_cv_prog_PYCODESTYLE="$PYCODESTYLE" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PYCODESTYLE="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PYCODESTYLE=$ac_cv_prog_PYCODESTYLE
+if test -n "$PYCODESTYLE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYCODESTYLE" >&5
+$as_echo "$PYCODESTYLE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PYCODESTYLE" && break
+done
+
+ if test -n "$PYCODESTYLE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pycodestyle version" >&5
+$as_echo_n "checking pycodestyle version... " >&6; }
+ pycodestyle_version=`$PYCODESTYLE --version 2>/dev/null`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pycodestyle_version" >&5
+$as_echo "$pycodestyle_version" >&6; }
+ fi
+fi
+
+
+# Check whether --with-2to3 was given.
+if test "${with_2to3+set}" = set; then :
+ withval=$with_2to3; PY2TO3BIN="$withval"
+else
+ PY2TO3BIN="yes"
+fi
+
+if test -n "$PYTHON3"; then
+ if test "x$PY2TO3BIN" = xyes; then
+ py3to2=`echo $PYTHON3 | sed -e "s/python/2to3-/"`
+ for ac_prog in $py3to2 2to3
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PY2TO3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PY2TO3"; then
+ ac_cv_prog_PY2TO3="$PY2TO3" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PY2TO3="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PY2TO3=$ac_cv_prog_PY2TO3
+if test -n "$PY2TO3"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PY2TO3" >&5
+$as_echo "$PY2TO3" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PY2TO3" && break
+done
+
+ if test -z "$PY2TO3"; then
+ # Windows distributions don't always have the 2to3 executable
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 2to3.py" >&5
+$as_echo_n "checking for 2to3.py... " >&6; }
+ py2to3script="$PY3PREFIX/Tools/scripts/2to3.py"
+ if test -f "$py2to3script"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py2to3script" >&5
+$as_echo "$py2to3script" >&6; }
+ PY2TO3="$PYTHON3 $py2to3script"
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5
+$as_echo "Not found" >&6; }
+ fi
+ fi
+ else
+ PY2TO3="$PY2TO3BIN"
+ fi
+ if test -z "$PY2TO3"; then
+ PYTHON3=
+ fi
+fi
+
+#----------------------------------------------------------------
+# Look for Perl5
+#----------------------------------------------------------------
+
+PERLBIN=
+
+
+# Check whether --with-perl5 was given.
+if test "${with_perl5+set}" = set; then :
+ withval=$with_perl5; PERLBIN="$withval"
+else
+ PERLBIN="$alllang_default"
+fi
+
+
+# First, check for "--without-perl5" or "--with-perl5=no".
+if test x"${PERLBIN}" = xno; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Perl5" >&5
+$as_echo "$as_me: Disabling Perl5" >&6;}
+PERL=
+else
+
+# First figure out what the name of Perl5 is
+
+if test "x$PERLBIN" = xyes; then
+for ac_prog in perl perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PERL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PERL"; then
+ ac_cv_prog_PERL="$PERL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PERL="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PERL=$ac_cv_prog_PERL
+if test -n "$PERL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PERL" && break
+done
+
+else
+PERL="$PERLBIN"
+fi
+
+
+# This could probably be simplified as for all platforms and all versions of Perl the following apparently should be run to get the compilation options:
+# perl -MExtUtils::Embed -e ccopts
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 header files" >&5
+$as_echo_n "checking for Perl5 header files... " >&6; }
+if test -n "$PERL"; then
+ PERL5DIR=`($PERL -MConfig -le 'print $Config{archlibexp}') 2>/dev/null`
+ if test -n "$PERL5DIR" ; then
+ dirs="$PERL5DIR $PERL5DIR/CORE"
+ PERL5EXT=none
+ for i in $dirs; do
+ if test -r $i/perl.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i" >&5
+$as_echo "$i" >&6; }
+ PERL5EXT="$i"
+ break
+ fi
+ done
+ if test "$PERL5EXT" = none; then
+ PERL5EXT="$PERL5DIR/CORE"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not locate perl.h...using $PERL5EXT" >&5
+$as_echo "could not locate perl.h...using $PERL5EXT" >&6; }
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 library" >&5
+$as_echo_n "checking for Perl5 library... " >&6; }
+ PERL5LIB=`($PERL -e 'use Config; $_=$Config{libperl}; s/^lib//; s/$Config{_a}$//; s/\.$Config{so}.*//; print $_, "\n"') 2>/dev/null`
+ if test -z "$PERL5LIB" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL5LIB" >&5
+$as_echo "$PERL5LIB" >&6; }
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 ccflags" >&5
+$as_echo_n "checking for Perl5 ccflags... " >&6; }
+ PERL5CCFLAGS=`($PERL -e 'use Config; print $Config{ccflags}, "\n"' | sed "s/-Wdeclaration-after-statement//" | sed "s/-I/$ISYSTEM/") 2>/dev/null`
+ if test -z "$PERL5CCFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL5CCFLAGS" >&5
+$as_echo "$PERL5CCFLAGS" >&6; }
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 ccdlflags" >&5
+$as_echo_n "checking for Perl5 ccdlflags... " >&6; }
+ PERL5CCDLFLAGS=`($PERL -e 'use Config; print $Config{ccdlflags}, "\n"') 2>/dev/null`
+ if test -z "$PERL5CCDLFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL5CCDLFLAGS" >&5
+$as_echo "$PERL5CCDLFLAGS" >&6; }
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 cccdlflags" >&5
+$as_echo_n "checking for Perl5 cccdlflags... " >&6; }
+ PERL5CCCDLFLAGS=`($PERL -e 'use Config; print $Config{cccdlflags}, "\n"') 2>/dev/null`
+ if test -z "$PERL5CCCDLFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL5CCCDLFLAGS" >&5
+$as_echo "$PERL5CCCDLFLAGS" >&6; }
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 ldflags" >&5
+$as_echo_n "checking for Perl5 ldflags... " >&6; }
+ PERL5LDFLAGS=`($PERL -e 'use Config; print $Config{ldflags}, "\n"') 2>/dev/null`
+ if test -z "$PERL5LDFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL5LDFLAGS" >&5
+$as_echo "$PERL5LDFLAGS" >&6; }
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl5 Test::More module" >&5
+$as_echo_n "checking for Perl5 Test::More module... " >&6; } # For test-suite
+ PERL5TESTMORE=`($PERL -e 'use Test::More; print "good";') 2>/dev/null`
+ if test -z "$PERL5TESTMORE" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to determine perl5 configuration" >&5
+$as_echo "unable to determine perl5 configuration" >&6; }
+ PERL5EXT=$PERL5DIR
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not figure out how to run perl5" >&5
+$as_echo "could not figure out how to run perl5" >&6; }
+fi
+
+# Cygwin (Windows) needs the library for dynamic linking
+case $host in
+*-*-cygwin* | *-*-mingw*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5LIB";;
+*)PERL5DYNAMICLINKING="";;
+esac
+fi
+
+
+
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for Octave
+#----------------------------------------------------------------
+
+OCTAVEBIN=
+OCTAVE_SO=.oct
+
+
+# Check whether --with-octave was given.
+if test "${with_octave+set}" = set; then :
+ withval=$with_octave; OCTAVEBIN="$withval"
+else
+ OCTAVEBIN="$alllang_default"
+fi
+
+
+# Check for "--without-octave" or "--with-octave=no".
+if test x"${OCTAVEBIN}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Octave" >&5
+$as_echo "$as_me: Disabling Octave" >&6;}
+ OCTAVE=
+
+# Check for Octave; prefer command-line program "octave-cli" to (in newer versions) GUI program "octave"
+elif test "x$OCTAVEBIN" = xyes; then
+ # Extract the first word of "octave-cli octave", so it can be a program name with args.
+set dummy octave-cli octave; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_OCTAVE+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $OCTAVE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_OCTAVE="$OCTAVE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_OCTAVE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+OCTAVE=$ac_cv_path_OCTAVE
+if test -n "$OCTAVE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE" >&5
+$as_echo "$OCTAVE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+else
+ OCTAVE="$OCTAVEBIN"
+fi
+
+# Check if Octave works
+if test -n "$OCTAVE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ${OCTAVE} works" >&5
+$as_echo_n "checking if ${OCTAVE} works... " >&6; }
+ if test "x`${OCTAVE} --version 2>/dev/null | sed -n -e '1p' | sed -n -e '/Octave, version/p'`" != x; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: no" >&5
+$as_echo "$as_me: no" >&6;}
+ OCTAVE=
+
+fi
+fi
+
+# Check for required Octave helper program "mkoctfile"
+if test -n "$OCTAVE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mkoctfile" >&5
+$as_echo_n "checking for mkoctfile... " >&6; }
+ version_suffix="`echo $OCTAVE | sed -e 's|.*\(-[0-9][0-9.]*\)$|\1|'`"
+ case $version_suffix in
+ -*) ;;
+ *) version_suffix="" ;;
+ esac
+ octave_directory=`dirname $OCTAVE`
+ if test "$octave_directory" = "." ; then
+ mkoctfile="mkoctfile${version_suffix}"
+ else
+ mkoctfile="${octave_directory}/mkoctfile${version_suffix}"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mkoctfile}" >&5
+$as_echo "${mkoctfile}" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ${mkoctfile} works" >&5
+$as_echo_n "checking if ${mkoctfile} works... " >&6; }
+ if test "x`${mkoctfile} --version 2>/dev/null | sed -n -e '1p' | sed -n -e '/mkoctfile, version/p'`" != x; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ OCTAVE=
+
+fi
+fi
+
+# Check for Octave preprocessor/compiler/linker flags
+if test -n "$OCTAVE"; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Octave preprocessor flags" >&5
+$as_echo_n "checking for Octave preprocessor flags... " >&6; }
+ OCTAVE_CPPFLAGS=
+ for var in CPPFLAGS INCFLAGS ALL_CXXFLAGS; do
+ for flag in `env - ${mkoctfile} -p ${var}`; do
+ case ${flag} in
+ -D*|-I*) OCTAVE_CPPFLAGS="${OCTAVE_CPPFLAGS} ${flag}";;
+ *) ;;
+ esac
+ done
+ done
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE_CPPFLAGS" >&5
+$as_echo "$OCTAVE_CPPFLAGS" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Octave compiler flags" >&5
+$as_echo_n "checking for Octave compiler flags... " >&6; }
+ OCTAVE_CXXFLAGS=
+ for var in CXX ALL_CXXFLAGS; do
+ for flag in `env - ${mkoctfile} -p ${var}`; do
+ case ${flag} in
+ -std=*|-g*|-W*) OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} ${flag}";;
+ *) ;;
+ esac
+ done
+ done
+ save_CXXFLAGS="${CXXFLAGS}"
+ CXXFLAGS="-Werror -O0"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} -O0"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CXXFLAGS="${save_CXXFLAGS}"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE_CXXFLAGS" >&5
+$as_echo "$OCTAVE_CXXFLAGS" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Octave linker flags" >&5
+$as_echo_n "checking for Octave linker flags... " >&6; }
+ OCTAVE_LDFLAGS=
+ for var in OCTLIBDIR; do
+ OCTAVE_LDFLAGS="${OCTAVE_LDFLAGS} "-L`env - ${mkoctfile} -p ${var}`
+ done
+ for var in RDYNAMIC_FLAG RLD_FLAG OCTAVE_LIBS LIBS; do
+ OCTAVE_LDFLAGS="${OCTAVE_LDFLAGS} "`env - ${mkoctfile} -p ${var}`
+ done
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE_LDFLAGS" >&5
+$as_echo "$OCTAVE_LDFLAGS" >&6; }
+
+fi
+
+# Check for Octave options
+if test -n "$OCTAVE"; then
+ for octave_opt in --no-window-system --silent --norc --no-history; do
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Octave option '${octave_opt}' is supported" >&5
+$as_echo_n "checking if Octave option '${octave_opt}' is supported... " >&6; }
+ octave_out=`${OCTAVE} ${octave_opt} /dev/null 2>&1 | sed -n '1p' | sed -n '/unrecognized/p'`
+ if test "x${octave_out}" = x; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ OCTAVE="${OCTAVE} ${octave_opt}"
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+ done
+fi
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for Scilab
+#----------------------------------------------------------------
+
+
+# Check whether --with-scilab was given.
+if test "${with_scilab+set}" = set; then :
+ withval=$with_scilab; SCILABBIN="$withval"
+else
+ SCILABBIN="$alllang_default"
+fi
+
+
+# Check whether --with-scilab-inc was given.
+if test "${with_scilab_inc+set}" = set; then :
+ withval=$with_scilab_inc; SCILABINCDIR="$withval"
+else
+ SCILABINCDIR=""
+fi
+
+
+# First, check for "--without-scilab" or "--with-scilab=no".
+if test x"${SCILABBIN}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Scilab" >&5
+$as_echo "$as_me: Disabling Scilab" >&6;}
+ SCILAB=
+else
+ # Check for Scilab executable
+ if test "x$SCILABBIN" = xyes; then
+ for ac_prog in scilab
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_SCILAB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$SCILAB"; then
+ ac_cv_prog_SCILAB="$SCILAB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_SCILAB="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+SCILAB=$ac_cv_prog_SCILAB
+if test -n "$SCILAB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SCILAB" >&5
+$as_echo "$SCILAB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$SCILAB" && break
+done
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for scilab" >&5
+$as_echo_n "checking for scilab... " >&6; }
+ if test -f "$SCILABBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SCILABBIN" >&5
+$as_echo "$SCILABBIN" >&6; }
+ SCILAB="$SCILABBIN"
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ fi
+ fi
+
+ if test -n "$SCILAB"; then
+ # Check for Scilab version (needs api_scilab so needs version 5.3.3 or higher)
+ SCILAB_FULL_VERSION=`$SCILAB -version | head -1 | sed -e 's|Scilab version \"\(.*\)\"|\1|g'`
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Scilab version is 5.3.3 or higher" >&5
+$as_echo_n "checking Scilab version is 5.3.3 or higher... " >&6; }
+ SCILAB_MAJOR_VERSION=`echo $SCILAB_FULL_VERSION | cut -d. -f1`
+ SCILAB_MINOR_VERSION=`echo $SCILAB_FULL_VERSION | cut -d. -f2`
+ SCILAB_MAINTENANCE_VERSION=`echo $SCILAB_FULL_VERSION | cut -d. -f3`
+ SCILAB_VERSION="$SCILAB_MAJOR_VERSION$SCILAB_MINOR_VERSION$SCILAB_MAINTENANCE_VERSION"
+
+ if test $SCILAB_VERSION -ge 533; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SCILAB=
+ fi
+
+ if test -n "$SCILAB"; then
+ # Set Scilab startup options depending on version
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Scilab startup options" >&5
+$as_echo_n "checking for Scilab startup options... " >&6; }
+ SCILABOPT="-nwni -nb"
+ if test $SCILAB_VERSION -ge 540; then
+ SCILABOPT+=" -noatomsautoload"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SCILABOPT" >&5
+$as_echo "$SCILABOPT" >&6; }
+
+ # Check for Scilab header files
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Scilab header files" >&5
+$as_echo_n "checking for Scilab header files... " >&6; }
+ if test "$SCILABINCDIR" != ""; then
+ dirs="$SCILABINCDIR"
+ elif test -n "$PKGCONFIG"; then
+ dirs=`$PKGCONFIG scilab --cflags-only-I | sed -e 's/-I//g'`
+ else
+ dirs=""
+ fi
+ for i in $dirs; do
+ if test -r $i/api_scilab.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i" >&5
+$as_echo "$i" >&6; }
+ SCILABINCLUDE="-I$i"
+ break
+ fi
+ if test -r $i/scilab/api_scilab.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i/scilab" >&5
+$as_echo "$i/scilab" >&6; }
+ SCILABINCLUDE="-I$i/scilab"
+ break
+ fi
+ done
+ if test "$SCILABINCLUDE" = "" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ SCILAB=
+ fi
+ fi
+ fi
+fi
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for java
+#----------------------------------------------------------------
+
+
+# Check whether --with-java was given.
+if test "${with_java+set}" = set; then :
+ withval=$with_java; JAVABIN="$withval"
+else
+ JAVABIN="$alllang_default"
+fi
+
+
+# Check whether --with-javac was given.
+if test "${with_javac+set}" = set; then :
+ withval=$with_javac; JAVACBIN="$withval"
+else
+ JAVACBIN=
+fi
+
+
+# First, check for "--without-java" or "--with-java=no".
+if test x"${JAVABIN}" = xno; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Java" >&5
+$as_echo "$as_me: Disabling Java" >&6;}
+JAVA=
+else
+
+case $host in
+ *-*-cygwin*)
+ if test -n "$JAVA_HOME"; then
+ JAVA_HOME=`cygpath --mixed "$JAVA_HOME"`
+ fi
+ JAVA_CLASSPATH_SEP=";"
+ ;;
+ *-*-mingw*)
+ if test -n "$JAVA_HOME"; then
+ JAVA_HOME=`${srcdir}/Tools/convertpath -u "$JAVA_HOME"`
+ fi
+ JAVA_CLASSPATH_SEP=";"
+ ;;
+ *-*-darwin*)
+ if test -z "$JAVA_HOME" -a -x /usr/libexec/java_home; then
+ JAVA_HOME=`/usr/libexec/java_home`
+ fi
+ JAVA_OSX_STD_INCDIR="/System/Library/Frameworks/JavaVM.framework/Headers"
+ if test -r "$JAVA_OSX_STD_INCDIR/jni.h"; then
+ JAVA_HOME_INCDIR=$JAVA_OSX_STD_INCDIR
+ fi
+ JAVA_CLASSPATH_SEP=":"
+ ;;
+ *)
+ JAVA_CLASSPATH_SEP=":"
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for java JDK" >&5
+$as_echo_n "checking for java JDK... " >&6; }
+if test -n "$JAVA_HOME"; then
+ java_home_ok=1
+ if test -z "$JAVABIN" -a ! -x "$JAVA_HOME/bin/java"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No java executable under JAVA_HOME." >&5
+$as_echo "$as_me: WARNING: No java executable under JAVA_HOME." >&2;}
+ java_home_ok=0
+ fi
+ if test -z "$JAVACBIN" -a ! -x "$JAVA_HOME/bin/javac"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No javac executable under JAVA_HOME." >&5
+$as_echo "$as_me: WARNING: No javac executable under JAVA_HOME." >&2;}
+ java_home_ok=0
+ fi
+
+ if test -z "$JAVA_HOME_INCDIR"; then
+ JAVA_HOME_INCDIR="$JAVA_HOME/include"
+ fi
+ if test -z "$JAVAINCDIR" -a ! -r "$JAVA_HOME_INCDIR/jni.h"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No java headers under JAVA_HOME (does it point to a JDK and not just JRE?)." >&5
+$as_echo "$as_me: WARNING: No java headers under JAVA_HOME (does it point to a JDK and not just JRE?)." >&2;}
+ java_home_ok=0
+ fi
+ if test "$java_home_ok" = 1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found (in $JAVA_HOME)" >&5
+$as_echo "found (in $JAVA_HOME)" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: JAVA_HOME ($JAVA_HOME) is defined but does not point to a complete JDK installation, ignoring it." >&5
+$as_echo "$as_me: WARNING: JAVA_HOME ($JAVA_HOME) is defined but does not point to a complete JDK installation, ignoring it." >&2;}
+ JAVA_HOME=
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (JAVA_HOME is not defined)" >&5
+$as_echo "no (JAVA_HOME is not defined)" >&6; }
+fi
+
+if test "x$JAVABIN" = xyes; then
+ if test -n "$JAVA_HOME"; then
+ JAVA="$JAVA_HOME/bin/java"
+ else
+ for ac_prog in java kaffe guavac
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVA+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$JAVA"; then
+ ac_cv_prog_JAVA="$JAVA" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_JAVA="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVA=$ac_cv_prog_JAVA
+if test -n "$JAVA"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5
+$as_echo "$JAVA" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$JAVA" && break
+done
+
+ fi
+else
+ JAVA="$JAVABIN"
+fi
+
+if test -z "$JAVACBIN"; then
+ if test -n "$JAVA_HOME"; then
+ JAVAC="$JAVA_HOME/bin/javac"
+ else
+ for ac_prog in javac
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVAC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$JAVAC"; then
+ ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_JAVAC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVAC=$ac_cv_prog_JAVAC
+if test -n "$JAVAC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
+$as_echo "$JAVAC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$JAVAC" && break
+done
+
+ fi
+else
+ JAVAC="$JAVACBIN"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for java include file jni.h" >&5
+$as_echo_n "checking for java include file jni.h... " >&6; }
+
+# Check whether --with-javaincl was given.
+if test "${with_javaincl+set}" = set; then :
+ withval=$with_javaincl; JAVAINCDIR="$withval"
+else
+ JAVAINCDIR=
+fi
+
+
+JAVAINC=""
+if test -z "$JAVAINCDIR" ; then
+ if test -n "$JAVA_HOME"; then
+ JAVAINCDIR="$JAVA_HOME_INCDIR"
+ JAVAINC=-I\"$JAVAINCDIR\"
+ else
+ JAVAINCDIR="/usr/j2sdk*/include /usr/local/j2sdk*/include /usr/jdk*/include /usr/local/jdk*/include /opt/j2sdk*/include /opt/jdk*/include /usr/java/include /usr/java/j2sdk*/include /usr/java/jdk*/include /usr/local/java/include /opt/java/include /usr/include/java /usr/local/include/java /usr/lib/java/include /usr/lib/jvm/java*/include /usr/lib64/jvm/java*/include /usr/include/kaffe /usr/local/include/kaffe /usr/include"
+
+ # Add in default installation directory on Windows for Cygwin
+ case $host in
+ *-*-cygwin* | *-*-mingw*) JAVAINCDIR="c:/Program*Files*/Java/jdk*/include d:/Program*Files*/Java/jdk*/include c:/j2sdk*/include d:/j2sdk*/include c:/jdk*/include d:/jdk*/include $JAVAINCDIR";;
+ *-*-darwin*) JAVAINCDIR="$JAVA_OSX_STD_INCDIR $JAVAINCDIR";;
+ *);;
+ esac
+
+ for d in $JAVAINCDIR ; do
+ if test -r "$d/jni.h" ; then
+ JAVAINCDIR=$d
+ JAVAINC=-I\"$d\"
+ JAVA_HOME_MAYBE="`dirname $d`"
+ break
+ fi
+ done
+ fi
+else
+ if test -r "$JAVAINCDIR/jni.h" ; then
+ JAVAINC=-I\"$JAVAINCDIR\"
+ fi
+fi
+
+if test "$JAVAINC" = "" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAINC" >&5
+$as_echo "$JAVAINC" >&6; }
+ # now look for <arch>/jni_md.h
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for java include file jni_md.h" >&5
+$as_echo_n "checking for java include file jni_md.h... " >&6; }
+ JAVAMDDIR=`find "$JAVAINCDIR" -follow -name jni_md.h -print`
+ if test "$JAVAMDDIR" = "" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ else
+ JAVAMDDIR=-I\"`dirname "$JAVAMDDIR" | tail -1`\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAMDDIR" >&5
+$as_echo "$JAVAMDDIR" >&6; }
+ JAVAINC="${JAVAINC} ${JAVAMDDIR}"
+ fi
+fi
+
+# Auto-detecting JAVA_HOME is not so easy, below will only work up to and including jdk8
+if test -z "$JAVA_HOME" && test -n "$JAVA_HOME_MAYBE" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for java jdk from jni include paths" >&5
+$as_echo_n "checking for java jdk from jni include paths... " >&6; }
+ if test -r "$JAVA_HOME_MAYBE/lib/tools.jar" ; then
+ JAVA_HOME=$JAVA_HOME_MAYBE
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA_HOME" >&5
+$as_echo "$JAVA_HOME" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ fi
+fi
+
+# Javadoc support required for the Java test-suite is available by default in jdk9+ and in tools.jar in earlier jdk versions
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for java tools.jar" >&5
+$as_echo_n "checking for java tools.jar... " >&6; }
+if test -n "$JAVA_HOME" && test -r "$JAVA_HOME/lib/tools.jar" ; then
+ JAVA_TOOLS_JAR="$JAVA_HOME/lib/tools.jar"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA_TOOLS_JAR" >&5
+$as_echo "$JAVA_TOOLS_JAR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+fi
+
+case $host in
+*-*-cygwin*)
+ # TODO: Only use this flag if the compiler supports it, later versions of gcc no longer have it
+ GCC_MNO_CYGWIN=" -mno-cygwin"
+ ;;
+*)
+ GCC_MNO_CYGWIN=""
+ ;;
+esac
+
+# java.exe on Cygwin requires the Windows standard (Pascal) calling convention as it is a normal Windows executable and not a Cygwin built executable
+case $host in
+*-*-cygwin* | *-*-mingw*)
+ if test "$GCC" = yes; then
+ JAVADYNAMICLINKING="$GCC_MNO_CYGWIN -mthreads -Wl,--add-stdcall-alias"
+ JAVACFLAGS="$GCC_MNO_CYGWIN -mthreads"
+ else
+ JAVADYNAMICLINKING=""
+ JAVACFLAGS=""
+ fi ;;
+*-*-darwin*)
+ JAVADYNAMICLINKING="-dynamiclib -framework JavaVM"
+ JAVACFLAGS=""
+ ;;
+*)
+ JAVADYNAMICLINKING=""
+ JAVACFLAGS=""
+ ;;
+esac
+
+# Java on Windows platforms including Cygwin doesn't use libname.dll, rather name.dll when loading dlls
+case $host in
+*-*-cygwin* | *-*-mingw*) JAVALIBRARYPREFIX="";;
+*)JAVALIBRARYPREFIX="lib";;
+esac
+
+# Java on Mac OS X tweaks
+case $host in
+*-*-darwin*)
+ JAVASO=".jnilib"
+ JAVALDSHARED='$(CC)'
+ JAVACXXSHARED='$(CXX)'
+ ;;
+*)
+ JAVASO=$SO
+ JAVALDSHARED='$(LDSHARED)'
+ JAVACXXSHARED='$(CXXSHARED)'
+ ;;
+esac
+fi
+
+# Quote for spaces in path to executables
+if test -n "$JAVA"; then
+ JAVA=\"$JAVA\"
+fi
+if test -n "$JAVAC"; then
+ JAVAC=\"$JAVAC\"
+fi
+
+# Turned off due to spurious warnings in later versions of openjdk-1.8
+# JAVAFLAGS=-Xcheck:jni
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for Javascript
+#----------------------------------------------------------------
+
+# Check whether --with-javascript was given.
+if test "${with_javascript+set}" = set; then :
+ withval=$with_javascript; with_javascript="$withval"
+else
+ with_javascript="$alllang_default"
+fi
+
+
+# First, check for "--without-javascript" or "--with-javascript=no".
+if test x"${with_javascript}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Javascript" >&5
+$as_echo "$as_me: Disabling Javascript" >&6;}
+ JAVASCRIPT=
+else
+ JAVASCRIPT=1
+
+ #----------------------------------------------------------------
+ # General Javascript settings shared by JSC and V8
+ #----------------------------------------------------------------
+
+ case $host in
+ *-*-darwin*)
+ JSSO=".dylib"
+ # HACK: didn't manage to get dynamic module loading working with a g++ compiled interpreter
+ JSINTERPRETERCXX='c++'
+ JSINTERPRETERLINKFLAGS='-g -Wl,-search_paths_first -Wl,-headerpad_max_install_names'
+ ;;
+ *)
+ JSSO=$SO
+ JSINTERPRETERCXX='$(CXX)'
+ JSINTERPRETERLINKFLAGS='-ldl'
+ ;;
+ esac
+
+ #----------------------------------------------------------------
+ # Look for Node.js which is the default Javascript engine
+ #----------------------------------------------------------------
+
+ for ac_prog in nodejs node
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NODEJS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NODEJS"; then
+ ac_cv_prog_NODEJS="$NODEJS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_NODEJS="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NODEJS=$ac_cv_prog_NODEJS
+if test -n "$NODEJS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NODEJS" >&5
+$as_echo "$NODEJS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$NODEJS" && break
+done
+
+
+ if test -n "$NODEJS"; then
+ # node-gyp is needed to run the test-suite/examples
+ for ac_prog in node-gyp
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NODEGYP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NODEGYP"; then
+ ac_cv_prog_NODEGYP="$NODEGYP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_NODEGYP="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NODEGYP=$ac_cv_prog_NODEGYP
+if test -n "$NODEGYP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NODEGYP" >&5
+$as_echo "$NODEGYP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$NODEGYP" && break
+done
+
+ if test -z "$NODEGYP"; then
+ NODEJS=
+ fi
+ fi
+
+ #----------------------------------------------------------------
+ # Look for JavascriptCore (Webkit) settings (JSCOREINCDIR, JSCOREDYNAMICLINKING)
+ #----------------------------------------------------------------
+
+ # check for include files
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JavaScriptCore/JavaScript.h" >&5
+$as_echo_n "checking for JavaScriptCore/JavaScript.h... " >&6; }
+
+# Check whether --with-jscoreinc was given.
+if test "${with_jscoreinc+set}" = set; then :
+ withval=$with_jscoreinc; JSCOREINCDIR="$withval"
+else
+ JSCOREINCDIR=
+fi
+
+
+ JSCOREVERSION=
+
+ if test -z "$JSCOREINCDIR"; then
+ JSCOREINCDIR="/usr/include/ /usr/local/include/"
+
+ # Add in default directory for JavaScriptCore headers for Linux and Mac OS X
+ case $host in
+ *-*-linux*)
+ JSCOREINCDIR="/usr/include/webkit-1.0/ /usr/include/webkitgtk-1.0/ /usr/local/include/webkit-1.0/JavaScriptCore/ $JSCOREINCDIR"
+ ;;
+ *-*-darwin*)
+ JSCOREINCDIR="/System/Library/Frameworks/JavaScriptCore.framework/Headers/ $JSCOREINCDIR"
+ ;;
+ *)
+ ;;
+ esac
+ fi
+
+ for d in $JSCOREINCDIR ; do
+ if test -r "$d/JavaScriptCore/JavaScript.h" || test -r "$d/JavaScript.h" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+ JSCOREINCDIR=$d
+ JSCOREINC=-I\"$d\"
+ break
+ fi
+ done
+
+ if test "$JSCOREINC" = "" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ fi
+
+ # check for JavaScriptCore/Webkit libraries
+
+# Check whether --with-jscorelib was given.
+if test "${with_jscorelib+set}" = set; then :
+ withval=$with_jscorelib; JSCORELIB="-L$withval"
+else
+ JSCORELIB=
+fi
+
+
+ if test -z "$JSCORELIB" -a -n "$PKGCONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JavaScriptCore/Webkit library" >&5
+$as_echo_n "checking for JavaScriptCore/Webkit library... " >&6; }
+ if pkg-config javascriptcoregtk-1.0; then
+ JSCORELIB=`$PKGCONFIG --libs javascriptcoregtk-1.0`
+ JSCOREVERSION=`$PKGCONFIG --modversion javascriptcoregtk-1.0`
+ fi
+ if test -z "$JSCORELIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ JSCENABLED=
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JSCORELIB" >&5
+$as_echo "$JSCORELIB" >&6; }
+ JSCOREDYNAMICLINKING="$JSCORELIB"
+ JSCENABLED=1
+ fi
+ fi
+
+ #----------------------------------------------------------------
+ # Look for V8 settings (JSV8INCDIR, JSV8DYNAMICLINKING)
+ #----------------------------------------------------------------
+
+ # check for include files
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for V8 Javascript v8.h" >&5
+$as_echo_n "checking for V8 Javascript v8.h... " >&6; }
+
+# Check whether --with-jsv8inc was given.
+if test "${with_jsv8inc+set}" = set; then :
+ withval=$with_jsv8inc; JSV8INCDIR="$withval"
+else
+ JSV8INCDIR=
+fi
+
+
+ # if not include dir is specified we try to find
+ if test -z "$JSV8INCDIR"; then
+ # Add in default directory for JavaScriptCore headers for Linux and Mac OS X
+ case $host in
+ *-*-linux*)
+ JSV8INCDIR="/usr/include /usr/local/include/ $JSV8INCDIR"
+ ;;
+ *-*-darwin*)
+ JSV8INCDIR="$JSV8INCDIR"
+ ;;
+ *)
+ ;;
+ esac
+ fi
+
+ for d in $JSV8INCDIR ; do
+ if test -r "$d/v8.h" ; then
+ JSV8INCDIR=$d
+ JSV8INC=-I\"$d\"
+ break
+ fi
+ done
+
+ if test "$JSV8INC" = "" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JSV8INCDIR" >&5
+$as_echo "$JSV8INCDIR" >&6; }
+ fi
+
+ # check for V8 library
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for V8 Javascript library" >&5
+$as_echo_n "checking for V8 Javascript library... " >&6; }
+
+# Check whether --with-jsv8lib was given.
+if test "${with_jsv8lib+set}" = set; then :
+ withval=$with_jsv8lib; JSV8LIBDIR="$withval"
+else
+ JSV8LIB=
+fi
+
+
+ v8libdirs="$JSV8LIBDIR /usr/lib64/ /usr/local/lib64/ /usr/lib/ /usr/local/lib/"
+ for d in $v8libdirs ; do
+ if test -r $d/libv8$JSSO; then
+ JSV8LIBDIR=$d
+ JSV8LIB="-L$d -lv8"
+ break
+ fi
+ done
+
+ if test "$JSV8LIB" = "" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ JSV8ENABLED=
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JSV8LIBDIR" >&5
+$as_echo "$JSV8LIBDIR" >&6; }
+ JSV8ENABLED=1
+ fi
+
+
+ # linking options
+ case $host in
+ *-*-darwin*)
+ JSV8DYNAMICLINKING="$JSV8LIB"
+ ;;
+ *-*-linux*)
+ JSV8DYNAMICLINKING="$JSV8LIB"
+ ;;
+ *)
+ JSV8DYNAMICLINKING=""
+ ;;
+ esac
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for Android
+#----------------------------------------------------------------
+
+
+# Check whether --with-android was given.
+if test "${with_android+set}" = set; then :
+ withval=$with_android; ANDROIDBIN="$withval"
+else
+ ANDROIDBIN="$alllang_default"
+fi
+
+
+# Check whether --with-adb was given.
+if test "${with_adb+set}" = set; then :
+ withval=$with_adb; ADBBIN="$withval"
+else
+ ADBBIN=
+fi
+
+
+# Check whether --with-ant was given.
+if test "${with_ant+set}" = set; then :
+ withval=$with_ant; ANTBIN="$withval"
+else
+ ANTBIN=
+fi
+
+
+# Check whether --with-ndk-build was given.
+if test "${with_ndk_build+set}" = set; then :
+ withval=$with_ndk_build; NDKBUILDBIN="$withval"
+else
+ NDKBUILDBIN=
+fi
+
+
+# First, check for "--without-android" or "--with-android=no".
+if test x"${ANDROIDBIN}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Android" >&5
+$as_echo "$as_me: Disabling Android" >&6;}
+ ANDROID=
+else
+ if test "x$ANDROIDBIN" = xyes; then
+ for ac_prog in android
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ANDROID+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ANDROID"; then
+ ac_cv_prog_ANDROID="$ANDROID" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ANDROID="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ANDROID=$ac_cv_prog_ANDROID
+if test -n "$ANDROID"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANDROID" >&5
+$as_echo "$ANDROID" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ANDROID" && break
+done
+
+ else
+ ANDROID="$ANDROIDBIN"
+ fi
+
+ if test -z "$ADBBIN"; then
+ for ac_prog in adb
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ADB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ADB"; then
+ ac_cv_prog_ADB="$ADB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ADB="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ADB=$ac_cv_prog_ADB
+if test -n "$ADB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ADB" >&5
+$as_echo "$ADB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ADB" && break
+done
+
+ else
+ ADB="$ADBBIN"
+ fi
+
+ if test -z "$ANTBIN"; then
+ for ac_prog in ant
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ANT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ANT"; then
+ ac_cv_prog_ANT="$ANT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ANT="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ANT=$ac_cv_prog_ANT
+if test -n "$ANT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANT" >&5
+$as_echo "$ANT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ANT" && break
+done
+
+ else
+ ANT="$ANTBIN"
+ fi
+
+ if test -z "$NDKBUILDBIN"; then
+ for ac_prog in ndk-build
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NDKBUILD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NDKBUILD"; then
+ ac_cv_prog_NDKBUILD="$NDKBUILD" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_NDKBUILD="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NDKBUILD=$ac_cv_prog_NDKBUILD
+if test -n "$NDKBUILD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NDKBUILD" >&5
+$as_echo "$NDKBUILD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$NDKBUILD" && break
+done
+
+ else
+ NDKBUILD="$NDKBUILDBIN"
+ fi
+fi
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for Guile
+#----------------------------------------------------------------
+
+GUILE=
+GUILE_CFLAGS=
+GUILE_LIBS=
+
+
+# Check whether --with-guile-config was given.
+if test "${with_guile_config+set}" = set; then :
+ withval=$with_guile_config; GUILE_CONFIG="$withval"
+else
+ GUILE_CONFIG=
+fi
+
+
+# Check whether --with-guile was given.
+if test "${with_guile+set}" = set; then :
+ withval=$with_guile;
+ GUILE="$withval"
+else
+ GUILE="$alllang_default"
+fi
+
+
+# Check whether --with-guile-cflags was given.
+if test "${with_guile_cflags+set}" = set; then :
+ withval=$with_guile_cflags;
+ GUILE_CFLAGS="$withval"
+fi
+
+
+# Check whether --with-guile-libs was given.
+if test "${with_guile_libs+set}" = set; then :
+ withval=$with_guile_libs;
+ GUILE_LIBS="$withval"
+fi
+
+
+# First, check for "--without-guile" or "--with-guile=no".
+if test x"${GUILE}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Guile" >&5
+$as_echo "$as_me: Disabling Guile" >&6;}
+else
+ if test -z "$GUILE_CONFIG" ; then
+ # Extract the first word of "guile-config", so it can be a program name with args.
+set dummy guile-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GUILE_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $GUILE_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GUILE_CONFIG="$GUILE_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_GUILE_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+GUILE_CONFIG=$ac_cv_path_GUILE_CONFIG
+if test -n "$GUILE_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUILE_CONFIG" >&5
+$as_echo "$GUILE_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+ if test -n "$GUILE_CONFIG" ; then
+ if test x"$GUILE" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for guile executable" >&5
+$as_echo_n "checking for guile executable... " >&6; }
+ # Try extracting it via guile-config first. If it's defined there it's the most reliable result
+ GUILE="`$GUILE_CONFIG info guile 2>/dev/null`"
+ if test -n "$GUILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUILE" >&5
+$as_echo "$GUILE" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found via guile-config - constructing path" >&5
+$as_echo "not found via guile-config - constructing path" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for guile bindir" >&5
+$as_echo_n "checking for guile bindir... " >&6; }
+ guile_bindir="`$GUILE_CONFIG info bindir`"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $guile_bindir" >&5
+$as_echo "$guile_bindir" >&6; }
+ GUILE="$guile_bindir/guile"
+ fi
+ if ! test -f "$GUILE" ; then
+ GUILE=
+ # Extract the first word of "guile", so it can be a program name with args.
+set dummy guile; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GUILE+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $GUILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GUILE="$GUILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_GUILE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+GUILE=$ac_cv_path_GUILE
+if test -n "$GUILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUILE" >&5
+$as_echo "$GUILE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+ if test -z "$GUILE" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no suitable guile executable found. Disabling Guile" >&5
+$as_echo "$as_me: WARNING: no suitable guile executable found. Disabling Guile" >&2;}
+ fi
+ fi
+
+ if test -n "$GUILE" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for guile version" >&5
+$as_echo_n "checking for guile version... " >&6; }
+ guile_version=`$GUILE -c '(display (effective-version))'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $guile_version" >&5
+$as_echo "$guile_version" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for guile version >= 1.8" >&5
+$as_echo_n "checking for guile version >= 1.8... " >&6; }
+ guile_good_version=`$GUILE -c '(if (>= (string->number (effective-version)) 1.8) (display "yes") (display "no"))'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $guile_good_version" >&5
+$as_echo "$guile_good_version" >&6; }
+ if test x"$guile_good_version" != xyes ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: at least guile version 1.8 is required. Disabling Guile" >&5
+$as_echo "$as_me: WARNING: at least guile version 1.8 is required. Disabling Guile" >&2;}
+ GUILE=
+ fi
+ fi
+
+ if test -n "$GUILE" ; then
+ # Test if guile-config and guile versions match. They should.
+ gc_version="`$GUILE_CONFIG --version 2>&1 | sed '1 s/.* //;q'`"
+ g_version="`$GUILE --version | sed '1 s/.* //;q'`"
+ if test "$gc_version" != "$g_version"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: different versions reported by $GUILE_CONFIG ($gc_version) and $GUILE ($g_version). Disabling Guile" >&5
+$as_echo "$as_me: WARNING: different versions reported by $GUILE_CONFIG ($gc_version) and $GUILE ($g_version). Disabling Guile" >&2;}
+ GUILE=
+ fi
+ fi
+
+ if test -n "$GUILE" ; then
+ if test -z "$GUILE_CFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for guile compile flags" >&5
+$as_echo_n "checking for guile compile flags... " >&6; }
+ GUILE_CFLAGS="`$GUILE_CONFIG compile`" # Note that this can sometimes be empty
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUILE_CFLAGS" >&5
+$as_echo "$GUILE_CFLAGS" >&6; }
+ fi
+
+ if test -z "$GUILE_LIBS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for guile link flags" >&5
+$as_echo_n "checking for guile link flags... " >&6; }
+ GUILE_LIBS="`$GUILE_CONFIG link`"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUILE_LIBS" >&5
+$as_echo "$GUILE_LIBS" >&6; }
+ fi
+ fi
+ fi
+fi
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for MzScheme
+#----------------------------------------------------------------
+
+
+# Check whether --with-mzscheme was given.
+if test "${with_mzscheme+set}" = set; then :
+ withval=$with_mzscheme; MZSCHEMEBIN="$withval"
+else
+ MZSCHEMEBIN="$alllang_default"
+fi
+
+
+# Check whether --with-mzc was given.
+if test "${with_mzc+set}" = set; then :
+ withval=$with_mzc; MZCBIN="$withval"
+else
+ MZCBIN=
+fi
+
+
+# First, check for "--without-mzscheme" or "--with-mzscheme=no".
+if test x"${MZSCHEMEBIN}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling MzScheme" >&5
+$as_echo "$as_me: Disabling MzScheme" >&6;}
+ MZC=
+else
+ if test "x$MZSCHEMEBIN" = xyes; then
+ # Extract the first word of "mzscheme", so it can be a program name with args.
+set dummy mzscheme; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MZSCHEME+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MZSCHEME in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MZSCHEME="$MZSCHEME" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_MZSCHEME="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+MZSCHEME=$ac_cv_path_MZSCHEME
+if test -n "$MZSCHEME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MZSCHEME" >&5
+$as_echo "$MZSCHEME" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MZSCHEME="$MZSCHEMEBIN"
+ fi
+
+ if test -z "$MZCBIN"; then
+ # Extract the first word of "mzc", so it can be a program name with args.
+set dummy mzc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MZC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MZC in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MZC="$MZC" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_MZC="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+MZC=$ac_cv_path_MZC
+if test -n "$MZC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MZC" >&5
+$as_echo "$MZC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+
+ if test -n "$MZSCHEME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MzScheme dynext object" >&5
+$as_echo_n "checking for MzScheme dynext object... " >&6; }
+ MZDYNOBJ=`$MZSCHEME --eval '(begin (require dynext/link) (with-handlers (((lambda args #t) (lambda args #f))) (for-each (lambda (x) (printf "~a" x)) (expand-for-link-variant (current-standard-link-libraries)))))' 2>/dev/null`
+ if test -f "$MZDYNOBJ"; then
+ :
+ else
+ # older versions (3.72 approx and earlier)
+ MZDYNOBJ=`$MZSCHEME --mute-banner --version --eval '(begin (require (lib "link.ss" "dynext")) (with-handlers (((lambda args #t) (lambda args #f))) (for-each (lambda (x) (display x) (display " ")) ((current-make-standard-link-libraries)))) (with-handlers (((lambda args #t) (lambda args #f))) (for-each (lambda (x) (display x)) (expand-for-link-variant (current-standard-link-libraries)))))' 2>/dev/null`
+ fi
+ if test -f "$MZDYNOBJ"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MZDYNOBJ" >&5
+$as_echo "$MZDYNOBJ" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ MZDYNOBJ=""
+ fi
+ fi
+fi
+
+
+#----------------------------------------------------------------
+# Look for Ruby
+#----------------------------------------------------------------
+
+RUBYBIN=
+
+
+# Check whether --with-ruby was given.
+if test "${with_ruby+set}" = set; then :
+ withval=$with_ruby; RUBYBIN="$withval"
+else
+ RUBYBIN="$alllang_default"
+fi
+
+
+# First, check for "--without-ruby" or "--with-ruby=no".
+RUBYSO=$SO
+if test x"${RUBYBIN}" = xno; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Ruby" >&5
+$as_echo "$as_me: Disabling Ruby" >&6;}
+RUBY=
+else
+
+# First figure out what the name of Ruby is
+
+if test "x$RUBYBIN" = xyes; then
+ for ac_prog in ruby
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RUBY+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RUBY"; then
+ ac_cv_prog_RUBY="$RUBY" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RUBY="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RUBY=$ac_cv_prog_RUBY
+if test -n "$RUBY"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY" >&5
+$as_echo "$RUBY" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$RUBY" && break
+done
+
+else
+ RUBY="$RUBYBIN"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby header files" >&5
+$as_echo_n "checking for Ruby header files... " >&6; }
+if test -n "$RUBY"; then
+ # Try Ruby1.9+ first
+ RUBYDIR=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubyhdrdir"] || $rubyhdrdir') 2>/dev/null`
+ RUBYARCHHDRDIR=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubyarchhdrdir"] || $rubyarchhdrdir') 2>/dev/null`
+ if test x"$RUBYDIR" = x"" || test x"$RUBYDIR" = x"nil"; then
+ RUBYDIR=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["archdir"] || $archdir') 2>/dev/null`
+ else
+ RUBYARCH=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["arch"] || $arch') 2>/dev/null`
+ fi
+ if test x"$RUBYDIR" != x""; then
+ dirs="$RUBYDIR"
+ RUBYINCLUDE=
+ for i in $dirs; do
+ if test -r $i/ruby.h; then
+ if test x"$RUBYARCH" = x""; then
+ RUBYINCLUDE="-I$i"
+ elif test -n "$RUBYARCHHDRDIR"; then
+ RUBYINCLUDE="-I$i -I$RUBYARCHHDRDIR"
+ else
+ RUBYINCLUDE="-I$i -I$i/$RUBYARCH"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBYINCLUDE" >&5
+$as_echo "$RUBYINCLUDE" >&6; }
+ break
+ fi
+ done
+ if test x"$RUBYINCLUDE" = x""; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not locate ruby.h" >&5
+$as_echo "could not locate ruby.h" >&6; }
+ fi
+
+ # Find library and path for linking.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby library" >&5
+$as_echo_n "checking for Ruby library... " >&6; }
+ RUBYLIB=""
+ rb_archlibdir=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["archlibdir"]') 2>/dev/null`
+ rb_libdir=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["libdir"]') 2>/dev/null`
+ rb_bindir=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["bindir"]') 2>/dev/null`
+ dirs="$dirs $rb_archlibdir $rb_libdir $rb_bindir"
+
+ rb_libruby=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["LIBRUBY_A"]') 2>/dev/null`
+ RUBYLINK=`($RUBY -rrbconfig -e '
+ c = RbConfig::CONFIG
+ if c.has_key? "LIBRUBYARG_STATIC" # 1.8.x
+ if c["LIBRUBY"] == c["LIBRUBY_A"]
+ link = c["LIBRUBYARG_STATIC"]
+ else
+ link = c["LIBRUBYARG_SHARED"]
+ end
+ else # 1.6.x
+ link = "-l" + c["RUBY_INSTALL_NAME"]
+ end
+
+ # Get the target Ruby was built for
+ target = c["target"]
+
+ if target == "i386-pc-mswin32"
+ # Need to change msvcrt-ruby*.lib to -lmsvcrt-ruby*
+ ext = File.extname(link)
+ # Get index that counts backwards from end of string
+ index = -1 - ext.size
+ # Strip off the extension
+ link = link.slice(0..index)
+ puts "-l#{link}"
+ else
+ puts link
+ end') 2>/dev/null`
+
+ if test "$rb_libruby" != ""; then
+ for i in $dirs; do
+ if (test -r $i/$rb_libruby;) then
+ RUBYLIB="$i"
+ break
+ fi
+ done
+ fi
+ if test "$RUBYLIB" = ""; then
+ RUBYLIB="$RUBYDIR"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found... using $RUBYDIR" >&5
+$as_echo "not found... using $RUBYDIR" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBYLINK in $RUBYLIB" >&5
+$as_echo "$RUBYLINK in $RUBYLIB" >&6; }
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to determine ruby configuration" >&5
+$as_echo "unable to determine ruby configuration" >&6; }
+ fi
+
+ case $host in
+ *-*-mingw*) ;; # do nothing, the default windows libraries are already included
+ *) RUBYLINK="$RUBYLINK `($RUBY -rrbconfig -e 'print RbConfig::CONFIG["LIBS"]') 2>/dev/null`";;
+ esac
+
+ RUBYCCDLFLAGS=`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["CCDLFLAGS"]') 2>/dev/null`
+ RUBYSO=.`($RUBY -rrbconfig -e 'print RbConfig::CONFIG["DLEXT"]') 2>/dev/null`
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not figure out how to run ruby" >&5
+$as_echo "could not figure out how to run ruby" >&6; }
+fi
+
+case $host in
+*-*-cygwin* | *-*-mingw*) RUBYDYNAMICLINKING="-L$RUBYLIB $RUBYLINK";;
+*) RUBYDYNAMICLINKING="";;
+esac
+fi
+
+
+
+
+
+
+
+
+#-------------------------------------------------------------------------
+# Look for PHP7
+#-------------------------------------------------------------------------
+
+PHPBIN=
+
+
+# Check whether --with-php was given.
+if test "${with_php+set}" = set; then :
+ withval=$with_php; PHPBIN="$withval"
+else
+ PHPBIN="$alllang_default"
+fi
+
+
+# First, check for "--without-php" or "--with-php=no".
+if test x"${PHPBIN}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling PHP" >&5
+$as_echo "$as_me: Disabling PHP" >&6;}
+ PHP=
+else
+ if test "x$PHPBIN" = xyes; then
+ for ac_prog in php7.3 php7.2 php7.1 php7.0 php
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PHP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PHP"; then
+ ac_cv_prog_PHP="$PHP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PHP="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PHP=$ac_cv_prog_PHP
+if test -n "$PHP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PHP" >&5
+$as_echo "$PHP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PHP" && break
+done
+
+ else
+ PHP=$PHPBIN
+ fi
+
+ if test -n "$PHP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PHP header files" >&5
+$as_echo_n "checking for PHP header files... " >&6; }
+ case $PHP in
+ *7.*)
+ PHPCONFIG=`echo "$PHP"|sed 's/7\...*$/-config&/'` ;;
+ *)
+ PHPCONFIG=$PHP-config ;;
+ esac
+ php_version=`$PHPCONFIG --version 2>/dev/null`
+ case $php_version in
+ 7.*)
+ PHPINC=`$PHPCONFIG --includes 2>/dev/null`
+ if test -n "$PHPINC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PHPINC" >&5
+$as_echo "$PHPINC" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ fi
+ ;;
+ "")
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not find $PHPCONFIG or obtain PHP version from it" >&5
+$as_echo "could not find $PHPCONFIG or obtain PHP version from it" >&6; } ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found PHP $php_version - not PHP 7" >&5
+$as_echo "found PHP $php_version - not PHP 7" >&6; } ;;
+ esac
+ fi
+fi
+
+
+
+#----------------------------------------------------------------
+# Look for OCaml
+#----------------------------------------------------------------
+
+
+# Check whether --with-ocaml was given.
+if test "${with_ocaml+set}" = set; then :
+ withval=$with_ocaml; with_ocaml="$withval"
+else
+ with_ocaml="$alllang_default"
+fi
+
+
+# Check whether --with-ocamlc was given.
+if test "${with_ocamlc+set}" = set; then :
+ withval=$with_ocamlc; OCAMLC="$withval"
+else
+ OCAMLC=
+fi
+
+
+# Check whether --with-ocamldlgen was given.
+if test "${with_ocamldlgen+set}" = set; then :
+ withval=$with_ocamldlgen; OCAMLDLGEN="$withval"
+else
+ OCAMLDLGEN=
+fi
+
+
+# Check whether --with-ocamlfind was given.
+if test "${with_ocamlfind+set}" = set; then :
+ withval=$with_ocamlfind; OCAMLFIND="$withval"
+else
+ OCAMLFIND=
+fi
+
+
+# Check whether --with-ocamlmktop was given.
+if test "${with_ocamlmktop+set}" = set; then :
+ withval=$with_ocamlmktop; OCAMLMKTOP="$withval"
+else
+ OCAMLMKTOP=
+fi
+
+
+# Check whether --with-camlp4 was given.
+if test "${with_camlp4+set}" = set; then :
+ withval=$with_camlp4; CAMLP4="$withval"
+else
+ CAMLP4=
+fi
+
+
+# First, check for "--without-ocaml" or "--with-ocaml=no".
+if test x"${with_ocaml}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling OCaml" >&5
+$as_echo "$as_me: Disabling OCaml" >&6;}
+ OCAMLC=
+else
+ # OCaml compiler
+ if test -z "$OCAMLC"; then
+ for ac_prog in ocamlc
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OCAMLC"; then
+ ac_cv_prog_OCAMLC="$OCAMLC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OCAMLC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLC=$ac_cv_prog_OCAMLC
+if test -n "$OCAMLC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLC" >&5
+$as_echo "$OCAMLC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$OCAMLC" && break
+done
+
+ fi
+
+ # OCaml Pre-Processor-Pretty-Printer
+ if test -z "$CAMLP4"; then
+ for ac_prog in camlp4
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CAMLP4+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CAMLP4"; then
+ ac_cv_prog_CAMLP4="$CAMLP4" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CAMLP4="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CAMLP4=$ac_cv_prog_CAMLP4
+if test -n "$CAMLP4"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAMLP4" >&5
+$as_echo "$CAMLP4" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CAMLP4" && break
+done
+
+ fi
+
+ # OCaml DL load generator
+ if test -z "$OCAMLDLGEN"; then
+ for ac_prog in ocamldlgen
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLDLGEN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OCAMLDLGEN"; then
+ ac_cv_prog_OCAMLDLGEN="$OCAMLDLGEN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OCAMLDLGEN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLDLGEN=$ac_cv_prog_OCAMLDLGEN
+if test -n "$OCAMLDLGEN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDLGEN" >&5
+$as_echo "$OCAMLDLGEN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$OCAMLDLGEN" && break
+done
+
+ fi
+
+ # OCaml package tool
+ if test -z "$OCAMLFIND"; then
+ for ac_prog in ocamlfind
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLFIND+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OCAMLFIND"; then
+ ac_cv_prog_OCAMLFIND="$OCAMLFIND" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OCAMLFIND="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLFIND=$ac_cv_prog_OCAMLFIND
+if test -n "$OCAMLFIND"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLFIND" >&5
+$as_echo "$OCAMLFIND" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$OCAMLFIND" && break
+done
+
+ fi
+
+ # OCaml toplevel creator
+ if test -z "$OCAMLMKTOP"; then
+ for ac_prog in ocamlmktop
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCAMLMKTOP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OCAMLMKTOP"; then
+ ac_cv_prog_OCAMLMKTOP="$OCAMLMKTOP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OCAMLMKTOP="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLMKTOP=$ac_cv_prog_OCAMLMKTOP
+if test -n "$OCAMLMKTOP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKTOP" >&5
+$as_echo "$OCAMLMKTOP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$OCAMLMKTOP" && break
+done
+
+ fi
+fi
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for C#
+#----------------------------------------------------------------
+
+
+# Check whether --with-csharp was given.
+if test "${with_csharp+set}" = set; then :
+ withval=$with_csharp; with_csharp="$withval"
+else
+ with_csharp="$alllang_default"
+fi
+
+
+# Check whether --with-cil-interpreter was given.
+if test "${with_cil_interpreter+set}" = set; then :
+ withval=$with_cil_interpreter; CSHARPBIN="$withval"
+else
+ CSHARPBIN=
+fi
+
+
+# Check whether --with-csharp-compiler was given.
+if test "${with_csharp_compiler+set}" = set; then :
+ withval=$with_csharp_compiler; CSHARPCOMPILERBIN="$withval"
+else
+ CSHARPCOMPILERBIN=
+fi
+
+
+# First, check for "--without-csharp" or "--with-csharp=no".
+if test x"${with_csharp}" = xno; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling CSharp" >&5
+$as_echo "$as_me: Disabling CSharp" >&6;}
+CSHARPCOMPILER=
+else
+
+if test -z "$CSHARPCOMPILERBIN" ; then
+ case $host in
+ *-*-cygwin* | *-*-mingw*)
+ # prefer unified Mono mcs compiler (not to be confused with the ancient .NET 1 mcs) over older/alternative names.
+ for ac_prog in csc mcs mono-csc gmcs cscc
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CSHARPCOMPILER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CSHARPCOMPILER"; then
+ ac_cv_prog_CSHARPCOMPILER="$CSHARPCOMPILER" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CSHARPCOMPILER="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CSHARPCOMPILER=$ac_cv_prog_CSHARPCOMPILER
+if test -n "$CSHARPCOMPILER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CSHARPCOMPILER" >&5
+$as_echo "$CSHARPCOMPILER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CSHARPCOMPILER" && break
+done
+
+ if test -n "$CSHARPCOMPILER" && test "$CSHARPCOMPILER" = "csc" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether csc is the Microsoft CSharp compiler" >&5
+$as_echo_n "checking whether csc is the Microsoft CSharp compiler... " >&6; }
+ csc 2>/dev/null | grep "C#" > /dev/null || CSHARPCOMPILER=""
+ if test -z "$CSHARPCOMPILER" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ for ac_prog in mcs mono-csc gmcs cscc
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CSHARPCOMPILER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CSHARPCOMPILER"; then
+ ac_cv_prog_CSHARPCOMPILER="$CSHARPCOMPILER" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CSHARPCOMPILER="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CSHARPCOMPILER=$ac_cv_prog_CSHARPCOMPILER
+if test -n "$CSHARPCOMPILER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CSHARPCOMPILER" >&5
+$as_echo "$CSHARPCOMPILER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CSHARPCOMPILER" && break
+done
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ fi
+ fi
+ ;;
+ *)for ac_prog in mono-csc gmcs mcs cscc
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CSHARPCOMPILER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CSHARPCOMPILER"; then
+ ac_cv_prog_CSHARPCOMPILER="$CSHARPCOMPILER" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CSHARPCOMPILER="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CSHARPCOMPILER=$ac_cv_prog_CSHARPCOMPILER
+if test -n "$CSHARPCOMPILER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CSHARPCOMPILER" >&5
+$as_echo "$CSHARPCOMPILER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CSHARPCOMPILER" && break
+done
+;;
+ esac
+else
+ CSHARPCOMPILER="$CSHARPCOMPILERBIN"
+fi
+
+CSHARPCONVERTPATH="Tools/convertpath -u"
+if test -z "$CSHARPBIN" ; then
+ CSHARPCILINTERPRETER=""
+ CSHARPCILINTERPRETER_FLAGS=""
+ if test "cscc" = "$CSHARPCOMPILER" ; then
+ for ac_prog in ilrun
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CSHARPCILINTERPRETER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CSHARPCILINTERPRETER"; then
+ ac_cv_prog_CSHARPCILINTERPRETER="$CSHARPCILINTERPRETER" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CSHARPCILINTERPRETER="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CSHARPCILINTERPRETER=$ac_cv_prog_CSHARPCILINTERPRETER
+if test -n "$CSHARPCILINTERPRETER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CSHARPCILINTERPRETER" >&5
+$as_echo "$CSHARPCILINTERPRETER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CSHARPCILINTERPRETER" && break
+done
+
+ else
+ if test "mcs" = "$CSHARPCOMPILER"; then
+ # Check that mcs is the C# compiler and not the Unix mcs utility by examining the output of 'mcs --version'
+ # The Mono compiler should emit: Mono C# compiler version a.b.c.d
+ csharp_version_raw=`(mcs --version) 2>/dev/null`
+ csharp_version_searched=`(mcs --version | sed -e "/C#/b" -e "/Mono/b" -e d) 2>/dev/null` # return string if contains 'Mono' or 'C#'
+ CSHARPCOMPILER=""
+ if test -n "$csharp_version_raw" ; then
+ if test "$csharp_version_raw" = "$csharp_version_searched" ; then
+ CSHARPCOMPILER="mcs"
+ fi
+ fi
+ if test "mcs" != "$CSHARPCOMPILER" ; then
+ echo "mcs is not a working Mono C# compiler"
+ fi
+ fi
+ if test "mcs" = "$CSHARPCOMPILER" || test "gmcs" = "$CSHARPCOMPILER" || test "mono-csc" = "$CSHARPCOMPILER"; then
+ for ac_prog in mono
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CSHARPCILINTERPRETER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CSHARPCILINTERPRETER"; then
+ ac_cv_prog_CSHARPCILINTERPRETER="$CSHARPCILINTERPRETER" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CSHARPCILINTERPRETER="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CSHARPCILINTERPRETER=$ac_cv_prog_CSHARPCILINTERPRETER
+if test -n "$CSHARPCILINTERPRETER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CSHARPCILINTERPRETER" >&5
+$as_echo "$CSHARPCILINTERPRETER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CSHARPCILINTERPRETER" && break
+done
+ # Mono JIT
+ CSHARPCILINTERPRETER_FLAGS="--debug"
+ else
+ if test "csc" = "$CSHARPCOMPILER"; then
+ CSHARPCONVERTPATH="Tools/convertpath -w"
+ fi
+ fi
+ fi
+else
+ CSHARPCILINTERPRETER="$CSHARPBIN"
+fi
+
+# Cygwin requires the Windows standard (Pascal) calling convention as it is a Windows executable and not a Cygwin built executable
+case $host in
+*-*-cygwin* | *-*-mingw*)
+ if test "$GCC" = yes; then
+ CSHARPDYNAMICLINKING="$GCC_MNO_CYGWIN -mthreads -Wl,--add-stdcall-alias"
+ CSHARPCFLAGS="$GCC_MNO_CYGWIN -mthreads"
+ else
+ CSHARPDYNAMICLINKING=""
+ CSHARPCFLAGS=""
+ fi ;;
+*)
+ CSHARPDYNAMICLINKING=""
+ CSHARPCFLAGS=""
+ ;;
+esac
+
+# CSharp on Windows platforms including Cygwin doesn't use libname.dll, rather name.dll when loading dlls
+case $host in
+*-*-cygwin* | *-*-mingw*) CSHARPLIBRARYPREFIX="";;
+*)CSHARPLIBRARYPREFIX="lib";;
+esac
+
+# C#/Mono on Mac OS X tweaks
+case $host in
+*-*-darwin*)
+ CSHARPSO=".so"
+ ;;
+*)
+ CSHARPSO=$SO
+ ;;
+esac
+fi
+
+
+
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for Lua
+#----------------------------------------------------------------
+
+LUABIN=
+LUAINCLUDE=
+LUALIB=
+LUADYNAMICLOADLIB=
+LUAFLAGS=
+LUALINK=
+# note: if LUABIN is empty then lua tests will not be done
+# LUABIN will be cleared if certain dependencies cannot be found
+
+
+# Check whether --with-lua was given.
+if test "${with_lua+set}" = set; then :
+ withval=$with_lua; LUABIN="$withval"
+else
+ LUABIN="$alllang_default"
+fi
+
+
+# Check whether --with-luaincl was given.
+if test "${with_luaincl+set}" = set; then :
+ withval=$with_luaincl;
+ LUAINCLUDE="$withval"
+else
+ LUAINCLUDE=
+fi
+
+
+# Check whether --with-lualib was given.
+if test "${with_lualib+set}" = set; then :
+ withval=$with_lualib;
+ LUALIB="$withval"
+else
+ LUALIB=
+fi
+
+
+# First, check for "--without-lua" or "--with-lua=no".
+if test x"${LUABIN}" = xno; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Lua" >&5
+$as_echo "$as_me: Disabling Lua" >&6;}
+else
+
+# can we find lua?
+if test "x$LUABIN" = xyes; then
+ # We look for a versioned Lua binary first, as there can be
+ # multiple versions of Lua installed on some systems (like Debian).
+ for ac_prog in lua5.4 lua5.3 lua5.2 lua5.1 lua
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LUABIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $LUABIN in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_LUABIN="$LUABIN" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_LUABIN="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+LUABIN=$ac_cv_path_LUABIN
+if test -n "$LUABIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LUABIN" >&5
+$as_echo "$LUABIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$LUABIN" && break
+done
+
+fi
+
+# check version: we need Lua 5.x
+if test "$LUABIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Lua version" >&5
+$as_echo_n "checking Lua version... " >&6; }
+ LUA_VERSION=`$LUABIN -e 'print(string.match(_VERSION, "%d+[.]%d+"))'`
+ # For 5.0 and 5.1 header and libraries may be named using 50 or 51.
+ LUA_VERSION_NO_DOTS=
+ if test -n "$LUA_VERSION" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Lua $LUA_VERSION.x" >&5
+$as_echo "Lua $LUA_VERSION.x" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+ fi
+ case $LUA_VERSION in
+ 5.0) LUA_VERSION_NO_DOTS=50 ;;
+ 5.1) LUA_VERSION_NO_DOTS=51 ;;
+ 5.*) ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not Lua 5.x, SWIG does not support this version of Lua" >&5
+$as_echo "$as_me: WARNING: Not Lua 5.x, SWIG does not support this version of Lua" >&2;}
+ LUABIN=""
+ ;;
+ esac
+fi
+
+if test "$LUABIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Lua dynamic loading is enabled" >&5
+$as_echo_n "checking whether Lua dynamic loading is enabled... " >&6; }
+ # using Lua to check Lua
+ # lua 5.0 & 5.1 have different fn names
+ if test "$LUA_VERSION" = "5.0"; then
+ LUADYNAMICLOADLIB=`$LUABIN -e '_,_,c=loadlib("no_such_lib","") if c~="absent" then print "1" end'`
+ else
+ LUADYNAMICLOADLIB=`$LUABIN -e '_,_,c=package.loadlib("no_such_lib","") if c~="absent" then print "1" end'`
+ fi
+
+ if test -z "$LUADYNAMICLOADLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ fi
+
+ # look for the header files & set LUAFLAGS accordingly
+ # will clear LUABIN if not present
+ if test -n "$LUAINCLUDE"; then
+ as_ac_File=`$as_echo "ac_cv_file_$LUAINCLUDE/lua.h" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LUAINCLUDE/lua.h" >&5
+$as_echo_n "checking for $LUAINCLUDE/lua.h... " >&6; }
+if eval \${$as_ac_File+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ test "$cross_compiling" = yes &&
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "$LUAINCLUDE/lua.h"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+eval ac_res=\$$as_ac_File
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+ LUAFLAGS="$ISYSTEM$LUAINCLUDE"
+else
+ LUABIN=
+fi
+
+ else
+ LUA_OK="1"
+ CFLAGS_SAVED=$CFLAGS
+ CFLAGS= # Use empty CFLAGS to avoid failure: "present but cannot be compiled"
+ # On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default"
+if test "x$ac_cv_header_lua_h" = xyes; then :
+ LUAFLAGS=""
+else
+ LUA_OK=""
+fi
+
+
+ CFLAGS=$CFLAGS_SAVED
+ # if we didn't get it, going to have to look elsewhere (the hard way)
+ if test -z "$LUA_OK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua.h in other locations" >&5
+$as_echo_n "checking for lua.h in other locations... " >&6; }
+ # note: Debian/Ubuntu seem to like /usr/include/lua5.1/lua.h
+ # The ordering of the include directories to search should match
+ # the ordering of libraries to search in the library test below.
+ inc=/usr/include
+ incloc=/usr/local/include
+ dirs="$inc/lua$LUA_VERSION"
+ test -z "$LUA_VERSION_NO_DOTS" || dirs="$dirs $inc/lua$LUA_VERSION_NO_DOTS"
+ dirs="$dirs $incloc/lua$LUA_VERSION"
+ test -z "$LUA_VERSION_NO_DOTS" || dirs="$dirs $incloc/lua$LUA_VERSION_NO_DOTS"
+ dirs="$dirs $incloc"
+ for i in $dirs; do
+ #echo "$i"
+ if test -r $i/lua.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $i/lua.h" >&5
+$as_echo "$i/lua.h" >&6; }
+ LUAFLAGS="$ISYSTEM$i"
+ break
+ fi
+ done
+ if test -z "$LUAFLAGS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ LUABIN="" # clear the bin
+ fi
+ fi
+ fi
+
+ # look for the library files & set LUALINK accordingly
+ # will clear LUABIN if not present
+ lua_save_LIBS=$LIBS # the code seems to disrupt LIBS, so saving
+
+ if test -n "$LUALIB"; then
+ as_ac_File=`$as_echo "ac_cv_file_$LUALIB/liblua.a" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LUALIB/liblua.a" >&5
+$as_echo_n "checking for $LUALIB/liblua.a... " >&6; }
+if eval \${$as_ac_File+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ test "$cross_compiling" = yes &&
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "$LUALIB/liblua.a"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+eval ac_res=\$$as_ac_File
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+ LUALINK="-L$LUALIB -llua"
+else
+ LUABIN=
+fi
+
+ else
+ libs="lua lua$LUA_VERSION"
+ test -z "$LUA_VERSION_NO_DOTS" || libs="$libs lua$LUA_VERSION_NO_DOTS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lua_close" >&5
+$as_echo_n "checking for library containing lua_close... " >&6; }
+if ${ac_cv_search_lua_close+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lua_close ();
+int
+main ()
+{
+return lua_close ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' $libs; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_lua_close=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_lua_close+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_lua_close+:} false; then :
+
+else
+ ac_cv_search_lua_close=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lua_close" >&5
+$as_echo "$ac_cv_search_lua_close" >&6; }
+ac_res=$ac_cv_search_lua_close
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ LUALINK="-l$ac_lib"
+else
+ LUABIN=
+fi
+
+ fi
+
+ # adding lualib for lua 5.0
+ if test "$LUA_VERSION" = "5.0"; then
+ LUALINK="$LUALINK -llualib"
+ fi
+
+ LIBS=$lua_save_LIBS # restore LIBS
+fi
+
+fi # if not disabled
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for GNU R
+#----------------------------------------------------------------
+
+RBIN=
+
+
+# Check whether --with-r was given.
+if test "${with_r+set}" = set; then :
+ withval=$with_r; RBIN="$withval"
+else
+ RBIN="$alllang_default"
+fi
+
+
+# First, check for "--without-r" or "--with-r=no".
+if test x"${RBIN}" = xno; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling R" >&5
+$as_echo "$as_me: Disabling R" >&6;}
+RBIN=
+else
+
+# can we find R?
+if test "x$RBIN" = xyes; then
+ # Extract the first word of "R", so it can be a program name with args.
+set dummy R; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_RBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $RBIN in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_RBIN="$RBIN" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_RBIN="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+RBIN=$ac_cv_path_RBIN
+if test -n "$RBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RBIN" >&5
+$as_echo "$RBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+fi
+
+
+
+#----------------------------------------------------------------
+# Look for Go compilers
+#----------------------------------------------------------------
+
+
+# Check whether --with-go was given.
+if test "${with_go+set}" = set; then :
+ withval=$with_go; GOBIN="$withval"
+else
+ GOBIN="$alllang_default"
+fi
+
+
+if test x"${GOBIN}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling Go" >&5
+$as_echo "$as_me: Disabling Go" >&6;}
+ GO=
+ GOGCC=false
+ GCCGO=
+ GOOPT=
+ GCCGOOPT=
+ GOVERSIONOPTION=
+else
+
+ if test "x$GOBIN" = xyes; then
+ for ac_prog in go
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_GO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$GO"; then
+ ac_cv_prog_GO="$GO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_GO="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+GO=$ac_cv_prog_GO
+if test -n "$GO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GO" >&5
+$as_echo "$GO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$GO" && break
+done
+
+ else
+ GO="$GOBIN"
+ fi
+
+ GOGCC=false
+ GCCGO=
+ GOOPT=
+ GCCGOOPT=
+ GOVERSIONOPTION=
+
+ if test -n "$GO" ; then
+ GOVERSIONOPTION=version
+ go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version //')
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether go version is too old" >&5
+$as_echo_n "checking whether go version is too old... " >&6; }
+ case $go_version in
+ go1.012*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - minimum version is 1.3" >&5
+$as_echo "yes - minimum version is 1.3" >&6; }
+ GO=
+ GOOPT="-intgosize 32"
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ case "$(go env GOARCH)" in
+ amd64 | arm64 | ppc64*)
+ GOOPT="-intgosize 64"
+ ;;
+ *)
+ GOOPT="-intgosize 32"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+
+ for ac_prog in gccgo
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_GCCGO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$GCCGO"; then
+ ac_cv_prog_GCCGO="$GCCGO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_GCCGO="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+GCCGO=$ac_cv_prog_GCCGO
+if test -n "$GCCGO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCCGO" >&5
+$as_echo "$GCCGO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$GCCGO" && break
+done
+
+
+ if test -n "$GCCGO" ; then
+ if $GCCGO --help 2>/dev/null | grep gccgo >/dev/null 2>&1 ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gccgo version is too old" >&5
+$as_echo_n "checking whether gccgo version is too old... " >&6; }
+ go_version=`$GO $GOVERSIONOPTION | sed -n '1p' | sed -e 's/^.* \([0-9.]*\) *$/\1/' -e 's/[.]//g'`
+ if test "x$go_version" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not determine gccgo version" >&5
+$as_echo "could not determine gccgo version" >&6; }
+ GCCGO=
+ elif test "$go_version" -lt 470; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - minimum version is 4.7.0" >&5
+$as_echo "yes - minimum version is 4.7.0" >&6; }
+ GCCGO=
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ if test "$go_version" -lt 480; then
+ GCCGOOPT="-intgosize 32"
+ else
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if ${ac_cv_sizeof_void_p+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_void_p" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (void *)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_void_p=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+
+ if test "$ac_cv_sizeof_void_p" = "8"; then
+ GCCGOOPT="-intgosize 64"
+ else
+ GCCGOOPT="-intgosize 32"
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Look for D
+#----------------------------------------------------------------
+
+
+# Check whether --with-d was given.
+if test "${with_d+set}" = set; then :
+ withval=$with_d; with_d="$withval"
+else
+ with_d="$alllang_default"
+fi
+
+
+# Check whether --with-d1-compiler was given.
+if test "${with_d1_compiler+set}" = set; then :
+ withval=$with_d1_compiler; D1COMPILERBIN="$withval"
+else
+ D1COMPILERBIN=
+fi
+
+
+# Check whether --with-d2-compiler was given.
+if test "${with_d2_compiler+set}" = set; then :
+ withval=$with_d2_compiler; D2COMPILERBIN="$withval"
+else
+ D2COMPILERBIN=
+fi
+
+
+
+# First, check for "--without-d" or "--with-d=no".
+if test x"${with_d}" = xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling D" >&5
+$as_echo "$as_me: Disabling D" >&6;}
+ D1COMPILER=
+ D2COMPILER=
+else
+ old_ac_ext=$ac_ext
+ ac_ext=d
+
+ if test -z "$D1COMPILERBIN" ; then
+ for ac_prog in dmd ldmd gdmd
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_D1COMPILER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$D1COMPILER"; then
+ ac_cv_prog_D1COMPILER="$D1COMPILER" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_D1COMPILER="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+D1COMPILER=$ac_cv_prog_D1COMPILER
+if test -n "$D1COMPILER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $D1COMPILER" >&5
+$as_echo "$D1COMPILER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$D1COMPILER" && break
+done
+
+
+ if test -n "$D1COMPILER" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the D1/Tango compiler works" >&5
+$as_echo_n "checking whether the D1/Tango compiler works... " >&6; }
+ cat > conftest.$ac_ext <<_ACEOF
+import tango.io.Stdout;
+void main() {
+}
+_ACEOF
+ rm -f conftest.$ac_objext
+ if $D1COMPILER conftest.$ac_ext 2>&5 && test ! -s conftest.err && test -s conftest.$ac_objext; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ D1COMPILER=
+
+fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ else
+ D1COMPILER="$D1COMPILERBIN"
+ fi
+
+ if test -z "$D2COMPILERBIN" ; then
+ for ac_prog in dmd gdmd
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_D2COMPILER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$D2COMPILER"; then
+ ac_cv_prog_D2COMPILER="$D2COMPILER" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_D2COMPILER="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+D2COMPILER=$ac_cv_prog_D2COMPILER
+if test -n "$D2COMPILER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $D2COMPILER" >&5
+$as_echo "$D2COMPILER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$D2COMPILER" && break
+done
+
+
+ if test -n "$D2COMPILER" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the D2 compiler works" >&5
+$as_echo_n "checking whether the D2 compiler works... " >&6; }
+ cat > conftest.$ac_ext <<_ACEOF
+import std.algorithm;
+void main() {
+}
+_ACEOF
+ rm -f conftest.$ac_objext
+ if $D2COMPILER conftest.$ac_ext 2>&5 && test ! -s conftest.err && test -s conftest.$ac_objext; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ D2COMPILER=
+
+fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ else
+ D2COMPILER="$D2COMPILERBIN"
+ fi
+
+ ac_ext=$old_ac_ext
+fi
+
+if test -n "$D1COMPILER"; then
+ DDEFAULTVERSION=1
+elif test -n "$D2COMPILER"; then
+ DDEFAULTVERSION=2
+fi
+
+# Do not prefix library file names with "lib" on Windows.
+case $host in
+*-*-cygwin* | *-*-mingw*) DLIBPREFIX="";;
+*)DLIBPREFIX="lib";;
+esac
+
+
+
+
+
+
+#----------------------------------------------------------------
+# Determine which languages to use for examples/test-suite
+#----------------------------------------------------------------
+
+SKIP_TCL=
+if test -z "$TCLINCLUDE" || test -z "$TCLLIB" ; then
+ SKIP_TCL="1"
+fi
+
+
+
+SKIP_PERL5=
+if test -z "$PERL" || test -z "$PERL5EXT" || test -z "$PERL5TESTMORE"; then
+ SKIP_PERL5="1"
+fi
+
+
+
+SKIP_OCTAVE=
+if test -z "$OCTAVE" ; then
+ SKIP_OCTAVE="1"
+fi
+
+
+
+SKIP_PYTHON=
+if (test -z "$PYINCLUDE" || test -z "$PYLINK") &&
+ (test -z "$PY3INCLUDE" || test -z "$PY3LINK") ; then
+ SKIP_PYTHON="1"
+fi
+
+
+SKIP_PYTHON3=
+if test -z "$PY3INCLUDE" || test -z "$PY3LINK" ; then
+ SKIP_PYTHON3="1"
+fi
+
+
+SKIP_JAVA=
+if test -z "$JAVA" || test -z "$JAVAC" || test -z "$JAVAINC" ; then
+ SKIP_JAVA="1"
+fi
+
+
+SKIP_JAVASCRIPT=
+if test -z "$JAVASCRIPT" || ( test -z "$NODEJS" && test -z "$JSCENABLED" && test -z "$JSV8ENABLED" ) ; then
+ SKIP_JAVASCRIPT="1"
+fi
+
+
+SKIP_GUILE=
+if test -z "$GUILE" || test -z "$GUILE_LIBS" ; then
+ SKIP_GUILE="1"
+fi
+
+
+
+SKIP_MZSCHEME=
+if test -z "$MZC" || test -z "$MZDYNOBJ" ; then
+ SKIP_MZSCHEME="1"
+fi
+
+
+
+SKIP_RUBY=
+if test -z "$RUBY" || test -z "$RUBYINCLUDE" || test -z "$RUBYLIB" ; then
+ SKIP_RUBY="1"
+fi
+
+
+
+SKIP_PHP=
+if test -z "$PHP" || test -z "$PHPINC" ; then
+ SKIP_PHP="1"
+fi
+
+
+
+SKIP_OCAML=
+if test -z "$OCAMLC" || test -z "$CAMLP4" ; then
+ SKIP_OCAML="1"
+fi
+
+
+
+SKIP_CSHARP=
+if test -z "$CSHARPCOMPILER" ; then
+ SKIP_CSHARP="1"
+else
+ if test "cscc" = "$CSHARPCOMPILER" && test -z "$CSHARPCILINTERPRETER" ; then
+ SKIP_CSHARP="1"
+ fi
+fi
+
+
+SKIP_LUA=
+# we need LUABIN & dynamic loading
+if test -z "$LUABIN" || test -z "$LUADYNAMICLOADLIB"; then
+ SKIP_LUA="1"
+fi
+
+
+SKIP_R=
+if test -z "$RBIN" ; then
+ SKIP_R="1"
+fi
+
+
+SKIP_SCILAB=
+if test -z "$SCILAB"; then
+ SKIP_SCILAB="1"
+fi
+
+
+SKIP_GO=
+if test -z "$GO" ; then
+ SKIP_GO="1"
+fi
+
+
+SKIP_D=
+if test -z "$DDEFAULTVERSION" ; then
+ SKIP_D="1"
+fi
+
+
+#----------------------------------------------------------------
+# Additional language dependencies
+#----------------------------------------------------------------
+
+SKIP_ANDROID=
+if test -z "$ANDROID" || test -z "$ADB" || test -z "$ANT" || test -z "$NDKBUILD" ; then
+ SKIP_ANDROID="1"
+fi
+
+
+
+
+#----------------------------------------------------------------
+# Miscellaneous
+#----------------------------------------------------------------
+
+ABS_SRCDIR=`(cd ${srcdir} && pwd)`
+
+case $host in
+ *-*-mingw* ) ABS_SRCDIR=`${srcdir}/Tools/convertpath -m $ABS_SRCDIR` ;;
+ *-*-cygwin* ) ABS_SRCDIR=`cygpath --mixed $ABS_SRCDIR` ;;
+esac
+
+# Root directory
+ROOT_DIR=`pwd`
+case $host in
+*-*-cygwin*)
+ # Translate path for native Windows compilers for use with 'make check'
+ if (cygpath --mixed $ROOT_DIR) >/dev/null 2>/dev/null; then
+ ROOT_DIR=`cygpath --mixed $ROOT_DIR`
+ fi
+ ;;
+esac
+
+case $host in
+*-*-cygwin* | *-*-mingw*)
+ # Extra files generated by some Windows compilers
+ EXTRA_CLEAN="*.stackdump *.exp *.lib *.pdb *.ilk"
+ ;;
+esac
+
+
+
+
+
+# Configure SWIG_LIB path
+
+
+# Check whether --with-swiglibdir was given.
+if test "${with_swiglibdir+set}" = set; then :
+ withval=$with_swiglibdir; swig_lib="$withval"
+else
+ swig_lib="${datadir}/swig/${PACKAGE_VERSION}"
+fi
+
+SWIG_LIB_INSTALL=${swig_lib}
+
+
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+ eval ac_define_dir="\"$swig_lib\""
+ eval ac_define_dir="\"$ac_define_dir\""
+ SWIG_LIB="$ac_define_dir"
+
+
+cat >>confdefs.h <<_ACEOF
+#define SWIG_LIB "$ac_define_dir"
+_ACEOF
+
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+
+
+case $build in
+ # Windows does not understand unix directories. Convert into a windows directory with drive letter.
+ *-*-mingw*) SWIG_LIB_WIN_UNIX=`${srcdir}/Tools/convertpath -m $SWIG_LIB`;;
+ *-*-cygwin*) SWIG_LIB_WIN_UNIX=`cygpath --mixed "$SWIG_LIB"`;;
+ *) SWIG_LIB_WIN_UNIX="";;
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define SWIG_LIB_WIN_UNIX "$SWIG_LIB_WIN_UNIX"
+_ACEOF
+
+
+SWIG_LIB_PREINST=$ABS_SRCDIR/Lib
+
+
+SWIG_LIB_SET="env SWIG_LIB=\$(SWIG_LIB_DIR)"
+if test "${srcdir}" = "."; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef _WIN32
+ yes
+ #endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "yes" >/dev/null 2>&1; then :
+ SWIG_LIB_SET="env SWIG_LIB="
+fi
+rm -f conftest*
+
+fi
+
+
+ac_config_files="$ac_config_files Makefile swig.spec Examples/Makefile Examples/d/example.mk Examples/xml/Makefile Examples/test-suite/errors/Makefile Examples/test-suite/csharp/Makefile Examples/test-suite/d/Makefile Examples/test-suite/guile/Makefile Examples/test-suite/java/Makefile Examples/test-suite/javascript/Makefile Examples/test-suite/mzscheme/Makefile Examples/test-suite/ocaml/Makefile Examples/test-suite/octave/Makefile Examples/test-suite/perl5/Makefile Examples/test-suite/php/Makefile Examples/test-suite/python/Makefile Examples/test-suite/ruby/Makefile Examples/test-suite/scilab/Makefile Examples/test-suite/tcl/Makefile Examples/test-suite/lua/Makefile Examples/test-suite/r/Makefile Examples/test-suite/go/Makefile Source/Makefile Tools/javascript/Makefile"
+
+ac_config_files="$ac_config_files preinst-swig"
+
+ac_config_files="$ac_config_files CCache/ccache_swig_config.h"
+
+
+#--------------------------------------------------------------------
+# Building Examples/ out of source directory
+#--------------------------------------------------------------------
+
+# If building out of source tree, replicate Examples/ source tree in
+# build directory, and copy over Makefiles from source directory.
+# Prefix each Makefile with a header which sets SRCDIR to the relative
+# source directory, and provides a rule for updating the Makefile from
+# its original source.
+ac_config_commands="$ac_config_commands Examples"
+
+
+#--------------------------------------------------------------------
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by swig $as_me 4.0.1, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <http://www.swig.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+swig config.status 4.0.1
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "Source/Include/swigconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS Source/Include/swigconfig.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "swig.spec") CONFIG_FILES="$CONFIG_FILES swig.spec" ;;
+ "Examples/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/Makefile" ;;
+ "Examples/d/example.mk") CONFIG_FILES="$CONFIG_FILES Examples/d/example.mk" ;;
+ "Examples/xml/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/xml/Makefile" ;;
+ "Examples/test-suite/errors/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/errors/Makefile" ;;
+ "Examples/test-suite/csharp/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/csharp/Makefile" ;;
+ "Examples/test-suite/d/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/d/Makefile" ;;
+ "Examples/test-suite/guile/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/guile/Makefile" ;;
+ "Examples/test-suite/java/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/java/Makefile" ;;
+ "Examples/test-suite/javascript/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/javascript/Makefile" ;;
+ "Examples/test-suite/mzscheme/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/mzscheme/Makefile" ;;
+ "Examples/test-suite/ocaml/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/ocaml/Makefile" ;;
+ "Examples/test-suite/octave/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/octave/Makefile" ;;
+ "Examples/test-suite/perl5/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/perl5/Makefile" ;;
+ "Examples/test-suite/php/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/php/Makefile" ;;
+ "Examples/test-suite/python/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/python/Makefile" ;;
+ "Examples/test-suite/ruby/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/ruby/Makefile" ;;
+ "Examples/test-suite/scilab/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/scilab/Makefile" ;;
+ "Examples/test-suite/tcl/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/tcl/Makefile" ;;
+ "Examples/test-suite/lua/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/lua/Makefile" ;;
+ "Examples/test-suite/r/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/r/Makefile" ;;
+ "Examples/test-suite/go/Makefile") CONFIG_FILES="$CONFIG_FILES Examples/test-suite/go/Makefile" ;;
+ "Source/Makefile") CONFIG_FILES="$CONFIG_FILES Source/Makefile" ;;
+ "Tools/javascript/Makefile") CONFIG_FILES="$CONFIG_FILES Tools/javascript/Makefile" ;;
+ "preinst-swig") CONFIG_FILES="$CONFIG_FILES preinst-swig" ;;
+ "CCache/ccache_swig_config.h") CONFIG_FILES="$CONFIG_FILES CCache/ccache_swig_config.h" ;;
+ "Examples") CONFIG_COMMANDS="$CONFIG_COMMANDS Examples" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ # TODO: see whether this extra hack can be removed once we start
+ # requiring Autoconf 2.70 or later.
+ case $CONFIG_FILES in #(
+ *\'*) :
+ eval set x "$CONFIG_FILES" ;; #(
+ *) :
+ set x $CONFIG_FILES ;; #(
+ *) :
+ ;;
+esac
+ shift
+ # Used to flag and report bootstrapping failures.
+ am_rc=0
+ for am_mf
+ do
+ # Strip MF so we end up with the name of the file.
+ am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile which includes
+ # dependency-tracking related rules and includes.
+ # Grep'ing the whole file directly is not great: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+ || continue
+ am_dirpart=`$as_dirname -- "$am_mf" ||
+$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$am_mf" : 'X\(//\)[^/]' \| \
+ X"$am_mf" : 'X\(//\)$' \| \
+ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$am_mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ am_filepart=`$as_basename -- "$am_mf" ||
+$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$am_mf" : 'X\(//\)$' \| \
+ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$am_mf" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { echo "$as_me:$LINENO: cd "$am_dirpart" \
+ && sed -e '/# am--include-marker/d' "$am_filepart" \
+ | $MAKE -f - am--depfiles" >&5
+ (cd "$am_dirpart" \
+ && sed -e '/# am--include-marker/d' "$am_filepart" \
+ | $MAKE -f - am--depfiles) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } || am_rc=$?
+ done
+ if test $am_rc -ne 0; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Something went wrong bootstrapping makefile fragments
+ for automatic dependency tracking. Try re-running configure with the
+ '--disable-dependency-tracking' option to at least be able to build
+ the package (albeit without support for automatic dependency tracking).
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ { am_dirpart=; unset am_dirpart;}
+ { am_filepart=; unset am_filepart;}
+ { am_mf=; unset am_mf;}
+ { am_rc=; unset am_rc;}
+ rm -f conftest-deps.mk
+}
+ ;;
+ "preinst-swig":F) chmod +x preinst-swig ;;
+ "Examples":C)
+ if test "x${srcdir}" != "x." ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: generating Examples build tree" >&5
+$as_echo "$as_me: generating Examples build tree" >&6;}
+ for mkfile in `cd ${srcdir} && find Examples/ -type f -name Makefile`; do
+ dir=`dirname ${mkfile}`
+ d=${dir}
+ reldir=""
+ while test "x$d" != "x." ; do
+ d=`dirname $d`
+ reldir="${reldir}../"
+ done
+ relsrcdir=${reldir}${srcdir}/
+ as_dir=${dir}; as_fn_mkdir_p
+ cat <<EOF >${mkfile}
+# DO NOT EDIT: instead edit ${relsrcdir}${mkfile}
+# and run (cd ${reldir} && ./config.status) to regenerate
+TOP_BUILDDIR_TO_TOP_SRCDIR = ${srcdir}/
+SRCDIR = ${relsrcdir}${dir}/
+
+EOF
+ cat ${srcdir}/${mkfile} >>${mkfile}
+ done
+ fi
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+
+#
+# CONFIG_SUBDIRS section.
+#
+if test "$no_recursion" != yes; then
+
+ # Remove --cache-file, --srcdir, and --disable-option-checking arguments
+ # so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ eval "set x $ac_configure_args"
+ shift
+ for ac_arg
+ do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case $ac_arg in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
+ | --c=*)
+ ;;
+ --config-cache | -C)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ ;;
+ --disable-option-checking)
+ ;;
+ *)
+ case $ac_arg in
+ *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append ac_sub_configure_args " '$ac_arg'" ;;
+ esac
+ done
+
+ # Always prepend --prefix to ensure using the same prefix
+ # in subdir configurations.
+ ac_arg="--prefix=$prefix"
+ case $ac_arg in
+ *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
+
+ # Pass --silent
+ if test "$silent" = yes; then
+ ac_sub_configure_args="--silent $ac_sub_configure_args"
+ fi
+
+ # Always prepend --disable-option-checking to silence warnings, since
+ # different subdirs can have different --enable and --with options.
+ ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args"
+
+ ac_popdir=`pwd`
+ for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ test -d "$srcdir/$ac_dir" || continue
+
+ ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
+ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5
+ $as_echo "$ac_msg" >&6
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ cd "$ac_dir"
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ ac_sub_configure=$ac_srcdir/configure.gnu
+ elif test -f "$ac_srcdir/configure"; then
+ ac_sub_configure=$ac_srcdir/configure
+ elif test -f "$ac_srcdir/configure.in"; then
+ # This should be Cygnus configure.
+ ac_sub_configure=$ac_aux_dir/configure
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5
+$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+ # Make the cache file name correct relative to the subdirectory.
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
+ *) # Relative name.
+ ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
+$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
+ # The eval makes quoting arguments work.
+ eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
+ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
+ as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5
+ fi
+
+ cd "$ac_popdir"
+ done
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+langs=""
+test -n "$SKIP_CSHARP" || langs="${langs}csharp "
+test -n "$SKIP_D" || langs="${langs}d "
+test -n "$SKIP_GO" || langs="${langs}go "
+test -n "$SKIP_GUILE" || langs="${langs}guile "
+test -n "$SKIP_JAVA" || langs="${langs}java "
+test -n "$SKIP_JAVASCRIPT" || langs="${langs}javascript "
+test -n "$SKIP_LUA" || langs="${langs}lua "
+test -n "$SKIP_MZSCHEME" || langs="${langs}mzscheme "
+test -n "$SKIP_OCAML" || langs="${langs}ocaml "
+test -n "$SKIP_OCTAVE" || langs="${langs}octave "
+test -n "$SKIP_PERL5" || langs="${langs}perl5 "
+test -n "$SKIP_PHP" || langs="${langs}php "
+test -n "$SKIP_PYTHON" || langs="${langs}python "
+test -n "$SKIP_R" || langs="${langs}r "
+test -n "$SKIP_RUBY" || langs="${langs}ruby "
+test -n "$SKIP_SCILAB" || langs="${langs}scilab "
+test -n "$SKIP_TCL" || langs="${langs}tcl "
+
+echo "
+The SWIG test-suite and examples are configured for the following languages:
+$langs
+"
+
diff --git a/configure.ac b/configure.ac
index 4e8abde5f..63509cd66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,11 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
dnl The macros which aren't shipped with the autotools are stored in the
dnl Tools/config directory in .m4 files.
-AC_INIT([swig],[3.0.12],[http://www.swig.org])
-
-dnl NB: When this requirement is increased to 2.60 or later, AC_PROG_SED
-dnl definition below can be removed
-AC_PREREQ(2.58)
+AC_INIT([swig],[4.0.1],[http://www.swig.org])
+AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([Source/Swig/swig.h])
AC_CONFIG_AUX_DIR([Tools/config])
@@ -16,9 +13,6 @@ AM_INIT_AUTOMAKE
dnl Some extra defines for the config file
AH_BOTTOM([
-/* Default language */
-#define SWIG_LANG "-tcl"
-
/* Deal with attempt by Microsoft to deprecate C standard runtime functions */
#if defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
@@ -28,8 +22,6 @@ AH_BOTTOM([
dnl Check for programs that a user requires to build SWIG
AC_PROG_CC
AC_PROG_CXX
-AC_EXEEXT
-AC_OBJEXT
AM_PROG_CC_C_O # Needed for subdir-objects in AUTOMAKE_OPTIONS
AC_COMPILE_WARNINGS # Increase warning levels
@@ -49,11 +41,6 @@ AC_CHECK_FUNC(popen, AC_DEFINE(HAVE_POPEN, 1, [Define if popen is available]), A
fi
dnl PCRE
-
-dnl AX_PATH_GENERIC() relies on AC_PROG_SED() but it is defined only in
-dnl autoconf 2.60 so trivially predefine it ourselves for the older versions
-m4_ifdef([AC_PROG_SED],, [AC_DEFUN([AC_PROG_SED], [AC_PATH_PROG([SED], sed)])])
-
AC_ARG_WITH([pcre],
[AS_HELP_STRING([--without-pcre],
[Disable support for regular expressions using PCRE])],
@@ -188,19 +175,19 @@ then
if test "$with_next_framework" ; then
LDSHARED="$LDSHARED \$(LDLIBRARY)"
fi ;;
- *-*-linux*) LDSHARED="gcc -shared";;
+ *-*-linux*) LDSHARED="$CC -shared";;
*-*-dgux*) LDSHARED="ld -G";;
- *-*-freebsd3*) LDSHARED="gcc -shared";;
+ *-*-freebsd3*) LDSHARED="$CC -shared";;
*-*-freebsd* | *-*-openbsd*) LDSHARED="ld -Bshareable";;
*-*-netbsd*)
if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
then
- LDSHARED="cc -shared"
+ LDSHARED="$CC -shared"
else
LDSHARED="ld -Bshareable"
fi;;
- *-sco-sysv*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
- *-*-darwin*) LDSHARED="cc -bundle -undefined suppress -flat_namespace";;
+ *-sco-sysv*) LDSHARED="$CC -G -KPIC -Ki486 -belf -Wl,-Bexport";;
+ *-*-darwin*) LDSHARED="$CC -bundle -undefined suppress -flat_namespace";;
*) LDSHARED="ld";;
esac
fi
@@ -280,7 +267,7 @@ fi
AC_MSG_RESULT($RPATH)
# LINKFORSHARED are the flags passed to the $(CC) command that links
-# the a few executables -- this is only needed for a few systems
+# a few executables -- this is only needed for a few systems
AC_MSG_CHECKING(LINKFORSHARED)
if test -z "$LINKFORSHARED"
@@ -386,9 +373,6 @@ case $host in
*) PHP_SO=$SO;;
esac
-AC_SUBST(PHP5_SO)
-PHP5_SO=$PHP_SO
-
AC_SUBST(MZSCHEME_SO)
case $host in
*) MZSCHEME_SO=.so;;
@@ -485,16 +469,23 @@ if test x"${with_tclconfig}" != x ; then
fi
fi
# check in a few common install locations
+dirs="/usr/lib*/ /usr/lib*/tcl*/ /usr/local/lib*/ /usr/local/lib*/tcl*/"
+case $host in
+*-*-darwin*)
+ dirs="/System/Library/Frameworks/Tcl.framework/ $dirs"
+ ;;
+*)
+ ;;
+esac
if test x"${TCLCONFIG}" = x ; then
- for i in `ls -d -r /usr/lib*/ 2>/dev/null` \
- `ls -d -r /usr/lib*/tcl*/ 2>/dev/null` \
- `ls -d -r /usr/local/lib*/ 2>/dev/null` \
- `ls -d -r /usr/local/lib*/tcl*/ 2>/dev/null` ; do
- if test -f $i"tclConfig.sh" ; then
- TCLCONFIG=`(cd $i; pwd)`
- break
- fi
+ for d in $dirs ; do
+ for i in `ls -d -r $d 2>/dev/null` ; do
+ if test -f $i"tclConfig.sh" ; then
+ TCLCONFIG=`(cd $i; pwd)`
+ break
+ fi
done
+ done
fi
if test x"${TCLCONFIG}" = x ; then
AC_MSG_RESULT(no)
@@ -601,7 +592,7 @@ if test x"${PYBIN}" = xno; then
else
# First figure out the name of the Python executable
if test "x$PYBIN" = xyes; then
- AC_CHECK_PROGS(PYTHON, [python python2.8 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
+ AC_CHECK_PROGS(PYTHON, [python python2.7])
else
PYTHON="$PYBIN"
fi
@@ -615,8 +606,11 @@ else
PYVER=0
else
AC_MSG_CHECKING(for Python os.name)
- PYOSNAME=`($PYTHON -c "import sys, os; sys.stdout.write(os.name)")`
+ PYOSNAME=`($PYTHON -c "import sys, os; sys.stdout.write(os.name)") 2>/dev/null`
AC_MSG_RESULT($PYOSNAME)
+ AC_MSG_CHECKING(for Python path separator)
+ PYSEPARATOR=`($PYTHON -c "import sys, os; sys.stdout.write(os.sep)") 2>/dev/null`
+ AC_MSG_RESULT($PYSEPARATOR)
fi
fi
@@ -628,8 +622,8 @@ else
PYEPREFIX=`($PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)") 2>/dev/null`
AC_MSG_RESULT($PYEPREFIX)
- if test x"$PYOSNAME" = x"nt"; then
- # Windows installations are quite different to posix installations
+ if test x"$PYOSNAME" = x"nt" -a x"$PYSEPARATOR" = x"\\"; then
+ # Windows installations are quite different to posix installations (MinGW path separator is a forward slash)
PYPREFIX=`echo "$PYPREFIX" | sed -e 's,\\\\,/,g'` # Forward slashes are easier to use and even work on Windows most of the time
PYTHON_SO=.pyd
@@ -657,7 +651,7 @@ else
# Need to do this hack since autoconf replaces __file__ with the name of the configure file
filehack="file__"
- PYVERSION=`($PYTHON -c "import sys,string,operator,os.path; sys.stdout.write(operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1))")`
+ PYVERSION=`($PYTHON -c "import sys,string,operator,os.path; sys.stdout.write(operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1))") 2>/dev/null`
AC_MSG_RESULT($PYVERSION)
# Find the directory for libraries this is necessary to deal with
@@ -745,10 +739,10 @@ else
PYVER=0
fi
if test "x$PY3BIN" = xyes; then
- if test x"$PYOSNAME" = x"nt" -a $PYVER -ge 3; then
+ if test x"$PYOSNAME" = x"nt" -a x"$PYSEPARATOR" = x"\\" -a $PYVER -ge 3; then
PYTHON3="$PYTHON"
else
- for py_ver in 3 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 ""; do
+ for py_ver in 3 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 ""; do
AC_CHECK_PROGS(PYTHON3, [python$py_ver])
if test -n "$PYTHON3"; then
AC_CHECK_PROGS(PY3CONFIG, [$PYTHON3-config])
@@ -774,10 +768,13 @@ else
if test $PYVER -ge 3; then
AC_MSG_CHECKING(for Python 3.x os.name)
- PY3OSNAME=`($PYTHON3 -c "import sys, os; sys.stdout.write(os.name)")`
+ PY3OSNAME=`($PYTHON3 -c "import sys, os; sys.stdout.write(os.name)") 2>/dev/null`
AC_MSG_RESULT($PY3OSNAME)
+ AC_MSG_CHECKING(for Python 3.x path separator)
+ PYSEPARATOR=`($PYTHON3 -c "import sys, os; sys.stdout.write(os.sep)") 2>/dev/null`
+ AC_MSG_RESULT($PYSEPARATOR)
- if test x"$PY3OSNAME" = x"nt"; then
+ if test x"$PY3OSNAME" = x"nt" -a x"$PYSEPARATOR" = x"\\"; then
# Windows installations are quite different to posix installations
# There is no python-config to use
AC_MSG_CHECKING(for Python 3.x prefix)
@@ -818,7 +815,8 @@ else
PY3PREFIX=`($PY3CONFIG --prefix) 2>/dev/null`
AC_MSG_RESULT($PY3PREFIX)
AC_MSG_CHECKING(for Python 3.x exec-prefix)
- PY3EPREFIX=`($PY3CONFIG --exec-prefix) 2>/dev/null`
+ # Piped through xargs to strip trailing whitespace (bug in msys2 + mingw Python)
+ PY3EPREFIX=`($PY3CONFIG --exec-prefix | xargs) 2>/dev/null`
AC_MSG_RESULT($PY3EPREFIX)
# Note: I could not think of a standard way to get the version string from different versions.
@@ -828,7 +826,7 @@ else
# Need to do this hack since autoconf replaces __file__ with the name of the configure file
filehack="file__"
- PY3VERSION=`($PYTHON3 -c "import string,operator,os.path; print(operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1))")`
+ PY3VERSION=`($PYTHON3 -c "import string,operator,os.path; print(operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1))") 2>/dev/null`
AC_MSG_RESULT($PY3VERSION)
# Find the directory for libraries this is necessary to deal with
@@ -889,11 +887,35 @@ else
fi
if test -n "$PYINCLUDE" || test -n "$PY3INCLUDE" ; then
- AC_CHECK_PROGS(PEP8, pep8)
- if test -n "$PEP8"; then
- AC_MSG_CHECKING(pep8 version)
- pep8_version=`$PEP8 --version 2>/dev/null`
- AC_MSG_RESULT($pep8_version)
+ AC_CHECK_PROGS(PYCODESTYLE, pycodestyle)
+ if test -n "$PYCODESTYLE"; then
+ AC_MSG_CHECKING(pycodestyle version)
+ pycodestyle_version=`$PYCODESTYLE --version 2>/dev/null`
+ AC_MSG_RESULT($pycodestyle_version)
+ fi
+fi
+
+AC_ARG_WITH(2to3, AS_HELP_STRING([--with-2to3=path], [Set location of Python 2to3 tool]), [PY2TO3BIN="$withval"], [PY2TO3BIN="yes"])
+if test -n "$PYTHON3"; then
+ if test "x$PY2TO3BIN" = xyes; then
+ py3to2=`echo $PYTHON3 | sed -e "s/python/2to3-/"`
+ AC_CHECK_PROGS(PY2TO3, $py3to2 2to3)
+ if test -z "$PY2TO3"; then
+ # Windows distributions don't always have the 2to3 executable
+ AC_MSG_CHECKING(for 2to3.py)
+ py2to3script="$PY3PREFIX/Tools/scripts/2to3.py"
+ if test -f "$py2to3script"; then
+ AC_MSG_RESULT($py2to3script)
+ PY2TO3="$PYTHON3 $py2to3script"
+ else
+ AC_MSG_RESULT(Not found)
+ fi
+ fi
+ else
+ PY2TO3="$PY2TO3BIN"
+ fi
+ if test -z "$PY2TO3"; then
+ PYTHON3=
fi
fi
@@ -1036,23 +1058,33 @@ if test -n "$OCTAVE"; then
AS_IF([test "x`${OCTAVE} --version 2>/dev/null | sed -n -e '1p' | sed -n -e '/Octave, version/p'`" != x],[
AC_MSG_RESULT([yes])
],[
- AC_MSG_NOTICE([no, disabling Octave])
+ AC_MSG_NOTICE([no])
OCTAVE=
])
fi
# Check for required Octave helper program "mkoctfile"
if test -n "$OCTAVE"; then
- AC_MSG_CHECKING([for mkoctfile])
- mkoctfile=["`echo $OCTAVE | sed -e 's|[a-z][a-z-]*$|mkoctfile|;t;s|[a-z][a-z-]*\(-[0-9][0-9.+]*\)$|mkoctfile\1|;t'`"]
- AC_MSG_RESULT([${mkoctfile}])
- AC_MSG_CHECKING([if ${mkoctfile} works])
- AS_IF([test "x`${mkoctfile} --version 2>/dev/null | sed -n -e '1p' | sed -n -e '/mkoctfile, version/p'`" != x],[
+ AC_MSG_CHECKING([for mkoctfile])
+ version_suffix=["`echo $OCTAVE | sed -e 's|.*\(-[0-9][0-9.]*\)$|\1|'`"]
+ case $version_suffix in
+ -*) ;;
+ *) version_suffix="" ;;
+ esac
+ octave_directory=`dirname $OCTAVE`
+ if test "$octave_directory" = "." ; then
+ mkoctfile="mkoctfile${version_suffix}"
+ else
+ mkoctfile="${octave_directory}/mkoctfile${version_suffix}"
+ fi
+ AC_MSG_RESULT([${mkoctfile}])
+ AC_MSG_CHECKING([if ${mkoctfile} works])
+ AS_IF([test "x`${mkoctfile} --version 2>/dev/null | sed -n -e '1p' | sed -n -e '/mkoctfile, version/p'`" != x],[
AC_MSG_RESULT([yes])
- ],[
- AC_MSG_NOTICE([no, disabling Octave])
+ ],[
+ AC_MSG_RESULT([no])
OCTAVE=
- ])
+ ])
fi
# Check for Octave preprocessor/compiler/linker flags
@@ -1092,7 +1124,10 @@ if test -n "$OCTAVE"; then
AC_MSG_CHECKING([for Octave linker flags])
OCTAVE_LDFLAGS=
- for var in RDYNAMIC_FLAG LFLAGS RLD_FLAG OCTAVE_LIBS LIBS; do
+ for var in OCTLIBDIR; do
+ OCTAVE_LDFLAGS="${OCTAVE_LDFLAGS} "-L`env - ${mkoctfile} -p ${var}`
+ done
+ for var in RDYNAMIC_FLAG RLD_FLAG OCTAVE_LIBS LIBS; do
OCTAVE_LDFLAGS="${OCTAVE_LDFLAGS} "`env - ${mkoctfile} -p ${var}`
done
AC_MSG_RESULT([$OCTAVE_LDFLAGS])
@@ -1230,11 +1265,14 @@ case $host in
if test -n "$JAVA_HOME"; then
JAVA_HOME=`cygpath --mixed "$JAVA_HOME"`
fi
+ dnl Java uses semicolons and not colons as separators in its classes search path under Windows.
+ JAVA_CLASSPATH_SEP=";"
;;
*-*-mingw*)
if test -n "$JAVA_HOME"; then
JAVA_HOME=`${srcdir}/Tools/convertpath -u "$JAVA_HOME"`
fi
+ JAVA_CLASSPATH_SEP=";"
;;
*-*-darwin*)
dnl Under OS X JAVA_HOME is not set by default, try to use the system default JRE.
@@ -1247,6 +1285,11 @@ case $host in
if test -r "$JAVA_OSX_STD_INCDIR/jni.h"; then
JAVA_HOME_INCDIR=$JAVA_OSX_STD_INCDIR
fi
+ JAVA_CLASSPATH_SEP=":"
+ ;;
+ *)
+ dnl Assume generic Unix.
+ JAVA_CLASSPATH_SEP=":"
;;
esac
@@ -1327,6 +1370,7 @@ if test -z "$JAVAINCDIR" ; then
if test -r "$d/jni.h" ; then
JAVAINCDIR=$d
JAVAINC=-I\"$d\"
+ JAVA_HOME_MAYBE="`dirname $d`"
break
fi
done
@@ -1353,6 +1397,26 @@ else
fi
fi
+# Auto-detecting JAVA_HOME is not so easy, below will only work up to and including jdk8
+if test -z "$JAVA_HOME" && test -n "$JAVA_HOME_MAYBE" ; then
+ AC_MSG_CHECKING(for java jdk from jni include paths)
+ if test -r "$JAVA_HOME_MAYBE/lib/tools.jar" ; then
+ JAVA_HOME=$JAVA_HOME_MAYBE
+ AC_MSG_RESULT([$JAVA_HOME])
+ else
+ AC_MSG_RESULT(not found)
+ fi
+fi
+
+# Javadoc support required for the Java test-suite is available by default in jdk9+ and in tools.jar in earlier jdk versions
+AC_MSG_CHECKING(for java tools.jar)
+if test -n "$JAVA_HOME" && test -r "$JAVA_HOME/lib/tools.jar" ; then
+ JAVA_TOOLS_JAR="$JAVA_HOME/lib/tools.jar"
+ AC_MSG_RESULT([$JAVA_TOOLS_JAR])
+else
+ AC_MSG_RESULT(not found)
+fi
+
case $host in
*-*-cygwin*)
# TODO: Only use this flag if the compiler supports it, later versions of gcc no longer have it
@@ -1418,6 +1482,8 @@ fi
AC_SUBST(JAVA)
AC_SUBST(JAVAC)
AC_SUBST(JAVAINC)
+AC_SUBST(JAVA_CLASSPATH_SEP)
+AC_SUBST(JAVA_TOOLS_JAR)
AC_SUBST(JAVADYNAMICLINKING)
AC_SUBST(JAVALIBRARYPREFIX)
AC_SUBST(JAVASO)
@@ -1476,7 +1542,7 @@ else
# check for include files
AC_MSG_CHECKING(for JavaScriptCore/JavaScript.h)
- AC_ARG_WITH(jscoreinc, [ --with-jscinc=path Set location of Javascript include directory], [JSCOREINCDIR="$withval"], [JSCOREINCDIR=])
+ AC_ARG_WITH(jscoreinc, [ --with-jscoreinc=path Set location of Javascript include directory], [JSCOREINCDIR="$withval"], [JSCOREINCDIR=])
JSCOREVERSION=
@@ -1510,7 +1576,7 @@ else
fi
# check for JavaScriptCore/Webkit libraries
- AC_ARG_WITH(jscorelib,[ --with-jsclib=path Set location of the JavaScriptCore/Webkit library directory],[JSCORELIB="-L$withval"], [JSCORELIB=])
+ AC_ARG_WITH(jscorelib,[ --with-jscorelib=path Set location of the JavaScriptCore/Webkit library directory],[JSCORELIB="-L$withval"], [JSCORELIB=])
if test -z "$JSCORELIB" -a -n "$PKGCONFIG"; then
AC_MSG_CHECKING(for JavaScriptCore/Webkit library)
@@ -1534,7 +1600,7 @@ else
# check for include files
AC_MSG_CHECKING(for V8 Javascript v8.h)
- AC_ARG_WITH(jsv8inc, [ --with-jsv8inc=path Set location of Javascript v8 include directory], [JSV8INCDIR="$withval"])
+ AC_ARG_WITH(jsv8inc, [ --with-jsv8inc=path Set location of Javascript v8 include directory], [JSV8INCDIR="$withval"], [JSV8INCDIR=])
# if not include dir is specified we try to find
if test -z "$JSV8INCDIR"; then
@@ -1618,34 +1684,6 @@ AC_SUBST(NODEJS)
AC_SUBST(NODEGYP)
#----------------------------------------------------------------
-# Look for gcj
-#----------------------------------------------------------------
-
-AC_ARG_WITH(gcj, AS_HELP_STRING([--without-gcj], [Disable GCJ])
-AS_HELP_STRING([--with-gcj=path], [Set location of gcj executable]),[GCJBIN="$withval"], [GCJBIN="$alllang_default"])
-AC_ARG_WITH(gcjh, [ --with-gcjh=path Set location of gcjh executable],[GCJHBIN="$withval"], [GCJHBIN=])
-
-# First, check for "--without-gcj" or "--with-gcj=no".
-if test x"${GCJBIN}" = xno; then
- AC_MSG_NOTICE([Disabling GCJ])
-else
- if test "x$GCJBIN" = xyes; then
- AC_CHECK_PROGS(GCJ, gcj)
- else
- GCJ="$GCJBIN"
- fi
-
- if test -z "$GCJCBIN"; then
- AC_CHECK_PROGS(GCJH, gcjh)
- else
- GCJH="$GCJHBIN"
- fi
-fi
-
-AC_SUBST(GCJ)
-AC_SUBST(GCJH)
-
-#----------------------------------------------------------------
# Look for Android
#----------------------------------------------------------------
@@ -1716,17 +1754,28 @@ else
fi
if test -n "$GUILE_CONFIG" ; then
if test x"$GUILE" = xyes; then
- AC_MSG_CHECKING([for guile bindir])
- guile_bindir="`$GUILE_CONFIG info bindir`"
- AC_MSG_RESULT([$guile_bindir])
- GUILE=$guile_bindir/guile
+ AC_MSG_CHECKING([for guile executable])
+ # Try extracting it via guile-config first. If it's defined there it's the most reliable result
+ GUILE="`$GUILE_CONFIG info guile 2>/dev/null`"
+ if test -n "$GUILE"; then
+ AC_MSG_RESULT([$GUILE])
+ else
+ AC_MSG_RESULT([not found via guile-config - constructing path])
+ AC_MSG_CHECKING([for guile bindir])
+ guile_bindir="`$GUILE_CONFIG info bindir`"
+ AC_MSG_RESULT([$guile_bindir])
+ GUILE="$guile_bindir/guile"
+ fi
if ! test -f "$GUILE" ; then
- GUILE=
+ GUILE=
AC_PATH_PROG(GUILE, guile)
fi
+ if test -z "$GUILE" ; then
+ AC_MSG_WARN([no suitable guile executable found. Disabling Guile])
+ fi
fi
- if test -f "$GUILE" ; then
+ if test -n "$GUILE" ; then
AC_MSG_CHECKING([for guile version])
guile_version=`$GUILE -c '(display (effective-version))'`
AC_MSG_RESULT([$guile_version])
@@ -1734,20 +1783,33 @@ else
guile_good_version=`$GUILE -c '(if (>= (string->number (effective-version)) 1.8) (display "yes") (display "no"))'`
AC_MSG_RESULT([$guile_good_version])
if test x"$guile_good_version" != xyes ; then
+ AC_MSG_WARN([at least guile version 1.8 is required. Disabling Guile])
GUILE=
fi
fi
- if test -z "$GUILE_CFLAGS" ; then
- AC_MSG_CHECKING([for guile compile flags])
- GUILE_CFLAGS="`$GUILE_CONFIG compile`" # Note that this can sometimes be empty
- AC_MSG_RESULT([$GUILE_CFLAGS])
+ if test -n "$GUILE" ; then
+ # Test if guile-config and guile versions match. They should.
+ gc_version="`$GUILE_CONFIG --version 2>&1 | sed '1 s/.* //;q'`"
+ g_version="`$GUILE --version | sed '1 s/.* //;q'`"
+ if test "$gc_version" != "$g_version"; then
+ AC_MSG_WARN([different versions reported by $GUILE_CONFIG ($gc_version) and $GUILE ($g_version). Disabling Guile])
+ GUILE=
+ fi
fi
- if test -z "$GUILE_LIBS" ; then
- AC_MSG_CHECKING([for guile link flags])
- GUILE_LIBS="`$GUILE_CONFIG link`"
- AC_MSG_RESULT([$GUILE_LIBS])
+ if test -n "$GUILE" ; then
+ if test -z "$GUILE_CFLAGS" ; then
+ AC_MSG_CHECKING([for guile compile flags])
+ GUILE_CFLAGS="`$GUILE_CONFIG compile`" # Note that this can sometimes be empty
+ AC_MSG_RESULT([$GUILE_CFLAGS])
+ fi
+
+ if test -z "$GUILE_LIBS" ; then
+ AC_MSG_CHECKING([for guile link flags])
+ GUILE_LIBS="`$GUILE_CONFIG link`"
+ AC_MSG_RESULT([$GUILE_LIBS])
+ fi
fi
fi
fi
@@ -1931,55 +1993,6 @@ AC_SUBST(RUBYSO)
AC_SUBST(RUBYDYNAMICLINKING)
#-------------------------------------------------------------------------
-# Look for PHP5
-#-------------------------------------------------------------------------
-
-PHP5BIN=
-
-AC_ARG_WITH(php5, AS_HELP_STRING([--without-php5], [Disable PHP5])
-AS_HELP_STRING([--with-php5=path], [Set location of PHP5 executable]),[ PHP5BIN="$withval"], [PHP5BIN="$alllang_default"])
-
-# First, check for "--without-php5" or "--with-php5=no".
-if test x"${PHP5BIN}" = xno; then
- AC_MSG_NOTICE([Disabling PHP5])
- PHP5=
-else
- if test "x$PHP5BIN" = xyes; then
- AC_CHECK_PROGS(PHP5, [php5 php])
- else
- PHP5=$PHP5BIN
- fi
-
- if test -n "$PHP5"; then
- AC_MSG_CHECKING(for PHP5 header files)
- dnl /usr/bin/php5 -> /usr/bin/php-config5
- case $PHP5 in
- *5)
- PHP5CONFIG=`echo "$PHP5"|sed 's/5$/-config5/'` ;;
- *)
- PHP5CONFIG=$PHP5-config ;;
- esac
- php5_version=`$PHP5CONFIG --version 2>/dev/null`
- case $php5_version in
- 5*)
- PHP5INC=`$PHP5CONFIG --includes 2>/dev/null`
- if test -n "$PHP5INC"; then
- AC_MSG_RESULT($PHP5INC)
- else
- AC_MSG_RESULT(not found)
- fi
- ;;
- "")
- AC_MSG_RESULT([could not find $PHP5CONFIG or obtain PHP5 version from it]) ;;
- *)
- AC_MSG_RESULT([found PHP $php_version - not PHP 5]) ;;
- esac
- fi
-fi
-AC_SUBST(PHP5)
-AC_SUBST(PHP5INC)
-
-#-------------------------------------------------------------------------
# Look for PHP7
#-------------------------------------------------------------------------
@@ -1994,7 +2007,7 @@ if test x"${PHPBIN}" = xno; then
PHP=
else
if test "x$PHPBIN" = xyes; then
- AC_CHECK_PROGS(PHP, [php7.1 php7.0 php])
+ AC_CHECK_PROGS(PHP, [php7.3 php7.2 php7.1 php7.0 php])
else
PHP=$PHPBIN
fi
@@ -2029,7 +2042,7 @@ AC_SUBST(PHP)
AC_SUBST(PHPINC)
#----------------------------------------------------------------
-# Look for ocaml
+# Look for OCaml
#----------------------------------------------------------------
AC_ARG_WITH(ocaml, AS_HELP_STRING([--without-ocaml], [Disable OCaml]), [with_ocaml="$withval"], [with_ocaml="$alllang_default"])
@@ -2044,205 +2057,37 @@ if test x"${with_ocaml}" = xno; then
AC_MSG_NOTICE([Disabling OCaml])
OCAMLC=
else
- AC_MSG_CHECKING(for Ocaml DL load generator)
+ # OCaml compiler
+ if test -z "$OCAMLC"; then
+ AC_CHECK_PROGS(OCAMLC, ocamlc)
+ fi
+
+ # OCaml Pre-Processor-Pretty-Printer
+ if test -z "$CAMLP4"; then
+ AC_CHECK_PROGS(CAMLP4, camlp4)
+ fi
+
+ # OCaml DL load generator
if test -z "$OCAMLDLGEN"; then
AC_CHECK_PROGS(OCAMLDLGEN, ocamldlgen)
fi
- AC_MSG_CHECKING(for Ocaml package tool)
- if test -z "$OCAMLFIND"; then
+ # OCaml package tool
+ if test -z "$OCAMLFIND"; then
AC_CHECK_PROGS(OCAMLFIND, ocamlfind)
fi
- AC_MSG_CHECKING(for Ocaml compiler)
- if test -z "$OCAMLC"; then
- AC_CHECK_PROGS(OCAMLC, ocamlc)
- fi
-
- AC_MSG_CHECKING(for Ocaml toplevel creator)
+ # OCaml toplevel creator
if test -z "$OCAMLMKTOP"; then
AC_CHECK_PROGS(OCAMLMKTOP, ocamlmktop)
fi
-
- AC_MSG_CHECKING(for Ocaml Pre-Processor-Pretty-Printer)
- if test -z "$CAMLP4"; then
- AC_CHECK_PROGS(CAMLP4, camlp4)
- fi
-fi # Disabling ocaml
+fi
AC_SUBST(OCAMLC)
+AC_SUBST(CAMLP4)
AC_SUBST(OCAMLDLGEN)
AC_SUBST(OCAMLFIND)
AC_SUBST(OCAMLMKTOP)
-AC_SUBST(CAMLP4)
-
-#----------------------------------------------------------------
-# Look for Pike
-#----------------------------------------------------------------
-
-# Identify the name of the Pike executable
-# Priority: configure option, automatic search
-PIKEBIN=
-AC_ARG_WITH(pike, AS_HELP_STRING([--without-pike], [Disable Pike])
-AS_HELP_STRING([--with-pike=path], [Set location of Pike executable]),[PIKEBIN="$withval"], [PIKEBIN="$alllang_default"])
-
-# First, check for "--without-pike" or "--with-pike=no".
-if test x"${PIKEBIN}" = xno; then
- AC_MSG_NOTICE([Disabling Pike])
- PIKEBIN=
-else
-
-if test "x$PIKEBIN" = xyes; then
- AC_CHECK_PROGS(PIKE, pike pike7.8 pike7.6 pike7.4 pike7.2)
-else
- PIKE="$PIKEBIN"
-fi
-
-
-# Check for pike-config
-# Priority: configure option, guessed from $PIKE, search from list
-AC_ARG_WITH(pike-config, AS_HELP_STRING([--with-pike-config=path],
- [Set location of pike-config script]),
- [PIKECONFIG="$withval"], [PIKECONFIG=""])
-
-if test -z "$PIKECONFIG" -a -n "$PIKE"; then
- AC_CHECK_PROGS(PIKECONFIG, $PIKE-config pike-config \
- pike7.6-config pike7.4-config pike7.2-config)
-fi
-
-# Check for a --with-pikeincl option to configure
-# Priority: configure option, info from $PIKECONFIG, guessed by pike script
-AC_ARG_WITH(pikeincl, AS_HELP_STRING([--with-pikeincl=path],
- [Set location of Pike include directory]),
- [PIKEINCLUDE="-I$withval"], [PIKEINCLUDE=])
-
-if test -n "$PIKE"; then
- AC_MSG_CHECKING([for Pike header files])
- if test -z "$PIKEINCLUDE" -a -n "$PIKECONFIG"; then
- PIKEINCLUDE=`$PIKECONFIG --cflags`
- fi
- if test -z "$PIKEINCLUDE" -a -n "$PIKE"; then
- PIKEINCLUDE=`$PIKE -x cflags`
- if test -z "$PIKEINCLUDE"; then
- PIKEPATH=`which $PIKE`
- PIKEINCLUDE=`$PIKE Tools/check-include-path.pike $PIKEPATH`
- PIKEINCLUDE="-I$PIKEINCLUDE"
- fi
- fi
-
- if test -z "$PIKEINCLUDE"; then
- AC_MSG_RESULT(not found)
- else
- AC_MSG_RESULT($PIKEINCLUDE)
- fi
-fi
-fi
-
-AC_SUBST(PIKEINCLUDE)
-AC_SUBST(PIKECCDLFLAGS) dnl XXX: where is this used/defined?
-AC_SUBST(PIKEDYNAMICLINKING) dnl XXX: where is this used/defined?
-
-#----------------------------------------------------------------
-# Look for CHICKEN
-#----------------------------------------------------------------
-
-CHICKEN=
-CHICKEN_CONFIG=
-CHICKENHOME=
-CHICKENOPTS=
-CHICKENLIB=
-
-
-AC_ARG_WITH(chicken, AS_HELP_STRING([--without-chicken], [Disable CHICKEN])
-AS_HELP_STRING([--with-chicken=path], [Set location of CHICKEN executable]),[ CHICKENBIN="$withval"], [CHICKENBIN="$alllang_default"])
-
-# First, check for "--without-chicken" or "--with-chicken=no".
-if test x"${CHICKENBIN}" = xno; then
-AC_MSG_NOTICE([Disabling CHICKEN])
-else
-
-if test "x$CHICKENBIN" = xyes; then
-AC_CHECK_PROGS(CHICKEN, chicken)
-else
-CHICKEN="$CHICKENBIN"
-fi
-
-AC_ARG_WITH(chickencsc,[ --with-chickencsc=path Set location of csc executable],[ CHICKEN_CSC="$withval"], [CHICKEN_CSC=])
-
-if test -z "$CHICKEN_CSC"; then
- AC_CHECK_PROGS(CHICKEN_CSC, csc)
- # Both the Microsoft C# compiler and chicken have an executable called csc, so check that this csc is really the chicken one
- if test -n "$CHICKEN_CSC" ; then
- AC_MSG_CHECKING(whether csc is the chicken compiler)
- $CHICKEN_CSC -version 2>/dev/null | grep "chicken" > /dev/null || CHICKEN_CSC=""
- if test -z "$CHICKEN_CSC"; then
- AC_MSG_RESULT(no)
- else
- AC_MSG_RESULT(yes)
- fi
- fi
-fi
-
-AC_ARG_WITH(chickencsi,[ --with-chickencsi=path Set location of csi executable],[ CHICKEN_CSI="$withval"], [CHICKEN_CSI=])
-
-if test -z "$CHICKEN_CSI"; then
-AC_CHECK_PROGS(CHICKEN_CSI, csi)
-fi
-
-if test -n "$CHICKEN_CSC" ; then
-
- AC_ARG_WITH(chickenopts,[ --with-chickenopts=args Set compiler options for static CHICKEN generated code],[
- CHICKENOPTS="$withval"], [CHICKENOPTS=])
- AC_ARG_WITH(chickensharedlib,[ --with-chickensharedlib=args Set linker options for shared CHICKEN generated code],[
- CHICKENSHAREDLIB="$withval"], [CHICKENSHAREDLIB=])
- AC_ARG_WITH(chickenlib,[ --with-chickenlib=args Set linker options for static CHICKEN generated code],[
- CHICKENLIB="$withval"], [CHICKENLIB=])
-
- AC_MSG_CHECKING(for compiler options for static CHICKEN generated code)
- if test -z "$CHICKENOPTS"; then
- CHICKENOPTS="`$CHICKEN_CSC -cflags`"
- else
- CHICKENOPTS="`$CHICKEN_CSC -cflags` $CHICKENOPTS"
- fi
- if test -z "$CHICKENOPTS"; then
- AC_MSG_RESULT(not found)
- else
- AC_MSG_RESULT($CHICKENOPTS)
- fi
-
- AC_MSG_CHECKING(for linker options for shared CHICKEN generated code)
- if test -z "$CHICKENSHAREDLIB"; then
- CHICKENSHAREDLIB="`$CHICKEN_CSC -shared -libs`"
- else
- CHICKENSHAREDLIB="`$CHICKEN_CSC -shared -libs` $CHICKENSHAREDLIB"
- fi
- if test -z "$CHICKENSHAREDLIB"; then
- AC_MSG_RESULT(not found)
- else
- AC_MSG_RESULT($CHICKENSHAREDLIB)
- fi
-
- AC_MSG_CHECKING(for linker options for static CHICKEN generated code)
- if test -z "$CHICKENLIB"; then
- CHICKENLIB="`$CHICKEN_CSC -libs`"
- else
- CHICKENLIB="`$CHICKEN_CSC -libs` $CHICKENLIB"
- fi
- if test -z "$CHICKENLIB"; then
- AC_MSG_RESULT(not found)
- else
- AC_MSG_RESULT($CHICKENLIB)
- fi
-
-fi # have CHICKEN_CONFIG
-fi # Check for --without-chicken
-
-AC_SUBST(CHICKEN)
-AC_SUBST(CHICKEN_CSC)
-AC_SUBST(CHICKEN_CSI)
-AC_SUBST(CHICKENOPTS)
-AC_SUBST(CHICKENLIB)
-AC_SUBST(CHICKENSHAREDLIB)
#----------------------------------------------------------------
# Look for C#
@@ -2261,14 +2106,14 @@ else
if test -z "$CSHARPCOMPILERBIN" ; then
case $host in
*-*-cygwin* | *-*-mingw*)
- # prefer Mono gmcs (.NET 2.0) over mcs (.NET 1.1) - note mcs-1.2.3 has major pinvoke bug
- AC_CHECK_PROGS(CSHARPCOMPILER, csc mono-csc gmcs mcs cscc)
+ # prefer unified Mono mcs compiler (not to be confused with the ancient .NET 1 mcs) over older/alternative names.
+ AC_CHECK_PROGS(CSHARPCOMPILER, csc mcs mono-csc gmcs cscc)
if test -n "$CSHARPCOMPILER" && test "$CSHARPCOMPILER" = "csc" ; then
AC_MSG_CHECKING(whether csc is the Microsoft CSharp compiler)
csc 2>/dev/null | grep "C#" > /dev/null || CSHARPCOMPILER=""
if test -z "$CSHARPCOMPILER" ; then
AC_MSG_RESULT(no)
- AC_CHECK_PROGS(CSHARPCOMPILER, mono-csc gmcs mcs cscc)
+ AC_CHECK_PROGS(CSHARPCOMPILER, mcs mono-csc gmcs cscc)
else
AC_MSG_RESULT(yes)
fi
@@ -2386,35 +2231,36 @@ else
if test "x$LUABIN" = xyes; then
# We look for a versioned Lua binary first, as there can be
# multiple versions of Lua installed on some systems (like Debian).
- # The search order should match the include-file and library search
- # orders below (a Lua shared library built for one version may not
- # work with a Lua binary of a different version).
AC_PATH_PROGS(LUABIN, [lua5.4 lua5.3 lua5.2 lua5.1 lua])
fi
# check version: we need Lua 5.x
if test "$LUABIN"; then
AC_MSG_CHECKING(Lua version)
- # if version 5.x
- LUAV5=`$LUABIN -e 'if string.sub(_VERSION,5,5)=="5" then print "1" end'`
- # if not version 5.0
- LUAV51=`$LUABIN -e 'if string.sub(_VERSION,5,7)~="5.0" then print "1" end'`
-
- if test -z "$LUAV5"; then
- AC_MSG_WARN(Not Lua 5.x, SWIG does not support this version of Lua)
- LUABIN=""
- elif test -z "$LUAV51"; then
- AC_MSG_RESULT(Lua 5.0.x)
+ [LUA_VERSION=`$LUABIN -e 'print(string.match(_VERSION, "%d+[.]%d+"))'`]
+ # For 5.0 and 5.1 header and libraries may be named using 50 or 51.
+ LUA_VERSION_NO_DOTS=
+ if test -n "$LUA_VERSION" ; then
+ AC_MSG_RESULT([Lua $LUA_VERSION.x])
else
- AC_MSG_RESULT(Lua 5.1 or later)
+ AC_MSG_RESULT([failed])
fi
+ case $LUA_VERSION in
+ 5.0) LUA_VERSION_NO_DOTS=50 ;;
+ 5.1) LUA_VERSION_NO_DOTS=51 ;;
+ 5.*) ;;
+ *)
+ AC_MSG_WARN([Not Lua 5.x, SWIG does not support this version of Lua])
+ LUABIN=""
+ ;;
+ esac
fi
if test "$LUABIN"; then
AC_MSG_CHECKING(whether Lua dynamic loading is enabled)
# using Lua to check Lua
# lua 5.0 & 5.1 have different fn names
- if test -z "$LUAV51"; then
+ if test "$LUA_VERSION" = "5.0"; then
LUADYNAMICLOADLIB=`$LUABIN -e '_,_,c=loadlib("no_such_lib","") if c~="absent" then print "1" end'`
else
LUADYNAMICLOADLIB=`$LUABIN -e '_,_,c=package.loadlib("no_such_lib","") if c~="absent" then print "1" end'`
@@ -2443,7 +2289,12 @@ if test "$LUABIN"; then
# The ordering of the include directories to search should match
# the ordering of libraries to search in the library test below.
inc=/usr/include
- dirs="$inc/lua5.4 $inc/lua5.3 $inc/lua5.2 $inc/lua5.1 $inc/lua51 $inc/lua5.0 $inc/lua50 /usr/local/include"
+ incloc=/usr/local/include
+ dirs="$inc/lua$LUA_VERSION"
+ test -z "$LUA_VERSION_NO_DOTS" || dirs="$dirs $inc/lua$LUA_VERSION_NO_DOTS"
+ dirs="$dirs $incloc/lua$LUA_VERSION"
+ test -z "$LUA_VERSION_NO_DOTS" || dirs="$dirs $incloc/lua$LUA_VERSION_NO_DOTS"
+ dirs="$dirs $incloc"
for i in $dirs; do
#echo "$i"
if test -r $i/lua.h; then
@@ -2466,11 +2317,13 @@ if test "$LUABIN"; then
if test -n "$LUALIB"; then
AC_CHECK_FILE($LUALIB/liblua.a,[LUALINK="-L$LUALIB -llua"],[LUABIN=])
else
- AC_SEARCH_LIBS(lua_close, [lua lua5.4 lua5.3 lua5.2 lua5.1 lua51 lua5.0 lua50], [LUALINK="-l$ac_lib"],[LUABIN=])
+ libs="lua lua$LUA_VERSION"
+ test -z "$LUA_VERSION_NO_DOTS" || libs="$libs lua$LUA_VERSION_NO_DOTS"
+ AC_SEARCH_LIBS(lua_close, [$libs], [LUALINK="-l$ac_lib"],[LUABIN=])
fi
# adding lualib for lua 5.0
- if test -z "$LUAV51"; then # extra for lua 5.0
+ if test "$LUA_VERSION" = "5.0"; then
LUALINK="$LUALINK -llualib"
fi
@@ -2485,52 +2338,6 @@ AC_SUBST(LUALINK)
AC_SUBST(LUABIN)
#----------------------------------------------------------------
-# Look for Allegro Common Lisp
-#----------------------------------------------------------------
-
-ALLEGROCLBIN=
-
-AC_ARG_WITH(allegrocl, AS_HELP_STRING([--without-allegrocl], [Disable Allegro CL])
-AS_HELP_STRING([--with-allegrocl=path], [Set location of Allegro CL executable (alisp)]),[ ALLEGROCLBIN="$withval"], [ALLEGROCLBIN="$alllang_default"])
-
-# First, check for "--without-allegrocl" or "--with-allegrocl=no".
-if test x"${ALLEGROCLBIN}" = xno; then
-AC_MSG_NOTICE([Disabling Allegro CL])
-ALLEGROCLBIN=
-else
-
-# can we find allegrocl?
-if test "x$ALLEGROCLBIN" = xyes; then
- AC_PATH_PROG(ALLEGROCLBIN, alisp)
-fi
-fi
-
-AC_SUBST(ALLEGROCLBIN)
-
-#----------------------------------------------------------------
-# Look for GNU CLISP
-#----------------------------------------------------------------
-
-CLISPBIN=
-
-AC_ARG_WITH(clisp, AS_HELP_STRING([--without-clisp], [Disable CLISP])
-AS_HELP_STRING([--with-clisp=path], [Set location of CLISP executable (clisp)]),[ CLISPBIN="$withval"], [CLISPBIN="$alllang_default"])
-
-# First, check for "--without-clisp" or "--with-clisp=no".
-if test x"${CLISPBIN}" = xno; then
-AC_MSG_NOTICE([Disabling CLISP])
-CLISPBIN=
-else
-
-# can we find clisp?
-if test "x$CLISPBIN" = xyes; then
- AC_PATH_PROG(CLISPBIN, clisp)
-fi
-fi
-
-AC_SUBST(CLISPBIN)
-
-#----------------------------------------------------------------
# Look for GNU R
#----------------------------------------------------------------
@@ -2563,11 +2370,6 @@ AS_HELP_STRING([--with-go=path], [Set location of Go compiler]),[GOBIN="$withval
if test x"${GOBIN}" = xno; then
AC_MSG_NOTICE([Disabling Go])
GO=
- GOC=
- GO1=false
- GO12=false
- GO13=false
- GO15=false
GOGCC=false
GCCGO=
GOOPT=
@@ -2583,30 +2385,17 @@ else
GOGCC=false
GCCGO=
- GO1=false
- GO12=false
- GO13=false
- GO15=false
GOOPT=
GCCGOOPT=
GOVERSIONOPTION=
if test -n "$GO" ; then
- GO1=true
GOVERSIONOPTION=version
go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version //')
- case "$go_version" in
- go1 | go1.[[01234]]*)
- GOC=$(sh -c "$(go env) && echo \$GOCHAR")c
- ;;
- *)
- GOC=compile
- ;;
- esac
AC_MSG_CHECKING([whether go version is too old])
case $go_version in
- go1.1* | go1.0* | go1 )
- AC_MSG_RESULT([yes - minimum version is 1.2])
+ go1.[012]*)
+ AC_MSG_RESULT([yes - minimum version is 1.3])
GO=
GOOPT="-intgosize 32"
;;
@@ -2622,20 +2411,6 @@ else
esac
;;
esac
- case $go_version in
- go1.0* | go1 | go1.1*)
- GOOPT="$GOOPT -use-shlib"
- ;;
- go1.2*)
- GO12=true
- ;;
- go1.3* | go1.4*)
- GO13=true
- ;;
- *)
- GO15=true
- ;;
- esac
fi
AC_CHECK_PROGS(GCCGO, gccgo)
@@ -2709,7 +2484,7 @@ void main() {
_ACEOF
rm -f conftest.$ac_objext
AS_IF(
- [_AC_DO_STDERR($D1COMPILER conftest.$ac_ext) && test ! -s conftest.err && test -s conftest.$ac_objext],
+ [$D1COMPILER conftest.$ac_ext 2>&AS_MESSAGE_LOG_FD && test ! -s conftest.err && test -s conftest.$ac_objext],
[AC_MSG_RESULT([yes])],
[_AC_MSG_LOG_CONFTEST AC_MSG_RESULT([no])
D1COMPILER=]
@@ -2732,7 +2507,7 @@ void main() {
_ACEOF
rm -f conftest.$ac_objext
AS_IF(
- [_AC_DO_STDERR($D2COMPILER conftest.$ac_ext) && test ! -s conftest.err && test -s conftest.$ac_objext],
+ [$D2COMPILER conftest.$ac_ext 2>&AS_MESSAGE_LOG_FD && test ! -s conftest.err && test -s conftest.$ac_objext],
[AC_MSG_RESULT([yes])],
[_AC_MSG_LOG_CONFTEST AC_MSG_RESULT([no])
D2COMPILER=]
@@ -2841,34 +2616,13 @@ fi
AC_SUBST(SKIP_PHP)
-SKIP_PHP5=
-if test -z "$PHP5" || test -z "$PHP5INC" ; then
- SKIP_PHP5="1"
-fi
-AC_SUBST(SKIP_PHP5)
-
-
SKIP_OCAML=
-if test -z "$OCAMLC" ; then
+if test -z "$OCAMLC" || test -z "$CAMLP4" ; then
SKIP_OCAML="1"
fi
AC_SUBST(SKIP_OCAML)
-SKIP_PIKE=
-if test -z "$PIKE" || test -z "$PIKEINCLUDE" ; then
- SKIP_PIKE="1"
-fi
-AC_SUBST(SKIP_PIKE)
-
-
-SKIP_CHICKEN=
-if test -z "$CHICKEN_CSC" || test -z "$CHICKEN"; then
- SKIP_CHICKEN="1"
-fi
-AC_SUBST(SKIP_CHICKEN)
-
-
SKIP_CSHARP=
if test -z "$CSHARPCOMPILER" ; then
SKIP_CSHARP="1"
@@ -2879,9 +2633,6 @@ else
fi
AC_SUBST(SKIP_CSHARP)
-SKIP_MODULA3="1" # Always skipped!
-AC_SUBST(SKIP_MODULA3)
-
SKIP_LUA=
# we need LUABIN & dynamic loading
if test -z "$LUABIN" || test -z "$LUADYNAMICLOADLIB"; then
@@ -2889,36 +2640,12 @@ if test -z "$LUABIN" || test -z "$LUADYNAMICLOADLIB"; then
fi
AC_SUBST(SKIP_LUA)
-SKIP_ALLEGROCL=
-if test -z "$ALLEGROCLBIN" ; then
- SKIP_ALLEGROCL="1"
-fi
-AC_SUBST(SKIP_ALLEGROCL)
-
-SKIP_CLISP=
-if test -z "$CLISPBIN" ; then
- SKIP_CLISP="1"
-fi
-AC_SUBST(SKIP_CLISP)
-
SKIP_R=
if test -z "$RBIN" ; then
SKIP_R="1"
fi
AC_SUBST(SKIP_R)
-SKIP_CFFI=
-#if test -z "$CFFIBIN" ; then
- SKIP_CFFI="1"
-#fi
-AC_SUBST(SKIP_CFFI)
-
-SKIP_UFFI=
-#if test -z "$UFFIBIN" ; then
- SKIP_UFFI="1"
-#fi
-AC_SUBST(SKIP_UFFI)
-
SKIP_SCILAB=
if test -z "$SCILAB"; then
SKIP_SCILAB="1"
@@ -2940,16 +2667,6 @@ AC_SUBST(SKIP_D)
#----------------------------------------------------------------
# Additional language dependencies
#----------------------------------------------------------------
-SKIP_GCJ=
-if test -z "$GCJ" || test -z "$GCJH" ; then
- SKIP_GCJ="1"
-else
- if test "$GCC" != yes; then
- SKIP_GCJ="1"
- fi
-fi
-AC_SUBST(SKIP_GCJ)
-
SKIP_ANDROID=
if test -z "$ANDROID" || test -z "$ADB" || test -z "$ANT" || test -z "$NDKBUILD" ; then
@@ -3036,7 +2753,6 @@ AC_CONFIG_FILES([
Examples/d/example.mk
Examples/xml/Makefile
Examples/test-suite/errors/Makefile
- Examples/test-suite/chicken/Makefile
Examples/test-suite/csharp/Makefile
Examples/test-suite/d/Makefile
Examples/test-suite/guile/Makefile
@@ -3047,17 +2763,11 @@ AC_CONFIG_FILES([
Examples/test-suite/octave/Makefile
Examples/test-suite/perl5/Makefile
Examples/test-suite/php/Makefile
- Examples/test-suite/php5/Makefile
- Examples/test-suite/pike/Makefile
Examples/test-suite/python/Makefile
Examples/test-suite/ruby/Makefile
Examples/test-suite/scilab/Makefile
Examples/test-suite/tcl/Makefile
Examples/test-suite/lua/Makefile
- Examples/test-suite/allegrocl/Makefile
- Examples/test-suite/clisp/Makefile
- Examples/test-suite/cffi/Makefile
- Examples/test-suite/uffi/Makefile
Examples/test-suite/r/Makefile
Examples/test-suite/go/Makefile
Source/Makefile
@@ -3105,10 +2815,6 @@ EOF
AC_OUTPUT
langs=""
-test -n "$SKIP_ALLEGROCL" || langs="${langs}allegrocl "
-test -n "$SKIP_CFFI" || langs="${langs}cffi "
-test -n "$SKIP_CHICKEN" || langs="${langs}chicken "
-test -n "$SKIP_CLISP" || langs="${langs}clisp "
test -n "$SKIP_CSHARP" || langs="${langs}csharp "
test -n "$SKIP_D" || langs="${langs}d "
test -n "$SKIP_GO" || langs="${langs}go "
@@ -3116,20 +2822,16 @@ test -n "$SKIP_GUILE" || langs="${langs}guile "
test -n "$SKIP_JAVA" || langs="${langs}java "
test -n "$SKIP_JAVASCRIPT" || langs="${langs}javascript "
test -n "$SKIP_LUA" || langs="${langs}lua "
-test -n "$SKIP_MODULA3" || langs="${langs}modula3 "
test -n "$SKIP_MZSCHEME" || langs="${langs}mzscheme "
test -n "$SKIP_OCAML" || langs="${langs}ocaml "
test -n "$SKIP_OCTAVE" || langs="${langs}octave "
test -n "$SKIP_PERL5" || langs="${langs}perl5 "
test -n "$SKIP_PHP" || langs="${langs}php "
-test -n "$SKIP_PHP5" || langs="${langs}php5 "
-test -n "$SKIP_PIKE" || langs="${langs}pike "
test -n "$SKIP_PYTHON" || langs="${langs}python "
test -n "$SKIP_R" || langs="${langs}r "
test -n "$SKIP_RUBY" || langs="${langs}ruby "
test -n "$SKIP_SCILAB" || langs="${langs}scilab "
test -n "$SKIP_TCL" || langs="${langs}tcl "
-test -n "$SKIP_UFFI" || langs="${langs}uffi "
echo "
The SWIG test-suite and examples are configured for the following languages:
diff --git a/swig.spec.in b/swig.spec.in
index 9229274c2..140b96206 100644
--- a/swig.spec.in
+++ b/swig.spec.in
@@ -27,10 +27,10 @@ with a variety of high-level programming languages. SWIG is primarily used with
common scripting languages such as Perl, Python, Tcl/Tk, and Ruby, however the
list of supported languages also includes non-scripting languages such as Java,
OCAML and C#. Also several interpreted and compiled Scheme implementations
-(Guile, MzScheme, Chicken) are supported. SWIG is most commonly used to create
+(Guile, MzScheme) are supported. SWIG is most commonly used to create
high-level interpreted or compiled programming environments, user interfaces,
and as a tool for testing and prototyping C/C++ software. SWIG can also export
-its parse tree in the form of XML and Lisp s-expressions.
+its parse tree in the form of XML.
%prep
%setup -q -n %{name}-%{version}
diff --git a/vms/aaareadme.txt b/vms/aaareadme.txt
deleted file mode 100644
index 52746a7e7..000000000
--- a/vms/aaareadme.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-Port on OpenVMS 7.3 using CC 6.5 and CXX 6.5
-
-
-Building procedure:
-$ @logicals
-$ @build_all
-
-the logicals swig_root is defined by the procedure logicals.com.
-The logicals.com procedure can be invoke with an optional argument
-for the define command, for example:
-$ @logicals "/system/exec"
-
-
-genbuild.py is the python program use to generate all the procedures in the
-[vms.scripts] directory.
-
-
-jf.pieronne@laposte.net
diff --git a/vms/build_end.com b/vms/build_end.com
deleted file mode 100644
index 103302270..000000000
--- a/vms/build_end.com
+++ /dev/null
@@ -1,21 +0,0 @@
-$ set def swig_root:[vms]
-$
-$ file = f$search("swig_root:[vms.o_alpha]*.obj")
-$ newobj = 0
-$ if file .nes. ""
-$ then
-$ v = f$verify(1)
-$ library/replace swig_root:[vms.o_alpha]swig.olb swig_root:[vms.o_alpha]*.obj
-$ delete swig_root:[vms.o_alpha]*.obj;*
-$ v = f$verify(v)
-$ newobj = 1
-$ endif
-$ file = f$search("swig_root:[vms]swig.exe")
-$ if file .eqs. "" .or. newobj
-$ then
-$ v = f$verify(1)
-$ cxxlink/exe=swig_root:[vms]swig.exe -
- /repo=swig_root:[source.modules1_1.cxx_repository] -
- swig_root:[vms.o_alpha]swig.olb/include=swigmain
-$ v = f$verify(v)
-$ endif
diff --git a/vms/build_init.com b/vms/build_init.com
deleted file mode 100644
index 9a1992dc4..000000000
--- a/vms/build_init.com
+++ /dev/null
@@ -1,13 +0,0 @@
-$ set def swig_root:[vms]
-$
-$ swiglib = "swig_root:[vms.o_alpha]swig.olb
-$
-$ if (f$search("swig_root:[vms]o_alpha.dir") .eqs. "") then $ -
- create/dir swig_root:[vms.o_alpha]
-$
-$ copy swigconfig.h [-.source.include]
-$ copy swigver.h [-.source.include]
-$
-$ if (f$search("''swiglib'") .eqs. "") then $ -
- library/create/object 'swiglib'
-$
diff --git a/vms/build_swig.com b/vms/build_swig.com
deleted file mode 100644
index 5570db0bc..000000000
--- a/vms/build_swig.com
+++ /dev/null
@@ -1 +0,0 @@
-$ @swig_root:[vms.scripts]build_all
diff --git a/vms/genbuild.py b/vms/genbuild.py
deleted file mode 100644
index df18ce3ed..000000000
--- a/vms/genbuild.py
+++ /dev/null
@@ -1,155 +0,0 @@
-import os.path, string, posix, pyvms
-#
-#
-
-IDIR = ['swig_root:[source.swig]', 'swig_root:[source.doh.include]',
- 'swig_root:[source.include]', 'swig_root:[source.preprocessor]']
-
-def new_file(fg, dirname):
- global IDIR
- fn = 'swig_root:[vms.scripts]compil_' + os.path.basename(dirname) + '.com'
- print >> fg, '$ @' + fn
- f = open(fn, 'w')
- print >> f, '$!'
- print >> f, '$! Generated by genbuild.py'
- print >> f, '$!'
- print >> f, '$ libname = "swig_root:[vms.o_alpha]swig.olb"'
- print >> f, '$'
- print >> f, '$ set default', pyvms.crtl_to_vms(dirname)[0][0]
- print >> f, '$'
- print >> f, "$ idir := ", IDIR[0]
- for i in range(1, len(IDIR)):
- print >> f, '$ idir = idir + ",' + IDIR[i] + '"'
- print >> f, '$'
- print >> f, "$ iflags = \"/include=(''idir', sys$disk:[])\""
- print >> f, '$ oflags = \"/object=swig_root:[vms.o_alpha]'
- print >> f, "$ cflags = \"''oflags'''iflags'''dflags'\""
- print >> f, "$ cxxflags = \"''oflags'''iflags'''dflags'\""
- print >> f, '$'
- return f
-
-
-def end_file(f):
- print >>f,"""$ exit
-$!
-$!
-$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
-$ V = 'F$Verify(0)
-$! P1 = What we are trying to make
-$! P2 = Command to make it
-$! P3 = Source file
-$! P4 - P8 What it depends on
-$
-$ modname = f$parse(p3,,,"name")
-$ set noon
-$ set message/nofacility/noident/noseverity/notext
-$ libr/lis=swig_root:[vms]swiglib.tmp/full/width=132/only='modname' 'libname'
-$ set message/facility/ident/severity/text
-$ on error then exit
-$ open/read swigtmp swig_root:[vms]swiglib.tmp
-$! skip header
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$!
-$
-$ read/end=module_not_found swigtmp r
-$ modfound = 1
-$ Time = f$cvtime(f$extract(49, 20, r))
-$ goto end_search_module
-$ module_not_found:
-$ modfound = 0
-$
-$ end_search_module:
-$ close swigtmp
-$ delete swig_root:[vms]swiglib.tmp;*
-$
-$ if modfound .eq. 0 then $ goto Makeit
-$
-$! Time = F$CvTime(F$File(P1,"RDT"))
-$arg=3
-$Loop:
-$ Argument = P'arg
-$ If Argument .Eqs. "" Then Goto Exit
-$ El=0
-$Loop2:
-$ File = F$Element(El," ",Argument)
-$ If File .Eqs. " " Then Goto Endl
-$ AFile = ""
-$Loop3:
-$ OFile = AFile
-$ AFile = F$Search(File)
-$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
-$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
-$ Goto Loop3
-$NextEL:
-$ El = El + 1
-$ Goto Loop2
-$EndL:
-$ arg=arg+1
-$ If arg .Le. 8 Then Goto Loop
-$ Goto Exit
-$
-$Makeit:
-$ VV=F$VERIFY(1)
-$ 'P2' 'P3'
-$ VV='F$Verify(VV)
-$Exit:
-$ If V Then Set Verify
-$ENDSUBROUTINE"""
-
-
-def listRep(args, dirname, filenames):
- fg = args[0]
- first = 1
- for fn in filenames:
- if fn[-2:] == '.c':
- if first:
- first = 0
- fc = new_file(fg, dirname)
-
- cstr = "\"cc ''cflags'\" "
- line = "$ call make swig_root:[vms.o_alpha]"
- line += fn[:-1] + 'obj -'
- print >> fc, line
- line = "\t" + cstr + fn
- print >> fc, line
- elif fn[-4:] == '.cxx':
- if first:
- first = 0
- fc = new_file(fg, dirname)
-
- cstr = "\"cxx ''cxxflags'\" "
- line = "$ call make swig_root:[vms.o_alpha]"
- line += fn[:-3] + 'obj -'
- print >> fc, line
- line = "\t" + cstr + fn
- print >> fc, line
- if first == 0:
- end_file(fc)
- fc.close()
-#
-def genbuild(f, dir):
- os.path.walk(dir, listRep, (f,))
- cmd = 'set default swig_root:[vms]'
-#
-f = open('swig_root:[vms.scripts]build_all.com','w')
-print >> f, '$!'
-print >> f, '$! Generated by genbuild.py'
-print >> f, '$!'
-print >> f, '$ set default swig_root:[vms]'
-print >> f, '$'
-print >> f, '$ @swig_root:[vms]build_init'
-#
-genbuild(f, '/swig_root/source')
-print >> f, '$'
-print >> f, '$ set default swig_root:[vms]'
-print >> f, '$'
-print >> f, '$ @swig_root:[vms]build_end'
-f.close
diff --git a/vms/logicals.com b/vms/logicals.com
deleted file mode 100644
index 20da9d49a..000000000
--- a/vms/logicals.com
+++ /dev/null
@@ -1,18 +0,0 @@
-$!
-$!
-$!
-$ proc = f$environment("PROCEDURE")
-$ proc = f$parse(proc,"sys$disk:[]",,,"NO_CONCEAL")
-$ cur_dev = f$parse(proc,,,"DEVICE","SYNTAX_ONLY")
-$ cur_dir = f$parse(proc,,,"DIRECTORY","SYNTAX_ONLY")
-$ cur_dir = f$extract(1,f$length(cur_dir)-2,cur_dir)
-$ cur_dir = cur_dir - "["
-$ cur_dir = cur_dir - "]"
-$ cur_dir = cur_dir - "<"
-$ cur_dir = cur_dir - ">"
-$
-$! remove trealing .VMS
-$ root_dir = f$extract(0,f$length(cur_dir)-4,cur_dir)
-$
-$ define 'p1' /trans=concealed swig_root 'cur_dev'['root_dir'.]
-
diff --git a/vms/scripts/build_all.com b/vms/scripts/build_all.com
deleted file mode 100644
index d41198348..000000000
--- a/vms/scripts/build_all.com
+++ /dev/null
@@ -1,15 +0,0 @@
-$!
-$! Generated by genbuild.py
-$!
-$ set default swig_root:[vms]
-$
-$ @swig_root:[vms]build_init
-$ @swig_root:[vms.scripts]compil_cparse.com
-$ @swig_root:[vms.scripts]compil_doh.com
-$ @swig_root:[vms.scripts]compil_modules1_1.com
-$ @swig_root:[vms.scripts]compil_preprocessor.com
-$ @swig_root:[vms.scripts]compil_swig.com
-$
-$ set default swig_root:[vms]
-$
-$ @swig_root:[vms]build_end
diff --git a/vms/scripts/compil_cparse.com b/vms/scripts/compil_cparse.com
deleted file mode 100644
index 4f78f4104..000000000
--- a/vms/scripts/compil_cparse.com
+++ /dev/null
@@ -1,98 +0,0 @@
-$!
-$! Generated by genbuild.py
-$!
-$ libname = "swig_root:[vms.o_alpha]swig.olb"
-$
-$ set default SWIG_ROOT:[SOURCE.CPARSE]
-$
-$ idir := swig_root:[source.swig]
-$ idir = idir + ",swig_root:[source.doh.include]"
-$ idir = idir + ",swig_root:[source.include]"
-$ idir = idir + ",swig_root:[source.preprocessor]"
-$
-$ iflags = "/include=(''idir', sys$disk:[])"
-$ oflags = "/object=swig_root:[vms.o_alpha]
-$ cflags = "''oflags'''iflags'''dflags'"
-$ cxxflags = "''oflags'''iflags'''dflags'"
-$
-$ call make swig_root:[vms.o_alpha]cscanner.obj -
- "cc ''cflags'" cscanner.c
-$ call make swig_root:[vms.o_alpha]parser.obj -
- "cc ''cflags'" parser.c
-$ call make swig_root:[vms.o_alpha]templ.obj -
- "cc ''cflags'" templ.c
-$ call make swig_root:[vms.o_alpha]util.obj -
- "cc ''cflags'" util.c
-$ exit
-$!
-$!
-$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
-$ V = 'F$Verify(0)
-$! P1 = What we are trying to make
-$! P2 = Command to make it
-$! P3 = Source file
-$! P4 - P8 What it depends on
-$
-$ modname = f$parse(p3,,,"name")
-$ set noon
-$ set message/nofacility/noident/noseverity/notext
-$ libr/lis=swig_root:[vms]swiglib.tmp/full/width=132/only='modname' 'libname'
-$ set message/facility/ident/severity/text
-$ on error then exit
-$ open/read swigtmp swig_root:[vms]swiglib.tmp
-$! skip header
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$!
-$
-$ read/end=module_not_found swigtmp r
-$ modfound = 1
-$ Time = f$cvtime(f$extract(49, 20, r))
-$ goto end_search_module
-$ module_not_found:
-$ modfound = 0
-$
-$ end_search_module:
-$ close swigtmp
-$ delete swig_root:[vms]swiglib.tmp;*
-$
-$ if modfound .eq. 0 then $ goto Makeit
-$
-$! Time = F$CvTime(F$File(P1,"RDT"))
-$arg=3
-$Loop:
-$ Argument = P'arg
-$ If Argument .Eqs. "" Then Goto Exit
-$ El=0
-$Loop2:
-$ File = F$Element(El," ",Argument)
-$ If File .Eqs. " " Then Goto Endl
-$ AFile = ""
-$Loop3:
-$ OFile = AFile
-$ AFile = F$Search(File)
-$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
-$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
-$ Goto Loop3
-$NextEL:
-$ El = El + 1
-$ Goto Loop2
-$EndL:
-$ arg=arg+1
-$ If arg .Le. 8 Then Goto Loop
-$ Goto Exit
-$
-$Makeit:
-$ VV=F$VERIFY(1)
-$ 'P2' 'P3'
-$ VV='F$Verify(VV)
-$Exit:
-$ If V Then Set Verify
-$ENDSUBROUTINE
diff --git a/vms/scripts/compil_doh.com b/vms/scripts/compil_doh.com
deleted file mode 100644
index 6d4ae89ad..000000000
--- a/vms/scripts/compil_doh.com
+++ /dev/null
@@ -1,106 +0,0 @@
-$!
-$! Generated by genbuild.py
-$!
-$ libname = "swig_root:[vms.o_alpha]swig.olb"
-$
-$ set default SWIG_ROOT:[SOURCE.DOH.DOH]
-$
-$ idir := swig_root:[source.swig]
-$ idir = idir + ",swig_root:[source.doh.include]"
-$ idir = idir + ",swig_root:[source.include]"
-$ idir = idir + ",swig_root:[source.preprocessor]"
-$
-$ iflags = "/include=(''idir', sys$disk:[])"
-$ oflags = "/object=swig_root:[vms.o_alpha]
-$ cflags = "''oflags'''iflags'''dflags'"
-$ cxxflags = "''oflags'''iflags'''dflags'"
-$
-$ call make swig_root:[vms.o_alpha]base.obj -
- "cc ''cflags'" base.c
-$ call make swig_root:[vms.o_alpha]file.obj -
- "cc ''cflags'" file.c
-$ call make swig_root:[vms.o_alpha]fio.obj -
- "cc ''cflags'" fio.c
-$ call make swig_root:[vms.o_alpha]hash.obj -
- "cc ''cflags'" hash.c
-$ call make swig_root:[vms.o_alpha]list.obj -
- "cc ''cflags'" list.c
-$ call make swig_root:[vms.o_alpha]memory.obj -
- "cc ''cflags'" memory.c
-$ call make swig_root:[vms.o_alpha]string.obj -
- "cc ''cflags'" string.c
-$ call make swig_root:[vms.o_alpha]void.obj -
- "cc ''cflags'" void.c
-$ exit
-$!
-$!
-$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
-$ V = 'F$Verify(0)
-$! P1 = What we are trying to make
-$! P2 = Command to make it
-$! P3 = Source file
-$! P4 - P8 What it depends on
-$
-$ modname = f$parse(p3,,,"name")
-$ set noon
-$ set message/nofacility/noident/noseverity/notext
-$ libr/lis=swig_root:[vms]swiglib.tmp/full/width=132/only='modname' 'libname'
-$ set message/facility/ident/severity/text
-$ on error then exit
-$ open/read swigtmp swig_root:[vms]swiglib.tmp
-$! skip header
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$!
-$
-$ read/end=module_not_found swigtmp r
-$ modfound = 1
-$ Time = f$cvtime(f$extract(49, 20, r))
-$ goto end_search_module
-$ module_not_found:
-$ modfound = 0
-$
-$ end_search_module:
-$ close swigtmp
-$ delete swig_root:[vms]swiglib.tmp;*
-$
-$ if modfound .eq. 0 then $ goto Makeit
-$
-$! Time = F$CvTime(F$File(P1,"RDT"))
-$arg=3
-$Loop:
-$ Argument = P'arg
-$ If Argument .Eqs. "" Then Goto Exit
-$ El=0
-$Loop2:
-$ File = F$Element(El," ",Argument)
-$ If File .Eqs. " " Then Goto Endl
-$ AFile = ""
-$Loop3:
-$ OFile = AFile
-$ AFile = F$Search(File)
-$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
-$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
-$ Goto Loop3
-$NextEL:
-$ El = El + 1
-$ Goto Loop2
-$EndL:
-$ arg=arg+1
-$ If arg .Le. 8 Then Goto Loop
-$ Goto Exit
-$
-$Makeit:
-$ VV=F$VERIFY(1)
-$ 'P2' 'P3'
-$ VV='F$Verify(VV)
-$Exit:
-$ If V Then Set Verify
-$ENDSUBROUTINE
diff --git a/vms/scripts/compil_modules1_1.com b/vms/scripts/compil_modules1_1.com
deleted file mode 100644
index c570dfe58..000000000
--- a/vms/scripts/compil_modules1_1.com
+++ /dev/null
@@ -1,132 +0,0 @@
-$!
-$! Generated by genbuild.py
-$!
-$ libname = "swig_root:[vms.o_alpha]swig.olb"
-$
-$ set default SWIG_ROOT:[SOURCE.MODULES1_1]
-$
-$ idir := swig_root:[source.swig]
-$ idir = idir + ",swig_root:[source.doh.include]"
-$ idir = idir + ",swig_root:[source.include]"
-$ idir = idir + ",swig_root:[source.preprocessor]"
-$
-$ iflags = "/include=(''idir', sys$disk:[])"
-$ oflags = "/object=swig_root:[vms.o_alpha]
-$ cflags = "''oflags'''iflags'''dflags'"
-$ cxxflags = "''oflags'''iflags'''dflags'"
-$
-$ call make swig_root:[vms.o_alpha]allocate.obj -
- "cxx ''cxxflags'" allocate.cxx
-$ call make swig_root:[vms.o_alpha]browser.obj -
- "cxx ''cxxflags'" browser.cxx
-$ call make swig_root:[vms.o_alpha]contract.obj -
- "cxx ''cxxflags'" contract.cxx
-$ call make swig_root:[vms.o_alpha]emit.obj -
- "cxx ''cxxflags'" emit.cxx
-$ call make swig_root:[vms.o_alpha]guile.obj -
- "cxx ''cxxflags'" guile.cxx
-$ call make swig_root:[vms.o_alpha]java.obj -
- "cxx ''cxxflags'" java.cxx
-$ call make swig_root:[vms.o_alpha]lang.obj -
- "cxx ''cxxflags'" lang.cxx
-$ call make swig_root:[vms.o_alpha]main.obj -
- "cxx ''cxxflags'" main.cxx
-$ call make swig_root:[vms.o_alpha]module.obj -
- "cxx ''cxxflags'" module.cxx
-$ call make swig_root:[vms.o_alpha]mzscheme.obj -
- "cxx ''cxxflags'" mzscheme.cxx
-$ call make swig_root:[vms.o_alpha]ocaml.obj -
- "cxx ''cxxflags'" ocaml.cxx
-$ call make swig_root:[vms.o_alpha]overload.obj -
- "cxx ''cxxflags'" overload.cxx
-$ call make swig_root:[vms.o_alpha]perl5.obj -
- "cxx ''cxxflags'" perl5.cxx
-$ call make swig_root:[vms.o_alpha]php4.obj -
- "cxx ''cxxflags'" php4.cxx
-$ call make swig_root:[vms.o_alpha]pike.obj -
- "cxx ''cxxflags'" pike.cxx
-$ call make swig_root:[vms.o_alpha]python.obj -
- "cxx ''cxxflags'" python.cxx
-$ call make swig_root:[vms.o_alpha]ruby.obj -
- "cxx ''cxxflags'" ruby.cxx
-$ call make swig_root:[vms.o_alpha]swigmain.obj -
- "cxx ''cxxflags'" swigmain.cxx
-$ call make swig_root:[vms.o_alpha]tcl8.obj -
- "cxx ''cxxflags'" tcl8.cxx
-$ call make swig_root:[vms.o_alpha]typepass.obj -
- "cxx ''cxxflags'" typepass.cxx
-$ call make swig_root:[vms.o_alpha]xml.obj -
- "cxx ''cxxflags'" xml.cxx
-$ exit
-$!
-$!
-$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
-$ V = 'F$Verify(0)
-$! P1 = What we are trying to make
-$! P2 = Command to make it
-$! P3 = Source file
-$! P4 - P8 What it depends on
-$
-$ modname = f$parse(p3,,,"name")
-$ set noon
-$ set message/nofacility/noident/noseverity/notext
-$ libr/lis=swig_root:[vms]swiglib.tmp/full/width=132/only='modname' 'libname'
-$ set message/facility/ident/severity/text
-$ on error then exit
-$ open/read swigtmp swig_root:[vms]swiglib.tmp
-$! skip header
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$!
-$
-$ read/end=module_not_found swigtmp r
-$ modfound = 1
-$ Time = f$cvtime(f$extract(49, 20, r))
-$ goto end_search_module
-$ module_not_found:
-$ modfound = 0
-$
-$ end_search_module:
-$ close swigtmp
-$ delete swig_root:[vms]swiglib.tmp;*
-$
-$ if modfound .eq. 0 then $ goto Makeit
-$
-$! Time = F$CvTime(F$File(P1,"RDT"))
-$arg=3
-$Loop:
-$ Argument = P'arg
-$ If Argument .Eqs. "" Then Goto Exit
-$ El=0
-$Loop2:
-$ File = F$Element(El," ",Argument)
-$ If File .Eqs. " " Then Goto Endl
-$ AFile = ""
-$Loop3:
-$ OFile = AFile
-$ AFile = F$Search(File)
-$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
-$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
-$ Goto Loop3
-$NextEL:
-$ El = El + 1
-$ Goto Loop2
-$EndL:
-$ arg=arg+1
-$ If arg .Le. 8 Then Goto Loop
-$ Goto Exit
-$
-$Makeit:
-$ VV=F$VERIFY(1)
-$ 'P2' 'P3'
-$ VV='F$Verify(VV)
-$Exit:
-$ If V Then Set Verify
-$ENDSUBROUTINE
diff --git a/vms/scripts/compil_preprocessor.com b/vms/scripts/compil_preprocessor.com
deleted file mode 100644
index f95961e8d..000000000
--- a/vms/scripts/compil_preprocessor.com
+++ /dev/null
@@ -1,94 +0,0 @@
-$!
-$! Generated by genbuild.py
-$!
-$ libname = "swig_root:[vms.o_alpha]swig.olb"
-$
-$ set default SWIG_ROOT:[SOURCE.PREPROCESSOR]
-$
-$ idir := swig_root:[source.swig]
-$ idir = idir + ",swig_root:[source.doh.include]"
-$ idir = idir + ",swig_root:[source.include]"
-$ idir = idir + ",swig_root:[source.preprocessor]"
-$
-$ iflags = "/include=(''idir', sys$disk:[])"
-$ oflags = "/object=swig_root:[vms.o_alpha]
-$ cflags = "''oflags'''iflags'''dflags'"
-$ cxxflags = "''oflags'''iflags'''dflags'"
-$
-$ call make swig_root:[vms.o_alpha]cpp.obj -
- "cc ''cflags'" cpp.c
-$ call make swig_root:[vms.o_alpha]expr.obj -
- "cc ''cflags'" expr.c
-$ exit
-$!
-$!
-$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
-$ V = 'F$Verify(0)
-$! P1 = What we are trying to make
-$! P2 = Command to make it
-$! P3 = Source file
-$! P4 - P8 What it depends on
-$
-$ modname = f$parse(p3,,,"name")
-$ set noon
-$ set message/nofacility/noident/noseverity/notext
-$ libr/lis=swig_root:[vms]swiglib.tmp/full/width=132/only='modname' 'libname'
-$ set message/facility/ident/severity/text
-$ on error then exit
-$ open/read swigtmp swig_root:[vms]swiglib.tmp
-$! skip header
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$!
-$
-$ read/end=module_not_found swigtmp r
-$ modfound = 1
-$ Time = f$cvtime(f$extract(49, 20, r))
-$ goto end_search_module
-$ module_not_found:
-$ modfound = 0
-$
-$ end_search_module:
-$ close swigtmp
-$ delete swig_root:[vms]swiglib.tmp;*
-$
-$ if modfound .eq. 0 then $ goto Makeit
-$
-$! Time = F$CvTime(F$File(P1,"RDT"))
-$arg=3
-$Loop:
-$ Argument = P'arg
-$ If Argument .Eqs. "" Then Goto Exit
-$ El=0
-$Loop2:
-$ File = F$Element(El," ",Argument)
-$ If File .Eqs. " " Then Goto Endl
-$ AFile = ""
-$Loop3:
-$ OFile = AFile
-$ AFile = F$Search(File)
-$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
-$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
-$ Goto Loop3
-$NextEL:
-$ El = El + 1
-$ Goto Loop2
-$EndL:
-$ arg=arg+1
-$ If arg .Le. 8 Then Goto Loop
-$ Goto Exit
-$
-$Makeit:
-$ VV=F$VERIFY(1)
-$ 'P2' 'P3'
-$ VV='F$Verify(VV)
-$Exit:
-$ If V Then Set Verify
-$ENDSUBROUTINE
diff --git a/vms/scripts/compil_swig.com b/vms/scripts/compil_swig.com
deleted file mode 100644
index 103e275f4..000000000
--- a/vms/scripts/compil_swig.com
+++ /dev/null
@@ -1,122 +0,0 @@
-$!
-$! Generated by genbuild.py
-$!
-$ libname = "swig_root:[vms.o_alpha]swig.olb"
-$
-$ set default SWIG_ROOT:[SOURCE.SWIG]
-$
-$ idir := swig_root:[source.swig]
-$ idir = idir + ",swig_root:[source.doh.include]"
-$ idir = idir + ",swig_root:[source.include]"
-$ idir = idir + ",swig_root:[source.preprocessor]"
-$
-$ iflags = "/include=(''idir', sys$disk:[])"
-$ oflags = "/object=swig_root:[vms.o_alpha]
-$ cflags = "''oflags'''iflags'''dflags'"
-$ cxxflags = "''oflags'''iflags'''dflags'"
-$
-$ call make swig_root:[vms.o_alpha]cwrap.obj -
- "cc ''cflags'" cwrap.c
-$ call make swig_root:[vms.o_alpha]error.obj -
- "cc ''cflags'" error.c
-$ call make swig_root:[vms.o_alpha]fragment.obj -
- "cc ''cflags'" fragment.c
-$ call make swig_root:[vms.o_alpha]getopt.obj -
- "cc ''cflags'" getopt.c
-$ call make swig_root:[vms.o_alpha]include.obj -
- "cc ''cflags'" include.c
-$ call make swig_root:[vms.o_alpha]misc.obj -
- "cc ''cflags'" misc.c
-$ call make swig_root:[vms.o_alpha]naming.obj -
- "cc ''cflags'" naming.c
-$ call make swig_root:[vms.o_alpha]parms.obj -
- "cc ''cflags'" parms.c
-$ call make swig_root:[vms.o_alpha]scanner.obj -
- "cc ''cflags'" scanner.c
-$ call make swig_root:[vms.o_alpha]stype.obj -
- "cc ''cflags'" stype.c
-$ call make swig_root:[vms.o_alpha]symbol.obj -
- "cc ''cflags'" symbol.c
-$ call make swig_root:[vms.o_alpha]tree.obj -
- "cc ''cflags'" tree.c
-$ call make swig_root:[vms.o_alpha]typemap.obj -
- "cc ''cflags'" typemap.c
-$ call make swig_root:[vms.o_alpha]typesys.obj -
- "cc ''cflags'" typesys.c
-$ call make swig_root:[vms.o_alpha]warn.obj -
- "cc ''cflags'" warn.c
-$ call make swig_root:[vms.o_alpha]wrapfunc.obj -
- "cc ''cflags'" wrapfunc.c
-$ exit
-$!
-$!
-$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
-$ V = 'F$Verify(0)
-$! P1 = What we are trying to make
-$! P2 = Command to make it
-$! P3 = Source file
-$! P4 - P8 What it depends on
-$
-$ modname = f$parse(p3,,,"name")
-$ set noon
-$ set message/nofacility/noident/noseverity/notext
-$ libr/lis=swig_root:[vms]swiglib.tmp/full/width=132/only='modname' 'libname'
-$ set message/facility/ident/severity/text
-$ on error then exit
-$ open/read swigtmp swig_root:[vms]swiglib.tmp
-$! skip header
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$ read swigtmp r
-$!
-$
-$ read/end=module_not_found swigtmp r
-$ modfound = 1
-$ Time = f$cvtime(f$extract(49, 20, r))
-$ goto end_search_module
-$ module_not_found:
-$ modfound = 0
-$
-$ end_search_module:
-$ close swigtmp
-$ delete swig_root:[vms]swiglib.tmp;*
-$
-$ if modfound .eq. 0 then $ goto Makeit
-$
-$! Time = F$CvTime(F$File(P1,"RDT"))
-$arg=3
-$Loop:
-$ Argument = P'arg
-$ If Argument .Eqs. "" Then Goto Exit
-$ El=0
-$Loop2:
-$ File = F$Element(El," ",Argument)
-$ If File .Eqs. " " Then Goto Endl
-$ AFile = ""
-$Loop3:
-$ OFile = AFile
-$ AFile = F$Search(File)
-$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
-$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
-$ Goto Loop3
-$NextEL:
-$ El = El + 1
-$ Goto Loop2
-$EndL:
-$ arg=arg+1
-$ If arg .Le. 8 Then Goto Loop
-$ Goto Exit
-$
-$Makeit:
-$ VV=F$VERIFY(1)
-$ 'P2' 'P3'
-$ VV='F$Verify(VV)
-$Exit:
-$ If V Then Set Verify
-$ENDSUBROUTINE
diff --git a/vms/swigconfig.h b/vms/swigconfig.h
deleted file mode 100644
index 3ee086407..000000000
--- a/vms/swigconfig.h
+++ /dev/null
@@ -1,2 +0,0 @@
-
-/* Note that this file has changed. TODO Get the latest from the original version. */