summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlinux-x86/bin/avbtoolbin28559059 -> 28559461 bytes
-rwxr-xr-xlinux-x86/bin/build_imagebin32972693 -> 33109156 bytes
-rwxr-xr-xlinux-x86/bin/build_super_imagebin31168939 -> 31305402 bytes
-rwxr-xr-xlinux-x86/bin/dtcbin138304 -> 138512 bytes
-rwxr-xr-xlinux-x86/bin/e2fsdroidbin1449896 -> 1451312 bytes
-rwxr-xr-xlinux-x86/bin/external_updaterbin1955194 -> 2041583 bytes
-rwxr-xr-xlinux-x86/bin/lpmakebin46496 -> 46160 bytes
-rwxr-xr-xlinux-x86/bin/mkbootfsbin52440 -> 53752 bytes
-rwxr-xr-xlinux-x86/bin/mkfs.erofsbin731192 -> 732552 bytes
-rwxr-xr-xlinux-x86/bin/paholebin1741688 -> 1744752 bytes
-rwxr-xr-xlinux-x86/bin/soong_zipbin2982345 -> 3159234 bytes
-rwxr-xr-xlinux-x86/bin/stgbin4941568 -> 4972040 bytes
-rwxr-xr-xlinux-x86/bin/stgdiffbin5008400 -> 5039528 bytes
-rwxr-xr-xlinux-x86/bin/swigbin1833536 -> 1675904 bytes
-rwxr-xr-xlinux-x86/bin/ufdt_apply_overlaybin52056 -> 52072 bytes
-rwxr-xr-xlinux-x86/lib64/libbase.sobin256928 -> 257328 bytes
-rwxr-xr-xlinux-x86/lib64/libcutils.sobin69648 -> 71048 bytes
-rwxr-xr-xlinux-x86/lib64/libelf.sobin781448 -> 784528 bytes
-rwxr-xr-xlinux-x86/lib64/libfdt.sobin40608 -> 40624 bytes
-rwxr-xr-xlinux-x86/lib64/libicui18n-host.sobin3139392 -> 3136408 bytes
-rwxr-xr-xlinux-x86/lib64/libicuuc-host.sobin2169720 -> 2184224 bytes
-rwxr-xr-xlinux-x86/lib64/libsqlite.sobin1334712 -> 1334712 bytes
-rw-r--r--linux-x86/share/swig/allegrocl/allegrocl.swg615
-rw-r--r--linux-x86/share/swig/allegrocl/inout_typemaps.i111
-rw-r--r--linux-x86/share/swig/allegrocl/longlongs.i49
-rw-r--r--linux-x86/share/swig/allegrocl/std_list.i230
-rw-r--r--linux-x86/share/swig/allegrocl/std_string.i209
-rw-r--r--linux-x86/share/swig/allegrocl/typemaps.i4
-rw-r--r--linux-x86/share/swig/allkw.swg6
-rw-r--r--linux-x86/share/swig/carrays.i42
-rw-r--r--linux-x86/share/swig/cdata.i8
-rw-r--r--linux-x86/share/swig/cffi/cffi.swg294
-rw-r--r--linux-x86/share/swig/chicken/chicken.swg809
-rw-r--r--linux-x86/share/swig/chicken/chickenkw.swg31
-rw-r--r--linux-x86/share/swig/chicken/chickenrun.swg375
-rw-r--r--linux-x86/share/swig/chicken/extra-install.list3
-rw-r--r--linux-x86/share/swig/chicken/multi-generic.scm152
-rw-r--r--linux-x86/share/swig/chicken/std_string.i96
-rw-r--r--linux-x86/share/swig/chicken/swigclosprefix.scm31
-rw-r--r--linux-x86/share/swig/chicken/tinyclos-multi-generic.patch150
-rw-r--r--linux-x86/share/swig/chicken/typemaps.i314
-rw-r--r--linux-x86/share/swig/clisp/clisp.swg32
-rw-r--r--linux-x86/share/swig/constraints.i109
-rw-r--r--linux-x86/share/swig/cpointer.i18
-rw-r--r--linux-x86/share/swig/csharp/argcargv.i76
-rw-r--r--linux-x86/share/swig/csharp/arrays_csharp.i37
-rw-r--r--linux-x86/share/swig/csharp/boost_intrusive_ptr.i4
-rw-r--r--linux-x86/share/swig/csharp/boost_shared_ptr.i6
-rw-r--r--linux-x86/share/swig/csharp/csharp.swg89
-rw-r--r--linux-x86/share/swig/csharp/csharphead.swg2
-rw-r--r--linux-x86/share/swig/csharp/csharpkw.swg4
-rw-r--r--linux-x86/share/swig/csharp/std_array.i71
-rw-r--r--linux-x86/share/swig/csharp/std_auto_ptr.i51
-rw-r--r--linux-x86/share/swig/csharp/std_list.i2
-rw-r--r--linux-x86/share/swig/csharp/std_map.i30
-rw-r--r--linux-x86/share/swig/csharp/std_set.i11
-rw-r--r--linux-x86/share/swig/csharp/std_string.i8
-rw-r--r--linux-x86/share/swig/csharp/std_string_view.i116
-rw-r--r--linux-x86/share/swig/csharp/std_unique_ptr.i38
-rw-r--r--linux-x86/share/swig/csharp/std_unordered_map.i306
-rw-r--r--linux-x86/share/swig/csharp/std_unordered_set.i320
-rw-r--r--linux-x86/share/swig/csharp/std_vector.i29
-rw-r--r--linux-x86/share/swig/csharp/std_wstring.i66
-rw-r--r--linux-x86/share/swig/csharp/swigmove.i16
-rw-r--r--linux-x86/share/swig/csharp/typemaps.i49
-rw-r--r--linux-x86/share/swig/csharp/wchar.i266
-rw-r--r--linux-x86/share/swig/d/argcargv.i26
-rw-r--r--linux-x86/share/swig/d/boost_shared_ptr.i6
-rw-r--r--linux-x86/share/swig/d/carrays.i76
-rw-r--r--linux-x86/share/swig/d/cpointer.i8
-rw-r--r--linux-x86/share/swig/d/dclassgen.swg32
-rw-r--r--linux-x86/share/swig/d/dexception.swg2
-rw-r--r--linux-x86/share/swig/d/dhead.swg125
-rw-r--r--linux-x86/share/swig/d/dkw.swg4
-rw-r--r--linux-x86/share/swig/d/doperators.swg127
-rw-r--r--linux-x86/share/swig/d/dprimitives.swg13
-rw-r--r--linux-x86/share/swig/d/dstrings.swg7
-rw-r--r--linux-x86/share/swig/d/dswigtype.swg93
-rw-r--r--linux-x86/share/swig/d/std_auto_ptr.i42
-rw-r--r--linux-x86/share/swig/d/std_map.i4
-rw-r--r--linux-x86/share/swig/d/std_string.i7
-rw-r--r--linux-x86/share/swig/d/std_unique_ptr.i42
-rw-r--r--linux-x86/share/swig/d/std_vector.i164
-rw-r--r--linux-x86/share/swig/d/swigmove.i16
-rw-r--r--linux-x86/share/swig/d/wrapperloader.swg13
-rw-r--r--linux-x86/share/swig/exception.i16
-rw-r--r--linux-x86/share/swig/go/argcargv.i62
-rw-r--r--linux-x86/share/swig/go/go.swg55
-rw-r--r--linux-x86/share/swig/go/gokw.swg2
-rw-r--r--linux-x86/share/swig/go/goruntime.swg211
-rw-r--r--linux-x86/share/swig/go/std_array.i43
-rw-r--r--linux-x86/share/swig/go/std_map.i4
-rw-r--r--linux-x86/share/swig/go/std_string.i71
-rw-r--r--linux-x86/share/swig/go/swigmove.i15
-rw-r--r--linux-x86/share/swig/guile/argcargv.i44
-rw-r--r--linux-x86/share/swig/guile/guile_scm_run.swg86
-rw-r--r--linux-x86/share/swig/guile/list-vector.i19
-rw-r--r--linux-x86/share/swig/guile/pointer-in-out.i3
-rw-r--r--linux-x86/share/swig/guile/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/guile/std_common.i2
-rw-r--r--linux-x86/share/swig/guile/std_map.i1116
-rw-r--r--linux-x86/share/swig/guile/std_string.i17
-rw-r--r--linux-x86/share/swig/guile/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/guile/swigmove.i19
-rw-r--r--linux-x86/share/swig/guile/swigrun.i2
-rw-r--r--linux-x86/share/swig/guile/typemaps.i107
-rw-r--r--linux-x86/share/swig/intrusive_ptr.i22
-rw-r--r--linux-x86/share/swig/inttypes.i25
-rw-r--r--linux-x86/share/swig/java/argcargv.i36
-rw-r--r--linux-x86/share/swig/java/arrays_java.i20
-rw-r--r--linux-x86/share/swig/java/boost_intrusive_ptr.i4
-rw-r--r--linux-x86/share/swig/java/boost_shared_ptr.i4
-rw-r--r--linux-x86/share/swig/java/director.swg89
-rw-r--r--linux-x86/share/swig/java/java.swg62
-rw-r--r--linux-x86/share/swig/java/javahead.swg14
-rw-r--r--linux-x86/share/swig/java/javakw.swg2
-rw-r--r--linux-x86/share/swig/java/std_array.i20
-rw-r--r--linux-x86/share/swig/java/std_auto_ptr.i56
-rw-r--r--linux-x86/share/swig/java/std_list.i2
-rw-r--r--linux-x86/share/swig/java/std_map.i19
-rw-r--r--linux-x86/share/swig/java/std_set.i4
-rw-r--r--linux-x86/share/swig/java/std_string_view.i138
-rw-r--r--linux-x86/share/swig/java/std_unique_ptr.i41
-rw-r--r--linux-x86/share/swig/java/std_unordered_map.i4
-rw-r--r--linux-x86/share/swig/java/std_unordered_set.i4
-rw-r--r--linux-x86/share/swig/java/std_vector.i22
-rw-r--r--linux-x86/share/swig/java/std_wstring.i26
-rw-r--r--linux-x86/share/swig/java/swiginterface.i4
-rw-r--r--linux-x86/share/swig/java/swigmove.i16
-rw-r--r--linux-x86/share/swig/java/typemaps.i20
-rw-r--r--linux-x86/share/swig/javascript/jsc/argcargv.i67
-rw-r--r--linux-x86/share/swig/javascript/jsc/arrays_javascript.i87
-rw-r--r--linux-x86/share/swig/javascript/jsc/ccomplex.i13
-rw-r--r--linux-x86/share/swig/javascript/jsc/cmalloc.i1
-rw-r--r--linux-x86/share/swig/javascript/jsc/factory.i1
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascriptcode.swg43
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascriptcomplex.swg2
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascripthelpers.swg2
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascriptinit.swg57
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascriptkw.swg40
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascriptrun.swg84
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascriptruntime.swg1
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascriptstrings.swg2
-rw-r--r--linux-x86/share/swig/javascript/jsc/javascripttypemaps.swg2
-rw-r--r--linux-x86/share/swig/javascript/jsc/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/javascript/jsc/std_map.i17
-rw-r--r--linux-x86/share/swig/javascript/jsc/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/javascript/jsc/swigmove.i1
-rw-r--r--linux-x86/share/swig/javascript/jsc/typemaps.i8
-rw-r--r--linux-x86/share/swig/javascript/napi/argcargv.i66
-rw-r--r--linux-x86/share/swig/javascript/napi/arrays_javascript.i88
-rw-r--r--linux-x86/share/swig/javascript/napi/ccomplex.i27
-rw-r--r--linux-x86/share/swig/javascript/napi/cdata.i1
-rw-r--r--linux-x86/share/swig/javascript/napi/cmalloc.i1
-rw-r--r--linux-x86/share/swig/javascript/napi/complex.i6
-rw-r--r--linux-x86/share/swig/javascript/napi/exception.i1
-rw-r--r--linux-x86/share/swig/javascript/napi/factory.i1
-rw-r--r--linux-x86/share/swig/javascript/napi/javascript.swg17
-rw-r--r--linux-x86/share/swig/javascript/napi/javascriptcode.swg880
-rw-r--r--linux-x86/share/swig/javascript/napi/javascriptcomplex.swg116
-rw-r--r--linux-x86/share/swig/javascript/napi/javascriptfragments.swg23
-rw-r--r--linux-x86/share/swig/javascript/napi/javascriptinit.swg111
-rw-r--r--linux-x86/share/swig/javascript/napi/javascriptprimtypes.swg387
-rw-r--r--linux-x86/share/swig/javascript/napi/javascriptrun.swg446
-rw-r--r--linux-x86/share/swig/javascript/napi/javascriptruntime.swg40
-rw-r--r--linux-x86/share/swig/javascript/napi/javascriptstrings.swg77
-rw-r--r--linux-x86/share/swig/javascript/napi/javascripttypemaps.swg56
-rw-r--r--linux-x86/share/swig/javascript/napi/nodejs_buffer.i47
-rw-r--r--linux-x86/share/swig/javascript/napi/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/javascript/napi/std_common.i5
-rw-r--r--linux-x86/share/swig/javascript/napi/std_complex.i26
-rw-r--r--linux-x86/share/swig/javascript/napi/std_deque.i1
-rw-r--r--linux-x86/share/swig/javascript/napi/std_except.i1
-rw-r--r--linux-x86/share/swig/javascript/napi/std_map.i71
-rw-r--r--linux-x86/share/swig/javascript/napi/std_pair.i35
-rw-r--r--linux-x86/share/swig/javascript/napi/std_string.i1
-rw-r--r--linux-x86/share/swig/javascript/napi/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/javascript/napi/std_vector.i99
-rw-r--r--linux-x86/share/swig/javascript/napi/stl.i (renamed from linux-x86/share/swig/pointer.i)13
-rw-r--r--linux-x86/share/swig/javascript/napi/swigmove.i1
-rw-r--r--linux-x86/share/swig/javascript/napi/typemaps.i144
-rw-r--r--linux-x86/share/swig/javascript/v8/argcargv.i75
-rw-r--r--linux-x86/share/swig/javascript/v8/arrays_javascript.i109
-rw-r--r--linux-x86/share/swig/javascript/v8/ccomplex.i15
-rw-r--r--linux-x86/share/swig/javascript/v8/cmalloc.i1
-rw-r--r--linux-x86/share/swig/javascript/v8/factory.i1
-rw-r--r--linux-x86/share/swig/javascript/v8/javascriptcode.swg157
-rw-r--r--linux-x86/share/swig/javascript/v8/javascriptcomplex.swg40
-rw-r--r--linux-x86/share/swig/javascript/v8/javascripthelpers.swg57
-rw-r--r--linux-x86/share/swig/javascript/v8/javascriptinit.swg43
-rw-r--r--linux-x86/share/swig/javascript/v8/javascriptprimtypes.swg35
-rw-r--r--linux-x86/share/swig/javascript/v8/javascriptrun.swg374
-rw-r--r--linux-x86/share/swig/javascript/v8/javascriptruntime.swg39
-rw-r--r--linux-x86/share/swig/javascript/v8/javascriptstrings.swg12
-rw-r--r--linux-x86/share/swig/javascript/v8/javascripttypemaps.swg4
-rw-r--r--linux-x86/share/swig/javascript/v8/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/javascript/v8/std_map.i17
-rw-r--r--linux-x86/share/swig/javascript/v8/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/javascript/v8/swigmove.i1
-rw-r--r--linux-x86/share/swig/javascript/v8/typemaps.i8
-rw-r--r--linux-x86/share/swig/javascriptkw.swg (renamed from linux-x86/share/swig/javascript/v8/javascriptkw.swg)25
-rw-r--r--linux-x86/share/swig/lua/argcargv.i57
-rw-r--r--linux-x86/share/swig/lua/lua.swg11
-rw-r--r--linux-x86/share/swig/lua/lua_fnptr.i4
-rw-r--r--linux-x86/share/swig/lua/luakw.swg2
-rw-r--r--linux-x86/share/swig/lua/luarun.swg71
-rw-r--r--linux-x86/share/swig/lua/luatypemaps.swg42
-rw-r--r--linux-x86/share/swig/lua/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/lua/std_map.i4
-rw-r--r--linux-x86/share/swig/lua/std_string.i19
-rw-r--r--linux-x86/share/swig/lua/std_string_view.i50
-rw-r--r--linux-x86/share/swig/lua/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/lua/swigmove.i18
-rw-r--r--linux-x86/share/swig/lua/typemaps.i14
-rw-r--r--linux-x86/share/swig/math.i13
-rw-r--r--linux-x86/share/swig/modula3/modula3.swg787
-rw-r--r--linux-x86/share/swig/modula3/modula3head.swg64
-rw-r--r--linux-x86/share/swig/modula3/typemaps.i74
-rw-r--r--linux-x86/share/swig/mzscheme/argcargv.i41
-rw-r--r--linux-x86/share/swig/mzscheme/mzrun.swg68
-rw-r--r--linux-x86/share/swig/mzscheme/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/mzscheme/std_map.i1130
-rw-r--r--linux-x86/share/swig/mzscheme/std_string.i7
-rw-r--r--linux-x86/share/swig/mzscheme/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/mzscheme/std_vector.i3
-rw-r--r--linux-x86/share/swig/mzscheme/swigmove.i19
-rw-r--r--linux-x86/share/swig/mzscheme/typemaps.i45
-rw-r--r--linux-x86/share/swig/ocaml/carray.i2
-rw-r--r--linux-x86/share/swig/ocaml/cstring.i18
-rw-r--r--linux-x86/share/swig/ocaml/director.swg6
-rw-r--r--linux-x86/share/swig/ocaml/ocaml.swg29
-rw-r--r--linux-x86/share/swig/ocaml/ocamlrun.swg272
-rw-r--r--linux-x86/share/swig/ocaml/ocamlrundec.swg147
-rw-r--r--linux-x86/share/swig/ocaml/std_common.i4
-rw-r--r--linux-x86/share/swig/ocaml/std_map.i17
-rw-r--r--linux-x86/share/swig/ocaml/std_string.i58
-rw-r--r--linux-x86/share/swig/ocaml/swigmove.i11
-rw-r--r--linux-x86/share/swig/ocaml/typecheck.i34
-rw-r--r--linux-x86/share/swig/octave/argcargv.i52
-rw-r--r--linux-x86/share/swig/octave/boost_shared_ptr.i6
-rw-r--r--linux-x86/share/swig/octave/director.swg2
-rw-r--r--linux-x86/share/swig/octave/extra-install.list2
-rw-r--r--linux-x86/share/swig/octave/octcomplex.swg4
-rw-r--r--linux-x86/share/swig/octave/octcontainer.swg42
-rw-r--r--linux-x86/share/swig/octave/octheaders.hpp130
-rw-r--r--linux-x86/share/swig/octave/octrun.swg236
-rw-r--r--linux-x86/share/swig/octave/octruntime.swg165
-rw-r--r--linux-x86/share/swig/octave/octtypemaps.swg11
-rw-r--r--linux-x86/share/swig/octave/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/octave/std_carray.i0
-rw-r--r--linux-x86/share/swig/octave/std_complex.i4
-rw-r--r--linux-x86/share/swig/octave/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/octave/swigmove.i1
-rw-r--r--linux-x86/share/swig/perl5/argcargv.i30
-rw-r--r--linux-x86/share/swig/perl5/carrays.i1
-rw-r--r--linux-x86/share/swig/perl5/perlhead.swg40
-rw-r--r--linux-x86/share/swig/perl5/perlinit.swg4
-rw-r--r--linux-x86/share/swig/perl5/perlmain.i33
-rw-r--r--linux-x86/share/swig/perl5/perlprimtypes.swg6
-rw-r--r--linux-x86/share/swig/perl5/perlrun.swg81
-rw-r--r--linux-x86/share/swig/perl5/perlstrings.swg2
-rw-r--r--linux-x86/share/swig/perl5/perltypemaps.swg6
-rw-r--r--linux-x86/share/swig/perl5/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/perl5/std_list.i16
-rw-r--r--linux-x86/share/swig/perl5/std_map.i17
-rw-r--r--linux-x86/share/swig/perl5/std_string_view.i2
-rw-r--r--linux-x86/share/swig/perl5/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/perl5/std_vector.i24
-rw-r--r--linux-x86/share/swig/perl5/swigmove.i1
-rw-r--r--linux-x86/share/swig/perl5/typemaps.i4
-rw-r--r--linux-x86/share/swig/php/argcargv.i38
-rw-r--r--linux-x86/share/swig/php/const.i68
-rw-r--r--linux-x86/share/swig/php/director.swg48
-rw-r--r--linux-x86/share/swig/php/factory.i70
-rw-r--r--linux-x86/share/swig/php/globalvar.i293
-rw-r--r--linux-x86/share/swig/php/php.swg342
-rw-r--r--linux-x86/share/swig/php/phpinit.swg19
-rw-r--r--linux-x86/share/swig/php/phpinterfaces.i60
-rw-r--r--linux-x86/share/swig/php/phpkw.swg60
-rw-r--r--linux-x86/share/swig/php/phppointers.i48
-rw-r--r--linux-x86/share/swig/php/phprun.swg271
-rw-r--r--linux-x86/share/swig/php/std_auto_ptr.i41
-rw-r--r--linux-x86/share/swig/php/std_common.i1
-rw-r--r--linux-x86/share/swig/php/std_map.i19
-rw-r--r--linux-x86/share/swig/php/std_string.i75
-rw-r--r--linux-x86/share/swig/php/std_string_view.i69
-rw-r--r--linux-x86/share/swig/php/std_unique_ptr.i41
-rw-r--r--linux-x86/share/swig/php/std_vector.i2
-rw-r--r--linux-x86/share/swig/php/stl.i1
-rw-r--r--linux-x86/share/swig/php/swigmove.i24
-rw-r--r--linux-x86/share/swig/php/typemaps.i60
-rw-r--r--linux-x86/share/swig/php/utils.i33
-rw-r--r--linux-x86/share/swig/pike/pike.swg326
-rw-r--r--linux-x86/share/swig/pike/pikekw.swg55
-rw-r--r--linux-x86/share/swig/pike/pikerun.swg71
-rw-r--r--linux-x86/share/swig/pike/std_string.i60
-rw-r--r--linux-x86/share/swig/python/README1
-rw-r--r--linux-x86/share/swig/python/argcargv.i17
-rw-r--r--linux-x86/share/swig/python/boost_shared_ptr.i6
-rw-r--r--linux-x86/share/swig/python/builtin.swg52
-rw-r--r--linux-x86/share/swig/python/carrays.i4
-rw-r--r--linux-x86/share/swig/python/ccomplex.i13
-rw-r--r--linux-x86/share/swig/python/defarg.swg37
-rw-r--r--linux-x86/share/swig/python/director.swg112
-rw-r--r--linux-x86/share/swig/python/embed.i47
-rw-r--r--linux-x86/share/swig/python/pyabc.i20
-rw-r--r--linux-x86/share/swig/python/pybuffer.i108
-rw-r--r--linux-x86/share/swig/python/pyclasses.swg4
-rw-r--r--linux-x86/share/swig/python/pycomplex.swg2
-rw-r--r--linux-x86/share/swig/python/pycontainer.swg352
-rw-r--r--linux-x86/share/swig/python/pydocs.swg48
-rw-r--r--linux-x86/share/swig/python/pyerrors.swg13
-rw-r--r--linux-x86/share/swig/python/pyhead.swg68
-rw-r--r--linux-x86/share/swig/python/pyinit.swg245
-rw-r--r--linux-x86/share/swig/python/pyname_compat.i7
-rw-r--r--linux-x86/share/swig/python/pyprimtypes.swg13
-rw-r--r--linux-x86/share/swig/python/pyrun.swg695
-rw-r--r--linux-x86/share/swig/python/pyruntime.swg24
-rw-r--r--linux-x86/share/swig/python/pystdcommon.swg17
-rw-r--r--linux-x86/share/swig/python/pystrings.swg60
-rw-r--r--linux-x86/share/swig/python/pythonkw.swg2
-rw-r--r--linux-x86/share/swig/python/pythreads.swg10
-rw-r--r--linux-x86/share/swig/python/pytypemaps.swg2
-rw-r--r--linux-x86/share/swig/python/std_array.i46
-rw-r--r--linux-x86/share/swig/python/std_auto_ptr.i44
-rw-r--r--linux-x86/share/swig/python/std_carray.i54
-rw-r--r--linux-x86/share/swig/python/std_filesystem.i121
-rw-r--r--linux-x86/share/swig/python/std_map.i18
-rw-r--r--linux-x86/share/swig/python/std_multimap.i12
-rw-r--r--linux-x86/share/swig/python/std_multiset.i11
-rw-r--r--linux-x86/share/swig/python/std_pair.i4
-rw-r--r--linux-x86/share/swig/python/std_set.i11
-rw-r--r--linux-x86/share/swig/python/std_string_view.i135
-rw-r--r--linux-x86/share/swig/python/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/python/std_unordered_map.i16
-rw-r--r--linux-x86/share/swig/python/std_unordered_multimap.i12
-rw-r--r--linux-x86/share/swig/python/std_unordered_multiset.i11
-rw-r--r--linux-x86/share/swig/python/std_unordered_set.i11
-rw-r--r--linux-x86/share/swig/python/swigmove.i1
-rw-r--r--linux-x86/share/swig/python/typemaps.i6
-rw-r--r--linux-x86/share/swig/r/argcargv.i38
-rw-r--r--linux-x86/share/swig/r/boost_shared_ptr.i31
-rw-r--r--linux-x86/share/swig/r/r.swg12
-rw-r--r--linux-x86/share/swig/r/rcontainer.swg18
-rw-r--r--linux-x86/share/swig/r/rfragments.swg4
-rw-r--r--linux-x86/share/swig/r/rkw.swg4
-rw-r--r--linux-x86/share/swig/r/rrun.swg61
-rw-r--r--linux-x86/share/swig/r/rtype.swg92
-rw-r--r--linux-x86/share/swig/r/std_vector.i56
-rw-r--r--linux-x86/share/swig/r/swigmove.i1
-rw-r--r--linux-x86/share/swig/ruby/argcargv.i22
-rw-r--r--linux-x86/share/swig/ruby/boost_shared_ptr.i6
-rw-r--r--linux-x86/share/swig/ruby/carrays.i1
-rw-r--r--linux-x86/share/swig/ruby/progargcargv.i2
-rw-r--r--linux-x86/share/swig/ruby/ruby.swg2
-rw-r--r--linux-x86/share/swig/ruby/rubyautodoc.swg4
-rw-r--r--linux-x86/share/swig/ruby/rubyclasses.swg18
-rw-r--r--linux-x86/share/swig/ruby/rubycomplex.swg6
-rw-r--r--linux-x86/share/swig/ruby/rubycontainer.swg53
-rw-r--r--linux-x86/share/swig/ruby/rubyerrors.swg2
-rw-r--r--linux-x86/share/swig/ruby/rubyhead.swg76
-rw-r--r--linux-x86/share/swig/ruby/rubykw.swg2
-rw-r--r--linux-x86/share/swig/ruby/rubyprimtypes.swg19
-rw-r--r--linux-x86/share/swig/ruby/rubyrun.swg32
-rw-r--r--linux-x86/share/swig/ruby/rubytracking.swg14
-rw-r--r--linux-x86/share/swig/ruby/std_array.i2
-rw-r--r--linux-x86/share/swig/ruby/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/ruby/std_map.i6
-rw-r--r--linux-x86/share/swig/ruby/std_multimap.i2
-rw-r--r--linux-x86/share/swig/ruby/std_set.i7
-rw-r--r--linux-x86/share/swig/ruby/std_shared_ptr.i37
-rw-r--r--linux-x86/share/swig/ruby/std_string_view.i6
-rw-r--r--linux-x86/share/swig/ruby/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/ruby/std_unordered_map.i2
-rw-r--r--linux-x86/share/swig/ruby/std_unordered_multimap.i2
-rw-r--r--linux-x86/share/swig/ruby/std_wstring.i15
-rw-r--r--linux-x86/share/swig/ruby/swigmove.i1
-rw-r--r--linux-x86/share/swig/ruby/timeval.i2
-rw-r--r--linux-x86/share/swig/ruby/typemaps.i10
-rw-r--r--linux-x86/share/swig/scilab/argcargv.i109
-rw-r--r--linux-x86/share/swig/scilab/boost_shared_ptr.i6
-rw-r--r--linux-x86/share/swig/scilab/sciarray.swg4
-rw-r--r--linux-x86/share/swig/scilab/scidouble.swg14
-rw-r--r--linux-x86/share/swig/scilab/scienum.swg2
-rw-r--r--linux-x86/share/swig/scilab/sciexception.swg9
-rw-r--r--linux-x86/share/swig/scilab/sciint.swg5
-rw-r--r--linux-x86/share/swig/scilab/scimatrixdouble.swg12
-rw-r--r--linux-x86/share/swig/scilab/scimatrixint.swg12
-rw-r--r--linux-x86/share/swig/scilab/scirun.swg43
-rw-r--r--linux-x86/share/swig/scilab/sciruntime.swg2
-rw-r--r--linux-x86/share/swig/scilab/std_map.i17
-rw-r--r--linux-x86/share/swig/scilab/std_string.i8
-rw-r--r--linux-x86/share/swig/scilab/swigmove.i1
-rw-r--r--linux-x86/share/swig/shared_ptr.i12
-rw-r--r--linux-x86/share/swig/std/std_basic_string.i11
-rw-r--r--linux-x86/share/swig/std/std_carray.swg64
-rw-r--r--linux-x86/share/swig/std/std_iostream.i12
-rw-r--r--linux-x86/share/swig/swig.swg119
-rw-r--r--linux-x86/share/swig/swigarch.i49
-rw-r--r--linux-x86/share/swig/swigcompat.swg23
-rw-r--r--linux-x86/share/swig/swigerrors.swg3
-rw-r--r--linux-x86/share/swig/swigfragments.swg47
-rw-r--r--linux-x86/share/swig/swiginit.swg5
-rw-r--r--linux-x86/share/swig/swiglabels.swg6
-rw-r--r--linux-x86/share/swig/swigrun.swg22
-rw-r--r--linux-x86/share/swig/swigwarn.swg110
-rw-r--r--linux-x86/share/swig/swigwarnings.swg4
-rw-r--r--linux-x86/share/swig/tcl/Makefile.in2
-rw-r--r--linux-x86/share/swig/tcl/argcargv.i27
-rw-r--r--linux-x86/share/swig/tcl/carrays.i3
-rw-r--r--linux-x86/share/swig/tcl/mactkinit.c233
-rw-r--r--linux-x86/share/swig/tcl/std_auto_ptr.i39
-rw-r--r--linux-x86/share/swig/tcl/std_map.i17
-rw-r--r--linux-x86/share/swig/tcl/std_string_view.i2
-rw-r--r--linux-x86/share/swig/tcl/std_unique_ptr.i39
-rw-r--r--linux-x86/share/swig/tcl/std_vector.i85
-rw-r--r--linux-x86/share/swig/tcl/swigmove.i1
-rw-r--r--linux-x86/share/swig/tcl/tclapi.swg6
-rw-r--r--linux-x86/share/swig/tcl/tclerrors.swg6
-rw-r--r--linux-x86/share/swig/tcl/tclinit.swg5
-rw-r--r--linux-x86/share/swig/tcl/tclprimtypes.swg37
-rw-r--r--linux-x86/share/swig/tcl/tclrun.swg103
-rw-r--r--linux-x86/share/swig/tcl/tclruntime.swg16
-rw-r--r--linux-x86/share/swig/tcl/tclsh.i55
-rw-r--r--linux-x86/share/swig/tcl/tclstrings.swg4
-rw-r--r--linux-x86/share/swig/tcl/tcltypemaps.swg5
-rw-r--r--linux-x86/share/swig/tcl/tclwstrings.swg15
-rw-r--r--linux-x86/share/swig/tcl/typemaps.i8
-rw-r--r--linux-x86/share/swig/tcl/wish.i70
-rw-r--r--linux-x86/share/swig/typemaps/attribute.swg138
-rw-r--r--linux-x86/share/swig/typemaps/carrays.swg12
-rw-r--r--linux-x86/share/swig/typemaps/cpointer.swg8
-rw-r--r--linux-x86/share/swig/typemaps/cstrings.swg22
-rw-r--r--linux-x86/share/swig/typemaps/enumint.swg2
-rw-r--r--linux-x86/share/swig/typemaps/exception.swg3
-rw-r--r--linux-x86/share/swig/typemaps/fragments.swg4
-rw-r--r--linux-x86/share/swig/typemaps/implicit.swg2
-rw-r--r--linux-x86/share/swig/typemaps/inoutlist.swg4
-rw-r--r--linux-x86/share/swig/typemaps/primtypes.swg8
-rw-r--r--linux-x86/share/swig/typemaps/ptrtypes.swg26
-rw-r--r--linux-x86/share/swig/typemaps/std_string_view.swg16
-rw-r--r--linux-x86/share/swig/typemaps/std_strings.swg25
-rw-r--r--linux-x86/share/swig/typemaps/string.swg1
-rw-r--r--linux-x86/share/swig/typemaps/strings.swg23
-rw-r--r--linux-x86/share/swig/typemaps/swigmacros.swg10
-rw-r--r--linux-x86/share/swig/typemaps/swigmove.swg19
-rw-r--r--linux-x86/share/swig/typemaps/swigobject.swg6
-rw-r--r--linux-x86/share/swig/typemaps/swigtype.swg111
-rw-r--r--linux-x86/share/swig/typemaps/swigtypemaps.swg1
-rw-r--r--linux-x86/share/swig/typemaps/typemaps.swg4
-rw-r--r--linux-x86/share/swig/typemaps/valtypes.swg7
-rw-r--r--linux-x86/share/swig/typemaps/void.swg4
-rw-r--r--linux-x86/share/swig/typemaps/wstring.swg1
-rw-r--r--linux-x86/share/swig/uffi/uffi.swg101
-rw-r--r--manifest.xml80
455 files changed, 12011 insertions, 13164 deletions
diff --git a/linux-x86/bin/avbtool b/linux-x86/bin/avbtool
index 55f75aa..8dff617 100755
--- a/linux-x86/bin/avbtool
+++ b/linux-x86/bin/avbtool
Binary files differ
diff --git a/linux-x86/bin/build_image b/linux-x86/bin/build_image
index 59cb722..e0f597b 100755
--- a/linux-x86/bin/build_image
+++ b/linux-x86/bin/build_image
Binary files differ
diff --git a/linux-x86/bin/build_super_image b/linux-x86/bin/build_super_image
index 92a7339..9b1f1e3 100755
--- a/linux-x86/bin/build_super_image
+++ b/linux-x86/bin/build_super_image
Binary files differ
diff --git a/linux-x86/bin/dtc b/linux-x86/bin/dtc
index 9c45f09..4713070 100755
--- a/linux-x86/bin/dtc
+++ b/linux-x86/bin/dtc
Binary files differ
diff --git a/linux-x86/bin/e2fsdroid b/linux-x86/bin/e2fsdroid
index ca1e498..cee5a9b 100755
--- a/linux-x86/bin/e2fsdroid
+++ b/linux-x86/bin/e2fsdroid
Binary files differ
diff --git a/linux-x86/bin/external_updater b/linux-x86/bin/external_updater
index 7209cbf..44b6cb3 100755
--- a/linux-x86/bin/external_updater
+++ b/linux-x86/bin/external_updater
Binary files differ
diff --git a/linux-x86/bin/lpmake b/linux-x86/bin/lpmake
index caba95f..1263427 100755
--- a/linux-x86/bin/lpmake
+++ b/linux-x86/bin/lpmake
Binary files differ
diff --git a/linux-x86/bin/mkbootfs b/linux-x86/bin/mkbootfs
index e979c31..0fc1c10 100755
--- a/linux-x86/bin/mkbootfs
+++ b/linux-x86/bin/mkbootfs
Binary files differ
diff --git a/linux-x86/bin/mkfs.erofs b/linux-x86/bin/mkfs.erofs
index a83fa9f..916494d 100755
--- a/linux-x86/bin/mkfs.erofs
+++ b/linux-x86/bin/mkfs.erofs
Binary files differ
diff --git a/linux-x86/bin/pahole b/linux-x86/bin/pahole
index 8535550..50bb7bc 100755
--- a/linux-x86/bin/pahole
+++ b/linux-x86/bin/pahole
Binary files differ
diff --git a/linux-x86/bin/soong_zip b/linux-x86/bin/soong_zip
index 0668932..4aba75d 100755
--- a/linux-x86/bin/soong_zip
+++ b/linux-x86/bin/soong_zip
Binary files differ
diff --git a/linux-x86/bin/stg b/linux-x86/bin/stg
index fff5f29..04fe69c 100755
--- a/linux-x86/bin/stg
+++ b/linux-x86/bin/stg
Binary files differ
diff --git a/linux-x86/bin/stgdiff b/linux-x86/bin/stgdiff
index 9cddb74..151dcbc 100755
--- a/linux-x86/bin/stgdiff
+++ b/linux-x86/bin/stgdiff
Binary files differ
diff --git a/linux-x86/bin/swig b/linux-x86/bin/swig
index 30f755f..dfa502a 100755
--- a/linux-x86/bin/swig
+++ b/linux-x86/bin/swig
Binary files differ
diff --git a/linux-x86/bin/ufdt_apply_overlay b/linux-x86/bin/ufdt_apply_overlay
index 7eb7af4..ac27420 100755
--- a/linux-x86/bin/ufdt_apply_overlay
+++ b/linux-x86/bin/ufdt_apply_overlay
Binary files differ
diff --git a/linux-x86/lib64/libbase.so b/linux-x86/lib64/libbase.so
index adf5698..17aaf8c 100755
--- a/linux-x86/lib64/libbase.so
+++ b/linux-x86/lib64/libbase.so
Binary files differ
diff --git a/linux-x86/lib64/libcutils.so b/linux-x86/lib64/libcutils.so
index 44bdeae..ab58641 100755
--- a/linux-x86/lib64/libcutils.so
+++ b/linux-x86/lib64/libcutils.so
Binary files differ
diff --git a/linux-x86/lib64/libelf.so b/linux-x86/lib64/libelf.so
index 524ec42..348d2f0 100755
--- a/linux-x86/lib64/libelf.so
+++ b/linux-x86/lib64/libelf.so
Binary files differ
diff --git a/linux-x86/lib64/libfdt.so b/linux-x86/lib64/libfdt.so
index 8a5e0b8..d289e74 100755
--- a/linux-x86/lib64/libfdt.so
+++ b/linux-x86/lib64/libfdt.so
Binary files differ
diff --git a/linux-x86/lib64/libicui18n-host.so b/linux-x86/lib64/libicui18n-host.so
index da5272a..864cd42 100755
--- a/linux-x86/lib64/libicui18n-host.so
+++ b/linux-x86/lib64/libicui18n-host.so
Binary files differ
diff --git a/linux-x86/lib64/libicuuc-host.so b/linux-x86/lib64/libicuuc-host.so
index 31501c7..6dfabc3 100755
--- a/linux-x86/lib64/libicuuc-host.so
+++ b/linux-x86/lib64/libicuuc-host.so
Binary files differ
diff --git a/linux-x86/lib64/libsqlite.so b/linux-x86/lib64/libsqlite.so
index b28003e..fc3b7c8 100755
--- a/linux-x86/lib64/libsqlite.so
+++ b/linux-x86/lib64/libsqlite.so
Binary files differ
diff --git a/linux-x86/share/swig/allegrocl/allegrocl.swg b/linux-x86/share/swig/allegrocl/allegrocl.swg
deleted file mode 100644
index 524aa7c..0000000
--- a/linux-x86/share/swig/allegrocl/allegrocl.swg
+++ /dev/null
@@ -1,615 +0,0 @@
-/* Define a C preprocessor symbol that can be used in interface files
- to distinguish between the SWIG language modules. */
-
-#define SWIG_ALLEGRO_CL
-
-#define %ffargs(...) %feature("ffargs", "1", ##__VA_ARGS__)
-%ffargs(strings_convert="t");
-
-/* typemaps for argument and result type conversions. */
-%typemap(lin,numinputs=1) SWIGTYPE "(cl::let (($out $in))\n $body)";
-
-%typemap(lout) bool, char, unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- float, double, long double, char *, void *,
- enum SWIGTYPE "(cl::setq ACL_ffresult $body)";
-%typemap(lout) void "$body";
-#ifdef __cplusplus
-%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
-%{ (cl:let* ((address $body)
- (new-inst (cl:make-instance '$lclass :foreign-address address)))
- (cl:when (cl:and $owner (cl:not (cl:zerop address)))
- (excl:schedule-finalization new-inst #'$ldestructor))
- (cl:setq ACL_ffresult new-inst)) %}
-
-%typemap(lout) SWIGTYPE "(cl::let* ((address $body)\n (new-inst (cl::make-instance '$lclass :foreign-address address)))\n (cl::unless (cl::zerop address)\n (excl:schedule-finalization new-inst #'$ldestructor))\n (cl::setq ACL_ffresult new-inst))";
-#else
-%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE
-%{ (cl:let* ((address $body)
- (new-inst (cl:make-instance '$lclass :foreign-address address)))
- (cl:setq ACL_ffresult new-inst)) %}
-#endif
-
-%typemap(lisptype) bool, const bool "cl:boolean";
-%typemap(lisptype) char, const char "cl:character";
-%typemap(lisptype) unsigned char, const unsigned char "cl:integer";
-%typemap(lisptype) signed char, const signed char "cl:integer";
-
-%typemap(ffitype) bool, const bool ":int";
-%typemap(ffitype) char, const char,
- signed char, const signed char ":char";
-%typemap(ffitype) unsigned char, const unsigned char ":unsigned-char";
-%typemap(ffitype) short, const short,
- signed short, const signed short ":short";
-%typemap(ffitype) unsigned short, const unsigned short ":unsigned-short";
-%typemap(ffitype) int, const int, signed int, const signed int ":int";
-%typemap(ffitype) unsigned int, const unsigned int ":unsigned-int";
-%typemap(ffitype) long, const long, signed long, const signed long ":long";
-%typemap(ffitype) unsigned long, const unsigned long ":unsigned-long";
-%typemap(ffitype) float, const float ":float";
-%typemap(ffitype) double, const double ":double";
-%typemap(ffitype) char *, const char *, signed char *,
- const signed char *, signed char &,
- const signed char & "(* :char)";
-%typemap(ffitype) unsigned char *, const unsigned char *,
- unsigned char &, const unsigned char & "(* :unsigned-char)";
-%typemap(ffitype) short *, const short *, short &,
- const short & "(* :short)";
-%typemap(ffitype) unsigned short *, const unsigned short *,
- unsigned short &, const unsigned short & "(* :unsigned-short)";
-%typemap(ffitype) int *, const int *, int &, const int & "(* :int)";
-%typemap(ffitype) unsigned int *, const unsigned int *,
- unsigned int &, const unsigned int & "(* :unsigned-int)";
-%typemap(ffitype) void * "(* :void)";
-%typemap(ffitype) void ":void";
-%typemap(ffitype) enum SWIGTYPE ":int";
-%typemap(ffitype) SWIGTYPE & "(* :void)";
-%typemap(ffitype) SWIGTYPE && "(* :void)";
-
-/* const typemaps
-idea: marshall all primitive c types to their respective lisp types
-to maintain const corretness. For pointers/references, all bets
-are off if you try to modify them.
-
-idea: add a constant-p slot to the base foreign-pointer class. For
-constant pointer/references check this value when setting (around method?)
-and error if a setf operation is performed on the address of this object.
-
-*/
-
-/*
-%exception %{
- try {
- $action
- } catch (...) {
- return $null;
- }
-%}
-
-*/
-
-// %typemap(throws) SWIGTYPE {
-// (void)$1;
-// SWIG_fail;
-// }
-
-%typemap(ctype) bool, const bool "int";
-%typemap(ctype) char, unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- float, double, long double, char *, void *, void,
- enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[],
- SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE &&, const SWIGTYPE "$1_ltype";
-%typemap(ctype) SWIGTYPE "$&1_type";
-
-%typemap(in) bool "$1 = (bool)$input;";
-%typemap(in) char, unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- float, double, long double, char *, void *, void,
- enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[],
- SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;";
-%typemap(in) SWIGTYPE "$1 = *$input;";
-
-/* We don't need to do any actual C-side typechecking, but need to
- use the precedence values to choose which overloaded function
- interfaces to generate when conflicts arise. */
-
-/* predefined precedence values
-
-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
-*/
-
-%typecheck(SWIG_TYPECHECK_BOOL) bool { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_CHAR) char { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_FLOAT) float { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_DOUBLE) double { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_STRING) char * { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_INTEGER)
- unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- enum SWIGTYPE { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&,
- SWIGTYPE[], SWIGTYPE[ANY],
- SWIGTYPE { $1 = 1; };
-
-/* This maps C/C++ types to Lisp classes for overload dispatch */
-
-%typemap(lispclass) bool "t";
-%typemap(lispclass) char "cl:character";
-%typemap(lispclass) unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- enum SWIGTYPE "cl:integer";
-%typemap(lispclass) float "cl:single-float";
-%typemap(lispclass) double "cl:double-float";
-%typemap(lispclass) char * "cl:string";
-
-%typemap(out) void "";
-%typemap(out) bool "$result = (int)$1;";
-%typemap(out) char, unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- float, double, long double, char *, void *,
- enum SWIGTYPE, SWIGTYPE *,
- SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;";
-#ifdef __cplusplus
-%typemap(out) SWIGTYPE "$result = new $1_ltype($1);";
-#else
-%typemap(out) SWIGTYPE {
- $result = ($&1_ltype) malloc(sizeof($1_type));
- memmove($result, &$1, sizeof($1_type));
-}
-#endif
-
-//////////////////////////////////////////////////////////////
-// UCS-2 string conversion
-
-// should this be SWIG_TYPECHECK_CHAR?
-%typecheck(SWIG_TYPECHECK_UNICHAR) wchar_t { $1 = 1; };
-
-%typemap(in) wchar_t "$1 = $input;";
-%typemap(lin,numinputs=1) wchar_t "(cl::let (($out (cl:char-code $in)))\n $body)";
-%typemap(lin,numinputs=1) wchar_t * "(excl:with-native-string ($out $in
-:external-format #+little-endian :fat-le #-little-endian :fat)\n
-$body)"
-
-%typemap(out) wchar_t "$result = $1;";
-%typemap(lout) wchar_t "(cl::setq ACL_ffresult (cl::code-char $body))";
-%typemap(lout) wchar_t * "(cl::setq ACL_ffresult (excl:native-to-string $body
-:external-format #+little-endian :fat-le #-little-endian :fat))";
-
-%typemap(ffitype) wchar_t ":unsigned-short";
-%typemap(lisptype) wchar_t "";
-%typemap(ctype) wchar_t "wchar_t";
-%typemap(lispclass) wchar_t "cl:character";
-%typemap(lispclass) wchar_t * "cl:string";
-//////////////////////////////////////////////////////////////
-
-/* Array reference typemaps */
-%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
-
-/* const pointers */
-%apply SWIGTYPE * { SWIGTYPE *const }
-%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
-%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
-
-/* name conversion for overloaded operators. */
-#ifdef __cplusplus
-%rename(__add__) *::operator+;
-%rename(__pos__) *::operator+();
-%rename(__pos__) *::operator+() const;
-
-%rename(__sub__) *::operator-;
-%rename(__neg__) *::operator-() const;
-%rename(__neg__) *::operator-();
-
-%rename(__mul__) *::operator*;
-%rename(__deref__) *::operator*();
-%rename(__deref__) *::operator*() const;
-
-%rename(__div__) *::operator/;
-%rename(__mod__) *::operator%;
-%rename(__logxor__) *::operator^;
-%rename(__logand__) *::operator&;
-%rename(__logior__) *::operator|;
-%rename(__lognot__) *::operator~();
-%rename(__lognot__) *::operator~() const;
-
-%rename(__not__) *::operator!();
-%rename(__not__) *::operator!() const;
-
-%rename(__assign__) *::operator=;
-
-%rename(__add_assign__) *::operator+=;
-%rename(__sub_assign__) *::operator-=;
-%rename(__mul_assign__) *::operator*=;
-%rename(__div_assign__) *::operator/=;
-%rename(__mod_assign__) *::operator%=;
-%rename(__logxor_assign__) *::operator^=;
-%rename(__logand_assign__) *::operator&=;
-%rename(__logior_assign__) *::operator|=;
-
-%rename(__lshift__) *::operator<<;
-%rename(__lshift_assign__) *::operator<<=;
-%rename(__rshift__) *::operator>>;
-%rename(__rshift_assign__) *::operator>>=;
-
-%rename(__eq__) *::operator==;
-%rename(__ne__) *::operator!=;
-%rename(__lt__) *::operator<;
-%rename(__gt__) *::operator>;
-%rename(__lte__) *::operator<=;
-%rename(__gte__) *::operator>=;
-
-%rename(__and__) *::operator&&;
-%rename(__or__) *::operator||;
-
-%rename(__preincr__) *::operator++();
-%rename(__postincr__) *::operator++(int);
-%rename(__predecr__) *::operator--();
-%rename(__postdecr__) *::operator--(int);
-
-%rename(__comma__) *::operator,();
-%rename(__comma__) *::operator,() const;
-
-%rename(__member_ref__) *::operator->;
-%rename(__member_func_ref__) *::operator->*;
-
-%rename(__funcall__) *::operator();
-%rename(__aref__) *::operator[];
-
-%rename(__bool__) *::operator bool();
-%rename(__bool__) *::operator bool() const;
-#endif
-
-%insert("lisphead") %{
-(eval-when (:compile-toplevel :load-toplevel :execute)
-
- ;; avoid compiling ef-templates at runtime
- (excl:find-external-format :fat)
- (excl:find-external-format :fat-le)
-
-;;; You can define your own identifier converter if you want.
-;;; Use the -identifier-converter command line argument to
-;;; specify its name.
-
-(eval-when (:compile-toplevel :load-toplevel :execute)
- (cl::defparameter *swig-export-list* nil))
-
-(cl::defconstant *void* :..void..)
-
-;; parsers to aid in finding SWIG definitions in files.
-(cl::defun scm-p1 (form)
- (let* ((info (cl::second form))
- (id (car info))
- (id-args (if (eq (cl::car form) 'swig-dispatcher)
- (cl::cdr info)
- (cl::cddr info))))
- (cl::apply *swig-identifier-converter* id
- (cl::progn (cl::when (cl::eq (cl::car form) 'swig-dispatcher)
- (cl::remf id-args :arities))
- id-args))))
-
-(cl::defmacro defswig1 (name (&rest args) &body body)
- `(cl::progn (cl::defmacro ,name ,args
- ,@body)
- (excl::define-simple-parser ,name scm-p1)) )
-
-(cl::defmacro defswig2 (name (&rest args) &body body)
- `(cl::progn (cl::defmacro ,name ,args
- ,@body)
- (excl::define-simple-parser ,name second)))
-
-(defun read-symbol-from-string (string)
- (cl::multiple-value-bind (result position)
- (cl::read-from-string string nil "eof" :preserve-whitespace t)
- (cl::if (cl::and (cl::symbolp result)
- (cl::eql position (cl::length string)))
- result
- (cl::multiple-value-bind (sym)
- (cl::intern string)
- sym))))
-
-(cl::defun full-name (id type arity class)
- ; We need some kind of a hack here to handle template classes
- ; and other synonym types right. We need the original name.
- (let*( (sym (read-symbol-from-string
- (if (eq *swig-identifier-converter* 'identifier-convert-lispify)
- (string-lispify id)
- id)))
- (sym-class (find-class sym nil))
- (id (cond ( (not sym-class)
- id )
- ( (and sym-class
- (not (eq (class-name sym-class)
- sym)))
- (class-name sym-class) )
- ( t
- id ))) )
- (cl::case type
- (:getter (cl::format nil "~@[~A_~]~A" class id))
- (:constructor (cl::format nil "new_~A~@[~A~]" id arity))
- (:destructor (cl::format nil "delete_~A" id))
- (:type (cl::format nil "ff_~A" id))
- (:slot id)
- (:ff-operator (cl::format nil "ffi_~A" id))
- (otherwise (cl::format nil "~@[~A_~]~A~@[~A~]"
- class id arity)))))
-
-(cl::defun identifier-convert-null (id &key type class arity)
- (cl::if (cl::eq type :setter)
- `(cl::setf ,(identifier-convert-null
- id :type :getter :class class :arity arity))
- (read-symbol-from-string (full-name id type arity class))))
-
-(cl::defun string-lispify (str)
- (cl::let ( (cname (excl::replace-regexp str "_" "-"))
- (lastcase :other)
- newcase char res )
- (cl::dotimes (n (cl::length cname))
- (cl::setf char (cl::schar cname n))
- (excl::if* (cl::alpha-char-p char)
- then
- (cl::setf newcase (cl::if (cl::upper-case-p char) :upper :lower))
- (cl::when (cl::and (cl::eq lastcase :lower)
- (cl::eq newcase :upper))
- ;; case change... add a dash
- (cl::push #\- res)
- (cl::setf newcase :other))
- (cl::push (cl::char-downcase char) res)
- (cl::setf lastcase newcase)
- else
- (cl::push char res)
- (cl::setf lastcase :other)))
- (cl::coerce (cl::nreverse res) 'string)))
-
-(cl::defun identifier-convert-lispify (cname &key type class arity)
- (cl::assert (cl::stringp cname))
- (cl::when (cl::eq type :setter)
- (cl::return-from identifier-convert-lispify
- `(cl::setf ,(identifier-convert-lispify
- cname :type :getter :class class :arity arity))))
- (cl::setq cname (full-name cname type arity class))
- (cl::if (cl::eq type :constant)
- (cl::setf cname (cl::format nil "*~A*" cname)))
- (read-symbol-from-string (string-lispify cname)))
-
-(cl::defun id-convert-and-export (name &rest kwargs)
- (cl::multiple-value-bind (symbol package)
- (cl::apply *swig-identifier-converter* name kwargs)
- (cl::let ((args (cl::list (cl::if (cl::consp symbol)
- (cl::cadr symbol) symbol)
- (cl::or package cl::*package*))))
- (cl::apply #'cl::export args)
- (cl::pushnew args *swig-export-list*))
- symbol))
-
-(cl::defmacro swig-insert-id (name namespace &key (type :type) class)
- `(cl::let ((cl::*package* (cl::find-package ,(package-name-for-namespace namespace))))
- (id-convert-and-export ,name :type ,type :class ,class)))
-
-(defswig2 swig-defconstant (string value)
- (cl::let ((symbol (id-convert-and-export string :type :constant)))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (cl::defconstant ,symbol ,value))))
-
-(cl::defun maybe-reorder-args (funcname arglist)
- ;; in the foreign setter function the new value will be the last argument
- ;; in Lisp it needs to be the first
- (cl::if (cl::consp funcname)
- (cl::append (cl::last arglist) (cl::butlast arglist))
- arglist))
-
-(cl::defun maybe-return-value (funcname arglist)
- ;; setf functions should return the new value
- (cl::when (cl::consp funcname)
- `(,(cl::if (cl::consp (cl::car arglist))
- (cl::caar arglist)
- (cl::car arglist)))))
-
-(cl::defun swig-anyvarargs-p (arglist)
- (cl::member :SWIG__varargs_ arglist))
-
-(defswig1 swig-defun ((name &optional (mangled-name name)
- &key (type :operator) class arity)
- arglist kwargs
- &body body)
- (cl::let* ((symbol (id-convert-and-export name :type type
- :arity arity :class class))
- (mangle (excl::if* (cl::string-equal name mangled-name)
- then (id-convert-and-export
- (cl::cond
- ((cl::eq type :setter) (cl::format nil "~A-set" name))
- ((cl::eq type :getter) (cl::format nil "~A-get" name))
- (t name))
- :type :ff-operator :arity arity :class class)
- else (cl::intern mangled-name)))
- (defun-args (maybe-reorder-args
- symbol
- (cl::mapcar #'cl::car (cl::and (cl::not (cl::equal arglist '(:void)))
- (cl::loop as i in arglist
- when (cl::eq (cl::car i) :p+)
- collect (cl::cdr i))))))
- (ffargs (cl::if (cl::equal arglist '(:void))
- arglist
- (cl::mapcar #'cl::cdr arglist)))
- )
- (cl::when (swig-anyvarargs-p ffargs)
- (cl::setq ffargs '()))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (excl::compiler-let ((*record-xref-info* nil))
- (ff:def-foreign-call (,mangle ,mangled-name) ,ffargs ,@kwargs))
- (cl::macrolet ((swig-ff-call (&rest args)
- (cl::cons ',mangle args)))
- (cl::defun ,symbol ,defun-args
- ,@body
- ,@(maybe-return-value symbol defun-args))))))
-
-(defswig1 swig-defmethod ((name &optional (mangled-name name)
- &key (type :operator) class arity)
- ffargs kwargs
- &body body)
- (cl::let* ((symbol (id-convert-and-export name :type type
- :arity arity :class class))
- (mangle (cl::intern mangled-name))
- (defmethod-args (maybe-reorder-args
- symbol
- (cl::unless (cl::equal ffargs '(:void))
- (cl::loop for (lisparg name dispatch) in ffargs
- when (eq lisparg :p+)
- collect `(,name ,dispatch)))))
- (ffargs (cl::if (cl::equal ffargs '(:void))
- ffargs
- (cl::loop for (nil name nil . ffi) in ffargs
- collect `(,name ,@ffi)))))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (excl::compiler-let ((*record-xref-info* nil))
- (ff:def-foreign-call (,mangle ,mangled-name) ,ffargs ,@kwargs))
- (cl::macrolet ((swig-ff-call (&rest args)
- (cl::cons ',mangle args)))
- (cl::defmethod ,symbol ,defmethod-args
- ,@body
- ,@(maybe-return-value symbol defmethod-args))))))
-
-(defswig1 swig-dispatcher ((name &key (type :operator) class arities))
- (cl::let ((symbol (id-convert-and-export name
- :type type :class class)))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (cl::defun ,symbol (&rest args)
- (cl::case (cl::length args)
- ,@(cl::loop for arity in arities
- for symbol-n = (id-convert-and-export name
- :type type :class class :arity arity)
- collect `(,arity (cl::apply #',symbol-n args)))
- (t (cl::error "No applicable wrapper-methods for foreign call ~a with args ~a of classes ~a" ',symbol args (cl::mapcar #'(cl::lambda (x) (cl::class-name (cl::class-of x))) args)))
- )))))
-
-(defswig2 swig-def-foreign-stub (name)
- (cl::let ((lsymbol (id-convert-and-export name :type :class))
- (symbol (id-convert-and-export name :type :type)))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (ff:def-foreign-type ,symbol (:class ))
- (cl::defclass ,lsymbol (ff:foreign-pointer) ()))))
-
-(defswig2 swig-def-foreign-class (name supers &rest rest)
- (cl::let ((lsymbol (id-convert-and-export name :type :class))
- (symbol (id-convert-and-export name :type :type)))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (ff:def-foreign-type ,symbol ,@rest)
- (cl::defclass ,lsymbol ,supers
- ((foreign-type :initform ',symbol :initarg :foreign-type
- :accessor foreign-pointer-type))))))
-
-(defswig2 swig-def-foreign-type (name &rest rest)
- (cl::let ((symbol (id-convert-and-export name :type :type)))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (ff:def-foreign-type ,symbol ,@rest))))
-
-(defswig2 swig-def-synonym-type (synonym of ff-synonym)
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (cl::setf (cl::find-class ',synonym) (cl::find-class ',of))
- (ff:def-foreign-type ,ff-synonym (:struct ))))
-
-(cl::defun package-name-for-namespace (namespace)
- (excl::list-to-delimited-string
- (cl::cons *swig-module-name*
- (cl::mapcar #'(cl::lambda (name)
- (cl::string
- (cl::funcall *swig-identifier-converter*
- name
- :type :namespace)))
- namespace))
- "."))
-
-(cl::defmacro swig-defpackage (namespace)
- (cl::let* ((parent-namespaces (cl::maplist #'cl::reverse (cl::cdr (cl::reverse namespace))))
- (parent-strings (cl::mapcar #'package-name-for-namespace
- parent-namespaces))
- (string (package-name-for-namespace namespace)))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (cl::defpackage ,string
- (:use :swig :ff #+ignore '(:common-lisp :ff :excl)
- ,@parent-strings ,*swig-module-name*)
- (:import-from :cl :* :nil :t)))))
-
-(cl::defmacro swig-in-package (namespace)
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (cl::in-package ,(package-name-for-namespace namespace))))
-
-(defswig2 swig-defvar (name mangled-name &key type (ftype :unsigned-natural))
- (cl::let ((symbol (id-convert-and-export name :type type)))
- `(cl::eval-when (:compile-toplevel :load-toplevel :execute)
- (ff:def-foreign-variable (,symbol ,mangled-name) :type ,ftype))))
-
-) ;; eval-when
-
-(cl::eval-when (:compile-toplevel :execute)
- (cl::flet ((starts-with-p (str prefix)
- (cl::and (cl::>= (cl::length str) (cl::length prefix))
- (cl::string= str prefix :end1 (cl::length prefix)))))
- (cl::export (cl::loop for sym being each present-symbol of cl::*package*
- when (cl::or (starts-with-p (cl::symbol-name sym) (cl::symbol-name :swig-))
- (starts-with-p (cl::symbol-name sym) (cl::symbol-name :identifier-convert-)))
- collect sym))))
-
-%}
-
-typedef void *__SWIGACL_FwdReference;
-
-%{
-
-#ifdef __cplusplus
-# define EXTERN extern "C"
-#else
-# define EXTERN extern
-#endif
-
-#define EXPORT EXTERN SWIGEXPORT
-
-typedef void *__SWIGACL_FwdReference;
-
-#include <string.h>
-#include <stdlib.h>
-%}
diff --git a/linux-x86/share/swig/allegrocl/inout_typemaps.i b/linux-x86/share/swig/allegrocl/inout_typemaps.i
deleted file mode 100644
index d8d61fe..0000000
--- a/linux-x86/share/swig/allegrocl/inout_typemaps.i
+++ /dev/null
@@ -1,111 +0,0 @@
-/* inout_typemaps.i
-
- Support for INPUT, OUTPUT, and INOUT typemaps. OUTPUT variables are returned
- as multiple values.
-
-*/
-
-
-/* Note that this macro automatically adds a pointer to the type passed in.
- As a result, INOUT typemaps for char are for 'char *'. The definition
- of typemaps for 'char' takes advantage of this, believing that it's more
- likely to see an INOUT argument for strings, than a single char. */
-%define INOUT_TYPEMAP(type_, OUTresult_, INbind_)
-// OUTPUT map.
-%typemap(lin,numinputs=0) type_ *OUTPUT, type_ &OUTPUT
-%{(cl::let (($out (ff:allocate-fobject '$*in_fftype :c)))
- $body
- OUTresult_
- (ff:free-fobject $out)) %}
-
-// INPUT map.
-%typemap(in) type_ *INPUT, type_ &INPUT
-%{ $1 = &$input; %}
-
-%typemap(ctype) type_ *INPUT, type_ &INPUT "$*1_ltype";
-
-
-// INOUT map.
-// careful here. the input string is converted to a C string
-// with length equal to the input string. This should be large
-// enough to contain whatever OUTPUT value will be stored in it.
-%typemap(lin,numinputs=1) type_ *INOUT, type_ &INOUT
-%{(cl::let (($out (ff:allocate-fobject '$*in_fftype :c)))
- INbind_
- $body
- OUTresult_
- (ff:free-fobject $out)) %}
-
-%enddef
-
-// $in, $out, $lclass,
-// $in_fftype, $*in_fftype
-
-INOUT_TYPEMAP(int,
- (cl::push (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
-INOUT_TYPEMAP(short,
- (cl::push (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
-INOUT_TYPEMAP(long,
- (cl::push (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
-INOUT_TYPEMAP(unsigned int,
- (cl::push (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
-INOUT_TYPEMAP(unsigned short,
- (cl::push (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
-INOUT_TYPEMAP(unsigned long,
- (cl::push (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
-// char * mapping for passing strings. didn't quite work
-// INOUT_TYPEMAP(char,
-// (cl::push (excl:native-to-string $out) ACL_result),
-// (cl::setf (ff:fslot-value-typed (cl::quote $in_fftype) :c $out)
-// (excl:string-to-native $in)))
-INOUT_TYPEMAP(float,
- (cl::push (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
-INOUT_TYPEMAP(double,
- (cl::push (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
-INOUT_TYPEMAP(bool,
- (cl::push (not (zerop (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out)))
- ACL_result),
- (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) (if $in 1 0)));
-
-%typemap(lisptype) bool *INPUT, bool &INPUT "boolean";
-
-// long long support not yet complete
-// INOUT_TYPEMAP(long long);
-// INOUT_TYPEMAP(unsigned long long);
-
-// char *OUTPUT map.
-// for this to work, swig needs to know how large an array to allocate.
-// you can fake this by
-// %typemap(ffitype) char *myarg "(:array :char 30)";
-// %apply char *OUTPUT { char *myarg };
-%typemap(lin,numinputs=0) char *OUTPUT, char &OUTPUT
-%{(cl::let (($out (ff:allocate-fobject '$*in_fftype :c)))
- $body
- (cl::push (excl:native-to-string $out) ACL_result)
- (ff:free-fobject $out)) %}
-
-// char *INPUT map.
-%typemap(in) char *INPUT, char &INPUT
-%{ $1 = &$input; %}
-%typemap(ctype) char *INPUT, char &INPUT "$*1_ltype";
-
-// char *INOUT map.
-%typemap(lin,numinputs=1) char *INOUT, char &INOUT
-%{(cl::let (($out (excl:string-to-native $in)))
- $body
- (cl::push (excl:native-to-string $out) ACL_result)
- (ff:free-fobject $out)) %}
-
-// uncomment this if you want INOUT mappings for chars instead of strings.
-// INOUT_TYPEMAP(char,
-// (cl::push (code-char (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out))
-// ACL_result),
-// (cl::setf (ff:fslot-value-typed (cl::quote $*in_fftype) :c $out) $in));
diff --git a/linux-x86/share/swig/allegrocl/longlongs.i b/linux-x86/share/swig/allegrocl/longlongs.i
deleted file mode 100644
index a15adcd..0000000
--- a/linux-x86/share/swig/allegrocl/longlongs.i
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -----------------------------------------------------------------------------
- * longlongs.i
- *
- * Typemap addition for support of 'long long' type and 'unsigned long long
- * Makes use of swig-def-foreign-class, so this header should be loaded
- * after allegrocl.swg and after any custom user identifier-conversion
- * functions have been defined.
- * ----------------------------------------------------------------------------- */
-
-#ifdef Acl64Bit
-%typemap(ctype) long long, unsigned long long "$1_ltype";
-%typemap(out) long long, unsigned long long "$result = $1;";
-
-%typemap(ffitype) long long ":nat";
-%typemap(ffitype) unsigned long long ":unsigned-nat";
-
-%typemap(lout) long long, unsigned long long " #+64bit (cl::setq ACL_ffresult $body)";
-
-#else
-%typemap(out) long long, unsigned long long "$result = &$1;";
-%typemap(ffitype) long long "(:struct (l1 :long) (l2 :long))";
-
-%typemap(ffitype) unsigned long long "(:struct (l1 :unsigned-long) (l2 :unsigned-long))";
-
-%typemap(lout) long long
-" (cl::setq ACL_ffresult (make-instance '#.(swig-insert-id \"longlong\" () :type :class)
- :foreign-address $body))";
-
-%typemap(lout) unsigned long long
-" (cl:setq ACL_ffresult (make-instance '#.(swig-insert-id \"ulonglong\" () :type :class)
- :foreign-address $body))";
-
-#endif
-
-%typemap(in) long long, unsigned long long "$1 = $input;";
-
-
-%insert("lisphead") %{
-
-#-64bit
-(swig-def-foreign-class "longlong"
- (ff:foreign-pointer)
- (:struct (l1 :long) (l2 :long)))
-
-#-64bit
-(swig-def-foreign-class "ulonglong"
- (ff:foreign-pointer)
- (:struct (l1 :unsigned-long) (l2 :unsigned-long)))
-%}
diff --git a/linux-x86/share/swig/allegrocl/std_list.i b/linux-x86/share/swig/allegrocl/std_list.i
deleted file mode 100644
index a3660c9..0000000
--- a/linux-x86/share/swig/allegrocl/std_list.i
+++ /dev/null
@@ -1,230 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_list.i
- *
- * SWIG typemaps for std::list types
- *
- * To use, add:
- *
- * %include "std_list.i"
- *
- * to your interface file. You will also need to include a template directive
- * for each instance of the list container you want to use in your application.
- * e.g.
- *
- * %template (intlist) std::list<int>;
- * %template (floatlist) std::list<float>;
- * ----------------------------------------------------------------------------- */
-
-%module std_list
-%warnfilter(468) std::list;
-
-%{
-#include <list>
-#include <stdexcept>
-%}
-
-
-namespace std{
- template<class T> class list
- {
- 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;
- typedef T &iterator;
- typedef const T& const_iterator;
-
- list();
- list(unsigned int size, const T& value = T());
- list(const list& other);
-
- void assign(unsigned int n, const T& value);
- void swap(list<T> &x);
-
- const_reference front();
- 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();
- void sort();
-
- %extend
- {
- %typemap(lout) T &__getitem__ "(cl::setq ACL_ffresult (ff:fslot-value-typed '$*out_fftype :c $body))";
- %typemap(lout) T *__getitem__ "(cl::setq ACL_ffresult (make-instance '$lclass :foreign-address $body))";
-
- const_reference __getitem__(int i) throw (std::out_of_range)
- {
- std::list<T>::iterator first = self->begin();
- int size = int(self->size());
- if (i<0) i += size;
- if (i>=0 && i<size)
- {
- for (int k=0;k<i;k++)
- {
- first++;
- }
- return *first;
- }
- else throw std::out_of_range("list index out of range");
- }
- void __setitem__(int i, const T& INPUT) throw (std::out_of_range)
- {
- std::list<T>::iterator first = self->begin();
- int size = int(self->size());
- if (i<0) i += size;
- if (i>=0 && i<size)
- {
- for (int k=0;k<i;k++)
- {
- first++;
- }
- *first = INPUT;
- }
- else throw std::out_of_range("list index out of range");
- }
- void __delitem__(int i) throw (std::out_of_range)
- {
- std::list<T>::iterator first = self->begin();
- int size = int(self->size());
- if (i<0) i += size;
- if (i>=0 && i<size)
- {
- for (int k=0;k<i;k++)
- {
- first++;
- }
- self->erase(first);
- }
- else throw std::out_of_range("list index out of range");
- }
- std::list<T> __getslice__(int i,int j)
- {
- std::list<T>::iterator first = self->begin();
- std::list<T>::iterator end = self->end();
-
- int size = int(self->size());
- if (i<0) i += size;
- if (j<0) j += size;
- if (i<0) i = 0;
- if (j>size) j = size;
- if (i>=j) i=j;
- if (i>=0 && i<size && j>=0)
- {
- for (int k=0;k<i;k++)
- {
- first++;
- }
- for (int m=0;m<j;m++)
- {
- end++;
- }
- std::list<T> tmp(j-i);
- if (j>i) std::copy(first,end,tmp.begin());
- return tmp;
- }
- else throw std::out_of_range("list index out of range");
- }
- void __delslice__(int i,int j)
- {
- std::list<T>::iterator first = self->begin();
- std::list<T>::iterator end = self->end();
-
- int size = int(self->size());
- if (i<0) i += size;
- if (j<0) j += size;
- if (i<0) i = 0;
- if (j>size) j = size;
-
- for (int k=0;k<i;k++)
- {
- first++;
- }
- for (int m=0;m<=j;m++)
- {
- end++;
- }
- self->erase(first,end);
- }
- void __setslice__(int i,int j, const std::list<T>& v)
- {
- std::list<T>::iterator first = self->begin();
- std::list<T>::iterator end = self->end();
-
- int size = int(self->size());
- if (i<0) i += size;
- if (j<0) j += size;
- if (i<0) i = 0;
- if (j>size) j = size;
-
- for (int k=0;k<i;k++)
- {
- first++;
- }
- for (int m=0;m<=j;m++)
- {
- end++;
- }
- if (int(v.size()) == j-i)
- {
- std::copy(v.begin(),v.end(),first);
- }
- else {
- self->erase(first,end);
- if (i+1 <= int(self->size()))
- {
- first = self->begin();
- for (int k=0;k<i;k++)
- {
- first++;
- }
- self->insert(first,v.begin(),v.end());
- }
- else self->insert(self->end(),v.begin(),v.end());
- }
- }
- unsigned int __len__()
- {
- return self->size();
- }
- bool __nonzero__()
- {
- return !(self->empty());
- }
- void append(const T& INPUT)
- {
- self->push_back(INPUT);
- }
- void pop()
- {
- self->pop_back();
- }
- }
- };
-}
-
-
-
-
-
-
diff --git a/linux-x86/share/swig/allegrocl/std_string.i b/linux-x86/share/swig/allegrocl/std_string.i
deleted file mode 100644
index cbcd250..0000000
--- a/linux-x86/share/swig/allegrocl/std_string.i
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_string.i
- *
- * SWIG typemaps for std::string
- * ----------------------------------------------------------------------------- */
-
-// ------------------------------------------------------------------------
-// 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>
-%warnfilter(404) std::string;
-%warnfilter(404) std::wstring;
-
-%{
-#include <string>
-%}
-
-// %include <std_vector.i>
-
-// %naturalvar std::string;
-// %naturalvar std::wstring;
-
-namespace std {
- typedef unsigned long size_t;
- typedef signed long ptrdiff_t;
-
- template <class charT> class basic_string {
- public:
- typedef charT *pointer;
- typedef charT &reference;
- typedef const charT &const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- basic_string();
- basic_string( charT *str );
- size_type size();
- charT operator []( int pos ) const;
- charT *c_str() const;
- basic_string<charT> &operator = ( const basic_string &ws );
- basic_string<charT> &operator = ( const charT *str );
- basic_string<charT> &append( const basic_string<charT> &other );
- basic_string<charT> &append( const charT *str );
- void push_back( charT c );
- void clear();
- void reserve( size_type t );
- void resize( size_type n, charT c = charT() );
- int compare( const basic_string<charT> &other ) const;
- int compare( const charT *str ) const;
- basic_string<charT> &insert( size_type pos,
- const basic_string<charT> &str );
- size_type find( const basic_string<charT> &other, int pos = 0 ) const;
- size_type find( charT c, int pos = 0 ) const;
- %extend {
- bool operator == ( const basic_string<charT> &other ) const {
- return self->compare( other ) == 0;
- }
- bool operator != ( const basic_string<charT> &other ) const {
- return self->compare( other ) != 0;
- }
- bool operator < ( const basic_string<charT> &other ) const {
- return self->compare( other ) == -1;
- }
- bool operator > ( const basic_string<charT> &other ) const {
- return self->compare( other ) == 1;
- }
- bool operator <= ( const basic_string<charT> &other ) const {
- return self->compare( other ) != 1;
- }
- bool operator >= ( const basic_string<charT> &other ) const {
- return self->compare( other ) != -1;
- }
-
- }
- };
-
- %template(string) basic_string<char>;
- %template(wstring) basic_string<wchar_t>;
-
- %apply char * { string };
- %apply wchar_t * { wstring };
-
- typedef basic_string<char> string;
- typedef basic_string<wchar_t> wstring;
-
- // automatically convert constant std::strings to cl:strings
- %typemap(ctype) string "char *";
- %typemap(in) string "$1.assign($input);";
- %typemap(out) string "$result = (char *)(&$1)->c_str();";
- %typemap(lisptype) string "cl:string";
- %typemap(lout) string "(cl::setq ACL_ffresult $body)";
-
- %typemap(ctype) const string *"char *";
- %typemap(in) const string * "$1.assign($input);";
- %typemap(out) const string * "$result = (char *)($1)->c_str();";
- %typemap(lisptype) const string * "cl:string";
- %typemap(lout) const string * "(cl::setq ACL_ffresult $body)";
-
- %typemap(ctype) wstring "wchar_t *";
- %typemap(in) wstring "$1.assign($input);";
- %typemap(out) wstring "$result = (wchar_t *)(&$1)->c_str();";
- %typemap(lisptype) wstring "cl:string";
- %typemap(lout) wstring "(cl::setq ACL_ffresult (excl:native-to-string $body
-:external-format #+little-endian :fat-le #-little-endian :fat))";
-
- %typemap(ctype) const wstring *"char *";
- %typemap(in) const wstring * "$1.assign($input);";
- %typemap(out) const wstring * "$result = (char *)($1)->c_str();";
- %typemap(lisptype) const wstring * "cl:string";
- %typemap(lout) const wstring * "(cl::setq ACL_ffresult $body)";
-
- /* Overloading check */
-// %typemap(in) string {
-// if (caml_ptr_check($input))
-// $1.assign((char *)caml_ptr_val($input,0),
-// caml_string_len($input));
-// else
-// SWIG_exception(SWIG_TypeError, "string expected");
-// }
-
-// %typemap(in) const string & ($*1_ltype temp) {
-// if (caml_ptr_check($input)) {
-// temp.assign((char *)caml_ptr_val($input,0),
-// caml_string_len($input));
-// $1 = &temp;
-// } else {
-// SWIG_exception(SWIG_TypeError, "string expected");
-// }
-// }
-
-// %typemap(in) string & ($*1_ltype temp) {
-// if (caml_ptr_check($input)) {
-// temp.assign((char *)caml_ptr_val($input,0),
-// caml_string_len($input));
-// $1 = &temp;
-// } else {
-// SWIG_exception(SWIG_TypeError, "string expected");
-// }
-// }
-
-// %typemap(in) string * ($*1_ltype *temp) {
-// if (caml_ptr_check($input)) {
-// temp = new $*1_ltype((char *)caml_ptr_val($input,0),
-// caml_string_len($input));
-// $1 = temp;
-// } else {
-// SWIG_exception(SWIG_TypeError, "string expected");
-// }
-// }
-
-// %typemap(free) string * ($*1_ltype *temp) {
-// delete temp;
-// }
-
-// %typemap(argout) string & {
-// caml_list_append(swig_result,caml_val_string_len((*$1).c_str(),
-// (*$1).size()));
-// }
-
-// %typemap(directorout) string {
-// $result.assign((char *)caml_ptr_val($input,0),
-// caml_string_len($input));
-// }
-
-// %typemap(out) string {
-// $result = caml_val_string_len($1.c_str(),$1.size());
-// }
-
-// %typemap(out) string * {
-// $result = caml_val_string_len((*$1).c_str(),(*$1).size());
-// }
-}
-
-// #ifdef ENABLE_CHARPTR_ARRAY
-// char **c_charptr_array( const std::vector <string > &str_v );
-
-// %{
-// SWIGEXT char **c_charptr_array( const std::vector <string > &str_v ) {
-// char **out = new char *[str_v.size() + 1];
-// out[str_v.size()] = 0;
-// for( int i = 0; i < str_v.size(); i++ ) {
-// out[i] = (char *)str_v[i].c_str();
-// }
-// return out;
-// }
-// %}
-// #endif
-
-// #ifdef ENABLE_STRING_VECTOR
-// %template (StringVector) std::vector<string >;
-
-// %insert(ml) %{
-// (* Some STL convenience items *)
-
-// let string_array_to_vector sa =
-// let nv = _new_StringVector C_void in
-// array_to_vector nv (fun x -> C_string x) sa ; nv
-
-// let c_string_array ar =
-// _c_charptr_array (string_array_to_vector ar)
-// %}
-
-// %insert(mli) %{
-// val c_string_array: string array -> c_obj
-// %}
-// #endif
diff --git a/linux-x86/share/swig/allegrocl/typemaps.i b/linux-x86/share/swig/allegrocl/typemaps.i
deleted file mode 100644
index 293d1cd..0000000
--- a/linux-x86/share/swig/allegrocl/typemaps.i
+++ /dev/null
@@ -1,4 +0,0 @@
-/* Unused for Allegro CL module */
-
-%include "inout_typemaps.i"
-%include "longlongs.i"
diff --git a/linux-x86/share/swig/allkw.swg b/linux-x86/share/swig/allkw.swg
index 2d3cf6e..5e4cb83 100644
--- a/linux-x86/share/swig/allkw.swg
+++ b/linux-x86/share/swig/allkw.swg
@@ -1,5 +1,5 @@
-#ifndef __Lib_allkw_swg__
-#define __Lib_allkw_swg__
+#ifndef SWIG_INCLUDED_LIB_ALLKW_SWG
+#define SWIG_INCLUDED_LIB_ALLKW_SWG
/*
@@ -30,4 +30,4 @@
%include <tcl/tclkw.swg>
-#endif //__Lib_allkw_swg__
+#endif // SWIG_INCLUDED_LIB_ALLKW_SWG
diff --git a/linux-x86/share/swig/carrays.i b/linux-x86/share/swig/carrays.i
index 3a9c3cf..71712c8 100644
--- a/linux-x86/share/swig/carrays.i
+++ b/linux-x86/share/swig/carrays.i
@@ -5,22 +5,28 @@
* pointers as arrays.
* ----------------------------------------------------------------------------- */
+#ifndef __cplusplus
+// C uses free/calloc/malloc
+%include "swigfragments.swg"
+%fragment("<stdlib.h>");
+#endif
+
/* -----------------------------------------------------------------------------
* %array_functions(TYPE,NAME)
*
* Generates functions for creating and accessing elements of a C array
* (as pointers). Creates the following functions:
*
- * TYPE *new_NAME(int nelements)
+ * TYPE *new_NAME(size_t nelements)
* void delete_NAME(TYPE *);
- * TYPE NAME_getitem(TYPE *, int index);
- * void NAME_setitem(TYPE *, int index, TYPE value);
- *
+ * TYPE NAME_getitem(TYPE *, size_t index);
+ * void NAME_setitem(TYPE *, size_t index, TYPE value);
+ *
* ----------------------------------------------------------------------------- */
%define %array_functions(TYPE,NAME)
%{
-static TYPE *new_##NAME(int nelements) { %}
+static TYPE *new_##NAME(size_t nelements) { %}
#ifdef __cplusplus
%{ return new TYPE[nelements](); %}
#else
@@ -36,18 +42,18 @@ static void delete_##NAME(TYPE *ary) { %}
#endif
%{}
-static TYPE NAME##_getitem(TYPE *ary, int index) {
+static TYPE NAME##_getitem(TYPE *ary, size_t index) {
return ary[index];
}
-static void NAME##_setitem(TYPE *ary, int index, TYPE value) {
+static void NAME##_setitem(TYPE *ary, size_t index, TYPE value) {
ary[index] = value;
}
%}
-TYPE *new_##NAME(int nelements);
+TYPE *new_##NAME(size_t nelements);
void delete_##NAME(TYPE *ary);
-TYPE NAME##_getitem(TYPE *ary, int index);
-void NAME##_setitem(TYPE *ary, int index, TYPE value);
+TYPE NAME##_getitem(TYPE *ary, size_t index);
+void NAME##_setitem(TYPE *ary, size_t index, TYPE value);
%enddef
@@ -59,13 +65,13 @@ void NAME##_setitem(TYPE *ary, int index, TYPE value);
* interface:
*
* struct NAME {
- * NAME(int nelements);
+ * NAME(size_t nelements);
* ~NAME();
- * TYPE getitem(int index);
- * void setitem(int index, TYPE value);
+ * TYPE getitem(size_t index);
+ * void setitem(size_t index, TYPE value);
* TYPE * cast();
* static NAME *frompointer(TYPE *t);
- * }
+ * }
*
* ----------------------------------------------------------------------------- */
@@ -80,14 +86,14 @@ typedef struct {
%extend NAME {
#ifdef __cplusplus
-NAME(int nelements) {
+NAME(size_t nelements) {
return new TYPE[nelements]();
}
~NAME() {
delete [] self;
}
#else
-NAME(int nelements) {
+NAME(size_t nelements) {
return (TYPE *) calloc(nelements,sizeof(TYPE));
}
~NAME() {
@@ -95,10 +101,10 @@ NAME(int nelements) {
}
#endif
-TYPE getitem(int index) {
+TYPE getitem(size_t index) {
return self[index];
}
-void setitem(int index, TYPE value) {
+void setitem(size_t index, TYPE value) {
self[index] = value;
}
TYPE * cast() {
diff --git a/linux-x86/share/swig/cdata.i b/linux-x86/share/swig/cdata.i
index f18ed4a..8736de1 100644
--- a/linux-x86/share/swig/cdata.i
+++ b/linux-x86/share/swig/cdata.i
@@ -4,6 +4,8 @@
* SWIG library file containing macros for manipulating raw C data as strings.
* ----------------------------------------------------------------------------- */
+%include <swigfragments.swg>
+
%{
typedef struct SWIGCDATA {
char *data;
@@ -21,7 +23,7 @@ typedef struct SWIGCDATA {
}
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
-#elif SWIGPHP7
+#elif SWIGPHP
%typemap(out) SWIGCDATA {
ZVAL_STRINGL($result, $1.data, $1.len);
@@ -60,7 +62,7 @@ static jbyteArray SWIG_JavaArrayOutCDATA(JNIEnv *jenv, char *result, jsize sz) {
/* -----------------------------------------------------------------------------
- * %cdata(TYPE [, NAME])
+ * %cdata(TYPE [, NAME])
*
* Convert raw C data to a binary string.
* ----------------------------------------------------------------------------- */
@@ -99,6 +101,8 @@ SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements);
%cdata(void);
+%fragment("<string.h>");
+
/* Memory move function. Due to multi-argument typemaps this appears to be wrapped as
void memmove(void *data, const char *s); */
void memmove(void *data, const void *indata, int inlen);
diff --git a/linux-x86/share/swig/cffi/cffi.swg b/linux-x86/share/swig/cffi/cffi.swg
deleted file mode 100644
index f729495..0000000
--- a/linux-x86/share/swig/cffi/cffi.swg
+++ /dev/null
@@ -1,294 +0,0 @@
-/* Define a C preprocessor symbol that can be used in interface files
- to distinguish between the SWIG language modules. */
-
-#define SWIG_CFFI
-
-/* Typespecs for basic types. */
-
-%typemap(cin) void ":void";
-
-%typemap(cin) char ":char";
-%typemap(cin) char * ":string";
-%typemap(cin) unsigned char ":unsigned-char";
-%typemap(cin) signed char ":char";
-
-%typemap(cin) short ":short";
-%typemap(cin) signed short ":short";
-%typemap(cin) unsigned short ":unsigned-short";
-
-%typemap(cin) int ":int";
-%typemap(cin) signed int ":int";
-%typemap(cin) unsigned int ":unsigned-int";
-
-%typemap(cin) long ":long";
-%typemap(cin) signed long ":long";
-%typemap(cin) unsigned long ":unsigned-long";
-
-%typemap(cin) long long ":long-long";
-%typemap(cin) signed long long ":long-long";
-%typemap(cin) unsigned long long ":unsigned-long-long";
-
-%typemap(cin) float ":float";
-%typemap(cin) double ":double";
-%typemap(cin) SWIGTYPE ":pointer";
-
-%typemap(cout) void ":void";
-
-%typemap(cout) char ":char";
-%typemap(cout) char * ":string";
-%typemap(cout) unsigned char ":unsigned-char";
-%typemap(cout) signed char ":char";
-
-%typemap(cout) short ":short";
-%typemap(cout) signed short ":short";
-%typemap(cout) unsigned short ":unsigned-short";
-
-%typemap(cout) int ":int";
-%typemap(cout) signed int ":int";
-%typemap(cout) unsigned int ":unsigned-int";
-
-%typemap(cout) long ":long";
-%typemap(cout) signed long ":long";
-%typemap(cout) unsigned long ":unsigned-long";
-
-%typemap(cout) long long ":long-long";
-%typemap(cout) signed long long ":long-long";
-%typemap(cout) unsigned long long ":unsigned-long-long";
-
-%typemap(cout) float ":float";
-%typemap(cout) double ":double";
-%typemap(cout) SWIGTYPE ":pointer";
-
-
-%typemap(ctype) bool "int";
-%typemap(ctype) char, unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- float, double, long double, char *, void *, void,
- enum SWIGTYPE, SWIGTYPE *,
- SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype";
-%typemap(ctype) SWIGTYPE "$&1_type";
-
-%typemap(in) bool "$1 = (bool)$input;";
-%typemap(in) char, unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- float, double, long double, char *, void *, void,
- enum SWIGTYPE, SWIGTYPE *,
- SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;";
-%typemap(in) SWIGTYPE "$1 = *$input;";
-
-%typemap(out) void "";
-%typemap(out) bool "$result = (int)$1;";
-%typemap(out) char, unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- float, double, long double, char *, void *,
- enum SWIGTYPE, SWIGTYPE *,
- SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;";
-#ifdef __cplusplus
-%typemap(out) SWIGTYPE "$result = new $1_type($1);";
-#else
-%typemap(out) SWIGTYPE {
- $result = ($&1_ltype) malloc(sizeof($1_type));
- memmove($result, &$1, sizeof($1_type));
-}
-#endif
-
-%typecheck(SWIG_TYPECHECK_BOOL) bool { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_CHAR) char { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_FLOAT) float { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_DOUBLE) double { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_STRING) char * { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_INTEGER)
- unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- enum SWIGTYPE { $1 = 1; };
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&,
- SWIGTYPE[ANY], SWIGTYPE { $1 = 1; };
-/* This maps C/C++ types to Lisp classes for overload dispatch */
-
-%typemap(lisptype) bool "cl:boolean";
-%typemap(lisptype) char "cl:character";
-%typemap(lisptype) unsigned char "cl:integer";
-%typemap(lisptype) signed char "cl:integer";
-
-%typemap(lispclass) bool "t";
-%typemap(lispclass) char "cl:character";
-%typemap(lispclass) unsigned char, signed char,
- short, signed short, unsigned short,
- int, signed int, unsigned int,
- long, signed long, unsigned long,
- enum SWIGTYPE "cl:integer";
-/* CLOS methods can't be specialized on single-float or double-float */
-%typemap(lispclass) float "cl:number";
-%typemap(lispclass) double "cl:number";
-%typemap(lispclass) char * "cl:string";
-
-/* Array reference typemaps */
-%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
-
-/* const pointers */
-%apply SWIGTYPE * { SWIGTYPE *const }
-%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
-%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
-
-%{
-
-#ifdef __cplusplus
-# define EXTERN extern "C"
-#else
-# define EXTERN extern
-#endif
-
-#define EXPORT EXTERN SWIGEXPORT
-
-#include <string.h>
-%}
-
-%insert("swiglisp") %{
-;;;SWIG wrapper code starts here
-
-(cl:defmacro defanonenum (cl:&body enums)
- "Converts anonymous enums to defconstants."
- `(cl:progn ,@(cl:loop for value in enums
- for index = 0 then (cl:1+ index)
- when (cl:listp value) do (cl:setf index (cl:second value)
- value (cl:first value))
- collect `(cl:defconstant ,value ,index))))
-
-(cl:eval-when (:compile-toplevel :load-toplevel)
- (cl:unless (cl:fboundp 'swig-lispify)
- (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*))
- (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst)))
- (cl:cond
- ((cl:null lst)
- rest)
- ((cl:upper-case-p c)
- (helper (cl:cdr lst) 'upper
- (cl:case last
- ((lower digit) (cl:list* c #\- rest))
- (cl:t (cl:cons c rest)))))
- ((cl:lower-case-p c)
- (helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest)))
- ((cl:digit-char-p c)
- (helper (cl:cdr lst) 'digit
- (cl:case last
- ((upper lower) (cl:list* c #\- rest))
- (cl:t (cl:cons c rest)))))
- ((cl:char-equal c #\_)
- (helper (cl:cdr lst) '_ (cl:cons #\- rest)))
- (cl:t
- (cl:error "Invalid character: ~A" c)))))
- (cl:let ((fix (cl:case flag
- ((constant enumvalue) "+")
- (variable "*")
- (cl:t ""))))
- (cl:intern
- (cl:concatenate
- 'cl:string
- fix
- (cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil))
- fix)
- package))))))
-
-;;;SWIG wrapper code ends here
-%}
-
-#ifdef __cplusplus
-%typemap(out) SWIGTYPE "$result = new $1_type($1);";
-#else
-%typemap(out) SWIGTYPE {
- $result = ($&1_ltype) malloc(sizeof($1_type));
- memmove($result, &$1, sizeof($1_type));
-}
-#endif
-
-//////////////////////////////////////////////////////////////
-
-/* name conversion for overloaded operators. */
-#ifdef __cplusplus
-%rename(__add__) *::operator+;
-%rename(__pos__) *::operator+();
-%rename(__pos__) *::operator+() const;
-
-%rename(__sub__) *::operator-;
-%rename(__neg__) *::operator-() const;
-%rename(__neg__) *::operator-();
-
-%rename(__mul__) *::operator*;
-%rename(__deref__) *::operator*();
-%rename(__deref__) *::operator*() const;
-
-%rename(__div__) *::operator/;
-%rename(__mod__) *::operator%;
-%rename(__logxor__) *::operator^;
-%rename(__logand__) *::operator&;
-%rename(__logior__) *::operator|;
-%rename(__lognot__) *::operator~();
-%rename(__lognot__) *::operator~() const;
-
-%rename(__not__) *::operator!();
-%rename(__not__) *::operator!() const;
-
-%rename(__assign__) *::operator=;
-
-%rename(__add_assign__) *::operator+=;
-%rename(__sub_assign__) *::operator-=;
-%rename(__mul_assign__) *::operator*=;
-%rename(__div_assign__) *::operator/=;
-%rename(__mod_assign__) *::operator%=;
-%rename(__logxor_assign__) *::operator^=;
-%rename(__logand_assign__) *::operator&=;
-%rename(__logior_assign__) *::operator|=;
-
-%rename(__lshift__) *::operator<<;
-%rename(__lshift_assign__) *::operator<<=;
-%rename(__rshift__) *::operator>>;
-%rename(__rshift_assign__) *::operator>>=;
-
-%rename(__eq__) *::operator==;
-%rename(__ne__) *::operator!=;
-%rename(__lt__) *::operator<;
-%rename(__gt__) *::operator>;
-%rename(__lte__) *::operator<=;
-%rename(__gte__) *::operator>=;
-
-%rename(__and__) *::operator&&;
-%rename(__or__) *::operator||;
-
-%rename(__preincr__) *::operator++();
-%rename(__postincr__) *::operator++(int);
-%rename(__predecr__) *::operator--();
-%rename(__postdecr__) *::operator--(int);
-
-%rename(__comma__) *::operator,();
-%rename(__comma__) *::operator,() const;
-
-%rename(__member_ref__) *::operator->;
-%rename(__member_func_ref__) *::operator->*;
-
-%rename(__funcall__) *::operator();
-%rename(__aref__) *::operator[];
-#endif
-
-
-%{
-
-#ifdef __cplusplus
-# define EXTERN extern "C"
-#else
-# define EXTERN extern
-#endif
-
-#define EXPORT EXTERN SWIGEXPORT
-
-#include <string.h>
-#include <stdlib.h>
-%}
diff --git a/linux-x86/share/swig/chicken/chicken.swg b/linux-x86/share/swig/chicken/chicken.swg
deleted file mode 100644
index 7df6767..0000000
--- a/linux-x86/share/swig/chicken/chicken.swg
+++ /dev/null
@@ -1,809 +0,0 @@
-/* -----------------------------------------------------------------------------
- * chicken.swg
- *
- * CHICKEN configuration module.
- * ----------------------------------------------------------------------------- */
-
-/* chicken.h has to appear first. */
-
-%insert(runtime) %{
-#include <assert.h>
-#include <chicken.h>
-%}
-
-%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
- * ----------------------------------------------------------------------------- */
-
-/*
- CHICKEN: C
- ----------
-
- fixnum: int, short, unsigned int, unsigned short, unsigned char,
- signed char
-
- char: char
-
- bool: bool
-
- flonum: float, double, long, long long, unsigned long, unsigned long
- long
- */
-
-/* --- Primitive types --- */
-
-%define SIMPLE_TYPEMAP(type_, from_scheme, to_scheme, checker, convtype, storage_)
-
-%typemap(in) type_
-%{ if (!checker ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument #$argnum is not of type 'type_'");
- }
- $1 = ($1_ltype) from_scheme ($input); %}
-
-/* Const primitive references. Passed by value */
-
-%typemap(in) const type_ & ($*1_ltype temp)
-%{ if (!checker ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument #$argnum is not of type 'type_'");
- }
- temp = ($*1_ltype) from_scheme ($input);
- $1 = &temp; %}
-
-/* --- Variable input --- */
-%typemap(varin) type_
-%{ if (!checker ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Cannot use '$1_ltype' for variable '$name' of type 'type_'");
- }
- $1 = ($1_ltype) from_scheme ($input); %}
-
-#if "storage_" == "0"
-
-%typemap(out) type_
-%{
- $result = to_scheme (convtype ($1));
-%}
-
-/* References to primitive types. Return by value */
-
-%typemap(out) const type_ &
-%{
- $result = to_scheme (convtype (*$1));
-%}
-
-/* --- Variable output --- */
-%typemap(varout) type_
-%{
- $result = to_scheme (convtype ($varname));
-%}
-
-%typemap(throws) type_
-%{
- SWIG_Chicken_ThrowException(to_scheme ( convtype ($1)));
-%}
-
-#else
-
-%typemap(out) type_
-%{
- {
- C_word *space = C_alloc(storage_);
- $result = to_scheme (&space, convtype ($1));
- }
-%}
-
-/* References to primitive types. Return by value */
-
-%typemap(out) const type_ &
-%{
- {
- C_word *space = C_alloc(storage_);
- $result = to_scheme (&space, convtype (*$1));
- }
-%}
-
-/* --- Variable output --- */
-%typemap(varout) type_
-%{
- {
- C_word *space = C_alloc(storage_);
- $result = to_scheme (&space, convtype ($varname));
- }
-%}
-
-%typemap(throws) type_
-%{
- {
- C_word *space = C_alloc(storage_);
- SWIG_Chicken_ThrowException(to_scheme (&space, convtype ($1)));
- }
-%}
-
-#endif
-
-/* --- Constants --- */
-
-%typemap(constcode) type_
-"static const $1_type $result = $value;"
-
-%enddef
-
-SIMPLE_TYPEMAP(int, C_num_to_int, C_fix, C_swig_is_number, (int), 0);
-//SIMPLE_TYPEMAP(enum SWIGTYPE, C_unfix, C_fix, C_swig_is_fixnum, (int), 0);
-SIMPLE_TYPEMAP(short, C_num_to_int, C_fix, C_swig_is_number, (int), 0);
-SIMPLE_TYPEMAP(long, C_num_to_long, C_long_to_num, C_swig_is_long, (long), C_SIZEOF_FLONUM);
-SIMPLE_TYPEMAP(long long, C_num_to_long, C_long_to_num, C_swig_is_long, (long), C_SIZEOF_FLONUM);
-SIMPLE_TYPEMAP(unsigned int, C_num_to_unsigned_int, C_unsigned_int_to_num, C_swig_is_number, (unsigned int), C_SIZEOF_FLONUM);
-SIMPLE_TYPEMAP(unsigned short, C_num_to_unsigned_int, C_fix, C_swig_is_number, (unsigned int), 0);
-SIMPLE_TYPEMAP(unsigned long, C_num_to_unsigned_long, C_unsigned_long_to_num, C_swig_is_long, (unsigned long), C_SIZEOF_FLONUM);
-SIMPLE_TYPEMAP(unsigned long long, C_num_to_unsigned_long, C_unsigned_long_to_num, C_swig_is_long, (unsigned long), C_SIZEOF_FLONUM);
-SIMPLE_TYPEMAP(unsigned char, C_character_code, C_make_character, C_swig_is_char, (unsigned int), 0);
-SIMPLE_TYPEMAP(signed char, C_character_code, C_make_character, C_swig_is_char, (int), 0);
-SIMPLE_TYPEMAP(char, C_character_code, C_make_character, C_swig_is_char, (char), 0);
-SIMPLE_TYPEMAP(bool, C_truep, C_mk_bool, C_swig_is_bool, (bool), 0);
-SIMPLE_TYPEMAP(float, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEOF_FLONUM);
-SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEOF_FLONUM);
-
-/* enum SWIGTYPE */
-%apply int { enum SWIGTYPE };
-%apply const int& { const enum SWIGTYPE& };
-%apply const int& { const enum SWIGTYPE&& };
-
-%typemap(varin) enum SWIGTYPE
-{
- if (!C_swig_is_fixnum($input) && sizeof(int) != sizeof($1)) {
- swig_barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, "enum variable '$name' can not be set");
- }
- *((int *)(void *)&$1) = C_unfix($input);
-}
-
-
-/* --- Input arguments --- */
-
-/* Strings */
-
-%typemap(in) char *
-{ if ($input == C_SCHEME_FALSE) {
- $1 = NULL;
- }
- else {
- if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument #$argnum is not of type 'char *'");
- }
- $1 = ($ltype) SWIG_MakeString ($input);
- }
-}
-
-%typemap(freearg) char * "if ($1 != NULL) { free ($1); }"
-
-/* Pointers, references, and arrays */
-%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE *, SWIGTYPE [], SWIGTYPE &, SWIGTYPE && {
- $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, $disown);
-}
-
-%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE *DISOWN {
- $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, SWIG_POINTER_DISOWN);
-}
-
-/* Void pointer. Accepts any kind of pointer */
-%typemap(in) void * {
- $1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0);
-}
-
-%typemap(varin,closcode="(slot-ref $input 'swig-this)") SWIGTYPE * {
- $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, SWIG_POINTER_DISOWN);
-}
-
-%typemap(varin,closcode="(slot-ref $input 'swig-this)") SWIGTYPE & {
- $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
-}
-
-%typemap(varin,closcode="(slot-ref $input 'swig-this)") SWIGTYPE && {
- $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
-}
-
-%typemap(varin) SWIGTYPE [] {
- SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, "Type error");
-}
-
-%typemap(varin) SWIGTYPE [ANY] {
- void *temp;
- int ii;
- $1_basetype *b = 0;
- temp = SWIG_MustGetPtr($input, $1_descriptor, 1, 0);
- b = ($1_basetype *) $1;
- for (ii = 0; ii < $1_size; ii++) b[ii] = *(($1_basetype *) temp + ii);
-}
-
-%typemap(varin) void * {
- $1 = SWIG_MustGetPtr($input, NULL, 1, 0);
-}
-
-%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- $result = SWIG_NewPointerObj($1, $descriptor, $owner);
-}
-
-%typemap(out) SWIGTYPE *DYNAMIC, SWIGTYPE &DYNAMIC {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor,(void **) &$1);
- $result = SWIG_NewPointerObj($1, ty, $owner);
-}
-
-%typemap(varout) SWIGTYPE *, SWIGTYPE [] {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- $result = SWIG_NewPointerObj($varname, $descriptor, 0);
-}
-
-%typemap(varout) SWIGTYPE & {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- $result = SWIG_NewPointerObj((void *) &$varname, $1_descriptor, 0);
-}
-
-%typemap(varout) SWIGTYPE && {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- $result = SWIG_NewPointerObj((void *) &$varname, $1_descriptor, 0);
-}
-
-/* special typemaps for class pointers */
-%typemap(in) SWIGTYPE (CLASS::*) {
- char err_msg[256];
-
- if (C_swig_is_pair($input)) {
- /* try and convert pointer object */
- void *result;
- if (!SWIG_ConvertPtr(C_block_item($input,1), &result, $descriptor, 0)) {
- C_word ptr = C_block_item($input,0);
- if (C_swig_is_string(ptr)) {
- SWIG_UnpackData(C_c_string(ptr), (void *) &$1, sizeof($type));
- } else {
- snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", $argnum, ($descriptor->str ? $descriptor->str : $descriptor->name));
- SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
- }
- } else {
- snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", $argnum, ($descriptor->str ? $descriptor->str : $descriptor->name));
- SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
- }
- } else {
- snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", $argnum, ($descriptor->str ? $descriptor->str : $descriptor->name));
- SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
- }
-}
-
-%typemap(out) SWIGTYPE (CLASS::*) {
- size_t ptr_size = sizeof($type);
- C_word *known_space = C_alloc(C_SIZEOF_PAIR + C_SIZEOF_STRING(2*ptr_size) + C_SIZEOF_SWIG_POINTER);
- char *temp = (char *)malloc(2*ptr_size);
- C_word ptr = SWIG_NewPointerObj((void *) known_space, $descriptor, 0);
-
- SWIG_PackData(temp, (void *) &$1, ptr_size);
- $result = C_pair(&known_space, C_string(&known_space, 2*ptr_size, temp), ptr);
- free(temp);
-}
-
-%typemap(varin) SWIGTYPE (CLASS::*) {
- char err_msg[256];
-
- if (C_swig_is_pair($input)) {
- /* try and convert pointer object */
- void *result;
- if (!SWIG_ConvertPtr(C_block_item($input,1), &result, $descriptor, 0)) {
- C_word ptr = C_block_item($input,0);
- if (C_swig_is_string(ptr)) {
- SWIG_UnpackData(C_c_string(ptr), (void *) &$1, sizeof($type));
- } else {
- snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", 1, ($descriptor->str ? $descriptor->str : $descriptor->name));
- SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
- }
- } else {
- snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", 1, ($descriptor->str ? $descriptor->str : $descriptor->name));
- SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
- }
- } else {
- snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", 1, ($descriptor->str ? $descriptor->str : $descriptor->name));
- SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
- }
-}
-
-%typemap(varout) SWIGTYPE (CLASS::*) {
- size_t ptr_size = sizeof($type);
- C_word *known_space = C_alloc(C_SIZEOF_PAIR + C_SIZEOF_STRING(2*ptr_size) + C_SIZEOF_SWIG_POINTER);
- char *temp = (char *)malloc(2*ptr_size);
- C_word ptr = SWIG_NewPointerObj((void *) known_space, $descriptor, 0);
-
- SWIG_PackData(temp, (void *) &$varname, ptr_size);
- $result = C_pair(&known_space, C_string(&known_space, 2*ptr_size, temp), ptr);
- free(temp);
-}
-
-
-
-/* Pass-by-value */
-
-%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE($&1_ltype argp) {
- argp = ($&1_ltype)SWIG_MustGetPtr($input, $&1_descriptor, $argnum, 0);
- $1 = *argp;
-}
-
-%typemap(varin,closcode="(slot-ref $input 'swig-this)") SWIGTYPE {
- $&1_ltype argp;
- argp = ($&1_ltype)SWIG_MustGetPtr($input, $&1_descriptor, 1, 0);
- $1 = *argp;
-}
-
-%typemap(out) SWIGTYPE
-#ifdef __cplusplus
-{
- $&1_ltype resultptr;
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- resultptr = new $1_ltype((const $1_ltype &) $1);
- $result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 1);
-}
-#else
-{
- $&1_ltype resultptr;
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- resultptr = ($&1_ltype) malloc(sizeof($1_type));
- memmove(resultptr, &$1, sizeof($1_type));
- $result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 1);
-}
-#endif
-
-%typemap(varout) SWIGTYPE
-#ifdef __cplusplus
-{
- $&1_ltype resultptr;
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- resultptr = new $1_ltype((const $1_ltype&) $1);
- $result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 0);
-}
-#else
-{
- $&1_ltype resultptr;
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- resultptr = ($&1_ltype) malloc(sizeof($1_type));
- memmove(resultptr, &$1, sizeof($1_type));
- $result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 0);
-}
-#endif
-
-/* --- Output values --- */
-
-/* Strings */
-
-%typemap(out)
- char *
-{ char *s = (char*) $1;
- if ($1 == NULL) {
- $result = C_SCHEME_FALSE;
- }
- else {
- int string_len = strlen ((char *) ($1));
- C_word *string_space = C_alloc (C_SIZEOF_STRING (string_len));
- $result = C_string (&string_space, string_len, s);
- }
-}
-
-%typemap(varout)
- char *
-{ char *s = (char*) $varname;
- if ($varname == NULL) {
- $result = C_SCHEME_FALSE;
- }
- else {
- int string_len = strlen ($varname);
- C_word *string_space = C_alloc (C_SIZEOF_STRING (string_len));
- $result = C_string (&string_space, string_len, s);
- }
-}
-
-%typemap(throws) char *
-{
- if ($1 == NULL) {
- SWIG_Chicken_ThrowException(C_SCHEME_FALSE);
- } else {
- int string_len = strlen($1);
- C_word *string_space = C_alloc(C_SIZEOF_STRING(string_len));
- SWIG_Chicken_ThrowException(C_string(&string_space, string_len, (char *) $1));
- }
-}
-
-/* Void */
-%typemap(out) void
-%{
-$result = C_SCHEME_UNDEFINED;
-%}
-
-/* Special typemap for character array return values */
-
-%typemap(out)
- char [ANY], const char [ANY]
-%{ if ($1 == NULL) {
- $result = C_SCHEME_FALSE;
- }
- else {
- const int string_len = strlen ($1);
- C_word *string_space = C_alloc (C_SIZEOF_STRING (string_len));
- $result = C_string (&string_space, string_len, $1);
- } %}
-
-/* Primitive types--return by value */
-
-/* --- Variable input --- */
-
-/* A string */
-#ifdef __cplusplus
-%typemap(varin) char * {
- if ($input == C_SCHEME_FALSE) {
- $1 = NULL;
- }
- else if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "C variable '$name ($1_ltype)'");
- }
- else {
- char *temp = C_c_string ($input);
- int len = C_header_size ($input);
- if ($1) delete [] $1;
- $1 = ($type) new char[len+1];
- strncpy((char*)$1, temp, len);
- ((char*)$1) [len] = 0;
- }
-}
-%typemap(varin,warning="451:Setting const char * variable may leak memory") const char * {
- if ($input == C_SCHEME_FALSE) {
- $1 = NULL;
- }
- else if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "C variable '$name ($1_ltype)'");
- }
- else {
- char *temp = C_c_string ($input);
- int len = C_header_size ($input);
- $1 = ($type) new char[len+1];
- strncpy((char*)$1,temp,len);
- ((char*)$1) [len] = 0;
- }
-}
-#else
-%typemap(varin) char * {
- if ($input == C_SCHEME_FALSE) {
- $1 = NULL;
- }
- else if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "C variable '$name ($1_ltype)'");
- }
- else {
- char *temp = C_c_string ($input);
- int len = C_header_size ($input);
- if ($1) free((char*) $1);
- $1 = ($type) malloc(len+1);
- strncpy((char*)$1,temp,len);
- ((char*)$1) [len] = 0;
- }
-}
-%typemap(varin,warning="451:Setting const char * variable may leak memory") const char * {
- if ($input == C_SCHEME_FALSE) {
- $1 = NULL;
- }
- else if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "C variable '$name ($1_ltype)'");
- }
- else {
- char *temp = C_c_string ($input);
- int len = C_header_size ($input);
- $1 = ($type) malloc(len+1);
- strncpy((char*)$1,temp,len);
- ((char*)$1) [len] = 0;
- }
-}
-#endif
-
-%typemap(varin) char [] {
- swig_barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, "C/C++ variable '$name' is read-only");
-}
-
-/* Special case for string array variables */
-%typemap(varin) char [ANY] {
- if ($input == C_SCHEME_FALSE) {
- memset($1,0,$1_dim0*sizeof(char));
- }
- else if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "C variable '$name ($1_ltype)'");
- }
- else {
- char *temp = C_c_string ($input);
- strncpy($1,temp,$1_dim0*sizeof(char));
- }
-}
-
-/* --- Variable output --- */
-
-/* Void */
-%typemap(varout) void "$result = C_SCHEME_UNDEFINED;";
-
-/* Special typemap for character array return values */
-%typemap(varout) char [ANY], const char [ANY]
-%{ if ($varname == NULL) {
- $result = C_SCHEME_FALSE;
- }
- else {
- const int string_len = strlen ($varname);
- C_word *string_space = C_alloc (C_SIZEOF_STRING (string_len));
- $result = C_string (&string_space, string_len, (char *) $varname);
- }
-%}
-
-
-/* --- Constants --- */
-
-%typemap(constcode) char *
-"static const char *$result = $value;"
-
-%typemap(constcode) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE []
-"static const void *$result = (void*) $value;"
-
-/* ------------------------------------------------------------
- * String & length
- * ------------------------------------------------------------ */
-
-%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
- if ($input == C_SCHEME_FALSE) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Cannot use a null/#f string for a char*, int arguments");
- }
- else if (C_swig_is_string ($input)) {
- $1 = ($1_ltype) C_c_string ($input);
- $2 = ($2_ltype) C_header_size ($input);
- }
- else {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument #$argnum is not of type 'string'");
- }
-}
-
-/* ------------------------------------------------------------
- * CHICKEN types
- * ------------------------------------------------------------ */
-
-%typemap(in) C_word "$1 = $input;";
-%typemap(out) C_word "$result = $1;";
-
-/* ------------------------------------------------------------
- * Typechecking rules
- * ------------------------------------------------------------ */
-
-%typecheck(SWIG_TYPECHECK_INTEGER)
- bool, const bool &
-{
- $1 = C_swig_is_bool ($input);
-}
-
-%typecheck(SWIG_TYPECHECK_INTEGER)
- int, short,
- unsigned int, unsigned short,
- signed char, unsigned char,
- const int &, const short &,
- const unsigned int &, const unsigned short &,
- enum SWIGTYPE
-{
- $1 = C_swig_is_fixnum ($input);
-}
-
-%typecheck(SWIG_TYPECHECK_INTEGER)
- long,
- unsigned long,
- long long, unsigned long long,
- const long &,
- const unsigned long &,
- const long long &, const unsigned long long &
-{
- $1 = (C_swig_is_bool ($input) ||
- C_swig_is_fixnum ($input) ||
- C_swig_is_flonum ($input)) ? 1 : 0;
-}
-
-%typecheck(SWIG_TYPECHECK_DOUBLE)
- float, double,
- const float &, const double &
-{
- $1 = C_swig_is_flonum ($input);
-}
-
-%typecheck(SWIG_TYPECHECK_CHAR) char {
- $1 = C_swig_is_string ($input);
-}
-
-%typecheck(SWIG_TYPECHECK_STRING) char * {
- $1 = C_swig_is_string ($input);
-}
-
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
- void *ptr;
- $1 = !SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0);
-}
-
-%typecheck(SWIG_TYPECHECK_VOIDPTR) void * {
- void *ptr;
- $1 = !SWIG_ConvertPtr($input, &ptr, 0, 0);
-}
-
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &
-{
- void *ptr = 0;
- if (SWIG_ConvertPtr($input, &ptr, $descriptor, SWIG_POINTER_NO_NULL)) {
- $1 = 0;
- } else {
- $1 = 1;
- }
-}
-
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &&
-{
- void *ptr = 0;
- if (SWIG_ConvertPtr($input, &ptr, $descriptor, SWIG_POINTER_NO_NULL)) {
- $1 = 0;
- } else {
- $1 = 1;
- }
-}
-
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
-{
- void *ptr = 0;
- if (SWIG_ConvertPtr($input, &ptr, $&descriptor, SWIG_POINTER_NO_NULL)) {
- $1 = 0;
- } else {
- $1 = 1;
- }
-}
-
-
-/* ------------------------------------------------------------
- * Exception handling
- * ------------------------------------------------------------ */
-
-/* ------------------------------------------------------------
- * --- Exception handling ---
- * ------------------------------------------------------------ */
-
-%typemap(throws) SWIGTYPE {
- $&ltype temp = new $ltype($1);
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- C_word ptr = SWIG_NewPointerObj(temp, $&descriptor,1);
- SWIG_Chicken_ThrowException(ptr);
-}
-
-%typemap(throws) SWIGTYPE * {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- C_word ptr = SWIG_NewPointerObj((void *) $1, $descriptor, 0);
- SWIG_Chicken_ThrowException(ptr);
-}
-
-%typemap(throws) SWIGTYPE [ANY] {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- C_word ptr = SWIG_NewPointerObj((void *) $1, $descriptor, 0);
- SWIG_Chicken_ThrowException(ptr);
-}
-
-%typemap(throws) SWIGTYPE & {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- C_word ptr = SWIG_NewPointerObj((void *)&($1),$descriptor,0);
- SWIG_Chicken_ThrowException(ptr);
-}
-
-%typemap(throws) SWIGTYPE && {
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
- C_word ptr = SWIG_NewPointerObj((void *)&($1),$descriptor,0);
- SWIG_Chicken_ThrowException(ptr);
-}
-
-/* ------------------------------------------------------------
- * ANSI C typemaps
- * ------------------------------------------------------------ */
-
-%apply unsigned long { size_t };
-
-/* ------------------------------------------------------------
- * Various
- * ------------------------------------------------------------ */
-
-/* Array reference typemaps */
-%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
-
-/* const pointers */
-%apply SWIGTYPE * { SWIGTYPE *const }
-%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
-%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
-
-/* ------------------------------------------------------------
- * Overloaded operator support
- * ------------------------------------------------------------ */
-
-#ifdef __cplusplus
-%rename(__add__) *::operator+;
-%rename(__pos__) *::operator+();
-%rename(__pos__) *::operator+() const;
-%rename(__sub__) *::operator-;
-%rename(__neg__) *::operator-();
-%rename(__neg__) *::operator-() const;
-%rename(__mul__) *::operator*;
-%rename(__div__) *::operator/;
-%rename(__mod__) *::operator%;
-%rename(__lshift__) *::operator<<;
-%rename(__rshift__) *::operator>>;
-%rename(__and__) *::operator&;
-%rename(__or__) *::operator|;
-%rename(__xor__) *::operator^;
-%rename(__invert__) *::operator~;
-%rename(__iadd__) *::operator+=;
-%rename(__isub__) *::operator-=;
-%rename(__imul__) *::operator*=;
-%rename(__idiv__) *::operator/=;
-%rename(__imod__) *::operator%=;
-%rename(__ilshift__) *::operator<<=;
-%rename(__irshift__) *::operator>>=;
-%rename(__iand__) *::operator&=;
-%rename(__ior__) *::operator|=;
-%rename(__ixor__) *::operator^=;
-%rename(__lt__) *::operator<;
-%rename(__le__) *::operator<=;
-%rename(__gt__) *::operator>;
-%rename(__ge__) *::operator>=;
-%rename(__eq__) *::operator==;
-%rename(__ne__) *::operator!=;
-
-/* Special cases */
-%rename(__call__) *::operator();
-
-#endif
-/* Warnings for certain CHICKEN keywords */
-%include <chickenkw.swg>
-
-/* TinyCLOS <--> Low-level CHICKEN */
-
-%typemap("clos_in") SIMPLE_CLOS_OBJECT * "(slot-ref $input (quote this))"
-%typemap("clos_out") SIMPLE_CLOS_OBJECT * "(make $class (quote this) $1)"
-
-%insert(header) %{
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* Chicken initialization function */
-SWIGEXPORT void SWIG_init(C_word, C_word, C_word) C_noret;
-#ifdef __cplusplus
-}
-#endif
-%}
-
-%insert(closprefix) "swigclosprefix.scm"
-
-%insert(init) "swiginit.swg"
-
-%insert(init) %{
-/* CHICKEN initialization function */
-#ifdef __cplusplus
-extern "C" {
-#endif
-SWIGEXPORT void SWIG_init(C_word argc, C_word closure, C_word continuation) {
- int i;
- C_word sym;
- C_word tmp;
- C_word *a;
- C_word ret;
- C_word *return_vec;
-
- SWIG_InitializeModule(0);
- SWIG_PropagateClientData();
- ret = C_SCHEME_TRUE;
-
-#if $veclength
- return_vec = C_alloc(C_SIZEOF_VECTOR($veclength));
- ret = (C_word) return_vec;
- *(return_vec++) = C_VECTOR_TYPE | $veclength;
-#endif
-
- a = C_alloc(2*$nummethods$symsize);
-
-%}
diff --git a/linux-x86/share/swig/chicken/chickenkw.swg b/linux-x86/share/swig/chicken/chickenkw.swg
deleted file mode 100644
index d2c26c7..0000000
--- a/linux-x86/share/swig/chicken/chickenkw.swg
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef CHICKEN_CHICKENKW_SWG_
-#define CHICKEN_CHICKENKW_SWG_
-
-/* Warnings for certain CHICKEN keywords. From Section 7.1.1 of
- Revised^5 Report on the Algorithmic Language Scheme */
-#define CHICKENKW(x) %namewarn("314: '" #x "' is a R^5RS syntatic keyword") #x
-
-CHICKENKW(else);
-CHICKENKW(=>);
-CHICKENKW(define);
-CHICKENKW(unquote);
-CHICKENKW(unquote-splicing);
-CHICKENKW(quote);
-CHICKENKW(lambda);
-CHICKENKW(if);
-CHICKENKW(set!);
-CHICKENKW(begin);
-CHICKENKW(cond);
-CHICKENKW(and);
-CHICKENKW(or);
-CHICKENKW(case);
-CHICKENKW(let);
-CHICKENKW(let*);
-CHICKENKW(letrec);
-CHICKENKW(do);
-CHICKENKW(delay);
-CHICKENKW(quasiquote);
-
-#undef CHICKENKW
-
-#endif //CHICKEN_CHICKENKW_SWG_
diff --git a/linux-x86/share/swig/chicken/chickenrun.swg b/linux-x86/share/swig/chicken/chickenrun.swg
deleted file mode 100644
index bb14b4b..0000000
--- a/linux-x86/share/swig/chicken/chickenrun.swg
+++ /dev/null
@@ -1,375 +0,0 @@
-/* -----------------------------------------------------------------------------
- * chickenrun.swg
- * ----------------------------------------------------------------------------- */
-
-#include <chicken.h>
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__BORLANDC__) || defined(_WATCOM)
-# ifndef snprintf
-# define snprintf _snprintf
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SWIG_malloc(size) \
- malloc(size)
-#define SWIG_free(mem) \
- free(mem)
-#define SWIG_MakeString(c) \
- SWIG_Chicken_MakeString(c)
-#define SWIG_ConvertPtr(s, result, type, flags) \
- SWIG_Chicken_ConvertPtr(s, result, type, flags)
-#define SWIG_MustGetPtr(s, type, argnum, flags) \
- SWIG_Chicken_MustGetPtr(s, type, argnum, flags)
-#define SWIG_NewPointerObj(ptr, type, owner) \
- SWIG_Chicken_NewPointerObj((void*)ptr, type, owner, &known_space)
-#define swig_barf SWIG_Chicken_Barf
-#define SWIG_ThrowException(val) SWIG_Chicken_ThrowException(val)
-
-#define SWIG_contract_assert(expr, message) if (!(expr)) { \
- SWIG_Chicken_Barf(SWIG_BARF1_CONTRACT_ASSERT, C_text(message)); } else
-
-/* Runtime API */
-#define SWIG_GetModule(clientdata) SWIG_Chicken_GetModule(clientdata)
-#define SWIG_SetModule(clientdata, pointer) SWIG_Chicken_SetModule(pointer)
-
-#define C_swig_is_bool(x) C_truep (C_booleanp (x))
-#define C_swig_is_char(x) C_truep (C_charp (x))
-#define C_swig_is_fixnum(x) C_truep (C_fixnump (x))
-#define C_swig_is_flonum(x) (C_truep (C_blockp (x)) && C_truep (C_flonump (x)))
-#define C_swig_is_string(x) (C_truep (C_blockp (x)) && C_truep (C_stringp (x)))
-#define C_swig_is_vector(x) (C_truep (C_blockp (x)) && C_truep (C_vectorp (x)))
-#define C_swig_is_list(x) (C_truep (C_i_listp (x)))
-#define C_swig_is_pair(x) (C_truep (C_blockp(x)) && C_truep (C_pairp(x)))
-#define C_swig_is_ptr(x) (C_truep (C_blockp (x)) && C_truep (C_pointerp (x)))
-#define C_swig_is_swigpointer(x) (C_truep (C_blockp(x)) && C_truep (C_swigpointerp(x)))
-#define C_swig_is_closurep(x) (C_truep (C_blockp(x)) && C_truep(C_closurep(x)))
-#define C_swig_is_number(x) (C_swig_is_fixnum(x) || C_swig_is_flonum(x))
-#define C_swig_is_long(x) C_swig_is_number(x)
-
-#define C_swig_sizeof_closure(num) (num+1)
-
-#define SWIG_Chicken_SetupArgout { \
- C_word *a = C_alloc(C_swig_sizeof_closure(2)); \
- C_word *closure = a; \
- *(a++)=C_CLOSURE_TYPE|2; \
- *(a++)=(C_word)SWIG_Chicken_ApplyResults; \
- *(a++)=continuation; \
- continuation=(C_word)closure; \
-}
-
-#define SWIG_APPEND_VALUE(obj) { \
- C_word val = (C_word)(obj); \
- if (val != C_SCHEME_UNDEFINED) { \
- C_word *a = C_alloc(C_swig_sizeof_closure(3)); \
- C_word *closure = a; \
- *(a++)=C_CLOSURE_TYPE|3; \
- *(a++)=(C_word)SWIG_Chicken_MultiResultBuild; \
- *(a++)=(C_word)continuation; \
- *(a++)=val; \
- continuation=(C_word)closure; \
- } }
-
-#define SWIG_Chicken_FindCreateProxy(func,obj) \
- if (C_swig_is_swigpointer(obj)) { \
- swig_type_info *t = (swig_type_info *) C_block_item(obj, 1); \
- if (t && t->clientdata && ((swig_chicken_clientdata *)t->clientdata)->gc_proxy_create) { \
- func = CHICKEN_gc_root_ref( ((swig_chicken_clientdata *)t->clientdata)->gc_proxy_create); \
- } else { \
- func = C_SCHEME_FALSE; \
- } \
- } else { \
- func = C_SCHEME_FALSE; \
- }
-
-
-enum {
- SWIG_BARF1_BAD_ARGUMENT_TYPE /* 1 arg */,
- SWIG_BARF1_ARGUMENT_NULL /* 1 arg */,
- SWIG_BARF1_CONTRACT_ASSERT /* 1 arg */,
-};
-
-typedef C_word (*swig_chicken_destructor)(C_word,C_word,C_word,C_word);
-typedef struct swig_chicken_clientdata {
- void *gc_proxy_create;
- swig_chicken_destructor destroy;
-} swig_chicken_clientdata;
-
-static char *
-SWIG_Chicken_MakeString(C_word str) {
- char *ret;
- size_t l;
-
- l = C_header_size(str);
- ret = (char *) SWIG_malloc( (l + 1) * sizeof(char));
- if (!ret) return NULL;
-
- memcpy(ret, C_c_string(str), l);
- ret[l] = '\0';
- return ret;
-}
-
-static C_word SWIG_Chicken_LookupSymbol(char *name, C_SYMBOL_TABLE *stable) {
- C_word *a = C_alloc(C_SIZEOF_STRING (strlen (name)));
- C_word n = C_string2(&a, name);
- C_word sym = C_find_symbol(n, stable);
- if (C_truep(sym)) {
- return C_symbol_value(sym);
- } else {
- return C_SCHEME_FALSE;
- }
-}
-
-/* Just a helper function. Do not export it */
-static void SWIG_Chicken_Panic (C_char *) C_noret;
-static void SWIG_Chicken_Panic (C_char *msg)
-{
- C_word *a = C_alloc (C_SIZEOF_STRING (strlen (msg)));
- C_word scmmsg = C_string2 (&a, msg);
- C_halt (scmmsg);
- exit (5); /* should never get here */
-}
-
-static void
-SWIG_Chicken_Barf(int code, C_char *msg, ...) C_noret;
-static void
-SWIG_Chicken_Barf(int code, C_char *msg, ...)
-{
- char *errorhook = C_text("\003syserror-hook");
- C_word *a = C_alloc (C_SIZEOF_STRING (strlen (errorhook)));
- C_word err = C_intern2 (&a, errorhook);
- int c = -1;
- int i, barfval;
- va_list v;
-
-
- C_temporary_stack = C_temporary_stack_bottom;
- err = C_block_item(err, 0);
-
- if(C_immediatep (err))
- SWIG_Chicken_Panic (C_text ("`##sys#error-hook' is not defined"));
-
- switch (code) {
- case SWIG_BARF1_BAD_ARGUMENT_TYPE:
- barfval = C_BAD_ARGUMENT_TYPE_ERROR;
- c = 1;
- break;
- case SWIG_BARF1_ARGUMENT_NULL:
- barfval = C_BAD_ARGUMENT_TYPE_ERROR;
- c = 1;
- break;
- case SWIG_BARF1_CONTRACT_ASSERT:
- barfval = C_BAD_ARGUMENT_TYPE_ERROR;
- c = 1;
- break;
- default:
- SWIG_Chicken_Panic (C_text (msg));
- };
-
- if(c > 0 && !C_immediatep (err)) {
- C_save (C_fix (barfval));
-
- i = c;
- if (i) {
- C_word *b = C_alloc (C_SIZEOF_STRING (strlen (msg)));
- C_word scmmsg = C_string2 (&b, msg);
- C_save (scmmsg);
- i--;
- }
-
- va_start (v, msg);
-
- while(i--)
- C_save (va_arg (v, C_word));
-
- va_end (v);
- C_do_apply (c + 1, err,
- C_SCHEME_UNDEFINED); /* <- no continuation is passed:
- '##sys#error-hook' may not
- return! */
- }
- else if (msg) {
- SWIG_Chicken_Panic (msg);
- }
- else {
- SWIG_Chicken_Panic (C_text ("unspecified panic"));
- }
-}
-
-static void SWIG_Chicken_ThrowException(C_word value) C_noret;
-static void SWIG_Chicken_ThrowException(C_word value)
-{
- char *aborthook = C_text("\003sysabort");
- C_word *a = C_alloc(C_SIZEOF_STRING(strlen(aborthook)));
- C_word abort = C_intern2(&a, aborthook);
-
- abort = C_block_item(abort, 0);
- if (C_immediatep(abort))
- SWIG_Chicken_Panic(C_text("`##sys#abort' is not defined"));
-
- C_save(value);
- C_do_apply(1, abort, C_SCHEME_UNDEFINED);
-}
-
-static void
-SWIG_Chicken_Finalizer(C_word argc, C_word closure, C_word continuation, C_word s)
-{
- swig_type_info *type;
- swig_chicken_clientdata *cdata;
-
- if (argc == 3 && s != C_SCHEME_FALSE && C_swig_is_swigpointer(s)) {
- type = (swig_type_info *) C_block_item(s, 1);
- if (type) {
- cdata = (swig_chicken_clientdata *) type->clientdata;
- if (cdata && cdata->destroy) {
- /* this will not return, but will continue correctly */
- cdata->destroy(3,closure,continuation,s);
- }
- }
- }
- C_kontinue(continuation, C_SCHEME_UNDEFINED);
-}
-static C_word finalizer_obj[2] = {(C_word) (C_CLOSURE_TYPE|1), (C_word) SWIG_Chicken_Finalizer};
-
-static C_word
-SWIG_Chicken_NewPointerObj(void *ptr, swig_type_info *type, int owner, C_word **data)
-{
- swig_chicken_clientdata *cdata = (swig_chicken_clientdata *) type->clientdata;
-
- if (ptr == NULL)
- return C_SCHEME_FALSE;
- else {
- C_word cptr = C_swigmpointer(data, ptr, type);
- /* add finalizer to object */
- #ifndef SWIG_CHICKEN_NO_COLLECTION
- if (owner)
- C_do_register_finalizer(cptr, (C_word) finalizer_obj);
- #endif
-
- return cptr;
- }
-}
-
-/* Return 0 if successful. */
-static int
-SWIG_Chicken_ConvertPtr(C_word s, void **result, swig_type_info *type, int flags)
-{
- swig_cast_info *cast;
- swig_type_info *from;
-
- 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);
- if (!from) return 1;
- if (type) {
- cast = SWIG_TypeCheckStruct(from, type);
- if (cast) {
- int newmemory = 0;
- *result = SWIG_TypeCast(cast, (void *) C_block_item(s, 0), &newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- } else {
- return 1;
- }
- } else {
- *result = (void *) C_block_item(s, 0);
- }
-
- /* check if we are disowning this object */
- if (flags & SWIG_POINTER_DISOWN) {
- C_do_unregister_finalizer(s);
- }
- } else {
- return 1;
- }
-
- return 0;
-}
-
-static SWIGINLINE void *
-SWIG_Chicken_MustGetPtr (C_word s, swig_type_info *type, int argnum, int flags)
-{
- void *result;
- char err_msg[256];
- if (SWIG_Chicken_ConvertPtr(s, &result, type, flags)) {
- /* type mismatch */
- snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", argnum, (type->str ? type->str : type->name));
- SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
- }
- return result;
-}
-
-static char *chicken_runtimevar_name = "type_pointer" SWIG_TYPE_TABLE_NAME;
-
-static swig_module_info *
-SWIG_Chicken_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
- swig_module_info *ret = 0;
- C_word sym;
-
- /* lookup the type pointer... it is stored in its own symbol table */
- C_SYMBOL_TABLE *stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION);
- if (stable != NULL) {
- sym = SWIG_Chicken_LookupSymbol(chicken_runtimevar_name, stable);
- if (C_truep(sym) && C_swig_is_ptr(sym)) {
- ret = (swig_module_info *) C_block_item(sym, 0);
- }
- }
-
- return ret;
-}
-
-static void
-SWIG_Chicken_SetModule(swig_module_info *module) {
- C_word *a;
- C_SYMBOL_TABLE *stable;
- C_word sym;
- C_word pointer;
- static C_word *space = 0;
-
- /* type pointer is stored in its own symbol table */
- stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION);
- if (stable == NULL) {
- stable = C_new_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION, 16);
- }
-
- if (!space) {
- space = (C_word *) C_malloc((C_SIZEOF_POINTER + C_SIZEOF_INTERNED_SYMBOL(C_strlen(chicken_runtimevar_name))) * sizeof(C_word));
- }
- a = space;
- pointer = C_mpointer(&a, (void *) module);
- sym = C_intern_in(&a, C_strlen(chicken_runtimevar_name), chicken_runtimevar_name, stable);
- C_set_block_item(sym, 0, pointer);
-}
-
-static C_word SWIG_Chicken_MultiResultBuild(C_word num, C_word closure, C_word lst) {
- C_word cont = C_block_item(closure,1);
- C_word obj = C_block_item(closure,2);
- C_word func;
-
- SWIG_Chicken_FindCreateProxy(func,obj);
-
- if (C_swig_is_closurep(func)) {
- ((C_proc4)(void *)C_block_item(func, 0))(4,func,cont,obj,lst);
- } else {
- C_word *a = C_alloc(C_SIZEOF_PAIR);
- C_kontinue(cont,C_pair(&a,obj,lst));
- }
- return C_SCHEME_UNDEFINED; /* never reached */
-}
-
-static C_word SWIG_Chicken_ApplyResults(C_word num, C_word closure, C_word result) {
- C_apply_values(3,C_SCHEME_UNDEFINED,C_block_item(closure,1),result);
- return C_SCHEME_UNDEFINED; /* never reached */
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/linux-x86/share/swig/chicken/extra-install.list b/linux-x86/share/swig/chicken/extra-install.list
deleted file mode 100644
index 48721ce..0000000
--- a/linux-x86/share/swig/chicken/extra-install.list
+++ /dev/null
@@ -1,3 +0,0 @@
-swigclosprefix.scm
-multi-generic.scm
-tinyclos-multi-generic.patch
diff --git a/linux-x86/share/swig/chicken/multi-generic.scm b/linux-x86/share/swig/chicken/multi-generic.scm
deleted file mode 100644
index 9d2e31d..0000000
--- a/linux-x86/share/swig/chicken/multi-generic.scm
+++ /dev/null
@@ -1,152 +0,0 @@
-;; This file is no longer necessary with Chicken versions above 1.92
-;;
-;; This file overrides two functions inside TinyCLOS to provide support
-;; for multi-argument generics. There are many ways of linking this file
-;; into your code... all that needs to happen is this file must be
-;; executed after loading TinyCLOS but before any SWIG modules are loaded
-;;
-;; something like the following
-;; (require 'tinyclos)
-;; (load "multi-generic")
-;; (declare (uses swigmod))
-;;
-;; An alternative to loading this scheme code directly is to add a
-;; (declare (unit multi-generic)) to the top of this file, and then
-;; compile this into the final executable or something. Or compile
-;; this into an extension.
-
-;; Lastly, to override TinyCLOS method creation, two functions are
-;; overridden: see the end of this file for which two are overridden.
-;; You might want to remove those two lines and then exert more control over
-;; which functions are used when.
-
-;; Comments, bugs, suggestions: send either to chicken-users@nongnu.org or to
-;; Most code copied from TinyCLOS
-
-(define <multi-generic> (make <entity-class>
- 'name "multi-generic"
- 'direct-supers (list <generic>)
- 'direct-slots '()))
-
-(letrec ([applicable?
- (lambda (c arg)
- (memq c (class-cpl (class-of arg))))]
-
- [more-specific?
- (lambda (c1 c2 arg)
- (memq c2 (memq c1 (class-cpl (class-of arg)))))]
-
- [filter-in
- (lambda (f l)
- (if (null? l)
- '()
- (let ([h (##sys#slot l 0)]
- [r (##sys#slot l 1)] )
- (if (f h)
- (cons h (filter-in f r))
- (filter-in f r) ) ) ) )])
-
-(add-method compute-apply-generic
- (make-method (list <multi-generic>)
- (lambda (call-next-method generic)
- (lambda args
- (let ([cam (let ([x (compute-apply-methods generic)]
- [y ((compute-methods generic) args)] )
- (lambda (args) (x y args)) ) ] )
- (cam args) ) ) ) ) )
-
-
-
-(add-method compute-methods
- (make-method (list <multi-generic>)
- (lambda (call-next-method generic)
- (lambda (args)
- (let ([applicable
- (filter-in (lambda (method)
- (let check-applicable ([list1 (method-specializers method)]
- [list2 args])
- (cond ((null? list1) #t)
- ((null? list2) #f)
- (else
- (and (applicable? (##sys#slot list1 0) (##sys#slot list2 0))
- (check-applicable (##sys#slot list1 1) (##sys#slot list2 1)))))))
- (generic-methods generic) ) ] )
- (if (or (null? applicable) (null? (##sys#slot applicable 1)))
- applicable
- (let ([cmms (compute-method-more-specific? generic)])
- (sort applicable (lambda (m1 m2) (cmms m1 m2 args))) ) ) ) ) ) ) )
-
-(add-method compute-method-more-specific?
- (make-method (list <multi-generic>)
- (lambda (call-next-method generic)
- (lambda (m1 m2 args)
- (let loop ((specls1 (method-specializers m1))
- (specls2 (method-specializers m2))
- (args args))
- (cond-expand
- [unsafe
- (let ((c1 (##sys#slot specls1 0))
- (c2 (##sys#slot specls2 0))
- (arg (##sys#slot args 0)))
- (if (eq? c1 c2)
- (loop (##sys#slot specls1 1)
- (##sys#slot specls2 1)
- (##sys#slot args 1))
- (more-specific? c1 c2 arg))) ]
- [else
- (cond ((and (null? specls1) (null? specls2))
- (##sys#error "two methods are equally specific" generic))
- ;((or (null? specls1) (null? specls2))
- ; (##sys#error "two methods have different number of specializers" generic))
- ((null? specls1) #f)
- ((null? specls2) #t)
- ((null? args)
- (##sys#error "fewer arguments than specializers" generic))
- (else
- (let ((c1 (##sys#slot specls1 0))
- (c2 (##sys#slot specls2 0))
- (arg (##sys#slot args 0)))
- (if (eq? c1 c2)
- (loop (##sys#slot specls1 1)
- (##sys#slot specls2 1)
- (##sys#slot args 1))
- (more-specific? c1 c2 arg)))) ) ] ) ) ) ) ) )
-
-) ;; end of letrec
-
-(define multi-add-method
- (lambda (generic method)
- (slot-set!
- generic
- 'methods
- (let filter-in-method ([methods (slot-ref generic 'methods)])
- (if (null? methods)
- (list method)
- (let ([l1 (length (method-specializers method))]
- [l2 (length (method-specializers (##sys#slot methods 0)))])
- (cond ((> l1 l2)
- (cons (##sys#slot methods 0) (filter-in-method (##sys#slot methods 1))))
- ((< l1 l2)
- (cons method methods))
- (else
- (let check-method ([ms1 (method-specializers method)]
- [ms2 (method-specializers (##sys#slot methods 0))])
- (cond ((and (null? ms1) (null? ms2))
- (cons method (##sys#slot methods 1))) ;; skip the method already in the generic
- ((eq? (##sys#slot ms1 0) (##sys#slot ms2 0))
- (check-method (##sys#slot ms1 1) (##sys#slot ms2 1)))
- (else
- (cons (##sys#slot methods 0) (filter-in-method (##sys#slot methods 1))))))))))))
-
- (##sys#setslot (##sys#slot generic (- (##sys#size generic) 2)) 1 (compute-apply-generic generic)) ))
-
-(define (multi-add-global-method val sym specializers proc)
- (let ((generic (if (procedure? val) val (make <multi-generic> 'name (##sys#symbol->string sym)))))
- (multi-add-method generic (make-method specializers proc))
- generic))
-
-;; Might want to remove these, or perhaps do something like
-;; (define old-add-method ##tinyclos#add-method)
-;; and then you can switch between creating multi-generics and TinyCLOS generics.
-(set! ##tinyclos#add-method multi-add-method)
-(set! ##tinyclos#add-global-method multi-add-global-method)
diff --git a/linux-x86/share/swig/chicken/std_string.i b/linux-x86/share/swig/chicken/std_string.i
deleted file mode 100644
index fa77c15..0000000
--- a/linux-x86/share/swig/chicken/std_string.i
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_string.i
- *
- * SWIG typemaps for std::string
- * ----------------------------------------------------------------------------- */
-
-%{
-#include <string>
-%}
-
-namespace std {
- %naturalvar string;
-
-
- %insert(closprefix) %{ (declare (hide <std-string>)) %}
- %nodefault string;
- %rename("std-string") string;
- class string {
- public:
- ~string() {}
- };
- %extend string {
- char *str;
- }
- %{
- #define std_string_str_get(s) ((char *)((s)->c_str()))
- #define std_string_str_set(s,v) (s->assign((char *)(v)))
- %}
-
- %typemap(typecheck) string = char *;
- %typemap(typecheck) const string & = char *;
-
- %typemap(in) string (char * tempptr) {
- if ($input == C_SCHEME_FALSE) {
- $1.resize(0);
- } else {
- if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE,
- "Argument #$argnum is not a string");
- }
- tempptr = SWIG_MakeString($input);
- $1.assign(tempptr);
- if (tempptr) SWIG_free(tempptr);
- }
- }
-
- %typemap(in) const string& ($*1_ltype temp, char *tempptr) {
-
- if ($input == C_SCHEME_FALSE) {
- temp.resize(0);
- $1 = &temp;
- } else {
- if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE,
- "Argument #$argnum is not a string");
- }
- tempptr = SWIG_MakeString($input);
- temp.assign(tempptr);
- if (tempptr) SWIG_free(tempptr);
- $1 = &temp;
- }
- }
-
- %typemap(out) string {
- int size = $1.size();
- C_word *space = C_alloc (C_SIZEOF_STRING (size));
- $result = C_string (&space, size, (char *) $1.c_str());
- }
-
- %typemap(out) const string& {
- int size = $1->size();
- C_word *space = C_alloc (C_SIZEOF_STRING (size));
- $result = C_string (&space, size, (char *) $1->c_str());
- }
-
- %typemap(varin) string {
- if ($input == C_SCHEME_FALSE) {
- $1.resize(0);
- } else {
- char *tempptr;
- if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE,
- "Argument #$argnum is not a string");
- }
- tempptr = SWIG_MakeString($input);
- $1.assign(tempptr);
- if (tempptr) SWIG_free(tempptr);
- }
- }
-
- %typemap(varout) string {
- int size = $1.size();
- C_word *space = C_alloc (C_SIZEOF_STRING (size));
- $result = C_string (&space, size, (char *) $1.c_str());
- }
-}
diff --git a/linux-x86/share/swig/chicken/swigclosprefix.scm b/linux-x86/share/swig/chicken/swigclosprefix.scm
deleted file mode 100644
index e4bd72b..0000000
--- a/linux-x86/share/swig/chicken/swigclosprefix.scm
+++ /dev/null
@@ -1,31 +0,0 @@
-(declare (hide swig-initialize))
-
-(define (swig-initialize obj initargs create)
- (slot-set! obj 'swig-this
- (if (memq 'swig-this initargs)
- (cadr initargs)
- (let ((ret (apply create initargs)))
- (if (instance? ret)
- (slot-ref ret 'swig-this)
- ret)))))
-
-(define-class <swig-metaclass-$module> (<class>) (void))
-
-(define-method (compute-getter-and-setter (class <swig-metaclass-$module>) slot allocator)
- (if (not (memq ':swig-virtual slot))
- (call-next-method)
- (let ((getter (let search-get ((lst slot))
- (if (null? lst)
- #f
- (if (eq? (car lst) ':swig-get)
- (cadr lst)
- (search-get (cdr lst))))))
- (setter (let search-set ((lst slot))
- (if (null? lst)
- #f
- (if (eq? (car lst) ':swig-set)
- (cadr lst)
- (search-set (cdr lst)))))))
- (values
- (lambda (o) (getter (slot-ref o 'swig-this)))
- (lambda (o new) (setter (slot-ref o 'swig-this) new) new)))))
diff --git a/linux-x86/share/swig/chicken/tinyclos-multi-generic.patch b/linux-x86/share/swig/chicken/tinyclos-multi-generic.patch
deleted file mode 100644
index 2e58596..0000000
--- a/linux-x86/share/swig/chicken/tinyclos-multi-generic.patch
+++ /dev/null
@@ -1,150 +0,0 @@
-# This patch is against chicken 1.92, but it should work just fine
-# with older versions of chicken. It adds support for mulit-argument
-# generics, that is, generics now correctly handle adding methods
-# with different lengths of specializer lists
-
-# This patch has been committed into the CHICKEN darcs repository,
-# so chicken versions above 1.92 work fine.
-
-# Comments, bugs, suggestions send to chicken-users@nongnu.org
-
-# Patch written by John Lenz <lenz@cs.wisc.edu>
-
---- tinyclos.scm.old 2005-04-05 01:13:56.000000000 -0500
-+++ tinyclos.scm 2005-04-11 16:37:23.746181489 -0500
-@@ -37,8 +37,10 @@
-
- (include "parameters")
-
-+(cond-expand [(not chicken-compile-shared) (declare (unit tinyclos))]
-+ [else] )
-+
- (declare
-- (unit tinyclos)
- (uses extras)
- (usual-integrations)
- (fixnum)
-@@ -234,7 +236,10 @@
- y = C_block_item(y, 1);
- }
- }
-- return(C_block_item(v, i + 1));
-+ if (x == C_SCHEME_END_OF_LIST && y == C_SCHEME_END_OF_LIST)
-+ return(C_block_item(v, i + 1));
-+ else
-+ goto mismatch;
- }
- else if(free_index == -1) free_index = i;
- mismatch:
-@@ -438,7 +443,7 @@
- (define hash-arg-list
- (foreign-lambda* unsigned-int ((scheme-object args) (scheme-object svector)) "
- C_word tag, h, x;
-- int n, i, j;
-+ int n, i, j, len = 0;
- for(i = 0; args != C_SCHEME_END_OF_LIST; args = C_block_item(args, 1)) {
- x = C_block_item(args, 0);
- if(C_immediatep(x)) {
-@@ -481,8 +486,9 @@
- default: i += 255;
- }
- }
-+ ++len;
- }
-- return(i & (C_METHOD_CACHE_SIZE - 1));") )
-+ return((i + len) & (C_METHOD_CACHE_SIZE - 1));") )
-
-
- ;
-@@ -868,13 +874,27 @@
- (##tinyclos#slot-set!
- generic
- 'methods
-- (cons method
-- (filter-in
-- (lambda (m)
-- (let ([ms1 (method-specializers m)]
-- [ms2 (method-specializers method)] )
-- (not (every2 (lambda (x y) (eq? x y)) ms1 ms2) ) ) )
-- (##tinyclos#slot-ref generic 'methods))))
-+ (let* ([ms1 (method-specializers method)]
-+ [l1 (length ms1)] )
-+ (let filter-in-method ([methods (##tinyclos#slot-ref generic 'methods)])
-+ (if (null? methods)
-+ (list method)
-+ (let* ([mm (##sys#slot methods 0)]
-+ [ms2 (method-specializers mm)]
-+ [l2 (length ms2)])
-+ (cond ((> l1 l2)
-+ (cons mm (filter-in-method (##sys#slot methods 1))))
-+ ((< l1 l2)
-+ (cons method methods))
-+ (else
-+ (let check-method ([ms1 ms1]
-+ [ms2 ms2])
-+ (cond ((and (null? ms1) (null? ms2))
-+ (cons method (##sys#slot methods 1))) ;; skip the method already in the generic
-+ ((eq? (##sys#slot ms1 0) (##sys#slot ms2 0))
-+ (check-method (##sys#slot ms1 1) (##sys#slot ms2 1)))
-+ (else
-+ (cons mm (filter-in-method (##sys#slot methods 1)))))))))))))
- (if (memq generic generic-invocation-generics)
- (set! method-cache-tag (vector))
- (%entity-cache-set! generic #f) )
-@@ -925,11 +945,13 @@
- (memq (car args) generic-invocation-generics))
- (let ([proc
- (method-procedure
-+ ; select the first method of one argument
- (let lp ([lis (generic-methods generic)])
-- (let ([tail (##sys#slot lis 1)])
-- (if (null? tail)
-- (##sys#slot lis 0)
-- (lp tail)) ) ) ) ] )
-+ (if (null? lis)
-+ (##sys#error "Unable to find original compute-apply-generic")
-+ (if (= (length (method-specializers (##sys#slot lis 0))) 1)
-+ (##sys#slot lis 0)
-+ (lp (##sys#slot lis 1)))))) ] )
- (lambda (args) (apply proc #f args)) )
- (let ([x (compute-apply-methods generic)]
- [y ((compute-methods generic) args)] )
-@@ -946,9 +968,13 @@
- (lambda (args)
- (let ([applicable
- (filter-in (lambda (method)
-- (every2 applicable?
-- (method-specializers method)
-- args))
-+ (let check-applicable ([list1 (method-specializers method)]
-+ [list2 args])
-+ (cond ((null? list1) #t)
-+ ((null? list2) #f)
-+ (else
-+ (and (applicable? (##sys#slot list1 0) (##sys#slot list2 0))
-+ (check-applicable (##sys#slot list1 1) (##sys#slot list2 1)))))))
- (generic-methods generic) ) ] )
- (if (or (null? applicable) (null? (##sys#slot applicable 1)))
- applicable
-@@ -975,8 +1001,10 @@
- [else
- (cond ((and (null? specls1) (null? specls2))
- (##sys#error "two methods are equally specific" generic))
-- ((or (null? specls1) (null? specls2))
-- (##sys#error "two methods have different number of specializers" generic))
-+ ;((or (null? specls1) (null? specls2))
-+ ; (##sys#error "two methods have different number of specializers" generic))
-+ ((null? specls1) #f)
-+ ((null? specls2) #t)
- ((null? args)
- (##sys#error "fewer arguments than specializers" generic))
- (else
-@@ -1210,7 +1238,7 @@
- (define <structure> (make-primitive-class "structure"))
- (define <procedure> (make-primitive-class "procedure" <procedure-class>))
- (define <end-of-file> (make-primitive-class "end-of-file"))
--(define <environment> (make-primitive-class "environment" <structure>)) ; (Benedikt insisted on this)
-+(define <environment> (make-primitive-class "environment" <structure>))
- (define <hash-table> (make-primitive-class "hash-table" <structure>))
- (define <promise> (make-primitive-class "promise" <structure>))
- (define <queue> (make-primitive-class "queue" <structure>))
diff --git a/linux-x86/share/swig/chicken/typemaps.i b/linux-x86/share/swig/chicken/typemaps.i
deleted file mode 100644
index fd587fd..0000000
--- a/linux-x86/share/swig/chicken/typemaps.i
+++ /dev/null
@@ -1,314 +0,0 @@
-/* -----------------------------------------------------------------------------
- * typemaps.i
- *
- * Pointer handling
- *
- * These mappings provide support for input/output arguments and
- * common uses for C/C++ pointers. INOUT mappings allow for C/C++
- * pointer variables in addition to input/output arguments.
- * ----------------------------------------------------------------------------- */
-
-// INPUT typemaps.
-// These remap a C pointer to be an "INPUT" value which is passed by value
-// instead of reference.
-
-/*
-The following methods can be applied to turn a pointer into a simple
-"input" value. That is, instead of passing a pointer to an object,
-you would use a real value instead.
-
- int *INPUT
- short *INPUT
- long *INPUT
- long long *INPUT
- unsigned int *INPUT
- unsigned short *INPUT
- unsigned long *INPUT
- unsigned long long *INPUT
- unsigned char *INPUT
- char *INPUT
- bool *INPUT
- float *INPUT
- double *INPUT
-
-To use these, suppose you had a C function like this :
-
- double fadd(double *a, double *b) {
- return *a+*b;
- }
-
-You could wrap it with SWIG as follows :
-
- %include <typemaps.i>
- double fadd(double *INPUT, double *INPUT);
-
-or you can use the %apply directive :
-
- %include <typemaps.i>
- %apply double *INPUT { double *a, double *b };
- double fadd(double *a, double *b);
-
-*/
-
-// OUTPUT typemaps. These typemaps are used for parameters that
-// are output only. The output value is appended to the result as
-// a list element.
-
-/*
-The following methods can be applied to turn a pointer into an "output"
-value. When calling a function, no input value would be given for
-a parameter, but an output value would be returned. In the case of
-multiple output values, they are returned in the form of a Scheme list.
-
- int *OUTPUT
- short *OUTPUT
- long *OUTPUT
- long long *OUTPUT
- unsigned int *OUTPUT
- unsigned short *OUTPUT
- unsigned long *OUTPUT
- unsigned long long *OUTPUT
- unsigned char *OUTPUT
- char *OUTPUT
- bool *OUTPUT
- float *OUTPUT
- double *OUTPUT
-
-For example, suppose you were trying to wrap the modf() function in the
-C math library which splits x into integral and fractional parts (and
-returns the integer part in one of its parameters).K:
-
- double modf(double x, double *ip);
-
-You could wrap it with SWIG as follows :
-
- %include <typemaps.i>
- double modf(double x, double *OUTPUT);
-
-or you can use the %apply directive :
-
- %include <typemaps.i>
- %apply double *OUTPUT { double *ip };
- double modf(double x, double *ip);
-
-*/
-
-//----------------------------------------------------------------------
-//
-// T_OUTPUT typemap (and helper function) to return multiple argouts as
-// a tuple instead of a list.
-//
-//----------------------------------------------------------------------
-
-// Simple types
-
-%define INOUT_TYPEMAP(type_, from_scheme, to_scheme, checker, convtype, storage_)
-
-%typemap(in) type_ *INPUT($*1_ltype temp), type_ &INPUT($*1_ltype temp)
-%{ if (!checker ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument #$argnum is not of type 'type_'");
- }
- temp = ($*1_ltype) from_scheme ($input);
- $1 = &temp; %}
-
-%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;"
-
-#if "storage_" == "0"
-
-%typemap(argout) type_ *OUTPUT, type_ &OUTPUT
-%{
- if ($1 == NULL) {
- swig_barf (SWIG_BARF1_ARGUMENT_NULL, "Argument #$argnum must be non-null");
- }
- SWIG_APPEND_VALUE(to_scheme (convtype (*$1)));
-%}
-
-#else
-
-%typemap(argout) type_ *OUTPUT, type_ &OUTPUT
-%{
- {
- C_word *known_space = C_alloc(storage_);
- if ($1 == NULL) {
- swig_barf (SWIG_BARF1_ARGUMENT_NULL, "Variable '$1' must be non-null");
- }
- SWIG_APPEND_VALUE(to_scheme (&known_space, convtype (*$1)));
- }
-%}
-
-#endif
-
-%enddef
-
-INOUT_TYPEMAP(int, C_num_to_int, C_fix, C_swig_is_number, (int), 0);
-INOUT_TYPEMAP(enum SWIGTYPE, C_num_to_int, C_fix, C_swig_is_number, (int), 0);
-INOUT_TYPEMAP(short, C_num_to_int, C_fix, C_swig_is_number, (int), 0);
-INOUT_TYPEMAP(long, C_num_to_long, C_long_to_num, C_swig_is_long, (long), C_SIZEOF_FLONUM);
-INOUT_TYPEMAP(long long, C_num_to_long, C_long_to_num, C_swig_is_long, (long), C_SIZEOF_FLONUM);
-INOUT_TYPEMAP(unsigned int, C_num_to_unsigned_int, C_unsigned_int_to_num, C_swig_is_number, (int), C_SIZEOF_FLONUM);
-INOUT_TYPEMAP(unsigned short, C_num_to_unsigned_int, C_fix, C_swig_is_number, (unsigned int), 0);
-INOUT_TYPEMAP(unsigned long, C_num_to_unsigned_long, C_unsigned_long_to_num, C_swig_is_long, (unsigned long), C_SIZEOF_FLONUM);
-INOUT_TYPEMAP(unsigned long long, C_num_to_unsigned_long, C_unsigned_long_to_num, C_swig_is_long, (unsigned long), C_SIZEOF_FLONUM);
-INOUT_TYPEMAP(unsigned char, C_character_code, C_make_character, C_swig_is_char, (unsigned int), 0);
-INOUT_TYPEMAP(signed char, C_character_code, C_make_character, C_swig_is_char, (int), 0);
-INOUT_TYPEMAP(char, C_character_code, C_make_character, C_swig_is_char, (char), 0);
-INOUT_TYPEMAP(bool, C_truep, C_mk_bool, C_swig_is_bool, (bool), 0);
-INOUT_TYPEMAP(float, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEOF_FLONUM);
-INOUT_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEOF_FLONUM);
-
-// INOUT
-// Mappings for an argument that is both an input and output
-// parameter
-
-/*
-The following methods can be applied to make a function parameter both
-an input and output value. This combines the behavior of both the
-"INPUT" and "OUTPUT" methods described earlier. Output values are
-returned in the form of a CHICKEN tuple.
-
- int *INOUT
- short *INOUT
- long *INOUT
- long long *INOUT
- unsigned int *INOUT
- unsigned short *INOUT
- unsigned long *INOUT
- unsigned long long *INOUT
- unsigned char *INOUT
- char *INOUT
- bool *INOUT
- float *INOUT
- double *INOUT
-
-For example, suppose you were trying to wrap the following function :
-
- void neg(double *x) {
- *x = -(*x);
- }
-
-You could wrap it with SWIG as follows :
-
- %include <typemaps.i>
- void neg(double *INOUT);
-
-or you can use the %apply directive :
-
- %include <typemaps.i>
- %apply double *INOUT { double *x };
- void neg(double *x);
-
-As well, you can wrap variables with :
-
- %include <typemaps.i>
- %apply double *INOUT { double *y };
- extern double *y;
-
-Unlike C, this mapping does not directly modify the input value (since
-this makes no sense in CHICKEN). Rather, the modified input value shows
-up as the return value of the function. Thus, to apply this function
-to a CHICKEN variable you might do this :
-
- x = neg(x)
-
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
-*/
-
-%typemap(in) int *INOUT = int *INPUT;
-%typemap(in) enum SWIGTYPE *INOUT = enum SWIGTYPE *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 long long *INOUT = unsigned long long *INPUT;
-%typemap(in) unsigned char *INOUT = unsigned char *INPUT;
-%typemap(in) char *INOUT = 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) enum SWIGTYPE &INOUT = enum SWIGTYPE &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 long long &INOUT = unsigned long long &INPUT;
-%typemap(in) unsigned char &INOUT = unsigned char &INPUT;
-%typemap(in) char &INOUT = char &INPUT;
-%typemap(in) bool &INOUT = bool &INPUT;
-%typemap(in) float &INOUT = float &INPUT;
-%typemap(in) double &INOUT = double &INPUT;
-
-%typemap(argout) int *INOUT = int *OUTPUT;
-%typemap(argout) enum SWIGTYPE *INOUT = enum SWIGTYPE *OUTPUT;
-%typemap(argout) short *INOUT = short *OUTPUT;
-%typemap(argout) long *INOUT = long *OUTPUT;
-%typemap(argout) long long *INOUT = long long *OUTPUT;
-%typemap(argout) unsigned *INOUT = unsigned *OUTPUT;
-%typemap(argout) unsigned short *INOUT = unsigned short *OUTPUT;
-%typemap(argout) unsigned long *INOUT = unsigned long *OUTPUT;
-%typemap(argout) unsigned long long *INOUT = unsigned long long *OUTPUT;
-%typemap(argout) unsigned char *INOUT = unsigned 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) enum SWIGTYPE &INOUT = enum SWIGTYPE &OUTPUT;
-%typemap(argout) short &INOUT = short &OUTPUT;
-%typemap(argout) long &INOUT = long &OUTPUT;
-%typemap(argout) long long &INOUT = long long &OUTPUT;
-%typemap(argout) unsigned &INOUT = unsigned &OUTPUT;
-%typemap(argout) unsigned short &INOUT = unsigned short &OUTPUT;
-%typemap(argout) unsigned long &INOUT = unsigned long &OUTPUT;
-%typemap(argout) unsigned long long &INOUT = unsigned long long &OUTPUT;
-%typemap(argout) unsigned char &INOUT = unsigned char &OUTPUT;
-%typemap(argout) char &INOUT = char &OUTPUT;
-%typemap(argout) bool &INOUT = bool &OUTPUT;
-%typemap(argout) float &INOUT = float &OUTPUT;
-%typemap(argout) double &INOUT = double &OUTPUT;
-
-/* Overloading information */
-
-%typemap(typecheck) double *INOUT = double;
-%typemap(typecheck) bool *INOUT = bool;
-%typemap(typecheck) char *INOUT = char;
-%typemap(typecheck) signed char *INOUT = signed char;
-%typemap(typecheck) unsigned char *INOUT = unsigned char;
-%typemap(typecheck) unsigned long *INOUT = unsigned long;
-%typemap(typecheck) unsigned long long *INOUT = unsigned long long;
-%typemap(typecheck) unsigned short *INOUT = unsigned short;
-%typemap(typecheck) unsigned int *INOUT = unsigned int;
-%typemap(typecheck) long *INOUT = long;
-%typemap(typecheck) long long *INOUT = long long;
-%typemap(typecheck) short *INOUT = short;
-%typemap(typecheck) int *INOUT = int;
-%typemap(typecheck) enum SWIGTYPE *INOUT = enum SWIGTYPE;
-%typemap(typecheck) float *INOUT = float;
-
-%typemap(typecheck) double &INOUT = double;
-%typemap(typecheck) bool &INOUT = bool;
-%typemap(typecheck) char &INOUT = char;
-%typemap(typecheck) signed char &INOUT = signed char;
-%typemap(typecheck) unsigned char &INOUT = unsigned char;
-%typemap(typecheck) unsigned long &INOUT = unsigned long;
-%typemap(typecheck) unsigned long long &INOUT = unsigned long long;
-%typemap(typecheck) unsigned short &INOUT = unsigned short;
-%typemap(typecheck) unsigned int &INOUT = unsigned int;
-%typemap(typecheck) long &INOUT = long;
-%typemap(typecheck) long long &INOUT = long long;
-%typemap(typecheck) short &INOUT = short;
-%typemap(typecheck) int &INOUT = int;
-%typemap(typecheck) enum SWIGTYPE &INOUT = enum SWIGTYPE;
-%typemap(typecheck) float &INOUT = float;
diff --git a/linux-x86/share/swig/clisp/clisp.swg b/linux-x86/share/swig/clisp/clisp.swg
deleted file mode 100644
index e1d330c..0000000
--- a/linux-x86/share/swig/clisp/clisp.swg
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -----------------------------------------------------------------------------
- * clisp.swg
- * ----------------------------------------------------------------------------- */
-
-/* Define a C preprocessor symbol that can be used in interface files
- to distinguish between the SWIG language modules. */
-
-#define SWIG_CLISP
-
-/* Typespecs for basic types. */
-
-%typemap(in) void "NIL";
-
-%typemap(in) char "character";
-%typemap(in) char * "ffi:c-string";
-%typemap(in) unsigned char "ffi:uchar";
-%typemap(in) signed char "ffi:char";
-
-%typemap(in) short "ffi:short";
-%typemap(in) signed short "ffi:short";
-%typemap(in) unsigned short "ffi:ushort";
-
-%typemap(in) int "ffi:int";
-%typemap(in) signed int "ffi:int";
-%typemap(in) unsigned int "ffi:uint";
-
-%typemap(in) long "ffi:long";
-%typemap(in) signed long "ffi:long";
-%typemap(in) unsigned long "ffi:ulong";
-
-%typemap(in) float "SINGLE-FLOAT";
-%typemap(in) double "DOUBLE-FLOAT";
diff --git a/linux-x86/share/swig/constraints.i b/linux-x86/share/swig/constraints.i
index 8bc7f91..77e9778 100644
--- a/linux-x86/share/swig/constraints.i
+++ b/linux-x86/share/swig/constraints.i
@@ -8,67 +8,60 @@
* errors in a language-independent manner.
* ----------------------------------------------------------------------------- */
-#ifdef AUTODOC
-%text %{
-%include <constraints.i>
-
-This library provides support for applying constraints to function
-arguments. Using a constraint, you can restrict arguments to be
-positive numbers, non-NULL pointers, and so on. The following
-constraints are available :
-
- Number POSITIVE - Positive number (not zero)
- Number NEGATIVE - Negative number (not zero)
- Number NONZERO - Nonzero number
- Number NONNEGATIVE - Positive number (including zero)
- Number NONPOSITIVE - Negative number (including zero)
- Pointer NONNULL - Non-NULL pointer
- Pointer ALIGN8 - 8-byte aligned pointer
- Pointer ALIGN4 - 4-byte aligned pointer
- Pointer ALIGN2 - 2-byte aligned pointer
-
-To use the constraints, you need to "apply" them to specific
-function arguments in your code. This is done using the %apply
-directive. For example :
-
- %apply Number NONNEGATIVE { double nonneg };
- double sqrt(double nonneg); // Name of argument must match
-
- %apply Pointer NONNULL { void *ptr };
- void *malloc(int POSITIVE); // May return a NULL pointer
- void free(void *ptr); // May not accept a NULL pointer
-
-Any function argument of the type you specify with the %apply directive
-will be checked with the appropriate constraint. Multiple types may
-be specified as follows :
-
- %apply Pointer NONNULL { void *, Vector *, List *, double *};
-
-In this case, all of the types listed would be checked for non-NULL
-pointers.
-
-The common datatypes of int, short, long, unsigned int, unsigned long,
-unsigned short, unsigned char, signed char, float, and double can be
-checked without using the %apply directive by simply using the
-constraint name as the parameter name. For example :
-
- double sqrt(double NONNEGATIVE);
- double log(double POSITIVE);
-
-If you have used typedef to change type-names, you can also do this :
-
- %apply double { Real }; // Make everything defined for doubles
- // work for Reals.
- Real sqrt(Real NONNEGATIVE);
- Real log(Real POSITIVE);
-
-%}
-#endif
+// This library provides support for applying constraints to function
+// arguments. Using a constraint, you can restrict arguments to be
+// positive numbers, non-NULL pointers, and so on. The following
+// constraints are available :
+//
+// Number POSITIVE - Positive number (not zero)
+// Number NEGATIVE - Negative number (not zero)
+// Number NONZERO - Nonzero number
+// Number NONNEGATIVE - Positive number (including zero)
+// Number NONPOSITIVE - Negative number (including zero)
+// Pointer NONNULL - Non-NULL pointer
+// Pointer ALIGN8 - 8-byte aligned pointer
+// Pointer ALIGN4 - 4-byte aligned pointer
+// Pointer ALIGN2 - 2-byte aligned pointer
+//
+// To use the constraints, you need to "apply" them to specific
+// function arguments in your code. This is done using the %apply
+// directive. For example :
+//
+// %apply Number NONNEGATIVE { double nonneg };
+// double sqrt(double nonneg); // Name of argument must match
+//
+// %apply Pointer NONNULL { FILE *stream };
+// FILE *fdopen(int NONNEGATIVE); // May return a NULL pointer
+// int fclose(void *stream); // Does not accept a NULL pointer
+//
+// Any function argument of the type you specify with the %apply directive
+// will be checked with the appropriate constraint. Multiple types may
+// be specified as follows :
+//
+// %apply Pointer NONNULL { void *, Vector *, List *, double *};
+//
+// In this case, all of the types listed would be checked for non-NULL
+// pointers.
+//
+// The common datatypes of int, short, long, unsigned int, unsigned long,
+// unsigned short, unsigned char, signed char, float, and double can be
+// checked without using the %apply directive by simply using the
+// constraint name as the parameter name. For example :
+//
+// double sqrt(double NONNEGATIVE);
+// double log(double POSITIVE);
+//
+// If you have used typedef to change type-names, you can also do this :
+//
+// %apply double { Real }; // Make everything defined for doubles
+// // work for Reals.
+// Real sqrt(Real NONNEGATIVE);
+// Real log(Real POSITIVE);
%include <exception.i>
-#ifdef SWIGCSHARP
-// Required attribute for C# exception handling
+#if defined(SWIGCSHARP) || defined(SWIGD)
+// Required attribute for C# and D exception handling
#define SWIGCSHARPCANTHROW , canthrow=1
#else
#define SWIGCSHARPCANTHROW
diff --git a/linux-x86/share/swig/cpointer.i b/linux-x86/share/swig/cpointer.i
index 881c511..df40c04 100644
--- a/linux-x86/share/swig/cpointer.i
+++ b/linux-x86/share/swig/cpointer.i
@@ -5,6 +5,12 @@
* pointer objects.
* ----------------------------------------------------------------------------- */
+#ifndef __cplusplus
+// C uses free/calloc/malloc
+%include "swigfragments.swg"
+%fragment("<stdlib.h>");
+#endif
+
/* -----------------------------------------------------------------------------
* %pointer_class(type,name)
*
@@ -55,14 +61,14 @@ NAME() {
return new TYPE();
}
~NAME() {
- if ($self) delete $self;
+ delete $self;
}
#else
NAME() {
return (TYPE *) calloc(1,sizeof(TYPE));
}
~NAME() {
- if ($self) free($self);
+ free($self);
}
#endif
}
@@ -114,7 +120,7 @@ static NAME * frompointer(TYPE *t) {
%define %pointer_functions(TYPE,NAME)
%{
-static TYPE *new_##NAME() { %}
+static TYPE *new_##NAME(void) { %}
#ifdef __cplusplus
%{ return new TYPE(); %}
#else
@@ -134,9 +140,9 @@ static TYPE *copy_##NAME(TYPE value) { %}
static void delete_##NAME(TYPE *obj) { %}
#ifdef __cplusplus
-%{ if (obj) delete obj; %}
+%{ delete obj; %}
#else
-%{ if (obj) free(obj); %}
+%{ free(obj); %}
#endif
%{}
@@ -149,7 +155,7 @@ static TYPE NAME ##_value(TYPE *obj) {
}
%}
-TYPE *new_##NAME();
+TYPE *new_##NAME(void);
TYPE *copy_##NAME(TYPE value);
void delete_##NAME(TYPE *obj);
void NAME##_assign(TYPE *obj, TYPE value);
diff --git a/linux-x86/share/swig/csharp/argcargv.i b/linux-x86/share/swig/csharp/argcargv.i
new file mode 100644
index 0000000..2dae1f6
--- /dev/null
+++ b/linux-x86/share/swig/csharp/argcargv.i
@@ -0,0 +1,76 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(cstype) (int ARGC, char **ARGV) "string[]"
+%typemap(imtype) (int ARGC, char **ARGV) "global::System.IntPtr"
+%typemap(ctype) (int ARGC, char **ARGV) "void*"
+%typemap(csin) (int ARGC, char **ARGV) "$modulePINVOKE.SWIG_csharp_string_array_to_c($csinput.Length, $csinput)"
+%pragma(csharp) imclasscode=%{
+ [global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_array_to_c")]
+ public static extern global::System.IntPtr SWIG_csharp_string_array_to_c(int len, [global::System.Runtime.InteropServices.In,global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray, ArraySubType=global::System.Runtime.InteropServices.UnmanagedType.LPStr, SizeParamIndex=0)] string[] array);
+%}
+%fragment("SWIG_csharp_string_array", "header") %{
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef struct { int len; char* array[1]; } SWIG_csharp_string_array;
+
+static void* SWIG_csharp_string_array_free(SWIG_csharp_string_array *arr) {
+ if (arr != SWIG_NULLPTR) {
+ int i;
+ for(i = 0; i < arr->len; i++) {
+ free(arr->array[i]);
+ }
+ free(arr);
+ }
+ return SWIG_NULLPTR;
+}
+
+SWIGEXPORT void* SWIGSTDCALL SWIG_csharp_string_array_to_c(int len, void *array) {
+ int i;
+ size_t alen, slen;
+ char *p, **ptr;
+ SWIG_csharp_string_array *ret;
+ /* We don't need to add one to len for the terminating NULL here because
+ * SWIG_csharp_string_array includes one element already.
+ */
+ alen = sizeof(SWIG_csharp_string_array) + sizeof(char *) * len;
+ ret = (SWIG_csharp_string_array *)malloc(alen);
+ if (ret == SWIG_NULLPTR) {
+ SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate array.");
+ return SWIG_NULLPTR;
+ }
+ memset(ret, 0, alen);
+ ret->len = len;
+ ptr = (char **)array;
+ for(i = 0; i < len; i++) {
+ slen = strlen(ptr[i]) + 1;
+ p = (char*)malloc(slen);
+ if (p == SWIG_NULLPTR) {
+ SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to alloc a string.");
+ return SWIG_csharp_string_array_free(ret);
+ }
+ memcpy(p, ptr[i], slen);
+ ret->array[i] = p;
+ }
+ ret->array[i] = SWIG_NULLPTR;
+ return ret;
+}
+
+#ifdef __cplusplus
+}
+#endif
+%}
+
+%typemap(in, canthrow=1, fragment="SWIG_csharp_string_array") (int ARGC, char **ARGV) %{
+ SWIG_csharp_string_array *arr = (SWIG_csharp_string_array*)$input;
+ if (arr != SWIG_NULLPTR) {
+ $1 = ($1_ltype)arr->len;
+ $2 = ($2_ltype)arr->array;
+ }
+%}
+
+%typemap(freearg, fragment="SWIG_csharp_string_array") (int ARGC, char **ARGV) %{
+ SWIG_csharp_string_array_free((SWIG_csharp_string_array*)$input);
+%}
diff --git a/linux-x86/share/swig/csharp/arrays_csharp.i b/linux-x86/share/swig/csharp/arrays_csharp.i
index 861da83..00ded71 100644
--- a/linux-x86/share/swig/csharp/arrays_csharp.i
+++ b/linux-x86/share/swig/csharp/arrays_csharp.i
@@ -49,8 +49,17 @@
* %csmethodmodifiers myArrayCopy "public unsafe";
* void myArrayCopy( int *sourceArray, int* targetArray, int nitems );
*
+ * long type
+ * ---------
+ * Unlike other primitive types, the sizeof(long) varies considerably from one
+ * platform to another. The sizeof(long) in the unmanaged layer must match the
+ * number of bytes used in the managed layer. A check is implemented via the
+ * "long_check_wordsize" fragment which results in a compile time error upon an
+ * inconsistent match. Use the SWIGWORDSIZE64 macro to target 64-bit long.
+ * For easiest portability, avoid using long!
* ----------------------------------------------------------------------------- */
+
%define CSHARP_ARRAYS( CTYPE, CSTYPE )
// input only arrays
@@ -94,16 +103,23 @@ CSHARP_ARRAYS(short, short)
CSHARP_ARRAYS(unsigned short, ushort)
CSHARP_ARRAYS(int, int)
CSHARP_ARRAYS(unsigned int, uint)
-// FIXME - on Unix 64 bit, long is 8 bytes but is 4 bytes on Windows 64 bit.
-// How can this be handled sensibly?
-// See e.g. http://www.xml.com/ldd/chapter/book/ch10.html
-CSHARP_ARRAYS(long, int)
-CSHARP_ARRAYS(unsigned long, uint)
CSHARP_ARRAYS(long long, long)
CSHARP_ARRAYS(unsigned long long, ulong)
CSHARP_ARRAYS(float, float)
CSHARP_ARRAYS(double, double)
+// 32-bit/64-bit architecture specific typemaps - special handling to ensure sizeof(long) on C side matches size used on C# side
+#if !defined(SWIGWORDSIZE64)
+CSHARP_ARRAYS(long, int)
+CSHARP_ARRAYS(unsigned long, uint)
+#else
+CSHARP_ARRAYS(long, long)
+CSHARP_ARRAYS(unsigned long, ulong)
+#endif
+%typemap(in, fragment="long_check_wordsize") long INPUT[], unsigned long INPUT[] "$1 = $input;"
+%typemap(in, fragment="long_check_wordsize") long OUTPUT[], unsigned long OUTPUT[] "$1 = $input;"
+%typemap(in, fragment="long_check_wordsize") long INOUT[], unsigned long INOUT[] "$1 = $input;"
+
// 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
@@ -169,11 +185,18 @@ CSHARP_ARRAYS_FIXED(short, short)
CSHARP_ARRAYS_FIXED(unsigned short, ushort)
CSHARP_ARRAYS_FIXED(int, int)
CSHARP_ARRAYS_FIXED(unsigned int, uint)
-CSHARP_ARRAYS_FIXED(long, int)
-CSHARP_ARRAYS_FIXED(unsigned long, uint)
CSHARP_ARRAYS_FIXED(long long, long)
CSHARP_ARRAYS_FIXED(unsigned long long, ulong)
CSHARP_ARRAYS_FIXED(float, float)
CSHARP_ARRAYS_FIXED(double, double)
CSHARP_ARRAYS_FIXED(bool, bool)
+// 32-bit/64-bit architecture specific typemaps - special handling to ensure sizeof(long) on C side matches size used on C# side
+#ifdef !SWIGWORDSIZE64
+CSHARP_ARRAYS_FIXED(long, int)
+CSHARP_ARRAYS_FIXED(unsigned long, uint)
+#else
+CSHARP_ARRAYS_FIXED(long, long)
+CSHARP_ARRAYS_FIXED(unsigned long, ulong)
+#endif
+%typemap(in, fragment="long_check_wordsize") long FIXED[], unsigned long FIXED[] "$1 = $input;"
diff --git a/linux-x86/share/swig/csharp/boost_intrusive_ptr.i b/linux-x86/share/swig/csharp/boost_intrusive_ptr.i
index fa3f53a..355a910 100644
--- a/linux-x86/share/swig/csharp/boost_intrusive_ptr.i
+++ b/linux-x86/share/swig/csharp/boost_intrusive_ptr.i
@@ -32,7 +32,7 @@
%}
%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{
//plain value(out)
- $1_ltype* resultp = new $1_ltype(($1_ltype &)$1);
+ $1_ltype* resultp = new $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 >());
%}
@@ -372,7 +372,7 @@
}
$1 = *argp; %}
%typemap(out) CONST TYPE
-%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
+%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %}
// plain pointer
%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
diff --git a/linux-x86/share/swig/csharp/boost_shared_ptr.i b/linux-x86/share/swig/csharp/boost_shared_ptr.i
index 508c0ec..d47fab5 100644
--- a/linux-x86/share/swig/csharp/boost_shared_ptr.i
+++ b/linux-x86/share/swig/csharp/boost_shared_ptr.i
@@ -29,10 +29,10 @@
}
$1 = *argp; %}
%typemap(out) CONST TYPE
-%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
+%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %}
%typemap(directorin) CONST TYPE
-%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
+%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %}
%typemap(directorout) CONST TYPE
%{ if (!$input) {
@@ -122,7 +122,7 @@
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
-%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
+%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0;
if ($owner) delete $1; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
diff --git a/linux-x86/share/swig/csharp/csharp.swg b/linux-x86/share/swig/csharp/csharp.swg
index 8322063..fffde50 100644
--- a/linux-x86/share/swig/csharp/csharp.swg
+++ b/linux-x86/share/swig/csharp/csharp.swg
@@ -82,8 +82,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(ctype) unsigned short, const unsigned short & "unsigned short"
%typemap(ctype) int, const int & "int"
%typemap(ctype) unsigned int, const unsigned int & "unsigned int"
-%typemap(ctype) long, const long & "long"
-%typemap(ctype) unsigned long, const unsigned long & "unsigned long"
+%typemap(ctype) long, const long & "int"
+%typemap(ctype) unsigned long, const unsigned long & "unsigned int"
%typemap(ctype) long long, const long long & "long long"
%typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
%typemap(ctype) float, const float & "float"
@@ -201,9 +201,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(directorin) short "$input = $1;"
%typemap(directorin) unsigned short "$input = $1;"
%typemap(directorin) int "$input = $1;"
-%typemap(directorin) unsigned int "$input = $1;"
+%typemap(directorin) unsigned int "$input = (unsigned int)$1;"
%typemap(directorin) long "$input = $1;"
-%typemap(directorin) unsigned long "$input = (unsigned long)$1;"
+%typemap(directorin) unsigned long "$input = $1;"
%typemap(directorin) long long "$input = $1;"
%typemap(directorin) unsigned long long "$input = $1;"
%typemap(directorin) float "$input = $1;"
@@ -246,9 +246,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(out) short %{ $result = $1; %}
%typemap(out) unsigned short %{ $result = $1; %}
%typemap(out) int %{ $result = $1; %}
-%typemap(out) unsigned int %{ $result = $1; %}
+%typemap(out) unsigned int %{ $result = (unsigned int)$1; %}
%typemap(out) long %{ $result = $1; %}
-%typemap(out) unsigned long %{ $result = (unsigned long)$1; %}
+%typemap(out) unsigned long %{ $result = $1; %}
%typemap(out) long long %{ $result = $1; %}
%typemap(out) unsigned long long %{ $result = $1; %}
%typemap(out) float %{ $result = $1; %}
@@ -327,7 +327,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(directorin) const short & "$input = $1;"
%typemap(directorin) const unsigned short & "$input = $1;"
%typemap(directorin) const int & "$input = $1;"
-%typemap(directorin) const unsigned int & "$input = $1;"
+%typemap(directorin) const unsigned int & "$input = (unsigned int)$1;"
%typemap(directorin) const long & "$input = $1;"
%typemap(directorin) const unsigned long & "$input = $1;"
%typemap(directorin) const long long & "$input = $1;"
@@ -373,9 +373,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(out) const short & %{ $result = *$1; %}
%typemap(out) const unsigned short & %{ $result = *$1; %}
%typemap(out) const int & %{ $result = *$1; %}
-%typemap(out) const unsigned int & %{ $result = *$1; %}
+%typemap(out) const unsigned int & %{ $result = (unsigned int)*$1; %}
%typemap(out) const long & %{ $result = *$1; %}
-%typemap(out) const unsigned long & %{ $result = (unsigned long)*$1; %}
+%typemap(out) const unsigned long & %{ $result = *$1; %}
%typemap(out) const long long & %{ $result = *$1; %}
%typemap(out) const unsigned long long & %{ $result = *$1; %}
%typemap(out) const float & %{ $result = *$1; %}
@@ -399,7 +399,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(out) SWIGTYPE
#ifdef __cplusplus
-%{ $result = new $1_ltype((const $1_ltype &)$1); %}
+%{ $result = new $1_ltype($1); %}
#else
{
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
@@ -409,7 +409,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
#endif
%typemap(directorin) SWIGTYPE
-%{ $input = (void *)new $1_ltype((const $1_ltype &)$1); %}
+%{ $input = (void *)new $1_ltype(SWIG_STD_MOVE($1)); %}
%typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, true)"
%typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle"
@@ -420,14 +420,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%}
%typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input;
if (!$1) {
- SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0);
return $null;
} %}
-%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input;
+%typemap(in, canthrow=1, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input;
if (!$1) {
- SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0);
return $null;
- } %}
+ }
+ rvrdeleter.reset($1); %}
%typemap(out) SWIGTYPE * %{ $result = (void *)$1; %}
%typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{
char buf[128];
@@ -578,7 +579,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
unsigned long,
unsigned short
%{ char error_msg[256];
- sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
+ SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1);
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, error_msg);
return $null; %}
@@ -613,7 +614,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
"$csinput"
%typemap(csin) char *, char *&, char[ANY], char[] "$csinput"
%typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)"
-%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
+%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
+%typemap(csin) SWIGTYPE && "$csclassname.swigRelease($csinput)"
%typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)"
/* The csout typemap is used for converting function return types from the return type
@@ -875,6 +877,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
global::System.IntPtr ret = $imcall;$excode
return ret;
}
+%typemap(csvarin, excode=SWIGEXCODE2) void *VOID_INT_PTR %{
+ set {
+ $imcall;$excode
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) void *VOID_INT_PTR %{
+ get {
+ global::System.IntPtr ret = $imcall;$excode
+ return ret;
+ } %}
%typemap(csdirectorin) void *VOID_INT_PTR "$iminput"
%typemap(csdirectorout) void *VOID_INT_PTR "$cscall"
@@ -885,6 +896,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(csinterfaces) SWIGTYPE "global::System.IDisposable"
%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
+%typemap(csinterfacemodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface"
// csbody typemaps... these are in macros so that the visibility of the methods can be easily changed by users.
@@ -903,6 +915,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
+
+ CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) {
+ if (obj != null) {
+ if (!obj.swigCMemOwn)
+ throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
+ global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
+ obj.swigCMemOwn = false;
+ obj.Dispose();
+ return ptr;
+ } else {
+ return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ }
%}
// Derived proxy classes
@@ -916,6 +941,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
+
+ CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) {
+ if (obj != null) {
+ if (!obj.swigCMemOwn)
+ throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
+ global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
+ obj.swigCMemOwn = false;
+ obj.Dispose();
+ return ptr;
+ } else {
+ return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ }
%}
%enddef
@@ -935,6 +973,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
+
+ CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ }
%}
%typemap(csbody) TYPE (CLASS::*) %{
@@ -1020,10 +1062,17 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
%pragma(csharp) imclassclassmodifiers="class"
%pragma(csharp) moduleclassmodifiers="public class"
-/* Some ANSI C typemaps */
+/* 64-bit architecture specific typemaps */
+#if defined(SWIGWORDSIZE64)
+%apply long long { long };
+%apply unsigned long long { unsigned long };
+%apply const long long & { const long & };
+%apply const unsigned long long & { const unsigned long & };
+#endif
-%apply unsigned long { size_t };
-%apply const unsigned long & { const size_t & };
+/* size_t maps to C# 32-bit uint type */
+%apply unsigned int { size_t };
+%apply const unsigned int & { const size_t & };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
diff --git a/linux-x86/share/swig/csharp/csharphead.swg b/linux-x86/share/swig/csharp/csharphead.swg
index 7db4c0e..56a019b 100644
--- a/linux-x86/share/swig/csharp/csharphead.swg
+++ b/linux-x86/share/swig/csharp/csharphead.swg
@@ -335,5 +335,5 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpString
%insert(runtime) %{
/* Contract support */
-#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
+#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } } while (0)
%}
diff --git a/linux-x86/share/swig/csharp/csharpkw.swg b/linux-x86/share/swig/csharp/csharpkw.swg
index 824f618..1904fce 100644
--- a/linux-x86/share/swig/csharp/csharpkw.swg
+++ b/linux-x86/share/swig/csharp/csharpkw.swg
@@ -2,9 +2,9 @@
#define CSHARP_CSHARPKW_SWG_
/* Warnings for C# keywords */
-#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '" `x` "_'",rename="%s_") `x`
+#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword",rename="%s_") `x`
-#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes, class renamed to '" `x` "_'",%$isclass,rename="%s_") `x`
+#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes",%$isclass,rename="%s_") `x`
/*
from
diff --git a/linux-x86/share/swig/csharp/std_array.i b/linux-x86/share/swig/csharp/std_array.i
index a4f0f96..87b1b89 100644
--- a/linux-x86/share/swig/csharp/std_array.i
+++ b/linux-x86/share/swig/csharp/std_array.i
@@ -6,37 +6,37 @@
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.IReadOnlyList<> collection.
* ----------------------------------------------------------------------------- */
-%{
-#include <algorithm>
-#include <array>
-#include <stdexcept>
-%}
-
%include <std_common.i>
-%define SWIG_STD_ARRAY_INTERNAL(T, N)
-%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n";
+%define SWIG_STD_ARRAY_INTERNAL(CTYPE, N)
+%typemap(csinterfaces) std::array< CTYPE, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>\n"
%proxycode %{
public $csclassname(global::System.Collections.ICollection c) : this() {
if (c == null)
throw new global::System.ArgumentNullException("c");
- int end = global::System.Math.Min(this.Count, c.Count);
+ int count = this.Count;
int i = 0;
- foreach ($typemap(cstype, T) elem in c) {
- if (i >= end)
+ foreach ($typemap(cstype, CTYPE) element in c) {
+ if (i >= count)
break;
- this[i++] = elem;
+ this[i++] = element;
}
}
- public int Count {
+ public bool IsFixedSize {
get {
- return (int)size();
+ return true;
}
}
- public $typemap(cstype, T) this[int index] {
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public $typemap(cstype, CTYPE) this[int index] {
get {
return getitem(index);
}
@@ -51,17 +51,29 @@
}
}
- public void CopyTo($typemap(cstype, T)[] array)
+ public int Count {
+ get {
+ return (int)size();
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public void CopyTo($typemap(cstype, CTYPE)[] array)
{
CopyTo(0, array, 0, this.Count);
}
- public void CopyTo($typemap(cstype, T)[] array, int arrayIndex)
+ public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex)
{
CopyTo(0, array, arrayIndex, this.Count);
}
- public void CopyTo(int index, $typemap(cstype, T)[] array, int arrayIndex, int count)
+ public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count)
{
if (array == null)
throw new global::System.ArgumentNullException("array");
@@ -79,7 +91,13 @@
array.SetValue(getitemcopy(index+i), arrayIndex+i);
}
- global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() {
+ 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);
}
@@ -97,7 +115,7 @@
/// 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)>
+ , global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
{
private $csclassname collectionRef;
private int currentIndex;
@@ -112,7 +130,7 @@
}
// Type-safe iterator Current
- public $typemap(cstype, T) Current {
+ public $typemap(cstype, CTYPE) Current {
get {
if (currentIndex == -1)
throw new global::System.InvalidOperationException("Enumeration not started.");
@@ -120,7 +138,7 @@
throw new global::System.InvalidOperationException("Enumeration finished.");
if (currentObject == null)
throw new global::System.InvalidOperationException("Collection modified.");
- return ($typemap(cstype, T))currentObject;
+ return ($typemap(cstype, CTYPE))currentObject;
}
}
@@ -161,7 +179,7 @@
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
- typedef T value_type;
+ typedef CTYPE value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
@@ -180,7 +198,7 @@
void swap(array& other);
%extend {
- T getitemcopy(int index) throw (std::out_of_range) {
+ CTYPE getitemcopy(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
return (*$self)[index];
else
@@ -213,6 +231,11 @@
}
%enddef
+%{
+#include <array>
+#include <algorithm>
+#include <stdexcept>
+%}
%csmethodmodifiers std::array::empty "private"
%csmethodmodifiers std::array::getitemcopy "private"
diff --git a/linux-x86/share/swig/csharp/std_auto_ptr.i b/linux-x86/share/swig/csharp/std_auto_ptr.i
index d7e5f16..da15df3 100644
--- a/linux-x86/share/swig/csharp/std_auto_ptr.i
+++ b/linux-x86/share/swig/csharp/std_auto_ptr.i
@@ -1,25 +1,38 @@
-/*
- The typemaps here allow to handle functions returning std::auto_ptr<>,
- which is the most common use of this type. If you have functions taking it
- as parameter, these typemaps can't be used for them and you need to do
- something else (e.g. use shared_ptr<> which SWIG supports fully).
- */
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
%define %auto_ptr(TYPE)
-%typemap (ctype) std::auto_ptr<TYPE > "void *"
-%typemap (imtype, out="System.IntPtr") std::auto_ptr<TYPE > "HandleRef"
-%typemap (cstype) std::auto_ptr<TYPE > "$typemap(cstype, TYPE)"
-%typemap (out) std::auto_ptr<TYPE > %{
- $result = (void *)$1.release();
+%typemap (ctype) std::auto_ptr< TYPE > "void *"
+%typemap (imtype, out="System.IntPtr") std::auto_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef"
+%typemap (cstype) std::auto_ptr< TYPE > "$typemap(cstype, TYPE)"
+
+%typemap(in) std::auto_ptr< TYPE >
+%{ $1.reset((TYPE *)$input); %}
+
+%typemap(csin) std::auto_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)"
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ $result = (void *)$1.release();
%}
-%typemap(csout, excode=SWIGEXCODE) std::auto_ptr<TYPE > {
- System.IntPtr cPtr = $imcall;
- $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
- return ret;
- }
-%template() std::auto_ptr<TYPE >;
+
+%typemap(csout, excode=SWIGEXCODE) std::auto_ptr< TYPE > {
+ System.IntPtr cPtr = $imcall;
+ $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
+ return ret;
+ }
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > ""
+
+%template() std::auto_ptr< TYPE >;
%enddef
namespace std {
- template <class T> class auto_ptr {};
-}
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/csharp/std_list.i b/linux-x86/share/swig/csharp/std_list.i
index 674aba0..cf6f202 100644
--- a/linux-x86/share/swig/csharp/std_list.i
+++ b/linux-x86/share/swig/csharp/std_list.i
@@ -19,7 +19,7 @@
// 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";
+%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 * };
diff --git a/linux-x86/share/swig/csharp/std_map.i b/linux-x86/share/swig/csharp/std_map.i
index e538a03..4f44742 100644
--- a/linux-x86/share/swig/csharp/std_map.i
+++ b/linux-x86/share/swig/csharp/std_map.i
@@ -26,7 +26,7 @@
/* K is the C++ key type, T is the C++ value type */
%define SWIG_STD_MAP_INTERNAL(K, T, C)
-%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n";
+%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"
%proxycode %{
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
@@ -48,6 +48,12 @@
return false;
}
+ public bool IsEmpty {
+ get {
+ return empty();
+ }
+ }
+
public int Count {
get {
return (int)size();
@@ -236,7 +242,11 @@
}
void setitem(const key_type& key, const mapped_type& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*$self).insert_or_assign(key, x);
+%#else
(*$self)[key] = x;
+%#endif
}
bool ContainsKey(const key_type& key) {
@@ -269,12 +279,14 @@
}
const key_type& get_next_key(std::map< K, T, C >::iterator *swigiterator) {
+ (void)$self;
std::map< K, T, C >::iterator iter = *swigiterator;
(*swigiterator)++;
return (*iter).first;
}
void destroy_iterator(std::map< K, T, C >::iterator *swigiterator) {
+ (void)$self;
delete swigiterator;
}
}
@@ -282,6 +294,7 @@
%enddef
+%csmethodmodifiers std::map::empty "private"
%csmethodmodifiers std::map::size "private"
%csmethodmodifiers std::map::getitem "private"
%csmethodmodifiers std::map::setitem "private"
@@ -295,18 +308,3 @@ namespace std {
SWIG_STD_MAP_INTERNAL(K, T, C)
};
}
-
-
-// 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/linux-x86/share/swig/csharp/std_set.i b/linux-x86/share/swig/csharp/std_set.i
index 82f010a..480a24c 100644
--- a/linux-x86/share/swig/csharp/std_set.i
+++ b/linux-x86/share/swig/csharp/std_set.i
@@ -16,6 +16,7 @@
#include <stdexcept>
%}
+%csmethodmodifiers std::set::empty "private"
%csmethodmodifiers std::set::size "private"
%csmethodmodifiers std::set::getitem "private"
%csmethodmodifiers std::set::create_iterator_begin "private"
@@ -28,7 +29,7 @@ namespace std {
template <class T>
class set {
-%typemap(csinterfaces) std::set<T> "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n";
+%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);
@@ -44,6 +45,12 @@ class set {
}
}
+ public bool IsEmpty {
+ get {
+ return empty();
+ }
+ }
+
public int Count {
get {
return (int)size();
@@ -297,12 +304,14 @@ class set {
}
const key_type& get_next(std::set<T>::iterator *swigiterator) {
+ (void)$self;
std::set<T>::iterator iter = *swigiterator;
(*swigiterator)++;
return *iter;
}
void destroy_iterator(std::set<T>::iterator *swigiterator) {
+ (void)$self;
delete swigiterator;
}
}
diff --git a/linux-x86/share/swig/csharp/std_string.i b/linux-x86/share/swig/csharp/std_string.i
index 5f8fa44..c8920c0 100644
--- a/linux-x86/share/swig/csharp/std_string.i
+++ b/linux-x86/share/swig/csharp/std_string.i
@@ -20,7 +20,7 @@ namespace std {
class string;
// string
-%typemap(ctype) string "char *"
+%typemap(ctype) string "const char *"
%typemap(imtype) string "string"
%typemap(cstype) string "string"
@@ -42,7 +42,7 @@ class string;
}
$result.assign($input); %}
-%typemap(directorin) string %{ $input = SWIG_csharp_string_callback($1.c_str()); %}
+%typemap(directorin) string %{ $input = $1.c_str(); %}
%typemap(csin) string "$csinput"
%typemap(csout, excode=SWIGEXCODE) string {
@@ -57,7 +57,7 @@ class string;
return $null; %}
// const string &
-%typemap(ctype) const string & "char *"
+%typemap(ctype) const string & "const char *"
%typemap(imtype) const string & "string"
%typemap(cstype) const string & "string"
@@ -89,7 +89,7 @@ class string;
$1_str = $input;
$result = &$1_str; %}
-%typemap(directorin) const string & %{ $input = SWIG_csharp_string_callback($1.c_str()); %}
+%typemap(directorin) const string & %{ $input = $1.c_str(); %}
%typemap(csvarin, excode=SWIGEXCODE2) const string & %{
set {
diff --git a/linux-x86/share/swig/csharp/std_string_view.i b/linux-x86/share/swig/csharp/std_string_view.i
new file mode 100644
index 0000000..3b6cd40
--- /dev/null
+++ b/linux-x86/share/swig/csharp/std_string_view.i
@@ -0,0 +1,116 @@
+/* -----------------------------------------------------------------------------
+ * std_string_view.i
+ *
+ * Typemaps for std::string_view and const std::string_view&
+ * These are mapped to a C# String and are passed around by value.
+ *
+ * To use non-const std::string_view references use the following %apply. Note
+ * that they are passed by value.
+ * %apply const std::string_view & {std::string_view &};
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <string_view>
+#include <string>
+%}
+
+namespace std {
+
+%naturalvar string_view;
+
+class string_view;
+
+// string_view
+%typemap(ctype) string_view "const char *"
+%typemap(imtype) string_view "string"
+%typemap(cstype) string_view "string"
+
+%typemap(csdirectorin) string_view "$iminput"
+%typemap(csdirectorout) string_view "$cscall"
+
+%typemap(in, canthrow=1) string_view
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+ return $null;
+ }
+ $1 = std::string_view($input); %}
+%typemap(out) string_view %{ $result = SWIG_csharp_string_callback(std::string($1).c_str()); %}
+
+%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) string_view
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+ return $null;
+ }
+ /* possible thread/reentrant code problem */
+ static std::string $1_str;
+ $1_str = $input;
+ $result = std::string_view($1_str); %}
+
+%typemap(directorin) string_view %{ $input = std::string($1).c_str(); %}
+
+%typemap(csin) string_view "$csinput"
+%typemap(csout, excode=SWIGEXCODE) string_view {
+ string ret = $imcall;$excode
+ return ret;
+ }
+
+%typemap(typecheck) string_view = char *;
+
+%typemap(throws, canthrow=1) string_view
+%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, std::string($1).c_str());
+ return $null; %}
+
+// const string_view &
+%typemap(ctype) const string_view & "const char *"
+%typemap(imtype) const string_view & "string"
+%typemap(cstype) const string_view & "string"
+
+%typemap(csdirectorin) const string_view & "$iminput"
+%typemap(csdirectorout) const string_view & "$cscall"
+
+%typemap(in, canthrow=1) const string_view &
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+ return $null;
+ }
+ $*1_ltype $1_str($input);
+ $1 = &$1_str; %}
+%typemap(out) const string_view & %{ $result = SWIG_csharp_string_callback(std::string(*$1).c_str()); %}
+
+%typemap(csin) const string_view & "$csinput"
+%typemap(csout, excode=SWIGEXCODE) const string_view & {
+ string ret = $imcall;$excode
+ return ret;
+ }
+
+%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string_view &
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+ return $null;
+ }
+ /* possible thread/reentrant code problem */
+ static std::string $1_str;
+ $1_str = $input;
+ static $*1_ltype $1_strview;
+ $1_strview = $1_str;
+ $result = &$1_strview; %}
+
+%typemap(directorin) const string_view & %{ $input = std::string($1).c_str(); %}
+
+%typemap(csvarin, excode=SWIGEXCODE2) const string_view & %{
+ set {
+ $imcall;$excode
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) const string_view & %{
+ get {
+ string ret = $imcall;$excode
+ return ret;
+ } %}
+
+%typemap(typecheck) const string_view & = char *;
+
+%typemap(throws, canthrow=1) const string_view &
+%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, std::string($1).c_str());
+ return $null; %}
+
+}
diff --git a/linux-x86/share/swig/csharp/std_unique_ptr.i b/linux-x86/share/swig/csharp/std_unique_ptr.i
new file mode 100644
index 0000000..0a4caaf
--- /dev/null
+++ b/linux-x86/share/swig/csharp/std_unique_ptr.i
@@ -0,0 +1,38 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap (ctype) std::unique_ptr< TYPE > "void *"
+%typemap (imtype, out="System.IntPtr") std::unique_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef"
+%typemap (cstype) std::unique_ptr< TYPE > "$typemap(cstype, TYPE)"
+
+%typemap(in) std::unique_ptr< TYPE >
+%{ $1.reset((TYPE *)$input); %}
+
+%typemap(csin) std::unique_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)"
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ $result = (void *)$1.release();
+%}
+
+%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > {
+ System.IntPtr cPtr = $imcall;
+ $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
+ return ret;
+ }
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > ""
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/csharp/std_unordered_map.i b/linux-x86/share/swig/csharp/std_unordered_map.i
new file mode 100644
index 0000000..f8145e3
--- /dev/null
+++ b/linux-x86/share/swig/csharp/std_unordered_map.i
@@ -0,0 +1,306 @@
+/* -----------------------------------------------------------------------------
+ * std_unordered_map.i
+ *
+ * SWIG typemaps for std::unordered_map< K, T, H >
+ *
+ * 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 an unordered_map from integers to doubles use:
+ *
+ * %include <std_unordered_map.i>
+ * %template(MapIntDouble) std::unordered_map<int, double>
+ *
+ * Notes:
+ * 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
+ * C++ std::unordered_map wrappers.
+ *
+ * Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <unordered_map>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+/* K is the C++ key type, T is the C++ value type */
+%define SWIG_STD_UNORDERED_MAP_INTERNAL(K, T, H)
+
+%typemap(csinterfaces) std::unordered_map< K, T, H > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"
+%proxycode %{
+
+ public $typemap(cstype, T) this[$typemap(cstype, K) key] {
+ get {
+ return getitem(key);
+ }
+
+ set {
+ setitem(key, value);
+ }
+ }
+
+ public bool TryGetValue($typemap(cstype, K) key, out $typemap(cstype, T) value) {
+ if (this.ContainsKey(key)) {
+ value = this[key];
+ return true;
+ }
+ value = default($typemap(cstype, T));
+ return false;
+ }
+
+ public bool IsEmpty {
+ get {
+ return empty();
+ }
+ }
+
+ public int Count {
+ get {
+ return (int)size();
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
+ get {
+ global::System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new global::System.Collections.Generic.List<$typemap(cstype, K)>();
+ int size = this.Count;
+ if (size > 0) {
+ global::System.IntPtr iter = create_iterator_begin();
+ for (int i = 0; i < size; i++) {
+ keys.Add(get_next_key(iter));
+ }
+ destroy_iterator(iter);
+ }
+ return keys;
+ }
+ }
+
+ public global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Values {
+ get {
+ global::System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new global::System.Collections.Generic.List<$typemap(cstype, T)>();
+ foreach (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) {
+ vals.Add(pair.Value);
+ }
+ return vals;
+ }
+ }
+
+ public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
+ Add(item.Key, item.Value);
+ }
+
+ public bool Remove(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
+ if (Contains(item)) {
+ return Remove(item.Key);
+ } else {
+ return false;
+ }
+ }
+
+ public bool Contains(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
+ if (this[item.Key] == item.Value) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) {
+ CopyTo(array, 0);
+ }
+
+ public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $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.");
+
+ global::System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new global::System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys);
+ for (int i = 0; i < keyList.Count; i++) {
+ $typemap(cstype, K) currentKey = keyList[i];
+ array.SetValue(new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i);
+ }
+ }
+
+ global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() {
+ return new $csclassnameEnumerator(this);
+ }
+
+ 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<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>
+ {
+ private $csclassname collectionRef;
+ private global::System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection;
+ private int currentIndex;
+ private object currentObject;
+ private int currentSize;
+
+ public $csclassnameEnumerator($csclassname collection) {
+ collectionRef = collection;
+ keyCollection = new global::System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys);
+ currentIndex = -1;
+ currentObject = null;
+ currentSize = collectionRef.Count;
+ }
+
+ // Type-safe iterator Current
+ public global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $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 (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $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++;
+ $typemap(cstype, K) currentKey = keyCollection[currentIndex];
+ currentObject = new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]);
+ } 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 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);
+ size_type size() const;
+ bool empty() const;
+ %rename(Clear) clear;
+ void clear();
+ %extend {
+ const mapped_type& getitem(const key_type& key) throw (std::out_of_range) {
+ std::unordered_map< K, T, H >::iterator iter = $self->find(key);
+ if (iter != $self->end())
+ return iter->second;
+ else
+ throw std::out_of_range("key not found");
+ }
+
+ void setitem(const key_type& key, const mapped_type& x) {
+ (*$self)[key] = x;
+ }
+
+ bool ContainsKey(const key_type& key) {
+ std::unordered_map< K, T, H >::iterator iter = $self->find(key);
+ return iter != $self->end();
+ }
+
+ void Add(const key_type& key, const mapped_type& value) throw (std::out_of_range) {
+ std::unordered_map< K, T, H >::iterator iter = $self->find(key);
+ if (iter != $self->end())
+ throw std::out_of_range("key already exists");
+ $self->insert(std::pair< K, T >(key, value));
+ }
+
+ bool Remove(const key_type& key) {
+ std::unordered_map< K, T, H >::iterator iter = $self->find(key);
+ if (iter != $self->end()) {
+ $self->erase(iter);
+ return true;
+ }
+ return false;
+ }
+
+ // create_iterator_begin(), get_next_key() and destroy_iterator work together to provide a collection of keys to C#
+ %apply void *VOID_INT_PTR { std::unordered_map< K, T, H >::iterator *create_iterator_begin }
+ %apply void *VOID_INT_PTR { std::unordered_map< K, T, H >::iterator *swigiterator }
+
+ std::unordered_map< K, T, H >::iterator *create_iterator_begin() {
+ return new std::unordered_map< K, T, H >::iterator($self->begin());
+ }
+
+ const key_type& get_next_key(std::unordered_map< K, T, H >::iterator *swigiterator) {
+ (void)self;
+ std::unordered_map< K, T, H >::iterator iter = *swigiterator;
+ (*swigiterator)++;
+ return (*iter).first;
+ }
+
+ void destroy_iterator(std::unordered_map< K, T, H >::iterator *swigiterator) {
+ (void)self;
+ delete swigiterator;
+ }
+ }
+
+
+%enddef
+
+%csmethodmodifiers std::unordered_map::empty "private"
+%csmethodmodifiers std::unordered_map::size "private"
+%csmethodmodifiers std::unordered_map::getitem "private"
+%csmethodmodifiers std::unordered_map::setitem "private"
+%csmethodmodifiers std::unordered_map::create_iterator_begin "private"
+%csmethodmodifiers std::unordered_map::get_next_key "private"
+%csmethodmodifiers std::unordered_map::destroy_iterator "private"
+
+// Default implementation
+namespace std {
+ template<class K, class T, class H = std::hash<K> > class unordered_map {
+ SWIG_STD_UNORDERED_MAP_INTERNAL(K, T, H)
+ };
+}
diff --git a/linux-x86/share/swig/csharp/std_unordered_set.i b/linux-x86/share/swig/csharp/std_unordered_set.i
new file mode 100644
index 0000000..d6f6a18
--- /dev/null
+++ b/linux-x86/share/swig/csharp/std_unordered_set.i
@@ -0,0 +1,320 @@
+/* -----------------------------------------------------------------------------
+ * std_unordered_set.i
+ *
+ * SWIG typemaps for std::unordered_set<T>.
+ *
+ * Note that ISet<> used here requires .NET 4 or later.
+ *
+ * The C# wrapper implements ISet<> interface and is similar in
+ * characteristics to the C# System.Collections.Generic.HashSet<> class, but
+ * doesn't provide quite all of its methods.
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <unordered_set>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+%csmethodmodifiers std::unordered_set::empty "private"
+%csmethodmodifiers std::unordered_set::size "private"
+%csmethodmodifiers std::unordered_set::getitem "private"
+%csmethodmodifiers std::unordered_set::create_iterator_begin "private"
+%csmethodmodifiers std::unordered_set::get_next "private"
+%csmethodmodifiers std::unordered_set::destroy_iterator "private"
+
+namespace std {
+
+// TODO: Add support for comparator and allocator template parameters.
+template <class T>
+class unordered_set {
+
+%typemap(csinterfaces) std::unordered_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 bool IsEmpty {
+ get {
+ return empty();
+ }
+ }
+
+ 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;
+
+ unordered_set();
+ unordered_set(const unordered_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::unordered_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::unordered_set<T>::iterator *create_iterator_begin }
+ %apply void *VOID_INT_PTR { std::unordered_set<T>::iterator *swigiterator }
+
+ std::unordered_set<T>::iterator *create_iterator_begin() {
+ return new std::unordered_set<T>::iterator($self->begin());
+ }
+
+ const key_type& get_next(std::unordered_set<T>::iterator *swigiterator) {
+ (void)$self;
+ std::unordered_set<T>::iterator iter = *swigiterator;
+ (*swigiterator)++;
+ return *iter;
+ }
+
+ void destroy_iterator(std::unordered_set<T>::iterator *swigiterator) {
+ (void)$self;
+ delete swigiterator;
+ }
+ }
+};
+
+}
diff --git a/linux-x86/share/swig/csharp/std_vector.i b/linux-x86/share/swig/csharp/std_vector.i
index e281129..982306e 100644
--- a/linux-x86/share/swig/csharp/std_vector.i
+++ b/linux-x86/share/swig/csharp/std_vector.i
@@ -19,7 +19,7 @@
// 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, 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.IEnumerable c) : this() {
if (c == null)
@@ -63,12 +63,18 @@
return (int)capacity();
}
set {
- if (value < size())
+ if (value < 0 || ($typemap(cstype, size_t))value < size())
throw new global::System.ArgumentOutOfRangeException("Capacity");
reserve(($typemap(cstype, size_t))value);
}
}
+ public bool IsEmpty {
+ get {
+ return empty();
+ }
+ }
+
public int Count {
get {
return (int)size();
@@ -203,19 +209,20 @@
typedef value_type& reference;
typedef CONST_REFERENCE const_reference;
+ vector();
+ vector(const vector &other);
+
%rename(Clear) clear;
void clear();
%rename(Add) push_back;
void push_back(CTYPE const& x);
size_type size() const;
+ bool empty() const;
size_type capacity() const;
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;
@@ -357,22 +364,13 @@ namespace std {
}
%enddef
-// Legacy macros
-%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...)
-#warning SWIG_STD_VECTOR_SPECIALIZE macro deprecated, please see csharp/std_vector.i and switch to SWIG_STD_VECTOR_ENHANCED
-SWIG_STD_VECTOR_ENHANCED(CTYPE)
-%enddef
-
-%define SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE...)
-#warning SWIG_STD_VECTOR_SPECIALIZE_MINIMUM macro deprecated, it is no longer required
-%enddef
-
%{
#include <vector>
#include <algorithm>
#include <stdexcept>
%}
+%csmethodmodifiers std::vector::empty "private"
%csmethodmodifiers std::vector::getitemcopy "private"
%csmethodmodifiers std::vector::getitem "private"
%csmethodmodifiers std::vector::setitem "private"
@@ -415,4 +413,3 @@ SWIG_STD_VECTOR_ENHANCED(float)
SWIG_STD_VECTOR_ENHANCED(double)
SWIG_STD_VECTOR_ENHANCED(std::string) // also requires a %include <std_string.i>
SWIG_STD_VECTOR_ENHANCED(std::wstring) // also requires a %include <std_wstring.i>
-
diff --git a/linux-x86/share/swig/csharp/std_wstring.i b/linux-x86/share/swig/csharp/std_wstring.i
index 162b90e..c7fef41 100644
--- a/linux-x86/share/swig/csharp/std_wstring.i
+++ b/linux-x86/share/swig/csharp/std_wstring.i
@@ -2,7 +2,9 @@
* std_wstring.i
*
* Typemaps for std::wstring and const std::wstring&
- * These are mapped to a C# String and are passed around by value.
+ * std::wstring is mapped to a C# Unicode string (UTF16) and is passed around by value.
+ * std::wstring support includes wchar_t as a 2 byte type (Windows) and a 4 byte type
+ * (most Unix systems).
*
* To use non-const std::wstring references use the following %apply. Note
* that they are passed by value.
@@ -15,6 +17,28 @@
#include <string>
%}
+%fragment("Swig_csharp_UTF16ToWString", "header") %{
+/* For converting from .NET UTF16 (2 byte unicode) strings. wchar_t is 2 bytes on Windows, 4 bytes on Linux. */
+static std::wstring Swig_csharp_UTF16ToWString(const unsigned short *str) {
+ if (sizeof(wchar_t) == 2) {
+ return std::wstring((wchar_t *)str);
+ } else {
+ const unsigned short *pBegin(str);
+ const unsigned short *ptr(pBegin);
+
+ while (*ptr != 0)
+ ++ptr;
+
+ std::wstring result;
+ result.reserve(ptr - pBegin);
+ while(pBegin != ptr)
+ result.push_back(*pBegin++);
+
+ return result;
+ }
+}
+%}
+
namespace std {
%naturalvar wstring;
@@ -22,31 +46,33 @@ namespace std {
class wstring;
// wstring
-%typemap(ctype, out="void *") wstring "wchar_t *"
+%typemap(ctype, out="void *") wstring "unsigned short *"
%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)]"
+ outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ directoroutattributes="[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"
-%typemap(in, canthrow=1) wstring
+%typemap(in, canthrow=1, fragment="Swig_csharp_UTF16ToWString") wstring
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
- $1.assign($input); %}
-%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %}
+ $1 = Swig_csharp_UTF16ToWString($input); %}
+%typemap(out) wstring %{ $result = SWIG_csharp_wstring_with_length_callback($1.data(), (int)$1.size()); %}
-%typemap(directorout, canthrow=1) wstring
+%typemap(directorout, canthrow=1) wstring
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
- $result.assign($input); %}
+ $result = Swig_csharp_UTF16ToWString($input); %}
-%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
+%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_with_length_callback($1.data(), (int)$1.size()); %}
%typemap(csin) wstring "$csinput"
%typemap(csout, excode=SWIGEXCODE) wstring {
@@ -57,29 +83,30 @@ class wstring;
%typemap(typecheck) wstring = wchar_t *;
%typemap(throws, canthrow=1) wstring
-%{ std::string message($1.begin(), $1.end());
- SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
+%{ SWIG_csharp_ApplicationException_callback($1.data(), (int)$1.size());
return $null; %}
// const wstring &
-%typemap(ctype, out="void *") const wstring & "wchar_t *"
+%typemap(ctype, out="void *") const wstring & "unsigned short *"
%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)]"
+ outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ directoroutattributes="[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"
%typemap(csdirectorout) const wstring & "$cscall"
-%typemap(in, canthrow=1) const wstring &
+%typemap(in, canthrow=1, fragment="Swig_csharp_UTF16ToWString") const wstring &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
- std::wstring $1_str($input);
+ std::wstring $1_str(Swig_csharp_UTF16ToWString($input));
$1 = &$1_str; %}
-%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %}
+%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_with_length_callback($1->data(), (int)$1->size()); %}
%typemap(csin) const wstring & "$csinput"
%typemap(csout, excode=SWIGEXCODE) const wstring & {
@@ -94,10 +121,10 @@ class wstring;
}
/* possible thread/reentrant code problem */
static std::wstring $1_str;
- $1_str = $input;
+ $1_str = Swig_csharp_UTF16ToWString($input);
$result = &$1_str; %}
-%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
+%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_with_length_callback($1.data(), (int)$1.size()); %}
%typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{
set {
@@ -112,8 +139,7 @@ class wstring;
%typemap(typecheck) const wstring & = wchar_t *;
%typemap(throws, canthrow=1) const wstring &
-%{ std::string message($1.begin(), $1.end());
- SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
+%{ SWIG_csharp_ApplicationException_callback($1.data(), (int)$1.size());
return $null; %}
}
diff --git a/linux-x86/share/swig/csharp/swigmove.i b/linux-x86/share/swig/csharp/swigmove.i
new file mode 100644
index 0000000..2f21bd6
--- /dev/null
+++ b/linux-x86/share/swig/csharp/swigmove.i
@@ -0,0 +1,16 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, canthrow=1, fragment="<memory>") SWIGTYPE MOVE ($&1_type argp)
+%{ argp = ($&1_ltype)$input;
+ if (!argp) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
+ return $null;
+ }
+ SwigValueWrapper< $1_ltype >::reset($1, argp); %}
+
+%typemap(csin) SWIGTYPE MOVE "$&csclassname.swigRelease($csinput)"
diff --git a/linux-x86/share/swig/csharp/typemaps.i b/linux-x86/share/swig/csharp/typemaps.i
index b6f9bdd..80a5cb5 100644
--- a/linux-x86/share/swig/csharp/typemaps.i
+++ b/linux-x86/share/swig/csharp/typemaps.i
@@ -74,15 +74,11 @@ INPUT_TYPEMAP(short, short, short)
INPUT_TYPEMAP(unsigned short, unsigned short, ushort)
INPUT_TYPEMAP(int, int, int)
INPUT_TYPEMAP(unsigned int, unsigned int, uint)
-INPUT_TYPEMAP(long, long, int)
-INPUT_TYPEMAP(unsigned long, unsigned long, uint)
INPUT_TYPEMAP(long long, long long, long)
INPUT_TYPEMAP(unsigned long long, unsigned long long, ulong)
INPUT_TYPEMAP(float, float, float)
INPUT_TYPEMAP(double, double, double)
-#undef INPUT_TYPEMAP
-
/*
OUTPUT typemaps
---------------
@@ -153,15 +149,11 @@ OUTPUT_TYPEMAP(short, short, short, INT16_PTR)
OUTPUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR)
OUTPUT_TYPEMAP(int, int, int, INT32_PTR)
OUTPUT_TYPEMAP(unsigned int, unsigned int, uint, UINT32_PTR)
-OUTPUT_TYPEMAP(long, long, int, INT32_PTR)
-OUTPUT_TYPEMAP(unsigned long, unsigned long, uint, UINT32_PTR)
OUTPUT_TYPEMAP(long long, long long, long, INT64_PTR)
OUTPUT_TYPEMAP(unsigned long long, unsigned long long, ulong, UINT64_PTR)
OUTPUT_TYPEMAP(float, float, float, FLOAT_PTR)
OUTPUT_TYPEMAP(double, double, double, DOUBLE_PTR)
-#undef OUTPUT_TYPEMAP
-
%typemap(in) bool *OUTPUT, bool &OUTPUT
%{ *$input = 0;
$1 = ($1_ltype)$input; %}
@@ -242,12 +234,47 @@ INOUT_TYPEMAP(short, short, short, INT16_PTR)
INOUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR)
INOUT_TYPEMAP(int, int, int, INT32_PTR)
INOUT_TYPEMAP(unsigned int, unsigned int, uint, UINT32_PTR)
-INOUT_TYPEMAP(long, long, int, INT32_PTR)
-INOUT_TYPEMAP(unsigned long, unsigned long, uint, UINT32_PTR)
INOUT_TYPEMAP(long long, long long, long, INT64_PTR)
INOUT_TYPEMAP(unsigned long long, unsigned long long, ulong, UINT64_PTR)
INOUT_TYPEMAP(float, float, float, FLOAT_PTR)
INOUT_TYPEMAP(double, double, double, DOUBLE_PTR)
-#undef INOUT_TYPEMAP
+// 32-bit/64-bit architecture specific typemaps - marshal as 32-bit by default
+#if !defined(SWIGWORDSIZE64)
+INPUT_TYPEMAP(long, int, int)
+INPUT_TYPEMAP(unsigned long, unsigned int, uint)
+
+OUTPUT_TYPEMAP(long, int, int, INT32_PTR)
+OUTPUT_TYPEMAP(unsigned long, unsigned int, uint, UINT32_PTR)
+
+INOUT_TYPEMAP(long, int, int, INT32_PTR)
+INOUT_TYPEMAP(unsigned long, unsigned int, uint, UINT32_PTR)
+#else
+INPUT_TYPEMAP(long, long long, int)
+INPUT_TYPEMAP(unsigned long, unsigned long long, uint)
+
+OUTPUT_TYPEMAP(long, long long, int, INT64_PTR)
+OUTPUT_TYPEMAP(unsigned long, unsigned long long, uint, UINT64_PTR)
+
+INOUT_TYPEMAP(long, long long, int, INT64_PTR)
+INOUT_TYPEMAP(unsigned long, unsigned long long, uint, UINT64_PTR)
+#endif
+%typemap(in) long INPUT[] ($*1_ltype tempinput), unsigned long INPUT[] ($*1_ltype tempinput)
+%{tempinput = ($*1_ltype)*$input;
+ $1 = &tempinput;%}
+
+%typemap(in) long OUTPUT[] ($*1_ltype tempoutput), unsigned long OUTPUT[] ($*1_ltype tempoutput)
+%{$1 = &tempoutput;%}
+
+%typemap(in) long INOUT[] ($*1_ltype tempinout), unsigned long INOUT[] ($*1_ltype tempinout)
+%{tempinout = ($*1_ltype)*$input;
+ $1 = &tempinout;%}
+
+%typemap(argout) long OUTPUT[], unsigned long OUTPUT[] "*$input = *$1;"
+%typemap(argout) long INOUT[], unsigned long INOUT[] "*$input = *$1;"
+
+
+#undef INPUT_TYPEMAP
+#undef OUTPUT_TYPEMAP
+#undef INOUT_TYPEMAP
diff --git a/linux-x86/share/swig/csharp/wchar.i b/linux-x86/share/swig/csharp/wchar.i
index 7981941..f1e0d5a 100644
--- a/linux-x86/share/swig/csharp/wchar.i
+++ b/linux-x86/share/swig/csharp/wchar.i
@@ -2,37 +2,58 @@
* wchar.i
*
* Typemaps for the wchar_t type
- * These are mapped to a C# String and are passed around by value.
+ * wchar_t * is mapped to a C# Unicode string (UTF16) and is passed around by value.
+ * wchar_t * support includes wchar_t as a 2 byte type (Windows) and a 4 byte type
+ * (most Unix systems).
*
* Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER
- *
* ----------------------------------------------------------------------------- */
#if !defined(SWIG_CSHARP_NO_WSTRING_HELPER)
#if !defined(SWIG_CSHARP_WSTRING_HELPER_)
#define SWIG_CSHARP_WSTRING_HELPER_
+
+%fragment("<wchar.h>"); // TODO: %fragment("<wchar.h", "runtime");
+
%insert(runtime) %{
/* Callback for returning strings to C# without leaking memory */
-typedef void * (SWIGSTDCALL* SWIG_CSharpWStringHelperCallback)(const wchar_t *);
-static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
+typedef void * (SWIGSTDCALL* SWIG_CSharpWStringHelperCallback)(const wchar_t *, int length);
+static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_with_length_callback = NULL;
+%}
+
+%insert(header) %{
+static void * SWIG_csharp_wstring_callback(const wchar_t *s) {
+ return SWIG_csharp_wstring_with_length_callback(s, (int)wcslen(s));
+}
%}
+
%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);
+ public delegate string SWIGWStringDelegate(global::System.IntPtr message, int length);
+ static SWIGWStringDelegate wstringUTF16Delegate = new SWIGWStringDelegate(CreateWStringFromUTF16);
+ static SWIGWStringDelegate wstringUTF32Delegate = new SWIGWStringDelegate(CreateWStringFromUTF32);
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")]
- public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate);
+ public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringUTF16Delegate, SWIGWStringDelegate wstringUTF32Delegate);
- static string CreateWString([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString) {
- return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString);
+ public static string CreateWStringFromUTF16([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
+ return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString, length);
+ }
+
+ public static string CreateWStringFromUTF32([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
+ if (length == 0)
+ return string.Empty;
+
+ byte[] buffer = new byte[length * 4];
+ global::System.Runtime.InteropServices.Marshal.Copy(cString, buffer, 0, buffer.Length);
+ return global::System.Text.Encoding.UTF32.GetString(buffer);
}
static SWIGWStringHelper() {
- SWIGRegisterWStringCallback_$module(wstringDelegate);
+ SWIGRegisterWStringCallback_$module(wstringUTF16Delegate, wstringUTF32Delegate);
}
}
@@ -43,13 +64,76 @@ static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
#ifdef __cplusplus
extern "C"
#endif
-SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStringHelperCallback callback) {
- SWIG_csharp_wstring_callback = callback;
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStringHelperCallback callback_utf16, SWIG_CSharpWStringHelperCallback callback_utf32) {
+ SWIG_csharp_wstring_with_length_callback = sizeof(wchar_t) == 2 ? callback_utf16 : callback_utf32;
}
%}
#endif // SWIG_CSHARP_WSTRING_HELPER_
#endif // SWIG_CSHARP_NO_WSTRING_HELPER
+#if !defined(SWIG_CSHARP_NO_WSTRING_EXCEPTION_HELPER)
+#if !defined(SWIG_CSHARP_WSTRING_EXCEPTION_HELPER_)
+#define SWIG_CSHARP_WSTRING_EXCEPTION_HELPER_
+
+%insert(runtime) %{
+/* Callback for returning strings to C# without leaking memory */
+typedef void (SWIGSTDCALL* SWIG_CSharpWStringExceptionHelperCallback)(const wchar_t *, int length);
+static SWIG_CSharpWStringExceptionHelperCallback SWIG_csharp_ApplicationException_callback = NULL;
+%}
+
+%pragma(csharp) imclasscode=%{
+ protected class SWIGWStringExceptionHelper {
+
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]
+ public delegate void SWIGWStringExceptionDelegate(global::System.IntPtr message, int length);
+ static SWIGWStringExceptionDelegate applicationExceptionUTF16Delegate = new SWIGWStringExceptionDelegate(SetPendingApplicationExceptionUTF16);
+ static SWIGWStringExceptionDelegate applicationExceptionUTF32Delegate = new SWIGWStringExceptionDelegate(SetPendingApplicationExceptionUTF32);
+
+ [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringExceptionCallback_$module")]
+ public static extern void SWIGRegisterWStringExceptionCallback_$module(SWIGWStringExceptionDelegate applicationExceptionUTF16Delegate, SWIGWStringExceptionDelegate applicationExceptionUTF32Delegate);
+
+ static string CreateWStringFromUTF16([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
+ return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString, length);
+ }
+
+ public static string CreateWStringFromUTF32([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
+ if (length == 0)
+ return string.Empty;
+
+ byte[] buffer = new byte[length * 4];
+ return global::System.Text.Encoding.UTF32.GetString(buffer);
+ }
+
+ static void SetPendingApplicationExceptionUTF16([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
+ string message = SWIGWStringHelper.CreateWStringFromUTF16(cString, length);
+ SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
+ }
+
+ static void SetPendingApplicationExceptionUTF32([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
+ string message = SWIGWStringHelper.CreateWStringFromUTF32(cString, length);
+ SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
+ }
+
+ static SWIGWStringExceptionHelper() {
+ SWIGRegisterWStringExceptionCallback_$module(applicationExceptionUTF16Delegate, applicationExceptionUTF32Delegate);
+ }
+ }
+
+ static protected SWIGWStringExceptionHelper swigWStringExceptionHelper = new SWIGWStringExceptionHelper();
+%}
+
+%insert(runtime) %{
+#ifdef __cplusplus
+extern "C"
+#endif
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringExceptionCallback_$module(SWIG_CSharpWStringExceptionHelperCallback callback_utf16, SWIG_CSharpWStringExceptionHelperCallback callback_utf32) {
+ SWIG_csharp_ApplicationException_callback = sizeof(wchar_t) == 2 ? callback_utf16 : callback_utf32;
+}
+%}
+
+#endif // SWIG_CSHARP_WSTRING_EXCEPTION_HELPER_
+#endif // SWIG_CSHARP_NO_WSTRING_EXCEPTION_HELPER
+
// wchar_t
%typemap(ctype) wchar_t "wchar_t"
@@ -77,13 +161,64 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
%typemap(typecheck) wchar_t = char;
// wchar_t *
-%typemap(ctype) wchar_t * "wchar_t *"
-%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", out="global::System.IntPtr" ) wchar_t * "string"
+
+%fragment("Swig_csharp_UTF16ToWCharPtr", "header") %{
+/* For converting from .NET UTF16 (2 byte unicode) strings. wchar_t is 2 bytes on Windows, 4 bytes on Linux. */
+static wchar_t * Swig_csharp_UTF16ToWCharPtr(const unsigned short *str) {
+ if (sizeof(wchar_t) == 2) {
+ return (wchar_t *)str;
+ } else {
+ wchar_t *result = 0;
+
+ if (str) {
+ const unsigned short *pBegin(str);
+ const unsigned short *pEnd(pBegin);
+ wchar_t *ptr = 0;
+
+ while (*pEnd != 0)
+ ++pEnd;
+
+#ifdef __cplusplus
+ result = ptr = new wchar_t[pEnd - pBegin + 1];
+#else
+ result = ptr = (wchar_t *)malloc(sizeof(wchar_t) * (pEnd - pBegin + 1));
+#endif
+ while(pBegin != pEnd)
+ *ptr++ = *pBegin++;
+ *ptr++ = 0;
+ }
+
+ return result;
+ }
+}
+%}
+
+%fragment("Swig_csharp_UTF16ToWCharPtrFree", "header") %{
+static void Swig_csharp_UTF16ToWCharPtrFree(wchar_t *str) {
+ if (sizeof(wchar_t) != 2) {
+#ifdef __cplusplus
+ delete [] str;
+#else
+ free(str);
+#endif
+ }
+}
+%}
+
+%typemap(ctype, out="void *") wchar_t * "unsigned short *"
+%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)]",
+ directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ directoroutattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]"
+ ) wchar_t * "string"
%typemap(cstype) wchar_t * "string"
+%typemap(csdirectorin) wchar_t * "$iminput"
+%typemap(csdirectorout) wchar_t * "$cscall"
%typemap(csin) wchar_t * "$csinput"
%typemap(csout, excode=SWIGEXCODE) wchar_t * {
- string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
+ string ret = $imcall;$excode
return ret;
}
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{
@@ -96,8 +231,105 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
return ret;
} %}
-%typemap(in) wchar_t * %{ $1 = ($1_ltype)$input; %}
-%typemap(out) wchar_t * %{ $result = (wchar_t *)$1; %}
+%typemap(in, fragment="Swig_csharp_UTF16ToWCharPtr") wchar_t *
+%{ $1 = Swig_csharp_UTF16ToWCharPtr($input); %}
+
+%typemap(out) wchar_t * %{ $result = $1 ? SWIG_csharp_wstring_callback($1) : 0; %}
+
+%typemap(freearg, fragment="Swig_csharp_UTF16ToWCharPtrFree") wchar_t *
+%{ Swig_csharp_UTF16ToWCharPtrFree($1); %}
+
+%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) wchar_t *
+%{ $result = Swig_csharp_UTF16ToWCharPtr($input); %}
+
+%typemap(directorin) wchar_t * %{ $input = SWIG_csharp_wstring_with_length_callback($1, (int)wcslen($1)); %}
%typemap(typecheck) wchar_t * = char *;
+%typemap(throws, canthrow=1, fragment="<wchar.h>") wchar_t *
+%{ SWIG_csharp_ApplicationException_callback($1, (int)wcslen($1));
+ return $null; %}
+
+
+/* Default typemap for handling wchar_t * members (based on char * in swig.swg) */
+
+#ifdef __cplusplus
+%typemap(memberin,fragment="<wchar.h>") wchar_t * {
+ delete [] $1;
+ if ($input && sizeof(wchar_t) == 2) {
+ $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]);
+ wcscpy((wchar_t *)$1, (const wchar_t *)$input);
+ } else {
+ $1 = $input;
+ $input = 0;
+ }
+}
+%typemap(memberin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="<wchar.h>") const wchar_t * {
+ if ($input && sizeof(wchar_t) == 2) {
+ $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]);
+ wcscpy((wchar_t *)$1, (const wchar_t *)$input);
+ } else {
+ $1 = $input;
+ $input = 0;
+ }
+}
+%typemap(globalin,fragment="<wchar.h>") wchar_t * {
+ delete [] $1;
+ if ($input && sizeof(wchar_t) == 2) {
+ $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]);
+ wcscpy((wchar_t *)$1, (const wchar_t *)$input);
+ } else {
+ $1 = $input;
+ $input = 0;
+ }
+}
+%typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="<wchar.h>") const wchar_t * {
+ if ($input && sizeof(wchar_t) == 2) {
+ $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]);
+ wcscpy((wchar_t *)$1, (const wchar_t *)$input);
+ } else {
+ $1 = $input;
+ $input = 0;
+ }
+}
+#else
+%typemap(memberin,fragment="<wchar.h>") wchar_t * {
+ free($1);
+ if ($input && sizeof(wchar_t) == 2) {
+ $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1);
+ wcscpy((wchar_t *)$1, (const wchar_t *)$input);
+ } else {
+ $1 = $input;
+ $input = 0;
+ }
+}
+%typemap(memberin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="<wchar.h>") const wchar_t * {
+ if ($input && sizeof(wchar_t) == 2) {
+ $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1);
+ wcscpy((wchar_t *)$1, (const wchar_t *)$input);
+ } else {
+ $1 = $input;
+ $input = 0;
+ }
+}
+%typemap(globalin,fragment="<wchar.h>") wchar_t * {
+ free($1);
+ if ($input && sizeof(wchar_t) == 2) {
+ $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1);
+ wcscpy((wchar_t *)$1, (const wchar_t *)$input);
+ } else {
+ $1 = $input;
+ $input = 0;
+ }
+}
+%typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="<wchar.h>") const wchar_t * {
+ if ($input && sizeof(wchar_t) == 2) {
+ $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1);
+ wcscpy((wchar_t *)$1, (const wchar_t *)$input);
+ } else {
+ $1 = $input;
+ $input = 0;
+ }
+}
+
+#endif
diff --git a/linux-x86/share/swig/d/argcargv.i b/linux-x86/share/swig/d/argcargv.i
new file mode 100644
index 0000000..92544f9
--- /dev/null
+++ b/linux-x86/share/swig/d/argcargv.i
@@ -0,0 +1,26 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(ctype) (int ARGC, char **ARGV) "SWIG_c_dstring_array"
+%typemap(imtype) (int ARGC, char **ARGV) "string[]"
+%typemap(dtype) (int ARGC, char **ARGV) "string[]"
+
+%typemap(in, canthrow=1) (int ARGC, char **ARGV) {
+ $1_ltype i, len;
+ len = $input.len;
+ $2 = ($2_ltype) malloc((len+1)*sizeof($*2_ltype));
+ if ($2 == SWIG_NULLPTR) {
+ SWIG_DSetPendingException(SWIG_DException, "memory allocation failed");
+ return $null;
+ }
+ $1 = len;
+ for (i = 0; i < len; i++) {
+ $2[i] = $input.array[i].str;
+ }
+ $2[i] = SWIG_NULLPTR;
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ free((void *)$2);
+}
diff --git a/linux-x86/share/swig/d/boost_shared_ptr.i b/linux-x86/share/swig/d/boost_shared_ptr.i
index 4a220a5..6d85c5a 100644
--- a/linux-x86/share/swig/d/boost_shared_ptr.i
+++ b/linux-x86/share/swig/d/boost_shared_ptr.i
@@ -23,10 +23,10 @@
}
$1 = *argp; %}
%typemap(out) CONST TYPE
-%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
+%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %}
%typemap(directorin) CONST TYPE
-%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
+%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %}
%typemap(directorout) CONST TYPE
%{ if (!$input) {
@@ -116,7 +116,7 @@
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
-%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
+%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0;
if ($owner) delete $1; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
diff --git a/linux-x86/share/swig/d/carrays.i b/linux-x86/share/swig/d/carrays.i
index f2803ea..0bd99a7 100644
--- a/linux-x86/share/swig/d/carrays.i
+++ b/linux-x86/share/swig/d/carrays.i
@@ -10,16 +10,16 @@
* Generates functions for creating and accessing elements of a C array
* (as pointers). Creates the following functions:
*
- * TYPE *new_NAME(int nelements)
+ * TYPE *new_NAME(size_t nelements)
* void delete_NAME(TYPE *);
- * TYPE NAME_getitem(TYPE *, int index);
- * void NAME_setitem(TYPE *, int index, TYPE value);
+ * TYPE NAME_getitem(TYPE *, size_t index);
+ * void NAME_setitem(TYPE *, size_t index, TYPE value);
*
* ----------------------------------------------------------------------------- */
%define %array_functions(TYPE,NAME)
%{
-static TYPE *new_##NAME(int nelements) { %}
+static TYPE *new_##NAME(size_t nelements) { %}
#ifdef __cplusplus
%{ return new TYPE[nelements](); %}
#else
@@ -35,18 +35,18 @@ static void delete_##NAME(TYPE *ary) { %}
#endif
%{}
-static TYPE NAME##_getitem(TYPE *ary, int index) {
+static TYPE NAME##_getitem(TYPE *ary, size_t index) {
return ary[index];
}
-static void NAME##_setitem(TYPE *ary, int index, TYPE value) {
+static void NAME##_setitem(TYPE *ary, size_t index, TYPE value) {
ary[index] = value;
}
%}
-TYPE *new_##NAME(int nelements);
+TYPE *new_##NAME(size_t nelements);
void delete_##NAME(TYPE *ary);
-TYPE NAME##_getitem(TYPE *ary, int index);
-void NAME##_setitem(TYPE *ary, int index, TYPE value);
+TYPE NAME##_getitem(TYPE *ary, size_t index);
+void NAME##_setitem(TYPE *ary, size_t index, TYPE value);
%enddef
@@ -58,13 +58,13 @@ void NAME##_setitem(TYPE *ary, int index, TYPE value);
* interface:
*
* struct NAME {
- * NAME(int nelements);
+ * NAME(size_t nelements);
* ~NAME();
- * TYPE getitem(int index);
- * void setitem(int index, TYPE value);
+ * TYPE getitem(size_t index);
+ * void setitem(size_t index, TYPE value);
* TYPE * ptr();
* static NAME *frompointer(TYPE *t);
- * }
+ * }
*
* ----------------------------------------------------------------------------- */
@@ -76,34 +76,36 @@ typedef TYPE NAME;
typedef struct {} NAME;
%extend NAME {
+
#ifdef __cplusplus
- NAME(int nelements) {
- return new TYPE[nelements]();
- }
- ~NAME() {
- delete [] self;
- }
+NAME(size_t nelements) {
+ return new TYPE[nelements]();
+}
+~NAME() {
+ delete [] self;
+}
#else
- NAME(int nelements) {
- return (TYPE *) calloc(nelements,sizeof(TYPE));
- }
- ~NAME() {
- free(self);
- }
+NAME(size_t nelements) {
+ return (TYPE *) calloc(nelements,sizeof(TYPE));
+}
+~NAME() {
+ free(self);
+}
#endif
- TYPE getitem(int index) {
- return self[index];
- }
- void setitem(int index, TYPE value) {
- self[index] = value;
- }
- TYPE * ptr() {
- return self;
- }
- static NAME *frompointer(TYPE *t) {
- return (NAME *) t;
- }
+TYPE getitem(size_t index) {
+ return self[index];
+}
+void setitem(size_t index, TYPE value) {
+ self[index] = value;
+}
+TYPE * ptr() {
+ return self;
+}
+static NAME *frompointer(TYPE *t) {
+ return (NAME *) t;
+}
+
};
%types(NAME = TYPE);
diff --git a/linux-x86/share/swig/d/cpointer.i b/linux-x86/share/swig/d/cpointer.i
index 75e610f..da3084b 100644
--- a/linux-x86/share/swig/d/cpointer.i
+++ b/linux-x86/share/swig/d/cpointer.i
@@ -54,14 +54,14 @@ NAME() {
return new TYPE();
}
~NAME() {
- if (self) delete self;
+ delete self;
}
#else
NAME() {
return (TYPE *) calloc(1,sizeof(TYPE));
}
~NAME() {
- if (self) free(self);
+ free(self);
}
#endif
}
@@ -133,9 +133,9 @@ static TYPE *copy_##NAME(TYPE value) { %}
static void delete_##NAME(TYPE *self) { %}
#ifdef __cplusplus
-%{ if (self) delete self; %}
+%{ delete self; %}
#else
-%{ if (self) free(self); %}
+%{ free(self); %}
#endif
%{}
diff --git a/linux-x86/share/swig/d/dclassgen.swg b/linux-x86/share/swig/d/dclassgen.swg
index 84fa03a..e4ff8d5 100644
--- a/linux-x86/share/swig/d/dclassgen.swg
+++ b/linux-x86/share/swig/d/dclassgen.swg
@@ -76,6 +76,19 @@ public static void* swigGetCPtr(typeof(this) obj) {
return (obj is null) ? null : obj.swigCPtr;
}
+public static void* swigRelease(typeof(this) obj) {
+ if (obj !is null) {
+ if (!obj.swigCMemOwn)
+ throw new Exception("Cannot release ownership as memory is not owned");
+ void* ptr = obj.swigCPtr;
+ obj.swigCMemOwn = false;
+ obj.dispose();
+ return ptr;
+ } else {
+ return null;
+ }
+}
+
mixin $imdmodule.SwigOperatorDefinitions;
%}
@@ -92,6 +105,19 @@ public static void* swigGetCPtr(typeof(this) obj) {
return (obj is null) ? null : obj.swigCPtr;
}
+public static void* swigRelease(typeof(this) obj) {
+ if (obj !is null) {
+ if (!obj.swigCMemOwn)
+ throw new Exception("Cannot release ownership as memory is not owned");
+ void* ptr = obj.swigCPtr;
+ obj.swigCMemOwn = false;
+ obj.dispose();
+ return ptr;
+ } else {
+ return null;
+ }
+}
+
mixin $imdmodule.SwigOperatorDefinitions;
%}
@@ -100,7 +126,7 @@ mixin $imdmodule.SwigOperatorDefinitions;
* Type wrapper classes.
*/
-%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
+%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] %{
private void* swigCPtr;
public this(void* cObject, bool futureUse) {
@@ -115,6 +141,10 @@ public static void* swigGetCPtr(typeof(this) obj) {
return (obj is null) ? null : obj.swigCPtr;
}
+public static void* swigRelease(typeof(this) obj) {
+ return (obj is null) ? null : obj.swigCPtr;
+}
+
mixin $imdmodule.SwigOperatorDefinitions;
%}
diff --git a/linux-x86/share/swig/d/dexception.swg b/linux-x86/share/swig/d/dexception.swg
index 1aadbaa..74e0422 100644
--- a/linux-x86/share/swig/d/dexception.swg
+++ b/linux-x86/share/swig/d/dexception.swg
@@ -15,7 +15,7 @@
unsigned long,
unsigned short
%{ char error_msg[256];
- sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
+ SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1);
SWIG_DSetPendingException(SWIG_DException, error_msg);
return $null; %}
diff --git a/linux-x86/share/swig/d/dhead.swg b/linux-x86/share/swig/d/dhead.swg
index 50e9c2e..40393c9 100644
--- a/linux-x86/share/swig/d/dhead.swg
+++ b/linux-x86/share/swig/d/dhead.swg
@@ -1,9 +1,6 @@
/* -----------------------------------------------------------------------------
* dhead.swg
*
- * Support code for exceptions if the SWIG_D_NO_EXCEPTION_HELPER is not defined
- * Support code for strings if the SWIG_D_NO_STRING_HELPER is not defined
- *
* Support code for function pointers. ----------------------------------------------------------------------------- */
%insert(runtime) %{
@@ -12,7 +9,7 @@
#include <stdio.h>
/* Contract support. */
-#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_DSetPendingException(SWIG_DException, msg); return nullreturn; } else
+#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_DSetPendingException(SWIG_DException, msg); return nullreturn; } } while (0)
%}
@@ -20,7 +17,6 @@
* Exception support code.
*/
-#if !defined(SWIG_D_NO_EXCEPTION_HELPER)
%insert(runtime) %{
// Support for throwing D exceptions from C/C++.
typedef enum {
@@ -71,87 +67,6 @@ SWIGEXPORT void SWIGRegisterExceptionCallbacks_$module(
}
%}
-#if (SWIG_D_VERSION == 1)
-%pragma(d) imdmoduleimports=%{
-// Exception throwing support currently requires Tango, but there is no reason
-// why it could not support Phobos.
-static import tango.core.Exception;
-static import tango.core.Thread;
-static import tango.stdc.stringz;
-%}
-
-%pragma(d) imdmodulecode=%{
-private class SwigExceptionHelper {
- static this() {
- swigRegisterExceptionCallbacks$module(
- &setException,
- &setIllegalArgumentException,
- &setIllegalElementException,
- &setIOException,
- &setNoSuchElementException);
- }
-
- static void setException(char* message) {
- auto exception = new object.Exception(tango.stdc.stringz.fromStringz(message).dup);
- SwigPendingException.set(exception);
- }
-
- static void setIllegalArgumentException(char* message) {
- auto exception = new tango.core.Exception.IllegalArgumentException(tango.stdc.stringz.fromStringz(message).dup);
- SwigPendingException.set(exception);
- }
-
- static void setIllegalElementException(char* message) {
- auto exception = new tango.core.Exception.IllegalElementException(tango.stdc.stringz.fromStringz(message).dup);
- SwigPendingException.set(exception);
- }
-
- static void setIOException(char* message) {
- auto exception = new tango.core.Exception.IOException(tango.stdc.stringz.fromStringz(message).dup);
- SwigPendingException.set(exception);
- }
-
- static void setNoSuchElementException(char* message) {
- auto exception = new tango.core.Exception.NoSuchElementException(tango.stdc.stringz.fromStringz(message).dup);
- SwigPendingException.set(exception);
- }
-}
-
-package class SwigPendingException {
-public:
- static this() {
- m_sPendingException = new ThreadLocalData(null);
- }
-
- static bool isPending() {
- return m_sPendingException.val !is null;
- }
-
- static void set(object.Exception e) {
- auto pending = m_sPendingException.val;
- if (pending !is null) {
- e.next = pending;
- throw new object.Exception("FATAL: An earlier pending exception from C/C++ " ~
- "code was missed and thus not thrown (" ~ pending.classinfo.name ~ ": " ~
- pending.msg ~ ")!", e);
- }
- m_sPendingException.val = e;
- }
-
- static object.Exception retrieve() {
- auto e = m_sPendingException.val;
- m_sPendingException.val = null;
- return e;
- }
-
-private:
- // The reference to the pending exception (if any) is stored thread-local.
- alias tango.core.Thread.ThreadLocal!(object.Exception) ThreadLocalData;
- static ThreadLocalData m_sPendingException;
-}
-alias void function(char* message) SwigExceptionCallback;
-%}
-#else
%pragma(d) imdmoduleimports=%{
static import std.conv;
%}
@@ -175,7 +90,7 @@ private class SwigExceptionHelper {
}
}
-package struct SwigPendingException {
+public class SwigPendingException {
public:
static this() {
m_sPendingException = null;
@@ -208,16 +123,13 @@ private:
}
alias void function(const char* message) SwigExceptionCallback;
%}
-#endif
// Callback registering function in wrapperloader.swg.
-#endif // SWIG_D_NO_EXCEPTION_HELPER
/*
* String support code.
*/
-#if !defined(SWIG_D_NO_STRING_HELPER)
%insert(runtime) %{
// Callback for returning strings to D without leaking memory.
typedef char * (* SWIG_DStringHelperCallback)(const char *);
@@ -231,23 +143,6 @@ SWIGEXPORT void SWIGRegisterStringCallback_$module(SWIG_DStringHelperCallback ca
}
%}
-#if (SWIG_D_VERSION == 1)
-%pragma(d) imdmoduleimports = "static import tango.stdc.stringz;";
-
-%pragma(d) imdmodulecode = %{
-private class SwigStringHelper {
- static this() {
- swigRegisterStringCallback$module(&createString);
- }
-
- static char* createString(char* cString) {
- // We are effectively dup'ing the string here.
- return tango.stdc.stringz.toStringz(tango.stdc.stringz.fromStringz(cString));
- }
-}
-alias char* function(char* cString) SwigStringCallback;
-%}
-#else
%pragma(d) imdmoduleimports = %{
static import std.conv;
static import std.string;
@@ -261,31 +156,18 @@ private class SwigStringHelper {
static const(char)* createString(const(char*) cString) {
// We are effectively dup'ing the string here.
- // TODO: Is this also correct for D2/Phobos?
+ // TODO: Is this correct for D2/Phobos?
return std.string.toStringz(std.conv.to!string(cString));
}
}
alias const(char)* function(const(char*) cString) SwigStringCallback;
%}
-#endif
// Callback registering function in wrapperloader.swg.
-#endif // SWIG_D_NO_STRING_HELPER
/*
* Function pointer support code.
*/
-#if (SWIG_D_VERSION == 1)
-%pragma(d) imdmodulecode = %{
-template SwigExternC(T) {
- static if (is(typeof(*(T.init)) R == return)) {
- static if (is(typeof(*(T.init)) P == function)) {
- alias extern(C) R function(P) SwigExternC;
- }
- }
-}
-%}
-#else
%pragma(d) imdmodulecode = %{
template SwigExternC(T) if (is(typeof(*(T.init)) P == function)) {
static if (is(typeof(*(T.init)) R == return)) {
@@ -295,4 +177,3 @@ template SwigExternC(T) if (is(typeof(*(T.init)) P == function)) {
}
}
%}
-#endif
diff --git a/linux-x86/share/swig/d/dkw.swg b/linux-x86/share/swig/d/dkw.swg
index 581093f..b96d1fa 100644
--- a/linux-x86/share/swig/d/dkw.swg
+++ b/linux-x86/share/swig/d/dkw.swg
@@ -2,7 +2,7 @@
#define D_DKW_SWG_
/* Warnings for D keywords */
-#define DKEYWORD(x) %keywordwarn("'" `x` "' is a D keyword, renaming to '_" `x` "'",rename="_%s") `x`
+#define DKEYWORD(x) %keywordwarn("'" `x` "' is a D keyword",rename="_%s") `x`
// Source: http://www.digitalmars.com/d/{1.0,2.0}/lex.html and
DKEYWORD(Error);
@@ -120,7 +120,7 @@ DKEYWORD(with);
DKEYWORD(wstring);
// Not really a keyword, but dispose() methods are generated in proxy classes
-// and it's a special method name for D1/Tango.
+// and it was a special method name for D1/Tango.
DKEYWORD(dispose);
#undef DKEYWORD
diff --git a/linux-x86/share/swig/d/doperators.swg b/linux-x86/share/swig/d/doperators.swg
index 0cb6353..f651c39 100644
--- a/linux-x86/share/swig/d/doperators.swg
+++ b/linux-x86/share/swig/d/doperators.swg
@@ -4,129 +4,6 @@
* Mapping of C++ operator overloading methods to D.
* ----------------------------------------------------------------------------- */
-#if (SWIG_D_VERSION == 1)
-
-%pragma(d) imdmodulecode=%{
-template SwigOperatorDefinitions() {
- public override int opEquals(Object o) {
- if (auto rhs = cast(typeof(this))o) {
- if (swigCPtr == rhs.swigCPtr) return 1;
- static if (is(typeof(swigOpEquals(rhs)))) {
- return swigOpEquals(rhs) ? 1 : 0;
- } else {
- return 0;
- }
- }
- return super.opEquals(o);
- }
-%}
-// opEquals is emitted in pure C mode as well to define two proxy classes
-// pointing to the same struct as equal.
-
-#ifdef __cplusplus
-%rename(opPos) *::operator+();
-%rename(opPos) *::operator+() const;
-%rename(opNeg) *::operator-();
-%rename(opNeg) *::operator-() const;
-%rename(opCom) *::operator~();
-%rename(opCom) *::operator~() const;
-
-%rename(opAdd) *::operator+;
-%rename(opAddAssign) *::operator+=;
-%rename(opSub) *::operator-;
-%rename(opSubAssign) *::operator-=;
-%rename(opMul) *::operator*;
-%rename(opMulAssign) *::operator*=;
-%rename(opDiv) *::operator/;
-%rename(opDivAssign) *::operator/=;
-%rename(opMod) *::operator%;
-%rename(opModAssign) *::operator%=;
-%rename(opAnd) *::operator&;
-%rename(opAndAssign) *::operator&=;
-%rename(opOr) *::operator|;
-%rename(opOrAssign) *::operator|=;
-%rename(opXor) *::operator^;
-%rename(opXorAssign) *::operator^=;
-%rename(opShl) *::operator<<;
-%rename(opShlAssign) *::operator<<=;
-%rename(opShr) *::operator>>;
-%rename(opShrAssign) *::operator>>=;
-
-%rename(opIndex) *::operator[](unsigned) const;
-// opIndexAssign is not currently generated, it needs more extensive support
-// mechanisms.
-
-%rename(opCall) *::operator();
-
-// !a is not overrideable in D1.
-%ignoreoperator(LNOT) operator!;
-
-// opCmp is used in D.
-%rename(swigOpEquals) *::operator==;
-%rename(swigOpLt) *::operator<;
-%rename(swigOpLtEquals) *::operator<=;
-%rename(swigOpGt) *::operator>;
-%rename(swigOpGtEquals) *::operator>=;
-
-// a != b is rewritten as !a.opEquals(b) in D.
-%ignoreoperator(NOTEQUAL) operator!=;
-
-// The logic operators are not overrideable in D.
-%ignoreoperator(LAND) operator&&;
-%ignoreoperator(LOR) operator||;
-
-// ++/--a is rewritten as a +/-= 1 in D1,so ignore the prefix operators.
-%ignoreoperator(PLUSPLUS) *::operator++();
-%ignoreoperator(MINUSMINUS) *::operator--();
-%rename(swigOpInc) *::operator++(int);
-%rename(swigOpDec) *::operator--(int);
-
-// The C++ assignment operator does not translate well to D where the proxy
-// classes have reference semantics.
-%ignoreoperator(EQ) operator=;
-
-%pragma(d) imdmodulecode=%{
- public override int opCmp(Object o) {
- static if (is(typeof(swigOpLt(typeof(this).init) &&
- swigOpEquals(typeof(this).init)))) {
- if (auto rhs = cast(typeof(this))o) {
- if (swigOpLt(rhs)) {
- return -1;
- } else if (swigOpEquals(rhs)) {
- return 0;
- } else {
- return 1;
- }
- }
- }
- return super.opCmp(o);
- }
-
- public typeof(this) opPostInc(T = int)(T unused = 0) {
- static assert(
- is(typeof(swigOpInc(int.init))),
- "opPostInc called on " ~ typeof(this).stringof ~ ", but no postfix " ~
- "increment operator exists in the corresponding C++ class."
- );
- return swigOpInc(int.init);
- }
-
- public typeof(this) opPostDec(T = int)(T unused = 0) {
- static assert(
- is(typeof(swigOpDec(int.init))),
- "opPostInc called on " ~ typeof(this).stringof ~ ", but no postfix " ~
- "decrement operator exists in the corresponding C++ class."
- );
- return swigOpDec(int.init);
- }
-%}
-#endif
-
-%pragma(d) imdmodulecode=%{
-}
-%}
-
-#else
%pragma(d) imdmodulecode=%{
mixin template SwigOperatorDefinitions() {
public override bool opEquals(Object o) {
@@ -198,7 +75,7 @@ mixin template SwigOperatorDefinitions() {
// a != b is rewritten as !a.opEquals(b) in D.
%ignoreoperator(NOTEQUAL) operator!=;
-// The logic operators are not overrideable in D.
+// The logic operators are not overridable in D.
%ignoreoperator(LAND) operator&&;
%ignoreoperator(LOR) operator||;
@@ -255,5 +132,3 @@ mixin template SwigOperatorDefinitions() {
%pragma(d) imdmodulecode=%{
}
%}
-
-#endif
diff --git a/linux-x86/share/swig/d/dprimitives.swg b/linux-x86/share/swig/d/dprimitives.swg
index eaee816..843350f 100644
--- a/linux-x86/share/swig/d/dprimitives.swg
+++ b/linux-x86/share/swig/d/dprimitives.swg
@@ -5,17 +5,10 @@
* ----------------------------------------------------------------------------- */
// C long/ulong width depends on the target arch, use stdlib aliases for them.
-#if (SWIG_D_VERSION == 1)
-%pragma(d) imdmoduleimports = "static import tango.stdc.config;"
-%pragma(d) globalproxyimports = "static import tango.stdc.config;"
-#define SWIG_LONG_DTYPE tango.stdc.config.c_long
-#define SWIG_ULONG_DTYPE tango.stdc.config.c_ulong
-#else
%pragma(d) imdmoduleimports = "static import core.stdc.config;"
%pragma(d) globalproxyimports = "static import core.stdc.config;"
#define SWIG_LONG_DTYPE core.stdc.config.c_long
#define SWIG_ULONG_DTYPE core.stdc.config.c_ulong
-#endif
/*
* The SWIG_D_PRIMITIVE macro is used to define the typemaps for the primitive
@@ -150,6 +143,12 @@ SWIG_D_PRIMITIVE(double, double)
const unsigned long &
""
+// Default assumes size_t is 32-bit for overloading
+%typecheck(SWIG_TYPECHECK_UINT32)
+ size_t,
+ const size_t &
+ ""
+
%typecheck(SWIG_TYPECHECK_INT64)
long long,
const long long &
diff --git a/linux-x86/share/swig/d/dstrings.swg b/linux-x86/share/swig/d/dstrings.swg
index 02895c1..0b875b5 100644
--- a/linux-x86/share/swig/d/dstrings.swg
+++ b/linux-x86/share/swig/d/dstrings.swg
@@ -64,17 +64,10 @@
// We need to have the \0-terminated string conversion functions available in
// the D proxy modules.
-#if (SWIG_D_VERSION == 1)
-// Could be easily extended to support Phobos as well.
-SWIGD_STRING_TYPEMAPS(char*, char[], tango.stdc.stringz.fromStringz, tango.stdc.stringz.toStringz)
-
-%pragma(d) globalproxyimports = "static import tango.stdc.stringz;";
-#else
SWIGD_STRING_TYPEMAPS(const(char)*, string, std.conv.to!string, std.string.toStringz)
%pragma(d) globalproxyimports = %{
static import std.conv;
static import std.string;
%}
-#endif
#undef SWIGD_STRING_TYPEMAPS
diff --git a/linux-x86/share/swig/d/dswigtype.swg b/linux-x86/share/swig/d/dswigtype.swg
index f0d604b..81a7d83 100644
--- a/linux-x86/share/swig/d/dswigtype.swg
+++ b/linux-x86/share/swig/d/dswigtype.swg
@@ -20,6 +20,10 @@
%typemap(imtype) SWIGTYPE & "void*"
%typemap(dtype, nativepointer="$dtype") SWIGTYPE & "$dclassname"
+%typemap(ctype) SWIGTYPE && "void *"
+%typemap(imtype) SWIGTYPE && "void*"
+%typemap(dtype, nativepointer="$dtype") SWIGTYPE && "$dclassname"
+
%typemap(ctype) SWIGTYPE *const& "void *"
%typemap(imtype) SWIGTYPE *const& "void*"
%typemap(dtype) SWIGTYPE *const& "$*dclassname"
@@ -28,6 +32,7 @@
SWIGTYPE,
SWIGTYPE *,
SWIGTYPE &,
+ SWIGTYPE &&,
SWIGTYPE [],
SWIGTYPE *const&
""
@@ -47,7 +52,7 @@
%typemap(out) SWIGTYPE
#ifdef __cplusplus
-%{ $result = new $1_ltype((const $1_ltype &)$1); %}
+%{ $result = new $1_ltype($1); %}
#else
{
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
@@ -57,7 +62,7 @@
#endif
%typemap(directorin) SWIGTYPE
- "$input = (void *)new $1_ltype((const $1_ltype &)$1);"
+ "$input = (void *)new $1_ltype(SWIG_STD_MOVE($1));"
%typemap(directorout) SWIGTYPE
%{ if (!$input) {
SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Unexpected null return for type $1_type");
@@ -117,7 +122,7 @@
%typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input;
if (!$1) {
- SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type type is null");
+ SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type is null");
return $null;
} %}
%typemap(out) SWIGTYPE & "$result = (void *)$1;"
@@ -149,6 +154,44 @@
/*
+ * Rvalue reference conversion typemaps.
+ */
+
+%typemap(in, canthrow=1, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input;
+ if (!$1) {
+ SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type is null");
+ return $null;
+ }
+ rvrdeleter.reset($1); %}
+%typemap(out) SWIGTYPE && "$result = (void *)$1;"
+
+%typemap(directorin) SWIGTYPE &&
+ "$input = ($1_ltype) &$1;"
+%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &&
+%{ if (!$input) {
+ SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Unexpected null return for type $1_type");
+ return $null;
+ }
+ $result = ($1_ltype)$input; %}
+
+%typemap(ddirectorin,
+ nativepointer="cast($dtype)$winput"
+) SWIGTYPE && "new $dclassname($winput, false)"
+%typemap(ddirectorout,
+ nativepointer="cast(void*)$dcall"
+) SWIGTYPE && "$dclassname.swigGetCPtr($dcall)"
+
+%typemap(din,
+ nativepointer="cast(void*)$dinput"
+) SWIGTYPE && "$dclassname.swigRelease($dinput)"
+%typemap(dout, excode=SWIGEXCODE,
+ nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}") SWIGTYPE && {
+ $dclassname ret = new $dclassname($imcall, $owner);$excode
+ return ret;
+}
+
+
+/*
* Array conversion typemaps.
*/
@@ -164,6 +207,7 @@
// Treat references to arrays like references to a single element.
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
+%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
/*
@@ -195,3 +239,46 @@
nativepointer="cast(void*)$dcall"
) SWIGTYPE *const& "$*dclassname.swigGetCPtr($dcall)"
+/*
+ * D String & D array represent in C
+ */
+
+%insert(runtime) %{
+#include <stddef.h>
+typedef struct { size_t len; char *str;} SWIG_c_dstring;
+typedef struct { size_t len; SWIG_c_dstring *array; } SWIG_c_dstring_array;
+%}
+
+/*
+ * String & length
+ */
+%typemap(imtype) (const char *STRING, size_t LENGTH) "string"
+%typemap(dtype) (const char *STRING, size_t LENGTH) "string"
+%typemap(ctype,default="={0,0}") (const char *STRING, size_t LENGTH) "SWIG_c_dstring"
+%typemap(din, nativepointer="std.conv.to!string($dinput)") (const char *STRING, size_t LENGTH) "$dinput"
+%typemap(freearg) (const char *STRING, size_t LENGTH) ""
+%typemap(in, canthrow=1) (const char *STRING, size_t LENGTH) %{
+ $1 = ($1_ltype)$input.str;
+ $2 = ($2_ltype)$input.len;
+%}
+%typemap(argout) (const char *STRING, size_t LENGTH) {
+ $input.str = (char *)$1;
+ $input.len = (size_t)$2;
+}
+%typemap(directorin) (const char *STRING, size_t LENGTH) {
+ $input.str = (char *)$1;
+ $input.len = (size_t)$2;
+}
+%typemap(ddirectorin) (const char *STRING, size_t LENGTH) "std.conv.to!string($winput)"
+%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) {
+ $input.str = (char *)$1;
+ $input.len = (size_t)$2;
+}
+%typemap(directorargout) (char *STRING, size_t LENGTH)
+{
+ $1 = ($1_ltype)$input.str;
+ $2 = ($2_ltype)$input.len;
+}
+%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) }
diff --git a/linux-x86/share/swig/d/std_auto_ptr.i b/linux-x86/share/swig/d/std_auto_ptr.i
new file mode 100644
index 0000000..500b611
--- /dev/null
+++ b/linux-x86/share/swig/d/std_auto_ptr.i
@@ -0,0 +1,42 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap (ctype) std::auto_ptr< TYPE > "void *"
+%typemap (imtype) std::auto_ptr< TYPE > "void*"
+%typemap (dtype) std::auto_ptr< TYPE > "$typemap(dtype, TYPE)"
+
+%typemap(in) std::auto_ptr< TYPE >
+%{ $1.reset((TYPE *)$input); %}
+
+%typemap(din,
+ nativepointer="cast(void*)$dinput"
+) std::auto_ptr< TYPE > "$typemap(dtype, TYPE).swigRelease($dinput)"
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ $result = (void *)$1.release();
+%}
+
+%typemap(dout, excode=SWIGEXCODE,
+ nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}"
+) std::auto_ptr< TYPE > {
+ void* cPtr = $imcall;
+ $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
+ return ret;
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > ""
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/d/std_map.i b/linux-x86/share/swig/d/std_map.i
index c5e03d0..a374f55 100644
--- a/linux-x86/share/swig/d/std_map.i
+++ b/linux-x86/share/swig/d/std_map.i
@@ -44,7 +44,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
diff --git a/linux-x86/share/swig/d/std_string.i b/linux-x86/share/swig/d/std_string.i
index 8d75d23..fbee057 100644
--- a/linux-x86/share/swig/d/std_string.i
+++ b/linux-x86/share/swig/d/std_string.i
@@ -79,19 +79,12 @@ class string;
// We need to have the \0-terminated string conversion functions available in
// the D proxy modules.
-#if (SWIG_D_VERSION == 1)
-// Could be easily extended to support Phobos as well.
-SWIGD_STD_STRING_TYPEMAPS(char*, char[], tango.stdc.stringz.fromStringz, tango.stdc.stringz.toStringz)
-
-%pragma(d) globalproxyimports = "static import tango.stdc.stringz;";
-#else
SWIGD_STD_STRING_TYPEMAPS(const(char)*, string, std.conv.to!string, std.string.toStringz)
%pragma(d) globalproxyimports = %{
static import std.conv;
static import std.string;
%}
-#endif
#undef SWIGD_STD_STRING_TYPEMAPS
diff --git a/linux-x86/share/swig/d/std_unique_ptr.i b/linux-x86/share/swig/d/std_unique_ptr.i
new file mode 100644
index 0000000..9317a7e
--- /dev/null
+++ b/linux-x86/share/swig/d/std_unique_ptr.i
@@ -0,0 +1,42 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap (ctype) std::unique_ptr< TYPE > "void *"
+%typemap (imtype) std::unique_ptr< TYPE > "void*"
+%typemap (dtype) std::unique_ptr< TYPE > "$typemap(dtype, TYPE)"
+
+%typemap(in) std::unique_ptr< TYPE >
+%{ $1.reset((TYPE *)$input); %}
+
+%typemap(din,
+ nativepointer="cast(void*)$dinput"
+) std::unique_ptr< TYPE > "$typemap(dtype, TYPE).swigRelease($dinput)"
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ $result = (void *)$1.release();
+%}
+
+%typemap(dout, excode=SWIGEXCODE,
+ nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}"
+) std::unique_ptr< TYPE > {
+ void* cPtr = $imcall;
+ $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
+ return ret;
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > ""
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/d/std_vector.i b/linux-x86/share/swig/d/std_vector.i
index fb8f7d2..8c67402 100644
--- a/linux-x86/share/swig/d/std_vector.i
+++ b/linux-x86/share/swig/d/std_vector.i
@@ -22,169 +22,6 @@
// MACRO for use within the std::vector class body
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CONST_REFERENCE, CTYPE...)
-#if (SWIG_D_VERSION == 1)
-%typemap(dimports) std::vector< CTYPE > "static import tango.core.Exception;"
-%proxycode %{
-public this($typemap(dtype, CTYPE)[] values) {
- this();
- append(values);
-}
-
-alias push_back add;
-alias push_back push;
-alias push_back opCatAssign;
-alias size length;
-alias opSlice slice;
-
-public $typemap(dtype, CTYPE) opIndexAssign($typemap(dtype, CTYPE) value, size_t index) {
- if (index >= size()) {
- throw new tango.core.Exception.NoSuchElementException("Tried to assign to element out of vector bounds.");
- }
- setElement(index, value);
- return value;
-}
-
-public $typemap(dtype, CTYPE) opIndex(size_t index) {
- if (index >= size()) {
- throw new tango.core.Exception.NoSuchElementException("Tried to read from element out of vector bounds.");
- }
- return getElement(index);
-}
-
-public void append($typemap(dtype, CTYPE)[] value...) {
- foreach (v; value) {
- add(v);
- }
-}
-
-public $typemap(dtype, CTYPE)[] opSlice() {
- $typemap(dtype, CTYPE)[] array = new $typemap(dtype, CTYPE)[size()];
- foreach (i, ref value; array) {
- value = getElement(i);
- }
- return array;
-}
-
-public int opApply(int delegate(ref $typemap(dtype, CTYPE) value) dg) {
- int result;
-
- size_t currentSize = size();
- for (size_t i = 0; i < currentSize; ++i) {
- auto value = getElement(i);
- result = dg(value);
- setElement(i, value);
- }
- return result;
-}
-
-public int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg) {
- int result;
-
- size_t currentSize = size();
- for (size_t i = 0; i < currentSize; ++i) {
- auto value = getElement(i);
-
- // Workaround for http://d.puremagic.com/issues/show_bug.cgi?id=2443.
- auto index = i;
-
- result = dg(index, value);
- setElement(i, value);
- }
- return result;
-}
-
-public void capacity(size_t value) {
- if (value < size()) {
- throw new tango.core.Exception.IllegalArgumentException("Tried to make the capacity of a vector smaller than its size.");
- }
-
- reserve(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;
- pv = new std::vector< CTYPE >();
-
- // Might throw std::length_error.
- pv->reserve(capacity);
-
- return pv;
- }
-
- size_type unused() const {
- return $self->capacity() - $self->size();
- }
-
- const_reference remove() throw (std::out_of_range) {
- if ($self->empty()) {
- throw std::out_of_range("Tried to remove last element from empty vector.");
- }
-
- std::vector< CTYPE >::const_reference value = $self->back();
- $self->pop_back();
- return value;
- }
-
- 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.");
- }
-
- std::vector< CTYPE >::iterator it = $self->begin() + index;
- std::vector< CTYPE >::const_reference value = *it;
- $self->erase(it);
- return 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) {
- if ((index < 0) || ($self->size() <= index)) {
- throw std::out_of_range("Tried to get value of element with invalid index.");
- }
- return (*$self)[index];
- }
- }
-
- // Use CTYPE const& instead of const_reference to work around SWIG code
- // generation issue when using const pointers as vector elements (like
- // std::vector< const int* >).
- %extend {
- void setElement(size_type index, CTYPE const& val) throw (std::out_of_range) {
- if ((index < 0) || ($self->size() <= index)) {
- throw std::out_of_range("Tried to set value of element with invalid index.");
- }
- (*$self)[index] = val;
- }
- }
-
-%dmethodmodifiers std::vector::getElement "private"
-%dmethodmodifiers std::vector::setElement "private"
-%dmethodmodifiers std::vector::reserve "private"
-
-#else
%typemap(dimports) std::vector< CTYPE > %{
static import std.algorithm;
@@ -541,7 +378,6 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
%dmethodmodifiers std::vector::getElement "private"
%dmethodmodifiers std::vector::setElement "private"
-#endif
%enddef
// Extra methods added to the collection class if operator== is defined for the class being wrapped
diff --git a/linux-x86/share/swig/d/swigmove.i b/linux-x86/share/swig/d/swigmove.i
new file mode 100644
index 0000000..e2eb834
--- /dev/null
+++ b/linux-x86/share/swig/d/swigmove.i
@@ -0,0 +1,16 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, canthrow=1) SWIGTYPE MOVE ($&1_type argp)
+%{ argp = ($&1_ltype)$input;
+ if (!argp) {
+ SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type");
+ return $null;
+ }
+ SwigValueWrapper< $1_ltype >::reset($1, argp); %}
+
+%typemap(din) SWIGTYPE MOVE "$dclassname.swigRelease($dinput)"
diff --git a/linux-x86/share/swig/d/wrapperloader.swg b/linux-x86/share/swig/d/wrapperloader.swg
index b3c1d0d..f0f1d1b 100644
--- a/linux-x86/share/swig/d/wrapperloader.swg
+++ b/linux-x86/share/swig/d/wrapperloader.swg
@@ -40,9 +40,10 @@ private {
} else {
version(D_Version2) {
static import std.conv;
+ } else {
+ static import std.c.string;
}
static import std.string;
- static import std.c.string;
}
version(D_Version2) {
@@ -112,7 +113,7 @@ private {
version(Tango) {
import tango.sys.Common;
} else version(linux) {
- import std.c.linux.linux;
+ import core.sys.posix.dlfcn;
} else {
extern(C) {
const RTLD_NOW = 2;
@@ -281,27 +282,19 @@ static this() {
"))library.loadSymbol(`" ~ symbol ~ "`);";
}
- //#if !defined(SWIG_D_NO_EXCEPTION_HELPER)
mixin(bindCode("swigRegisterExceptionCallbacks$module", "SWIGRegisterExceptionCallbacks_$module"));
- //#endif // SWIG_D_NO_EXCEPTION_HELPER
- //#if !defined(SWIG_D_NO_STRING_HELPER)
mixin(bindCode("swigRegisterStringCallback$module", "SWIGRegisterStringCallback_$module"));
- //#endif // SWIG_D_NO_STRING_HELPER
$wrapperloaderbindcode
}
-//#if !defined(SWIG_D_NO_EXCEPTION_HELPER)
extern(C) void function(
SwigExceptionCallback exceptionCallback,
SwigExceptionCallback illegalArgumentCallback,
SwigExceptionCallback illegalElementCallback,
SwigExceptionCallback ioCallback,
SwigExceptionCallback noSuchElementCallback) swigRegisterExceptionCallbacks$module;
-//#endif // SWIG_D_NO_EXCEPTION_HELPER
-//#if !defined(SWIG_D_NO_STRING_HELPER)
extern(C) void function(SwigStringCallback callback) swigRegisterStringCallback$module;
-//#endif // SWIG_D_NO_STRING_HELPER
%}
%pragma(d) wrapperloaderbindcommand = %{
diff --git a/linux-x86/share/swig/exception.i b/linux-x86/share/swig/exception.i
index ee9ce9b..1c00fb3 100644
--- a/linux-x86/share/swig/exception.i
+++ b/linux-x86/share/swig/exception.i
@@ -12,10 +12,15 @@
%insert("runtime") "swigerrors.swg"
-#ifdef SWIGPHP7
+#ifdef SWIGPHP
%{
-#include "zend_exceptions.h"
-#define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code); goto thrown; } while (0)
+#define SWIG_exception(code, msg) do { zend_throw_exception( \
+ code == SWIG_TypeError ? zend_ce_type_error : \
+ code == SWIG_ValueError ? zend_ce_value_error : \
+ code == SWIG_DivisionByZero ? zend_ce_division_by_zero_error : \
+ code == SWIG_SyntaxError ? zend_ce_parse_error : \
+ code == SWIG_OverflowError ? zend_ce_arithmetic_error : \
+ NULL, msg, code); SWIG_fail; } while (0)
%}
#endif
@@ -24,9 +29,8 @@
SWIGINTERN void SWIG_exception_ (int code, const char *msg,
const char *subr) {
#define ERROR(scmerr) \
- scm_error(scm_from_locale_string((char *) (scmerr)), \
- (char *) subr, (char *) msg, \
- SCM_EOL, SCM_BOOL_F)
+ scm_error(scm_from_locale_string(scmerr), \
+ subr, msg, SCM_EOL, SCM_BOOL_F)
#define MAP(swigerr, scmerr) \
case swigerr: \
ERROR(scmerr); \
diff --git a/linux-x86/share/swig/go/argcargv.i b/linux-x86/share/swig/go/argcargv.i
new file mode 100644
index 0000000..f2dee2b
--- /dev/null
+++ b/linux-x86/share/swig/go/argcargv.i
@@ -0,0 +1,62 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(gotype) (int ARGC, char **ARGV) "[]string"
+
+%insert(go_wrapper) %{
+//export cgo_swig_get_string_slice_idx
+func cgo_swig_get_string_slice_idx(s []string, i C.swig_intgo) string {
+ return s[i]
+}
+%}
+
+%{
+extern
+#ifdef __cplusplus
+ "C"
+#endif
+_gostring_ cgo_swig_get_string_slice_idx(_goslice_ s, intgo i);
+%}
+
+%typemap(in) (int ARGC, char **ARGV) {
+ $1_ltype len = ($1_ltype)$input.len;
+ size_t aralloc = (size_t)((len + 1) * sizeof(char *));
+ if (len < 0) {
+ _swig_gopanic("negative array length");
+ }
+ $2 = ($2_ltype) Swig_malloc((int)aralloc);
+ if ($2 == NULL) {
+ _swig_gopanic("fail allocating memory for array");
+ }
+ memset($2, 0, aralloc);
+ $1 = len;
+ {
+ $1_ltype i;
+ for (i = 0; i < len; i++) {
+ char *p;
+ _gostring_ st = cgo_swig_get_string_slice_idx($input, (intgo)i);
+ if (st.n < 0) {
+ _swig_gopanic("string length negative");
+ }
+ p = (char *) Swig_malloc((int)(st.n + 1));
+ if (p == NULL) {
+ _swig_gopanic("fail allocating memory for a string");
+ }
+ memcpy(p, st.p, st.n);
+ p[st.n] = 0;
+ $2[i] = p;
+ }
+ $2[i] = NULL;
+ }
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ if ($2 != NULL) {
+ $1_ltype i;
+ for (i = 0; i < $1; i++) {
+ Swig_free((void *)$2[i]);
+ }
+ Swig_free((void *)$2);
+ }
+}
diff --git a/linux-x86/share/swig/go/go.swg b/linux-x86/share/swig/go/go.swg
index c225ed9..348ae5f 100644
--- a/linux-x86/share/swig/go/go.swg
+++ b/linux-x86/share/swig/go/go.swg
@@ -388,8 +388,9 @@
%typemap(gotype) SWIGTYPE &&
%{$gotypename%}
-%typemap(in) SWIGTYPE &&
-%{ $1 = *($&1_ltype)&$input; %}
+%typemap(in, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter)
+%{ $1 = *($&1_ltype)&$input;
+rvrdeleter.reset($1); %}
%typemap(out) SWIGTYPE &&
%{ *($&1_ltype)&$result = $1; %}
@@ -453,9 +454,12 @@
%}
%typemap(freearg)
- char *, char *&, char[ANY], char[]
+ char *, char[ANY], char[]
%{ free($1); %}
+%typemap(freearg) char *&
+%{ free(temp$argnum); %}
+
%typemap(out,fragment="AllocateString")
char *, char *&, char[ANY], char[]
%{ $result = Swig_AllocateString((char*)$1, $1 ? strlen((char*)$1) : 0); %}
@@ -520,6 +524,44 @@
$2 = ($2_ltype)$input.n;
%}
+/* The int & type needs to convert to intgo. */
+
+%typemap(gotype) int & "*int"
+
+%typemap(in) int & (int e)
+%{
+ e = (int)*$input;
+ $1 = &e;
+%}
+
+%typemap(out) int &
+%{ $result = new intgo(*$1); %}
+
+%typemap(argout) int &
+%{ *$input = (intgo)e$argnum; %}
+
+%typemap(goout) int & ""
+
+%typemap(directorin) int & (intgo e)
+%{
+ e = (intgo)$1;
+ $input = &e;
+%}
+
+%typemap(godirectorin) int & ""
+
+%typemap(directorout) int &
+%{
+ $*1_ltype f = ($*1_ltype)*$input;
+ $result = ($1_ltype)&f;
+%}
+
+%typemap(directorargout) int &
+%{ $1 = (int)*$input; %}
+
+%typemap(argout) const int & ""
+%typemap(directorargout) const int & ""
+
/* Enums. We can't do the right thing for enums in typemap(gotype) so
we deliberately don't define them. The right thing would be to
capitalize the name. This is instead done in go.cxx. */
@@ -552,10 +594,7 @@
%typemap(godirectorin) enum SWIGTYPE & ""
%typemap(directorout) enum SWIGTYPE &
-%{
- $*1_ltype f = ($*1_ltype)*$input;
- $result = ($1_ltype)&f;
-%}
+%{ $result = $input; %}
/* Arbitrary type. This is a type passed by value in the C/C++ code.
We convert it to a pointer for the Go code. Note that all basic
@@ -587,7 +626,7 @@
%typemap(goout) SWIGTYPE ""
%typemap(directorin) SWIGTYPE
-%{ $input = new $1_ltype((const $1_ltype &)$1); %}
+%{ $input = new $1_ltype(SWIG_STD_MOVE($1)); %}
%typemap(godirectorin) SWIGTYPE ""
diff --git a/linux-x86/share/swig/go/gokw.swg b/linux-x86/share/swig/go/gokw.swg
index dd9f35a..3542830 100644
--- a/linux-x86/share/swig/go/gokw.swg
+++ b/linux-x86/share/swig/go/gokw.swg
@@ -1,6 +1,6 @@
/* Rename keywords. */
-#define GOKW(x) %keywordwarn("'" `x` "' is a Go keyword, renaming to 'X"`x`"'",rename="X%s") `x`
+#define GOKW(x) %keywordwarn("'" `x` "' is a Go keyword",rename="X%s") `x`
#define GOBN(x) %builtinwarn("'" `x` "' conflicts with a built-in name in Go") "::"`x`
GOKW(break);
diff --git a/linux-x86/share/swig/go/goruntime.swg b/linux-x86/share/swig/go/goruntime.swg
index 269a4ee..7bf083b 100644
--- a/linux-x86/share/swig/go/goruntime.swg
+++ b/linux-x86/share/swig/go/goruntime.swg
@@ -23,46 +23,39 @@ static void* Swig_malloc(int c) {
%}
-#if SWIGGO_CGO
%insert(cgo_comment_typedefs) %{
+#include <stddef.h>
#include <stdint.h>
%}
-#endif
#if SWIGGO_INTGO_SIZE == 32
%insert(runtime) %{
typedef int intgo;
typedef unsigned int uintgo;
%}
-#if SWIGGO_CGO
%insert(cgo_comment_typedefs) %{
typedef int intgo;
typedef unsigned int uintgo;
%}
-#endif
#elif SWIGGO_INTGO_SIZE == 64
%insert(runtime) %{
typedef long long intgo;
typedef unsigned long long uintgo;
%}
-#if SWIGGO_CGO
%insert(cgo_comment_typedefs) %{
typedef long long intgo;
typedef unsigned long long uintgo;
%}
-#endif
#else
%insert(runtime) %{
typedef ptrdiff_t intgo;
typedef size_t uintgo;
%}
-#if SWIGGO_CGO
%insert(cgo_comment_typedefs) %{
typedef ptrdiff_t intgo;
typedef size_t uintgo;
%}
#endif
-#endif
#ifndef SWIGGO_GCCGO
// Set the host compiler struct attribute that will be
@@ -89,8 +82,6 @@ typedef struct { void* array; intgo len; intgo cap; } _goslice_;
%}
-#ifdef SWIGGO_CGO
-
%insert(cgo_comment_typedefs) %{
typedef struct { char *p; intgo n; } _gostring_;
@@ -98,91 +89,7 @@ typedef struct { void* array; intgo len; intgo cap; } _goslice_;
%}
-#endif
-
-#ifndef SWIGGO_GCCGO
-/* Boilerplate for C/C++ code when using 6g/8g. This code is compiled
- with gcc. */
-%insert(runtime) %{
-
-#define swiggo_size_assert_eq(x, y, name) typedef char name[(x-y)*(x-y)*-2+1];
-#define swiggo_size_assert(t, n) swiggo_size_assert_eq(sizeof(t), n, swiggo_sizeof_##t##_is_not_##n)
-
-swiggo_size_assert(char, 1)
-swiggo_size_assert(short, 2)
-swiggo_size_assert(int, 4)
-typedef long long swiggo_long_long;
-swiggo_size_assert(swiggo_long_long, 8)
-swiggo_size_assert(float, 4)
-swiggo_size_assert(double, 8)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern void crosscall2(void (*fn)(void *, int), void *, int);
-extern char* _cgo_topofstack(void) __attribute__ ((weak));
-extern void _cgo_allocate(void *, int);
-extern void _cgo_panic(void *, int);
-#ifdef __cplusplus
-}
-#endif
-
-static char *_swig_topofstack() {
- if (_cgo_topofstack) {
- return _cgo_topofstack();
- } else {
- return 0;
- }
-}
-
-static void _swig_gopanic(const char *p) {
- struct {
- const char *p;
- } SWIGSTRUCTPACKED a;
- a.p = p;
- crosscall2(_cgo_panic, &a, (int) sizeof a);
-}
-
-%}
-
-#if !SWIGGO_CGO
-
-/* This is here for backward compatibility, but it will not work
- with Go 1.5 or later. Do not use it in new code. */
-%insert(runtime) %{
-
-static void *_swig_goallocate(size_t len) {
- struct {
- size_t len;
- void *ret;
- } SWIGSTRUCTPACKED a;
- a.len = len;
- crosscall2(_cgo_allocate, &a, (int) sizeof a);
- return a.ret;
-}
-
-%}
-
-#endif
-
-#if !SWIGGO_CGO
-
-/* Boilerplate for C code when using 6g/8g. This code is compiled
- with 6c/8c. */
-%insert(gc_header) %{
-#include "runtime.h"
-#include "cgocall.h"
-
-#pragma dataflag 16
-static void *cgocall = runtime·cgocall;
-#pragma dataflag 16
-void *·_cgo_runtime_cgocall = &cgocall;
-
-%}
-
-#endif
-
-#else
+#ifdef SWIGGO_GCCGO
/* Boilerplate for C/C++ code when using gccgo. */
%insert(runtime) %{
@@ -201,115 +108,12 @@ extern void _cgo_panic(const char *);
#define _swig_gopanic _cgo_panic
%}
-#if !SWIGGO_CGO
-
-%insert(runtime) %{
-
-/* Implementations of SwigCgocall and friends for different versions
- of gccgo. The Go code will call these functions using C names with
- a prefix of the module name. The implementations here call the
- routine in libgo. The routines to call vary depending on the gccgo
- version. We assume that the version of gcc used to compile this
- file is the same as the version of gccgo. */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SWIG_GCC_VERSION \
- (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-
-#if SWIG_GCC_VERSION < 40700
-#define SwigDoCgocall()
-#define SwigDoCgocallDone()
-#define SwigDoCgocallBack()
-#define SwigDoCgocallBackDone()
-#elif SWIG_GCC_VERSION == 40700
-void SwigDoCgocall(void) __asm__("libgo_syscall.syscall.Entersyscall");
-void SwigDoCgocallDone(void) __asm__("libgo_syscall.syscall.Exitsyscall");
-void SwigDoCgocallBack(void) __asm__("libgo_syscall.syscall.Exitsyscall");
-void SwigDoCgocallBackDone(void) __asm__("libgo_syscall.syscall.Entersyscall");
-#else
-void SwigDoCgocall(void) __asm__("syscall.Cgocall");
-void SwigDoCgocallDone(void) __asm__("syscall.CgocallDone");
-void SwigDoCgocallBack(void) __asm__("syscall.CgocallBack");
-void SwigDoCgocallBackDone(void) __asm__("syscall.CgocallBackDone");
-#endif
-
-#define SWIGSTRINGIFY2(s) #s
-#define SWIGSTRINGIFY(s) SWIGSTRINGIFY2(s)
-
-void SwigCgocall()
- __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocall");
-void SwigCgocall() {
- SwigDoCgocall();
-}
-
-void SwigCgocallDone()
- __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallDone");
-void SwigCgocallDone() {
- SwigDoCgocallDone();
-}
-
-void SwigCgocallBack()
- __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallBack");
-void SwigCgocallBack() {
- SwigDoCgocallBack();
-}
-
-void SwigCgocallBackDone()
- __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallBackDone");
-void SwigCgocallBackDone() {
- SwigDoCgocallBackDone();
-}
-
-#undef SWIGSTRINGIFY
-#undef SWIGSTRINGIFY2
-
-#ifdef __cplusplus
-}
-#endif
-
-%}
-
-#endif
-
#endif
-#if !SWIGGO_CGO
-
-%insert(runtime) %{
-
-/* This is here for backward compatibility, but it will not work
- with Go 1.5 or later. Do not use it in new code. */
-static _gostring_ _swig_makegostring(const char *p, size_t l) {
- _gostring_ ret;
- ret.p = (char*)_swig_goallocate(l + 1);
- memcpy(ret.p, p, l);
- ret.n = l;
- return ret;
-}
-
-%}
-
-#endif
-
-%insert(runtime) %{
-
-#define SWIG_contract_assert(expr, msg) \
- if (!(expr)) { _swig_gopanic(msg); } else
-%}
-
#ifndef SWIGGO_GCCGO
%go_import("unsafe", _ "runtime/cgo")
-#if !SWIGGO_CGO
-%insert(go_header) %{
-var _cgo_runtime_cgocall func(unsafe.Pointer, uintptr)
-%}
-#endif
-
#else
%go_import("syscall", "unsafe")
@@ -346,6 +150,17 @@ type _swig_fnptr *byte
type _swig_memberptr *byte
%}
+/* Convert a Go interface value into a C++ pointer. */
+
+%insert(go_header) %{
+func getSwigcptr(v interface { Swigcptr() uintptr }) uintptr {
+ if v == nil {
+ return 0
+ }
+ return v.Swigcptr()
+}
+%}
+
/* 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/linux-x86/share/swig/go/std_array.i b/linux-x86/share/swig/go/std_array.i
new file mode 100644
index 0000000..36c790e
--- /dev/null
+++ b/linux-x86/share/swig/go/std_array.i
@@ -0,0 +1,43 @@
+/* -----------------------------------------------------------------------------
+ * std_array.i
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+namespace std {
+
+ template<class T, size_t N> class array {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ array();
+ array(const array& other);
+
+ size_type size() const;
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void fill(const T& u);
+ %extend {
+ const_reference get(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("array index out of range");
+ }
+ void set(int i, const value_type& val) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ (*self)[i] = val;
+ else
+ throw std::out_of_range("array index out of range");
+ }
+ }
+ };
+}
diff --git a/linux-x86/share/swig/go/std_map.i b/linux-x86/share/swig/go/std_map.i
index 773b6d0..19281ad 100644
--- a/linux-x86/share/swig/go/std_map.i
+++ b/linux-x86/share/swig/go/std_map.i
@@ -48,7 +48,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
diff --git a/linux-x86/share/swig/go/std_string.i b/linux-x86/share/swig/go/std_string.i
index 099ae84..35b4a5e 100644
--- a/linux-x86/share/swig/go/std_string.i
+++ b/linux-x86/share/swig/go/std_string.i
@@ -52,6 +52,9 @@ class string;
%typemap(godirectorin,fragment="CopyString") string
%{ $result = swigCopyString($input) %}
+%typemap(throws) string
+%{ _swig_gopanic($1.c_str()); %}
+
%typemap(in) const string &
%{
$*1_ltype $1_str($input.p, $input.n);
@@ -88,4 +91,72 @@ class string;
%typemap(godirectorin,fragment="CopyString") const string &
%{ $result = swigCopyString($input) %}
+%typemap(throws) const string &
+%{ _swig_gopanic($1.c_str()); %}
+
+
+%typemap(gotype) string * "*string"
+
+%typemap(in) string * (string temp)
+%{
+ if ($input) {
+ temp.assign($input->p, $input->n);
+ $1 = &temp;
+ } else
+ $1 = 0;
+%}
+
+%typemap(godirectorout) string *
+%{
+ if $input != nil {
+ p := Swig_malloc(len(*$input))
+ s := (*[1<<30]byte)(unsafe.Pointer(p))[:len(*$input)]
+ copy(s, *$input)
+ $result = (*string)(unsafe.Pointer(&s))
+ } else {
+ $result = nil
+ }
+%}
+
+%typemap(directorout) string * (string temp)
+%{
+ temp.assign($input->p, $input->n);
+ $result = &temp;
+ free($input.p);
+%}
+
+%typemap(out,fragment="AllocateString") string * (_gostring_ temp)
+%{
+ temp = Swig_AllocateString($1->data(), $1->length());
+ $result = &temp;
+%}
+
+%typemap(goout,fragment="CopyString") string *
+%{ *$result = swigCopyString(*$1) %}
+
+%typemap(directorin,fragment="AllocateString") string * (_gostring_ temp)
+%{
+ if ($1) {
+ temp = Swig_AllocateString($1->data(), $1->length());
+ $input = &temp;
+ } else
+ $input = 0;
+%}
+
+%typemap(godirectorin,fragment="CopyString") string *
+%{ *$result = swigCopyString(*$input); %}
+
+%typemap(argout,fragment="AllocateString") string *
+%{
+ if ($1)
+ *$input = Swig_AllocateString($1->data(), $1->length());
+%}
+
+%typemap(goargout,fragment="CopyString") string *
+%{
+ if $input != nil {
+ *$1 = swigCopyString(*$input)
+ }
+%}
+
}
diff --git a/linux-x86/share/swig/go/swigmove.i b/linux-x86/share/swig/go/swigmove.i
new file mode 100644
index 0000000..e1984b6
--- /dev/null
+++ b/linux-x86/share/swig/go/swigmove.i
@@ -0,0 +1,15 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in) SWIGTYPE MOVE ($&1_type argp)
+%{
+ argp = ($&1_ltype)$input;
+ if (argp == NULL) {
+ _swig_gopanic("Attempt to dereference null $1_type");
+ }
+ SwigValueWrapper< $1_ltype >::reset($1, argp);
+%}
diff --git a/linux-x86/share/swig/guile/argcargv.i b/linux-x86/share/swig/guile/argcargv.i
new file mode 100644
index 0000000..003be96
--- /dev/null
+++ b/linux-x86/share/swig/guile/argcargv.i
@@ -0,0 +1,44 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(in) (int ARGC, char **ARGV) {
+ $1_ltype i, len;
+ SWIG_contract_assert($input != (SCM)0 &&
+ !scm_is_null($input) &&
+ scm_is_array($input),
+ "you must pass array of strings");
+ len = scm_c_array_length($input);
+ $1 = len;
+ $2 = ($2_ltype) malloc((len+1)*sizeof($*2_ltype));
+ if ($2 == NULL) {
+ scm_misc_error(FUNC_NAME, "fail allocating memory for array", SCM_EOL);
+ }
+ for (i = 0; i < len; i++) {
+ SCM args = scm_list_1(scm_from_long(i));
+ SCM str = scm_array_ref($input, args);
+ SWIG_contract_assert(scm_is_string(str), "elements in array must be strings");
+ $2[i] = ($*2_ltype)SWIG_scm2str(str);
+ }
+ $2[i] = NULL;
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ if ($input != (SCM)0 && !scm_is_null($input) && scm_is_array($input)) {
+ size_t len = scm_c_array_length($input);
+ size_t i;
+ for(i = 0; i < len; i++) {
+ SCM args = scm_list_1(scm_from_long(i));
+ SCM str = scm_array_ref($input, args);
+ if (!scm_is_string(str)) {
+ break;
+ }
+ }
+ /* All elements are strings! */
+ $1 = (i == len);
+ }
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ free((void *)$2);
+}
diff --git a/linux-x86/share/swig/guile/guile_scm_run.swg b/linux-x86/share/swig/guile/guile_scm_run.swg
index 86e5c3b..89eda39 100644
--- a/linux-x86/share/swig/guile/guile_scm_run.swg
+++ b/linux-x86/share/swig/guile/guile_scm_run.swg
@@ -2,6 +2,12 @@
* guile_scm_run.swg
* ----------------------------------------------------------------------------- */
+#if __GNUC__ >= 10
+#if defined(__cplusplus)
+#pragma GCC diagnostic ignored "-Wvolatile" /* For 'volatile SCM *' in at least Guile 3.0 and earlier */
+#endif
+#endif
+
#include <libguile.h>
#include <stdio.h>
#include <string.h>
@@ -65,10 +71,11 @@ typedef struct swig_guile_clientdata {
#define SWIG_IsPointer(object) \
SWIG_Guile_IsPointer(object)
#define SWIG_contract_assert(expr, msg) \
- if (!(expr)) \
- scm_error(scm_from_locale_symbol("swig-contract-assertion-failed"), \
- (char *) FUNC_NAME, (char *) msg, \
- SCM_EOL, SCM_BOOL_F); else
+ do { \
+ if (!(expr)) \
+ scm_error(scm_from_locale_symbol("swig-contract-assertion-failed"), \
+ FUNC_NAME, msg, SCM_EOL, SCM_BOOL_F); \
+ } while (0)
/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty) \
@@ -110,6 +117,8 @@ static SCM swig_symbol = SCM_EOL;
( !scm_is_null(x) && SCM_INSTANCEP(x) && scm_is_true(scm_slot_exists_p(x, swig_symbol)) \
? scm_slot_ref(x, swig_symbol) : (x) )
+SWIGINTERN void SWIG_Guile_MarkPointerNoncollectable(SCM s);
+
SWIGINTERN SCM
SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner)
{
@@ -123,7 +132,7 @@ SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner)
else
SCM_NEWSMOB2(smob, swig_tag, ptr, (void *) type);
- if (!cdata || SCM_NULLP(cdata->goops_class) || swig_make_func == SCM_EOL ) {
+ if (!cdata || scm_is_null(cdata->goops_class) || swig_make_func == SCM_EOL ) {
return smob;
} else {
/* the scm_make() C function only handles the creation of gf,
@@ -143,7 +152,7 @@ SWIGINTERN unsigned long
SWIG_Guile_PointerAddress(SCM object)
{
SCM smob = SWIG_Guile_GetSmob(object);
- if (SCM_NULLP(smob)) return 0;
+ if (scm_is_null(smob)) return 0;
else if (SCM_SMOB_PREDICATE(swig_tag, smob)
|| SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
|| SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) {
@@ -156,7 +165,7 @@ SWIGINTERN swig_type_info *
SWIG_Guile_PointerType(SCM object)
{
SCM smob = SWIG_Guile_GetSmob(object);
- if (SCM_NULLP(smob)) return NULL;
+ if (scm_is_null(smob)) return NULL;
else if (SCM_SMOB_PREDICATE(swig_tag, smob)
|| SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
|| SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) {
@@ -183,8 +192,9 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
swig_cast_info *cast;
swig_type_info *from;
SCM smob = SWIG_Guile_GetSmob(s);
+ int ret = SWIG_ERROR;
- if (SCM_NULLP(smob)) {
+ if (scm_is_null(smob)) {
*result = NULL;
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
#if SCM_MAJOR_VERSION >= 2
@@ -195,22 +205,36 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
} else if (SWIG_Guile_IsValidSmob(smob)) {
from = (swig_type_info *) SCM_CELL_WORD_2(smob);
if (!from) return SWIG_ERROR;
+
+ if ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) {
+ if ((SCM_CELL_TYPE(smob) == swig_collectable_tag && SCM_CELL_WORD_1(smob) == 0) || SCM_CELL_TYPE(smob) == swig_tag) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ }
+ }
+
if (type) {
cast = SWIG_TypeCheckStruct(from, type);
if (cast) {
int newmemory = 0;
*result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob), &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
- return SWIG_OK;
+ ret = SWIG_OK;
} else {
return SWIG_ERROR;
}
} else {
*result = (void *) SCM_CELL_WORD_1(smob);
- return SWIG_OK;
+ ret = SWIG_OK;
+ }
+
+ if (flags & SWIG_POINTER_DISOWN) {
+ SWIG_Guile_MarkPointerNoncollectable(smob);
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ SCM_SET_CELL_WORD_1(smob, 0);
}
}
- return SWIG_ERROR;
+ return ret;
}
SWIGINTERNINLINE void *
@@ -221,7 +245,7 @@ SWIG_Guile_MustGetPtr (SCM s, swig_type_info *type,
int res = SWIG_Guile_ConvertPtr(s, &result, type, flags);
if (!SWIG_IsOK(res)) {
/* type mismatch */
- scm_wrong_type_arg((char *) func_name, argnum, s);
+ scm_wrong_type_arg(func_name, argnum, s);
}
return result;
}
@@ -250,7 +274,7 @@ SWIGINTERN void
SWIG_Guile_MarkPointerNoncollectable(SCM s)
{
SCM smob = SWIG_Guile_GetSmob(s);
- if (!SCM_NULLP(smob)) {
+ if (!scm_is_null(smob)) {
if (SWIG_Guile_IsValidSmob(smob)) {
SCM_SET_CELL_TYPE(smob, swig_tag);
}
@@ -263,7 +287,7 @@ SWIGINTERN void
SWIG_Guile_MarkPointerDestroyed(SCM s)
{
SCM smob = SWIG_Guile_GetSmob(s);
- if (!SCM_NULLP(smob)) {
+ if (!scm_is_null(smob)) {
if (SWIG_Guile_IsValidSmob(smob)) {
SCM_SET_CELL_TYPE(smob, swig_destroyed_tag);
}
@@ -315,13 +339,13 @@ print_swig_aux (SCM swig_smob, SCM port, scm_print_state *pstate,
type = (swig_type_info *) SCM_CELL_WORD_2(swig_smob);
if (type) {
- scm_puts((char *) "#<", port);
- scm_puts((char *) attribute, port);
- scm_puts((char *) "swig-pointer ", port);
- scm_puts((char *) SWIG_TypePrettyName(type), port);
- scm_puts((char *) " ", port);
+ scm_puts("#<", port);
+ scm_puts(attribute, port);
+ scm_puts("swig-pointer ", port);
+ scm_puts(SWIG_TypePrettyName(type), port);
+ scm_puts(" ", port);
scm_intprint((long) SCM_CELL_WORD_1(swig_smob), 16, port);
- scm_puts((char *) ">", port);
+ scm_puts(">", port);
/* non-zero means success */
return 1;
} else {
@@ -354,10 +378,10 @@ print_member_function_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
swig_type_info *type;
type = (swig_type_info *) SCM_CELL_WORD_2(swig_smob);
if (type) {
- scm_puts((char *) "#<", port);
- scm_puts((char *) "swig-member-function-pointer ", port);
- scm_puts((char *) SWIG_TypePrettyName(type), port);
- scm_puts((char *) " >", port);
+ scm_puts("#<", port);
+ scm_puts("swig-member-function-pointer ", port);
+ scm_puts(SWIG_TypePrettyName(type), port);
+ scm_puts(" >", port);
/* non-zero means success */
return 1;
} else {
@@ -401,7 +425,7 @@ ensure_smob_tag(SCM swig_module,
SCM variable = scm_module_variable(swig_module,
scm_from_locale_symbol(scheme_variable_name));
if (scm_is_false(variable)) {
- *tag_variable = scm_make_smob_type((char*)scheme_variable_name, 0);
+ *tag_variable = scm_make_smob_type(scheme_variable_name, 0);
scm_c_module_define(swig_module, scheme_variable_name,
scm_from_ulong(*tag_variable));
return 1;
@@ -446,7 +470,7 @@ SWIG_Guile_Init ()
}
swig_make_func = scm_permanent_object(
scm_variable_ref(scm_c_module_lookup(scm_c_resolve_module("oop goops"), "make")));
- swig_keyword = scm_permanent_object(scm_from_locale_keyword((char*) "init-smob"));
+ swig_keyword = scm_permanent_object(scm_from_locale_keyword("init-smob"));
swig_symbol = scm_permanent_object(scm_from_locale_symbol("swig-smob"));
#ifdef SWIG_INIT_RUNTIME_MODULE
SWIG_INIT_RUNTIME_MODULE
@@ -484,21 +508,21 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
int i;
int num_args_passed = 0;
for (i = 0; i<reqargs; i++) {
- if (!SCM_CONSP(rest))
- scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure"));
+ if (!scm_is_pair(rest))
+ scm_wrong_num_args(scm_from_utf8_string(procname ? procname : "unknown procedure"));
*dest++ = SCM_CAR(rest);
rest = SCM_CDR(rest);
num_args_passed++;
}
- for (i = 0; i<optargs && SCM_CONSP(rest); i++) {
+ for (i = 0; i<optargs && scm_is_pair(rest); i++) {
*dest++ = SCM_CAR(rest);
rest = SCM_CDR(rest);
num_args_passed++;
}
for (; i<optargs; i++)
*dest++ = SCM_UNDEFINED;
- if (!SCM_NULLP(rest))
- scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure"));
+ if (!scm_is_null(rest))
+ scm_wrong_num_args(scm_from_utf8_string(procname ? procname : "unknown procedure"));
return num_args_passed;
}
diff --git a/linux-x86/share/swig/guile/list-vector.i b/linux-x86/share/swig/guile/list-vector.i
index 057a1da..b6530d1 100644
--- a/linux-x86/share/swig/guile/list-vector.i
+++ b/linux-x86/share/swig/guile/list-vector.i
@@ -107,7 +107,7 @@
(size_t VECTORLENINPUT, C_TYPE *VECTORINPUT),
(int LISTLENINPUT, C_TYPE *LISTINPUT),
(size_t LISTLENINPUT, C_TYPE *LISTINPUT)
- {if ($2!=NULL) SWIG_free($2);}
+ {SWIG_free($2);}
%enddef
@@ -173,7 +173,7 @@
(int *LISTLENOUTPUT, C_TYPE **LISTOUTPUT),
(size_t *LISTLENOUTPUT, C_TYPE **LISTOUTPUT)
{
- if ((*$2)!=NULL) free(*$2);
+ free(*$2);
}
%enddef
@@ -231,7 +231,7 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02scm, stri
if ((*$2)!=NULL) {
int i;
for (i = 0; i < *$1; i++) {
- if ((*$2)[i] != NULL) free((*$2)[i]);
+ free((*$2)[i]);
}
free(*$2);
}
@@ -249,7 +249,7 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02scm, stri
if (($2)!=NULL) {
int i;
for (i = 0; i< $1; i++)
- if (($2)[i] != NULL) free(($2)[i]);
+ free(($2)[i]);
free($2);
}
}
@@ -283,8 +283,7 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02scm, stri
/* input */
/* Passing data is a little complicated here; just remember:
- IGNORE typemaps come first, then IN, then CHECK. But if
- IGNORE is given, IN won't be used for this type.
+ IN typemaps come first, then CHECK.
We need to "ignore" one of the parameters because there shall
be only one argument on the Scheme side. Here we only
@@ -360,7 +359,7 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02scm, stri
const C_TYPE *PARALLEL_VECTORINPUT,
C_TYPE *PARALLEL_LISTINPUT,
const C_TYPE *PARALLEL_LISTINPUT
- {if ($1!=NULL) SWIG_free($1);}
+ {SWIG_free($1);}
%enddef
@@ -422,7 +421,7 @@ TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02scm, stri
%typemap(freearg) C_TYPE **PARALLEL_VECTOROUTPUT,
C_TYPE **PARALLEL_LISTOUTPUT
{
- if ((*$1)!=NULL) free(*$1);
+ free(*$1);
}
%enddef
@@ -471,7 +470,7 @@ TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02
if (($1)!=NULL) {
int i;
for (i = 0; i<*_global_list_length; i++)
- if (($1)[i] != NULL) SWIG_free(($1)[i]);
+ SWIG_free(($1)[i]);
SWIG_free($1);
}
}
@@ -482,7 +481,7 @@ TYPEMAP_PARALLEL_LIST_VECTOR_INPUT_OUTPUT(const char *, SWIG_scm2str, SWIG_str02
if ((*$1)!=NULL) {
int i;
for (i = 0; i<_global_arraylentemp; i++)
- if ((*$1)[i] != NULL) free((*$1)[i]);
+ free((*$1)[i]);
free(*$1);
}
}
diff --git a/linux-x86/share/swig/guile/pointer-in-out.i b/linux-x86/share/swig/guile/pointer-in-out.i
index d8a631c..8010030 100644
--- a/linux-x86/share/swig/guile/pointer-in-out.i
+++ b/linux-x86/share/swig/guile/pointer-in-out.i
@@ -37,7 +37,6 @@
Likewise, but make the pointer object not garbage collectable.
- func(int **BOTH)
func(int **INOUT)
This annotation combines INPUT and OUTPUT.
@@ -82,8 +81,6 @@
%typemap(argout, doc="<" #SCM_TYPE ">") PTRTYPE *OUTPUT_NONCOLLECTABLE
"SWIG_APPEND_VALUE(SWIG_NewPointerObj(*$1, $*descriptor, 0));";
-%typemap(in) PTRTYPE *BOTH = PTRTYPE *INPUT;
-%typemap(argout) PTRTYPE *BOTH = PTRTYPE *OUTPUT;
%typemap(in) PTRTYPE *INOUT = PTRTYPE *INPUT;
%typemap(argout) PTRTYPE *INOUT = PTRTYPE *OUTPUT;
diff --git a/linux-x86/share/swig/guile/std_auto_ptr.i b/linux-x86/share/swig/guile/std_auto_ptr.i
new file mode 100644
index 0000000..59d5c0e
--- /dev/null
+++ b/linux-x86/share/swig/guile/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ scm_misc_error(FUNC_NAME, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'", SCM_EOL);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/guile/std_common.i b/linux-x86/share/swig/guile/std_common.i
index 5899c55..9797449 100644
--- a/linux-x86/share/swig/guile/std_common.i
+++ b/linux-x86/share/swig/guile/std_common.i
@@ -19,7 +19,7 @@ std::string SWIG_scm2string(SCM x) {
char* temp;
temp = SWIG_scm2str(x);
std::string s(temp);
- if (temp) SWIG_free(temp);
+ SWIG_free(temp);
return s;
}
%}
diff --git a/linux-x86/share/swig/guile/std_map.i b/linux-x86/share/swig/guile/std_map.i
index f84e78b..6fb9bca 100644
--- a/linux-x86/share/swig/guile/std_map.i
+++ b/linux-x86/share/swig/guile/std_map.i
@@ -5,6 +5,7 @@
* ----------------------------------------------------------------------------- */
%include <std_common.i>
+%include <exception.i>
// ------------------------------------------------------------------------
// std::map
@@ -64,7 +65,11 @@ namespace std {
val = SCM_CAR(val);
x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
}
+%#ifdef __cpp_lib_map_try_emplace
+ (($1_type &)$1).insert_or_assign(*k, *x);
+%#else
(($1_type &)$1)[*k] = *x;
+%#endif
alist = SCM_CDR(alist);
}
} else {
@@ -98,7 +103,11 @@ namespace std {
val = SCM_CAR(val);
x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
}
+%#ifdef __cpp_lib_map_try_emplace
+ temp.insert_or_assign(*k, *x);
+%#else
temp[*k] = *x;
+%#endif
alist = SCM_CDR(alist);
}
} else {
@@ -239,7 +248,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void __setitem__(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void __delitem__(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -264,1107 +277,4 @@ namespace std {
}
};
-
- // specializations for built-ins
-
- %define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
-
- template<class T> class map< K, T, C > {
- %typemap(in) map< K, T, C > {
- if (scm_is_null($input)) {
- $1 = std::map< K, T, C >();
- } else if (scm_is_pair($input)) {
- $1 = std::map< K, T, C >();
- SCM alist = $input;
- while (!scm_is_null(alist)) {
- T* x;
- SCM entry, key, val;
- entry = SCM_CAR(alist);
- if (!scm_is_pair(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = SCM_CAR(entry);
- val = SCM_CDR(entry);
- if (!CHECK(key))
- SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "," #C "> expected");
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) != 0) {
- if (!scm_is_pair(val))
- SWIG_exception(SWIG_TypeError,"alist expected");
- val = SCM_CAR(val);
- x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
- }
- (($1_type &)$1)[CONVERT_FROM(key)] = *x;
- alist = SCM_CDR(alist);
- }
- } else {
- $1 = *(($&1_type)
- SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
- }
- }
- %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, C >();
- $1 = &temp;
- } else if (scm_is_pair($input)) {
- temp = std::map< K, T, C >();
- $1 = &temp;
- SCM alist = $input;
- while (!scm_is_null(alist)) {
- T* x;
- SCM entry, key, val;
- entry = SCM_CAR(alist);
- if (!scm_is_pair(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = SCM_CAR(entry);
- val = SCM_CDR(entry);
- if (!CHECK(key))
- SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "," #C "> expected");
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) != 0) {
- if (!scm_is_pair(val))
- SWIG_exception(SWIG_TypeError,"alist expected");
- val = SCM_CAR(val);
- x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
- }
- temp[CONVERT_FROM(key)] = *x;
- alist = SCM_CDR(alist);
- }
- } else {
- $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
- }
- }
- %typemap(out) map< K, T, C > {
- SCM alist = SCM_EOL;
- 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);
- SCM entry = scm_cons(k,x);
- alist = scm_cons(entry,alist);
- }
- $result = alist;
- }
- %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
- // native sequence?
- if (scm_is_null($input)) {
- /* an empty sequence can be of any type */
- $1 = 1;
- } else if (scm_is_pair($input)) {
- // check the first element only
- T* x;
- SCM head = SCM_CAR($input);
- if (scm_is_pair(head)) {
- SCM key = SCM_CAR(head);
- SCM val = SCM_CDR(head);
- if (!CHECK(key)) {
- $1 = 0;
- } else {
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) == 0) {
- $1 = 1;
- } else if (scm_is_pair(val)) {
- val = SCM_CAR(val);
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) == 0)
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $&1_descriptor, 0) == 0)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %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 */
- $1 = 1;
- } else if (scm_is_pair($input)) {
- // check the first element only
- T* x;
- SCM head = SCM_CAR($input);
- if (scm_is_pair(head)) {
- SCM key = SCM_CAR(head);
- SCM val = SCM_CDR(head);
- if (!CHECK(key)) {
- $1 = 0;
- } else {
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) == 0) {
- $1 = 1;
- } else if (scm_is_pair(val)) {
- val = SCM_CAR(val);
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) == 0)
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $1_descriptor, 0) == 0)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %rename("length") size;
- %rename("null?") empty;
- %rename("clear!") clear;
- %rename("ref") __getitem__;
- %rename("set!") __setitem__;
- %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& other);
-
- unsigned int size() const;
- bool empty() const;
- void clear();
- %extend {
- T& __getitem__(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 __setitem__(K key, const T& x) {
- (*self)[key] = x;
- }
- void __delitem__(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(K 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, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
- SCM k = CONVERT_TO(i->first);
- result = scm_cons(k,result);
- }
- return result;
- }
- }
- };
- %enddef
-
- %define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
- template<class K> class map< K, T, C > {
- %typemap(in) map< K, T, C > {
- if (scm_is_null($input)) {
- $1 = std::map< K, T, C >();
- } else if (scm_is_pair($input)) {
- $1 = std::map< K, T, C >();
- SCM alist = $input;
- while (!scm_is_null(alist)) {
- K* k;
- SCM entry, key, val;
- entry = SCM_CAR(alist);
- if (!scm_is_pair(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = SCM_CAR(entry);
- val = SCM_CDR(entry);
- k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
- if (!CHECK(val)) {
- if (!scm_is_pair(val))
- SWIG_exception(SWIG_TypeError,"alist expected");
- val = SCM_CAR(val);
- if (!CHECK(val))
- SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "," #C "> expected");
- }
- (($1_type &)$1)[*k] = CONVERT_FROM(val);
- alist = SCM_CDR(alist);
- }
- } else {
- $1 = *(($&1_type)
- SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
- }
- }
- %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, C >();
- $1 = &temp;
- } else if (scm_is_pair($input)) {
- temp = std::map< K, T, C >();
- $1 = &temp;
- SCM alist = $input;
- while (!scm_is_null(alist)) {
- K* k;
- SCM entry, key, val;
- entry = SCM_CAR(alist);
- if (!scm_is_pair(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = SCM_CAR(entry);
- val = SCM_CDR(entry);
- k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
- if (!CHECK(val)) {
- if (!scm_is_pair(val))
- SWIG_exception(SWIG_TypeError,"alist expected");
- val = SCM_CAR(val);
- if (!CHECK(val))
- SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "," #C "> expected");
- }
- temp[*k] = CONVERT_FROM(val);
- alist = SCM_CDR(alist);
- }
- } else {
- $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
- }
- }
- %typemap(out) map< K, T, C > {
- SCM alist = SCM_EOL;
- 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);
- SCM entry = scm_cons(k,x);
- alist = scm_cons(entry,alist);
- }
- $result = alist;
- }
- %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
- // native sequence?
- if (scm_is_null($input)) {
- /* an empty sequence can be of any type */
- $1 = 1;
- } else if (scm_is_pair($input)) {
- // check the first element only
- K* k;
- SCM head = SCM_CAR($input);
- if (scm_is_pair(head)) {
- SCM val = SCM_CDR(head);
- if (SWIG_ConvertPtr(val,(void **) &k,
- $descriptor(K *), 0) != 0) {
- $1 = 0;
- } else {
- if (CHECK(val)) {
- $1 = 1;
- } else if (scm_is_pair(val)) {
- val = SCM_CAR(val);
- if (CHECK(val))
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $&1_descriptor, 0) == 0)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %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 */
- $1 = 1;
- } else if (scm_is_pair($input)) {
- // check the first element only
- K* k;
- SCM head = SCM_CAR($input);
- if (scm_is_pair(head)) {
- SCM val = SCM_CDR(head);
- if (SWIG_ConvertPtr(val,(void **) &k,
- $descriptor(K *), 0) != 0) {
- $1 = 0;
- } else {
- if (CHECK(val)) {
- $1 = 1;
- } else if (scm_is_pair(val)) {
- val = SCM_CAR(val);
- if (CHECK(val))
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $1_descriptor, 0) == 0)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %rename("length") size;
- %rename("null?") empty;
- %rename("clear!") clear;
- %rename("ref") __getitem__;
- %rename("set!") __setitem__;
- %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& 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, C >::iterator i = self->find(key);
- if (i != self->end())
- return i->second;
- else
- throw std::out_of_range("key not found");
- }
- void __setitem__(const K& key, T x) {
- (*self)[key] = x;
- }
- void __delitem__(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();
- }
- SCM keys() {
- SCM result = SCM_EOL;
- 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);
- }
- return result;
- }
- }
- };
- %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)
- template<> class map< K, T, C > {
- %typemap(in) map< K, T, C > {
- if (scm_is_null($input)) {
- $1 = std::map< K, T, C >();
- } else if (scm_is_pair($input)) {
- $1 = std::map< K, T, C >();
- SCM alist = $input;
- while (!scm_is_null(alist)) {
- SCM entry, key, val;
- entry = SCM_CAR(alist);
- if (!scm_is_pair(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = SCM_CAR(entry);
- val = SCM_CDR(entry);
- if (!CHECK_K(key))
- SWIG_exception(SWIG_TypeError,
- "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 "," #C "> expected");
- }
- (($1_type &)$1)[CONVERT_K_FROM(key)] =
- CONVERT_T_FROM(val);
- alist = SCM_CDR(alist);
- }
- } else {
- $1 = *(($&1_type)
- SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
- }
- }
- %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, C >();
- $1 = &temp;
- } else if (scm_is_pair($input)) {
- temp = std::map< K, T, C >();
- $1 = &temp;
- SCM alist = $input;
- while (!scm_is_null(alist)) {
- SCM entry, key, val;
- entry = SCM_CAR(alist);
- if (!scm_is_pair(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = SCM_CAR(entry);
- val = SCM_CDR(entry);
- if (!CHECK_K(key))
- SWIG_exception(SWIG_TypeError,
- "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 "," #C "> expected");
- }
- temp[CONVERT_K_FROM(key)] = CONVERT_T_FROM(val);
- alist = SCM_CDR(alist);
- }
- } else {
- $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
- }
- }
- %typemap(out) map< K, T, C > {
- SCM alist = SCM_EOL;
- 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);
- alist = scm_cons(entry,alist);
- }
- $result = alist;
- }
- %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
- // native sequence?
- if (scm_is_null($input)) {
- /* an empty sequence can be of any type */
- $1 = 1;
- } else if (scm_is_pair($input)) {
- // check the first element only
- SCM head = SCM_CAR($input);
- if (scm_is_pair(head)) {
- SCM key = SCM_CAR(head);
- SCM val = SCM_CDR(head);
- if (!CHECK_K(key)) {
- $1 = 0;
- } else {
- if (CHECK_T(val)) {
- $1 = 1;
- } else if (scm_is_pair(val)) {
- val = SCM_CAR(val);
- if (CHECK_T(val))
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $&1_descriptor, 0) == 0)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %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 */
- $1 = 1;
- } else if (scm_is_pair($input)) {
- // check the first element only
- SCM head = SCM_CAR($input);
- if (scm_is_pair(head)) {
- SCM key = SCM_CAR(head);
- SCM val = SCM_CDR(head);
- if (!CHECK_K(key)) {
- $1 = 0;
- } else {
- if (CHECK_T(val)) {
- $1 = 1;
- } else if (scm_is_pair(val)) {
- val = SCM_CAR(val);
- if (CHECK_T(val))
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $1_descriptor, 0) == 0)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %rename("length") size;
- %rename("null?") empty;
- %rename("clear!") clear;
- %rename("ref") __getitem__;
- %rename("set!") __setitem__;
- %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& other);
-
- unsigned int size() const;
- bool empty() const;
- void clear();
- %extend {
- T __getitem__(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 __setitem__(K key, T x) {
- (*self)[key] = x;
- }
- void __delitem__(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(K 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, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
- SCM k = CONVERT_K_TO(i->first);
- result = scm_cons(k,result);
- }
- return result;
- }
- }
- };
- %enddef
-
-
- specialize_std_map_on_key(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_key(int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_key(short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_key(long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_key(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_key(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_key(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_key(double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_key(float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_key(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
-
- specialize_std_map_on_value(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_value(int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_value(short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_value(long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_value(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_value(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_value(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_value(double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_value(float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_value(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
-
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(int,scm_is_number,
- scm_to_long,scm_from_long,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(short,scm_is_number,
- scm_to_long,scm_from_long,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(long,scm_is_number,
- scm_to_long,scm_from_long,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(double,scm_is_number,
- scm_to_double,scm_from_double,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(float,scm_is_number,
- scm_to_double,scm_from_double,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- bool,scm_is_bool,
- scm_is_true,SWIG_bool2scm);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- int,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- short,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- long,scm_is_number,
- scm_to_long,scm_from_long);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- unsigned int,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- unsigned short,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- unsigned long,scm_is_number,
- scm_to_ulong,scm_from_ulong);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- double,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- float,scm_is_number,
- scm_to_double,scm_from_double);
- specialize_std_map_on_both(std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm,
- std::string,scm_is_string,
- SWIG_scm2string,SWIG_string2scm);
}
diff --git a/linux-x86/share/swig/guile/std_string.i b/linux-x86/share/swig/guile/std_string.i
index 6513173..178c484 100644
--- a/linux-x86/share/swig/guile/std_string.i
+++ b/linux-x86/share/swig/guile/std_string.i
@@ -30,7 +30,7 @@ namespace std {
if (scm_is_string($input)) {
tempptr = SWIG_scm2str($input);
$1.assign(tempptr);
- if (tempptr) SWIG_free(tempptr);
+ SWIG_free(tempptr);
} else {
SWIG_exception(SWIG_TypeError, "string expected");
}
@@ -40,7 +40,7 @@ namespace std {
if (scm_is_string($input)) {
tempptr = SWIG_scm2str($input);
temp.assign(tempptr);
- if (tempptr) SWIG_free(tempptr);
+ SWIG_free(tempptr);
$1 = &temp;
} else {
SWIG_exception(SWIG_TypeError, "string expected");
@@ -51,7 +51,7 @@ namespace std {
if (scm_is_string($input)) {
tempptr = SWIG_scm2str($input);
$1 = new $*1_ltype(tempptr);
- if (tempptr) SWIG_free(tempptr);
+ SWIG_free(tempptr);
} else {
SWIG_exception(SWIG_TypeError, "string expected");
}
@@ -73,7 +73,7 @@ namespace std {
if (scm_is_string($input)) {
char *tempptr = SWIG_scm2str($input);
$1.assign(tempptr);
- if (tempptr) SWIG_free(tempptr);
+ SWIG_free(tempptr);
} else {
SWIG_exception(SWIG_TypeError, "string expected");
}
@@ -83,4 +83,13 @@ namespace std {
$result = SWIG_str02scm($1.c_str());
}
+ %typemap(throws) string {
+ scm_throw(scm_from_locale_symbol("swig-exception"),
+ scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED));
+ }
+
+ %typemap(throws) const string & {
+ scm_throw(scm_from_locale_symbol("swig-exception"),
+ scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED));
+ }
}
diff --git a/linux-x86/share/swig/guile/std_unique_ptr.i b/linux-x86/share/swig/guile/std_unique_ptr.i
new file mode 100644
index 0000000..6f907e9
--- /dev/null
+++ b/linux-x86/share/swig/guile/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ scm_misc_error(FUNC_NAME, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'", SCM_EOL);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/guile/swigmove.i b/linux-x86/share/swig/guile/swigmove.i
new file mode 100644
index 0000000..87ab91e
--- /dev/null
+++ b/linux-x86/share/swig/guile/swigmove.i
@@ -0,0 +1,19 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "$1_type", $symname, $argnum);
+ } else {
+ %argument_fail(res, "$1_type", $symname, $argnum);
+ }
+ }
+ if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
+ SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp);
+}
diff --git a/linux-x86/share/swig/guile/swigrun.i b/linux-x86/share/swig/guile/swigrun.i
index 4b9ea2c..e4573eb 100644
--- a/linux-x86/share/swig/guile/swigrun.i
+++ b/linux-x86/share/swig/guile/swigrun.i
@@ -4,8 +4,6 @@
#ifdef SWIGGUILE_SCM
-/* Hook the runtime module initialization
- into the shared initialization function SWIG_Guile_Init. */
%runtime %{
/* Hook the runtime module initialization
into the shared initialization function SWIG_Guile_Init. */
diff --git a/linux-x86/share/swig/guile/typemaps.i b/linux-x86/share/swig/guile/typemaps.i
index cfccced..d9b78fb 100644
--- a/linux-x86/share/swig/guile/typemaps.i
+++ b/linux-x86/share/swig/guile/typemaps.i
@@ -4,17 +4,43 @@
* Guile-specific typemaps
* ----------------------------------------------------------------------------- */
+/* These are defined with a view to eventually merging with those defined for other target languages in swigtypemaps.swg and exception.swg */
+#define %set_output(obj) $result = obj
+#define %set_varoutput(obj) $result = obj
+#define %argument_fail(_code, _type, _name, _argn) scm_wrong_type_arg(FUNC_NAME, _argn, $input)
+#define %as_voidptr(ptr) (void*)(ptr)
+#define %argument_nullref(_type, _name, _argn) scm_misc_error(FUNC_NAME, "invalid null reference for argument " #_argn " of type '" _type "'", SCM_EOL)
+#define %releasenotowned_fail(_code, _type, _name, _argn) scm_misc_error(FUNC_NAME, "cannot release ownership as memory is not owned for argument " #_argn " of type '" _type "'", SCM_EOL)
+
/* Pointers */
-%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
+%typemap(in) SWIGTYPE *, SWIGTYPE [] {
$1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
}
-%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "";
+%typemap(in) SWIGTYPE & ($1_ltype argp) {
+ argp = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
+ if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
+ $1 = argp;
+}
+%typemap(in, noblock=1, fragment="<memory>") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "$1_type", $symname, $argnum);
+ } else {
+ %argument_fail(res, "$1_type", $symname, $argnum);
+ }
+ }
+ if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
+ $1 = ($1_ltype)argp;
+ rvrdeleter.reset($1);
+}
+%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] ""
%typemap(in) void * {
$1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0);
}
-%typemap(freearg) void * "";
+%typemap(freearg) void * ""
%typemap(varin) SWIGTYPE * {
$1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0);
@@ -29,7 +55,7 @@
}
%typemap(varin) SWIGTYPE [] {
- scm_wrong_type_arg((char *) FUNC_NAME, 1, $input);
+ scm_wrong_type_arg(FUNC_NAME, 1, $input);
}
%typemap(varin) SWIGTYPE [ANY] {
@@ -68,31 +94,31 @@
%typemap(throws) SWIGTYPE {
$&ltype temp = new $ltype($1);
- scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
+ scm_throw(scm_from_locale_symbol("swig-exception"),
scm_list_n(SWIG_NewPointerObj(temp, $&descriptor, 1),
SCM_UNDEFINED));
}
%typemap(throws) SWIGTYPE & {
- scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
+ scm_throw(scm_from_locale_symbol("swig-exception"),
scm_list_n(SWIG_NewPointerObj(&$1, $descriptor, 1),
SCM_UNDEFINED));
}
%typemap(throws) SWIGTYPE && {
- scm_throw(gh_symbol2scm((char *) "swig-exception"),
- gh_list(SWIG_NewPointerObj(&$1, $descriptor, 1),
+ scm_throw(scm_from_locale_symbol("swig-exception"),
+ scm_list_n(SWIG_NewPointerObj(&$1, $descriptor, 1),
SCM_UNDEFINED));
}
%typemap(throws) SWIGTYPE * {
- scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
+ scm_throw(scm_from_locale_symbol("swig-exception"),
scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1),
SCM_UNDEFINED));
}
%typemap(throws) SWIGTYPE [] {
- scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
+ scm_throw(scm_from_locale_symbol("swig-exception"),
scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1),
SCM_UNDEFINED));
}
@@ -115,8 +141,9 @@
/* Pass-by-value */
-%typemap(in) SWIGTYPE($&1_ltype argp) {
+%typemap(in) SWIGTYPE ($&1_ltype argp) {
argp = ($&1_ltype)SWIG_MustGetPtr($input, $&1_descriptor, $argnum, 0);
+ if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
$1 = *argp;
}
@@ -130,7 +157,7 @@
#ifdef __cplusplus
{
$&1_ltype resultptr;
- resultptr = new $1_ltype((const $1_ltype &) $1);
+ resultptr = new $1_ltype($1);
$result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1);
}
#else
@@ -145,8 +172,7 @@
%typemap(varout) SWIGTYPE
#ifdef __cplusplus
{
- $&1_ltype resultptr;
- resultptr = new $1_ltype((const $1_ltype&) $1);
+ $&1_ltype resultptr = ($&1_ltype)&$1;
$result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0);
}
#else
@@ -166,8 +192,8 @@
%typemap(varin) enum SWIGTYPE {
if (sizeof(int) != sizeof($1)) {
scm_error(scm_from_locale_symbol("swig-error"),
- (char *) FUNC_NAME,
- (char *) "enum variable '$name' cannot be set",
+ FUNC_NAME,
+ "enum variable '$name' cannot be set",
SCM_EOL, SCM_BOOL_F);
}
* (int *) &($1) = scm_to_int($input);
@@ -175,7 +201,7 @@
%typemap(out) enum SWIGTYPE { $result = scm_from_long((int)$1); }
%typemap(varout) enum SWIGTYPE { $result = scm_from_long((int)$1); }
%typemap(throws) enum SWIGTYPE {
- scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
+ scm_throw(scm_from_locale_symbol("swig-exception"),
scm_list_n(scm_from_long((int)$1), SCM_UNDEFINED));
}
@@ -209,8 +235,6 @@
%typemap (argout,doc="$name (of type <" #SCM_NAME ">)") C_NAME *OUTPUT
{ C_NAME swig_c_value = *$1;
SWIG_APPEND_VALUE(C_TO_SCM_EXPR); }
- %typemap (in) C_NAME *BOTH = C_NAME *INPUT;
- %typemap (argout) C_NAME *BOTH = C_NAME *OUTPUT;
%typemap (in) C_NAME *INOUT = C_NAME *INPUT;
%typemap (argout) C_NAME *INOUT = C_NAME *OUTPUT;
/* Const primitive references. Passed by value */
@@ -224,7 +248,7 @@
/* Throw typemap */
%typemap(throws) C_NAME {
C_NAME swig_c_value = $1;
- scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
+ scm_throw(scm_from_locale_symbol("swig-exception"),
scm_list_n(C_TO_SCM_EXPR, SCM_UNDEFINED));
}
%enddef
@@ -252,8 +276,6 @@
{$1 = &temp;}
%typemap (argout,doc="$name (of type <" #SCM_NAME ">)") C_NAME *OUTPUT, C_NAME &OUTPUT
{SWIG_APPEND_VALUE(C_TO_SCM(*$1));}
- %typemap (in) C_NAME *BOTH = C_NAME *INPUT;
- %typemap (argout) C_NAME *BOTH = C_NAME *OUTPUT;
%typemap (in) C_NAME *INOUT = C_NAME *INPUT;
%typemap (argout) C_NAME *INOUT = C_NAME *OUTPUT;
%typemap (in) C_NAME &INOUT = C_NAME &INPUT;
@@ -268,7 +290,7 @@
}
/* Throw typemap */
%typemap(throws) C_NAME {
- scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
+ scm_throw(scm_from_locale_symbol("swig-exception"),
scm_list_n(C_TO_SCM($1), SCM_UNDEFINED));
}
%enddef
@@ -314,27 +336,25 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer);
{$1 = &temp;}
%typemap (argout,doc="$NAME (a string)") char **OUTPUT
{SWIG_APPEND_VALUE(SWIG_str02scm(*$1));}
- %typemap (in) char **BOTH = char **INPUT;
- %typemap (argout) char **BOTH = char **OUTPUT;
%typemap (in) char **INOUT = char **INPUT;
%typemap (argout) char **INOUT = char **OUTPUT;
/* SWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after
the function call. */
-%typemap (freearg) char * "if (must_free$argnum && $1) SWIG_free($1);";
-%typemap (freearg) char **INPUT, char **BOTH "if (must_free$argnum && (*$1)) SWIG_free(*$1);"
+%typemap (freearg) char * "if (must_free$argnum) SWIG_free($1);"
+%typemap (freearg) char **INPUT, char **INOUT "if (must_free$argnum) SWIG_free(*$1);"
%typemap (freearg) char **OUTPUT "SWIG_free(*$1);"
/* But this shall not apply if we try to pass a single char by
reference. */
-%typemap (freearg) char *OUTPUT, char *BOTH "";
+%typemap (freearg) char *OUTPUT, char *INOUT ""
/* If we set a string variable, delete the old result first, unless const. */
%typemap (varin) char * {
- if ($1) free($1);
+ free($1);
$1 = ($1_ltype) SWIG_scm2str($input);
}
@@ -343,19 +363,19 @@ 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_throw(scm_from_locale_symbol("swig-exception"),
scm_list_n(SWIG_str02scm($1), SCM_UNDEFINED));
}
/* Void */
-%typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;";
+%typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;"
/* SCM is passed through */
typedef unsigned long SCM;
-%typemap (in) SCM "$1=$input;";
-%typemap (out) SCM "$result=$1;";
+%typemap (in) SCM "$1=$input;"
+%typemap (out) SCM "$result=$1;"
%typecheck(SWIG_TYPECHECK_POINTER) SCM "$1=1;";
/* ------------------------------------------------------------
@@ -373,31 +393,26 @@ typedef unsigned long SCM;
* taken from typemaps/swigtype.swg
* ------------------------------------------------------------ */
-#define %set_output(obj) $result = obj
-#define %set_varoutput(obj) $result = obj
-#define %argument_fail(code, type, name, argn) scm_wrong_type_arg((char *) FUNC_NAME, argn, $input);
-#define %as_voidptr(ptr) (void*)(ptr)
-
-%typemap(in) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor);
+%typemap(in) SWIGTYPE (CLASS::*) {
+ int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1), $descriptor);
if (!SWIG_IsOK(res)) {
- %argument_fail(res,"$type",$symname, $argnum);
+ %argument_fail(res,"$type",$symname, $argnum);
}
}
%typemap(out,noblock=1) SWIGTYPE (CLASS::*) {
- %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
%typemap(varin) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor);
+ int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($1), $descriptor);
if (!SWIG_IsOK(res)) {
- scm_wrong_type_arg((char *) FUNC_NAME, 1, $input);
+ scm_wrong_type_arg(FUNC_NAME, 1, $input);
}
}
%typemap(varout,noblock=1) SWIGTYPE (CLASS::*) {
- %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
/* ------------------------------------------------------------
@@ -426,7 +441,7 @@ typedef unsigned long SCM;
%typecheck(SWIG_TYPECHECK_BOOL)
bool, bool&, const bool&
{
- $1 = SCM_BOOLP($input) ? 1 : 0;
+ $1 = scm_is_bool($input) ? 1 : 0;
}
%typecheck(SWIG_TYPECHECK_DOUBLE)
diff --git a/linux-x86/share/swig/intrusive_ptr.i b/linux-x86/share/swig/intrusive_ptr.i
index 621a701..a4e8df0 100644
--- a/linux-x86/share/swig/intrusive_ptr.i
+++ b/linux-x86/share/swig/intrusive_ptr.i
@@ -56,25 +56,3 @@ SWIG_INTRUSIVE_PTR_TYPEMAPS(const, TYPE)
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(, TYPE)
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(const, TYPE)
%enddef
-
-// Legacy macros
-%define SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE...)
-#warning "SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE) is deprecated. Please use %intrusive_ptr(TYPE) instead."
-%intrusive_ptr(TYPE)
-%enddef
-
-%define SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE...)
-#warning "SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %intrusive_ptr(TYPE) instead."
-%intrusive_ptr(TYPE)
-%enddef
-
-%define SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE...)
-#warning "SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE) is deprecated. Please use %intrusive_ptr_no_wrap(TYPE) instead."
-%intrusive_ptr_no_wrap(TYPE)
-%enddef
-
-%define SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE...)
-#warning "SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %intrusive_ptr_no_wrap(TYPE) instead."
-%intrusive_ptr_no_wrap(TYPE)
-%enddef
-
diff --git a/linux-x86/share/swig/inttypes.i b/linux-x86/share/swig/inttypes.i
index 85bd5ad..f5a09f0 100644
--- a/linux-x86/share/swig/inttypes.i
+++ b/linux-x86/share/swig/inttypes.i
@@ -49,37 +49,12 @@ extern "C" {
extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t ** endptr, int base);
#endif
-#ifdef SWIGWORDSIZE64
-
/* Like `strtol' but convert to `intmax_t'. */
extern intmax_t strtoimax (const char *nptr, char **endptr, int base);
/* Like `strtoul' but convert to `uintmax_t'. */
extern uintmax_t strtoumax (const char *nptr, char **endptr,int base);
-#ifdef SWIG_WCHAR
- /* Like `wcstol' but convert to `intmax_t'. */
- extern intmax_t wcstoimax (const wchar_t *nptr, wchar_t **endptr, int base);
-
- /* Like `wcstoul' but convert to `uintmax_t'. */
- extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t **endptr, int base);
-#endif
-
-#else /* SWIGWORDSIZE32 */
-
- /* Like `strtol' but convert to `intmax_t'. */
- extern intmax_t strtoimax (const char *nptr, char **endptr, int base);
-
- /* Like `strtoul' but convert to `uintmax_t'. */
- extern uintmax_t strtoumax (const char *nptr, char **endptr, int base);
-
-#ifdef SWIG_WCHAR
- /* Like `wcstol' but convert to `intmax_t'. */
- extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t **endptr, int base);
-#endif
-
-#endif /* SWIGWORDSIZE64 */
-
#ifdef __cplusplus
}
#endif
diff --git a/linux-x86/share/swig/java/argcargv.i b/linux-x86/share/swig/java/argcargv.i
new file mode 100644
index 0000000..cf0f85b
--- /dev/null
+++ b/linux-x86/share/swig/java/argcargv.i
@@ -0,0 +1,36 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(jni) (int ARGC, char **ARGV) "jobjectArray"
+%typemap(jtype) (int ARGC, char **ARGV) "String[]"
+%typemap(jstype) (int ARGC, char **ARGV) "String[]"
+
+%typemap(in) (int ARGC, char **ARGV) {
+ $1_ltype i, len;
+ if ($input == (jobjectArray)0) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
+ return $null;
+ }
+ len = ($1_ltype)JCALL1(GetArrayLength, jenv, $input);
+ if (len < 0) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "array length negative");
+ return $null;
+ }
+ $2 = ($2_ltype) malloc((len+1)*sizeof($*2_ltype));
+ if ($2 == NULL) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "memory allocation failed");
+ return $null;
+ }
+ $1 = len;
+ for (i = 0; i < len; i++) {
+ jstring j_string = (jstring)JCALL2(GetObjectArrayElement, jenv, $input, (jsize)i);
+ const char *c_string = JCALL2(GetStringUTFChars, jenv, j_string, 0);
+ $2[i] = ($*2_ltype)c_string;
+ }
+ $2[i] = NULL;
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ free((void *)$2);
+}
diff --git a/linux-x86/share/swig/java/arrays_java.i b/linux-x86/share/swig/java/arrays_java.i
index dd38438..a8f5180 100644
--- a/linux-x86/share/swig/java/arrays_java.i
+++ b/linux-x86/share/swig/java/arrays_java.i
@@ -104,7 +104,7 @@ JAVA_ARRAYS_DECL(int, jint, Int, Int) /* int[] */
JAVA_ARRAYS_DECL(unsigned int, jlong, Long, Uint) /* unsigned int[] */
JAVA_ARRAYS_DECL(long, jint, Int, Long) /* long[] */
JAVA_ARRAYS_DECL(unsigned long, jlong, Long, Ulong) /* unsigned long[] */
-JAVA_ARRAYS_DECL(jlong, jlong, Long, Longlong) /* long long[] */
+JAVA_ARRAYS_DECL(long long, jlong, Long, Longlong) /* long long[] */
JAVA_ARRAYS_DECL(float, jfloat, Float, Float) /* float[] */
JAVA_ARRAYS_DECL(double, jdouble, Double, Double) /* double[] */
@@ -128,7 +128,7 @@ JAVA_ARRAYS_IMPL(int, jint, Int, Int) /* int[] */
JAVA_ARRAYS_IMPL(unsigned int, jlong, Long, Uint) /* unsigned int[] */
JAVA_ARRAYS_IMPL(long, jint, Int, Long) /* long[] */
JAVA_ARRAYS_IMPL(unsigned long, jlong, Long, Ulong) /* unsigned long[] */
-JAVA_ARRAYS_IMPL(jlong, jlong, Long, Longlong) /* long long[] */
+JAVA_ARRAYS_IMPL(long long, jlong, Long, Longlong) /* long long[] */
JAVA_ARRAYS_IMPL(float, jfloat, Float, Float) /* float[] */
JAVA_ARRAYS_IMPL(double, jdouble, Double, Double) /* double[] */
@@ -147,19 +147,19 @@ JAVA_ARRAYS_IMPL(double, jdouble, Double, Double) /* double[] */
%typemap(jstype) CTYPE[ANY], CTYPE[] %{JTYPE[]%}
%typemap(in) CTYPE[] (JNITYPE *jarr)
-%{ if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, (CTYPE **)&$1, $input)) return $null; %}
+%{ if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, ($&1_ltype)&$1, $input)) return $null; %}
%typemap(in) CTYPE[ANY] (JNITYPE *jarr)
%{ if ($input && JCALL1(GetArrayLength, jenv, $input) != $1_size) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "incorrect array size");
return $null;
}
- if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, (CTYPE **)&$1, $input)) return $null; %}
+ if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, ($&1_ltype)&$1, $input)) return $null; %}
%typemap(argout) CTYPE[ANY], CTYPE[]
-%{ SWIG_JavaArrayArgout##JFUNCNAME(jenv, jarr$argnum, (CTYPE *)$1, $input); %}
+%{ SWIG_JavaArrayArgout##JFUNCNAME(jenv, jarr$argnum, ($1_ltype)$1, $input); %}
%typemap(out) CTYPE[ANY]
-%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, (CTYPE *)$1, $1_dim0); %}
+%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, ($1_ltype)$1, $1_dim0); %}
%typemap(out) CTYPE[]
-%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, (CTYPE *)$1, FillMeInAsSizeCannotBeDeterminedAutomatically); %}
+%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, ($1_ltype)$1, FillMeInAsSizeCannotBeDeterminedAutomatically); %}
%typemap(freearg) CTYPE[ANY], CTYPE[]
#ifdef __cplusplus
%{ delete [] $1; %}
@@ -227,6 +227,12 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
double[ANY], double[]
""
+#if defined(SWIGWORDSIZE64)
+%apply long long[ANY] { long[ANY] };
+%apply unsigned long long[ANY] { unsigned long[ANY] };
+%apply long long[] { long[] };
+%apply unsigned long long[] { unsigned long[] };
+#endif
/* Arrays of proxy classes. The typemaps in this macro make it possible to treat an array of
* class/struct/unions as an array of Java classes.
diff --git a/linux-x86/share/swig/java/boost_intrusive_ptr.i b/linux-x86/share/swig/java/boost_intrusive_ptr.i
index 3bc80b4..072a31e 100644
--- a/linux-x86/share/swig/java/boost_intrusive_ptr.i
+++ b/linux-x86/share/swig/java/boost_intrusive_ptr.i
@@ -33,7 +33,7 @@
%}
%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{
//plain value(out)
- $1_ltype* resultp = new $1_ltype(($1_ltype &)$1);
+ $1_ltype* resultp = new $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 >());
%}
@@ -342,7 +342,7 @@
}
$1 = *argp; %}
%typemap(out) CONST TYPE
-%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
+%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %}
// plain pointer
%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
diff --git a/linux-x86/share/swig/java/boost_shared_ptr.i b/linux-x86/share/swig/java/boost_shared_ptr.i
index 325a683..ce00162 100644
--- a/linux-x86/share/swig/java/boost_shared_ptr.i
+++ b/linux-x86/share/swig/java/boost_shared_ptr.i
@@ -29,11 +29,11 @@
}
$1 = *argp; %}
%typemap(out) CONST TYPE
-%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
+%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $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)); %}
+ *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %}
%typemap(directorout) CONST TYPE
%{ if (!$input) {
diff --git a/linux-x86/share/swig/java/director.swg b/linux-x86/share/swig/java/director.swg
index d3bd162..630a98f 100644
--- a/linux-x86/share/swig/java/director.swg
+++ b/linux-x86/share/swig/java/director.swg
@@ -51,16 +51,20 @@ SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
#endif
+#if defined(SWIG_JAVA_DETACH_ON_THREAD_END)
+#include <pthread.h>
+#endif
+
namespace Swig {
/* Java object wrapper */
class JObjectWrapper {
public:
- JObjectWrapper() : jthis_(NULL), weak_global_(true) {
+ JObjectWrapper() : jthis_(SWIG_NULLPTR), weak_global_(true) {
}
~JObjectWrapper() {
- jthis_ = NULL;
+ jthis_ = SWIG_NULLPTR;
weak_global_ = true;
}
@@ -99,13 +103,13 @@ namespace Swig {
#endif
if (jthis_) {
if (weak_global_) {
- if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE)
+ if (jenv->IsSameObject(jthis_, SWIG_NULLPTR) == JNI_FALSE)
jenv->DeleteWeakGlobalRef((jweak)jthis_);
} else
jenv->DeleteGlobalRef(jthis_);
}
- jthis_ = NULL;
+ jthis_ = SWIG_NULLPTR;
weak_global_ = true;
}
@@ -133,6 +137,19 @@ namespace Swig {
}
}
+#if defined(SWIG_JAVA_DETACH_ON_THREAD_END)
+ static void detach(void *jvm) {
+ static_cast<JavaVM *>(jvm)->DetachCurrentThread();
+ }
+
+ static void make_detach_key() {
+ pthread_key_create(&detach_key_, detach);
+ }
+
+ /* thread-local key to register a destructor */
+ static pthread_key_t detach_key_;
+#endif
+
private:
/* pointer to Java object */
jobject jthis_;
@@ -140,6 +157,10 @@ namespace Swig {
bool weak_global_;
};
+#if defined(SWIG_JAVA_DETACH_ON_THREAD_END)
+ pthread_key_t JObjectWrapper::detach_key_;
+#endif
+
/* Local JNI reference deleter */
class LocalRefGuard {
JNIEnv *jenv_;
@@ -172,7 +193,7 @@ namespace Swig {
JNIEnv *jenv_;
int env_status;
public:
- JNIEnvWrapper(const Director *director) : director_(director), jenv_(0), env_status(0) {
+ JNIEnvWrapper(const Director *director) : director_(director), jenv_(SWIG_NULLPTR), env_status(0) {
#if defined(__ANDROID__)
JNIEnv **jenv = &jenv_;
#else
@@ -181,8 +202,8 @@ namespace Swig {
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;
+ args.group = SWIG_NULLPTR;
+ args.name = SWIG_NULLPTR;
#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) {
@@ -201,9 +222,19 @@ namespace Swig {
#else
director_->swig_jvm_->AttachCurrentThread(jenv, &args);
#endif
+
+#if defined(SWIG_JAVA_DETACH_ON_THREAD_END)
+ // At least on Android 6, detaching after every call causes a memory leak.
+ // Instead, register a thread desructor and detach only when the thread ends.
+ // See https://developer.android.com/training/articles/perf-jni#threads
+ static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+ pthread_once(&once, JObjectWrapper::make_detach_key);
+ pthread_setspecific(JObjectWrapper::detach_key_, director->swig_jvm_);
+#endif
}
~JNIEnvWrapper() {
-#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD)
+#if !defined(SWIG_JAVA_DETACH_ON_THREAD_END) && !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD)
// Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call.
// However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak.
if (env_status == JNI_EDETACHED)
@@ -215,6 +246,15 @@ namespace Swig {
}
};
+ struct SwigDirectorMethod {
+ const char *name;
+ const char *desc;
+ jmethodID methid;
+ SwigDirectorMethod(JNIEnv *jenv, jclass baseclass, const char *name, const char *desc) : name(name), desc(desc) {
+ methid = jenv->GetMethodID(baseclass, name, desc);
+ }
+ };
+
/* Java object wrapper */
JObjectWrapper swig_self_;
@@ -227,7 +267,7 @@ namespace Swig {
#if defined(DEBUG_DIRECTOR_OWNED)
std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl;
#endif
- if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) {
+ if (jobj && jenv->IsSameObject(jobj, SWIG_NULLPTR) == JNI_FALSE) {
jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V");
if (disconn_meth) {
#if defined(DEBUG_DIRECTOR_OWNED)
@@ -238,8 +278,13 @@ namespace Swig {
}
}
+ jclass swig_new_global_ref(JNIEnv *jenv, const char *classname) {
+ jclass clz = jenv->FindClass(classname);
+ return clz ? (jclass)jenv->NewGlobalRef(clz) : SWIG_NULLPTR;
+ }
+
public:
- Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() {
+ Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) SWIG_NULLPTR), swig_self_() {
/* Acquire the Java VM pointer */
jenv->GetJavaVM(&swig_jvm_);
}
@@ -284,9 +329,9 @@ namespace Swig {
// Simple holder for a Java string during exception handling, providing access to a c-style string
class JavaString {
public:
- JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) {
+ JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(SWIG_NULLPTR) {
if (jenv_ && jstr_)
- cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, NULL);
+ cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, SWIG_NULLPTR);
}
~JavaString() {
@@ -327,7 +372,7 @@ namespace Swig {
// Get exception message by calling Java method Throwable.getMessage()
static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) {
- jstring jmsg = NULL;
+ jstring jmsg = SWIG_NULLPTR;
if (jenv && throwable) {
jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions
jclass throwclz = jenv->GetObjectClass(throwable);
@@ -337,7 +382,7 @@ namespace Swig {
if (getMessageMethodID)
jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID);
}
- if (jmsg == NULL && jenv->ExceptionCheck())
+ if (jmsg == SWIG_NULLPTR && jenv->ExceptionCheck())
jenv->ExceptionClear();
}
return jmsg;
@@ -351,7 +396,7 @@ namespace Swig {
public:
// Construct exception from a Java throwable
- DirectorException(JNIEnv *jenv, jthrowable throwable) : jenv_(jenv), throwable_(throwable), classname_(0), msg_(0) {
+ DirectorException(JNIEnv *jenv, jthrowable throwable) : jenv_(jenv), throwable_(throwable), classname_(SWIG_NULLPTR), msg_(SWIG_NULLPTR) {
// Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/')
if (jenv && throwable) {
@@ -366,7 +411,7 @@ namespace Swig {
// Copy strings, since there is no guarantee that jenv will be active when handled
if (jstr_classname) {
JavaString jsclassname(jenv, jstr_classname);
- const char *classname = jsclassname.c_str(0);
+ const char *classname = jsclassname.c_str(SWIG_NULLPTR);
if (classname)
classname_ = copypath(classname);
}
@@ -376,11 +421,11 @@ namespace Swig {
}
JavaExceptionMessage exceptionmsg(jenv, throwable);
- msg_ = copystr(exceptionmsg.message(0));
+ msg_ = copystr(exceptionmsg.message(SWIG_NULLPTR));
}
// More general constructor for handling as a java.lang.RuntimeException
- DirectorException(const char *msg) : jenv_(0), throwable_(0), classname_(0), msg_(msg ? copystr(msg) : 0) {
+ DirectorException(const char *msg) : jenv_(SWIG_NULLPTR), throwable_(SWIG_NULLPTR), classname_(SWIG_NULLPTR), msg_(msg ? copystr(msg) : SWIG_NULLPTR) {
}
~DirectorException() throw() {
@@ -401,7 +446,7 @@ namespace Swig {
jthrowable throwable = jenv->ExceptionOccurred();
if (throwable && jenv->IsSameObject(throwable, throwable_) == JNI_FALSE) {
jenv->ExceptionClear();
- throwable = 0;
+ throwable = SWIG_NULLPTR;
}
if (!throwable)
jenv->Throw(throwable_);
@@ -409,8 +454,8 @@ namespace Swig {
// Try and reconstruct original exception, but original stacktrace is not reconstructed
jenv->ExceptionClear();
- jmethodID ctorMethodID = 0;
- jclass throwableclass = 0;
+ jmethodID ctorMethodID = SWIG_NULLPTR;
+ jclass throwableclass = SWIG_NULLPTR;
if (classname_) {
throwableclass = jenv->FindClass(classname_);
if (throwableclass)
@@ -447,7 +492,7 @@ namespace Swig {
}
static char *copystr(const char *srcmsg) {
- char *target = 0;
+ char *target = SWIG_NULLPTR;
if (srcmsg) {
size_t msglen = strlen(srcmsg) + 1;
target = new char[msglen];
diff --git a/linux-x86/share/swig/java/java.swg b/linux-x86/share/swig/java/java.swg
index e930933..4d427cb 100644
--- a/linux-x86/share/swig/java/java.swg
+++ b/linux-x86/share/swig/java/java.swg
@@ -665,7 +665,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
%typemap(out) SWIGTYPE
#ifdef __cplusplus
-%{ *($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %}
+%{ *($&1_ltype*)&$result = new $1_ltype($1); %}
#else
{
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
@@ -676,7 +676,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
%typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE
%{ $input = 0;
- *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %}
+ *(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %}
%typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, true)"
%typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)"
@@ -692,14 +692,15 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
}
%typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input;
if (!$1) {
- SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type is null");
return $null;
} %}
-%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input;
+%typemap(in, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = *($&1_ltype)&$input;
if (!$1) {
- SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type is null");
return $null;
- } %}
+ }
+ rvrdeleter.reset($1); %}
%typemap(out) SWIGTYPE *
%{ *($&1_ltype)&$result = $1; %}
%typemap(out, fragment="SWIG_PackData", noblock=1) SWIGTYPE (CLASS::*) {
@@ -1038,7 +1039,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
unsigned long,
unsigned short
%{ char error_msg[256];
- sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
+ SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1);
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, error_msg);
return $null; %}
@@ -1101,7 +1102,8 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
jobjectArray
"$javainput"
%typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)"
-%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$javaclassname.getCPtr($javainput)"
+%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$javaclassname.getCPtr($javainput)"
+%typemap(javain) SWIGTYPE && "$javaclassname.swigRelease($javainput)"
%typemap(javain) SWIGTYPE (CLASS::*) "$javaclassname.getCMemberPtr($javainput)"
/* The javaout typemap is used for converting function return types from the return type
@@ -1196,6 +1198,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
+%typemap(javainterfacemodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface"
/* javabody typemaps */
@@ -1215,6 +1218,18 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
+
+ CPTR_VISIBILITY static long swigRelease($javaclassname obj) {
+ long ptr = 0;
+ if (obj != null) {
+ if (!obj.swigCMemOwn)
+ throw new RuntimeException("Cannot release ownership as memory is not owned");
+ ptr = obj.swigCPtr;
+ obj.swigCMemOwn = false;
+ obj.delete();
+ }
+ return ptr;
+ }
%}
// Derived proxy classes
@@ -1229,6 +1244,18 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
+
+ CPTR_VISIBILITY static long swigRelease($javaclassname obj) {
+ long ptr = 0;
+ if (obj != null) {
+ if (!obj.swigCMemOwn)
+ throw new RuntimeException("Cannot release ownership as memory is not owned");
+ ptr = obj.swigCPtr;
+ obj.swigCMemOwn = false;
+ obj.delete();
+ }
+ return ptr;
+ }
%}
%enddef
@@ -1248,6 +1275,10 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
+
+ CPTR_VISIBILITY static long swigRelease($javaclassname obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
%}
%typemap(javabody) TYPE (CLASS::*) %{
@@ -1273,7 +1304,7 @@ SWIG_JAVABODY_PROXY(protected, protected, SWIGTYPE)
SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE)
%typemap(javafinalize) SWIGTYPE %{
- @SuppressWarnings("deprecation")
+ @SuppressWarnings({"deprecation", "removal"})
protected void finalize() {
delete();
}
@@ -1368,10 +1399,17 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
%pragma(java) jniclassclassmodifiers="public class"
%pragma(java) moduleclassmodifiers="public class"
-/* Some ANSI C typemaps */
+/* 64-bit architecture specific typemaps */
+#if defined(SWIGWORDSIZE64)
+%apply long long { long };
+%apply unsigned long long { unsigned long };
+%apply const long long & { const long & };
+%apply const unsigned long long & { const unsigned long & };
+#endif
-%apply unsigned long { size_t };
-%apply const unsigned long & { const size_t & };
+/* size_t maps to Java 64-bit (signed) long type */
+%apply unsigned int { size_t };
+%apply const unsigned int & { const size_t & };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
diff --git a/linux-x86/share/swig/java/javahead.swg b/linux-x86/share/swig/java/javahead.swg
index 2e10254..758a037 100644
--- a/linux-x86/share/swig/java/javahead.swg
+++ b/linux-x86/share/swig/java/javahead.swg
@@ -30,18 +30,6 @@
#endif
%insert(runtime) %{
-/* Fix for jlong on some versions of gcc on Windows */
-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
- typedef long long __int64;
-#endif
-
-/* Fix for jlong on 64-bit x86 Solaris */
-#if defined(__x86_64)
-# ifdef _LP64
-# undef _LP64
-# endif
-#endif
-
#include <jni.h>
#include <stdlib.h>
#include <string.h>
@@ -99,5 +87,5 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC
%insert(runtime) %{
/* Contract support */
-#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
+#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } } while (0)
%}
diff --git a/linux-x86/share/swig/java/javakw.swg b/linux-x86/share/swig/java/javakw.swg
index 99cd547..8a5b76e 100644
--- a/linux-x86/share/swig/java/javakw.swg
+++ b/linux-x86/share/swig/java/javakw.swg
@@ -2,7 +2,7 @@
#define JAVA_JAVAKW_SWG_
/* Warnings for Java keywords */
-#define JAVAKW(x) %keywordwarn("'" `x` "' is a java keyword, renaming to '_"`x`"'",rename="_%s") `x`
+#define JAVAKW(x) %keywordwarn("'" `x` "' is a java keyword",rename="_%s") `x`
/*
from
diff --git a/linux-x86/share/swig/java/std_array.i b/linux-x86/share/swig/java/std_array.i
index d3436cc..b5012de 100644
--- a/linux-x86/share/swig/java/std_array.i
+++ b/linux-x86/share/swig/java/std_array.i
@@ -4,6 +4,19 @@
%include <std_common.i>
+%fragment("SWIG_ArraySize", "header", fragment="SWIG_JavaIntFromSize_t") {
+ SWIGINTERN jint SWIG_ArraySize(size_t size) {
+ jint sz = SWIG_JavaIntFromSize_t(size);
+ if (sz == -1) {
+ throw std::out_of_range("array size is too large to fit into a Java int");
+ }
+
+ return sz;
+ }
+}
+
+%javamethodmodifiers std::array::sizeImpl "private";
+
namespace std {
template<class T, size_t N> class array {
@@ -19,11 +32,16 @@ namespace std {
array();
array(const array& other);
- size_type size() const;
%rename(isEmpty) empty;
bool empty() const;
void fill(const T& u);
%extend {
+ %fragment("SWIG_ArraySize");
+
+ jint size() const throw (std::out_of_range) {
+ return SWIG_ArraySize(self->size());
+ }
+
const_reference get(int i) throw (std::out_of_range) {
int size = int(self->size());
if (i>=0 && i<size)
diff --git a/linux-x86/share/swig/java/std_auto_ptr.i b/linux-x86/share/swig/java/std_auto_ptr.i
index 9b3cd73..aee9b48 100644
--- a/linux-x86/share/swig/java/std_auto_ptr.i
+++ b/linux-x86/share/swig/java/std_auto_ptr.i
@@ -1,27 +1,41 @@
-/*
- The typemaps here allow to handle functions returning std::auto_ptr<>,
- which is the most common use of this type. If you have functions taking it
- as parameter, these typemaps can't be used for them and you need to do
- something else (e.g. use shared_ptr<> which SWIG supports fully).
- */
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
%define %auto_ptr(TYPE)
-%typemap (jni) std::auto_ptr<TYPE > "jlong"
-%typemap (jtype) std::auto_ptr<TYPE > "long"
-%typemap (jstype) std::auto_ptr<TYPE > "$typemap(jstype, TYPE)"
-
-%typemap (out) std::auto_ptr<TYPE > %{
- jlong lpp = 0;
- *(TYPE**) &lpp = $1.release();
- $result = lpp;
+
+%typemap (jni) std::auto_ptr< TYPE > "jlong"
+%typemap (jtype) std::auto_ptr< TYPE > "long"
+%typemap (jstype) std::auto_ptr< TYPE > "$typemap(jstype, TYPE)"
+
+%typemap(in) std::auto_ptr< TYPE > (TYPE *auto_temp)
+%{ auto_temp = *(TYPE **)&$input;
+ $1.reset(auto_temp); %}
+
+%typemap(javain) std::auto_ptr< TYPE > "$typemap(jstype, TYPE).swigRelease($javainput)"
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ jlong lpp = 0;
+ *(TYPE **) &lpp = $1.release();
+ $result = lpp;
%}
-%typemap(javaout) std::auto_ptr<TYPE > {
- long cPtr = $jnicall;
- return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true);
- }
-%template() std::auto_ptr<TYPE >;
+
+%typemap(javaout) std::auto_ptr< TYPE > {
+ long cPtr = $jnicall;
+ return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true);
+ }
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > ""
+
+%template() std::auto_ptr< TYPE >;
%enddef
namespace std {
- template <class T> class auto_ptr {};
-}
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/java/std_list.i b/linux-x86/share/swig/java/std_list.i
index 1077bd0..896df30 100644
--- a/linux-x86/share/swig/java/std_list.i
+++ b/linux-x86/share/swig/java/std_list.i
@@ -168,7 +168,7 @@ namespace std {
return **$self;
}
- iterator advance_unchecked(size_type index) const {
+ iterator advance_unchecked(int index) const {
std::list<T>::iterator ret = *$self;
std::advance(ret, index);
return ret;
diff --git a/linux-x86/share/swig/java/std_map.i b/linux-x86/share/swig/java/std_map.i
index 6d5ca1a..d9623b2 100644
--- a/linux-x86/share/swig/java/std_map.i
+++ b/linux-x86/share/swig/java/std_map.i
@@ -79,7 +79,7 @@ template<class K, class T, class C = std::less< K> > class map {
}
public $typemap(jboxtype, T) put($typemap(jboxtype, K) key, $typemap(jboxtype, T) value) {
- Iterator itr = find(($typemap(jboxtype, K)) key);
+ Iterator itr = find(key);
if (itr.isNot(end())) {
$typemap(jboxtype, T) oldValue = itr.getValue();
itr.setValue(value);
@@ -199,7 +199,11 @@ template<class K, class T, class C = std::less< K> > class map {
}
void putUnchecked(const K& key, const T& value) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, value);
+%#else
(*self)[key] = value;
+%#endif
}
void removeUnchecked(const std::map< K, T, C >::iterator itr) {
@@ -208,17 +212,4 @@ template<class K, class T, class C = std::less< K> > class map {
}
};
-// 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/linux-x86/share/swig/java/std_set.i b/linux-x86/share/swig/java/std_set.i
index 73e0c2c..053866b 100644
--- a/linux-x86/share/swig/java/std_set.i
+++ b/linux-x86/share/swig/java/std_set.i
@@ -96,6 +96,10 @@ class set {
public boolean hasNext() {
return curr.isNot(end);
}
+
+ public void remove() {
+ throw new java.lang.UnsupportedOperationException();
+ }
}.init();
}
diff --git a/linux-x86/share/swig/java/std_string_view.i b/linux-x86/share/swig/java/std_string_view.i
new file mode 100644
index 0000000..c89f799
--- /dev/null
+++ b/linux-x86/share/swig/java/std_string_view.i
@@ -0,0 +1,138 @@
+/* -----------------------------------------------------------------------------
+ * std_string_view.i
+ *
+ * Typemaps for std::string_view and const std::string_view&
+ * These are mapped to a Java String and are passed around by value.
+ *
+ * To use non-const std::string_view references use the following %apply. Note
+ * that they are passed by value.
+ * %apply const std::string_view & {std::string_view &};
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <string_view>
+#include <string>
+%}
+
+namespace std {
+
+%naturalvar string_view;
+
+class string_view;
+
+// string_view
+%typemap(jni) string_view "jstring"
+%typemap(jtype) string_view "String"
+%typemap(jstype) string_view "String"
+%typemap(javadirectorin) string_view "$jniinput"
+%typemap(javadirectorout) string_view "$javacall"
+
+%typemap(in) string_view
+%{ if(!$input) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
+ return $null;
+ }
+ const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0);
+ if (!$1_pstr) return $null;
+ $1 = std::string_view($1_pstr); %}
+
+/* std::string_view requires the string data to remain valid while the
+ * string_view is in use. */
+%typemap(freearg) string_view
+%{ jenv->ReleaseStringUTFChars($input, $1_pstr); %}
+
+%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) string_view
+%{ if(!$input) {
+ if (!jenv->ExceptionCheck()) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
+ }
+ return $null;
+ }
+ const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0);
+ if (!$1_pstr) return $null;
+ /* possible thread/reentrant code problem */
+ static std::string $1_str;
+ $1_str = $1_pstr;
+ $result = std::string_view($1_str);
+ jenv->ReleaseStringUTFChars($input, $1_pstr); %}
+
+/* std::string_view::data() isn't zero-byte terminated, but NewStringUTF()
+ * requires a zero byte so it seems we have to make a copy (ick). The
+ * cleanest way to do that seems to be via a temporary std::string.
+ */
+%typemap(directorin,descriptor="Ljava/lang/String;") string_view
+%{ $input = jenv->NewStringUTF(std::string($1).c_str());
+ Swig::LocalRefGuard $1_refguard(jenv, $input); %}
+
+%typemap(out) string_view
+%{ $result = jenv->NewStringUTF(std::string($1).c_str()); %}
+
+%typemap(javain) string_view "$javainput"
+
+%typemap(javaout) string_view {
+ return $jnicall;
+ }
+
+%typemap(typecheck) string_view = char *;
+
+%typemap(throws) string_view
+%{ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, std::string($1).c_str());
+ return $null; %}
+
+// const string_view &
+%typemap(jni) const string_view & "jstring"
+%typemap(jtype) const string_view & "String"
+%typemap(jstype) const string_view & "String"
+%typemap(javadirectorin) const string_view & "$jniinput"
+%typemap(javadirectorout) const string_view & "$javacall"
+
+%typemap(in) const string_view &
+%{ if(!$input) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
+ return $null;
+ }
+ const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0);
+ if (!$1_pstr) return $null;
+ $*1_ltype $1_str($1_pstr);
+ $1 = &$1_str; %}
+
+/* std::string_view requires the string data to remain valid while the
+ * string_view is in use. */
+%typemap(freearg) const string_view &
+%{ jenv->ReleaseStringUTFChars($input, $1_pstr); %}
+
+%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string_view &
+%{ if(!$input) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
+ return $null;
+ }
+ const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0);
+ if (!$1_pstr) return $null;
+ /* possible thread/reentrant code problem */
+ static std::string $1_str;
+ $1_str = $1_pstr;
+ static $*1_ltype $1_strview;
+ $1_strview = $1_str;
+ $result = &$1_strview;
+ jenv->ReleaseStringUTFChars($input, $1_pstr); %}
+
+%typemap(directorin,descriptor="Ljava/lang/String;") const string_view &
+%{ $input = jenv->NewStringUTF(std::string($1).c_str());
+ Swig::LocalRefGuard $1_refguard(jenv, $input); %}
+
+%typemap(out) const string_view &
+%{ $result = jenv->NewStringUTF(std::string(*$1).c_str()); %}
+
+%typemap(javain) const string_view & "$javainput"
+
+%typemap(javaout) const string_view & {
+ return $jnicall;
+ }
+
+%typemap(typecheck) const string_view & = char *;
+
+%typemap(throws) const string_view &
+%{ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, std::string($1).c_str());
+ return $null; %}
+
+}
diff --git a/linux-x86/share/swig/java/std_unique_ptr.i b/linux-x86/share/swig/java/std_unique_ptr.i
new file mode 100644
index 0000000..838ca49
--- /dev/null
+++ b/linux-x86/share/swig/java/std_unique_ptr.i
@@ -0,0 +1,41 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+
+%typemap (jni) std::unique_ptr< TYPE > "jlong"
+%typemap (jtype) std::unique_ptr< TYPE > "long"
+%typemap (jstype) std::unique_ptr< TYPE > "$typemap(jstype, TYPE)"
+
+%typemap(in) std::unique_ptr< TYPE > (TYPE *unique_temp)
+%{ unique_temp = *(TYPE **)&$input;
+ $1.reset(unique_temp); %}
+
+%typemap(javain) std::unique_ptr< TYPE > "$typemap(jstype, TYPE).swigRelease($javainput)"
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ jlong lpp = 0;
+ *(TYPE **) &lpp = $1.release();
+ $result = lpp;
+%}
+
+%typemap(javaout) std::unique_ptr< TYPE > {
+ long cPtr = $jnicall;
+ return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true);
+ }
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > ""
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/java/std_unordered_map.i b/linux-x86/share/swig/java/std_unordered_map.i
index 283a9b4..2d93395 100644
--- a/linux-x86/share/swig/java/std_unordered_map.i
+++ b/linux-x86/share/swig/java/std_unordered_map.i
@@ -199,7 +199,11 @@ template<class K, class T> class unordered_map {
}
void putUnchecked(const K& key, const T& value) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, value);
+%#else
(*self)[key] = value;
+%#endif
}
void removeUnchecked(const std::unordered_map< K, T >::iterator itr) {
diff --git a/linux-x86/share/swig/java/std_unordered_set.i b/linux-x86/share/swig/java/std_unordered_set.i
index 59726e9..ddcedf0 100644
--- a/linux-x86/share/swig/java/std_unordered_set.i
+++ b/linux-x86/share/swig/java/std_unordered_set.i
@@ -92,6 +92,10 @@ class unordered_set {
public boolean hasNext() {
return curr.isNot(end);
}
+
+ public void remove() {
+ throw new java.lang.UnsupportedOperationException();
+ }
}.init();
}
diff --git a/linux-x86/share/swig/java/std_vector.i b/linux-x86/share/swig/java/std_vector.i
index 60ee23e..dee48fa 100644
--- a/linux-x86/share/swig/java/std_vector.i
+++ b/linux-x86/share/swig/java/std_vector.i
@@ -75,6 +75,14 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
public int size() {
return doSize();
}
+
+ public int capacity() {
+ return doCapacity();
+ }
+
+ public void reserve(int n) {
+ doReserve(n);
+ }
%}
public:
@@ -89,8 +97,6 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
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();
@@ -103,6 +109,16 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
return new std::vector< CTYPE >(static_cast<std::vector< CTYPE >::size_type>(count), value);
}
+ jint doCapacity() throw (std::out_of_range) {
+ return SWIG_VectorSize(self->capacity());
+ }
+
+ void doReserve(jint n) throw (std::length_error, std::out_of_range) {
+ if (n < 0)
+ throw std::out_of_range("vector reserve size must be positive");
+ self->reserve(n);
+ }
+
jint doSize() const throw (std::out_of_range) {
return SWIG_VectorSize(self->size());
}
@@ -161,6 +177,8 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
}
%enddef
+%javamethodmodifiers std::vector::doCapacity "private";
+%javamethodmodifiers std::vector::doReserve "private";
%javamethodmodifiers std::vector::doSize "private";
%javamethodmodifiers std::vector::doAdd "private";
%javamethodmodifiers std::vector::doGet "private";
diff --git a/linux-x86/share/swig/java/std_wstring.i b/linux-x86/share/swig/java/std_wstring.i
index dd0b2f5..efa9e63 100644
--- a/linux-x86/share/swig/java/std_wstring.i
+++ b/linux-x86/share/swig/java/std_wstring.i
@@ -60,7 +60,7 @@ class wstring;
%}
%typemap(directorin,descriptor="Ljava/lang/String;") wstring %{
- jsize $1_len = $1.length();
+ jsize $1_len = (jsize)$1.length();
jchar *$1_conv_buf = new jchar[$1_len];
for (jsize i = 0; i < $1_len; ++i) {
$1_conv_buf[i] = (jchar)$1[i];
@@ -71,7 +71,7 @@ class wstring;
%}
%typemap(out) wstring
-%{jsize $1_len = $1.length();
+%{jsize $1_len = (jsize)$1.length();
jchar *conv_buf = new jchar[$1_len];
for (jsize i = 0; i < $1_len; ++i) {
conv_buf[i] = (jchar)$1[i];
@@ -88,9 +88,12 @@ class wstring;
//%typemap(typecheck) wstring = wchar_t *;
%typemap(throws) wstring
-%{ std::string message($1.begin(), $1.end());
- SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str());
- return $null; %}
+%{std::string message($1.size(), '\0');
+ for (size_t i = 0; i < $1.size(); ++i) {
+ message[i] = (char)$1[i];
+ }
+ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str());
+ return $null; %}
// const wstring &
%typemap(jni) const wstring & "jstring"
@@ -138,7 +141,7 @@ class wstring;
jenv->ReleaseStringChars($input, $1_pstr); %}
%typemap(directorin,descriptor="Ljava/lang/String;") const wstring & %{
- jsize $1_len = $1.length();
+ jsize $1_len = (jsize)$1.length();
jchar *$1_conv_buf = new jchar[$1_len];
for (jsize i = 0; i < $1_len; ++i) {
$1_conv_buf[i] = (jchar)($1)[i];
@@ -149,7 +152,7 @@ class wstring;
%}
%typemap(out) const wstring &
-%{jsize $1_len = $1->length();
+%{jsize $1_len = (jsize)$1->length();
jchar *conv_buf = new jchar[$1_len];
for (jsize i = 0; i < $1_len; ++i) {
conv_buf[i] = (jchar)(*$1)[i];
@@ -166,9 +169,12 @@ class wstring;
//%typemap(typecheck) const wstring & = wchar_t *;
%typemap(throws) const wstring &
-%{ std::string message($1.begin(), $1.end());
- SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str());
- return $null; %}
+%{std::string message($1.size(), '\0');
+ for (size_t i = 0; i < $1.size(); ++i) {
+ message[i] = (char)$1[i];
+ }
+ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str());
+ return $null; %}
}
diff --git a/linux-x86/share/swig/java/swiginterface.i b/linux-x86/share/swig/java/swiginterface.i
index 3344641..c3ca97d 100644
--- a/linux-x86/share/swig/java/swiginterface.i
+++ b/linux-x86/share/swig/java/swiginterface.i
@@ -28,7 +28,7 @@
}
%typemap(javaout) CTYPE *const& {
long cPtr = $jnicall;
- return (cPtr == 0) ? null : ($javainterfacename)new $javaclassname(cPtr, $owner);
+ return (cPtr == 0) ? null : ($*javainterfacename)new $*javaclassname(cPtr, $owner);
}
%typemap(javadirectorin) CTYPE "($&javainterfacename)new $&javaclassname($jniinput, true)"
@@ -40,7 +40,7 @@
%typemap(javadirectorout) CTYPE *const& "$javacall.$*interfacename_GetInterfaceCPtr()"
%typemap(directorin,descriptor="L$packagepath/$&javainterfacename;") CTYPE
%{ $input = 0;
- *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %}
+ *(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %}
%typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE *, CTYPE []
%{ *(($&1_ltype)&$input) = ($1_ltype) $1; %}
%typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE &
diff --git a/linux-x86/share/swig/java/swigmove.i b/linux-x86/share/swig/java/swigmove.i
new file mode 100644
index 0000000..671b988
--- /dev/null
+++ b/linux-x86/share/swig/java/swigmove.i
@@ -0,0 +1,16 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in) SWIGTYPE MOVE ($&1_type argp)
+%{ argp = *($&1_ltype*)&$input;
+ if (!argp) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
+ return $null;
+ }
+ SwigValueWrapper< $1_ltype >::reset($1, argp); %}
+
+%typemap(javain) SWIGTYPE MOVE "$&javaclassname.swigRelease($javainput)"
diff --git a/linux-x86/share/swig/java/typemaps.i b/linux-x86/share/swig/java/typemaps.i
index e130c19..658a6b1 100644
--- a/linux-x86/share/swig/java/typemaps.i
+++ b/linux-x86/share/swig/java/typemaps.i
@@ -527,3 +527,23 @@ INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
%typemap(argout) unsigned long long *INOUT = unsigned long long *OUTPUT;
%typemap(argout) unsigned long long &INOUT = unsigned long long &OUTPUT;
+
+#if defined(SWIGWORDSIZE64)
+%apply long long *INPUT { long *INPUT };
+%apply unsigned long long *INPUT { unsigned long *INPUT };
+
+%apply long long &INPUT { long &INPUT };
+%apply unsigned long long &INPUT { unsigned long &INPUT };
+
+%apply long long *INOUT { long *INOUT };
+%apply unsigned long long *INOUT { unsigned long *INOUT };
+
+%apply long long &INOUT { long &INOUT };
+%apply unsigned long long &INOUT { unsigned long &INOUT };
+
+%apply long long *OUTPUT { long *OUTPUT };
+%apply unsigned long long *OUTPUT { unsigned long *OUTPUT };
+
+%apply long long &OUTPUT { long &OUTPUT };
+%apply unsigned long long &OUTPUT { unsigned long &OUTPUT };
+#endif
diff --git a/linux-x86/share/swig/javascript/jsc/argcargv.i b/linux-x86/share/swig/javascript/jsc/argcargv.i
new file mode 100644
index 0000000..dacecb0
--- /dev/null
+++ b/linux-x86/share/swig/javascript/jsc/argcargv.i
@@ -0,0 +1,67 @@
+/* ------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------ */
+
+%{
+SWIGINTERN int SWIG_AsVal_string SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, JSStringRef* str)
+{
+ if (!JSValueIsString SWIG_JSC_FROM_CALL_ARGS(obj)) {
+ return SWIG_TypeError;
+ }
+ if(str != SWIG_NULLPTR) {
+ *str = JSValueToStringCopy SWIG_JSC_AS_CALL_ARGS(obj, SWIG_NULLPTR);
+ }
+ return SWIG_OK;
+}
+%}
+
+%typemap(in) (int ARGC, char **ARGV) {
+ int i, len;
+ size_t arraysize;
+ JSObjectRef array;
+ if (!JSValueIsArray SWIG_JSC_FROM_CALL_ARGS($input)) {
+ SWIG_exception_fail(SWIG_ERROR, "not array");
+ }
+ array = JSValueToObject SWIG_JSC_AS_CALL_ARGS($input, SWIG_NULLPTR);
+ len = SWIGJSC_ArrayLength SWIG_JSC_FROM_CALL_ARGS(array);
+ arraysize = (len+1)*sizeof($*2_ltype);
+ $1 = len;
+ $2 = ($2_ltype) malloc(arraysize);
+ if ($2 == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_ERROR, "memory allocation of array failed");
+ }
+ memset($2, 0, arraysize);
+ for (i = 0; i < len; i++) {
+ int res, slen;
+ $*2_ltype pstr;
+ JSStringRef str;
+ JSValueRef jsvalue = JSObjectGetPropertyAtIndex(context, array, i, SWIG_NULLPTR);
+ res = SWIG_AsVal_string SWIG_JSC_AS_CALL_ARGS(jsvalue, &str);
+ if (!SWIG_IsOK(res)) {
+ SWIG_exception_fail(SWIG_ERROR, "failed to convert to string");
+ }
+ slen = JSStringGetMaximumUTF8CStringSize(str);
+ pstr = ($*2_ltype) malloc(slen);
+ if (pstr == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_ERROR, "memory allocation of a string failed");
+ }
+ if (slen) {
+ res = JSStringGetUTF8CString(str, pstr, slen);
+ if (res > slen) {
+ SWIG_exception_fail(SWIG_ERROR, "wrong string length");
+ }
+ }
+ $2[i] = pstr;
+ }
+ $2[i] = SWIG_NULLPTR;
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ if ($2 != SWIG_NULLPTR) {
+ $1_ltype i;
+ for (i = 0; i < $1; i++) {
+ free((void *)$2[i]);
+ }
+ free((void *)$2);
+ }
+}
diff --git a/linux-x86/share/swig/javascript/jsc/arrays_javascript.i b/linux-x86/share/swig/javascript/jsc/arrays_javascript.i
index b9199d8..713b7ef 100644
--- a/linux-x86/share/swig/javascript/jsc/arrays_javascript.i
+++ b/linux-x86/share/swig/javascript/jsc/arrays_javascript.i
@@ -21,34 +21,39 @@
* fs = example.FiddleSticks;
* ----------------------------------------------------------------------------- */
-%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {}
+
+%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {}
%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {}
+%fragment("SWIG_JSCOutInt", "header", fragment=SWIG_From_frag(int)) {}
+%fragment("SWIG_JSCOutNumber", "header", fragment=SWIG_From_frag(double)) {}
+
+%define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH)
-%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY]
- (int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
+%typemap(in, fragment=NAME) CTYPE[ANY] {
if (JSValueIsObject(context, $input))
{
+ int i;
// Convert into Array
- array = JSValueToObject(context, $input, NULL);
+ JSObjectRef array = JSValueToObject(context, $input, NULL);
- length = $1_dim0;
+ int length = ANYLENGTH;
$1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
// Get each element from array
for (i = 0; i < length; i++)
{
- jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL);
+ JSValueRef jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL);
+ $*1_ltype temp;
// Get primitive value from JSObject
- res = SWIG_AsVal(int)(jsvalue, &temp);
+ int res = SWIG_AsVal(CTYPE)(jsvalue, &temp);
if (!SWIG_IsOK(res))
{
SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
}
arg$argnum[i] = temp;
}
-
}
else
{
@@ -56,68 +61,34 @@
}
}
-%typemap(freearg) int[], int[ANY] {
+%typemap(freearg) CTYPE[ANY] {
free($1);
}
-%typemap(out, fragment=SWIG_From_frag(int)) int[], int[ANY] (int length = 0, int i = 0)
-{
- length = $1_dim0;
+%enddef
+
+%define JAVASCRIPT_ARRAYS_OUT_DECL(NAME, CTYPE)
+
+%typemap(out, fragment=NAME) CTYPE[ANY] {
+ int length = $1_dim0;
JSValueRef values[length];
+ int i;
for (i = 0; i < length; i++)
{
- values[i] = SWIG_From(int)($1[i]);
+ values[i] = SWIG_From(CTYPE)($1[i]);
}
$result = JSObjectMakeArray(context, length, values, NULL);
}
-%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY]
- (int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
- if (JSValueIsObject(context, $input))
- {
- // Convert into Array
- array = JSValueToObject(context, $input, NULL);
+%enddef
- length = $1_dim0;
-
- $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetIntProperty", int, , SWIGJSC_ArrayLength(context, array))
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetIntProperty", int, ANY, $1_dim0)
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetNumberProperty", double, , SWIGJSC_ArrayLength(context, array))
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetNumberProperty", double, ANY, $1_dim0)
- // Get each element from array
- for (i = 0; i < length; i++)
- {
- jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL);
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutInt", int)
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutNumber", double)
- // Get primitive value from JSObject
- res = SWIG_AsVal(double)(jsvalue, &temp);
- if (!SWIG_IsOK(res))
- {
- SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
- }
- arg$argnum[i] = temp;
- }
-
- }
- else
- {
- SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
- }
-}
-
-%typemap(freearg) double[], double[ANY] {
- free($1);
-}
-
-%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0)
-{
- length = $1_dim0;
- JSValueRef values[length];
-
- for (i = 0; i < length; i++)
- {
- values[i] = SWIG_From(double)($1[i]);
- }
-
- $result = JSObjectMakeArray(context, length, values, NULL);
-}
diff --git a/linux-x86/share/swig/javascript/jsc/ccomplex.i b/linux-x86/share/swig/javascript/jsc/ccomplex.i
index 50f0f95..e58dbf7 100644
--- a/linux-x86/share/swig/javascript/jsc/ccomplex.i
+++ b/linux-x86/share/swig/javascript/jsc/ccomplex.i
@@ -12,15 +12,16 @@
#include <complex.h>
%}
+#define complex _Complex
/* C complex constructor */
#define CCplxConst(r, i) ((r) + I*(i))
-%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag);
-%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag);
-%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
+%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag);
/* declaring the typemaps */
-%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex);
-%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex);
-%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex);
diff --git a/linux-x86/share/swig/javascript/jsc/cmalloc.i b/linux-x86/share/swig/javascript/jsc/cmalloc.i
new file mode 100644
index 0000000..248f06b
--- /dev/null
+++ b/linux-x86/share/swig/javascript/jsc/cmalloc.i
@@ -0,0 +1 @@
+%include <typemaps/cmalloc.swg>
diff --git a/linux-x86/share/swig/javascript/jsc/factory.i b/linux-x86/share/swig/javascript/jsc/factory.i
new file mode 100644
index 0000000..46a0a87
--- /dev/null
+++ b/linux-x86/share/swig/javascript/jsc/factory.i
@@ -0,0 +1 @@
+%include <typemaps/factory.swg>
diff --git a/linux-x86/share/swig/javascript/jsc/javascriptcode.swg b/linux-x86/share/swig/javascript/jsc/javascriptcode.swg
index 4050a6e..e560200 100644
--- a/linux-x86/share/swig/javascript/jsc/javascriptcode.swg
+++ b/linux-x86/share/swig/javascript/jsc/javascriptcode.swg
@@ -4,6 +4,7 @@
* - $jslocals: locals part of wrapper
* - $jscode: code part of wrapper
* - $jsargcount: number of arguments
+ * - $jsargrequired: required number of arguments
* - $jsmangledtype: mangled type of class
* ----------------------------------------------------------------------------- */
%fragment ("js_ctor", "templates")
@@ -11,7 +12,7 @@
static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
$jslocals
- if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ if (argc < $jsargrequired || argc > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN);
@@ -67,6 +68,7 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
* - $jslocals: locals part of wrapper
* - $jscode: code part of wrapper
* - $jsargcount: number of arguments
+ * - $jsargrequired: required number of arguments
* - $jsmangledtype: mangled type of class
* ----------------------------------------------------------------------------- */
%fragment ("js_overloaded_ctor", "templates")
@@ -86,13 +88,14 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size
/* -----------------------------------------------------------------------------
* js_ctor_dispatch_case: template for a dispatch case for calling an overloaded ctor.
* - $jsargcount: number of arguments of called ctor
+ * - $jsargrequired: required number of arguments
* - $jswrapper: wrapper of called ctor
*
* Note: a try-catch-like mechanism is used to switch cases
* ----------------------------------------------------------------------------- */
%fragment ("js_ctor_dispatch_case", "templates")
%{
- if(argc == $jsargcount) {
+ if(argc >= $jsargrequired && argc <= $jsargcount) {
thisObject = $jswrapper(context, NULL, argc, argv, exception);
if(thisObject != NULL) { *exception=0; return thisObject; } /* reset exception and return */
}
@@ -187,9 +190,11 @@ static bool $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef
/* -----------------------------------------------------------------------------
* js_function: template for function wrappers
- * - $jswrapper: wrapper function name
- * - $jslocals: locals part of wrapper
- * - $jscode: code part of wrapper
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jsargcount: number of arguments
+ * - $jsargrequired: required number of arguments
+ * - $jscode: code part of wrapper
* ----------------------------------------------------------------------------- */
%fragment ("js_function", "templates")
%{
@@ -198,7 +203,7 @@ static JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjec
$jslocals
JSValueRef jsresult;
- if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ if (argc < $jsargrequired || argc > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
return jsresult;
@@ -236,9 +241,11 @@ static JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjec
/* -----------------------------------------------------------------------------
* js_overloaded_function: template for a overloaded function
- * - $jswrapper: wrapper function name
- * - $jslocals: locals part of wrapper
- * - $jscode: code part of wrapper
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jsargcount: required number of arguments
+ * - $jsargrequired: required number of arguments
+ * - $jscode: code part of wrapper
* ----------------------------------------------------------------------------- */
%fragment ("js_overloaded_function", "templates")
%{
@@ -247,7 +254,7 @@ static int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th
$jslocals
JSValueRef jsresult;
- if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ if (argc < $jsargrequired || argc > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
*p_result = jsresult;
@@ -261,19 +268,27 @@ static int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th
/* -----------------------------------------------------------------------------
* js_function_dispatch_case: template for a case used in the function dispatcher
- * - $jswrapper: wrapper function name
- * - $jsargcount: number of arguments of overloaded function
- * - $jscode: code part of wrapper
+ * - $jswrapper: wrapper function name
+ * - $jsargcount: number of arguments of overloaded function
+ * - $jsargrequired: required number of arguments
+ * - $jscode: code part of wrapper
* ----------------------------------------------------------------------------- */
%fragment ("js_function_dispatch_case", "templates")
%{
- if(argc == $jsargcount) {
+ if(argc >= $jsargrequired && argc <= $jsargcount) {
res = $jswrapper(context, function, thisObject, argc, argv, exception, &jsresult);
if(res == SWIG_OK) { *exception = 0; return jsresult; }
}
%}
/* -----------------------------------------------------------------------------
+ * js_check_arg: template for checking if an argument exists
+ * - $jsarg: number of argument
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_check_arg", "templates")
+%{if(argc > $jsarg)%}
+
+/* -----------------------------------------------------------------------------
* jsc_variable_declaration: template for a variable table entry
* - $jsname: name of the variable
* - $jsgetter: wrapper of getter function
diff --git a/linux-x86/share/swig/javascript/jsc/javascriptcomplex.swg b/linux-x86/share/swig/javascript/jsc/javascriptcomplex.swg
index 7be120b..dcc205d 100644
--- a/linux-x86/share/swig/javascript/jsc/javascriptcomplex.swg
+++ b/linux-x86/share/swig/javascript/jsc/javascriptcomplex.swg
@@ -127,7 +127,7 @@ SWIG_AsVal_dec(Type)(JSValueRef o, Type *val)
float re;
int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
if (SWIG_IsOK(res)) {
- if (val) *val = Constructor(re, 0.0);
+ if (val) *val = Constructor(re, 0.0f);
return res;
}
}
diff --git a/linux-x86/share/swig/javascript/jsc/javascripthelpers.swg b/linux-x86/share/swig/javascript/jsc/javascripthelpers.swg
index 4576543..bdd5142 100644
--- a/linux-x86/share/swig/javascript/jsc/javascripthelpers.swg
+++ b/linux-x86/share/swig/javascript/jsc/javascripthelpers.swg
@@ -46,7 +46,7 @@ SWIGINTERN bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObjec
int res;
JSStringGetUTF8CString(propertyName, buffer, 256);
- res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
+ res = SWIG_snprintf(msg, sizeof(msg), "Tried to write read-only variable: %s.", buffer);
if(res<0) {
SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
diff --git a/linux-x86/share/swig/javascript/jsc/javascriptinit.swg b/linux-x86/share/swig/javascript/jsc/javascriptinit.swg
index a32ba33..b0138b3 100644
--- a/linux-x86/share/swig/javascript/jsc/javascriptinit.swg
+++ b/linux-x86/share/swig/javascript/jsc/javascriptinit.swg
@@ -1,14 +1,59 @@
%insert(init) %{
SWIGRUNTIME void
-SWIG_JSC_SetModule(swig_module_info *swig_module) {}
+SWIG_JSC_SetModule(JSGlobalContextRef context, swig_module_info *swig_module) {
+ JSObjectRef globalObject;
+ JSStringRef moduleName;
+ JSClassDefinition classDef;
+ JSClassRef classRef;
+ JSObjectRef object;
+ if(context == 0){
+ return;
+ }
+
+ globalObject = JSContextGetGlobalObject(context);
+ moduleName = JSStringCreateWithUTF8CString("swig_module_info_data");
+
+ classDef = kJSClassDefinitionEmpty;
+ classRef = JSClassCreate(&classDef);
+
+ object = JSObjectMake(context, classRef, NULL);
+ JSObjectSetPrivate(object, (void*)swig_module);
+
+ JSObjectSetProperty(context, globalObject, moduleName, object, kJSPropertyAttributeNone, NULL);
+
+ JSClassRelease(classRef);
+ JSStringRelease(moduleName);
+}
SWIGRUNTIME swig_module_info *
-SWIG_JSC_GetModule(void) {
- return 0;
+SWIG_JSC_GetModule(JSGlobalContextRef context) {
+ JSObjectRef globalObject;
+ JSStringRef moduleName;
+ JSValueRef value;
+ JSObjectRef object;
+
+ if(context == 0){
+ return 0;
+ }
+
+ globalObject = JSContextGetGlobalObject(context);
+ moduleName = JSStringCreateWithUTF8CString("swig_module_info_data");
+
+ if(JSObjectHasProperty(context, globalObject, moduleName) == false) {
+ JSStringRelease(moduleName);
+ return 0;
+ }
+
+ value = JSObjectGetProperty(context, globalObject, moduleName, NULL);
+ object = JSValueToObject(context, value, NULL);
+ JSStringRelease(moduleName);
+
+ return (swig_module_info*)JSObjectGetPrivate(object);
}
-#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule()
-#define SWIG_SetModule(clientdata, pointer) SWIG_JSC_SetModule(pointer)
+#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer) SWIG_JSC_SetModule(clientdata, pointer)
+#define SWIG_INIT_CLIENT_DATA_TYPE JSGlobalContextRef
%}
%insert(init) "swiginit.swg"
@@ -26,7 +71,7 @@ extern "C" {
#endif
bool SWIGJSC_INIT (JSGlobalContextRef context, JSObjectRef *exports) {
- SWIG_InitializeModule(0);
+ SWIG_InitializeModule(context);
%}
/* -----------------------------------------------------------------------------
diff --git a/linux-x86/share/swig/javascript/jsc/javascriptkw.swg b/linux-x86/share/swig/javascript/jsc/javascriptkw.swg
deleted file mode 100644
index c3c1183..0000000
--- a/linux-x86/share/swig/javascript/jsc/javascriptkw.swg
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef JAVASCRIPT_JAVASCRIPTKW_SWG_
-#define JAVASCRIPT_JAVASCRIPTKW_SWG_
-
-/* Warnings for Java keywords */
-#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",rename="_%s") `x`
-
-/* Taken from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words */
-
-JAVASCRIPTKW(break);
-JAVASCRIPTKW(case);
-JAVASCRIPTKW(catch);
-JAVASCRIPTKW(continue);
-JAVASCRIPTKW(default);
-JAVASCRIPTKW(delete);
-JAVASCRIPTKW(do);
-JAVASCRIPTKW(else);
-JAVASCRIPTKW(finally);
-JAVASCRIPTKW(for);
-JAVASCRIPTKW(function);
-JAVASCRIPTKW(if);
-JAVASCRIPTKW(in);
-JAVASCRIPTKW(instanceof);
-JAVASCRIPTKW(new);
-JAVASCRIPTKW(return);
-JAVASCRIPTKW(switch);
-JAVASCRIPTKW(this);
-JAVASCRIPTKW(throw);
-JAVASCRIPTKW(try);
-JAVASCRIPTKW(typeof);
-JAVASCRIPTKW(var);
-JAVASCRIPTKW(void);
-JAVASCRIPTKW(while);
-JAVASCRIPTKW(with);
-
-/* others bad names if any*/
-// for example %namewarn("321:clone() is a javascript bad method name") *::clone();
-
-#undef JAVASCRIPTKW
-
-#endif //JAVASCRIPT_JAVASCRIPTKW_SWG_
diff --git a/linux-x86/share/swig/javascript/jsc/javascriptrun.swg b/linux-x86/share/swig/javascript/jsc/javascriptrun.swg
index 4a8fc5b..ee68c57 100644
--- a/linux-x86/share/swig/javascript/jsc/javascriptrun.swg
+++ b/linux-x86/share/swig/javascript/jsc/javascriptrun.swg
@@ -7,23 +7,27 @@
#define SWIG_exception(code, msg) do { SWIG_JSC_exception(context, exception, code, msg); SWIG_fail; } while (0)
#define SWIG_fail goto fail
-SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) {
- JSStringRef message = JSStringCreateWithUTF8CString(type);
+SWIGRUNTIME void SWIG_Javascript_Raise_ValueRef(JSContextRef context, JSValueRef *exception, JSValueRef valRef) {
JSValueRef error_arguments[1];
JSObjectRef exception_object;
- JSValueRef exception_value;
- exception_value = JSValueMakeString(context, message);
/* Converting the result to an object will let JavascriptCore add
"sourceURL" (file) and "line" (number) and "message" to the exception,
instead of just returning a raw string. This is extremely important for debugging your errors.
Using JSObjectMakeError is better than JSValueToObject because the latter only populates
"sourceURL" and "line", but not "message" or any others I don't know about.
*/
- error_arguments[0] = exception_value;
+ error_arguments[0] = valRef;
exception_object = JSObjectMakeError(context, 1, error_arguments, NULL);
/* Return the exception_object */
*exception = exception_object;
+}
+
+SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* msg) {
+ JSStringRef message = JSStringCreateWithUTF8CString(msg);
+ JSValueRef exception_value = JSValueMakeString(context, message);
+
+ SWIG_Javascript_Raise_ValueRef(context, exception, exception_value);
JSStringRelease(message);
}
@@ -117,28 +121,33 @@ SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef ob
SwigPrivData *cdata;
cdata = (SwigPrivData *) JSObjectGetPrivate(objRef);
- if(cdata == NULL) {
+ if (cdata == NULL) {
return SWIG_ERROR;
}
- if(cdata->info != info) {
- bool type_valid = false;
- swig_cast_info *t = info->cast;
- while(t != NULL) {
- if(t->type == cdata->info) {
- type_valid = true;
- break;
- }
- t = t->next;
- }
- if(!type_valid) {
- return SWIG_TypeError;
+ assert(ptr);
+ *ptr = NULL;
+ if (!info || cdata->info == info) {
+ *ptr = cdata->swigCObject;
+ } else {
+ swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, cdata->swigCObject, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ return SWIG_ERROR;
}
}
- *ptr = cdata->swigCObject;
-
- if(flags & SWIG_POINTER_DISOWN) {
- cdata->swigCMemOwn = false;
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !cdata->swigCMemOwn) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ } else {
+ if (flags & SWIG_POINTER_DISOWN) {
+ cdata->swigCMemOwn = false;
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ cdata->swigCObject = 0;
+ }
}
return SWIG_OK;
@@ -264,11 +273,12 @@ int SWIG_JSC_ConvertPacked(JSContextRef context, JSValueRef valRef, void *ptr, s
SWIGRUNTIME
JSValueRef SWIG_JSC_NewPackedObj(JSContextRef context, void *data, size_t size, swig_type_info *type) {
- JSClassRef classRef = _SwigObject_classRef;
+ JSClassRef classRef = _SwigPackedData_classRef;
JSObjectRef result = JSObjectMake(context, classRef, NULL);
SwigPackedData* cdata = (SwigPackedData*) malloc(sizeof(SwigPackedData));
- cdata->data = data;
+ cdata->data = malloc(size);
+ memcpy(cdata->data, data, size);
cdata->size = size;
cdata->type = type;
@@ -318,12 +328,38 @@ unsigned int SWIGJSC_ArrayLength(JSContextRef context, JSObjectRef arr) {
}
SWIGRUNTIME
+bool SWIGJSC_ValueIsArray(JSContextRef context, JSValueRef value) {
+ if (JSValueIsObject(context, value)) {
+ static JSStringRef ArrayString = NULL;
+ static JSStringRef isArrayString = NULL;
+ JSObjectRef array = NULL;
+ JSObjectRef isArray = NULL;
+ JSValueRef retval = NULL;
+
+ if (!ArrayString)
+ ArrayString = JSStringCreateWithUTF8CString("Array");
+ if (!isArrayString)
+ isArrayString = JSStringCreateWithUTF8CString("isArray");
+
+ array = (JSObjectRef)JSObjectGetProperty(context, JSContextGetGlobalObject(context), ArrayString, NULL);
+ isArray = (JSObjectRef)JSObjectGetProperty(context, array, isArrayString, NULL);
+ retval = JSObjectCallAsFunction(context, isArray, NULL, 1, &value, NULL);
+
+ if (JSValueIsBoolean(context, retval))
+ return JSValueToBoolean(context, retval);
+ }
+ return false;
+}
+
+SWIGRUNTIME
JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueRef obj) {
JSObjectRef arr;
unsigned int length;
if (JSValueIsUndefined(context, value)) {
arr = JSObjectMakeArray(context, 0, 0, 0);
+ } else if (!SWIGJSC_ValueIsArray(context, value)) {
+ arr = JSObjectMakeArray(context, 1, &value, 0);
} else {
arr = JSValueToObject(context, value, 0);
}
diff --git a/linux-x86/share/swig/javascript/jsc/javascriptruntime.swg b/linux-x86/share/swig/javascript/jsc/javascriptruntime.swg
index 8f83908..a626390 100644
--- a/linux-x86/share/swig/javascript/jsc/javascriptruntime.swg
+++ b/linux-x86/share/swig/javascript/jsc/javascriptruntime.swg
@@ -11,6 +11,7 @@
#include <string.h>
#include <errno.h>
#include <limits.h>
+#include <assert.h>
%}
%insert(runtime) "swigrun.swg"; /* SWIG API */
diff --git a/linux-x86/share/swig/javascript/jsc/javascriptstrings.swg b/linux-x86/share/swig/javascript/jsc/javascriptstrings.swg
index 55c8e4b..5c8081a 100644
--- a/linux-x86/share/swig/javascript/jsc/javascriptstrings.swg
+++ b/linux-x86/share/swig/javascript/jsc/javascriptstrings.swg
@@ -75,6 +75,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz
}
%define %_typemap2_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -166,6 +167,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
%_typemap_string(StringCode,
Char,
+ WarningLeakMsg,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
diff --git a/linux-x86/share/swig/javascript/jsc/javascripttypemaps.swg b/linux-x86/share/swig/javascript/jsc/javascripttypemaps.swg
index e8fbbec..fd8e7aa 100644
--- a/linux-x86/share/swig/javascript/jsc/javascripttypemaps.swg
+++ b/linux-x86/share/swig/javascript/jsc/javascripttypemaps.swg
@@ -41,7 +41,7 @@
#define SWIG_SetConstant(name, obj)
/* raise */
-#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise(context, exception, type)
+#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise_ValueRef(context, exception, obj)
%insert("runtime") %{
#define SWIG_JSC_FROM_DECL_ARGS(arg1) (JSContextRef context, arg1)
diff --git a/linux-x86/share/swig/javascript/jsc/std_auto_ptr.i b/linux-x86/share/swig/javascript/jsc/std_auto_ptr.i
new file mode 100644
index 0000000..3d7ae8b
--- /dev/null
+++ b/linux-x86/share/swig/javascript/jsc/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/javascript/jsc/std_map.i b/linux-x86/share/swig/javascript/jsc/std_map.i
index 9fa1088..a679f44 100644
--- a/linux-x86/share/swig/javascript/jsc/std_map.i
+++ b/linux-x86/share/swig/javascript/jsc/std_map.i
@@ -49,7 +49,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -65,17 +69,4 @@ namespace std {
}
};
-// 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/linux-x86/share/swig/javascript/jsc/std_unique_ptr.i b/linux-x86/share/swig/javascript/jsc/std_unique_ptr.i
new file mode 100644
index 0000000..f988714
--- /dev/null
+++ b/linux-x86/share/swig/javascript/jsc/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/javascript/jsc/swigmove.i b/linux-x86/share/swig/javascript/jsc/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/javascript/jsc/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/javascript/jsc/typemaps.i b/linux-x86/share/swig/javascript/jsc/typemaps.i
index d3d8afb..08b5838 100644
--- a/linux-x86/share/swig/javascript/jsc/typemaps.i
+++ b/linux-x86/share/swig/javascript/jsc/typemaps.i
@@ -18,7 +18,7 @@ you would use a real value instead.
int *INPUT
short *INPUT
long *INPUT
- long long *INPUT
+ long long *INPUT
unsigned int *INPUT
unsigned short *INPUT
unsigned long *INPUT
@@ -72,7 +72,7 @@ multiple output values, they are returned in the form of a Python tuple.
For example, suppose you were trying to wrap the modf() function in the
C math library which splits x into integral and fractional parts (and
-returns the integer part in one of its parameters).K:
+returns the integer part in one of its parameters) :
double modf(double x, double *ip);
@@ -139,10 +139,6 @@ to a Python variable you might do this :
x = neg(x)
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
*/
%include <typemaps/typemaps.swg>
diff --git a/linux-x86/share/swig/javascript/napi/argcargv.i b/linux-x86/share/swig/javascript/napi/argcargv.i
new file mode 100644
index 0000000..4a14604
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/argcargv.i
@@ -0,0 +1,66 @@
+/* ------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------ */
+
+%{
+SWIGINTERN int SWIG_AsVal_string (Napi::Value valRef, Napi::String *str)
+{
+ if (!valRef.IsString()) {
+ return SWIG_TypeError;
+ }
+ if(str != SWIG_NULLPTR) {
+ *str = valRef.ToString();
+ }
+ return SWIG_OK;
+}
+%}
+
+%typemap(in) (int ARGC, char **ARGV) {
+ $1_ltype i, len;
+ size_t arraysize;
+ Napi::Array array;
+ if (!$input.IsArray()) {
+ SWIG_exception_fail(SWIG_ERROR, "not array");
+ }
+ array = $input.As<Napi::Array>();
+ len = array.Length();
+ arraysize = (len+1)*sizeof($*2_ltype);
+ $1 = len;
+ $2 = ($2_ltype) malloc(arraysize);
+ if ($2 == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_ERROR, "memory allocation of array failed");
+ }
+ memset($2, 0, arraysize);
+ for (i = 0; i < len; i++) {
+ int res, slen;
+ $*2_ltype pstr;
+ Napi::String napi_str;
+ Napi::Value jsvalue = array.Get(i);
+ res = SWIG_AsVal_string(jsvalue, &napi_str);
+ if (!SWIG_IsOK(res)) {
+ SWIG_exception_fail(SWIG_ERROR, "failed to convert to string");
+ }
+ std::string str = napi_str.Utf8Value();
+ slen = str.size();
+ pstr = ($*2_ltype) malloc(slen + 1);
+ if (pstr == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_ERROR, "memory allocation of a string failed");
+ }
+ if (slen) {
+ memcpy(pstr, str.c_str(), slen);
+ }
+ pstr[slen] = 0;
+ $2[i] = pstr;
+ }
+ $2[i] = SWIG_NULLPTR;
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ if ($2 != SWIG_NULLPTR) {
+ $1_ltype i;
+ for (i = 0; i < $1; i++) {
+ free((void *)$2[i]);
+ }
+ free((void *)$2);
+ }
+}
diff --git a/linux-x86/share/swig/javascript/napi/arrays_javascript.i b/linux-x86/share/swig/javascript/napi/arrays_javascript.i
new file mode 100644
index 0000000..c020978
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/arrays_javascript.i
@@ -0,0 +1,88 @@
+/* -----------------------------------------------------------------------------
+ * arrays_javascript.i
+ *
+ * These typemaps give more natural support for arrays. The typemaps are not efficient
+ * as there is a lot of copying of the array values whenever the array is passed to C/C++
+ * from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array.
+ * An exception is thrown if they are not.
+ *
+ * Example usage:
+ * Wrapping:
+ *
+ * %include <arrays_javascript.i>
+ * %inline %{
+ * extern int FiddleSticks[3];
+ * %}
+ *
+ * Use from JavaScript like this:
+ *
+ * var fs = [10, 11, 12];
+ * example.FiddleSticks = fs;
+ * fs = example.FiddleSticks;
+ * ----------------------------------------------------------------------------- */
+
+
+%fragment("SWIG_NAPI_GetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {}
+%fragment("SWIG_NAPI_GetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {}
+%fragment("SWIG_NAPI_OutInt", "header", fragment=SWIG_From_frag(int)) {}
+%fragment("SWIG_NAPI_OutNumber", "header", fragment=SWIG_From_frag(double)) {}
+
+%define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH)
+
+%typemap(in, fragment=NAME) CTYPE[ANY] {
+ if ($input.IsArray()) {
+ Napi::Env env = $input.Env();
+ // Convert into Array
+ Napi::Array array = $input.As<Napi::Array>();
+
+ int length = ANYLENGTH;
+
+ $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
+
+ // Get each element from array
+ for (int i = 0; i < length; i++) {
+ Napi::Value jsvalue = array.Get(i);
+ $*1_ltype temp;
+
+ // Get primitive value from JSObject
+ int res = SWIG_AsVal(CTYPE)(jsvalue, &temp);
+ if (!SWIG_IsOK(res)) {
+ SWIG_Error(SWIG_ERROR, "Failed to convert $input to double");
+ }
+ arg$argnum[i] = temp;
+ }
+ } else {
+ Napi::Env env = $input.Env();
+ SWIG_Error(SWIG_ERROR, "$input is not an array");
+ }
+}
+
+%typemap(freearg) CTYPE[ANY] {
+ free($1);
+}
+
+%enddef
+
+%define JAVASCRIPT_ARRAYS_OUT_DECL(NAME, CTYPE)
+
+%typemap(out, fragment=NAME) CTYPE[ANY] {
+ int length = $1_dim0;
+ Napi::Array array = Napi::Array::New(env, length);
+
+ for (int i = 0; i < length; i++) {
+ array.Set(i, SWIG_From(CTYPE)($1[i]));
+ }
+
+ $result = array;
+}
+
+%enddef
+
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_NAPI_GetIntProperty", int, , array.Length())
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_NAPI_GetIntProperty", int, ANY, $1_dim0)
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_NAPI_GetNumberProperty", double, , array.Length())
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_NAPI_GetNumberProperty", double, ANY, $1_dim0)
+
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_NAPI_OutInt", int)
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_NAPI_OutNumber", double)
+
diff --git a/linux-x86/share/swig/javascript/napi/ccomplex.i b/linux-x86/share/swig/javascript/napi/ccomplex.i
new file mode 100644
index 0000000..e58dbf7
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/ccomplex.i
@@ -0,0 +1,27 @@
+/* -----------------------------------------------------------------------------
+ * ccomplex.i
+ *
+ * C complex typemaps
+ * ISO C99: 7.3 Complex arithmetic <complex.h>
+ * ----------------------------------------------------------------------------- */
+
+
+%include <javascriptcomplex.swg>
+
+%{
+#include <complex.h>
+%}
+
+#define complex _Complex
+
+/* C complex constructor */
+#define CCplxConst(r, i) ((r) + I*(i))
+
+%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag);
+
+/* declaring the typemaps */
+%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex);
diff --git a/linux-x86/share/swig/javascript/napi/cdata.i b/linux-x86/share/swig/javascript/napi/cdata.i
new file mode 100644
index 0000000..3679659
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/cdata.i
@@ -0,0 +1 @@
+%include <typemaps/cdata.swg>
diff --git a/linux-x86/share/swig/javascript/napi/cmalloc.i b/linux-x86/share/swig/javascript/napi/cmalloc.i
new file mode 100644
index 0000000..248f06b
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/cmalloc.i
@@ -0,0 +1 @@
+%include <typemaps/cmalloc.swg>
diff --git a/linux-x86/share/swig/javascript/napi/complex.i b/linux-x86/share/swig/javascript/napi/complex.i
new file mode 100644
index 0000000..4c3b3c5
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/complex.i
@@ -0,0 +1,6 @@
+#ifdef __cplusplus
+%include <std_complex.i>
+#else
+%include <ccomplex.i>
+#endif
+
diff --git a/linux-x86/share/swig/javascript/napi/exception.i b/linux-x86/share/swig/javascript/napi/exception.i
new file mode 100644
index 0000000..0246cfd
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/exception.i
@@ -0,0 +1 @@
+%include <typemaps/exception.swg>
diff --git a/linux-x86/share/swig/javascript/napi/factory.i b/linux-x86/share/swig/javascript/napi/factory.i
new file mode 100644
index 0000000..46a0a87
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/factory.i
@@ -0,0 +1 @@
+%include <typemaps/factory.swg>
diff --git a/linux-x86/share/swig/javascript/napi/javascript.swg b/linux-x86/share/swig/javascript/napi/javascript.swg
new file mode 100644
index 0000000..c37a384
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascript.swg
@@ -0,0 +1,17 @@
+/* -----------------------------------------------------------------------------
+ * javascript.swg
+ *
+ * Javascript typemaps
+ * ----------------------------------------------------------------------------- */
+
+%include <typemaps/swigmacros.swg>
+
+%include <javascripttypemaps.swg>
+
+%include <javascriptruntime.swg>
+
+%include <javascriptkw.swg>
+
+%include <javascriptcode.swg>
+
+%include <javascriptinit.swg>
diff --git a/linux-x86/share/swig/javascript/napi/javascriptcode.swg b/linux-x86/share/swig/javascript/napi/javascriptcode.swg
new file mode 100644
index 0000000..26e8ade
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascriptcode.swg
@@ -0,0 +1,880 @@
+/* -----------------------------------------------------------------------------
+ * js_ctor: template for wrapping a ctor.
+ * - $jswrapper: wrapper of called ctor
+ * - $jsparent: mangled name of parent (or SWIG_NAPI_ObjectWrap if none)
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * - $jsargcount: number of arguments
+ * - $jsargrequired: minimum number of arguments
+ * - $jsmangledname: mangled name of class
+ * - $jsmangledtype: mangled type of class
+ * ----------------------------------------------------------------------------- */
+
+%fragment("js_ctor", "templates") %{
+template <typename SWIG_OBJ_WRAP>
+// js_ctor
+// This is the main constructor
+$jsmangledname_templ<SWIG_OBJ_WRAP>::$jsmangledname_templ(const Napi::CallbackInfo &info)
+ : $jsparent_templ<SWIG_OBJ_WRAP>(true, info) {
+ Napi::Env env = info.Env();
+
+ this->info = SWIGTYPE_$jsmangledtype;
+ if (info.Length() == 1 && info[0].IsExternal()) {
+ // This constructor has been called internally from C++/SWIG
+ // to wrap an already existing C++ object in JS
+ this->self = info[0].As<Napi::External<void>>().Data();
+ this->owned = false;
+ return;
+ }
+ this->owned = true;
+
+ $jslocals
+ if(static_cast<int>(info.Length()) < $jsargrequired || static_cast<int>(info.Length()) > $jsargcount) {
+ SWIG_Error(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ }
+ $jscode
+ this->self = result;
+ return;
+ goto fail;
+fail:
+ return;
+}
+
+// This is the bypass constructor to be used from child classes
+template <typename SWIG_OBJ_WRAP>
+$jsmangledname_templ<SWIG_OBJ_WRAP>::$jsmangledname_templ(bool, const Napi::CallbackInfo &info)
+ : $jsparent_templ<SWIG_OBJ_WRAP>(true, info) {}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_veto_ctor: a vetoing ctor for abstract classes
+ * - $jsmangledname: mangled name of class
+ * - $jsparent: mangled name of parent (or SWIG_NAPI_ObjectWrap if none)
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_veto_ctor", "templates")
+%{
+// js_veto_ctor
+template <typename SWIG_OBJ_WRAP>
+$jsmangledname_templ<SWIG_OBJ_WRAP>::$jsmangledname_templ(const Napi::CallbackInfo &info)
+ : $jsparent_templ<SWIG_OBJ_WRAP>(true, info) {
+ Napi::Env env = info.Env();
+ if (info.Length() == 1 && info[0].IsExternal()) {
+ // This constructor has been called internally from C++/SWIG
+ // to wrap an already existing C++ object in JS as its
+ // base abstract class
+ this->self = info[0].As<Napi::External<void>>().Data();
+ this->owned = false;
+ return;
+ }
+ SWIG_Error(SWIG_ERROR, "Class $jsname can not be instantiated");
+ return;
+ goto fail;
+fail:
+ return;
+}
+
+// This is the extendable constructor to be used from child classes
+template <typename SWIG_OBJ_WRAP>
+$jsmangledname_templ<SWIG_OBJ_WRAP>::$jsmangledname_templ(bool, const Napi::CallbackInfo &info)
+ : $jsparent_templ<SWIG_OBJ_WRAP>(true, info) {
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_ctor_dispatcher: dispatcher for overloaded constructors
+ * - $jsmangledname: mangled name of class
+ * - $jsparent: mangled name of parent (or SWIG_NAPI_ObjectWrap if none)
+ * - $jsdispatchcases: part containing code for dispatching
+ * - $jsmangledtype: mangled type of class
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_ctor_dispatcher", "templates")
+%{
+// js_ctor_dispatcher
+template <typename SWIG_OBJ_WRAP>
+$jsmangledname_templ<SWIG_OBJ_WRAP>::$jsmangledname_templ(const Napi::CallbackInfo &info)
+ : $jsparent_templ<SWIG_OBJ_WRAP>(true, info) {
+ Napi::Env env = info.Env();
+ Napi::Object self;
+ NAPI_CHECK_RESULT(info.This().ToObject(), self);
+ this->info = SWIGTYPE_$jsmangledtype;
+ if (info.Length() == 1 && info[0].IsExternal()) {
+ // This constructor has been called internally from C++/SWIG
+ // to wrap an already existing C++ object in JS
+ this->self = info[0].As<Napi::External<void>>().Data();
+ this->owned = false;
+ return;
+ }
+
+ // switch all cases by means of series of if-returns.
+ $jsdispatchcases
+
+ // default:
+ SWIG_Error(SWIG_ERROR, "Illegal arguments for construction of $jsmangledname");
+
+ goto fail;
+fail:
+ return;
+}
+
+// This is the extendable constructor to be used from child classes
+template <typename SWIG_OBJ_WRAP>
+$jsmangledname_templ<SWIG_OBJ_WRAP>::$jsmangledname_templ(bool, const Napi::CallbackInfo &info)
+ : $jsparent_templ<SWIG_OBJ_WRAP>(true, info) {
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_overloaded_ctor: template for wrapping a ctor.
+ * - $jswrapper: wrapper of called ctor
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * - $jsargcount: number of arguments
+ * - $jsargrequired: minimum number of arguments
+ * - $jsmangledtype: mangled type of class
+ * ----------------------------------------------------------------------------- */
+%fragment("js_overloaded_ctor", "templates") %{
+// js_overloaded_ctor
+template <typename SWIG_OBJ_WRAP>
+Napi::Value $jsmangledname_templ<SWIG_OBJ_WRAP>::$jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Object self;
+ $jslocals
+ NAPI_CHECK_RESULT(info.This().ToObject(), self);
+ this->owned = true;
+ if(static_cast<int>(info.Length()) < $jsargrequired || static_cast<int>(info.Length()) > $jsargcount) {
+ SWIG_Error(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ }
+ $jscode
+ this->self = result;
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_ctor_dispatch_case: template for a dispatch case for calling an overloaded ctor.
+ * - $jsargcount: number of arguments of called ctor
+ * - $jsargrequired: minimum number of arguments
+ * - $jswrapper: wrapper of called ctor
+ *
+ * Note: a try-catch-like mechanism is used to switch cases
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_ctor_dispatch_case", "templates")
+%{
+ // js_ctor_dispatch_case
+ if(static_cast<int>(info.Length()) >= $jsargrequired && static_cast<int>(info.Length()) <= $jsargcount) {
+#ifdef NAPI_CPP_EXCEPTIONS
+ bool tryNext = false;
+ try {
+ $jswrapper(info);
+ } catch (const Napi::TypeError &) {
+ tryNext = true;
+ } catch (const Napi::Error &e) {
+ throw e;
+ }
+ if (!tryNext)
+ return;
+#else
+ $jswrapper(info);
+ if (env.IsExceptionPending()) {
+ Napi::Error e = env.GetAndClearPendingException();
+ Napi::Value typeErrorValue;
+ bool isTypeError;
+ Napi::Function typeErrorCons;
+ // Yes, this is ugly
+ // TODO: Fix this in Node.js when the core team grows up
+ NAPI_CHECK_RESULT(env.Global().Get("TypeError"), typeErrorValue);
+ typeErrorCons = typeErrorValue.As<Napi::Function>();
+ NAPI_CHECK_RESULT(e.Value().InstanceOf(typeErrorCons), isTypeError);
+ if (!isTypeError) {
+ // This is not the error you are looking for
+ e.ThrowAsJavaScriptException();
+ SWIG_fail;
+ }
+ } else {
+ return;
+ }
+#endif
+ }
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_check_arg: template for checking if an argument exists
+ * - $jsarg: number of argument
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_check_arg", "templates")
+%{if(info.Length() > $jsarg)%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_dtor: template for a destructor wrapper
+ * - $jsmangledname: mangled class name
+ * - $jstype: class type
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_dtor", "templates")
+%{
+// js_dtor
+template <typename SWIG_OBJ_WRAP>
+$jsmangledname_templ<SWIG_OBJ_WRAP>::~$jsmangledname_templ() {
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_dtoroverride: template for a destructor wrapper
+ * - ${classname_mangled}: mangled class name
+ * - $jstype: class type
+ * - ${destructor_action}: The custom destructor action to invoke.
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_dtoroverride", "templates")
+%{
+// js_dtoroverride
+template <typename SWIG_OBJ_WRAP>
+${classname_mangled}_templ<SWIG_OBJ_WRAP>::~${classname_mangled}_templ() {
+ auto arg1 = reinterpret_cast<$jstype>(this->self);
+ if (this->owned && arg1) {
+ ${destructor_action}
+ this->self = nullptr;
+ }
+}
+%}
+
+/* -----------------------------------------------------------------------------
+ * js_global_getter: template for global getter function wrappers
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment("js_global_getter", "templates")
+%{
+// js_global_getter
+Napi::Value $jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jslocals
+ $jscode
+ return jsresult;
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_global_setter: template for global setter function wrappers
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment("js_global_setter", "templates")
+%{
+// js_global_setter
+void $jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value value = info.Length() > 0 ? info[0] : Napi::Value();
+ Napi::Value jsresult;
+ $jslocals
+ $jscode
+ return;
+
+ goto fail;
+fail:
+ return;
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_register_global_variable: template for a statement that registers a global variable
+ * - $jsname: variable name
+ * - $jsparent: parent namespace
+ * - $jsgetter: wrapper of the getter function
+ * - $jssetter: wrapper of the setter function
+ *
+ * Note: this template is also used for global variables.
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_register_global_variable", "templates")
+%{
+ // jsnapi_register_global_variable
+ do {
+ Napi::PropertyDescriptor pd = Napi::PropertyDescriptor::Accessor<$jsgetter, $jssetter>("$jsname");
+ NAPI_CHECK_MAYBE($jsparent.DefineProperties({pd}));
+ } while (0);
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_global_function: template for function wrappers
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jsargcount: number of arguments
+ * - $jsargrequired: minimum number of arguments
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment("js_global_function", "templates")
+%{
+// js_global_function
+Napi::Value $jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jslocals
+ if(static_cast<int>(info.Length()) < $jsargrequired || static_cast<int>(info.Length()) > $jsargcount) {
+ SWIG_Error(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ }
+
+ $jscode
+ return jsresult;
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_global_function_dispatcher: template for a global function dispatcher for
+ * global overloaded functions
+ * - $jswrapper: wrapper function name
+ * - $jsname: name of the wrapped function
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment("js_global_function_dispatcher", "templates")
+%{
+// js_global_function_dispatcher
+Napi::Value $jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jscode
+
+ SWIG_Error(SWIG_ERROR, "Illegal arguments for function $jsname.");
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_register_global_function: template for a statement that registers a global function
+ * - $jsname: function name
+ * - $jsparent: parent namespace
+ * - $jswrapper: name of the JS wrapper
+ *
+ * Note: this template is also used for global variables.
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_register_global_function", "templates")
+%{
+ // jsnapi_register_global_function
+ do {
+ Napi::PropertyDescriptor pd = Napi::PropertyDescriptor::Function("$jsname", $jswrapper);
+ NAPI_CHECK_MAYBE($jsparent.DefineProperties({pd}));
+ } while (0);
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_getter: template for getter function wrappers
+ * - $jsmangledname: mangled class name
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment("js_getter", "templates")
+%{
+// js_getter
+template <typename SWIG_OBJ_WRAP>
+Napi::Value $jsmangledname_templ<SWIG_OBJ_WRAP>::$jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jslocals
+ $jscode
+ return jsresult;
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_setter: template for setter function wrappers
+ * - $jsmangledname: mangled class name
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment("js_setter", "templates")
+%{
+// js_setter
+template <typename SWIG_OBJ_WRAP>
+void $jsmangledname_templ<SWIG_OBJ_WRAP>::$jswrapper(const Napi::CallbackInfo &info, const Napi::Value &value) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jslocals
+ $jscode
+ return;
+
+ goto fail;
+fail:
+ return;
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_function: template for function wrappers
+ * - $jsmangledname: mangled class name
+ * - $jswrapper: wrapper function name
+ * - $jsargcount: minimum number of arguments
+ * - $jsargrequired: minimum number of arguments
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment("js_function", "templates")
+%{
+// js_function
+template <typename SWIG_OBJ_WRAP>
+Napi::Value $jsmangledname_templ<SWIG_OBJ_WRAP>::$jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jslocals
+ if(static_cast<int>(info.Length()) < $jsargrequired || static_cast<int>(info.Length()) > $jsargcount) {
+ SWIG_Error(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ }
+
+ $jscode
+ return jsresult;
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_function_dispatcher: template for a function dispatcher for overloaded functions
+ * - $jsmangledname: mangled class name
+ * - $jswrapper: wrapper function name
+ * - $jsname: name of the wrapped function
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment("js_function_dispatcher", "templates")
+%{
+// js_function_dispatcher
+template <typename SWIG_OBJ_WRAP>
+Napi::Value $jsmangledname_templ<SWIG_OBJ_WRAP>::$jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jscode
+
+ SWIG_Error(SWIG_ERROR, "Illegal arguments for function $jsname.");
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_overloaded_function: template for a overloaded function
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_overloaded_function", "templates")
+%{
+// js_overloaded_function
+template <typename SWIG_OBJ_WRAP>
+Napi::Value $jsmangledname_templ<SWIG_OBJ_WRAP>::$jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jslocals
+ $jscode
+ return jsresult;
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_global_overloaded_function: template for a global overloaded function
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_global_overloaded_function", "templates")
+%{
+// js_global_overloaded_function
+Napi::Value $jswrapper(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ $jslocals
+ $jscode
+ return jsresult;
+
+ goto fail;
+fail:
+ return Napi::Value();
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * js_function_dispatch_case: template for a case used in the function dispatcher
+ * - $jswrapper: wrapper function name
+ * - $jsargcount: number of arguments of overloaded function
+ * - $jsargrequired: minimum number of arguments
+ * - $jscode: code part of wrapper
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_function_dispatch_case", "templates")
+%{
+ // js_function_dispatch_case
+ if(static_cast<int>(info.Length()) >= $jsargrequired && static_cast<int>(info.Length()) <= $jsargcount) {
+#ifdef NAPI_CPP_EXCEPTIONS
+ bool tryNext = false;
+ try {
+ jsresult = $jswrapper(info);
+ } catch (const Napi::TypeError &) {
+ tryNext = true;
+ } catch (const Napi::Error &e) {
+ throw e;
+ }
+ if (!tryNext)
+ return jsresult;
+#else
+ $jswrapper(info);
+ if (env.IsExceptionPending()) {
+ Napi::Error e = env.GetAndClearPendingException();
+ Napi::Value typeErrorValue;
+ bool isTypeError;
+ Napi::Function typeErrorCons;
+ // Yes, this is ugly
+ // TODO: Fix this in Node.js when the core team grows up
+ NAPI_CHECK_RESULT(env.Global().Get("TypeError"), typeErrorValue);
+ typeErrorCons = typeErrorValue.As<Napi::Function>();
+ NAPI_CHECK_RESULT(e.Value().InstanceOf(typeErrorCons), isTypeError);
+ if (!isTypeError) {
+ // This is not the error you are looking for
+ e.ThrowAsJavaScriptException();
+ SWIG_fail;
+ }
+ } else {
+ return jsresult;
+ }
+#endif
+ }
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_class_prologue_template: template for a class prologue
+ * - $jsmangledname: mangled class name
+ * - $jsparent: mangled name of parent (or SWIG_NAPI_ObjectWrap if none)
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_class_prologue_template", "templates")
+%{
+ // jsnapi_class_prologue_template
+ template <typename SWIG_OBJ_WRAP>
+ class $jsmangledname_templ : public $jsparent_templ<SWIG_OBJ_WRAP> {
+ public:
+ $jsmangledname_templ(const Napi::CallbackInfo &);
+ $jsmangledname_templ(bool, const Napi::CallbackInfo &);
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_class_dtor_declaration: template for a class destructor declaration
+ * - $jsmangledname: mangled class name
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_class_dtor_declaration", "templates")
+%{
+ virtual ~$jsmangledname_templ();
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_class_method_declaration: template for a class method declaration
+ * - $jsmangledname: mangled class name
+ * - $jswrapper: method name
+ * - $jsstatic: static modifier
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_class_method_declaration", "templates")
+%{
+ // jsnapi_class_method_declaration
+ $jsstatic Napi::Value $jswrapper(const Napi::CallbackInfo &);
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_class_setter_declaration: template for a class method declaration
+ * - $jsmangledname: mangled class name
+ * - $jswrapper: method name
+ * - $jsstatic: static modifier
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_class_setter_declaration", "templates")
+%{
+ // jsnapi_class_setter_declaration
+ $jsstatic void $jswrapper(const Napi::CallbackInfo &, const Napi::Value &);
+%}
+
+
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_class_epilogue_template: template for a class epilogue
+ * - $jsmangledname: mangled class name
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_class_epilogue_template", "templates")
+%{
+ // jsnapi_class_epilogue_template
+ static void JS_veto_set_static_variable(const Napi::CallbackInfo &, const Napi::Value &);
+ void JS_veto_set_variable(const Napi::CallbackInfo &, const Napi::Value &);
+};
+
+template <typename SWIG_OBJ_WRAP>
+void $jsmangledname_templ<SWIG_OBJ_WRAP>::JS_veto_set_static_variable(const Napi::CallbackInfo &info, const Napi::Value &value) {
+ SWIG_NAPI_Raise(info.Env(), "Tried to write read-only variable.");
+}
+
+template <typename SWIG_OBJ_WRAP>
+void $jsmangledname_templ<SWIG_OBJ_WRAP>::JS_veto_set_variable(const Napi::CallbackInfo &info, const Napi::Value &value) {
+ SWIG_NAPI_Raise(info.Env(), "Tried to write read-only variable.");
+}
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_class_instance: template for a class declaration instance
+ * - $jsmangledname: mangled class name
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_declare_class_instance", "templates")
+%{
+ // jsnapi_class_instance
+ class $jsmangledname_inst : public $jsmangledname_templ<$jsmangledname_inst> {
+ public:
+ using $jsmangledname_templ::$jsmangledname_templ;
+ virtual ~$jsmangledname_inst() {};
+ static void GetMembers(
+ Napi::Env,
+ std::map<std::string, $jsmangledname_templ::PropertyDescriptor> &,
+ std::map<std::string, $jsmangledname_templ::PropertyDescriptor> &
+ );
+ static Napi::Function GetClass(Napi::Env);
+ };
+%}
+
+
+/*
+ * Inheritance is still not officially supported in NAPI
+ * Refer to this for my workaround:
+ * https://mmomtchev.medium.com/c-class-inheritance-with-node-api-and-node-addon-api-c180334d9902
+ */
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_inherited_class_prologue_template: template for a class prologue
+ * - $jsmangledname: mangled class name
+ * - $jsparent: mangled name of parent class
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_inherited_class_prologue_template", "templates")
+%{
+ // jsnapi_inherited_class_prologue_template
+ SWIG_NAPI_ClientData $jsmangledname_clientData;
+ template <typename SWIG_OBJ_WRAP>
+ class $jsmangledname_templ : public $jsparent_templ<SWIG_OBJ_WRAP> {
+ public:
+ $jsmangledname_templ(const Napi::CallbackInfo& info);
+%}
+
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_getclass: template for creating a class object
+ * - $jsname: class name
+ * - $jsmangledname: mangled class name
+ * - $jsfunctions: member functions
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_getclass", "templates")
+%{
+ /* Class: $jsname ($jsmangledname) */
+ // jsnapi_getclass
+Napi::Function $jsmangledname_inst::GetClass(Napi::Env env) {
+ std::map<std::string, $jsmangledname_templ::PropertyDescriptor> members, staticMembers;
+ GetMembers(env, members, staticMembers);
+
+ std::vector<$jsmangledname_inst::PropertyDescriptor> symbolTable;
+ for (auto it = members.begin(); it != members.end(); it++)
+ symbolTable.push_back(it->second);
+ for (auto it = staticMembers.begin(); it != staticMembers.end(); it++)
+ symbolTable.push_back(it->second);
+
+ return Napi::ObjectWrap<$jsmangledname_inst>::DefineClass(env, "$jsname", symbolTable);
+}
+
+void $jsmangledname_inst::GetMembers(
+ Napi::Env env,
+ std::map<std::string, $jsmangledname_templ::PropertyDescriptor> &members,
+ std::map<std::string, $jsmangledname_templ::PropertyDescriptor> &staticMembers
+) {
+ std::map<std::string, $jsparent_templ<$jsparent_inst>::PropertyDescriptor> baseMembers, baseStaticMembers;
+ $jsparent_inst::GetMembers(env, baseMembers, baseStaticMembers);
+ members.insert(baseMembers.begin(), baseMembers.end());
+ staticMembers.insert(staticMembers.begin(), staticMembers.end());
+
+ /* register wrapper functions */
+ $jsnapiwrappers
+ /* add static class functions and variables */
+ $jsnapistaticwrappers
+}
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_registerclass: template for regsitering a class object
+ * - $jsname: class name
+ * - $jsmangledname: mangled class name
+ * - $jsparent: parent namespace
+ * - $jsmangledtype: mangled class type
+ * - $jsclassidx: class index in the class table
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_registerclass", "templates")
+%{
+
+ /* Class: $jsname ($jsmangledname) */
+ // jsnapi_registerclass
+ Napi::Function $jsmangledname_ctor = $jsmangledname_inst::GetClass(env);
+ $jsparent.Set("$jsname", $jsmangledname_ctor);
+ if (SWIGTYPE_$jsmangledtype->clientdata == nullptr) {
+ SWIGTYPE_$jsmangledtype->clientdata = new size_t($jsclassidx);
+ }
+ Napi::FunctionReference *$jsmangledname_ctor_ref = new Napi::FunctionReference();
+ *$jsmangledname_ctor_ref = Napi::Persistent($jsmangledname_ctor);
+ env.GetInstanceData<EnvInstanceData>()->ctor[$jsclassidx] = $jsmangledname_ctor_ref;
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_setup_inheritance: setup inheritance between two classes
+ * - $jsname: class name
+ * - $jsmangledname: mangled class name
+ * - $jsparent: mangled name of parent class
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_setup_inheritance", "templates")
+%{
+ // Inheritance for $jsmangledname ($jsname) <- $jsparent
+ // jsnapi_setup_inheritance
+ do {
+ Napi::Value protoBase, protoSub;
+ NAPI_CHECK_RESULT($jsmangledname_ctor.Get("prototype"), protoSub);
+ NAPI_CHECK_RESULT($jsparent_ctor.Get("prototype"), protoBase);
+ NAPI_CHECK_MAYBE(setProto.Call({$jsmangledname_ctor, $jsparent_ctor}));
+ NAPI_CHECK_MAYBE(setProto.Call({protoSub, protoBase}));
+ } while (0);
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_create_namespace: template for a statement that creates a namespace object.
+ * - $jsmangledname: mangled namespace name
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_create_namespace", "templates")
+%{
+ // jsnapi_create_namespace
+ Napi::Object $jsmangledname = Napi::Object::New(env);
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_register_namespace: template for a statement that registers a namespace in a parent namespace.
+ * - $jsname: name of namespace
+ * - $jsmangledname: mangled name of namespace
+ * - $jsparent: mangled name of parent namespace
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_register_namespace", "templates")
+%{
+ // jsnapi_register_namespace
+ NAPI_CHECK_MAYBE($jsparent.Set("$jsname", $jsmangledname));
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_member_function_descriptor: template for a statement that registers a member function.
+ * - $jsmangledname: mangled class name
+ * - $jsname: name of the function
+ * - $jswrapper: wrapper of the member function
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_register_member_function", "templates")
+%{
+ // jsnapi_member_function_descriptor
+ members.erase("$jsname");
+ members.insert({"$jsname",
+ $jsmangledname_templ::InstanceMethod("$jsname",
+ &$jsmangledname_templ::$jswrapper,
+ static_cast<napi_property_attributes>(napi_writable | napi_configurable))
+ });
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_register_member_variable: template for a statement that registers a member variable.
+ * - $jsname: name of the function
+ * - $jsmangledname: mangled class name
+ * - $jsgetter: wrapper of the getter function
+ * - $jssetter: wrapper of the setter function
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_register_member_variable", "templates")
+%{
+ // jsnapi_register_member_variable
+ members.erase("$jsname");
+ members.insert({"$jsname",
+ $jsmangledname_templ::InstanceAccessor("$jsname",
+ &$jsmangledname_templ::$jsgetter,
+ &$jsmangledname_templ::$jssetter,
+ static_cast<napi_property_attributes>(napi_writable | napi_enumerable | napi_configurable))
+ });
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_register_static_function: template for a statement that registers a static class function.
+ * - $jsname: function name
+ * - $jsmangledname: mangled class name
+ * - $jswrapper: wrapper of the function
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_register_static_function", "templates")
+%{
+ // jsnapi_register_static_function
+ staticMembers.erase("$jsname");
+ staticMembers.insert({"$jsname",
+ StaticMethod("$jsname",
+ &$jsmangledname_templ::$jswrapper,
+ static_cast<napi_property_attributes>(napi_writable | napi_configurable))
+ });
+%}
+
+/* -----------------------------------------------------------------------------
+ * jsnapi_register_static_variable: template for a statement that registers a static variable.
+ * - $jsname: variable name
+ * - $jsmangledname: mangled class name
+ * - $jsgetter: wrapper of the getter function
+ * - $jssetter: wrapper of the setter function
+ * ----------------------------------------------------------------------------- */
+%fragment("jsnapi_register_static_variable", "templates")
+%{
+ // jsnapi_register_static_variable
+ staticMembers.erase("$jsname");
+ staticMembers.insert({"$jsname",
+ StaticAccessor("$jsname",
+ &$jsmangledname_templ::$jsgetter,
+ &$jsmangledname_templ::$jssetter,
+ static_cast<napi_property_attributes>(napi_writable | napi_enumerable | napi_configurable))
+ });
+%}
diff --git a/linux-x86/share/swig/javascript/napi/javascriptcomplex.swg b/linux-x86/share/swig/javascript/napi/javascriptcomplex.swg
new file mode 100644
index 0000000..3b08644
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascriptcomplex.swg
@@ -0,0 +1,116 @@
+/*
+ Defines the As/From converters for double/float complex, you need to
+ provide complex Type, the Name you want to use in the converters,
+ the complex Constructor method, and the Real and Imag complex
+ accessor methods.
+
+ See the std_complex.i and ccomplex.i for concrete examples.
+*/
+
+/* the common from converter */
+%define %swig_fromcplx_conv(Type, Real, Imag)
+%fragment(SWIG_From_frag(Type),"header",
+ fragment=SWIG_From_frag(double))
+{
+SWIGINTERNINLINE Napi::Value
+SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
+{
+ Napi::Array vals = Napi::Array::New(0);
+
+ vals.Set(0, SWIG_From(double)(Real(c)));
+ vals.Set(1, SWIG_From(double)(Imag(c)));
+ return vals;
+}
+}
+%enddef
+
+/* the double case */
+%define %swig_cplxdbl_conv(Type, Constructor, Real, Imag)
+%fragment(SWIG_AsVal_frag(Type),"header",
+ fragment=SWIG_AsVal_frag(double))
+{
+SWIGINTERN int
+SWIG_AsVal_dec(Type) (Napi::Value o, Type* val)
+{
+ if (o.IsArray()) {
+ Napi::Array array = Napi::Array::Cast(o);
+
+ if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
+ double re, im;
+ Napi::Value r;
+
+ r = array.Get(0);
+ if (!r.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ re = r.ToNumber().DoubleValue();
+
+ r = array.Get(1);
+ if (!r.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ im = r.ToNumber().DoubleValue();
+
+ if (val) *val = Constructor(re, im);
+ return SWIG_OK;
+ } else if (o.IsNumber()) {
+ double d = o.ToNumber().DoubleValue();
+ if (val) *val = Constructor(d, 0.0);
+ return SWIG_OK;
+ }
+ return SWIG_TypeError;
+}
+}
+%swig_fromcplx_conv(Type, Real, Imag);
+%enddef
+
+/* the float case */
+%define %swig_cplxflt_conv(Type, Constructor, Real, Imag)
+%fragment(SWIG_AsVal_frag(Type),"header",
+ fragment=SWIG_AsVal_frag(float)) {
+SWIGINTERN int
+SWIG_AsVal_dec(Type) (Napi::Value o, Type* val)
+{
+ if (o.IsArray()) {
+ Napi::Array array = o.As<Napi::Array>();
+
+ if (array.Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
+ double re, im;
+ Napi::Value r;
+
+ r = array.Get(0);
+ if (!r.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ re = r.ToNumber().DoubleValue();
+
+ r = array.Get(1);
+ if (!r.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ im = r.ToNumber().DoubleValue();
+
+ if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) {
+ if (val) *val = Constructor(%numeric_cast(re, float),
+ %numeric_cast(im, float));
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
+ } else if (o.IsNumber()) {
+ float f = static_cast<float>(o.ToNumber().DoubleValue());
+ if (val) *val = Constructor(f, 0.0);
+ return SWIG_OK;
+ }
+ return SWIG_TypeError;
+}
+}
+%swig_fromcplx_conv(Type, Real, Imag);
+%enddef
+
+#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \
+%swig_cplxflt_conv(Type, Constructor, Real, Imag)
+
+
+#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \
+%swig_cplxdbl_conv(Type, Constructor, Real, Imag)
diff --git a/linux-x86/share/swig/javascript/napi/javascriptfragments.swg b/linux-x86/share/swig/javascript/napi/javascriptfragments.swg
new file mode 100644
index 0000000..4778bf0
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascriptfragments.swg
@@ -0,0 +1,23 @@
+/*
+
+ Create a file with this name, 'javascriptfragments.swg', in your working
+ directory and add all the %fragments you want to take precedence
+ over the default ones defined by swig.
+
+ For example, if you add:
+
+ %fragment(SWIG_AsVal_frag(int),"header") {
+ SWIGINTERNINLINE int
+ SWIG_AsVal(int)(PyObject *obj, int *val)
+ {
+ <your code here>;
+ }
+ }
+
+ this will replace the code used to retrieve an integer value for all
+ the typemaps that need it, including:
+
+ int, std::vector<int>, std::list<std::pair<int,int> >, etc.
+
+
+*/
diff --git a/linux-x86/share/swig/javascript/napi/javascriptinit.swg b/linux-x86/share/swig/javascript/napi/javascriptinit.swg
new file mode 100644
index 0000000..e8b3d38
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascriptinit.swg
@@ -0,0 +1,111 @@
+%insert(header) %{
+#include <assert.h>
+%}
+
+%insert(init) %{
+
+EnvInstanceData::EnvInstanceData(Napi::Env env, swig_module_info *swig_module) :
+env(env), SWIG_NAPI_ObjectWrapCtor(nullptr), ctor(nullptr), swig_module(swig_module) {
+ ctor = new Napi::FunctionReference*[swig_module->size + 1];
+ for (size_t i = 0; i <= swig_module->size; i++) {
+ ctor[i] = nullptr;
+ }
+}
+
+EnvInstanceData::~EnvInstanceData() {
+ for (size_t i = 0; i <= swig_module->size; i++) {
+ if (ctor[i] != nullptr)
+ delete ctor[i];
+ ctor[i] = nullptr;
+ }
+ delete [] ctor;
+ delete SWIG_NAPI_ObjectWrapCtor;
+}
+
+SWIGRUNTIME void
+SWIG_NAPI_SetModule(Napi::Env env, swig_module_info *swig_module) {
+ auto data = new EnvInstanceData(env, swig_module);
+ env.SetInstanceData(data);
+}
+
+SWIGRUNTIME swig_module_info *
+SWIG_NAPI_GetModule(Napi::Env env) {
+ auto data = env.GetInstanceData<EnvInstanceData>();
+ if (data == nullptr) return nullptr;
+ return data->swig_module;
+}
+
+#define SWIG_GetModule(clientdata) SWIG_NAPI_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer) SWIG_NAPI_SetModule(clientdata, pointer)
+#define SWIG_INIT_CLIENT_DATA_TYPE Napi::Env
+
+%}
+
+%insert(init) "swiginit.swg"
+
+// Open the initializer function definition here
+
+%fragment ("js_initializer_define", "templates") %{
+#define SWIG_NAPI_INIT $jsname_initialize
+%}
+
+%insert(init) %{
+Napi::Object Init(Napi::Env env, Napi::Object exports) {
+ SWIG_InitializeModule(env);
+%}
+
+/* -----------------------------------------------------------------------------
+ * js_init_inheritance: template for enabling the inheritance
+ * ----------------------------------------------------------------------------- */
+%fragment("js_init_inheritance", "templates")
+%{
+ Napi::Value jsObjectValue, jsSetProtoValue;
+ Napi::Object jsObject;
+ Napi::Function setProto;
+ NAPI_CHECK_RESULT(env.Global().Get("Object"), jsObjectValue);
+ NAPI_CHECK_RESULT(jsObjectValue.ToObject(), jsObject);
+ NAPI_CHECK_RESULT(jsObject.Get("setPrototypeOf"), jsSetProtoValue);
+ setProto = jsSetProtoValue.As<Napi::Function>();
+%}
+
+/* -----------------------------------------------------------------------------
+ * js_initializer: template for the module initializer function
+ * - $jsname: module name
+ * - $jsnapipreinheritance: the previous template
+ * - $jsnapinspaces: part with code creating namespace objects
+ * - $jsnapiwrappers: part with code that registers wrapper functions
+ * - $jsnapiinitinheritance: part with inherit statements
+ * - $jsnapistaticwrappers: part with code adding static functions to class objects
+ * - $jsnapiregisterclasses: part with code that registers class objects in namespaces
+ * - $jsnapiregisternspaces: part with code that registers namespaces in parent namespaces
+ * ----------------------------------------------------------------------------- */
+%fragment("js_initializer", "templates")
+%{
+ Napi::Function SWIG_NAPI_ObjectWrap_ctor = SWIG_NAPI_ObjectWrap_inst::GetClass(env);
+ Napi::FunctionReference *SWIG_NAPI_ObjectWrap_ctor_ref = new Napi::FunctionReference();
+ *SWIG_NAPI_ObjectWrap_ctor_ref = Napi::Persistent(SWIG_NAPI_ObjectWrap_ctor);
+ env.GetInstanceData<EnvInstanceData>()->SWIG_NAPI_ObjectWrapCtor = SWIG_NAPI_ObjectWrap_ctor_ref;
+
+ /* create objects for namespaces */
+ $jsnapinspaces
+
+ /* register classes */
+ $jsnapiregisterclasses
+
+ /* enable inheritance */
+ $jsnapipreinheritance
+
+ /* setup inheritances */
+ $jsnapiinitinheritance
+
+ /* create and register namespace objects */
+ $jsnapiregisternspaces
+
+ return exports;
+ goto fail;
+fail:
+ return Napi::Object();
+}
+
+NODE_API_MODULE($jsname, Init)
+%}
diff --git a/linux-x86/share/swig/javascript/napi/javascriptprimtypes.swg b/linux-x86/share/swig/javascript/napi/javascriptprimtypes.swg
new file mode 100644
index 0000000..e6224f9
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascriptprimtypes.swg
@@ -0,0 +1,387 @@
+/* ------------------------------------------------------------
+ * Primitive Types
+ * ------------------------------------------------------------ */
+
+/* boolean */
+
+%fragment(SWIG_From_frag(bool),"header", "header") {
+SWIGINTERN
+Napi::Value SWIG_From_bool(Napi::Env env, bool val)
+{
+ return Napi::Boolean::New(env, val);
+}
+}
+
+
+%fragment(SWIG_AsVal_frag(bool),"header",
+ fragment=SWIG_AsVal_frag(long)) {
+SWIGINTERN
+int SWIG_AsVal_dec(bool)(Napi::Value obj, bool *val)
+{
+ if(!obj.IsBoolean()) {
+ return SWIG_TypeError;
+ }
+
+ Napi::Boolean b;
+ NAPI_CHECK_RESULT(obj.ToBoolean(), b);
+ if (val) *val = b.Value();
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
+
+/* char */
+
+%fragment(SWIG_From_frag(unsigned char), "header") {
+SWIGINTERNINLINE Napi::Value
+SWIG_From_unsigned_SS_char(Napi::Env env, unsigned char c)
+{
+ return Napi::Number::New(env, static_cast<double>(c));
+}
+}
+
+
+%fragment(SWIG_From_frag(signed char), "header") {
+SWIGINTERNINLINE Napi::Value
+SWIG_From_signed_SS_char(Napi::Env env, signed char c)
+{
+ return Napi::Number::New(env, static_cast<double>(c));
+}
+}
+
+/* int */
+
+%fragment(SWIG_From_frag(int), "header") {
+SWIGINTERN
+Napi::Value SWIG_From_int(Napi::Env env, int val)
+{
+ return Napi::Number::New(env, val);
+}
+}
+
+%fragment(SWIG_AsVal_frag(int),"header") {
+SWIGINTERN
+int SWIG_AsVal_dec(int)(Napi::Value valRef, int* val)
+{
+ if (!valRef.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if (val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(valRef.ToNumber(), num);
+ *val = static_cast<int>(num.Int32Value());
+ }
+
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
+
+
+/* unsigned int */
+
+%fragment(SWIG_From_frag(unsigned int), "header") {
+SWIGINTERN
+Napi::Value SWIG_From_unsigned_SS_int(Napi::Env env, unsigned int val)
+{
+ return Napi::Number::New(env, val);
+}
+}
+
+%fragment(SWIG_AsVal_frag(unsigned int),"header") {
+SWIGINTERN
+int SWIG_AsVal_dec(unsigned int)(Napi::Value valRef, unsigned int* val)
+{
+ if (!valRef.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if (val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(valRef.ToNumber(), num);
+ if (num.Int64Value() < 0) {
+ return SWIG_TypeError;
+ }
+ *val = static_cast<unsigned int>(num.Uint32Value());
+ }
+
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
+
+
+/* short */
+
+%fragment("SWIG_Env_FromShort", "header") {
+SWIGINTERN
+Napi::Value SWIG_From_short(Napi::Env env, short val)
+{
+ return Napi::Number::New(env, val);
+}
+}
+
+%fragment(SWIG_AsVal_frag(short),"header") {
+SWIGINTERN
+int SWIG_AsVal_dec(short)(Napi::Value valRef, short* val)
+{
+ if (!valRef.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if (val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(valRef.ToNumber(), num);
+ *val = static_cast<short>(num.Int32Value());
+ }
+
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
+
+
+/* unsigned short */
+
+%fragment(SWIG_From_frag(unsigned short), "header") {
+SWIGINTERN
+Napi::Value SWIG_From_unsigned_SS_short(Napi::Env env, unsigned short val)
+{
+ return Napi::Number::New(env, val);
+}
+}
+
+%fragment(SWIG_AsVal_frag(unsigned short),"header") {
+SWIGINTERN
+int SWIG_AsVal_dec(unsigned short)(Napi::Value valRef, unsigned short* val)
+{
+ if (!valRef.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if (val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(valRef.ToNumber(), num);
+ if (num.Int64Value() < 0) {
+ return SWIG_TypeError;
+ }
+ *val = static_cast<unsigned short>(num.Uint32Value());
+ }
+
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
+
+
+/* long */
+
+%fragment(SWIG_From_frag(long), "header") {
+SWIGINTERN
+Napi::Value SWIG_From_long(Napi::Env env, long val)
+{
+ return Napi::Number::New(env, val);
+}
+}
+
+%fragment(SWIG_AsVal_frag(long),"header",
+ fragment="SWIG_CanCastAsInteger") {
+SWIGINTERN
+int SWIG_AsVal_dec(long)(Napi::Value obj, long* val)
+{
+ if (!obj.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if (val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(obj.ToNumber(), num);
+ *val = static_cast<long>(num.Int64Value());
+ }
+
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
+
+/* unsigned long */
+
+%fragment(SWIG_From_frag(unsigned long), "header") {
+SWIGINTERN
+Napi::Value SWIG_From_unsigned_SS_long(Napi::Env env, unsigned long val)
+{
+ return Napi::Number::New(env, val);
+}
+}
+
+%fragment(SWIG_AsVal_frag(unsigned long),"header",
+ fragment="SWIG_CanCastAsInteger") {
+SWIGINTERN
+int SWIG_AsVal_dec(unsigned long)(Napi::Value obj, unsigned long *val)
+{
+ if(!obj.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if (val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(obj.ToNumber(), num);
+ if (num.Int64Value() < 0) {
+ return SWIG_TypeError;
+ }
+ *val = static_cast<unsigned long>(num.Int64Value());
+ }
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
+
+/* long long */
+
+%fragment(SWIG_From_frag(long long), "header", fragment="SWIG_LongLongAvailable") {
+%#ifdef SWIG_LONG_LONG_AVAILABLE
+SWIGINTERN
+Napi::Value SWIG_From_long_SS_long(Napi::Env env, long long val)
+{
+ return Napi::Number::New(env, val);
+}
+%#endif
+}
+
+%fragment(SWIG_AsVal_frag(long long),"header",
+ fragment=SWIG_AsVal_frag(long),
+ fragment="SWIG_CanCastAsInteger",
+ fragment="SWIG_LongLongAvailable") {
+%#ifdef SWIG_LONG_LONG_AVAILABLE
+SWIGINTERN
+int SWIG_AsVal_dec(long long)(Napi::Value obj, long long* val)
+{
+ if(!obj.IsNumber()) {
+ return SWIG_TypeError;
+ }
+
+ if (val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(obj.ToNumber(), num);
+ *val = static_cast<long long>(num.Int64Value());
+ }
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+%#endif
+}
+
+/* unsigned long long */
+
+%fragment(SWIG_From_frag(unsigned long long), "header", fragment="SWIG_LongLongAvailable") {
+%#ifdef SWIG_LONG_LONG_AVAILABLE
+SWIGINTERN
+Napi::Value SWIG_From_unsigned_SS_long_SS_long(Napi::Env env, unsigned long long val)
+{
+ return Napi::Number::New(env, val);
+}
+%#endif
+}
+
+
+%fragment(SWIG_AsVal_frag(unsigned long long),"header",
+ fragment=SWIG_AsVal_frag(unsigned long),
+ fragment="SWIG_CanCastAsInteger",
+ fragment="SWIG_LongLongAvailable") {
+%#ifdef SWIG_LONG_LONG_AVAILABLE
+SWIGINTERN
+int SWIG_AsVal_dec(unsigned long long)(Napi::Value obj, unsigned long long *val)
+{
+ if(!obj.IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if (obj.ToNumber().Int64Value() < 0) {
+ return SWIG_TypeError;
+ }
+ if (val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(obj.ToNumber(), num);
+ *val = static_cast<unsigned long long>(num.Int64Value());
+ }
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+%#endif
+}
+
+
+/* float */
+
+%fragment(SWIG_From_frag(float), "header") {
+SWIGINTERN
+Napi::Value SWIG_From_float(Napi::Env env, float val)
+{
+ return Napi::Number::New(env, val);
+}
+}
+
+%fragment(SWIG_AsVal_frag(float),"header") {
+SWIGINTERN
+int SWIG_AsVal_dec(float)(Napi::Value obj, float *val)
+{
+ if(!obj.IsNumber()) {
+ return SWIG_TypeError;
+ }
+
+ if(val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(obj.ToNumber(), num);
+ *val = static_cast<float>(num.DoubleValue());
+ }
+
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
+
+
+/* double */
+
+%fragment(SWIG_From_frag(double), "header") {
+SWIGINTERN
+Napi::Value SWIG_From_double(Napi::Env env, double val)
+{
+ return Napi::Number::New(env, val);
+}
+}
+
+%fragment(SWIG_AsVal_frag(double),"header") {
+SWIGINTERN
+int SWIG_AsVal_dec(double)(Napi::Value obj, double *val)
+{
+ if(!obj.IsNumber()) {
+ return SWIG_TypeError;
+ }
+
+ if(val) {
+ Napi::Number num;
+ NAPI_CHECK_RESULT(obj.ToNumber(), num);
+ *val = static_cast<double>(num.DoubleValue());
+ }
+
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+}
diff --git a/linux-x86/share/swig/javascript/napi/javascriptrun.swg b/linux-x86/share/swig/javascript/napi/javascriptrun.swg
new file mode 100644
index 0000000..ce698fe
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascriptrun.swg
@@ -0,0 +1,446 @@
+/* ---------------------------------------------------------------------------
+ * Error handling
+ *
+ * ---------------------------------------------------------------------------*/
+
+/*
+ * We support several forms:
+ *
+ * SWIG_Raise("Error message")
+ * which creates an Error object with the error message
+ *
+ * SWIG_Raise(SWIG_TypeError, "Type error")
+ * which creates the specified error type with the message
+ *
+ * SWIG_Raise(obj)
+ * which throws the object itself
+ *
+ * SWIG_Raise(obj, "Exception const &", SWIGType_p_Exception)
+ * which also throws the object itself and discards the unneeded extra type info
+ *
+ * These must be functions instead of macros to use the C++ overloading to
+ * resolve the arguments
+ */
+#define SWIG_exception(code, msg) SWIG_Error(code, msg)
+#define SWIG_fail goto fail
+
+#ifdef NAPI_CPP_EXCEPTIONS
+
+#define SWIG_Error(code, msg) SWIG_NAPI_Raise(env, code, msg)
+#define NAPI_CHECK_MAYBE(maybe) (maybe)
+#define NAPI_CHECK_RESULT(maybe, result) (result = maybe)
+
+SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, const char *msg) {
+ throw Napi::Error::New(env, msg);
+}
+
+SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, int type, const char *msg) {
+ switch(type) {
+ default:
+ case SWIG_IOError:
+ case SWIG_MemoryError:
+ case SWIG_SystemError:
+ case SWIG_RuntimeError:
+ case SWIG_DivisionByZero:
+ case SWIG_SyntaxError:
+ throw Napi::Error::New(env, msg);
+ case SWIG_OverflowError:
+ case SWIG_IndexError:
+ throw Napi::RangeError::New(env, msg);
+ case SWIG_ValueError:
+ case SWIG_TypeError:
+ throw Napi::TypeError::New(env, msg);
+ }
+}
+
+SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, Napi::Value obj,
+ const char *msg = nullptr, swig_type_info *info = nullptr) {
+ throw Napi::Error(env, obj);
+}
+
+#else
+
+#define SWIG_Error(code, msg) do { SWIG_NAPI_Raise(env, code, msg); SWIG_fail; } while (0)
+#define NAPI_CHECK_MAYBE(maybe) do { if (maybe.IsNothing()) SWIG_fail; } while (0)
+#define NAPI_CHECK_RESULT(maybe, result) \
+ do { \
+ auto r = maybe; \
+ if (r.IsNothing()) SWIG_fail; \
+ result = r.Unwrap(); \
+ } while (0)
+
+SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, const char *msg) {
+ Napi::Error::New(env, msg).ThrowAsJavaScriptException();
+}
+
+SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, int type, const char *msg) {
+ switch(type) {
+ default:
+ case SWIG_IOError:
+ case SWIG_MemoryError:
+ case SWIG_SystemError:
+ case SWIG_RuntimeError:
+ case SWIG_DivisionByZero:
+ case SWIG_SyntaxError:
+ Napi::Error::New(env, msg).ThrowAsJavaScriptException();
+ return;
+ case SWIG_OverflowError:
+ case SWIG_IndexError:
+ Napi::RangeError::New(env, msg).ThrowAsJavaScriptException();
+ return;
+ case SWIG_ValueError:
+ case SWIG_TypeError:
+ Napi::TypeError::New(env, msg).ThrowAsJavaScriptException();
+ return;
+ }
+}
+
+SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, Napi::Value obj,
+ const char *msg = nullptr, swig_type_info *info = nullptr) {
+ Napi::Error(env, obj).ThrowAsJavaScriptException();
+}
+
+#endif
+
+void JS_veto_set_variable(const Napi::CallbackInfo &info) {
+ SWIG_NAPI_Raise(info.Env(), "Tried to write read-only variable.");
+}
+
+struct EnvInstanceData {
+ Napi::Env env;
+ // Base class per-environment constructor, used to check
+ // if a JS object is a SWIG wrapper
+ Napi::FunctionReference *SWIG_NAPI_ObjectWrapCtor;
+ // Per-environment wrapper constructors, indexed by the number in
+ // swig_type->clientdata
+ Napi::FunctionReference **ctor;
+ swig_module_info *swig_module;
+ EnvInstanceData(Napi::Env, swig_module_info *);
+ ~EnvInstanceData();
+};
+
+typedef size_t SWIG_NAPI_ClientData;
+
+// Base class for all wrapped objects,
+// used mostly when unwrapping unknown objects
+template <typename SWIG_OBJ_WRAP>
+class SWIG_NAPI_ObjectWrap_templ : public Napi::ObjectWrap<SWIG_OBJ_WRAP> {
+ public:
+ void *self;
+ bool owned;
+ size_t size;
+ swig_type_info *info;
+ SWIG_NAPI_ObjectWrap_templ(const Napi::CallbackInfo &info);
+ SWIG_NAPI_ObjectWrap_templ(bool, const Napi::CallbackInfo &info) :
+ Napi::ObjectWrap<SWIG_OBJ_WRAP>(info),
+ self(nullptr),
+ owned(true),
+ size(0),
+ info(nullptr)
+ {}
+ virtual ~SWIG_NAPI_ObjectWrap_templ() {};
+
+ Napi::Value ToString(const Napi::CallbackInfo &info);
+};
+
+template <typename SWIG_OBJ_WRAP>
+SWIG_NAPI_ObjectWrap_templ<SWIG_OBJ_WRAP>::SWIG_NAPI_ObjectWrap_templ(const Napi::CallbackInfo &info) :
+ Napi::ObjectWrap<SWIG_OBJ_WRAP>(info), size(0), info(nullptr) {
+ Napi::Env env = info.Env();
+ if (info.Length() == 1 && info[0].IsExternal()) {
+ // This constructor has been called internally from C++/SWIG
+ // to wrap an already existing C++ object of unknown type in JS
+ this->self = info[0].As<Napi::External<void>>().Data();
+ this->owned = false;
+ } else {
+ SWIG_Error(SWIG_ERROR, "This constructor is not accessible from JS");
+ }
+ return;
+ goto fail;
+fail:
+ return;
+}
+
+template <typename SWIG_OBJ_WRAP>
+Napi::Value SWIG_NAPI_ObjectWrap_templ<SWIG_OBJ_WRAP>::ToString(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ static char repr[128];
+ const char *name = SWIG_TypePrettyName(this->info);
+ snprintf(repr, sizeof(repr), "{SwigObject %s (%s) at %p %s}",
+ this->info ? this->info->name : "unknown",
+ name ? name : "unknown",
+ this->self,
+ this->owned ? "[owned]" : "[copy]");
+ return Napi::String::New(env, repr);
+}
+
+class SWIG_NAPI_ObjectWrap_inst : public SWIG_NAPI_ObjectWrap_templ<SWIG_NAPI_ObjectWrap_inst> {
+public:
+ using SWIG_NAPI_ObjectWrap_templ::SWIG_NAPI_ObjectWrap_templ;
+ static Napi::Function GetClass(Napi::Env);
+ static void GetMembers(
+ Napi::Env,
+ std::map<std::string, SWIG_NAPI_ObjectWrap_templ::PropertyDescriptor> &,
+ std::map<std::string, SWIG_NAPI_ObjectWrap_templ::PropertyDescriptor> &
+ );
+};
+
+void SWIG_NAPI_ObjectWrap_inst::GetMembers(
+ Napi::Env env,
+ std::map<std::string, SWIG_NAPI_ObjectWrap_templ::PropertyDescriptor> &members,
+ std::map<std::string, SWIG_NAPI_ObjectWrap_templ::PropertyDescriptor> &
+) {
+ members.erase("toString");
+ members.insert({"toString", SWIG_NAPI_ObjectWrap_templ::InstanceMethod("toString", &SWIG_NAPI_ObjectWrap_templ::ToString)});
+}
+
+Napi::Function SWIG_NAPI_ObjectWrap_inst::GetClass(Napi::Env env) {
+ return Napi::ObjectWrap<SWIG_NAPI_ObjectWrap_inst>::DefineClass(env, "SwigObject", {});
+}
+
+SWIGRUNTIME int SWIG_NAPI_ConvertInstancePtr(Napi::Object objRef, void **ptr, swig_type_info *info, int flags) {
+ SWIG_NAPI_ObjectWrap_inst *ow;
+ Napi::Env env = objRef.Env();
+ if(!objRef.IsObject()) return SWIG_ERROR;
+
+ // Check if this is a SWIG wrapper
+ Napi::FunctionReference *ctor = env.GetInstanceData<EnvInstanceData>()->SWIG_NAPI_ObjectWrapCtor;
+ bool instanceOf;
+ NAPI_CHECK_RESULT(objRef.InstanceOf(ctor->Value()), instanceOf);
+ if (!instanceOf) {
+ return SWIG_TypeError;
+ }
+
+ ow = Napi::ObjectWrap<SWIG_NAPI_ObjectWrap_inst>::Unwrap(objRef);
+
+ // Now check if the SWIG type is compatible unless the types match exactly or the type is unknown
+ if(info && ow->info != info && ow->info != nullptr) {
+ swig_cast_info *tc = SWIG_TypeCheckStruct(ow->info, info);
+ if (!tc && ow->info->name) {
+ tc = SWIG_TypeCheck(ow->info->name, info);
+ }
+ bool type_valid = tc != 0;
+ if(!type_valid) {
+ return SWIG_TypeError;
+ }
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, ow->self, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ *ptr = ow->self;
+ }
+
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !ow->owned) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ } else {
+ if (flags & SWIG_POINTER_DISOWN) {
+ ow->owned = false;
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ ow->self = nullptr;
+ }
+ }
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+
+
+SWIGRUNTIME int SWIG_NAPI_GetInstancePtr(Napi::Value valRef, void **ptr) {
+ SWIG_NAPI_ObjectWrap_inst *ow;
+ if(!valRef.IsObject()) {
+ return SWIG_TypeError;
+ }
+ Napi::Object objRef;
+ NAPI_CHECK_RESULT(valRef.ToObject(), objRef);
+ ow = Napi::ObjectWrap<SWIG_NAPI_ObjectWrap_inst>::Unwrap(objRef);
+
+ if(ow->self == nullptr) {
+ return SWIG_ERROR;
+ }
+
+ *ptr = ow->self;
+ return SWIG_OK;
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+
+
+SWIGRUNTIME int SWIG_NAPI_ConvertPtr(Napi::Value valRef, void **ptr, swig_type_info *info, int flags) {
+ // special case: JavaScript null => C NULL pointer
+ if (valRef.IsNull()) {
+ *ptr=0;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
+ }
+
+ if (!valRef.IsObject()) {
+ return SWIG_TypeError;
+ }
+
+ Napi::Object objRef;
+ NAPI_CHECK_RESULT(valRef.ToObject(), objRef);
+ return SWIG_NAPI_ConvertInstancePtr(objRef, ptr, info, flags);
+ goto fail;
+fail:
+ return SWIG_ERROR;
+}
+
+SWIGRUNTIME Napi::Value SWIG_NAPI_NewPointerObj(Napi::Env env, void *ptr, swig_type_info *info, int flags) {
+ Napi::External<void> native;
+ Napi::FunctionReference *ctor;
+
+ if (ptr == nullptr) {
+ return env.Null();
+ }
+ native = Napi::External<void>::New(env, ptr);
+
+ size_t *idx = info != nullptr ?
+ reinterpret_cast<SWIG_NAPI_ClientData *>(info->clientdata) :
+ nullptr;
+ if (idx == nullptr) {
+ // This type does not have a dedicated wrapper
+ ctor = env.GetInstanceData<EnvInstanceData>()->SWIG_NAPI_ObjectWrapCtor;
+ } else {
+ ctor = env.GetInstanceData<EnvInstanceData>()->ctor[*idx];
+ }
+
+ Napi::Value wrapped;
+ NAPI_CHECK_RESULT(ctor->New({native}), wrapped);
+
+ // Preserve the type even if using the generic wrapper
+ if (idx == nullptr && info != nullptr) {
+ Napi::Object obj;
+ NAPI_CHECK_RESULT(wrapped.ToObject(), obj);
+ Napi::ObjectWrap<SWIG_NAPI_ObjectWrap_inst>::Unwrap(obj)->info = info;
+ }
+
+ if ((flags & SWIG_POINTER_OWN) == SWIG_POINTER_OWN) {
+ Napi::Object obj;
+ NAPI_CHECK_RESULT(wrapped.ToObject(), obj);
+ Napi::ObjectWrap<SWIG_NAPI_ObjectWrap_inst>::Unwrap(obj)->owned = true;
+ }
+
+ return wrapped;
+ goto fail;
+fail:
+ return Napi::Value();
+}
+
+#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_NAPI_ConvertPtr(obj, ptr, info, flags)
+#define SWIG_NewPointerObj(ptr, info, flags) SWIG_NAPI_NewPointerObj(env, ptr, info, flags)
+
+#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_NAPI_ConvertInstancePtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_NAPI_NewPointerObj(env, thisvalue, type, flags)
+
+#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_NAPI_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NAPI_NewPointerObj(env, ptr, type, 0)
+
+#define SWIG_GetInstancePtr(obj, ptr) SWIG_NAPI_GetInstancePtr(obj, ptr)
+
+SWIGRUNTIME Napi::Value _SWIG_NAPI_wrap_equals(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ void *arg1 = (void *) 0 ;
+ void *arg2 = (void *) 0 ;
+ bool result;
+ int res1;
+ int res2;
+
+ if(info.Length() != 1) SWIG_Error(SWIG_ERROR, "Illegal number of arguments for equals.");
+
+ res1 = SWIG_GetInstancePtr(info.This(), &arg1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_Error(SWIG_ERROR, "Could not get pointer from 'this' object for equals.");
+ }
+ res2 = SWIG_GetInstancePtr(info[0], &arg2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_Error(SWIG_ArgError(res2), " in method '" "equals" "', argument " "1"" of type '" "void *""'");
+ }
+
+ result = (bool)(arg1 == arg2);
+ jsresult = Napi::Boolean::New(env, result);
+
+ return jsresult;
+ goto fail;
+fail:
+ return Napi::Value();
+}
+
+SWIGRUNTIME Napi::Value _wrap_getCPtr(const Napi::CallbackInfo &info) {
+ Napi::Env env = info.Env();
+ Napi::Value jsresult;
+ void *arg1 = (void *) 0 ;
+ long result;
+ int res1;
+
+ res1 = SWIG_GetInstancePtr(info.This(), &arg1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_Error(SWIG_ArgError(res1), " in method '" "getCPtr" "', argument " "1"" of type '" "void *""'");
+ }
+
+ result = (long)arg1;
+ jsresult = Napi::Number::New(env, result);
+
+ return jsresult;
+ goto fail;
+fail:
+ return Napi::Value();
+}
+
+
+/* ---------------------------------------------------------------------------
+ * PackedData object
+ * (objects visible to JS that do not have a dedicated wrapper but must preserve type)
+ * ---------------------------------------------------------------------------*/
+
+SWIGRUNTIME
+Napi::Value SWIG_NAPI_NewPackedObj(Napi::Env env, void *data, size_t size, swig_type_info *type) {
+ void *data_copy = new uint8_t[size];
+ memcpy(data_copy, data, size);
+ Napi::Value val = SWIG_NAPI_NewPointerObj(env, data_copy, type, SWIG_POINTER_OWN);
+ Napi::Object obj;
+ if (val.IsEmpty()) goto fail;
+
+ NAPI_CHECK_RESULT(val.ToObject(), obj);
+ Napi::ObjectWrap<SWIG_NAPI_ObjectWrap_inst>::Unwrap(obj)->size = size;
+
+fail:
+ return val;
+}
+
+SWIGRUNTIME
+int SWIG_NAPI_ConvertPacked(Napi::Value valRef, void *ptr, size_t size, swig_type_info *type) {
+ void *tmp;
+ if (!SWIG_IsOK(SWIG_NAPI_ConvertPtr(valRef, &tmp, type, 0))) {
+ return SWIG_ERROR;
+ }
+ memcpy(ptr, tmp, size);
+ return SWIG_OK;
+}
+
+#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_NAPI_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type) SWIG_NAPI_NewPackedObj(env, ptr, sz, type)
+
+
+/* ---------------------------------------------------------------------------
+ * Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg)
+ *
+ * ---------------------------------------------------------------------------*/
+
+SWIGRUNTIME
+
+Napi::Value SWIG_NAPI_AppendOutput(Napi::Env env, Napi::Value result, Napi::Value obj) {
+ if (result.IsUndefined()) {
+ result = Napi::Array::New(env);
+ } else if (!result.IsArray()) {
+ Napi::Array tmparr = Napi::Array::New(env);
+ tmparr.Set(static_cast<uint32_t>(0), result);
+ result = tmparr;
+ }
+
+ Napi::Array arr = result.As<Napi::Array>();
+ arr.Set(arr.Length(), obj);
+ return arr;
+}
diff --git a/linux-x86/share/swig/javascript/napi/javascriptruntime.swg b/linux-x86/share/swig/javascript/napi/javascriptruntime.swg
new file mode 100644
index 0000000..42f11ed
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascriptruntime.swg
@@ -0,0 +1,40 @@
+/* -----------------------------------------------------------------------------
+ * javascriptruntime.swg
+ *
+ * ----------------------------------------------------------------------------- */
+
+// NAPI
+// ----------
+
+%insert(runtime) %{
+#if defined(_CPPUNWIND) || defined(__EXCEPTIONS)
+#define NAPI_CPP_EXCEPTIONS
+#else
+#define NAPI_DISABLE_CPP_EXCEPTIONS
+#define NODE_ADDON_API_ENABLE_MAYBE
+#endif
+
+// This gives us
+// Branch Node.js v10.x - from v10.20.0
+// Branch Node.js v12.x - from v12.17.0
+// Everything from Node.js v14.0.0 on
+// Our limiting feature is napi_set_instance_data
+#ifndef NAPI_VERSION
+#define NAPI_VERSION 6
+#elif NAPI_VERSION < 6
+#error NAPI_VERSION 6 is the minimum supported target (Node.js >=14, >=12.17, >=10.20)
+#endif
+#include <napi.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <map>
+%}
+
+%insert(runtime) "swigrun.swg"; /* SWIG API */
+%insert(runtime) "swigerrors.swg"; /* SWIG errors */
+
+%insert(runtime) "javascriptrun.swg"
+
diff --git a/linux-x86/share/swig/javascript/napi/javascriptstrings.swg b/linux-x86/share/swig/javascript/napi/javascriptstrings.swg
new file mode 100644
index 0000000..7293c7b
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascriptstrings.swg
@@ -0,0 +1,77 @@
+
+/* ------------------------------------------------------------
+ * utility methods for char strings
+ * ------------------------------------------------------------ */
+%fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") {
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(Napi::Value valRef, char** cptr, size_t* psize, int *alloc)
+{
+ if(valRef.IsString()) {
+ Napi::String js_str;
+ NAPI_CHECK_RESULT(valRef.ToString(), js_str);
+
+ std::string str = js_str.Utf8Value();
+ size_t len = str.size() + 1;
+ char* cstr = (char*) %new_array(len, char);
+ memcpy(cstr, str.data(), len);
+
+ if(alloc) *alloc = SWIG_NEWOBJ;
+ if(psize) *psize = len;
+ if(cptr) *cptr = cstr;
+
+ return SWIG_OK;
+ } else {
+ if(valRef.IsObject()) {
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+ Napi::Object obj;
+ NAPI_CHECK_RESULT(valRef.ToObject(), obj);
+ // try if the object is a wrapped char[]
+ if (pchar_descriptor) {
+ void* vptr = 0;
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+ if (cptr) *cptr = (char *) vptr;
+ if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
+ if (alloc) *alloc = SWIG_OLDOBJ;
+ return SWIG_OK;
+ }
+ }
+ }
+ }
+ goto fail;
+fail:
+ return SWIG_TypeError;
+}
+}
+
+
+%fragment(SWIG_From_frag(char), "header") {
+SWIGINTERNINLINE Napi::Value
+SWIG_From_char(Napi::Env env, char c)
+{
+ Napi::String js_str = Napi::String::New(env, &c, 1);
+ return js_str;
+}
+}
+
+
+%fragment("SWIG_FromCharPtr", "header", fragment = "SWIG_FromCharPtrAndSize") {
+// Override the default one with an empty one
+}
+
+%fragment("SWIG_FromCharPtrAndSize", "header") {
+SWIGINTERNINLINE Napi::Value
+SWIG_Env_FromCharPtrAndSize(Napi::Env env, const char* carray, size_t size)
+{
+ if (carray) {
+ Napi::String js_str = Napi::String::New(env, carray, size);
+ return js_str;
+ } else {
+ return env.Undefined();
+ }
+}
+}
+
+%insert(runtime) %{
+#define SWIG_FromCharPtrAndSize(cptr, size) SWIG_Env_FromCharPtrAndSize(env, cptr, size)
+#define SWIG_FromCharPtr(cptr) SWIG_Env_FromCharPtrAndSize(env, cptr, strlen(cptr))
+%}
diff --git a/linux-x86/share/swig/javascript/napi/javascripttypemaps.swg b/linux-x86/share/swig/javascript/napi/javascripttypemaps.swg
new file mode 100644
index 0000000..d7d21be
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/javascripttypemaps.swg
@@ -0,0 +1,56 @@
+/* ------------------------------------------------------------
+ * Typemap specializations for Javascript
+ * ------------------------------------------------------------ */
+
+/* ------------------------------------------------------------
+ * Fragment section
+ * ------------------------------------------------------------ */
+
+/* These macros are necessary to provide an extra parameter
+ to SWIG_AsVal_dec functions (Napi::Env environment).
+ They must be defined before including `typemaps/fragments.swg`
+*/
+#define SWIG_FROM_DECL_ARGS SWIG_NAPI_FROM_DECL_ARGS
+#define SWIG_FROM_CALL_ARGS SWIG_NAPI_FROM_CALL_ARGS
+
+/* Include fundamental fragemt definitions */
+%include <typemaps/fragments.swg>
+
+/* Look for user fragments file. */
+%include <javascriptfragments.swg>
+
+/* Javascript fragments for fundamental types */
+%include <javascriptprimtypes.swg>
+
+/* Javascript fragments for char* strings */
+%include <javascriptstrings.swg>
+
+
+/* ------------------------------------------------------------
+ * Unified typemap section
+ * ------------------------------------------------------------ */
+
+/* Javascript types */
+
+#define SWIG_Object Napi::Value
+#define VOID_Object env.Undefined()
+
+/* Overload of the output/constant/exception/dirout handling */
+
+/* append output */
+#define SWIG_AppendOutput(result, obj) SWIG_NAPI_AppendOutput(env, result, obj)
+
+/* set constant */
+#define SWIG_SetConstant(name, obj)
+
+/* raise */
+#define SWIG_Raise(...) SWIG_NAPI_Raise(env, __VA_ARGS__)
+
+%insert("runtime") %{
+#define SWIG_NAPI_FROM_DECL_ARGS(arg1) (Napi::Env env, arg1)
+#define SWIG_NAPI_FROM_CALL_ARGS(arg1) (env, arg1)
+%}
+
+
+/* Include the unified typemap library */
+%include <typemaps/swigtypemaps.swg>
diff --git a/linux-x86/share/swig/javascript/napi/nodejs_buffer.i b/linux-x86/share/swig/javascript/napi/nodejs_buffer.i
new file mode 100644
index 0000000..d95ba2d
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/nodejs_buffer.i
@@ -0,0 +1,47 @@
+/*
+ * To include generic versions of the in typemaps, add:
+ *
+ * %typemap(in) (void *, size_t) = (const void* buffer_data, const size_t buffer_len);
+ * %typemap(typecheck) (void *, size_t) = (const void* buffer_data, const size_t buffer_len);
+ *
+ * or to discriminate by argument names:
+ * %typemap(in) (void *data, size_t length) = (const void* buffer_data, const size_t buffer_len);
+ * %typemap(typecheck) (void *data, size_t length) = (const void* buffer_data, const size_t buffer_len);
+ */
+
+%typemap(in) (const void* buffer_data, const size_t buffer_len) {
+ if ($input.IsBuffer()) {
+ Napi::Buffer<char> buf = $input.As<Napi::Buffer<char>>();
+ $1 = reinterpret_cast<void *>(buf.Data());
+ $2 = buf.ByteLength();
+ } else {
+ SWIG_exception_fail(SWIG_TypeError, "in method '$symname', argument is not a Buffer");
+ }
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_VOIDPTR) (const void* buffer_data, const size_t buffer_len) {
+ $1 = $input.IsBuffer();
+}
+
+
+/*
+ * In order to use the argout typemap, the function must have the following signature:
+ *
+ * void buffer(void **buffer_data, size_t *buffer_len)
+ *
+ * In this case, this function will be wrapped by a JS function that takes
+ * no arguments (because of numinputs=0) and returns a Buffer
+ */
+
+%typemap(in, numinputs=0) (void **buffer_data, size_t *buffer_len) (void *temp_data, size_t temp_len) {
+ $1 = &temp_data;
+ $2 = &temp_len;
+}
+%typemap(argout) (void **buffer_data, size_t *buffer_len) {
+ if (*$1 != nullptr) {
+ Napi::Buffer<char> buf = Napi::Buffer<char>::Copy(env, reinterpret_cast<char *>(*$1), *$2);
+ NAPI_CHECK_RESULT(buf.As<Napi::Value>(), $result);
+ } else {
+ $result = env.Null();
+ }
+}
diff --git a/linux-x86/share/swig/javascript/napi/std_auto_ptr.i b/linux-x86/share/swig/javascript/napi/std_auto_ptr.i
new file mode 100644
index 0000000..3d7ae8b
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/javascript/napi/std_common.i b/linux-x86/share/swig/javascript/napi/std_common.i
new file mode 100644
index 0000000..cee11e8
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_common.i
@@ -0,0 +1,5 @@
+%include <std_except.i>
+
+%apply size_t { std::size_t };
+%apply const size_t& { const std::size_t& };
+
diff --git a/linux-x86/share/swig/javascript/napi/std_complex.i b/linux-x86/share/swig/javascript/napi/std_complex.i
new file mode 100644
index 0000000..a252e0a
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_complex.i
@@ -0,0 +1,26 @@
+/*
+ * STD C++ complex typemaps
+ */
+
+%include <javascriptcomplex.swg>
+
+%{
+#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)
+%swig_cplxflt_convn(std::complex<float>, std::complex<float>, std::real, std::imag)
+
+/* defining the typemaps */
+
+%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>);
+%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>);
diff --git a/linux-x86/share/swig/javascript/napi/std_deque.i b/linux-x86/share/swig/javascript/napi/std_deque.i
new file mode 100644
index 0000000..cb98f6c
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_deque.i
@@ -0,0 +1 @@
+%include <std/_std_deque.i>
diff --git a/linux-x86/share/swig/javascript/napi/std_except.i b/linux-x86/share/swig/javascript/napi/std_except.i
new file mode 100644
index 0000000..af98428
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_except.i
@@ -0,0 +1 @@
+%include <typemaps/std_except.swg>
diff --git a/linux-x86/share/swig/javascript/napi/std_map.i b/linux-x86/share/swig/javascript/napi/std_map.i
new file mode 100644
index 0000000..a33e886
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_map.i
@@ -0,0 +1,71 @@
+/* -----------------------------------------------------------------------------
+ * 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 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& 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, 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) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
+ (*self)[key] = x;
+%#endif
+ }
+ 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/linux-x86/share/swig/javascript/napi/std_pair.i b/linux-x86/share/swig/javascript/napi/std_pair.i
new file mode 100644
index 0000000..b72c50b
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_pair.i
@@ -0,0 +1,35 @@
+/* -----------------------------------------------------------------------------
+ * std_pair.i
+ *
+ * SWIG typemaps for std::pair
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::pair
+// ------------------------------------------------------------------------
+
+%{
+#include <utility>
+%}
+
+namespace std {
+
+ template<class T, class U> struct pair {
+ typedef T first_type;
+ typedef U second_type;
+
+ pair();
+ pair(T first, U second);
+ pair(const pair& other);
+
+ template <class U1, class U2> pair(const pair<U1, U2> &other);
+
+ T first;
+ U second;
+ };
+
+ // add specializations here
+
+}
diff --git a/linux-x86/share/swig/javascript/napi/std_string.i b/linux-x86/share/swig/javascript/napi/std_string.i
new file mode 100644
index 0000000..dc1378a
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_string.i
@@ -0,0 +1 @@
+%include <typemaps/std_string.swg>
diff --git a/linux-x86/share/swig/javascript/napi/std_unique_ptr.i b/linux-x86/share/swig/javascript/napi/std_unique_ptr.i
new file mode 100644
index 0000000..f988714
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/javascript/napi/std_vector.i b/linux-x86/share/swig/javascript/napi/std_vector.i
new file mode 100644
index 0000000..586ac5c
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/std_vector.i
@@ -0,0 +1,99 @@
+/* -----------------------------------------------------------------------------
+ * 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 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);
+ %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");
+ }
+ }
+ };
+
+ // bool specialization
+ 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);
+ %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");
+ }
+ }
+ };
+}
+
+%define specialize_std_vector(T)
+#warning "specialize_std_vector - specialization for type T no longer needed"
+%enddef
+
diff --git a/linux-x86/share/swig/pointer.i b/linux-x86/share/swig/javascript/napi/stl.i
index ea8e535..04f8601 100644
--- a/linux-x86/share/swig/pointer.i
+++ b/linux-x86/share/swig/javascript/napi/stl.i
@@ -1,11 +1,10 @@
/* -----------------------------------------------------------------------------
- * pointer.i
+ * stl.i
* ----------------------------------------------------------------------------- */
-
-%echo "pointer.i is deprecated. Use cpointer.i instead."
-%echo "See http://www.swig.org/Doc3.0/Library.html"
-
-
-
+%include <std_common.i>
+%include <std_string.i>
+%include <std_vector.i>
+%include <std_map.i>
+%include <std_pair.i>
diff --git a/linux-x86/share/swig/javascript/napi/swigmove.i b/linux-x86/share/swig/javascript/napi/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/javascript/napi/typemaps.i b/linux-x86/share/swig/javascript/napi/typemaps.i
new file mode 100644
index 0000000..08b5838
--- /dev/null
+++ b/linux-x86/share/swig/javascript/napi/typemaps.i
@@ -0,0 +1,144 @@
+/* -----------------------------------------------------------------------------
+ * typemaps.i
+ *
+ * Pointer handling
+ * These mappings provide support for input/output arguments and common
+ * uses for C/C++ pointers.
+ * ----------------------------------------------------------------------------- */
+
+// INPUT typemaps.
+// These remap a C pointer to be an "INPUT" value which is passed by value
+// instead of reference.
+
+/*
+The following methods can be applied to turn a pointer into a simple
+"input" value. That is, instead of passing a pointer to an object,
+you would use a real value instead.
+
+ int *INPUT
+ short *INPUT
+ long *INPUT
+ long long *INPUT
+ unsigned int *INPUT
+ unsigned short *INPUT
+ unsigned long *INPUT
+ unsigned long long *INPUT
+ unsigned char *INPUT
+ bool *INPUT
+ float *INPUT
+ double *INPUT
+
+To use these, suppose you had a C function like this :
+
+ double fadd(double *a, double *b) {
+ return *a+*b;
+ }
+
+You could wrap it with SWIG as follows :
+
+ %include <typemaps.i>
+ double fadd(double *INPUT, double *INPUT);
+
+or you can use the %apply directive :
+
+ %include <typemaps.i>
+ %apply double *INPUT { double *a, double *b };
+ double fadd(double *a, double *b);
+
+*/
+
+// OUTPUT typemaps. These typemaps are used for parameters that
+// are output only. The output value is appended to the result as
+// a list element.
+
+/*
+The following methods can be applied to turn a pointer into an "output"
+value. When calling a function, no input value would be given for
+a parameter, but an output value would be returned. In the case of
+multiple output values, they are returned in the form of a Python tuple.
+
+ int *OUTPUT
+ short *OUTPUT
+ long *OUTPUT
+ long long *OUTPUT
+ unsigned int *OUTPUT
+ unsigned short *OUTPUT
+ unsigned long *OUTPUT
+ unsigned long long *OUTPUT
+ unsigned char *OUTPUT
+ bool *OUTPUT
+ float *OUTPUT
+ double *OUTPUT
+
+For example, suppose you were trying to wrap the modf() function in the
+C math library which splits x into integral and fractional parts (and
+returns the integer part in one of its parameters) :
+
+ double modf(double x, double *ip);
+
+You could wrap it with SWIG as follows :
+
+ %include <typemaps.i>
+ double modf(double x, double *OUTPUT);
+
+or you can use the %apply directive :
+
+ %include <typemaps.i>
+ %apply double *OUTPUT { double *ip };
+ double modf(double x, double *ip);
+
+The Python output of the function would be a tuple containing both
+output values.
+
+*/
+
+// INOUT
+// Mappings for an argument that is both an input and output
+// parameter
+
+/*
+The following methods can be applied to make a function parameter both
+an input and output value. This combines the behavior of both the
+"INPUT" and "OUTPUT" methods described earlier. Output values are
+returned in the form of a Python tuple.
+
+ int *INOUT
+ short *INOUT
+ long *INOUT
+ long long *INOUT
+ unsigned int *INOUT
+ unsigned short *INOUT
+ unsigned long *INOUT
+ unsigned long long *INOUT
+ unsigned char *INOUT
+ bool *INOUT
+ float *INOUT
+ double *INOUT
+
+For example, suppose you were trying to wrap the following function :
+
+ void neg(double *x) {
+ *x = -(*x);
+ }
+
+You could wrap it with SWIG as follows :
+
+ %include <typemaps.i>
+ void neg(double *INOUT);
+
+or you can use the %apply directive :
+
+ %include <typemaps.i>
+ %apply double *INOUT { double *x };
+ void neg(double *x);
+
+Unlike C, this mapping does not directly modify the input value (since
+this makes no sense in Python). Rather, the modified input value shows
+up as the return value of the function. Thus, to apply this function
+to a Python variable you might do this :
+
+ x = neg(x)
+
+*/
+
+%include <typemaps/typemaps.swg>
diff --git a/linux-x86/share/swig/javascript/v8/argcargv.i b/linux-x86/share/swig/javascript/v8/argcargv.i
new file mode 100644
index 0000000..b1396a4
--- /dev/null
+++ b/linux-x86/share/swig/javascript/v8/argcargv.i
@@ -0,0 +1,75 @@
+/* ------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------ */
+
+%{
+#ifndef SWIGV8_VALUE_TO_ARRAY
+# define SWIGV8_VALUE_TO_ARRAY(val) SWIGV8_ARRAY::Cast(val)
+#endif
+#ifndef SWIGV8_STRING
+# define SWIGV8_STRING v8::Local<v8::String>
+#endif
+
+SWIGINTERN int SWIG_AsVal_string (SWIGV8_VALUE valRef, SWIGV8_STRING *str)
+{
+ if (!valRef->IsString()) {
+ return SWIG_TypeError;
+ }
+ if(str != SWIG_NULLPTR) {
+ *str = SWIGV8_TO_STRING(valRef);
+ }
+ return SWIG_OK;
+}
+%}
+
+%typemap(in) (int ARGC, char **ARGV) {
+ $1_ltype i, len;
+ size_t arraysize;
+ SWIGV8_ARRAY array;
+ if (!$input->IsArray()) {
+ SWIG_exception_fail(SWIG_ERROR, "not array");
+ }
+ array = SWIGV8_VALUE_TO_ARRAY($input);
+ len = array->Length();
+ arraysize = (len+1)*sizeof($*2_ltype);
+ $1 = len;
+ $2 = ($2_ltype) malloc(arraysize);
+ if ($2 == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_ERROR, "memory allocation of array failed");
+ }
+ memset($2, 0, arraysize);
+ for (i = 0; i < len; i++) {
+ int res, slen;
+ $*2_ltype pstr;
+ SWIGV8_STRING str;
+ SWIGV8_VALUE jsvalue = SWIGV8_ARRAY_GET(array, i);
+ res = SWIG_AsVal_string(jsvalue, &str);
+ if (!SWIG_IsOK(res)) {
+ SWIG_exception_fail(SWIG_ERROR, "failed to convert to string");
+ }
+ slen = SWIGV8_UTF8_LENGTH(str);
+ pstr = ($*2_ltype) malloc(slen + 1);
+ if (pstr == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_ERROR, "memory allocation of a string failed");
+ }
+ if (slen) {
+ res = SWIGV8_WRITE_UTF8(str, pstr, slen);
+ if (res != slen) {
+ SWIG_exception_fail(SWIG_ERROR, "wrong string length");
+ }
+ }
+ pstr[slen] = 0;
+ $2[i] = pstr;
+ }
+ $2[i] = SWIG_NULLPTR;
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ if ($2 != SWIG_NULLPTR) {
+ $1_ltype i;
+ for (i = 0; i < $1; i++) {
+ free((void *)$2[i]);
+ }
+ free((void *)$2);
+ }
+}
diff --git a/linux-x86/share/swig/javascript/v8/arrays_javascript.i b/linux-x86/share/swig/javascript/v8/arrays_javascript.i
index 22b50be..6dc7e4b 100644
--- a/linux-x86/share/swig/javascript/v8/arrays_javascript.i
+++ b/linux-x86/share/swig/javascript/v8/arrays_javascript.i
@@ -21,105 +21,66 @@
* fs = example.FiddleSticks;
* ----------------------------------------------------------------------------- */
-%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {}
+
+%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {}
%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {}
+%fragment("SWIG_JSCOutInt", "header", fragment=SWIG_From_frag(int)) {}
+%fragment("SWIG_JSCOutNumber", "header", fragment=SWIG_From_frag(double)) {}
+
+%define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH)
-%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY]
- (int length = 0, v8::Local<v8::Array> array, v8::Local<v8::Value> jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
- if ($input->IsArray())
- {
+%typemap(in, fragment=NAME) CTYPE[ANY] {
+ if ($input->IsArray()) {
// Convert into Array
- array = v8::Local<v8::Array>::Cast($input);
+ v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast($input);
- length = $1_dim0;
+ int length = ANYLENGTH;
- $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
+ $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
// Get each element from array
- for (i = 0; i < length; i++)
- {
- jsvalue = array->Get(i);
+ for (int i = 0; i < length; i++) {
+ v8::Local<v8::Value> jsvalue = SWIGV8_ARRAY_GET(array, i);
+ $*1_ltype temp;
// Get primitive value from JSObject
- res = SWIG_AsVal(int)(jsvalue, &temp);
- if (!SWIG_IsOK(res))
- {
+ int res = SWIG_AsVal(CTYPE)(jsvalue, &temp);
+ if (!SWIG_IsOK(res)) {
SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
}
arg$argnum[i] = temp;
}
-
- }
- else
- {
- SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
+ } else {
+ SWIG_exception_fail(SWIG_ERROR, "$input is not an array");
}
}
-%typemap(freearg) int[], int[ANY] {
- free($1);
+%typemap(freearg) CTYPE[ANY] {
+ free($1);
}
-%typemap(out, fragment=SWIG_From_frag(int)) int[], int[ANY] (int length = 0, int i = 0)
-{
- length = $1_dim0;
- v8::Local<v8::Array> array = v8::Array::New(length);
-
- for (i = 0; i < length; i++)
- {
- array->Set(i, SWIG_From(int)($1[i]));
- }
-
-
- $result = array;
-}
-
-%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY]
- (int length = 0, v8::Local<v8::Array> array, v8::Local<v8::Value> jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
- if ($input->IsArray())
- {
- // Convert into Array
- array = v8::Local<v8::Array>::Cast($input);
-
- length = $1_dim0;
+%enddef
- $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
+%define JAVASCRIPT_ARRAYS_OUT_DECL(NAME, CTYPE)
- // Get each element from array
- for (i = 0; i < length; i++)
- {
- jsvalue = array->Get(i);
-
- // Get primitive value from JSObject
- res = SWIG_AsVal(double)(jsvalue, &temp);
- if (!SWIG_IsOK(res))
- {
- SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
- }
- arg$argnum[i] = temp;
- }
+%typemap(out, fragment=NAME) CTYPE[ANY] {
+ int length = $1_dim0;
+ v8::Local<v8::Array> array = SWIGV8_ARRAY_NEW(length);
+ for (int i = 0; i < length; i++) {
+ SWIGV8_ARRAY_SET(array, i, SWIG_From(CTYPE)($1[i]));
}
- else
- {
- SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
- }
-}
-%typemap(freearg) double[], double[ANY] {
- free($1);
+ $result = array;
}
-%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0)
-{
- length = $1_dim0;
- v8::Local<v8::Array> array = v8::Array::New(length);
+%enddef
- for (i = 0; i < length; i++)
- {
- array->Set(i, SWIG_From(double)($1[i]));
- }
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetIntProperty", int, , array->Length())
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetIntProperty", int, ANY, $1_dim0)
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetNumberProperty", double, , array->Length())
+JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetNumberProperty", double, ANY, $1_dim0)
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutInt", int)
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutNumber", double)
- $result = array;
-}
diff --git a/linux-x86/share/swig/javascript/v8/ccomplex.i b/linux-x86/share/swig/javascript/v8/ccomplex.i
index 8eda920..e58dbf7 100644
--- a/linux-x86/share/swig/javascript/v8/ccomplex.i
+++ b/linux-x86/share/swig/javascript/v8/ccomplex.i
@@ -6,21 +6,22 @@
* ----------------------------------------------------------------------------- */
-%include <javscriptcomplex.swg>
+%include <javascriptcomplex.swg>
%{
#include <complex.h>
%}
+#define complex _Complex
/* C complex constructor */
#define CCplxConst(r, i) ((r) + I*(i))
-%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag);
-%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag);
-%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
+%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag);
/* declaring the typemaps */
-%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex);
-%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex);
-%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex);
diff --git a/linux-x86/share/swig/javascript/v8/cmalloc.i b/linux-x86/share/swig/javascript/v8/cmalloc.i
new file mode 100644
index 0000000..248f06b
--- /dev/null
+++ b/linux-x86/share/swig/javascript/v8/cmalloc.i
@@ -0,0 +1 @@
+%include <typemaps/cmalloc.swg>
diff --git a/linux-x86/share/swig/javascript/v8/factory.i b/linux-x86/share/swig/javascript/v8/factory.i
new file mode 100644
index 0000000..46a0a87
--- /dev/null
+++ b/linux-x86/share/swig/javascript/v8/factory.i
@@ -0,0 +1 @@
+%include <typemaps/factory.swg>
diff --git a/linux-x86/share/swig/javascript/v8/javascriptcode.swg b/linux-x86/share/swig/javascript/v8/javascriptcode.swg
index c4aaf3d..7705865 100644
--- a/linux-x86/share/swig/javascript/v8/javascriptcode.swg
+++ b/linux-x86/share/swig/javascript/v8/javascriptcode.swg
@@ -4,16 +4,18 @@
* - $jslocals: locals part of wrapper
* - $jscode: code part of wrapper
* - $jsargcount: number of arguments
+ * - $jsargrequired: required number of arguments
* - $jsmangledtype: mangled type of class
* ----------------------------------------------------------------------------- */
%fragment("js_ctor", "templates") %{
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
-
- v8::Handle<v8::Object> self = args.Holder();
+
+ SWIGV8_OBJECT self = args.Holder();
$jslocals
- if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ if(self->InternalFieldCount() < 1) SWIG_exception_fail(SWIG_ERROR, "Illegal call of constructor $jswrapper.");
+ if(args.Length() < $jsargrequired || args.Length() > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
SWIGV8_SetPrivateData(self, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN);
@@ -53,7 +55,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
OverloadErrorHandler errorHandler;
- v8::Handle<v8::Value> self;
+ SWIGV8_VALUE self;
// switch all cases by means of series of if-returns.
$jsdispatchcases
@@ -72,15 +74,17 @@ fail:
* - $jslocals: locals part of wrapper
* - $jscode: code part of wrapper
* - $jsargcount: number of arguments
+ * - $jsargrequired: required number of arguments
* - $jsmangledtype: mangled type of class
* ----------------------------------------------------------------------------- */
%fragment("js_overloaded_ctor", "templates") %{
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
SWIGV8_HANDLESCOPE();
-
- v8::Handle<v8::Object> self = args.Holder();
+
+ SWIGV8_OBJECT self = args.Holder();
$jslocals
- if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ if(self->InternalFieldCount() < 1) SWIG_exception_fail(SWIG_ERROR, "Illegal call of constructor $jswrapper.");
+ if(args.Length() < $jsargrequired || args.Length() > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
SWIGV8_SetPrivateData(self, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN);
@@ -95,25 +99,19 @@ fail:
/* -----------------------------------------------------------------------------
* js_ctor_dispatch_case: template for a dispatch case for calling an overloaded ctor.
* - $jsargcount: number of arguments of called ctor
+ * - $jsargrequired: required number of arguments
* - $jswrapper: wrapper of called ctor
*
* Note: a try-catch-like mechanism is used to switch cases
* ----------------------------------------------------------------------------- */
%fragment ("js_ctor_dispatch_case", "templates")
%{
- if(args.Length() == $jsargcount) {
+ if(args.Length() >= $jsargrequired && args.Length() <= $jsargcount) {
errorHandler.err.Clear();
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- self = $jswrapper(args, errorHandler);
- if(errorHandler.err.IsEmpty()) {
- SWIGV8_ESCAPE(self);
- }
-#else
$jswrapper(args, errorHandler);
if(errorHandler.err.IsEmpty()) {
return;
}
-#endif
}
%}
@@ -125,22 +123,8 @@ fail:
%fragment ("js_dtor", "templates")
%{
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-static void $jswrapper(v8::Persistent< v8::Value > object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
-static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) {
-#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) {
+static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
-#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
#ifdef SWIGRUNTIME_DEBUG
@@ -149,20 +133,6 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
$jsfree proxy->swigCObject;
}
delete proxy;
-
-#if (V8_MAJOR_VERSION-0) < 5
- object.Clear();
-#endif
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- object.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- object.Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- object->Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 5
- object->Dispose();
-#endif
}
%}
@@ -174,40 +144,14 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
* ----------------------------------------------------------------------------- */
%fragment ("js_dtoroverride", "templates")
%{
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-static void $jswrapper(v8::Persistent<v8::Value> object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
-static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
-#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) {
$jstype arg1 = ($jstype)proxy->swigCObject;
${destructor_action}
}
delete proxy;
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- object.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- object.Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- object->Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- object->Dispose();
-#elif (V8_MAJOR_VERSION-0) < 5
- object.Clear();
-#endif
}
%}
@@ -219,14 +163,10 @@ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
* ----------------------------------------------------------------------------- */
%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;
+ SWIGV8_VALUE jsresult;
$jslocals
$jscode
SWIGV8_RETURN_INFO(jsresult, info);
@@ -245,11 +185,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("js_setter", "templates")
%{
-#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
@@ -262,18 +198,20 @@ fail:
/* -----------------------------------------------------------------------------
* js_function: template for function wrappers
- * - $jswrapper: wrapper function name
- * - $jslocals: locals part of wrapper
- * - $jscode: code part of wrapper
+ * - $jswrapper: wrapper function name
+ * - $jslocals: locals part of wrapper
+ * - $jscode: code part of wrapper
+ * - $jsargcount: number of arguments
+ * - $jsargrequired: required number of arguments
* ----------------------------------------------------------------------------- */
%fragment("js_function", "templates")
%{
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ SWIGV8_VALUE jsresult;
$jslocals
- if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
+ if (args.Length() < $jsargrequired || args.Length() > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
SWIGV8_RETURN(jsresult);
@@ -296,7 +234,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ SWIGV8_VALUE jsresult;
OverloadErrorHandler errorHandler;
$jscode
@@ -320,7 +258,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler
{
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ SWIGV8_VALUE jsresult;
$jslocals
$jscode
SWIGV8_RETURN(jsresult);
@@ -333,30 +271,31 @@ fail:
/* -----------------------------------------------------------------------------
* js_function_dispatch_case: template for a case used in the function dispatcher
- * - $jswrapper: wrapper function name
- * - $jsargcount: number of arguments of overloaded function
- * - $jscode: code part of wrapper
+ * - $jswrapper: wrapper function name
+ * - $jsargcount: number of arguments of overloaded function
+ * - $jsargrequired: required number of arguments
+ * - $jscode: code part of wrapper
* ----------------------------------------------------------------------------- */
%fragment ("js_function_dispatch_case", "templates")
%{
- if(args.Length() == $jsargcount) {
+ if(args.Length() >= $jsargrequired && args.Length() <= $jsargcount) {
errorHandler.err.Clear();
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- jsresult = $jswrapper(args, errorHandler);
- if(errorHandler.err.IsEmpty()) {
- SWIGV8_ESCAPE(jsresult);
- }
-#else
$jswrapper(args, errorHandler);
if(errorHandler.err.IsEmpty()) {
return;
}
-#endif
}
%}
/* -----------------------------------------------------------------------------
+ * js_check_arg: template for checking if an argument exists
+ * - $jsarg: number of argument
+ * ----------------------------------------------------------------------------- */
+%fragment ("js_check_arg", "templates")
+%{if(args.Length() > $jsarg)%}
+
+/* -----------------------------------------------------------------------------
* jsv8_declare_class_template: template for a class template declaration.
* - $jsmangledname: mangled class name
* ----------------------------------------------------------------------------- */
@@ -374,7 +313,7 @@ fail:
%fragment("jsv8_define_class_template", "templates")
%{
/* Name: $jsmangledname, Type: $jsmangledtype, Dtor: $jsdtor */
- v8::Handle<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
+ SWIGV8_FUNCTION_TEMPLATE $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class);
$jsmangledname_clientData.dtor = $jsdtor;
if (SWIGTYPE_$jsmangledtype->clientdata == 0) {
@@ -392,15 +331,11 @@ fail:
%{
if (SWIGTYPE_p$jsbaseclass->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ.IsEmpty()))
{
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- $jsmangledname_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ);
-#else
$jsmangledname_class->Inherit(
v8::Local<v8::FunctionTemplate>::New(
v8::Isolate::GetCurrent(),
static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ)
);
-#endif
#ifdef SWIGRUNTIME_DEBUG
printf("Inheritance successful $jsmangledname $jsbaseclass\n");
@@ -420,11 +355,15 @@ fail:
%fragment("jsv8_create_class_instance", "templates")
%{
/* Class: $jsname ($jsmangledname) */
- v8::Handle<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
+ SWIGV8_FUNCTION_TEMPLATE $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
$jsmangledname_class_0->SetCallHandler($jsctor);
$jsmangledname_class_0->Inherit($jsmangledname_class);
+#if (SWIG_V8_VERSION < 0x0704)
$jsmangledname_class_0->SetHiddenPrototype(true);
- v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+ v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+#else
+ v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(context).ToLocalChecked();
+#endif
%}
/* -----------------------------------------------------------------------------
@@ -435,7 +374,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_class", "templates")
%{
- $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
+ SWIGV8_MAYBE_CHECK($jsparent_obj->Set(context, SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj));
%}
/* -----------------------------------------------------------------------------
@@ -444,7 +383,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_create_namespace", "templates")
%{
- v8::Handle<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW();
+ SWIGV8_OBJECT $jsmangledname_obj = SWIGV8_OBJECT_NEW();
%}
/* -----------------------------------------------------------------------------
@@ -455,7 +394,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_namespace", "templates")
%{
- $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
+ SWIGV8_MAYBE_CHECK($jsparent_obj->Set(context, SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj));
%}
/* -----------------------------------------------------------------------------
@@ -491,7 +430,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_static_function", "templates")
%{
- SWIGV8_AddStaticFunction($jsparent_obj, "$jsname", $jswrapper);
+ SWIGV8_AddStaticFunction($jsparent_obj, "$jsname", $jswrapper, context);
%}
/* -----------------------------------------------------------------------------
@@ -505,5 +444,5 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_static_variable", "templates")
%{
- SWIGV8_AddStaticVariable($jsparent_obj, "$jsname", $jsgetter, $jssetter);
+ SWIGV8_AddStaticVariable($jsparent_obj, "$jsname", $jsgetter, $jssetter, context);
%}
diff --git a/linux-x86/share/swig/javascript/v8/javascriptcomplex.swg b/linux-x86/share/swig/javascript/v8/javascriptcomplex.swg
index d3b4aaf..7b3c554 100644
--- a/linux-x86/share/swig/javascript/v8/javascriptcomplex.swg
+++ b/linux-x86/share/swig/javascript/v8/javascriptcomplex.swg
@@ -12,15 +12,15 @@
%fragment(SWIG_From_frag(Type),"header",
fragment=SWIG_From_frag(double))
{
-SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIGINTERNINLINE SWIGV8_VALUE
SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
{
SWIGV8_HANDLESCOPE_ESC();
- v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW();
+ v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW(0);
- vals->Set(0, SWIG_From(double)(Real(c)));
- vals->Set(1, SWIG_From(double)(Imag(c)));
+ SWIGV8_ARRAY_SET(vals, 0, SWIG_From(double)(Real(c)));
+ SWIGV8_ARRAY_SET(vals, 1, SWIG_From(double)(Imag(c)));
SWIGV8_ESCAPE(vals);
}
}
@@ -32,30 +32,30 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
fragment=SWIG_AsVal_frag(double))
{
SWIGINTERN int
-SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
+SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
{
SWIGV8_HANDLESCOPE();
if (o->IsArray()) {
- v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
+ SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o);
- if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
+ if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
double re, im;
int res;
- res = SWIG_AsVal(double)(array->Get(0), &re);
- if(!SWIG_IsOK(res)) {
+ res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re);
+ if (!SWIG_IsOK(res)) {
return SWIG_TypeError;
}
- res = SWIG_AsVal(double)(array->Get(1), &im);
- if(!SWIG_IsOK(res)) {
+ res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im);
+ if (!SWIG_IsOK(res)) {
return SWIG_TypeError;
}
if (val) *val = Constructor(re, im);
return SWIG_OK;
- } else if(o->IsNumber()){
+ } else if (o->IsNumber()) {
double d;
int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d));
if (SWIG_IsOK(res)) {
@@ -74,24 +74,24 @@ SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
%fragment(SWIG_AsVal_frag(Type),"header",
fragment=SWIG_AsVal_frag(float)) {
SWIGINTERN int
-SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
+SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
{
SWIGV8_HANDLESCOPE();
if (o->IsArray()) {
- v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
+ SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o);
- if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
+ if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
double re, im;
int res;
- res = SWIG_AsVal(double)(array->Get(0), &re);
- if(!SWIG_IsOK(res)) {
+ res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re);
+ if (!SWIG_IsOK(res)) {
return SWIG_TypeError;
}
- res = SWIG_AsVal(double)(array->Get(1), &im);
- if(!SWIG_IsOK(res)) {
+ res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im);
+ if (!SWIG_IsOK(res)) {
return SWIG_TypeError;
}
@@ -102,7 +102,7 @@ SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
} else {
return SWIG_OverflowError;
}
- } else if(o->IsNumber()){
+ } else if (o->IsNumber()) {
float re;
int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
if (SWIG_IsOK(res)) {
diff --git a/linux-x86/share/swig/javascript/v8/javascripthelpers.swg b/linux-x86/share/swig/javascript/v8/javascripthelpers.swg
index 80fbd7a..7f70406 100644
--- a/linux-x86/share/swig/javascript/v8/javascripthelpers.swg
+++ b/linux-x86/share/swig/javascript/v8/javascripthelpers.swg
@@ -1,39 +1,26 @@
%insert(runtime) %{
-// Note: since 3.19 there are new CallBack types, since 03.21.9 the old ones have been removed
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
-typedef v8::InvocationCallback SwigV8FunctionCallback;
-typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
-typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
-typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
-#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
/**
* Creates a class template for a class with specified initialization function.
*/
-SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
+SWIGRUNTIME SWIGV8_FUNCTION_TEMPLATE SWIGV8_CreateClassTemplate(const char* symbol) {
SWIGV8_HANDLESCOPE_ESC();
v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
- v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
+ SWIGV8_OBJECT_TEMPLATE inst_templ = class_templ->InstanceTemplate();
inst_templ->SetInternalFieldCount(1);
- v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
+ SWIGV8_OBJECT_TEMPLATE equals_templ = class_templ->PrototypeTemplate();
equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals));
- v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
+ SWIGV8_OBJECT_TEMPLATE cptr_templ = class_templ->PrototypeTemplate();
cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
SWIGV8_ESCAPE(class_templ);
@@ -42,64 +29,52 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch
/**
* Registers a class method with given name for a given class template.
*/
-SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddMemberFunction(SWIGV8_FUNCTION_TEMPLATE class_templ, const char* symbol,
SwigV8FunctionCallback _func) {
- v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
+ SWIGV8_OBJECT_TEMPLATE proto_templ = class_templ->PrototypeTemplate();
proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func));
}
/**
* Registers a class property with given name for a given class template.
*/
-SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddMemberVariable(SWIGV8_FUNCTION_TEMPLATE class_templ, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
- v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
+ SWIGV8_OBJECT_TEMPLATE proto_templ = class_templ->InstanceTemplate();
proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
}
/**
* Registers a class method with given name for a given object.
*/
-SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
- const SwigV8FunctionCallback& _func) {
- obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
+SWIGRUNTIME void SWIGV8_AddStaticFunction(SWIGV8_OBJECT obj, const char* symbol,
+ const SwigV8FunctionCallback& _func, v8::Local<v8::Context> context) {
+ SWIGV8_MAYBE_CHECK(obj->Set(context, SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(context).ToLocalChecked()));
}
/**
* Registers a class method with given name for a given object.
*/
-SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
- SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
-#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 SWIGV8_AddStaticVariable(SWIGV8_OBJECT obj, const char* symbol,
+ SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter,
+ v8::Local<v8::Context> context) {
+ SWIGV8_MAYBE_CHECK(obj->SetAccessor(context, SWIGV8_SYMBOL_NEW(symbol), getter, setter));
}
-#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);
+ res = SWIG_snprintf(msg, sizeof(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/linux-x86/share/swig/javascript/v8/javascriptinit.swg b/linux-x86/share/swig/javascript/v8/javascriptinit.swg
index 8faf2dd..3bf8c41 100644
--- a/linux-x86/share/swig/javascript/v8/javascriptinit.swg
+++ b/linux-x86/share/swig/javascript/v8/javascriptinit.swg
@@ -5,29 +5,21 @@
%insert(init) %{
SWIGRUNTIME void
-SWIG_V8_SetModule(void *, swig_module_info *swig_module) {
- v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
+SWIG_V8_SetModule(v8::Local<v8::Context> context, swig_module_info *swig_module) {
+ v8::Local<v8::Object> global_obj = 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
+ global_obj->SetPrivate(context, privateKey, mod);
}
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
+SWIG_V8_GetModule(v8::Local<v8::Context> context) {
+ v8::Local<v8::Object> global_obj = context->Global();
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))
+ if (!global_obj->GetPrivate(context, privateKey).ToLocal(&moduleinfo))
return 0;
-#endif
if (moduleinfo.IsEmpty() || moduleinfo->IsNull() || moduleinfo->IsUndefined())
{
@@ -52,6 +44,7 @@ SWIG_V8_GetModule(void *) {
#define SWIG_GetModule(clientdata) SWIG_V8_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_V8_SetModule(clientdata, pointer)
+#define SWIG_INIT_CLIENT_DATA_TYPE v8::Local<v8::Context>
%}
@@ -64,20 +57,20 @@ SWIG_V8_GetModule(void *) {
%}
%insert(init) %{
+#if !defined(NODE_MODULE_VERSION) || (NODE_MODULE_VERSION < 12)
// Note: 'extern "C"'' disables name mangling which makes it easier to load the symbol manually
-// TODO: is it ok to do that?
-extern "C"
-#if (NODE_MODULE_VERSION < 0x000C)
-void SWIGV8_INIT (v8::Handle<v8::Object> exports)
+extern "C" void SWIGV8_INIT (SWIGV8_OBJECT exports_obj)
+#elif (NODE_MODULE_VERSION < 64)
+void SWIGV8_INIT (SWIGV8_OBJECT exports_obj, SWIGV8_VALUE /*module*/, void*)
#else
-void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*module*/)
+void SWIGV8_INIT (SWIGV8_OBJECT exports_obj, SWIGV8_VALUE /*module*/, v8::Local<v8::Context> context, void*)
#endif
{
- SWIG_InitializeModule(static_cast<void *>(&exports));
+#if !defined(NODE_MODULE_VERSION) || NODE_MODULE_VERSION < 64
+ v8::Local<v8::Context> context = SWIGV8_CURRENT_CONTEXT();
+#endif
- SWIGV8_HANDLESCOPE();
-
- v8::Handle<v8::Object> exports_obj = exports;
+ SWIG_InitializeModule(context);
%}
@@ -124,6 +117,10 @@ void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*modul
}
#if defined(BUILDING_NODE_EXTENSION)
+#if (NODE_MODULE_VERSION < 64)
NODE_MODULE($jsname, $jsname_initialize)
+#else
+NODE_MODULE_CONTEXT_AWARE($jsname, $jsname_initialize)
+#endif
#endif
%}
diff --git a/linux-x86/share/swig/javascript/v8/javascriptprimtypes.swg b/linux-x86/share/swig/javascript/v8/javascriptprimtypes.swg
index f76be98..8ed571d 100644
--- a/linux-x86/share/swig/javascript/v8/javascriptprimtypes.swg
+++ b/linux-x86/share/swig/javascript/v8/javascriptprimtypes.swg
@@ -6,7 +6,7 @@
%fragment(SWIG_From_frag(bool),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value>
+SWIGV8_VALUE
SWIG_From_dec(bool)(bool value)
{
return SWIGV8_BOOLEAN_NEW(value);
@@ -16,7 +16,7 @@ SWIG_From_dec(bool)(bool value)
%fragment(SWIG_AsVal_frag(bool),"header",
fragment=SWIG_AsVal_frag(long)) {
SWIGINTERN
-int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
+int SWIG_AsVal_dec(bool)(SWIGV8_VALUE obj, bool *val)
{
if(!obj->IsBoolean()) {
return SWIG_ERROR;
@@ -31,7 +31,7 @@ int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
%fragment(SWIG_From_frag(int),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
+SWIGV8_VALUE SWIG_From_dec(int)(int value)
{
return SWIGV8_INT32_NEW(value);
}
@@ -39,7 +39,7 @@ v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
%fragment(SWIG_AsVal_frag(int),"header") {
SWIGINTERN
-int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
+int SWIG_AsVal_dec(int)(SWIGV8_VALUE valRef, int* val)
{
if (!valRef->IsNumber()) {
return SWIG_TypeError;
@@ -54,7 +54,7 @@ int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
%fragment(SWIG_From_frag(long),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
+SWIGV8_VALUE SWIG_From_dec(long)(long value)
{
return SWIGV8_NUMBER_NEW(value);
}
@@ -63,7 +63,7 @@ v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
%fragment(SWIG_AsVal_frag(long),"header",
fragment="SWIG_CanCastAsInteger") {
SWIGINTERN
-int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
+int SWIG_AsVal_dec(long)(SWIGV8_VALUE obj, long* val)
{
if (!obj->IsNumber()) {
return SWIG_TypeError;
@@ -79,17 +79,16 @@ int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
%fragment(SWIG_From_frag(unsigned long),"header",
fragment=SWIG_From_frag(long)) {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
+SWIGV8_VALUE SWIG_From_dec(unsigned long)(unsigned long value)
{
- return (value > LONG_MAX) ?
- SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
+ return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast<double>(value));
}
}
%fragment(SWIG_AsVal_frag(unsigned long),"header",
fragment="SWIG_CanCastAsInteger") {
SWIGINTERN
-int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
+int SWIG_AsVal_dec(unsigned long)(SWIGV8_VALUE obj, unsigned long *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
@@ -115,7 +114,7 @@ int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
+SWIGV8_VALUE SWIG_From_dec(long long)(long long value)
{
return SWIGV8_NUMBER_NEW(value);
}
@@ -128,7 +127,7 @@ v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERN
-int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
+int SWIG_AsVal_dec(long long)(SWIGV8_VALUE obj, long long* val)
{
if (!obj->IsNumber()) {
return SWIG_TypeError;
@@ -148,10 +147,9 @@ int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value)
+SWIGV8_VALUE SWIG_From_dec(unsigned long long)(unsigned long long value)
{
- return (value > LONG_MAX) ?
- SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
+ return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast<double>(value));
}
%#endif
}
@@ -162,7 +160,7 @@ v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERN
-int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long long *val)
+int SWIG_AsVal_dec(unsigned long long)(SWIGV8_VALUE obj, unsigned long long *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
@@ -185,7 +183,7 @@ int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long
%fragment(SWIG_From_frag(double),"header") {
SWIGINTERN
-v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
+SWIGV8_VALUE SWIG_From_dec(double) (double val)
{
return SWIGV8_NUMBER_NEW(val);
}
@@ -193,7 +191,7 @@ v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
%fragment(SWIG_AsVal_frag(double),"header") {
SWIGINTERN
-int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
+int SWIG_AsVal_dec(double)(SWIGV8_VALUE obj, double *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
@@ -203,4 +201,3 @@ int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
return SWIG_OK;
}
}
-
diff --git a/linux-x86/share/swig/javascript/v8/javascriptrun.swg b/linux-x86/share/swig/javascript/v8/javascriptrun.swg
index 2452f40..4980863 100644
--- a/linux-x86/share/swig/javascript/v8/javascriptrun.swg
+++ b/linux-x86/share/swig/javascript/v8/javascriptrun.swg
@@ -1,75 +1,44 @@
/* ---------------------------------------------------------------------------
* These typedefs and defines are used to deal with v8 API changes
*
+ * Useful table of versions: https://nodejs.org/en/download/releases/
* ---------------------------------------------------------------------------*/
-// First v8 version that uses "SetWeak" and not "MakeWeak"
-
-#define SWIGV8_SETWEAK_VERSION 0x032224
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803)
-#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
-#else
+#if (SWIG_V8_VERSION < 0x0704)
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
+#else
+#define SWIGV8_STRING_NEW2(cstr, len) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::NewStringType::kNormal, len)).ToLocalChecked()
#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
-typedef v8::Handle<v8::Value> SwigV8ReturnValue;
-typedef v8::Arguments SwigV8Arguments;
-typedef v8::AccessorInfo SwigV8PropertyCallbackInfo;
-#define SWIGV8_RETURN(val) return scope.Close(val)
-#define SWIGV8_RETURN_INFO(val, info) return scope.Close(val)
-#else
typedef void SwigV8ReturnValue;
typedef v8::FunctionCallbackInfo<v8::Value> SwigV8Arguments;
typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return
#define SWIGV8_RETURN_INFO(val, info) info.GetReturnValue().Set(val); return
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032117)
-#define SWIGV8_HANDLESCOPE() v8::HandleScope scope
-#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope
-#define SWIGV8_ESCAPE(val) return scope.Close(val)
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224)
-#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
-#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope(v8::Isolate::GetCurrent());
-#define SWIGV8_ESCAPE(val) return scope.Close(val)
-#else
#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
#define SWIGV8_HANDLESCOPE_ESC() v8::EscapableHandleScope scope(v8::Isolate::GetCurrent());
#define SWIGV8_ESCAPE(val) return scope.Escape(val)
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224)
-#define SWIGV8_ADJUST_MEMORY(size) v8::V8::AdjustAmountOfExternalAllocatedMemory(size)
-#define SWIGV8_CURRENT_CONTEXT() v8::Context::GetCurrent()
-#define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err)
-#define SWIGV8_STRING_NEW(str) v8::String::New(str)
-#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym)
-#else
#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
-#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
-#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
+
+#if (SWIG_V8_VERSION < 0x0704)
+#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::String::kNormalString)
+#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::String::kNormalString)
+#else
+#define SWIGV8_STRING_NEW(str) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::NewStringType::kNormal)).ToLocalChecked()
+#define SWIGV8_SYMBOL_NEW(sym) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::NewStringType::kNormal)).ToLocalChecked()
#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
-#define SWIGV8_ARRAY_NEW() v8::Array::New()
-#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(bool)
-#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(val)
-#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func)
-#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New()
-#define SWIGV8_INT32_NEW(num) v8::Int32::New(num)
-#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(num)
-#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(num)
-#define SWIGV8_NUMBER_NEW(num) v8::Number::New(num)
-#define SWIGV8_OBJECT_NEW() v8::Object::New()
-#define SWIGV8_UNDEFINED() v8::Undefined()
-#define SWIGV8_NULL() v8::Null()
+#if (SWIG_V8_VERSION < 0x0704)
+#define SWIGV8_MAYBE_CHECK(maybe) maybe.FromJust()
#else
-#define SWIGV8_ARRAY_NEW() v8::Array::New(v8::Isolate::GetCurrent())
+#define SWIGV8_MAYBE_CHECK(maybe) maybe.Check()
+#endif
+
+#define SWIGV8_ARRAY_NEW(size) v8::Array::New(v8::Isolate::GetCurrent(), size)
#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool)
#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val)
#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(v8::Isolate::GetCurrent(), func)
@@ -80,26 +49,19 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_NUMBER_NEW(num) v8::Number::New(v8::Isolate::GetCurrent(), num)
#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent())
#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent())
+#define SWIGV8_ARRAY v8::Local<v8::Array>
+#define SWIGV8_FUNCTION_TEMPLATE v8::Local<v8::FunctionTemplate>
+#define SWIGV8_OBJECT v8::Local<v8::Object>
+#define SWIGV8_OBJECT_TEMPLATE v8::Local<v8::ObjectTemplate>
+#define SWIGV8_OBJECT_TEMPLATE_NEW() v8::ObjectTemplate::New(v8::Isolate::GetCurrent())
+#define SWIGV8_VALUE v8::Local<v8::Value>
#define SWIGV8_NULL() v8::Null(v8::Isolate::GetCurrent())
-#endif
+#define SWIGV8_ARRAY_GET(array, index) (array)->Get(SWIGV8_CURRENT_CONTEXT(), index).ToLocalChecked()
+#define SWIGV8_ARRAY_SET(array, index, value) SWIGV8_MAYBE_CHECK((array)->Set(SWIGV8_CURRENT_CONTEXT(), index, value))
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(class);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), class);
-#else
#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class);
-#endif
-
-#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)
+#if SWIG_V8_VERSION < 0x0608
#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject()
#define SWIGV8_TO_STRING(handle) (handle)->ToString()
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue()
@@ -107,14 +69,20 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#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()
+#define SWIGV8_OBJECT_TEMPLATE_INSTACE(tmpl) tmpl->NewInstance();
#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())
+#define SWIGV8_OBJECT_TEMPLATE_INSTACE(tmpl) tmpl->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
+#if (SWIG_V8_VERSION < 0x0704)
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#else
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(v8::Isolate::GetCurrent())
+#endif
#endif
/* ---------------------------------------------------------------------------
@@ -131,6 +99,11 @@ SWIGINTERN void SWIG_V8_Raise(const char *msg) {
SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg)));
}
+SWIGINTERN void SWIG_V8_Raise(SWIGV8_VALUE obj, const char *msg) {
+ SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_TO_STRING(obj)));
+}
+
+
/*
Note: There are two contexts for handling errors.
A static V8ErrorHandler is used in not overloaded methods.
@@ -163,7 +136,7 @@ public:
SWIGV8_THROW_EXCEPTION(err);
}
}
- v8::Handle<v8::Value> err;
+ SWIGV8_VALUE err;
};
/* ---------------------------------------------------------------------------
@@ -182,23 +155,8 @@ public:
};
~SWIGV8_Proxy() {
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- handle.ClearWeak();
- handle.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- handle.ClearWeak(v8::Isolate::GetCurrent());
- handle.Dispose(v8::Isolate::GetCurrent());
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- handle.ClearWeak();
- handle.Dispose();
-#else
handle.ClearWeak();
handle.Reset();
-#endif
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- handle.Clear();
-#endif
SWIGV8_ADJUST_MEMORY(-SWIGV8_AVG_OBJ_SIZE);
}
@@ -213,37 +171,22 @@ class SWIGV8_ClientData {
public:
v8::Persistent<v8::FunctionTemplate> class_templ;
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- void (*dtor) (v8::Persistent< v8::Value> object, void *parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy);
-#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
};
SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
-SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(SWIGV8_OBJECT objRef, void **ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE();
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
- SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
-#else
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
-#endif
if(cdata == NULL) {
return SWIG_ERROR;
}
- if(cdata->info != info) {
+ if(info && cdata->info != info) {
swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info);
if (!tc && cdata->info->name) {
tc = SWIG_TypeCheck(cdata->info->name, info);
@@ -252,48 +195,41 @@ SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void *
if(!type_valid) {
return SWIG_TypeError;
}
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, cdata->swigCObject, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ *ptr = cdata->swigCObject;
}
- *ptr = cdata->swigCObject;
- if(flags & SWIG_POINTER_DISOWN) {
- cdata->swigCMemOwn = false;
+
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !cdata->swigCMemOwn) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ } else {
+ if (flags & SWIG_POINTER_DISOWN) {
+ cdata->swigCMemOwn = false;
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ cdata->swigCObject = 0;
+ }
}
return SWIG_OK;
}
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Persistent< v8::Value > object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Value > object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
-SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
-#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;
}
-SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) {
+SWIGRUNTIME int SWIG_V8_GetInstancePtr(SWIGV8_VALUE valRef, void **ptr) {
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ SWIGV8_OBJECT objRef = SWIGV8_OBJECT::Cast(valRef);
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
- SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
-#else
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
-#endif
if(cdata == NULL) {
return SWIG_ERROR;
@@ -304,70 +240,30 @@ SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr)
return SWIG_OK;
}
-SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME void SWIGV8_SetPrivateData(SWIGV8_OBJECT obj, void *ptr, swig_type_info *info, int flags) {
SWIGV8_Proxy *cdata = new SWIGV8_Proxy();
cdata->swigCObject = ptr;
cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
cdata->info = info;
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- obj->SetPointerInInternalField(0, cdata);
-#else
obj->SetAlignedPointerInInternalField(0, cdata);
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- cdata->handle = v8::Persistent<v8::Object>::New(obj);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj);
-#else
cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- // clientdata must be set for owned data as we need to register the dtor
- if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
- cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
- } else {
- cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
- }
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918)
- if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
- cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
- } else {
- cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, SWIGV8_Proxy_DefaultDtor);
- }
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
- cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
- } else {
- cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
- }
-#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)
- cdata->handle.MarkIndependent();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
-#else
+#if (SWIG_V8_VERSION < 0x0704)
cdata->handle.MarkIndependent();
+// Looks like future versions do not require that anymore:
+// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
#endif
-
}
-SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME int SWIG_V8_ConvertPtr(SWIGV8_VALUE valRef, void **ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE();
/* special case: JavaScript null => C NULL pointer */
@@ -378,31 +274,20 @@ SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swi
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ SWIGV8_OBJECT objRef = SWIGV8_OBJECT::Cast(valRef);
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
}
-SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME SWIGV8_VALUE SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE_ESC();
- v8::Handle<v8::FunctionTemplate> class_templ;
+ SWIGV8_FUNCTION_TEMPLATE class_templ;
if (ptr == NULL) {
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- SWIGV8_ESCAPE(SWIGV8_NULL());
-#else
v8::Local<v8::Primitive> result = SWIGV8_NULL();
SWIGV8_ESCAPE(result);
-#endif
}
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- if(info->clientdata != 0) {
- class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ;
- } else {
- class_templ = SWIGV8_SWIGTYPE_Proxy_class_templ;
- }
-#else
v8::Isolate *isolate = v8::Isolate::GetCurrent();
if(info->clientdata != 0) {
@@ -410,10 +295,9 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
} else {
class_templ = v8::Local<v8::FunctionTemplate>::New(isolate, SWIGV8_SWIGTYPE_Proxy_class_templ);
}
-#endif
-// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
- v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+ v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
+
SWIGV8_SetPrivateData(result, ptr, info, flags);
SWIGV8_ESCAPE(result);
@@ -433,7 +317,7 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ SWIGV8_VALUE jsresult;
void *arg1 = (void *) 0 ;
void *arg2 = (void *) 0 ;
bool result;
@@ -463,7 +347,7 @@ fail:
SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ SWIGV8_VALUE jsresult;
void *arg1 = (void *) 0 ;
long result;
int res1;
@@ -489,9 +373,14 @@ fail:
class SwigV8PackedData {
public:
- SwigV8PackedData(void *data, size_t size, swig_type_info *type): data(data), size(size), type(type) {};
+ SwigV8PackedData(void *data, size_t size, swig_type_info *type): data(nullptr), size(size), type(type) {
+ this->data = malloc(size);
+ if (this->data != nullptr)
+ memcpy(this->data, data, size);
+ };
~SwigV8PackedData() {
+ free(this->data);
};
void *data;
@@ -502,37 +391,28 @@ public:
};
SWIGRUNTIMEINLINE
-int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
+int SwigV8Packed_Check(SWIGV8_VALUE valRef) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ SWIGV8_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__"));
-#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
-swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, size_t size) {
+swig_type_info *SwigV8Packed_UnpackData(SWIGV8_VALUE valRef, void *ptr, size_t size) {
if (SwigV8Packed_Check(valRef)) {
SWIGV8_HANDLESCOPE();
SwigV8PackedData *sobj;
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ SWIGV8_OBJECT objRef = SWIGV8_TO_OBJECT(valRef);
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
- sobj = static_cast<SwigV8PackedData*>(v8::External::Unwrap(cdataRef));
-#else
sobj = static_cast<SwigV8PackedData*>(objRef->GetAlignedPointerFromInternalField(0));
-#endif
if (sobj == NULL || sobj->size != size) return 0;
memcpy(ptr, sobj->data, size);
return sobj->type;
@@ -542,7 +422,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr,
}
SWIGRUNTIME
-int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
+int SWIGV8_ConvertPacked(SWIGV8_VALUE valRef, void *ptr, size_t sz, swig_type_info *ty) {
swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz);
if (!to) return SWIG_ERROR;
if (ty) {
@@ -555,92 +435,38 @@ int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swi
return SWIG_OK;
}
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Persistent< v8::Value > object, void *parameter) {
- SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
- SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
-SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) {
-#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
-
+ cdata->handle.Reset();
delete cdata;
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- object.Clear();
- object.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- object.Clear();
- object.Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- object->Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- object->Dispose();
-#elif (V8_MAJOR_VERSION-0) < 5
- object.Clear();
-#endif
}
SWIGRUNTIME
-v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
+SWIGV8_VALUE SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
SWIGV8_HANDLESCOPE_ESC();
SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type);
-// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
- v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
+ SWIGV8_OBJECT_TEMPLATE tmpl = SWIGV8_OBJECT_TEMPLATE_NEW();
+ tmpl->SetInternalFieldCount(1);
+ v8::Local<v8::Object> obj = SWIGV8_OBJECT_TEMPLATE_INSTACE(tmpl);
-#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);
-#else
obj->SetAlignedPointerInInternalField(0, cdata);
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- cdata->handle = v8::Persistent<v8::Object>::New(obj);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj);
-#else
cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
-#endif
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918)
- cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
-#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)
- cdata->handle.MarkIndependent();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
-#else
+#if (SWIG_V8_VERSION < 0x0704)
cdata->handle.MarkIndependent();
+// Looks like future versions do not require that anymore:
+// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
#endif
SWIGV8_ESCAPE(obj);
+
}
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIGV8_ConvertPacked(obj, ptr, sz, ty)
@@ -654,22 +480,18 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
SWIGRUNTIME
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
-v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) {
-#else
-v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handle<v8::Value> obj) {
-#endif
+SWIGV8_VALUE SWIGV8_AppendOutput(SWIGV8_VALUE result, SWIGV8_VALUE obj) {
SWIGV8_HANDLESCOPE_ESC();
if (result->IsUndefined()) {
- result = SWIGV8_ARRAY_NEW();
+ result = SWIGV8_ARRAY_NEW(0);
+ } else if (!result->IsArray()) {
+ SWIGV8_ARRAY tmparr = SWIGV8_ARRAY_NEW(0);
+ SWIGV8_ARRAY_SET(tmparr, 0, result);
+ result = tmparr;
}
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(result);
-#else
- v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result);
-#endif
- arr->Set(arr->Length(), obj);
+ SWIGV8_ARRAY arr = SWIGV8_ARRAY::Cast(result);
+ SWIGV8_ARRAY_SET(arr, arr->Length(), obj);
SWIGV8_ESCAPE(arr);
}
diff --git a/linux-x86/share/swig/javascript/v8/javascriptruntime.swg b/linux-x86/share/swig/javascript/v8/javascriptruntime.swg
index c78e04e..4e93fc4 100644
--- a/linux-x86/share/swig/javascript/v8/javascriptruntime.swg
+++ b/linux-x86/share/swig/javascript/v8/javascriptruntime.swg
@@ -7,36 +7,8 @@
// ----------------
//
// v8 added version macros V8_MAJOR_VERSION, V8_MINOR_VERSION, V8_BUILD_NUMBER
-// and V8_PATCH_LEVEL in version 4.3.0. SWIG generated code uses these if
-// they are defined - to support earlier versions you can specify the V8 version
-// in use via the command line when you run SWIG:
-//
-// swig -c++ -javascript -v8 -DV8_VERSION=0x032530 example.i
-//
-// Or code in the interface file using SWIG_V8_VERSION:
-//
-// %begin %{#define SWIG_V8_VERSION 0x031110%}
-//
-// This is specified as a hex constant, but the constant is read as pairs of
-// decimal digits, so for V8 3.25.30 use constant 0x032530. This scheme can't
-// represent components > 99, but this constant is only useful for V8 < 4.3.0,
-// and no V8 versions from that era had a component > 99.
-
-%define %swig_v8_define_version(version)
-%insert("runtime") %{
-#ifndef SWIG_V8_VERSION
-#define SWIG_V8_VERSION version
-#endif
-%}
-%enddef
-
-#ifdef V8_VERSION
-%swig_v8_define_version(V8_VERSION)
-#else
-// HACK: defining a default version
-%swig_v8_define_version(0x031110)
-#endif
-
+// and V8_PATCH_LEVEL in version 4.3.0. SWIG doesn't support anything that
+// old so SWIG generated code can rely on these.
// Node support
// ------------
@@ -56,9 +28,16 @@
%insert(runtime) %{
#include <v8.h>
+#undef SWIG_V8_VERSION
+#define SWIG_V8_VERSION ((V8_MAJOR_VERSION / 10) * 4096 + \
+ (V8_MAJOR_VERSION % 10) * 256 + \
+ (V8_MINOR_VERSION / 10) * 16 + \
+ (V8_MINOR_VERSION % 10))
+
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
+#include <assert.h>
%}
%insert(runtime) "swigrun.swg"; /* SWIG API */
diff --git a/linux-x86/share/swig/javascript/v8/javascriptstrings.swg b/linux-x86/share/swig/javascript/v8/javascriptstrings.swg
index e767a6d..8dc2d94 100644
--- a/linux-x86/share/swig/javascript/v8/javascriptstrings.swg
+++ b/linux-x86/share/swig/javascript/v8/javascriptstrings.swg
@@ -4,13 +4,13 @@
* ------------------------------------------------------------ */
%fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") {
SWIGINTERN int
-SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
+SWIG_AsCharPtrAndSize(SWIGV8_VALUE valRef, char** cptr, size_t* psize, int *alloc)
{
if(valRef->IsString()) {
- v8::Handle<v8::String> js_str = SWIGV8_TO_STRING(valRef);
+ v8::Local<v8::String> js_str = v8::Local<v8::String>::Cast(valRef);
size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
- char* cstr = new char[len];
+ char* cstr = (char*) %new_array(len, char);
SWIGV8_WRITE_UTF8(js_str, cstr, len);
if(alloc) *alloc = SWIG_NEWOBJ;
@@ -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 = SWIGV8_TO_OBJECT(valRef);
+ SWIGV8_OBJECT obj = SWIGV8_OBJECT::Cast(valRef);
// try if the object is a wrapped char[]
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor) {
@@ -41,7 +41,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
}
%fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") {
-SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIGINTERNINLINE SWIGV8_VALUE
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
if (carray) {
@@ -49,7 +49,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
// TODO: handle extra long strings
return SWIGV8_UNDEFINED();
} else {
- v8::Handle<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
+ v8::Local<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
return js_str;
}
} else {
diff --git a/linux-x86/share/swig/javascript/v8/javascripttypemaps.swg b/linux-x86/share/swig/javascript/v8/javascripttypemaps.swg
index 4601698..c4d341b 100644
--- a/linux-x86/share/swig/javascript/v8/javascripttypemaps.swg
+++ b/linux-x86/share/swig/javascript/v8/javascripttypemaps.swg
@@ -25,7 +25,7 @@
/* Javascript types */
-#define SWIG_Object v8::Handle<v8::Value>
+#define SWIG_Object SWIGV8_VALUE
#define VOID_Object SWIGV8_UNDEFINED()
/* Overload of the output/constant/exception/dirout handling */
@@ -37,7 +37,7 @@
#define SWIG_SetConstant(name, obj)
/* raise */
-#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(type)
+#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(obj, type)
/* Include the unified typemap library */
%include <typemaps/swigtypemaps.swg>
diff --git a/linux-x86/share/swig/javascript/v8/std_auto_ptr.i b/linux-x86/share/swig/javascript/v8/std_auto_ptr.i
new file mode 100644
index 0000000..3d7ae8b
--- /dev/null
+++ b/linux-x86/share/swig/javascript/v8/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/javascript/v8/std_map.i b/linux-x86/share/swig/javascript/v8/std_map.i
index 3b8b093..a33e886 100644
--- a/linux-x86/share/swig/javascript/v8/std_map.i
+++ b/linux-x86/share/swig/javascript/v8/std_map.i
@@ -48,7 +48,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -64,17 +68,4 @@ namespace std {
}
};
-// 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/linux-x86/share/swig/javascript/v8/std_unique_ptr.i b/linux-x86/share/swig/javascript/v8/std_unique_ptr.i
new file mode 100644
index 0000000..f988714
--- /dev/null
+++ b/linux-x86/share/swig/javascript/v8/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/javascript/v8/swigmove.i b/linux-x86/share/swig/javascript/v8/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/javascript/v8/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/javascript/v8/typemaps.i b/linux-x86/share/swig/javascript/v8/typemaps.i
index d3d8afb..08b5838 100644
--- a/linux-x86/share/swig/javascript/v8/typemaps.i
+++ b/linux-x86/share/swig/javascript/v8/typemaps.i
@@ -18,7 +18,7 @@ you would use a real value instead.
int *INPUT
short *INPUT
long *INPUT
- long long *INPUT
+ long long *INPUT
unsigned int *INPUT
unsigned short *INPUT
unsigned long *INPUT
@@ -72,7 +72,7 @@ multiple output values, they are returned in the form of a Python tuple.
For example, suppose you were trying to wrap the modf() function in the
C math library which splits x into integral and fractional parts (and
-returns the integer part in one of its parameters).K:
+returns the integer part in one of its parameters) :
double modf(double x, double *ip);
@@ -139,10 +139,6 @@ to a Python variable you might do this :
x = neg(x)
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
*/
%include <typemaps/typemaps.swg>
diff --git a/linux-x86/share/swig/javascript/v8/javascriptkw.swg b/linux-x86/share/swig/javascriptkw.swg
index c3c1183..81e1340 100644
--- a/linux-x86/share/swig/javascript/v8/javascriptkw.swg
+++ b/linux-x86/share/swig/javascriptkw.swg
@@ -4,24 +4,46 @@
/* Warnings for Java keywords */
#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",rename="_%s") `x`
-/* Taken from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words */
+/* Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords */
+/* This the union of all currently reserved keywords in ECMAScript 4 to 6 in both sloppy and strict mode */
+JAVASCRIPTKW(arguments);
+JAVASCRIPTKW(await);
JAVASCRIPTKW(break);
JAVASCRIPTKW(case);
JAVASCRIPTKW(catch);
+JAVASCRIPTKW(class);
+JAVASCRIPTKW(const);
JAVASCRIPTKW(continue);
+JAVASCRIPTKW(debugger);
JAVASCRIPTKW(default);
JAVASCRIPTKW(delete);
JAVASCRIPTKW(do);
JAVASCRIPTKW(else);
+JAVASCRIPTKW(enum);
+JAVASCRIPTKW(eval);
+JAVASCRIPTKW(export);
+JAVASCRIPTKW(extends);
+JAVASCRIPTKW(false);
JAVASCRIPTKW(finally);
JAVASCRIPTKW(for);
JAVASCRIPTKW(function);
JAVASCRIPTKW(if);
+JAVASCRIPTKW(implements);
+JAVASCRIPTKW(import);
JAVASCRIPTKW(in);
JAVASCRIPTKW(instanceof);
+JAVASCRIPTKW(interface);
+JAVASCRIPTKW(let);
JAVASCRIPTKW(new);
+JAVASCRIPTKW(null);
+JAVASCRIPTKW(package);
+JAVASCRIPTKW(private);
+JAVASCRIPTKW(protected);
+JAVASCRIPTKW(public);
JAVASCRIPTKW(return);
+JAVASCRIPTKW(static);
+JAVASCRIPTKW(super);
JAVASCRIPTKW(switch);
JAVASCRIPTKW(this);
JAVASCRIPTKW(throw);
@@ -31,6 +53,7 @@ JAVASCRIPTKW(var);
JAVASCRIPTKW(void);
JAVASCRIPTKW(while);
JAVASCRIPTKW(with);
+JAVASCRIPTKW(yield);
/* others bad names if any*/
// for example %namewarn("321:clone() is a javascript bad method name") *::clone();
diff --git a/linux-x86/share/swig/lua/argcargv.i b/linux-x86/share/swig/lua/argcargv.i
new file mode 100644
index 0000000..605a24f
--- /dev/null
+++ b/linux-x86/share/swig/lua/argcargv.i
@@ -0,0 +1,57 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+
+ Use it as follows:
+
+ %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
+ extern int mainApp(size_t argc, const char **argv);
+
+ then from lua:
+
+ args = { "arg0", "arg1" }
+ mainApp(args)
+
+ * ------------------------------------------------------------- */
+
+%{
+SWIGINTERN int SWIG_argv_size(lua_State* L, int index) {
+ int n=0;
+ while(1){
+ lua_rawgeti(L,index,n+1);
+ if (lua_isnil(L,-1))
+ break;
+ ++n;
+ lua_pop(L,1);
+ }
+ lua_pop(L,1);
+ return n;
+}
+%}
+
+%typemap(in) (int ARGC, char **ARGV) {
+ if (lua_istable(L,$input)) {
+ int i, size = SWIG_argv_size(L,$input);
+ $1 = ($1_ltype) size;
+ $2 = (char **) malloc((size+1)*sizeof(char *));
+ for (i = 0; i < size; i++) {
+ lua_rawgeti(L,$input,i+1);
+ if (lua_isnil(L,-1))
+ break;
+ $2[i] = (char *)lua_tostring(L, -1);
+ lua_pop(L,1);
+ }
+ $2[i]=NULL;
+ } else {
+ $1 = 0; $2 = 0;
+ lua_pushstring(L,"Expecting argv array");
+ lua_error(L);
+ }
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ $1 = lua_istable(L,$input);
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ free((char *) $2);
+}
diff --git a/linux-x86/share/swig/lua/lua.swg b/linux-x86/share/swig/lua/lua.swg
index 6db3add..4244435 100644
--- a/linux-x86/share/swig/lua/lua.swg
+++ b/linux-x86/share/swig/lua/lua.swg
@@ -18,8 +18,9 @@
* constants typemaps
* ----------------------------------------------------------------------------- */
// this basically adds to a table of constants
+/* Extra `(`...`)` here are to handle $value being e.g. `SizeOf< int,int >::size`. */
%typemap(consttab) int, unsigned int, short, unsigned short, long, unsigned long, unsigned char, signed char, bool, enum SWIGTYPE
- {SWIG_LUA_CONSTTAB_INT("$symname", $value)}
+ {SWIG_LUA_CONSTTAB_INT("$symname", ($value))}
%typemap(consttab) float, double
{SWIG_LUA_CONSTTAB_FLOAT("$symname", $value)}
@@ -151,7 +152,7 @@ The python/lua ones are great, but C++ ones I don't like
(mainly because I cannot get the stack trace out of it)
Therefore I have not bothered to try doing much in this
-Therefore currently its just enough to get a few test cases running ok
+Therefore currently it's just enough to get a few test cases running ok
note: if you wish to throw anything related to std::exception
use %include <std_except.i> instead
@@ -191,7 +192,7 @@ use %include <std_except.i> instead
Throwing object is a serious problem:
Assuming some code throws a 'FooBar'
There are a few options:
-- return a pointer to it: but its unclear how long this will last for.
+- return a pointer to it: but it's unclear how long this will last for.
- return a copy of it: but not all objects are copyable
(see exception_partial_info in the test suite for a case where you cannot do this)
- convert to a string & throw that
@@ -213,7 +214,7 @@ SWIG_fail;%}
// %apply SWIGTYPE EXCEPTION_BY_VAL {FooBar};
// %apply SWIGTYPE& EXCEPTION_BY_VAL {FooBar&}; // note: need & twice
%typemap(throws) SWIGTYPE EXCEPTION_BY_VAL
-%{SWIG_NewPointerObj(L,(void *)new $1_ltype(($1_ltype &) $1),$&1_descriptor,1);
+%{SWIG_NewPointerObj(L,(void *)new $1_ltype($1),$&1_descriptor,1);
SWIG_fail;%}
// similar for object reference
@@ -224,7 +225,7 @@ SWIG_fail;%}
// note: no support for object pointers
-// its not clear how long the pointer is valid for, therefore not supporting it
+// it's not clear how long the pointer is valid for, therefore not supporting it
/* -----------------------------------------------------------------------------
* extras
diff --git a/linux-x86/share/swig/lua/lua_fnptr.i b/linux-x86/share/swig/lua/lua_fnptr.i
index 481cfaf..b4c663c 100644
--- a/linux-x86/share/swig/lua/lua_fnptr.i
+++ b/linux-x86/share/swig/lua/lua_fnptr.i
@@ -17,7 +17,7 @@ note: it should be passed by value, not byref or as a pointer.
The SWIGLUA_FN holds a pointer to the lua_State, and the stack index where the function is held.
The macro SWIGLUA_FN_GET() will put a copy of the lua function at the top of the stack.
-After that its fairly simple to write the rest of the code (assuming know how to use lua),
+After that it's fairly simple to write the rest of the code (assuming know how to use lua),
just push the parameters, call the function and return the result.
int my_func(int a, int b, SWIGLUA_FN fn)
@@ -119,6 +119,6 @@ void swiglua_ref_get(SWIGLUA_REF* pref){
%{ swiglua_ref_set(&$1,L,$input); %}
%typemap(out) SWIGLUA_REF
-%{ if ($1.L!=0) {swiglua_ref_get(&$1);} else {lua_pushnil(L);}
+%{ if ($1.L!=0) {swiglua_ref_get(&$1);} else {lua_pushnil(L);}
SWIG_arg++; %}
diff --git a/linux-x86/share/swig/lua/luakw.swg b/linux-x86/share/swig/lua/luakw.swg
index fc2f92b..394e400 100644
--- a/linux-x86/share/swig/lua/luakw.swg
+++ b/linux-x86/share/swig/lua/luakw.swg
@@ -2,7 +2,7 @@
Warnings for Lua keywords, built-in names and bad names.
*/
-#define LUAKW(x) %keywordwarn("'" `x` "' is a Lua keyword, renaming to 'c_" `x` "'", rename="c_%s") `x`
+#define LUAKW(x) %keywordwarn("'" `x` "' is a Lua keyword", rename="c_%s") `x`
#define LUABN(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "'" `x` "' conflicts with a basic function in Lua"), %$not %$ismember) `x`
/*
diff --git a/linux-x86/share/swig/lua/luarun.swg b/linux-x86/share/swig/lua/luarun.swg
index bd764d6..af6cd66 100644
--- a/linux-x86/share/swig/lua/luarun.swg
+++ b/linux-x86/share/swig/lua/luarun.swg
@@ -149,6 +149,20 @@ typedef struct swig_elua_entry {
# define lua_rawlen lua_objlen
#endif
+/* lua_tolstring() was added in Lua 5.1. It should be a little more
+ efficient than making two separate calls and it avoids problems with order
+ of evaluation so SWIG calls lua_tolstring() when it wants the length and
+ we provide a compatibility implementation for Lua 5.0. */
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
+static const char *(lua_tolstring)(lua_State *L, int idx, size_t *len) {
+ /* Call lua_tostring() first as it may convert the value from number to
+ string. */
+ const char *result = lua_tostring(L, idx);
+ if (len) *len = lua_strlen(L, idx);
+ return result;
+}
+#endif
+
/* lua_pushglobaltable is the recommended "future-proof" way to get
the global table for Lua 5.2 and later. Here we define
@@ -307,7 +321,7 @@ typedef struct {
/* Contract support */
#define SWIG_contract_assert(expr, msg) \
- if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else
+ do { if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } } while (0)
/* helper #defines */
@@ -819,6 +833,7 @@ SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, i
int bases_search_result;
int substack_start = lua_gettop(L)-2;
assert(first_arg == substack_start+1);
+ (void)first_arg;
lua_checkstack(L,5);
assert(lua_isuserdata(L,-2)); /* just in case */
lua_getmetatable(L,-2); /* get the meta table */
@@ -826,7 +841,7 @@ SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, i
/* NEW: looks for the __getitem() fn
this is a user provided get fn */
SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
- if (lua_iscfunction(L,-1)) /* if its there */
+ if (lua_iscfunction(L,-1)) /* if it's there */
{ /* found it so call the fn & return its value */
lua_pushvalue(L,substack_start+1); /* the userdata */
lua_pushvalue(L,substack_start+2); /* the parameter */
@@ -857,6 +872,7 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
int bases_search_result;
int substack_start = lua_gettop(L)-2;
assert(first_arg == substack_start+1);
+ (void)first_arg;
lua_checkstack(L,5);
assert(lua_isuserdata(L,-2)); /* just in case */
lua_getmetatable(L,-2); /* get the meta table */
@@ -883,7 +899,7 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
lua_pushvalue(L,substack_start+2); /* key */
lua_rawget(L,-2); /* look for the fn */
lua_remove(L,-2); /* stack tidy, remove .fn table */
- if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
+ if (lua_isfunction(L,-1)) /* note: if it's a C function or lua function */
{ /* found it so return the fn & let lua call it */
lua_remove(L,-2); /* stack tidy, remove metatable */
if(ret)
@@ -966,7 +982,7 @@ SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int fi
/* NEW: looks for the __setitem() fn
this is a user provided set fn */
SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
- if (lua_iscfunction(L,-1)) /* if its there */
+ if (lua_iscfunction(L,-1)) /* if it's there */
{ /* found it so call the fn & return its value */
lua_pushvalue(L,substack_start+1); /* the userdata */
lua_pushvalue(L,substack_start+2); /* the parameter */
@@ -1343,15 +1359,15 @@ SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_clas
SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration*/
/* The real function that resolves a metamethod.
- * Function searches given class and all it's bases(recursively) for first instance of something that is
- * not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actual metamethod implementation
+ * Function searches given class and all its bases (recursively) for first instance of something that is
+ * not equal to SWIG_Lua_resolve_metamethod. (Almost always this 'something' is actual metamethod implementation
* and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the
* answer.
* Returns 1 if found, 0 otherwise.
* clss is class which metatable we will search for method
* metamethod_name_idx is index in L where metamethod name (as string) lies
- * skip_check allows to skip searching metamethod in givel clss and immideatelly go to searching in bases. skip_check
- * is not caried to subsequent recursive calls - false is always passed. It is set to true only at first call from
+ * skip_check allows skipping searching metamethod in the given class and immediately going to searching in bases. skip_check
+ * is not carried to subsequent recursive calls - false is always passed. It is set to true only at first call from
* SWIG_Lua_resolve_metamethod
* */
SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx,
@@ -1497,7 +1513,7 @@ SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class
}
}
- lua_pop(L,1); /* remove inheritable metatmethods table */
+ lua_pop(L,1); /* remove inheritable metamethods table */
/* Special handling for __tostring method */
lua_pushstring(L, "__tostring");
@@ -1757,6 +1773,7 @@ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *t
(if possible) */
SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags)
{
+ int ret = SWIG_ERROR;
swig_lua_userdata *usr;
swig_cast_info *cast;
/* special case: lua nil => NULL pointer */
@@ -1765,33 +1782,49 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type
*ptr=0;
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
+ if (lua_islightuserdata(L,index))
+ {
+ *ptr=lua_touserdata(L,index);
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
+ }
usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
if (usr)
{
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !usr->own)
+ {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ }
if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
{
- usr->own=0;
+ usr->own = 0;
}
if (!type) /* special cast void*, no casting fn */
{
*ptr=usr->ptr;
- return SWIG_OK; /* ok */
+ ret = SWIG_OK;
+ }
+ else
+ {
+ cast=SWIG_TypeCheck(usr->type->name,type); /* performs normal type checking */
+ if (cast)
+ {
+ int newmemory = 0;
+ *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ ret = SWIG_OK;
+ }
}
- cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
- if (cast)
+ if ((ret == SWIG_OK) && (flags & SWIG_POINTER_CLEAR))
{
- int newmemory = 0;
- *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- return SWIG_OK; /* ok */
+ usr->ptr = 0;
}
}
- return SWIG_ERROR; /* error */
+ return ret;
}
SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags,
int argnum,const char *func_name){
- void *result;
+ void *result = 0;
if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
luaL_error (L,"Error in %s, expected a %s at argument number %d\n",
func_name,(type && type->str)?type->str:"void*",argnum);
diff --git a/linux-x86/share/swig/lua/luatypemaps.swg b/linux-x86/share/swig/lua/luatypemaps.swg
index 8959f20..7d23917 100644
--- a/linux-x86/share/swig/lua/luatypemaps.swg
+++ b/linux-x86/share/swig/lua/luatypemaps.swg
@@ -24,7 +24,7 @@
// additional check for unsigned numbers, to not permit negative input
%typemap(in,checkfn="lua_isnumber") unsigned int,
unsigned short, unsigned long, unsigned char
-%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative")
+%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative");
$1 = ($type)lua_tonumber(L, $input);%}
%typemap(out) int,short,long,
@@ -39,12 +39,12 @@ $1 = ($type)lua_tonumber(L, $input);%}
// SWIG assumes that this code will need a pointer to int to be passed in
// (this might be ok for objects by const ref, but not for numeric primitives)
// therefore we add a set of typemaps to fix this (for both in & out)
-%typemap(in,checkfn="lua_isnumber") const int&($basetype temp)
-%{ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
+%typemap(in,checkfn="lua_isnumber") const int&($*1_ltype temp)
+%{ temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp;%}
-%typemap(in,checkfn="lua_isnumber") const unsigned int&($basetype temp)
-%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative")
-temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
+%typemap(in,checkfn="lua_isnumber") const unsigned int&($*1_ltype temp)
+%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative");
+temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp;%}
%typemap(out) const int&, const unsigned int&
%{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%}
@@ -151,11 +151,17 @@ SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
}
%}
-%typemap(in,checkfn="lua_isuserdata") SWIGTYPE&&
-%{
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,$input,(void**)&$1,$descriptor,$disown))){
- SWIG_fail_ptr("$symname",$argnum,$descriptor);
+%typemap(in,checkfn="lua_isuserdata",fragment="<memory>") SWIGTYPE&& (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) %{
+ res = SWIG_ConvertPtr(L, $input, &argp, $descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type '$1_type' in $symname"); SWIG_fail;
+ } else {
+ SWIG_fail_ptr("$symname", $argnum, $descriptor);
+ }
}
+ $1 = ($1_ltype)argp;
+ rvrdeleter.reset($1);
%}
// out is simple
@@ -217,7 +223,7 @@ $1=($1_ltype)&temp;%}
#ifdef __cplusplus
%typemap(out) SWIGTYPE
{
- $&1_ltype resultptr = new $1_ltype((const $1_ltype &) $1);
+ $&1_ltype resultptr = new $1_ltype($1);
SWIG_NewPointerObj(L,(void *) resultptr,$&1_descriptor,1); SWIG_arg++;
}
#else
@@ -237,22 +243,22 @@ $1=($1_ltype)&temp;%}
// therefore a special wrapping functions SWIG_ConvertMember() & SWIG_NewMemberObj() were written
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*)
%{
- if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($type),$descriptor)))
+ if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($1),$descriptor)))
SWIG_fail_ptr("$symname",$argnum,$descriptor);
%}
%typemap(out) SWIGTYPE (CLASS::*)
-%{
- SWIG_NewMemberObj(L,(void*)(&$1),sizeof($type),$descriptor); SWIG_arg++;
+%{
+ SWIG_NewMemberObj(L,(void*)(&$1),sizeof($1),$descriptor); SWIG_arg++;
%}
// void (must be empty without the SWIG_arg++)
-%typemap(out) void "";
+%typemap(out) void ""
/* void* is a special case
A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does)
-but if its an output, then it should be wrapped like any other SWIG object (using default typemap)
+but if it's an output, then it should be wrapped like any other SWIG object (using default typemap)
*/
%typemap(in,checkfn="SWIG_isptrtype") void*
%{$1=($1_ltype)SWIG_MustGetPtr(L,$input,0,0,$argnum,"$symname");%}
@@ -285,7 +291,7 @@ parameters match which function
// unfortunately lua only considers one type of number
// so all numbers (int,float,double) match
-// you could add an advanced fn to get type & check if its integral
+// you could add an advanced fn to get type & check if it's integral
%typecheck(SWIG_TYPECHECK_INTEGER)
int, short, long,
unsigned int, unsigned short, unsigned long,
@@ -396,7 +402,7 @@ parameters match which function
* Specials
* ----------------------------------------------------------------------------- */
// swig::LANGUAGE_OBJ was added to allow containers of native objects
-// however its rather difficult to do this in lua, as you cannot hold pointers
+// however it's rather difficult to do this in lua, as you cannot hold pointers
// to native objects (they are held in the interpreter)
// therefore for now: just ignoring this feature
#ifdef __cplusplus
diff --git a/linux-x86/share/swig/lua/std_auto_ptr.i b/linux-x86/share/swig/lua/std_auto_ptr.i
new file mode 100644
index 0000000..b3b71d0
--- /dev/null
+++ b/linux-x86/share/swig/lua/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, checkfn="SWIG_isptrtype", noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *' in $symname"); SWIG_fail;
+ } else {
+ SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *));
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++;
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/lua/std_map.i b/linux-x86/share/swig/lua/std_map.i
index 773b6d0..19281ad 100644
--- a/linux-x86/share/swig/lua/std_map.i
+++ b/linux-x86/share/swig/lua/std_map.i
@@ -48,7 +48,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
diff --git a/linux-x86/share/swig/lua/std_string.i b/linux-x86/share/swig/lua/std_string.i
index b95a8a4..795db71 100644
--- a/linux-x86/share/swig/lua/std_string.i
+++ b/linux-x86/share/swig/lua/std_string.i
@@ -43,19 +43,28 @@ but
Similarly for getting the string
$1 = (char*)lua_tostring(L, $input);
becomes
- $1.assign(lua_tostring(L,$input),lua_rawlen(L,$input));
-
-Not using: lua_tolstring() as this is only found in Lua 5.1 & not 5.0.2
+ size_t len;
+ const char *ptr = lua_tolstring(L, $input, &len);
+ $1.assign(ptr, len);
*/
%typemap(in,checkfn="lua_isstring") string
-%{$1.assign(lua_tostring(L,$input),lua_rawlen(L,$input));%}
+{
+ size_t len;
+ const char *ptr = lua_tolstring(L, $input, &len);
+ $1.assign(ptr, len);
+}
%typemap(out) string
%{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%}
%typemap(in,checkfn="lua_isstring") const string& ($*1_ltype temp)
-%{temp.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); $1=&temp;%}
+{
+ size_t len;
+ const char *ptr = lua_tolstring(L, $input, &len);
+ temp.assign(ptr, len);
+ $1=&temp;
+}
%typemap(out) const string&
%{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%}
diff --git a/linux-x86/share/swig/lua/std_string_view.i b/linux-x86/share/swig/lua/std_string_view.i
new file mode 100644
index 0000000..5c8b636
--- /dev/null
+++ b/linux-x86/share/swig/lua/std_string_view.i
@@ -0,0 +1,50 @@
+/* -----------------------------------------------------------------------------
+ * std_string_view.i
+ *
+ * std::string_view typemaps for LUA
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <string_view>
+%}
+
+namespace std {
+
+%naturalvar string_view;
+
+%typemap(in,checkfn="lua_isstring") string_view
+{
+ size_t len;
+ const char *ptr = lua_tolstring(L, $input, &len);
+ $1 = std::string_view(ptr, len);
+}
+
+%typemap(out) string_view
+%{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%}
+
+%typemap(in,checkfn="lua_isstring") const string_view& ($*1_ltype temp)
+{
+ size_t len;
+ const char *ptr = lua_tolstring(L, $input, &len);
+ temp = std::string_view(ptr, len);
+ $1=&temp;
+}
+
+%typemap(out) const string_view&
+%{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%}
+
+// for throwing of any kind of string_view, string_view ref's and string_view pointers
+// we convert all to lua strings
+%typemap(throws) string_view, string_view&, const string_view&
+%{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_fail;%}
+
+%typemap(throws) string_view*, const string_view*
+%{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_fail;%}
+
+%typecheck(SWIG_TYPECHECK_STRINGVIEW) string_view, const string_view& {
+ $1 = lua_isstring(L,$input);
+}
+
+class string_view;
+
+}
diff --git a/linux-x86/share/swig/lua/std_unique_ptr.i b/linux-x86/share/swig/lua/std_unique_ptr.i
new file mode 100644
index 0000000..ad08f3b
--- /dev/null
+++ b/linux-x86/share/swig/lua/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, checkfn="SWIG_isptrtype", noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *' in $symname"); SWIG_fail;
+ } else {
+ SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *));
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++;
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/lua/swigmove.i b/linux-x86/share/swig/lua/swigmove.i
new file mode 100644
index 0000000..d130e79
--- /dev/null
+++ b/linux-x86/share/swig/lua/swigmove.i
@@ -0,0 +1,18 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, checkfn="lua_isuserdata", noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr(L, $input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type '$1_type' in $symname"); SWIG_fail;
+ } else {
+ SWIG_fail_ptr("$symname", $argnum, $&1_descriptor);
+ }
+ }
+ SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp);
+}
diff --git a/linux-x86/share/swig/lua/typemaps.i b/linux-x86/share/swig/lua/typemaps.i
index 8392e5b..68f6f6c 100644
--- a/linux-x86/share/swig/lua/typemaps.i
+++ b/linux-x86/share/swig/lua/typemaps.i
@@ -28,7 +28,7 @@ The basic code looks like this:
However the code below is a mixture of #defines & such, so nowhere as easy to read
-To make you code work correctly its not just a matter of %including this file
+To make you code work correctly it's not just a matter of %including this file
You also have to give SWIG the hints on which to use where
eg
@@ -77,7 +77,7 @@ SWIG_NUMBER_TYPEMAP(enum SWIGTYPE);
// also for long longs's
SWIG_NUMBER_TYPEMAP(long long); SWIG_NUMBER_TYPEMAP(unsigned long long); SWIG_NUMBER_TYPEMAP(signed long long);
-// note we dont do char, as a char* is probably a string not a ptr to a single char
+// note we don't do char, as a char* is probably a string not a ptr to a single char
// similar for booleans
%typemap(in,checkfn="lua_isboolean") bool *INPUT(bool temp), bool &INPUT(bool temp)
@@ -188,16 +188,6 @@ int SWIG_read_NAME_num_array(lua_State* L,int index,TYPE *array,int size);
*/
-/* Reported that you don't need to check for NULL for delete & free
-There probably is some compiler that its not true for, so the code is left here just in case.
-#ifdef __cplusplus
-#define SWIG_ALLOC_ARRAY(TYPE,LEN) new TYPE[LEN]
-#define SWIG_FREE_ARRAY(PTR) if(PTR){delete[] PTR;}
-#else
-#define SWIG_ALLOC_ARRAY(TYPE,LEN) (TYPE *)malloc(LEN*sizeof(TYPE))
-#define SWIG_FREE_ARRAY(PTR) if(PTR){free(PTR);}
-#endif
-*/
%{
#ifdef __cplusplus /* generic alloc/dealloc fns*/
#define SWIG_ALLOC_ARRAY(TYPE,LEN) new TYPE[LEN]
diff --git a/linux-x86/share/swig/math.i b/linux-x86/share/swig/math.i
index a37c92d..ac8d9a6 100644
--- a/linux-x86/share/swig/math.i
+++ b/linux-x86/share/swig/math.i
@@ -9,6 +9,8 @@
#include <math.h>
%}
+#ifndef SWIGPHP /* PHP already provides all these functions except fabs() */
+
extern double cos(double x);
/* Cosine of x */
@@ -54,9 +56,6 @@ extern double pow(double x, double y);
extern double sqrt(double x);
/* Square root. x >= 0 */
-extern double fabs(double x);
-/* Absolute value of x */
-
extern double ceil(double x);
/* Smallest integer not less than x, as a double */
@@ -66,6 +65,13 @@ extern double floor(double x);
extern double fmod(double x, double y);
/* Floating-point remainder of x/y, with the same sign as x. */
+#endif
+
+extern double fabs(double x);
+/* Absolute value of x */
+
+#ifndef SWIGPHP /* PHP already provides these constants and it's an error to redefine them */
+
#define M_E 2.7182818284590452354
#define M_LOG2E 1.4426950408889634074
#define M_LOG10E 0.43429448190325182765
@@ -80,3 +86,4 @@ extern double fmod(double x, double y);
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.70710678118654752440
+#endif
diff --git a/linux-x86/share/swig/modula3/modula3.swg b/linux-x86/share/swig/modula3/modula3.swg
deleted file mode 100644
index 13d06e9..0000000
--- a/linux-x86/share/swig/modula3/modula3.swg
+++ /dev/null
@@ -1,787 +0,0 @@
-/* -----------------------------------------------------------------------------
- * modula3.swg
- *
- * Modula3 typemaps
- * ----------------------------------------------------------------------------- */
-
-%include <modula3head.swg>
-
-/* The ctype, m3rawtype and m3wraptype typemaps work together and so there should be one of each.
- * The ctype typemap contains the C type used in the signature of C wrappers for C++ functions.
- * The m3rawtype typemap contains the M3 type used in the raw interface.
- * The m3rawintype typemap contains the M3 type used as function argument.
- * The m3rawrettype typemap contains the M3 type used as return value.
- * The m3wraptype typemap contains the M3 type used in the M3 type wrapper classes and module class. */
-
-/* Primitive types */
-%typemap(ctype) bool, const bool & "bool"
-%typemap(ctype) char, const char & "char"
-%typemap(ctype) signed char, const signed char & "signed char"
-%typemap(ctype) unsigned char, const unsigned char & "unsigned short"
-%typemap(ctype) short, const short & "short"
-%typemap(ctype) unsigned short, const unsigned short & "unsigned short"
-%typemap(ctype) int, const int & "int"
-%typemap(ctype) unsigned int, const unsigned int & "unsigned int"
-%typemap(ctype) long, const long & "long"
-%typemap(ctype) unsigned long, const unsigned long & "unsigned long"
-%typemap(ctype) long long, const long long & "long long"
-%typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
-%typemap(ctype) float, const float & "float"
-%typemap(ctype) double, const double & "double"
-%typemap(ctype) char * "char *"
-%typemap(ctype) void "void"
-
-%typemap(m3rawtype) bool, const bool & "BOOLEAN"
-%typemap(m3rawtype) char, const char & "C.char"
-%typemap(m3rawtype) signed char, const signed char & "C.signed_char"
-%typemap(m3rawtype) unsigned char, const unsigned char & "C.unsigned_char"
-%typemap(m3rawtype) short, const short & "C.short"
-%typemap(m3rawtype) unsigned short, const unsigned short & "C.unsigned_short"
-%typemap(m3rawtype) int, const int & "C.int"
-%typemap(m3rawtype) unsigned int, const unsigned int & "C.unsigned_int"
-%typemap(m3rawtype) long, const long & "C.long"
-%typemap(m3rawtype) unsigned long, const unsigned long & "C.unsigned_long"
-%typemap(m3rawtype) long long, const long long & "C.long_long"
-%typemap(m3rawtype) unsigned long long, const unsigned long long & "C.unsigned_long_long"
-%typemap(m3rawtype) float, const float & "C.float"
-%typemap(m3rawtype) double, const double & "C.double"
-%typemap(m3rawtype) long double, const long double & "C.long_double"
-%typemap(m3rawtype) char * "C.char_star"
-%typemap(m3rawtype) void ""
-%typemap(m3rawtype) FILE "Cstdio.FILE";
-%typemap(m3rawtype) FILE * "Cstdio.FILE_star";
-
-
-%typemap(m3rawintype) bool *, bool &, bool "BOOLEAN"
-%typemap(m3rawintype) char *, char &, char "C.char"
-%typemap(m3rawintype) signed char *, signed char &, signed char "C.signed_char"
-%typemap(m3rawintype) unsigned char *, unsigned char &, unsigned char "C.unsigned_char"
-%typemap(m3rawintype) short *, short &, short "C.short"
-%typemap(m3rawintype) unsigned short *, unsigned short &, unsigned short "C.unsigned_short"
-%typemap(m3rawintype) int *, int &, int "C.int"
-%typemap(m3rawintype) unsigned int *, unsigned int &, unsigned int "C.unsigned_int"
-%typemap(m3rawintype) long *, long &, long "C.long"
-%typemap(m3rawintype) unsigned long *, unsigned long &, unsigned long "C.unsigned_long"
-%typemap(m3rawintype) long long *, long long &, long long "C.long_long"
-%typemap(m3rawintype) unsigned long long *, unsigned long long &, unsigned long long "C.unsigned_long_long"
-%typemap(m3rawintype) float *, float &, float "C.float"
-%typemap(m3rawintype) double *, double &, double "C.double"
-%typemap(m3rawintype) long double *, long double &, long double "C.long_double"
-%typemap(m3rawintype) char * "C.char_star"
-%typemap(m3rawintype) void ""
-%typemap(m3rawintype) void * "ADDRESS"
-%typemap(m3rawintype) FILE "Cstdio.FILE";
-%typemap(m3rawintype) FILE * "Cstdio.FILE_star";
-
-%typemap(m3rawinmode) char *, void *, FILE * ""
-
-
-%typemap(m3rawrettype) bool, const bool & "BOOLEAN"
-%typemap(m3rawrettype) char, const char & "C.char"
-%typemap(m3rawrettype) signed char, const signed char & "C.signed_char"
-%typemap(m3rawrettype) unsigned char, const unsigned char & "C.unsigned_char"
-%typemap(m3rawrettype) short, const short & "C.short"
-%typemap(m3rawrettype) unsigned short, const unsigned short & "C.unsigned_short"
-%typemap(m3rawrettype) int, const int & "C.int"
-%typemap(m3rawrettype) unsigned int, const unsigned int & "C.unsigned_int"
-%typemap(m3rawrettype) long, const long & "C.long"
-%typemap(m3rawrettype) unsigned long, const unsigned long & "C.unsigned_long"
-%typemap(m3rawrettype) long long, const long long & "C.long_long"
-%typemap(m3rawrettype) unsigned long long, const unsigned long long & "C.unsigned_long_long"
-%typemap(m3rawrettype) float, const float & "C.float"
-%typemap(m3rawrettype) double, const double & "C.double"
-%typemap(m3rawrettype) long double, const long double & "C.long_double"
-%typemap(m3rawrettype) char * "C.char_star"
-%typemap(m3rawrettype) void ""
-%typemap(m3rawrettype) void * "ADDRESS"
-%typemap(m3rawrettype) FILE "Cstdio.FILE";
-%typemap(m3rawrettype) FILE * "Cstdio.FILE_star";
-
-
-%typemap("m3rawtype:import")
- char, const char &,
- signed char, const signed char &,
- unsigned char, const unsigned char &,
- short, const short &,
- unsigned short, const unsigned short &,
- int, const int &,
- unsigned int, const unsigned int &,
- long, const long &,
- unsigned long, const unsigned long &,
- long long, const long long &,
- unsigned long long, const unsigned long long &,
- float, const float &,
- double, const double &,
- long double, const long double &,
- char *
- "Ctypes AS C"
-
-%typemap("m3rawintype:import")
- char, const char &,
- signed char, const signed char &,
- unsigned char, const unsigned char &,
- short, const short &,
- unsigned short, const unsigned short &,
- int, const int &,
- unsigned int, const unsigned int &,
- long, const long &,
- unsigned long, const unsigned long &,
- long long, const long long &,
- unsigned long long, const unsigned long long &,
- float, const float &,
- double, const double &,
- long double, const long double &,
- char *
- "Ctypes AS C"
-
-%typemap("m3rawrettype:import")
- char, const char &,
- signed char, const signed char &,
- unsigned char, const unsigned char &,
- short, const short &,
- unsigned short, const unsigned short &,
- int, const int &,
- unsigned int, const unsigned int &,
- long, const long &,
- unsigned long, const unsigned long &,
- long long, const long long &,
- unsigned long long, const unsigned long long &,
- float, const float &,
- double, const double &,
- long double, const long double &,
- char *
- "Ctypes AS C"
-
-%typemap("m3rawtype:import")
- FILE, FILE *
- "Cstdio";
-
-%typemap("m3rawintype:import")
- FILE, FILE *
- "Cstdio";
-
-%typemap("m3rawrettype:import")
- FILE, FILE *
- "Cstdio";
-
-%typemap(m3wraptype) bool, const bool & "BOOLEAN"
-%typemap(m3wraptype) char, const char & "CHAR"
-%typemap(m3wraptype) signed char, const signed char & "CHAR"
-%typemap(m3wraptype) unsigned char, const unsigned char & "CHAR"
-%typemap(m3wraptype) short, const short & "Integer16.T"
-%typemap(m3wraptype) unsigned short, const unsigned short & "Cardinal16.T"
-%typemap(m3wraptype) int, const int & "INTEGER"
-%typemap(m3wraptype) unsigned int, const unsigned int & "CARDINAL"
-%typemap(m3wraptype) long, const long & "Integer32.T"
-%typemap(m3wraptype) unsigned long, const unsigned long & "Cardinal32.T"
-%typemap(m3wraptype) long long, const long long & "Integer64.T"
-%typemap(m3wraptype) unsigned long long, const unsigned long long & "Cardinal64.T"
-%typemap(m3wraptype) float, const float & "REAL"
-%typemap(m3wraptype) double, const double & "LONGREAL"
-%typemap(m3wraptype) long double, const long double & "EXTENDED"
-%typemap(m3wraptype) char * "TEXT"
-%typemap(m3wraptype) void ""
-%typemap(m3wraptype) FILE "Cstdio.FILE";
-%typemap(m3wraptype) FILE * "Cstdio.FILE_star";
-
-%typemap(m3wrapintype) bool, const bool *, const bool & "BOOLEAN"
-%typemap(m3wrapintype) char, const char *, const char & "CHAR"
-%typemap(m3wrapintype) signed char, const signed char *, const signed char & "CHAR"
-%typemap(m3wrapintype) unsigned char, const unsigned char *, const unsigned char & "CHAR"
-%typemap(m3wrapintype) short, const short *, const short & "INTEGER"
-%typemap(m3wrapintype) unsigned short, const unsigned short *, const unsigned short & "CARDINAL"
-%typemap(m3wrapintype) int, const int *, const int & "INTEGER"
-%typemap(m3wrapintype) unsigned int, const unsigned int *, const unsigned int & "CARDINAL"
-%typemap(m3wrapintype) long, const long *, const long & "INTEGER"
-%typemap(m3wrapintype) unsigned long, const unsigned long *, const unsigned long & "CARDINAL"
-%typemap(m3wrapintype) long long, const long long *, const long long & "INTEGER"
-%typemap(m3wrapintype) unsigned long long, const unsigned long long *, const unsigned long long & "CARDINAL"
-%typemap(m3wrapintype) float, const float *, const float & "REAL"
-%typemap(m3wrapintype) double, const double *, const double & "LONGREAL"
-%typemap(m3wrapintype) long double, const long double *, const long double & "EXTENDED"
-%typemap(m3wrapintype) const char *, const char [] "TEXT"
-%typemap(m3wrapintype,numinputs=0) void ""
-%typemap(m3wrapintype) FILE "Cstdio.FILE";
-%typemap(m3wrapintype) FILE * "Cstdio.FILE_star";
-
-
-%typemap(m3wrapouttype) bool, bool *, bool & "BOOLEAN"
-%typemap(m3wrapouttype) char, char *, char & "CHAR"
-%typemap(m3wrapouttype) signed char, signed char *, signed char & "CHAR"
-%typemap(m3wrapouttype) unsigned char, unsigned char *, unsigned char & "CHAR"
-%typemap(m3wrapouttype) short, short *, short & "INTEGER"
-%typemap(m3wrapouttype) unsigned short, unsigned short *, unsigned short & "CARDINAL"
-%typemap(m3wrapouttype) int, int *, int & "INTEGER"
-%typemap(m3wrapouttype) unsigned int, unsigned int *, unsigned int & "CARDINAL"
-%typemap(m3wrapouttype) long, long *, long & "INTEGER"
-%typemap(m3wrapouttype) unsigned long, unsigned long *, unsigned long & "CARDINAL"
-%typemap(m3wrapouttype) long long, long long *, long long & "INTEGER"
-%typemap(m3wrapouttype) unsigned long long, unsigned long long *, unsigned long long & "CARDINAL"
-%typemap(m3wrapouttype) float, float *, float & "REAL"
-%typemap(m3wrapouttype) double, double *, double & "LONGREAL"
-%typemap(m3wrapouttype) long double, long double *, long double & "EXTENDED"
-%typemap(m3wrapouttype) char *, char [] "TEXT"
-%typemap(m3wrapouttype,numinputs=0) void ""
-
-%typemap(m3wraprettype) bool, const bool & "BOOLEAN"
-%typemap(m3wraprettype) char, const char & "CHAR"
-%typemap(m3wraprettype) signed char, const signed char & "CHAR"
-%typemap(m3wraprettype) unsigned char, const unsigned char & "CHAR"
-%typemap(m3wraprettype) short, const short & "INTEGER"
-%typemap(m3wraprettype) unsigned short, const unsigned short & "CARDINAL"
-%typemap(m3wraprettype) int, const int & "INTEGER"
-%typemap(m3wraprettype) unsigned int, const unsigned int & "CARDINAL"
-%typemap(m3wraprettype) long, const long & "INTEGER"
-%typemap(m3wraprettype) unsigned long, const unsigned long & "CARDINAL"
-%typemap(m3wraprettype) long long, const long long & "INTEGER"
-%typemap(m3wraprettype) unsigned long long, const unsigned long long & "CARDINAL"
-%typemap(m3wraprettype) float, const float & "REAL"
-%typemap(m3wraprettype) double, const double & "LONGREAL"
-%typemap(m3wraprettype) long double, const long double & "EXTENDED"
-%typemap(m3wraprettype) char * "TEXT"
-%typemap(m3wraprettype) void ""
-%typemap(m3wraprettype) FILE "Cstdio.FILE";
-%typemap(m3wraprettype) FILE * "Cstdio.FILE_star";
-
-
-%typemap(ctype) char[ANY] "char *"
-%typemap(m3rawtype) char[ANY] "C.char_star"
-%typemap(m3rawintype) char[ANY] "C.char_star"
-%typemap(m3rawrettype) char[ANY] "C.char_star"
-%typemap(m3wraptype) char[ANY] "TEXT"
-%typemap(m3wrapintype) char[ANY] "TEXT"
-%typemap(m3wrapouttype) char[ANY] "TEXT"
-%typemap(m3wraprettype) char[ANY] "TEXT"
-
-%typemap(m3wrapinmode) const char * %{%}
-%typemap(m3wrapargvar) const char * %{$1 : C.char_star;%}
-%typemap(m3wrapinconv) const char * %{$1 := M3toC.SharedTtoS($1_name);%}
-%typemap(m3wrapfreearg) const char * %{M3toC.FreeSharedS($1_name,$1);%}
-%typemap(m3wrapargraw) const char * %{$1%}
-%typemap("m3wrapargvar:import") const char * "Ctypes AS C"
-%typemap("m3wrapinconv:import") const char * "M3toC"
-%typemap("m3wrapfreearg:import") const char * "M3toC"
-
-%typemap(m3wrapretvar) char * %{result : C.char_star;%}
-%typemap(m3wrapretraw) char * %{result%}
-%typemap(m3wrapretconv) char * %{M3toC.CopyStoT(result)%}
-%typemap("m3wrapretvar:import") char * "Ctypes AS C"
-%typemap("m3wrapretconv:import") char * "M3toC"
-
-%typemap(m3wrapinmode) FILE * %{%}
-
-
-%typemap("m3wraptype:import")
- FILE, FILE *
- "Cstdio";
-
-%typemap("m3wrapintype:import")
- FILE, FILE *
- "Cstdio";
-
-%typemap("m3wraprettype:import")
- FILE, FILE *
- "Cstdio";
-
-
-/* Composed types */
-%typemap(ctype) SWIGTYPE "$1_type"
-%typemap(m3rawtype) SWIGTYPE "$1_basetype"
-%typemap(m3rawrettype) SWIGTYPE "UNTRACED REF $1_basetype"
-%typemap(m3wraptype) SWIGTYPE "$1_basetype"
-%typemap(m3wrapintype) SWIGTYPE "$1_basetype"
-%typemap(m3wrapouttype) SWIGTYPE "$1_basetype"
-%typemap(m3wraprettype) SWIGTYPE "$1_basetype"
-
-%typemap(ctype) SWIGTYPE [] "$1_type"
-%typemap(m3rawtype) const SWIGTYPE [] "UNTRACED REF ARRAY INTEGER OF $1_basetype"
-%typemap(m3rawtype) SWIGTYPE [] "UNTRACED REF ARRAY INTEGER OF $1_basetype"
-%typemap(m3rawintype) const SWIGTYPE [] "(*ARRAY OF*) $1_basetype"
-%typemap(m3rawinmode) const SWIGTYPE [] "READONLY"
-%typemap(m3rawintype) SWIGTYPE [] "(*ARRAY OF*) $1_basetype"
-%typemap(m3rawinmode) SWIGTYPE [] "VAR"
-%typemap(m3rawrettype) const SWIGTYPE [] "UNTRACED REF ARRAY INTEGER OF $1_basetype"
-%typemap(m3rawrettype) SWIGTYPE [] "UNTRACED REF ARRAY INTEGER OF $1_basetype"
-%typemap(m3wraptype) SWIGTYPE [] "$1_basetype"
-%typemap(m3wrapintype) const SWIGTYPE [] "ARRAY OF $1_basetype"
-%typemap(m3wrapinmode) const SWIGTYPE [] "READONLY"
-%typemap(m3wrapintype) SWIGTYPE [] "ARRAY OF $1_basetype"
-%typemap(m3wrapinmode) SWIGTYPE [] "VAR"
-%typemap(m3wrapouttype) SWIGTYPE [] "ARRAY OF $1_basetype"
-%typemap(m3wraprettype) SWIGTYPE [] "REF ARRAY OF $1_basetype"
-
-%typemap(ctype) SWIGTYPE * "$1_type"
-%typemap(m3rawtype) const SWIGTYPE * "UNTRACED REF $1_basetype"
-%typemap(m3rawtype) SWIGTYPE * "UNTRACED REF $1_basetype"
-%typemap(m3rawintype) const SWIGTYPE * "$1_basetype"
-%typemap(m3rawinmode) const SWIGTYPE * "READONLY"
-%typemap(m3rawintype) SWIGTYPE * "$1_basetype"
-%typemap(m3rawinmode) SWIGTYPE * "VAR"
-%typemap(m3rawrettype) const SWIGTYPE * "UNTRACED REF $1_basetype"
-%typemap(m3rawrettype) SWIGTYPE * "UNTRACED REF $1_basetype"
-%typemap(m3wraptype) SWIGTYPE * "$1_basetype"
-%typemap(m3wrapintype) const SWIGTYPE * "$1_basetype"
-%typemap(m3wrapinmode) const SWIGTYPE * "READONLY"
-%typemap(m3wrapintype) SWIGTYPE * "$1_basetype"
-%typemap(m3wrapinmode) SWIGTYPE * "VAR"
-%typemap(m3wrapouttype) SWIGTYPE * "$1_basetype"
-%typemap(m3wraprettype) SWIGTYPE * "UNTRACED REF $1_basetype"
-
-%typemap(ctype) SWIGTYPE & "$1_type"
-%typemap(m3rawtype) const SWIGTYPE & "UNTRACED REF $1_basetype"
-%typemap(m3rawtype) SWIGTYPE & "UNTRACED REF $1_basetype"
-%typemap(m3rawintype) const SWIGTYPE & "$1_basetype"
-%typemap(m3rawinmode) const SWIGTYPE & "READONLY"
-%typemap(m3rawintype) SWIGTYPE & "$1_basetype"
-%typemap(m3rawinmode) SWIGTYPE & "VAR"
-%typemap(m3rawrettype) const SWIGTYPE & "UNTRACED REF $1_basetype"
-%typemap(m3rawrettype) SWIGTYPE & "UNTRACED REF $1_basetype"
-%typemap(m3wraptype) SWIGTYPE & "$1_basetype"
-%typemap(m3wrapintype) const SWIGTYPE & "$1_basetype"
-%typemap(m3wrapinmode) const SWIGTYPE & "READONLY"
-%typemap(m3wrapintype) SWIGTYPE & "$1_basetype"
-%typemap(m3wrapinmode) SWIGTYPE & "VAR"
-%typemap(m3wrapouttype) SWIGTYPE & "$1_basetype"
-%typemap(m3wraprettype) SWIGTYPE & "UNTRACED REF $1_basetype"
-
-%typemap(ctype) SWIGTYPE && "$1_type"
-%typemap(m3rawtype) const SWIGTYPE && "UNTRACED REF $1_basetype"
-%typemap(m3rawtype) SWIGTYPE && "UNTRACED REF $1_basetype"
-%typemap(m3rawintype) const SWIGTYPE && "$1_basetype"
-%typemap(m3rawinmode) const SWIGTYPE && "READONLY"
-%typemap(m3rawintype) SWIGTYPE && "$1_basetype"
-%typemap(m3rawinmode) SWIGTYPE && "VAR"
-%typemap(m3rawrettype) const SWIGTYPE && "UNTRACED REF $1_basetype"
-%typemap(m3rawrettype) SWIGTYPE && "UNTRACED REF $1_basetype"
-%typemap(m3wraptype) SWIGTYPE && "$1_basetype"
-%typemap(m3wrapintype) const SWIGTYPE && "$1_basetype"
-%typemap(m3wrapinmode) const SWIGTYPE && "READONLY"
-%typemap(m3wrapintype) SWIGTYPE && "$1_basetype"
-%typemap(m3wrapinmode) SWIGTYPE && "VAR"
-%typemap(m3wrapouttype) SWIGTYPE && "$1_basetype"
-%typemap(m3wraprettype) SWIGTYPE && "UNTRACED REF $1_basetype"
-
-%typemap(ctype) enum SWIGTYPE "$1_type"
-%typemap(m3rawtype) enum SWIGTYPE "C.int"
-%typemap(m3rawintype) enum SWIGTYPE "C.int (* $1_type *)"
-%typemap(m3rawrettype) enum SWIGTYPE "C.int"
-%typemap(m3wraptype) enum SWIGTYPE "$*1_type"
-%typemap(m3wrapintype) enum SWIGTYPE "$1_type"
-%typemap(m3wrapouttype) enum SWIGTYPE "$1_type"
-%typemap(m3wraprettype) enum SWIGTYPE "$*1_type"
-
-/* pointer to a class member */
-%typemap(ctype) SWIGTYPE (CLASS::*) "$1_type"
-%typemap(m3rawtype) SWIGTYPE (CLASS::*) "REFANY"
-%typemap(m3wraptype) SWIGTYPE (CLASS::*) "$1_basetype"
-
-/* The following are the in, out, freearg, argout typemaps.
- These are the PInvoke code generating typemaps for converting from C# to C and visa versa. */
-
-/* primitive types */
-%typemap(in) bool
-%{ $1 = $input ? true : false; %}
-
-%typemap(in) char,
- signed char,
- unsigned char,
- short,
- unsigned short,
- int,
- unsigned int,
- long,
- unsigned long,
- long long,
- unsigned long long,
- float,
- double,
- enum SWIGTYPE
-%{ $1 = ($1_ltype)$input; %}
-
-%typemap(out) bool %{ $result = $1; %}
-%typemap(out) char %{ $result = $1; %}
-%typemap(out) signed char %{ $result = $1; %}
-%typemap(out) unsigned char %{ $result = $1; %}
-%typemap(out) short %{ $result = $1; %}
-%typemap(out) unsigned short %{ $result = $1; %}
-%typemap(out) int %{ $result = $1; %}
-%typemap(out) unsigned int %{ $result = $1; %}
-%typemap(out) long %{ $result = $1; %}
-%typemap(out) unsigned long %{ $result = $1; %}
-%typemap(out) long long %{ $result = $1; %}
-%typemap(out) unsigned long long %{ $result = $1; %}
-%typemap(out) float %{ $result = $1; %}
-%typemap(out) double %{ $result = $1; %}
-%typemap(out) enum SWIGTYPE %{ $result = $1; %}
-
-/* char * - treat as String */
-%typemap(in) char * {
- $1 = $input;
-}
-//%typemap(freearg) char * { if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, $1); }
-//%typemap(out) char * { if($1) $result = JCALL1(NewStringUTF, jenv, $1); }
-
-%typemap(out) void ""
-
-/* primitive types by const reference */
-%typemap(in) const bool & (bool temp)
-%{ temp = $input ? true : false;
- $1 = &temp; %}
-
-%typemap(in) const char & (char temp),
- const signed char & (signed char temp),
- const unsigned char & (unsigned char temp),
- const short & (short temp),
- const unsigned short & (unsigned short temp),
- const int & (int temp),
- const unsigned int & (unsigned int temp),
- const long & (long temp),
- const unsigned long & (unsigned long temp),
- const long long & ($*1_ltype temp),
- const unsigned long long & ($*1_ltype temp),
- const float & (float temp),
- const double & (double temp)
-%{ temp = ($*1_ltype)$input;
-$1 = &temp; %}
-
-%typemap(out) const bool & %{ $result = *$1; %}
-%typemap(out) const char & %{ $result = *$1; %}
-%typemap(out) const signed char & %{ $result = *$1; %}
-%typemap(out) const unsigned char & %{ $result = *$1; %}
-%typemap(out) const short & %{ $result = *$1; %}
-%typemap(out) const unsigned short & %{ $result = *$1; %}
-%typemap(out) const int & %{ $result = *$1; %}
-%typemap(out) const unsigned int & %{ $result = *$1; %}
-%typemap(out) const long & %{ $result = *$1; %}
-%typemap(out) const unsigned long & %{ $result = *$1; %}
-%typemap(out) const long long & %{ $result = *$1; %}
-%typemap(out) const unsigned long long & %{ $result = *$1; %}
-%typemap(out) const float & %{ $result = *$1; %}
-%typemap(out) const double & %{ $result = *$1; %}
-
-/* Default handling. Object passed by value. Convert to a pointer */
-%typemap(in) SWIGTYPE ($&1_type argp)
-%{ argp = *($&1_ltype*)&$input;
- if (!argp) {
-// SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
- RETURN $null;
- }
- $1 = *argp; %}
-%typemap(out) SWIGTYPE
-#ifdef __cplusplus
-%{*($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %}
-#else
-{
- $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
- memmove($1ptr, &$1, sizeof($1_type));
- *($&1_ltype*)&$result = $1ptr;
-}
-#endif
-
-/* Generic pointers and references */
-%typemap(in) SWIGTYPE *, SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
-%typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input;
- if(!$1) {
- //SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
- RETURN $null;
- } %}
-%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input;
- if(!$1) {
- //SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
- RETURN $null;
- } %}
-%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %}
-
-
-/* Default array handling */
-%typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)&$input; %}
-%typemap(out) SWIGTYPE [] %{ *($&1_ltype)&$result = $1; %}
-
-/* char[ANY] - treat as String */
-%typemap(in) char[ANY] {
- $1 = $input;
-}
-
-%typemap(argout) char[ANY] ""
-%typemap(freearg) char[ANY] ""//{ if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, $1); }
-%typemap(out) char[ANY] { if($1) $result = $1; }
-
-
-/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
- * that cannot be overloaded in C# as more than one C++ type maps to a single C# type */
-
-%typecheck(SWIG_TYPECHECK_BOOL) /* Java boolean */
- bool,
- const bool &
- ""
-
-%typecheck(SWIG_TYPECHECK_CHAR) /* Java char */
- char,
- const char &
- ""
-
-%typecheck(SWIG_TYPECHECK_INT8) /* Java byte */
- signed char,
- const signed char &
- ""
-
-%typecheck(SWIG_TYPECHECK_INT16) /* Java short */
- unsigned char,
- short,
- const unsigned char &,
- const short &
- ""
-
-%typecheck(SWIG_TYPECHECK_INT32) /* Java int */
- unsigned short,
- int,
- long,
- const unsigned short &,
- const int &,
- const long &,
- enum SWIGTYPE
- ""
-
-%typecheck(SWIG_TYPECHECK_INT64) /* Java long */
- unsigned int,
- unsigned long,
- long long,
- const unsigned int &,
- const unsigned long &,
- const long long &
- ""
-
-%typecheck(SWIG_TYPECHECK_INT128) /* Java BigInteger */
- unsigned long long
- ""
-
-%typecheck(SWIG_TYPECHECK_FLOAT) /* Java float */
- float,
- const float &
- ""
-
-%typecheck(SWIG_TYPECHECK_DOUBLE) /* Java double */
- double,
- const double &
- ""
-
-%typecheck(SWIG_TYPECHECK_STRING) /* Java String */
- char *,
- char[ANY]
- ""
-
-%typecheck(SWIG_TYPECHECK_POINTER) /* Default */
- SWIGTYPE,
- SWIGTYPE *,
- SWIGTYPE &,
- SWIGTYPE &&,
- SWIGTYPE [],
- SWIGTYPE (CLASS::*)
- ""
-
-/* Exception handling */
-
-%typemap(throws) int,
- long,
- short,
- unsigned int,
- unsigned long,
- unsigned short {
- char error_msg[256];
- sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
- SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, error_msg);
- RETURN $null;
-}
-
-%typemap(throws) SWIGTYPE {
- (void)$1;
- SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
- RETURN $null;
-}
-
-%typemap(throws) char * {
- SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1);
- RETURN $null;
-}
-
-
-/* Typemaps for code generation in proxy classes and C# type wrapper classes */
-
-/* The in typemap is used for converting function parameter types from the type
- * used in the proxy, module or type wrapper class to the type used in the PInvoke class. */
-%typemap(m3in) bool, const bool &,
- char, const char &,
- signed char, const signed char &,
- unsigned char, const unsigned char &,
- short, const short &,
- unsigned short, const unsigned short &,
- int, const int &,
- unsigned int, const unsigned int &,
- long, const long &,
- unsigned long, const unsigned long &,
- long long, const long long &,
- unsigned long long, const unsigned long long &,
- float, const float &,
- double, const double &,
- char *,
- char[ANY],
- enum SWIGTYPE
- "$input"
-%typemap(m3in) SWIGTYPE "$&*1_type.getCPtr($input)"
-%typemap(m3in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "$1_basetype.getCPtr($input)"
-
-/* The m3out typemap is used for converting function return types from the return type
- * used in the PInvoke class to the type returned by the proxy, module or type wrapper class. */
-%typemap(m3out) bool, const bool &,
- char, const char &,
- signed char, const signed char &,
- unsigned char, const unsigned char &,
- short, const short &,
- unsigned short, const unsigned short &,
- int, const int &,
- unsigned int, const unsigned int &,
- long, const long &,
- unsigned long, const unsigned long &,
- long long, const long long &,
- unsigned long long, const unsigned long long &,
- float, const float &,
- double, const double &,
- char *,
- char[ANY],
- enum SWIGTYPE
-%{$imcall%}
-
-%typemap(m3out) void %{$imcall%}
-
-%typemap(m3out) SWIGTYPE %{
- RETURN NEW(REF $1_basetype, $imcall);
-%}
-%typemap(m3out) SWIGTYPE & %{
- RETURN NEW($1_basetype, $imcall, $owner);
-%}
-%typemap(m3out) SWIGTYPE && %{
- RETURN NEW($1_basetype, $imcall, $owner);
-%}
-%typemap(m3out) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
- cPtr := $imcall;
- RETURN (cPtr = IntPtr.Zero) ? null : NEW($1_basetype, cPtr, $owner);
-%}
-
-/* Properties */
-%typemap(m3varin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
-PROCEDURE Set$var (value: $vartype) =
- BEGIN
- $imcall;
- END Set$var;
-%}
-
-%typemap(m3varout) bool, const bool &,
- char, const char &,
- signed char, const signed char &,
- unsigned char, const unsigned char &,
- short, const short &,
- unsigned short, const unsigned short &,
- int, const int &,
- unsigned int, const unsigned int &,
- long, const long &,
- unsigned long, const unsigned long &,
- long long, const long long &,
- unsigned long long, const unsigned long long &,
- float, const float &,
- double, const double &,
- char *,
- char[ANY],
- enum SWIGTYPE %{
-PROCEDURE Get$var (): $vartype =
- BEGIN
- RETURN $imcall;
- END Get$var;
-%}
-
-%typemap(m3varout) void %{
- get {
- $imcall;
- } %}
-%typemap(m3varout) SWIGTYPE %{
- get {
- RETURN new $&*1_mangle($imcall, true);
- } %}
-%typemap(m3varout) SWIGTYPE & %{
- get {
- RETURN new $1_basetype($imcall, $owner);
- } %}
-%typemap(m3varout) SWIGTYPE && %{
- get {
- RETURN new $1_basetype($imcall, $owner);
- } %}
-%typemap(m3varout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
- get {
- IntPtr cPtr = $imcall;
- RETURN (cPtr == IntPtr.Zero) ? null : new $1_basetype(cPtr, $owner);
- } %}
-
-/* Typemaps used for the generation of proxy and type wrapper class code */
-%typemap(m3base) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
-%typemap(m3classmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
-%typemap(m3code) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
-%typemap(m3imports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
-%typemap(m3interfaces) SWIGTYPE "IDisposable"
-%typemap(m3interfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
-%typemap(m3ptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
-
-%typemap(m3finalize) SWIGTYPE %{
- ~$1_basetype() {
- Dispose();
- }
-%}
-
-%typemap(m3destruct, methodname="Dispose") SWIGTYPE {
- if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
- $imcall;
- swigCMemOwn = false;
- }
- swigCPtr = IntPtr.Zero;
- GC.SuppressFinalize(this);
- }
-
-%typemap(m3destruct_derived, methodname="Dispose") SWIGTYPE {
- if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
- $imcall;
- swigCMemOwn = false;
- }
- swigCPtr = IntPtr.Zero;
- GC.SuppressFinalize(this);
- base.Dispose();
- }
-
-%typemap(m3getcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
- internal static IntPtr getCPtr($1_basetype obj) {
- RETURN (obj == null) ? IntPtr.Zero : obj.swigCPtr;
- }
-%}
-
-/* M3 specific directives */
-#define %m3multiretval %feature("modula3:multiretval")
-#define %constnumeric(num) %feature("constnumeric","num")
-
-%pragma(modula3) moduleimports=%{
-IMPORT BlaBla;
-%}
-
-%pragma(modula3) imclassimports=%{
-FROM BlaBla IMPORT Bla;
-%}
-
-/* Some ANSI C typemaps */
-
-%apply unsigned long { size_t };
-
-/* Array reference typemaps */
-%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
-
-/* const pointers */
-%apply SWIGTYPE * { SWIGTYPE *const }
-%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
-%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
-
diff --git a/linux-x86/share/swig/modula3/modula3head.swg b/linux-x86/share/swig/modula3/modula3head.swg
deleted file mode 100644
index af96a78..0000000
--- a/linux-x86/share/swig/modula3/modula3head.swg
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -----------------------------------------------------------------------------
- * modula3head.swg
- *
- * Modula3 support code
- * ----------------------------------------------------------------------------- */
-
-%insert(runtime) %{
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-%}
-
-#if 0
-%insert(runtime) %{
-/* Support for throwing Modula3 exceptions */
-typedef enum {
- SWIG_JavaOutOfMemoryError = 1,
- SWIG_JavaIOException,
- SWIG_JavaRuntimeException,
- SWIG_JavaIndexOutOfBoundsException,
- SWIG_JavaArithmeticException,
- SWIG_JavaIllegalArgumentException,
- SWIG_JavaNullPointerException,
- SWIG_JavaUnknownError
-} SWIG_JavaExceptionCodes;
-
-typedef struct {
- SWIG_JavaExceptionCodes code;
- const char *java_exception;
-} SWIG_JavaExceptions_t;
-
-#if defined(SWIG_NOINCLUDE)
-void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg);
-#else
-%}
-%insert(runtime) {
-void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
- jclass excep;
- static const SWIG_JavaExceptions_t java_exceptions[] = {
- { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
- { SWIG_JavaIOException, "java/io/IOException" },
- { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
- { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
- { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
- { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
- { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
- { SWIG_JavaUnknownError, "java/lang/UnknownError" },
- { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } };
- const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
-
- while (except_ptr->code != code && except_ptr->code)
- except_ptr++;
-
- JCALL0(ExceptionClear, jenv);
- excep = JCALL1(FindClass, jenv, except_ptr->java_exception);
- if (excep)
- JCALL2(ThrowNew, jenv, excep, msg);
-}
-}
-%insert(runtime) %{
-#endif
-%}
-#endif
diff --git a/linux-x86/share/swig/modula3/typemaps.i b/linux-x86/share/swig/modula3/typemaps.i
deleted file mode 100644
index 1d76ab5..0000000
--- a/linux-x86/share/swig/modula3/typemaps.i
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -----------------------------------------------------------------------------
- * typemaps.i
- *
- * Pointer and reference handling typemap library
- *
- * These mappings provide support for input/output arguments and common
- * uses for C/C++ pointers and C++ references.
- * ----------------------------------------------------------------------------- */
-
-/* These typemaps will eventually probably maybe make their way into named typemaps
- * OUTPUT * and OUTPUT & as they currently break functions that return a pointer or
- * reference. */
-
-%typemap(ctype) bool *, bool & "bool *"
-%typemap(ctype) char & "char *"
-%typemap(ctype) signed char *, signed char & "signed char *"
-%typemap(ctype) unsigned char *, unsigned char & "unsigned short *"
-%typemap(ctype) short *, short & "short *"
-%typemap(ctype) unsigned short *, unsigned short & "unsigned short *"
-%typemap(ctype) int *, int & "int *"
-%typemap(ctype) unsigned int *, unsigned int & "unsigned int *"
-%typemap(ctype) long *, long & "long *"
-%typemap(ctype) unsigned long *, unsigned long & "unsigned long *"
-%typemap(ctype) long long *, long long & "long long *"
-%typemap(ctype) unsigned long long *, unsigned long long & "unsigned long long *"
-%typemap(ctype) float *, float & "float *"
-%typemap(ctype) double *, double & "double *"
-
-%typemap(imtype) bool *, bool & "ref bool"
-%typemap(imtype) char & "ref char"
-%typemap(imtype) signed char *, signed char & "ref sbyte"
-%typemap(imtype) unsigned char *, unsigned char & "ref byte"
-%typemap(imtype) short *, short & "ref short"
-%typemap(imtype) unsigned short *, unsigned short & "ref ushort"
-%typemap(imtype) int *, int & "ref int"
-%typemap(imtype) unsigned int *, unsigned int & "ref uint"
-%typemap(imtype) long *, long & "ref int"
-%typemap(imtype) unsigned long *, unsigned long & "ref uint"
-%typemap(imtype) long long *, long long & "ref long"
-%typemap(imtype) unsigned long long *, unsigned long long & "ref ulong"
-%typemap(imtype) float *, float & "ref float"
-%typemap(imtype) double *, double & "ref double"
-
-%typemap(cstype) bool *, bool & "ref bool"
-%typemap(cstype) char & "ref char"
-%typemap(cstype) signed char *, signed char & "ref sbyte"
-%typemap(cstype) unsigned char *, unsigned char & "ref byte"
-%typemap(cstype) short *, short & "ref short"
-%typemap(cstype) unsigned short *, unsigned short & "ref ushort"
-%typemap(cstype) int *, int & "ref int"
-%typemap(cstype) unsigned int *, unsigned int & "ref uint"
-%typemap(cstype) long *, long & "ref int"
-%typemap(cstype) unsigned long *, unsigned long & "ref uint"
-%typemap(cstype) long long *, long long & "ref long"
-%typemap(cstype) unsigned long long *, unsigned long long & "ref ulong"
-%typemap(cstype) float *, float & "ref float"
-%typemap(cstype) double *, double & "ref double"
-
-%typemap(csin) bool *, bool &,
- char &,
- signed char *, signed char &,
- unsigned char *, unsigned char &,
- short *, short &,
- unsigned short *, unsigned short &,
- int *, int &,
- unsigned int *, unsigned int &,
- long *, long &,
- unsigned long *, unsigned long &,
- long long *, long long &,
- unsigned long long *, unsigned long long &,
- float *, float &,
- double *, double &
- "ref $csinput"
-
diff --git a/linux-x86/share/swig/mzscheme/argcargv.i b/linux-x86/share/swig/mzscheme/argcargv.i
new file mode 100644
index 0000000..eec1e0d
--- /dev/null
+++ b/linux-x86/share/swig/mzscheme/argcargv.i
@@ -0,0 +1,41 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(in) (int ARGC, char **ARGV) {
+ $1_ltype i, len;
+ Scheme_Object **elems;
+ SWIG_contract_assert($input != (Scheme_Object *)NULL &&
+ $input != scheme_null &&
+ SCHEME_TYPE($input) == scheme_vector_type, "null array");
+ len = SCHEME_VEC_SIZE($input);
+ $1 = len;
+ $2 = ($2_ltype) SWIG_MzScheme_Malloc((size_t)(len+1)*sizeof($*2_ltype), FUNC_NAME);
+ elems = SCHEME_VEC_ELS($input);
+ for (i = 0; i < len; i++) {
+ SWIG_contract_assert(SCHEME_TYPE(elems[i]) == scheme_char_string_type,
+ "elements in array must be strings");
+ $2[i] = ($*2_ltype)SCHEME_STR_VAL(elems[i]);
+ }
+ $2[i] = NULL;
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ if ($input != (Scheme_Object *)NULL && $input != scheme_null &&
+ SCHEME_TYPE($input) == scheme_vector_type) {
+ size_t len = SCHEME_VEC_SIZE($input);
+ size_t i;
+ Scheme_Object **elems = SCHEME_VEC_ELS($input);
+ for (i = 0; i < len; i++) {
+ if (SCHEME_TYPE(elems[i]) != scheme_char_string_type) {
+ break;
+ }
+ }
+ /* All elements are strings! */
+ $1 = (i == len);
+ }
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ SWIG_free((void *)$2);
+}
diff --git a/linux-x86/share/swig/mzscheme/mzrun.swg b/linux-x86/share/swig/mzscheme/mzrun.swg
index c438c9c..8adae46 100644
--- a/linux-x86/share/swig/mzscheme/mzrun.swg
+++ b/linux-x86/share/swig/mzscheme/mzrun.swg
@@ -23,12 +23,15 @@ extern "C" {
SWIG_MzScheme_MustGetPtr(s, type, argnum, flags, FUNC_NAME, argc, argv)
#define SWIG_contract_assert(expr,msg) \
- if (!(expr)) { \
- char *m=(char *) scheme_malloc(strlen(msg)+1000); \
- sprintf(m,"SWIG contract, assertion failed: function=%s, message=%s", \
- (char *) FUNC_NAME,(char *) msg); \
- scheme_signal_error(m); \
- }
+ do { \
+ if (!(expr)) { \
+ size_t len=strlen(msg)+1000; \
+ char *m=(char *) scheme_malloc(len); \
+ SWIG_snprintf2(m, len, "SWIG contract, assertion failed: function=%s, message=%s", \
+ (char *) FUNC_NAME,(char *) msg); \
+ scheme_signal_error(m); \
+ } \
+ } while (0)
/* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_MzScheme_GetModule((Scheme_Env *)(clientdata))
@@ -123,6 +126,7 @@ struct swig_mz_proxy {
Scheme_Type mztype;
swig_type_info *type;
void *object;
+ int own;
};
static Scheme_Type swig_type;
@@ -133,7 +137,7 @@ mz_free_swig(void *p, void *data) {
if (SCHEME_NULLP((Scheme_Object*)p) || SCHEME_TYPE((Scheme_Object*)p) != swig_type)
return;
if (proxy->type) {
- if (proxy->type->clientdata) {
+ if (proxy->type->clientdata && proxy->own) {
((Scheme_Prim *)proxy->type->clientdata)(1, (Scheme_Object **)&proxy);
}
}
@@ -141,42 +145,61 @@ mz_free_swig(void *p, void *data) {
static Scheme_Object *
SWIG_MzScheme_NewPointerObj(void *ptr, swig_type_info *type, int owner) {
- struct swig_mz_proxy *new_proxy;
- new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy));
- new_proxy->mztype = swig_type;
- new_proxy->type = type;
- new_proxy->object = ptr;
- if (owner) {
- scheme_add_finalizer(new_proxy, mz_free_swig, NULL);
+ if (ptr) {
+ struct swig_mz_proxy *new_proxy;
+ new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy));
+ new_proxy->mztype = swig_type;
+ new_proxy->type = type;
+ new_proxy->object = ptr;
+ new_proxy->own = owner & SWIG_POINTER_OWN;
+ if (new_proxy->own) {
+ scheme_add_finalizer(new_proxy, mz_free_swig, NULL);
+ }
+ return (Scheme_Object *) new_proxy;
+ } else {
+ return scheme_make_null();
}
- return (Scheme_Object *) new_proxy;
}
static int
SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type, int flags) {
swig_cast_info *cast;
+ int ret = SWIG_ERROR;
if (SCHEME_NULLP(s)) {
*result = NULL;
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 ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE && !proxy->own) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ }
+
if (type) {
cast = SWIG_TypeCheckStruct(proxy->type, type);
if (cast) {
int newmemory = 0;
*result = SWIG_TypeCast(cast, proxy->object, &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
- return 0;
+ ret = SWIG_OK;
} else {
- return 1;
+ return SWIG_ERROR;
}
} else {
*result = proxy->object;
- return 0;
+ ret = SWIG_OK;
+ }
+
+ if (flags & SWIG_POINTER_DISOWN) {
+ scheme_subtract_finalizer(proxy, mz_free_swig, NULL);
+ proxy->own = 0;
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ proxy->object = 0;
}
}
- return 1;
+ return ret;
}
static SWIGINLINE void *
@@ -195,7 +218,8 @@ SWIG_MzScheme_Malloc(size_t size, const char *func_name) {
void *p = malloc(size);
if (p == NULL) {
scheme_signal_error("swig-memory-error");
- } else return p;
+ }
+ return p;
}
static Scheme_Object *
@@ -398,10 +422,10 @@ SWIG_MzScheme_new_scheme_struct (Scheme_Env* env, const char* basename,
int L=strlen(mz_dynload_libpaths[k])+strlen("\\")+strlen(mz_dlopen_libraries[i])+1;
libp=(char *) malloc(L*sizeof(char));
#ifdef __OS_WIN32
- sprintf(libp,"%s\\%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]);
+ SWIG_snprintf2(libp,L,"%s\\%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]);
mz_libraries[i]=(void *) LoadLibrary(libp);
#else
- sprintf(libp,"%s/%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]);
+ SWIG_snprintf2(libp,L,"%s/%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]);
mz_libraries[i]=(void *) dlopen(libp,RTLD_LAZY);
#endif
if (mz_dynload_debug) {
diff --git a/linux-x86/share/swig/mzscheme/std_auto_ptr.i b/linux-x86/share/swig/mzscheme/std_auto_ptr.i
new file mode 100644
index 0000000..c61bc8b
--- /dev/null
+++ b/linux-x86/share/swig/mzscheme/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'");
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/mzscheme/std_map.i b/linux-x86/share/swig/mzscheme/std_map.i
index 1d3eec2..4d312f5 100644
--- a/linux-x86/share/swig/mzscheme/std_map.i
+++ b/linux-x86/share/swig/mzscheme/std_map.i
@@ -5,6 +5,7 @@
* ----------------------------------------------------------------------------- */
%include <std_common.i>
+%include <exception.i>
// ------------------------------------------------------------------------
// std::map
@@ -64,7 +65,11 @@ namespace std {
val = scheme_car(val);
x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
}
+%#ifdef __cpp_lib_map_try_emplace
+ (($1_type &)$1).insert_or_assign(*k, *x);
+%#else
(($1_type &)$1)[*k] = *x;
+%#endif
alist = scheme_cdr(alist);
}
} else {
@@ -100,7 +105,11 @@ namespace std {
val = scheme_car(val);
x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
}
+%#ifdef __cpp_lib_map_try_emplace
+ temp.insert_or_assign(*k, *x);
+%#else
temp[*k] = *x;
+%#endif
alist = scheme_cdr(alist);
}
} else {
@@ -242,7 +251,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void __setitem__(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void __delitem__(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -268,1121 +281,4 @@ namespace std {
}
};
-
- // specializations for built-ins
-
- %define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
-
- 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, C >();
- } else if (SCHEME_PAIRP($input)) {
- $1 = std::map< K, T, C >();
- Scheme_Object* alist = $input;
- while (!SCHEME_NULLP(alist)) {
- T* x;
- Scheme_Object *entry, *key, *val;
- entry = scheme_car(alist);
- if (!SCHEME_PAIRP(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = scheme_car(entry);
- val = scheme_cdr(entry);
- if (!CHECK(key))
- SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "," #C "> expected");
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) == -1) {
- if (!SCHEME_PAIRP(val))
- SWIG_exception(SWIG_TypeError,"alist expected");
- val = scheme_car(val);
- x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
- }
- (($1_type &)$1)[CONVERT_FROM(key)] = *x;
- alist = scheme_cdr(alist);
- }
- } else {
- $1 = *(($&1_type)
- SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
- }
- }
- %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, C >();
- $1 = &temp;
- } else if (SCHEME_PAIRP($input)) {
- temp = std::map< K, T, C >();
- $1 = &temp;
- Scheme_Object* alist = $input;
- while (!SCHEME_NULLP(alist)) {
- T* x;
- Scheme_Object *entry, *key, *val;
- entry = scheme_car(alist);
- if (!SCHEME_PAIRP(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = scheme_car(entry);
- val = scheme_cdr(entry);
- if (!CHECK(key))
- SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "," #C "> expected");
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) == -1) {
- if (!SCHEME_PAIRP(val))
- SWIG_exception(SWIG_TypeError,"alist expected");
- val = scheme_car(val);
- x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
- }
- temp[CONVERT_FROM(key)] = *x;
- alist = scheme_cdr(alist);
- }
- } else {
- $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
- }
- }
- %typemap(out) map< K, T, C > {
- Scheme_Object* alist = scheme_null;
- 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);
- Scheme_Object* x = SWIG_NewPointerObj(val,$descriptor(T *), 1);
- Scheme_Object* entry = scheme_make_pair(k,x);
- alist = scheme_make_pair(entry,alist);
- }
- $result = alist;
- }
- %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
- // native sequence?
- if (SCHEME_NULLP($input)) {
- /* an empty sequence can be of any type */
- $1 = 1;
- } else if (SCHEME_PAIRP($input)) {
- // check the first element only
- T* x;
- Scheme_Object* head = scheme_car($input);
- if (SCHEME_PAIRP(head)) {
- Scheme_Object* key = scheme_car(head);
- Scheme_Object* val = scheme_cdr(head);
- if (!CHECK(key)) {
- $1 = 0;
- } else {
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) != -1) {
- $1 = 1;
- } else if (SCHEME_PAIRP(val)) {
- val = scheme_car(val);
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) != -1)
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $&1_descriptor, 0) != -1)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %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 */
- $1 = 1;
- } else if (SCHEME_PAIRP($input)) {
- // check the first element only
- T* x;
- Scheme_Object* head = scheme_car($input);
- if (SCHEME_PAIRP(head)) {
- Scheme_Object* key = scheme_car(head);
- Scheme_Object* val = scheme_cdr(head);
- if (!CHECK(key)) {
- $1 = 0;
- } else {
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) != -1) {
- $1 = 1;
- } else if (SCHEME_PAIRP(val)) {
- val = scheme_car(val);
- if (SWIG_ConvertPtr(val,(void**) &x,
- $descriptor(T *), 0) != -1)
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $1_descriptor, 0) != -1)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %rename("length") size;
- %rename("null?") empty;
- %rename("clear!") clear;
- %rename("ref") __getitem__;
- %rename("set!") __setitem__;
- %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& other);
-
- unsigned int size() const;
- bool empty() const;
- void clear();
- %extend {
- T& __getitem__(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 __setitem__(K key, const T& x) {
- (*self)[key] = x;
- }
- void __delitem__(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(K 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, C >::reverse_iterator i=self->rbegin();
- i!=self->rend(); ++i) {
- Scheme_Object* k = CONVERT_TO(i->first);
- result = scheme_make_pair(k,result);
- }
- return result;
- }
- }
- };
- %enddef
-
- %define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
- 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, C >();
- } else if (SCHEME_PAIRP($input)) {
- $1 = std::map< K, T, C >();
- Scheme_Object* alist = $input;
- while (!SCHEME_NULLP(alist)) {
- K* k;
- Scheme_Object *entry, *key, *val;
- entry = scheme_car(alist);
- if (!SCHEME_PAIRP(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = scheme_car(entry);
- val = scheme_cdr(entry);
- k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
- if (!CHECK(val)) {
- if (!SCHEME_PAIRP(val))
- SWIG_exception(SWIG_TypeError,"alist expected");
- val = scheme_car(val);
- if (!CHECK(val))
- SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "," #C "> expected");
- }
- (($1_type &)$1)[*k] = CONVERT_FROM(val);
- alist = scheme_cdr(alist);
- }
- } else {
- $1 = *(($&1_type)
- SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
- }
- }
- %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, C >();
- $1 = &temp;
- } else if (SCHEME_PAIRP($input)) {
- temp = std::map< K, T, C >();
- $1 = &temp;
- Scheme_Object* alist = $input;
- while (!SCHEME_NULLP(alist)) {
- K* k;
- Scheme_Object *entry, *key, *val;
- entry = scheme_car(alist);
- if (!SCHEME_PAIRP(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = scheme_car(entry);
- val = scheme_cdr(entry);
- k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
- if (!CHECK(val)) {
- if (!SCHEME_PAIRP(val))
- SWIG_exception(SWIG_TypeError,"alist expected");
- val = scheme_car(val);
- if (!CHECK(val))
- SWIG_exception(SWIG_TypeError,
- "map<" #K "," #T "," #C "> expected");
- }
- temp[*k] = CONVERT_FROM(val);
- alist = scheme_cdr(alist);
- }
- } else {
- $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
- }
- }
- %typemap(out) map< K, T, C > {
- Scheme_Object* alist = scheme_null;
- 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);
- Scheme_Object* x = CONVERT_TO(i->second);
- Scheme_Object* entry = scheme_make_pair(k,x);
- alist = scheme_make_pair(entry,alist);
- }
- $result = alist;
- }
- %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
- // native sequence?
- if (SCHEME_NULLP($input)) {
- /* an empty sequence can be of any type */
- $1 = 1;
- } else if (SCHEME_PAIRP($input)) {
- // check the first element only
- K* k;
- Scheme_Object* head = scheme_car($input);
- if (SCHEME_PAIRP(head)) {
- Scheme_Object* key = scheme_car(head);
- Scheme_Object* val = scheme_cdr(head);
- if (SWIG_ConvertPtr(val,(void **) &k,
- $descriptor(K *), 0) == -1) {
- $1 = 0;
- } else {
- if (CHECK(val)) {
- $1 = 1;
- } else if (SCHEME_PAIRP(val)) {
- val = scheme_car(val);
- if (CHECK(val))
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $&1_descriptor, 0) != -1)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %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 */
- $1 = 1;
- } else if (SCHEME_PAIRP($input)) {
- // check the first element only
- K* k;
- Scheme_Object* head = scheme_car($input);
- if (SCHEME_PAIRP(head)) {
- Scheme_Object* key = scheme_car(head);
- Scheme_Object* val = scheme_cdr(head);
- if (SWIG_ConvertPtr(val,(void **) &k,
- $descriptor(K *), 0) == -1) {
- $1 = 0;
- } else {
- if (CHECK(val)) {
- $1 = 1;
- } else if (SCHEME_PAIRP(val)) {
- val = scheme_car(val);
- if (CHECK(val))
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $1_descriptor, 0) != -1)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %rename("length") size;
- %rename("null?") empty;
- %rename("clear!") clear;
- %rename("ref") __getitem__;
- %rename("set!") __setitem__;
- %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& 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, C >::iterator i = self->find(key);
- if (i != self->end())
- return i->second;
- else
- throw std::out_of_range("key not found");
- }
- void __setitem__(const K& key, T x) {
- (*self)[key] = x;
- }
- void __delitem__(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();
- }
- Scheme_Object* keys() {
- Scheme_Object* result = scheme_null;
- 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);
- result = scheme_make_pair(k,result);
- }
- return result;
- }
- }
- };
- %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)
- 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, C >();
- } else if (SCHEME_PAIRP($input)) {
- $1 = std::map< K, T, C >();
- Scheme_Object* alist = $input;
- while (!SCHEME_NULLP(alist)) {
- Scheme_Object *entry, *key, *val;
- entry = scheme_car(alist);
- if (!SCHEME_PAIRP(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = scheme_car(entry);
- val = scheme_cdr(entry);
- if (!CHECK_K(key))
- SWIG_exception(SWIG_TypeError,
- "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 "," #C "> expected");
- }
- (($1_type &)$1)[CONVERT_K_FROM(key)] =
- CONVERT_T_FROM(val);
- alist = scheme_cdr(alist);
- }
- } else {
- $1 = *(($&1_type)
- SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
- }
- }
- %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, C >();
- $1 = &temp;
- } else if (SCHEME_PAIRP($input)) {
- temp = std::map< K, T, C >();
- $1 = &temp;
- Scheme_Object* alist = $input;
- while (!SCHEME_NULLP(alist)) {
- Scheme_Object *entry, *key, *val;
- entry = scheme_car(alist);
- if (!SCHEME_PAIRP(entry))
- SWIG_exception(SWIG_TypeError,"alist expected");
- key = scheme_car(entry);
- val = scheme_cdr(entry);
- if (!CHECK_K(key))
- SWIG_exception(SWIG_TypeError,
- "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 "," #C "> expected");
- }
- temp[CONVERT_K_FROM(key)] = CONVERT_T_FROM(val);
- alist = scheme_cdr(alist);
- }
- } else {
- $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
- }
- }
- %typemap(out) map< K, T, C > {
- Scheme_Object* alist = scheme_null;
- 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);
- Scheme_Object* entry = scheme_make_pair(k,x);
- alist = scheme_make_pair(entry,alist);
- }
- $result = alist;
- }
- %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
- // native sequence?
- if (SCHEME_NULLP($input)) {
- /* an empty sequence can be of any type */
- $1 = 1;
- } else if (SCHEME_PAIRP($input)) {
- // check the first element only
- Scheme_Object* head = scheme_car($input);
- if (SCHEME_PAIRP(head)) {
- Scheme_Object* key = scheme_car(head);
- Scheme_Object* val = scheme_cdr(head);
- if (!CHECK_K(key)) {
- $1 = 0;
- } else {
- if (CHECK_T(val)) {
- $1 = 1;
- } else if (SCHEME_PAIRP(val)) {
- val = scheme_car(val);
- if (CHECK_T(val))
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $&1_descriptor, 0) != -1)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %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 */
- $1 = 1;
- } else if (SCHEME_PAIRP($input)) {
- // check the first element only
- Scheme_Object* head = scheme_car($input);
- if (SCHEME_PAIRP(head)) {
- Scheme_Object* key = scheme_car(head);
- Scheme_Object* val = scheme_cdr(head);
- if (!CHECK_K(key)) {
- $1 = 0;
- } else {
- if (CHECK_T(val)) {
- $1 = 1;
- } else if (SCHEME_PAIRP(val)) {
- val = scheme_car(val);
- if (CHECK_T(val))
- $1 = 1;
- else
- $1 = 0;
- } else {
- $1 = 0;
- }
- }
- } else {
- $1 = 0;
- }
- } else {
- // wrapped map?
- std::map< K, T, C >* m;
- if (SWIG_ConvertPtr($input,(void **) &m,
- $1_descriptor, 0) != -1)
- $1 = 1;
- else
- $1 = 0;
- }
- }
- %rename("length") size;
- %rename("null?") empty;
- %rename("clear!") clear;
- %rename("ref") __getitem__;
- %rename("set!") __setitem__;
- %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& other);
-
- unsigned int size() const;
- bool empty() const;
- void clear();
- %extend {
- T __getitem__(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 __setitem__(K key, T x) {
- (*self)[key] = x;
- }
- void __delitem__(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(K 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, C >::reverse_iterator i=self->rbegin();
- i!=self->rend(); ++i) {
- Scheme_Object* k = CONVERT_K_TO(i->first);
- result = scheme_make_pair(k,result);
- }
- return result;
- }
- }
- };
- %enddef
-
-
- specialize_std_map_on_key(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_key(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_key(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_key(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_key(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_key(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_key(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_key(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_key(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_key(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
-
- specialize_std_map_on_value(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_value(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_value(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_value(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_value(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_value(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_value(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_value(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_value(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_value(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
-
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- bool,SCHEME_BOOLP,
- SCHEME_TRUEP,swig_make_boolean);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- unsigned int,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- unsigned short,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- unsigned long,SCHEME_INTP,
- SCHEME_INT_VAL,scheme_make_integer_value);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- double,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- float,SCHEME_REALP,
- scheme_real_to_double,scheme_make_double);
- specialize_std_map_on_both(std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string,
- std::string,SCHEME_STRINGP,
- swig_scm_to_string,swig_make_string);
}
diff --git a/linux-x86/share/swig/mzscheme/std_string.i b/linux-x86/share/swig/mzscheme/std_string.i
index b19e856..70673ea 100644
--- a/linux-x86/share/swig/mzscheme/std_string.i
+++ b/linux-x86/share/swig/mzscheme/std_string.i
@@ -52,6 +52,13 @@ namespace std {
$result = scheme_make_string($1->c_str());
}
+ %typemap(throws) string {
+ scheme_signal_error("%s: %s", FUNC_NAME, $1.c_str());
+ }
+
+ %typemap(throws) const string & {
+ scheme_signal_error("%s: %s", FUNC_NAME, $1.c_str());
+ }
}
diff --git a/linux-x86/share/swig/mzscheme/std_unique_ptr.i b/linux-x86/share/swig/mzscheme/std_unique_ptr.i
new file mode 100644
index 0000000..53cf466
--- /dev/null
+++ b/linux-x86/share/swig/mzscheme/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'");
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/mzscheme/std_vector.i b/linux-x86/share/swig/mzscheme/std_vector.i
index 0ef5edb..ae886b7 100644
--- a/linux-x86/share/swig/mzscheme/std_vector.i
+++ b/linux-x86/share/swig/mzscheme/std_vector.i
@@ -421,6 +421,9 @@ namespace std {
}
};
%enddef
+ %typemap(throws) std::out_of_range {
+ scheme_signal_error("%s: %s", FUNC_NAME, $1.what());
+ }
specialize_std_vector(bool,SCHEME_BOOLP,SCHEME_TRUEP,\
swig_make_boolean);
diff --git a/linux-x86/share/swig/mzscheme/swigmove.i b/linux-x86/share/swig/mzscheme/swigmove.i
new file mode 100644
index 0000000..bbfcdcb
--- /dev/null
+++ b/linux-x86/share/swig/mzscheme/swigmove.i
@@ -0,0 +1,19 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type '$1_type'");
+ } else {
+ %argument_fail(res, "$1_type", $symname, $argnum);
+ }
+ }
+ if (argp == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)");
+ SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp);
+}
diff --git a/linux-x86/share/swig/mzscheme/typemaps.i b/linux-x86/share/swig/mzscheme/typemaps.i
index 09bda2c..7ceffb2 100644
--- a/linux-x86/share/swig/mzscheme/typemaps.i
+++ b/linux-x86/share/swig/mzscheme/typemaps.i
@@ -2,6 +2,12 @@
* typemaps.i
* ----------------------------------------------------------------------------- */
+#define %set_output(obj) $result = obj
+#define %set_varoutput(obj) $result = obj
+#define %argument_fail(code, type, name, argn) scheme_wrong_type(FUNC_NAME, type, argn, argc, argv)
+#define %as_voidptr(ptr) (void*)(ptr)
+
+
/* The MzScheme module handles all types uniformly via typemaps. Here
are the definitions. */
@@ -66,9 +72,23 @@
#ifdef __cplusplus
-%typemap(in) SWIGTYPE &, SWIGTYPE && {
+%typemap(in) SWIGTYPE & {
$1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
- if ($1 == NULL) scheme_signal_error("swig-type-error (null reference)");
+ if ($1 == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)");
+}
+
+%typemap(in, noblock=1, fragment="<memory>") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type '$1_type'");
+ } else {
+ %argument_fail(res, "$1_type", $symname, $argnum);
+ }
+ }
+ if (argp == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)");
+ $1 = ($1_ltype)argp;
+ rvrdeleter.reset($1);
}
%typemap(out) SWIGTYPE &, SWIGTYPE && {
@@ -105,8 +125,8 @@
$1 = ($1_type) SWIG_convert_int($input);
}
-%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);";
-%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);";
+%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);"
+%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);"
/* Pass-by-value */
@@ -127,7 +147,7 @@
#ifdef __cplusplus
{
$&1_ltype resultptr;
- resultptr = new $1_ltype(($1_ltype &) $1);
+ resultptr = new $1_ltype($1);
$result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1);
}
#else
@@ -143,7 +163,7 @@
#ifdef __cplusplus
{
$&1_ltype resultptr;
- resultptr = new $1_ltype(($1_ltype &) $1);
+ resultptr = new $1_ltype($1);
$result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0);
}
#else
@@ -187,8 +207,6 @@
s = C_TO_MZ(*$1);
SWIG_APPEND_VALUE(s);
}
-%typemap(in) C_NAME *BOTH = C_NAME *INPUT;
-%typemap(argout) C_NAME *BOTH = C_NAME *OUTPUT;
%typemap(in) C_NAME *INOUT = C_NAME *INPUT;
%typemap(argout) C_NAME *INOUT = C_NAME *OUTPUT;
%enddef
@@ -270,14 +288,18 @@ REF_MAP(float, SCHEME_REALP, scheme_real_to_double,
REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
scheme_make_double, real);
+%typemap(throws) char * {
+ scheme_signal_error("%s: %s", FUNC_NAME, $1);
+}
+
/* Void */
-%typemap(out) void "$result = scheme_void;";
+%typemap(out) void "$result = scheme_void;"
/* Pass through Scheme_Object * */
-%typemap (in) Scheme_Object * "$1=$input;";
-%typemap (out) Scheme_Object * "$result=$1;";
+%typemap (in) Scheme_Object * "$1=$input;"
+%typemap (out) Scheme_Object * "$result=$1;"
%typecheck(SWIG_TYPECHECK_POINTER) Scheme_Object * "$1=1;";
@@ -291,7 +313,6 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
// $2 = ($2_ltype) temp;
//}
-
/* ------------------------------------------------------------
* Typechecking rules
* ------------------------------------------------------------ */
diff --git a/linux-x86/share/swig/ocaml/carray.i b/linux-x86/share/swig/ocaml/carray.i
index 5e74c3d..71631aa 100644
--- a/linux-x86/share/swig/ocaml/carray.i
+++ b/linux-x86/share/swig/ocaml/carray.i
@@ -77,7 +77,7 @@ type _value = c_obj
%typemap(out) SWIGTYPE [] {
int i;
- CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+ const value *fromval = caml_named_value("create_$ntype_from_ptr");
$result = caml_array_new($1_dim0);
for( i = 0; i < $1_dim0; i++ ) {
diff --git a/linux-x86/share/swig/ocaml/cstring.i b/linux-x86/share/swig/ocaml/cstring.i
index f1190ad..3f680a2 100644
--- a/linux-x86/share/swig/ocaml/cstring.i
+++ b/linux-x86/share/swig/ocaml/cstring.i
@@ -25,13 +25,13 @@
*
* %cstring_bounded_output(char *outx, 512);
* void foo(char *outx) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*
*/
%define %cstring_bounded_output(TYPEMAP,MAX)
-%typemap(ignore) TYPEMAP(char temp[MAX+1]) {
+%typemap(in,numinputs=0) TYPEMAP(char temp[MAX+1]) {
$1 = ($1_ltype) temp;
}
%typemap(argout) TYPEMAP {
@@ -54,7 +54,7 @@
*/
%define %cstring_chunk_output(TYPEMAP,SIZE)
-%typemap(ignore) TYPEMAP(char temp[SIZE]) {
+%typemap(in,numinputs=0) TYPEMAP(char temp[SIZE]) {
$1 = ($1_ltype) temp;
}
%typemap(argout) TYPEMAP {
@@ -144,7 +144,7 @@
*
* %cstring_output_maxsize(char *outx, int max) {
* void foo(char *outx, int max) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*/
@@ -175,7 +175,7 @@
*
* %cstring_output_maxsize(char *outx, int *max) {
* void foo(char *outx, int *max) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* *max = strlen(outx);
* }
*/
@@ -213,12 +213,12 @@
* %cstring_output_allocated(char **outx, free($1));
* void foo(char **outx) {
* *outx = (char *) malloc(512);
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*/
%define %cstring_output_allocate(TYPEMAP, RELEASE)
-%typemap(ignore) TYPEMAP($*1_ltype temp = 0) {
+%typemap(in,numinputs=0) TYPEMAP($*1_ltype temp = 0) {
$1 = &temp;
}
@@ -241,13 +241,13 @@
* %cstring_output_allocated(char **outx, int *sz, free($1));
* void foo(char **outx, int *sz) {
* *outx = (char *) malloc(512);
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* *sz = strlen(outx);
* }
*/
%define %cstring_output_allocate_size(TYPEMAP, SIZE, RELEASE)
-%typemap(ignore) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) {
+%typemap(in,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) {
$1 = &temp;
$2 = &tempn;
}
diff --git a/linux-x86/share/swig/ocaml/director.swg b/linux-x86/share/swig/ocaml/director.swg
index eb91aaf..4cdb0c6 100644
--- a/linux-x86/share/swig/ocaml/director.swg
+++ b/linux-x86/share/swig/ocaml/director.swg
@@ -67,13 +67,13 @@ namespace Swig {
class Director {
private:
/* pointer to the wrapped ocaml object */
- CAML_VALUE swig_self;
+ value swig_self;
/* flag indicating whether the object is owned by ocaml or c++ */
mutable bool swig_disown_flag;
public:
/* wrap a ocaml object. */
- Director(CAML_VALUE self) : swig_self(self), swig_disown_flag(false) {
+ Director(value self) : swig_self(self), swig_disown_flag(false) {
caml_register_global_root(&swig_self);
}
@@ -85,7 +85,7 @@ namespace Swig {
}
/* return a pointer to the wrapped ocaml object */
- CAML_VALUE swig_get_self() const {
+ value swig_get_self() const {
return swig_self;
}
diff --git a/linux-x86/share/swig/ocaml/ocaml.swg b/linux-x86/share/swig/ocaml/ocaml.swg
index ac496bd..b3ccab5 100644
--- a/linux-x86/share/swig/ocaml/ocaml.swg
+++ b/linux-x86/share/swig/ocaml/ocaml.swg
@@ -40,9 +40,10 @@
$1 = ($ltype) caml_ptr_val($input,$1_descriptor);
}
-%typemap(in) SWIGTYPE && {
+%typemap(in, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{
$1 = ($ltype) caml_ptr_val($input,$1_descriptor);
-}
+ rvrdeleter.reset($1);
+%}
%typemap(varin) SWIGTYPE & {
$1 = *(($ltype) caml_ptr_val($input,$1_descriptor));
@@ -62,7 +63,7 @@
#if 0
%typemap(argout) SWIGTYPE & {
- CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+ const value *fromval = caml_named_value("create_$ntype_from_ptr");
if( fromval ) {
swig_result =
caml_list_append(swig_result,
@@ -75,7 +76,7 @@
}
}
%typemap(argout) SWIGTYPE && {
- CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+ const value *fromval = caml_named_value("create_$ntype_from_ptr");
if( fromval ) {
swig_result =
caml_list_append(swig_result,
@@ -93,10 +94,14 @@
$1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ;
}
+%typemap(varout) SWIGTYPE {
+ $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)&$1, $&1_descriptor);
+}
+
#ifdef __cplusplus
%typemap(out) SWIGTYPE {
- $&1_ltype temp = new $ltype((const $1_ltype &) $1);
+ $&1_ltype temp = new $1_ltype($1);
$result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)temp, $&1_descriptor);
}
@@ -110,8 +115,12 @@
#endif
+%typemap(varout) SWIGTYPE * {
+ $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)$1, $1_descriptor);
+}
+
%typemap(directorin) SWIGTYPE {
- $&ltype temp = new $ltype((const $ltype &)$1);
+ $&ltype temp = new $1_ltype(SWIG_STD_MOVE($1));
swig_result = SWIG_Ocaml_ptr_to_val("create_$ltype_from_ptr", (void *)temp, $&1_descriptor);
args = caml_list_append(args, swig_result);
}
@@ -180,12 +189,12 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
/* Void */
-%typemap(out) void "$result = Val_unit;";
+%typemap(out) void "$result = Val_unit;"
/* Pass through value */
-%typemap (in) CAML_VALUE "$1=$input;";
-%typemap (out) CAML_VALUE "$result=$1;";
+%typemap (in) value "$1=$input;"
+%typemap (out) value "$result=$1;"
#if 0
%include <carray.i>
@@ -302,7 +311,7 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) }
+%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/linux-x86/share/swig/ocaml/ocamlrun.swg b/linux-x86/share/swig/ocaml/ocamlrun.swg
index 3d552cc..95350ea 100644
--- a/linux-x86/share/swig/ocaml/ocamlrun.swg
+++ b/linux-x86/share/swig/ocaml/ocamlrun.swg
@@ -91,20 +91,20 @@ extern "C" {
}
}
- SWIGINTERN void caml_print_list( CAML_VALUE v );
+ SWIGINTERN void caml_print_list( value v );
- SWIGINTERN void caml_print_val( CAML_VALUE v ) {
- switch( SWIG_Tag_val(v) ) {
+ SWIGINTERN void caml_print_val( value v ) {
+ switch( Tag_val(v) ) {
case C_bool:
- if( Bool_val(SWIG_Field(v,0)) ) fprintf( stderr, "true " );
+ if( Bool_val(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)) );
+ (Int_val(Field(v,0)) >= ' ' &&
+ Int_val(Field(v,0)) < 127) ? Int_val(Field(v,0)) : '.',
+ Int_val(Field(v,0)) );
break;
case C_short:
case C_ushort:
@@ -127,7 +127,7 @@ extern "C" {
case C_ptr:
{
void *vout = 0;
- swig_type_info *ty = (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field(v,1));
+ swig_type_info *ty = (swig_type_info *)(long)Int64_val(Field(v,1));
caml_ptr_val_internal(v,&vout,0);
fprintf( stderr, "PTR(%p,%s) ",
vout,
@@ -137,15 +137,15 @@ extern "C" {
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) );
+ for( i = 0; i < Wosize_val( Field(v,0) ); i++ )
+ caml_print_val( Field(Field(v,0),i) );
}
break;
case C_list:
- caml_print_list( SWIG_Field(v,0) );
+ caml_print_list( Field(v,0) );
break;
case C_obj:
- fprintf( stderr, "OBJ(%p) ", (void *)SWIG_Field(v,0) );
+ fprintf( stderr, "OBJ(%p) ", (void *)Field(v,0) );
break;
case C_string:
{
@@ -157,30 +157,30 @@ extern "C" {
}
}
- SWIGINTERN void caml_print_list( CAML_VALUE v ) {
+ SWIGINTERN void caml_print_list( value v ) {
CAMLparam1(v);
while( v && Is_block(v) ) {
fprintf( stderr, "[ " );
- caml_print_val( SWIG_Field(v,0) );
+ caml_print_val( Field(v,0) );
fprintf( stderr, "]\n" );
- v = SWIG_Field(v,1);
+ v = Field(v,1);
}
CAMLreturn0;
}
- SWIGINTERN CAML_VALUE caml_list_nth( CAML_VALUE lst, int n ) {
+ SWIGINTERN value caml_list_nth( value lst, int n ) {
CAMLparam1(lst);
int i = 0;
while( i < n && lst && Is_block(lst) ) {
- i++; lst = SWIG_Field(lst,1);
+ i++; lst = Field(lst,1);
}
if( lst == Val_unit ) CAMLreturn(Val_unit);
- else CAMLreturn(SWIG_Field(lst,0));
+ else CAMLreturn(Field(lst,0));
}
- SWIGINTERN CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt ) {
+ SWIGINTERN value caml_list_append( value lst, value elt ) {
CAMLparam2(lst,elt);
- SWIG_CAMLlocal3(v,vt,lh);
+ CAMLlocal3(v,vt,lh);
lh = Val_unit;
v = Val_unit;
@@ -190,224 +190,224 @@ extern "C" {
while( lst && Is_block(lst) ) {
if( v && v != Val_unit ) {
vt = caml_alloc_tuple(2);
- SWIG_Store_field(v,1,vt);
+ 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);
+ Store_field(v,0,Field(lst,0));
+ lst = Field(lst,1);
}
if( v && Is_block(v) ) {
vt = caml_alloc_tuple(2);
- SWIG_Store_field(v,1,vt);
+ 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);
+ Store_field(v,0,elt);
+ Store_field(v,1,Val_unit);
CAMLreturn(lh);
}
- SWIGINTERN int caml_list_length( CAML_VALUE lst ) {
+ SWIGINTERN int caml_list_length( value lst ) {
CAMLparam1(lst);
int i = 0;
- while( lst && Is_block(lst) ) { i++; lst = SWIG_Field(lst,1); }
+ while( lst && Is_block(lst) ) { i++; lst = Field(lst,1); }
CAMLreturn(i);
}
- SWIGINTERN void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item ) {
+ SWIGINTERN void caml_array_set( value arr, int n, value item ) {
CAMLparam2(arr,item);
- SWIG_Store_field(SWIG_Field(arr,0),n,item);
+ Store_field(Field(arr,0),n,item);
CAMLreturn0;
}
- SWIGINTERN value caml_array_nth( CAML_VALUE arr, int n ) {
+ SWIGINTERN value caml_array_nth( 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 )
+ if( Tag_val(arr) == C_array )
+ CAMLreturn(Field(Field(arr,0),n));
+ else if( 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 ) {
+ SWIGINTERN int caml_array_len( 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 )
+ if( Tag_val(arr) == C_array )
+ CAMLreturn(Wosize_val(Field(arr,0)));
+ else if( 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) {
+ SWIGINTERN value caml_swig_alloc(int x,int y) {
return caml_alloc(x,y);
}
SWIGINTERN value caml_array_new( int n ) {
CAMLparam0();
- SWIG_CAMLlocal1(vv);
+ CAMLlocal1(vv);
vv = caml_swig_alloc(1,C_array);
- SWIG_Store_field(vv,0,caml_alloc_tuple(n));
+ Store_field(vv,0,caml_alloc_tuple(n));
CAMLreturn(vv);
}
- SWIGINTERN CAML_VALUE caml_val_bool( int b ) {
+ SWIGINTERN value caml_val_bool( int b ) {
CAMLparam0();
- SWIG_CAMLlocal1(bv);
+ CAMLlocal1(bv);
bv = caml_swig_alloc(1,C_bool);
- SWIG_Store_field(bv,0,Val_bool(b));
+ Store_field(bv,0,Val_bool(b));
CAMLreturn(bv);
}
- SWIGINTERN CAML_VALUE caml_val_char( char c ) {
+ SWIGINTERN value caml_val_char( char c ) {
CAMLparam0();
- SWIG_CAMLlocal1(cv);
+ CAMLlocal1(cv);
cv = caml_swig_alloc(1,C_char);
- SWIG_Store_field(cv,0,Val_int(c));
+ Store_field(cv,0,Val_int(c));
CAMLreturn(cv);
}
- SWIGINTERN CAML_VALUE caml_val_uchar( unsigned char uc ) {
+ SWIGINTERN value caml_val_uchar( unsigned char uc ) {
CAMLparam0();
- SWIG_CAMLlocal1(ucv);
+ CAMLlocal1(ucv);
ucv = caml_swig_alloc(1,C_uchar);
- SWIG_Store_field(ucv,0,Val_int(uc));
+ Store_field(ucv,0,Val_int(uc));
CAMLreturn(ucv);
}
- SWIGINTERN CAML_VALUE caml_val_short( short s ) {
+ SWIGINTERN value caml_val_short( short s ) {
CAMLparam0();
- SWIG_CAMLlocal1(sv);
+ CAMLlocal1(sv);
sv = caml_swig_alloc(1,C_short);
- SWIG_Store_field(sv,0,Val_int(s));
+ Store_field(sv,0,Val_int(s));
CAMLreturn(sv);
}
- SWIGINTERN CAML_VALUE caml_val_ushort( unsigned short us ) {
+ SWIGINTERN value caml_val_ushort( unsigned short us ) {
CAMLparam0();
- SWIG_CAMLlocal1(usv);
+ CAMLlocal1(usv);
usv = caml_swig_alloc(1,C_ushort);
- SWIG_Store_field(usv,0,Val_int(us));
+ Store_field(usv,0,Val_int(us));
CAMLreturn(usv);
}
- SWIGINTERN CAML_VALUE caml_val_int( int i ) {
+ SWIGINTERN value caml_val_int( int i ) {
CAMLparam0();
- SWIG_CAMLlocal1(iv);
+ CAMLlocal1(iv);
iv = caml_swig_alloc(1,C_int);
- SWIG_Store_field(iv,0,Val_int(i));
+ Store_field(iv,0,Val_int(i));
CAMLreturn(iv);
}
- SWIGINTERN CAML_VALUE caml_val_uint( unsigned int ui ) {
+ SWIGINTERN value caml_val_uint( unsigned int ui ) {
CAMLparam0();
- SWIG_CAMLlocal1(uiv);
+ CAMLlocal1(uiv);
uiv = caml_swig_alloc(1,C_int);
- SWIG_Store_field(uiv,0,Val_int(ui));
+ Store_field(uiv,0,Val_int(ui));
CAMLreturn(uiv);
}
- SWIGINTERN CAML_VALUE caml_val_long( long l ) {
+ SWIGINTERN value caml_val_long( long l ) {
CAMLparam0();
- SWIG_CAMLlocal1(lv);
+ CAMLlocal1(lv);
lv = caml_swig_alloc(1,C_int64);
- SWIG_Store_field(lv,0,caml_copy_int64(l));
+ Store_field(lv,0,caml_copy_int64(l));
CAMLreturn(lv);
}
- SWIGINTERN CAML_VALUE caml_val_ulong( unsigned long ul ) {
+ SWIGINTERN value caml_val_ulong( unsigned long ul ) {
CAMLparam0();
- SWIG_CAMLlocal1(ulv);
+ CAMLlocal1(ulv);
ulv = caml_swig_alloc(1,C_int64);
- SWIG_Store_field(ulv,0,caml_copy_int64(ul));
+ Store_field(ulv,0,caml_copy_int64(ul));
CAMLreturn(ulv);
}
- SWIGINTERN CAML_VALUE caml_val_float( float f ) {
+ SWIGINTERN value caml_val_float( float f ) {
CAMLparam0();
- SWIG_CAMLlocal1(fv);
+ CAMLlocal1(fv);
fv = caml_swig_alloc(1,C_float);
- SWIG_Store_field(fv,0,caml_copy_double((double)f));
+ Store_field(fv,0,caml_copy_double((double)f));
CAMLreturn(fv);
}
- SWIGINTERN CAML_VALUE caml_val_double( double d ) {
+ SWIGINTERN value caml_val_double( double d ) {
CAMLparam0();
- SWIG_CAMLlocal1(fv);
+ CAMLlocal1(fv);
fv = caml_swig_alloc(1,C_double);
- SWIG_Store_field(fv,0,caml_copy_double(d));
+ Store_field(fv,0,caml_copy_double(d));
CAMLreturn(fv);
}
- SWIGINTERN CAML_VALUE caml_val_ptr( void *p, swig_type_info *info ) {
+ SWIGINTERN value caml_val_ptr( void *p, swig_type_info *info ) {
CAMLparam0();
- SWIG_CAMLlocal1(vv);
+ 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));
+ Store_field(vv,0,caml_copy_int64((long)p));
+ Store_field(vv,1,caml_copy_int64((long)info));
CAMLreturn(vv);
}
- SWIGINTERN CAML_VALUE caml_val_string( const char *p ) {
+ SWIGINTERN value caml_val_string( const char *p ) {
CAMLparam0();
- SWIG_CAMLlocal1(vv);
+ 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));
+ Store_field(vv,0,caml_copy_string(p));
CAMLreturn(vv);
}
- SWIGINTERN CAML_VALUE caml_val_string_len( const char *p, int len ) {
+ SWIGINTERN value caml_val_string_len( const char *p, int len ) {
CAMLparam0();
- SWIG_CAMLlocal1(vv);
+ 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);
+ Store_field(vv,0,caml_alloc_string(len));
+ memcpy(Bp_val(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) {
+ SWIGINTERN 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 ) {
+ SWIGINTERN long caml_long_val_full( value v, const char *name ) {
CAMLparam1(v);
if( !Is_block(v) ) return 0;
- switch( SWIG_Tag_val(v) ) {
+ switch( 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)));
+ CAMLreturn(Int_val(Field(v,0)));
case C_uint:
case C_int32:
- CAMLreturn(Int32_val(SWIG_Field(v,0)));
+ CAMLreturn(Int32_val(Field(v,0)));
case C_int64:
- CAMLreturn((long)SWIG_Int64_val(SWIG_Field(v,0)));
+ CAMLreturn((long)Int64_val(Field(v,0)));
case C_float:
case C_double:
- CAMLreturn((long)Double_val(SWIG_Field(v,0)));
+ CAMLreturn((long)Double_val(Field(v,0)));
case C_string:
- CAMLreturn((long)String_val(SWIG_Field(v,0)));
+ CAMLreturn((long)String_val(Field(v,0)));
case C_ptr:
- CAMLreturn((long)SWIG_Int64_val(SWIG_Field(SWIG_Field(v,0),0)));
+ CAMLreturn((long)Int64_val(Field(Field(v,0),0)));
case C_enum: {
- SWIG_CAMLlocal1(ret);
- CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
+ CAMLlocal1(ret);
+ const 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));
@@ -417,100 +417,100 @@ extern "C" {
}
}
- SWIGINTERN long caml_long_val( CAML_VALUE v ) {
+ SWIGINTERN long caml_long_val( value v ) {
return caml_long_val_full(v,0);
}
- SWIGINTERN double caml_double_val( CAML_VALUE v ) {
+ SWIGINTERN double caml_double_val( value v ) {
CAMLparam1(v);
if( !Is_block(v) ) return 0.0;
- switch( SWIG_Tag_val(v) ) {
+ switch( 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)));
+ CAMLreturnT(double, Int_val(Field(v,0)));
case C_uint:
case C_int32:
- CAMLreturn_type(Int32_val(SWIG_Field(v,0)));
+ CAMLreturnT(double, Int32_val(Field(v,0)));
case C_int64:
- CAMLreturn_type(SWIG_Int64_val(SWIG_Field(v,0)));
+ CAMLreturnT(double, Int64_val(Field(v,0)));
case C_float:
case C_double:
- CAMLreturn_type(Double_val(SWIG_Field(v,0)));
+ CAMLreturnT(double, Double_val(Field(v,0)));
default:
- fprintf( stderr, "Unknown block tag %d\n", SWIG_Tag_val(v) );
+ fprintf( stderr, "Unknown block tag %d\n", Tag_val(v) );
caml_failwith("No conversion to double");
}
}
- SWIGINTERN int caml_ptr_val_internal( CAML_VALUE v, void **out,
+ SWIGINTERN int caml_ptr_val_internal( value v, void **out,
swig_type_info *descriptor ) {
CAMLparam1(v);
void *outptr = NULL;
swig_type_info *outdescr = NULL;
- static CAML_VALUE *func_val = NULL;
+ static const value *func_val = NULL;
if( v == Val_unit ) {
*out = 0;
- CAMLreturn_type(0);
+ CAMLreturnT(int, 0);
}
if( !Is_block(v) ) return -1;
- switch( SWIG_Tag_val(v) ) {
+ switch( 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));
+ CAMLreturnT(int, caml_ptr_val_internal(caml_callback(*func_val, v), out, descriptor));
case C_string:
- outptr = (void *)String_val(SWIG_Field(v,0));
+ outptr = (void *)String_val(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));
+ outptr = (void *)(long)Int64_val(Field(v,0));
+ outdescr = (swig_type_info *)(long)Int64_val(Field(v,1));
break;
default:
*out = 0;
- CAMLreturn_type(1);
+ CAMLreturnT(int, 1);
break;
}
- CAMLreturn_type(SWIG_GetPtr(outptr, out, outdescr, descriptor));
+ CAMLreturnT(int, SWIG_GetPtr(outptr, out, outdescr, descriptor));
}
- SWIGINTERN void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor ) {
+ SWIGINTERN void *caml_ptr_val( 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);
+ CAMLreturnT(void*, out);
else
caml_failwith( "No appropriate conversion found." );
}
- SWIGINTERN char *caml_string_val( CAML_VALUE v ) {
+ SWIGINTERN char *caml_string_val( value v ) {
return (char *)caml_ptr_val( v, 0 );
}
- SWIGINTERN int caml_string_len( CAML_VALUE v ) {
- switch( SWIG_Tag_val(v) ) {
+ SWIGINTERN int caml_string_len( value v ) {
+ switch( Tag_val(v) ) {
case C_string:
- return caml_string_length(SWIG_Field(v,0));
+ return caml_string_length(Field(v,0));
default:
return strlen((char *)caml_ptr_val(v,0));
}
}
- SWIGINTERN int caml_bool_check( CAML_VALUE v ) {
+ SWIGINTERN int caml_bool_check( value v ) {
CAMLparam1(v);
if( !Is_block(v) ) return 0;
- switch( SWIG_Tag_val(v) ) {
+ switch( Tag_val(v) ) {
case C_bool:
case C_ptr:
case C_string:
@@ -520,12 +520,12 @@ extern "C" {
}
}
- SWIGINTERN int caml_int_check( CAML_VALUE v ) {
+ SWIGINTERN int caml_int_check( value v ) {
CAMLparam1(v);
if( !Is_block(v) ) return 0;
- switch( SWIG_Tag_val(v) ) {
+ switch( Tag_val(v) ) {
case C_char:
case C_uchar:
case C_short:
@@ -541,11 +541,11 @@ extern "C" {
}
}
- SWIGINTERN int caml_float_check( CAML_VALUE v ) {
+ SWIGINTERN int caml_float_check( value v ) {
CAMLparam1(v);
if( !Is_block(v) ) return 0;
- switch( SWIG_Tag_val(v) ) {
+ switch( Tag_val(v) ) {
case C_float:
case C_double:
CAMLreturn(1);
@@ -555,11 +555,11 @@ extern "C" {
}
}
- SWIGINTERN int caml_ptr_check( CAML_VALUE v ) {
+ SWIGINTERN int caml_ptr_check( value v ) {
CAMLparam1(v);
if( !Is_block(v) ) return 0;
- switch( SWIG_Tag_val(v) ) {
+ switch( Tag_val(v) ) {
case C_string:
case C_ptr:
case C_int64:
@@ -570,11 +570,11 @@ extern "C" {
}
}
- SWIGINTERN CAML_VALUE SWIG_Ocaml_ptr_to_val(const char *name, void *ptr, swig_type_info *descriptor) {
+ SWIGINTERN value SWIG_Ocaml_ptr_to_val(const char *name, void *ptr, swig_type_info *descriptor) {
CAMLparam0();
- SWIG_CAMLlocal1(result);
+ CAMLlocal1(result);
- CAML_VALUE *fromval = caml_named_value(name);
+ const value *fromval = caml_named_value(name);
if (fromval) {
result = caml_callback(*fromval, caml_val_ptr(ptr, descriptor));
} else {
@@ -584,17 +584,17 @@ extern "C" {
}
static swig_module_info *SWIG_Ocaml_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
- CAML_VALUE pointer;
+ 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));
+ if (Is_block(pointer) && Tag_val(pointer) == C_ptr) {
+ return (swig_module_info *)(void *)(long)Int64_val(Field(pointer,0));
}
return 0;
}
static void SWIG_Ocaml_SetModule(swig_module_info *pointer) {
- CAML_VALUE mod_pointer;
+ value mod_pointer;
mod_pointer = caml_val_ptr(pointer, NULL);
caml_callback(*caml_named_value("swig_set_type_info"), mod_pointer);
@@ -603,5 +603,3 @@ extern "C" {
#ifdef __cplusplus
}
#endif
-#undef value
-
diff --git a/linux-x86/share/swig/ocaml/ocamlrundec.swg b/linux-x86/share/swig/ocaml/ocamlrundec.swg
index 555f9a4..4d20f34 100644
--- a/linux-x86/share/swig/ocaml/ocamlrundec.swg
+++ b/linux-x86/share/swig/ocaml/ocamlrundec.swg
@@ -14,8 +14,6 @@ SWIGEXT {
#else
#define 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>
@@ -34,95 +32,6 @@ SWIGEXT {
#define caml_array_set swig_caml_array_set
-/* Adapted from memory.h and mlvalues.h */
-
-#define SWIG_CAMLlocal1(x) \
- caml_value_t x = 0; \
- CAMLxparam1 (x)
-
-#define SWIG_CAMLlocal2(x, y) \
- caml_value_t x = 0, y = 0; \
- CAMLxparam2 (x, y)
-
-#define SWIG_CAMLlocal3(x, y, z) \
- caml_value_t x = 0, y = 0, z = 0; \
- CAMLxparam3 (x, y, z)
-
-#define SWIG_CAMLlocal4(x, y, z, t) \
- caml_value_t x = 0, y = 0, z = 0, t = 0; \
- CAMLxparam4 (x, y, z, t)
-
-#define SWIG_CAMLlocal5(x, y, z, t, u) \
- caml_value_t x = 0, y = 0, z = 0, t = 0, u = 0; \
- CAMLxparam5 (x, y, z, t, u)
-
-#define SWIG_CAMLlocalN(x, size) \
- caml_value_t x [(size)] = { 0, /* 0, 0, ... */ }; \
- CAMLxparamN (x, (size))
-
-#define SWIG_Field(x, i) (((caml_value_t *)(x)) [i]) /* Also an l-value. */
-#define SWIG_Store_field(block, offset, val) do{ \
- mlsize_t caml__temp_offset = (offset); \
- caml_value_t caml__temp_val = (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))
-#ifdef ARCH_BIG_ENDIAN
-#define SWIG_Tag_val(val) (((unsigned char *) (val)) [-1])
- /* Also an l-value. */
-#define SWIG_Tag_hp(hp) (((unsigned char *) (hp)) [sizeof(caml_value_t)-1])
- /* Also an l-value. */
-#else
-#define SWIG_Tag_val(val) (((unsigned char *) (val)) [-sizeof(caml_value_t)])
- /* Also an l-value. */
-#define SWIG_Tag_hp(hp) (((unsigned char *) (hp)) [0])
- /* Also an l-value. */
-#endif
-
-#ifdef CAMLreturn0
-#undef CAMLreturn0
-#endif
-#define CAMLreturn0 do{ \
- caml_local_roots = caml__frame; \
- return; \
-}while (0)
-
-#ifdef CAMLreturn
-#undef CAMLreturn
-#endif
-#define CAMLreturn(result) do{ \
- caml_value_t caml__temp_result = (result); \
- caml_local_roots = caml__frame; \
- return (caml__temp_result); \
-}while(0)
-
-#define CAMLreturn_type(result) do{ \
- caml_local_roots = caml__frame; \
- return result; \
-}while(0)
-
-#ifdef CAMLnoreturn
-#undef CAMLnoreturn
-#endif
-#define CAMLnoreturn ((void) caml__frame)
-
-
-#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
-
#define SWIG_NewPointerObj(p,type,flags) caml_val_ptr(p,type)
#define SWIG_GetModule(clientdata) SWIG_Ocaml_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Ocaml_SetModule(pointer)
@@ -141,7 +50,7 @@ typedef enum {
SWIGINTERN void SWIG_OCamlThrowException(SWIG_OCamlExceptionCodes code, const char *msg) {
CAMLparam0();
- SWIG_CAMLlocal1(str);
+ CAMLlocal1(str);
switch (code) {
case SWIG_OCamlIllegalArgumentException:
@@ -164,48 +73,48 @@ SWIGINTERN void SWIG_OCamlThrowException(SWIG_OCamlExceptionCodes code, const ch
CAMLreturn0;
}
-#define SWIG_contract_assert(expr, msg) if(!(expr)) {SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, msg);}
+#define SWIG_contract_assert(expr, msg) do { if(!(expr)) {SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, msg);} } while (0)
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 value caml_list_nth( value lst, int n );
+ SWIGINTERN value caml_list_append( value lst, value elt );
+ SWIGINTERN int caml_list_length( value lst );
+ SWIGINTERN value caml_array_new( int n );
+ SWIGINTERN void caml_array_set( value arr, int n, value item );
+ SWIGINTERN value caml_array_nth( value arr, int n );
+ SWIGINTERN int caml_array_len( value arr );
- SWIGINTERN CAML_VALUE caml_val_char( char c );
- SWIGINTERN CAML_VALUE caml_val_uchar( unsigned char c );
+ SWIGINTERN value caml_val_char( char c );
+ SWIGINTERN value caml_val_uchar( unsigned char c );
- SWIGINTERN CAML_VALUE caml_val_short( short s );
- SWIGINTERN CAML_VALUE caml_val_ushort( unsigned short s );
+ SWIGINTERN value caml_val_short( short s );
+ SWIGINTERN value caml_val_ushort( unsigned short s );
- SWIGINTERN CAML_VALUE caml_val_int( int x );
- SWIGINTERN CAML_VALUE caml_val_uint( unsigned int x );
+ SWIGINTERN value caml_val_int( int x );
+ SWIGINTERN value caml_val_uint( unsigned int x );
- SWIGINTERN CAML_VALUE caml_val_long( long x );
- SWIGINTERN CAML_VALUE caml_val_ulong( unsigned long x );
+ SWIGINTERN value caml_val_long( long x );
+ SWIGINTERN value caml_val_ulong( unsigned long x );
- SWIGINTERN CAML_VALUE caml_val_float( float f );
- SWIGINTERN CAML_VALUE caml_val_double( double d );
+ SWIGINTERN value caml_val_float( float f );
+ SWIGINTERN value caml_val_double( double d );
- SWIGINTERN CAML_VALUE caml_val_ptr( void *p, swig_type_info *descriptor );
+ SWIGINTERN value caml_val_ptr( void *p, swig_type_info *descriptor );
- SWIGINTERN CAML_VALUE caml_val_string( const char *str );
- SWIGINTERN CAML_VALUE caml_val_string_len( const char *str, int len );
+ SWIGINTERN value caml_val_string( const char *str );
+ SWIGINTERN value caml_val_string_len( const char *str, int len );
- SWIGINTERN long caml_long_val( CAML_VALUE v );
- SWIGINTERN double caml_double_val( CAML_VALUE v );
+ SWIGINTERN long caml_long_val( value v );
+ SWIGINTERN double caml_double_val( value v );
- SWIGINTERN int caml_ptr_val_internal( CAML_VALUE v, void **out,
+ SWIGINTERN int caml_ptr_val_internal( value v, void **out,
swig_type_info *descriptor );
- SWIGINTERN void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor );
+ SWIGINTERN void *caml_ptr_val( value v, swig_type_info *descriptor );
- SWIGINTERN char *caml_string_val( CAML_VALUE v );
- SWIGINTERN int caml_string_len( CAML_VALUE v );
+ SWIGINTERN char *caml_string_val( value v );
+ SWIGINTERN int caml_string_len( value v );
#ifdef __cplusplus
}
diff --git a/linux-x86/share/swig/ocaml/std_common.i b/linux-x86/share/swig/ocaml/std_common.i
index 7e64607..62a8d3c 100644
--- a/linux-x86/share/swig/ocaml/std_common.i
+++ b/linux-x86/share/swig/ocaml/std_common.i
@@ -12,12 +12,12 @@
%{
#include <string>
SWIGINTERNINLINE
-CAML_VALUE SwigString_FromString(const std::string &s) {
+value SwigString_FromString(const std::string &s) {
return caml_val_string((char *)s.c_str());
}
SWIGINTERNINLINE
-std::string SwigString_AsString(CAML_VALUE o) {
+std::string SwigString_AsString(value o) {
return std::string((char *)caml_ptr_val(o,0));
}
%}
diff --git a/linux-x86/share/swig/ocaml/std_map.i b/linux-x86/share/swig/ocaml/std_map.i
index 3f197ba..b6a98c6 100644
--- a/linux-x86/share/swig/ocaml/std_map.i
+++ b/linux-x86/share/swig/ocaml/std_map.i
@@ -47,7 +47,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -63,17 +67,4 @@ namespace std {
}
};
-// 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/linux-x86/share/swig/ocaml/std_string.i b/linux-x86/share/swig/ocaml/std_string.i
index 712c3bb..6cf918c 100644
--- a/linux-x86/share/swig/ocaml/std_string.i
+++ b/linux-x86/share/swig/ocaml/std_string.i
@@ -4,18 +4,11 @@
* SWIG typemaps for std::string
* ----------------------------------------------------------------------------- */
-// ------------------------------------------------------------------------
-// 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 <string>
#include <vector>
%}
-
+
%include <exception.i>
%include <std_vector.i>
@@ -23,10 +16,10 @@ namespace std {
%naturalvar string;
%naturalvar wstring;
-
+
class string;
class wstring;
-
+
/* Overloading check */
%typemap(in) string {
if (caml_ptr_check($input))
@@ -44,15 +37,6 @@ class wstring;
}
}
-%typemap(in) string & ($*1_ltype temp) {
- if (caml_ptr_check($input)) {
- temp.assign((char *)caml_ptr_val($input,0), caml_string_len($input));
- $1 = &temp;
- } else {
- SWIG_exception(SWIG_TypeError, "string expected");
- }
-}
-
%typemap(in) string * ($*1_ltype *temp) {
if (caml_ptr_check($input)) {
temp = new $*1_ltype((char *)caml_ptr_val($input,0), caml_string_len($input));
@@ -66,12 +50,12 @@ class wstring;
delete temp;
}
-%typemap(argout) string & {
- swig_result = caml_list_append(swig_result,caml_val_string_len((*$1).c_str(), (*$1).size()));
+%typemap(out) const string & {
+ $result = caml_val_string_len((*$1).data(), (*$1).size());
}
%typemap(directorin) string {
- swig_result = caml_val_string_len($1.c_str(), $1.size());
+ swig_result = caml_val_string_len($1.data(), $1.size());
args = caml_list_append(args, swig_result);
}
@@ -80,13 +64,39 @@ class wstring;
}
%typemap(out) string {
- $result = caml_val_string_len($1.c_str(),$1.size());
+ $result = caml_val_string_len($1.data(),$1.size());
+}
+
+%typemap(varout) string {
+ $result = caml_val_string_len($1.data(),$1.size());
}
%typemap(out) string * {
- $result = caml_val_string_len((*$1).c_str(),(*$1).size());
+ $result = caml_val_string_len((*$1).data(),(*$1).size());
+}
+
+%typemap(varout) string * {
+ $result = caml_val_string_len((*$1).data(),(*$1).size());
+}
+
+%typemap(typecheck) string, const string & = char *;
+
+%typemap(throws) string, const string & "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.c_str());"
+
+%typemap(in) string &INPUT = const string &;
+%typemap(in, numinputs=0) string &OUTPUT ($*1_ltype temp)
+%{ $1 = &temp; %}
+%typemap(argout) string &OUTPUT {
+ swig_result = caml_list_append(swig_result, caml_val_string_len((*$1).data(), (*$1).size()));
}
+%typemap(in) string &INOUT = const string &;
+%typemap(argout) string &INOUT = string &OUTPUT;
+
%typemap(typecheck) string, const string & = char *;
+
+%typemap(throws) string, const string & {
+ SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.c_str());
+}
}
#ifdef ENABLE_CHARPTR_ARRAY
diff --git a/linux-x86/share/swig/ocaml/swigmove.i b/linux-x86/share/swig/ocaml/swigmove.i
new file mode 100644
index 0000000..32f9903
--- /dev/null
+++ b/linux-x86/share/swig/ocaml/swigmove.i
@@ -0,0 +1,11 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0) {
+ argp1 = ($&1_ltype) caml_ptr_val($input,$&1_descriptor);
+ SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp);
+}
diff --git a/linux-x86/share/swig/ocaml/typecheck.i b/linux-x86/share/swig/ocaml/typecheck.i
index 0c0a600..1466d1c 100644
--- a/linux-x86/share/swig/ocaml/typecheck.i
+++ b/linux-x86/share/swig/ocaml/typecheck.i
@@ -7,7 +7,7 @@
%typecheck(SWIG_TYPECHECK_INT8) char, signed char, const char &, const signed char & {
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_char: $1 = 1; break;
default: $1 = 0; break;
}
@@ -17,7 +17,7 @@
%typecheck(SWIG_TYPECHECK_UINT8) unsigned char, const unsigned char & {
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_uchar: $1 = 1; break;
default: $1 = 0; break;
}
@@ -27,7 +27,7 @@
%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) ) {
+ switch( Tag_val($input) ) {
case C_short: $1 = 1; break;
default: $1 = 0; break;
}
@@ -37,7 +37,7 @@
%typecheck(SWIG_TYPECHECK_UINT16) unsigned short, const unsigned short & {
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_ushort: $1 = 1; break;
default: $1 = 0; break;
}
@@ -50,7 +50,7 @@
%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) ) {
+ switch( Tag_val($input) ) {
case C_int: $1 = 1; break;
default: $1 = 0; break;
}
@@ -60,7 +60,7 @@
%typecheck(SWIG_TYPECHECK_UINT32) unsigned int, const unsigned int & {
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_uint: $1 = 1; break;
case C_int32: $1 = 1; break;
default: $1 = 0; break;
@@ -77,7 +77,7 @@
{
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_int64: $1 = 1; break;
default: $1 = 0; break;
}
@@ -87,7 +87,7 @@
%typecheck(SWIG_TYPECHECK_BOOL) bool, const bool & {
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_bool: $1 = 1; break;
default: $1 = 0; break;
}
@@ -97,7 +97,7 @@
%typecheck(SWIG_TYPECHECK_FLOAT) float, const float & {
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_float: $1 = 1; break;
default: $1 = 0; break;
}
@@ -107,7 +107,7 @@
%typecheck(SWIG_TYPECHECK_DOUBLE) double, const double & {
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_double: $1 = 1; break;
default: $1 = 0; break;
}
@@ -117,11 +117,11 @@
%typecheck(SWIG_TYPECHECK_STRING) char * {
if( !Is_block($input) ) $1 = 0;
else {
- switch( SWIG_Tag_val($input) ) {
+ switch( Tag_val($input) ) {
case C_string: $1 = 1; break;
case C_ptr: {
swig_type_info *typeinfo =
- (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field($input,1));
+ (swig_type_info *)(long)Int64_val(Field($input,1));
$1 = SWIG_TypeCheck("char *",typeinfo) ||
SWIG_TypeCheck("signed char *",typeinfo) ||
SWIG_TypeCheck("unsigned char *",typeinfo) ||
@@ -136,7 +136,7 @@
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
- if (!Is_block($input) || !(SWIG_Tag_val($input) == C_obj || SWIG_Tag_val($input) == C_ptr)) {
+ if (!Is_block($input) || !(Tag_val($input) == C_obj || Tag_val($input) == C_ptr)) {
$1 = 0;
} else {
void *ptr;
@@ -149,14 +149,14 @@
if (!Is_block($input)) {
$1 = 0;
} else {
- switch (SWIG_Tag_val($input)) {
+ switch (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));
+ typeinfo = (swig_type_info *)Int64_val(Field($input, 1));
$1 = SWIG_TypeCheck("$1_type", typeinfo) != NULL;
break;
}
@@ -170,7 +170,7 @@
$1 = !caml_ptr_val_internal($input, &ptr, 0);
}
-%typecheck(SWIG_TYPECHECK_SWIGOBJECT) CAML_VALUE "$1 = 1;"
+%typecheck(SWIG_TYPECHECK_SWIGOBJECT) value "$1 = 1;"
/* ------------------------------------------------------------
* Exception handling
@@ -183,7 +183,7 @@
unsigned long,
unsigned short {
char error_msg[256];
- sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
+ SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1);
SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, error_msg);
}
diff --git a/linux-x86/share/swig/octave/argcargv.i b/linux-x86/share/swig/octave/argcargv.i
new file mode 100644
index 0000000..8ddca59
--- /dev/null
+++ b/linux-x86/share/swig/octave/argcargv.i
@@ -0,0 +1,52 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(in) (int ARGC, char **ARGV) {
+ if ($input.is_scalar_type()) {
+ $1 = 0; $2 = NULL;
+ %argument_fail(SWIG_TypeError, "'int ARGC, char **ARGV' is not a list", $symname, $argnum);
+ }
+ octave_value_list list = $input.list_value();
+ int i, len = list.length();
+ $1 = ($1_ltype) len;
+ $2 = (char **) malloc((len+1)*sizeof(char *));
+ for (i = 0; i < len; i++) {
+ if (!list(i).is_string()) {
+ $1 = 0;
+ %argument_fail(SWIG_TypeError, "'int ARGC, char **ARGV' use a non-string", $symname, $argnum);
+ }
+ const std::string & s = list(i).string_value();
+ size_t slen = s.size() + 1;
+ char * p = (char*)malloc(slen);
+ $2[i] = p;
+ memcpy(p, s.c_str(), slen);
+ }
+ $2[i] = NULL;
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ $1 = 0;
+ const octave_value& ov = $input;
+ if (!ov.is_scalar_type()) {
+ octave_value_list list = ov.list_value();
+ int i, len = list.length();
+ $1 = 1;
+ for (i = 0; i < len; i++) {
+ if (!list(i).is_string()) {
+ $1 = 0;
+ break;
+ }
+ }
+ }
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ if ($2 != NULL) {
+ $1_ltype i;
+ for (i = 0; i < $1; i++) {
+ free((void *)$2[i]);
+ }
+ free((void *)$2);
+ }
+}
diff --git a/linux-x86/share/swig/octave/boost_shared_ptr.i b/linux-x86/share/swig/octave/boost_shared_ptr.i
index 668bf43..87c89b5 100644
--- a/linux-x86/share/swig/octave/boost_shared_ptr.i
+++ b/linux-x86/share/swig/octave/boost_shared_ptr.i
@@ -35,7 +35,7 @@
}
}
%typemap(out) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1));
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -54,12 +54,12 @@
}
}
%typemap(varout) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $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));
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($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) {
diff --git a/linux-x86/share/swig/octave/director.swg b/linux-x86/share/swig/octave/director.swg
index bf71d18..5b9cd86 100644
--- a/linux-x86/share/swig/octave/director.swg
+++ b/linux-x86/share/swig/octave/director.swg
@@ -7,8 +7,6 @@
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
-#include <exception>
-
namespace Swig {
class Director {
diff --git a/linux-x86/share/swig/octave/extra-install.list b/linux-x86/share/swig/octave/extra-install.list
new file mode 100644
index 0000000..41ef947
--- /dev/null
+++ b/linux-x86/share/swig/octave/extra-install.list
@@ -0,0 +1,2 @@
+# see top-level Makefile.in
+octheaders.hpp
diff --git a/linux-x86/share/swig/octave/octcomplex.swg b/linux-x86/share/swig/octave/octcomplex.swg
index a3e9ebf..553c25a 100644
--- a/linux-x86/share/swig/octave/octcomplex.swg
+++ b/linux-x86/share/swig/octave/octcomplex.swg
@@ -2,7 +2,7 @@
Defines the As/From conversors for double/float complex, you need to
provide complex Type, the Name you want to use in the conversors,
the complex Constructor method, and the Real and Imag complex
- accesor methods.
+ accessor methods.
See the std_complex.i and ccomplex.i for concrete examples.
*/
@@ -73,7 +73,7 @@
int res = SWIG_AddCast(SWIG_AsVal(float)(ov, &d));
if (SWIG_IsOK(res)) {
if (val)
- *val = Constructor(d, 0.0);
+ *val = Constructor(d, 0.0f);
return res;
}
}
diff --git a/linux-x86/share/swig/octave/octcontainer.swg b/linux-x86/share/swig/octave/octcontainer.swg
index 310a849..97a345e 100644
--- a/linux-x86/share/swig/octave/octcontainer.swg
+++ b/linux-x86/share/swig/octave/octcontainer.swg
@@ -11,12 +11,6 @@
* be the case.
* ----------------------------------------------------------------------------- */
-%{
-#include <climits>
-#include <iostream>
-%}
-
-
#if !defined(SWIG_NO_EXPORT_ITERATOR_METHODS)
# if !defined(SWIG_EXPORT_ITERATOR_METHODS)
# define SWIG_EXPORT_ITERATOR_METHODS SWIG_EXPORT_ITERATOR_METHODS
@@ -64,7 +58,6 @@ namespace swig {
%fragment("OctSequence_Base","header",fragment="<stddef.h>")
{
-%#include <functional>
namespace std {
template <>
@@ -73,7 +66,11 @@ namespace std {
bool
operator()(const octave_value& v, const octave_value& w) const
{
+%#if SWIG_OCTAVE_PREREQ(7,0,0)
+ octave_value res = octave::binary_op(octave_value::op_le,v,w);
+%#else
octave_value res = do_binary_op(octave_value::op_le,v,w);
+%#endif
return res.is_true();
}
};
@@ -109,7 +106,7 @@ namespace swig {
template <class Sequence, class Difference>
inline typename Sequence::iterator
- getpos(Sequence* self, Difference i) {
+ getpos(Sequence* self, Difference i) {
typename Sequence::iterator pos = self->begin();
std::advance(pos, check_index(i,self->size()));
return pos;
@@ -117,7 +114,7 @@ namespace swig {
template <class Sequence, class Difference>
inline typename Sequence::const_iterator
- cgetpos(const Sequence* self, Difference i) {
+ cgetpos(const Sequence* self, Difference i) {
typename Sequence::const_iterator pos = self->begin();
std::advance(pos, check_index(i,self->size()));
return pos;
@@ -143,25 +140,29 @@ namespace swig {
template <class Sequence, class Difference, class InputSeq>
inline void
- setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) {
+ setslice(Sequence* self, Difference i, Difference j, const InputSeq& is) {
typename Sequence::size_type size = self->size();
typename Sequence::size_type ii = swig::check_index(i, size, true);
typename Sequence::size_type jj = swig::slice_index(j, size);
if (jj < ii) jj = ii;
size_t ssize = jj - ii;
- if (ssize <= v.size()) {
+ if (ssize <= is.size()) {
+ // expanding/staying the same size
typename Sequence::iterator sb = self->begin();
- typename InputSeq::const_iterator vmid = v.begin();
+ typename InputSeq::const_iterator vmid = is.begin();
std::advance(sb,ii);
std::advance(vmid, jj - ii);
- self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end());
+ self->insert(std::copy(is.begin(), vmid, sb), vmid, is.end());
} else {
+ // shrinking
typename Sequence::iterator sb = self->begin();
typename Sequence::iterator se = self->begin();
std::advance(sb,ii);
std::advance(se,jj);
self->erase(sb,se);
- self->insert(sb, v.begin(), v.end());
+ sb = self->begin();
+ std::advance(sb,ii);
+ self->insert(sb, is.begin(), is.end());
}
}
@@ -205,7 +206,7 @@ namespace swig
return swig::as<T>(item);
} catch (const std::exception& e) {
char msg[1024];
- sprintf(msg, "in sequence element %d ", _index);
+ SWIG_snprintf(msg, sizeof(msg), "in sequence element %d ", _index);
if (!Octave_Error_Occurred()) {
%type_error(swig::type_name<T>());
}
@@ -576,8 +577,17 @@ namespace swig {
} else {
return octseq.check() ? SWIG_OK : SWIG_ERROR;
}
- } catch (std::exception& e) {
+ }
+%#if SWIG_OCTAVE_PREREQ(6,0,0)
+ catch (octave::execution_exception& exec) {
+ }
+%#endif
+ catch (std::exception& e) {
+%#if SWIG_OCTAVE_PREREQ(6,0,0)
+ if (seq) // Know that octave is not in an error state
+%#else
if (seq&&!error_state)
+%#endif
error("swig type error: %s",e.what());
return SWIG_ERROR;
}
diff --git a/linux-x86/share/swig/octave/octheaders.hpp b/linux-x86/share/swig/octave/octheaders.hpp
new file mode 100644
index 0000000..26e5564
--- /dev/null
+++ b/linux-x86/share/swig/octave/octheaders.hpp
@@ -0,0 +1,130 @@
+//
+// This header includes all C++ headers required for generated Octave wrapper code.
+// Using a single header file allows pre-compilation of Octave headers, as follows:
+// * Check out this header file:
+// swig -octave -co octheaders.hpp
+// * Pre-compile header file into octheaders.hpp.gch:
+// g++ -c ... octheaders.hpp
+// * Use pre-compiled header file:
+// g++ -c -include octheaders.hpp ...
+//
+
+#if !defined(SWIG_OCTAVE_OCTHEADERS_HPP)
+#define SWIG_OCTAVE_OCTHEADERS_HPP
+
+// Required C++ headers
+#include <cstdlib>
+#include <climits>
+#include <iostream>
+#include <exception>
+#include <functional>
+#include <complex>
+#include <string>
+#include <vector>
+#include <map>
+
+// Minimal headers to define Octave version
+#include <octave/oct.h>
+#include <octave/version.h>
+
+// Macro for enabling features which require Octave version >= major.minor.patch
+// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '<digit>' (released) and '<digit>+' (in development) patch numbers
+#define SWIG_OCTAVE_PREREQ(major, minor, patch) \
+ ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((major)<<16) + ((minor)<<8) + (patch) )
+
+// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1
+#if !defined(OCTAVE_MAJOR_VERSION)
+
+# if !defined(OCTAVE_API_VERSION_NUMBER)
+
+// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet
+// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER
+# include <octave/ov.h>
+# if defined(octave_ov_h)
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 8
+# define OCTAVE_PATCH_VERSION 0
+# else
+
+// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed
+# define ComplexLU __ignore
+# include <octave/CmplxLU.h>
+# undef ComplexLU
+# if defined(octave_Complex_LU_h)
+
+// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 1
+# define OCTAVE_PATCH_VERSION 99
+
+# else
+
+// OCTAVE_API_VERSION_NUMBER == 37
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 2
+# define OCTAVE_PATCH_VERSION 0
+
+# endif // defined(octave_Complex_LU_h)
+
+# endif // defined(octave_ov_h)
+
+// Correlation between Octave API and version numbers extracted from Octave's
+// ChangeLogs; version is the *earliest* released Octave with that API number
+# elif OCTAVE_API_VERSION_NUMBER >= 48
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 6
+# define OCTAVE_PATCH_VERSION 0
+
+# elif OCTAVE_API_VERSION_NUMBER >= 45
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 4
+# define OCTAVE_PATCH_VERSION 1
+
+# elif OCTAVE_API_VERSION_NUMBER >= 42
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 3
+# define OCTAVE_PATCH_VERSION 54
+
+# elif OCTAVE_API_VERSION_NUMBER >= 41
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 3
+# define OCTAVE_PATCH_VERSION 53
+
+# elif OCTAVE_API_VERSION_NUMBER >= 40
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 3
+# define OCTAVE_PATCH_VERSION 52
+
+# elif OCTAVE_API_VERSION_NUMBER >= 39
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 3
+# define OCTAVE_PATCH_VERSION 51
+
+# else // OCTAVE_API_VERSION_NUMBER == 38
+# define OCTAVE_MAJOR_VERSION 3
+# define OCTAVE_MINOR_VERSION 3
+# define OCTAVE_PATCH_VERSION 50
+
+# endif // !defined(OCTAVE_API_VERSION_NUMBER)
+
+#endif // !defined(OCTAVE_MAJOR_VERSION)
+
+// Required Octave headers
+#include <octave/Cell.h>
+#include <octave/dynamic-ld.h>
+#include <octave/oct-env.h>
+#include <octave/oct-map.h>
+#include <octave/ov-scalar.h>
+#include <octave/ov-fcn-handle.h>
+#include <octave/parse.h>
+#if SWIG_OCTAVE_PREREQ(4,2,0)
+#include <octave/interpreter.h>
+#else
+#include <octave/toplev.h>
+#endif
+#include <octave/unwind-prot.h>
+#if SWIG_OCTAVE_PREREQ(4,2,0)
+#include <octave/call-stack.h>
+#endif
+
+#endif // !defined(SWIG_OCTAVE_OCTHEADERS_HPP)
diff --git a/linux-x86/share/swig/octave/octrun.swg b/linux-x86/share/swig/octave/octrun.swg
index ff614e6..5865c92 100644
--- a/linux-x86/share/swig/octave/octrun.swg
+++ b/linux-x86/share/swig/octave/octrun.swg
@@ -89,10 +89,6 @@ SWIGRUNTIME void SWIG_Octave_SetModule(void *clientdata, swig_module_info *point
// Runtime API implementation
-#include <map>
-#include <vector>
-#include <string>
-
typedef octave_value_list(*octave_func) (const octave_value_list &, int);
class octave_swig_type;
@@ -175,7 +171,16 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
octave_function* function_value(bool = false) { return this; }
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
+ return execute(tw,nargout,args);
+ }
+#endif
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ octave_value_list execute(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
+#else
octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
+#endif
octave_value_list all_args;
all_args.append(first_args);
all_args.append(args);
@@ -203,11 +208,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
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
@@ -231,7 +232,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
const swig_type_info *construct_type; // type of special type object
std::vector < type_ptr_pair > types; // our c++ base classes
- int own; // whether we call c++ destructors when we die
+ int thisown; // whether we call c++ destructors when we die
typedef std::pair < const swig_octave_member *, octave_value > member_value_pair;
typedef std::map < std::string, member_value_pair > member_map;
@@ -401,7 +402,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
static octave_value make_value_hack(const octave_base_value &x) {
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ ((octave_swig_type &) x).m_count++;
+#else
((octave_swig_type &) x).count++;
+#endif
return octave_value((octave_base_value *) &x);
}
@@ -411,7 +416,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
octave_swig_type(void *_ptr = 0, const swig_type_info *_type = 0, int _own = 0,
bool _always_static = false)
- : module(0), construct_type(_ptr ? 0 : _type), own(_own),
+ : module(0), construct_type(_ptr ? 0 : _type), thisown(_own),
always_static(_always_static) {
if (_type || _ptr)
types.push_back(std::make_pair(_type, _ptr));
@@ -425,8 +430,12 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
~octave_swig_type() {
- if (own) {
+ if (thisown) {
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ ++m_count;
+#else
++count;
+#endif
for (unsigned int j = 0; j < types.size(); ++j) {
if (!types[j].first || !types[j].first->clientdata)
continue;
@@ -464,10 +473,20 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
// Fill in dim_vector
for (int k=0;k<ndim;k++) {
const octave_value& obj = c(k);
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ try {
+ d.elem(k) = obj.int_value();
+ }
+ catch (octave::execution_exception& oee) {
+ // __dims__ should return a cell filled with integers
+ return dim_vector(1,1);
+ }
+#else
d.elem(k) = obj.int_value();
// __dims__ should return a cell filled with integers
if (error_state) return dim_vector(1,1);
+#endif
}
return d;
#if SWIG_OCTAVE_PREREQ(4,4,0)
@@ -476,8 +495,18 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
} else if (out.is_matrix_type() || out.is_numeric_type() ) {
#endif
if (out.rows()==1 || out.columns()==1) {
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ Array<int> a;
+ try {
+ a = out.int_vector_value();
+ }
+ catch (octave::execution_exception& oee) {
+ return dim_vector(1,1);
+ }
+#else
Array<int> a = out.int_vector_value();
if (error_state) return dim_vector(1,1);
+#endif
dim_vector d;
d.resize(a.numel() < 2 ? 2 : a.numel());
d(0) = d(1) = 1;
@@ -494,23 +523,35 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
octave_value as_value() {
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ ++m_count;
+#else
++count;
+#endif
return Swig::swig_value_ref(this);
}
void incref() {
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ ++m_count;
+#else
++count;
+#endif
}
void decref() {
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ if (!--m_count)
+#else
if (!--count)
+#endif
delete this;
}
- long swig_this() const {
+ size_t swig_this() const {
if (!types.size())
- return (long) this;
- return (long) types[0].second.ptr;
+ return (size_t) this;
+ return (size_t) types[0].second.ptr;
}
const char* help_text() const {
if (!types.size())
@@ -538,7 +579,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
void merge(octave_swig_type &rhs) {
- rhs.own = 0;
+ rhs.thisown = 0;
for (unsigned int j = 0; j < rhs.types.size(); ++j) {
assert(!rhs.types[j].second.destroyed);
#ifdef SWIG_DIRECTORS
@@ -561,35 +602,56 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
swig_member_const_iterator swig_members_begin() { return members.begin(); }
swig_member_const_iterator swig_members_end() { return members.end(); }
- int cast(void **vptr, swig_type_info *type, int *_own, int flags) {
+ int cast(void **vptr, swig_type_info *type, int *own, int flags) {
int res = SWIG_ERROR;
- if (_own)
- *_own = own;
- if (flags &SWIG_POINTER_DISOWN)
- own = 0;
+ int clear_pointer = 0;
+
+ if (own)
+ *own = 0;
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !thisown) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ } else {
+ if (own)
+ *own = *own | thisown;
+ if (flags & SWIG_POINTER_DISOWN) {
+ thisown = 0;
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ clear_pointer = 1;
+ }
+ }
+
if (!type && types.size()) {
- if(vptr)
+ if (vptr) {
*vptr = types[0].second.ptr;
+ if (clear_pointer)
+ types[0].second.ptr = 0;
+ }
return SWIG_OK;
}
for (unsigned int j = 0; j < types.size(); ++j)
if (type == types[j].first) {
- if(vptr)
+ if (vptr) {
*vptr = types[j].second.ptr;
+ if (clear_pointer)
+ types[j].second.ptr = 0;
+ }
return SWIG_OK;
}
for (unsigned int j = 0; j < types.size(); ++j) {
swig_cast_info *tc = SWIG_TypeCheck(types[j].first->name, type);
if (!tc)
continue;
- if(vptr) {
+ if (vptr) {
int newmemory = 0;
*vptr = SWIG_TypeCast(tc, types[j].second.ptr, &newmemory);
- if (newmemory == SWIG_CAST_NEW_MEMORY) {
- assert(_own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
- if (_own)
- *_own = *_own | SWIG_CAST_NEW_MEMORY;
- }
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ if (clear_pointer)
+ types[j].second.ptr = 0;
}
res = SWIG_OK;
break;
@@ -598,7 +660,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
bool is_owned() const {
- return own;
+ return thisown;
}
#ifdef SWIG_DIRECTORS
@@ -639,7 +701,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
return true;
}
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ virtual bool isstruct() const {
+#else
virtual bool is_map() const {
+#endif
return true;
}
@@ -787,7 +853,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
return as_value();
}
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ virtual bool isobject() const {
+#else
virtual bool is_object() const {
+#endif
return true;
}
@@ -882,7 +952,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
virtual bool load_binary (std::istream& is, bool swap,
- oct_mach_info::float_format fmt) {
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ octave::mach_info::float_format fmt) {
+#else
+ oct_mach_info::float_format fmt) {
+#endif
return true;
}
@@ -1066,7 +1140,18 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
octave_swig_type *ptr;
public:
octave_swig_ref(octave_swig_type *_ptr = 0)
- :ptr(_ptr) { }
+ :ptr(_ptr)
+ {
+ // Ensure type_id() is set correctly
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ if (s_t_id == -1) {
+ s_t_id = octave_swig_ref::static_type_id();
+#else
+ if (t_id == -1) {
+ t_id = octave_swig_ref::static_type_id();
+#endif
+ }
+ }
~octave_swig_ref()
{ if (ptr) ptr->decref(); }
@@ -1086,8 +1171,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
bool is_defined() const
{ return ptr->is_defined(); }
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ virtual bool isstruct() const
+ { return ptr->isstruct(); }
+#else
virtual bool is_map() const
{ return ptr->is_map(); }
+#endif
virtual octave_value subsref(const std::string &ops, const std::list < octave_value_list > &idx)
{ return ptr->subsref(ops, idx); }
@@ -1098,8 +1188,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
octave_value subsasgn(const std::string &ops, const std::list < octave_value_list > &idx, const octave_value &rhs)
{ return ptr->subsasgn(ops, idx, rhs); }
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ virtual bool isobject() const
+ { return ptr->isobject(); }
+#else
virtual bool is_object() const
{ return ptr->is_object(); }
+#endif
virtual bool is_string() const
{ return ptr->is_string(); }
@@ -1144,7 +1239,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
{ return ptr->save_binary(os, save_as_floats); }
virtual bool load_binary (std::istream& is, bool swap,
- oct_mach_info::float_format fmt)
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ octave::mach_info::float_format fmt)
+#else
+ oct_mach_info::float_format fmt)
+#endif
{ return ptr->load_binary(is, swap, fmt); }
#if defined (HAVE_HDF5)
@@ -1180,6 +1279,14 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
#endif
{ return ptr->print(os, pr_as_read_syntax); }
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ static void set_type_id(int type_id) { s_t_id=type_id; }
+#else
+# if SWIG_OCTAVE_PREREQ(4,4,0)
+ static void set_type_id(int type_id) { t_id=type_id; }
+# endif
+#endif
+
virtual type_conv_info numeric_conversion_function(void) const {
return octave_base_value::type_conv_info (default_numeric_conversion_function,
octave_scalar::static_type_id ());
@@ -1207,8 +1314,18 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
public:
octave_swig_packed(swig_type_info *_type = 0, const void *_buf = 0, size_t _buf_len = 0)
- : type(_type), buf((const char*)_buf, (const char*)_buf + _buf_len) {
- }
+ : type(_type), buf((const char*)_buf, (const char*)_buf + _buf_len)
+ {
+ // Ensure type_id() is set correctly
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ if (s_t_id == -1) {
+ s_t_id = octave_swig_packed::static_type_id();
+#else
+ if (t_id == -1) {
+ t_id = octave_swig_packed::static_type_id();
+#endif
+ }
+ }
bool copy(swig_type_info *outtype, void *ptr, size_t sz) const {
if (outtype && outtype != type)
@@ -1254,7 +1371,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
}
virtual bool load_binary (std::istream& is, bool swap,
- oct_mach_info::float_format fmt) {
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ octave::mach_info::float_format fmt) {
+#else
+ oct_mach_info::float_format fmt) {
+#endif
return true;
}
@@ -1282,6 +1403,14 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
# endif
#endif
+#if SWIG_OCTAVE_PREREQ(9,0,0)
+ static void set_type_id(int type_id) { s_t_id=type_id; }
+#else
+# if SWIG_OCTAVE_PREREQ(4,4,0)
+ static void set_type_id(int type_id) { t_id=type_id; }
+# endif
+#endif
+
private:
#if !SWIG_OCTAVE_PREREQ(4,0,0)
DECLARE_OCTAVE_ALLOCATOR;
@@ -1456,12 +1585,15 @@ octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig
SWIGRUNTIME octave_value SWIG_Octave_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
int own = (flags &SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
+ if (ptr) {
#ifdef SWIG_DIRECTORS
- Swig::Director *d = Swig::get_rtdir(ptr);
- if (d && Swig::swig_director_get_self(d))
- return Swig::swig_director_get_self(d)->as_value();
+ Swig::Director *d = Swig::get_rtdir(ptr);
+ if (d && Swig::swig_director_get_self(d))
+ return Swig::swig_director_get_self(d)->as_value();
#endif
- return Swig::swig_value_ref(new octave_swig_type(ptr, type, own));
+ return Swig::swig_value_ref(new octave_swig_type(ptr, type, own));
+ }
+ return octave_value(Matrix()); // null matrix
}
SWIGRUNTIME int SWIG_Octave_ConvertPtrAndOwn(octave_value ov, void **ptr, swig_type_info *type, int flags, int *own) {
@@ -1504,16 +1636,24 @@ SWIGRUNTIMEINLINE void SWIG_Octave_SetConstant(octave_swig_type *module_ns, cons
}
SWIGRUNTIMEINLINE octave_value SWIG_Octave_GetGlobalValue(std::string name) {
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ octave::interpreter *interp = octave::interpreter::the_interpreter ();
+ return interp->global_varval(name);
+#else
#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
+#endif
}
SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value& value) {
-#if SWIG_OCTAVE_PREREQ(4,4,0)
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ octave::interpreter *interp = octave::interpreter::the_interpreter ();
+ interp->global_assign(name, value);
+#elif SWIG_OCTAVE_PREREQ(4,4,0)
octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
symtab.global_assign(name, value);
#else
@@ -1523,10 +1663,24 @@ SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value
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();
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+ octave::interpreter *interp = octave::interpreter::the_interpreter ();
+ interp->assign(name, interp->global_varval(name));
+ octave::tree_evaluator& tree_eval = interp->get_evaluator();
+#if SWIG_OCTAVE_PREREQ(8,0,0)
+ std::shared_ptr<octave::stack_frame> stackFrame = tree_eval.get_current_stack_frame();
+#else
+ octave::call_stack& callStack = tree_eval.get_call_stack();
+ std::shared_ptr<octave::stack_frame> stackFrame = tree_eval.get_current_stack_frame();
+#endif
+ octave::symbol_record sym=symscope.lookup_symbol(name);
+ stackFrame->mark_global(sym);
+#else
+ octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
symscope.assign(name, symtab.global_varval(name));
symscope.mark_global(name);
+#endif
#else
#if !SWIG_OCTAVE_PREREQ(3,2,0)
link_to_global_variable(curr_sym_tab->lookup(name, true));
diff --git a/linux-x86/share/swig/octave/octruntime.swg b/linux-x86/share/swig/octave/octruntime.swg
index f98bf4f..94e2ca4 100644
--- a/linux-x86/share/swig/octave/octruntime.swg
+++ b/linux-x86/share/swig/octave/octruntime.swg
@@ -1,111 +1,10 @@
+#ifdef SWIG_OCTAVE_EXTERNAL_OCTHEADERS
%insert(runtime) %{
-
-#include <cstdlib>
-#include <iostream>
-
-#include <octave/oct.h>
-#include <octave/version.h>
-
-// Macro for enabling features which require Octave version >= major.minor.patch
-// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '<digit>' (released) and '<digit>+' (in development) patch numbers
-#define SWIG_OCTAVE_PREREQ(major, minor, patch) \
- ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((major)<<16) + ((minor)<<8) + (patch) )
-
-// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1
-#if !defined(OCTAVE_MAJOR_VERSION)
-
-# if !defined(OCTAVE_API_VERSION_NUMBER)
-
-// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet
-// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER
-# include <octave/ov.h>
-# if defined(octave_ov_h)
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 8
-# define OCTAVE_PATCH_VERSION 0
-# else
-
-// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed
-# define ComplexLU __ignore
-# include <octave/CmplxLU.h>
-# undef ComplexLU
-# if defined(octave_Complex_LU_h)
-
-// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 1
-# define OCTAVE_PATCH_VERSION 99
-
-# else
-
-// OCTAVE_API_VERSION_NUMBER == 37
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 2
-# define OCTAVE_PATCH_VERSION 0
-
-# endif // defined(octave_Complex_LU_h)
-
-# endif // defined(octave_ov_h)
-
-// Correlation between Octave API and version numbers extracted from Octave's
-// ChangeLogs; version is the *earliest* released Octave with that API number
-# elif OCTAVE_API_VERSION_NUMBER >= 48
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 6
-# define OCTAVE_PATCH_VERSION 0
-
-# elif OCTAVE_API_VERSION_NUMBER >= 45
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 4
-# define OCTAVE_PATCH_VERSION 1
-
-# elif OCTAVE_API_VERSION_NUMBER >= 42
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 3
-# define OCTAVE_PATCH_VERSION 54
-
-# elif OCTAVE_API_VERSION_NUMBER >= 41
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 3
-# define OCTAVE_PATCH_VERSION 53
-
-# elif OCTAVE_API_VERSION_NUMBER >= 40
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 3
-# define OCTAVE_PATCH_VERSION 52
-
-# elif OCTAVE_API_VERSION_NUMBER >= 39
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 3
-# define OCTAVE_PATCH_VERSION 51
-
-# else // OCTAVE_API_VERSION_NUMBER == 38
-# define OCTAVE_MAJOR_VERSION 3
-# define OCTAVE_MINOR_VERSION 3
-# define OCTAVE_PATCH_VERSION 50
-
-# endif // !defined(OCTAVE_API_VERSION_NUMBER)
-
-#endif // !defined(OCTAVE_MAJOR_VERSION)
-
-#include <octave/Cell.h>
-#include <octave/dynamic-ld.h>
-#include <octave/oct-env.h>
-#include <octave/oct-map.h>
-#include <octave/ov-scalar.h>
-#include <octave/ov-fcn-handle.h>
-#include <octave/parse.h>
-#if SWIG_OCTAVE_PREREQ(4,2,0)
-#include <octave/interpreter.h>
+#include "octheaders.hpp"
+%}
#else
-#include <octave/toplev.h>
+%insert(runtime) "octheaders.hpp";
#endif
-#include <octave/unwind-prot.h>
-#if SWIG_OCTAVE_PREREQ(4,2,0)
-#include <octave/call-stack.h>
-#endif
-
-%}
%insert(runtime) "swigrun.swg";
%insert(runtime) "swigerrors.swg";
@@ -120,7 +19,8 @@ static bool SWIG_init_user(octave_swig_type* module_ns);
SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
bool retn = false;
{
-#if SWIG_OCTAVE_PREREQ(4,2,0)
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+#elif SWIG_OCTAVE_PREREQ(4,2,0)
octave::unwind_protect frame;
frame.protect_var(discard_error_messages); discard_error_messages = true;
frame.protect_var(discard_warning_messages); discard_warning_messages = true;
@@ -163,7 +63,8 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) {
bool retn = false;
{
-#if SWIG_OCTAVE_PREREQ(4,2,0)
+#if SWIG_OCTAVE_PREREQ(6,0,0)
+#elif SWIG_OCTAVE_PREREQ(4,2,0)
octave::unwind_protect frame;
frame.protect_var(discard_error_messages); discard_error_messages = true;
frame.protect_var(discard_warning_messages); discard_warning_messages = true;
@@ -315,13 +216,29 @@ DEFUN_DLD( swig_octave_prereq, args, nargout, swig_octave_prereq_usage ) {
return octave_value(prereq);
}
+static const char *const swig_exit_usage = "-*- texinfo -*- \n\
+@deftypefn {Loadable Function} {} swig_exit([@var{exit_status}])\n\
+Exit Octave without performing any memory cleanup.\n\
+@end deftypefn";
+
+DEFUN_DLD( swig_exit, args, nargout, swig_exit_usage ) {
+ if (args.length() > 1) {
+ error("swig_exit: must be called with at most one arguments");
+ return octave_value_list();
+ }
+ int exit_status = 0;
+ if (args.length() == 1) {
+ exit_status = args(0).int_value();
+ }
+ ::_Exit(exit_status);
+ return octave_value();
+}
+
static const char *const SWIG_name_usage = "-*- texinfo -*- \n\
@deftypefn {Loadable Module} {} " SWIG_name_d "\n\
Loads the SWIG-generated module `" SWIG_name_d "'.\n\
@end deftypefn";
-void __swig_atexit__(void) { ::_Exit(0); }
-
DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
static octave_swig_type* module_ns = 0;
@@ -329,15 +246,16 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
// workaround to prevent octave seg-faulting on exit: set Octave exit function
// octave_exit to _Exit, which exits immediately without trying to cleanup memory.
// definitely affected version 3.2.*, not sure about 3.3.*, seems to be fixed in
- // version 3.4.*, but reappeared in 4.2.*, so turn on for all versions after 3.2.*.
+ // version 3.4.*, reappeared in 4.2.*, hack not possible in 4.4.* or later due to
+ // removal of octave_exit, so turn on for all versions between 3.2.*. and 4.4.*.
// can be turned off with macro definition.
#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK
-#if SWIG_OCTAVE_PREREQ(4,4,0)
- atexit(__swig_atexit__);
-#elif SWIG_OCTAVE_PREREQ(3,2,0)
+#if !SWIG_OCTAVE_PREREQ(4,4,0)
+#if SWIG_OCTAVE_PREREQ(3,2,0)
octave_exit = ::_Exit;
#endif
#endif
+#endif
// check for no input and output args
if (args.length() != 0 || nargout != 0) {
@@ -376,16 +294,14 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
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;
+ octave_swig_ref::set_type_id(i);
}
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;
+ octave_swig_packed::set_type_id(i);
}
}
if (register_octave_swig_ref) {
@@ -394,9 +310,6 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
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();
@@ -405,7 +318,14 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
SWIG_InitializeModule(0);
SWIG_PropagateClientData();
-#if SWIG_OCTAVE_PREREQ(4,4,0)
+#if SWIG_OCTAVE_PREREQ(8,0,0)
+ octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator();
+ octave_function *me = tree_eval.current_function();
+#elif SWIG_OCTAVE_PREREQ(6,0,0)
+ octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator();
+ octave::call_stack& stack = tree_eval.get_call_stack();
+ octave_function *me = stack.current_function();
+#elif SWIG_OCTAVE_PREREQ(4,4,0)
octave::call_stack& stack = octave::interpreter::the_interpreter()->get_call_stack();
octave_function *me = stack.current();
#else
@@ -427,6 +347,9 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
if (!SWIG_Octave_InstallFunction(me, "swig_octave_prereq")) {
return octave_value_list();
}
+ if (!SWIG_Octave_InstallFunction(me, "swig_exit")) {
+ return octave_value_list();
+ }
octave_swig_type* cvar_ns=0;
if (std::string(SWIG_global_name) != ".") {
diff --git a/linux-x86/share/swig/octave/octtypemaps.swg b/linux-x86/share/swig/octave/octtypemaps.swg
index 4acf8e0..4984fdd 100644
--- a/linux-x86/share/swig/octave/octtypemaps.swg
+++ b/linux-x86/share/swig/octave/octtypemaps.swg
@@ -32,8 +32,15 @@
#define SWIG_SetConstant(name, obj) SWIG_Octave_SetConstant(module_ns,name,obj)
// raise
-#define SWIG_Octave_Raise(OBJ, TYPE, DESC) error("C++ side threw an exception of type " TYPE)
-#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type, desc)
+%runtime %{
+SWIGINTERN void SWIG_Octave_Raise(const octave_value &obj, const char *type) {
+ if (obj.is_string())
+ error("%s", obj.string_value().c_str());
+ else
+ error("C++ side threw an exception of type %s", type);
+}
+%}
+#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type)
// Include the unified typemap library
%include <typemaps/swigtypemaps.swg>
diff --git a/linux-x86/share/swig/octave/std_auto_ptr.i b/linux-x86/share/swig/octave/std_auto_ptr.i
new file mode 100644
index 0000000..3d7ae8b
--- /dev/null
+++ b/linux-x86/share/swig/octave/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/octave/std_carray.i b/linux-x86/share/swig/octave/std_carray.i
deleted file mode 100644
index e69de29..0000000
--- a/linux-x86/share/swig/octave/std_carray.i
+++ /dev/null
diff --git a/linux-x86/share/swig/octave/std_complex.i b/linux-x86/share/swig/octave/std_complex.i
index 30c1882..461e2fd 100644
--- a/linux-x86/share/swig/octave/std_complex.i
+++ b/linux-x86/share/swig/octave/std_complex.i
@@ -4,10 +4,6 @@
%include <octcomplex.swg>
-%{
-#include <complex>
-%}
-
namespace std {
%naturalvar complex;
template<typename T> class complex;
diff --git a/linux-x86/share/swig/octave/std_unique_ptr.i b/linux-x86/share/swig/octave/std_unique_ptr.i
new file mode 100644
index 0000000..f988714
--- /dev/null
+++ b/linux-x86/share/swig/octave/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/octave/swigmove.i b/linux-x86/share/swig/octave/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/octave/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/perl5/argcargv.i b/linux-x86/share/swig/perl5/argcargv.i
new file mode 100644
index 0000000..ee23813
--- /dev/null
+++ b/linux-x86/share/swig/perl5/argcargv.i
@@ -0,0 +1,30 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(in) (int ARGC, char **ARGV) {
+ int i;
+ SSize_t len;
+ AV *av = (AV *)SvRV($input);
+ if (SvTYPE(av) != SVt_PVAV) {
+ SWIG_croak("in method '$symname', Expecting reference to argv array");
+ goto fail;
+ }
+ len = av_len(av) + 1;
+ $1 = ($1_ltype) len;
+ $2 = (char **) malloc((len+1)*sizeof(char *));
+ for (i = 0; i < len; i++) {
+ SV **tv = av_fetch(av, i, 0);
+ $2[i] = SvPV_nolen(*tv);
+ }
+ $2[i] = NULL;
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ AV *av = (AV *)SvRV($input);
+ $1 = SvTYPE(av) == SVt_PVAV;
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ free((void *)$2);
+}
diff --git a/linux-x86/share/swig/perl5/carrays.i b/linux-x86/share/swig/perl5/carrays.i
index 8be67ab..c1e6db3 100644
--- a/linux-x86/share/swig/perl5/carrays.i
+++ b/linux-x86/share/swig/perl5/carrays.i
@@ -1,2 +1 @@
%include <typemaps/carrays.swg>
-
diff --git a/linux-x86/share/swig/perl5/perlhead.swg b/linux-x86/share/swig/perl5/perlhead.swg
index 5437af5..11ea50a 100644
--- a/linux-x86/share/swig/perl5/perlhead.swg
+++ b/linux-x86/share/swig/perl5/perlhead.swg
@@ -4,26 +4,27 @@
#include <stdlib.h>
extern "C" {
#endif
+
+#if __GNUC__ >= 10
+#if defined(__cplusplus)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvolatile"
+#endif
+#endif
+
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
-/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+#if __GNUC__ >= 10
+#if defined(__cplusplus)
+#pragma GCC diagnostic pop
+#endif
+#endif
-/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
-#ifndef PERL_REVISION
-# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
-# define PERL_PATCHLEVEL_H_IMPLICIT
-# include <patchlevel.h>
-# endif
-# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
-# include <could_not_find_Perl_patchlevel.h>
-# endif
-# ifndef PERL_REVISION
-# define PERL_REVISION (5)
-# define PERL_VERSION PATCHLEVEL
-# define PERL_SUBVERSION SUBVERSION
-# endif
+/* PERL_REVISION was added in Perl 5.6. */
+#if !defined PERL_REVISION || (PERL_REVISION-0 == 5 && PERL_VERSION-0 < 8)
+# error SWIG requires Perl >= 5.8.0
#endif
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
@@ -38,15 +39,6 @@ extern "C" {
# define SvUOK(sv) SvIOK_UV(sv)
#endif
-#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
-# define PL_sv_undef sv_undef
-# define PL_na na
-# define PL_errgv errgv
-# define PL_sv_no sv_no
-# define PL_sv_yes sv_yes
-# define PL_markstack_ptr markstack_ptr
-#endif
-
#ifndef IVSIZE
# ifdef LONGSIZE
# define IVSIZE LONGSIZE
diff --git a/linux-x86/share/swig/perl5/perlinit.swg b/linux-x86/share/swig/perl5/perlinit.swg
index b49040d..c26b93f 100644
--- a/linux-x86/share/swig/perl5/perlinit.swg
+++ b/linux-x86/share/swig/perl5/perlinit.swg
@@ -4,15 +4,11 @@
#ifdef __cplusplus
extern "C"
#endif
-#ifndef PERL_OBJECT
#ifndef MULTIPLICITY
SWIGEXPORT void SWIG_init (CV* cv);
#else
SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
#endif
-#else
-SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
-#endif
%}
/* Module initialization function */
diff --git a/linux-x86/share/swig/perl5/perlmain.i b/linux-x86/share/swig/perl5/perlmain.i
index 18ecb7e..14f1cf2 100644
--- a/linux-x86/share/swig/perl5/perlmain.i
+++ b/linux-x86/share/swig/perl5/perlmain.i
@@ -4,25 +4,20 @@
* Code to statically rebuild perl5.
* ----------------------------------------------------------------------------- */
-#ifdef AUTODOC
-%subsection "perlmain.i"
-%text %{
-This module provides support for building a new version of the
-Perl executable. This will be necessary on systems that do
-not support shared libraries and may be necessary with C++
-extensions.
-
-This module may only build a stripped down version of the
-Perl executable. Thus, it may be necessary (or desirable)
-to hand-edit this file for your particular application. To
-do this, simply copy this file from swig_lib/perl5/perlmain.i
-to your working directory and make the appropriate modifications.
-
-This library file works with Perl 5.003. It may work with earlier
-versions, but it hasn't been tested. As far as I know, this
-library is C++ safe.
-%}
-#endif
+// This module provides support for building a new version of the
+// Perl executable. This will be necessary on systems that do
+// not support shared libraries and may be necessary with C++
+// extensions.
+//
+// This module may only build a stripped down version of the
+// Perl executable. Thus, it may be necessary (or desirable)
+// to hand-edit this file for your particular application. To
+// do this, simply copy this file from swig_lib/perl5/perlmain.i
+// to your working directory and make the appropriate modifications.
+//
+// This library file works with Perl 5.003. It may work with earlier
+// versions, but it hasn't been tested. As far as I know, this
+// library is C++ safe.
%{
diff --git a/linux-x86/share/swig/perl5/perlprimtypes.swg b/linux-x86/share/swig/perl5/perlprimtypes.swg
index 4cb6756..57f390a 100644
--- a/linux-x86/share/swig/perl5/perlprimtypes.swg
+++ b/linux-x86/share/swig/perl5/perlprimtypes.swg
@@ -179,7 +179,7 @@ SWIG_From_dec(long long)(long long value)
else {
//sv = newSVpvf("%lld", value); doesn't work in non 64bit Perl
char temp[256];
- sprintf(temp, "%lld", value);
+ SWIG_snprintf(temp, sizeof(temp), "%lld", value);
sv = newSVpv(temp, 0);
}
return sv_2mortal(sv);
@@ -259,7 +259,7 @@ SWIG_From_dec(unsigned long long)(unsigned long long value)
else {
//sv = newSVpvf("%llu", value); doesn't work in non 64bit Perl
char temp[256];
- sprintf(temp, "%llu", value);
+ SWIG_snprintf(temp, sizeof(temp), "%llu", value);
sv = newSVpv(temp, 0);
}
return sv_2mortal(sv);
@@ -280,7 +280,7 @@ SWIG_AsVal_dec(unsigned long long)(SV *obj, unsigned long long *val)
* (UVSIZE <= sizeof(*val) || v <= ULLONG_MAX) */
if (val) *val = SvUV(obj);
return SWIG_OK;
- } else if (SvIOK(obj)) {
+ } else if (SvIOK(obj)) {
IV v = SvIV(obj);
if (v >= 0 && (IVSIZE <= sizeof(*val) || v <= ULLONG_MAX)) {
if (val) *val = v;
diff --git a/linux-x86/share/swig/perl5/perlrun.swg b/linux-x86/share/swig/perl5/perlrun.swg
index b04002f..dfb2c8e 100644
--- a/linux-x86/share/swig/perl5/perlrun.swg
+++ b/linux-x86/share/swig/perl5/perlrun.swg
@@ -6,13 +6,8 @@
* type checking.
* ----------------------------------------------------------------------------- */
-#ifdef PERL_OBJECT
-#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
-#define SWIG_PERL_OBJECT_CALL pPerl,
-#else
#define SWIG_PERL_OBJECT_DECL
#define SWIG_PERL_OBJECT_CALL
-#endif
/* Common SWIG API */
@@ -88,32 +83,12 @@ extern "C" {
#endif
/* Macro to call an XS function */
-#ifdef PERL_OBJECT
-# define SWIG_CALLXS(_name) _name(cv,pPerl)
-#else
-# ifndef MULTIPLICITY
-# define SWIG_CALLXS(_name) _name(cv)
-# else
-# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
-# endif
-#endif
-
-#ifdef PERL_OBJECT
-#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
-#ifdef __cplusplus
-}
+#ifndef MULTIPLICITY
+# define SWIG_CALLXS(_name) _name(cv)
+#else
+# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
#endif
-#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
-#define SWIGCLASS_STATIC
-
-#else /* PERL_OBJECT */
-
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static SWIGUNUSED
@@ -141,24 +116,14 @@ typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
#endif
#endif /* MULTIPLICITY */
-#endif /* PERL_OBJECT */
-# ifdef PERL_OBJECT
-# define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
-static void SWIGUNUSED SWIG_Perl_croak_null(CPerlObj *pPerl)
-# else
static void SWIGUNUSED SWIG_croak_null()
-# endif
{
SV *err = get_sv("@", GV_ADD);
-# if (PERL_VERSION < 6)
- croak("%_", err);
-# else
if (sv_isobject(err))
croak(0);
else
croak("%s", SvPV_nolen(err));
-# endif
}
@@ -233,7 +198,7 @@ SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
/* Acquire a pointer value */
SWIGRUNTIME int
-SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, int own) {
+SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *SWIGUNUSEDPARM(sv), int SWIGUNUSEDPARM(own)) {
/* TODO */
return 0;
}
@@ -245,6 +210,7 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_
swig_cast_info *tc;
void *voidptr = (void *)0;
SV *tsv = 0;
+ int check_owned_pointer_release = (flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE;
if (own)
*own = 0;
@@ -321,13 +287,14 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_
/*
* DISOWN implementation: we need a perl guru to check this one.
*/
- if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+ if (tsv && ((flags & SWIG_POINTER_DISOWN) || check_owned_pointer_release)) {
/*
* almost copy paste code from below SWIG_POINTER_OWN setting
*/
SV *obj = sv;
HV *stash = SvSTASH(SvRV(obj));
GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+ int owned = 0;
if (isGV(gv)) {
HV *hv = GvHVn(gv);
/*
@@ -335,10 +302,21 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_
* Hence, to remove ownership, we delete the entry.
*/
if (hv_exists_ent(hv, obj, 0)) {
- hv_delete_ent(hv, obj, 0, 0);
+ owned = 1;
+ if (flags & SWIG_POINTER_DISOWN) {
+ hv_delete_ent(hv, obj, 0, 0);
+ }
}
}
+ if (check_owned_pointer_release && !owned) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ }
}
+
+ if (tsv && (flags & SWIG_POINTER_CLEAR)) {
+ SvIV_set(tsv, 0);
+ }
+
return SWIG_OK;
}
@@ -462,24 +440,19 @@ typedef struct {
} swig_variable_info;
/* Magic variable code */
-#ifndef PERL_OBJECT
-# ifdef __cplusplus
+#ifdef __cplusplus
# define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
-# else
+#else
# define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
-# endif
-# ifndef MULTIPLICITY
-SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *))
-# else
-SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *))
-# endif
+#endif
+#ifndef MULTIPLICITY
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *))
#else
-# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *))
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *))
#endif
{
MAGIC *mg;
- sv_magic(sv,sv,'U',name,strlen(name));
+ sv_magic(sv,sv,'U',name,(I32)strlen(name));
mg = mg_find(sv,'U');
mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
mg->mg_virtual->svt_get = (SwigMagicFunc) get;
diff --git a/linux-x86/share/swig/perl5/perlstrings.swg b/linux-x86/share/swig/perl5/perlstrings.swg
index 242a9c9..d21b75a 100644
--- a/linux-x86/share/swig/perl5/perlstrings.swg
+++ b/linux-x86/share/swig/perl5/perlstrings.swg
@@ -15,7 +15,7 @@ SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
STRLEN len = 0;
char *cstr = SvPV(obj, len);
size_t size = len + 1;
- if (cptr) {
+ if (cptr) {
if (alloc) {
if (*alloc == SWIG_NEWOBJ) {
*cptr = %new_copy_array(cstr, size, char);
diff --git a/linux-x86/share/swig/perl5/perltypemaps.swg b/linux-x86/share/swig/perl5/perltypemaps.swg
index bf1596e..42f8887 100644
--- a/linux-x86/share/swig/perl5/perltypemaps.swg
+++ b/linux-x86/share/swig/perl5/perltypemaps.swg
@@ -56,7 +56,9 @@
%define %set_output(obj) $result = obj; argvi++ %enddef
/* append output */
-%define %append_output(obj) if (argvi >= items) EXTEND(sp, argvi+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
@@ -95,7 +97,7 @@
"sv_setiv(SvRV($result), PTR2IV(&$1));";
%typemap(varout,type="$1_descriptor") SWIGTYPE (CLASS::*) {
- SWIG_MakePackedObj($result, (void *) &$1, sizeof($1_type), $1_descriptor);
+ SWIG_MakePackedObj($result, (void *) &$1, sizeof($1), $1_descriptor);
}
%typemap(varout) SWIGTYPE *const = SWIGTYPE *;
diff --git a/linux-x86/share/swig/perl5/std_auto_ptr.i b/linux-x86/share/swig/perl5/std_auto_ptr.i
new file mode 100644
index 0000000..3d7ae8b
--- /dev/null
+++ b/linux-x86/share/swig/perl5/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/perl5/std_list.i b/linux-x86/share/swig/perl5/std_list.i
index 36678ad..76f789b 100644
--- a/linux-x86/share/swig/perl5/std_list.i
+++ b/linux-x86/share/swig/perl5/std_list.i
@@ -55,7 +55,7 @@ namespace std {
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
T* obj;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
@@ -86,7 +86,7 @@ namespace std {
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
T* obj;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
@@ -134,7 +134,7 @@ namespace std {
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
@@ -167,7 +167,7 @@ namespace std {
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
@@ -221,7 +221,7 @@ namespace std {
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
if (CHECK_T(*tv)) {
@@ -250,7 +250,7 @@ namespace std {
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
T* obj;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
@@ -295,7 +295,7 @@ namespace std {
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
@@ -326,7 +326,7 @@ namespace std {
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
diff --git a/linux-x86/share/swig/perl5/std_map.i b/linux-x86/share/swig/perl5/std_map.i
index 1b37318..7d8103c 100644
--- a/linux-x86/share/swig/perl5/std_map.i
+++ b/linux-x86/share/swig/perl5/std_map.i
@@ -48,7 +48,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -64,17 +68,4 @@ namespace std {
}
};
-// 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/linux-x86/share/swig/perl5/std_string_view.i b/linux-x86/share/swig/perl5/std_string_view.i
new file mode 100644
index 0000000..b1afffc
--- /dev/null
+++ b/linux-x86/share/swig/perl5/std_string_view.i
@@ -0,0 +1,2 @@
+%include <perlstrings.swg>
+%include <typemaps/std_string_view.swg>
diff --git a/linux-x86/share/swig/perl5/std_unique_ptr.i b/linux-x86/share/swig/perl5/std_unique_ptr.i
new file mode 100644
index 0000000..f988714
--- /dev/null
+++ b/linux-x86/share/swig/perl5/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/perl5/std_vector.i b/linux-x86/share/swig/perl5/std_vector.i
index 5bfd2c5..06bc6f3 100644
--- a/linux-x86/share/swig/perl5/std_vector.i
+++ b/linux-x86/share/swig/perl5/std_vector.i
@@ -51,7 +51,7 @@ namespace std {
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
T* obj;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
@@ -82,7 +82,7 @@ namespace std {
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
T* obj;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
@@ -127,7 +127,7 @@ namespace std {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
@@ -159,7 +159,7 @@ namespace std {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
@@ -233,7 +233,7 @@ namespace std {
if (SvTYPE(av) != SVt_PVAV)
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
for (int i=0; i<len; i++) {
void *v;
SV **tv = av_fetch(av, i, 0);
@@ -261,7 +261,7 @@ namespace std {
if (SvTYPE(av) != SVt_PVAV)
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
for (int i=0; i<len; i++) {
void *v;
SV **tv = av_fetch(av, i, 0);
@@ -305,7 +305,7 @@ namespace std {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
@@ -336,7 +336,7 @@ namespace std {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
@@ -414,7 +414,7 @@ namespace std {
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
if (CHECK_T(*tv)) {
@@ -443,7 +443,7 @@ namespace std {
SWIG_croak("Type error in argument $argnum of $symname. "
"Expected an array of " #T);
SV **tv;
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
if (CHECK_T(*tv)) {
@@ -484,7 +484,7 @@ namespace std {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
@@ -514,7 +514,7 @@ namespace std {
/* native sequence? */
AV *av = (AV *)SvRV($input);
if (SvTYPE(av) == SVt_PVAV) {
- I32 len = av_len(av) + 1;
+ SSize_t len = av_len(av) + 1;
if (len == 0) {
/* an empty sequence can be of any type */
$1 = 1;
diff --git a/linux-x86/share/swig/perl5/swigmove.i b/linux-x86/share/swig/perl5/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/perl5/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/perl5/typemaps.i b/linux-x86/share/swig/perl5/typemaps.i
index 3e1f60d..078f24c 100644
--- a/linux-x86/share/swig/perl5/typemaps.i
+++ b/linux-x86/share/swig/perl5/typemaps.i
@@ -206,7 +206,7 @@ output values.
if (argvi >= items) {
EXTEND(sp, argvi+1);
}
- sprintf(temp,"%lld", (long long)*($1));
+ SWIG_snprintf(temp, sizeof(temp),"%lld", (long long)*($1));
$result = sv_newmortal();
sv_setpv($result,temp);
argvi++;
@@ -217,7 +217,7 @@ output values.
if (argvi >= items) {
EXTEND(sp, argvi+1);
}
- sprintf(temp,"%llu", (unsigned long long)*($1));
+ SWIG_snprintf(temp, sizeof(temp),"%llu", (unsigned long long)*($1));
$result = sv_newmortal();
sv_setpv($result,temp);
argvi++;
diff --git a/linux-x86/share/swig/php/argcargv.i b/linux-x86/share/swig/php/argcargv.i
new file mode 100644
index 0000000..2a0d745
--- /dev/null
+++ b/linux-x86/share/swig/php/argcargv.i
@@ -0,0 +1,38 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(in) (int ARGC, char **ARGV) {
+ int len, i;
+ zval *val;
+ zend_array *ar;
+ if (Z_TYPE($input) != IS_ARRAY) {
+ SWIG_PHP_Error(E_ERROR, "Type error in '$symname'. Expected array");
+ goto fail;
+ }
+ ar = Z_ARR($input);
+ len = zend_array_count(ar);
+ $1 = ($1_ltype) len;
+ $2 = (char **) malloc((len+1)*sizeof(char *));
+ i = 0;
+ ZEND_HASH_FOREACH_VAL(ar, val) {
+ if (Z_TYPE(*val) != IS_STRING) {
+ SWIG_PHP_Error(E_ERROR, "Array must use strings only, in '$symname'.");
+ goto fail;
+ }
+ if (i == len) {
+ SWIG_PHP_Error(E_ERROR, "Array is bigger than zend report in '$symname'.");
+ goto fail;
+ }
+ $2[i++] = Z_STRVAL(*val);
+ } ZEND_HASH_FOREACH_END();
+ $2[i] = NULL;
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ $1 = Z_TYPE($input) == IS_ARRAY;
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ free((void *)$2);
+}
diff --git a/linux-x86/share/swig/php/const.i b/linux-x86/share/swig/php/const.i
index 32b4b9b..1e1fe9c 100644
--- a/linux-x86/share/swig/php/const.i
+++ b/linux-x86/share/swig/php/const.i
@@ -3,6 +3,58 @@
*
* Typemaps for constants
* ----------------------------------------------------------------------------- */
+%typemap(classconsttab) int,
+ unsigned int,
+ short,
+ unsigned short,
+ long,
+ unsigned long,
+ unsigned char,
+ signed char,
+ enum SWIGTYPE %{
+ zend_declare_class_constant_long(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)($value));
+%}
+
+%typemap(classconsttab) bool %{
+ zend_declare_class_constant_bool(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)($value));
+%}
+
+%typemap(classconsttab) float,
+ double %{
+ zend_declare_class_constant_double(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, $value);
+%}
+
+%typemap(classconsttab) char %{
+{
+ char swig_char = $value;
+ zend_declare_class_constant_stringl(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, &swig_char, 1);
+}
+%}
+
+%typemap(classconsttab) char *,
+ const char *,
+ char [],
+ const char [] %{
+ zend_declare_class_constant_string(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, $value);
+%}
+
+// This creates a zend_object to wrap the pointer, and we can't do that
+// before the Zend runtime has been initialised so we delay it until
+// RINIT. The downside is it then happens for every request.
+%typemap(classconsttab,rinit=1) SWIGTYPE *,
+ SWIGTYPE &,
+ SWIGTYPE &&,
+ SWIGTYPE [] %{
+{
+ zval z;
+ ZVAL_UNDEF(&z);
+ SWIG_SetPointerZval(&z, (void*)($value), $1_descriptor, 0);
+ zval_copy_ctor(&z);
+ zend_declare_class_constant(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, &z);
+}
+%}
+
+%typemap(classconsttab) SWIGTYPE (CLASS::*) ""
%typemap(consttab) int,
unsigned int,
@@ -13,10 +65,10 @@
unsigned char,
signed char,
enum SWIGTYPE
- "SWIG_LONG_CONSTANT($symname, ($1_type)$value);";
+ "SWIG_LONG_CONSTANT($symname, ($1_type)($value));";
%typemap(consttab) bool
- "SWIG_BOOL_CONSTANT($symname, ($1_type)$value);";
+ "SWIG_BOOL_CONSTANT($symname, ($1_type)($value));";
%typemap(consttab) float,
double
@@ -31,17 +83,21 @@
const char []
"SWIG_STRING_CONSTANT($symname, $value);";
-%typemap(consttab) SWIGTYPE *,
+// This creates a zend_object to wrap the pointer, and we can't do that
+// before the Zend runtime has been initialised so we delay it until
+// RINIT. The downside is it then happens for every request.
+%typemap(consttab,rinit=1) SWIGTYPE *,
SWIGTYPE &,
SWIGTYPE &&,
SWIGTYPE [] {
zend_constant c;
- SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0);
+ ZVAL_UNDEF(&c.value);
+ SWIG_SetPointerZval(&c.value, (void*)($value), $1_descriptor, 0);
zval_copy_ctor(&c.value);
c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0);
- SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number);
+ ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number);
zend_register_constant(&c);
}
/* Handled as a global variable. */
-%typemap(consttab) SWIGTYPE (CLASS::*) "";
+%typemap(consttab) SWIGTYPE (CLASS::*) ""
diff --git a/linux-x86/share/swig/php/director.swg b/linux-x86/share/swig/php/director.swg
index ea0eba8..55ffff5 100644
--- a/linux-x86/share/swig/php/director.swg
+++ b/linux-x86/share/swig/php/director.swg
@@ -8,6 +8,8 @@
#ifndef SWIG_DIRECTOR_PHP_HEADER_
#define SWIG_DIRECTOR_PHP_HEADER_
+#define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
+
#include <string>
#include <exception>
#include <map>
@@ -76,31 +78,34 @@ namespace Swig {
};
class Director {
+ private:
+ /* flag indicating whether the object is owned by PHP or C++ */
+ mutable bool swig_disown_flag;
+
protected:
// "mutable" so we can get a non-const pointer to it in const methods.
mutable zval swig_self;
typedef std::map<void *, GCItem_var> swig_ownership_map;
mutable swig_ownership_map swig_owner;
+
public:
- Director(zval *self) {
+ Director(zval *self) : swig_disown_flag(false) {
ZVAL_COPY_VALUE(&swig_self, self);
}
- static bool swig_is_overridden_method(const char *cname, const char *lc_fname) {
- bool result = false;
- zend_string * cname_str = zend_string_init(cname, strlen(cname), 0);
- zend_class_entry *ce = zend_lookup_class(cname_str);
- if (ce) {
- zval * mptr = zend_hash_str_find(&ce->function_table, lc_fname, strlen(lc_fname));
- if (mptr) {
- // common.scope points to zend_class_entry for the declaring class,
- // and there's only one of those per class, so we can just use a
- // pointer compare here.
- result = Z_FUNC_P(mptr)->common.scope != ce;
- }
+ ~Director() {
+ if (swig_disown_flag) {
+ Z_DELREF(swig_self);
+ }
+ }
+
+ zend_object *swig_get_self() const { return Z_OBJ(swig_self); }
+
+ void swig_disown() const {
+ if (!swig_disown_flag) {
+ swig_disown_flag = true;
+ Z_ADDREF(swig_self);
}
- zend_string_release(cname_str);
- return result;
}
template <typename Type>
@@ -109,6 +114,12 @@ namespace Swig {
swig_owner[vptr] = new GCItem_T<Type>(vptr);
}
}
+
+ void swig_acquire_ownership_obj(void *vptr, int own) const {
+ if (vptr && own) {
+ swig_owner[vptr] = new GCItem_Object(own);
+ }
+ }
};
/* base class for director exceptions */
@@ -121,8 +132,8 @@ namespace Swig {
swig_msg += " ";
swig_msg += msg;
}
- SWIG_ErrorCode() = code;
- SWIG_ErrorMsg() = swig_msg.c_str();
+ // Don't replace an already active PHP exception.
+ if (!EG(exception)) zend_throw_exception(NULL, swig_msg.c_str(), code);
}
virtual ~DirectorException() throw() {
@@ -150,8 +161,7 @@ namespace Swig {
};
/* any php exception that occurs during a director method call */
- class DirectorMethodException : public DirectorException
- {
+ class DirectorMethodException : public DirectorException {
public:
DirectorMethodException()
: DirectorException(E_ERROR, "SWIG director method error", NULL) {
diff --git a/linux-x86/share/swig/php/factory.i b/linux-x86/share/swig/php/factory.i
index c4e082d..5f2b397 100644
--- a/linux-x86/share/swig/php/factory.i
+++ b/linux-x86/share/swig/php/factory.i
@@ -3,41 +3,41 @@
you have:
---- geometry.h --------
- struct Geometry {
- enum GeomType{
- POINT,
- CIRCLE
- };
-
- virtual ~Geometry() {}
+ 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; }
- };
-
+ 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;
- }
- }
+ switch (type) {
+ case POINT: return new Point();
+ case CIRCLE: return new Circle();
+ default: return 0;
+ }
+ }
---- geometry.h --------
@@ -57,16 +57,16 @@
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);
+ %factory(Foo::Geometry *Foo::Geometry::create, Foo::Point, Foo::Circle);
+
-
*/
/* for loop for macro with one argument */
@@ -90,20 +90,20 @@
/* for loop for macro with two arguments */
%define %formacro_2(macro,...)%_formacro_2(macro, __VA_ARGS__, __fordone__)%enddef
-%define %_factory_dispatch(Type)
+%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);
- }
+ SWIG_SetPointerZval(return_value, SWIG_as_voidptr(dobj), $descriptor(Type *), $owner);
+ }
}%enddef
%define %factory(Method,Types...)
-%typemap(out) Method {
+%typemap(out, phptype="?SWIGTYPE") Method {
int dcast = 0;
%formacro(%_factory_dispatch, Types)
if (!dcast) {
- SWIG_SetPointerZval(return_value, SWIG_as_voidptr($1),$descriptor, $owner);
+ SWIG_SetPointerZval(return_value, SWIG_as_voidptr($1), $descriptor, $owner);
}
}%enddef
diff --git a/linux-x86/share/swig/php/globalvar.i b/linux-x86/share/swig/php/globalvar.i
deleted file mode 100644
index 6b31207..0000000
--- a/linux-x86/share/swig/php/globalvar.i
+++ /dev/null
@@ -1,293 +0,0 @@
-/* -----------------------------------------------------------------------------
- * globalvar.i
- *
- * Global variables - add the variable to PHP
- * ----------------------------------------------------------------------------- */
-
-%typemap(varinit) char *
-{
- zval z_var;
- if ($1) {
- ZVAL_STRING(&z_var, $1);
- } else {
- ZVAL_STR(&z_var, ZSTR_EMPTY_ALLOC());
- }
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit) char []
-{
- zval z_var;
- ZVAL_STRING(&z_var, $1);
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit) int,
- unsigned int,
- unsigned short,
- short,
- unsigned short,
- long,
- unsigned long,
- signed char,
- unsigned char,
- enum SWIGTYPE
-{
- zval z_var;
- ZVAL_LONG(&z_var, (long)$1);
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit) bool
-{
- zval z_var;
- ZVAL_BOOL(&z_var, ($1)?1:0);
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit) float, double
-{
- zval z_var;
- ZVAL_DOUBLE(&z_var, (double)$1);
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit) char
-{
- zval z_var;
- char c = $1;
- ZVAL_STRINGL(&z_var, &c, 1);
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit) SWIGTYPE *, SWIGTYPE []
-{
- zval z_var;
- SWIG_SetPointerZval(&z_var, (void*)$1, $1_descriptor, 0);
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&
-{
- zval z_var;
- SWIG_SetPointerZval(&z_var, (void*)&$1, $&1_descriptor, 0);
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit) char [ANY]
-{
- zval z_var;
- /* varinit char [ANY] */
- ZVAL_STRINGL(&z_var, $1, $1_dim0);
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
-}
-
-%typemap(varinit, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
-{
- zval resource;
- void * p = emalloc(sizeof($1));
- memcpy(p, &$1, sizeof($1));
- ZVAL_RES(&resource, zend_register_resource(p, swig_member_ptr));
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &resource);
-}
-
-%typemap(varin) int, unsigned int, short, unsigned short, long, unsigned long, signed char, unsigned char, enum SWIGTYPE
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- $1 = zval_get_long(z_var);
-}
-
-%typemap(varin) bool
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- convert_to_boolean(z_var);
- $1 = (Z_TYPE_P(z_var) == IS_TRUE);
-}
-
-%typemap(varin) double,float
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- $1 = zval_get_double(z_var);
-}
-
-%typemap(varin) char
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- convert_to_string(z_var);
- if ($1 != Z_STRVAL_P(z_var)[0]) {
- $1 = Z_STRVAL_P(z_var)[0];
- }
-}
-
-%typemap(varin) char *
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- char *s1;
- convert_to_string(z_var);
- s1 = Z_STRVAL_P(z_var);
- if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
- if (s1)
- $1 = estrdup(s1);
- else
- $1 = NULL;
- }
-}
-
-
-%typemap(varin) SWIGTYPE []
-{
- if ($1) {
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, $owner);
- }
-}
-
-%typemap(varin) char [ANY]
-{
- zval **z_var;
- char *s1;
-
- zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1, (void**)&z_var);
- s1 = Z_STRVAL_P(z_var);
- if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
- if (s1)
- strncpy($1, s1, $1_dim0);
- }
-}
-
-%typemap(varin) SWIGTYPE
-{
- zval *z_var;
- $&1_ltype _temp;
-
- z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- if (SWIG_ConvertPtr(z_var, (void**)&_temp, $&1_descriptor, 0) < 0) {
- SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor");
- }
-
- $1 = *($&1_ltype)_temp;
-}
-
-%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
-{
- zval *z_var;
- $1_ltype _temp;
-
- z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- if (SWIG_ConvertPtr(z_var, (void **)&_temp, $1_descriptor, 0) < 0) {
- SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor");
- }
-
- $1 = ($1_ltype)_temp;
-}
-
-%typemap(varin, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- void * p = (void*)zend_fetch_resource_ex(z_var, SWIG_MEMBER_PTR, swig_member_ptr);
- memcpy(&$1, p, sizeof($1));
-}
-
-%typemap(varout) int,
- unsigned int,
- unsigned short,
- short,
- long,
- unsigned long,
- signed char,
- unsigned char,
- enum SWIGTYPE
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- if ($1 != ($1_ltype)Z_LVAL_P(z_var)) {
- z_var->value.lval = (long)$1;
- }
-}
-
-//SAMFIX need to cast zval->type, what if zend-hash_find fails? etc?
-%typemap(varout) bool
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- if ($1 != ($1_ltype)Z_LVAL_P(z_var)) {
- z_var->value.lval = (long)$1;
- }
-}
-
-%typemap(varout) double, float
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- if ($1 != ($1_ltype)Z_DVAL_P(z_var)) {
- z_var->value.dval = (double)$1;
- }
-}
-
-%typemap(varout) char
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- char c = $1;
- if ($1 != Z_STRVAL_P(z_val)[0]) {
- ZVAL_STRING(z_var, &c);
- }
-}
-
-%typemap(varout) char *
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- const char *s1 = Z_STRVAL_P(z_var);
- if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
- if (s1)
- efree(s1);
- if ($1) {
- (z_var)->value.str.val = estrdup($1);
- (z_var)->value.str.len = strlen($1) + 1;
- } else {
- (z_var)->value.str.val = 0;
- (z_var)->value.str.len = 0;
- }
- }
-}
-
-%typemap(varout) SWIGTYPE
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- SWIG_SetPointerZval(z_var, (void*)&$1, $&1_descriptor, 0);
-}
-
-%typemap(varout) SWIGTYPE []
-{
- if($1) {
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0);
- }
-}
-
-%typemap(varout) char [ANY]
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- const char *s1 = Z_STRVAL_P(z_var);
-deliberate error cos this code looks bogus to me
- if ((s1 == NULL) || strcmp(s1, $1)) {
- if ($1) {
- (z_var)->value.str.val = estrdup($1);
- (z_var)->value.str.len = strlen($1) + 1;
- } else {
- (z_var)->value.str.val = 0;
- (z_var)->value.str.len = 0;
- }
- }
-}
-
-%typemap(varout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
-{
- zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
- SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0);
-}
-
-%typemap(varout, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
-{
- zval resource;
- void * p = emalloc(sizeof($1));
- memcpy(p, &$1, sizeof($1));
- ZVAL_RES(&resource, zend_register_resource(p, swig_member_ptr));
- zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &resource);
-}
diff --git a/linux-x86/share/swig/php/php.swg b/linux-x86/share/swig/php/php.swg
index 4eba6be..ca8704f 100644
--- a/linux-x86/share/swig/php/php.swg
+++ b/linux-x86/share/swig/php/php.swg
@@ -4,13 +4,19 @@
* PHP configuration file
* ----------------------------------------------------------------------------- */
+%include <typemaps/fragments.swg>
+
+// Default to generating PHP type declarations (for PHP >= 8) except for
+// cases which are liable to cause compatibility issues with existing
+// bindings.
+%feature("php:type", "compat");
+
%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.
-%include <globalvar.i> // Global variables.
%include <const.i>
// use %init %{ "/*code goes here*/ " %}
@@ -35,107 +41,142 @@
%include <utils.i>
-%pass_by_val(bool,CONVERT_BOOL_IN);
+%pass_by_val(bool, "bool", CONVERT_BOOL_IN);
-%pass_by_val(size_t, CONVERT_INT_IN);
+%pass_by_val(size_t, "int", CONVERT_INT_IN);
-%pass_by_val(enum SWIGTYPE, CONVERT_INT_IN);
+%pass_by_val(enum SWIGTYPE, "int", 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 int, "int", CONVERT_INT_IN);
+%pass_by_val(int,"int", CONVERT_INT_IN);
+%pass_by_val(unsigned int,"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 short, "int", CONVERT_INT_IN);
+%pass_by_val(short,"int", CONVERT_INT_IN);
+%pass_by_val(unsigned short, "int", 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, "int", CONVERT_INT_IN);
+%pass_by_val(long, "int", CONVERT_INT_IN);
+%pass_by_val(unsigned long, "int", 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 long long, "int|string", CONVERT_LONG_LONG_IN);
+%pass_by_val(long long, "int|string", CONVERT_LONG_LONG_IN);
+%pass_by_val(unsigned long long, "int|string", 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(signed char, "int", CONVERT_INT_IN);
+%pass_by_val(char, "string", CONVERT_CHAR_IN);
+%pass_by_val(unsigned char, "int", CONVERT_INT_IN);
-%pass_by_val(float, CONVERT_FLOAT_IN);
+%pass_by_val(float, "float", CONVERT_FLOAT_IN);
-%pass_by_val(double, CONVERT_FLOAT_IN);
+%pass_by_val(double, "float", CONVERT_FLOAT_IN);
-%pass_by_val(char *, CONVERT_STRING_IN);
+%pass_by_val(char *, "string", 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]
+%typemap(in, phptype="string") char[ANY]
%{
convert_to_string(&$input);
$1 = ($1_ltype) Z_STRVAL($input);
%}
-%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) %{
+%typemap(in, phptype="string") (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) %{
convert_to_string(&$input);
$1 = ($1_ltype) Z_STRVAL($input);
$2 = ($2_ltype) Z_STRLEN($input);
%}
/* Object passed by value. Convert to a pointer */
-%typemap(in) SWIGTYPE ($&1_ltype tmp)
+%typemap(in, phptype="SWIGTYPE") 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;
+ if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
+ zend_type_error("Expected $&1_descriptor for argument $argnum of $symname");
+ return;
+ }
+ $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;
- }
+ if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
+ zend_type_error("Expected $&1_descriptor for argument $argnum of $symname");
+ SWIG_fail;
+ }
+ $result = *tmp;
%}
-%typemap(in) SWIGTYPE *,
+%typemap(in, phptype="?SWIGTYPE") 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");
- }
+ if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) {
+ zend_type_error("Expected $1_descriptor for argument $argnum of $symname");
+ return;
+ }
%}
-%typemap(in) SWIGTYPE &
+%typemap(directorout) SWIGTYPE * (swig_owntype own),
+ SWIGTYPE [] (swig_owntype own)
%{
- 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");
- }
+ if (SWIG_ConvertPtrAndOwn($input, (void **)&$result, $1_descriptor, SWIG_POINTER_DISOWN, &own) < 0) {
+ zend_type_error("Expected $1_descriptor for argument $argnum of $symname");
+ SWIG_fail;
+ }
+ swig_acquire_ownership_obj((void*)$result, own);
%}
-%typemap(in) SWIGTYPE &&
+%typemap(in, phptype="SWIGTYPE") 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");
- }
+ if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) {
+ zend_type_error("Expected $1_descriptor for argument $argnum of $symname");
+ return;
+ }
+%}
+%typemap(in, fragment="<memory>") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) %{
+ res = SWIG_ConvertPtr(&$input, &argp, $descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $1_descriptor of $symname");
+ return;
+ } else {
+ zend_type_error("Expected $1_descriptor for argument $argnum of $symname");
+ return;
+ }
+ }
+ if (!argp) {
+ zend_type_error("Invalid null reference for argument $argnum of $1_descriptor of $symname");
+ return;
+ }
+ $1 = ($1_ltype)argp;
+ rvrdeleter.reset($1);
+%}
+
+%typemap(directorout) SWIGTYPE & ($1_ltype tmp),
+ SWIGTYPE && ($1_ltype tmp)
+%{
+ if (SWIG_ConvertPtr($input, (void **) &tmp, $1_descriptor, 0) < 0 || tmp == NULL) {
+ zend_type_error("Expected $1_descriptor for argument $argnum of $symname");
+ SWIG_fail;
+ }
+ $result = tmp;
%}
-%typemap(in) SWIGTYPE *const& ($*ltype temp)
+%typemap(in, phptype="?SWIGTYPE") 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;
+ if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) {
+ zend_type_error("Expected $*1_descriptor for argument $argnum of $symname");
+ return;
+ }
+ $1 = ($1_ltype)&temp;
%}
-%typemap(in) SWIGTYPE *DISOWN
+%typemap(in, phptype="?SWIGTYPE") 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");
+ if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN) < 0) {
+ zend_type_error("Expected $1_descriptor for argument $argnum of $symname");
+ return;
}
%}
@@ -144,19 +185,22 @@
SWIGTYPE &,
SWIGTYPE &&;
-%typemap(in) void *
+%typemap(in, phptype="?SWIGTYPE") void *
%{
- 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");
- }
+ if (SWIG_ConvertPtr(&$input, (void **) &$1, 0, 0) < 0) {
+ /* Allow NULL from php for void* */
+ if (Z_ISNULL($input)) {
+ $1=0;
+ } else {
+ zend_type_error("Expected $1_descriptor for argument $argnum of $symname");
+ return;
+ }
+ }
%}
/* 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),
+%typemap(in, phptype="?SWIG\\_p_void", byref=1) void ** ($*1_ltype ptr, int force),
void *& ($*1_ltype ptr, int force)
{
/* If they pass NULL by reference, make it into a void*
@@ -165,7 +209,8 @@
/* So... we didn't get a ref or ptr, but we'll accept NULL by reference */
if (!(Z_ISREF($input) && Z_ISNULL_P(Z_REFVAL($input)))) {
/* wasn't a pre/ref/thing, OR anything like an int thing */
- SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname.");
+ zend_throw_exception(zend_ce_type_error, "Type error in argument $arg of $symname", 0);
+ goto fail;
}
}
force=0;
@@ -183,14 +228,15 @@
%typemap(argout) void **,
void *&
%{
- if (force$argnum) {
- SWIG_SetPointerZval(&$input, (void*) ptr$argnum, $*1_descriptor, 1);
+ if (force$argnum && Z_ISREF($input)) {
+ SWIG_SetPointerZval(Z_REFVAL($input), (void*) ptr$argnum, $*1_descriptor, 1);
}
%}
/* Typemap for output values */
-%typemap(out) int,
+%typemap(out, phptype="int")
+ int,
unsigned int,
short,
unsigned short,
@@ -198,39 +244,35 @@
unsigned long,
signed char,
unsigned char,
- bool,
size_t
%{
RETVAL_LONG($1);
%}
-%typemap(out) enum SWIGTYPE
+%typemap(out, phptype="int") enum SWIGTYPE
%{
RETVAL_LONG((long)$1);
%}
-%typemap(out) long long
+%typemap(out, phptype="int|string") long long
%{
if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) {
RETVAL_LONG((long)($1));
} else {
- char temp[256];
- sprintf(temp, "%lld", (long long)$1);
- RETVAL_STRING(temp);
+ RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)$1));
}
%}
-%typemap(out) unsigned long long
+%typemap(out, phptype="int|string") unsigned long long
%{
if ($1 <= (unsigned long long)LONG_MAX) {
RETVAL_LONG((long)($1));
} else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)$1);
- RETVAL_STRING(temp);
+ RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)$1));
}
%}
-%typemap(out) const int &,
+%typemap(out, phptype="int")
+ const int &,
const unsigned int &,
const short &,
const unsigned short &,
@@ -244,34 +286,30 @@
RETVAL_LONG(*$1);
%}
-%typemap(out) const enum SWIGTYPE &
+%typemap(out, phptype="int") const enum SWIGTYPE &
%{
RETVAL_LONG((long)*$1);
%}
-%typemap(out) const enum SWIGTYPE &&
+%typemap(out, phptype="int") const enum SWIGTYPE &&
%{
RETVAL_LONG((long)*$1);
%}
-%typemap(out) const long long &
+%typemap(out, phptype="int|string") const long long &
%{
if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) {
RETVAL_LONG((long)(*$1));
} else {
- char temp[256];
- sprintf(temp, "%lld", (long long)(*$1));
- RETVAL_STRING(temp);
+ RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)(*$1)));
}
%}
-%typemap(out) const unsigned long long &
+%typemap(out, phptype="int|string") const unsigned long long &
%{
if (*$1 <= (unsigned long long)LONG_MAX) {
RETVAL_LONG((long)(*$1));
} else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)(*$1));
- RETVAL_STRING(temp);
+ RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)(*$1)));
}
%}
@@ -303,12 +341,12 @@
}
%}
-%typemap(out) bool
+%typemap(out, phptype="bool") bool
%{
RETVAL_BOOL(($1) ? 1 : 0);
%}
-%typemap(out) const bool &
+%typemap(out, phptype="bool") const bool &
%{
RETVAL_BOOL((*$1) ? 1 : 0);
%}
@@ -318,13 +356,13 @@
ZVAL_BOOL($input, ($1) ? 1 : 0);
%}
-%typemap(out) float,
+%typemap(out, phptype="float") float,
double
%{
RETVAL_DOUBLE($1);
%}
-%typemap(out) const float &,
+%typemap(out, phptype="float") const float &,
const double &
%{
RETVAL_DOUBLE(*$1);
@@ -336,18 +374,22 @@
ZVAL_DOUBLE($input, $1);
%}
-%typemap(out) char
+%typemap(out, phptype="string") char
%{
RETVAL_STRINGL(&$1, 1);
%}
-%typemap(out) const char &
+%typemap(out, phptype="string") const char &
%{
RETVAL_STRINGL(&*$1, 1);
%}
-%typemap(out) char *,
- char []
+%typemap(out, phptype="string") char []
+%{
+ RETVAL_STRING((const char *)$1);
+%}
+
+%typemap(out, phptype="?string") char *
%{
if (!$1) {
RETVAL_NULL();
@@ -356,7 +398,7 @@
}
%}
-%typemap(out) char *&
+%typemap(out, phptype="?string") char *&
%{
if (!*$1) {
RETVAL_NULL();
@@ -365,17 +407,22 @@
}
%}
-%typemap(out) SWIGTYPE *,
+%typemap(out, phptype="?SWIGTYPE") SWIGTYPE *
+%{
+ SWIG_SetPointerZval($result, (void *)$1, $1_descriptor, $owner);
+%}
+
+%typemap(out, phptype="SWIGTYPE")
SWIGTYPE [],
SWIGTYPE &,
SWIGTYPE &&
%{
- SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
+ SWIG_SetPointerZval($result, (void *)$1, $1_descriptor, $owner);
%}
-%typemap(out) SWIGTYPE *const&
+%typemap(out, phptype="?SWIGTYPE") SWIGTYPE *const&
%{
- SWIG_SetPointerZval(return_value, (void *)*$1, $*1_descriptor, $owner);
+ SWIG_SetPointerZval($result, (void *)*$1, $*1_descriptor, $owner);
%}
%typemap(directorin) SWIGTYPE *,
@@ -383,53 +430,57 @@
SWIGTYPE &,
SWIGTYPE &&
%{
- SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2);
+ ZVAL_UNDEF($input);
+ SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, $owner);
%}
-%typemap(out, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
+%typemap(out, phptype="SWIGTYPE") SWIGTYPE (CLASS::*)
{
void * p = emalloc(sizeof($1));
memcpy(p, &$1, sizeof($1));
- RETVAL_RES(zend_register_resource(p, swig_member_ptr));
+ SWIG_SetPointerZval($result, (void *)p, $&1_descriptor, 1);
}
-%typemap(in, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
+%typemap(in, phptype="SWIGTYPE") SWIGTYPE (CLASS::*)
{
- void * p = (void*)zend_fetch_resource_ex(&$input, SWIG_MEMBER_PTR, swig_member_ptr);
+ void * p = SWIG_Z_FETCH_OBJ_P(&$input)->ptr;
memcpy(&$1, p, sizeof($1));
}
-%typemap(out) SWIGTYPE *DYNAMIC,
- SWIGTYPE &DYNAMIC
+%typemap(out, phptype="?SWIGTYPE") SWIGTYPE *DYNAMIC
{
swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1);
- SWIG_SetPointerZval(return_value, (void *)$1, ty, $owner);
+ SWIG_SetPointerZval($result, (void *)$1, ty, $owner);
}
-%typemap(out) SWIGTYPE
-#ifdef __cplusplus
+%typemap(out, phptype="SWIGTYPE") SWIGTYPE &DYNAMIC
{
- $&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1);
- SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1);
+ swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1);
+ SWIG_SetPointerZval($result, (void *)$1, ty, $owner);
}
-#else
+
+%typemap(out, phptype="SWIGTYPE") SWIGTYPE
{
- $&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type));
+#ifdef __cplusplus
+ $&1_ltype resultobj = new $1_ltype($1);
+#else
+ $&1_ltype resultobj = ($&1_ltype) malloc(sizeof($1_type));
memcpy(resultobj, &$1, sizeof($1_type));
- SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1);
-}
#endif
+ SWIG_SetPointerZval($result, (void *)resultobj, $&1_descriptor, 1);
+}
%typemap(directorin) SWIGTYPE
%{
- SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1|2);
+ ZVAL_UNDEF($input);
+ SWIG_SetPointerZval($input, (new $1_ltype(SWIG_STD_MOVE($1))), $&1_descriptor, 1);
%}
-%typemap(out) void "";
+%typemap(out, phptype="void") void ""
-%typemap(out) char [ANY]
+%typemap(out, phptype="string") char [ANY]
{
- int len = 0;
+ size_t len = 0;
while (len < $1_dim0 && $1[len]) ++len;
RETVAL_STRINGL($1, len);
}
@@ -448,24 +499,38 @@
" $1 = (Z_TYPE($input) == is1 || Z_TYPE($input) == is2);"
%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)
+%define %php_typecheck_long(_type,_prec,_min,_max)
+%typemap(typecheck,precedence=_prec) _type, const _type & %{
+ $1 = (Z_TYPE($input) == IS_LONG &&
+ (_min <= ZEND_LONG_MIN || (zend_long)_min <= Z_LVAL($input)) &&
+ (_max >= ZEND_LONG_MAX || (zend_long)_max >= Z_LVAL($input)));
+%}
+%enddef
+
+%php_typecheck_long(int,SWIG_TYPECHECK_INTEGER,INT_MIN,INT_MAX)
+%php_typecheck_long(unsigned int,SWIG_TYPECHECK_UINT32,0,UINT_MAX)
+%php_typecheck_long(short,SWIG_TYPECHECK_INT16,SHRT_MIN,SHRT_MAX)
+%php_typecheck_long(unsigned short,SWIG_TYPECHECK_UINT16,0,USHRT_MAX)
+%php_typecheck_long(long,SWIG_TYPECHECK_INT32,LONG_MIN,LONG_MAX)
+%php_typecheck_long(unsigned long,SWIG_TYPECHECK_UINT32,0,ULONG_MAX)
+%php_typecheck_long(long long,SWIG_TYPECHECK_INT64,LLONG_MIN,LLONG_MAX)
+%php_typecheck_long(unsigned long long,SWIG_TYPECHECK_UINT64,0,ULLONG_MAX)
+%php_typecheck_long(signed char,SWIG_TYPECHECK_INT8,SCHAR_MIN,SCHAR_MAX)
+%php_typecheck_long(unsigned char,SWIG_TYPECHECK_UINT8,0,UCHAR_MAX)
+%php_typecheck_long(size_t,SWIG_TYPECHECK_SIZE,0,(size_t)-1)
%php_typecheck(enum SWIGTYPE,SWIG_TYPECHECK_INTEGER,IS_LONG)
%php_typecheck2(bool,SWIG_TYPECHECK_BOOL,IS_TRUE,IS_FALSE)
-%php_typecheck(float,SWIG_TYPECHECK_FLOAT,IS_DOUBLE)
+%typemap(typecheck,precedence=SWIG_TYPECHECK_FLOAT,fragment="SWIG_Float_Overflow_Check") float, const float & %{
+ $1 = (Z_TYPE($input) == IS_DOUBLE && !SWIG_Float_Overflow_Check(Z_DVAL($input)));
+%}
+/* Don't range check here since PHP stores this as C/C++ 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 []
+%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&
+ " $1 = (Z_TYPE($input) == IS_STRING || Z_TYPE($input) == IS_NULL); "
+
+%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char []
" $1 = (Z_TYPE($input) == IS_STRING); "
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
@@ -512,18 +577,18 @@
unsigned long,
unsigned short %{
zend_throw_exception(NULL, "C++ $1_type exception thrown", $1);
- return;
+ goto fail;
%}
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{
(void)$1;
zend_throw_exception(NULL, "C++ $1_type exception thrown", 0);
- return;
+ goto fail;
%}
%typemap(throws) char * %{
zend_throw_exception(NULL, $1, 0);
- return;
+ goto fail;
%}
/* Array reference typemaps */
@@ -537,3 +602,6 @@
/* php keywords */
%include <phpkw.swg>
+
+/* PHP known interfaces */
+%include <phpinterfaces.i>
diff --git a/linux-x86/share/swig/php/phpinit.swg b/linux-x86/share/swig/php/phpinit.swg
index 1665f5d..ae72a10 100644
--- a/linux-x86/share/swig/php/phpinit.swg
+++ b/linux-x86/share/swig/php/phpinit.swg
@@ -7,19 +7,10 @@
%init %{
SWIG_php_minit {
+ zend_class_entry SWIGUNUSED internal_ce;
SWIG_InitializeModule((void*)&module_number);
-%}
-
-%fragment("swig_php_init_member_ptr2", "header") %{
-#define SWIG_MEMBER_PTR "CLASS::*"
-
-static void swig_member_ptr_dtor(zend_resource *res) {
- efree(res->ptr);
-}
-
-static int swig_member_ptr = 0;
-%}
-
-%fragment("swig_php_init_member_ptr", "init", fragment="swig_php_init_member_ptr2") %{
- swig_member_ptr = zend_register_list_destructors_ex(swig_member_ptr_dtor, NULL, SWIG_MEMBER_PTR, module_number);
+#if PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION == 0
+ /* This hack is needed to avoid segfaults. */
+ EG(class_table) = CG(class_table);
+#endif
%}
diff --git a/linux-x86/share/swig/php/phpinterfaces.i b/linux-x86/share/swig/php/phpinterfaces.i
new file mode 100644
index 0000000..e1029b6
--- /dev/null
+++ b/linux-x86/share/swig/php/phpinterfaces.i
@@ -0,0 +1,60 @@
+/* -----------------------------------------------------------------------------
+ * phpinterfaces.i
+ *
+ * Define "known" PHP interfaces.
+ *
+ * These can be added at MINIT time (which is when PHP loads the extension
+ * module).
+ *
+ * Any interface can be added via phpinterfaces, but looking up the
+ * zend_class_entry by name has to wait until RINIT time, which means it
+ * happens for every request.
+ * ----------------------------------------------------------------------------- */
+
+// Note: Abstract interfaces such as "Traversable" can't be used in
+// "implements" so are not relevant here.
+
+%insert(header) %{
+
+#define SWIG_PHP_INTERFACE_Iterator_CE zend_ce_iterator
+#define SWIG_PHP_INTERFACE_Iterator_HEADER "zend_interfaces.h"
+
+#define SWIG_PHP_INTERFACE_IteratorAggregate_CE zend_ce_aggregate
+#define SWIG_PHP_INTERFACE_IteratorAggregate_HEADER "zend_interfaces.h"
+
+#define SWIG_PHP_INTERFACE_ArrayAccess_CE zend_ce_arrayaccess
+#define SWIG_PHP_INTERFACE_ArrayAccess_HEADER "zend_interfaces.h"
+
+#define SWIG_PHP_INTERFACE_Serializable_CE zend_ce_serializable
+#define SWIG_PHP_INTERFACE_Serializable_HEADER "zend_interfaces.h"
+
+#define SWIG_PHP_INTERFACE_Countable_CE zend_ce_countable
+#define SWIG_PHP_INTERFACE_Countable_HEADER "zend_interfaces.h"
+
+#define SWIG_PHP_INTERFACE_OuterIterator_CE spl_ce_OuterIterator
+#define SWIG_PHP_INTERFACE_OuterIterator_HEADER "ext/spl/spl_iterators.h"
+
+#define SWIG_PHP_INTERFACE_RecursiveIterator_CE spl_ce_RecursiveIterator
+#define SWIG_PHP_INTERFACE_RecursiveIterator_HEADER "ext/spl/spl_iterators.h"
+
+#define SWIG_PHP_INTERFACE_SeekableIterator_CE spl_ce_SeekableIterator
+#define SWIG_PHP_INTERFACE_SeekableIterator_HEADER "ext/spl/spl_iterators.h"
+
+#define SWIG_PHP_INTERFACE_SplObserver_CE spl_ce_SplObserver
+#define SWIG_PHP_INTERFACE_SplObserver_HEADER "ext/spl/spl_observer.h"
+
+#define SWIG_PHP_INTERFACE_SplSubject_CE spl_ce_SplSubject
+#define SWIG_PHP_INTERFACE_SplSubject_HEADER "ext/spl/spl_observer.h"
+
+#define SWIG_PHP_INTERFACE_DateTimeInterface_CE php_date_get_interface_ce()
+#define SWIG_PHP_INTERFACE_DateTimeInterface_HEADER "ext/date/php_date.h"
+
+// The "json" extension needs to be loaded earlier that us for this to work.
+#define SWIG_PHP_INTERFACE_JsonSerializable_CE php_json_serializable_ce
+#define SWIG_PHP_INTERFACE_JsonSerializable_HEADER "ext/json/php_json.h"
+
+// New in PHP 8.0.
+#define SWIG_PHP_INTERFACE_Stringable_CE zend_ce_stringable
+#define SWIG_PHP_INTERFACE_Stringable_HEADER "zend_interfaces.h"
+
+%}
diff --git a/linux-x86/share/swig/php/phpkw.swg b/linux-x86/share/swig/php/phpkw.swg
index 5c5296a..443ac8b 100644
--- a/linux-x86/share/swig/php/phpkw.swg
+++ b/linux-x86/share/swig/php/phpkw.swg
@@ -3,10 +3,13 @@
* ----------------------------------------------------------------------------- */
/* Keyword (case insensitive) */
-#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x`
+#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword",sourcefmt="%(lower)s",rename="c_%s") `x`
+
+/* Keyword, except ok as a function */
+#define PHPKW_ok_as_function(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",%$not %$isfunction,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`
+#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name",%$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`
@@ -22,7 +25,7 @@
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`
+#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function",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,
@@ -55,6 +58,7 @@ PHPKW(endwhile);
PHPKW(extends);
PHPKW(final);
PHPKW(finally);
+PHPKW(fn); // as of PHP 7.4
PHPKW(for);
PHPKW(foreach);
PHPKW(function);
@@ -65,6 +69,7 @@ PHPKW(implements);
PHPKW(instanceof);
PHPKW(insteadof);
PHPKW(interface);
+PHPKW(match); // as of PHP 8.0
PHPKW(namespace);
PHPKW(new);
PHPKW(or);
@@ -82,6 +87,11 @@ PHPKW(while);
PHPKW(xor);
PHPKW(yield);
+/* PHP 8.1 made `readonly` a keyword, but (unlike any other keyword it seems)
+ * it may still be used as a function name.
+ */
+PHPKW_ok_as_function(readonly);
+
// Compile-time "magic" constants
// From: http://php.net/manual/en/reserved.keywords.php
// also at: http://php.net/manual/en/language.constants.predefined.php
@@ -119,6 +129,10 @@ PHPBN2(PHP_SAPI);
PHPBN2(PHP_EOL);
PHPBN2(PHP_INT_MAX);
PHPBN2(PHP_INT_SIZE);
+PHPBN2(PHP_FLOAT_DIG); // Since 7.2.0
+PHPBN2(PHP_FLOAT_EPSILON); // Since 7.2.0
+PHPBN2(PHP_FLOAT_MIN); // Since 7.2.0
+PHPBN2(PHP_FLOAT_MAX); // Since 7.2.0
PHPBN2(DEFAULT_INCLUDE_PATH);
PHPBN2(PEAR_INSTALL_DIR);
PHPBN2(PEAR_EXTENSION_DIR);
@@ -134,6 +148,7 @@ PHPBN2(PHP_LOCALSTATEDIR);
PHPBN2(PHP_CONFIG_FILE_PATH);
PHPBN2(PHP_CONFIG_FILE_SCAN_DIR);
PHPBN2(PHP_SHLIB_SUFFIX);
+PHPBN2(PHP_FD_SETSIZE); // Since 7.1.0
PHPBN2(E_ERROR);
PHPBN2(E_WARNING);
PHPBN2(E_PARSE);
@@ -145,6 +160,7 @@ PHPBN2(E_COMPILE_WARNING);
PHPBN2(E_USER_ERROR);
PHPBN2(E_USER_WARNING);
PHPBN2(E_USER_NOTICE);
+PHPBN2(E_RECOVERABLE_ERROR);
PHPBN2(E_DEPRECATED);
PHPBN2(E_USER_DEPRECATED);
PHPBN2(E_ALL);
@@ -156,6 +172,9 @@ PHPBN2(__COMPILER_HALT_OFFSET__);
PHPBN2(PHP_OUTPUT_HANDLER_START);
PHPBN2(PHP_OUTPUT_HANDLER_CONT);
PHPBN2(PHP_OUTPUT_HANDLER_END);
+/* Since 7.4.0 (Microsoft Windows only) */
+PHPBN2(PHP_WINDOWS_EVENT_CTRL_C);
+PHPBN2(PHP_WINDOWS_EVENT_CTRL_BREAK);
/* These don't actually seem to be set (tested on Linux, I guess they're
* Windows only?) */
PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER);
@@ -402,21 +421,6 @@ 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);
-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);
@@ -627,27 +631,26 @@ PHPBN2(PGSQL_POLLING_OK);
PHPBN2(PGSQL_POLLING_READING);
PHPBN2(PGSQL_POLLING_WRITING);
-/* Class names reserved by PHP (case insensitive) */
+/* Class names reserved by PHP. */
+/* Check is case insensitive - these *MUST* be listed in lower case here. */
PHPCN(directory);
PHPCN(stdclass);
PHPCN(__php_incomplete_class);
-/* Added in PHP5. */
PHPCN(exception);
PHPCN(errorexception);
PHPCN(php_user_filter);
PHPCN(closure);
PHPCN(generator);
PHPCN(self);
-PHPCN(static);
PHPCN(parent);
/* http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.classes */
PHPCN(bool); // As of PHP 7.0
PHPCN(int); // As of PHP 7.0
PHPCN(float); // As of PHP 7.0
PHPCN(string); // As of PHP 7.0
-PHPCN(NULL); // As of PHP 7.0
-PHPCN(TRUE); // As of PHP 7.0
-PHPCN(FALSE); // As of PHP 7.0
+PHPCN(null); // As of PHP 7.0
+PHPCN(true); // As of PHP 7.0
+PHPCN(false); // As of PHP 7.0
PHPCN(resource); // As of PHP 7.0 (currently works but reserved)
PHPCN(object); // As of PHP 7.0 (currently works but reserved)
PHPCN(mixed); // As of PHP 7.0 (currently works but reserved)
@@ -655,6 +658,14 @@ PHPCN(numeric); // As of PHP 7.0 (currently works but reserved)
/* http://php.net/manual/en/migration71.incompatible.php#migration71.incompatible.invalid-class-names */
PHPCN(iterable); // As of PHP 7.1
PHPCN(void); // As of PHP 7.1
+/* Predefined interfaces and classes, introduced in PHP 7.0.0 */
+PHPCN(arithmeticerror);
+PHPCN(assertionerror);
+PHPCN(divisionbyzeroerror);
+PHPCN(error);
+PHPCN(throwable);
+PHPCN(parseerror);
+PHPCN(typeerror);
/* From extensions (which of these are actually predefined depends which
* extensions are loaded by default). */
PHPCN(xmlwriter);
@@ -866,6 +877,7 @@ PHPFN(unset); // "Language construct"
PHPFN(usort);
#undef PHPKW
+#undef PHPKW_ok_as_function
#undef PHPBN1a
#undef PHPBN1b
#undef PHPBN1
diff --git a/linux-x86/share/swig/php/phppointers.i b/linux-x86/share/swig/php/phppointers.i
index d79697b..a4ff3c0 100644
--- a/linux-x86/share/swig/php/phppointers.i
+++ b/linux-x86/share/swig/php/phppointers.i
@@ -1,16 +1,12 @@
-%define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT )
-%typemap(in, byref=1) TYPE *REF ($*1_ltype tmp),
+%define %pass_by_ref( TYPE, PHP_TYPE, CONVERT_IN, CONVERT_OUT )
+%typemap(in,byref=1,phptype=PHP_TYPE) TYPE *REF ($*1_ltype tmp),
TYPE &REF ($*1_ltype tmp)
%{
- /* First Check for SWIG wrapped type */
- if (Z_ISNULL($input)) {
- $1 = 0;
- } else if (Z_ISREF($input)) {
- /* Not swig wrapped type, so we check if it's a PHP reference type */
- CONVERT_IN(tmp, $*1_ltype, $input);
- $1 = &tmp;
+ if (Z_ISREF($input)) {
+ CONVERT_IN(tmp, $*1_ltype, $input);
+ $1 = &tmp;
} else {
- SWIG_PHP_Error(E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference));
+ zend_type_error(SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference));
}
%}
%typemap(argout) TYPE *REF,
@@ -22,25 +18,25 @@
%}
%enddef
-%pass_by_ref( size_t, CONVERT_INT_IN, ZVAL_LONG );
+%pass_by_ref( size_t, "int", 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 int, "int", CONVERT_INT_IN, ZVAL_LONG );
+%pass_by_ref( int, "int", CONVERT_INT_IN, ZVAL_LONG );
+%pass_by_ref( unsigned int, "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 short, "int", CONVERT_INT_IN, ZVAL_LONG );
+%pass_by_ref( short, "int", CONVERT_INT_IN, ZVAL_LONG );
+%pass_by_ref( unsigned short, "int", 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 long, "int", CONVERT_INT_IN, ZVAL_LONG );
+%pass_by_ref( long, "int", CONVERT_INT_IN, ZVAL_LONG );
+%pass_by_ref( unsigned long, "int", 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( signed char, "int", CONVERT_INT_IN, ZVAL_LONG );
+%pass_by_ref( char, "string", CONVERT_CHAR_IN, ZVAL_STRING );
+%pass_by_ref( unsigned char, "int", 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( float, "float", CONVERT_FLOAT_IN, ZVAL_DOUBLE );
+%pass_by_ref( double, "float", CONVERT_FLOAT_IN, ZVAL_DOUBLE );
-%pass_by_ref( char *, CONVERT_CHAR_IN, ZVAL_STRING );
+%pass_by_ref( char *, "string", CONVERT_CHAR_IN, ZVAL_STRING );
diff --git a/linux-x86/share/swig/php/phprun.swg b/linux-x86/share/swig/php/phprun.swg
index a07a1b9..588701f 100644
--- a/linux-x86/share/swig/php/phprun.swg
+++ b/linux-x86/share/swig/php/phprun.swg
@@ -4,24 +4,21 @@
* PHP runtime library
* ----------------------------------------------------------------------------- */
+#define swig_owntype int
+
#ifdef __cplusplus
extern "C" {
#endif
-#include "zend.h"
-#include "zend_API.h"
-#include "zend_exceptions.h"
-#include "php.h"
-#if PHP_MAJOR_VERSION != 7
-# error These bindings need PHP7 - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
+#if PHP_MAJOR_VERSION < 8
+# error These bindings need PHP 8 or later - to generate PHP7 bindings use SWIG < 4.1.0; to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
#endif
-#include "ext/standard/php_string.h"
-#include <stdlib.h> /* for abort(), used in generated code. */
+#include "zend_inheritance.h"
+#include "zend_exceptions.h"
+#include "zend_inheritance.h"
-/* This indirection is to work around const correctness issues in older PHP.
- * FIXME: Remove for PHP7? Or might user code be using it? */
-#define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A)
+#include <stdlib.h> /* for abort(), used in generated code. */
#define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
#define SWIG_LONG_CONSTANT(N, V) REGISTER_LONG_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
@@ -32,13 +29,6 @@ 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,178 +40,125 @@ 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_PHP_Error(code,msg) do { zend_throw_exception(NULL, msg, code); SWIG_fail; } while (0)
#define SWIG_contract_assert(expr,msg) \
- if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else
+ do { if (!(expr)) zend_printf("Contract Assert Failed %s\n", msg); } while (0)
/* Standard SWIG API */
#define SWIG_GetModule(clientdata) SWIG_Php_GetModule()
#define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer, *(int*)clientdata)
+static zend_class_entry SWIG_Php_swig_wrapped_interface_ce;
+
/* used to wrap returned objects in so we know whether they are newobject
and need freeing, or not */
typedef struct {
void * ptr;
int newobject;
+ const swig_type_info * type;
+ zend_object std;
} swig_object_wrapper;
+#define SWIG_Z_FETCH_OBJ_P(zv) swig_php_fetch_object(Z_OBJ_P(zv))
+
+static inline
+swig_object_wrapper * swig_php_fetch_object(zend_object *obj) {
+ return (swig_object_wrapper *)((char *)obj - XtOffsetOf(swig_object_wrapper, std));
+}
+
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
static void
SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) {
- /*
- * First test for Null pointers. Return those as PHP native NULL
- */
- if (!ptr ) {
+ // Return PHP NULL for a C/C++ NULL pointer.
+ if (!ptr) {
ZVAL_NULL(z);
return;
}
- if (type->clientdata) {
- swig_object_wrapper *value;
- if (! (*(int *)(type->clientdata)))
- zend_error(E_ERROR, "Type: %s failed to register with zend",type->name);
- value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper));
- value->ptr=ptr;
- value->newobject=(newobject & 1);
- if ((newobject & 2) == 0) {
- /* Just register the pointer as a resource. */
- ZVAL_RES(z, zend_register_resource(value, *(int *)(type->clientdata)));
- } else {
- /*
- * Wrap the resource in an object, the resource will be accessible
- * via the "_cPtr" member. This is currently only used by
- * directorin typemaps.
- */
- zval resource;
- zend_class_entry *ce = NULL;
- const char *type_name = type->name+3; /* +3 so: _p_Foo -> Foo */
- size_t type_name_len;
- const char * p;
- HashTable * ht;
-
- /* Namespace__Foo -> Foo */
- /* FIXME: ugly and goes wrong for classes with __ in their names. */
- while ((p = strstr(type_name, "__")) != NULL) {
- type_name = p + 2;
- }
- type_name_len = strlen(type_name);
-
- ZVAL_RES(&resource, zend_register_resource(value, *(int *)(type->clientdata)));
- if (SWIG_PREFIX_LEN > 0) {
- zend_string * classname = zend_string_alloc(SWIG_PREFIX_LEN + type_name_len, 0);
- memcpy(classname->val, SWIG_PREFIX, SWIG_PREFIX_LEN);
- memcpy(classname->val + SWIG_PREFIX_LEN, type_name, type_name_len);
- ce = zend_lookup_class(classname);
- zend_string_release(classname);
- } else {
- zend_string * classname = zend_string_init(type_name, type_name_len, 0);
- ce = zend_lookup_class(classname);
- zend_string_release(classname);
- }
- if (ce == NULL) {
- /* class does not exist */
- ce = zend_standard_class_def;
- }
- ALLOC_HASHTABLE(ht);
- zend_hash_init(ht, 1, NULL, NULL, 0);
- zend_hash_str_update(ht, "_cPtr", sizeof("_cPtr") - 1, &resource);
- object_and_properties_init(z, ce, ht);
- }
+ if (!type->clientdata) {
+ zend_type_error("Type: %s not registered with zend", type->name);
return;
}
- zend_error(E_ERROR, "Type: %s not registered with zend",type->name);
-}
-
-/* This pointer conversion routine takes the native pointer p (along with
- its type name) and converts it by calling appropriate casting functions
- according to ty. The resultant pointer is returned, or NULL is returned
- if the pointer can't be cast.
-
- Sadly PHP has no API to find a type name from a type id, only from an
- instance of a resource of the type id, so we have to pass type_name as well.
-
- The two functions which might call this are:
- SWIG_ConvertResourcePtr which gets the type name from the resource
- and the registered zend destructors for which we have one per type each
- with the type name hard wired in. */
-static void *
-SWIG_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty) {
- swig_cast_info *tc;
- void *result = 0;
-
- if (!ty) {
- /* They don't care about the target type, so just pass on the pointer! */
- return p;
- }
-
- if (! type_name) {
- /* can't convert p to ptr type ty if we don't know what type p is */
- return NULL;
- }
-
- /* convert and cast p from type_name to ptr as ty. */
- tc = SWIG_TypeCheck(type_name, ty);
- if (tc) {
- int newmemory = 0;
- result = SWIG_TypeCast(tc, p, &newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- }
- return result;
-}
-/* This function returns a pointer of type ty by extracting the pointer
- and type info from the resource in z. z must be a resource.
- If it fails, NULL is returned.
- It uses SWIG_ConvertResourceData to do the real work. */
-static void *
-SWIG_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags) {
- swig_object_wrapper *value;
- void *p;
- const char *type_name;
-
- if (Z_RES_TYPE_P(z) == -1) return NULL;
- value = (swig_object_wrapper *) Z_RES_VAL_P(z);
- if (flags & SWIG_POINTER_DISOWN) {
- value->newobject = 0;
+ {
+ zend_object *obj;
+ swig_object_wrapper *value;
+ if (Z_TYPE_P(z) == IS_OBJECT) {
+ /* The PHP object is already initialised - this is the case when wrapping
+ * the return value from a PHP constructor. */
+ obj = Z_OBJ_P(z);
+ } else {
+ zend_class_entry *ce = (zend_class_entry*)(type->clientdata);
+ obj = ce->create_object(ce);
+ ZVAL_OBJ(z, obj);
+ }
+ value = swig_php_fetch_object(obj);
+ value->ptr = ptr;
+ value->newobject = (newobject & 1);
+ value->type = type;
}
- p = value->ptr;
-
- type_name=zend_rsrc_list_get_rsrc_type(Z_RES_P(z));
-
- return SWIG_ConvertResourceData(p, type_name, ty);
}
-/* We allow passing of a RESOURCE pointing to the object or an OBJECT whose
- _cPtr is a resource pointing to the object */
+/* We wrap C/C++ pointers as PHP objects. */
static int
-SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
+SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_owntype *own) {
+ if (own)
+ *own = 0;
+
if (z == NULL) {
*ptr = 0;
- return 0;
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
switch (Z_TYPE_P(z)) {
case IS_OBJECT: {
- HashTable * ht = Z_OBJ_HT_P(z)->get_properties(z);
- if (ht) {
- zval * _cPtr = zend_hash_str_find(ht, "_cPtr", sizeof("_cPtr") - 1);
- if (_cPtr) {
- if (Z_TYPE_P(_cPtr) == IS_INDIRECT) {
- _cPtr = Z_INDIRECT_P(_cPtr);
- }
- if (Z_TYPE_P(_cPtr) == IS_RESOURCE) {
- *ptr = SWIG_ConvertResourcePtr(_cPtr, ty, flags);
- return (*ptr == NULL ? -1 : 0);
- }
+ zend_object *obj = Z_OBJ_P(z);
+ swig_object_wrapper *value;
+ if (ty && ty->clientdata == (void*)obj->ce) {
+ // Object is exactly the class asked for - this handles common cases cheaply,
+ // and in particular the PHP classes we use to wrap a pointer to a non-class.
+ } else if (!zend_class_implements_interface(obj->ce, &SWIG_Php_swig_wrapped_interface_ce)) {
+ // Not an object we've wrapped.
+ return -1;
+ }
+
+ /* convert and cast value->ptr from value->type to ptr as ty. */
+ value = swig_php_fetch_object(obj);
+ if (!ty) {
+ /* They don't care about the target type, so just pass on the pointer! */
+ *ptr = value->ptr;
+ } else {
+ swig_cast_info *tc = SWIG_TypeCheck(value->type->name, ty);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, value->ptr, &newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+ if (own)
+ *own |= SWIG_CAST_NEW_MEMORY;
+ }
+ } else {
+ *ptr = NULL;
+ }
+ }
+
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !value->newobject) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ } else {
+ if (*ptr == NULL)
+ return SWIG_ERROR; /* should be SWIG_NullReferenceError?? */
+ if (flags & SWIG_POINTER_DISOWN) {
+ value->newobject = 0;
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ value->ptr = 0;
}
}
- break;
+
+ return SWIG_OK;
}
- case IS_RESOURCE:
- *ptr = SWIG_ConvertResourcePtr(z, ty, flags);
- return (*ptr == NULL ? -1 : 0);
case IS_NULL:
*ptr = 0;
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
@@ -230,17 +167,43 @@ SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
return -1;
}
+static int
+SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
+ return SWIG_ConvertPtrAndOwn(z, ptr, ty, flags, 0);
+}
+
static const char const_name[] = "swig_runtime_data_type_pointer";
-static swig_module_info *SWIG_Php_GetModule() {
+static swig_module_info *SWIG_Php_GetModule(void) {
zval *pointer = zend_get_constant_str(const_name, sizeof(const_name) - 1);
if (pointer) {
if (Z_TYPE_P(pointer) == IS_LONG) {
return (swig_module_info *) pointer->value.lval;
}
- }
+ }
return NULL;
}
static void SWIG_Php_SetModule(swig_module_info *pointer, int module_number) {
REGISTER_LONG_CONSTANT(const_name, (long) pointer, CONST_CS | CONST_PERSISTENT);
}
+
+/* Common parts of the "create_object" object handler. */
+static zend_object *SWIG_Php_do_create_object(zend_class_entry *ce, zend_object_handlers *handlers) {
+ swig_object_wrapper *obj = (swig_object_wrapper*)zend_object_alloc(sizeof(swig_object_wrapper), ce);
+ zend_object_std_init(&obj->std, ce);
+ object_properties_init(&obj->std, ce);
+ obj->std.handlers = handlers;
+ obj->newobject = 1;
+ return &obj->std;
+}
+
+/* Common parts of the "free_obj" object handler.
+ Returns void* pointer if the C/C++ object should be destroyed. */
+static void* SWIG_Php_free_obj(zend_object *object) {
+ if (object) {
+ swig_object_wrapper *obj = swig_php_fetch_object(object);
+ zend_object_std_dtor(&obj->std);
+ if (obj->newobject) return obj->ptr;
+ }
+ return NULL;
+}
diff --git a/linux-x86/share/swig/php/std_auto_ptr.i b/linux-x86/share/swig/php/std_auto_ptr.i
new file mode 100644
index 0000000..2840916
--- /dev/null
+++ b/linux-x86/share/swig/php/std_auto_ptr.i
@@ -0,0 +1,41 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $descriptor(TYPE *) of $symname");
+ return;
+ } else {
+ zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname");
+ return;
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN);
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/php/std_common.i b/linux-x86/share/swig/php/std_common.i
index 092bf01..1b69fc7 100644
--- a/linux-x86/share/swig/php/std_common.i
+++ b/linux-x86/share/swig/php/std_common.i
@@ -7,4 +7,3 @@
%include <std/std_except.i>
%apply size_t { std::size_t };
-
diff --git a/linux-x86/share/swig/php/std_map.i b/linux-x86/share/swig/php/std_map.i
index 7c01573..6904efc 100644
--- a/linux-x86/share/swig/php/std_map.i
+++ b/linux-x86/share/swig/php/std_map.i
@@ -35,7 +35,7 @@ namespace std {
map();
map(const map& other);
-
+
unsigned int size() const;
void clear();
%extend {
@@ -47,7 +47,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -66,17 +70,4 @@ namespace std {
}
};
-// 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/linux-x86/share/swig/php/std_string.i b/linux-x86/share/swig/php/std_string.i
index b55751f..5abbbbb 100644
--- a/linux-x86/share/swig/php/std_string.i
+++ b/linux-x86/share/swig/php/std_string.i
@@ -4,19 +4,21 @@
* 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>
%}
+/* std::string and const std::string& are converted to/from PHP string
+ * automatically.
+ *
+ * A C++ std::string& parameter is wrapped as a pass-by-reference PHP
+ * string parameter by default, but the INPUT/INOUT/OUTPUT typemaps
+ * below provide other options (see below).
+ *
+ * std::string* is not wrapped by default, but INPUT/INOUT/OUTPUT typemaps
+ * are provided (see below).
+ */
+
namespace std {
%naturalvar string;
@@ -27,19 +29,17 @@ namespace std {
$1 = (Z_TYPE($input) == IS_STRING) ? 1 : 0;
%}
- %typemap(in) string %{
+ %typemap(in, phptype="string") string %{
convert_to_string(&$input);
$1.assign(Z_STRVAL($input), Z_STRLEN($input));
%}
%typemap(directorout) string %{
- if (!EG(exception)) {
convert_to_string($input);
$result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input));
- }
%}
- %typemap(out) string %{
+ %typemap(out, phptype="string") string %{
ZVAL_STRINGL($result, $1.data(), $1.size());
%}
@@ -47,24 +47,31 @@ namespace std {
ZVAL_STRINGL($input, $1.data(), $1.size());
%}
- %typemap(out) const string & %{
+ %typemap(out, phptype="string") const string& %{
ZVAL_STRINGL($result, $1->data(), $1->size());
%}
%typemap(throws) string, const string& %{
zend_throw_exception(NULL, $1.c_str(), 0);
- return;
+ goto fail;
%}
- %typemap(in) const string & ($*1_ltype temp) %{
+ %typemap(throws) string*, const string* %{
+ zend_throw_exception(NULL, $1->c_str(), 0);
+ goto fail;
+ %}
+
+ %typemap(in, phptype="string") const string& ($*1_ltype temp) %{
convert_to_string(&$input);
temp.assign(Z_STRVAL($input), Z_STRLEN($input));
$1 = &temp;
%}
- /* These next two handle a function which takes a non-const reference to
- * a std::string and modifies the string. */
- %typemap(in,byref=1) string & ($*1_ltype temp) %{
+ /*************************************************************************/
+
+ /* These next four typemaps handle a function which takes a non-const
+ * reference to a std::string and modifies the string. */
+ %typemap(in,byref=1, phptype="string") string& ($*1_ltype temp) %{
{
zval * p = Z_ISREF($input) ? Z_REFVAL($input) : &$input;
convert_to_string(p);
@@ -73,16 +80,14 @@ namespace std {
}
%}
- %typemap(directorout) string & ($*1_ltype *temp) %{
- if (!EG(exception)) {
+ %typemap(directorout) string& ($*1_ltype *temp) %{
convert_to_string($input);
temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input));
swig_acquire_ownership(temp);
$result = temp;
- }
%}
- %typemap(argout) string & %{
+ %typemap(argout) string& %{
if (Z_ISREF($input)) {
ZVAL_STRINGL(Z_REFVAL($input), $1->data(), $1->size());
}
@@ -90,5 +95,27 @@ namespace std {
/* SWIG will apply the non-const typemap above to const string& without
* this more specific typemap. */
- %typemap(argout) const string & "";
+ %typemap(argout) const string& ""
+
+ /*************************************************************************/
+
+ /* Alternative ways to handle string& - you can specify how to wrap based
+ * on the parameter name, e.g. this handles parameters named `str` as
+ * INOUT:
+ *
+ * %apply (std::string& INOUT) (std::string& str);
+ */
+
+ %typemap(in) string& INPUT = const string&;
+ %typemap(in, numinputs=0) string& OUTPUT ($*1_ltype temp)
+ %{ $1 = &temp; %}
+ %typemap(argout,fragment="t_output_helper") string& OUTPUT
+ {
+ zval o;
+ ZVAL_STRINGL(&o, $1->data(), $1->size());
+ t_output_helper($result, &o);
+ }
+ %typemap(in) string& INOUT = const string&;
+ %typemap(argout) string& INOUT = string& OUTPUT;
+
}
diff --git a/linux-x86/share/swig/php/std_string_view.i b/linux-x86/share/swig/php/std_string_view.i
new file mode 100644
index 0000000..8fff6e1
--- /dev/null
+++ b/linux-x86/share/swig/php/std_string_view.i
@@ -0,0 +1,69 @@
+/* -----------------------------------------------------------------------------
+ * std_string_view.i
+ *
+ * SWIG typemaps for std::string_view types
+ * ----------------------------------------------------------------------------- */
+
+%include <exception.i>
+
+%{
+#include <string_view>
+%}
+
+namespace std {
+
+ %naturalvar string_view;
+
+ class string_view;
+
+ %typemap(typecheck,precedence=SWIG_TYPECHECK_STRINGVIEW) string_view, const string_view& %{
+ $1 = (Z_TYPE($input) == IS_STRING) ? 1 : 0;
+ %}
+
+ %typemap(in, phptype="string") string_view %{
+ convert_to_string(&$input);
+ $1 = std::string_view(Z_STRVAL($input), Z_STRLEN($input));
+ %}
+
+ %typemap(in, phptype="string") const string_view& ($*1_ltype temp) %{
+ convert_to_string(&$input);
+ temp = std::string_view(Z_STRVAL($input), Z_STRLEN($input));
+ $1 = &temp;
+ %}
+
+ %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) string_view %{
+ convert_to_string($input);
+ $result = std::string_view(Z_STRVAL_P($input), Z_STRLEN_P($input));
+ %}
+
+ %typemap(out, phptype="string") string_view %{
+ ZVAL_STRINGL($result, $1.data(), $1.size());
+ %}
+
+ %typemap(directorin) string_view, const string_view& %{
+ ZVAL_STRINGL($input, $1.data(), $1.size());
+ %}
+
+ %typemap(out, phptype="string") const string_view& %{
+ ZVAL_STRINGL($result, $1->data(), $1->size());
+ %}
+
+ %typemap(throws) string_view, const string_view& %{
+ {
+ zval swig_exception;
+ ZVAL_STRINGL(&swig_exception, $1.data(), $1.size());
+ zend_throw_exception_object(&swig_exception);
+ goto fail;
+ }
+ %}
+
+ %typemap(throws) string_view*, const string_view* %{
+ {
+ zval swig_exception;
+ ZVAL_STRINGL(&swig_exception, $1->data(), $1->size());
+ zend_throw_exception_object(&swig_exception);
+ goto fail;
+ }
+ %}
+
+}
diff --git a/linux-x86/share/swig/php/std_unique_ptr.i b/linux-x86/share/swig/php/std_unique_ptr.i
new file mode 100644
index 0000000..1bf3159
--- /dev/null
+++ b/linux-x86/share/swig/php/std_unique_ptr.i
@@ -0,0 +1,41 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $descriptor(TYPE *) of $symname");
+ return;
+ } else {
+ zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname");
+ return;
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN);
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/php/std_vector.i b/linux-x86/share/swig/php/std_vector.i
index e633bc3..382b37c 100644
--- a/linux-x86/share/swig/php/std_vector.i
+++ b/linux-x86/share/swig/php/std_vector.i
@@ -112,5 +112,3 @@ namespace std {
%define specialize_std_vector(T)
#warning "specialize_std_vector - specialization for type T no longer needed"
%enddef
-
-
diff --git a/linux-x86/share/swig/php/stl.i b/linux-x86/share/swig/php/stl.i
index 04f8601..38aba67 100644
--- a/linux-x86/share/swig/php/stl.i
+++ b/linux-x86/share/swig/php/stl.i
@@ -7,4 +7,3 @@
%include <std_vector.i>
%include <std_map.i>
%include <std_pair.i>
-
diff --git a/linux-x86/share/swig/php/swigmove.i b/linux-x86/share/swig/php/swigmove.i
new file mode 100644
index 0000000..b16a3c5
--- /dev/null
+++ b/linux-x86/share/swig/php/swigmove.i
@@ -0,0 +1,24 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.i
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr(&$input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $&1_descriptor of $symname");
+ return;
+ } else {
+ zend_type_error("Expected $&1_descriptor for argument $argnum of $symname");
+ return;
+ }
+ }
+ if (!argp) {
+ zend_type_error("Invalid null reference for argument $argnum of $&1_descriptor of $symname");
+ return;
+ }
+ SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp);
+}
diff --git a/linux-x86/share/swig/php/typemaps.i b/linux-x86/share/swig/php/typemaps.i
index c248a58..718469e 100644
--- a/linux-x86/share/swig/php/typemaps.i
+++ b/linux-x86/share/swig/php/typemaps.i
@@ -25,21 +25,21 @@
* ----------------------------------------------------------------------------- */
%define BOOL_TYPEMAP(TYPE)
-%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
+%typemap(in, phptype="bool") TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
%{
convert_to_boolean(&$input);
temp = (Z_TYPE($input) == IS_TRUE);
$1 = &temp;
%}
-%typemap(argout) TYPE *INPUT, TYPE &INPUT "";
-%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;";
+%typemap(argout) 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;
ZVAL_BOOL(&o, temp$argnum);
t_output_helper($result, &o);
}
-%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
+%typemap(in, phptype="float") TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
%{
convert_to_boolean($input);
lvalue = (Z_TYPE_P($input) == IS_TRUE);
@@ -52,20 +52,20 @@
%enddef
%define DOUBLE_TYPEMAP(TYPE)
-%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
+%typemap(in, phptype="float") TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
%{
temp = (TYPE) zval_get_double(&$input);
$1 = &temp;
%}
-%typemap(argout) TYPE *INPUT, TYPE &INPUT "";
-%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;";
+%typemap(argout) 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;
ZVAL_DOUBLE(&o, temp$argnum);
t_output_helper($result, &o);
}
-%typemap(in) TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue)
+%typemap(in, phptype="float") TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue)
%{
dvalue = (TYPE) zval_get_double(&$input);
$1 = &dvalue;
@@ -77,20 +77,20 @@
%enddef
%define INT_TYPEMAP(TYPE)
-%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
+%typemap(in, phptype="int") TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp)
%{
temp = (TYPE) zval_get_long(&$input);
$1 = &temp;
%}
-%typemap(argout) TYPE *INPUT, TYPE &INPUT "";
-%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;";
+%typemap(argout) 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;
ZVAL_LONG(&o, temp$argnum);
t_output_helper($result, &o);
}
-%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
+%typemap(in, phptype="int") TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue)
%{
lvalue = (TYPE) zval_get_long(&$input);
$1 = &lvalue;
@@ -122,13 +122,11 @@ INT_TYPEMAP(long long);
if ((long long)LONG_MIN <= temp$argnum && temp$argnum <= (long long)LONG_MAX) {
ZVAL_LONG(&o, (long)temp$argnum);
} else {
- char temp[256];
- sprintf(temp, "%lld", (long long)temp$argnum);
- ZVAL_STRING(&o, temp);
+ ZVAL_NEW_STR(&o, zend_strpprintf(0, "%lld", (long long)temp$argnum));
}
t_output_helper($result, &o);
}
-%typemap(in) TYPE *REFERENCE (long long lvalue)
+%typemap(in, phptype="int|string") TYPE *REFERENCE (long long lvalue)
%{
CONVERT_LONG_LONG_IN(lvalue, long long, $input)
$1 = &lvalue;
@@ -138,9 +136,7 @@ INT_TYPEMAP(long long);
if ((long long)LONG_MIN <= lvalue$argnum && lvalue$argnum <= (long long)LONG_MAX) {
ZVAL_LONG(&$arg, (long)temp$argnum);
} else {
- char temp[256];
- sprintf(temp, "%lld", (long long)lvalue$argnum);
- ZVAL_STRING(&$arg, temp);
+ ZVAL_NEW_STR(&$arg, zend_strpprintf(0, "%lld", (long long)lvalue$argnum));
}
%}
%typemap(argout) long long &OUTPUT
@@ -148,11 +144,10 @@ INT_TYPEMAP(long long);
if ((long long)LONG_MIN <= *arg$argnum && *arg$argnum <= (long long)LONG_MAX) {
ZVAL_LONG($result, (long)(*arg$argnum));
} else {
- char temp[256];
- sprintf(temp, "%lld", (long long)(*arg$argnum));
- ZVAL_STRING($result, temp);
+ ZVAL_NEW_STR($result, zend_strpprintf(0, "%lld", (long long)(*arg$argnum)));
}
%}
+
INT_TYPEMAP(unsigned long long);
%typemap(argout,fragment="t_output_helper") unsigned long long *OUTPUT
{
@@ -160,13 +155,11 @@ INT_TYPEMAP(unsigned long long);
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);
+ ZVAL_NEW_STR(&o, zend_strpprintf(0, "%llu", (unsigned long long)temp$argnum));
}
t_output_helper($result, &o);
}
-%typemap(in) TYPE *REFERENCE (unsigned long long lvalue)
+%typemap(in, phptype="int|string") TYPE *REFERENCE (unsigned long long lvalue)
%{
CONVERT_UNSIGNED_LONG_LONG_IN(lvalue, unsigned long long, $input)
$1 = &lvalue;
@@ -176,9 +169,7 @@ INT_TYPEMAP(unsigned long long);
if (lvalue$argnum <= (unsigned long long)LONG_MAX) {
ZVAL_LONG($arg, (long)(lvalue$argnum));
} else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)lvalue$argnum);
- ZVAL_STRING((*$arg), temp);
+ ZVAL_NEW_STR((*$arg), zend_strpprintf(0, "%llu", (unsigned long long)lvalue$argnum));
}
%}
%typemap(argout) unsigned long long &OUTPUT
@@ -186,9 +177,7 @@ INT_TYPEMAP(unsigned long long);
if (*arg$argnum <= (unsigned long long)LONG_MAX) {
ZVAL_LONG($result, (long)(*arg$argnum));
} else {
- char temp[256];
- sprintf(temp, "%llu", (unsigned long long)(*arg$argnum));
- ZVAL_STRING($result, temp);
+ ZVAL_NEW_STR($result, zend_strpprintf(0, "%llu", (unsigned long long)(*arg$argnum)));
}
%}
@@ -252,7 +241,7 @@ INT_TYPEMAP(unsigned long long);
%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] )
+%typemap(in, phptype="string") char INPUT[ANY] ( char temp[$1_dim0] )
%{
convert_to_string(&$input);
strncpy(temp, Z_STRVAL($input), $1_dim0);
@@ -267,7 +256,7 @@ INT_TYPEMAP(unsigned long long);
t_output_helper($result, &o);
}
-%typemap(in,numinputs=0) void **OUTPUT (int force),
+%typemap(in,numinputs=0,phptype="?SWIGTYPE") void **OUTPUT (int force),
void *&OUTPUT (int force)
%{
/* If they pass NULL by reference, make it into a void*
@@ -276,7 +265,8 @@ INT_TYPEMAP(unsigned long long);
/* So... we didn't get a ref or ptr, but we'll accept NULL by reference */
if (!(Z_ISREF($input) && Z_ISNULL_P(Z_REFVAL($input)))) {
/* wasn't a pre/ref/thing, OR anything like an int thing */
- SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname.");
+ zend_type_error("Expected reference or NULL for argument $arg of $symname");
+ return;
}
}
force=0;
diff --git a/linux-x86/share/swig/php/utils.i b/linux-x86/share/swig/php/utils.i
index ed6e08f..33db942 100644
--- a/linux-x86/share/swig/php/utils.i
+++ b/linux-x86/share/swig/php/utils.i
@@ -16,9 +16,9 @@
char * endptr;
errno = 0;
lvar = (t) strtoll(Z_STRVAL(invar), &endptr, 10);
- if (*endptr && !errno) break;
- /* FALL THRU */
+ if (*endptr == '\0' && !errno) break;
}
+ /* FALL THRU */
default:
lvar = (t) zval_get_long(&invar);
}
@@ -33,9 +33,9 @@
char * endptr;
errno = 0;
lvar = (t) strtoull(Z_STRVAL(invar), &endptr, 10);
- if (*endptr && !errno) break;
- /* FALL THRU */
+ if (*endptr == '\0' && !errno) break;
}
+ /* FALL THRU */
default:
lvar = (t) zval_get_long(&invar);
}
@@ -63,28 +63,33 @@
}
%enddef
-%define %pass_by_val( TYPE, CONVERT_IN )
-%typemap(in) TYPE
+%define %pass_by_val( TYPE, PHP_TYPE, CONVERT_IN )
+%typemap(in, phptype=PHP_TYPE) TYPE
%{
CONVERT_IN($1,$1_ltype,$input);
%}
-%typemap(in) const TYPE & ($*1_ltype temp)
+%typemap(in, phptype=PHP_TYPE) const TYPE & ($*1_ltype temp)
%{
CONVERT_IN(temp,$*1_ltype,$input);
$1 = &temp;
%}
%typemap(directorout) TYPE
%{
- if (!EG(exception)) {
- CONVERT_IN($result, $1_ltype, *$input);
- }
+ CONVERT_IN($result, $1_ltype, *$input);
+%}
+%typemap(directorout) const TYPE &
+%{
+ $*1_ltype swig_val;
+ CONVERT_IN(swig_val, $*1_ltype, *$input);
+ $1_ltype temp = new $*1_ltype(swig_val);
+ swig_acquire_ownership(temp);
+ $result = temp;
%}
-%typemap(directorout) const TYPE & ($*1_ltype temp)
+%typemap(directorfree) const TYPE &
%{
- if (!EG(exception)) {
- CONVERT_IN(temp, $*1_ltype, *$input);
+ if (director) {
+ director->swig_release_ownership(%as_voidptr($input));
}
- $result = &temp;
%}
%enddef
diff --git a/linux-x86/share/swig/pike/pike.swg b/linux-x86/share/swig/pike/pike.swg
deleted file mode 100644
index a36bf3a..0000000
--- a/linux-x86/share/swig/pike/pike.swg
+++ /dev/null
@@ -1,326 +0,0 @@
-/* -----------------------------------------------------------------------------
- * pike.swg
- *
- * Pike configuration module.
- * ----------------------------------------------------------------------------- */
-
-%insert(runtime) "swigrun.swg"; // Common C API type-checking code
-%insert(runtime) "pikerun.swg"; // Pike run-time code
-
-%insert(runtime) %{
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include <pike/global.h>
-#include <pike/module.h>
-#include <pike/interpret.h>
-#ifdef __cplusplus
-}
-#endif
-%}
-
-/* -----------------------------------------------------------------------------
- * standard typemaps
- * ----------------------------------------------------------------------------- */
-
-/* --- Input arguments --- */
-
-/* Primitive datatypes. */
-
-%typemap(in, pikedesc="tInt")
- int, unsigned int, short, unsigned short,
- long, unsigned long, char, signed char, unsigned char,
- bool, enum SWIGTYPE, long long, unsigned long long
-{
- if ($input.type != T_INT)
- Pike_error("Bad argument: Expected an integer.\n");
- $1 = ($1_ltype) $input.u.integer;
-}
-
-%typemap(in, pikedesc="tFloat") float, double {
- if ($input.type != T_FLOAT)
- Pike_error("Bad argument: Expected a float.\n");
- $1 = ($1_ltype) $input.u.float_number;
-}
-
-%typemap(in, pikedesc="tStr") char *, char [ANY] {
- if ($input.type != T_STRING)
- Pike_error("Bad argument: Expected a string.\n");
- $1 = ($1_ltype) STR0($input.u.string);
-}
-
-/* Pointers, references and arrays */
-
-%typemap(in) SWIGTYPE *,
- SWIGTYPE &,
- SWIGTYPE &&,
- SWIGTYPE []
- "SWIG_ConvertPtr($input.u.object, (void **) &$1, $1_descriptor, 1);"
-
-/* Void pointer. Accepts any kind of pointer */
-%typemap(in) void * "/* FIXME */";
-
-/* Object passed by value. Convert to a pointer */
-%typemap(in) SWIGTYPE ($&1_ltype argp) "/* FIXME */";
-
-/* Pointer to a class member */
-%typemap(in) SWIGTYPE (CLASS::*) "/* FIXME */";
-
-/* Const primitive references. Passed by value */
-
-%typemap(in, pikedesc="tInt") const int & (int temp),
- const short & (short temp),
- const long & (long temp),
- const unsigned int & (unsigned int temp),
- const unsigned short & (unsigned short temp),
- const unsigned long & (unsigned long temp),
- const char & (char temp),
- const signed char & (signed char temp),
- const unsigned char & (unsigned char temp),
- const bool & (bool temp),
- const long long & ($*1_ltype temp),
- const unsigned long long & ($*1_ltype temp),
- const enum SWIGTYPE & ($*1_ltype temp),
- const enum SWIGTYPE && ($*1_ltype temp)
-{
- if ($input.type != T_INT)
- Pike_error("Bad argument: Expected an integer.\n");
- temp = ($*1_ltype) $input.u.integer;
- $1 = &temp;
-}
-
-%typemap(in, pikedesc="tFloat") const float & (float temp),
- const double & (double temp)
-{
- if ($input.type != T_FLOAT)
- Pike_error("Bad argument: Expected a float.\n");
- temp = ($*1_ltype) $input.u.float_number;
- $1 = &temp;
-}
-
-/* -----------------------------------------------------------------------------
- * Output Typemaps
- * ----------------------------------------------------------------------------- */
-%typemap(out, pikedesc="tInt")
- int, unsigned int,
- short, unsigned short,
- long, unsigned long,
- char, signed char, unsigned char,
- bool, enum SWIGTYPE
- "push_int($1);";
-
-%typemap(out, pikedesc="tInt") long long "push_int64($1);";
-%typemap(out, pikedesc="tInt") unsigned long long "push_int64($1);";
-%typemap(out, pikedesc="tFloat") float, double "push_float($1);";
-%typemap(out, pikedesc="tStr") char * "push_text($1);";
-
-/* Pointers, references, and arrays */
-%typemap(out, pikedesc="tObj") SWIGTYPE*, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "push_object(SWIG_NewPointerObj((void *) $1, $1_descriptor, $owner));";
-
-/* Void return value; don't push anything */
-%typemap(out, pikedesc="tVoid") void "";
-
-/* Dynamic casts */
-
-%typemap(out) SWIGTYPE *DYNAMIC, SWIGTYPE &DYNAMIC "/* FIXME */";
-
-/* Member pointer */
-%typemap(out) SWIGTYPE (CLASS::*) "/* FIXME */";
-
-/* Special typemap for character array return values */
-%typemap(out, pikedesc="tStr") char [ANY], const char [ANY] "push_text($1);";
-
-/* Primitive types--return by value */
-%typemap(out, pikedesc="tObj") SWIGTYPE
-#ifdef __cplusplus
-{
- $&1_ltype resultptr;
- resultptr = new $1_ltype((const $1_ltype &) $1);
- push_object(SWIG_NewPointerObj((void *) resultptr, $&1_descriptor, 1));
-}
-#else
-{
- $&1_ltype resultptr;
- resultptr = ($&1_ltype) malloc(sizeof($1_type));
- memmove(resultptr, &$1, sizeof($1_type));
- push_object(SWIG_NewPointerObj((void *) resultptr, $&1_descriptor, 1));
-}
-#endif
-
-/* References to primitive types. Return by value */
-
-%typemap(out, pikedesc="tInt") const int &, const unsigned int &,
- const short &, const unsigned short &,
- const long &, const unsigned long &,
- const char &, const signed char &, const unsigned char &,
- const bool &,
- const long long &, const unsigned long long &,
- const enum SWIGTYPE & ($*1_ltype temp),
- const enum SWIGTYPE && ($*1_ltype temp)
- "push_int(*($1));";
-
-%typemap(out, pikedesc="tFloat") const float &, const double & "push_float(*($1));";
-
-/************************ Constant Typemaps *****************************/
-
-%typemap(constant)
- int, unsigned int,
- short, unsigned short,
- long, unsigned long,
- signed char, unsigned char,
- bool, enum SWIGTYPE,
- long long, unsigned long long
- "add_integer_constant(\"$symname\", $1, 0);";
-
-%typemap(constant) char
- "add_integer_constant(\"$symname\", '$1', 0);";
-
-%typemap(constant) long long, unsigned long long
- "add_integer_constant(\"$symname\", $1, 0);";
-
-%typemap(constant) float, double
- "add_float_constant(\"$symname\", $1, 0);";
-
-%typemap(constant) char *
- "add_string_constant(\"$symname\", \"$1\", 0);";
-
-/* ------------------------------------------------------------
- * String & length
- * ------------------------------------------------------------ */
-
-%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
- if ($input.type != T_STRING)
- Pike_error("Bad argument: Expected a string.\n");
- $1 = ($1_ltype) STR0($input.u.string);
- $2 = ($2_ltype) $input.u.string->length;
-}
-
-/* ------------------------------------------------------------
- * ANSI C typemaps
- * ------------------------------------------------------------ */
-
-%typemap(in, pikedesc="tInt") size_t {
- if ($input.type != T_INT)
- Pike_error("Bad argument: Expected an integer.\n");
- $1 = ($1_ltype) $input.u.integer;
-}
-
-%typemap(out) size_t = long;
-
-/* ------------------------------------------------------------
- * Typechecking rules
- * ------------------------------------------------------------ */
-
-%typecheck(SWIG_TYPECHECK_INTEGER)
- int, short, long,
- unsigned int, unsigned short, unsigned long,
- signed char, unsigned char,
- long long, unsigned long long,
- const int &, const short &, const long &,
- const unsigned int &, const unsigned short &, const unsigned long &,
- const long long &, const unsigned long long &,
- enum SWIGTYPE, enum SWIGTYPE &, SWIGTYPE &&,
- bool, const bool &
-{
- $1 = ($input.type == T_INT) ? 1 : 0;
-}
-
-%typecheck(SWIG_TYPECHECK_DOUBLE)
- float, double,
- const float &, const double &
-{
- $1 = (($input.type == T_FLOAT) || ($input.type == T_INT)) ? 1 : 0;
-}
-
-%typecheck(SWIG_TYPECHECK_CHAR) char {
- $1 = ($input.type == T_INT) ? 1 : 0;
-}
-
-%typecheck(SWIG_TYPECHECK_STRING) char * {
- $1 = ($input.type == T_STRING) ? 1 : 0;
-}
-
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
- void *ptr;
- if (SWIG_ConvertPtr($input.u.object, (void **) &ptr, $1_descriptor, 0) == -1) {
- $1 = 0;
- } else {
- $1 = 1;
- }
-}
-
-%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
- void *ptr;
- if (SWIG_ConvertPtr($input.u.object, (void **) &ptr, $&1_descriptor, 0) == -1) {
- $1 = 0;
- } else {
- $1 = 1;
- }
-}
-
-%typecheck(SWIG_TYPECHECK_VOIDPTR) void * {
- void *ptr;
- if (SWIG_ConvertPtr($input.u.object, (void **) &ptr, 0, 0) == -1) {
- $1 = 0;
- } else {
- $1 = 1;
- }
-}
-
-/* Array reference typemaps */
-%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
-
-/* const pointers */
-%apply SWIGTYPE * { SWIGTYPE *const }
-%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
-%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
-
-/* ------------------------------------------------------------
- * Overloaded operator support
- * ------------------------------------------------------------ */
-
-#ifdef __cplusplus
-%rename("`+") *::operator+;
-%rename("`-") *::operator-;
-%rename("`*") *::operator*;
-%rename("`/") *::operator/;
-%rename("`%") *::operator%;
-%rename("`<<") *::operator<<;
-%rename("`>>") *::operator>>;
-%rename("`&") *::operator&;
-%rename("`|") *::operator|;
-%rename("`^") *::operator^;
-%rename("`~") *::operator~;
-%rename("`<") *::operator<;
-%rename("`>") *::operator>;
-%rename("`==") *::operator==;
-
-/* Special cases */
-%rename("`()") *::operator();
-
-#endif
-
-/* ------------------------------------------------------------
- * The start of the Pike initialization function
- * ------------------------------------------------------------ */
-
-%init "swiginit.swg"
-
-%init %{
-#ifdef __cplusplus
-extern "C"
-#endif
-PIKE_MODULE_EXIT {}
-
-#ifdef __cplusplus
-extern "C"
-#endif
-PIKE_MODULE_INIT
-{
- struct program *pr;
- SWIG_InitializeModule(0);
-%}
-
-/* pike keywords */
-%include <pikekw.swg>
diff --git a/linux-x86/share/swig/pike/pikekw.swg b/linux-x86/share/swig/pike/pikekw.swg
deleted file mode 100644
index 844b1f1..0000000
--- a/linux-x86/share/swig/pike/pikekw.swg
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef PIKE_PIKEKW_SWG_
-#define PIKE_PIKEKW_SWG_
-
-/* Warnings for Pike keywords */
-#define PIKEKW(x) %namewarn("314: '" #x "' is a pike keyword") #x
-
-/*
- from
- http://www.http://docs.linux.cz/pike/tutorial_C.html
-
-*/
-
-
-PIKEKW(array);
-PIKEKW(break);
-PIKEKW(case);
-PIKEKW(catch);
-PIKEKW(continue);
-PIKEKW(default);
-PIKEKW(do);
-PIKEKW(else);
-PIKEKW(float);
-PIKEKW(for);
-PIKEKW(foreach);
-PIKEKW(function);
-PIKEKW(gauge);
-PIKEKW(if);
-PIKEKW(inherit);
-PIKEKW(inline);
-PIKEKW(int);
-PIKEKW(lambda);
-PIKEKW(mapping);
-PIKEKW(mixed);
-PIKEKW(multiset);
-PIKEKW(nomask);
-PIKEKW(object);
-PIKEKW(predef);
-PIKEKW(private);
-PIKEKW(program);
-PIKEKW(protected);
-PIKEKW(public);
-PIKEKW(return);
-PIKEKW(sscanf);
-PIKEKW(static);
-PIKEKW(string);
-PIKEKW(switch);
-PIKEKW(typeof);
-PIKEKW(varargs);
-PIKEKW(void);
-PIKEKW(while);
-
-
-#undef PIKEKW
-
-#endif //PIKE_PIKEKW_SWG_
diff --git a/linux-x86/share/swig/pike/pikerun.swg b/linux-x86/share/swig/pike/pikerun.swg
deleted file mode 100644
index 6ec1143..0000000
--- a/linux-x86/share/swig/pike/pikerun.swg
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -----------------------------------------------------------------------------
- * pikerun.swg
- *
- * This file contains the runtime support for Pike modules
- * and includes code for managing global variables and pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include "pike/object.h"
-#include "pike/program.h"
-#ifdef __cplusplus
-}
-#endif
-#include <assert.h>
-
-/* Stores information about a wrapped object */
-typedef struct swig_object_wrapper {
- void *self;
- swig_type_info *type;
-} swig_object_wrapper;
-
-#ifdef THIS
-#undef THIS
-#endif
-#define THIS (((swig_object_wrapper *) Pike_fp->current_storage)->self)
-
-#define SWIG_ConvertPtr SWIG_Pike_ConvertPtr
-#define SWIG_NewPointerObj SWIG_Pike_NewPointerObj
-#define SWIG_GetModule(clientdata) SWIG_Pike_GetModule(clientdata)
-#define SWIG_SetModule(clientdata, pointer) SWIG_Pike_SetModule(pointer)
-
-/* These need to be filled in before type sharing between modules will work */
-static swig_module_info *SWIG_Pike_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
- return 0;
-}
-
-static void SWIG_Pike_SetModule(swig_module_info *pointer) {
-
-}
-
-/* Convert a pointer value */
-static int
-SWIG_Pike_ConvertPtr(struct object *obj, void **ptr, swig_type_info *ty, int flags) {
- struct program *pr;
- swig_cast_info *tc;
- swig_object_wrapper *obj_wrapper;
-
- if (ty) {
- pr = (struct program *) ty->clientdata;
- obj_wrapper = (swig_object_wrapper *) get_storage(obj, pr);
- if (obj_wrapper && obj_wrapper->type) {
- tc = SWIG_TypeCheckStruct(obj_wrapper->type, ty);
- if (tc) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc, obj_wrapper->self, &newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- return 0;
- }
- }
- }
- return -1;
-}
-
-/* Create a new pointer object */
-static struct object *
-SWIG_Pike_NewPointerObj(void *ptr, swig_type_info *type, int own) {
- return 0;
-}
diff --git a/linux-x86/share/swig/pike/std_string.i b/linux-x86/share/swig/pike/std_string.i
deleted file mode 100644
index b32b3c1..0000000
--- a/linux-x86/share/swig/pike/std_string.i
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_string.i
- *
- * SWIG typemaps for std::string
- * ----------------------------------------------------------------------------- */
-
-%{
-#include <string>
-%}
-
-namespace std {
-
- %naturalvar string;
-
- class string;
-
- /* Overloading check */
-
- %typemap(typecheck) string = char *;
- %typemap(typecheck) const string & = char *;
-
- %typemap(in, pikedesc="tStr") string {
- if ($input.type != T_STRING)
- Pike_error("Bad argument: Expected a string.\n");
- $1.assign(STR0($input.u.string));
- }
-
- %typemap(in, pikedesc="tStr") const string & ($*1_ltype temp) {
- if ($input.type != T_STRING)
- Pike_error("Bad argument: Expected a string.\n");
- temp.assign(STR0($input.u.string));
- $1 = &temp;
- }
-
- %typemap(out, pikedesc="tStr") string "push_text($1.c_str());";
-
- %typemap(out, pikedesc="tStr") const string & "push_text($1->c_str());";
-
- %typemap(directorin) string, const string &, string & "$1.c_str()";
-
- %typemap(directorin) string *, const string * "$1->c_str()";
-
- %typemap(directorout) string {
- if ($input.type == T_STRING)
- $result.assign(STR0($input.u.string));
- else
- throw Swig::DirectorTypeMismatchException("string expected");
- }
-
- %typemap(directorout) const string & ($*1_ltype temp) {
- if ($input.type == T_STRING) {
- temp.assign(STR0($input.u.string));
- $result = &temp;
- } else {
- throw Swig::DirectorTypeMismatchException("string expected");
- }
- }
-
-}
-
diff --git a/linux-x86/share/swig/python/README b/linux-x86/share/swig/python/README
index fa8ef61..70968e7 100644
--- a/linux-x86/share/swig/python/README
+++ b/linux-x86/share/swig/python/README
@@ -101,4 +101,3 @@ std_container.i general common code for the STD/STL containers
std_vectora.i vector + allocator (allocators are now supported in STD/STL)
typemaps.i old in/out typemaps (doesn't need to be included)
-defarg.swg for processing default arguments with shadow classes
diff --git a/linux-x86/share/swig/python/argcargv.i b/linux-x86/share/swig/python/argcargv.i
index 717fe73..af71840 100644
--- a/linux-x86/share/swig/python/argcargv.i
+++ b/linux-x86/share/swig/python/argcargv.i
@@ -1,13 +1,10 @@
-/* ------------------------------------------------------------
- * --- Argc & Argv ---
- * ------------------------------------------------------------ */
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
%fragment("SWIG_AsArgcArgv","header",fragment="SWIG_AsCharPtrAndSize") {
SWIGINTERN int
-SWIG_AsArgcArgv(PyObject *input,
- swig_type_info *ppchar_info,
- size_t *argc, char ***argv, int *owner)
-{
+SWIG_AsArgcArgv(PyObject *input, swig_type_info *ppchar_info, size_t *argc, char ***argv, int *owner) {
void *vptr;
int res = SWIG_ConvertPtr(input, &vptr, ppchar_info, 0);
if (!SWIG_IsOK(res)) {
@@ -51,7 +48,7 @@ SWIG_AsArgcArgv(PyObject *input,
} else {
/* seems dangerous, but the user asked for it... */
size_t i = 0;
- if (argv) { while (*argv[i] != 0) ++i;}
+ if (argv) { while (*argv[i] != 0) ++i;}
if (argc) *argc = i;
if (owner) *owner = 0;
return SWIG_OK;
@@ -66,10 +63,10 @@ SWIG_AsArgcArgv(PyObject *input,
%typemap(in,noblock=0,fragment="SWIG_AsArgcArgv") (int ARGC, char **ARGV) (int res,char **argv = 0, size_t argc = 0, int owner= 0) {
res = SWIG_AsArgcArgv($input, $descriptor(char**), &argc, &argv, &owner);
- if (!SWIG_IsOK(res)) {
+ if (!SWIG_IsOK(res)) {
$1 = 0; $2 = 0;
%argument_fail(SWIG_TypeError, "int ARGC, char **ARGV", $symname, $argnum);
- } else {
+ } else {
$1 = %static_cast(argc,$1_ltype);
$2 = %static_cast(argv, $2_ltype);
}
diff --git a/linux-x86/share/swig/python/boost_shared_ptr.i b/linux-x86/share/swig/python/boost_shared_ptr.i
index 709e781..bfd8787 100644
--- a/linux-x86/share/swig/python/boost_shared_ptr.i
+++ b/linux-x86/share/swig/python/boost_shared_ptr.i
@@ -39,7 +39,7 @@
}
}
%typemap(out) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1));
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -58,12 +58,12 @@
}
}
%typemap(varout) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $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));
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($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) {
diff --git a/linux-x86/share/swig/python/builtin.swg b/linux-x86/share/swig/python/builtin.swg
index 28051e6..6c2c311 100644
--- a/linux-x86/share/swig/python/builtin.swg
+++ b/linux-x86/share/swig/python/builtin.swg
@@ -6,7 +6,11 @@ SWIGINTERN Py_hash_t
SwigPyObject_hash(PyObject *obj) {
SwigPyObject *sobj = (SwigPyObject *)obj;
void *ptr = sobj->ptr;
+#if PY_VERSION_HEX < 0x03020000
+ return (Py_hash_t)(Py_ssize_t)ptr;
+#else
return (Py_hash_t)ptr;
+#endif
}
SWIGINTERN Py_hash_t
@@ -211,7 +215,11 @@ SwigPyStaticVar_Type(void) {
sizeof(PyGetSetDescrObject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
- 0, /* tp_print */
+#if PY_VERSION_HEX < 0x030800b4
+ (printfunc)0, /* tp_print */
+#else
+ (Py_ssize_t)0, /* tp_vectorcall_offset */
+#endif
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
@@ -256,6 +264,15 @@ SwigPyStaticVar_Type(void) {
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+ 0, /* tp_print */
+#endif
+#if PY_VERSION_HEX >= 0x030c0000
+ 0, /* tp_watched */
+#endif
#ifdef COUNT_ALLOCS
0, /* tp_allocs */
0, /* tp_frees */
@@ -289,7 +306,11 @@ SwigPyObjectType(void) {
PyType_Type.tp_basicsize, /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
- 0, /* tp_print */
+#if PY_VERSION_HEX < 0x030800b4
+ (printfunc)0, /* tp_print */
+#else
+ (Py_ssize_t)0, /* tp_vectorcall_offset */
+#endif
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
@@ -334,6 +355,15 @@ SwigPyObjectType(void) {
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+ 0, /* tp_print */
+#endif
+#if PY_VERSION_HEX >= 0x030c0000
+ 0, /* tp_watched */
+#endif
#ifdef COUNT_ALLOCS
0, /* tp_allocs */
0, /* tp_frees */
@@ -402,10 +432,10 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) {
SWIGINTERN void
SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype)
{
-#if PY_VERSION_HEX >= 0x03000000
- type->ob_base.ob_base.ob_type = metatype;
+#if PY_VERSION_HEX >= 0x030900a4
+ Py_SET_TYPE(type, metatype);
#else
- type->ob_type = metatype;
+ Py_TYPE(type) = metatype;
#endif
}
@@ -510,8 +540,10 @@ SwigPyBuiltin_ternaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py
assert(tuple);
Py_INCREF(b);
PyTuple_SET_ITEM(tuple, 0, b);
- Py_INCREF(c);
- PyTuple_SET_ITEM(tuple, 1, c);
+ if (c) {
+ Py_INCREF(c);
+ PyTuple_SET_ITEM(tuple, 1, c);
+ }
result = wrapper(a, tuple);
Py_DECREF(tuple);
return result;
@@ -626,8 +658,10 @@ 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);
+ if (c) {
+ Py_INCREF(c);
+ PyTuple_SET_ITEM(tuple, 1, c);
+ }
resultobj = wrapper(a, tuple);
result = resultobj ? 0 : -1;
Py_XDECREF(resultobj);
diff --git a/linux-x86/share/swig/python/carrays.i b/linux-x86/share/swig/python/carrays.i
index 74b2be9..a7b6120 100644
--- a/linux-x86/share/swig/python/carrays.i
+++ b/linux-x86/share/swig/python/carrays.i
@@ -7,7 +7,3 @@
%enddef
%include <typemaps/carrays.swg>
-
-
-
-
diff --git a/linux-x86/share/swig/python/ccomplex.i b/linux-x86/share/swig/python/ccomplex.i
index 28872b9..b99f96a 100644
--- a/linux-x86/share/swig/python/ccomplex.i
+++ b/linux-x86/share/swig/python/ccomplex.i
@@ -12,15 +12,16 @@
#include <complex.h>
%}
+#define complex _Complex
/* C complex constructor */
#define CCplxConst(r, i) ((r) + I*(i))
-%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag);
-%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag);
-%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
+%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag);
/* declaring the typemaps */
-%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex);
-%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex);
-%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex);
diff --git a/linux-x86/share/swig/python/defarg.swg b/linux-x86/share/swig/python/defarg.swg
deleted file mode 100644
index 59450bd..0000000
--- a/linux-x86/share/swig/python/defarg.swg
+++ /dev/null
@@ -1,37 +0,0 @@
-/* This file defines an internal function for processing default arguments
- with proxy classes.
-
- There seems to be no straightforward way to write proxy functions
- involving default arguments. For example :
-
- def foo(arg1,arg2,*args):
- proxyc.foo(arg1,arg2,args)
-
- This fails because args is now a tuple and SWIG doesn't know what to
- do with it.
-
- This file allows a different approach :
-
- def foo(arg1,arg2,*args):
- proxyc.__call_defarg(proxyc.foo,(arg1,arg2,)+args)
-
- Basically, we form a new tuple from the object, call this special
- __call_defarg method and it passes control to the real wrapper function.
- An ugly hack, but it works.
-*/
-
-SWIGINTERN PyObject *swig_call_defargs(PyObject *self, PyObject *args) {
- PyObject *func;
- PyObject *parms;
-
- if (!PyArg_ParseTuple(args, "OO", &func, &parms))
- return NULL;
-
- if (!PyCallable_Check(func)) {
- SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyErr_SetString(PyExc_TypeError, "__call_defarg : Need a callable object!");
- SWIG_PYTHON_THREAD_END_BLOCK;
- return NULL;
- }
- return PyEval_CallObject(func,parms);
-}
diff --git a/linux-x86/share/swig/python/director.swg b/linux-x86/share/swig/python/director.swg
index 9694c62..a1dd00f 100644
--- a/linux-x86/share/swig/python/director.swg
+++ b/linux-x86/share/swig/python/director.swg
@@ -14,6 +14,24 @@
#include <vector>
#include <map>
+#if defined(SWIG_PYTHON_THREADS)
+/* __THREAD__ is the old macro to activate some thread support */
+# if !defined(__THREAD__)
+# define __THREAD__ 1
+# endif
+#endif
+
+#ifdef __THREAD__
+#ifndef Py_LIMITED_API
+# include "pythread.h"
+#else
+# if defined(_WIN32)
+# include <windows.h>
+# else
+# include <pthread.h>
+# endif
+#endif
+#endif
/*
Use -DSWIG_PYTHON_DIRECTOR_NO_VTABLE if you don't want to generate a 'virtual
@@ -173,7 +191,7 @@ namespace Swig {
swig_msg += msg;
}
if (!PyErr_Occurred()) {
- PyErr_SetString(error, what());
+ PyErr_SetString(error, swig_msg.c_str());
}
SWIG_PYTHON_THREAD_END_BLOCK;
}
@@ -244,25 +262,89 @@ namespace Swig {
};
-#if defined(SWIG_PYTHON_THREADS)
-/* __THREAD__ is the old macro to activate some thread support */
-# if !defined(__THREAD__)
-# define __THREAD__ 1
-# endif
-#endif
-
#ifdef __THREAD__
-# include "pythread.h"
+#ifndef Py_LIMITED_API
+ class Mutex
+ {
+ public:
+ Mutex() {
+ mutex_ = PyThread_allocate_lock();
+ }
+
+ ~Mutex() {
+ PyThread_release_lock(mutex_);
+ }
+
+ private:
+ void Lock() {
+ PyThread_acquire_lock(mutex_, WAIT_LOCK);
+ }
+
+ void Unlock() {
+ PyThread_free_lock(mutex_);
+ }
+
+ PyThread_type_lock mutex_;
+
+ friend class Guard;
+ };
+#elif defined(_WIN32)
+ class Mutex : private CRITICAL_SECTION {
+ public:
+ Mutex() {
+ InitializeCriticalSection(this);
+ }
+
+ ~Mutex() {
+ DeleteCriticalSection(this);
+ }
+
+ private:
+ void Lock() {
+ EnterCriticalSection(this);
+ }
+
+ void Unlock() {
+ LeaveCriticalSection(this);
+ }
+
+ friend class Guard;
+ };
+#else
+ class Mutex {
+ public:
+ Mutex() {
+ pthread_mutex_init(&mutex_, NULL);
+ }
+
+ ~Mutex() {
+ pthread_mutex_destroy(&mutex_);
+ }
+
+ private:
+ void Lock() {
+ pthread_mutex_lock(&mutex_);
+ }
+
+ void Unlock() {
+ pthread_mutex_unlock(&mutex_);
+ }
+
+ friend class Guard;
+
+ pthread_mutex_t mutex_;
+ };
+#endif
class Guard {
- PyThread_type_lock &mutex_;
+ Mutex &mutex_;
public:
- Guard(PyThread_type_lock & mutex) : mutex_(mutex) {
- PyThread_acquire_lock(mutex_, WAIT_LOCK);
+ Guard(Mutex & mutex) : mutex_(mutex) {
+ mutex_.Lock();
}
~Guard() {
- PyThread_release_lock(mutex_);
+ mutex_.Unlock();
}
};
# define SWIG_GUARD(mutex) Guard _guard(mutex)
@@ -330,7 +412,7 @@ namespace Swig {
typedef std::map<void *, GCItem_var> swig_ownership_map;
mutable swig_ownership_map swig_owner;
#ifdef __THREAD__
- static PyThread_type_lock swig_mutex_own;
+ static Mutex swig_mutex_own;
#endif
public:
@@ -382,7 +464,7 @@ namespace Swig {
};
#ifdef __THREAD__
- PyThread_type_lock Director::swig_mutex_own = PyThread_allocate_lock();
+ Mutex Director::swig_mutex_own;
#endif
}
diff --git a/linux-x86/share/swig/python/embed.i b/linux-x86/share/swig/python/embed.i
index efd0487..e5ee601 100644
--- a/linux-x86/share/swig/python/embed.i
+++ b/linux-x86/share/swig/python/embed.i
@@ -2,36 +2,43 @@
// embed.i
// SWIG file embedding the Python interpreter in something else.
// This file is deprecated and no longer actively maintained, but it still
-// seems to work with Python 2.7. Status with Python 3 is unknown.
+// seems to work with Python 2.7. It doesn't work with Python 3.
//
// This file makes it possible to extend Python and all of its
// built-in functions without having to hack its setup script.
//
+// This module provides support for building a new version of the
+// Python executable. This will be necessary on systems that do
+// not support shared libraries and may be necessary with C++
+// extensions. This file contains everything you need to build
+// a new version of Python from include files and libraries normally
+// installed with the Python language.
+//
+// This module will automatically grab all of the Python modules
+// present in your current Python executable (including any special
+// purpose modules you have enabled such as Tkinter). Thus, you
+// may need to provide additional link libraries when compiling.
+//
+// As far as I know, this module is C++ safe.
-
-#ifdef AUTODOC
-%subsection "embed.i"
-%text %{
-This module provides support for building a new version of the
-Python executable. This will be necessary on systems that do
-not support shared libraries and may be necessary with C++
-extensions. This file contains everything you need to build
-a new version of Python from include files and libraries normally
-installed with the Python language.
-
-This module will automatically grab all of the Python modules
-present in your current Python executable (including any special
-purpose modules you have enabled such as Tkinter). Thus, you
-may need to provide additional link libraries when compiling.
-
-As far as I know, this module is C++ safe.
-%}
+%wrapper %{
+#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN)
+#define PY_SSIZE_T_CLEAN
#endif
-%wrapper %{
+#if __GNUC__ >= 7
+#pragma GCC diagnostic push
+#if defined(__cplusplus) && __cplusplus >=201703L
+#pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */
+#endif
+#endif
#include <Python.h>
+#if __GNUC__ >= 7
+#pragma GCC diagnostic pop
+#endif
+
#ifdef __cplusplus
extern "C"
#endif
diff --git a/linux-x86/share/swig/python/pyabc.i b/linux-x86/share/swig/python/pyabc.i
index fbd91dc..cae1e70 100644
--- a/linux-x86/share/swig/python/pyabc.i
+++ b/linux-x86/share/swig/python/pyabc.i
@@ -1,10 +1,14 @@
%define %pythonabc(Type, Abc)
- %feature("python:abc", #Abc) Type;
+ %feature("python:abc", Abc) Type;
%enddef
-%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);
+%pythoncode %{if _swig_python_version_info[0:2] >= (3, 3):
+ import collections.abc
+else:
+ import collections
+%}
+%pythonabc(std::vector, "collections.abc.MutableSequence if _swig_python_version_info >= (3, 3) else collections.MutableSequence");
+%pythonabc(std::list, "collections.abc.MutableSequence if _swig_python_version_info >= (3, 3) else collections.MutableSequence");
+%pythonabc(std::map, "collections.abc.MutableMapping if _swig_python_version_info >= (3, 3) else collections.MutableMapping");
+%pythonabc(std::multimap, "collections.abc.MutableMapping if _swig_python_version_info >= (3, 3) else collections.MutableMapping");
+%pythonabc(std::set, "collections.abc.MutableSet if _swig_python_version_info >= (3, 3) else collections.MutableSet");
+%pythonabc(std::multiset, "collections.abc.MutableSet if _swig_python_version_info >= (3, 3) else collections.MutableSet");
diff --git a/linux-x86/share/swig/python/pybuffer.i b/linux-x86/share/swig/python/pybuffer.i
index 577eb69..9ebc36a 100644
--- a/linux-x86/share/swig/python/pybuffer.i
+++ b/linux-x86/share/swig/python/pybuffer.i
@@ -12,18 +12,43 @@
* }
*/
+/* Note that in Py_LIMITED_API case we have no choice, but to use deprecated
+ * functions, as they provides the only way to access buffer data with limited
+ * API, which doesn't include Py_buffer definition. We also disable the
+ * warnings about doing this because they're not useful in our case.
+ */
+
%define %pybuffer_mutable_binary(TYPEMAP, SIZE)
%typemap(in) (TYPEMAP, SIZE) {
int res; Py_ssize_t size = 0; void *buf = 0;
+%#ifndef Py_LIMITED_API
Py_buffer view;
res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE);
- size = view.len;
- buf = view.buf;
- PyBuffer_Release(&view);
+%#else
+ %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+ %#pragma GCC diagnostic push
+ %#pragma GCC diagnostic ignored "-Wdeprecated"
+ %#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ %#elif defined(_MSC_VER)
+ %#pragma warning(push)
+ %#pragma warning(disable: 4996)
+ %#endif
+ res = PyObject_AsWriteBuffer($input, &buf, &size);
+ %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+ %#pragma GCC diagnostic pop
+ %#elif defined(_MSC_VER)
+ %#pragma warning(pop)
+ %#endif
+%#endif
if (res < 0) {
PyErr_Clear();
%argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
}
+%#ifndef Py_LIMITED_API
+ size = view.len;
+ buf = view.buf;
+ PyBuffer_Release(&view);
+%#endif
$1 = ($1_ltype) buf;
$2 = ($2_ltype) (size/sizeof($*1_type));
}
@@ -45,14 +70,34 @@
%define %pybuffer_mutable_string(TYPEMAP)
%typemap(in) (TYPEMAP) {
int res; void *buf = 0;
+%#ifndef Py_LIMITED_API
Py_buffer view;
res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE);
- buf = view.buf;
- PyBuffer_Release(&view);
+%#else
+ %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+ %#pragma GCC diagnostic push
+ %#pragma GCC diagnostic ignored "-Wdeprecated"
+ %#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ %#elif defined(_MSC_VER)
+ %#pragma warning(push)
+ %#pragma warning(disable: 4996)
+ %#endif
+ Py_ssize_t size;
+ res = PyObject_AsWriteBuffer($input, &buf, &size);
+ %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+ %#pragma GCC diagnostic pop
+ %#elif defined(_MSC_VER)
+ %#pragma warning(pop)
+ %#endif
+%#endif
if (res < 0) {
PyErr_Clear();
%argument_fail(res, "(TYPEMAP)", $symname, $argnum);
}
+%#ifndef Py_LIMITED_API
+ buf = view.buf;
+ PyBuffer_Release(&view);
+%#endif
$1 = ($1_ltype) buf;
}
%enddef
@@ -74,15 +119,34 @@
%define %pybuffer_binary(TYPEMAP, SIZE)
%typemap(in) (TYPEMAP, SIZE) {
int res; Py_ssize_t size = 0; const void *buf = 0;
+%#ifndef Py_LIMITED_API
Py_buffer view;
res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
- size = view.len;
- buf = view.buf;
- PyBuffer_Release(&view);
+%#else
+ %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+ %#pragma GCC diagnostic push
+ %#pragma GCC diagnostic ignored "-Wdeprecated"
+ %#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ %#elif defined(_MSC_VER)
+ %#pragma warning(push)
+ %#pragma warning(disable: 4996)
+ %#endif
+ res = PyObject_AsReadBuffer($input, &buf, &size);
+ %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+ %#pragma GCC diagnostic pop
+ %#elif defined(_MSC_VER)
+ %#pragma warning(pop)
+ %#endif
+%#endif
if (res < 0) {
PyErr_Clear();
%argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
}
+%#ifndef Py_LIMITED_API
+ size = view.len;
+ buf = view.buf;
+ PyBuffer_Release(&view);
+%#endif
$1 = ($1_ltype) buf;
$2 = ($2_ltype) (size / sizeof($*1_type));
}
@@ -106,16 +170,34 @@
%define %pybuffer_string(TYPEMAP)
%typemap(in) (TYPEMAP) {
int res; const void *buf = 0;
+%#ifndef Py_LIMITED_API
Py_buffer view;
res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
- buf = view.buf;
- PyBuffer_Release(&view);
+%#else
+ %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+ %#pragma GCC diagnostic push
+ %#pragma GCC diagnostic ignored "-Wdeprecated"
+ %#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ %#elif defined(_MSC_VER)
+ %#pragma warning(push)
+ %#pragma warning(disable: 4996)
+ %#endif
+ Py_ssize_t size;
+ res = PyObject_AsReadBuffer($input, &buf, &size);
+ %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+ %#pragma GCC diagnostic pop
+ %#elif defined(_MSC_VER)
+ %#pragma warning(pop)
+ %#endif
+%#endif
if (res < 0) {
+ PyErr_Clear();
%argument_fail(res, "(TYPEMAP)", $symname, $argnum);
}
+%#ifndef Py_LIMITED_API
+ buf = view.buf;
+ PyBuffer_Release(&view);
+%#endif
$1 = ($1_ltype) buf;
}
%enddef
-
-
-
diff --git a/linux-x86/share/swig/python/pyclasses.swg b/linux-x86/share/swig/python/pyclasses.swg
index 9d6299f..39c4e03 100644
--- a/linux-x86/share/swig/python/pyclasses.swg
+++ b/linux-x86/share/swig/python/pyclasses.swg
@@ -11,7 +11,7 @@
or as a member variable:
struct A {
- SwigPtr_PyObject obj;
+ SwigPtr_PyObject _obj;
A(PyObject *o) : _obj(o) {
}
};
@@ -43,7 +43,7 @@ namespace swig {
%apply PyObject * {SwigPtr_PyObject};
%apply PyObject * const& {SwigPtr_PyObject const&};
- %typemap(typecheck,precedence=SWIG_TYPECHECK_SWIGOBJECT,noblock=1) SwigPtr_PyObject const& "$1 = ($input != 0);";
+ %typemap(typecheck,precedence=SWIG_TYPECHECK_SWIGOBJECT,noblock=1) SwigPtr_PyObject const& "$1 = ($input != 0);"
/* For output */
diff --git a/linux-x86/share/swig/python/pycomplex.swg b/linux-x86/share/swig/python/pycomplex.swg
index 087c50f..28c9636 100644
--- a/linux-x86/share/swig/python/pycomplex.swg
+++ b/linux-x86/share/swig/python/pycomplex.swg
@@ -65,7 +65,7 @@ SWIG_AsVal(Type)(PyObject *o, Type *val)
float re;
int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
if (SWIG_IsOK(res)) {
- if (val) *val = Constructor(re, 0.0);
+ if (val) *val = Constructor(re, 0.0f);
return res;
}
}
diff --git a/linux-x86/share/swig/python/pycontainer.swg b/linux-x86/share/swig/python/pycontainer.swg
index fef4e9b..6916c61 100644
--- a/linux-x86/share/swig/python/pycontainer.swg
+++ b/linux-x86/share/swig/python/pycontainer.swg
@@ -15,9 +15,9 @@
#include <iostream>
#if PY_VERSION_HEX >= 0x03020000
-# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))
+# define SWIGPY_SLICEOBJECT PyObject
#else
-# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))
+# define SWIGPY_SLICEOBJECT PySliceObject
#endif
%}
@@ -52,7 +52,7 @@ namespace swig {
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) {
+ static bool back_reference(PyObject* /*child*/, PyObject* /*owner*/) {
return false;
}
};
@@ -69,8 +69,7 @@ namespace swig {
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 PyObject_SetAttr(child, container_owner_attribute(), owner) != -1;
}
return false;
}
@@ -387,7 +386,7 @@ namespace swig {
size_t replacecount = (jj - ii + step - 1) / step;
if (is.size() != replacecount) {
char msg[1024];
- sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount);
+ PyOS_snprintf(msg, sizeof(msg), "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount);
throw std::invalid_argument(msg);
}
typename Sequence::const_iterator isit = is.begin();
@@ -403,7 +402,7 @@ namespace swig {
size_t replacecount = (ii - jj - step - 1) / -step;
if (is.size() != replacecount) {
char msg[1024];
- sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount);
+ PyOS_snprintf(msg, sizeof(msg), "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount);
throw std::invalid_argument(msg);
}
typename Sequence::const_iterator isit = is.begin();
@@ -457,239 +456,6 @@ namespace swig {
}
}
-%fragment("SwigPySequence_Cont","header",
- fragment="StdTraits",
- fragment="SwigPySequence_Base",
- fragment="SwigPyIterator_T")
-{
-namespace swig
-{
- template <class T>
- struct SwigPySequence_Ref
- {
- SwigPySequence_Ref(PyObject* seq, Py_ssize_t index)
- : _seq(seq), _index(index)
- {
- }
-
- operator T () const
- {
- swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index);
- try {
- 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()) {
- ::%type_error(swig::type_name<T>());
- }
- SWIG_Python_AddErrorMsg(msg);
- SWIG_Python_AddErrorMsg(e.what());
- throw;
- }
- }
-
- SwigPySequence_Ref& operator=(const T& v)
- {
- PySequence_SetItem(_seq, _index, swig::from<T>(v));
- return *this;
- }
-
- private:
- PyObject* _seq;
- Py_ssize_t _index;
- };
-
- template <class T>
- struct SwigPySequence_ArrowProxy
- {
- SwigPySequence_ArrowProxy(const T& x): m_value(x) {}
- const T* operator->() const { return &m_value; }
- operator const T*() const { return &m_value; }
- T m_value;
- };
-
- template <class T, class Reference >
- struct SwigPySequence_InputIterator
- {
- typedef SwigPySequence_InputIterator<T, Reference > self;
-
- typedef std::random_access_iterator_tag iterator_category;
- typedef Reference reference;
- typedef T value_type;
- typedef T* pointer;
- typedef Py_ssize_t difference_type;
-
- SwigPySequence_InputIterator()
- {
- }
-
- SwigPySequence_InputIterator(PyObject* seq, Py_ssize_t index)
- : _seq(seq), _index(index)
- {
- }
-
- reference operator*() const
- {
- return reference(_seq, _index);
- }
-
- SwigPySequence_ArrowProxy<T>
- operator->() const {
- return SwigPySequence_ArrowProxy<T>(operator*());
- }
-
- bool operator==(const self& ri) const
- {
- return (_index == ri._index) && (_seq == ri._seq);
- }
-
- bool operator!=(const self& ri) const
- {
- return !(operator==(ri));
- }
-
- self& operator ++ ()
- {
- ++_index;
- return *this;
- }
-
- self& operator -- ()
- {
- --_index;
- return *this;
- }
-
- self& operator += (difference_type n)
- {
- _index += n;
- return *this;
- }
-
- self operator +(difference_type n) const
- {
- return self(_seq, _index + n);
- }
-
- self& operator -= (difference_type n)
- {
- _index -= n;
- return *this;
- }
-
- self operator -(difference_type n) const
- {
- return self(_seq, _index - n);
- }
-
- difference_type operator - (const self& ri) const
- {
- return _index - ri._index;
- }
-
- bool operator < (const self& ri) const
- {
- return _index < ri._index;
- }
-
- reference
- operator[](difference_type n) const
- {
- return reference(_seq, _index + n);
- }
-
- private:
- PyObject* _seq;
- difference_type _index;
- };
-
- // STL container wrapper around a Python sequence
- template <class T>
- struct SwigPySequence_Cont
- {
- typedef SwigPySequence_Ref<T> reference;
- typedef const SwigPySequence_Ref<T> const_reference;
- typedef T value_type;
- typedef T* pointer;
- typedef Py_ssize_t difference_type;
- typedef size_t size_type;
- typedef const pointer const_pointer;
- typedef SwigPySequence_InputIterator<T, reference> iterator;
- typedef SwigPySequence_InputIterator<T, const_reference> const_iterator;
-
- SwigPySequence_Cont(PyObject* seq) : _seq(0)
- {
- if (!PySequence_Check(seq)) {
- throw std::invalid_argument("a sequence is expected");
- }
- _seq = seq;
- Py_INCREF(_seq);
- }
-
- ~SwigPySequence_Cont()
- {
- Py_XDECREF(_seq);
- }
-
- size_type size() const
- {
- return static_cast<size_type>(PySequence_Size(_seq));
- }
-
- bool empty() const
- {
- return size() == 0;
- }
-
- iterator begin()
- {
- return iterator(_seq, 0);
- }
-
- const_iterator begin() const
- {
- return const_iterator(_seq, 0);
- }
-
- iterator end()
- {
- return iterator(_seq, size());
- }
-
- const_iterator end() const
- {
- return const_iterator(_seq, size());
- }
-
- reference operator[](difference_type n)
- {
- return reference(_seq, n);
- }
-
- const_reference operator[](difference_type n) const
- {
- return const_reference(_seq, n);
- }
-
- 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))
- return false;
- }
- return true;
- }
-
- private:
- PyObject* _seq;
- };
-
-}
-}
-
%define %swig_sequence_iterator(Sequence...)
%swig_sequence_iterator_with_making_function(swig::make_output_iterator,Sequence...)
%enddef
@@ -705,12 +471,12 @@ namespace swig
class const_iterator;
class const_reverse_iterator;
- %typemap(out,noblock=1,fragment="SwigPySequence_Cont")
+ %typemap(out,noblock=1,fragment="SwigPyIterator_T")
iterator, reverse_iterator, const_iterator, const_reverse_iterator {
$result = SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
}
- %typemap(out,noblock=1,fragment="SwigPySequence_Cont")
+ %typemap(out,noblock=1,fragment="SwigPyIterator_T")
std::pair<iterator, iterator>, std::pair<const_iterator, const_iterator> {
$result = PyTuple_New(2);
PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).first),
@@ -719,7 +485,7 @@ namespace swig
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
}
- %fragment("SwigPyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="SwigPySequence_Cont") {}
+ %fragment("SwigPyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="SwigPyIterator_T") {}
%typemap(out,noblock=1,fragment="SwigPyPairBoolOutputIterator")
std::pair<iterator, bool>, std::pair<const_iterator, bool> {
@@ -729,7 +495,7 @@ namespace swig
PyTuple_SetItem($result,1,SWIG_From(bool)(%static_cast($1,const $type &).second));
}
- %typemap(in,noblock=1,fragment="SwigPySequence_Cont")
+ %typemap(in,noblock=1,fragment="SwigPyIterator_T")
iterator(swig::SwigPyIterator *iter = 0, int res),
reverse_iterator(swig::SwigPyIterator *iter = 0, int res),
const_iterator(swig::SwigPyIterator *iter = 0, int res),
@@ -747,14 +513,14 @@ namespace swig
}
}
- %typecheck(%checkcode(ITERATOR),noblock=1,fragment="SwigPySequence_Cont")
+ %typecheck(%checkcode(ITERATOR),noblock=1,fragment="SwigPyIterator_T")
iterator, reverse_iterator, const_iterator, const_reverse_iterator {
swig::SwigPyIterator *iter = 0;
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
$1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<$type > *>(iter) != 0));
}
- %fragment("SwigPySequence_Cont");
+ %fragment("SwigPyIterator_T");
%newobject iterator(PyObject **PYTHON_SELF);
%extend {
@@ -782,7 +548,7 @@ namespace swig
#if 1
%newobject __getslice__;
#endif
- %newobject __getitem__(PySliceObject *slice);
+ %newobject __getitem__(SWIGPY_SLICEOBJECT *slice);
#if defined(SWIGPYTHON_BUILTIN)
%feature("python:slot", "nb_nonzero", functype="inquiry") __nonzero__;
@@ -830,13 +596,13 @@ namespace swig
%extend {
/* typemap for slice object support */
- %typemap(in) PySliceObject* {
+ %typemap(in) SWIGPY_SLICEOBJECT* {
if (!PySlice_Check($input)) {
%argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
}
- $1 = (PySliceObject *) $input;
+ $1 = (SWIGPY_SLICEOBJECT *) $input;
}
- %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* {
+ %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) SWIGPY_SLICEOBJECT* {
$1 = PySlice_Check($input);
}
@@ -866,49 +632,49 @@ namespace swig
/* Overloaded methods for Python 3 compatibility
* (Also useful in Python 2.x)
*/
- Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) {
+ Sequence* __getitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
return NULL;
}
- PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
+ PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step);
Sequence::difference_type id = i;
Sequence::difference_type jd = j;
return swig::getslice(self, id, jd, step);
}
- void __setitem__(PySliceObject *slice, const Sequence& v) throw (std::out_of_range, std::invalid_argument) {
+ void __setitem__(SWIGPY_SLICEOBJECT *slice, const Sequence& v) throw (std::out_of_range, std::invalid_argument) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
return;
}
- PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
+ PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step);
Sequence::difference_type id = i;
Sequence::difference_type jd = j;
swig::setslice(self, id, jd, step, v);
}
- void __setitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) {
+ void __setitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
return;
}
- PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
+ PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step);
Sequence::difference_type id = i;
Sequence::difference_type jd = j;
swig::delslice(self, id, jd, step);
}
- void __delitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) {
+ void __delitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
return;
}
- PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
+ PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step);
Sequence::difference_type id = i;
Sequence::difference_type jd = j;
swig::delslice(self, id, jd, step);
@@ -1000,26 +766,50 @@ namespace swig
%fragment("StdSequenceTraits","header",
fragment="StdTraits",
- fragment="SwigPySequence_Cont")
+ fragment="SwigPySequence_Base")
{
namespace swig {
- template <class SwigPySeq, class Seq>
- inline void
- assign(const SwigPySeq& swigpyseq, Seq* seq) {
- // seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
- typedef typename SwigPySeq::value_type value_type;
- typename SwigPySeq::const_iterator it = swigpyseq.begin();
- for (;it != swigpyseq.end(); ++it) {
- seq->insert(seq->end(),(value_type)(*it));
+ template <class Seq, class T = typename Seq::value_type >
+ struct IteratorProtocol {
+ static void assign(PyObject *obj, Seq *seq) {
+ SwigVar_PyObject iter = PyObject_GetIter(obj);
+ if (iter) {
+ SwigVar_PyObject item = PyIter_Next(iter);
+ while (item) {
+ seq->insert(seq->end(), swig::as<T>(item));
+ item = PyIter_Next(iter);
+ }
+ }
}
- }
+
+ static bool check(PyObject *obj) {
+ bool ret = false;
+ SwigVar_PyObject iter = PyObject_GetIter(obj);
+ if (iter) {
+ SwigVar_PyObject item = PyIter_Next(iter);
+ ret = true;
+ while (item) {
+ ret = swig::check<T>(item);
+ item = ret ? PyIter_Next(iter) : 0;
+ }
+ }
+ return ret;
+ }
+ };
template <class Seq, class T = typename Seq::value_type >
struct traits_asptr_stdseq {
typedef Seq sequence;
typedef T value_type;
+ static bool is_iterable(PyObject *obj) {
+ SwigVar_PyObject iter = PyObject_GetIter(obj);
+ PyErr_Clear();
+ return iter != 0;
+ }
+
static int asptr(PyObject *obj, sequence **seq) {
+ int ret = SWIG_ERROR;
if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) {
sequence *p;
swig_type_info *descriptor = swig::type_info<sequence>();
@@ -1027,27 +817,25 @@ namespace swig {
if (seq) *seq = p;
return SWIG_OLDOBJ;
}
- } else if (PySequence_Check(obj)) {
+ } else if (is_iterable(obj)) {
try {
- SwigPySequence_Cont<value_type> swigpyseq(obj);
if (seq) {
- sequence *pseq = new sequence();
- assign(swigpyseq, pseq);
- *seq = pseq;
- return SWIG_NEWOBJ;
+ *seq = new sequence();
+ IteratorProtocol<Seq, T>::assign(obj, *seq);
+ if (!PyErr_Occurred())
+ return SWIG_NEWOBJ;
} else {
- return swigpyseq.check() ? SWIG_OK : SWIG_ERROR;
+ return IteratorProtocol<Seq, T>::check(obj) ? SWIG_OK : SWIG_ERROR;
}
} catch (std::exception& e) {
- if (seq) {
- if (!PyErr_Occurred()) {
- PyErr_SetString(PyExc_TypeError, e.what());
- }
- }
- return SWIG_ERROR;
+ if (seq && !PyErr_Occurred())
+ PyErr_SetString(PyExc_TypeError, e.what());
}
+ if (seq)
+ delete *seq;
+ return SWIG_ERROR;
}
- return SWIG_ERROR;
+ return ret;
}
};
diff --git a/linux-x86/share/swig/python/pydocs.swg b/linux-x86/share/swig/python/pydocs.swg
index 1eea41b..5a25423 100644
--- a/linux-x86/share/swig/python/pydocs.swg
+++ b/linux-x86/share/swig/python/pydocs.swg
@@ -2,43 +2,43 @@
// Documentation for use with the autodoc feature.
#ifdef SWIG_DOC_DOXYGEN_STYLE
-%typemap(doc) SWIGTYPE "@param $1_name $1_type";
-%typemap(doc) SWIGTYPE * "@param $1_name $1_type";
-%typemap(doc) const SWIGTYPE & "@param $1_name $1_type";
-%typemap(doc) const SWIGTYPE && "@param $1_name $1_type";
-%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type";
-
-%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)";
-%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)";
-%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)";
+%typemap(doc) SWIGTYPE "@param $1_name $1_type"
+%typemap(doc) SWIGTYPE * "@param $1_name $1_type"
+%typemap(doc) const SWIGTYPE & "@param $1_name $1_type"
+%typemap(doc) const SWIGTYPE && "@param $1_name $1_type"
+%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type"
+
+%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)"
+%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)"
+%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)"
#else
-%typemap(doc) SWIGTYPE "$1_name: $1_type";
-%typemap(doc) SWIGTYPE * "$1_name: $1_type";
-%typemap(doc) const SWIGTYPE & "$1_name: $1_type";
-%typemap(doc) const SWIGTYPE && "$1_name: $1_type";
-%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type";
-
-%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)";
-%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)";
-%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)";
+%typemap(doc) SWIGTYPE "$1_name: $1_type"
+%typemap(doc) SWIGTYPE * "$1_name: $1_type"
+%typemap(doc) const SWIGTYPE & "$1_name: $1_type"
+%typemap(doc) const SWIGTYPE && "$1_name: $1_type"
+%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type"
+
+%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)"
+%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";
+%typemap(doctype) bool "boolean"
%define int_doctype_for_cppint_type(cppint_type)
- %typemap(doctype) cppint_type, unsigned cppint_type "int";
+ %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) size_t "int"
-%typemap(doctype) enum SWIGTYPE "int";
+%typemap(doctype) enum SWIGTYPE "int"
-%typemap(doctype) float, double, long double "float";
+%typemap(doctype) float, double, long double "float"
-%typemap(doctype) char*, std::string "string";
+%typemap(doctype) char*, std::string "string"
%typemap(doctype) SWIGTYPE "$1_basetype"
%typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)"
diff --git a/linux-x86/share/swig/python/pyerrors.swg b/linux-x86/share/swig/python/pyerrors.swg
index dcd99c9..dfa55e0 100644
--- a/linux-x86/share/swig/python/pyerrors.swg
+++ b/linux-x86/share/swig/python/pyerrors.swg
@@ -57,14 +57,15 @@ SWIG_Python_AddErrorMsg(const char* mesg)
PyErr_Fetch(&type, &value, &traceback);
if (value) {
PyObject *old_str = PyObject_Str(value);
- const char *tmp = SWIG_Python_str_AsChar(old_str);
+ PyObject *bytes = NULL;
+ const char *tmp = SWIG_PyUnicode_AsUTF8AndSize(old_str, NULL, &bytes);
PyErr_Clear();
Py_XINCREF(type);
if (tmp)
PyErr_Format(type, "%s %s", tmp, mesg);
else
PyErr_Format(type, "%s", mesg);
- SWIG_Python_str_DelForPy3(tmp);
+ Py_XDECREF(bytes);
Py_DECREF(old_str);
Py_DECREF(value);
} else {
@@ -95,8 +96,12 @@ SWIG_Python_RaiseOrModifyTypeError(const char *message)
#else
newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
#endif
- Py_XDECREF(value);
- PyErr_Restore(type, newvalue, traceback);
+ if (newvalue) {
+ Py_XDECREF(value);
+ PyErr_Restore(type, newvalue, traceback);
+ } else {
+ PyErr_Restore(type, value, traceback);
+ }
} else {
/* Raise TypeError using given message */
PyErr_SetString(PyExc_TypeError, message);
diff --git a/linux-x86/share/swig/python/pyhead.swg b/linux-x86/share/swig/python/pyhead.swg
index c820f90..46891d9 100644
--- a/linux-x86/share/swig/python/pyhead.swg
+++ b/linux-x86/share/swig/python/pyhead.swg
@@ -13,7 +13,6 @@
#define PyString_Size(str) PyBytes_Size(str)
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
-#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
#endif
@@ -31,36 +30,29 @@
#endif
-/* Warning: This function will allocate a new string in Python 3,
- * so please call SWIG_Python_str_DelForPy3(x) to free the space.
- */
-SWIGINTERN char*
-SWIG_Python_str_AsChar(PyObject *str)
+/* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */
+SWIGINTERN const char *
+SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes)
{
-#if PY_VERSION_HEX >= 0x03000000
- char *newstr = 0;
- str = PyUnicode_AsUTF8String(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;
+#if PY_VERSION_HEX >= 0x03030000
+# if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
+ *pbytes = NULL;
+ return PyUnicode_AsUTF8AndSize(str, psize);
+# else
+ *pbytes = PyUnicode_AsUTF8String(str);
+ const char *chars = *pbytes ? PyBytes_AsString(*pbytes) : NULL;
+ if (chars && psize)
+ *psize = PyBytes_Size(*pbytes);
+ return chars;
+# endif
#else
- return PyString_AsString(str);
+ char *chars = NULL;
+ *pbytes = NULL;
+ PyString_AsStringAndSize(str, &chars, psize);
+ return chars;
#endif
}
-#if PY_VERSION_HEX >= 0x03000000
-# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
-#else
-# define SWIG_Python_str_DelForPy3(x)
-#endif
-
-
SWIGINTERN PyObject*
SWIG_Python_str_FromChar(const char *c)
{
@@ -75,13 +67,31 @@ SWIG_Python_str_FromChar(const char *c)
# define PyObject_DEL PyObject_Del
#endif
-// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
-// interface files check for it.
+/* 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 ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
+#ifdef SWIGPYTHON_BUILTIN
+# define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule_builtin" SWIG_TYPE_TABLE_NAME
+#else
+# define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME
+#endif
+# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME)
#if PY_VERSION_HEX < 0x03020000
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
#define Py_hash_t long
#endif
+
+#ifdef Py_LIMITED_API
+# define PyTuple_GET_ITEM PyTuple_GetItem
+/* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used
+ interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */
+# define PyTuple_SET_ITEM PyTuple_SetItem
+# define PyTuple_GET_SIZE PyTuple_Size
+# define PyCFunction_GET_FLAGS PyCFunction_GetFlags
+# define PyCFunction_GET_FUNCTION PyCFunction_GetFunction
+# define PyCFunction_GET_SELF PyCFunction_GetSelf
+# define PyList_GET_ITEM PyList_GetItem
+# define PyList_SET_ITEM PyList_SetItem
+# define PySliceObject PyObject
+#endif
diff --git a/linux-x86/share/swig/python/pyinit.swg b/linux-x86/share/swig/python/pyinit.swg
index dfbf40b..6833b45 100644
--- a/linux-x86/share/swig/python/pyinit.swg
+++ b/linux-x86/share/swig/python/pyinit.swg
@@ -8,6 +8,8 @@
%fragment("<stddef.h>"); // For offsetof
#endif
+#if defined SWIGPYTHON_FASTPROXY && !defined SWIGPYTHON_BUILTIN
+
%insert(runtime) %{
#ifdef __cplusplus
extern "C" {
@@ -24,220 +26,14 @@ SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyO
#endif
%}
+#endif
+
%init %{
#ifdef __cplusplus
extern "C" {
#endif
-/* Python-specific SWIG API */
-#define SWIG_newvarlink() SWIG_Python_newvarlink()
-#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
-#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
-
-/* -----------------------------------------------------------------------------
- * global variable support code.
- * ----------------------------------------------------------------------------- */
-
-typedef struct swig_globalvar {
- char *name; /* Name of global variable */
- PyObject *(*get_attr)(void); /* Return the current value */
- int (*set_attr)(PyObject *); /* Set the value */
- struct swig_globalvar *next;
-} swig_globalvar;
-
-typedef struct swig_varlinkobject {
- PyObject_HEAD
- swig_globalvar *vars;
-} swig_varlinkobject;
-
-SWIGINTERN PyObject *
-swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
-#if PY_VERSION_HEX >= 0x03000000
- return PyUnicode_InternFromString("<Swig global variables>");
-#else
- return PyString_FromString("<Swig global variables>");
-#endif
-}
-
-SWIGINTERN PyObject *
-swig_varlink_str(swig_varlinkobject *v) {
-#if PY_VERSION_HEX >= 0x03000000
- PyObject *str = PyUnicode_InternFromString("(");
- PyObject *tail;
- PyObject *joined;
- swig_globalvar *var;
- for (var = v->vars; var; var=var->next) {
- tail = PyUnicode_FromString(var->name);
- joined = PyUnicode_Concat(str, tail);
- Py_DecRef(str);
- Py_DecRef(tail);
- str = joined;
- if (var->next) {
- tail = PyUnicode_InternFromString(", ");
- joined = PyUnicode_Concat(str, tail);
- Py_DecRef(str);
- Py_DecRef(tail);
- str = joined;
- }
- }
- tail = PyUnicode_InternFromString(")");
- joined = PyUnicode_Concat(str, tail);
- Py_DecRef(str);
- Py_DecRef(tail);
- str = joined;
-#else
- PyObject *str = PyString_FromString("(");
- swig_globalvar *var;
- for (var = v->vars; var; var=var->next) {
- PyString_ConcatAndDel(&str,PyString_FromString(var->name));
- if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
- }
- PyString_ConcatAndDel(&str,PyString_FromString(")"));
-#endif
- return str;
-}
-
-SWIGINTERN void
-swig_varlink_dealloc(swig_varlinkobject *v) {
- swig_globalvar *var = v->vars;
- while (var) {
- swig_globalvar *n = var->next;
- free(var->name);
- free(var);
- var = n;
- }
-}
-
-SWIGINTERN PyObject *
-swig_varlink_getattr(swig_varlinkobject *v, char *n) {
- PyObject *res = NULL;
- swig_globalvar *var = v->vars;
- while (var) {
- if (strcmp(var->name,n) == 0) {
- res = (*var->get_attr)();
- break;
- }
- var = var->next;
- }
- if (res == NULL && !PyErr_Occurred()) {
- PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
- }
- return res;
-}
-
-SWIGINTERN int
-swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
- int res = 1;
- swig_globalvar *var = v->vars;
- while (var) {
- if (strcmp(var->name,n) == 0) {
- res = (*var->set_attr)(p);
- break;
- }
- var = var->next;
- }
- if (res == 1 && !PyErr_Occurred()) {
- PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
- }
- return res;
-}
-
-SWIGINTERN PyTypeObject*
-swig_varlink_type(void) {
- static char varlink__doc__[] = "Swig var link object";
- static PyTypeObject varlink_type;
- static int type_init = 0;
- if (!type_init) {
- const PyTypeObject tmp = {
-#if PY_VERSION_HEX >= 0x03000000
- PyVarObject_HEAD_INIT(NULL, 0)
-#else
- PyObject_HEAD_INIT(NULL)
- 0, /* ob_size */
-#endif
- "swigvarlink", /* tp_name */
- sizeof(swig_varlinkobject), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor) swig_varlink_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- (getattrfunc) swig_varlink_getattr, /* tp_getattr */
- (setattrfunc) swig_varlink_setattr, /* tp_setattr */
- 0, /* tp_compare */
- (reprfunc) swig_varlink_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- (reprfunc) swig_varlink_str, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- 0, /* tp_flags */
- varlink__doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
- 0, /* tp_del */
- 0, /* tp_version_tag */
-#if PY_VERSION_HEX >= 0x03040000
- 0, /* tp_finalize */
-#endif
-#ifdef COUNT_ALLOCS
- 0, /* tp_allocs */
- 0, /* tp_frees */
- 0, /* tp_maxalloc */
- 0, /* tp_prev */
- 0 /* tp_next */
-#endif
- };
- varlink_type = tmp;
- type_init = 1;
- if (PyType_Ready(&varlink_type) < 0)
- return NULL;
- }
- return &varlink_type;
-}
-
-/* Create a variable linking object for use later */
-SWIGINTERN PyObject *
-SWIG_Python_newvarlink(void) {
- swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
- if (result) {
- result->vars = 0;
- }
- return ((PyObject*) result);
-}
-
-SWIGINTERN void
-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) {
- memcpy(gv->name, name, size);
- gv->get_attr = get_attr;
- gv->set_attr = set_attr;
- gv->next = v->vars;
- }
- }
- v->vars = gv;
-}
-
-SWIGINTERN PyObject *
-SWIG_globals(void) {
- static PyObject *globals = 0;
- if (!globals) {
- globals = SWIG_newvarlink();
- }
- return globals;
-}
-
/* -----------------------------------------------------------------------------
* constants/methods manipulation
* ----------------------------------------------------------------------------- */
@@ -266,15 +62,12 @@ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
}
}
-/* -----------------------------------------------------------------------------*/
-/* Fix SwigMethods to carry the callback ptrs when needed */
-/* -----------------------------------------------------------------------------*/
+/* -----------------------------------------------------------------------------
+ * Patch %callback methods' docstrings to hold the callback ptrs
+ * -----------------------------------------------------------------------------*/
SWIGINTERN void
-SWIG_Python_FixMethods(PyMethodDef *methods,
- swig_const_info *const_table,
- swig_type_info **types,
- swig_type_info **types_initial) {
+SWIG_Python_FixMethods(PyMethodDef *methods, const swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) {
size_t i;
for (i = 0; methods[i].ml_name; ++i) {
const char *c = methods[i].ml_doc;
@@ -282,7 +75,7 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
c = strstr(c, "swig_ptr: ");
if (c) {
int j;
- swig_const_info *ci = 0;
+ const swig_const_info *ci = 0;
const char *name = c + 10;
for (j = 0; const_table[j].type; ++j) {
if (strncmp(const_table[j].name, name,
@@ -314,6 +107,20 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
}
}
+#ifdef __cplusplus
+}
+#endif
+
+%}
+
+#if defined SWIGPYTHON_FASTPROXY && !defined SWIGPYTHON_BUILTIN
+
+%init %{
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* -----------------------------------------------------------------------------
* Method creation and docstring support functions
* ----------------------------------------------------------------------------- */
@@ -376,6 +183,12 @@ SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyO
}
#endif
+%}
+
+#endif
+
+%init %{
+
/* -----------------------------------------------------------------------------*
* Partial Init method
* -----------------------------------------------------------------------------*/
diff --git a/linux-x86/share/swig/python/pyname_compat.i b/linux-x86/share/swig/python/pyname_compat.i
index a9630db..789b284 100644
--- a/linux-x86/share/swig/python/pyname_compat.i
+++ b/linux-x86/share/swig/python/pyname_compat.i
@@ -25,7 +25,6 @@
*/
%fragment("PySequence_Base", "header", fragment="SwigPySequence_Base") {}
-%fragment("PySequence_Cont", "header", fragment="SwigPySequence_Cont") {}
%fragment("PySwigIterator_T", "header", fragment="SwigPyIterator_T") {}
%fragment("PyPairBoolOutputIterator", "header", fragment="SwigPyPairBoolOutputIterator") {}
%fragment("PySwigIterator", "header", fragment="SwigPyIterator") {}
@@ -38,11 +37,6 @@
#define PyObject_ptr SwigPtr_PyObject
#define PyObject_var SwigVar_PyObject
#define PyOper SwigPyOper
-#define PySeq SwigPySeq
-#define PySequence_ArrowProxy SwigPySequence_ArrowProxy
-#define PySequence_Cont SwigPySequence_Cont
-#define PySequence_InputIterator SwigPySequence_InputIterator
-#define PySequence_Ref SwigPySequence_Ref
#define PySwigClientData SwigPyClientData
#define PySwigClientData_Del SwigPyClientData_Del
#define PySwigClientData_New SwigPyClientData_New
@@ -79,7 +73,6 @@
#define PySwigPacked_repr SwigPyPacked_repr
#define PySwigPacked_str SwigPyPacked_str
#define PySwigPacked_type SwigPyPacked_type
-#define pyseq swigpyseq
#define pyswigobject_type swigpyobject_type
#define pyswigpacked_type swigpypacked_type
%}
diff --git a/linux-x86/share/swig/python/pyprimtypes.swg b/linux-x86/share/swig/python/pyprimtypes.swg
index 6a01af1..7f37275 100644
--- a/linux-x86/share/swig/python/pyprimtypes.swg
+++ b/linux-x86/share/swig/python/pyprimtypes.swg
@@ -104,7 +104,12 @@ SWIG_AsVal_dec(long)(PyObject *obj, long* val)
if (!dispatch) {
double d;
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+ // Largest double not larger than LONG_MAX (not portably calculated easily)
+ // Note that double(LONG_MAX) is stored in a double rounded up by one (for 64-bit long)
+ // 0x7ffffffffffffc00LL == (int64_t)std::nextafter(double(__uint128_t(LONG_MAX)+1), double(0))
+ const double long_max = sizeof(long) == 8 ? 0x7ffffffffffffc00LL : LONG_MAX;
+ // No equivalent needed for 64-bit double(LONG_MIN) is exactly LONG_MIN
+ if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, long_max)) {
if (val) *val = (long)(d);
return res;
}
@@ -166,7 +171,11 @@ SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val)
if (!dispatch) {
double d;
int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+ // Largest double not larger than ULONG_MAX (not portably calculated easily)
+ // Note that double(ULONG_MAX) is stored in a double rounded up by one (for 64-bit unsigned long)
+ // 0xfffffffffffff800ULL == (uint64_t)std::nextafter(double(__uint128_t(ULONG_MAX)+1), double(0))
+ const double ulong_max = sizeof(unsigned long) == 8 ? 0xfffffffffffff800ULL : ULONG_MAX;
+ if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ulong_max)) {
if (val) *val = (unsigned long)(d);
return res;
}
diff --git a/linux-x86/share/swig/python/pyrun.swg b/linux-x86/share/swig/python/pyrun.swg
index 445a1e3..af60c2b 100644
--- a/linux-x86/share/swig/python/pyrun.swg
+++ b/linux-x86/share/swig/python/pyrun.swg
@@ -11,8 +11,8 @@
# 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"
+#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000
+# error "This version of SWIG only supports Python 3 >= 3.3"
#endif
/* Common SWIG API */
@@ -127,7 +127,12 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
if (!PyList_Check(result)) {
PyObject *o2 = result;
result = PyList_New(1);
- PyList_SetItem(result, 0, o2);
+ if (result) {
+ PyList_SET_ITEM(result, 0, o2);
+ } else {
+ Py_DECREF(obj);
+ return o2;
+ }
}
PyList_Append(result,obj);
Py_DECREF(obj);
@@ -183,6 +188,19 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
}
}
+SWIGINTERN int
+SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name) {
+ int no_kwargs = 1;
+ if (kwargs) {
+ assert(PyDict_Check(kwargs));
+ if (PyDict_Size(kwargs) > 0) {
+ PyErr_Format(PyExc_TypeError, "%s() does not take keyword arguments", name);
+ no_kwargs = 0;
+ }
+ }
+ return no_kwargs;
+}
+
/* A functor is a function object with one single object argument */
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
@@ -196,6 +214,261 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Python-specific SWIG API */
+#define SWIG_newvarlink() SWIG_Python_newvarlink()
+#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
+#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
+
+/* -----------------------------------------------------------------------------
+ * global variable support code.
+ * ----------------------------------------------------------------------------- */
+
+typedef struct swig_globalvar {
+ char *name; /* Name of global variable */
+ PyObject *(*get_attr)(void); /* Return the current value */
+ int (*set_attr)(PyObject *); /* Set the value */
+ struct swig_globalvar *next;
+} swig_globalvar;
+
+typedef struct swig_varlinkobject {
+ PyObject_HEAD
+ swig_globalvar *vars;
+} swig_varlinkobject;
+
+SWIGINTERN PyObject *
+swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) {
+#if PY_VERSION_HEX >= 0x03000000
+ return PyUnicode_InternFromString("<Swig global variables>");
+#else
+ return PyString_FromString("<Swig global variables>");
+#endif
+}
+
+SWIGINTERN PyObject *
+swig_varlink_str(PyObject *o) {
+ swig_varlinkobject *v = (swig_varlinkobject *) o;
+#if PY_VERSION_HEX >= 0x03000000
+ PyObject *str = PyUnicode_InternFromString("(");
+ PyObject *tail;
+ PyObject *joined;
+ swig_globalvar *var;
+ for (var = v->vars; var; var=var->next) {
+ tail = PyUnicode_FromString(var->name);
+ joined = PyUnicode_Concat(str, tail);
+ Py_DecRef(str);
+ Py_DecRef(tail);
+ str = joined;
+ if (var->next) {
+ tail = PyUnicode_InternFromString(", ");
+ joined = PyUnicode_Concat(str, tail);
+ Py_DecRef(str);
+ Py_DecRef(tail);
+ str = joined;
+ }
+ }
+ tail = PyUnicode_InternFromString(")");
+ joined = PyUnicode_Concat(str, tail);
+ Py_DecRef(str);
+ Py_DecRef(tail);
+ str = joined;
+#else
+ PyObject *str = PyString_FromString("(");
+ swig_globalvar *var;
+ for (var = v->vars; var; var=var->next) {
+ PyString_ConcatAndDel(&str,PyString_FromString(var->name));
+ if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
+ }
+ PyString_ConcatAndDel(&str,PyString_FromString(")"));
+#endif
+ return str;
+}
+
+SWIGINTERN void
+swig_varlink_dealloc(PyObject *o) {
+ swig_varlinkobject *v = (swig_varlinkobject *) o;
+ swig_globalvar *var = v->vars;
+ while (var) {
+ swig_globalvar *n = var->next;
+ free(var->name);
+ free(var);
+ var = n;
+ }
+}
+
+SWIGINTERN PyObject *
+swig_varlink_getattr(PyObject *o, char *n) {
+ swig_varlinkobject *v = (swig_varlinkobject *) o;
+ PyObject *res = NULL;
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name,n) == 0) {
+ res = (*var->get_attr)();
+ break;
+ }
+ var = var->next;
+ }
+ if (res == NULL && !PyErr_Occurred()) {
+ PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
+ }
+ return res;
+}
+
+SWIGINTERN int
+swig_varlink_setattr(PyObject *o, char *n, PyObject *p) {
+ swig_varlinkobject *v = (swig_varlinkobject *) o;
+ int res = 1;
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name,n) == 0) {
+ res = (*var->set_attr)(p);
+ break;
+ }
+ var = var->next;
+ }
+ if (res == 1 && !PyErr_Occurred()) {
+ PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
+ }
+ return res;
+}
+
+SWIGINTERN PyTypeObject*
+swig_varlink_type(void) {
+ static char varlink__doc__[] = "Swig var link object";
+#ifndef Py_LIMITED_API
+ static PyTypeObject varlink_type;
+ static int type_init = 0;
+ if (!type_init) {
+ const PyTypeObject tmp = {
+#if PY_VERSION_HEX >= 0x03000000
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+#endif
+ "swigvarlink", /* tp_name */
+ sizeof(swig_varlinkobject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor) swig_varlink_dealloc, /* tp_dealloc */
+#if PY_VERSION_HEX < 0x030800b4
+ (printfunc)0, /*tp_print*/
+#else
+ (Py_ssize_t)0, /*tp_vectorcall_offset*/
+#endif
+ (getattrfunc) swig_varlink_getattr, /* tp_getattr */
+ (setattrfunc) swig_varlink_setattr, /* tp_setattr */
+ 0, /* tp_compare */
+ (reprfunc) swig_varlink_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ (reprfunc) swig_varlink_str, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ 0, /* tp_flags */
+ varlink__doc__, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
+ 0, /* tp_del */
+ 0, /* tp_version_tag */
+#if PY_VERSION_HEX >= 0x03040000
+ 0, /* tp_finalize */
+#endif
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+ 0, /* tp_print */
+#endif
+#if PY_VERSION_HEX >= 0x030C0000
+ 0, /* tp_watched */
+#endif
+#ifdef COUNT_ALLOCS
+ 0, /* tp_allocs */
+ 0, /* tp_frees */
+ 0, /* tp_maxalloc */
+ 0, /* tp_prev */
+ 0 /* tp_next */
+#endif
+ };
+ varlink_type = tmp;
+ type_init = 1;
+ if (PyType_Ready(&varlink_type) < 0)
+ return NULL;
+ }
+ return &varlink_type;
+#else
+ PyType_Slot slots[] = {
+ { Py_tp_dealloc, (void *)swig_varlink_dealloc },
+ { Py_tp_repr, (void *)swig_varlink_repr },
+ { Py_tp_getattr, (void *)swig_varlink_getattr },
+ { Py_tp_setattr, (void *)swig_varlink_setattr },
+ { Py_tp_str, (void *)swig_varlink_str },
+ { Py_tp_doc, (void *)varlink__doc__ },
+ { 0, NULL }
+ };
+ PyType_Spec spec = {
+ "swigvarlink",
+ sizeof(swig_varlinkobject),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ slots
+ };
+ return (PyTypeObject *)PyType_FromSpec(&spec);
+#endif
+}
+
+/* Create a variable linking object for use later */
+SWIGINTERN PyObject *
+SWIG_Python_newvarlink(void) {
+ swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type());
+ if (result) {
+ result->vars = 0;
+ }
+ return ((PyObject*) result);
+}
+
+SWIGINTERN void
+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) {
+ memcpy(gv->name, name, size);
+ gv->get_attr = get_attr;
+ gv->set_attr = set_attr;
+ gv->next = v->vars;
+ }
+ }
+ v->vars = gv;
+}
+
+
+static PyObject *Swig_Globals_global = NULL;
+
+SWIGINTERN PyObject *
+SWIG_globals(void) {
+ if (Swig_Globals_global == NULL) {
+ Swig_Globals_global = SWIG_newvarlink();
+ }
+ return Swig_Globals_global;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
/* -----------------------------------------------------------------------------
* Pointer declarations
* ----------------------------------------------------------------------------- */
@@ -266,18 +539,25 @@ SwigPyClientData_New(PyObject* obj)
/* the newraw method and newargs arguments used to create a new raw instance */
if (PyClass_Check(obj)) {
data->newraw = 0;
- data->newargs = obj;
Py_INCREF(obj);
+ data->newargs = obj;
} else {
data->newraw = PyObject_GetAttrString(data->klass, "__new__");
if (data->newraw) {
- Py_INCREF(data->newraw);
- data->newargs = PyTuple_New(1);
- PyTuple_SetItem(data->newargs, 0, obj);
+ data->newargs = PyTuple_New(1);
+ if (data->newargs) {
+ Py_INCREF(obj);
+ PyTuple_SET_ITEM(data->newargs, 0, obj);
+ } else {
+ Py_DECREF(data->newraw);
+ Py_DECREF(data->klass);
+ free(data);
+ return 0;
+ }
} else {
- data->newargs = obj;
+ Py_INCREF(obj);
+ data->newargs = obj;
}
- Py_INCREF(data->newargs);
}
/* the destroy method, aka as the C++ delete method */
data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
@@ -286,10 +566,7 @@ SwigPyClientData_New(PyObject* obj)
data->destroy = 0;
}
if (data->destroy) {
- int flags;
- Py_INCREF(data->destroy);
- flags = PyCFunction_GET_FLAGS(data->destroy);
- data->delargs = !(flags & (METH_O));
+ data->delargs = !(PyCFunction_GET_FLAGS(data->destroy) & METH_O);
} else {
data->delargs = 0;
}
@@ -300,10 +577,13 @@ SwigPyClientData_New(PyObject* obj)
}
SWIGRUNTIME void
-SwigPyClientData_Del(SwigPyClientData *data) {
+SwigPyClientData_Del(SwigPyClientData *data)
+{
+ Py_XDECREF(data->klass);
Py_XDECREF(data->newraw);
Py_XDECREF(data->newargs);
Py_XDECREF(data->destroy);
+ free(data);
}
/* =============== SwigPyObject =====================*/
@@ -330,7 +610,7 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
if (!sobj->dict)
sobj->dict = PyDict_New();
- Py_INCREF(sobj->dict);
+ Py_XINCREF(sobj->dict);
return sobj->dict;
}
@@ -348,18 +628,21 @@ SwigPyObject_format(const char* fmt, SwigPyObject *v)
PyObject *res = NULL;
PyObject *args = PyTuple_New(1);
if (args) {
- if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
- PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
+ PyObject *val = SwigPyObject_long(v);
+ if (val) {
+ PyObject *ofmt;
+ PyTuple_SET_ITEM(args, 0, val);
+ ofmt = SWIG_Python_str_FromChar(fmt);
if (ofmt) {
#if PY_VERSION_HEX >= 0x03000000
- res = PyUnicode_Format(ofmt,args);
+ res = PyUnicode_Format(ofmt,args);
#else
- res = PyString_Format(ofmt,args);
+ res = PyString_Format(ofmt,args);
#endif
- Py_DECREF(ofmt);
+ Py_DECREF(ofmt);
}
- Py_DECREF(args);
}
+ Py_DECREF(args);
}
return res;
}
@@ -381,18 +664,23 @@ SwigPyObject_repr(SwigPyObject *v)
{
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) {
+ if (repr && v->next) {
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
+ if (nrep) {
# if PY_VERSION_HEX >= 0x03000000
- PyObject *joined = PyUnicode_Concat(repr, nrep);
- Py_DecRef(repr);
- Py_DecRef(nrep);
- repr = joined;
+ PyObject *joined = PyUnicode_Concat(repr, nrep);
+ Py_DecRef(repr);
+ Py_DecRef(nrep);
+ repr = joined;
# else
- PyString_ConcatAndDel(&repr,nrep);
+ PyString_ConcatAndDel(&repr,nrep);
# endif
+ } else {
+ Py_DecRef(repr);
+ repr = NULL;
+ }
}
- return repr;
+ return repr;
}
/* We need a version taking two PyObject* parameters so it's a valid
@@ -415,12 +703,14 @@ SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
SWIGRUNTIME PyObject*
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
{
- PyObject* res;
- if( op != Py_EQ && op != Py_NE ) {
- Py_INCREF(Py_NotImplemented);
- return Py_NotImplemented;
+ PyObject* res = NULL;
+ if (!PyErr_Occurred()) {
+ if (op != Py_EQ && op != Py_NE) {
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
+ }
+ res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
}
- res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
return res;
}
@@ -448,20 +738,34 @@ SwigPyObject_type(void) {
SWIGRUNTIMEINLINE int
SwigPyObject_Check(PyObject *op) {
-#ifdef SWIGPYTHON_BUILTIN
PyTypeObject *target_tp = SwigPyObject_type();
- if (PyType_IsSubtype(op->ob_type, target_tp))
+ PyTypeObject *op_type = Py_TYPE(op);
+#ifdef SWIGPYTHON_BUILTIN
+ if (PyType_IsSubtype(op_type, target_tp))
return 1;
- return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
+ return (strcmp(op_type->tp_name, "SwigPyObject") == 0);
#else
- return (Py_TYPE(op) == SwigPyObject_type())
- || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
+ if (op_type == target_tp)
+ return 1;
+# ifdef Py_LIMITED_API
+ int cmp;
+ PyObject *tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__");
+ if (!tp_name)
+ return 0;
+ cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject");
+ Py_DECREF(tp_name);
+ return cmp == 0;
+# else
+ return (strcmp(op_type->tp_name, "SwigPyObject") == 0);
+# endif
#endif
}
SWIGRUNTIME PyObject *
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
+static PyObject* Swig_Capsule_global = NULL;
+
SWIGRUNTIME void
SwigPyObject_dealloc(PyObject *v)
{
@@ -488,8 +792,12 @@ SwigPyObject_dealloc(PyObject *v)
if (data->delargs) {
/* we need to create a temporary object to carry the destroy operation */
PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
- res = SWIG_Python_CallFunctor(destroy, tmp);
- Py_DECREF(tmp);
+ if (tmp) {
+ res = SWIG_Python_CallFunctor(destroy, tmp);
+ } else {
+ res = 0;
+ }
+ Py_XDECREF(tmp);
} else {
PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
PyObject *mself = PyCFunction_GET_SELF(destroy);
@@ -508,8 +816,12 @@ SwigPyObject_dealloc(PyObject *v)
printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
#endif
- }
+ Py_XDECREF(Swig_Capsule_global);
+ }
Py_XDECREF(next);
+#ifdef SWIGPYTHON_BUILTIN
+ Py_XDECREF(sobj->dict);
+#endif
PyObject_DEL(v);
}
@@ -521,6 +833,7 @@ SwigPyObject_append(PyObject* v, PyObject* next)
PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
return NULL;
}
+ ((SwigPyObject *)next)->next = sobj->next;
sobj->next = next;
Py_INCREF(next);
return SWIG_Py_Void();
@@ -565,9 +878,9 @@ SwigPyObject_own(PyObject *v, PyObject *args)
PyObject *obj = PyBool_FromLong(sobj->own);
if (val) {
if (PyObject_IsTrue(val)) {
- SwigPyObject_acquire(v,args);
+ Py_DECREF(SwigPyObject_acquire(v,args));
} else {
- SwigPyObject_disown(v,args);
+ Py_DECREF(SwigPyObject_disown(v,args));
}
}
return obj;
@@ -588,7 +901,7 @@ swigobject_methods[] = {
SWIGRUNTIME PyTypeObject*
SwigPyObject_TypeOnce(void) {
static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
-
+#ifndef Py_LIMITED_API
static PyNumberMethods SwigPyObject_as_number = {
(binaryfunc)0, /*nb_add*/
(binaryfunc)0, /*nb_subtract*/
@@ -647,7 +960,11 @@ SwigPyObject_TypeOnce(void) {
sizeof(SwigPyObject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyObject_dealloc, /* tp_dealloc */
- 0, /* tp_print */
+#if PY_VERSION_HEX < 0x030800b4
+ (printfunc)0, /*tp_print*/
+#else
+ (Py_ssize_t)0, /*tp_vectorcall_offset*/
+#endif
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */
#if PY_VERSION_HEX >= 0x03000000
@@ -696,6 +1013,15 @@ SwigPyObject_TypeOnce(void) {
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+ 0, /* tp_print */
+#endif
+#if PY_VERSION_HEX >= 0x030C0000
+ 0, /* tp_watched */
+#endif
#ifdef COUNT_ALLOCS
0, /* tp_allocs */
0, /* tp_frees */
@@ -706,21 +1032,50 @@ SwigPyObject_TypeOnce(void) {
};
swigpyobject_type = tmp;
type_init = 1;
- if (PyType_Ready(&swigpyobject_type) < 0)
+ if (PyType_Ready(&swigpyobject_type) != 0)
return NULL;
}
return &swigpyobject_type;
+#else
+ PyType_Slot slots[] = {
+ { Py_tp_dealloc, (void *)SwigPyObject_dealloc },
+ { Py_tp_repr, (void *)SwigPyObject_repr },
+ { Py_tp_getattro, (void *)PyObject_GenericGetAttr },
+ { Py_tp_doc, (void *)swigobject_doc },
+ { Py_tp_richcompare, (void *)SwigPyObject_richcompare },
+ { Py_tp_methods, (void *)swigobject_methods },
+ { Py_nb_int, (void *)SwigPyObject_long },
+ { 0, NULL }
+ };
+ PyType_Spec spec = {
+ "SwigPyObject",
+ sizeof(SwigPyObject),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ slots
+ };
+ return (PyTypeObject *)PyType_FromSpec(&spec);
+#endif
}
SWIGRUNTIME PyObject *
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
{
- SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
+ SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type());
if (sobj) {
sobj->ptr = ptr;
sobj->ty = ty;
sobj->own = own;
sobj->next = 0;
+#ifdef SWIGPYTHON_BUILTIN
+ sobj->dict = 0;
+#endif
+ if (own == SWIG_POINTER_OWN) {
+ /* Obtain a reference to the Python capsule wrapping the module information, so that the
+ * module information is correctly destroyed after all SWIG python objects have been freed
+ * by the GC (and corresponding destructors invoked) */
+ Py_XINCREF(Swig_Capsule_global);
+ }
}
return (PyObject *)sobj;
}
@@ -777,8 +1132,20 @@ SwigPyPacked_type(void) {
SWIGRUNTIMEINLINE int
SwigPyPacked_Check(PyObject *op) {
- return ((op)->ob_type == SwigPyPacked_TypeOnce())
- || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
+ PyTypeObject* op_type = Py_TYPE(op);
+ if (op_type == SwigPyPacked_TypeOnce())
+ return 1;
+#ifdef Py_LIMITED_API
+ int cmp;
+ PyObject *tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__");
+ if (!tp_name)
+ return 0;
+ cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked");
+ Py_DECREF(tp_name);
+ return cmp == 0;
+#else
+ return (strcmp(op_type->tp_name, "SwigPyPacked") == 0);
+#endif
}
SWIGRUNTIME void
@@ -794,6 +1161,7 @@ SwigPyPacked_dealloc(PyObject *v)
SWIGRUNTIME PyTypeObject*
SwigPyPacked_TypeOnce(void) {
static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
+#ifndef Py_LIMITED_API
static PyTypeObject swigpypacked_type;
static int type_init = 0;
if (!type_init) {
@@ -808,7 +1176,11 @@ SwigPyPacked_TypeOnce(void) {
sizeof(SwigPyPacked), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyPacked_dealloc, /* tp_dealloc */
- 0, /* tp_print */
+#if PY_VERSION_HEX < 0x030800b4
+ (printfunc)0, /*tp_print*/
+#else
+ (Py_ssize_t)0, /*tp_vectorcall_offset*/
+#endif
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */
#if PY_VERSION_HEX>=0x03000000
@@ -857,6 +1229,15 @@ SwigPyPacked_TypeOnce(void) {
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall */
+#endif
+#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
+ 0, /* tp_print */
+#endif
+#if PY_VERSION_HEX >= 0x030C0000
+ 0, /* tp_watched */
+#endif
#ifdef COUNT_ALLOCS
0, /* tp_allocs */
0, /* tp_frees */
@@ -867,16 +1248,34 @@ SwigPyPacked_TypeOnce(void) {
};
swigpypacked_type = tmp;
type_init = 1;
- if (PyType_Ready(&swigpypacked_type) < 0)
+ if (PyType_Ready(&swigpypacked_type) != 0)
return NULL;
}
return &swigpypacked_type;
+#else
+ PyType_Slot slots[] = {
+ { Py_tp_dealloc, (void *)SwigPyPacked_dealloc },
+ { Py_tp_repr, (void *)SwigPyPacked_repr },
+ { Py_tp_str, (void *)SwigPyPacked_str },
+ { Py_tp_getattro, (void *)PyObject_GenericGetAttr },
+ { Py_tp_doc, (void *)swigpacked_doc },
+ { 0, NULL }
+ };
+ PyType_Spec spec = {
+ "SwigPyPacked",
+ sizeof(SwigPyPacked),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ slots
+ };
+ return (PyTypeObject *)PyType_FromSpec(&spec);
+#endif
}
SWIGRUNTIME PyObject *
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
{
- SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
+ SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type());
if (sobj) {
void *pack = malloc(size);
if (pack) {
@@ -1057,12 +1456,19 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
if (sobj) {
- if (own)
- *own = *own | sobj->own;
- if (flags & SWIG_POINTER_DISOWN) {
- sobj->own = 0;
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !sobj->own) {
+ res = SWIG_ERROR_RELEASE_NOT_OWNED;
+ } else {
+ if (own)
+ *own = *own | sobj->own;
+ if (flags & SWIG_POINTER_DISOWN) {
+ sobj->own = 0;
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ sobj->ptr = 0;
+ }
+ res = SWIG_OK;
}
- res = SWIG_OK;
} else {
if (implicit_conv) {
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
@@ -1121,10 +1527,20 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
swig_cast_info *tc;
/* here we get the method pointer for callbacks */
+#ifndef Py_LIMITED_API
const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+#else
+ PyObject* pystr_doc = PyObject_GetAttrString(obj, "__doc__");
+ PyObject *bytes = NULL;
+ const char *doc = pystr_doc ? SWIG_PyUnicode_AsUTF8AndSize(pystr_doc, NULL, &bytes) : 0;
+#endif
const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
if (desc)
desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
+#ifdef Py_LIMITED_API
+ Py_XDECREF(bytes);
+ Py_XDECREF(pystr_doc);
+#endif
if (!desc)
return SWIG_ERROR;
tc = SWIG_TypeCheck(desc,ty);
@@ -1175,16 +1591,23 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
PyObject **dictptr = _PyObject_GetDictPtr(inst);
if (dictptr != NULL) {
- PyObject *dict = *dictptr;
- if (dict == NULL) {
- dict = PyDict_New();
- *dictptr = dict;
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- }
+ PyObject *dict = *dictptr;
+ if (dict == NULL) {
+ dict = PyDict_New();
+ *dictptr = dict;
+ }
+ if (dict) {
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ } else{
+ Py_DECREF(inst);
+ inst = 0;
+ }
}
#else
- PyObject *key = SWIG_This();
- PyObject_SetAttr(inst, key, swig_this);
+ if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
+ Py_DECREF(inst);
+ inst = 0;
+ }
#endif
}
} else {
@@ -1193,11 +1616,20 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
if (empty_args) {
PyObject *empty_kwargs = PyDict_New();
if (empty_kwargs) {
- inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
+#ifndef Py_LIMITED_API
+ newfunc newfn = ((PyTypeObject *)data->newargs)->tp_new;
+#else
+ newfunc newfn = (newfunc)PyType_GetSlot((PyTypeObject *)data->newargs, Py_tp_new);
+#endif
+ inst = newfn((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;
+ if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
+ Py_DECREF(inst);
+ inst = 0;
+ } else {
+ PyType_Modified(Py_TYPE(inst));
+ }
}
}
Py_DECREF(empty_args);
@@ -1214,25 +1646,25 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
return inst;
}
-SWIGRUNTIME void
+SWIGRUNTIME int
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
{
- PyObject *dict;
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
- PyObject **dictptr = _PyObject_GetDictPtr(inst);
- if (dictptr != NULL) {
- dict = *dictptr;
- if (dict == NULL) {
- dict = PyDict_New();
- *dictptr = dict;
- }
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- return;
- }
-#endif
- dict = PyObject_GetAttrString(inst, "__dict__");
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- Py_DECREF(dict);
+ PyObject **dictptr = _PyObject_GetDictPtr(inst);
+ if (dictptr != NULL) {
+ PyObject *dict = *dictptr;
+ if (dict == NULL) {
+ dict = PyDict_New();
+ *dictptr = dict;
+ }
+ if (dict) {
+ return PyDict_SetItem(dict, SWIG_This(), swig_this);
+ } else{
+ return -1;
+ }
+ }
+#endif
+ return PyObject_SetAttr(inst, SWIG_This(), swig_this);
}
@@ -1244,9 +1676,10 @@ SWIG_Python_InitShadowInstance(PyObject *args) {
} else {
SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
if (sthis) {
- SwigPyObject_append((PyObject*) sthis, obj[1]);
+ Py_DECREF(SwigPyObject_append((PyObject*) sthis, obj[1]));
} else {
- SWIG_Python_SetSwigThis(obj[0], obj[1]);
+ if (SWIG_Python_SetSwigThis(obj[0], obj[1]) != 0)
+ return NULL;
}
return SWIG_Py_Void();
}
@@ -1270,7 +1703,12 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f
if (flags & SWIG_BUILTIN_TP_INIT) {
newobj = (SwigPyObject*) self;
if (newobj->ptr) {
- PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
+#ifndef Py_LIMITED_API
+ allocfunc alloc = clientdata->pytype->tp_alloc;
+#else
+ allocfunc alloc = (allocfunc)PyType_GetSlot(clientdata->pytype, Py_tp_alloc);
+#endif
+ PyObject *next_self = alloc(clientdata->pytype, 0);
while (newobj->next)
newobj = (SwigPyObject *) newobj->next;
newobj->next = next_self;
@@ -1282,7 +1720,9 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f
} else {
newobj = PyObject_New(SwigPyObject, clientdata->pytype);
#ifdef SWIGPYTHON_BUILTIN
- newobj->dict = 0;
+ if (newobj) {
+ newobj->dict = 0;
+ }
#endif
}
if (newobj) {
@@ -1321,39 +1761,61 @@ SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
void *SWIG_ReturnGlobalTypeList(void *);
#endif
+static PyObject *Swig_TypeCache_global = NULL;
+
+/* The python cached type query */
+SWIGRUNTIME PyObject *
+SWIG_Python_TypeCache(void) {
+ if (Swig_TypeCache_global == NULL) {
+ Swig_TypeCache_global = PyDict_New();
+ }
+ return Swig_TypeCache_global;
+}
+
SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+#ifdef SWIG_LINK_RUNTIME
static void *type_pointer = (void *)0;
/* first check if module already created */
if (!type_pointer) {
-#ifdef SWIG_LINK_RUNTIME
type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
+ }
#else
- type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
- if (PyErr_Occurred()) {
- PyErr_Clear();
- type_pointer = (void *)0;
- }
-#endif
+ void *type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ type_pointer = (void *)0;
}
+#endif
return (swig_module_info *) type_pointer;
}
+
+static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */
+
SWIGRUNTIME void
SWIG_Python_DestroyModule(PyObject *obj)
{
swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
swig_type_info **types = swig_module->types;
size_t i;
+ if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */
+ return;
for (i =0; i < swig_module->size; ++i) {
swig_type_info *ty = types[i];
if (ty->owndata) {
SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
+ ty->clientdata = 0;
if (data) SwigPyClientData_Del(data);
}
}
Py_DECREF(SWIG_This());
Swig_This_global = NULL;
+ Py_DECREF(SWIG_globals());
+ Swig_Globals_global = NULL;
+ Py_DECREF(SWIG_Python_TypeCache());
+ Swig_TypeCache_global = NULL;
+ Swig_Capsule_global = NULL;
}
SWIGRUNTIME void
@@ -1367,19 +1829,17 @@ SWIG_Python_SetModule(swig_module_info *swig_module) {
#endif
PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
if (pointer && module) {
- PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
+ if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) {
+ ++interpreter_counter;
+ Swig_Capsule_global = pointer;
+ } else {
+ Py_DECREF(pointer);
+ }
} else {
Py_XDECREF(pointer);
}
}
-/* The python cached type query */
-SWIGRUNTIME PyObject *
-SWIG_Python_TypeCache(void) {
- static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
- return cache;
-}
-
SWIGRUNTIME swig_type_info *
SWIG_Python_TypeQuery(const char *type)
{
@@ -1394,8 +1854,10 @@ SWIG_Python_TypeQuery(const char *type)
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) {
obj = PyCapsule_New((void*) descriptor, NULL, NULL);
- PyDict_SetItem(cache, key, obj);
- Py_DECREF(obj);
+ if (obj) {
+ PyDict_SetItem(cache, key, obj);
+ Py_DECREF(obj);
+ }
}
}
Py_DECREF(key);
@@ -1419,7 +1881,8 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront)
PyErr_Fetch(&type, &value, &traceback);
if (value) {
PyObject *old_str = PyObject_Str(value);
- const char *tmp = SWIG_Python_str_AsChar(old_str);
+ PyObject *bytes = NULL;
+ const char *tmp = SWIG_PyUnicode_AsUTF8AndSize(old_str, NULL, &bytes);
const char *errmesg = tmp ? tmp : "Invalid error message";
Py_XINCREF(type);
PyErr_Clear();
@@ -1428,7 +1891,7 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront)
} else {
PyErr_Format(type, "%s %s", errmesg, mesg);
}
- SWIG_Python_str_DelForPy3(tmp);
+ Py_XDECREF(bytes);
Py_DECREF(old_str);
}
return 1;
@@ -1473,21 +1936,25 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
} else
#endif
{
+#ifndef Py_LIMITED_API
+ /* tp_name is not accessible */
const char *otype = (obj ? obj->ob_type->tp_name : 0);
if (otype) {
PyObject *str = PyObject_Str(obj);
- const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
+ PyObject *bytes = NULL;
+ const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0;
if (cstr) {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
type, otype, cstr);
- SWIG_Python_str_DelForPy3(cstr);
} else {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
type, otype);
}
+ Py_XDECREF(bytes);
Py_XDECREF(str);
return;
}
+#endif
}
PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
} else {
@@ -1502,12 +1969,6 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg
void *result;
if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
PyErr_Clear();
-#if SWIG_POINTER_EXCEPTION
- if (flags) {
- SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
- SWIG_Python_ArgFail(argnum);
- }
-#endif
}
return result;
}
@@ -1538,7 +1999,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
}
if (!tp->tp_dict) {
- if (PyType_Ready(tp) < 0)
+ if (PyType_Ready(tp) != 0)
goto done;
}
@@ -1553,7 +2014,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
} else {
encoded_name = PyUnicode_AsUTF8String(name);
if (!encoded_name)
- return -1;
+ goto done;
}
PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
Py_DECREF(encoded_name);
diff --git a/linux-x86/share/swig/python/pyruntime.swg b/linux-x86/share/swig/python/pyruntime.swg
index 751bc8d..3f45af8 100644
--- a/linux-x86/share/swig/python/pyruntime.swg
+++ b/linux-x86/share/swig/python/pyruntime.swg
@@ -4,14 +4,38 @@
# include <math.h>
#endif
+#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN)
+#define PY_SSIZE_T_CLEAN
+#endif
+
+#if __GNUC__ >= 7
+#pragma GCC diagnostic push
+#if defined(__cplusplus) && __cplusplus >=201703L
+#pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */
+#endif
+#endif
+
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
+
+#if defined(_MSC_VER) && _MSC_VER >= 1929
+/* Workaround compilation errors when redefining _DEBUG in MSVC 2019 version 16.10 and later
+ * See https://github.com/swig/swig/issues/2090 */
+# include <corecrt.h>
+#endif
+
# undef _DEBUG
# include <Python.h>
# define _DEBUG 1
#else
# include <Python.h>
#endif
+
+#if __GNUC__ >= 7
+#pragma GCC diagnostic pop
+#endif
+
+#include <stdio.h>
%}
%insert(runtime) "swigrun.swg"; /* SWIG API */
diff --git a/linux-x86/share/swig/python/pystdcommon.swg b/linux-x86/share/swig/python/pystdcommon.swg
index 0242e4d..afa7135 100644
--- a/linux-x86/share/swig/python/pystdcommon.swg
+++ b/linux-x86/share/swig/python/pystdcommon.swg
@@ -45,11 +45,20 @@ namespace swig {
template <class Type>
struct traits_asptr {
static int asptr(PyObject *obj, Type **val) {
- Type *p = 0;
+ int res = SWIG_ERROR;
swig_type_info *descriptor = type_info<Type>();
- int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
- if (SWIG_IsOK(res)) {
- if (val) *val = p;
+ if (val) {
+ Type *p = 0;
+ int newmem = 0;
+ res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR;
+ if (SWIG_IsOK(res)) {
+ if (newmem & SWIG_CAST_NEW_MEMORY) {
+ res |= SWIG_NEWOBJMASK;
+ }
+ *val = p;
+ }
+ } else {
+ res = descriptor ? SWIG_ConvertPtr(obj, 0, descriptor, 0) : SWIG_ERROR;
}
return res;
}
diff --git a/linux-x86/share/swig/python/pystrings.swg b/linux-x86/share/swig/python/pystrings.swg
index 93f48ac..1cb4e99 100644
--- a/linux-x86/share/swig/python/pystrings.swg
+++ b/linux-x86/share/swig/python/pystrings.swg
@@ -2,8 +2,10 @@
* utility methods for char strings
* ------------------------------------------------------------ */
%fragment("SWIG_AsCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") {
+/* Return string from Python obj. NOTE: obj must remain in scope in order
+ to use the returned cptr (but only when alloc is set to SWIG_OLDOBJ) */
SWIGINTERN int
-SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
+SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc)
{
%#if PY_VERSION_HEX>=0x03000000
%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
@@ -16,53 +18,31 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
%#endif
{
char *cstr; Py_ssize_t len;
+ PyObject *bytes = NULL;
int ret = SWIG_OK;
-%#if PY_VERSION_HEX>=0x03000000
-%#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
- if (!alloc && cptr) {
- /* We can't allow converting without allocation, since the internal
- representation of string in Python 3 is UCS-2/UCS-4 but we require
- a UTF-8 representation.
- TODO(bhy) More detailed explanation */
- return SWIG_RuntimeError;
- }
- obj = PyUnicode_AsUTF8String(obj);
- if (!obj)
- return SWIG_TypeError;
if (alloc)
- *alloc = SWIG_NEWOBJ;
-%#endif
- PyBytes_AsStringAndSize(obj, &cstr, &len);
+ *alloc = SWIG_OLDOBJ;
+%#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
+ if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1)
+ return SWIG_TypeError;
%#else
- PyString_AsStringAndSize(obj, &cstr, &len);
-%#endif
- if (cptr) {
+ cstr = (char *)SWIG_PyUnicode_AsUTF8AndSize(obj, &len, &bytes);
+ if (!cstr)
+ return SWIG_TypeError;
+ /* The returned string is only duplicated if the char * returned is not owned and memory managed by obj */
+ if (bytes && cptr) {
if (alloc) {
- if (*alloc == SWIG_NEWOBJ) {
- *cptr = %new_copy_array(cstr, len + 1, char);
- *alloc = SWIG_NEWOBJ;
- } else {
- *cptr = cstr;
- *alloc = SWIG_OLDOBJ;
- }
+ cstr = %new_copy_array(cstr, len + 1, char);
+ *alloc = SWIG_NEWOBJ;
} else {
-%#if PY_VERSION_HEX>=0x03000000
-%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
- *cptr = PyBytes_AsString(obj);
-%#else
- assert(0); /* Should never reach here with Unicode strings in Python 3 */
-%#endif
-%#else
- *cptr = SWIG_Python_str_AsChar(obj);
- if (!*cptr)
- ret = SWIG_TypeError;
-%#endif
+ /* alloc must be set in order to clean up allocated memory */
+ return SWIG_RuntimeError;
}
}
- if (psize) *psize = len + 1;
-%#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
- Py_XDECREF(obj);
%#endif
+ if (cptr) *cptr = cstr;
+ if (psize) *psize = len + 1;
+ Py_XDECREF(bytes);
return ret;
} else {
%#if defined(SWIG_PYTHON_2_UNICODE)
diff --git a/linux-x86/share/swig/python/pythonkw.swg b/linux-x86/share/swig/python/pythonkw.swg
index 0138e40..a210345 100644
--- a/linux-x86/share/swig/python/pythonkw.swg
+++ b/linux-x86/share/swig/python/pythonkw.swg
@@ -2,7 +2,7 @@
Warnings for Python keywords, built-in names and bad names.
*/
-#define PYTHONKW(x) %keywordwarn("'" `x` "' is a python keyword, renaming to '_" `x` "'", rename="_%s") `x`
+#define PYTHONKW(x) %keywordwarn("'" `x` "' is a python keyword", rename="_%s") `x`
#define PYTHONBN(x) %builtinwarn("'" `x` "' conflicts with a built-in name in python") `x`
diff --git a/linux-x86/share/swig/python/pythreads.swg b/linux-x86/share/swig/python/pythreads.swg
index d8797e6..96a6471 100644
--- a/linux-x86/share/swig/python/pythreads.swg
+++ b/linux-x86/share/swig/python/pythreads.swg
@@ -8,8 +8,12 @@
# define SWIG_PYTHON_USE_GIL
# endif
# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
-# ifndef SWIG_PYTHON_INITIALIZE_THREADS
-# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
+# if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
+# if PY_VERSION_HEX < 0x03070000
+# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
+# else
+# define SWIG_PYTHON_INITIALIZE_THREADS
+# endif
# endif
# ifdef __cplusplus /* C++ code */
class SWIG_Python_Thread_Block {
@@ -24,7 +28,7 @@
bool status;
PyThreadState *save;
public:
- void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
+ void end() { if (status) { status = false; PyEval_RestoreThread(save); }}
SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
~SWIG_Python_Thread_Allow() { end(); }
};
diff --git a/linux-x86/share/swig/python/pytypemaps.swg b/linux-x86/share/swig/python/pytypemaps.swg
index 0eda17c..0ae25a6 100644
--- a/linux-x86/share/swig/python/pytypemaps.swg
+++ b/linux-x86/share/swig/python/pytypemaps.swg
@@ -83,7 +83,7 @@
{ SWIG_PY_POINTER, "$symname", 0, 0, (void *)($value), &$descriptor }
%typemap(consttab) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY));
-%typemap(constcode) SWIGTYPE ((*)(ANY)) "";
+%typemap(constcode) SWIGTYPE ((*)(ANY)) ""
%typemap(constcode) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY));
diff --git a/linux-x86/share/swig/python/std_array.i b/linux-x86/share/swig/python/std_array.i
index a3de312..707b354 100644
--- a/linux-x86/share/swig/python/std_array.i
+++ b/linux-x86/share/swig/python/std_array.i
@@ -19,15 +19,43 @@
}
};
- template <class SwigPySeq, class T, size_t N>
- inline void
- assign(const SwigPySeq& swigpyseq, std::array<T, N>* seq) {
- if (swigpyseq.size() < seq->size())
- throw std::invalid_argument("std::array cannot be expanded in size");
- else if (swigpyseq.size() > seq->size())
- throw std::invalid_argument("std::array cannot be reduced in size");
- std::copy(swigpyseq.begin(), swigpyseq.end(), seq->begin());
- }
+ template <class T, size_t N>
+ struct IteratorProtocol<std::array<T, N>, T> {
+
+ static void assign(PyObject *obj, std::array<T, N> *seq) {
+ SwigVar_PyObject iter = PyObject_GetIter(obj);
+ if (iter) {
+ SwigVar_PyObject item = PyIter_Next(iter);
+ size_t count = 0;
+ typename std::array<T, N>::iterator array_iter = seq->begin();
+ while (item && (count < N)) {
+ ++count;
+ *array_iter++ = swig::as<T>(item);
+ item = PyIter_Next(iter);
+ }
+ if (count != N || item)
+ throw std::invalid_argument("std::array size does not match source container size");
+ }
+ }
+
+ static bool check(PyObject *obj) {
+ bool ret = false;
+ SwigVar_PyObject iter = PyObject_GetIter(obj);
+ if (iter) {
+ SwigVar_PyObject item = PyIter_Next(iter);
+ size_t count = 0;
+ ret = true;
+ while (item && (count < N)) {
+ ++count;
+ ret = swig::check<T>(item);
+ item = ret ? PyIter_Next(iter) : 0;
+ }
+ if (count != N || item)
+ ret = false;
+ }
+ return ret;
+ }
+ };
template <class T, size_t N>
inline void
diff --git a/linux-x86/share/swig/python/std_auto_ptr.i b/linux-x86/share/swig/python/std_auto_ptr.i
index e310e00..3d7ae8b 100644
--- a/linux-x86/share/swig/python/std_auto_ptr.i
+++ b/linux-x86/share/swig/python/std_auto_ptr.i
@@ -1,17 +1,39 @@
-/*
- The typemaps here allow to handle functions returning std::auto_ptr<>,
- which is the most common use of this type. If you have functions taking it
- as parameter, these typemaps can't be used for them and you need to do
- something else (e.g. use shared_ptr<> which SWIG supports fully).
- */
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
%define %auto_ptr(TYPE)
-%typemap (out) std::auto_ptr<TYPE > %{
- %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
%}
-%template() std::auto_ptr<TYPE >;
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
%enddef
namespace std {
- template <class T> class auto_ptr {};
-}
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/python/std_carray.i b/linux-x86/share/swig/python/std_carray.i
deleted file mode 100644
index 680d671..0000000
--- a/linux-x86/share/swig/python/std_carray.i
+++ /dev/null
@@ -1,54 +0,0 @@
-%include <pycontainer.swg>
-
-
-%fragment("StdCarrayTraits","header",fragment="StdSequenceTraits")
-{
-namespace swig {
- template <class T, size_t S>
- struct traits_asptr<std::carray<T, S> > {
- static int asptr(PyObject *obj, std::carray<T, S> **array) {
- return traits_asptr_stdseq<std::carray<T, S> >::asptr(obj, array);
- }
- };
-}
-}
-
-%warnfilter(SWIGWARN_IGNORE_OPERATOR_INDEX) std::carray::operator[];
-
-%extend std::carray {
- %fragment(SWIG_Traits_frag(std::carray<_Type, _Size >), "header",
- fragment="SwigPyIterator_T",
- fragment=SWIG_Traits_frag(_Type),
- fragment="StdCarrayTraits") {
- namespace swig {
- template <> struct traits<std::carray<_Type, _Size > > {
- typedef pointer_category category;
- static const char* type_name() {
- return "std::carray<" #_Type "," #_Size " >";
- }
- };
- }
- }
-
- %typemaps_asptr(SWIG_TYPECHECK_VECTOR, swig::asptr,
- SWIG_Traits_frag(std::carray<_Type, _Size >),
- std::carray<_Type, _Size >);
-
- %typemap(out,noblock=1) iterator, const_iterator {
- $result = SWIG_NewPointerObj(swig::make_output_iterator((const $type &)$1),
- swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
- }
-
- inline size_t __len__() const { return self->size(); }
-
- inline const _Type& __getitem__(size_t i) const { return (*self)[i]; }
-
- inline void __setitem__(size_t i, const _Type& v) { (*self)[i] = v; }
-
-
- swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) {
- return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
- }
-}
-
-%include <std/std_carray.swg>
diff --git a/linux-x86/share/swig/python/std_filesystem.i b/linux-x86/share/swig/python/std_filesystem.i
new file mode 100644
index 0000000..5b9f335
--- /dev/null
+++ b/linux-x86/share/swig/python/std_filesystem.i
@@ -0,0 +1,121 @@
+/* -----------------------------------------------------------------------------
+ * std_filesystem.i
+ *
+ * SWIG typemaps for std::filesystem::path
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <filesystem>
+%}
+
+%fragment("SWIG_std_filesystem", "header") {
+SWIGINTERN PyObject *SWIG_std_filesystem_importPathClass() {
+ PyObject *module = PyImport_ImportModule("pathlib");
+ PyObject *cls = PyObject_GetAttrString(module, "Path");
+ Py_DECREF(module);
+ return cls;
+}
+
+SWIGINTERN bool SWIG_std_filesystem_isPathInstance(PyObject *obj) {
+ PyObject *cls = SWIG_std_filesystem_importPathClass();
+ bool is_instance = PyObject_IsInstance(obj, cls);
+ Py_DECREF(cls);
+ return is_instance;
+}
+}
+
+%typemap(in, fragment="SWIG_std_filesystem", fragment="<type_traits>") std::filesystem::path {
+ if (PyUnicode_Check($input)) {
+ PyObject *bytes = NULL;
+ const char *s = SWIG_PyUnicode_AsUTF8AndSize($input, NULL, &bytes);
+ $1 = std::filesystem::path(s);
+ Py_XDECREF(bytes);
+ } else if (SWIG_std_filesystem_isPathInstance($input)) {
+ PyObject *str_obj = PyObject_Str($input);
+ if constexpr (std::is_same_v<typename std::filesystem::path::value_type, wchar_t>) {
+ Py_ssize_t size = 0;
+ wchar_t *ws = PyUnicode_AsWideCharString(str_obj, &size);
+ if (!ws) SWIG_fail;
+ $1 = std::filesystem::path(std::wstring(ws, static_cast<size_t>(size)));
+ PyMem_Free(ws);
+ } else {
+ PyObject *bytes = NULL;
+ const char *s = SWIG_PyUnicode_AsUTF8AndSize(str_obj, NULL, &bytes);
+ $1 = std::filesystem::path(s);
+ Py_XDECREF(bytes);
+ }
+ Py_DECREF(str_obj);
+ } else {
+ void *argp = 0;
+ int res = SWIG_ConvertPtr($input, &argp, $descriptor(std::filesystem::path *), $disown | 0);
+ if (!SWIG_IsOK(res)) {
+ %argument_fail(res, "$type", $symname, $argnum);
+ }
+ std::filesystem::path *temp = %reinterpret_cast(argp, $1_ltype*);
+ $1 = *temp;
+ }
+}
+
+%typemap(in, fragment="SWIG_std_filesystem", fragment="<type_traits>") const std::filesystem::path &(std::filesystem::path temp_path) {
+ if (PyUnicode_Check($input)) {
+ PyObject *bytes = NULL;
+ const char *s = SWIG_PyUnicode_AsUTF8AndSize($input, NULL, &bytes);
+ temp_path = std::filesystem::path(s);
+ $1 = &temp_path;
+ Py_XDECREF(bytes);
+ } else if (SWIG_std_filesystem_isPathInstance($input)) {
+ PyObject *str_obj = PyObject_Str($input);
+ if constexpr (std::is_same_v<typename std::filesystem::path::value_type, wchar_t>) {
+ Py_ssize_t size = 0;
+ wchar_t *ws = PyUnicode_AsWideCharString(str_obj, &size);
+ if (!ws) SWIG_fail;
+ temp_path = std::filesystem::path(std::wstring(ws, static_cast<size_t>(size)));
+ $1 = &temp_path;
+ PyMem_Free(ws);
+ } else {
+ PyObject *bytes = NULL;
+ const char *s = SWIG_PyUnicode_AsUTF8AndSize(str_obj, NULL, &bytes);
+ temp_path = std::filesystem::path(s);
+ $1 = &temp_path;
+ Py_XDECREF(bytes);
+ }
+ Py_DECREF(str_obj);
+ } else {
+ void *argp = 0;
+ int res = SWIG_ConvertPtr($input, &argp, $descriptor, $disown | 0);
+ if (!SWIG_IsOK(res)) {
+ %argument_fail(res, "$type", $symname, $argnum);
+ }
+ $1 = %reinterpret_cast(argp, $1_ltype);
+ }
+}
+
+%typemap(out, fragment="SWIG_std_filesystem", fragment="<type_traits>") std::filesystem::path {
+ PyObject *args;
+ if constexpr (std::is_same_v<typename std::filesystem::path::value_type, wchar_t>) {
+ std::wstring s = $1.generic_wstring();
+ args = Py_BuildValue("(u)", s.data());
+ } else {
+ std::string s = $1.generic_string();
+ args = Py_BuildValue("(s)", s.data());
+ }
+ PyObject *cls = SWIG_std_filesystem_importPathClass();
+ $result = PyObject_CallObject(cls, args);
+ Py_DECREF(cls);
+ Py_DECREF(args);
+}
+
+%typemap(out, fragment="SWIG_std_filesystem", fragment="<type_traits>") const std::filesystem::path & {
+ PyObject *args;
+ if constexpr (std::is_same_v<typename std::filesystem::path::value_type, wchar_t>) {
+ std::wstring s = $1->generic_wstring();
+ args = Py_BuildValue("(u)", s.data());
+ } else {
+ std::string s = $1->generic_string();
+ args = Py_BuildValue("(s)", s.data());
+ }
+ PyObject *cls = SWIG_std_filesystem_importPathClass();
+ $result = PyObject_CallObject(cls, args);
+ Py_DECREF(cls);
+ Py_DECREF(args);
+}
diff --git a/linux-x86/share/swig/python/std_map.i b/linux-x86/share/swig/python/std_map.i
index 8ae483c..954e7eb 100644
--- a/linux-x86/share/swig/python/std_map.i
+++ b/linux-x86/share/swig/python/std_map.i
@@ -2,7 +2,7 @@
Maps
*/
-%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits")
+%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits",fragment="SwigPyIterator_T")
{
namespace swig {
template <class ValueType>
@@ -77,16 +77,6 @@
%fragment("StdMapTraits","header",fragment="StdMapCommonTraits")
{
namespace swig {
- template <class SwigPySeq, class K, class T, class Compare, class Alloc >
- inline void
- assign(const SwigPySeq& swigpyseq, std::map<K,T,Compare,Alloc > *map) {
- typedef typename std::map<K,T,Compare,Alloc >::value_type value_type;
- typename SwigPySeq::const_iterator it = swigpyseq.begin();
- for (;it != swigpyseq.end(); ++it) {
- map->insert(value_type(it->first, it->second));
- }
- }
-
template <class K, class T, class Compare, class Alloc>
struct traits_asptr<std::map<K,T,Compare,Alloc > > {
typedef std::map<K,T,Compare,Alloc > map_type;
@@ -101,7 +91,7 @@
%#endif
res = traits_asptr_stdseq<map_type, std::pair<K, T> >::asptr(items, val);
} else {
- map_type *p;
+ map_type *p = 0;
swig_type_info *descriptor = swig::type_info<map_type>();
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res) && val) *val = p;
@@ -295,7 +285,11 @@
}
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
PyObject* asdict() {
diff --git a/linux-x86/share/swig/python/std_multimap.i b/linux-x86/share/swig/python/std_multimap.i
index f78a527..75b4d7f 100644
--- a/linux-x86/share/swig/python/std_multimap.i
+++ b/linux-x86/share/swig/python/std_multimap.i
@@ -6,16 +6,6 @@
%fragment("StdMultimapTraits","header",fragment="StdMapCommonTraits")
{
namespace swig {
- template <class SwigPySeq, class K, class T >
- inline void
- assign(const SwigPySeq& swigpyseq, std::multimap<K,T > *multimap) {
- typedef typename std::multimap<K,T>::value_type value_type;
- typename SwigPySeq::const_iterator it = swigpyseq.begin();
- for (;it != swigpyseq.end(); ++it) {
- multimap->insert(value_type(it->first, it->second));
- }
- }
-
template <class K, class T>
struct traits_asptr<std::multimap<K,T> > {
typedef std::multimap<K,T> multimap_type;
@@ -29,7 +19,7 @@
%#endif
res = traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
} else {
- multimap_type *p;
+ multimap_type *p = 0;
swig_type_info *descriptor = swig::type_info<multimap_type>();
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res) && val) *val = p;
diff --git a/linux-x86/share/swig/python/std_multiset.i b/linux-x86/share/swig/python/std_multiset.i
index ac43033..b79f64e 100644
--- a/linux-x86/share/swig/python/std_multiset.i
+++ b/linux-x86/share/swig/python/std_multiset.i
@@ -7,17 +7,6 @@
%fragment("StdMultisetTraits","header",fragment="StdSequenceTraits")
%{
namespace swig {
- template <class SwigPySeq, class T>
- inline void
- assign(const SwigPySeq& swigpyseq, std::multiset<T>* seq) {
- // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
- typedef typename SwigPySeq::value_type value_type;
- typename SwigPySeq::const_iterator it = swigpyseq.begin();
- for (;it != swigpyseq.end(); ++it) {
- seq->insert(seq->end(),(value_type)(*it));
- }
- }
-
template <class T>
struct traits_asptr<std::multiset<T> > {
static int asptr(PyObject *obj, std::multiset<T> **m) {
diff --git a/linux-x86/share/swig/python/std_pair.i b/linux-x86/share/swig/python/std_pair.i
index 172572b..cf463cb 100644
--- a/linux-x86/share/swig/python/std_pair.i
+++ b/linux-x86/share/swig/python/std_pair.i
@@ -47,7 +47,7 @@
res = get_pair(first, second, val);
}
} else {
- value_type *p;
+ value_type *p = 0;
swig_type_info *descriptor = swig::type_info<value_type>();
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res) && val) *val = *p;
@@ -104,7 +104,7 @@
res = get_pair(first, second, val);
}
} else {
- value_type *p;
+ value_type *p = 0;
swig_type_info *descriptor = swig::type_info<value_type>();
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res) && val) *val = p;
diff --git a/linux-x86/share/swig/python/std_set.i b/linux-x86/share/swig/python/std_set.i
index 0ef0119..3f80daf 100644
--- a/linux-x86/share/swig/python/std_set.i
+++ b/linux-x86/share/swig/python/std_set.i
@@ -5,17 +5,6 @@
%fragment("StdSetTraits","header",fragment="StdSequenceTraits")
%{
namespace swig {
- template <class SwigPySeq, class T>
- inline void
- assign(const SwigPySeq& swigpyseq, std::set<T>* seq) {
- // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
- typedef typename SwigPySeq::value_type value_type;
- typename SwigPySeq::const_iterator it = swigpyseq.begin();
- for (;it != swigpyseq.end(); ++it) {
- seq->insert(seq->end(),(value_type)(*it));
- }
- }
-
template <class T>
struct traits_asptr<std::set<T> > {
static int asptr(PyObject *obj, std::set<T> **s) {
diff --git a/linux-x86/share/swig/python/std_string_view.i b/linux-x86/share/swig/python/std_string_view.i
new file mode 100644
index 0000000..a3069f8
--- /dev/null
+++ b/linux-x86/share/swig/python/std_string_view.i
@@ -0,0 +1,135 @@
+/* -----------------------------------------------------------------------------
+ * std_string_view.i
+ *
+ * SWIG typemaps for std::string_view types
+ * ----------------------------------------------------------------------------- */
+
+%include <exception.i>
+
+%{
+#include <string_view>
+
+#if PY_VERSION_HEX < 0x03000000
+# error std_string_view.i not supported for Python 2
+#endif
+%}
+
+namespace std {
+
+ %naturalvar string_view;
+
+ class string_view;
+
+ %typemap(typecheck,precedence=SWIG_TYPECHECK_STRINGVIEW) string_view, const string_view & %{
+#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR
+ $1 = PyBytes_Check($input);
+#else
+ $1 = PyUnicode_Check($input) || PyBytes_Check($input);
+#endif
+ %}
+
+ %typemap(in) string_view (PyObject *bytes = NULL) %{
+ Py_ssize_t len;
+#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR
+ const char *p = PyBytes_AsString($input);
+ if (!p) SWIG_fail;
+ len = PyBytes_Size($input);
+#else
+ const char *p;
+ if (PyUnicode_Check($input)) {
+ p = SWIG_PyUnicode_AsUTF8AndSize($input, &len, &bytes);
+ if (!p) SWIG_fail;
+ } else {
+ p = PyBytes_AsString($input);
+ if (!p) SWIG_fail;
+ len = PyBytes_Size($input);
+ }
+#endif
+ $1 = std::string_view(p, len);
+ %}
+
+ %typemap(freearg) string_view %{
+ Py_XDECREF(bytes$argnum);
+ %}
+
+ %typemap(in) const string_view & ($*1_ltype temp, PyObject *bytes = NULL) %{
+ Py_ssize_t len;
+#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR
+ const char *p = PyBytes_AsString($input);
+ if (!p) SWIG_fail;
+ len = PyBytes_Size($input);
+#else
+ const char *p;
+ if (PyUnicode_Check($input)) {
+ p = SWIG_PyUnicode_AsUTF8AndSize($input, &len, &bytes);
+ if (!p) SWIG_fail;
+ } else {
+ p = PyBytes_AsString($input);
+ if (!p) SWIG_fail;
+ len = PyBytes_Size($input);
+ }
+#endif
+ temp = std::string_view(p, len);
+ $1 = &temp;
+ %}
+
+ %typemap(freearg) const string_view & %{
+ Py_XDECREF(bytes$argnum);
+ %}
+
+ %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) string_view {
+ Py_ssize_t len;
+%#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR
+ const char *p = PyBytes_AsString($input);
+ if (p) len = PyBytes_Size($input);
+%#else
+ const char *p;
+ PyObject *bytes = NULL;
+ if (PyUnicode_Check($input)) {
+ p = SWIG_PyUnicode_AsUTF8AndSize($input, &len, &bytes);
+ // Avoid undefined behaviour (p will be pointing to a temporary
+ // if bytes is not NULL which happens when Py_LIMITED_API is defined
+ // and < 0x030A0000) and just leak by not calling Py_XDECREF.
+ // Py_XDECREF(bytes);
+ } else {
+ p = PyBytes_AsString($input);
+ if (p) len = PyBytes_Size($input);
+ }
+%#endif
+ if (p) $result = std::string_view(p, len);
+ }
+
+
+ %typemap(out) string_view %{
+#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR
+ $result = PyBytes_FromStringAndSize($1.data(), $1.size());
+#else
+ $result = PyUnicode_FromStringAndSize($1.data(), $1.size());
+#endif
+ %}
+
+ %typemap(varout) string_view %{
+#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR
+ $result = PyBytes_FromStringAndSize($1.data(), $1.size());
+#else
+ $result = PyUnicode_FromStringAndSize($1.data(), $1.size());
+#endif
+ %}
+
+ %typemap(directorin) string_view, const string_view & %{
+#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR
+ $input = PyBytes_FromStringAndSize($1.data(), $1.size());
+#else
+ $input = PyUnicode_FromStringAndSize($1.data(), $1.size());
+#endif
+ %}
+
+ %typemap(out) const string_view & %{
+#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR
+ $result = PyBytes_FromStringAndSize($1->data(), $1->size());
+#else
+ $result = PyUnicode_FromStringAndSize($1->data(), $1->size());
+#endif
+ %}
+
+}
diff --git a/linux-x86/share/swig/python/std_unique_ptr.i b/linux-x86/share/swig/python/std_unique_ptr.i
new file mode 100644
index 0000000..f988714
--- /dev/null
+++ b/linux-x86/share/swig/python/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/python/std_unordered_map.i b/linux-x86/share/swig/python/std_unordered_map.i
index 042d5b6..4321735 100644
--- a/linux-x86/share/swig/python/std_unordered_map.i
+++ b/linux-x86/share/swig/python/std_unordered_map.i
@@ -56,16 +56,6 @@
%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,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, 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) {
@@ -87,7 +77,7 @@
%#endif
res = traits_asptr_stdseq<std::unordered_map<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
} else {
- unordered_map_type *p;
+ unordered_map_type *p = 0;
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;
@@ -281,7 +271,11 @@
}
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
+%#ifdef __cpp_lib_unordered_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
PyObject* asdict() {
diff --git a/linux-x86/share/swig/python/std_unordered_multimap.i b/linux-x86/share/swig/python/std_unordered_multimap.i
index 2811404..816ec09 100644
--- a/linux-x86/share/swig/python/std_unordered_multimap.i
+++ b/linux-x86/share/swig/python/std_unordered_multimap.i
@@ -6,16 +6,6 @@
%fragment("StdUnorderedMultimapTraits","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_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, 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) {
@@ -36,7 +26,7 @@
%#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;
+ unordered_multimap_type *p = 0;
swig_type_info *descriptor = swig::type_info<unordered_multimap_type>();
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
if (SWIG_IsOK(res) && val) *val = p;
diff --git a/linux-x86/share/swig/python/std_unordered_multiset.i b/linux-x86/share/swig/python/std_unordered_multiset.i
index b0f3f09..0542247 100644
--- a/linux-x86/share/swig/python/std_unordered_multiset.i
+++ b/linux-x86/share/swig/python/std_unordered_multiset.i
@@ -7,17 +7,6 @@
%fragment("StdUnorderedMultisetTraits","header",fragment="StdSequenceTraits")
%{
namespace swig {
- template <class SwigPySeq, class Key, class Hash, class Compare, class Alloc>
- inline void
- 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();
- for (;it != swigpyseq.end(); ++it) {
- seq->insert(seq->end(),(value_type)(*it));
- }
- }
-
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) {
diff --git a/linux-x86/share/swig/python/std_unordered_set.i b/linux-x86/share/swig/python/std_unordered_set.i
index 79fca6c..fd866b1 100644
--- a/linux-x86/share/swig/python/std_unordered_set.i
+++ b/linux-x86/share/swig/python/std_unordered_set.i
@@ -5,17 +5,6 @@
%fragment("StdUnorderedSetTraits","header",fragment="StdSequenceTraits")
%{
namespace swig {
- template <class SwigPySeq, class Key, class Hash, class Compare, class Alloc>
- inline void
- 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();
- for (;it != swigpyseq.end(); ++it) {
- seq->insert(seq->end(),(value_type)(*it));
- }
- }
-
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) {
diff --git a/linux-x86/share/swig/python/swigmove.i b/linux-x86/share/swig/python/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/python/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/python/typemaps.i b/linux-x86/share/swig/python/typemaps.i
index 5d438ec..7559203 100644
--- a/linux-x86/share/swig/python/typemaps.i
+++ b/linux-x86/share/swig/python/typemaps.i
@@ -72,7 +72,7 @@ multiple output values, they are returned in the form of a Python tuple.
For example, suppose you were trying to wrap the modf() function in the
C math library which splits x into integral and fractional parts (and
-returns the integer part in one of its parameters).K:
+returns the integer part in one of its parameters) :
double modf(double x, double *ip);
@@ -139,10 +139,6 @@ to a Python variable you might do this :
x = neg(x)
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
*/
%include <typemaps/typemaps.swg>
diff --git a/linux-x86/share/swig/r/argcargv.i b/linux-x86/share/swig/r/argcargv.i
new file mode 100644
index 0000000..1753f6e
--- /dev/null
+++ b/linux-x86/share/swig/r/argcargv.i
@@ -0,0 +1,38 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+/* Preserve string vector as is */
+%typemap(scoercein) (int ARGC, char **ARGV) ""
+/* Verify we pass the proper string vector */
+%typemap(scheck) (int ARGC, char **ARGV) %{
+ assert(is.null($input) || (is.vector($input) && is.character($input)))
+%}
+/* Check argument is null or a string vector for dispatcher */
+%typemap(rtypecheck) (int ARGC, char **ARGV) %{
+ is.null($arg) || (is.vector($arg) && is.character($arg))
+%}
+%typemap(in) (int ARGC, char **ARGV) {
+ $1_ltype i;
+ SEXP *pstr;
+ if ($input == R_NilValue) {
+ /* Empty array */
+ $1 = 0;
+ } else if (!Rf_isVectorAtomic($input) || TYPEOF($input) != STRSXP) {
+ SWIG_exception_fail(SWIG_RuntimeError, "Wrong array type.");
+ } else {
+ $1 = Rf_length($input);
+ pstr = CHARACTER_POINTER($input);
+ }
+ $2 = ($2_ltype) malloc(($1+1)*sizeof($*2_ltype));
+ if ($2 == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_MemoryError, "Memory allocation failed.");
+ }
+ for (i = 0; i < $1; i++) {
+ $2[i] = ($*2_ltype)STRING_VALUE(pstr[i]);
+ }
+ $2[i] = SWIG_NULLPTR;
+}
+%typemap(freearg,noblock=1) (int ARGC, char **ARGV) {
+ free((void *)$2);
+}
diff --git a/linux-x86/share/swig/r/boost_shared_ptr.i b/linux-x86/share/swig/r/boost_shared_ptr.i
index 668bf43..fde6ae5 100644
--- a/linux-x86/share/swig/r/boost_shared_ptr.i
+++ b/linux-x86/share/swig/r/boost_shared_ptr.i
@@ -35,7 +35,7 @@
}
}
%typemap(out) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1));
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -54,12 +54,12 @@
}
}
%typemap(varout) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $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));
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($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) {
@@ -394,6 +394,31 @@
#error "typemaps for $1_type not available"
%}
+%typemap(rtype) 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(rtype, TYPE)"
+
+%typemap(rtypecheck) 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 > *&
+ "(extends($argtype, '$typemap(rtype, TYPE)') && length($arg) == 1) || is.null($arg)"
+
+%typemap(scoercein) 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 > *&
+ %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %}
+
+%typemap(scoerceout) 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 > *&
+ %{ $result <- if (is.null($result)) $result
+ else new("$typemap(rtype, TYPE)", ref=$result); %}
+
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
diff --git a/linux-x86/share/swig/r/r.swg b/linux-x86/share/swig/r/r.swg
index 8cf8cdf..c1ce37c 100644
--- a/linux-x86/share/swig/r/r.swg
+++ b/linux-x86/share/swig/r/r.swg
@@ -26,9 +26,13 @@ SWIGEXPORT void SWIG_init(void) {
assign(name, _obj);
%end_block %enddef
-%define %raise(obj,type,desc)
-return R_NilValue;
-%enddef
+%runtime %{
+SWIGINTERN void SWIG_R_Raise(SEXP obj, const char *msg) {
+ Rf_error(Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg);
+}
+%}
+
+#define %raise(OBJ, TYPE, DESC) SWIG_R_Raise(OBJ, "C/C++ exception of type " TYPE); return R_NilValue
%insert("sinit") "srun.swg"
@@ -53,7 +57,7 @@ SWIG_InitializeModule(0);
assert(all(sapply($input, class) == "$R_class"));
%}
-%typemap(out) void "";
+%typemap(out) void ""
%typemap(in) int *, int[ANY],
signed int *, signed int[ANY],
diff --git a/linux-x86/share/swig/r/rcontainer.swg b/linux-x86/share/swig/r/rcontainer.swg
index 54b31b3..84a6c69 100644
--- a/linux-x86/share/swig/r/rcontainer.swg
+++ b/linux-x86/share/swig/r/rcontainer.swg
@@ -75,25 +75,29 @@ namespace swig {
template <class Sequence, class Difference, class InputSeq>
inline void
- setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) {
+ setslice(Sequence* self, Difference i, Difference j, const InputSeq& is) {
typename Sequence::size_type size = self->size();
typename Sequence::size_type ii = swig::check_index(i, size, true);
typename Sequence::size_type jj = swig::slice_index(j, size);
if (jj < ii) jj = ii;
size_t ssize = jj - ii;
- if (ssize <= v.size()) {
+ if (ssize <= is.size()) {
+ // expanding/staying the same size
typename Sequence::iterator sb = self->begin();
- typename InputSeq::const_iterator vmid = v.begin();
+ typename InputSeq::const_iterator vmid = is.begin();
std::advance(sb,ii);
std::advance(vmid, jj - ii);
- self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end());
+ self->insert(std::copy(is.begin(), vmid, sb), vmid, is.end());
} else {
+ // shrinking
typename Sequence::iterator sb = self->begin();
typename Sequence::iterator se = self->begin();
std::advance(sb,ii);
std::advance(se,jj);
self->erase(sb,se);
- self->insert(sb, v.begin(), v.end());
+ sb = self->begin();
+ std::advance(sb,ii);
+ self->insert(sb, is.begin(), is.end());
}
}
@@ -148,9 +152,9 @@ namespace swig {
return swig::getslice(self, i, j);
}
- void __setslice__(difference_type i, difference_type j, const Sequence& v)
+ void __setslice__(difference_type i, difference_type j, const Sequence& is)
throw (std::out_of_range, std::invalid_argument) {
- swig::setslice(self, i, j, v);
+ swig::setslice(self, i, j, is);
}
void __delslice__(difference_type i, difference_type j) throw (std::out_of_range) {
diff --git a/linux-x86/share/swig/r/rfragments.swg b/linux-x86/share/swig/r/rfragments.swg
index b89212b..c3b40a9 100644
--- a/linux-x86/share/swig/r/rfragments.swg
+++ b/linux-x86/share/swig/r/rfragments.swg
@@ -1,7 +1,3 @@
-#define SWIG_Error(code, msg) Rf_warning(msg); return Rf_ScalarLogical(NA_LOGICAL)
-
-#define SWIG_fail return Rf_ScalarLogical(NA_LOGICAL)
-
/* for raw pointers */
#define SWIG_ConvertPtr(oc, ptr, ty, flags) SWIG_R_ConvertPtr(oc, ptr, ty, flags)
#define SWIG_ConvertFunctionPtr(oc, ptr, ty) SWIG_R_ConvertPtr(oc, ptr, ty, 0)
diff --git a/linux-x86/share/swig/r/rkw.swg b/linux-x86/share/swig/r/rkw.swg
index 074d7df..c4af708 100644
--- a/linux-x86/share/swig/r/rkw.swg
+++ b/linux-x86/share/swig/r/rkw.swg
@@ -2,8 +2,8 @@
Warnings for R keywords, built-in names and bad names.
*/
-#define RKW(x) %keywordwarn("'" `x` "' is a R keyword, renaming to '_" `x`"'", rename="_%s") `x`
-#define RSWIGKW(x) %keywordwarn("'" `x` "' is a SWIG R reserved parameter name, renaming to '_" `x`"'", rename="_%s") `x`
+#define RKW(x) %keywordwarn("'" `x` "' is a R keyword", rename="_%s") `x`
+#define RSWIGKW(x) %keywordwarn("'" `x` "' is a SWIG R reserved parameter name", rename="_%s") `x`
/*
Warnings for R reserved words taken from
diff --git a/linux-x86/share/swig/r/rrun.swg b/linux-x86/share/swig/r/rrun.swg
index c341321..3ffc02f 100644
--- a/linux-x86/share/swig/r/rrun.swg
+++ b/linux-x86/share/swig/r/rrun.swg
@@ -1,4 +1,3 @@
-
/* Remove global namespace pollution */
#if !defined(SWIG_NO_R_NO_REMAP)
# define R_NO_REMAP
@@ -16,13 +15,15 @@ extern "C" {
#endif
/* for raw pointer */
+#define SWIG_R_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags)
-#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags)
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <stdarg.h>
#if R_VERSION >= R_Version(2,6,0)
#define VMAXTYPE void *
@@ -30,6 +31,47 @@ extern "C" {
#define VMAXTYPE char *
#endif
+/* Last error */
+static int SWIG_lasterror_code = 0;
+static char SWIG_lasterror_msg[1024];
+SWIGRUNTIME void SWIG_Error(int code, const char *format, ...) {
+ va_list arg;
+ SWIG_lasterror_code = code;
+ va_start(arg, format);
+ vsnprintf(SWIG_lasterror_msg, sizeof(SWIG_lasterror_msg), format, arg);
+ va_end(arg);
+}
+
+SWIGRUNTIME const char *SWIG_ErrorType(int code) {
+ switch (code) {
+ case SWIG_MemoryError:
+ return "SWIG:MemoryError";
+ case SWIG_IOError:
+ return "SWIG:IOError";
+ case SWIG_RuntimeError:
+ return "SWIG:RuntimeError";
+ case SWIG_IndexError:
+ return "SWIG:IndexError";
+ case SWIG_TypeError:
+ return "SWIG:TypeError";
+ case SWIG_DivisionByZero:
+ return "SWIG:DivisionByZero";
+ case SWIG_OverflowError:
+ return "SWIG:OverflowError";
+ case SWIG_SyntaxError:
+ return "SWIG:SyntaxError";
+ case SWIG_ValueError:
+ return "SWIG:ValueError";
+ case SWIG_SystemError:
+ return "SWIG:SystemError";
+ case SWIG_AttributeError:
+ return "SWIG:AttributeError";
+ }
+ return "SWIG:UnknownError";
+}
+
+#define SWIG_fail goto fail
+
/*
This is mainly a way to avoid having lots of local variables that may
conflict with those in the routine.
@@ -273,9 +315,11 @@ SWIG_R_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
/* Convert a pointer value */
SWIGRUNTIMEINLINE int
-SWIG_R_ConvertPtr(SEXP obj, void **ptr, swig_type_info *ty, int flags) {
+SWIG_R_ConvertPtrAndOwn(SEXP obj, void **ptr, swig_type_info *ty, int flags, int *own) {
void *vptr;
if (!obj) return SWIG_ERROR;
+ if (own)
+ *own = 0;
if (obj == R_NilValue) {
if (ptr) *ptr = NULL;
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
@@ -290,8 +334,15 @@ SWIG_R_ConvertPtr(SEXP obj, void **ptr, swig_type_info *ty, int flags) {
} else {
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
int newmemory = 0;
- if (ptr) *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
+ if (ptr) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ }
}
} else {
if (ptr) *ptr = vptr;
diff --git a/linux-x86/share/swig/r/rtype.swg b/linux-x86/share/swig/r/rtype.swg
index bdc48c2..1d66632 100644
--- a/linux-x86/share/swig/r/rtype.swg
+++ b/linux-x86/share/swig/r/rtype.swg
@@ -3,34 +3,34 @@
for use in class representations.
*/
-%typemap("rtype") int, int *, int & "integer";
-%typemap("rtype") long, long *, long & "integer";
-%typemap("rtype") float, float*, float & "numeric";
-%typemap("rtype") double, double*, double & "numeric";
-%typemap("rtype") char *, char ** "character";
-%typemap("rtype") char "character";
-%typemap("rtype") string, string *, string & "character";
-%typemap("rtype") std::string, std::string *, std::string & "character";
-%typemap("rtype") bool, bool * "logical";
-%typemap("rtype") enum SWIGTYPE "character";
-%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";
-%typemap("rtype") SWIGTYPE & "$R_class";
-%typemap("rtype") SWIGTYPE && "$R_class";
-%typemap("rtype") SWIGTYPE "$&R_class";
+%typemap("rtype") bool, bool * "logical"
+%typemap("rtype") int, int *, int & "integer"
+%typemap("rtype") long, long *, long & "integer"
+%typemap("rtype") float, float*, float & "numeric"
+%typemap("rtype") double, double*, double & "numeric"
+%typemap("rtype") char *, char ** "character"
+%typemap("rtype") char "character"
+%typemap("rtype") string, string *, string & "character"
+%typemap("rtype") std::string, std::string *, std::string & "character"
+%typemap("rtype") enum SWIGTYPE "character"
+%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"
+%typemap("rtype") SWIGTYPE *const& "$*R_class"
+%typemap("rtype") SWIGTYPE & "$R_class"
+%typemap("rtype") SWIGTYPE && "$R_class"
+%typemap("rtype") SWIGTYPE "$&R_class"
%typemap("rtypecheck") int, int &, long, long &
%{ (is.integer($arg) || is.numeric($arg)) && length($arg) == 1 %}
%typemap("rtypecheck") int *, long *
%{ is.integer($arg) || is.numeric($arg) %}
-
-%typemap("rtypecheck") float, double
+%typemap("rtypecheck") float, float &, double, double &
%{ is.numeric($arg) && length($arg) == 1 %}
%typemap("rtypecheck") float *, double *
%{ is.numeric($arg) %}
@@ -40,6 +40,38 @@
%typemap("rtypecheck") bool *
%{ is.logical($arg) %}
+%typemap("rtypecheck") char
+ %{ is.character($arg) && length($arg) == 1 %}
+%typemap("rtypecheck") char *, char **
+ %{ is.character($arg) %}
+
+%typemap("rtypecheck") string, string &
+ %{ is.character($arg) && length($arg) == 1 %}
+%typemap("rtypecheck") string *
+ %{ is.character($arg) %}
+
+%typemap("rtypecheck") std::string, std::string &
+ %{ is.character($arg) && length($arg) == 1 %}
+%typemap("rtypecheck") std::string *
+ %{ is.character($arg) %}
+
+%typemap("rtypecheck") enum SWIGTYPE, enum SWIGTYPE *const&, enum SWIGTYPE &, const enum SWIGTYPE &, enum SWIGTYPE &&
+ %{ is.character($arg) && length($arg) == 1 %}
+%typemap("rtypecheck") enum SWIGTYPE *
+ %{ is.character($arg) %}
+
+%typemap("rtypecheck") SWIGTYPE *
+ %{ extends($argtype, '$R_class') || is.null($arg) %}
+
+%typemap("rtypecheck") SWIGTYPE &, SWIGTYPE &&
+ %{ extends($argtype, '$R_class') && length($arg) == 1 %}
+
+%typemap("rtypecheck") SWIGTYPE *const&
+ %{ extends($argtype, '$*R_class') && length($arg) == 1 %}
+
+%typemap("rtypecheck") SWIGTYPE
+ %{ extends($argtype, '$&R_class') && length($arg) == 1 %}
+
/*
Set up type checks to insure overloading precedence.
We would like non pointer items to shadow pointer items, so that
@@ -93,21 +125,21 @@
%typemap(scoercein) enum SWIGTYPE *const
%{ $input = enumToInteger($input, "$R_class"); %}
-%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE &&
- %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref") %}
+%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE *const&, SWIGTYPE &, SWIGTYPE &&
+ %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %}
/*
%typemap(scoercein) SWIGTYPE *, SWIGTYPE *const
- %{ $input = coerceIfNotSubclass($input, "$R_class") %}
+ %{ $input = coerceIfNotSubclass($input, "$R_class"); %}
%typemap(scoercein) SWIGTYPE &
- %{ $input = coerceIfNotSubclass($input, "$R_class") %}
+ %{ $input = coerceIfNotSubclass($input, "$R_class"); %}
%typemap(scoercein) SWIGTYPE &&
- %{ $input = coerceIfNotSubclass($input, "$R_class") %}
+ %{ $input = coerceIfNotSubclass($input, "$R_class"); %}
%typemap(scoercein) SWIGTYPE
- %{ $input = coerceIfNotSubclass($input, "$&R_class") %}
+ %{ $input = coerceIfNotSubclass($input, "$&R_class"); %}
*/
%typemap(scoercein) SWIGTYPE[ANY]
@@ -172,6 +204,10 @@ string &, std::string &
%{ $result <- if (is.null($result)) $result
else new("$R_class", ref=$result); %}
+%typemap(scoerceout) SWIGTYPE *const&
+ %{ $result <- if (is.null($result)) $result
+ else new("$*R_class", ref=$result); %}
+
/* Override the SWIGTYPE * above. */
%typemap(scoerceout) char,
diff --git a/linux-x86/share/swig/r/std_vector.i b/linux-x86/share/swig/r/std_vector.i
index 4ec51dc..98840c5 100644
--- a/linux-x86/share/swig/r/std_vector.i
+++ b/linux-x86/share/swig/r/std_vector.i
@@ -544,7 +544,7 @@
struct traits_asptr < std::vector<T> > {
static int asptr(SEXP obj, std::vector<T> **val) {
std::vector<T> *p;
- int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector<T> >(), 0);
+ int res = SWIG_ConvertPtr(obj, (void**)&p, type_info< std::vector<T> >(), 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
@@ -660,6 +660,27 @@
}
};
+ template <>
+ struct traits_from_ptr<std::vector<std::vector<std::basic_string<char> > > > {
+ static SEXP from (std::vector< std::vector<std::basic_string<char> > > *val, int owner = 0) {
+ SEXP result;
+ // allocate the R list
+ PROTECT(result = Rf_allocVector(VECSXP, val->size()));
+ for (unsigned pos = 0; pos < val->size(); pos++)
+ {
+ // allocate the R vector
+ SET_VECTOR_ELT(result, pos, Rf_allocVector(STRSXP, val->at(pos).size()));
+ // Fill the R vector
+ for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos)
+ {
+ CHARACTER_POINTER(VECTOR_ELT(result, pos))[vpos] = Rf_mkChar(val->at(pos).at(vpos).c_str());
+ }
+ }
+ UNPROTECT(1);
+ return(result);
+ }
+ };
+
template <typename T>
struct traits_from_ptr< std::vector < std::vector< T > > > {
static SEXP from (std::vector < std::vector< T > > *val, int owner = 0) {
@@ -806,7 +827,7 @@
static int asptr(SEXP obj, std::vector< std::vector<T> > **val) {
std::vector< std::vector<T> > *p;
Rprintf("vector of vectors - unsupported content\n");
- int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector<T> > > (), 0);
+ int res = SWIG_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector<T> > > (), 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
@@ -841,7 +862,7 @@
%typemap("rtypecheck") std::vector<double>, std::vector<double> *, std::vector<double> &
%{ is.numeric($arg) %}
%typemap("rtype") std::vector<double> "numeric"
-%typemap("scoercein") std::vector<double>, std::vector<double> *, std::vector<double> & "$input = as.numeric($input);";
+%typemap("scoercein") std::vector<double>, std::vector<double> *, std::vector<double> & "$input = as.numeric($input);"
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<float>)
%traits_type_name(std::vector<float>)
@@ -857,7 +878,7 @@
%typemap("rtypecheck") std::vector<bool>, std::vector<bool> *, std::vector<bool> &
%{ is.logical($arg) %}
%typemap("rtype") std::vector<bool> "logical"
-%typemap("scoercein") std::vector<bool> , std::vector<bool> & "$input = as.logical($input);";
+%typemap("scoercein") std::vector<bool> , std::vector<bool> & "$input = as.logical($input);"
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<int>);
@@ -866,7 +887,7 @@
%{ is.integer($arg) || is.numeric($arg) %}
%typemap("rtype") std::vector<int> "integer"
-%typemap("scoercein") std::vector<int> , std::vector<int> *, std::vector<int> & "$input = as.integer($input);";
+%typemap("scoercein") std::vector<int> , std::vector<int> *, std::vector<int> & "$input = as.integer($input);"
// strings
%typemap("rtype") std::vector< std::basic_string<char> >,
@@ -887,8 +908,6 @@ std::vector< std::basic_string<char> > *,
std::vector< std::basic_string<char> > &
%{ %}
-%apply std::vector< std::basic_string<char> > { std::vector< std::string> };
-
// all the related integer vectors
// signed
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<signed char>);
@@ -974,21 +993,21 @@ std::vector< std::basic_string<char> > *,
%typemap("rtypecheck") std::vector<std::vector<int> >, std::vector<std::vector<int> > *, std::vector<std::vector<int> > &
%{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %}
%typemap("rtype") std::vector<std::vector<int> >, std::vector<std::vector<int> > *, std::vector<std::vector<int> > & "list"
-%typemap("scoercein") std::vector< std::vector<int> >, std::vector<std::vector<int> > *, std::vector<std::vector<int> > & "$input = lapply($input, as.integer);";
+%typemap("scoercein") std::vector< std::vector<int> >, std::vector<std::vector<int> > *, std::vector<std::vector<int> > & "$input = lapply($input, as.integer);"
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<unsigned int> >);
%traits_type_name(std::vector< std::vector<unsigned int> >);
%typemap("rtypecheck") std::vector<std::vector<unsigned int> >, std::vector<std::vector<unsigned int> > *, std::vector<std::vector<unsigned int> > &
%{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %}
%typemap("rtype") std::vector<std::vector<unsigned int> >, std::vector<std::vector<unsigned int> > *, std::vector<std::vector<unsigned int> > & "list"
-%typemap("scoercein") std::vector< std::vector<unsigned int> >, std::vector<std::vector<int> > *, std::vector<std::vector<unsigned int> > & "$input = lapply($input, as.integer);";
+%typemap("scoercein") std::vector< std::vector<unsigned int> >, std::vector<std::vector<int> > *, std::vector<std::vector<unsigned int> > & "$input = lapply($input, as.integer);"
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<float> >);
%traits_type_name(std::vector< std::vector<float> >);
%typemap("rtypecheck") std::vector<std::vector<float> >, std::vector<std::vector<float> > *, std::vector<std::vector<float> > &
%{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %}
%typemap("rtype") std::vector<std::vector<float> >, std::vector<std::vector<float> > *, std::vector<std::vector<float> > "list"
-%typemap("scoercein") std::vector< std::vector<float> >, std::vector<std::vector<float> > *, std::vector<std::vector<float> > & "$input = lapply($input, as.numeric);";
+%typemap("scoercein") std::vector< std::vector<float> >, std::vector<std::vector<float> > *, std::vector<std::vector<float> > & "$input = lapply($input, as.numeric);"
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<double> >);
%traits_type_name(std::vector< std::vector<double> >);
@@ -1003,7 +1022,14 @@ std::vector< std::basic_string<char> > *,
%typemap("rtypecheck") std::vector<std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > &
%{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %}
%typemap("rtype") std::vector<std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > & "list"
-%typemap("scoercein") std::vector< std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > & "$input = lapply($input, as.logical);";
+%typemap("scoercein") std::vector< std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > & "$input = lapply($input, as.logical);"
+
+%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<std::basic_string<char> > >);
+%traits_type_name(std::vector< std::vector<std::basic_string<char> > >);
+%typemap("rtypecheck") std::vector<std::vector<std::basic_string<char> > >, std::vector<std::vector<std::basic_string<char> > > *, std::vector<std::vector<std::basic_string<char> > > &
+ %{ is.list($arg) && all(sapply($arg , is.character)) %}
+%typemap("rtype") std::vector<std::vector<std::basic_string<char> > >, std::vector<std::vector<std::basic_string<char> > > *, std::vector<std::vector<std::basic_string<char> > > & "list"
+%typemap("scoercein") std::vector< std::vector<std::basic_string<char> > >, std::vector<std::vector<std::basic_string<char> > > *, std::vector<std::vector<std::basic_string<char> > > & "$input = lapply($input, as.character);"
// we don't want these to be given R classes as they
// have already been turned into R vectors.
@@ -1049,7 +1075,10 @@ std::vector< std::basic_string<char> > *,
std::vector< std::vector<double> >&,
std::vector< std::vector<bool> >,
std::vector< std::vector<bool> >*,
- std::vector< std::vector<bool> >&
+ std::vector< std::vector<bool> >&,
+ std::vector< std::vector<std::basic_string<char> > >,
+ std::vector< std::vector<std::basic_string<char> > >*,
+ std::vector< std::vector<std::basic_string<char> > >&
%{ %}
#if defined(SWIGWORDSIZE64)
@@ -1071,3 +1100,6 @@ std::vector< std::basic_string<char> > *,
%{ %}
#endif
+
+%apply std::vector< std::basic_string<char> > { std::vector<std::string> };
+%apply std::vector< std::vector< std::basic_string<char> > > { std::vector< std::vector<std::string> > };
diff --git a/linux-x86/share/swig/r/swigmove.i b/linux-x86/share/swig/r/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/r/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/ruby/argcargv.i b/linux-x86/share/swig/ruby/argcargv.i
index fc0bc40..b8efcff 100644
--- a/linux-x86/share/swig/ruby/argcargv.i
+++ b/linux-x86/share/swig/ruby/argcargv.i
@@ -1,26 +1,22 @@
-/* ------------------------------------------------------------
- * --- Argc & Argv ---
- * ------------------------------------------------------------ */
-
-/* ------------------------------------------------------------
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
- Use it as follow:
+ Use it as follows:
%apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
%inline %{
- int mainApp(size_t argc, const char **argv)
- {
+ int mainApp(size_t argc, const char **argv) {
return argc;
}
- then in the ruby side:
+ then from ruby:
- args = ["asdf", "asdf2"]
- mainApp(args);
+ $args = ["asdf", "asdf2"]
+ mainApp(args)
- * ------------------------------------------------------------ */
+ * ------------------------------------------------------------- */
%typemap(in) (int ARGC, char **ARGV) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
@@ -31,7 +27,7 @@
VALUE *ptr = RARRAY_PTR($input);
for (i=0; i < size; i++, ptr++) {
$2[i]= StringValuePtr(*ptr);
- }
+ }
$2[i]=NULL;
} else {
$1 = 0; $2 = 0;
diff --git a/linux-x86/share/swig/ruby/boost_shared_ptr.i b/linux-x86/share/swig/ruby/boost_shared_ptr.i
index 9676bf9..70deae4 100644
--- a/linux-x86/share/swig/ruby/boost_shared_ptr.i
+++ b/linux-x86/share/swig/ruby/boost_shared_ptr.i
@@ -35,7 +35,7 @@
}
}
%typemap(out) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1));
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -54,12 +54,12 @@
}
}
%typemap(varout) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $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));
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($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) {
diff --git a/linux-x86/share/swig/ruby/carrays.i b/linux-x86/share/swig/ruby/carrays.i
index 8f74cd9..7e1e66a 100644
--- a/linux-x86/share/swig/ruby/carrays.i
+++ b/linux-x86/share/swig/ruby/carrays.i
@@ -3,4 +3,3 @@
%enddef
%include <typemaps/carrays.swg>
-
diff --git a/linux-x86/share/swig/ruby/progargcargv.i b/linux-x86/share/swig/ruby/progargcargv.i
index a2843c3..36f1c9a 100644
--- a/linux-x86/share/swig/ruby/progargcargv.i
+++ b/linux-x86/share/swig/ruby/progargcargv.i
@@ -3,7 +3,7 @@ int PROG_ARGC
char **PROG_ARGV
Some C function receive argc and argv from C main function.
- This typemap provides ignore typemap which pass Ruby ARGV contents
+ This file provides typemaps which pass Ruby ARGV contents
as argc and argv to C function.
*/
diff --git a/linux-x86/share/swig/ruby/ruby.swg b/linux-x86/share/swig/ruby/ruby.swg
index d133597..cf7c109 100644
--- a/linux-x86/share/swig/ruby/ruby.swg
+++ b/linux-x86/share/swig/ruby/ruby.swg
@@ -17,7 +17,7 @@
/* 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) "";
+%rename("%(uppercase)s", %$ismember, %$isvariable, %$isstatic, %$hasvalue, %$hasconsttype) "";
/* Enums are mapped to constants but all we do is make sure the
first letter is uppercase */
diff --git a/linux-x86/share/swig/ruby/rubyautodoc.swg b/linux-x86/share/swig/ruby/rubyautodoc.swg
index 1e6b0d9..6b0472c 100644
--- a/linux-x86/share/swig/ruby/rubyautodoc.swg
+++ b/linux-x86/share/swig/ruby/rubyautodoc.swg
@@ -77,7 +77,7 @@ AUTODOC(operator>, "Higher than comparison operator");
AUTODOC(operator<<, "Left shifting or appending operator");
AUTODOC(operator>>, "Right shifting operator or extracting operator");
AUTODOC(operator+, "Add operator");
-AUTODOC(operator-, "Substraction operator");
+AUTODOC(operator-, "Subtraction operator");
AUTODOC(operator+(), "Positive operator");
AUTODOC(operator-(), "Negation operator");
AUTODOC(operator&, "AND operator");
@@ -93,7 +93,7 @@ AUTODOC(__gt__, "Higher than comparison operator");
AUTODOC(__lshift__, "Left shifting or appending operator");
AUTODOC(__rshift__, "Right shifting operator or extracting operator");
AUTODOC(__add___, "Add operator");
-AUTODOC(__sub__, "Substraction operator");
+AUTODOC(__sub__, "Subtraction operator");
AUTODOC(__pos__, "Positive operator");
AUTODOC(__neg__, "Negation operator");
AUTODOC(__and__, "AND operator");
diff --git a/linux-x86/share/swig/ruby/rubyclasses.swg b/linux-x86/share/swig/ruby/rubyclasses.swg
index f7b51bd..c43f38f 100644
--- a/linux-x86/share/swig/ruby/rubyclasses.swg
+++ b/linux-x86/share/swig/ruby/rubyclasses.swg
@@ -174,7 +174,7 @@ namespace swig {
return rb_inspect(_obj);
}
- static VALUE swig_rescue_swallow(VALUE)
+ static VALUE swig_rescue_swallow(VALUE, VALUE)
{
/*
VALUE errstr = rb_obj_as_string(rb_errinfo());
@@ -203,12 +203,12 @@ namespace swig {
args.id = op_id;
args.nargs = 1;
args.target = VALUE(other);
- ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
- (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+ ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
+ (VALUEFUNC(swig_rescue_swallow)), Qnil);
}
if (ret == Qnil) {
- VALUE a = rb_funcall( _obj, hash_id, 0 );
- VALUE b = rb_funcall( VALUE(other), hash_id, 0 );
+ VALUE a = rb_funcall2( _obj, hash_id, 0, 0 );
+ VALUE b = rb_funcall2( VALUE(other), hash_id, 0, 0 );
res = op_func(a, b);
} else {
res = RTEST(ret);
@@ -243,8 +243,8 @@ namespace swig {
args.id = op_id;
args.nargs = 0;
args.target = Qnil;
- ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
- (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+ ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
+ (VALUEFUNC(swig_rescue_swallow)), Qnil);
SWIG_RUBY_THREAD_END_BLOCK;
return ret;
}
@@ -262,8 +262,8 @@ namespace swig {
args.id = op_id;
args.nargs = 1;
args.target = VALUE(other);
- ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
- (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+ ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args),
+ (VALUEFUNC(swig_rescue_swallow)), Qnil);
SWIG_RUBY_THREAD_END_BLOCK;
return GC_VALUE(ret);
}
diff --git a/linux-x86/share/swig/ruby/rubycomplex.swg b/linux-x86/share/swig/ruby/rubycomplex.swg
index 4e249c7..d2aaf6c 100644
--- a/linux-x86/share/swig/ruby/rubycomplex.swg
+++ b/linux-x86/share/swig/ruby/rubycomplex.swg
@@ -36,12 +36,12 @@ SWIGINTERN int SWIG_Is_Complex( VALUE obj ) {
SWIGINTERN VALUE SWIG_Complex_Real(VALUE obj) {
static ID real_id = rb_intern("real");
- return rb_funcall(obj, real_id, 0);
+ return rb_funcall2(obj, real_id, 0, 0);
}
SWIGINTERN VALUE SWIG_Complex_Imaginary(VALUE obj) {
static ID imag_id = rb_intern("imag");
- return rb_funcall(obj, imag_id, 0);
+ return rb_funcall2(obj, imag_id, 0, 0);
}
}
@@ -127,7 +127,7 @@ SWIG_AsVal(Type)(VALUE o, Type *val)
float re;
int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
if (SWIG_IsOK(res)) {
- if (val) *val = Constructor(re, 0.0);
+ if (val) *val = Constructor(re, 0.0f);
return res;
}
}
diff --git a/linux-x86/share/swig/ruby/rubycontainer.swg b/linux-x86/share/swig/ruby/rubycontainer.swg
index 9fa205b..cd912d9 100644
--- a/linux-x86/share/swig/ruby/rubycontainer.swg
+++ b/linux-x86/share/swig/ruby/rubycontainer.swg
@@ -101,7 +101,7 @@ namespace swig {
inline Sequence*
getslice(const Sequence* self, Difference i, Difference j) {
typename Sequence::size_type size = self->size();
- typename Sequence::size_type ii = swig::check_index(i, size, (i == size && j == size));
+ typename Sequence::size_type ii = swig::check_index(i, size, (i == (Difference)size && j == (Difference)size));
typename Sequence::size_type jj = swig::slice_index(j, size);
if (jj > ii) {
@@ -117,25 +117,29 @@ namespace swig {
template <class Sequence, class Difference, class InputSeq>
inline void
- setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) {
+ setslice(Sequence* self, Difference i, Difference j, const InputSeq& is) {
typename Sequence::size_type size = self->size();
typename Sequence::size_type ii = swig::check_index(i, size, true);
typename Sequence::size_type jj = swig::slice_index(j, size);
if (jj < ii) jj = ii;
size_t ssize = jj - ii;
- if (ssize <= v.size()) {
+ if (ssize <= is.size()) {
+ // expanding/staying the same size
typename Sequence::iterator sb = self->begin();
- typename InputSeq::const_iterator vmid = v.begin();
+ typename InputSeq::const_iterator vmid = is.begin();
std::advance(sb,ii);
std::advance(vmid, jj - ii);
- self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end());
+ self->insert(std::copy(is.begin(), vmid, sb), vmid, is.end());
} else {
+ // shrinking
typename Sequence::iterator sb = self->begin();
typename Sequence::iterator se = self->begin();
std::advance(sb,ii);
std::advance(se,jj);
self->erase(sb,se);
- self->insert(sb, v.begin(), v.end());
+ sb = self->begin();
+ std::advance(sb,ii);
+ self->insert(sb, is.begin(), is.end());
}
}
@@ -186,7 +190,7 @@ namespace swig
return swig::as<T>(item);
} catch (const std::invalid_argument& e) {
char msg[1024];
- sprintf(msg, "in sequence element %d ", _index);
+ SWIG_snprintf(msg, sizeof(msg), "in sequence element %d ", _index);
VALUE lastErr = rb_gv_get("$!");
if ( lastErr == Qnil ) {
%type_error(swig::type_name<T>());
@@ -338,7 +342,7 @@ namespace swig
typedef T value_type;
typedef T* pointer;
typedef int difference_type;
- typedef int size_type;
+ typedef std::size_t size_type;
typedef const pointer const_pointer;
typedef RubySequence_InputIterator<T, reference> iterator;
typedef RubySequence_InputIterator<T, const_reference> const_iterator;
@@ -628,7 +632,7 @@ namespace swig
try {
r = swig::from< const Sequence* >( swig::getslice(self, i, j) );
}
- catch( std::out_of_range ) {
+ catch( const std::out_of_range& ) {
}
return r;
}
@@ -687,9 +691,8 @@ namespace swig
r = swig::from< Sequence::value_type >( *(at) );
$self->erase(at);
}
- catch (std::out_of_range)
- {
- }
+ catch (const std::out_of_range&) {
+ }
return r;
}
}
@@ -757,7 +760,7 @@ namespace swig
try {
r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) );
}
- catch( std::out_of_range ) {
+ catch( const std::out_of_range& ) {
}
return r;
}
@@ -780,7 +783,7 @@ namespace swig
try {
r = swig::from< const Sequence* >( swig::getslice(self, i, j) );
}
- catch( std::out_of_range ) {
+ catch( const std::out_of_range& ) {
}
return r;
}
@@ -790,7 +793,7 @@ namespace swig
try {
r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) );
}
- catch( std::out_of_range ) {
+ catch( const std::out_of_range& ) {
}
return r;
}
@@ -804,9 +807,9 @@ namespace swig
static ID id_start = rb_intern("begin");
static ID id_noend = rb_intern("exclude_end?");
- VALUE start = rb_funcall( i, id_start, 0 );
- VALUE end = rb_funcall( i, id_end, 0 );
- bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue );
+ VALUE start = rb_funcall2( i, id_start, 0, 0 );
+ VALUE end = rb_funcall2( i, id_end, 0, 0 );
+ bool noend = ( rb_funcall2( i, id_noend, 0, 0 ) == Qtrue );
int len = $self->size();
@@ -838,7 +841,7 @@ namespace swig
return swig::from< Sequence::value_type >( x );
}
- VALUE __setitem__(difference_type i, difference_type length, const Sequence& v) throw (std::invalid_argument) {
+ VALUE __setitem__(difference_type i, difference_type length, const Sequence& is) throw (std::invalid_argument) {
if ( length < 0 )
return Qnil;
@@ -850,13 +853,13 @@ namespace swig
i = len + i;
}
Sequence::difference_type j = length + i;
- if ( j > static_cast<Sequence::difference_type>(len) ) {
- swig::resize( $self, j, *(v.begin()) );
+ if ( j > static_cast<Sequence::difference_type>(len) && is.size() > 0 ) {
+ swig::resize( $self, j, *(is.begin()) );
}
VALUE r = Qnil;
- swig::setslice($self, i, j, v);
- r = swig::from< const Sequence* >( &v );
+ swig::setslice($self, i, j, is);
+ r = swig::from< const Sequence* >( &is );
return r;
}
}
@@ -1017,7 +1020,7 @@ namespace swig {
} else {
return rubyseq.check() ? SWIG_OK : SWIG_ERROR;
}
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
if (seq) {
VALUE lastErr = rb_gv_get("$!");
if (lastErr == Qnil) {
@@ -1057,7 +1060,7 @@ namespace swig {
} else {
return true;
}
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
if (seq) {
VALUE lastErr = rb_gv_get("$!");
if (lastErr == Qnil) {
diff --git a/linux-x86/share/swig/ruby/rubyerrors.swg b/linux-x86/share/swig/ruby/rubyerrors.swg
index 434544b..ad71d1d 100644
--- a/linux-x86/share/swig/ruby/rubyerrors.swg
+++ b/linux-x86/share/swig/ruby/rubyerrors.swg
@@ -110,7 +110,7 @@ const char* Ruby_Format_TypeError( const char* msg,
}
str = rb_str_cat2( str, "Expected argument " );
- sprintf( buf, "%d of type ", argn-1 );
+ SWIG_snprintf( buf, sizeof( buf), "%d of type ", argn-1 );
str = rb_str_cat2( str, buf );
str = rb_str_cat2( str, type );
str = rb_str_cat2( str, ", but got " );
diff --git a/linux-x86/share/swig/ruby/rubyhead.swg b/linux-x86/share/swig/ruby/rubyhead.swg
index 90f07cf..39196d4 100644
--- a/linux-x86/share/swig/ruby/rubyhead.swg
+++ b/linux-x86/share/swig/ruby/rubyhead.swg
@@ -1,4 +1,22 @@
+#if __GNUC__ >= 7
+#pragma GCC diagnostic push
+#if defined(__cplusplus)
+#pragma GCC diagnostic ignored "-Wregister"
+#if __GNUC__ >= 10
+#pragma GCC diagnostic ignored "-Wvolatile"
+#if __GNUC__ >= 11
+#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion"
+#endif
+#endif
+#endif
+#endif
+
#include <ruby.h>
+#include <ruby/version.h> /* For RUBY_API_VERSION_CODE */
+
+#if __GNUC__ >= 7
+#pragma GCC diagnostic pop
+#endif
/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
* breaks using rb_intern as an lvalue, as SWIG does. We work around this
@@ -98,38 +116,46 @@
/*
- * Need to be very careful about how these macros are defined, especially
- * when compiling C++ code or C code with an ANSI C compiler.
+ * The following macros are used for providing the correct type of a
+ * function pointer to the Ruby C API.
+ *
+ * Starting with Ruby 2.7 these macros act transparently due to Ruby's moving
+ * moving away from ANYARGS and instead employing strict function signatures.
+ *
+ * Note: In case of C (not C++) the macros are transparent even before
+ * Ruby 2.7 due to the fact that the Ruby C API used function declarators
+ * with empty parentheses, which allows for an unspecified number of
+ * arguments.
*
- * VALUEFUNC(f) is a macro used to typecast a C function that implements
- * a Ruby method so that it can be passed as an argument to API functions
- * like rb_define_method() and rb_define_singleton_method().
+ * PROTECTFUNC(f) is used for the function pointer argument of the Ruby
+ * C API function rb_protect().
*
- * VOIDFUNC(f) is a macro used to typecast a C function that implements
- * either the "mark" or "free" stuff for a Ruby Data object, so that it
- * can be passed as an argument to API functions like Data_Wrap_Struct()
+ * VALUEFUNC(f) is used for the function pointer argument(s) of Ruby C API
+ * functions like rb_define_method() and rb_define_singleton_method().
+ *
+ * VOIDFUNC(f) is used to typecast a C function that implements either
+ * the "mark" or "free" stuff for a Ruby Data object, so that it can be
+ * passed as an argument to Ruby C API functions like Data_Wrap_Struct()
* and Data_Make_Struct().
+ *
+ * SWIG_RUBY_VOID_ANYARGS_FUNC(f) is used for the function pointer
+ * argument(s) of Ruby C API functions like rb_define_virtual_variable().
+ *
+ * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer
+ * argument(s) of Ruby C API functions like st_foreach().
*/
-
-#ifdef __cplusplus
-# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
-# define PROTECTFUNC(f) ((VALUE (*)()) f)
-# define VALUEFUNC(f) ((VALUE (*)()) f)
-# define VOIDFUNC(f) ((void (*)()) f)
-# else
-# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
-# define PROTECTFUNC(f) ((VALUE (*)()) f)
-# define VALUEFUNC(f) ((VALUE (*)()) f)
-# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
-# else /* These definitions should work for Ruby 1.7+ */
-# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
-# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
-# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
-# endif
-# endif
+#if defined(__cplusplus) && RUBY_API_VERSION_CODE < 20700
+# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
+# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
+# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
+# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f))
+# define SWIG_RUBY_INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f))
#else
+# define PROTECTFUNC(f) (f)
# define VALUEFUNC(f) (f)
# define VOIDFUNC(f) (f)
+# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) (f)
+# define SWIG_RUBY_INT_ANYARGS_FUNC(f) (f)
#endif
/* Don't use for expressions have side effect */
diff --git a/linux-x86/share/swig/ruby/rubykw.swg b/linux-x86/share/swig/ruby/rubykw.swg
index 194687b..6b4685e 100644
--- a/linux-x86/share/swig/ruby/rubykw.swg
+++ b/linux-x86/share/swig/ruby/rubykw.swg
@@ -2,7 +2,7 @@
#define RUBY_RUBYKW_SWG_
/* Warnings for Ruby keywords */
-#define RUBYKW(x) %keywordwarn("'" `x` "' is a ruby keyword, renaming to 'C_" `x` "'",rename="C_%s",fullname=1) `x`
+#define RUBYKW(x) %keywordwarn("'" `x` "' is a ruby keyword",rename="C_%s",fullname=1) `x`
/*
diff --git a/linux-x86/share/swig/ruby/rubyprimtypes.swg b/linux-x86/share/swig/ruby/rubyprimtypes.swg
index 3a84819..d5d9d73 100644
--- a/linux-x86/share/swig/ruby/rubyprimtypes.swg
+++ b/linux-x86/share/swig/ruby/rubyprimtypes.swg
@@ -10,15 +10,16 @@
%fragment("SWIG_ruby_failed","header")
{
SWIGINTERN VALUE
-SWIG_ruby_failed(void)
+SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2))
{
return Qnil;
}
}
%define %ruby_aux_method(Type, Method, Action)
-SWIGINTERN VALUE SWIG_AUX_##Method##(VALUE *args)
+SWIGINTERN VALUE SWIG_AUX_##Method##(VALUE arg)
{
+ VALUE *args = (VALUE *)arg;
VALUE obj = args[0];
VALUE type = TYPE(obj);
Type *res = (Type *)(args[1]);
@@ -79,7 +80,7 @@ SWIG_AsVal_dec(long)(VALUE obj, long* val)
VALUE a[2];
a[0] = obj;
a[1] = (VALUE)(&v);
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
if (val) *val = v;
return SWIG_OK;
}
@@ -111,7 +112,9 @@ SWIG_AsVal_dec(unsigned long)(VALUE obj, unsigned long *val)
VALUE a[2];
a[0] = obj;
a[1] = (VALUE)(&v);
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (rb_funcall(obj, swig_lowerthan_id, 1, INT2FIX(0)) != Qfalse)
+ return SWIG_OverflowError;
if (val) *val = v;
return SWIG_OK;
}
@@ -149,7 +152,7 @@ SWIG_AsVal_dec(long long)(VALUE obj, long long *val)
VALUE a[2];
a[0] = obj;
a[1] = (VALUE)(&v);
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
if (val) *val = v;
return SWIG_OK;
}
@@ -187,7 +190,9 @@ SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val)
VALUE a[2];
a[0] = obj;
a[1] = (VALUE)(&v);
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (rb_funcall(obj, swig_lowerthan_id, 1, INT2FIX(0)) != Qfalse)
+ return SWIG_OverflowError;
if (val) *val = v;
return SWIG_OK;
}
@@ -215,7 +220,7 @@ SWIG_AsVal_dec(double)(VALUE obj, double *val)
VALUE a[2];
a[0] = obj;
a[1] = (VALUE)(&v);
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
if (val) *val = v;
return SWIG_OK;
}
diff --git a/linux-x86/share/swig/ruby/rubyrun.swg b/linux-x86/share/swig/ruby/rubyrun.swg
index 4b2ffe4..d72102a 100644
--- a/linux-x86/share/swig/ruby/rubyrun.swg
+++ b/linux-x86/share/swig/ruby/rubyrun.swg
@@ -80,6 +80,7 @@ static VALUE swig_runtime_data_type_pointer = Qnil;
/* Global IDs used to keep some internal SWIG stuff */
static ID swig_arity_id = 0;
static ID swig_call_id = 0;
+static ID swig_lowerthan_id = 0;
/*
If your swig extension is to be run within an embedded ruby and has
@@ -131,7 +132,7 @@ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
VALUE exceptionClass = getExceptionClass();
if (rb_obj_is_kind_of(obj, exceptionClass)) {
return obj;
- } else {
+ } else {
return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
}
}
@@ -144,6 +145,7 @@ SWIG_Ruby_InitRuntime(void)
_mSWIG = rb_define_module("SWIG");
swig_call_id = rb_intern("call");
swig_arity_id = rb_intern("arity");
+ swig_lowerthan_id = rb_intern("<");
}
}
@@ -151,13 +153,14 @@ SWIG_Ruby_InitRuntime(void)
SWIGRUNTIME void
SWIG_Ruby_define_class(swig_type_info *type)
{
- char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
- sprintf(klass_name, "TYPE%s", type->name);
+ size_t klass_len = 4 + strlen(type->name) + 1;
+ char *klass_name = (char *) malloc(klass_len);
+ SWIG_snprintf(klass_name, klass_len, "TYPE%s", type->name);
if (NIL_P(_cSWIG_Pointer)) {
_cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
}
- rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
+ rb_undef_alloc_func(rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer));
free((void *) klass_name);
}
@@ -208,8 +211,9 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
SWIG_RubyAddTracking(ptr, obj);
}
} else {
- klass_name = (char *) malloc(4 + strlen(type->name) + 1);
- sprintf(klass_name, "TYPE%s", type->name);
+ size_t klass_len = 4 + strlen(type->name) + 1;
+ klass_name = (char *) malloc(klass_len);
+ SWIG_snprintf(klass_name, klass_len, "TYPE%s", type->name);
klass = rb_const_get(_mSWIG, rb_intern(klass_name));
free((void *) klass_name);
obj = Data_Wrap_Struct(klass, 0, 0, ptr);
@@ -235,6 +239,8 @@ SWIGRUNTIMEINLINE char *
SWIG_Ruby_MangleStr(VALUE obj)
{
VALUE stype = rb_iv_get(obj, "@__swigtype__");
+ if (NIL_P(stype))
+ return NULL;
return StringValuePtr(stype);
}
@@ -279,6 +285,11 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
own->own = 0;
}
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE)) {
+ if (!RDATA(obj)->dfree)
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ }
+
/* Check to see if the input object is giving up ownership
of the underlying C struct or C++ object. If so then we
need to reset the destructor since the Ruby object no
@@ -290,7 +301,7 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
swig_class *sklass = (swig_class *) ty->clientdata;
track = sklass->trackObjects;
}
-
+
if (track) {
/* We are tracking objects for this class. Thus we change the destructor
* to SWIG_RubyRemoveTracking. This allows us to
@@ -304,6 +315,10 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
}
}
+ if (flags & SWIG_POINTER_CLEAR) {
+ DATA_PTR(obj) = 0;
+ }
+
/* Do type-checking if type info was provided */
if (ty) {
if (ty->clientdata) {
@@ -411,6 +426,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer)
{
/* register a new class */
VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
+ rb_undef_alloc_func(cl);
/* create and store the structure pointer to a global variable */
swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
@@ -441,7 +457,7 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
{
if ( rb_respond_to( proc, swig_arity_id ) )
{
- VALUE num = rb_funcall( proc, swig_arity_id, 0 );
+ VALUE num = rb_funcall2( proc, swig_arity_id, 0, 0 );
int arity = NUM2INT(num);
if ( arity < 0 && (arity+1) < -minimal ) return 1;
if ( arity == minimal ) return 1;
diff --git a/linux-x86/share/swig/ruby/rubytracking.swg b/linux-x86/share/swig/ruby/rubytracking.swg
index b9fb249..1edcc56 100644
--- a/linux-x86/share/swig/ruby/rubytracking.swg
+++ b/linux-x86/share/swig/ruby/rubytracking.swg
@@ -32,7 +32,7 @@ extern "C" {
*/
static st_table* swig_ruby_trackings = NULL;
-static VALUE swig_ruby_trackings_count(ANYARGS) {
+static VALUE swig_ruby_trackings_count(ID id, VALUE *var) {
return SWIG2NUM(swig_ruby_trackings->num_entries);
}
@@ -69,7 +69,9 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
}
- rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
+ rb_define_virtual_variable("SWIG_TRACKINGS_COUNT",
+ VALUEFUNC(swig_ruby_trackings_count),
+ SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL));
}
/* Add a Tracking from a C/C++ struct to a Ruby object */
@@ -118,13 +120,15 @@ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
to the passed callback function. */
/* Proxy method to abstract the internal trackings datatype */
-static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
- (*meth)(ptr, obj);
+static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) {
+ ((void (*) (void *, VALUE))meth)((void *)ptr, (VALUE)obj);
return ST_CONTINUE;
}
SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
- st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth);
+ st_foreach(swig_ruby_trackings,
+ SWIG_RUBY_INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback),
+ (st_data_t)meth);
}
#ifdef __cplusplus
diff --git a/linux-x86/share/swig/ruby/std_array.i b/linux-x86/share/swig/ruby/std_array.i
index a4d3ef5..c00685f 100644
--- a/linux-x86/share/swig/ruby/std_array.i
+++ b/linux-x86/share/swig/ruby/std_array.i
@@ -41,7 +41,7 @@
getslice(const std::array<T, N>* self, Difference i, Difference j) {
typedef std::array<T, N> Sequence;
typename Sequence::size_type size = self->size();
- typename Sequence::size_type ii = swig::check_index(i, size, (i == size && j == size));
+ typename Sequence::size_type ii = swig::check_index(i, size, (i == (Difference)size && j == (Difference)size));
typename Sequence::size_type jj = swig::slice_index(j, size);
if (ii == 0 && jj == size) {
diff --git a/linux-x86/share/swig/ruby/std_auto_ptr.i b/linux-x86/share/swig/ruby/std_auto_ptr.i
new file mode 100644
index 0000000..3d7ae8b
--- /dev/null
+++ b/linux-x86/share/swig/ruby/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/ruby/std_map.i b/linux-x86/share/swig/ruby/std_map.i
index 7077fa1..99e3d40 100644
--- a/linux-x86/share/swig/ruby/std_map.i
+++ b/linux-x86/share/swig/ruby/std_map.i
@@ -96,7 +96,7 @@
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);
+ VALUE items = rb_funcall2(obj, id_to_a, 0, 0);
res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
} else {
map_type *p;
@@ -344,7 +344,11 @@
}
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
VALUE inspect()
diff --git a/linux-x86/share/swig/ruby/std_multimap.i b/linux-x86/share/swig/ruby/std_multimap.i
index 762a876..5d8e33e 100644
--- a/linux-x86/share/swig/ruby/std_multimap.i
+++ b/linux-x86/share/swig/ruby/std_multimap.i
@@ -23,7 +23,7 @@
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);
+ VALUE items = rb_funcall2(obj, id_to_a, 0, 0);
return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
} else {
multimap_type *p;
diff --git a/linux-x86/share/swig/ruby/std_set.i b/linux-x86/share/swig/ruby/std_set.i
index e38702e..1b425c6 100644
--- a/linux-x86/share/swig/ruby/std_set.i
+++ b/linux-x86/share/swig/ruby/std_set.i
@@ -180,17 +180,14 @@
// Redefine std::set iterator/reverse_iterator typemap
%typemap(out,noblock=1) iterator, reverse_iterator {
- $result = SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,const $type &),
- self),
- swig::Iterator::descriptor(),SWIG_POINTER_OWN);
+ $result = SWIG_NewPointerObj((swig::make_set_nonconst_iterator<$type>($1, self)), swig::Iterator::descriptor(), SWIG_POINTER_OWN);
}
// Redefine std::set std::pair<iterator, bool> typemap
%typemap(out,noblock=1,fragment="RubyPairBoolOutputIterator")
std::pair<iterator, bool> {
$result = rb_ary_new2(2);
- rb_ary_push($result, SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,$type &).first),
- swig::Iterator::descriptor(),SWIG_POINTER_OWN));
+ rb_ary_push($result, SWIG_NewPointerObj((swig::make_set_nonconst_iterator($1.first)), swig::Iterator::descriptor(), SWIG_POINTER_OWN));
rb_ary_push($result, SWIG_From(bool)(%static_cast($1,const $type &).second));
}
diff --git a/linux-x86/share/swig/ruby/std_shared_ptr.i b/linux-x86/share/swig/ruby/std_shared_ptr.i
index dee35ec..086e308 100644
--- a/linux-x86/share/swig/ruby/std_shared_ptr.i
+++ b/linux-x86/share/swig/ruby/std_shared_ptr.i
@@ -13,24 +13,27 @@ namespace swig {
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;
+ int res = SWIG_ERROR;
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;
+ if (val) {
+ std::shared_ptr<Type> *p = 0;
+ swig_ruby_owntype newmem = {0, 0};
+ res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR;
+ if (SWIG_IsOK(res)) {
+ 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;
+ }
+ } else {
+ res = descriptor ? SWIG_ConvertPtr(obj, 0, descriptor, 0) : SWIG_ERROR;
}
return res;
}
diff --git a/linux-x86/share/swig/ruby/std_string_view.i b/linux-x86/share/swig/ruby/std_string_view.i
new file mode 100644
index 0000000..cbfc428
--- /dev/null
+++ b/linux-x86/share/swig/ruby/std_string_view.i
@@ -0,0 +1,6 @@
+
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) std::basic_string_view<char>;
+
+AUTODOC(substr, "Return a portion of the String");
+
+%include <typemaps/std_string_view.swg>
diff --git a/linux-x86/share/swig/ruby/std_unique_ptr.i b/linux-x86/share/swig/ruby/std_unique_ptr.i
new file mode 100644
index 0000000..f988714
--- /dev/null
+++ b/linux-x86/share/swig/ruby/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/ruby/std_unordered_map.i b/linux-x86/share/swig/ruby/std_unordered_map.i
index 48c8752..3c6b650 100644
--- a/linux-x86/share/swig/ruby/std_unordered_map.i
+++ b/linux-x86/share/swig/ruby/std_unordered_map.i
@@ -23,7 +23,7 @@
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);
+ VALUE items = rb_funcall2(obj, id_to_a, 0, 0);
res = traits_asptr_stdseq<std::unordered_map<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
} else {
map_type *p;
diff --git a/linux-x86/share/swig/ruby/std_unordered_multimap.i b/linux-x86/share/swig/ruby/std_unordered_multimap.i
index ebc53b5..c3261f9 100644
--- a/linux-x86/share/swig/ruby/std_unordered_multimap.i
+++ b/linux-x86/share/swig/ruby/std_unordered_multimap.i
@@ -23,7 +23,7 @@
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);
+ VALUE items = rb_funcall2(obj, id_to_a, 0, 0);
return traits_asptr_stdseq<std::unordered_multimap<K,T,Hash,Compare,Alloc>, std::pair<K, T> >::asptr(items, val);
} else {
multimap_type *p;
diff --git a/linux-x86/share/swig/ruby/std_wstring.i b/linux-x86/share/swig/ruby/std_wstring.i
index 2b63343..c5d168a 100644
--- a/linux-x86/share/swig/ruby/std_wstring.i
+++ b/linux-x86/share/swig/ruby/std_wstring.i
@@ -1,4 +1,15 @@
%{
+#if defined(__linux__)
+#include <endian.h>
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define SWIG_RUBY_ENDIAN "LE"
+#elif BYTE_ORDER == BIG_ENDIAN
+#define SWIG_RUBY_ENDIAN "BE"
+#endif
+#else
+#define SWIG_RUBY_ENDIAN "LE"
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -15,9 +26,9 @@ extern "C" {
#ifndef SWIG_RUBY_WSTRING_ENCODING
#if WCHAR_MAX == 0x7fff || WCHAR_MAX == 0xffff
-#define SWIG_RUBY_WSTRING_ENCODING "UTF-16LE"
+#define SWIG_RUBY_WSTRING_ENCODING "UTF-16" SWIG_RUBY_ENDIAN
#elif WCHAR_MAX == 0x7fffffff || WCHAR_MAX == 0xffffffff
-#define SWIG_RUBY_WSTRING_ENCODING "UTF-32LE"
+#define SWIG_RUBY_WSTRING_ENCODING "UTF-32" SWIG_RUBY_ENDIAN
#else
#error unsupported wchar_t size. SWIG_RUBY_WSTRING_ENCODING must be given.
#endif
diff --git a/linux-x86/share/swig/ruby/swigmove.i b/linux-x86/share/swig/ruby/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/ruby/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/ruby/timeval.i b/linux-x86/share/swig/ruby/timeval.i
index e7bc2d3..94a75c8 100644
--- a/linux-x86/share/swig/ruby/timeval.i
+++ b/linux-x86/share/swig/ruby/timeval.i
@@ -55,7 +55,7 @@ struct timeval rb_time_timeval(VALUE);
if (NIL_P($input))
$1 = (time_t)-1;
else
- $1 = NUM2LONG(rb_funcall($input, rb_intern("tv_sec"), 0));
+ $1 = NUM2LONG(rb_funcall2($input, rb_intern("tv_sec"), 0, 0));
}
%typemap(typecheck) time_t
diff --git a/linux-x86/share/swig/ruby/typemaps.i b/linux-x86/share/swig/ruby/typemaps.i
index c4db821..a3eaa0c 100644
--- a/linux-x86/share/swig/ruby/typemaps.i
+++ b/linux-x86/share/swig/ruby/typemaps.i
@@ -119,7 +119,7 @@ multiple output values, they are returned in the form of a Ruby Array.
For example, suppose you were trying to wrap the modf() function in the
C math library which splits x into integral and fractional parts (and
-returns the integer part in one of its parameters).K:
+returns the integer part in one of its parameters) :
double modf(double x, double *ip);
@@ -139,7 +139,7 @@ output values.
*/
%define OUTPUT_TYPEMAP(type, converter, convtype)
-%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;";
+%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;"
%typemap(argout, fragment="output_helper") type *OUTPUT, type &OUTPUT {
VALUE o = converter(convtype (*$1));
$result = output_helper($result, o);
@@ -161,7 +161,7 @@ OUTPUT_TYPEMAP(double, rb_float_new, (double));
#undef OUTPUT_TYPEMAP
-%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;";
+%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;"
%typemap(argout, fragment="output_helper") bool *OUTPUT, bool &OUTPUT {
VALUE o = (*$1) ? Qtrue : Qfalse;
$result = output_helper($result, o);
@@ -214,10 +214,6 @@ to a Ruby variable you might do this :
x = neg(x)
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
*/
%typemap(in) int *INOUT = int *INPUT;
diff --git a/linux-x86/share/swig/scilab/argcargv.i b/linux-x86/share/swig/scilab/argcargv.i
new file mode 100644
index 0000000..9aeda1a
--- /dev/null
+++ b/linux-x86/share/swig/scilab/argcargv.i
@@ -0,0 +1,109 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%{
+SWIGINTERN int SWIG_AsVal_strings (SwigSciObject iVar, int **array, int report) {
+ int iType = 0;
+ SciErr sciErr = getVarAddressFromPosition(pvApiCtx, iVar, array);
+ if (sciErr.iErr) {
+ if (report) printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+ sciErr = getVarType(pvApiCtx, *array, &iType);
+ if (sciErr.iErr) {
+ if (report) printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+ if (iType != sci_strings) {
+ /* An empty matrix has type sci_matrix. */
+ if (!isEmptyMatrix(pvApiCtx, *array)) {
+ return SWIG_TypeError;
+ }
+ *array = SWIG_NULLPTR;
+ }
+ return SWIG_OK;
+}
+%}
+
+%typemap(in) (int ARGC, char **ARGV) {
+ SciErr sciErr;
+ size_t memsize;
+ int i, rows, cols, res, len, *aLen, *array;
+ res = SWIG_AsVal_strings ($input, &array, 1);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_TypeError) {
+ SWIG_exception_fail(SWIG_TypeError, "not a string matrix");
+ }
+ SWIG_fail;
+ }
+
+ if (array == SWIG_NULLPTR) {
+ /* Special case for empty matrix. */
+ $1 = 0;
+ $2 = ($2_ltype) malloc(sizeof($*2_ltype));
+ $2[0] = SWIG_NULLPTR;
+ } else {
+ /* first call to retrieve dimensions */
+ rows = 0;
+ cols = 0;
+ sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, SWIG_NULLPTR, SWIG_NULLPTR);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ SWIG_fail;
+ }
+ len = rows * cols;
+ memsize = sizeof(int) * len;
+ aLen = (int*)malloc(memsize);
+ if (aLen == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_MemoryError, "fail allocate sizes array");
+ }
+ memset(aLen, 0, memsize);
+ /*second call to retrieve length of each string */
+ sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, aLen, SWIG_NULLPTR);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ free((void *)aLen);
+ SWIG_fail;
+ }
+ memsize = sizeof($*2_ltype) * (len + 1);
+ $1 = ($1_ltype) len;
+ $2 = ($2_ltype) malloc(memsize);
+ if ($2 == SWIG_NULLPTR) {
+ free((void *)aLen);
+ SWIG_exception_fail(SWIG_MemoryError, "fail allocate array");
+ }
+ memset($2, 0, memsize);
+ for(i = 0 ; i < len ; i++) {
+ $2[i] = ($*2_ltype)malloc(aLen[i] + 1);
+ if ($2[i] == SWIG_NULLPTR) {
+ free((void *)aLen);
+ SWIG_exception_fail(SWIG_MemoryError, "fail allocate array string element");
+ }
+ }
+ /* third call to retrieve data */
+ sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, aLen, $2);
+ if(sciErr.iErr) {
+ printError(&sciErr, 0);
+ free((void *)aLen);
+ SWIG_fail;
+ }
+ $2[len] = SWIG_NULLPTR;
+ free((void *)aLen);
+ }
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ int *array;
+ $1 = SWIG_IsOK(SWIG_AsVal_strings ($input, &array, 0));
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ if ($2 != SWIG_NULLPTR) {
+ $1_ltype i;
+ for (i = 0; i < $1; i++) {
+ free((void *)$2[i]);
+ }
+ free((void *)$2);
+ }
+}
diff --git a/linux-x86/share/swig/scilab/boost_shared_ptr.i b/linux-x86/share/swig/scilab/boost_shared_ptr.i
index 668bf43..87c89b5 100644
--- a/linux-x86/share/swig/scilab/boost_shared_ptr.i
+++ b/linux-x86/share/swig/scilab/boost_shared_ptr.i
@@ -35,7 +35,7 @@
}
}
%typemap(out) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1));
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -54,12 +54,12 @@
}
}
%typemap(varout) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $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));
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($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) {
diff --git a/linux-x86/share/swig/scilab/sciarray.swg b/linux-x86/share/swig/scilab/sciarray.swg
index c00e383..97b30a2 100644
--- a/linux-x86/share/swig/scilab/sciarray.swg
+++ b/linux-x86/share/swig/scilab/sciarray.swg
@@ -40,8 +40,8 @@
}
else {
char errmsg[100];
- sprintf(errmsg, "Size of input data (%d) is too big (maximum is %d)",
- iRows*iCols, $1_dim0);
+ SWIG_snprintf2(errmsg, sizeof(errmsg), "Size of input data (%d) is too big (maximum is %d)",
+ iRows*iCols, $1_dim0);
SWIG_exception_fail(SWIG_OverflowError, errmsg);
}
}
diff --git a/linux-x86/share/swig/scilab/scidouble.swg b/linux-x86/share/swig/scilab/scidouble.swg
index 1b82633..e14c846 100644
--- a/linux-x86/share/swig/scilab/scidouble.swg
+++ b/linux-x86/share/swig/scilab/scidouble.swg
@@ -56,6 +56,7 @@ SWIG_SciDouble_FromDouble(void *pvApiCtx, int iVarOut, double dblValue, char *fn
SWIGINTERN int
SWIG_SciDouble_AsDoubleArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, double **pdValue, char *fname) {
SciErr sciErr;
+ int iType = 0;
int *piAddrVar = NULL;
sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar);
@@ -64,13 +65,24 @@ SWIG_SciDouble_AsDoubleArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *i
return SWIG_ERROR;
}
- if (isDoubleType(pvApiCtx, piAddrVar) && !isVarComplex(pvApiCtx, piAddrVar)) {
+ sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+
+ if (iType == sci_matrix && !isVarComplex(pvApiCtx, piAddrVar)) {
sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, pdValue);
if (sciErr.iErr) {
printError(&sciErr, 0);
return SWIG_ERROR;
}
}
+ else if (iType == sci_implicit_poly) {
+ *iRows = -1;
+ *iCols = 0;
+ *pdValue = NULL;
+ }
else {
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A real matrix expected.\n"), fname, iVar);
return SWIG_ERROR;
diff --git a/linux-x86/share/swig/scilab/scienum.swg b/linux-x86/share/swig/scilab/scienum.swg
index 54ec1f8..cc1f7c9 100644
--- a/linux-x86/share/swig/scilab/scienum.swg
+++ b/linux-x86/share/swig/scilab/scienum.swg
@@ -18,7 +18,7 @@ SWIG_Int_AsEnum(void *pvApiCtx, int iVar, int *enumValue, char *fname) {
}
%fragment(SWIG_From_frag(Enum), "header", fragment="SWIG_Int_FromEnum") {
-%#define SWIG_From_Enum(scilabValue) SWIG_Int_FromEnum(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName())
+%#define SWIG_From_Enum(scilabValue) SWIG_Int_FromEnum(pvApiCtx, SWIG_Scilab_GetOutputPosition(), (int)scilabValue, SWIG_Scilab_GetFuncName())
}
%fragment("SWIG_Int_FromEnum", "header", fragment="SWIG_SciDouble_FromInt") {
SWIGINTERN int
diff --git a/linux-x86/share/swig/scilab/sciexception.swg b/linux-x86/share/swig/scilab/sciexception.swg
index 1d653b3..9b842cf 100644
--- a/linux-x86/share/swig/scilab/sciexception.swg
+++ b/linux-x86/share/swig/scilab/sciexception.swg
@@ -17,20 +17,20 @@
size_t, size_t&,
ptrdiff_t, ptrdiff_t& {
char obj[20];
- sprintf(obj, "%d", (int)$1);
+ SWIG_snprintf(obj, sizeof(obj), "%d", (int)$1);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
%typemap(throws, noblock=1) enum SWIGTYPE {
char obj[20];
- sprintf(obj, "%d", (int)$1);
+ SWIG_snprintf(obj, sizeof(obj), "%d", (int)$1);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
%typemap(throws, noblock=1) float, double,
float&, double& {
char obj[20];
- sprintf(obj, "%5.3f", (double)$1);
+ SWIG_snprintf(obj, sizeof(obj), "%5.3f", (double)$1);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
@@ -44,7 +44,8 @@
%typemap(throws, noblock=1) char, char& {
char obj[2];
- sprintf(obj, "%c", (char)$1);
+ obj[0] = (char)$1;
+ obj[1] = 0;
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
diff --git a/linux-x86/share/swig/scilab/sciint.swg b/linux-x86/share/swig/scilab/sciint.swg
index 2d69935..b7b2563 100644
--- a/linux-x86/share/swig/scilab/sciint.swg
+++ b/linux-x86/share/swig/scilab/sciint.swg
@@ -157,6 +157,11 @@ SWIG_SciDoubleOrInt32_AsIntArrayAndSize(void *pvApiCtx, int iVar, int *iRows, in
return SWIG_ERROR;
}
}
+ else if (iType == sci_implicit_poly) {
+ *iRows = -1;
+ *iCols = 0;
+ *piValue = NULL;
+ }
else {
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double matrix expected.\n"), fname, iVar);
return SWIG_ERROR;
diff --git a/linux-x86/share/swig/scilab/scimatrixdouble.swg b/linux-x86/share/swig/scilab/scimatrixdouble.swg
index 9444a80..bb9403e 100644
--- a/linux-x86/share/swig/scilab/scimatrixdouble.swg
+++ b/linux-x86/share/swig/scilab/scimatrixdouble.swg
@@ -28,7 +28,11 @@
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (double *IN, int IN_SIZE) (int rowCount, int colCount)
{
if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) {
- $2 = rowCount * colCount;
+ if (rowCount < 0) {
+ $2 = rowCount;
+ } else {
+ $2 = rowCount * colCount;
+ }
}
else {
return SWIG_ERROR;
@@ -40,7 +44,11 @@
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (int IN_SIZE, double *IN) (int rowCount, int colCount)
{
if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) {
- $1 = rowCount * colCount;
+ if (rowCount < 0) {
+ $1 = rowCount;
+ } else {
+ $1 = rowCount * colCount;
+ }
}
else {
return SWIG_ERROR;
diff --git a/linux-x86/share/swig/scilab/scimatrixint.swg b/linux-x86/share/swig/scilab/scimatrixint.swg
index e304d4f..0577107 100644
--- a/linux-x86/share/swig/scilab/scimatrixint.swg
+++ b/linux-x86/share/swig/scilab/scimatrixint.swg
@@ -30,7 +30,11 @@
%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int *IN, int IN_SIZE) (int rowCount, int colCount)
{
if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) {
- $2 = rowCount * colCount;
+ if (rowCount < 0) {
+ $2 = rowCount;
+ } else {
+ $2 = rowCount * colCount;
+ }
}
else {
return SWIG_ERROR;
@@ -43,7 +47,11 @@
%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int IN_SIZE, int *IN) (int rowCount, int colCount)
{
if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) {
- $1 = rowCount * colCount;
+ if (rowCount < 0) {
+ $1 = rowCount;
+ } else {
+ $1 = rowCount * colCount;
+ }
}
else {
return SWIG_ERROR;
diff --git a/linux-x86/share/swig/scilab/scirun.swg b/linux-x86/share/swig/scilab/scirun.swg
index 51df9a5..481aac7 100644
--- a/linux-x86/share/swig/scilab/scirun.swg
+++ b/linux-x86/share/swig/scilab/scirun.swg
@@ -5,7 +5,6 @@
/* Scilab version macro */
#include "version.h"
-#define SWIG_SCILAB_VERSION (SCI_VERSION_MAJOR * 100) + (SCI_VERSION_MINOR * 10) + SCI_VERSION_MAINTENANCE
/* Scilab standard headers */
@@ -13,11 +12,11 @@
extern "C" {
#endif
#include "api_scilab.h"
-#if SWIG_SCILAB_VERSION < 540
+#if SCI_VERSION_MAJOR < 5 || SCI_VERSION_MAJOR == 5 && SCI_VERSION_MINOR < 4
#define __USE_DEPRECATED_STACK_FUNCTIONS__
#include "stack-c.h"
#endif
-#if SWIG_SCILAB_VERSION < 600
+#if SCI_VERSION_MAJOR < 6
#include "MALLOC.h"
#endif
#include "Scierror.h"
@@ -31,12 +30,12 @@ extern "C" {
/* Gateway signature */
-#if SWIG_SCILAB_VERSION >= 600
-#define SWIG_GatewayParameters char* fname, void *pvApiCtx
-#define SWIG_GatewayArguments fname, pvApiCtx
-#else
+#if SCI_VERSION_MAJOR < 6
#define SWIG_GatewayParameters char* fname, unsigned long fname_len
#define SWIG_GatewayArguments fname, fname_len
+# else
+#define SWIG_GatewayParameters char* fname, void *pvApiCtx
+#define SWIG_GatewayArguments fname, pvApiCtx
#endif
/* Function name management functions */
@@ -47,10 +46,8 @@ static char *SWIG_Scilab_GetFuncName(void) {
return SwigFuncName;
}
static void SWIG_Scilab_SetFuncName(char *funcName) {
- if (SwigFuncName != NULL) {
- free(SwigFuncName);
- SwigFuncName = NULL;
- }
+ free(SwigFuncName);
+ SwigFuncName = NULL;
if (funcName) {
SwigFuncName = (char *)malloc(strlen(funcName) + 1);
if (SwigFuncName)
@@ -60,29 +57,29 @@ static void SWIG_Scilab_SetFuncName(char *funcName) {
/* Api context management functions */
-#if SWIG_SCILAB_VERSION >= 600
+#if SCI_VERSION_MAJOR < 6
+#define SWIG_Scilab_SetApiContext(apiCtx)
+#else
static void *pvApiCtx = NULL;
static void SWIG_Scilab_SetApiContext(void *apiCtx) {
pvApiCtx = apiCtx;
}
-#else
-#define SWIG_Scilab_SetApiContext(apiCtx)
#endif
/* Argument management functions */
-#if SWIG_SCILAB_VERSION >= 540
-#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument)
-#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument)
-#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument)
-#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx)
-#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos
-#else
+#if SCI_VERSION_MAJOR < 5 || SCI_VERSION_MAJOR == 5 && SCI_VERSION_MINOR < 4
#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckRhs(minInputArgument, maxInputArgument)
#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckRhs(minInputArgument, 256)
#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckLhs(minOutputArgument, maxOutputArgument)
#define SWIG_NbInputArgument(pvApiCtx) Rhs
#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) LhsVar(outputArgumentPos) = argumentPos
+#else
+#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument)
+#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument)
+#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument)
+#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx)
+#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos
#endif
typedef int SwigSciObject;
@@ -436,7 +433,7 @@ SWIG_Scilab_NewMemberObj(void *pvApiCtx, int iVarOut, void *ptr, int sz, swig_ty
#ifdef __cplusplus
extern "C"
#endif
-int SWIG_this(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_this(SWIG_GatewayParameters) {
void *ptrValue = NULL;
if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) {
SWIG_Scilab_SetOutputPosition(1);
@@ -453,7 +450,7 @@ int SWIG_this(SWIG_GatewayParameters) {
#ifdef __cplusplus
extern "C"
#endif
-int SWIG_ptr(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_ptr(SWIG_GatewayParameters) {
if (SWIG_NbInputArgument(pvApiCtx) > 0) {
SciErr sciErr;
int *piAddrVar1 = NULL;
diff --git a/linux-x86/share/swig/scilab/sciruntime.swg b/linux-x86/share/swig/scilab/sciruntime.swg
index 3de138e..e772926 100644
--- a/linux-x86/share/swig/scilab/sciruntime.swg
+++ b/linux-x86/share/swig/scilab/sciruntime.swg
@@ -40,7 +40,7 @@ SWIG_Scilab_TypeQuery(const char *name) {
#ifdef __cplusplus
extern "C"
#endif
-int <module>_Init(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_<module>_Init(SWIG_GatewayParameters) {
SWIG_InitializeModule(NULL);
SWIG_CreateScilabVariables(pvApiCtx);
swig_module_initialized = 1;
diff --git a/linux-x86/share/swig/scilab/std_map.i b/linux-x86/share/swig/scilab/std_map.i
index 07eb63f..aeede60 100644
--- a/linux-x86/share/swig/scilab/std_map.i
+++ b/linux-x86/share/swig/scilab/std_map.i
@@ -47,7 +47,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -63,17 +67,4 @@ namespace std {
}
};
-// 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/linux-x86/share/swig/scilab/std_string.i b/linux-x86/share/swig/scilab/std_string.i
index 71ac6d2..8736c2a 100644
--- a/linux-x86/share/swig/scilab/std_string.i
+++ b/linux-x86/share/swig/scilab/std_string.i
@@ -37,3 +37,11 @@ SWIG_From_dec(std::string)(std::string pstValue) {
}
%include <typemaps/std_string.swg>
+
+%typemap(throws, noblock=1) std::string {
+ SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $&descriptor);
+}
+
+%typemap(throws, noblock=1) const std::string & {
+ SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $descriptor);
+}
diff --git a/linux-x86/share/swig/scilab/swigmove.i b/linux-x86/share/swig/scilab/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/scilab/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/shared_ptr.i b/linux-x86/share/swig/shared_ptr.i
index eada0b9..b450229 100644
--- a/linux-x86/share/swig/shared_ptr.i
+++ b/linux-x86/share/swig/shared_ptr.i
@@ -55,15 +55,3 @@ struct SWIG_null_deleter {
SWIG_SHARED_PTR_TYPEMAPS(, TYPE)
SWIG_SHARED_PTR_TYPEMAPS(const, TYPE)
%enddef
-
-// Legacy macros
-%define SWIG_SHARED_PTR(PROXYCLASS, TYPE...)
-#warning "SWIG_SHARED_PTR(PROXYCLASS, TYPE) is deprecated. Please use %shared_ptr(TYPE) instead."
-%shared_ptr(TYPE)
-%enddef
-
-%define SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE...)
-#warning "SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %shared_ptr(TYPE) instead."
-%shared_ptr(TYPE)
-%enddef
-
diff --git a/linux-x86/share/swig/std/std_basic_string.i b/linux-x86/share/swig/std/std_basic_string.i
index fb7afc1..e95cb47 100644
--- a/linux-x86/share/swig/std/std_basic_string.i
+++ b/linux-x86/share/swig/std/std_basic_string.i
@@ -55,7 +55,16 @@ namespace std {
size_type capacity() const;
- void reserve(size_type __res_arg = 0);
+ void reserve(size_type __res_arg);
+ %extend {
+ void shrink_to_fit() {
+ %#if __cplusplus >= 202002L
+ self->shrink_to_fit();
+ %#else
+ self->reserve();
+ %#endif
+ }
+ }
// Modifiers:
diff --git a/linux-x86/share/swig/std/std_carray.swg b/linux-x86/share/swig/std/std_carray.swg
deleted file mode 100644
index de2a076..0000000
--- a/linux-x86/share/swig/std/std_carray.swg
+++ /dev/null
@@ -1,64 +0,0 @@
-%{
-#include <algorithm>
-%}
-
-//
-// std::carray - is really an extension to the 'std' namespace.
-//
-// A simple fix C array wrapper, more or less as presented in
-//
-// "The C++ Standarf Library", by Nicolai M. Josuttis
-//
-// which is also derived from the example in
-//
-// "The C++ Programming Language", by Bjarne Stroustup.
-//
-
-%inline %{
-namespace std {
- template <class _Type, size_t _Size>
- class carray
- {
- public:
- typedef _Type value_type;
- typedef size_t size_type;
-
- typedef _Type * iterator;
- typedef const _Type * const_iterator;
-
- carray() { }
-
- carray(const carray& other) {
- std::copy(other.v, other.v + size(), v);
- }
-
- template <class _Iterator>
- carray(_Iterator first, _Iterator last) {
- assign(first, last);
- }
-
- iterator begin() { return v; }
- iterator end() { return v + _Size; }
-
- const_iterator begin() const { return v; }
- const_iterator end() const { return v + _Size; }
-
- _Type& operator[](size_t i) { return v[i]; }
- const _Type& operator[](size_t i) const { return v[i]; }
-
- static size_t size() { return _Size; }
-
- template <class _Iterator>
- void assign(_Iterator first, _Iterator last) {
- if (std::distance(first,last) == size()) {
- std::copy(first, last, v);
- } else {
- throw std::length_error("bad range length");
- }
- }
-
- private:
- _Type v[_Size];
- };
-}
-%}
diff --git a/linux-x86/share/swig/std/std_iostream.i b/linux-x86/share/swig/std/std_iostream.i
index 38a2296..4c12698 100644
--- a/linux-x86/share/swig/std/std_iostream.i
+++ b/linux-x86/share/swig/std/std_iostream.i
@@ -264,6 +264,14 @@ namespace std
seekg(off_type, ios_base::seekdir);
};
+ %template(ostream) basic_ostream<char>;
+ %template(istream) basic_istream<char>;
+
+#if defined(SWIG_WCHAR)
+ %template(wostream) basic_ostream<wchar_t>;
+ %template(wistream) basic_istream<wchar_t>;
+#endif
+
// 27.6.1.5 Template class basic_iostream
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_iostream
@@ -318,8 +326,6 @@ namespace std
}
namespace std {
- %template(ostream) basic_ostream<char>;
- %template(istream) basic_istream<char>;
%template(iostream) basic_iostream<char>;
%template(endl) endl<char, std::char_traits<char> >;
@@ -327,8 +333,6 @@ namespace std {
%template(flush) flush<char, std::char_traits<char> >;
#if defined(SWIG_WCHAR)
- %template(wostream) basic_ostream<wchar_t>;
- %template(wistream) basic_istream<wchar_t>;
%template(wiostream) basic_iostream<wchar_t>;
%template(wendl) endl<wchar_t, std::char_traits<wchar_t> >;
diff --git a/linux-x86/share/swig/swig.swg b/linux-x86/share/swig/swig.swg
index 6dc215d..db7e08c 100644
--- a/linux-x86/share/swig/swig.swg
+++ b/linux-x86/share/swig/swig.swg
@@ -9,20 +9,6 @@
* User Directives
* ----------------------------------------------------------------------------- */
-/* Deprecated SWIG-1.1 directives */
-
-#define %disabledoc %warn "104:%disabledoc is deprecated"
-#define %enabledoc %warn "105:%enabledoc is deprecated"
-#define %doconly %warn "106:%doconly is deprecated"
-#define %style %warn "107:%style is deprecated" /##/
-#define %localstyle %warn "108:%localstyle is deprecated" /##/
-#define %title %warn "109:%title is deprecated" /##/
-#define %section %warn "110:%section is deprecated" /##/
-#define %subsection %warn "111:%subsection is deprecated" /##/
-#define %subsubsection %warn "112:%subsubsection is deprecated" /##/
-#define %new %warn "117:%new is deprecated. Use %newobject"
-#define %text %insert("null")
-
/* Code insertion directives such as %wrapper %{ ... %} */
#define %begin %insert("begin")
@@ -31,10 +17,6 @@
#define %wrapper %insert("wrapper")
#define %init %insert("init")
-/* Class extension */
-
-#define %addmethods %warn "113:%addmethods is now %extend" %extend
-
/* %ignore directive */
#define %ignore %rename($ignore)
@@ -42,9 +24,6 @@
/* Access control directives */
-#define %readonly %warn "114:%readonly is deprecated. Use %immutable; " %feature("immutable");
-#define %readwrite %warn "115:%readwrite is deprecated. Use %mutable; " %feature("immutable","");
-
#define %immutable %feature("immutable")
#define %noimmutable %feature("immutable","0")
#define %clearimmutable %feature("immutable","")
@@ -172,7 +151,7 @@
#define %novaluewrapper %feature("novaluewrapper")
#define %clearnovaluewrapper %feature("novaluewrapper","")
-/* Contract support - Experimental and undocumented */
+/* Contract support - Experimental */
#define %contract %feature("contract")
#define %nocontract %feature("contract","0")
#define %clearcontract %feature("contract","")
@@ -268,7 +247,9 @@ static int NAME(TYPE x) {
*/
-%define %$not "not" %enddef
+/* Note that when %$not is used with another macro, say %enum as follows: %$not %$enum, the result is "notmatch=enum" */
+%define %$not "not" %enddef
+
%define %$isenum "match"="enum" %enddef
%define %$isenumitem "match"="enumitem" %enddef
%define %$isaccess "match"="access" %enddef
@@ -279,6 +260,7 @@ static int NAME(TYPE x) {
%define %$isnamespace "match"="namespace" %enddef
%define %$istemplate "match"="template" %enddef
%define %$isconstant "match"="constant" %enddef /* %constant definition */
+%define %$isusing "match"="using" %enddef
%define %$isunion "match$kind"="union" %enddef
%define %$isfunction "match$kind"="function" %enddef
@@ -358,6 +340,11 @@ static int NAME(TYPE x) {
%define SWIG_TYPECHECK_STDUNISTRING 115 %enddef
%define SWIG_TYPECHECK_UNISTRING 120 %enddef
%define SWIG_TYPECHECK_CHAR 130 %enddef
+/* Give std::string_view a slightly higher precedence because if there are
+ * overloaded forms then it may be more efficient to pass as std::string_view
+ * (e.g. to pass as std::string requires copying the data into a std::string).
+ */
+%define SWIG_TYPECHECK_STRINGVIEW 134 %enddef
%define SWIG_TYPECHECK_STDSTRING 135 %enddef
%define SWIG_TYPECHECK_STRING 140 %enddef
%define SWIG_TYPECHECK_PAIR 150 %enddef
@@ -445,15 +432,15 @@ namespace std {
/* Set up the typemap for handling new return strings */
#ifdef __cplusplus
-%typemap(newfree) char * "delete [] $1;";
+%typemap(newfree) char * "delete [] $1;"
#else
-%typemap(newfree) char * "free($1);";
+%typemap(newfree) char * "free($1);"
#endif
/* Default typemap for handling char * members */
#ifdef __cplusplus
-%typemap(memberin) char * {
+%typemap(memberin,fragment="<string.h>") char * {
delete [] $1;
if ($input) {
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
@@ -462,7 +449,7 @@ namespace std {
$1 = 0;
}
}
-%typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * {
+%typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="<string.h>") const char * {
if ($input) {
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
strcpy((char *)$1, (const char *)$input);
@@ -470,7 +457,7 @@ namespace std {
$1 = 0;
}
}
-%typemap(globalin) char * {
+%typemap(globalin,fragment="<string.h>") char * {
delete [] $1;
if ($input) {
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
@@ -479,7 +466,7 @@ namespace std {
$1 = 0;
}
}
-%typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * {
+%typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="<string.h>") const char * {
if ($input) {
$1 = ($1_type) (new char[strlen((const char *)$input)+1]);
strcpy((char *)$1, (const char *)$input);
@@ -488,7 +475,7 @@ namespace std {
}
}
#else
-%typemap(memberin) char * {
+%typemap(memberin,fragment="<string.h>") char * {
free($1);
if ($input) {
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
@@ -497,7 +484,7 @@ namespace std {
$1 = 0;
}
}
-%typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * {
+%typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="<string.h>") const char * {
if ($input) {
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
strcpy((char *)$1, (const char *)$input);
@@ -505,7 +492,7 @@ namespace std {
$1 = 0;
}
}
-%typemap(globalin) char * {
+%typemap(globalin,fragment="<string.h>") char * {
free($1);
if ($input) {
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
@@ -514,7 +501,7 @@ namespace std {
$1 = 0;
}
}
-%typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * {
+%typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="<string.h>") const char * {
if ($input) {
$1 = ($1_type) malloc(strlen((const char *)$input)+1);
strcpy((char *)$1, (const char *)$input);
@@ -527,7 +514,7 @@ namespace std {
/* Character array handling */
-%typemap(memberin) char [ANY] {
+%typemap(memberin,fragment="<string.h>") char [ANY] {
if($input) {
strncpy((char*)$1, (const char *)$input, $1_dim0-1);
$1[$1_dim0-1] = 0;
@@ -536,7 +523,7 @@ namespace std {
}
}
-%typemap(globalin) char [ANY] {
+%typemap(globalin,fragment="<string.h>") char [ANY] {
if($input) {
strncpy((char*)$1, (const char *)$input, $1_dim0-1);
$1[$1_dim0-1] = 0;
@@ -545,12 +532,12 @@ namespace std {
}
}
-%typemap(memberin) char [] {
+%typemap(memberin,fragment="<string.h>") char [] {
if ($input) strcpy((char *)$1, (const char *)$input);
else $1[0] = 0;
}
-%typemap(globalin) char [] {
+%typemap(globalin,fragment="<string.h>") char [] {
if ($input) strcpy((char *)$1, (const char *)$input);
else $1[0] = 0;
}
@@ -599,6 +586,10 @@ namespace std {
* Runtime code
* ----------------------------------------------------------------------------- */
+
+%insert("runtime") "swiglabels.swg"
+
+
/* The SwigValueWrapper class */
/*
@@ -649,33 +640,53 @@ namespace std {
* arg1 = *inarg1; // Assignment from a pointer
* arg1 = Vector(1,2,3); // Assignment from a value
*
+ * SwigValueWrapper is a drop in replacement to modify normal value semantics by
+ * using the heap instead of the stack to copy/move the underlying object it is
+ * managing. Smart pointers also manage an underlying object on the heap, so
+ * SwigValueWrapper has characteristics of a smart pointer. The reset function
+ * is specific smart pointer functionality, but cannot be a non-static member as
+ * when SWIG modifies typemap code it assumes non-static member function calls
+ * are routed to the underlying object, changing for example $1.f() to (&x)->f().
+ * The reset function was added as an optimisation to avoid some copying/moving
+ * and to take ownership of an object already created on the heap.
+ *
* The class offers a strong guarantee of exception safety.
- * With regards to the implementation, the private SwigMovePointer nested class is
- * a simple smart pointer with move semantics, much like std::auto_ptr.
+ * With regards to the implementation, the private SwigSmartPointer nested class is
+ * a simple smart pointer providing exception safety, much like std::auto_ptr.
*
* This wrapping technique was suggested by William Fulton and is henceforth
* known as the "Fulton Transform" :-).
*/
#ifdef __cplusplus
-%insert("runtime") %{
+// Placed in the header section to ensure the language specific header files are
+// the first included headers and not <utility>
+%insert("header") %{
#ifdef __cplusplus
+#include <utility>
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
- struct SwigMovePointer {
+ struct SwigSmartPointer {
T *ptr;
- SwigMovePointer(T *p) : ptr(p) { }
- ~SwigMovePointer() { delete ptr; }
- SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+ SwigSmartPointer(T *p) : ptr(p) { }
+ ~SwigSmartPointer() { delete ptr; }
+ SwigSmartPointer& operator=(SwigSmartPointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+ void reset(T *p) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = p; }
} pointer;
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
SwigValueWrapper() : pointer(0) { }
- SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+ SwigValueWrapper& operator=(const T& t) { SwigSmartPointer tmp(new T(t)); pointer = tmp; return *this; }
+#if __cplusplus >=201103L
+ SwigValueWrapper& operator=(T&& t) { SwigSmartPointer tmp(new T(std::move(t))); pointer = tmp; return *this; }
+ operator T&&() const { return std::move(*pointer.ptr); }
+#else
operator T&() const { return *pointer.ptr; }
- T *operator&() { return pointer.ptr; }
-};%}
+#endif
+ T *operator&() const { return pointer.ptr; }
+ static void reset(SwigValueWrapper& t, T *p) { t.pointer.reset(p); }
+};
/*
* SwigValueInit() is a generic initialisation solution as the following approach:
@@ -686,16 +697,18 @@ public:
*
* unsigned int c_result = unsigned int();
*/
-%insert("runtime") %{
template <typename T> T SwigValueInit() {
return T();
}
+
+#if __cplusplus >=201103L
+# define SWIG_STD_MOVE(OBJ) std::move(OBJ)
+#else
+# define SWIG_STD_MOVE(OBJ) OBJ
+#endif
+
#endif
%}
#endif
-/* The swiglabels */
-
-%insert("runtime") "swiglabels.swg"
-
-
+%insert("runtime") "swigcompat.swg"
diff --git a/linux-x86/share/swig/swigarch.i b/linux-x86/share/swig/swigarch.i
index bf4ee8e..2f76149 100644
--- a/linux-x86/share/swig/swigarch.i
+++ b/linux-x86/share/swig/swigarch.i
@@ -6,57 +6,28 @@
* Use only in extreme cases, when no arch. independent code can be
* generated
*
- * To activate architecture specific code, use
+ * To activate 32-bit architecture checks, use
*
* swig -DSWIGWORDSIZE32
*
- * or
+ * This adds checks that long is 32-bits when compiling the generated wrappers.
+ *
+ * To activate 64-bit architecture specific code, use
*
* swig -DSWIGWORDSIZE64
*
- * Note that extra checking code will be added to the wrapped code,
- * which will prevent the compilation in a different architecture.
+ * This adds checks that long is 64-bits when compiling the generated wrappers.
+ * Some target languages also generate code that expects long to be 64-bits.
*
- * If you don't specify the SWIGWORDSIZE (the default case), swig will
+ * If you don't specify the SWIGWORDSIZE (the default case), SWIG will
* generate architecture independent and/or 32bits code, with no extra
- * checking code added.
+ * checks for the sizeof long.
* ----------------------------------------------------------------------------- */
-#if !defined(SWIGWORDSIZE32) && !defined(SWIGWORDSIZE64)
-# if (__WORDSIZE == 32)
-# define SWIGWORDSIZE32
-# endif
-#endif
-
-#if !defined(SWIGWORDSIZE64) && !defined(SWIGWORDSIZE32)
-# if defined(__x86_64) || defined(__x86_64__) || (__WORDSIZE == 64)
-# define SWIGWORDSIZE64
-# endif
-#endif
-
-
#ifdef SWIGWORDSIZE32
-%{
-#define SWIGWORDSIZE32
-#ifndef LONG_MAX
-#include <limits.h>
-#endif
-#if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX)
-# error "SWIG wrapped code invalid in 64 bit architecture, regenerate code using -DSWIGWORDSIZE64"
-#endif
-%}
+%fragment("long_check_wordsize32");
#endif
#ifdef SWIGWORDSIZE64
-%{
-#define SWIGWORDSIZE64
-#ifndef LONG_MAX
-#include <limits.h>
-#endif
-#if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
-# error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
+%fragment("long_check_wordsize64");
#endif
-%}
-#endif
-
-
diff --git a/linux-x86/share/swig/swigcompat.swg b/linux-x86/share/swig/swigcompat.swg
new file mode 100644
index 0000000..7d29b75
--- /dev/null
+++ b/linux-x86/share/swig/swigcompat.swg
@@ -0,0 +1,23 @@
+/* -----------------------------------------------------------------------------
+ * swigcompat.swg
+ *
+ * Macros to provide support compatibility with older C and C++ standards.
+ * ----------------------------------------------------------------------------- */
+
+/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF
+ * if you're missing it.
+ */
+#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \
+ (defined __cplusplus && __cplusplus >= 201103L) || \
+ defined SWIG_HAVE_SNPRINTF) && \
+ !defined SWIG_NO_SNPRINTF
+# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A)
+# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B)
+#else
+/* Fallback versions ignore the buffer size, but most of our uses either have a
+ * fixed maximum possible size or dynamically allocate a buffer that's large
+ * enough.
+ */
+# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A)
+# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B)
+#endif
diff --git a/linux-x86/share/swig/swigerrors.swg b/linux-x86/share/swig/swigerrors.swg
index 1a6d203..4d5a8e4 100644
--- a/linux-x86/share/swig/swigerrors.swg
+++ b/linux-x86/share/swig/swigerrors.swg
@@ -1,4 +1,4 @@
-/* Errors in SWIG */
+/* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */
#define SWIG_UnknownError -1
#define SWIG_IOError -2
#define SWIG_RuntimeError -3
@@ -13,4 +13,3 @@
#define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13
-
diff --git a/linux-x86/share/swig/swigfragments.swg b/linux-x86/share/swig/swigfragments.swg
index 2cbef7c..75f05bc 100644
--- a/linux-x86/share/swig/swigfragments.swg
+++ b/linux-x86/share/swig/swigfragments.swg
@@ -29,6 +29,10 @@
#include <math.h>
%}
+%fragment("<string.h>", "header") %{
+#include <string.h>
+%}
+
%fragment("<stddef.h>", "header") %{
#include <stddef.h>
%}
@@ -73,6 +77,10 @@
#include <algorithm>
%}
+%fragment("<memory>", "header") %{
+#include <memory>
+%}
+
%fragment("<stdexcept>", "header") %{
#include <stdexcept>
%}
@@ -81,6 +89,41 @@
#include <string>
%}
-%fragment("<memory>", "header") %{
-#include <memory>
+%fragment("<string_view>", "header") %{
+#include <string_view>
+%}
+
+%fragment("<type_traits>", "header") %{
+#include <type_traits>
+%}
+
+%fragment("<iostream>", "header") %{
+#include <iostream>
+%}
+
+/* -----------------------------------------------------------------------------
+ * Other common fragments
+ * ----------------------------------------------------------------------------- */
+
+%fragment("long_check_wordsize32", "header", fragment="<limits.h>") %{
+#if !defined(SWIG_NO_WORDSIZE32_CHECK)
+#if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX)
+# error "SWIG generated code is invalid on this 64-bit architecture, please regenerate without defining SWIGWORDSIZE32 or define SWIGWORDSIZE64"
+#endif
+#endif
%}
+
+%fragment("long_check_wordsize64", "header", fragment="<limits.h>") %{
+#if !defined(SWIG_NO_WORDSIZE64_CHECK)
+#if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
+# error "SWIG generated code is invalid on this 32-bit architecture, please regenerate without defining SWIGWORDSIZE64 or define SWIGWORDSIZE32"
+#endif
+#endif
+%}
+
+#ifdef SWIGWORDSIZE64
+%fragment("long_check_wordsize", "header", fragment="long_check_wordsize64") {}
+#else
+%fragment("long_check_wordsize", "header", fragment="long_check_wordsize32") {}
+#endif
+
diff --git a/linux-x86/share/swig/swiginit.swg b/linux-x86/share/swig/swiginit.swg
index 33926b1..e50b1b4 100644
--- a/linux-x86/share/swig/swiginit.swg
+++ b/linux-x86/share/swig/swiginit.swg
@@ -50,9 +50,12 @@ extern "C" {
#define SWIGRUNTIME_DEBUG
#endif
+#ifndef SWIG_INIT_CLIENT_DATA_TYPE
+#define SWIG_INIT_CLIENT_DATA_TYPE void *
+#endif
SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
+SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) {
size_t i;
swig_module_info *module_head, *iter;
int init;
diff --git a/linux-x86/share/swig/swiglabels.swg b/linux-x86/share/swig/swiglabels.swg
index b385566..58d87e9 100644
--- a/linux-x86/share/swig/swiglabels.swg
+++ b/linux-x86/share/swig/swiglabels.swg
@@ -121,3 +121,9 @@
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif
+
+#if defined(__cplusplus) && __cplusplus >=201103L
+# define SWIG_NULLPTR nullptr
+#else
+# define SWIG_NULLPTR NULL
+#endif
diff --git a/linux-x86/share/swig/swigrun.swg b/linux-x86/share/swig/swigrun.swg
index 59118ec..824185c 100644
--- a/linux-x86/share/swig/swigrun.swg
+++ b/linux-x86/share/swig/swigrun.swg
@@ -44,6 +44,8 @@
#define SWIG_POINTER_DISOWN 0x1
#define SWIG_CAST_NEW_MEMORY 0x2
#define SWIG_POINTER_NO_NULL 0x4
+#define SWIG_POINTER_CLEAR 0x8
+#define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN)
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -115,7 +117,7 @@
SWIG errors code.
Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
- allows to return the 'cast rank', for example, if you have this
+ allows returning the 'cast rank', for example, if you have this
int food(double)
int fooi(int);
@@ -129,7 +131,13 @@
*/
#define SWIG_OK (0)
+/* Runtime errors are < 0 */
#define SWIG_ERROR (-1)
+/* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */
+/* Errors in range -100 to -199 are language specific errors defined in *errors.swg */
+/* Errors < -200 are generic runtime specific errors */
+#define SWIG_ERROR_RELEASE_NOT_OWNED (-200)
+
#define SWIG_IsOK(r) (r >= 0)
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
@@ -137,14 +145,14 @@
#define SWIG_CASTRANKLIMIT (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
-/* The TmpMask is for in/out typemaps that use temporal objects */
+/* The TmpMask is for in/out typemaps that use temporary objects */
#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ (SWIG_ERROR)
#define SWIG_OLDOBJ (SWIG_OK)
#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
-/* Check, add and del mask methods */
+/* Check, add and del object mask methods */
#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
@@ -290,7 +298,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) {
if (ty) {
swig_cast_info *iter = ty->cast;
while (iter) {
@@ -350,9 +358,9 @@ SWIG_TypeName(const swig_type_info *ty) {
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
/* The "str" field contains the equivalent pretty names of the
- type, separated by vertical-bar characters. We choose
- to print the last name, as it is often (?) the most
- specific. */
+ type, separated by vertical-bar characters. Choose the last
+ name. It should be the most specific; a fully resolved name
+ but not necessarily with default template parameters expanded. */
if (!type) return NULL;
if (type->str != NULL) {
const char *last_name = type->str;
diff --git a/linux-x86/share/swig/swigwarn.swg b/linux-x86/share/swig/swigwarn.swg
index 1e195af..09b4be6 100644
--- a/linux-x86/share/swig/swigwarn.swg
+++ b/linux-x86/share/swig/swigwarn.swg
@@ -5,31 +5,31 @@
/* -- Deprecated features -- */
-%define SWIGWARN_DEPRECATED_EXTERN 101 %enddef
-%define SWIGWARN_DEPRECATED_VAL 102 %enddef
-%define SWIGWARN_DEPRECATED_OUT 103 %enddef
-%define SWIGWARN_DEPRECATED_DISABLEDOC 104 %enddef
-%define SWIGWARN_DEPRECATED_ENABLEDOC 105 %enddef
-%define SWIGWARN_DEPRECATED_DOCONLY 106 %enddef
-%define SWIGWARN_DEPRECATED_STYLE 107 %enddef
-%define SWIGWARN_DEPRECATED_LOCALSTYLE 108 %enddef
-%define SWIGWARN_DEPRECATED_TITLE 109 %enddef
-%define SWIGWARN_DEPRECATED_SECTION 110 %enddef
-%define SWIGWARN_DEPRECATED_SUBSECTION 111 %enddef
-%define SWIGWARN_DEPRECATED_SUBSUBSECTION 112 %enddef
-%define SWIGWARN_DEPRECATED_ADDMETHODS 113 %enddef
-%define SWIGWARN_DEPRECATED_READONLY 114 %enddef
-%define SWIGWARN_DEPRECATED_READWRITE 115 %enddef
-%define SWIGWARN_DEPRECATED_EXCEPT 116 %enddef
-%define SWIGWARN_DEPRECATED_NEW 117 %enddef
-%define SWIGWARN_DEPRECATED_EXCEPT_TM 118 %enddef
-%define SWIGWARN_DEPRECATED_IGNORE_TM 119 %enddef
-%define SWIGWARN_DEPRECATED_OPTC 120 %enddef
-%define SWIGWARN_DEPRECATED_NAME 121 %enddef
-%define SWIGWARN_DEPRECATED_NOEXTERN 122 %enddef
-%define SWIGWARN_DEPRECATED_NODEFAULT 123 %enddef
-%define SWIGWARN_DEPRECATED_TYPEMAP_LANG 124 %enddef
-%define SWIGWARN_DEPRECATED_INPUT_FILE 125 %enddef
+/* Unused since 4.2.0: #define WARN_DEPRECATED_EXTERN 101 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_VAL 102 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_OUT 103 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_DISABLEDOC 104 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_ENABLEDOC 105 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_DOCONLY 106 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_STYLE 107 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_LOCALSTYLE 108 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_TITLE 109 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_SECTION 110 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_SUBSECTION 111 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_SUBSUBSECTION 112 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_ADDMETHODS 113 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_READONLY 114 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_READWRITE 115 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_EXCEPT 116 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_NEW 117 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_EXCEPT_TM 118 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_IGNORE_TM 119 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_OPTC 120 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_NAME 121 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_NOEXTERN 122 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_NODEFAULT 123 */
+/* Unused since 4.1.0: #define WARN_DEPRECATED_TYPEMAP_LANG 124 */
+/* Unused since 4.2.0: #define WARN_DEPRECATED_INPUT_FILE 125 */
%define SWIGWARN_DEPRECATED_NESTED_WORKAROUND 126 %enddef
/* -- Preprocessor -- */
@@ -48,17 +48,17 @@
%define SWIGWARN_PARSE_EXTEND_UNDEF 303 %enddef
%define SWIGWARN_PARSE_UNSUPPORTED_VALUE 304 %enddef
%define SWIGWARN_PARSE_BAD_VALUE 305 %enddef
-%define SWIGWARN_PARSE_PRIVATE 306 %enddef
-%define SWIGWARN_PARSE_BAD_DEFAULT 307 %enddef
+/* Unused since 1.3.32: #define WARN_PARSE_PRIVATE 306 */
+/* Unused since 4.2.0: #define WARN_PARSE_BAD_DEFAULT 307 */
%define SWIGWARN_PARSE_NAMESPACE_ALIAS 308 %enddef
%define SWIGWARN_PARSE_PRIVATE_INHERIT 309 %enddef
-%define SWIGWARN_PARSE_TEMPLATE_REPEAT 310 %enddef
-%define SWIGWARN_PARSE_TEMPLATE_PARTIAL 311 %enddef
+/* Unused since 1.3.18: #define WARN_PARSE_TEMPLATE_REPEAT 310 */
+/* Unused since 1.3.18: #define WARN_PARSE_TEMPLATE_PARTIAL 311 */
%define SWIGWARN_PARSE_UNNAMED_NESTED_CLASS 312 %enddef
%define SWIGWARN_PARSE_UNDEFINED_EXTERN 313 %enddef
%define SWIGWARN_PARSE_KEYWORD 314 %enddef
%define SWIGWARN_PARSE_USING_UNDEF 315 %enddef
-%define SWIGWARN_PARSE_MODULE_REPEAT 316 %enddef
+/* Unused since 1.3.18: #define WARN_PARSE_MODULE_REPEAT 316 */
%define SWIGWARN_PARSE_TEMPLATE_SP_UNDEF 317 %enddef
%define SWIGWARN_PARSE_TEMPLATE_AMBIG 318 %enddef
%define SWIGWARN_PARSE_NO_ACCESS 319 %enddef
@@ -69,11 +69,17 @@
%define SWIGWARN_PARSE_NESTED_TEMPLATE 324 %enddef
%define SWIGWARN_PARSE_NAMED_NESTED_CLASS 325 %enddef
%define SWIGWARN_PARSE_EXTEND_NAME 326 %enddef
+%define SWIGWARN_PARSE_EXTERN_TEMPLATE 327 %enddef
+%define SWIGWARN_PARSE_ASSIGNED_VALUE 328 %enddef
+%define SWIGWARN_PARSE_USING_CONSTRUCTOR 329 %enddef
%define SWIGWARN_CPP11_LAMBDA 340 %enddef
-%define SWIGWARN_CPP11_ALIAS_DECLARATION 341 %enddef /* redundant now */
-%define SWIGWARN_CPP11_ALIAS_TEMPLATE 342 %enddef /* redundant now */
-%define SWIGWARN_CPP11_VARIADIC_TEMPLATE 343 %enddef
+/* Unused since 3.0.11: #define WARN_CPP11_ALIAS_DECLARATION 341 */
+/* Unused since 3.0.11: #define WARN_CPP11_ALIAS_TEMPLATE 342 */
+/* Unused since 4.2.0: #define WARN_CPP11_VARIADIC_TEMPLATE 343 */
+%define SWIGWARN_CPP11_DECLTYPE 344 %enddef
+%define SWIGWARN_CPP14_AUTO 345 %enddef
+%define SWIGWARN_CPP11_AUTO 346 %enddef
%define SWIGWARN_IGNORE_OPERATOR_NEW 350 %enddef /* new */
%define SWIGWARN_IGNORE_OPERATOR_DELETE 351 %enddef /* delete */
@@ -122,8 +128,9 @@
%define SWIGWARN_IGNORE_OPERATOR_NEWARR 394 %enddef /* new [] */
%define SWIGWARN_IGNORE_OPERATOR_DELARR 395 %enddef /* delete [] */
%define SWIGWARN_IGNORE_OPERATOR_REF 396 %enddef /* operator *() */
+%define SWIGWARN_IGNORE_OPERATOR_LTEQUALGT 397 %enddef /* <=> */
-/* 394-399 are reserved */
+/* please leave 350-399 free for WARN_IGNORE_OPERATOR_* */
/* -- Type system and typemaps -- */
@@ -133,11 +140,12 @@
%define SWIGWARN_TYPE_REDEFINED 404 %enddef
%define SWIGWARN_TYPE_RVALUE_REF_QUALIFIER_IGNORED 405 %enddef
-%define SWIGWARN_TYPEMAP_SOURCETARGET 450 %enddef
+/* Unused since 4.1.0: #define WARN_TYPEMAP_SOURCETARGET 450 */
%define SWIGWARN_TYPEMAP_CHARLEAK 451 %enddef
-%define SWIGWARN_TYPEMAP_SWIGTYPE 452 %enddef
+/* Unused since 1.3.32: #define WARN_TYPEMAP_SWIGTYPE 452 */
%define SWIGWARN_TYPEMAP_APPLY_UNDEF 453 %enddef
%define SWIGWARN_TYPEMAP_SWIGTYPELEAK 454 %enddef
+%define SWIGWARN_TYPEMAP_WCHARLEAK 455 %enddef
%define SWIGWARN_TYPEMAP_IN_UNDEF 460 %enddef
%define SWIGWARN_TYPEMAP_OUT_UNDEF 461 %enddef
@@ -172,7 +180,7 @@
%define SWIGWARN_LANG_NATIVE_UNIMPL 507 %enddef
%define SWIGWARN_LANG_DEREF_SHADOW 508 %enddef
%define SWIGWARN_LANG_OVERLOAD_SHADOW 509 %enddef
-%define SWIGWARN_LANG_FRIEND_IGNORE 510 %enddef
+%define SWIGWARN_LANG_FRIEND_IGNORE 510 %enddef /* No longer issued */
%define SWIGWARN_LANG_OVERLOAD_KEYWORD 511 %enddef
%define SWIGWARN_LANG_OVERLOAD_CONST 512 %enddef
%define SWIGWARN_LANG_CLASS_UNNAMED 513 %enddef
@@ -188,6 +196,7 @@
%define SWIGWARN_LANG_EXTEND_DESTRUCTOR 523 %enddef
%define SWIGWARN_LANG_EXPERIMENTAL 524 %enddef
%define SWIGWARN_LANG_DIRECTOR_FINAL 525 %enddef
+%define SWIGWARN_LANG_USING_NAME_DIFFERENT 526 %enddef
/* -- Doxygen comments -- */
@@ -199,7 +208,7 @@
%define SWIGWARN_DOXYGEN_UNKNOWN_CHARACTER 565 %enddef
%define SWIGWARN_DOXYGEN_UNEXPECTED_ITERATOR_VALUE 566 %enddef
-/* -- Reserved (600-799) -- */
+/* -- Reserved (600-699) -- */
/* -- Language module specific warnings (700 - 899) -- */
@@ -227,7 +236,12 @@
%define SWIGWARN_PYTHON_INDENT_MISMATCH 740 %enddef
-/* please leave 740-759 free for Python */
+/* please leave 740-749 free for Python */
+
+/* Unused since 4.2.0: #define WARN_R_MISSING_RTYPECHECK_TYPEMAP 750 */
+%define SWIGWARN_R_TYPEMAP_RTYPECHECK_UNDEF 751 %enddef
+
+/* please leave 750-759 free for R */
%define SWIGWARN_RUBY_WRONG_NAME 801 %enddef
%define SWIGWARN_RUBY_MULTIPLE_INHERITANCE 802 %enddef
@@ -251,6 +265,7 @@
%define SWIGWARN_JAVA_TYPEMAP_DIRECTORIN_NODESC 824 %enddef
%define SWIGWARN_JAVA_NO_DIRECTORCONNECT_ATTR 825 %enddef
%define SWIGWARN_JAVA_NSPACE_WITHOUT_PACKAGE 826 %enddef
+%define SWIGWARN_JAVA_TYPEMAP_INTERFACEMODIFIERS_UNDEF 827 %enddef
/* please leave 810-829 free for Java */
@@ -271,26 +286,15 @@
%define SWIGWARN_CSHARP_EXCODE 844 %enddef
%define SWIGWARN_CSHARP_CANTHROW 845 %enddef
%define SWIGWARN_CSHARP_NO_DIRECTORCONNECT_ATTR 846 %enddef
+%define SWIGWARN_CSHARP_TYPEMAP_INTERFACEMODIFIERS_UNDEF 847 %enddef
/* please leave 830-849 free for C# */
-%define SWIGWARN_MODULA3_TYPEMAP_TYPE_UNDEF 850 %enddef
-%define SWIGWARN_MODULA3_TYPEMAP_GETCPTR_UNDEF 851 %enddef
-%define SWIGWARN_MODULA3_TYPEMAP_CLASSMOD_UNDEF 852 %enddef
-%define SWIGWARN_MODULA3_TYPEMAP_PTRCONSTMOD_UNDEF 853 %enddef
-%define SWIGWARN_MODULA3_TYPEMAP_MULTIPLE_RETURN 854 %enddef
-%define SWIGWARN_MODULA3_MULTIPLE_INHERITANCE 855 %enddef
-%define SWIGWARN_MODULA3_TYPECONSTRUCTOR_UNKNOWN 856 %enddef
-%define SWIGWARN_MODULA3_UNKNOWN_PRAGMA 857 %enddef
-%define SWIGWARN_MODULA3_BAD_ENUMERATION 858 %enddef
-%define SWIGWARN_MODULA3_DOUBLE_ID 859 %enddef
-%define SWIGWARN_MODULA3_BAD_IMPORT 860 %enddef
-
-/* please leave 850-869 free for Modula 3 */
+/* 850-860 were used by Modula 3 (removed in SWIG 4.1.0) - avoid reusing for now */
%define SWIGWARN_PHP_MULTIPLE_INHERITANCE 870 %enddef
%define SWIGWARN_PHP_UNKNOWN_PRAGMA 871 %enddef
-%define SWIGWARN_PHP_PUBLIC_BASE 872 %enddef
+/* Unused since 4.1.0: define WARN_PHP_PUBLIC_BASE 872 */
/* please leave 870-889 free for PHP */
diff --git a/linux-x86/share/swig/swigwarnings.swg b/linux-x86/share/swig/swigwarnings.swg
index 34c98fb..2dfea66 100644
--- a/linux-x86/share/swig/swigwarnings.swg
+++ b/linux-x86/share/swig/swigwarnings.swg
@@ -52,8 +52,9 @@
%define SWIGWARN_TYPEMAP_CHARLEAK_MSG "451:Setting a const char * variable may leak memory." %enddef
%define SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG "454:Setting a pointer/reference variable may leak memory." %enddef
+%define SWIGWARN_TYPEMAP_WCHARLEAK_MSG "455:Setting a const wchar_t * variable may leak memory." %enddef
%define SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG "470:Thread/reentrant unsafe wrapping, consider returning by value instead." %enddef
-%define SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG "473:Returning a pointer or reference in a director method is not recommended." %enddef
+%define SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG "473:Returning a reference, pointer or pointer wrapper in a director method is not recommended." %enddef
%define SWIGWARN_TYPEMAP_INITIALIZER_LIST_MSG "476:Initialization using std::initializer_list." %enddef
/* -----------------------------------------------------------------------------
@@ -107,6 +108,7 @@
%define SWIGWARN_IGNORE_OPERATOR_NEWARR_MSG "394:operator new[] ignored" %enddef
%define SWIGWARN_IGNORE_OPERATOR_DELARR_MSG "395:operator delete[] ignored" %enddef
%define SWIGWARN_IGNORE_OPERATOR_REF_MSG "396:operator*() ignored" %enddef
+%define SWIGWARN_IGNORE_OPERATOR_LTEQUALGT_MSG "397:operator<=> ignored" %enddef
#define %ignoreoperator(Oper) %ignorewarn(SWIGWARN_IGNORE_OPERATOR_##Oper##_MSG)
diff --git a/linux-x86/share/swig/tcl/Makefile.in b/linux-x86/share/swig/tcl/Makefile.in
index 13d7d46..019091c 100644
--- a/linux-x86/share/swig/tcl/Makefile.in
+++ b/linux-x86/share/swig/tcl/Makefile.in
@@ -45,7 +45,7 @@ LIBS =
# SWIGCC = Compiler used to compile the wrapper file
SWIG = $(exec_prefix)/bin/swig
-SWIGOPT = -tcl # use -tcl8 for Tcl 8.0
+SWIGOPT = -tcl
SWIGCC = $(CC)
# SWIG Library files. Uncomment if rebuilding tclsh
diff --git a/linux-x86/share/swig/tcl/argcargv.i b/linux-x86/share/swig/tcl/argcargv.i
new file mode 100644
index 0000000..e93f691
--- /dev/null
+++ b/linux-x86/share/swig/tcl/argcargv.i
@@ -0,0 +1,27 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%typemap(in) (int ARGC, char **ARGV) {
+ Tcl_Size i, nitems;
+ Tcl_Obj **listobjv;
+ if (Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) {
+ SWIG_exception_fail(SWIG_ValueError, "in method '$symname', Expecting list of argv");
+ goto fail;
+ }
+ $1 = ($1_ltype) nitems;
+ $2 = (char **) malloc((nitems+1)*sizeof(char *));
+ for (i = 0; i < nitems; i++) {
+ $2[i] = Tcl_GetString(listobjv[i]);
+ }
+ $2[i] = NULL;
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ Tcl_Size len;
+ $1 = Tcl_ListObjLength(interp, $input, &len) == TCL_OK;
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ free((void *)$2);
+}
diff --git a/linux-x86/share/swig/tcl/carrays.i b/linux-x86/share/swig/tcl/carrays.i
index 0236672..c1e6db3 100644
--- a/linux-x86/share/swig/tcl/carrays.i
+++ b/linux-x86/share/swig/tcl/carrays.i
@@ -1,4 +1 @@
%include <typemaps/carrays.swg>
-
-
-
diff --git a/linux-x86/share/swig/tcl/mactkinit.c b/linux-x86/share/swig/tcl/mactkinit.c
deleted file mode 100644
index 8d14200..0000000
--- a/linux-x86/share/swig/tcl/mactkinit.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -----------------------------------------------------------------------------
- * mactkinit.c
- *
- * This is a support file needed to build a new version of Wish.
- * Normally, this capability is found in TkAppInit.c, but this creates
- * tons of namespace problems for many applications.
- * ----------------------------------------------------------------------------- */
-
-#include <Gestalt.h>
-#include <ToolUtils.h>
-#include <Fonts.h>
-#include <Dialogs.h>
-#include <SegLoad.h>
-#include <Traps.h>
-
-#include "tk.h"
-#include "tkInt.h"
-#include "tkMacInt.h"
-
-typedef int (*TclMacConvertEventPtr) _ANSI_ARGS_((EventRecord *eventPtr));
-Tcl_Interp *gStdoutInterp = NULL;
-
-void TclMacSetEventProc _ANSI_ARGS_((TclMacConvertEventPtr procPtr));
-int TkMacConvertEvent _ANSI_ARGS_((EventRecord *eventPtr));
-
-/*
- * Prototypes for functions the ANSI library needs to link against.
- */
-short InstallConsole _ANSI_ARGS_((short fd));
-void RemoveConsole _ANSI_ARGS_((void));
-long WriteCharsToConsole _ANSI_ARGS_((char *buff, long n));
-long ReadCharsFromConsole _ANSI_ARGS_((char *buff, long n));
-char * __ttyname _ANSI_ARGS_((long fildes));
-short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event));
-
-/*
- * Forward declarations for procedures defined later in this file:
- */
-
-/*
- *----------------------------------------------------------------------
- *
- * MacintoshInit --
- *
- * This procedure calls Mac specific initialization calls. Most of
- * these calls must be made as soon as possible in the startup
- * process.
- *
- * Results:
- * Returns TCL_OK if everything went fine. If it didn't the
- * application should probably fail.
- *
- * Side effects:
- * Inits the application.
- *
- *----------------------------------------------------------------------
- */
-
-int
-MacintoshInit()
-{
- int i;
- long result, mask = 0x0700; /* mask = system 7.x */
-
- /*
- * Tk needs us to set the qd pointer it uses. This is needed
- * 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;
-
- InitGraf(&tcl_macQdPtr->thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- InitDialogs((long) NULL);
- InitCursor();
-
- /*
- * Make sure we are running on system 7 or higher
- */
-
- if ((NGetTrapAddress(_Gestalt, ToolTrap) ==
- NGetTrapAddress(_Unimplemented, ToolTrap))
- || (((Gestalt(gestaltSystemVersion, &result) != noErr)
- || (mask != (result & mask))))) {
- panic("Tcl/Tk requires System 7 or higher.");
- }
-
- /*
- * Make sure we have color quick draw
- * (this means we can't run on 68000 macs)
- */
-
- if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr)
- || (result < gestalt32BitQD13))) {
- panic("Tk requires Color QuickDraw.");
- }
-
-
- FlushEvents(everyEvent, 0);
- SetEventMask(everyEvent);
-
- /*
- * Set up stack & heap sizes
- */
- /* TODO: stack size
- size = StackSpace();
- SetAppLimit(GetAppLimit() - 8192);
- */
- MaxApplZone();
- for (i = 0; i < 4; i++) {
- (void) MoreMasters();
- }
-
- TclMacSetEventProc(TkMacConvertEvent);
- TkConsoleCreate();
-
- return TCL_OK;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * SetupMainInterp --
- *
- * 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.
- *
- * Results:
- * Returns TCL_OK if everything went fine. If it didn't the
- * application should probably fail.
- *
- * Side effects:
- * More initialization.
- *
- *----------------------------------------------------------------------
- */
-
-int
-SetupMainInterp(
- Tcl_Interp *interp)
-{
- /*
- * Initialize the console only if we are running as an interactive
- * application.
- */
-
- TkMacInitAppleEvents(interp);
- TkMacInitMenus(interp);
-
- if (strcmp(Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY), "1")
- == 0) {
- if (TkConsoleInit(interp) == TCL_ERROR) {
- goto error;
- }
- }
-
- /*
- * Attach the global interpreter to tk's expected global console
- */
-
- gStdoutInterp = interp;
-
- return TCL_OK;
-
-error:
- panic(interp->result);
- return TCL_ERROR;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * InstallConsole, RemoveConsole, etc. --
- *
- * The following functions provide the UI for the console package.
- * Users wishing to replace SIOUX with their own console package
- * need only provide the four functions below in a library.
- *
- * Results:
- * See SIOUX documentation for details.
- *
- * Side effects:
- * See SIOUX documentation for details.
- *
- *----------------------------------------------------------------------
- */
-
-short
-InstallConsole(short fd)
-{
-#pragma unused (fd)
-
- return 0;
-}
-
-void
-RemoveConsole(void)
-{
-}
-
-long
-WriteCharsToConsole(char *buffer, long n)
-{
- TkConsolePrint(gStdoutInterp, TCL_STDOUT, buffer, n);
- return n;
-}
-
-long
-ReadCharsFromConsole(char *buffer, long n)
-{
- return 0;
-}
-
-extern char *
-__ttyname(long fildes)
-{
- static char *devicename = "null device";
-
- if (fildes >= 0 && fildes <= 2) {
- return (devicename);
- }
-
- return (0L);
-}
-
-short
-SIOUXHandleOneEvent(EventRecord *event)
-{
- return 0;
-}
diff --git a/linux-x86/share/swig/tcl/std_auto_ptr.i b/linux-x86/share/swig/tcl/std_auto_ptr.i
new file mode 100644
index 0000000..b24809a
--- /dev/null
+++ b/linux-x86/share/swig/tcl/std_auto_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_auto_ptr.i
+ *
+ * SWIG library file for handling std::auto_ptr.
+ * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
+ * class when returning a std::auto_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::auto_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %auto_ptr(TYPE)
+%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::auto_ptr< TYPE > %{
+ Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::auto_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class auto_ptr {};
+}
diff --git a/linux-x86/share/swig/tcl/std_map.i b/linux-x86/share/swig/tcl/std_map.i
index 2c7f40a..5c8bc75 100644
--- a/linux-x86/share/swig/tcl/std_map.i
+++ b/linux-x86/share/swig/tcl/std_map.i
@@ -47,7 +47,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -63,17 +67,4 @@ namespace std {
}
};
-// 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/linux-x86/share/swig/tcl/std_string_view.i b/linux-x86/share/swig/tcl/std_string_view.i
new file mode 100644
index 0000000..9d922bc
--- /dev/null
+++ b/linux-x86/share/swig/tcl/std_string_view.i
@@ -0,0 +1,2 @@
+%include <typemaps/std_string_view.swg>
+
diff --git a/linux-x86/share/swig/tcl/std_unique_ptr.i b/linux-x86/share/swig/tcl/std_unique_ptr.i
new file mode 100644
index 0000000..0ea324c
--- /dev/null
+++ b/linux-x86/share/swig/tcl/std_unique_ptr.i
@@ -0,0 +1,39 @@
+/* -----------------------------------------------------------------------------
+ * std_unique_ptr.i
+ *
+ * SWIG library file for handling std::unique_ptr.
+ * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy
+ * class when returning a std::unique_ptr from a function.
+ * Memory ownership is passed from the proxy class to the std::unique_ptr in the
+ * C++ layer when passed as a parameter to a wrapped function.
+ * ----------------------------------------------------------------------------- */
+
+%define %unique_ptr(TYPE)
+%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "TYPE *", $symname, $argnum);
+ } else {
+ %argument_fail(res, "TYPE *", $symname, $argnum);
+ }
+ }
+ $1.reset((TYPE *)argp);
+}
+
+%typemap (out) std::unique_ptr< TYPE > %{
+ Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN));
+%}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0);
+ $1 = SWIG_CheckState(res);
+}
+
+%template() std::unique_ptr< TYPE >;
+%enddef
+
+namespace std {
+ template <class T> class unique_ptr {};
+}
diff --git a/linux-x86/share/swig/tcl/std_vector.i b/linux-x86/share/swig/tcl/std_vector.i
index 5fba537..f950ee3 100644
--- a/linux-x86/share/swig/tcl/std_vector.i
+++ b/linux-x86/share/swig/tcl/std_vector.i
@@ -34,11 +34,11 @@
%{
#include <vector>
-Tcl_Obj* SwigString_FromString(const std::string &s) {
- return Tcl_NewStringObj(s.data(), (int)s.length());
+SWIGINTERN Tcl_Obj* SwigString_FromString(const std::string &s) {
+ return Tcl_NewStringObj(s.data(), (Tcl_Size)s.length());
}
-int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) {
+SWIGINTERN int SWIG_Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) {
int v;
int res = Tcl_GetBooleanFromObj(interp, o, &v);
if (res == TCL_OK) {
@@ -47,9 +47,10 @@ int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) {
return res;
}
-int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) {
- int len;
+SWIGINTERN int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) {
+ Tcl_Size len;
const char* temp = Tcl_GetStringFromObj(o, &len);
+ (void)interp;
if (temp == NULL)
return TCL_ERROR;
val->assign(temp, len);
@@ -84,16 +85,16 @@ namespace std {
template<class T> class vector {
%typemap(in) vector< T > (std::vector< T > *v) {
Tcl_Obj **listobjv;
- int nitems;
- int i;
+ Tcl_Size nitems;
+ Tcl_Size i;
T* temp;
- if (SWIG_ConvertPtr($input, (void **) &v, \
+ if (SWIG_ConvertPtr($input, (void **) &v,
$&1_descriptor, 0) == 0){
$1 = *v;
} else {
// It isn't a vector< T > so it should be a list of T's
- if(Tcl_ListObjGetElements(interp, $input, \
+ if(Tcl_ListObjGetElements(interp, $input,
&nitems, &listobjv) == TCL_ERROR)
return TCL_ERROR;
$1 = std::vector< T >();
@@ -113,12 +114,12 @@ namespace std {
%typemap(in) const vector< T >* (std::vector< T > *v, std::vector< T > w),
const vector< T >& (std::vector< T > *v, std::vector< T > w) {
Tcl_Obj **listobjv;
- int nitems;
- int i;
+ Tcl_Size nitems;
+ Tcl_Size i;
T* temp;
- if(SWIG_ConvertPtr($input, (void **) &v, \
- $&1_descriptor, 0) == 0) {
+ if(SWIG_ConvertPtr($input, (void **) &v,
+ $1_descriptor, 0) == 0) {
$1 = v;
} else {
// It isn't a vector< T > so it should be a list of T's
@@ -143,7 +144,7 @@ namespace std {
%typemap(out) vector< T > {
for (unsigned int i=0; i<$1.size(); i++) {
T* ptr = new T((($1_type &)$1)[i]);
- Tcl_ListObjAppendElement(interp, $result, \
+ Tcl_ListObjAppendElement(interp, $result,
SWIG_NewInstanceObj(ptr,
$descriptor(T *),
0));
@@ -152,11 +153,11 @@ namespace std {
%typecheck(SWIG_TYPECHECK_VECTOR) vector< T > {
Tcl_Obj **listobjv;
- int nitems;
+ Tcl_Size nitems;
T* temp;
std::vector< T > *v;
- if(SWIG_ConvertPtr($input, (void **) &v, \
+ if(SWIG_ConvertPtr($input, (void **) &v,
$&1_descriptor, 0) == 0) {
/* wrapped vector */
$1 = 1;
@@ -168,7 +169,7 @@ namespace std {
else
if (nitems == 0)
$1 = 1;
- //check the first value to see if it is of correct type
+ //check the first value to see if it is of correct type
else if ((SWIG_ConvertPtr(listobjv[0],
(void **) &temp,
$descriptor(T *),0)) != 0)
@@ -181,11 +182,11 @@ namespace std {
%typecheck(SWIG_TYPECHECK_VECTOR) const vector< T >&,
const vector< T >* {
Tcl_Obj **listobjv;
- int nitems;
+ Tcl_Size nitems;
T* temp;
std::vector< T > *v;
- if(SWIG_ConvertPtr($input, (void **) &v, \
+ if(SWIG_ConvertPtr($input, (void **) &v,
$1_descriptor, 0) == 0){
/* wrapped vector */
$1 = 1;
@@ -197,7 +198,7 @@ namespace std {
else
if (nitems == 0)
$1 = 1;
- //check the first value to see if it is of correct type
+ //check the first value to see if it is of correct type
else if ((SWIG_ConvertPtr(listobjv[0],
(void **) &temp,
$descriptor(T *),0)) != 0)
@@ -260,11 +261,11 @@ namespace std {
%typemap(in) vector< T > (std::vector< T > *v){
Tcl_Obj **listobjv;
- int nitems;
- int i;
+ Tcl_Size nitems;
+ Tcl_Size i;
T temp;
- if(SWIG_ConvertPtr($input, (void **) &v, \
+ if(SWIG_ConvertPtr($input, (void **) &v,
$&1_descriptor, 0) == 0) {
$1 = *v;
} else {
@@ -284,11 +285,11 @@ namespace std {
%typemap(in) const vector< T >& (std::vector< T > *v,std::vector< T > w),
const vector< T >* (std::vector< T > *v,std::vector< T > w) {
Tcl_Obj **listobjv;
- int nitems;
- int i;
+ Tcl_Size nitems;
+ Tcl_Size i;
T temp;
- if(SWIG_ConvertPtr($input, (void **) &v, \
+ if(SWIG_ConvertPtr($input, (void **) &v,
$1_descriptor, 0) == 0) {
$1 = v;
} else {
@@ -308,18 +309,18 @@ namespace std {
%typemap(out) vector< T > {
for (unsigned int i=0; i<$1.size(); i++) {
- Tcl_ListObjAppendElement(interp, $result, \
+ Tcl_ListObjAppendElement(interp, $result,
CONVERT_TO((($1_type &)$1)[i]));
}
}
%typecheck(SWIG_TYPECHECK_VECTOR) vector< T > {
Tcl_Obj **listobjv;
- int nitems;
+ Tcl_Size nitems;
T temp;
std::vector< T > *v;
- if(SWIG_ConvertPtr($input, (void **) &v, \
+ if(SWIG_ConvertPtr($input, (void **) &v,
$&1_descriptor, 0) == 0){
/* wrapped vector */
$1 = 1;
@@ -331,22 +332,22 @@ namespace std {
else
if (nitems == 0)
$1 = 1;
- //check the first value to see if it is of correct type
- if (CONVERT_FROM(interp, listobjv[0], &temp) == TCL_ERROR)
- $1 = 0;
- else
- $1 = 1;
+ //check the first value to see if it is of correct type
+ else if (CONVERT_FROM(interp, listobjv[0], &temp) == TCL_ERROR)
+ $1 = 0;
+ else
+ $1 = 1;
}
}
%typecheck(SWIG_TYPECHECK_VECTOR) const vector< T >&,
const vector< T >*{
Tcl_Obj **listobjv;
- int nitems;
+ Tcl_Size nitems;
T temp;
std::vector< T > *v;
- if(SWIG_ConvertPtr($input, (void **) &v, \
+ if(SWIG_ConvertPtr($input, (void **) &v,
$1_descriptor, 0) == 0){
/* wrapped vector */
$1 = 1;
@@ -358,11 +359,11 @@ namespace std {
else
if (nitems == 0)
$1 = 1;
- //check the first value to see if it is of correct type
- if (CONVERT_FROM(interp, listobjv[0], &temp) == TCL_ERROR)
- $1 = 0;
- else
- $1 = 1;
+ //check the first value to see if it is of correct type
+ else if (CONVERT_FROM(interp, listobjv[0], &temp) == TCL_ERROR)
+ $1 = 0;
+ else
+ $1 = 1;
}
}
@@ -412,7 +413,7 @@ namespace std {
};
%enddef
- specialize_std_vector(bool, Tcl_GetBoolFromObj, Tcl_NewBooleanObj);
+ specialize_std_vector(bool, SWIG_Tcl_GetBoolFromObj, Tcl_NewBooleanObj);
specialize_std_vector(char, SwigInt_As<char>,Tcl_NewIntObj);
specialize_std_vector(int, Tcl_GetIntFromObj,Tcl_NewIntObj);
specialize_std_vector(short, SwigInt_As<short>, Tcl_NewIntObj);
diff --git a/linux-x86/share/swig/tcl/swigmove.i b/linux-x86/share/swig/tcl/swigmove.i
new file mode 100644
index 0000000..62ecca7
--- /dev/null
+++ b/linux-x86/share/swig/tcl/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>
diff --git a/linux-x86/share/swig/tcl/tclapi.swg b/linux-x86/share/swig/tcl/tclapi.swg
index 2187de5..03c3967 100644
--- a/linux-x86/share/swig/tcl/tclapi.swg
+++ b/linux-x86/share/swig/tcl/tclapi.swg
@@ -23,8 +23,8 @@ typedef struct swig_const_info {
swig_type_info **ptype;
} swig_const_info;
-typedef int (*swig_wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
-typedef int (*swig_wrapper_func)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
+typedef int (*swig_wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *const []);
+typedef int (*swig_wrapper_func)(ClientData, Tcl_Interp *, int, Tcl_Obj *const []);
typedef char *(*swig_variable_func)(ClientData, Tcl_Interp *, char *, char *, int);
typedef void (*swig_delete_func)(ClientData);
@@ -63,7 +63,7 @@ typedef struct swig_instance {
/* Structure for command table */
typedef struct {
const char *name;
- int (*wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
+ int (*wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *const []);
ClientData clientdata;
} swig_command_info;
diff --git a/linux-x86/share/swig/tcl/tclerrors.swg b/linux-x86/share/swig/tcl/tclerrors.swg
index 889d3ad..73d73f8 100644
--- a/linux-x86/share/swig/tcl/tclerrors.swg
+++ b/linux-x86/share/swig/tcl/tclerrors.swg
@@ -51,15 +51,15 @@ SWIG_Tcl_SetErrorObj(Tcl_Interp *interp, const char *ctype, Tcl_Obj *obj)
{
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, obj);
- Tcl_SetErrorCode(interp, "SWIG", ctype, NULL);
+ Tcl_SetErrorCode(interp, "SWIG", ctype, (char *)NULL);
}
SWIGINTERN void
SWIG_Tcl_SetErrorMsg(Tcl_Interp *interp, const char *ctype, const char *mesg)
{
Tcl_ResetResult(interp);
- Tcl_SetErrorCode(interp, "SWIG", ctype, NULL);
- Tcl_AppendResult(interp, ctype, " ", mesg, NULL);
+ Tcl_SetErrorCode(interp, "SWIG", ctype, (char *)NULL);
+ Tcl_AppendResult(interp, ctype, " ", mesg, (char *)NULL);
/*
Tcl_AddErrorInfo(interp, ctype);
Tcl_AddErrorInfo(interp, " ");
diff --git a/linux-x86/share/swig/tcl/tclinit.swg b/linux-x86/share/swig/tcl/tclinit.swg
index 3140bdc..eb9e3ec 100644
--- a/linux-x86/share/swig/tcl/tclinit.swg
+++ b/linux-x86/share/swig/tcl/tclinit.swg
@@ -24,7 +24,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *);
/* Compatibility version for TCL stubs */
#ifndef SWIG_TCL_STUBS_VERSION
-#define SWIG_TCL_STUBS_VERSION "8.1"
+#define SWIG_TCL_STUBS_VERSION "8.4-"
#endif
%}
@@ -100,8 +100,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *interp) {
size_t i;
if (interp == 0) return TCL_ERROR;
#ifdef USE_TCL_STUBS
- /* (char*) cast is required to avoid compiler warning/error for Tcl < 8.4. */
- if (Tcl_InitStubs(interp, (char*)SWIG_TCL_STUBS_VERSION, 0) == NULL) {
+ if (Tcl_InitStubs(interp, SWIG_TCL_STUBS_VERSION, 0) == NULL) {
return TCL_ERROR;
}
#endif
diff --git a/linux-x86/share/swig/tcl/tclprimtypes.swg b/linux-x86/share/swig/tcl/tclprimtypes.swg
index 3b6d04f..ddefa7d 100644
--- a/linux-x86/share/swig/tcl/tclprimtypes.swg
+++ b/linux-x86/share/swig/tcl/tclprimtypes.swg
@@ -61,7 +61,7 @@ SWIG_From_dec(unsigned long)(unsigned long value)
return SWIG_From(long)(%numeric_cast(value, long));
} else {
char temp[256];
- sprintf(temp, "%lu", value);
+ SWIG_snprintf(temp, sizeof(temp), "%lu", value);
return Tcl_NewStringObj(temp,-1);
}
}
@@ -82,7 +82,7 @@ SWIG_AsVal_dec(unsigned long)(Tcl_Obj *obj, unsigned long *val) {
get it as a string so we can distinguish these cases. */
}
{
- int len = 0;
+ Tcl_Size len = 0;
const char *nptr = Tcl_GetStringFromObj(obj, &len);
if (nptr && len > 0) {
char *endptr;
@@ -122,7 +122,7 @@ SWIG_From_dec(long long)(long long value)
return SWIG_From(long)(%numeric_cast(value,long));
} else {
char temp[256];
- sprintf(temp, "%lld", value);
+ SWIG_snprintf(temp, sizeof(temp), "%lld", value);
return Tcl_NewStringObj(temp,-1);
}
}
@@ -136,30 +136,13 @@ SWIG_From_dec(long long)(long long value)
SWIGINTERN int
SWIG_AsVal_dec(long long)(Tcl_Obj *obj, long long *val)
{
- long v;
- if (Tcl_GetLongFromObj(0,obj, &v) == TCL_OK) {
+ Tcl_WideInt v;
+ if (Tcl_GetWideIntFromObj(0, obj, &v) == TCL_OK) {
+ if (sizeof(v) > sizeof(*val) && (v < LLONG_MIN || v > LLONG_MAX)) {
+ return SWIG_OverflowError;
+ }
if (val) *val = v;
return SWIG_OK;
- } else {
- int len = 0;
- const char *nptr = Tcl_GetStringFromObj(obj, &len);
- if (nptr && len > 0) {
- char *endptr;
- long long v;
- errno = 0;
- v = strtoll(nptr, &endptr,0);
- if (nptr[0] == '\0' || *endptr != '\0')
- return SWIG_TypeError;
- if ((v == LLONG_MAX || v == LLONG_MIN) && errno == ERANGE) {
- errno = 0;
- return SWIG_OverflowError;
- } else {
- if (*endptr == '\0') {
- if (val) *val = v;
- return SWIG_OK;
- }
- }
- }
}
return SWIG_TypeError;
}
@@ -180,7 +163,7 @@ SWIG_From_dec(unsigned long long)(unsigned long long value)
return SWIG_From(long long)(%numeric_cast(value, long long));
} else {
char temp[256];
- sprintf(temp, "%llu", value);
+ SWIG_snprintf(temp, sizeof(temp), "%llu", value);
return Tcl_NewStringObj(temp,-1);
}
}
@@ -200,7 +183,7 @@ SWIG_AsVal_dec(unsigned long long)(Tcl_Obj *obj, unsigned long long *val)
if (val) *val = (unsigned long) v;
return SWIG_OK;
} else {
- int len = 0;
+ Tcl_Size len = 0;
const char *nptr = Tcl_GetStringFromObj(obj, &len);
if (nptr && len > 0) {
char *endptr;
diff --git a/linux-x86/share/swig/tcl/tclrun.swg b/linux-x86/share/swig/tcl/tclrun.swg
index 9010b9c..debbd09 100644
--- a/linux-x86/share/swig/tcl/tclrun.swg
+++ b/linux-x86/share/swig/tcl/tclrun.swg
@@ -67,8 +67,8 @@
#define SWIG_GetConstant SWIG_GetConstantObj
#define SWIG_Tcl_GetConstant SWIG_Tcl_GetConstantObj
-#if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 5
-#define SWIG_TCL_HASHTABLE_INIT {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5)
+#define SWIG_TCL_HASHTABLE_INIT {0, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#else
#define SWIG_TCL_HASHTABLE_INIT {0}
#endif
@@ -118,10 +118,13 @@ SWIG_Tcl_Disown(void *ptr) {
return 0;
}
+SWIGRUNTIME void SWIG_Tcl_ObjectDelete(ClientData clientData);
+
/* Convert a pointer value */
SWIGRUNTIME int
SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swig_type_info *ty, int flags) {
swig_cast_info *tc;
+ const char *cmd_name;
/* Pointer values must start with leading underscore */
while (*c != '_') {
*ptr = (void *) 0;
@@ -137,7 +140,7 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi
/* from being called when c is not a command, firing the unknown proc */
if (Tcl_VarEval(interp,"info commands ", c, (char *) NULL) == TCL_OK) {
Tcl_Obj *result = Tcl_GetObjResult(interp);
- if (*(Tcl_GetStringFromObj(result, NULL)) == 0) {
+ if (*(Tcl_GetString(result)) == 0) {
/* It's not a command, so it can't be a pointer */
Tcl_ResetResult(interp);
return SWIG_ERROR;
@@ -155,32 +158,55 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi
return SWIG_ERROR;
}
- c = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), NULL);
+ c = Tcl_GetString(Tcl_GetObjResult(interp));
}
+ cmd_name = c;
c++;
c = SWIG_UnpackData(c,ptr,sizeof(void *));
+
if (ty) {
+ Tcl_CmdInfo info;
tc = c ? SWIG_TypeCheck(c,ty) : 0;
if (!tc) {
return SWIG_ERROR;
}
- if (flags & SWIG_POINTER_DISOWN) {
- SWIG_Disown((void *) *ptr);
- }
- {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
+ if (Tcl_GetCommandInfo(interp, cmd_name, &info)) {
+ /* When creating a pointer string, SWIG_Tcl_NewInstanceObj calls Tcl_CreateObjCommand and sets
+ * info.objClientData to an instance of swig_instance. Detecting when we can cast any info.objClientData
+ * to swig_instance is not simple as it may be an unrelated command; we use deleteProc to determine this. */
+ if (info.deleteProc == SWIG_Tcl_ObjectDelete) {
+ swig_instance *inst = (swig_instance *)info.objClientData;
+ if (!inst->thisvalue) {
+ *ptr = 0;
+ }
+ assert(inst->thisvalue == *ptr);
+ if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !SWIG_Thisown(inst->thisvalue)) {
+ return SWIG_ERROR_RELEASE_NOT_OWNED;
+ } else {
+ if (flags & SWIG_POINTER_DISOWN) {
+ SWIG_Disown((void *) *ptr);
+ }
+ if (flags & SWIG_POINTER_CLEAR) {
+ inst->thisvalue = 0;
+ }
+ {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,(void *) *ptr, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ }
+ }
+ }
}
}
+
return SWIG_OK;
}
/* Convert a pointer value */
SWIGRUNTIMEINLINE int
SWIG_Tcl_ConvertPtr(Tcl_Interp *interp, Tcl_Obj *oc, void **ptr, swig_type_info *ty, int flags) {
- return SWIG_Tcl_ConvertPtrFromString(interp, Tcl_GetStringFromObj(oc,NULL), ptr, ty, flags);
+ return SWIG_Tcl_ConvertPtrFromString(interp, Tcl_GetString(oc), ptr, ty, flags);
}
/* Convert a pointer value */
@@ -207,7 +233,7 @@ SWIG_Tcl_ConvertPacked(Tcl_Interp *SWIGUNUSEDPARM(interp) , Tcl_Obj *obj, void *
const char *c;
if (!obj) goto type_error;
- c = Tcl_GetStringFromObj(obj,NULL);
+ c = Tcl_GetString(obj);
/* Pointer values must start with leading underscore */
if (*c != '_') goto type_error;
c++;
@@ -306,7 +332,7 @@ SWIG_Tcl_ObjectDelete(ClientData clientData) {
/* Function to invoke object methods given an instance */
SWIGRUNTIME int
-SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST _objv[]) {
+SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const _objv[]) {
char *method, *attrname;
swig_instance *inst = (swig_instance *) clientData;
swig_method *meth;
@@ -326,7 +352,7 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_
Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC);
return TCL_ERROR;
}
- method = Tcl_GetStringFromObj(objv[1],NULL);
+ method = Tcl_GetString(objv[1]);
if (strcmp(method,"-acquire") == 0) {
inst->destroy = 1;
SWIG_Acquire(inst->thisvalue);
@@ -389,7 +415,7 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_
Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC);
return TCL_ERROR;
}
- attrname = Tcl_GetStringFromObj(objv[2],NULL);
+ attrname = Tcl_GetString(objv[2]);
attr = cls->attributes;
while (attr && attr->name) {
if ((strcmp(attr->name, attrname) == 0) && (attr->getmethod)) {
@@ -423,7 +449,7 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_
}
i = 2;
while (i < objc) {
- attrname = Tcl_GetStringFromObj(objv[i],NULL);
+ attrname = Tcl_GetString(objv[i]);
attr = cls->attributes;
while (attr && attr->name) {
if ((strcmp(attr->name, attrname) == 0) && (attr->setmethod)) {
@@ -490,19 +516,30 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ
/* Check to see if this pointer belongs to a class or not */
if (thisvalue && (type->clientdata) && (interp)) {
Tcl_CmdInfo ci;
+ int has_command;
char *name;
- name = Tcl_GetStringFromObj(robj,NULL);
- if (!Tcl_GetCommandInfo(interp,name, &ci) || (flags)) {
+ name = Tcl_GetString(robj);
+ has_command = Tcl_GetCommandInfo(interp, name, &ci);
+ if (!has_command || flags) {
swig_instance *newinst = (swig_instance *) malloc(sizeof(swig_instance));
newinst->thisptr = Tcl_DuplicateObj(robj);
Tcl_IncrRefCount(newinst->thisptr);
newinst->thisvalue = thisvalue;
newinst->classptr = (swig_class *) type->clientdata;
newinst->destroy = flags;
- newinst->cmdtok = Tcl_CreateObjCommand(interp, Tcl_GetStringFromObj(robj,NULL), (swig_wrapper_func) SWIG_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_ObjectDelete);
+ newinst->cmdtok = Tcl_CreateObjCommand(interp, Tcl_GetString(robj), (swig_wrapper_func) SWIG_Tcl_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_Tcl_ObjectDelete);
if (flags) {
SWIG_Acquire(thisvalue);
}
+ } else {
+ swig_instance *inst = (swig_instance *)ci.objClientData;
+ /* Restore thisvalue as SWIG_POINTER_CLEAR may have been used to set it to zero.
+ Occurs when the C pointer is re-used by the memory allocator and the command has
+ been created and not destroyed - bug?? - see cpp11_std_unique_ptr_runme.tcl test. */
+ if (inst->thisvalue != thisvalue) {
+ assert(inst->thisvalue == 0);
+ inst->thisvalue = thisvalue;
+ }
}
}
return robj;
@@ -510,7 +547,7 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ
/* Function to create objects */
SWIGRUNTIME int
-SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
Tcl_Obj *newObj = 0;
void *thisvalue = 0;
swig_instance *newinst = 0;
@@ -527,7 +564,7 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc,
}
cons = classptr->constructor;
if (objc > 1) {
- char *s = Tcl_GetStringFromObj(objv[1],NULL);
+ char *s = Tcl_GetString(objv[1]);
if (strcmp(s,"-this") == 0) {
thisarg = 2;
cons = 0;
@@ -539,7 +576,7 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc,
} else if (objc >= 3) {
char *s1;
name = s;
- s1 = Tcl_GetStringFromObj(objv[2],NULL);
+ s1 = Tcl_GetString(objv[2]);
if (strcmp(s1,"-this") == 0) {
thisarg = 3;
cons = 0;
@@ -555,12 +592,12 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc,
return result;
}
newObj = Tcl_DuplicateObj(Tcl_GetObjResult(interp));
- if (!name) name = Tcl_GetStringFromObj(newObj,NULL);
+ if (!name) name = Tcl_GetString(newObj);
} else if (thisarg > 0) {
if (thisarg < objc) {
destroy = 0;
newObj = Tcl_DuplicateObj(objv[thisarg]);
- if (!name) name = Tcl_GetStringFromObj(newObj,NULL);
+ if (!name) name = Tcl_GetString(newObj);
} else {
Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC);
return TCL_ERROR;
@@ -582,7 +619,7 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc,
if (destroy) {
SWIG_Acquire(thisvalue);
}
- newinst->cmdtok = Tcl_CreateObjCommand(interp,name, (swig_wrapper) SWIG_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_ObjectDelete);
+ newinst->cmdtok = Tcl_CreateObjCommand(interp,name, (swig_wrapper) SWIG_Tcl_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_Tcl_ObjectDelete);
return TCL_OK;
}
@@ -590,7 +627,7 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc,
* Get arguments
* -----------------------------------------------------------------------------*/
SWIGRUNTIME int
-SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char *fmt, ...) {
+SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *fmt, ...) {
int argno = 0, opt = 0;
long tempi;
double tempd;
@@ -619,7 +656,7 @@ SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char
vptr = va_arg(ap,void *);
if (vptr) {
if (isupper(*c)) {
- obj = SWIG_Tcl_GetConstantObj(Tcl_GetStringFromObj(objv[argno+1],0));
+ obj = SWIG_Tcl_GetConstantObj(Tcl_GetString(objv[argno+1]));
if (!obj) obj = objv[argno+1];
} else {
obj = objv[argno+1];
@@ -643,15 +680,15 @@ SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char
break;
case 's': case 'S':
if (*(c+1) == '#') {
- int *vlptr = (int *) va_arg(ap, void *);
+ Tcl_Size *vlptr = (Tcl_Size *) va_arg(ap, void *);
*((char **) vptr) = Tcl_GetStringFromObj(obj, vlptr);
c++;
} else {
- *((char **)vptr) = Tcl_GetStringFromObj(obj,NULL);
+ *((char **)vptr) = Tcl_GetString(obj);
}
break;
case 'c': case 'C':
- *((char *)vptr) = *(Tcl_GetStringFromObj(obj,NULL));
+ *((char *)vptr) = *(Tcl_GetString(obj));
break;
case 'p': case 'P':
ty = (swig_type_info *) va_arg(ap, void *);
@@ -676,11 +713,11 @@ SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char
argerror:
{
char temp[32];
- sprintf(temp,"%d", argno+1);
+ SWIG_snprintf(temp, sizeof(temp), "%d", argno+1);
c = strchr(fmt,':');
if (!c) c = strchr(fmt,';');
if (!c) c = (char *)"";
- Tcl_AppendResult(interp,c," argument ", temp, NULL);
+ Tcl_AppendResult(interp,c," argument ", temp, (char *)NULL);
va_end(ap);
return TCL_ERROR;
}
diff --git a/linux-x86/share/swig/tcl/tclruntime.swg b/linux-x86/share/swig/tcl/tclruntime.swg
index bb4edd7..3b34a76 100644
--- a/linux-x86/share/swig/tcl/tclruntime.swg
+++ b/linux-x86/share/swig/tcl/tclruntime.swg
@@ -6,6 +6,22 @@
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
+
+/* Check, if Tcl version supports Tcl_Size,
+ which was introduced in Tcl 8.7 and 9.
+*/
+#ifndef TCL_SIZE_MAX
+ #include <limits.h>
+ #define TCL_SIZE_MAX INT_MAX
+
+ #ifndef Tcl_Size
+ typedef int Tcl_Size;
+ #endif
+
+ #define TCL_SIZE_MODIFIER ""
+ #define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj
+ #define Tcl_NewSizeIntObj Tcl_NewIntObj
+#endif
%}
%insert(runtime) "swigrun.swg"; /* Common C API type-checking code */
diff --git a/linux-x86/share/swig/tcl/tclsh.i b/linux-x86/share/swig/tcl/tclsh.i
index 160ba8d..e908756 100644
--- a/linux-x86/share/swig/tcl/tclsh.i
+++ b/linux-x86/share/swig/tcl/tclsh.i
@@ -4,20 +4,15 @@
* SWIG File for building new tclsh program
* ----------------------------------------------------------------------------- */
-#ifdef AUTODOC
-%subsection "tclsh.i"
-%text %{
-This module provides the Tcl_AppInit() function needed to build a
-new version of the tclsh executable. This file should not be used
-when using dynamic loading. To make an interface file work with
-both static and dynamic loading, put something like this in your
-interface file :
-
- #ifdef STATIC
- %include <tclsh.i>
- #endif
-%}
-#endif
+// This module provides the Tcl_AppInit() function needed to build a
+// new version of the tclsh executable. This file should not be used
+// when using dynamic loading. To make an interface file work with
+// both static and dynamic loading, put something like this in your
+// interface file :
+//
+// #ifdef STATIC
+// %include <tclsh.i>
+// #endif
%{
@@ -33,10 +28,6 @@ char *SWIG_RcFileName = "~/.myapprc";
#endif
-#ifdef MAC_TCL
-extern int MacintoshInit _ANSI_ARGS_((void));
-#endif
-
int Tcl_AppInit(Tcl_Interp *interp){
if (Tcl_Init(interp) == TCL_ERROR)
@@ -46,40 +37,16 @@ int Tcl_AppInit(Tcl_Interp *interp){
if (SWIG_init(interp) == TCL_ERROR)
return TCL_ERROR;
-#if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5
- Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
-#else
- tcl_RcFileName = SWIG_RcFileName;
-#endif
-#ifdef SWIG_RcRsrcName
- Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL);
-#endif
-
+ Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
+
return TCL_OK;
}
-#if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 4
int main(int argc, char **argv) {
-#ifdef MAC_TCL
- char *newArgv[2];
-
- if (MacintoshInit() != TCL_OK) {
- Tcl_Exit(1);
- }
-
- argc = 1;
- newArgv[0] = "tclsh";
- newArgv[1] = NULL;
- argv = newArgv;
-#endif
-
Tcl_Main(argc, argv, Tcl_AppInit);
return(0);
}
-#else
-extern int main();
-#endif
%}
diff --git a/linux-x86/share/swig/tcl/tclstrings.swg b/linux-x86/share/swig/tcl/tclstrings.swg
index 540d627..738c813 100644
--- a/linux-x86/share/swig/tcl/tclstrings.swg
+++ b/linux-x86/share/swig/tcl/tclstrings.swg
@@ -6,7 +6,7 @@
SWIGINTERN int
SWIG_AsCharPtrAndSize(Tcl_Obj *obj, char** cptr, size_t* psize, int *alloc)
{
- int len = 0;
+ Tcl_Size len = 0;
char *cstr = Tcl_GetStringFromObj(obj, &len);
if (cstr) {
if (cptr) *cptr = cstr;
@@ -24,7 +24,7 @@ SWIG_AsCharPtrAndSize(Tcl_Obj *obj, char** cptr, size_t* psize, int *alloc)
SWIGINTERNINLINE Tcl_Obj *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
- return (size < INT_MAX) ? Tcl_NewStringObj(carray, %numeric_cast(size,int)) : NULL;
+ return (size < TCL_SIZE_MAX) ? Tcl_NewStringObj(carray, %numeric_cast(size,Tcl_Size)) : NULL;
}
}
diff --git a/linux-x86/share/swig/tcl/tcltypemaps.swg b/linux-x86/share/swig/tcl/tcltypemaps.swg
index ad31bcf..66cce47 100644
--- a/linux-x86/share/swig/tcl/tcltypemaps.swg
+++ b/linux-x86/share/swig/tcl/tcltypemaps.swg
@@ -77,11 +77,6 @@
#endif
-%typemap(throws,noblock=1) SWIGTYPE CLASS {
- SWIG_set_result(SWIG_NewInstanceObj(%as_voidptr(SWIG_new_copy($1, $1_ltype)), $&1_descriptor, 1));
- SWIG_fail;
-}
-
%typemap(out) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE;
%typemap(out) SWIGTYPE *const = SWIGTYPE *;
diff --git a/linux-x86/share/swig/tcl/tclwstrings.swg b/linux-x86/share/swig/tcl/tclwstrings.swg
index b3b682e..76da2ab 100644
--- a/linux-x86/share/swig/tcl/tclwstrings.swg
+++ b/linux-x86/share/swig/tcl/tclwstrings.swg
@@ -12,14 +12,14 @@
SWIGINTERN int
SWIG_AsWCharPtrAndSize(Tcl_Obj *obj, wchar_t** cptr, size_t* psize, int *alloc)
{
- int len = 0;
+ Tcl_Size len = 0;
Tcl_UniChar *ustr = Tcl_GetUnicodeFromObj(obj, &len);
if (ustr) {
if (cptr) {
Tcl_Encoding encoding = NULL;
char *src = (char *) ustr;
- int srcLen = (len)*sizeof(Tcl_UniChar);
- int dstLen = sizeof(wchar_t)*(len + 1);
+ Tcl_Size srcLen = (len)*sizeof(Tcl_UniChar);
+ Tcl_Size dstLen = sizeof(wchar_t)*(len + 1);
char *dst = %new_array(dstLen, char);
int flags = 0;
Tcl_EncodingState *statePtr = 0;
@@ -29,6 +29,7 @@ SWIG_AsWCharPtrAndSize(Tcl_Obj *obj, wchar_t** cptr, size_t* psize, int *alloc)
Tcl_UtfToExternal(0, encoding, src, srcLen, flags, statePtr, dst,
dstLen, &srcRead, &dstWrote, &dstChars);
+ *cptr = (wchar_t*)dst;
if (alloc) *alloc = SWIG_NEWOBJ;
}
if (psize) *psize = len + 1;
@@ -43,11 +44,11 @@ SWIGINTERNINLINE Tcl_Obj *
SWIG_FromWCharPtrAndSize(const wchar_t* carray, size_t size)
{
Tcl_Obj *res = NULL;
- if (size < INT_MAX) {
+ if (size < TCL_SIZE_MAX) {
Tcl_Encoding encoding = NULL;
char *src = (char *) carray;
- int srcLen = (int)(size*sizeof(wchar_t));
- int dstLen = (int)(size*sizeof(Tcl_UniChar));
+ Tcl_Size srcLen = (Tcl_Size)(size*sizeof(wchar_t));
+ Tcl_Size dstLen = (Tcl_Size)(size*sizeof(Tcl_UniChar));
char *dst = %new_array(dstLen, char);
int flags = 0;
Tcl_EncodingState *statePtr = 0;
@@ -58,7 +59,7 @@ SWIG_FromWCharPtrAndSize(const wchar_t* carray, size_t size)
Tcl_ExternalToUtf(0, encoding, src, srcLen, flags, statePtr, dst,
dstLen, &srcRead, &dstWrote, &dstChars);
- res = Tcl_NewUnicodeObj((Tcl_UniChar*)dst, (int)size);
+ res = Tcl_NewUnicodeObj((Tcl_UniChar*)dst, (Tcl_Size)size);
%delete_array(dst);
}
return res;
diff --git a/linux-x86/share/swig/tcl/typemaps.i b/linux-x86/share/swig/tcl/typemaps.i
index 04a5c78..4f42cfc 100644
--- a/linux-x86/share/swig/tcl/typemaps.i
+++ b/linux-x86/share/swig/tcl/typemaps.i
@@ -164,14 +164,14 @@ or you can use the %apply directive :
%typemap(in) long long *INPUT($*1_ltype temp),
long long &INPUT($*1_ltype temp)
{
- temp = ($*1_ltype) strtoll(Tcl_GetStringFromObj($input,NULL),0,0);
+ temp = ($*1_ltype) strtoll(Tcl_GetString($input),0,0);
$1 = &temp;
}
%typemap(in) unsigned long long *INPUT($*1_ltype temp),
unsigned long long &INPUT($*1_ltype temp)
{
- temp = ($*1_ltype) strtoull(Tcl_GetStringFromObj($input,NULL),0,0);
+ temp = ($*1_ltype) strtoull(Tcl_GetString($input),0,0);
$1 = &temp;
}
@@ -275,7 +275,7 @@ output values.
{
char temp[256];
Tcl_Obj *o;
- sprintf(temp,"%lld",(long long)*($1));
+ SWIG_snprintf(temp,sizeof(temp),"%lld",(long long)*($1));
o = Tcl_NewStringObj(temp,-1);
Tcl_ListObjAppendElement(interp,Tcl_GetObjResult(interp),o);
}
@@ -284,7 +284,7 @@ output values.
{
char temp[256];
Tcl_Obj *o;
- sprintf(temp,"%llu",(unsigned long long)*($1));
+ SWIG_snprintf(temp,sizeof(temp),"%llu",(unsigned long long)*($1));
o = Tcl_NewStringObj(temp,-1);
Tcl_ListObjAppendElement(interp,Tcl_GetObjResult(interp),o);
}
diff --git a/linux-x86/share/swig/tcl/wish.i b/linux-x86/share/swig/tcl/wish.i
index 260032a..6969b2a 100644
--- a/linux-x86/share/swig/tcl/wish.i
+++ b/linux-x86/share/swig/tcl/wish.i
@@ -4,25 +4,20 @@
* SWIG File for making wish
* ----------------------------------------------------------------------------- */
-#ifdef AUTODOC
-%subsection "wish.i"
-%text %{
-This module provides the Tk_AppInit() function needed to build a
-new version of the wish executable. Like tclsh.i, this file should
-not be used with dynamic loading. To make an interface file work with
-both static and dynamic loading, put something like this in your
-interface file :
-
- #ifdef STATIC
- %include <wish.i>
- #endif
-
-A startup file may be specified by defining the symbol SWIG_RcFileName
-as follows (this should be included in a code-block) :
-
- #define SWIG_RcFileName "~/.mywishrc"
-%}
-#endif
+// This module provides the Tk_AppInit() function needed to build a
+// new version of the wish executable. Like tclsh.i, this file should
+// not be used with dynamic loading. To make an interface file work with
+// both static and dynamic loading, put something like this in your
+// interface file :
+//
+// #ifdef STATIC
+// %include <wish.i>
+// #endif
+//
+// A startup file may be specified by defining the symbol SWIG_RcFileName
+// as follows (this should be included in a code-block) :
+//
+// #define SWIG_RcFileName "~/.mywishrc"
%{
@@ -35,11 +30,6 @@ as follows (this should be included in a code-block) :
char *SWIG_RcFileName = "~/.wishrc";
#endif
-#ifdef MAC_TCL
-extern int MacintoshInit _ANSI_ARGS_((void));
-extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp));
-#endif
-
/*
*----------------------------------------------------------------------
*
@@ -61,10 +51,9 @@ extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp));
int Tcl_AppInit(Tcl_Interp *interp)
{
-#ifndef MAC_TCL
Tk_Window main;
main = Tk_MainWindow(interp);
-#endif
+
/*
* Call the init procedures for included packages. Each call should
* look like this:
@@ -93,10 +82,6 @@ int Tcl_AppInit(Tcl_Interp *interp)
return TCL_ERROR;
}
-#ifdef MAC_TCL
- SetupMainInterp(interp);
-#endif
-
/*
* Specify a user-specific startup file to invoke if the application
* is run interactively. Typically the startup file is "~/.apprc"
@@ -104,35 +89,12 @@ int Tcl_AppInit(Tcl_Interp *interp)
* then no user-specific startup file will be run under any conditions.
*/
-#if TCL_MAJOR_VERSION >= 8 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5
- Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
-#else
- tcl_RcFileName = SWIG_RcFileName;
-#endif
-
-/* For Macintosh might also want this */
-
-#ifdef MAC_TCL
-#ifdef SWIG_RcRsrcName
- Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL_ONLY);
-#endif
-#endif
+ Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
return TCL_OK;
}
#if TK_MAJOR_VERSION >= 4
int main(int argc, char **argv) {
-
-#ifdef MAC_TCL
- char *newArgv[2];
- if (MacintoshInit() != TCL_OK) {
- Tcl_Exit(1);
- }
- argc = 1;
- newArgv[0] = "Wish";
- newArgv[1] = NULL;
- argv = newArgv;
-#endif
Tk_Main(argc, argv, Tcl_AppInit);
return(0);
}
diff --git a/linux-x86/share/swig/typemaps/attribute.swg b/linux-x86/share/swig/typemaps/attribute.swg
index 9881139..abdf44d 100644
--- a/linux-x86/share/swig/typemaps/attribute.swg
+++ b/linux-x86/share/swig/typemaps/attribute.swg
@@ -7,132 +7,6 @@
/*
The following macros convert a pair of set/get methods
into a "native" attribute.
-
- Use %attribute when you have a pair of get/set methods to a primitive type
- like in:
-
- %attribute(A, int, a, get_a, set_a);
-
- struct A
- {
- int get_a() const;
- void set_a(int aa);
- };
-
- If you don't provide a 'set' method, a 'read-only' attribute
- is generated, ie, like in:
-
- %attribute(A, int, c, get_c);
-
- Use %attributeref when you have const/non-const reference access methods
- for primitive types or class/structs, like in:
-
- %attributeref(A, int, b);
-
- struct A
- {
- const int& b() const;
- int& b();
- };
-
- %attributeref(B, int, c);
-
- struct B
- {
- int& c();
- };
-
- You can also use
-
- %attributeref(Class, AttributeType, AttributeName, AccessorMethod)
-
- if the internal C++ reference methods have a different name from the
- attribute you want, so
-
- %attributeref(B, int, d, c);
-
- is the same as the last example, but instead of the attribute 'c' being
- called 'c', it is called 'd'.
-
- Now you can use the attributes like so:
-
- x = A()
- x.a = 3 # calls A::set_a
- print x.a # calls A::get_a
-
- x.b = 3 # calls A::b()
- print x.b # calls A::b() const
-
- Use %attribute2 instead of %attribute to indicate that reference-pointer
- translation is required. You use %attribute2 instead of %attribute in
- cases like this:
-
- %attribute2(MyClass, MyFoo, Foo, GetFoo, SetFoo);
- %inline %{
- struct MyFoo {
- int x;
- };
- class MyClass {
- MyFoo foo;
- public:
- MyFoo& GetFoo() { return foo; }
- void SetFoo(const MyFoo& other) { foo = other; }
- };
- %}
-
- Here, the data type of the property is a wrapped type (MyFoo) and on the
- C++ side it is passed by reference. The problem is that the SWIG wrapper will
- pass around a pointer (MyFoo *) which is not compatible with the reference
- type of the accessors (MyFoo &). Therefore, if you use %attribute, you'll get
- an error from your C/C++ compiler. %attribute2 translates between a pointer
- and a reference to eliminate the error. In case you're confused, let's make it
- simple: just use %attribute at first, but if the C/C++ compiler gives an error
- while compiling the wrapper, try %attribute2 instead.
-
- NOTE: remember that if the type contains commas, such as 'std::pair<int,int>',
- you need to use the macro like:
-
- %attributeref(A, %arg(std::pair<int,int>), pval);
-
- where %arg() 'normalizes' the type to be understood as a single
- argument, otherwise the macro will get confused by the comma.
-
- The %attributeval is the same as %attribute, but should be used when the type
- is a class/struct (ie a non-primitive type) and when the get and set methods
- return/pass by value. The following is very similar to the above example, but
- note that the access is by value rather than reference.
-
- %attributeval(MyClassVal, MyFoo, ReadWriteFoo, GetFoo, SetFoo);
- %attributeval(MyClassVal, MyFoo, ReadOnlyFoo, GetFoo);
- %inline %{
- class MyClassVal {
- MyFoo foo;
- public:
- MyFoo GetFoo() { return foo; }
- void SetFoo(MyFoo other) { foo = other; }
- };
- %}
-
- The %attributestring is the same as %attributeval, but should be used for string
- class types, which are unusual as they are a class on the C++ side, but normally an
- immutable/primitive type in the target language. Example usage for std::string:
-
- %include <std_string.i>
- %attributestring(MyStringyClass, std::string, ReadWriteString, GetString, SetString);
- %attributestring(MyStringyClass, std::string, ReadOnlyString, GetString);
- %inline %{
- class MyStringyClass {
- std::string str;
- public:
- MyStringyClass(const std::string &val) : str(val) {}
- std::string GetString() { return str; }
- void SetString(std::string other) { str = other; }
- };
- %}
-
- The %attributestring also works for class types that have %naturalvar turned
- on and so is also useful for shared_ptr which has %naturalvar turned on in %shared_ptr.
-
*/
//
@@ -224,20 +98,10 @@
#if #AccessorMethod != ""
%attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AccessorMethod, AccessorMethod, &self_->AccessorMethod(), self_->AccessorMethod() = *val_)
#else
- %attribute_custom(%arg(Class), %arg(AttributeType), AccessorName, AccessorName, AccessorName, &self_->AccessorName(), self_->AccessorName() = *val_)
+ %attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AttributeName, AttributeName, &self_->AttributeName(), self_->AttributeName() = *val_)
#endif
%enddef
-// deprecated (same as %attributeref, but there is an argument order inconsistency)
-%define %attribute_ref(Class, AttributeType, AccessorMethod, AttributeName...)
- #if #AttributeName != ""
- %attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AccessorMethod, AccessorMethod, self_->AccessorMethod(), self_->AccessorMethod() = val_)
- #else
- %attribute_custom(%arg(Class), %arg(AttributeType), AccessorMethod, AccessorMethod, AccessorMethod, self_->AccessorMethod(), self_->AccessorMethod() = val_)
- #endif
-%enddef
-
-
%define %attributeval(Class, AttributeType, AttributeName, GetMethod, SetMethod...)
%{
#define %mangle(Class) ##_## AttributeName ## _get(self_) new AttributeType(self_->GetMethod())
diff --git a/linux-x86/share/swig/typemaps/carrays.swg b/linux-x86/share/swig/typemaps/carrays.swg
index 462d60b..d02e70f 100644
--- a/linux-x86/share/swig/typemaps/carrays.swg
+++ b/linux-x86/share/swig/typemaps/carrays.swg
@@ -11,10 +11,10 @@
* Generates functions for creating and accessing elements of a C array
* (as pointers). Creates the following functions:
*
- * TYPE *new_NAME(int nelements)
+ * TYPE *new_NAME(size_t nelements)
* void delete_NAME(TYPE *);
- * TYPE NAME_getitem(TYPE *, int index);
- * void NAME_setitem(TYPE *, int index, TYPE value);
+ * TYPE NAME_getitem(TYPE *, size_t index);
+ * void NAME_setitem(TYPE *, size_t index, TYPE value);
*
* ----------------------------------------------------------------------------- */
@@ -51,10 +51,10 @@ void NAME##_setitem(TYPE *ary, size_t index, TYPE value);
* interface:
*
* struct NAME {
- * NAME(int nelements);
+ * NAME(size_t nelements);
* ~NAME();
- * TYPE getitem(int index);
- * void setitem(int index, TYPE value);
+ * TYPE getitem(size_t index);
+ * void setitem(size_t index, TYPE value);
* TYPE * cast();
* static NAME *frompointer(TYPE *t);
* }
diff --git a/linux-x86/share/swig/typemaps/cpointer.swg b/linux-x86/share/swig/typemaps/cpointer.swg
index 94bbbd6..a5ac07d 100644
--- a/linux-x86/share/swig/typemaps/cpointer.swg
+++ b/linux-x86/share/swig/typemaps/cpointer.swg
@@ -55,7 +55,7 @@ typedef struct {
return %new_instance(TYPE);
}
~NAME() {
- if ($self) %delete($self);
+ %delete($self);
}
}
@@ -105,7 +105,7 @@ typedef struct {
%define %pointer_functions(TYPE,NAME)
%{
- static TYPE *new_##NAME() {
+ static TYPE *new_##NAME(void) {
return %new_instance(TYPE);
}
@@ -114,7 +114,7 @@ typedef struct {
}
static void delete_##NAME(TYPE *obj) {
- if (obj) %delete(obj);
+ %delete(obj);
}
static void NAME ##_assign(TYPE *obj, TYPE value) {
@@ -126,7 +126,7 @@ typedef struct {
}
%}
-TYPE *new_##NAME();
+TYPE *new_##NAME(void);
TYPE *copy_##NAME(TYPE value);
void delete_##NAME(TYPE *obj);
void NAME##_assign(TYPE *obj, TYPE value);
diff --git a/linux-x86/share/swig/typemaps/cstrings.swg b/linux-x86/share/swig/typemaps/cstrings.swg
index 0aca611..7a7e2c1 100644
--- a/linux-x86/share/swig/typemaps/cstrings.swg
+++ b/linux-x86/share/swig/typemaps/cstrings.swg
@@ -50,7 +50,7 @@
*
* %cstring_bounded_output(Char *outx, 512);
* void foo(Char *outx) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*
*/
@@ -59,7 +59,7 @@
%typemap(in,noblock=1,numinputs=0) TYPEMAP (Char temp[MAX+1]) {
$1 = ($1_ltype) temp;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment= #SWIG_FromCharPtr ) TYPEMAP {
$1[MAX] = 0;
%append_output(SWIG_FromCharPtr($1));
@@ -85,7 +85,7 @@
%typemap(in,noblock=1,numinputs=0) TYPEMAP(Char temp[SIZE]) {
$1 = ($1_ltype) temp;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment= #SWIG_FromCharPtrAndSize) TYPEMAP {
%append_output(SWIG_FromCharPtrAndSize($1,SIZE));
}
@@ -122,7 +122,7 @@
temp[n - 1] = 0;
$1 = ($1_ltype) temp;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
$1[MAX] = 0;
%append_output(SWIG_FromCharPtr($1));
@@ -160,7 +160,7 @@
if (alloc == SWIG_NEWOBJ) %delete_array(t);
$1[n-1] = 0;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
%append_output(SWIG_FromCharPtr($1));
%delete_array($1);
@@ -175,7 +175,7 @@
*
* %cstring_output_maxsize(Char *outx, int max) {
* void foo(Char *outx, int max) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*/
@@ -205,7 +205,7 @@
*
* %cstring_output_withsize(Char *outx, int *max) {
* void foo(Char *outx, int *max) {
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* *max = strlen(outx);
* }
*/
@@ -239,7 +239,7 @@
* %cstring_output_allocate(Char **outx, free($1));
* void foo(Char **outx) {
* *outx = (Char *) malloc(512);
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* }
*/
@@ -247,7 +247,7 @@
%typemap(in,noblock=1,numinputs=0) TYPEMAP($*1_ltype temp = 0) {
$1 = &temp;
}
-%typemap(freearg,match="in") TYPEMAP "";
+%typemap(freearg,match="in") TYPEMAP ""
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP {
if (*$1) {
%append_output(SWIG_FromCharPtr(*$1));
@@ -266,7 +266,7 @@
* %cstring_output_allocate_size(Char **outx, int *sz, free($1));
* void foo(Char **outx, int *sz) {
* *outx = (Char *) malloc(512);
- * sprintf(outx,"blah blah\n");
+ * strcpy(outx,"blah blah\n");
* *sz = strlen(outx);
* }
*/
@@ -275,7 +275,7 @@
%typemap(in,noblock=1,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) {
$1 = &temp; $2 = &tempn;
}
-%typemap(freearg,match="in") (TYPEMAP,SIZE) "";
+%typemap(freearg,match="in") (TYPEMAP,SIZE) ""
%typemap(argout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)(TYPEMAP,SIZE) {
if (*$1) {
%append_output(SWIG_FromCharPtrAndSize(*$1,*$2));
diff --git a/linux-x86/share/swig/typemaps/enumint.swg b/linux-x86/share/swig/typemaps/enumint.swg
index d048bb6..b7e2956 100644
--- a/linux-x86/share/swig/typemaps/enumint.swg
+++ b/linux-x86/share/swig/typemaps/enumint.swg
@@ -29,7 +29,7 @@
%typemap(varin,fragment=SWIG_AsVal_frag(int),noblock=1) enum SWIGTYPE {
if (sizeof(int) != sizeof($1)) {
%variable_fail(SWIG_AttributeError,"$type", "arch, read-only $name");
- } else {
+ } else {
int ecode = SWIG_AsVal(int)($input, %reinterpret_cast(&$1,int*));
if (!SWIG_IsOK(ecode)) {
%variable_fail(ecode, "$type", "$name");
diff --git a/linux-x86/share/swig/typemaps/exception.swg b/linux-x86/share/swig/typemaps/exception.swg
index b60a329..aece832 100644
--- a/linux-x86/share/swig/typemaps/exception.swg
+++ b/linux-x86/share/swig/typemaps/exception.swg
@@ -19,6 +19,7 @@
#endif
#define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name)
#define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type)
+#define %releasenotownedfail_fmt(_type,_name,_argn) "in method '" `_name` "', cannot release ownership as memory is not owned for argument " `_argn`" of type '" `_type`"'"
/* setting an error */
#define %error(code,msg...) SWIG_Error(code, msg)
@@ -30,7 +31,7 @@
%define_as(SWIG_exception_fail(code, msg), %block(%error(code, msg); SWIG_fail))
-%define_as(SWIG_contract_assert(expr, msg), if (!(expr)) { %error(SWIG_RuntimeError, msg); SWIG_fail; } else)
+%define_as(SWIG_contract_assert(expr, msg), do { if (!(expr)) { %error(SWIG_RuntimeError, msg); SWIG_fail; } } while (0))
}
diff --git a/linux-x86/share/swig/typemaps/fragments.swg b/linux-x86/share/swig/typemaps/fragments.swg
index e83f415..e76a694 100644
--- a/linux-x86/share/swig/typemaps/fragments.swg
+++ b/linux-x86/share/swig/typemaps/fragments.swg
@@ -120,10 +120,6 @@ inline int SWIG_isfinite_func(T 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/linux-x86/share/swig/typemaps/implicit.swg b/linux-x86/share/swig/typemaps/implicit.swg
index 2fc3108..5536e0a 100644
--- a/linux-x86/share/swig/typemaps/implicit.swg
+++ b/linux-x86/share/swig/typemaps/implicit.swg
@@ -27,7 +27,7 @@
get(2.0) ==> get(A(2.0))
get(B()) ==> get(A(B()))
- and swig will construct an 'A' temporal variable using the
+ and swig will construct an 'A' temporary variable using the
corresponding implicit constructor.
diff --git a/linux-x86/share/swig/typemaps/inoutlist.swg b/linux-x86/share/swig/typemaps/inoutlist.swg
index 23fda85..6c7604a 100644
--- a/linux-x86/share/swig/typemaps/inoutlist.swg
+++ b/linux-x86/share/swig/typemaps/inoutlist.swg
@@ -221,10 +221,6 @@ this :
x = neg(x)
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
*/
%define %_value_inout_typemap(Type)
diff --git a/linux-x86/share/swig/typemaps/primtypes.swg b/linux-x86/share/swig/typemaps/primtypes.swg
index dd80eb7..85a0b8d 100644
--- a/linux-x86/share/swig/typemaps/primtypes.swg
+++ b/linux-x86/share/swig/typemaps/primtypes.swg
@@ -252,9 +252,11 @@ SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double *d, double min, double max) {
double x = *d;
if ((min <= x && x <= max)) {
- double fx = floor(x);
- double cx = ceil(x);
- double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+ double fx, cx, rd;
+ errno = 0;
+ fx = floor(x);
+ cx = ceil(x);
+ rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
if ((errno == EDOM) || (errno == ERANGE)) {
errno = 0;
} else {
diff --git a/linux-x86/share/swig/typemaps/ptrtypes.swg b/linux-x86/share/swig/typemaps/ptrtypes.swg
index e8439e6..8619b31 100644
--- a/linux-x86/share/swig/typemaps/ptrtypes.swg
+++ b/linux-x86/share/swig/typemaps/ptrtypes.swg
@@ -35,7 +35,7 @@
$1 = *ptr;
if (SWIG_IsNewObj(res)) %delete(ptr);
}
- %typemap(freearg) Type "";
+ %typemap(freearg) Type ""
%typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) {
Type *ptr = (Type *)0;
res = asptr_meth($input, &ptr);
@@ -184,13 +184,33 @@
%enddef
/*---------------------------------------------------------------------
+ * typemap definition for types with from method for ptr types
+ * Same as typemaps_from but without varout typemap
+ *---------------------------------------------------------------------*/
+
+%define %ptr_typemaps_from(FromMeth, FromFrag, Type...)
+ %value_out_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+ /* No varout typemap */
+ %value_constcode_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+ %value_directorin_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+ %value_throws_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+ %value_output_typemap(%arg(FromMeth), %arg(FromFrag), Type);
+%enddef
+
+/*---------------------------------------------------------------------
* typemap definition for types with asptr/from methods
*---------------------------------------------------------------------*/
%define %typemaps_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, Type...)
%typemaps_asptr(%arg(CheckCode), %arg(AsPtrMeth), %arg(AsPtrFrag), Type)
+ %ptr_typemaps_from(%arg(FromMeth), %arg(FromFrag), Type);
+ %ptr_inout_typemap(Type);
+%enddef
+
+// Same as typemaps_asptrfrom but defines a varout typemap to wrap with value semantics instead of the default pointer semantics
+%define %_typemaps_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, Type...)
+ %typemaps_asptr(%arg(CheckCode), %arg(AsPtrMeth), %arg(AsPtrFrag), Type)
%typemaps_from(%arg(FromMeth), %arg(FromFrag), Type);
- %value_output_typemap(%arg(FromMeth), %arg(FromFrag), Type);
%ptr_inout_typemap(Type);
%enddef
@@ -199,7 +219,7 @@
*---------------------------------------------------------------------*/
%define %typemaps_asptrfromn(CheckCode, Type...)
-%typemaps_asptrfrom(%arg(CheckCode),
+%_typemaps_asptrfrom(%arg(CheckCode),
%arg(SWIG_AsPtr(Type)),
%arg(SWIG_From(Type)),
%arg(SWIG_AsPtr_frag(Type)),
diff --git a/linux-x86/share/swig/typemaps/std_string_view.swg b/linux-x86/share/swig/typemaps/std_string_view.swg
new file mode 100644
index 0000000..24f57c6
--- /dev/null
+++ b/linux-x86/share/swig/typemaps/std_string_view.swg
@@ -0,0 +1,16 @@
+//
+// string_view
+//
+
+
+%include <typemaps/std_strings.swg>
+
+%fragment("<string_view>");
+
+namespace std
+{
+ %naturalvar string_view;
+ class string_view;
+}
+
+%typemaps_std_string_view(std::string_view, char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, %checkcode(STRINGVIEW));
diff --git a/linux-x86/share/swig/typemaps/std_strings.swg b/linux-x86/share/swig/typemaps/std_strings.swg
index e9c23ba..8425458 100644
--- a/linux-x86/share/swig/typemaps/std_strings.swg
+++ b/linux-x86/share/swig/typemaps/std_strings.swg
@@ -45,6 +45,16 @@ SWIG_From_dec(String)(const String& s)
}
%enddef
+%define %std_string_view_from(String, SWIG_FromCharPtrAndSize, Frag)
+%fragment(SWIG_From_frag(String),"header",fragment=Frag) {
+SWIGINTERNINLINE SWIG_Object
+SWIG_From_dec(String)(const String& s)
+{
+ return SWIG_FromCharPtrAndSize(s.data() ? s.data() : "", s.size());
+}
+}
+%enddef
+
%define %std_string_asval(String)
%fragment(SWIG_AsVal_frag(String),"header", fragment=SWIG_AsPtr_frag(String)) {
SWIGINTERN int
@@ -76,3 +86,18 @@ SWIG_AsVal_dec(String)(SWIG_Object obj, String *val)
%typemaps_asptrfromn(%arg(CheckCode), String);
%enddef
+
+
+/* An empty string_view returns NULL from data() but SWIG_FromCharPtrAndSize()
+ * implementations treat that as invalid and return None/Null/undef or similar
+ * in the target language so we can't just use %typemaps_std_string.
+ */
+%define %typemaps_std_string_view(String, Char, AsPtrMethod, FromMethod, CheckCode)
+
+%std_string_asptr(String, Char, AsPtrMethod, #AsPtrMethod)
+%std_string_asval(String)
+%std_string_view_from(String, FromMethod, #FromMethod)
+
+%typemaps_asptrfromn(%arg(CheckCode), String);
+
+%enddef
diff --git a/linux-x86/share/swig/typemaps/string.swg b/linux-x86/share/swig/typemaps/string.swg
index 4b70723..72f4aa5 100644
--- a/linux-x86/share/swig/typemaps/string.swg
+++ b/linux-x86/share/swig/typemaps/string.swg
@@ -30,6 +30,7 @@ SWIG_strnlen(const char* s, size_t maxlen)
%include <typemaps/strings.swg>
%typemaps_string(%checkcode(STRING), %checkcode(CHAR),
+ SWIGWARN_TYPEMAP_CHARLEAK_MSG,
char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize,
strlen, SWIG_strnlen,
"<limits.h>", CHAR_MIN, CHAR_MAX)
diff --git a/linux-x86/share/swig/typemaps/strings.swg b/linux-x86/share/swig/typemaps/strings.swg
index 87e97dd..1237d98 100644
--- a/linux-x86/share/swig/typemaps/strings.swg
+++ b/linux-x86/share/swig/typemaps/strings.swg
@@ -19,6 +19,7 @@
%define %_typemap_string(StringCode,
Char,
+ WarningLeakMsg,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
@@ -78,7 +79,7 @@
if (!SWIG_IsOK(res)) {
%variable_fail(res,"$type","$name");
}
- if ($1) SWIG_DeleteCharArray($1);
+ SWIG_DeleteCharArray($1);
if (alloc == SWIG_NEWOBJ) {
$1 = cptr;
} else {
@@ -86,7 +87,7 @@
}
}
-%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
+%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=WarningLeakMsg) const Char * {
Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ;
int res = SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc);
if (!SWIG_IsOK(res)) {
@@ -108,7 +109,7 @@
/* memberin */
%typemap(memberin,noblock=1) Char * {
- if ($1) SWIG_DeleteCharArray($1);
+ SWIG_DeleteCharArray($1);
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast($input, const Char *)) + 1;
$1 = ($1_type)SWIG_NewCopyCharArray(%reinterpret_cast($input, const Char *), size, Char);
@@ -117,7 +118,7 @@
}
}
-%typemap(memberin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
+%typemap(memberin,noblock=1,warning=WarningLeakMsg) const Char * {
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1;
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
@@ -129,7 +130,7 @@
/* globalin */
%typemap(globalin,noblock=1) Char * {
- if ($1) SWIG_DeleteCharArray($1);
+ SWIG_DeleteCharArray($1);
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1;
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
@@ -138,7 +139,7 @@
}
}
-%typemap(globalin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
+%typemap(globalin,noblock=1,warning=WarningLeakMsg) const Char * {
if ($input) {
size_t size = SWIG_CharPtrLen($input) + 1;
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
@@ -265,7 +266,7 @@
}
$1 = %reinterpret_cast(temp, $1_ltype);
}
-%typemap(freearg) Char [ANY], const Char [ANY] "";
+%typemap(freearg) Char [ANY], const Char [ANY] ""
%typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0], int res)
{
@@ -275,7 +276,7 @@
}
$1 = &temp;
}
-%typemap(freearg) const Char (&)[ANY] "";
+%typemap(freearg) const Char (&)[ANY] ""
%typemap(out,fragment=#SWIG_FromCharPtrAndSize,fragment=#SWIG_CharBufLen)
Char [ANY], const Char[ANY]
@@ -501,6 +502,7 @@
#ifndef %_typemap2_string
%define %_typemap2_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -591,6 +593,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
%_typemap_string(StringCode,
Char,
+ WarningLeakMsg,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
@@ -609,6 +612,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
* ------------------------------------------------------------ */
%define %typemaps_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -616,6 +620,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
SWIG_CharBufLen,
FragLimits, CHAR_MIN, CHAR_MAX)
%_typemap2_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -631,6 +636,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
* ------------------------------------------------------------ */
%define %typemaps_string_alloc(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
@@ -640,6 +646,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
SWIG_DeleteCharArray,
FragLimits, CHAR_MIN, CHAR_MAX)
%_typemap2_string(StringCode, CharCode,
+ WarningLeakMsg,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
diff --git a/linux-x86/share/swig/typemaps/swigmacros.swg b/linux-x86/share/swig/typemaps/swigmacros.swg
index 687b068..b772eb0 100644
--- a/linux-x86/share/swig/typemaps/swigmacros.swg
+++ b/linux-x86/share/swig/typemaps/swigmacros.swg
@@ -109,16 +109,6 @@ nocppval
#endif
%enddef
-/* insert the SWIGVERSION in the interface and the wrapper code */
-#if SWIG_VERSION
-%insert("header") {
-%define_as(SWIGVERSION, SWIG_VERSION)
-%#define SWIG_VERSION SWIGVERSION
-}
-#endif
-
-
-
/* -----------------------------------------------------------------------------
* Casting operators
* ----------------------------------------------------------------------------- */
diff --git a/linux-x86/share/swig/typemaps/swigmove.swg b/linux-x86/share/swig/typemaps/swigmove.swg
new file mode 100644
index 0000000..b0a2968
--- /dev/null
+++ b/linux-x86/share/swig/typemaps/swigmove.swg
@@ -0,0 +1,19 @@
+/* -----------------------------------------------------------------------------
+ * swigmove.swg
+ *
+ * Input typemaps library for implementing full move semantics when passing
+ * parameters by value.
+ * ----------------------------------------------------------------------------- */
+
+%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) {
+ res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "$1_type", $symname, $argnum);
+ } else {
+ %argument_fail(res, "$1_type", $symname, $argnum);
+ }
+ }
+ if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
+ SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp);
+}
diff --git a/linux-x86/share/swig/typemaps/swigobject.swg b/linux-x86/share/swig/typemaps/swigobject.swg
index b1e6dc9..26c6ba8 100644
--- a/linux-x86/share/swig/typemaps/swigobject.swg
+++ b/linux-x86/share/swig/typemaps/swigobject.swg
@@ -2,7 +2,7 @@
* Language Object * - Just pass straight through unmodified
* ------------------------------------------------------------ */
-%typemap(in) SWIG_Object "$1 = $input;";
+%typemap(in) SWIG_Object "$1 = $input;"
%typemap(in,noblock=1) SWIG_Object const & ($*ltype temp)
{
@@ -30,8 +30,8 @@
#if defined(SWIG_DIRECTOR_TYPEMAPS)
-%typemap(directorin) SWIG_Object "$input = $1;";
-%typemap(directorout) SWIG_Object "$result = $input;";
+%typemap(directorin) SWIG_Object "$input = $1;"
+%typemap(directorout) SWIG_Object "$result = $input;"
#endif /* SWIG_DIRECTOR_TYPEMAPS */
diff --git a/linux-x86/share/swig/typemaps/swigtype.swg b/linux-x86/share/swig/typemaps/swigtype.swg
index 581de1a..ba8ce3c 100644
--- a/linux-x86/share/swig/typemaps/swigtype.swg
+++ b/linux-x86/share/swig/typemaps/swigtype.swg
@@ -9,7 +9,7 @@
}
$1 = %reinterpret_cast(argp, $ltype);
}
-%typemap(freearg) SWIGTYPE * "";
+%typemap(freearg) SWIGTYPE * ""
%typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0, int res = 0) {
res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags);
@@ -18,7 +18,7 @@
}
$1 = %reinterpret_cast(argp, $ltype);
}
-%typemap(freearg) SWIGTYPE [] "";
+%typemap(freearg) SWIGTYPE [] ""
%typemap(in, noblock=1) SWIGTYPE *const& (void *argp = 0, int res = 0, $*1_ltype temp) {
@@ -29,7 +29,7 @@
temp = %reinterpret_cast(argp, $*ltype);
$1 = %reinterpret_cast(&temp, $1_ltype);
}
-%typemap(freearg) SWIGTYPE *const& "";
+%typemap(freearg) SWIGTYPE *const& ""
/* Reference */
@@ -41,7 +41,7 @@
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
$1 = %reinterpret_cast(argp, $ltype);
}
-%typemap(freearg) SWIGTYPE & "";
+%typemap(freearg) SWIGTYPE & ""
#if defined(__cplusplus) && defined(%implicitconv_flag)
%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res = 0) {
@@ -56,51 +56,23 @@
{
if (SWIG_IsNewObj(res$argnum)) %delete($1);
}
-#else
-%typemap(in,noblock=1) const SWIGTYPE & (void *argp, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
- if (!SWIG_IsOK(res)) {
- %argument_fail(res, "$type", $symname, $argnum);
- }
- if (!argp) { %argument_nullref("$type", $symname, $argnum); }
- $1 = %reinterpret_cast(argp, $ltype);
-}
#endif
/* Rvalue reference */
-%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
+%typemap(in, noblock=1, fragment="<memory>") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) {
+ res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE | %convertptr_flags);
if (!SWIG_IsOK(res)) {
- %argument_fail(res, "$type", $symname, $argnum);
- }
- if (!argp) { %argument_nullref("$type", $symname, $argnum); }
- $1 = %reinterpret_cast(argp, $ltype);
-}
-%typemap(freearg) SWIGTYPE && "";
-
-#if defined(__cplusplus) && defined(%implicitconv_flag)
-%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE && (void *argp = 0, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag);
- if (!SWIG_IsOK(res)) {
- %argument_fail(res, "$type", $symname, $argnum);
- }
- if (!argp) { %argument_nullref("$type", $symname, $argnum); }
- $1 = %reinterpret_cast(argp, $ltype);
-}
-%typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE &&
-{
- if (SWIG_IsNewObj(res$argnum)) %delete($1);
-}
-#else
-%typemap(in,noblock=1) const SWIGTYPE && (void *argp, int res = 0) {
- res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
- if (!SWIG_IsOK(res)) {
- %argument_fail(res, "$type", $symname, $argnum);
+ if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
+ %releasenotowned_fail(res, "$type", $symname, $argnum);
+ } else {
+ %argument_fail(res, "$type", $symname, $argnum);
+ }
}
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
$1 = %reinterpret_cast(argp, $ltype);
+ rvrdeleter.reset($1);
}
-#endif
+%typemap(freearg) SWIGTYPE && ""
/* By value */
#if defined(__cplusplus) && defined(%implicitconv_flag)
@@ -146,9 +118,15 @@
}
/* Return by value */
+#ifdef __cplusplus
%typemap(out, noblock=1) SWIGTYPE {
- %set_output(SWIG_NewPointerObj(%new_copy($1, $ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags));
+ %set_output(SWIG_NewPointerObj((new $1_ltype($1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags));
}
+#else
+%typemap(out, noblock=1) SWIGTYPE {
+ %set_output(SWIG_NewPointerObj(%new_copy($1, $1_ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags));
+}
+#endif
/* -----------------------------------------------------------------------------
* --- Variable input ---
@@ -194,12 +172,8 @@
if ($input) {
size_t ii = 0;
for (; ii < (size_t)$1_dim0; ++ii) {
- if ($input[ii]) {
- size_t jj = 0;
- for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj];
- } else {
- %variable_nullref("$type","$name");
- }
+ size_t jj = 0;
+ for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj];
}
} else {
%variable_nullref("$type","$name");
@@ -210,12 +184,8 @@
if ($input) {
size_t ii = 0;
for (; ii < (size_t)$1_dim0; ++ii) {
- if ($input[ii]) {
- size_t jj = 0;
- for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj];
- } else {
- %variable_nullref("$type","$name");
- }
+ size_t jj = 0;
+ for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj];
}
} else {
%variable_nullref("$type","$name");
@@ -230,12 +200,8 @@
} else if (inp) {
size_t ii = 0;
for (; ii < (size_t)$1_dim0; ++ii) {
- if (inp[ii]) {
- size_t jj = 0;
- for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = inp[ii][jj];
- } else {
- %variable_nullref("$type", "$name");
- }
+ size_t jj = 0;
+ for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = inp[ii][jj];
}
} else {
%variable_nullref("$type", "$name");
@@ -389,6 +355,7 @@
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, SWIG_POINTER_NO_NULL);
@@ -411,7 +378,7 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE {
- $input = SWIG_NewPointerObj(%as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags);
+ $input = SWIG_NewPointerObj((new $1_ltype(SWIG_STD_MOVE($1))), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags);
}
%typemap(directorin,noblock=1) SWIGTYPE * {
@@ -534,7 +501,7 @@
* ------------------------------------------------------------ */
%typemap(throws,noblock=1) SWIGTYPE {
- %raise(SWIG_NewPointerObj(%new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor);
+ %raise(SWIG_NewPointerObj(%new_copy($1, $1_ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor);
}
%typemap(throws,noblock=1) SWIGTYPE * {
@@ -562,29 +529,29 @@
* ------------------------------------------------------------ */
%typemap(in) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor);
+ int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1),$descriptor);
if (!SWIG_IsOK(res)) {
%argument_fail(res,"$type",$symname, $argnum);
}
}
%typemap(out,noblock=1) SWIGTYPE (CLASS::*) {
- %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
%typemap(varin) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor);
+ int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($1), $descriptor);
if (!SWIG_IsOK(res)) {
%variable_fail(res, "$type", "$name");
}
}
%typemap(varout,noblock=1) SWIGTYPE (CLASS::*) {
- %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
%typemap(constcode,noblock=1) SWIGTYPE (CLASS::*) {
- %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($type), $descriptor));
+ %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($value), $descriptor));
}
#if defined(SWIG_DIRECTOR_TYPEMAPS)
@@ -592,13 +559,13 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE (CLASS::*) {
- $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor);
+ $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor);
}
/* directorout */
%typemap(directorout) SWIGTYPE (CLASS::*) {
- int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor);
+ int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($result), $descriptor);
if (!SWIG_IsOK(swig_res)) {
%dirout_fail(swig_res,"$type");
}
@@ -703,9 +670,15 @@
/* INSTANCE typemap */
+#ifdef __cplusplus
+%typemap(out,noblock=1) SWIGTYPE INSTANCE {
+ %set_output(SWIG_NewInstanceObj((new $1_ltype($1)), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags));
+}
+#else
%typemap(out,noblock=1) SWIGTYPE INSTANCE {
%set_output(SWIG_NewInstanceObj(%new_copy($1, $1_ltype), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags));
}
+#endif
%typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] {
%set_output(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, $owner | %newinstance_flags));
diff --git a/linux-x86/share/swig/typemaps/swigtypemaps.swg b/linux-x86/share/swig/typemaps/swigtypemaps.swg
index 4e5bb2b..733e5ac 100644
--- a/linux-x86/share/swig/typemaps/swigtypemaps.swg
+++ b/linux-x86/share/swig/typemaps/swigtypemaps.swg
@@ -140,6 +140,7 @@
#define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_ValueError, %argnullref_fmt(type, name, argn))
#define %variable_fail(code, type, name) SWIG_exception_fail(%default_code(code), %varfail_fmt(type, name))
#define %variable_nullref(type, name) SWIG_exception_fail(SWIG_ValueError, %varnullref_fmt(type, name))
+#define %releasenotowned_fail(code, type, name, argn) SWIG_exception_fail(%default_code(code), %releasenotownedfail_fmt(type, name, argn))
#if defined(SWIG_DIRECTOR_TYPEMAPS)
#define %dirout_fail(code, type) SWIG_DirOutFail(%default_code(code), %outfail_fmt(type))
diff --git a/linux-x86/share/swig/typemaps/typemaps.swg b/linux-x86/share/swig/typemaps/typemaps.swg
index 4629e8d..7d013b0 100644
--- a/linux-x86/share/swig/typemaps/typemaps.swg
+++ b/linux-x86/share/swig/typemaps/typemaps.swg
@@ -140,10 +140,6 @@ to a Tcl variable you might do this :
x = neg(x)
-Note : previous versions of SWIG used the symbol 'BOTH' to mark
-input/output arguments. This is still supported, but will be slowly
-phased out in future releases.
-
*/
diff --git a/linux-x86/share/swig/typemaps/valtypes.swg b/linux-x86/share/swig/typemaps/valtypes.swg
index 11eac59..7623ff0 100644
--- a/linux-x86/share/swig/typemaps/valtypes.swg
+++ b/linux-x86/share/swig/typemaps/valtypes.swg
@@ -38,7 +38,7 @@
}
$1 = %static_cast(val,$ltype);
}
- %typemap(freearg) Type "";
+ %typemap(freearg) Type ""
%typemap(in,noblock=1,fragment=frag) const Type & ($*ltype temp, Type val, int ecode = 0) {
ecode = asval_meth($input, &val);
if (!SWIG_IsOK(ecode)) {
@@ -47,7 +47,7 @@
temp = %static_cast(val, $*ltype);
$1 = &temp;
}
- %typemap(freearg) const Type& "";
+ %typemap(freearg) const Type& ""
%enddef
/* out */
@@ -180,6 +180,7 @@
/*---------------------------------------------------------------------
* typemap definition for types with from method
*---------------------------------------------------------------------*/
+
%define %typemaps_from(FromMeth, FromFrag, Type...)
%value_out_typemap(%arg(FromMeth), %arg(FromFrag), Type);
%value_varout_typemap(%arg(FromMeth), %arg(FromFrag), Type);
@@ -191,7 +192,7 @@
/*---------------------------------------------------------------------
- * typemap definition for types with alval/from method
+ * typemap definition for types with asval/from method
*---------------------------------------------------------------------*/
%define %typemaps_asvalfrom(CheckCode, AsValMeth, FromMeth,
diff --git a/linux-x86/share/swig/typemaps/void.swg b/linux-x86/share/swig/typemaps/void.swg
index bbd68ed..795992b 100644
--- a/linux-x86/share/swig/typemaps/void.swg
+++ b/linux-x86/share/swig/typemaps/void.swg
@@ -10,7 +10,7 @@
%argument_fail(res, "$type", $symname, $argnum);
}
}
-%typemap(freearg) void * "";
+%typemap(freearg) void * ""
%typemap(in,noblock=1) void * const& ($*ltype temp = 0, int res) {
res = SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown);
@@ -19,7 +19,7 @@
}
$1 = &temp;
}
-%typemap(freearg) void * const& "";
+%typemap(freearg) void * const& ""
/* out */
diff --git a/linux-x86/share/swig/typemaps/wstring.swg b/linux-x86/share/swig/typemaps/wstring.swg
index cd409d1..d99c0bb 100644
--- a/linux-x86/share/swig/typemaps/wstring.swg
+++ b/linux-x86/share/swig/typemaps/wstring.swg
@@ -31,6 +31,7 @@ SWIG_wcsnlen(const wchar_t* s, size_t maxlen)
%include <typemaps/strings.swg>
%typemaps_string(%checkcode(UNISTRING), %checkcode(UNICHAR),
+ SWIGWARN_TYPEMAP_WCHARLEAK_MSG,
wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize,
wcslen, SWIG_wcsnlen,
"<wchar.h>", WCHAR_MIN, WCHAR_MAX)
diff --git a/linux-x86/share/swig/uffi/uffi.swg b/linux-x86/share/swig/uffi/uffi.swg
deleted file mode 100644
index 41b0859..0000000
--- a/linux-x86/share/swig/uffi/uffi.swg
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Define a C preprocessor symbol that can be used in interface files
- to distinguish between the SWIG language modules. */
-
-#define SWIG_UFFI
-
-/* Typespecs for basic types. */
-
-%typemap(ffitype) char ":char";
-%typemap(ffitype) unsigned char ":unsigned-char";
-%typemap(ffitype) signed char ":char";
-%typemap(ffitype) short ":short";
-%typemap(ffitype) signed short ":short";
-%typemap(ffitype) unsigned short ":unsigned-short";
-%typemap(ffitype) int ":int";
-%typemap(ffitype) signed int ":int";
-%typemap(ffitype) unsigned int ":unsigned-int";
-%typemap(ffitype) long ":long";
-%typemap(ffitype) signed long ":long";
-%typemap(ffitype) unsigned long ":unsigned-long";
-%typemap(ffitype) float ":float";
-%typemap(ffitype) double ":double";
-%typemap(ffitype) char * ":cstring";
-%typemap(ffitype) void * ":pointer-void";
-%typemap(ffitype) void ":void";
-
-// FIXME: This is guesswork
-typedef long size_t;
-
-%wrapper %{
-(eval-when (compile eval)
-
-;;; You can define your own identifier converter if you want.
-;;; Use the -identifier-converter command line argument to
-;;; specify its name.
-
-(defun identifier-convert-null (id &key type)
- (declare (ignore type))
- (read-from-string id))
-
-(defun identifier-convert-lispify (cname &key type)
- (assert (stringp cname))
- (if (eq type :constant)
- (setf cname (format nil "*~A*" cname)))
- (setf cname (replace-regexp cname "_" "-"))
- (let ((lastcase :other)
- newcase char res)
- (dotimes (n (length cname))
- (setf char (schar cname n))
- (if* (alpha-char-p char)
- then
- (setf newcase (if (upper-case-p char) :upper :lower))
-
- (when (or (and (eq lastcase :upper) (eq newcase :lower))
- (and (eq lastcase :lower) (eq newcase :upper)))
- ;; case change... add a dash
- (push #\- res)
- (setf newcase :other))
-
- (push (char-downcase char) res)
-
- (setf lastcase newcase)
-
- else
- (push char res)
- (setf lastcase :other)))
- (read-from-string (coerce (nreverse res) 'string))))
-
-(defun identifier-convert-low-level (cname &key type)
- (assert (stringp cname))
- (if (eq type :constant)
- (setf cname (format nil "+~A+" cname)))
- (setf cname (substitute #\- #\_ cname))
- (if (eq type :operator)
- (setf cname (format nil "%~A" cname)))
- (if (eq type :constant-function)
- nil)
- (read-from-string cname))
-
-
-
-(defmacro swig-defconstant (string value &key (export T))
- (let ((symbol (funcall *swig-identifier-converter* string :type :constant)))
- `(eval-when (compile load eval)
- (uffi:def-constant ,symbol ,value ,export))))
-
-(defmacro swig-defun (name &rest rest)
- (let ((symbol (funcall *swig-identifier-converter* name :type :operator)))
- `(eval-when (compile load eval)
- (uffi:def-function (,name ,symbol) ,@rest)
- (export (quote ,symbol)))))
-
-(defmacro swig-def-struct (name &rest fields)
- "Declare a struct object"
- (let ((symbol (funcall *swig-identifier-converter* name :type :type)))
- `(eval-when (compile load eval)
- (uffi:def-struct ,symbol ,@fields)
- (export (quote ,symbol)))))
-
-
-) ;; eval-when
-%}
diff --git a/manifest.xml b/manifest.xml
index 3f43ef0..dad5cee 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -7,7 +7,7 @@
<superproject name="kernel/superproject" remote="aosp" revision="build-tools" />
- <project path="prebuilts/kernel-build-tools" name="kernel/prebuilts/build-tools" clone-depth="1" revision="4a161b47ff9fe8ee164671e61585ba79ee975fc6" />
+ <project path="prebuilts/kernel-build-tools" name="kernel/prebuilts/build-tools" clone-depth="1" revision="ae85d23af20f61220b114fc3f7bb6f77cc140365" />
<project path="build/bazel" name="platform/build/bazel" groups="pdk" revision="fb9d46a7f4def991a07d86082e8a45c0c362746d">
<linkfile dest="WORKSPACE" src="bazel.WORKSPACE" />
@@ -15,15 +15,15 @@
<linkfile dest="BUILD" src="bazel.BUILD" />
</project>
- <project path="build/bazel_common_rules" name="platform/build/bazel_common_rules" groups="pdk" revision="9c6d27060d6808fc1f2a203ff311319641285ec7" />
+ <project path="build/bazel_common_rules" name="platform/build/bazel_common_rules" groups="pdk" revision="212bca45fa9e280adc98081483f649814baf4b61" />
- <project path="build/blueprint" name="platform/build/blueprint" revision="4f968700d169e19677b7d15ccadf6695622f76f0" />
+ <project path="build/blueprint" name="platform/build/blueprint" revision="c10b49b5e914a3deb86fd4226813204a564e32b5" />
- <project path="build/make" name="platform/build" groups="pdk" revision="c3ce9e344c6bc592571283909b11ad392b999a17">
+ <project path="build/make" name="platform/build" groups="pdk" revision="5e6df98fc38fe42d66f0815dd7655ba5d5285e7e">
<linkfile dest="build/tools" src="tools" />
</project>
- <project path="build/soong" name="platform/build/soong" revision="41da84b2e63502d1823c956316626fa1d28d869e">
+ <project path="build/soong" name="platform/build/soong" revision="8e4060abc51d6b10ad0fc3f66ca92111b858749e">
<linkfile dest="Android.bp" src="root.bp" />
<linkfile dest="bootstrap.bash" src="bootstrap.bash" />
@@ -55,31 +55,31 @@
<project path="prebuilts/jdk/jdk11" name="platform/prebuilts/jdk/jdk11" groups="pdk" clone-depth="1" revision="559b6c1784e6f579a2212eed78bd053474005fe1" />
- <project path="prebuilts/clang/host/linux-x86" name="platform/prebuilts/clang/host/linux-x86" groups="linux" clone-depth="1" revision="57a553497f3eac317f4b1a5ad9381989fd78268b" />
+ <project path="prebuilts/clang/host/linux-x86" name="platform/prebuilts/clang/host/linux-x86" groups="linux" clone-depth="1" revision="3bd47139ac0e3593d4707ac0eeb2d45aa7411b67" />
- <project path="prebuilts/build-tools" name="platform/prebuilts/build-tools" clone-depth="1" revision="1cb1dbfbba3e1b4007e47d0b9066039e68f6760e" />
+ <project path="prebuilts/build-tools" name="platform/prebuilts/build-tools" clone-depth="1" revision="796175fd6e38471d61799622af7a18f5e75ecc54" />
- <project path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8" clone-depth="1" revision="cef8f53bb61fbdb02dbf4d433004f6cb637c3bc6" />
+ <project path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8" clone-depth="1" revision="62956fc7f3a9be24a7d9edbcc9f156d0dcb0f075" />
- <project path="prebuilts/go/linux-x86" name="platform/prebuilts/go/linux-x86" groups="linux" clone-depth="1" revision="278e43da00640f7005cfff1519f51be476ebc388" />
+ <project path="prebuilts/go/linux-x86" name="platform/prebuilts/go/linux-x86" groups="linux" clone-depth="1" revision="7f0f1006d8d84a601a9abe08a01c655d32401959" />
<project path="prebuilts/ninja/linux-x86" name="platform/prebuilts/ninja/linux-x86" groups="linux" clone-depth="1" revision="8a10824f74fe0e22af9bf314a837f5b70e2bb67f" />
- <project path="bionic" name="platform/bionic" revision="386e64df7dad6fe8db66070b88f5da0152dc3170" />
+ <project path="bionic" name="platform/bionic" revision="e7efd77d2c590bf27fcb2b413421d514dc48f656" />
- <project path="external/abseil-cpp" name="platform/external/abseil-cpp" revision="538aea662fef35630321f6cb84dd80b8d4846259" />
+ <project path="external/abseil-cpp" name="platform/external/abseil-cpp" revision="4af5b57dd17f345a9b8936d12bdc743b0e0bf7e5" />
- <project path="external/boringssl" name="platform/external/boringssl" revision="62e04b2b9e7feb4b4e7a8214d1f1f0e18d505596" />
+ <project path="external/boringssl" name="platform/external/boringssl" revision="41be05a790e708f9b1f7841f791b3bb73b434136" />
<project path="external/dwarves" name="platform/external/dwarves" revision="82a6e19c8e8a4f0c6fe065e8d4b0f67ee122551b" />
- <project path="external/e2fsprogs" name="platform/external/e2fsprogs" revision="3fa483b4f8167085bbc87d42b9ca52e611612344" />
+ <project path="external/e2fsprogs" name="platform/external/e2fsprogs" revision="886fdbbf29390e4a7298da65e46d976a27b4460c" />
- <project path="external/elfutils" name="platform/external/elfutils" revision="5c3f803b9f4d620edd56cae14685c96914bde9ce" />
+ <project path="external/elfutils" name="platform/external/elfutils" revision="caba0695e4ddd08cce5c1563260b009a872efafe" />
<project path="external/erofs-utils" name="platform/external/erofs-utils" revision="45ee690acb651d56e11f254a5632618ab2bc0692" />
- <project path="external/expat" name="platform/external/expat" revision="79370bd83c708bdc2545ccaabcb4841929a5109c" />
+ <project path="external/expat" name="platform/external/expat" revision="9ad535cb017d547e22dcb2d80b41de85e115c23c" />
<project path="external/fec" name="platform/external/fec" revision="bd748f639f8156d3c439c46178ee2e1176b226cf" />
@@ -87,23 +87,23 @@
<project path="external/go-cmp" name="platform/external/go-cmp" groups="pdk" revision="88d15eac089d7f20c739ff1001d56b91872b21a1" />
- <project path="external/icu" name="platform/external/icu" revision="8144ba71b4efcfe46cd0e76e85d371bcc7d55567" />
+ <project path="external/icu" name="platform/external/icu" revision="5752fa286a3b6d8e0ab856411c116a16af18396b" />
- <project path="external/jemalloc_new" name="platform/external/jemalloc_new" revision="8a33a878279b78163de034d855cdc09d65634b05" />
+ <project path="external/jemalloc_new" name="platform/external/jemalloc_new" revision="33b4678f52527df4a470a9416fb2b08194ce253a" />
<project path="external/libbpf" name="platform/external/libbpf" revision="45dc3752d2bdd3de48b53feca441f6a872d15eb1" />
- <project path="external/libcxx" name="platform/external/libcxx" revision="f5d9b62fb0e250f6f941e21f1d4676baed8244c6" />
+ <project path="external/libcxx" name="platform/external/libcxx" revision="45e6c488a5ad73455d2b70c2ef7d9783cf893dfd" />
- <project path="external/libcxxabi" name="platform/external/libcxxabi" revision="9034618d515bba4a26b43a2e5f469e2de107298c" />
+ <project path="external/libcxxabi" name="platform/external/libcxxabi" revision="ab85fcc31aa9e7100bfda4cb5fb05e7bcc309854" />
- <project path="external/libxml2" name="platform/external/libxml2" revision="45eeaa8b59f5a7eaa1485376dd351e7376ac4199" />
+ <project path="external/libxml2" name="platform/external/libxml2" revision="ad02985b09a0fca762aecb62fd5d2fc818240a40" />
<project path="external/licenseclassifier" name="platform/external/licenseclassifier" revision="46c4c49da23cae783fa41bf46525a6505638499a" />
<project path="external/pcre" name="platform/external/pcre" revision="615a447b8530d3b0fe9b43721e070631590ec4dc" />
- <project path="external/protobuf" name="platform/external/protobuf" revision="89e2aece8546e9e86ac0051f56a8ea0591e68690" />
+ <project path="external/protobuf" name="platform/external/protobuf" revision="8b3bb789abcfcd4c47774e1989114b64ca0e5ae1" />
<project path="external/python/cpython2" name="platform/external/python/cpython2" revision="02716d134676571e8572d7de85022f49eb39b0cb" />
@@ -111,51 +111,51 @@
<project path="external/python/six" name="platform/external/python/six" revision="ea0a57a4c8d7a2cd338cdb53746e570d8d3a5692" />
- <project path="external/selinux" name="platform/external/selinux" revision="c20d8480e5b47e819c4dd9e2f314b4a26b616639" />
+ <project path="external/selinux" name="platform/external/selinux" revision="261afd394b622a6d9d639978dffcfde84967788c" />
<project path="external/spdx-tools" name="platform/external/spdx-tools" revision="b7fc9510bdfffdeac56470c6025fa9671e640496" />
- <project path="external/sqlite" name="platform/external/sqlite" revision="488f64fde2e8d8a3b163fe44807821a00e2c1448" />
+ <project path="external/sqlite" name="platform/external/sqlite" revision="0e0cc81e9d54c86761c7baffb5fd60e25c381486" />
- <project path="external/squashfs-tools" name="platform/external/squashfs-tools" revision="804084c33becca772409c9b23de8403a31b9e6c5" />
+ <project path="external/squashfs-tools" name="platform/external/squashfs-tools" revision="98bb83ee0696b37f5720992968afeb2b390a8b46" />
<project path="external/starlark-go" name="platform/external/starlark-go" revision="4947cdc739c985f6d86941e22894f5cefe7c9e9a" />
- <project path="external/stg" name="platform/external/stg" revision="068cfa080c14905c6670383b68150070269d4431" />
+ <project path="external/stg" name="platform/external/stg" revision="03ab09f3cb3ff287985df9aabcd812b7890a09ce" />
- <project path="external/swig" name="platform/external/swig" revision="6ffc1dbf29ba98c4d8aa71ebc9b484e973fe1030" />
+ <project path="external/swig" name="platform/external/swig" revision="d0f0f90be16c2ac553b5fa08512045273135147a" />
- <project path="external/zlib" name="platform/external/zlib" revision="be9c729ed5f2c69d98ca1711652121f7ff7cfb5b" />
+ <project path="external/zlib" name="platform/external/zlib" revision="b34cd2e4371556e913ad9801a924a891c74d1463" />
- <project path="external/zstd" name="platform/external/zstd" revision="7665215f6d6c3a44de7f5b39e006cc099329eda8" />
+ <project path="external/zstd" name="platform/external/zstd" revision="272b77a34b1c110d0b09be72c772df6cdc1aad7f" />
- <project path="prebuilts/clang-tools" name="platform/prebuilts/clang-tools" clone-depth="1" revision="880ba63cabe0be75dff14c6da1847c982aa6f0fa" />
+ <project path="prebuilts/clang-tools" name="platform/prebuilts/clang-tools" clone-depth="1" revision="1634c6a556d1f2c24897bf74156c6449486e8941" />
- <project path="system/core" name="platform/system/core" revision="ea88c191e137eb77c9504052b0b6f08b169bf6f3" />
+ <project path="system/core" name="platform/system/core" revision="563c1a83a03a6867490bc764921f49b7b538259e" />
- <project path="system/logging" name="platform/system/logging" revision="81bacf97371d8ef5b2fa0e76601686903d3ddb9a" />
+ <project path="system/logging" name="platform/system/logging" revision="1cf3ce705205687d720027dd66b90cecff2f4182" />
- <project path="system/extras" name="platform/system/extras" revision="8560442f5bf63bfc37c8e14702d08efd45804aca" />
+ <project path="system/extras" name="platform/system/extras" revision="5080f93ced2c132b96a775550e62dbc7d3f8770c" />
- <project path="system/libbase" name="platform/system/libbase" revision="5284bc2af27a41a11bf3952b8b3422bb7dc5357b" />
+ <project path="system/libbase" name="platform/system/libbase" revision="5df5be0fbbfcf06e610f01f84863e0a96a82c27a" />
- <project path="system/security" name="platform/system/security" revision="23f9c84b329f2ebf5198d3364ce080aa6b95c5c1" />
+ <project path="system/security" name="platform/system/security" revision="98e175b6f8467d31566f90a266bffea39234e2ec" />
- <project path="system/tools/aidl" name="platform/system/tools/aidl" revision="3280e1e7517eeb9e958cb7443d2a296f048ed723" />
+ <project path="system/tools/aidl" name="platform/system/tools/aidl" revision="3718f9dd8d05b363d2a578194b4067a3f27f660e" />
- <project path="external/avb" name="platform/external/avb" revision="c929e908fb03ec565db86493e73dbc3b32a2c8e9" />
+ <project path="external/avb" name="platform/external/avb" revision="26eaa0afb46fd0ff56287a8e568fea36ec673f53" />
- <project path="external/dtc" name="platform/external/dtc" revision="c4db10d48e96701e0bd7391a49f3c67de9f71113" />
+ <project path="external/dtc" name="platform/external/dtc" revision="835431ed392390ee22d557bd35d385ebb892cd0d" />
<project path="external/lz4" name="platform/external/lz4" revision="124599333514066524f55f5f41fbf0d46212e598" />
<project path="external/kmod" name="platform/external/kmod" revision="3a9039f4c7102de17c2be5b9ba5bf09b08aa8dd9" />
- <project path="system/tools/mkbootimg" name="platform/system/tools/mkbootimg" revision="28b7934249c2885db8b561f1439d74663fcdce93" />
+ <project path="system/tools/mkbootimg" name="platform/system/tools/mkbootimg" revision="f5c284e8998dd8a085cf027bb518b6c2b84cf744" />
- <project path="tools/external_updater" name="platform/tools/external_updater" revision="8e22672c573a9279dbd66c0dd6961012e0b268b2" />
+ <project path="tools/external_updater" name="platform/tools/external_updater" revision="f63b5ef3700277560edd736d4a187b281bd3da7a" />
- <project path="tools/libufdt" name="platform/system/libufdt" revision="00ee4cc4f5b4c32ea11b0e301c9a96d2967e51d1" />
+ <project path="tools/libufdt" name="platform/system/libufdt" revision="355f0294ec7395b7959664859ad381ff5cbb9c09" />
<project path="tools/interceptor" name="kernel/tools/interceptor" revision="e8cfa98602acef64c756e6c77d1de5455843d855" />
</manifest>