summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2015-03-28 17:07:03 +1300
committerOlly Betts <olly@survex.com>2015-03-28 17:07:03 +1300
commit2289f74b7ea14184af350c5ad8a06fdefb8fe9ae (patch)
tree70978f778b9cc074437831550239230a920a63a8
parent6a892b32d8881ec8325d1b100bb64c5588d61c73 (diff)
parentdba8d4a7ea64da03369b1e984574d3a7761f2681 (diff)
downloadswig-2289f74b7ea14184af350c5ad8a06fdefb8fe9ae.tar.gz
Merge branch 'master' into doxygen
-rw-r--r--.travis.yml5
-rw-r--r--Doc/Manual/Javascript.html6
-rw-r--r--Doc/Manual/Lua.html2
-rw-r--r--Doc/Manual/Ocaml.html316
-rw-r--r--Doc/Manual/Python.html8
-rw-r--r--Doc/Manual/Scilab.html6
-rw-r--r--Examples/Makefile.in6
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective.i5
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective.stderr2
-rw-r--r--Examples/test-suite/ocaml/Makefile.in17
-rw-r--r--Lib/ocaml/ocamldec.swg4
-rw-r--r--Lib/python/pyabc.i2
-rw-r--r--Lib/python/pycontainer.swg4
-rw-r--r--Lib/python/pyiterators.swg4
-rw-r--r--Lib/python/std_map.i16
-rw-r--r--Lib/python/std_pair.i4
-rw-r--r--Lib/python/std_unordered_map.i16
-rw-r--r--Lib/scilab/scichar.swg33
-rw-r--r--Lib/swiglabels.swg9
-rw-r--r--RELEASENOTES2
-rw-r--r--Source/CParse/cscanner.c2
-rw-r--r--Source/Modules/csharp.cxx2
-rw-r--r--Source/Modules/go.cxx19
-rw-r--r--Source/Modules/java.cxx2
-rw-r--r--Source/Modules/ocaml.cxx6
-rw-r--r--Source/Modules/octave.cxx2
-rw-r--r--Source/Modules/perl5.cxx2
-rw-r--r--Source/Modules/ruby.cxx4
-rw-r--r--Source/Modules/scilab.cxx2
-rw-r--r--Tools/config/ac_compare_version.m440
-rw-r--r--configure.ac169
31 files changed, 336 insertions, 381 deletions
diff --git a/.travis.yml b/.travis.yml
index 1a79187d7..9cdc5bf8b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -65,6 +65,9 @@ matrix:
# Not quite working yet
- compiler: gcc
env: SWIGLANG=python SWIG_FEATURES=-classic
+ # Lots of failing tests currently
+ - compiler: gcc
+ env: SWIGLANG=ocaml
before_install:
- date -u
- uname -a
@@ -80,6 +83,8 @@ before_install:
- if test "$SWIGLANG" = "javascript" -a "$ENGINE" = "v8"; then sudo apt-get install -qq libv8-dev; fi
- if test "$SWIGLANG" = "guile"; then sudo apt-get -qq install guile-2.0-dev; fi
- if test "$SWIGLANG" = "lua"; then sudo apt-get -qq install lua5.1 liblua5.1-dev; fi
+ # configure also looks for ocamldlgen, but this isn't packaged. But it isn't used by default so this doesn't matter.
+ - if test "$SWIGLANG" = "ocaml"; then sudo apt-get -qq install ocaml ocaml-findlib; fi
- if test "$SWIGLANG" = "octave" -a -z "$VER"; then sudo apt-get -qq install octave3.2 octave3.2-headers; fi
- if test "$SWIGLANG" = "octave" -a "$VER"; then sudo add-apt-repository -y ppa:kwwette/octaves && sudo apt-get -qq update && sudo apt-get -qq install liboctave${VER}-dev; fi
- if test "$SWIGLANG" = "php"; then sudo apt-get install php5-cli php5-dev; fi
diff --git a/Doc/Manual/Javascript.html b/Doc/Manual/Javascript.html
index cae199048..5e6540c7d 100644
--- a/Doc/Manual/Javascript.html
+++ b/Doc/Manual/Javascript.html
@@ -197,10 +197,10 @@ $ sudo npm install -g node-gyp</pre>
<pre>
$ swig -javascript -node -c++ example.i</pre>
</div>
-<p>Then run <code>node-gyp</code></p>
+<p>Then run <code>node-gyp build</code> to actually create the module:</p>
<div class="shell">
<pre>
-$ node-gyp</pre>
+$ node-gyp build</pre>
</div>
<p>This will create a <code>build</code> folder containing the native module. To use the extension you need to 'require' it in your Javascript source file:</p>
<div class="code">
@@ -410,7 +410,7 @@ open new windows, and many more things.
};</pre>
</div>
-<H2><a name="Javascript_nn14"></a>26.4 Examples</H2>
+<H2><a id="Javascript_examples" name="Javascript_nn14"></a>26.4 Examples</H2>
<p>Some basic examples are shown here in more detail.</p>
diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html
index 61f19be68..2e1515c43 100644
--- a/Doc/Manual/Lua.html
+++ b/Doc/Manual/Lua.html
@@ -891,7 +891,7 @@ void spam(short);
<p>
or
</p>
-<DIV CLASS="CODE"><PRE>VOID FOO(bAR *B);
+<div class="code"><pre>void foo(Bar *b);
void foo(Bar &amp;b);
</pre></div>
<p>
diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html
index aa6679f9a..da20b8da3 100644
--- a/Doc/Manual/Ocaml.html
+++ b/Doc/Manual/Ocaml.html
@@ -1,11 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
- <title>SWIG and Ocaml</title>
+<title>SWIG and Ocaml</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
- <body bgcolor="#ffffff">
- <a name="n1"></a>
+
+<body bgcolor="#ffffff">
<H1><a name="Ocaml"></a>31 SWIG and Ocaml</H1>
<!-- INDEX -->
<div class="sectiontoc">
@@ -59,20 +59,23 @@
<p>
- This chapter describes SWIG's
-support of Ocaml. Ocaml is a relatively recent addition to the ML family,
-and is a recent addition to SWIG. It's the second compiled, typed
-language to be added. Ocaml has widely acknowledged benefits for engineers,
-mostly derived from a sophisticated type system, compile-time checking
-which eliminates several classes of common programming errors, and good
-native performance. While all of this is wonderful, there are well-written
-C and C++ libraries that Ocaml users will want to take advantage of as
-part of their arsenal (such as SSL and gdbm), as well as their own mature
-C and C++ code. SWIG allows this code to be used in a natural, type-safe
-way with Ocaml, by providing the necessary, but repetitive glue code
-which creates and uses Ocaml values to communicate with C and C++ code.
- In addition, SWIG also produces the needed Ocaml source that binds
-variants, functions, classes, etc.
+This chapter describes SWIG's support of Ocaml.
+</p>
+
+<p>
+Ocaml is a relatively recent addition to the ML family,
+and is a recent addition to SWIG. It's the second compiled, typed
+language to be added. Ocaml has widely acknowledged benefits for engineers,
+mostly derived from a sophisticated type system, compile-time checking
+which eliminates several classes of common programming errors, and good
+native performance. While all of this is wonderful, there are well-written
+C and C++ libraries that Ocaml users will want to take advantage of as
+part of their arsenal (such as SSL and gdbm), as well as their own mature
+C and C++ code. SWIG allows this code to be used in a natural, type-safe
+way with Ocaml, by providing the necessary, but repetitive glue code
+which creates and uses Ocaml values to communicate with C and C++ code.
+In addition, SWIG also produces the needed Ocaml source that binds
+variants, functions, classes, etc.
</p>
<p>
@@ -84,17 +87,16 @@ If you're not familiar with the Objective Caml language, you can visit
<p>
- SWIG 1.3 works with Ocaml 3.04 and above. Given the choice,
- you should use the latest stable release. The SWIG Ocaml module has
-been tested on Linux (x86,PPC,Sparc) and Cygwin on Windows. The
-best way to determine whether your system will work is to compile the
-examples and test-suite which come with SWIG. You can do this by running
-<tt>make check</tt> from the SWIG root directory after installing SWIG.
- The Ocaml module has been tested using the system's dynamic linking (the
-usual -lxxx against libxxx.so, as well as with Gerd Stolpmann's
-<a
- href="http://download.camlcity.org/download/">Dl package
-</a>. The ocaml_dynamic and ocaml_dynamic_cpp targets in the
+SWIG 3.0 works with Ocaml 3.08.3 and above. Given the choice,
+you should use the latest stable release. The SWIG Ocaml module has
+been tested on Linux (x86,PPC,Sparc) and Cygwin on Windows. The
+best way to determine whether your system will work is to compile the
+examples and test-suite which come with SWIG. You can do this by running
+<tt>make check</tt> from the SWIG root directory after installing SWIG.
+The Ocaml module has been tested using the system's dynamic linking (the
+usual -lxxx against libxxx.so, as well as with Gerd Stolpmann's
+<a href="http://download.camlcity.org/download/">Dl package</a>.
+The ocaml_dynamic and ocaml_dynamic_cpp targets in the
file Examples/Makefile illustrate how to compile and link SWIG modules that
will be loaded dynamically. This has only been tested on Linux so far.
</p>
@@ -103,30 +105,30 @@ will be loaded dynamically. This has only been tested on Linux so far.
<p>
- The basics of getting a SWIG Ocaml module up and running
- can be seen from one of SWIG's example Makefiles, but is also described
- here. To build an Ocaml module, run SWIG using the <tt>-ocaml</tt>
-option.
+The basics of getting a SWIG Ocaml module up and running
+can be seen from one of SWIG's example Makefiles, but is also described
+here. To build an Ocaml module, run SWIG using the <tt>-ocaml</tt>
+option.
</p>
-<div class="code">
- <pre>
+<div class="code">
+<pre>
%swig -ocaml example.i
- </pre>
+</pre>
</div>
-
-<p> This will produce 3 files. The file <tt>example_wrap.c</tt> contains
+
+<p>This will produce 3 files. The file <tt>example_wrap.c</tt> contains
all of the C code needed to build an Ocaml module. To build the module,
-you will compile the file <tt>example_wrap.c</tt> with <tt>ocamlc</tt> or
+you will compile the file <tt>example_wrap.c</tt> with <tt>ocamlc</tt> or
<tt>ocamlopt</tt> to create the needed .o file. You will need to compile
the resulting .ml and .mli files as well, and do the final link with -custom
-(not needed for native link). </p>
-
+(not needed for native link).</p>
+
<H3><a name="Ocaml_nn4"></a>31.1.2 Compiling the code</H3>
<p>
-The OCaml SWIG module now requires you to compile a module (<tt>Swig</tt>)
+The OCaml SWIG module now requires you to compile a module (<tt>Swig</tt>)
separately. In addition to aggregating common SWIG functionality, the Swig
module contains the data structure that represents C/C++ values. This allows
easier data sharing between modules if two or more are combined, because
@@ -134,28 +136,29 @@ the type of each SWIG'ed module's c_obj is derived from Swig.c_obj_t. This
also allows SWIG to acquire new conversions painlessly, as well as giving
the user more freedom with respect to custom typing.
- Use <tt>ocamlc</tt> or <tt>ocamlopt</tt> to compile your
- SWIG interface like:
+Use <tt>ocamlc</tt> or <tt>ocamlopt</tt> to compile your SWIG interface like:
</p>
-
-<div class="code">
- <pre>
+
+<div class="code">
+<pre>
% swig -ocaml -co swig.mli ; swig -ocaml co swig.ml
% ocamlc -c swig.mli ; ocamlc -c swig.ml
% ocamlc -c -ccopt "-I/usr/include/foo" example_wrap.c
% ocamlc -c example.mli
% ocamlc -c example.ml
- </pre>
+</pre>
</div>
-
-<p> <tt>ocamlc</tt> is aware of .c files and knows how to handle them. Unfortunately,
- it does not know about .cxx, .cc, or .cpp files, so when SWIG is invoked
- in C++ mode, you must: </p>
-
-<div class="code">
- <pre>
-% cp example_wrap.cxx example_wrap.cxx.c<br>% ocamlc -c ... -ccopt -xc++ example_wrap.cxx.c<br>% ...<br>
- </pre>
+
+<p><tt>ocamlc</tt> is aware of .c files and knows how to handle them. Unfortunately,
+it does not know about .cxx, .cc, or .cpp files, so when SWIG is invoked
+in C++ mode, you must:</p>
+
+<div class="code">
+<pre>
+% cp example_wrap.cxx example_wrap.cxx.c
+% ocamlc -c ... -ccopt -xc++ example_wrap.cxx.c
+% ...
+</pre>
</div>
<H3><a name="Ocaml_nn5"></a>31.1.3 The camlp4 module</H3>
@@ -165,8 +168,8 @@ the user more freedom with respect to custom typing.
The camlp4 module (swigp4.ml -&gt; swigp4.cmo) contains a simple rewriter which
makes C++ code blend more seamlessly with objective caml code. Its use is
optional, but encouraged. The source file is included in the Lib/ocaml
-directory of the SWIG source distribution. You can checkout this file with
-<tt>"swig -ocaml -co swigp4.ml"</tt>. You should compile the file with
+directory of the SWIG source distribution. You can checkout this file with
+<tt>"swig -ocaml -co swigp4.ml"</tt>. You should compile the file with
<tt>"ocamlc -I `camlp4 -where` -pp 'camlp4o pa_extend.cmo q_MLast.cmo' -c swigp4.ml"</tt>
</p>
@@ -192,7 +195,7 @@ a '+= b</td>
<td>
(invoke object) "+=" argument as in<br>
(invoke a) "+=" b<td></tr>
-<tr><th colspan=2>Note that because camlp4 always recognizes &lt;&lt;
+<tr><th colspan=2>Note that because camlp4 always recognizes &lt;&lt;
and &gt;&gt;, they are replaced by lsl and lsr in operator names.
<tr><td>
<i>'unop</i> object as in<br>
@@ -241,11 +244,11 @@ let b = C_string (getenv "PATH")
You can test-drive your module by building a
toplevel ocaml interpreter. Consult the ocaml manual for details.
</p>
-
+
<p>
When linking any ocaml bytecode with your module, use the -custom
- option to build your functions into the primitive list. This
- option is not needed when you build native code.
+option to build your functions into the primitive list. This
+option is not needed when you build native code.
</p>
<H3><a name="Ocaml_nn7"></a>31.1.5 Compilation problems and compiling with C++</H3>
@@ -273,9 +276,9 @@ In the code as seen by the typemap
writer, there is a value, swig_result, that always contains the
current return data. It is a list, and must be appended with the
caml_list_append function, or with functions and macros provided by
-objective caml.<br>
+objective caml.
</p>
-
+
<div class="code"><pre>
type c_obj =
C_void
@@ -299,66 +302,65 @@ type c_obj =
</pre></div>
<p>
- A few functions exist which generate and return these:
+A few functions exist which generate and return these:
</p>
-
+
<ul>
- <li>caml_ptr_val receives a c_obj and returns a void *. &nbsp;This
- should be used for all pointer purposes.</li>
- <li>caml_long_val receives a c_obj and returns a long. &nbsp;This
- should be used for most integral purposes.<br>
- </li>
- <li>caml_val_ptr receives a void * and returns a c_obj.</li>
- <li>caml_val_bool receives a C int and returns a c_obj representing
- its bool value.</li>
- <li>caml_val_(u)?(char|short|int|long|float|double) receives an
-appropriate C value and returns a c_obj representing it.</li>
- <li>caml_val_string receives a char * and returns a string value.</li>
- <li>caml_val_string_len receives a char * and a length and returns
- a string value.</li>
- <li>caml_val_obj receives a void * and an object type and returns
- a C_obj, which contains a closure giving method access.</li>
-
+ <li>caml_ptr_val receives a c_obj and returns a void *. This
+ should be used for all pointer purposes.</li>
+ <li>caml_long_val receives a c_obj and returns a long. This
+ should be used for most integral purposes.</li>
+ <li>caml_val_ptr receives a void * and returns a c_obj.</li>
+ <li>caml_val_bool receives a C int and returns a c_obj representing
+ its bool value.</li>
+ <li>caml_val_(u)?(char|short|int|long|float|double) receives an
+ appropriate C value and returns a c_obj representing it.</li>
+ <li>caml_val_string receives a char * and returns a string value.</li>
+ <li>caml_val_string_len receives a char * and a length and returns
+ a string value.</li>
+ <li>caml_val_obj receives a void * and an object type and returns
+ a C_obj, which contains a closure giving method access.</li>
</ul>
<p>
Because of this style, a typemap can return any kind of value it
-wants from a function. &nbsp;This enables out typemaps and inout typemaps
-to work well. &nbsp;The one thing to remember about outputting values
-is that you must append them to the return list with swig_result = caml_list_append(swig_result,v).
-</p>
-
-<p>
-&nbsp;This function will return a new list that has your element
- appended. Upon return to caml space, the fnhelper function
- beautifies the result. A list containing a single item degrades to
- only that item (i.e. [ C_int 3 ] -&gt; C_int 3), and a list
- containing more than one item is wrapped in C_list (i.e. [ C_char
- 'a' ; C_char 'b' -&gt; C_list [ C_char 'a' ; C_char b
- ]). &nbsp;This is in order to make return values easier to handle
- when functions have only one return value, such as constructors,
- and operators. &nbsp;In addition, string, pointer, and object
- values are interchangeable with respect to caml_ptr_val, so you can
- allocate memory as caml strings and still use the resulting
- pointers for C purposes, even using them to construct simple objects
- on. Note, though, that foreign C++ code does not respect the garbage
- collector, although the SWIG interface does.</p>
-
- <p>
- The wild card type that you can use in lots of different ways is
- C_obj. It allows you to wrap any type of thing you like as an
- object using the same mechanism that the ocaml module
- does. &nbsp;When evaluated in caml_ptr_val, the returned value is
- the result of a call to the object's "&amp;" operator, taken as a pointer.
- </p>
- <p>
- You should only construct values using objective caml, or using the
- functions caml_val_* functions provided as static functions to a SWIG
- ocaml module, as well as the caml_list_* functions. These functions
- provide everything a typemap needs to produce values. In addition,
- value items pass through directly, but you must make your own type
- signature for a function that uses value in this way.
- </p>
+wants from a function. This enables out typemaps and inout typemaps
+to work well. The one thing to remember about outputting values
+is that you must append them to the return list with swig_result = caml_list_append(swig_result,v).
+</p>
+
+<p>
+This function will return a new list that has your element
+appended. Upon return to caml space, the fnhelper function
+beautifies the result. A list containing a single item degrades to
+only that item (i.e. [ C_int 3 ] -&gt; C_int 3), and a list
+containing more than one item is wrapped in C_list (i.e. [ C_char
+'a' ; C_char 'b' -&gt; C_list [ C_char 'a' ; C_char b
+]). This is in order to make return values easier to handle
+when functions have only one return value, such as constructors,
+and operators. In addition, string, pointer, and object
+values are interchangeable with respect to caml_ptr_val, so you can
+allocate memory as caml strings and still use the resulting
+pointers for C purposes, even using them to construct simple objects
+on. Note, though, that foreign C++ code does not respect the garbage
+collector, although the SWIG interface does.</p>
+
+<p>
+The wild card type that you can use in lots of different ways is
+C_obj. It allows you to wrap any type of thing you like as an
+object using the same mechanism that the ocaml module
+does. When evaluated in caml_ptr_val, the returned value is
+the result of a call to the object's "&amp;" operator, taken as a pointer.
+</p>
+
+<p>
+You should only construct values using objective caml, or using the
+functions caml_val_* functions provided as static functions to a SWIG
+ocaml module, as well as the caml_list_* functions. These functions
+provide everything a typemap needs to produce values. In addition,
+value items pass through directly, but you must make your own type
+signature for a function that uses value in this way.
+</p>
<H3><a name="Ocaml_nn9"></a>31.2.1 The generated module</H3>
@@ -376,7 +378,7 @@ that the keywords are not the same as the C++ ones.
You can introduce extra code into the output wherever you like with SWIG.
These are the places you can introduce code:
<table border="1" summary="Extra code sections">
-<tr><td>"header"</td><td>This code is inserted near the beginning of the
+<tr><td>"header"</td><td>This code is inserted near the beginning of the
C wrapper file, before any function definitions.</td></tr>
<tr><td>"wrapper"</td><td>This code is inserted in the function definition
section.</td></tr>
@@ -385,25 +387,25 @@ file.</td></tr>
<tr><td>"mli"</td><td>This code is inserted into the caml interface file.
Special signatures should be inserted here.
</td></tr>
-<tr><td>"ml"</td><td>This code is inserted in the caml code defining the
+<tr><td>"ml"</td><td>This code is inserted in the caml code defining the
interface to your C code. Special caml code, as well as any initialization
which should run when the module is loaded may be inserted here.
-</td></tr>
+</td></tr>
<tr><td>"classtemplate"</td><td>The "classtemplate" place is special because
it describes the output SWIG will generate for class definitions.
</td></tr>
</table>
-
+
<H3><a name="Ocaml_nn10"></a>31.2.2 Enums</H3>
<p>
SWIG will wrap enumerations as polymorphic variants in the output
-Ocaml code, as above in C_enum.&nbsp; In order to support all
+Ocaml code, as above in C_enum. In order to support all
C++-style uses of enums, the function int_to_enum and enum_to_int are
provided for ocaml code to produce and consume these values as
-integers. &nbsp;Other than that, correct uses of enums will not have
-a problem. &nbsp;Since enum labels may overlap between enums, the
+integers. Other than that, correct uses of enums will not have
+a problem. Since enum labels may overlap between enums, the
enum_to_int and int_to_enum functions take an enum type label as an
argument. Example:
</p>
@@ -416,9 +418,9 @@ enum c_enum_type { a = 1, b, c = 4, d = 8 };
enum c_enum_type { a = 1, b, c = 4, d = 8 };
</pre></div>
-<p>
+<p>
The output mli contains:
-</p>
+</p>
<div class="code"><pre>
type c_enum_type = [
@@ -435,16 +437,16 @@ type c_enum_tag = [
val int_to_enum c_enum_type -&gt; int -&gt; c_obj
val enum_to_int c_enum_type -&gt; c_obj -&gt; c_obj
</pre>
- </div>
+</div>
<p>
- So it's possible to do this:
+So it's possible to do this:
</p>
-<div class="code">
- <pre>
+<div class="code">
+<pre>
bash-2.05a$ ocamlmktop -custom enum_test_wrap.o enum_test.cmo -o enum_test_top
-bash-2.05a$ ./enum_test_top
+bash-2.05a$ ./enum_test_top
Objective Caml version 3.04
# open Enum_test ;;
@@ -455,7 +457,7 @@ val x : Enum_test.c_obj = C_enum `a
# int_to_enum `c_enum_type 4 ;;
- : Enum_test.c_obj = C_enum `c
</pre>
- </div>
+</div>
<H4><a name="Ocaml_nn11"></a>31.2.2.1 Enum typing in Ocaml</H4>
@@ -485,7 +487,7 @@ distribution.
<p>
By including "carray.i", you will get access to some macros that help you
-create typemaps for array types fairly easily.
+create typemaps for array types fairly easily.
</p>
<p>
@@ -547,7 +549,7 @@ void printfloats( float *tab, int len ) {
printf( "%f ", tab[i] );
}
- printf( "\n" );
+ printf( "\n" );
}
%}
@@ -577,25 +579,25 @@ void printfloats( float *tab, int len );
<p>
C++ classes, along with structs and unions are represented by C_obj
-(string -&gt; c_obj -&gt; c_obj) wrapped closures. &nbsp;These objects
+(string -&gt; c_obj -&gt; c_obj) wrapped closures. These objects
contain a method list, and a type, which allow them to be used like
C++ objects. When passed into typemaps that use pointers, they
-degrade to pointers through their "&amp;" method. &nbsp;Every method
+degrade to pointers through their "&amp;" method. Every method
an object has is represented as a string in the object's method table,
-and each method table exists in memory only once. &nbsp;In addition
+and each method table exists in memory only once. In addition
to any other operators an object might have, certain builtin ones are
-provided by SWIG: (all of these take no arguments (C_void))
+provided by SWIG: (all of these take no arguments (C_void))
</p>
<table summary="SWIG provided operators">
<tr><td>"~"</td><td>Delete this object</td></tr>
-<tr><td>"&amp;"</td><td>Return an ordinary C_ptr value representing this
+<tr><td>"&amp;"</td><td>Return an ordinary C_ptr value representing this
object's address</td></tr>
<tr><td>"sizeof"</td><td>If enabled with ("sizeof"="1") on the module node,
return the object's size in char.</td></tr>
<tr><td>":methods"</td><td>Returns a list of strings containing the names of
the methods this object contains</td></tr>
-<tr><td>":classof"</td><td>Returns the name of the class this object belongs
+<tr><td>":classof"</td><td>Returns the name of the class this object belongs
to.</td></tr>
<tr><td>":parents"</td><td>Returns a list of all direct parent classes which
have been wrapped by SWIG.</td></tr>
@@ -603,8 +605,8 @@ have been wrapped by SWIG.</td></tr>
indicated parent class. This is mainly used internally by the SWIG module,
but may be useful to client programs.</td></tr>
<tr><td>"[member-variable]"</td><td>Each member variable is wrapped as a
-method with an optional parameter.
-Called with one argument, the member variable is set to the value of the
+method with an optional parameter.
+Called with one argument, the member variable is set to the value of the
argument. With zero arguments, the value is returned.
</td></tr>
</table>
@@ -652,12 +654,12 @@ Since there's a makefile in that directory, the example is easy to build.
<p>
Here's a sample transcript of an interactive session using a string vector
-after making a toplevel (make toplevel). This example uses the camlp4
+after making a toplevel (make toplevel). This example uses the camlp4
module.
</p>
<div class="code"><pre>
-bash-2.05a$ ./example_top
+bash-2.05a$ ./example_top
Objective Caml version 3.06
Camlp4 Parsing version 3.06
@@ -685,14 +687,14 @@ C_list
- : Example.c_obj = C_void
# x '[1] ;;
- : Example.c_obj = C_string "spam"
-# for i = 0 to (x -&gt; size() as int) - 1 do
- print_endline ((x '[i to int]) as string)
+# for i = 0 to (x -&gt; size() as int) - 1 do
+ print_endline ((x '[i to int]) as string)
done ;;
foo
bar
baz
- : unit = ()
-#
+#
</pre></div>
<H4><a name="Ocaml_nn19"></a>31.2.4.2 C++ Class Example</H4>
@@ -703,7 +705,7 @@ Here's a simple example using Trolltech's Qt Library:
</p>
<table border="1" bgcolor="#dddddd" summary="Qt Library example">
- <tr><th><center>qt.i</center></th></tr>
+<tr><th><center>qt.i</center></th></tr>
<tr><td><pre>
%module qt
%{
@@ -733,9 +735,9 @@ bash-2.05a$ QTPATH=/your/qt/path
bash-2.05a$ for file in swig.mli swig.ml swigp4.ml ; do swig -ocaml -co $file ; done
bash-2.05a$ ocamlc -c swig.mli ; ocamlc -c swig.ml
bash-2.05a$ ocamlc -I `camlp4 -where` -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
-bash-2.05a$ swig -ocaml -c++ -I$QTPATH/include qt.i
+bash-2.05a$ swig -ocaml -c++ -I$QTPATH/include qt.i
bash-2.05a$ mv qt_wrap.cxx qt_wrap.c
-bash-2.05a$ ocamlc -c -ccopt -xc++ -ccopt -g -g -ccopt -I$QTPATH/include qt_wrap.c
+bash-2.05a$ ocamlc -c -ccopt -xc++ -ccopt -g -g -ccopt -I$QTPATH/include qt_wrap.c
bash-2.05a$ ocamlc -c qt.mli
bash-2.05a$ ocamlc -c qt.ml
bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
@@ -747,7 +749,7 @@ bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
<div class="code"><pre>
-bash-2.05a$ ./qt_top
+bash-2.05a$ ./qt_top
Objective Caml version 3.06
Camlp4 Parsing version 3.06
@@ -767,7 +769,7 @@ val hello : Qt.c_obj = C_obj &lt;fun&gt;
<p>
Assuming you have a working installation of QT, you will see a window
-containing the string "hi" in a button.
+containing the string "hi" in a button.
</p>
<H3><a name="Ocaml_nn22"></a>31.2.5 Director Classes</H3>
@@ -852,7 +854,7 @@ let triangle_class pts ob meth args =
| _ -&gt; (invoke ob) meth args ;;
let triangle =
- new_derived_object
+ new_derived_object
new_shape
(triangle_class ((0.0,0.0),(0.5,1.0),(1.0,0.0)))
'() ;;
@@ -896,7 +898,7 @@ The definition of the actual object triangle can be described this way:
<div class="code"><pre>
let triangle =
- new_derived_object
+ new_derived_object
new_shape
(triangle_class ((0.0,0.0),(0.5,1.0),(1.0,0.0)))
'()
@@ -904,13 +906,13 @@ let triangle =
<p>
The first argument to <tt>new_derived_object</tt>, new_shape is the method
-which returns a shape instance. This function will be invoked with the
+which returns a shape instance. This function will be invoked with the
third argument will be appended to the argument list [ C_void ]. In the
example, the actual argument list is sent as (C_list [ C_void ; C_void ]).
The augmented constructor for a director class needs the first argument
to determine whether it is being constructed as a derived object, or as
an object of the indicated type only (in this case <tt>shape</tt>). The
-Second argument is a closure that will be added to the final C_obj.
+Second argument is a closure that will be added to the final C_obj.
</p>
<p>
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index 8dae4bbf0..1886fcd45 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -3404,7 +3404,7 @@ def bar(*args):
class Foo {
public:
int bar(int x);
-}
+};
</pre>
</div>
@@ -3441,7 +3441,7 @@ proxy, just before the return statement.
class Foo {
public:
int bar(int x);
-}
+};
</pre>
</div>
@@ -3470,7 +3470,7 @@ SWIG version 1.3.28 you can use the directive forms
class Foo {
public:
int bar(int x);
-}
+};
</pre>
</div>
@@ -3500,7 +3500,7 @@ class Foo {
public:
int bar(int x);
int bar();
-}
+};
</pre>
</div>
diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html
index d0a1d5381..cb4a3af90 100644
--- a/Doc/Manual/Scilab.html
+++ b/Doc/Manual/Scilab.html
@@ -42,7 +42,7 @@
<li><a href="#Scilab_wrapping_pointers_null_pointers">Null pointers</a>
</ul>
<li><a href="#Scilab_wrapping_structs">Structures</a>
-<li><a href="#Scilab_wrapping_cpp_classes">C++ Classes</a>
+<li><a href="#Scilab_wrapping_cpp_classes">C++ classes</a>
<li><a href="#Scilab_wrapping_cpp_inheritance">C++ inheritance</a>
<li><a href="#Scilab_wrapping_pointers_references_values_arrays">Pointers, references, values, and arrays</a>
<li><a href="#Scilab_wrapping_cpp_templates">C++ templates</a>
@@ -931,7 +931,7 @@ ans =
</pre></div>
-<H3><a name="Scilab_wrapping_cpp_classes"></a>39.3.8 C++ Classes</H3>
+<H3><a name="Scilab_wrapping_cpp_classes"></a>39.3.8 C++ classes</H3>
<p>
@@ -1365,7 +1365,7 @@ void throw_int() throw(int) {
}
void throw_stl_invalid_arg(int i) throw(std::invalid_argument) {
- if (i &amp;lt 0)
+ if (i &lt; 0)
throw std::invalid_argument("argument is negative.");
}
%}
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index a7d00929b..6a29e9087 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -883,7 +883,7 @@ OCAMLFIND=@OCAMLFIND@
OCAMLMKTOP=@OCAMLMKTOP@ $(SWIGWHERE)
NOLINK ?= false
OCAMLPP= -pp "camlp4o ./swigp4.cmo"
-OCAMLP4WHERE=`$(COMPILETOOL) camlp4 -where`
+OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where`
OCAMLCORE=\
rm -rf swig.mli swig.ml swigp4.ml && \
$(SWIG) -ocaml -co swig.mli 2>/dev/null && \
@@ -1710,7 +1710,7 @@ SCILAB_LIBPREFIX = lib
scilab:
$(SWIG) -scilab $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SCILAB_INC) $(INCLUDES) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS)
+ $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SCILAB_INC) $(INCLUDES) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS)
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(IOBJS) $(OBJS) $(LIBS) -o $(SCILAB_LIBPREFIX)$(TARGET)$(SO)
# ----------------------------------------------------------------
@@ -1719,7 +1719,7 @@ scilab:
scilab_cpp:
$(SWIG) -c++ -scilab $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SCILAB_INC) $(INCLUDES) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
+ $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SCILAB_INC) $(INCLUDES) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(IOBJS) $(OBJS) $(LIBS) $(CPP_DLLIBS) -o $(SCILAB_LIBPREFIX)$(TARGET)$(SO)
# -----------------------------------------------------------------
diff --git a/Examples/test-suite/errors/pp_unknowndirective.i b/Examples/test-suite/errors/pp_unknowndirective.i
index 659a997d3..b4e608b34 100644
--- a/Examples/test-suite/errors/pp_unknowndirective.i
+++ b/Examples/test-suite/errors/pp_unknowndirective.i
@@ -1,5 +1,10 @@
%module xxx
+/* Regression test for bug introduced in 3.0.4 and fixed in 3.0.6 - the '%std'
+ * here led to SWIG calling abort().
+ */
+%typemap(jstype) std::vector<std::string>, const %std::vector<std::string>&, std::vector<std::string>& "List<String>"
+
/* This used to give the rather cryptic "Syntax error in input(1)." prior to
* SWIG 3.0.4. This testcase checks that the improved message is actually
* issued.
diff --git a/Examples/test-suite/errors/pp_unknowndirective.stderr b/Examples/test-suite/errors/pp_unknowndirective.stderr
index d0d5e249f..2cc2377c7 100644
--- a/Examples/test-suite/errors/pp_unknowndirective.stderr
+++ b/Examples/test-suite/errors/pp_unknowndirective.stderr
@@ -1 +1 @@
-pp_unknowndirective.i:7: Error: Unknown directive '%remane'.
+pp_unknowndirective.i:12: Error: Unknown directive '%remane'.
diff --git a/Examples/test-suite/ocaml/Makefile.in b/Examples/test-suite/ocaml/Makefile.in
index 9a4e008b9..0956fcbc4 100644
--- a/Examples/test-suite/ocaml/Makefile.in
+++ b/Examples/test-suite/ocaml/Makefile.in
@@ -3,7 +3,7 @@
#######################################################################
LANGUAGE = ocaml
-OCAMLC = ocamlc
+OCAMLC = @OCAMLC@
VARIANT = _static
SCRIPTSUFFIX = _runme.ml
@@ -25,18 +25,11 @@ run_testcase = \
fi ;
check_quant:
- cat /dev/null > testing
- cat /dev/null > success
- cat /dev/null > results
+ : > testing
+ : > success
$(MAKE) check
- echo "Failed:" >> results
- for element in `cat testing` ; do \
- if grep $$element success >/dev/null 2>/dev/null ; then \
- : ; \
- else \
- echo $$element >> results ; \
- fi ; \
- done
+ echo "Failed:" > results
+ diff testing success | sed 's/^< //p;d' >> results
echo "Success:" >> results
cat success >> results
diff --git a/Lib/ocaml/ocamldec.swg b/Lib/ocaml/ocamldec.swg
index e6b8939fb..96e1cd2ce 100644
--- a/Lib/ocaml/ocamldec.swg
+++ b/Lib/ocaml/ocamldec.swg
@@ -130,7 +130,7 @@ CAMLextern int64 Int64_val(caml_value_t v);
SWIGSTATIC CAML_VALUE caml_array_new( int n );
SWIGSTATIC void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item );
SWIGSTATIC CAML_VALUE caml_array_nth( CAML_VALUE arr, int n );
- SWIGSTATIC int caml_array_length( CAML_VALUE arr );
+ SWIGSTATIC int caml_array_len( CAML_VALUE arr );
SWIGSTATIC CAML_VALUE caml_val_char( char c );
SWIGSTATIC CAML_VALUE caml_val_uchar( unsigned char c );
@@ -165,5 +165,3 @@ CAMLextern int64 Int64_val(caml_value_t v);
#ifdef __cplusplus
}
#endif
-
-/* mzschemedec.swg ends here */
diff --git a/Lib/python/pyabc.i b/Lib/python/pyabc.i
index 3da06b5a9..12ce65985 100644
--- a/Lib/python/pyabc.i
+++ b/Lib/python/pyabc.i
@@ -1,7 +1,7 @@
%define %pythonabc(Type, Abc)
%feature("python:abc", #Abc) Type;
%enddef
-%pythoncode {import collections};
+%pythoncode %{import collections%}
%pythonabc(std::vector, collections.MutableSequence);
%pythonabc(std::list, collections.MutableSequence);
%pythonabc(std::map, collections.MutableMapping);
diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg
index e5543cd6b..7168862f5 100644
--- a/Lib/python/pycontainer.swg
+++ b/Lib/python/pycontainer.swg
@@ -710,8 +710,8 @@ namespace swig
#if defined(SWIGPYTHON_BUILTIN)
%feature("python:slot", "tp_iter", functype="getiterfunc") iterator;
#else
- %pythoncode {def __iter__(self):
- return self.iterator()}
+ %pythoncode %{def __iter__(self):
+ return self.iterator()%}
#endif
}
diff --git a/Lib/python/pyiterators.swg b/Lib/python/pyiterators.swg
index 110c431fe..8fbb31226 100644
--- a/Lib/python/pyiterators.swg
+++ b/Lib/python/pyiterators.swg
@@ -344,8 +344,8 @@ namespace swig
%feature("python:slot", "tp_iternext", functype="iternextfunc") SwigPyIterator::__next__;
#else
%extend SwigPyIterator {
- %pythoncode {def __iter__(self):
- return self}
+ %pythoncode %{def __iter__(self):
+ return self%}
}
#endif
diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i
index 58902bca4..454e821a5 100644
--- a/Lib/python/std_map.i
+++ b/Lib/python/std_map.i
@@ -176,14 +176,14 @@
#else
%extend {
- %pythoncode {def __iter__(self):
- return self.key_iterator()}
- %pythoncode {def iterkeys(self):
- return self.key_iterator()}
- %pythoncode {def itervalues(self):
- return self.value_iterator()}
- %pythoncode {def iteritems(self):
- return self.iterator()}
+ %pythoncode %{def __iter__(self):
+ return self.key_iterator()%}
+ %pythoncode %{def iterkeys(self):
+ return self.key_iterator()%}
+ %pythoncode %{def itervalues(self):
+ return self.value_iterator()%}
+ %pythoncode %{def iteritems(self):
+ return self.iterator()%}
}
#endif
diff --git a/Lib/python/std_pair.i b/Lib/python/std_pair.i
index 73d47e198..5694e7e09 100644
--- a/Lib/python/std_pair.i
+++ b/Lib/python/std_pair.i
@@ -176,7 +176,7 @@ SwigPython_std_pair_setitem (PyObject *a, Py_ssize_t b, PyObject *c)
%define %swig_pair_methods(pair...)
#if !defined(SWIGPYTHON_BUILTIN)
%extend {
-%pythoncode {def __len__(self):
+%pythoncode %{def __len__(self):
return 2
def __repr__(self):
return str((self.first, self.second))
@@ -189,7 +189,7 @@ def __setitem__(self, index, val):
if not (index % 2):
self.first = val
else:
- self.second = val}
+ self.second = val%}
}
#endif
%enddef
diff --git a/Lib/python/std_unordered_map.i b/Lib/python/std_unordered_map.i
index 737468234..e58a4e927 100644
--- a/Lib/python/std_unordered_map.i
+++ b/Lib/python/std_unordered_map.i
@@ -231,14 +231,14 @@
return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
}
- %pythoncode {def __iter__(self):
- return self.key_iterator()}
- %pythoncode {def iterkeys(self):
- return self.key_iterator()}
- %pythoncode {def itervalues(self):
- return self.value_iterator()}
- %pythoncode {def iteritems(self):
- return self.iterator()}
+ %pythoncode %{def __iter__(self):
+ return self.key_iterator()%}
+ %pythoncode %{def iterkeys(self):
+ return self.key_iterator()%}
+ %pythoncode %{def itervalues(self):
+ return self.value_iterator()%}
+ %pythoncode %{def iteritems(self):
+ return self.iterator()%}
}
%enddef
diff --git a/Lib/scilab/scichar.swg b/Lib/scilab/scichar.swg
index 509a40c18..66818e991 100644
--- a/Lib/scilab/scichar.swg
+++ b/Lib/scilab/scichar.swg
@@ -117,8 +117,10 @@ SWIGINTERN int
SWIG_SciString_AsCharPtrAndSize(void *pvApiCtx, int iVar, char **pcValue, size_t *piLength, int *alloc, char *fname) {
SciErr sciErr;
int *piAddrVar = NULL;
- int iRet;
- char *pstStrings = NULL;
+ char *pstString = NULL;
+ int iRows = 0;
+ int iCols = 0;
+ int iLen = 0;
sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar);
if (sciErr.iErr) {
@@ -126,14 +128,31 @@ SWIG_SciString_AsCharPtrAndSize(void *pvApiCtx, int iVar, char **pcValue, size_t
return SWIG_ERROR;
}
- iRet = getAllocatedSingleString(pvApiCtx, piAddrVar, &pstStrings);
- if (iRet) {
- return SWIG_ERROR;
+ if (isScalar(pvApiCtx, piAddrVar) == 0 || isStringType(pvApiCtx, piAddrVar) == 0)
+ {
+ Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A single string expected.\n"), fname, iVar);
+ return SWIG_TypeError;
+ }
+
+ sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &iLen, NULL);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+
+ pstString = %new_array(iLen + 1, char);
+
+ sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &iLen, &pstString);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return SWIG_ERROR;
}
// TODO: return SWIG_ERROR if pcValue NULL (now returning SWIG_ERROR fails some typechecks)
if (pcValue) {
- *pcValue = pstStrings;
+ *pcValue = pstString;
}
if (alloc != NULL) {
@@ -141,7 +160,7 @@ SWIG_SciString_AsCharPtrAndSize(void *pvApiCtx, int iVar, char **pcValue, size_t
}
if (piLength != NULL) {
- *piLength = strlen(*pcValue);
+ *piLength = strlen(pstString);
}
return SWIG_OK;
diff --git a/Lib/swiglabels.swg b/Lib/swiglabels.swg
index baa21a756..e73e63a57 100644
--- a/Lib/swiglabels.swg
+++ b/Lib/swiglabels.swg
@@ -110,3 +110,12 @@
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif
+
+/* Intel's compiler complains if a variable which was never initialised is
+ * cast to void, which is a common idiom which we use to indicate that we
+ * are aware a variable isn't used. So we just silence that warning.
+ * See: https://github.com/swig/swig/issues/192 for more discussion.
+ */
+#ifdef __INTEL_COMPILER
+# pragma warning disable 592
+#endif
diff --git a/RELEASENOTES b/RELEASENOTES
index ff1c99821..6af303bc8 100644
--- a/RELEASENOTES
+++ b/RELEASENOTES
@@ -358,7 +358,7 @@ SWIG-1.3.22 summary:
exceptions into target language exceptions.
- Improved enum support, mapping to built-in Java 1.5 enums and C#
enums or the typesafe enum pattern for these two languages.
-- Python - much better STL suppport and support for std::wstring,
+- Python - much better STL support and support for std::wstring,
wchar_t and FILE *.
- Initial support for Modula3 and Allegro CL.
- 64 bit TCL support.
diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c
index 7dd63924b..619bc6215 100644
--- a/Source/CParse/cscanner.c
+++ b/Source/CParse/cscanner.c
@@ -908,7 +908,7 @@ int yylex(void) {
return (WARN);
/* Note down the apparently unknown directive for error reporting. */
- cparse_unknown_directive = Swig_copy_string(yytext);
+ cparse_unknown_directive = NewString(yytext);
}
/* Have an unknown identifier, as a last step, we'll do a typedef lookup on it. */
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index 52d230d99..1e4eec3bf 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -1642,7 +1642,7 @@ public:
String *proxyclassname = Getattr(n, "classtypeobj");
String *baseclassname = Getattr(base.item, "name");
Swig_warning(WARN_CSHARP_MULTIPLE_INHERITANCE, Getfile(n), Getline(n),
- "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Java.\n", SwigType_namestr(proxyclassname), SwigType_namestr(baseclassname));
+ "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in C#.\n", SwigType_namestr(proxyclassname), SwigType_namestr(baseclassname));
base = Next(base);
}
}
diff --git a/Source/Modules/go.cxx b/Source/Modules/go.cxx
index c7c32cde5..087a71999 100644
--- a/Source/Modules/go.cxx
+++ b/Source/Modules/go.cxx
@@ -1353,7 +1353,7 @@ private:
Delete(ret_type);
}
- goargout(info->parms, parm_count);
+ goargout(info->parms);
if (SwigType_type(info->result) != T_VOID) {
String *goout = goTypemapLookup("goout", info->n, "swig_r");
@@ -1945,7 +1945,7 @@ private:
Printv(f_go_wrappers, call, NULL);
Delete(call);
- goargout(parms, parm_count);
+ goargout(parms);
if (need_return_var) {
if (goout == NULL) {
@@ -2487,18 +2487,17 @@ private:
* property with the name to use to refer to that parameter.
* ----------------------------------------------------------------------- */
- void goargout(ParmList *parms, int parm_count) {
+ void goargout(ParmList *parms) {
Parm *p = parms;
- for (int i = 0; i < parm_count; ++i) {
- p = getParm(p);
- String *tm = goGetattr(p, "tmap:goargout");
+ while (p) {
+ String *tm = Getattr(p, "tmap:goargout");
if (!tm) {
p = nextSibling(p);
} else {
tm = Copy(tm);
Replaceall(tm, "$result", "swig_r");
Replaceall(tm, "$input", Getattr(p, "emit:goinput"));
- Printv(f_go_wrappers, tm, NULL);
+ Printv(f_go_wrappers, tm, "\n", NULL);
Delete(tm);
p = Getattr(p, "tmap:goargout:next");
}
@@ -4456,7 +4455,7 @@ private:
Printv(f_go_wrappers, "\tswig_r = *(*", ret_type, ")(unsafe.Pointer(&swig_r_p))\n", NULL);
}
- goargout(parms, parm_count);
+ goargout(parms);
if (SwigType_type(result) != T_VOID) {
if (goout == NULL) {
@@ -4758,7 +4757,7 @@ private:
Printv(f_go_wrappers, "\tswig_r = *(*", ret_type, ")(unsafe.Pointer(&swig_r_p))\n", NULL);
}
- goargout(parms, parm_count);
+ goargout(parms);
if (SwigType_type(result) != T_VOID) {
if (goout == NULL) {
@@ -6314,7 +6313,7 @@ private:
String *ct = Getattr(n, "emit:cgotype");
if (ct) {
- *c_struct_type = (bool)Getattr(n, "emit:cgotypestruct");
+ *c_struct_type = Getattr(n, "emit:cgotypestruct") ? true : false;
return Copy(ct);
}
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 47575e85f..72a1007fc 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -1893,7 +1893,7 @@ public:
} else if (Len(pure_baseclass) > 0 && Len(baseclass) > 0) {
Swig_warning(WARN_JAVA_MULTIPLE_INHERITANCE, Getfile(n), Getline(n),
"Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Java. "
- "Perhaps you need one of the 'replace' or 'notderived' attributes in the csbase typemap?\n", typemap_lookup_type, pure_baseclass);
+ "Perhaps you need one of the 'replace' or 'notderived' attributes in the javabase typemap?\n", typemap_lookup_type, pure_baseclass);
}
// Pure Java interfaces
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx
index 72f0d98d3..bca6fa2a0 100644
--- a/Source/Modules/ocaml.cxx
+++ b/Source/Modules/ocaml.cxx
@@ -620,9 +620,9 @@ public:
}
/* if the object is a director, and the method call originated from its
- * underlying python object, resolve the call by going up the c++
- * inheritance chain. otherwise try to resolve the method in python.
- * without this check an infinite loop is set up between the director and
+ * underlying ocaml object, resolve the call by going up the c++
+ * inheritance chain. otherwise try to resolve the method in ocaml.
+ * without this check an infinite loop is set up between the director and
* shadow class method calls.
*/
diff --git a/Source/Modules/octave.cxx b/Source/Modules/octave.cxx
index 6d225575d..e5f18cae8 100644
--- a/Source/Modules/octave.cxx
+++ b/Source/Modules/octave.cxx
@@ -1387,7 +1387,7 @@ public:
SwigType_namestr(name));
}
} else {
- // attach typemaps to arguments (C/C++ -> Python)
+ // attach typemaps to arguments (C/C++ -> Octave)
String *parse_args = NewString("");
Swig_director_parms_fixup(l);
diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx
index 3963abf5d..45ed6f6e4 100644
--- a/Source/Modules/perl5.cxx
+++ b/Source/Modules/perl5.cxx
@@ -2255,7 +2255,7 @@ public:
if (SwigType_isreference(ptype)) {
Insert(ppname, 0, "&");
}
- /* if necessary, cast away const since Python doesn't support it! */
+ /* if necessary, cast away const since Perl doesn't support it! */
if (SwigType_isconst(nptype)) {
nonconst = NewStringf("nc_tmp_%s", pname);
String *nonconst_i = NewStringf("= const_cast< %s >(%s)", SwigType_lstr(ptype, 0), ppname);
diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx
index 5aadf86df..d484f7065 100644
--- a/Source/Modules/ruby.cxx
+++ b/Source/Modules/ruby.cxx
@@ -1795,8 +1795,8 @@ public:
/* if the object is a director, and the method call originated from its
* underlying Ruby object, resolve the call by going up the c++
- * inheritance chain. otherwise try to resolve the method in python.
- * without this check an infinite loop is set up between the director and
+ * inheritance chain. otherwise try to resolve the method in Ruby.
+ * without this check an infinite loop is set up between the director and
* shadow class method calls.
*/
diff --git a/Source/Modules/scilab.cxx b/Source/Modules/scilab.cxx
index 6d9930431..82389f4cd 100644
--- a/Source/Modules/scilab.cxx
+++ b/Source/Modules/scilab.cxx
@@ -675,7 +675,7 @@ public:
}
}
- /* Create variables for member pointer constants, not suppported by typemaps (like Python wrapper does) */
+ /* Create variables for member pointer constants, not supported by typemaps (like Python wrapper does) */
if (SwigType_type(type) == T_MPOINTER) {
String *wname = Swig_name_wrapper(constantName);
String *str = SwigType_str(type, wname);
diff --git a/Tools/config/ac_compare_version.m4 b/Tools/config/ac_compare_version.m4
deleted file mode 100644
index 0828f4789..000000000
--- a/Tools/config/ac_compare_version.m4
+++ /dev/null
@@ -1,40 +0,0 @@
-dnl @synopsis AC_COMPARE_VERSION\
-dnl (version-a, version-b, action-if-greater, action-if-equal, action-if-less)
-dnl
-dnl This macro compares two version numbers and executes the indicated action
-dnl based on whether they're equal or one is greater than the other.
-dnl It's needed to determine whether ocaml is new enough that the incompatible
-dnl change 'loc' -> '_loc' is present in this version of camlp4.
-dnl
-dnl It's implemented from scratch just for SWIG by arty.
-dnl
-dnl @category Misc
-dnl @author arty
-dnl @version 2006-11-02
-dnl @license GPLWithACException
-
-AC_DEFUN([AC_COMPARE_VERSION], [
- # Split the version into units.
- ver_a="[$1]"
- ver_b="[$2]"
- nodots_a=`echo $ver_a | sed -e 's/\./ /g'`
- condition="equal"
- isolate_b_regex='\([[0-9]]\+\).*'
- for ver_part in $nodots_a ; do
- b_ver_part=`echo "$ver_b" | sed -e 's/'"$isolate_b_regex"'/\1/'`
- if test \( "$ver_part" -lt "$b_ver_part" \) -a \( "x$condition" = "xequal" \) ; then
- condition=less
- elif test \( "$ver_part" -gt "$b_ver_part" \) -a \( "x$condition" = "xequal" \) ; then
- condition=greater
- fi
- isolate_b_regex='[[0-9]]\+\.'"$isolate_b_regex"
- done
-
- if test "x$condition" = "xequal" ; then
- [$4]
- elif test "x$condition" = "xless" ; then
- [$3]
- elif test "x$condition" = "xgreater" ; then
- [$5]
- fi
-])
diff --git a/configure.ac b/configure.ac
index b595de08e..dfd874b75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1745,19 +1745,18 @@ AC_SUBST(PHPINC)
# Look for ocaml
#----------------------------------------------------------------
-AC_ARG_WITH(ocaml, AS_HELP_STRING([--without-ocaml], [Disable OCaml])
-AS_HELP_STRING([--with-ocaml=path], [Set location of ocaml executable]),[ OCAMLBIN="$withval"], [OCAMLBIN=yes])
+AC_ARG_WITH(ocaml, AS_HELP_STRING([--without-ocaml], [Disable OCaml]), [with_ocaml="$withval"], [with_ocaml=yes])
AC_ARG_WITH(ocamlc,[ --with-ocamlc=path Set location of ocamlc executable],[ OCAMLC="$withval"], [OCAMLC=])
AC_ARG_WITH(ocamldlgen,[ --with-ocamldlgen=path Set location of ocamldlgen],[ OCAMLDLGEN="$withval" ], [OCAMLDLGEN=])
AC_ARG_WITH(ocamlfind,[ --with-ocamlfind=path Set location of ocamlfind],[OCAMLFIND="$withval"],[OCAMLFIND=])
AC_ARG_WITH(ocamlmktop,[ --with-ocamlmktop=path Set location of ocamlmktop executable],[ OCAMLMKTOP="$withval"], [OCAMLMKTOP=])
+AC_ARG_WITH(camlp4,[ --with-camlp4=path Set location of camlp4 executable],[ CAMLP4="$withval"], [CAMLP4=])
# First, check for "--without-ocaml" or "--with-ocaml=no".
-if test x"${OCAMLBIN}" = xno -o x"${with_alllang}" = xno ; then
+if test x"${with_ocaml}" = xno -o x"${with_alllang}" = xno ; then
AC_MSG_NOTICE([Disabling OCaml])
- OCAMLBIN=
+ OCAMLC=
else
-
AC_MSG_CHECKING(for Ocaml DL load generator)
if test -z "$OCAMLDLGEN"; then
AC_CHECK_PROGS(OCAMLDLGEN, ocamldlgen, :)
@@ -1773,60 +1772,22 @@ else
AC_CHECK_PROGS(OCAMLC, ocamlc, :)
fi
- AC_MSG_CHECKING(for Ocaml interpreter)
- if test "x$OCAMLBIN" = xyes; then
- AC_CHECK_PROGS(OCAMLBIN, ocaml, :)
- fi
-
AC_MSG_CHECKING(for Ocaml toplevel creator)
if test -z "$OCAMLMKTOP"; then
AC_CHECK_PROGS(OCAMLMKTOP, ocamlmktop, :)
fi
- OCAMLLOC=loc
- if test "$OCAMLC" != ":" ; then
- AC_MSG_CHECKING(for Ocaml header files)
- dirs="/usr/lib/ocaml/caml /usr/local/lib/ocaml/caml"
- dir="`$OCAMLC -where 2>/dev/null`"
- if test "$dir"; then
- dirs="$dir/caml $dirs"
- fi
- for i in $dirs; do
- if test -r $i/mlvalues.h; then
- AC_MSG_RESULT($i)
- OCAMLEXT="$i"
- OCAMLINC="-I$OCAMLEXT"
- break
- fi
- done
- if test -z "$OCAMLINC"; then
- AC_MSG_RESULT(not found)
- fi
-
- AC_MSG_CHECKING(for Ocaml version 3.08.2 or higher)
- OCAMLVER=`$OCAMLC -version | sed -e 's/.*version //g'`
- AC_COMPARE_VERSION([$OCAMLVER],[3.08.2],[:],[:],[OCAMLLOC=_loc])
- AC_MSG_RESULT($OCAMLVER)
+ AC_MSG_CHECKING(for Ocaml Pre-Processor-Pretty-Printer)
+ if test -z "$CAMLP4"; then
+ AC_CHECK_PROGS(CAMLP4, camlp4, :)
fi
fi # Disabling ocaml
-export OCAMLLOC
-export OCAMLVER
-export OCAMLINC
-export OCAMLBIN
-export OCAMLC
-export OCAMLDLGEN
-export OCAMLFIND
-export OCAMLMKTOP
-
-AC_SUBST(OCAMLLOC)
-AC_SUBST(OCAMLVER)
-AC_SUBST(OCAMLINC)
-AC_SUBST(OCAMLBIN)
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLDLGEN)
AC_SUBST(OCAMLFIND)
AC_SUBST(OCAMLMKTOP)
+AC_SUBST(CAMLP4)
#----------------------------------------------------------------
# Look for Pike
@@ -2333,8 +2294,6 @@ else
GO="$GOBIN"
fi
- AC_CHECK_PROGS(GCCGO, gccgo)
-
GOGCC=false
GCCGO=
GO1=false
@@ -2345,61 +2304,67 @@ else
GCCGOOPT=
GOVERSIONOPTION=
- GO1=true
- GOVERSIONOPTION=version
- GOC=$(sh -c "$(go env) && echo \$GOCHAR")c
- go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version //')
- AC_MSG_CHECKING([whether go version is too old])
- case $go_version in
- go1.0* | go1 )
- AC_MSG_RESULT([yes - minimum version is 1.1])
- GO=
- GOOPT="-intgosize 32"
- ;;
- *)
- AC_MSG_RESULT([no])
- if test "$GOC" = "6c"; then
- GOOPT="-intgosize 64"
- else
+ if test -n "$GO" ; then
+ GO1=true
+ GOVERSIONOPTION=version
+ GOC=$(sh -c "$(go env) && echo \$GOCHAR")c
+ go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version //')
+ AC_MSG_CHECKING([whether go version is too old])
+ case $go_version in
+ go1.0* | go1 )
+ AC_MSG_RESULT([yes - minimum version is 1.1])
+ GO=
GOOPT="-intgosize 32"
- fi
- ;;
- esac
- case $go_version in
- go1.0* | go1 | go1.1*)
- GOOPT="$GOOPT -use-shlib"
- ;;
- go1.2*)
- GO12=true
- ;;
- go1.3* | go1.4*)
- GO13=true
- ;;
- *)
- GO15=true
- ;;
- esac
-
- if $GCCGO --help 2>/dev/null | grep gccgo >/dev/null 2>&1 ; then
- AC_MSG_CHECKING([whether gccgo version is too old])
- go_version=[`$GO $GOVERSIONOPTION | sed -n '1p' | sed -e 's/^.* \([0-9.]*\) *$/\1/' -e 's/[.]//g'`]
- if test "x$go_version" = x; then
- AC_MSG_RESULT([could not determine gccgo version])
- GCCGO=
- elif test "$go_version" -lt 470; then
- AC_MSG_RESULT([yes - minimum version is 4.7.0])
- GCCGO=
- else
+ ;;
+ *)
AC_MSG_RESULT([no])
- if test "$go_version" -lt 480; then
- GCCGOOPT="-intgosize 32"
+ if test "$GOC" = "6c"; then
+ GOOPT="-intgosize 64"
else
- AC_CHECK_SIZEOF([void *], [4])
- if test "$ac_cv_sizeof_void_p" = "8"; then
- GCCGOOPT="-intgosize 64"
- else
- GCCGOOPT="-intgosize 32"
- fi
+ GOOPT="-intgosize 32"
+ fi
+ ;;
+ esac
+ case $go_version in
+ go1.0* | go1 | go1.1*)
+ GOOPT="$GOOPT -use-shlib"
+ ;;
+ go1.2*)
+ GO12=true
+ ;;
+ go1.3* | go1.4*)
+ GO13=true
+ ;;
+ *)
+ GO15=true
+ ;;
+ esac
+ fi
+
+ AC_CHECK_PROGS(GCCGO, gccgo)
+
+ if test -n "$GCCGO" ; then
+ if $GCCGO --help 2>/dev/null | grep gccgo >/dev/null 2>&1 ; then
+ AC_MSG_CHECKING([whether gccgo version is too old])
+ go_version=[`$GO $GOVERSIONOPTION | sed -n '1p' | sed -e 's/^.* \([0-9.]*\) *$/\1/' -e 's/[.]//g'`]
+ if test "x$go_version" = x; then
+ AC_MSG_RESULT([could not determine gccgo version])
+ GCCGO=
+ elif test "$go_version" -lt 470; then
+ AC_MSG_RESULT([yes - minimum version is 4.7.0])
+ GCCGO=
+ else
+ AC_MSG_RESULT([no])
+ if test "$go_version" -lt 480; then
+ GCCGOOPT="-intgosize 32"
+ else
+ AC_CHECK_SIZEOF([void *], [4])
+ if test "$ac_cv_sizeof_void_p" = "8"; then
+ GCCGOOPT="-intgosize 64"
+ else
+ GCCGOOPT="-intgosize 32"
+ fi
+ fi
fi
fi
fi
@@ -2580,7 +2545,7 @@ AC_SUBST(SKIP_PHP)
SKIP_OCAML=
-if test -z "$OCAMLBIN" || test -z "$OCAMLINC" ; then
+if test -z "$OCAMLC" ; then
SKIP_OCAML="1"
fi
AC_SUBST(SKIP_OCAML)