The Ruby language doesn't support multiple inheritance, but
@@ -4585,7 +4603,7 @@ matching rules used for other kinds of features apply (see the chapter
on "Customization
Features") for more details).
-One of the most common issues in generating SWIG bindings for
@@ -4608,7 +4626,7 @@ to C++ (or vice versa) depending on what function or methods are
invoked. Clearly, developing a SWIG wrapper requires a thorough
understanding of how the underlying library manages memory.
-Ruby uses a mark and sweep garbage collector. When the garbage
@@ -4639,7 +4657,7 @@ any memory has been allocated in creating the underlying C struct or
C++ struct, then a "free" function must be defined that deallocates
this memory.
-As described above, memory management depends on clearly
@@ -4784,7 +4802,7 @@ public:
This code can be seen in swig/examples/ruby/tracking.
-The remaining parts of this section will use the class library
@@ -5010,7 +5028,7 @@ However, if you implement your own free functions (see below) you may
also have to call the SWIG_RubyRemoveTracking and RubyUnlinkObjects
methods.
-With a bit more testing, we see that our class library still
@@ -5139,7 +5157,7 @@ irb(main):016:0>
This code can be seen in swig/examples/ruby/mark_function.
-By default, SWIG creates a "free" function that is called when
@@ -5307,7 +5325,7 @@ been freed, and thus raises a runtime exception.
This code can be seen in swig/examples/ruby/free_function.
-As has been said, the Ruby GC runs and marks objects before
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index d1492d30a..876c0ac17 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -127,7 +127,7 @@ Supported Target Language Options
-lua - Generate Lua wrappers
-octave - Generate Octave wrappers
-perl5 - Generate Perl 5 wrappers
- -php7 - Generate PHP 7 wrappers
+ -php7 - Generate PHP 7 or later wrappers
-python - Generate Python wrappers
-r - Generate R (aka GNU S) wrappers
-ruby - Generate Ruby wrappers
@@ -826,6 +826,32 @@ However, for the same conservative reasons even a constant with a simple cast wi
+
+In such cases simply ignore the warning or suppress it using the normal warning suppression techniques.
+
+
The use of constant expressions is allowed, but SWIG does not evaluate
them. Rather, it passes them through to the output file and lets the C
@@ -1994,7 +2020,7 @@ and a more descriptive one, but the two functions are otherwise equivalent:
| regex:/pattern/subst/ |
String after (Perl-like) regex substitution operation. This function
- allows to apply arbitrary regular expressions to the identifier names. The
+ allows applying arbitrary regular expressions to the identifier names. The
pattern part is a regular expression in Perl syntax (as supported
by the Perl Compatible Regular Expressions (PCRE))
library and the subst string
@@ -3438,6 +3464,18 @@ initialization on module loading, you could write this:
%}
+
+Please note that some language backends (e.g. C# or Java) don't have any
+initialization function, hence you should define a global object performing
+the necessary initialization for them instead:
+
+
+
+%init %{
+ static struct MyInit { MyInit() { init_variables(); } } myInit;
+%}
+
+
diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html
index dc9ae0f7e..2244a0508 100644
--- a/Doc/Manual/SWIGPlus.html
+++ b/Doc/Manual/SWIGPlus.html
@@ -91,6 +91,7 @@ For additions to the original C++ standard, please read the
SWIG and C++11,
SWIG and C++14 and
SWIG and C++17 chapters.
+SWIG and C++20 chapters.
As a prerequisite,
you should first read the chapter SWIG Basics to see
how SWIG wraps ISO C. Support for C++ builds upon ISO C
@@ -3631,7 +3632,7 @@ Alternatively, you could expand the constructor template in selected instantiati
// Create default and conversion constructors
%extend pair<double, double> {
- %template(paird) pair<double, dobule>; // Default constructor
+ %template(paird) pair<double, double>; // Default constructor
%template(pairc) pair<int, int>; // Conversion constructor
};
@@ -3646,7 +3647,7 @@ instead:
// Create default and conversion constructors
%extend pair<double, double> {
- %template(pair) pair<double, dobule>; // Default constructor
+ %template(pair) pair<double, double>; // Default constructor
%template(pair) pair<int, int>; // Conversion constructor
};
diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html
index 88ab8043e..5c4ef6269 100644
--- a/Doc/Manual/Scilab.html
+++ b/Doc/Manual/Scilab.html
@@ -9,7 +9,7 @@
-
+
@@ -88,7 +88,7 @@ This chapter explains how to use SWIG for Scilab. After this introduction, you s
-
+
@@ -105,7 +105,7 @@ SWIG for Scilab supports C language. C++ is partially supported. See 35.2 Running SWIG
+
@@ -139,7 +139,7 @@ Note: a code in an %inline section is both parsed and wrapped by SWIG,
-
+
@@ -182,7 +182,7 @@ The swig executable has several other command line options you can use.
-
+
@@ -202,7 +202,7 @@ $ gcc -shared example_wrap.o -o libexample.so
Note: we supposed in this example that the path to the Scilab include directory is /usr/local/include/scilab (which is the case in a Debian environment), this should be changed for another environment.
-
+
@@ -226,7 +226,7 @@ Link done.
which means that Scilab has successfully loaded the shared library. The module functions and other symbols are now available in Scilab.
-
+
@@ -260,7 +260,7 @@ ans =
Note: for conciseness, we assume in the subsequent Scilab code examples that the modules have been beforehand built and loaded in Scilab.
-
+
@@ -320,10 +320,10 @@ $ swig -scilab -help
-
+
-
+
@@ -332,7 +332,7 @@ This means that functions, structs, classes, variables, etc... are interfaced th
There are a few exceptions, such as constants and enumerations, which can be wrapped directly as Scilab variables.
-
+
@@ -347,7 +347,7 @@ In these cases, the %rename directive
Note: truncations can be disabled by specifying the target version 6 of Scilab in the targetversion argument (i.e. -targetversion 6).
-
+
@@ -378,7 +378,7 @@ ans =
24.
-
+
@@ -431,7 +431,7 @@ In Scilab, parameters are passed by value. The output (and inout) parameters are
7.
-
+
@@ -480,7 +480,7 @@ int divide(int n, int d, int *OUTPUT, int *OUTPUT);
-
+
@@ -549,10 +549,10 @@ It works the same:
-
+
-
+
@@ -693,7 +693,7 @@ are mapped to Scilab variables, with the same name:
3.14
-
+
@@ -758,7 +758,7 @@ typedef enum { RED, BLUE, GREEN } color;
-
+
@@ -820,7 +820,7 @@ Note: the type name _p_FILE which means "pointer to FILE".
The user of a pointer is responsible for freeing it or, like in the example, closing any resources associated with it (just as is required in a C program).
-
+
@@ -861,7 +861,7 @@ ans =
-
+
@@ -877,7 +877,7 @@ Using the previous SWIG_this() and SWIG_ptr(), it is possible
-
+
@@ -986,7 +986,7 @@ Note: the pointer to the struct works as described in 35.3.8 C++ classes
+
@@ -1054,7 +1054,7 @@ Note: like structs, class pointers are mapped as described in 35.3.9 C++ inheritance
+
@@ -1129,7 +1129,7 @@ But we can use either use the get_perimeter() function of the parent cl
18.84
-
+
@@ -1169,7 +1169,7 @@ void magnify(Circle *circle, double factor) {
-
+
@@ -1227,7 +1227,7 @@ All these functions will return a pointer to an instance of Foo.
As the function spam7 returns a value, new instance of Foo has to be allocated, and a pointer on this instance is returned.
-
+
@@ -1286,7 +1286,7 @@ Then in Scilab:
More details on template support can be found in the templates documentation.
-
+
@@ -1339,7 +1339,7 @@ private:
-
+
@@ -1417,7 +1417,7 @@ Note: the nspace feature is not supp
-
+
@@ -1500,17 +1500,17 @@ More complex or custom exception types require specific exception typemaps to be
See the SWIG C++ documentation for more details.
-
+
The Standard Template Library (STL) is partially supported. See STL for more details.
-
+
-
+
@@ -1561,7 +1561,7 @@ The default behaviour is for SWIG to generate code that will give a runtime erro
-
+
@@ -1616,7 +1616,7 @@ void printArray(int values[], int len) {
[ 0 1 2 3 ]
-
+
@@ -1689,7 +1689,7 @@ void print_matrix(double **M, int nbRows, int nbCols) {
-
+
@@ -1782,7 +1782,7 @@ The remarks made earlier for arrays also apply here:
There is no control while converting double values to integers, double values are truncated without any checking or warning.
-
+
@@ -1982,7 +1982,7 @@ ans =
--> delete_PersonPtrSet(p);
-
+
@@ -2006,7 +2006,7 @@ For example, to initialize the module example:
--> example_Init();
-
+
@@ -2021,7 +2021,7 @@ To produce a dynamic module, when generating the wrapper, there are two possibil
the builder mode. In this mode, Scilab is responsible of building.
-
+
@@ -2034,7 +2034,7 @@ This mode is the best option to use when you have to integrate the module build
-
+
@@ -2074,14 +2074,14 @@ The command is:
$ swig -scilab -builder -buildercflags -I/opt/foo/include -builderldflags "-L/opt/foo/lib -lfoo" -buildersources baa1.cxx, baa2.cxx example.i
-
+
In this part we give some details about the generated Scilab scripts.
-
+
@@ -2106,7 +2106,7 @@ ilib_build(ilib_name, table, files, libs);
table: two column string matrix containing a table of pairs of 'scilab function name', 'C function name'.
-
+
@@ -2145,7 +2145,7 @@ clear get_file_path;
-
+
diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html
index 2cb1d2be4..13a9a2181 100644
--- a/Doc/Manual/Sections.html
+++ b/Doc/Manual/Sections.html
@@ -8,7 +8,7 @@
-Last update : SWIG-4.0.1 (in progress)
+Last update : SWIG-4.1.0 (in progress)
@@ -24,6 +24,7 @@ Last update : SWIG-4.0.1 (in progress)
- SWIG and C++11
- SWIG and C++14
- SWIG and C++17
+- SWIG and C++20
- The SWIG preprocessor
- The SWIG library
- Argument handling
diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html
index ba5ca3852..0a22afb18 100644
--- a/Doc/Manual/Tcl.html
+++ b/Doc/Manual/Tcl.html
@@ -7,7 +7,7 @@
-
+
@@ -84,7 +84,7 @@ Tcl 8.0 or a later release. Earlier releases of SWIG supported Tcl 7.x, but
this is no longer supported.
-
+
@@ -110,7 +110,7 @@ build a Tcl extension module. To finish building the module, you
need to compile this file and link it with the rest of your program.
-
+
@@ -128,7 +128,7 @@ this is the case, you should probably make a symbolic link so that tcl.h
-
+
@@ -164,7 +164,7 @@ The name of the module is specified using the %module directive or the
-module command line option.
-
+
@@ -230,7 +230,7 @@ minimal in most situations (and quite frankly not worth the extra
hassle in the opinion of this author).
-
+
@@ -358,7 +358,7 @@ to the default system configuration (this requires root access and you will need
the man pages).
-
+
@@ -441,7 +441,7 @@ erratic program behavior. If working with lots of software components, you
might want to investigate using a more formal standard such as COM.
-
+
@@ -468,7 +468,7 @@ also introduce problems on platforms that support more than one
linking standard (e.g., -o32 and -n32 on Irix).
-
+
@@ -487,7 +487,7 @@ option will append the prefix to the name when creating a command and
call it "Foo_bar".
-
+
@@ -509,7 +509,7 @@ When the -namespace option is used, objects in the module
are always accessed with the namespace name such as Foo::bar.
-
+
@@ -520,7 +520,7 @@ covers the process of using SWIG with Microsoft Visual C++.
although the procedure may be similar with other compilers.
-
+
@@ -578,7 +578,7 @@ MSDOS > tclsh80
%
-
+
@@ -641,7 +641,7 @@ to get you started. With a little practice, you'll be making lots of
Tcl extensions.
-
+
@@ -652,7 +652,7 @@ classes. This section briefly covers the essential aspects of this
wrapping.
-
+
@@ -686,7 +686,7 @@ To fix this, supply an extra argument to load like this:
-
+
@@ -711,7 +711,7 @@ like you think it does:
%
-
+
@@ -791,7 +791,7 @@ extern char *path; // Read-only (due to %immutable)
-
+
@@ -875,7 +875,7 @@ When an identifier name is given, it is used to perform an implicit hash-table l
conversion. This allows the global statement to be omitted.
-
+
@@ -971,7 +971,7 @@ C-style cast may return a bogus result whereas as the C++-style cast will return
None if the conversion can't be performed.
-
+
@@ -1253,7 +1253,7 @@ Note: Tcl only destroys the underlying object if it has ownership. See the
memory management section that appears shortly.
-
+
@@ -1319,7 +1319,7 @@ In Tcl, the static member is accessed as follows:
-
+
@@ -1368,7 +1368,7 @@ For instance:
It is safe to use multiple inheritance with SWIG.
-
+
@@ -1422,7 +1422,7 @@ to hold the result and a pointer is returned (Tcl will release this memory
when the return value is garbage collected).
-
+
@@ -1545,7 +1545,7 @@ first declaration takes precedence.
Please refer to the "SWIG and C++" chapter for more information about overloading.
-
+
@@ -1647,7 +1647,7 @@ There are ways to make this operator appear as part of the class using the %
Keep reading.
-
+
@@ -1711,7 +1711,7 @@ utilizes thousands of small deeply nested namespaces each with
identical symbol names, well, then you get what you deserve.
-
+
@@ -1763,7 +1763,7 @@ More details can be found in the SWIG and C++
examples will appear later.
-
+
@@ -1847,7 +1847,7 @@ simply use the __deref__() method. For example:
-
+
@@ -1860,7 +1860,7 @@ of low-level details were omitted. This section provides a brief overview
of how the proxy classes work.
-
+
@@ -1925,7 +1925,7 @@ function. This allows objects to be encapsulated objects that look a lot like
as shown in the last section.
-
+
@@ -2113,7 +2113,7 @@ typemaps--an advanced topic discussed later.
-
+
@@ -2301,7 +2301,7 @@ set c [lindex $dim 1]
-
+
@@ -2435,7 +2435,7 @@ Since SWIG's exception handling is user-definable, you are not limited to C++ ex
See the chapter on "Customization Features" for more examples.
-
+
@@ -2452,7 +2452,7 @@ Typemaps are only used if you want to change some aspect of the primitive
C-Tcl interface.
-
+
@@ -2572,7 +2572,7 @@ parameter is omitted):
-
+
@@ -2710,7 +2710,7 @@ Initialize an argument to a value before any conversions occur.
Examples of these methods will appear shortly.
-
+
@@ -2781,7 +2781,7 @@ properly assigned.
The Tcl name of the wrapper function being created.
-
+
@@ -2843,7 +2843,7 @@ argv[2] = Larry
3
-
+
@@ -2885,7 +2885,7 @@ result, a Tcl function using these typemaps will work like this :
%
-
+
@@ -2961,7 +2961,7 @@ int Tcl_IsShared(Tcl_Obj *obj);
-
+
@@ -3045,7 +3045,7 @@ work)
-
+
@@ -3127,7 +3127,7 @@ For example:
-
+
@@ -3199,7 +3199,7 @@ As a final note, most SWIG examples do not yet use the
to use the load command instead.
-
+
@@ -3298,7 +3298,7 @@ danger of blowing something up (although it is easily accomplished
with an out of bounds array access).
-
+
@@ -3419,7 +3419,7 @@ short, but clever Tcl script can be combined with SWIG to do many
interesting things.
-
+
diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html
index 8a31dbf10..a12ede553 100644
--- a/Doc/Manual/Typemaps.html
+++ b/Doc/Manual/Typemaps.html
@@ -7,7 +7,7 @@
-
+
@@ -102,7 +102,7 @@
-
+
@@ -119,7 +119,7 @@ to re-read the earlier chapters if you have found your way to this
chapter with only a vague idea of what SWIG already does by default.
-
+
@@ -212,7 +212,7 @@ to read the extension documentation for your favorite language to know
how it works (an exercise left to the reader).
-
+
@@ -313,7 +313,7 @@ parts of the generated wrapper functions. Because arbitrary code can be insert
possible to completely change the way in which values are converted.
-
+
@@ -415,7 +415,7 @@ In this case, a single input object is expanded into a pair of C arguments. Thi
provides a hint to the unusual variable naming scheme involving $1, $2, and so forth.
-
+
@@ -493,7 +493,7 @@ typedef int size_t;
then SWIG already knows that the int typemaps apply. You don't have to do anything.
-
+
@@ -605,7 +605,7 @@ typemaps that expand upon this list. For example, the Java module defines a var
aspects of the Java bindings. Consult language specific documentation for further details.
-
+
@@ -668,7 +668,7 @@ void wrap_foo(char *s, int x) {
-
+
@@ -686,7 +686,7 @@ SWIG can also be viewed as has having a second set of aspects based around %exception are also cross-cutting concerns as they encapsulate code that can be used to add logging or exception handling to any function.
-
+
@@ -706,14 +706,14 @@ of "The C Programming Language" by Kernighan and Ritchie or
"The C++ Programming Language" by Stroustrup before going any further.
-
+
This section describes the behavior of the %typemap directive itself.
-
+
@@ -826,7 +826,7 @@ Admittedly, it's not the most readable syntax at first glance. However, the pur
individual pieces will become clear.
-
+
@@ -876,7 +876,7 @@ class Foo {
-
+
@@ -934,7 +934,7 @@ The patterns for %apply follow the same rules as for %typemap.
-
+
@@ -968,7 +968,7 @@ For example:
after the clear operation.
-
+
@@ -1048,7 +1048,7 @@ It should be noted that for scoping to work, SWIG has to know that stringclass string.
-
+
@@ -1056,7 +1056,7 @@ The section describes the pattern matching rules by which C/C++ datatypes are as
The matching rules can be observed in practice by using the debugging options also described.
-
+
@@ -1155,7 +1155,7 @@ void F(int x[1000]); // int [ANY] rule (typemap 5)
stripped all qualifiers in one step.
-
+
@@ -1330,7 +1330,7 @@ void go(Struct aStruct);
-
+
@@ -1468,7 +1468,7 @@ Finally the best way to view the typemap matching rules in action is via the
-
+
@@ -1498,7 +1498,7 @@ but all subsequent arguments must match exactly.
-
+
@@ -1657,7 +1657,7 @@ are similar to those for specialized template handling.
-
+
@@ -1870,7 +1870,7 @@ Also the types may be displayed slightly differently - char const * and
-
+
@@ -1878,7 +1878,7 @@ This section describes rules by which typemap code is inserted into
the generated wrapper code.
-
+
@@ -1956,7 +1956,7 @@ a block scope when it is emitted. This sometimes results in a less complicated
Note that only the third of the three typemaps have the typemap code passed through the SWIG preprocessor.
-
+
@@ -2123,7 +2123,7 @@ each type must have its own local variable declaration.
-
+
@@ -2375,7 +2375,7 @@ Another approach, which only works for arrays is to use the $1_basetype
-
+
@@ -2387,7 +2387,7 @@ it is done during the SWIG parsing/compilation stages.
The following special variable macros are available across all language modules.
-
+
@@ -2398,7 +2398,7 @@ For example, $descriptor(std::vector<int> *) will expand into Run-time type checker usage section.
-
+
@@ -2456,7 +2456,7 @@ The result is the following expansion
-
+
@@ -2483,7 +2483,7 @@ is equivalent to the following as $*1_ltype expands to unsigned int
-
+
@@ -2525,7 +2525,7 @@ which then expands to:
-
+
@@ -2533,7 +2533,7 @@ The family of typemaps recognized by a language module may vary. However,
the following typemap methods are nearly universal:
-
+
@@ -2593,7 +2593,7 @@ Usually numinputs is not specified, whereupon the default value is 1, t
is the same as the old "ignore" typemap.
-
+
@@ -2620,7 +2620,7 @@ If you define new "in" typemaps and your program uses overloaded method
"typecheck" typemaps. More details about this follow in the Typemaps and overloading section.
-
+
@@ -2651,7 +2651,7 @@ $symname - Name of function/method being wrapped
The "out" typemap supports an optional attribute flag called "optimal". This is for code optimisation and is detailed in the Optimal code generation when returning by value section.
-
+
@@ -2670,7 +2670,7 @@ For example:
-
+
@@ -2703,7 +2703,7 @@ See the Default/optional arguments sec
for further information on default argument wrapping.
-
+
@@ -2722,7 +2722,7 @@ converted. For example:
-
+
@@ -2768,7 +2768,7 @@ return values are often appended to return value of the function.
See the typemaps.i library file for examples.
-
+
@@ -2801,7 +2801,7 @@ be used in other typemaps whenever a wrapper function needs to abort
prematurely.
-
+
@@ -2830,7 +2830,7 @@ string *foo();
See Object ownership and %newobject for further details.
-
+
@@ -2869,7 +2869,7 @@ This approach is an alternative to using the "newfree" typemap and %newobjec
is no need to list all the functions that require the memory cleanup, it is purely done on types.
-
+
@@ -2891,7 +2891,7 @@ It is rarely necessary to write "memberin" typemaps---SWIG already provides
a default implementation for arrays, strings, and other objects.
-
+
@@ -2899,7 +2899,7 @@ The "varin" typemap is used to convert objects in the target language to C for t
purposes of assigning to a C/C++ global variable. This is implementation specific.
-
+
@@ -2907,7 +2907,7 @@ The "varout" typemap is used to convert a C/C++ object to an object in the targe
language when reading a C/C++ global variable. This is implementation specific.
-
+
@@ -2957,7 +2957,7 @@ Note that if your methods do not have an exception specification but they do thr
Please also see the Exception handling with %exception section for another way to handle exceptions.
-
+
@@ -2965,7 +2965,7 @@ This section contains a few examples. Consult language module documentation
for more examples.
-
+
@@ -3224,7 +3224,7 @@ Now, you will find that member access is quite nice:
useless and has since been eliminated. To return structure members, simply use the "out" typemap.
-
+
@@ -3272,7 +3272,7 @@ a NULL pointer. As a result, SWIG can often prevent a potential
segmentation faults or other run-time problems by raising an exception
rather than blindly passing values to the underlying C/C++ program.
-
+
@@ -3302,7 +3302,7 @@ The example above also shows a common approach of issuing a warning for an as ye
%typemap(ruby, in) int "$1 = NUM2INT($input);".
-
+
@@ -3491,7 +3491,7 @@ example.i:7: Warning 475: optimal attribute usage in the out typemap.
However, it doesn't always get it right, for example when $1 is within some commented out code.
-
+
@@ -3768,7 +3768,7 @@ with non-consecutive C/C++ arguments; a workaround such as a helper function re-
the arguments to make them consecutive will need to be written.
-
+
@@ -3777,7 +3777,7 @@ See the information in the issuing warnings
-
+
@@ -4113,7 +4113,7 @@ fragment usage unless a desire to really get to grips
with some powerful but tricky macro and fragment usage that is used in parts of the SWIG typemap library.
-
+
@@ -4146,7 +4146,7 @@ struct A {
-
+
@@ -4192,7 +4192,7 @@ The interested (or very brave) reader can take a look at the fragments.swg file
-
+
@@ -4218,7 +4218,7 @@ language modules.
Modules can be unloaded from the type system.
-
+
@@ -4412,7 +4412,7 @@ structures rather than creating new ones. These swig_module_info
structures are chained together in a circularly linked list.
-
+
This section covers how to use these functions from typemaps. To learn how to
@@ -4508,7 +4508,7 @@ probably just look at the output of SWIG to get a better sense for how types are
managed.
-
+
@@ -4630,37 +4630,69 @@ To support dynamic dispatch, SWIG first defines a general purpose type hierarchy
Symbolic Name Precedence Value
------------------------------ ------------------
-SWIG_TYPECHECK_POINTER 0
-SWIG_TYPECHECK_VOIDPTR 10
-SWIG_TYPECHECK_BOOL 15
-SWIG_TYPECHECK_UINT8 20
-SWIG_TYPECHECK_INT8 25
-SWIG_TYPECHECK_UINT16 30
-SWIG_TYPECHECK_INT16 35
-SWIG_TYPECHECK_UINT32 40
-SWIG_TYPECHECK_INT32 45
-SWIG_TYPECHECK_UINT64 50
-SWIG_TYPECHECK_INT64 55
-SWIG_TYPECHECK_UINT128 60
-SWIG_TYPECHECK_INT128 65
-SWIG_TYPECHECK_INTEGER 70
-SWIG_TYPECHECK_FLOAT 80
-SWIG_TYPECHECK_DOUBLE 90
-SWIG_TYPECHECK_COMPLEX 100
-SWIG_TYPECHECK_UNICHAR 110
-SWIG_TYPECHECK_UNISTRING 120
-SWIG_TYPECHECK_CHAR 130
-SWIG_TYPECHECK_STRING 140
-SWIG_TYPECHECK_BOOL_ARRAY 1015
-SWIG_TYPECHECK_INT8_ARRAY 1025
-SWIG_TYPECHECK_INT16_ARRAY 1035
-SWIG_TYPECHECK_INT32_ARRAY 1045
-SWIG_TYPECHECK_INT64_ARRAY 1055
-SWIG_TYPECHECK_INT128_ARRAY 1065
-SWIG_TYPECHECK_FLOAT_ARRAY 1080
-SWIG_TYPECHECK_DOUBLE_ARRAY 1090
-SWIG_TYPECHECK_CHAR_ARRAY 1130
-SWIG_TYPECHECK_STRING_ARRAY 1140
+SWIG_TYPECHECK_POINTER 0
+SWIG_TYPECHECK_ITERATOR 5
+SWIG_TYPECHECK_VOIDPTR 10
+SWIG_TYPECHECK_BOOL 15
+SWIG_TYPECHECK_UINT8 20
+SWIG_TYPECHECK_INT8 25
+SWIG_TYPECHECK_UINT16 30
+SWIG_TYPECHECK_INT16 35
+SWIG_TYPECHECK_UINT32 40
+SWIG_TYPECHECK_INT32 45
+SWIG_TYPECHECK_SIZE 47
+SWIG_TYPECHECK_PTRDIFF 48
+SWIG_TYPECHECK_UINT64 50
+SWIG_TYPECHECK_INT64 55
+SWIG_TYPECHECK_UINT128 60
+SWIG_TYPECHECK_INT128 65
+SWIG_TYPECHECK_INTEGER 70
+SWIG_TYPECHECK_FLOAT 80
+SWIG_TYPECHECK_DOUBLE 90
+SWIG_TYPECHECK_CPLXFLT 95
+SWIG_TYPECHECK_CPLXDBL 100
+SWIG_TYPECHECK_COMPLEX 105
+SWIG_TYPECHECK_UNICHAR 110
+SWIG_TYPECHECK_STDUNISTRING 115
+SWIG_TYPECHECK_UNISTRING 120
+SWIG_TYPECHECK_CHAR 130
+SWIG_TYPECHECK_STDSTRING 135
+SWIG_TYPECHECK_STRING 140
+SWIG_TYPECHECK_PAIR 150
+SWIG_TYPECHECK_STDARRAY 155
+SWIG_TYPECHECK_VECTOR 160
+SWIG_TYPECHECK_DEQUE 170
+SWIG_TYPECHECK_LIST 180
+SWIG_TYPECHECK_SET 190
+SWIG_TYPECHECK_MULTISET 200
+SWIG_TYPECHECK_MAP 210
+SWIG_TYPECHECK_MULTIMAP 220
+SWIG_TYPECHECK_STACK 230
+SWIG_TYPECHECK_QUEUE 240
+SWIG_TYPECHECK_BOOL_ARRAY 1015
+SWIG_TYPECHECK_INT8_ARRAY 1025
+SWIG_TYPECHECK_INT16_ARRAY 1035
+SWIG_TYPECHECK_INT32_ARRAY 1045
+SWIG_TYPECHECK_INT64_ARRAY 1055
+SWIG_TYPECHECK_INT128_ARRAY 1065
+SWIG_TYPECHECK_FLOAT_ARRAY 1080
+SWIG_TYPECHECK_DOUBLE_ARRAY 1090
+SWIG_TYPECHECK_CHAR_ARRAY 1130
+SWIG_TYPECHECK_STRING_ARRAY 1140
+SWIG_TYPECHECK_OBJECT_ARRAY 1150
+SWIG_TYPECHECK_BOOL_PTR 2015
+SWIG_TYPECHECK_UINT8_PTR 2020
+SWIG_TYPECHECK_INT8_PTR 2025
+SWIG_TYPECHECK_UINT16_PTR 2030
+SWIG_TYPECHECK_INT16_PTR 2035
+SWIG_TYPECHECK_UINT32_PTR 2040
+SWIG_TYPECHECK_INT32_PTR 2045
+SWIG_TYPECHECK_UINT64_PTR 2050
+SWIG_TYPECHECK_INT64_PTR 2055
+SWIG_TYPECHECK_FLOAT_PTR 2080
+SWIG_TYPECHECK_DOUBLE_PTR 2090
+SWIG_TYPECHECK_CHAR_PTR 2130
+SWIG_TYPECHECK_SWIGOBJECT 5000
@@ -4815,7 +4847,7 @@ Subsequent "in" typemaps would then perform more extensive type-checking.
-
+
@@ -4917,7 +4949,7 @@ Otherwise both can be wrapped by removing the overloading name ambiguity by rena
The 'equivalent' attribute is used in the implementation for the shared_ptr smart pointer library.
-
+
@@ -5022,7 +5054,7 @@ will delete the typemaps for all the typemap methods; namely "in", "check" and "
-
+
@@ -5059,7 +5091,7 @@ sure that the typemaps sharing information have exactly the same types and names
-
+
@@ -5119,7 +5151,7 @@ will also match the typemap. One work around is to create an interface file tha
the method, but gives the argument a name other than self.
-
+
diff --git a/Doc/Manual/Varargs.html b/Doc/Manual/Varargs.html
index 9f20469d2..620f2e5a0 100644
--- a/Doc/Manual/Varargs.html
+++ b/Doc/Manual/Varargs.html
@@ -7,7 +7,7 @@
-
+
@@ -43,7 +43,7 @@ added in SWIG-1.3.12. Most other wrapper generation tools have
wisely chosen to avoid this issue.
-
+
@@ -140,7 +140,7 @@ List make_list(const char *s, ...) {
-
+
@@ -233,7 +233,7 @@ can also support real varargs wrapping (with stack-frame manipulation) if you
are willing to get hands dirty. Keep reading.
-
+
@@ -302,7 +302,7 @@ Read on for further solutions.
-
+
@@ -413,7 +413,7 @@ mixed argument types such as printf(). Providing general purpose
wrappers to such functions presents special problems (covered shortly).
-
+
@@ -593,7 +593,7 @@ really want to elevate your guru status and increase your job
security, continue to the next section.
-
+
@@ -845,7 +845,7 @@ provide an argument number for the first extra argument. This can be used to in
values. Please consult the chapter on each language module for more details.
-
+
@@ -899,7 +899,7 @@ int my_vprintf(const char *fmt, ...) {
-
+
@@ -968,7 +968,7 @@ design or to provide an alternative interface using a helper function than it is
fully general wrapper to a varargs C++ member function.
-
+
diff --git a/Doc/Manual/Warnings.html b/Doc/Manual/Warnings.html
index c63d7de0c..02197f1cb 100644
--- a/Doc/Manual/Warnings.html
+++ b/Doc/Manual/Warnings.html
@@ -7,7 +7,7 @@
-
+
@@ -37,7 +37,7 @@
-
+
@@ -57,7 +57,7 @@ where the generated wrapper code will probably compile, but it may not
work like you expect.
-
+
@@ -149,7 +149,7 @@ your interface. Ignore the warning messages at your own peril.
-
+
@@ -222,7 +222,7 @@ that is, any warnings suppressed or added in %warnfilter, #pragma S
or the -w option.
-
+
@@ -276,7 +276,7 @@ example.i:24: Warning 901: You are really going to regret this usage of blah * s
-
+
@@ -311,7 +311,7 @@ or
-
+
@@ -328,7 +328,7 @@ no obvious recovery. There is no mechanism for suppressing error
messages.
-
+
@@ -337,7 +337,7 @@ option. This will cause SWIG to exit with a non successful exit code if a
warning is encountered.
-
+
@@ -356,10 +356,10 @@ $ swig -python -Fmicrosoft example.i
example.i(4) : Syntax error in input(1).
-
+
-
+
@@ -387,7 +387,7 @@ example.i(4) : Syntax error in input(1).
- 126. The 'nestedworkaround' feature is deprecated.
-
+
@@ -399,7 +399,7 @@ example.i(4) : Syntax error in input(1).
- 206. Unexpected tokens after #directive directive.
-
+
@@ -476,14 +476,14 @@ example.i(4) : Syntax error in input(1).
- 395. operator delete[] ignored.
-
+
- 401. Nothing known about class 'name'. Ignored.
- 402. Base class 'name' is incomplete.
- 403. Class 'name' might be abstract.
-
- 450. Deprecated typemap feature ($source/$target).
+
- 450. Reserved
- 451. Setting const char * variable may leak memory.
- 452. Reserved
- 453. Can't apply (pattern). No typemaps are defined.
@@ -507,7 +507,7 @@ example.i(4) : Syntax error in input(1).
-
+
@@ -538,7 +538,7 @@ example.i(4) : Syntax error in input(1).
- 525. Destructor declaration is final, name cannot be a director class.
-
+
@@ -549,7 +549,7 @@ example.i(4) : Syntax error in input(1).
- 564: Error parsing Doxygen command command: error text. Command ignored."
-
+
@@ -600,14 +600,14 @@ example.i(4) : Syntax error in input(1).
- 871. Unrecognized pragma pragma. (Php).
-
+
These numbers can be used by your own application.
-
+
diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html
index 800e2e420..eae9ffb84 100644
--- a/Doc/Manual/Windows.html
+++ b/Doc/Manual/Windows.html
@@ -1,4 +1,4 @@
-
+
Getting started on Windows
@@ -33,9 +33,10 @@
@@ -77,10 +78,10 @@ If you want to build your own swig.exe have a look at examples using Cygwin.
@@ -95,9 +96,11 @@ More information on each of the examples is available with the examples distribu
Ensure the SWIG executable is as supplied in the SWIG root directory in order for the examples to work.
Most languages require some environment variables to be set before running Visual C++.
Note that Visual C++ must be re-started to pick up any changes in environment variables.
-Open up an example .dsp file, Visual C++ will create a workspace for you (.dsw file).
-Ensure the Release build is selected then do a Rebuild All from the Build menu.
-The required environment variables are displayed with their current values.
+Open up an example .dsp file, Visual C++ will prompt you to upgrade the project and convert
+it into an MSBuild project (.vcxproj file) and Solution (.sln file).
+Note that older versions of Visual C++ will simply create a workspace for you (.dsw file).
+Ensure the Release build is selected then do a Rebuild Solution from the Build menu.
+The required environment variables are displayed with their current values during the build.
The list of required environment variables for each module language is also listed below.
@@ -111,7 +114,7 @@ If you are interested in how the project files are set up there is explanatory i
The C# examples do not require any environment variables to be set as a C# project file is included.
-Just open up the .sln solution file in Visual Studio .NET 2003 or later, select Release Build, and do a Rebuild All from the Build menu.
+Just open up the .sln solution file in Visual Studio 2005 or later, select Release Build, and do a Rebuild Solution from the Build menu.
The accompanying C# and C++ project files are automatically used by the solution file.
@@ -224,7 +227,130 @@ This information is provided for those that want to modify the SWIG source code
Normally this is not needed, so most people will want to ignore this section.
-
+
+
+
+
+SWIG can also be built using CMake and Visual Studio rather than autotools. As with the other approaches to
+building SWIG the dependencies need to be installed. The steps below are one of a number of ways of installing the dependencies without requiring Cygwin or MinGW.
+For fully working build steps always check the Continuous Integration setups currently detailed in the Appveyor YAML file.
+
+
+
+ -
+ Install Nuget from https://www.nuget.org/downloads (v5.8.1 is used in this example, and installed to C:\Tools). Nuget is the package manager
+ for .NET, but allows us to easily install PCRE and other dependencies required by SWIG.
+
+ -
+ Install CMake using the following command:
C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
+ Alternatively you can download CMake from https://cmake.org/download/.
+
+ -
+ Install Bison using the following command:
C:\Tools\nuget install bison-win32 -Version 2.4.1.1 -OutputDirectory C:\Tools\bison
+ Alternatively download Bison from https://sourceforge.net/projects/gnuwin32/files/bison/ (2.4.1 is used in this example)
+ and save to a folder e.g. C:\Tools\Bison
+
+ -
+ Install PCRE using Nuget using the following command:
C:\Tools\nuget install pcre -Version 8.33.0.1 -OutputDirectory C:\Tools\pcre .
+ Alternatively, use WITH_PCRE option to disable PCRE support if you are sure not to need it.
+
+ -
+ We will also need the SWIG source code. Either download a zipped archive from GitHub, or if git is installed clone the latest codebase
+ using
git clone https://github.com/swig/swig.git
+ In this example we are assuming the source code is available at C:\swig
+
+
+
+
+ We are assuming Visual Studio 2017 is installed. For other versions of Visual Studio change "Visual Studio 15 2017 Win64" to the relevant
+ Visual Studio Generator.
+ Now we have all the required dependencies we can build SWIG using the commands below. We add the required build tools to the system PATH, and then
+ build a Release version of SWIG. If all runs successfully a new swig.exe should be generated in a /Release folder.
+
+
+
+
+cd C:\swig
+SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\bison-win32.2.4.1.1\tools\native\bin;%PATH%
+SET PCRE_ROOT=C:\Tools\pcre\pcre.8.33.0.1\build\native
+SET PCRE_PLATFORM=x64
+cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE_STATIC" ^
+ -DPCRE_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE_LIBRARY=%PCRE_ROOT%/lib/v110/%PCRE_PLATFORM%/Release/static/utf8/pcre8.lib .
+cmake --build . --config Release
+
+REM to test the exe
+cd /Release
+swig.exe -help
+
+
+
+
+ In addition to Release builds you can create a Debug build using:
+
+
+ cmake --build . --config Debug
+
+
+ A Visual Studio solution file should be generated named swig.sln. This can be opened and debugged by running the swig project and setting the
+ Debugging Command Arguments. For example to debug one of the test-suite .i files included with the SWIG source use the following:
+
+
+ -python -c++ -o C:\Temp\doxygen_parsing.cpp C:\swig\Examples\test-suite\doxygen_parsing.i
+
+
+
+
+
+
+Download and install MSYS2 from www.msys2.org (tested with version msys2-x86_64-20201109).
+Launch the MSYS2 shell.
+
+
+Install the packages needed to build swig:
+
+
+
+
+pacman -S git autoconf automake bison gcc make pcre-devel
+
+
+
+
+Clone the repository to /usr/src/:
+
+
+
+
+mkdir /usr/src/
+cd /usr/src/
+git clone https://github.com/swig/swig.git
+
+
+
+
+Configure and build:
+
+
+
+
+cd /usr/src/swig
+./autogen.sh
+./configure
+make
+
+
+
+
+Finally you may also want to install SWIG:
+
+
+
+
+
@@ -342,7 +468,7 @@ make
-
+
@@ -353,15 +479,6 @@ Note that the Cygwin environment will also allow one to regenerate the autotool
These files are generated using the autogen.sh script and will only need regenerating in circumstances such as changing the build system.
-
-
-
-
-If you don't want to install Cygwin or MinGW, use a different compiler to build
-SWIG. For example, all the source code files can be added to a Visual C++ project
-file in order to build swig.exe from the Visual C++ IDE.
-
-
diff --git a/Doc/Manual/chapters b/Doc/Manual/chapters
index e38a9cd5f..f888848d5 100644
--- a/Doc/Manual/chapters
+++ b/Doc/Manual/chapters
@@ -7,6 +7,7 @@ SWIGPlus.html
CPlusPlus11.html
CPlusPlus14.html
CPlusPlus17.html
+CPlusPlus20.html
Preprocessor.html
Library.html
Arguments.html
diff --git a/Doc/Manual/style.css b/Doc/Manual/style.css
index 45e51e35b..ffadb87e2 100644
--- a/Doc/Manual/style.css
+++ b/Doc/Manual/style.css
@@ -65,6 +65,10 @@ div.diagram {
font-family: "Courier New", Courier, "Courier 10 Pitch", monospace;
}
+div.diagram li {
+ margin-left: 0;
+}
+
ul li p {
margin-left: 0;
margin-right: 0;
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index a66a58e2c..b1c18e1b2 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -58,6 +58,7 @@ INTERFACE =
INTERFACEDIR =
INTERFACEPATH = $(SRCDIR)$(INTERFACEDIR)$(INTERFACE)
SWIGOPT =
+PCHSUPPORT = @PCHSUPPORT@
# SWIG_LIB_DIR and SWIGEXE must be explicitly set by Makefiles using this Makefile
SWIG_LIB_DIR = ./Lib
@@ -164,6 +165,7 @@ TCL_SO = @TCL_SO@
TCLLDSHARED = @TCLLDSHARED@
TCLCXXSHARED = @TCLCXXSHARED@
TCL_SCRIPT = $(SRCDIR)$(RUNME).tcl
+TCL_LINK = @TCLLINK@
# -----------------------------------------------------------
# Build a new version of the tclsh shell
@@ -186,7 +188,7 @@ tclsh_cpp: $(SRCDIR_SRCS)
tcl: $(SRCDIR_SRCS)
$(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ISRCS) $(INTERFACEPATH)
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE)
- $(TCLLDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO)
+ $(TCLLDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) $(TCL_LINK)
# -----------------------------------------------------------
# Build a Tcl7.5 dynamic loadable module for C++
@@ -195,7 +197,7 @@ tcl: $(SRCDIR_SRCS)
tcl_cpp: $(SRCDIR_SRCS)
$(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ICXXSRCS) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE)
- $(TCLCXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO)
+ $(TCLCXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) $(TCL_LINK)
# -----------------------------------------------------------------
# Run Tcl example
@@ -380,13 +382,7 @@ python_static_cpp: $(SRCDIR_SRCS)
# Running a Python example
# -----------------------------------------------------------------
-ifeq (,$(PY3))
- PYSCRIPT = $(RUNME).py
-else
- PYSCRIPT = $(RUNME)3.py
-endif
-
-PY2TO3 = @PY2TO3@ `@PY2TO3@ -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'`
+PYSCRIPT = $(RUNME).py
python_run: $(PYSCRIPT)
ifneq (,$(PYCODESTYLE))
@@ -399,10 +395,6 @@ $(RUNME).py: $(SRCDIR)$(RUNME).py
cp $< $@
endif
-$(RUNME)3.py: $(SRCDIR)$(RUNME).py
- cp $< $@
- $(PY2TO3) -w $@ >/dev/null 2>&1
-
# -----------------------------------------------------------------
# Version display
# -----------------------------------------------------------------
@@ -420,7 +412,6 @@ python_clean:
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@ *$(PYTHON_SO)
rm -f $(TARGET).py
- if test -f $(SRCDIR)$(RUNME).py; then rm -f $(RUNME)3.py $(RUNME)3.py.bak; fi
case "x$(SRCDIR)" in x|x./);; *) rm -f $(RUNME).py;; esac
@@ -438,14 +429,37 @@ OCTAVE_SO = @OCTAVE_SO@
OCTAVE_SCRIPT = $(SRCDIR)$(RUNME).m
+# ----------------------------------------------------------------
+# Pre-compile Octave headers, if supported
+# ----------------------------------------------------------------
+
+ifeq (yes,$(PCHSUPPORT))
+
+octave_precompile_headers:
+ echo "precompiling $(OCTHEADERS)"
+ cp -f $(OCTHEADERSSRC) $(OCTHEADERS)
+ if $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(OCTAVE_CXX) $(OCTHEADERS); then \
+ : ; \
+ else \
+ rm -f $(OCTHEADERSGCH); \
+ exit 1; \
+ fi
+
+else
+
+octave_precompile_headers:
+ echo "precompiling Octave headers not supported"; exit 1
+
+endif
+
# ----------------------------------------------------------------
# Build a C dynamically loadable module
# Note: Octave requires C++ compiler when compiling C wrappers
# ----------------------------------------------------------------
octave: $(SRCDIR_SRCS)
- $(SWIG) -octave $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(INCLUDES) $(OCTAVE_CXX)
+ $(SWIG) -octave $(SWIGOCTHDROPT) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -g -c $(IOCTHEADERS) $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(INCLUDES) $(OCTAVE_CXX)
$(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS) $(INCLUDES)
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
@@ -454,8 +468,8 @@ octave: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
octave_cpp: $(SRCDIR_SRCS)
- $(SWIG) -c++ -octave $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(OCTAVE_CXX)
+ $(SWIG) -c++ -octave $(SWIGOCTHDROPT) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -g -c $(IOCTHEADERS) $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(OCTAVE_CXX)
$(CXXSHARED) -g $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
# -----------------------------------------------------------------
@@ -481,6 +495,7 @@ octave_clean:
rm -f *_wrap* *~ .~* myoctave@EXEEXT@ *.pyc
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@ *$(OCTAVE_SO)
+ rm -f $(OCTHEADERS) $(OCTHEADERSGCH)
##################################################################
##### GUILE ######
@@ -1031,20 +1046,21 @@ ruby_clean:
rm -f *.@OBJEXT@ *$(RUBY_SO)
##################################################################
-##### PHP7 ######
+##### PHP ######
##################################################################
PHP = @PHP@
PHP_INCLUDE = @PHPINC@
PHP_SO = @PHP_SO@
PHP_SCRIPT = $(SRCDIR)$(RUNME).php
+PHP_EXTENSION = example$(PHP_SO)
# -------------------------------------------------------------------
# Build a PHP dynamically loadable module (C)
# -------------------------------------------------------------------
php: $(SRCDIR_SRCS)
- $(SWIG) -php7 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(SWIG) -php $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PHP_INCLUDE)
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO)
@@ -1053,7 +1069,7 @@ php: $(SRCDIR_SRCS)
# --------------------------------------------------------------------
php_cpp: $(SRCDIR_SRCS)
- $(SWIG) -php7 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(SWIG) -php -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP_INCLUDE)
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO)
@@ -1062,7 +1078,7 @@ php_cpp: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
php_run:
- $(RUNTOOL) $(PHP) -n -q -d extension_dir=. -d safe_mode=Off -d display_errors=stderr $(PHP_SCRIPT) $(RUNPIPE)
+ $(RUNTOOL) $(PHP) -n -d extension_dir=. -d extension=$(PHP_EXTENSION) -d display_errors=stderr -r 'set_error_handler(function($$n,$$s,$$f,$$l){if($$f!==Null){print$$f;if($$l!==Null)print":$$l";print": ";}print"$$s\n";exit(1);});include($$argv[1]);' $(PHP_SCRIPT) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@@ -1234,46 +1250,6 @@ lua_clean:
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *$(LUA_SO)
-##################################################################
-##### ALLEGRO CL ######
-##################################################################
-
-ALLEGROCL = @ALLEGROCLBIN@
-ALLEGROCL_SCRIPT=$(RUNME).lisp
-
-allegrocl: $(SRCDIR_SRCS)
- $(SWIG) -allegrocl -cwrap $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCDIR_SRCS)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
-
-allegrocl_cpp: $(SRCDIR_SRCS)
- $(SWIG) -c++ -allegrocl $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES)
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
-
-# -----------------------------------------------------------------
-# Run ALLEGRO CL example
-# -----------------------------------------------------------------
-
-allegrocl_run:
- $(RUNTOOL) $(ALLEGROCL) -batch -s $(ALLEGROCL_SCRIPT) $(RUNPIPE)
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-allegrocl_version:
- $(ALLEGROCL) --version
-
-# -----------------------------------------------------------------
-# Cleaning the ALLEGRO CL examples
-# -----------------------------------------------------------------
-
-allegrocl_clean:
- rm -f *_wrap* *~ .~*
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@
-
##################################################################
##### CFFI ######
##################################################################
@@ -1494,34 +1470,20 @@ scilab_clean:
GO = @GO@
GOGCC = @GOGCC@
GCCGO = @GCCGO@
-GO1 = @GO1@
-GO12 = @GO12@
-GO13 = @GO13@
-GO15 = @GO15@
-GOC = @GOC@
GOOPT = @GOOPT@
GCCGOOPT = @GCCGOOPT@
GOVERSIONOPTION = @GOVERSIONOPTION@
GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
-GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) || $(GO15); then echo -pack ; fi`
GOSRCS = $(INTERFACE:.i=.go)
GOCSRCS = $(INTERFACE:.i=_gc.c)
-GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
-GOTOOL = `if $(GO1) ; then echo go tool; fi`
-GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-
GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
GOPATHPARENTDIR = gopath/$(GOMOD)/src
GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
-GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
-GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
-GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
-
# ----------------------------------------------------------------
# Build a Go module (C)
# ----------------------------------------------------------------
@@ -1536,49 +1498,13 @@ $(GOPATHPARENTDIR)/go.mod:
echo "go 1.12" >> $(GOPATHDIR)/go.mod
mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod
-go_nocgo: $(SRCDIR_SRCS)
- $(SWIG) -go -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
- $(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
- else \
- $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
- fi
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c -I . $(GOSRCS); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS); \
- $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} $(GOCSRCS); \
- rm -f $(GOPACKAGE); \
- if $(GO13) || $(GO15); then \
- cp $(GOGCOBJS) $(GOPACKAGE); \
- $(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- elif $(GO12); then \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- else \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
- fi; \
- fi
- if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
- fi
-
go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
$(SWIG) -go -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
@mkdir gopath 2>/dev/null || true
@mkdir gopath/$(GOMOD) 2>/dev/null || true
@mkdir gopath/$(GOMOD)/src 2>/dev/null || true
@mkdir $(GOPATHDIR) 2>/dev/null || true
- rm -f $(GOPATHDIR)/*
+ rm -rf $(GOPATHDIR)/*
cp $(ISRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@@ -1587,6 +1513,13 @@ go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
+ @if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+ rm -f gopath/$(GOMOD)/src/runme/*; \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+ fi
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
@@ -1595,82 +1528,29 @@ go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
export CGO_CFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
- (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
+ (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
if $(GOGCC); then \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
- fi
+ fi; \
if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE); \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
+ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
# ----------------------------------------------------------------
# Build a Go module (C++)
# ----------------------------------------------------------------
-go_cpp_nocgo: $(SRCDIR_SRCS)
- $(SWIG) -go -c++ -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
- if test -n "$(SRCDIR_CXXSRCS)$(SRCDIR_SRCS)"; then \
- $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_CXXSRCS) $(SRCDIR_SRCS) $(INCLUDES); \
- fi; \
- $(foreach f,$(ICXXSRCS), \
- $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) -o $(addsuffix .@OBJEXT@,$(basename $f)) $f $(INCLUDES); \
- ) \
- else \
- $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
- fi
- if ! $(GOGCC) ; then \
- $(foreach f,$(GOSRCS), \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f \
- ); \
- $(foreach f,$(GOCSRCS), \
- $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} \
- -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f; \
- ) \
- rm -f $(GOPACKAGE); \
- if $(GO13) || $(GO15); then \
- cp $(GOGCOBJS) $(GOPACKAGE); \
- $(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- elif $(GO12); then \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
- else \
- $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
- fi; \
- else \
- $(foreach f,$(GOSRCS), \
- $(COMPILETOOL) $(GCCGO) -g -c -I . -o $(addsuffix .@OBJEXT@,$(basename $f)) $f \
- ); \
- fi
- if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
- fi
-
go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
$(SWIG) -go -c++ -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
@mkdir gopath 2>/dev/null || true
@mkdir gopath/$(GOMOD) 2>/dev/null || true
@mkdir gopath/$(GOMOD)/src 2>/dev/null || true
@mkdir $(GOPATHDIR) 2>/dev/null || true
- rm -f $(GOPATHDIR)/*
+ rm -rf $(GOPATHDIR)/*
cp $(ICXXSRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@@ -1682,6 +1562,13 @@ go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
+ @if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+ rm -f gopath/$(GOMOD)/src/runme/*; \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+ fi
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
@@ -1692,21 +1579,16 @@ go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
- (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
+ (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
if $(GOGCC); then \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
- fi
+ fi; \
if test -f $(SRCDIR)$(RUNME).go; then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -g -c -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE) -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
- fi; \
+ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
# -----------------------------------------------------------------
diff --git a/Examples/chicken/README b/Examples/chicken/README
deleted file mode 100644
index d4f91baf6..000000000
--- a/Examples/chicken/README
+++ /dev/null
@@ -1,12 +0,0 @@
-This directory contains examples for CHICKEN.
-
-class -- illustrates the proxy class C++ interface
-constants -- handling #define and %constant literals
-egg -- examples of building chicken extension libraries
-multimap -- typemaps with multiple sub-types
-overload -- C++ function overloading
-simple -- the simple example from the user manual
-zlib -- a wrapping of the zlib compression library
-
-You should be able to run make in each of the examples. By default, a shared
-library will be built. Run make check to execute the test.
diff --git a/Examples/chicken/check.list b/Examples/chicken/check.list
deleted file mode 100644
index 9ea022bfb..000000000
--- a/Examples/chicken/check.list
+++ /dev/null
@@ -1,6 +0,0 @@
-# see top-level Makefile.in
-class
-constants
-multimap
-overload
-simple
diff --git a/Examples/chicken/class/Makefile b/Examples/chicken/class/Makefile
deleted file mode 100644
index ea2d8b62e..000000000
--- a/Examples/chicken/class/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-INTERFACE = example.i
-SRCS =
-CXXSRCS = example.cxx
-TARGET = class
-INCLUDE =
-SWIGOPT =
-VARIANT =
-
-# uncomment the following lines to build a static exe (only pick one of the CHICKEN_MAIN lines)
-#CHICKEN_MAIN = runme-lowlevel.scm
-#CHICKEN_MAIN = runme-tinyclos.scm
-#VARIANT = _static
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CHICKEN_SCRIPT='runme-lowlevel.scm' chicken_run
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CHICKEN_SCRIPT='runme-tinyclos.scm' chicken_run
-
-build: $(TARGET) $(TARGET)_proxy
-
-$(TARGET): $(INTERFACE) $(SRCS)
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
- SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
-
-$(TARGET)_proxy: $(INTERFACE) $(SRCS)
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
- SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT) -proxy' TARGET='$(TARGET)_proxy' \
- INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
- rm -f example.scm
- rm -f $(TARGET)
diff --git a/Examples/chicken/class/example.cxx b/Examples/chicken/class/example.cxx
deleted file mode 100644
index 046304519..000000000
--- a/Examples/chicken/class/example.cxx
+++ /dev/null
@@ -1,28 +0,0 @@
-/* File : example.cxx */
-
-#include "example.h"
-#define M_PI 3.14159265358979323846
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
- x += dx;
- y += dy;
-}
-
-int Shape::nshapes = 0;
-
-double Circle::area() {
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter() {
- return 2*M_PI*radius;
-}
-
-double Square::area() {
- return width*width;
-}
-
-double Square::perimeter() {
- return 4*width;
-}
diff --git a/Examples/chicken/class/example.h b/Examples/chicken/class/example.h
deleted file mode 100644
index 5bad31693..000000000
--- a/Examples/chicken/class/example.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* File : example.h */
-
-class Shape {
-public:
- Shape() {
- nshapes++;
- }
- virtual ~Shape() {
- nshapes--;
- }
- double x, y;
- void move(double dx, double dy);
- virtual double area() = 0;
- virtual double perimeter() = 0;
- static int nshapes;
-
- enum SomeEnum {
- First = 0,
- Second,
- Third,
- Last = 1000
- };
-};
-
-class Circle : public Shape {
-private:
- double radius;
-public:
- Circle(double r) : radius(r) { }
- virtual double area();
- virtual double perimeter();
-};
-
-class Square : public Shape {
-private:
- double width;
-public:
- Square(double w) : width(w) { }
- virtual double area();
- virtual double perimeter();
-};
diff --git a/Examples/chicken/class/example.i b/Examples/chicken/class/example.i
deleted file mode 100644
index fbdf7249f..000000000
--- a/Examples/chicken/class/example.i
+++ /dev/null
@@ -1,9 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/* Let's just grab the original header file here */
-%include "example.h"
diff --git a/Examples/chicken/class/runme-lowlevel.scm b/Examples/chicken/class/runme-lowlevel.scm
deleted file mode 100644
index 7c59c0aaa..000000000
--- a/Examples/chicken/class/runme-lowlevel.scm
+++ /dev/null
@@ -1,76 +0,0 @@
-;; This file illustrates the low-level C++ interface generated
-;; by SWIG.
-
-(load-library 'example "class.so")
-(declare (uses example))
-
-;; ----- Object creation -----
-
-(display "Creating some objects:\n")
-(define c (new-Circle 10.0))
-(display " Created circle ")
-(display c)
-(display "\n")
-(define s (new-Square 10.0))
-(display " Created square ")
-(display s)
-(display "\n")
-
-;; ----- Access a static member -----
-
-(display "\nA total of ")
-(display (Shape-nshapes))
-(display " shapes were created\n")
-
-;; ----- Member data access -----
-
-;; Set the location of the object
-
-(Shape-x-set c 20.0)
-(Shape-y-set c 30.0)
-
-(Shape-x-set s -10.0)
-(Shape-y-set s 5.0)
-
-(display "\nHere is their current position:\n")
-(display " Circle = (")
-(display (Shape-x-get c))
-(display ", ")
-(display (Shape-y-get c))
-(display ")\n")
-(display " Square = (")
-(display (Shape-x-get s))
-(display ", ")
-(display (Shape-y-get s))
-(display ")\n")
-
-;; ----- Call some methods -----
-
-(display "\nHere are some properties of the shapes:\n")
-(let
- ((disp (lambda (o)
- (display " ")
- (display o)
- (display "\n")
- (display " area = ")
- (display (Shape-area o))
- (display "\n")
- (display " perimeter = ")
- (display (Shape-perimeter o))
- (display "\n"))))
- (disp c)
- (disp s))
-
-(display "\nGuess I'll clean up now\n")
-
-;; Note: this invokes the virtual destructor
-(set! c #f)
-(set! s #f)
-(gc #t)
-
-(set! s 3)
-(display (Shape-nshapes))
-(display " shapes remain\n")
-(display "Goodbye\n")
-
-(exit)
diff --git a/Examples/chicken/class/runme-tinyclos.scm b/Examples/chicken/class/runme-tinyclos.scm
deleted file mode 100644
index 5ba1d6adb..000000000
--- a/Examples/chicken/class/runme-tinyclos.scm
+++ /dev/null
@@ -1,76 +0,0 @@
-;; This file illustrates the proxy C++ interface generated
-;; by SWIG.
-
-(load-library 'example "class_proxy.so")
-(declare (uses example))
-(declare (uses tinyclos))
-
-;; ----- Object creation -----
-
-(display "Creating some objects:\n")
-(define c (make 10.0))
-(display " Created circle ")
-(display c)
-(display "\n")
-(define s (make 10.0))
-(display " Created square ")
-(display s)
-(display "\n")
-
-;; ----- Access a static member -----
-
-(display "\nA total of ")
-(display (Shape-nshapes))
-(display " shapes were created\n")
-
-;; ----- Member data access -----
-
-;; Set the location of the object
-
-(slot-set! c 'x 20.0)
-(slot-set! c 'y 30.0)
-
-(slot-set! s 'x -10.0)
-(slot-set! s 'y 5.0)
-
-(display "\nHere is their current position:\n")
-(display " Circle = (")
-(display (slot-ref c 'x))
-(display ", ")
-(display (slot-ref c 'y))
-(display ")\n")
-(display " Square = (")
-(display (slot-ref s 'x))
-(display ", ")
-(display (slot-ref s 'y))
-(display ")\n")
-
-;; ----- Call some methods -----
-
-(display "\nHere are some properties of the shapes:\n")
-(let
- ((disp (lambda (o)
- (display " ")
- (display o)
- (display "\n")
- (display " area = ")
- (display (area o))
- (display "\n")
- (display " perimeter = ")
- (display (perimeter o))
- (display "\n"))))
- (disp c)
- (disp s))
-
-(display "\nGuess I'll clean up now\n")
-
-;; Note: Invoke the virtual destructors by forcing garbage collection
-(set! c 77)
-(set! s 88)
-(gc #t)
-
-(display (Shape-nshapes))
-(display " shapes remain\n")
-(display "Goodbye\n")
-
-(exit)
diff --git a/Examples/chicken/constants/Makefile b/Examples/chicken/constants/Makefile
deleted file mode 100644
index 2fdde0a58..000000000
--- a/Examples/chicken/constants/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-INTERFACE = example.i
-SRCS =
-CXXSRCS =
-TARGET = constants
-INCLUDE =
-SWIGOPT =
-VARIANT =
-
-# uncomment the following two lines to build a static exe
-#CHICKEN_MAIN = runme.scm
-#VARIANT = _static
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run
-
-build: $(TARGET)
-
-$(TARGET): $(INTERFACE) $(SRCS)
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
- SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
- rm -f example.scm
- rm -f $(TARGET)
diff --git a/Examples/chicken/constants/example.i b/Examples/chicken/constants/example.i
deleted file mode 100644
index 0995c19b9..000000000
--- a/Examples/chicken/constants/example.i
+++ /dev/null
@@ -1,27 +0,0 @@
-/* File : example.i */
-%module example
-
-/* A few preprocessor macros */
-
-#define ICONST 42
-#define FCONST 2.1828
-#define CCONST 'x'
-#define CCONST2 '\n'
-#define SCONST "Hello World"
-#define SCONST2 "\"Hello World\""
-
-/* This should work just fine */
-#define EXPR ICONST + 3*(FCONST)
-
-/* This shouldn't do anything */
-#define EXTERN extern
-
-/* Neither should this (BAR isn't defined) */
-#define FOO (ICONST + BAR)
-
-/* The following directives also produce constants. Remember that
- CHICKEN is normally case-insensitive, so don't rely on differing
- case to differentiate variable names */
-
-%constant int iconstX = 37;
-%constant double fconstX = 3.14;
diff --git a/Examples/chicken/constants/runme.scm b/Examples/chicken/constants/runme.scm
deleted file mode 100644
index 1b10b2605..000000000
--- a/Examples/chicken/constants/runme.scm
+++ /dev/null
@@ -1,16 +0,0 @@
-;; feel free to uncomment and comment sections
-
-(load-library 'example "./constants.so")
-
-(display "starting test ... you will see 'finished' if successful.\n")
-(or (= (ICONST) 42) (exit 1))
-(or (< (abs (- (FCONST) 2.1828)) 0.00001) (exit 1))
-(or (char=? (CCONST) #\x) (exit 1))
-(or (char=? (CCONST2) #\newline) (exit 1))
-(or (string=? (SCONST) "Hello World") (exit 1))
-(or (string=? (SCONST2) "\"Hello World\"") (exit 1))
-(or (< (abs (- (EXPR) (+ (ICONST) (* 3 (FCONST))))) 0.00001) (exit 1))
-(or (= (iconstX) 37) (exit 1))
-(or (< (abs (- (fconstX) 3.14)) 0.00001) (exit 1))
-(display "finished test.\n")
-(exit 0)
diff --git a/Examples/chicken/egg/Makefile b/Examples/chicken/egg/Makefile
deleted file mode 100644
index 0137dc0a7..000000000
--- a/Examples/chicken/egg/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-
-check: build
- cd eggs/install && csi ../../test.scm
-
-build: single multi
-
-# This creates an egg which contains only the single module. Any additional implementation files
-# that implement the interface being wrapped should also be added to this egg
-single: single_wrap.cxx
- mkdir -p eggs
- tar czf eggs/single.egg single.setup single.scm single_wrap.cxx
- rm -f single.scm single_wrap.cxx
-
-# compile the single module with -nounit
-single_wrap.cxx: single.i
- $(SWIGEXE) -chicken -c++ -proxy -nounit single.i
-
-# Now build both mod1 and mod2 into a single egg
-multi: mod1_wrap.cxx mod2_wrap.cxx
- mkdir -p eggs
- tar czf eggs/multi.egg multi.setup multi_init.scm mod1.scm mod1_wrap.cxx mod2.scm mod2_wrap.cxx
- rm -f mod1.scm mod1_wrap.cxx mod2.scm mod2_wrap.cxx
-
-mod1_wrap.cxx: mod1.i
- $(SWIGEXE) -chicken -c++ -proxy mod1.i
-
-mod2_wrap.cxx: mod2.i
- $(SWIGEXE) -chicken -c++ -proxy mod2.i
-
-clean:
- rm -rf eggs
-
-# this part is for testing...
-setup:
- cd eggs && \
- mkdir -p install && \
- chicken-setup -repository `pwd`/install single.egg && \
- chicken-setup -repository `pwd`/install multi.egg
diff --git a/Examples/chicken/egg/README b/Examples/chicken/egg/README
deleted file mode 100644
index b5df0e631..000000000
--- a/Examples/chicken/egg/README
+++ /dev/null
@@ -1,19 +0,0 @@
-These examples show how to build a chicken extension module in the form of an
-egg. There are two eggs that get built, single.egg which contains a single
-module which is built with -nounit and multi.egg, which contains two modules
-mod1 and mod2. These are built normally, and multi_init.scm loads them both.
-Read section "17.4.2 Building chicken extension libraries" in the manual
-for a description of these two techniques.
-
-To build:
-
-$ make
-$ make setup
-$ make run
-
-$ make clean
-
-The eggs are built into an eggs subdirectory, because chicken-setup has
-problems installing eggs when there are other files named similar in
-the same directory. The make setup step runs chicken-setup to install
-the eggs into the eggs/install directory.
diff --git a/Examples/chicken/egg/mod1.i b/Examples/chicken/egg/mod1.i
deleted file mode 100644
index 6a2940b89..000000000
--- a/Examples/chicken/egg/mod1.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module mod1
-
-%inline %{
-class Bar {
- public:
- int b;
-};
-%}
diff --git a/Examples/chicken/egg/mod2.i b/Examples/chicken/egg/mod2.i
deleted file mode 100644
index e9ae4a6a8..000000000
--- a/Examples/chicken/egg/mod2.i
+++ /dev/null
@@ -1,17 +0,0 @@
-%module mod2
-
-%import "mod1.i"
-
-%{
-class Bar {
- public:
- int b;
-};
-%}
-
-%inline %{
- class Bar2 : public Bar {
- public:
- int c;
- };
-%}
diff --git a/Examples/chicken/egg/multi.setup b/Examples/chicken/egg/multi.setup
deleted file mode 100644
index 95aeb001c..000000000
--- a/Examples/chicken/egg/multi.setup
+++ /dev/null
@@ -1,2 +0,0 @@
-(run (csc -s -o multi.so multi_init.scm mod1.scm mod1_wrap.cxx mod2.scm mod2_wrap.cxx))
-(install-extension 'multi '("multi.so"))
diff --git a/Examples/chicken/egg/multi_init.scm b/Examples/chicken/egg/multi_init.scm
deleted file mode 100644
index 600491d5b..000000000
--- a/Examples/chicken/egg/multi_init.scm
+++ /dev/null
@@ -1,2 +0,0 @@
-(declare (uses mod1))
-(declare (uses mod2))
diff --git a/Examples/chicken/egg/single.i b/Examples/chicken/egg/single.i
deleted file mode 100644
index 46266b4bf..000000000
--- a/Examples/chicken/egg/single.i
+++ /dev/null
@@ -1,8 +0,0 @@
-%module single
-
-%inline %{
-class Foo {
- public:
- int a;
-};
-%}
diff --git a/Examples/chicken/egg/single.setup b/Examples/chicken/egg/single.setup
deleted file mode 100644
index 4b503ec21..000000000
--- a/Examples/chicken/egg/single.setup
+++ /dev/null
@@ -1,2 +0,0 @@
-(run (csc -s -o single.so single.scm single_wrap.cxx))
-(install-extension 'single '("single.so"))
diff --git a/Examples/chicken/egg/test.scm b/Examples/chicken/egg/test.scm
deleted file mode 100644
index 4ec94ed18..000000000
--- a/Examples/chicken/egg/test.scm
+++ /dev/null
@@ -1,18 +0,0 @@
-(require-extension single)
-(require-extension multi)
-
-(define f (make ))
-(slot-set! f 'a 3)
-(print (slot-ref f 'a))
-
-(define b (make ))
-(slot-set! b 'b 2)
-(print (slot-ref b 'b))
-
-(define b2 (make ))
-(slot-set! b2 'b 4)
-(slot-set! b2 'c 6)
-(print (slot-ref b2 'b))
-(print (slot-ref b2 'c))
-
-(exit 0)
diff --git a/Examples/chicken/multimap/Makefile b/Examples/chicken/multimap/Makefile
deleted file mode 100644
index 551d1c74d..000000000
--- a/Examples/chicken/multimap/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-INTERFACE = example.i
-SRCS = example.c
-CXXSRCS =
-TARGET = multimap
-INCLUDE =
-SWIGOPT =
-VARIANT =
-
-# uncomment the following two lines to build a static exe
-#CHICKEN_MAIN = runme.scm
-#VARIANT = _static
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run
-
-build: $(TARGET)
-
-$(TARGET): $(INTERFACE) $(SRCS)
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
- SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
- rm -f example.scm
- rm -f $(TARGET)
diff --git a/Examples/chicken/multimap/example.c b/Examples/chicken/multimap/example.c
deleted file mode 100644
index b8360fa8a..000000000
--- a/Examples/chicken/multimap/example.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* File : example.c */
-#include
-#include
-#include
-
-/* Compute the greatest common divisor of positive integers */
-int gcd(int x, int y) {
- int g;
- g = y;
- while (x > 0) {
- g = x;
- x = y % x;
- y = g;
- }
- return g;
-}
-
-int gcdmain(int argc, char *argv[]) {
- int x,y;
- if (argc != 3) {
- printf("usage: gcd x y\n");
- return -1;
- }
- x = atoi(argv[1]);
- y = atoi(argv[2]);
- printf("gcd(%d,%d) = %d\n", x,y,gcd(x,y));
- return 0;
-}
-
-int count(char *bytes, int len, char c) {
- int i;
- int count = 0;
- for (i = 0; i < len; i++) {
- if (bytes[i] == c) count++;
- }
- return count;
-}
-
-void capitalize(char *str, int len) {
- int i;
- for (i = 0; i < len; i++) {
- str[i] = (char)toupper(str[i]);
- }
-}
-
-void circle(double x, double y) {
- double a = x*x + y*y;
- if (a > 1.0) {
- printf("Bad points %g, %g\n", x,y);
- } else {
- printf("Good points %g, %g\n", x,y);
- }
-}
diff --git a/Examples/chicken/multimap/example.i b/Examples/chicken/multimap/example.i
deleted file mode 100644
index 02567f48f..000000000
--- a/Examples/chicken/multimap/example.i
+++ /dev/null
@@ -1,96 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-extern int gcd(int x, int y);
-extern int gcdmain(int argc, char *argv[]);
-extern int count(char *bytes, int len, char c);
-extern void capitalize (char *str, int len);
-extern void circle (double cx, double cy);
-extern int squareCubed (int n, int *OUTPUT);
-%}
-
-%include exception.i
-%include typemaps.i
-
-extern int gcd(int x, int y);
-
-%typemap(in) (int argc, char *argv[]) {
- int i;
- if (!C_swig_is_vector ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a vector");
- }
- $1 = C_header_size ($input);
- $2 = (char **) malloc(($1+1)*sizeof(char *));
- for (i = 0; i < $1; i++) {
- C_word o = C_block_item ($input, i);
- if (!C_swig_is_string (o)) {
- char err[50];
- free($2);
- sprintf (err, "$input[%d] is not a string", i);
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, err);
- }
- $2[i] = C_c_string (o);
- }
- $2[i] = 0;
-}
-
-%typemap(freearg) (int argc, char *argv[]) {
- free($2);
-}
-extern int gcdmain(int argc, char *argv[]);
-
-%typemap(in) (char *bytes, int len) {
- if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a string");
- }
- $1 = C_c_string ($input);
- $2 = C_header_size ($input);
-}
-
-extern int count(char *bytes, int len, char c);
-
-
-/* This example shows how to wrap a function that mutates a string */
-
-%typemap(in) (char *str, int len)
-%{ if (!C_swig_is_string ($input)) {
- swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a string");
- }
- $2 = C_header_size ($input);
- $1 = (char *) malloc ($2+1);
- memmove ($1, C_c_string ($input), $2);
-%}
-
-/* Return the mutated string as a new object. Notice the if MANY construct ... they must be at column 0. */
-
-%typemap(argout) (char *str, int len) (C_word *scmstr)
-%{ scmstr = C_alloc (C_SIZEOF_STRING ($2));
- SWIG_APPEND_VALUE(C_string (&scmstr, $2, $1));
- free ($1);
-%}
-
-extern void capitalize (char *str, int len);
-
-/* A multi-valued constraint. Force two arguments to lie
- inside the unit circle */
-
-%typemap(check) (double cx, double cy) {
- double a = $1*$1 + $2*$2;
- if (a > 1.0) {
- SWIG_exception (SWIG_ValueError, "cx and cy must be in unit circle");
- }
-}
-
-extern void circle (double cx, double cy);
-
-/* Test out multiple return values */
-
-extern int squareCubed (int n, int *OUTPUT);
-%{
-/* Returns n^3 and set n2 to n^2 */
-int squareCubed (int n, int *n2) {
- *n2 = n * n;
- return (*n2) * n;
-};
-%}
diff --git a/Examples/chicken/multimap/runme.scm b/Examples/chicken/multimap/runme.scm
deleted file mode 100644
index ebe644004..000000000
--- a/Examples/chicken/multimap/runme.scm
+++ /dev/null
@@ -1,58 +0,0 @@
-;; feel free to uncomment and comment sections
-
-(load-library 'example "multimap.so")
-
-(display "(gcd 90 12): ")
-(display (gcd 90 12))
-(display "\n")
-
-(display "(circle 0.5 0.5): ")
-(display (circle 0.5 0.5))
-(display "\n")
-
-(display "(circle 1.0 1.0): ")
-(handle-exceptions exvar
- (if (= (car exvar) 9)
- (display "success: exception thrown")
- (display "an incorrect exception was thrown"))
- (begin
- (circle 1.0 1.0)
- (display "an exception was not thrown when it should have been")))
-(display "\n")
-
-(display "(circle 1 1): ")
-(handle-exceptions exvar
- (if (= (car exvar) 9)
- (display "success: exception thrown")
- (display "an incorrect exception was thrown"))
- (begin
- (circle 1 1)
- (display "an exception was not thrown when it should have been")))
-(display "\n")
-
-(display "(capitalize \"will this be all capital letters?\"): ")
-(display (capitalize "will this be all capital letters?"))
-(display "\n")
-
-(display "(count \"jumpity little spider\" #\\t): ")
-(display (count "jumpity little spider" #\t))
-(display "\n")
-
-(display "(gcdmain '#(\"hi\" \"there\")): ")
-(display (gcdmain '#("hi" "there")))
-(display "\n")
-
-(display "(gcdmain '#(\"gcd\" \"9\" \"28\")): ")
-(gcdmain '#("gcd" "9" "28"))
-(display "\n")
-
-(display "(gcdmain '#(\"gcd\" \"12\" \"90\")): ")
-(gcdmain '#("gcd" "12" "90"))
-(display "\n")
-
-(display "squarecubed 3: ")
-(call-with-values (lambda() (squareCubed 3))
- (lambda (a b) (printf "~A ~A" a b)))
-(display "\n")
-
-(exit)
diff --git a/Examples/chicken/overload/Makefile b/Examples/chicken/overload/Makefile
deleted file mode 100644
index 019390192..000000000
--- a/Examples/chicken/overload/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-INTERFACE = example.i
-SRCS =
-CXXSRCS = example.cxx
-TARGET = overload
-INCLUDE =
-SWIGOPT = -proxy -unhideprimitive
-VARIANT =
-
-# uncomment the following lines to build a static exe
-#CHICKEN_MAIN = runme.scm
-#VARIANT = _static
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run
-
-build: $(TARGET)
-
-$(TARGET): $(INTERFACE) $(SRCS)
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
- SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
- rm -f example.scm
- rm -f $(TARGET)
diff --git a/Examples/chicken/overload/README b/Examples/chicken/overload/README
deleted file mode 100644
index 9487c3f3e..000000000
--- a/Examples/chicken/overload/README
+++ /dev/null
@@ -1,2 +0,0 @@
-Overloading example from Chapter 5.14 of SWIG Core Documentation for
-version 1.3.
diff --git a/Examples/chicken/overload/example.cxx b/Examples/chicken/overload/example.cxx
deleted file mode 100644
index 65e743941..000000000
--- a/Examples/chicken/overload/example.cxx
+++ /dev/null
@@ -1,33 +0,0 @@
-/* File : example.c */
-
-#include "example.h"
-#include
-
-void foo(int x) {
- printf("x is %d\n", x);
-}
-
-void foo(char *x) {
- printf("x is '%s'\n", x);
-}
-
-Foo::Foo () {
- myvar = 55;
- printf ("Foo constructor called\n");
-}
-
-Foo::Foo (const Foo &) {
- myvar = 66;
- printf ("Foo copy constructor called\n");
-}
-
-void Foo::bar (int x) {
- printf ("Foo::bar(x) method ... \n");
- printf("x is %d\n", x);
-}
-
-void Foo::bar (char *s, int y) {
- printf ("Foo::bar(s,y) method ... \n");
- printf ("s is '%s'\n", s);
- printf ("y is %d\n", y);
-}
diff --git a/Examples/chicken/overload/example.h b/Examples/chicken/overload/example.h
deleted file mode 100644
index 1c135d509..000000000
--- a/Examples/chicken/overload/example.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* File : example.h */
-
-extern void foo (int x);
-extern void foo (char *x);
-
-class Foo {
- private:
- int myvar;
- public:
- Foo();
- Foo(const Foo &); // Copy constructor
- void bar(int x);
- void bar(char *s, int y);
-};
diff --git a/Examples/chicken/overload/example.i b/Examples/chicken/overload/example.i
deleted file mode 100644
index 23a29986e..000000000
--- a/Examples/chicken/overload/example.i
+++ /dev/null
@@ -1,16 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/* Let "Foo" objects be converted back and forth from TinyCLOS into
- low-level CHICKEN SWIG procedures */
-
-%typemap(clos_in) Foo * = SIMPLE_CLOS_OBJECT *;
-%typemap(clos_out) Foo * = SIMPLE_CLOS_OBJECT *;
-
-/* Let's just grab the original header file here */
-%include "example.h"
-
diff --git a/Examples/chicken/overload/runme.scm b/Examples/chicken/overload/runme.scm
deleted file mode 100644
index 168490f76..000000000
--- a/Examples/chicken/overload/runme.scm
+++ /dev/null
@@ -1,45 +0,0 @@
-;; This file demonstrates the overloading capabilities of SWIG
-
-(load-library 'example "overload.so")
-
-;; Low level
-;; ---------
-
-(display "
-Trying low level code ...
- (foo 1)
- (foo \"some string\")
- (define A-FOO (new-Foo))
- (define ANOTHER-FOO (new-Foo A-FOO)) ;; copy constructor
- (Foo-bar A-FOO 2)
- (Foo-bar ANOTHER-FOO \"another string\" 3)
-")
-
-(primitive:foo 1)
-(primitive:foo "some string")
-(define A-FOO (slot-ref (primitive:new-Foo) 'swig-this))
-(define ANOTHER-FOO (slot-ref (primitive:new-Foo A-FOO) 'swig-this)) ;; copy constructor
-(primitive:Foo-bar A-FOO 2)
-(primitive:Foo-bar ANOTHER-FOO "another string" 3)
-
-;; TinyCLOS
-;; --------
-
-(display "
-Trying TinyCLOS code ...
- (+foo+ 1)
- (+foo+ \"some string\")
- (define A-FOO (make ))
- (define ANOTHER-FOO (make A-FOO)) ;; copy constructor
- (-bar- A-FOO 2)
- (-bar- ANOTHER-FOO \"another string\" 3)
-")
-
-(foo 1)
-(foo "some string")
-(define A-FOO (make ))
-(define ANOTHER-FOO (make A-FOO)) ;; copy constructor
-(bar A-FOO 2)
-(bar ANOTHER-FOO "another string" 3)
-
-(exit)
diff --git a/Examples/chicken/simple/Makefile b/Examples/chicken/simple/Makefile
deleted file mode 100644
index f5dd1a966..000000000
--- a/Examples/chicken/simple/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-INTERFACE = example.i
-SRCS = example.c
-CXXSRCS =
-TARGET = simple
-INCLUDE =
-SWIGOPT =
-VARIANT =
-
-# uncomment the following two lines to build a static exe
-#CHICKEN_MAIN = runme.scm
-#VARIANT = _static
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run
-
-build: $(TARGET)
-
-$(TARGET): $(INTERFACE) $(SRCS)
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
- SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
- rm -f example.scm example-generic.scm example-clos.scm
- rm -f $(TARGET)
diff --git a/Examples/chicken/simple/README b/Examples/chicken/simple/README
deleted file mode 100644
index 07e8da069..000000000
--- a/Examples/chicken/simple/README
+++ /dev/null
@@ -1 +0,0 @@
-Simple example from users manual.
diff --git a/Examples/chicken/simple/example.c b/Examples/chicken/simple/example.c
deleted file mode 100644
index f2b074781..000000000
--- a/Examples/chicken/simple/example.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Simple example from documentation */
-/* File : example.c */
-
-#include
-
-double My_variable = 3.0;
-
-/* Compute factorial of n */
-int fact(int n) {
- if (n <= 1) return 1;
- else return n*fact(n-1);
-}
-
-/* Compute n mod m */
-int my_mod(int n, int m) {
- return (n % m);
-}
-
-
-char *get_time() {
- long ltime;
- time(<ime);
- return ctime(<ime);
-}
diff --git a/Examples/chicken/simple/example.i b/Examples/chicken/simple/example.i
deleted file mode 100644
index 5b3e95580..000000000
--- a/Examples/chicken/simple/example.i
+++ /dev/null
@@ -1,16 +0,0 @@
-/* File : example.i */
-%module example
-%{
-/* Put headers and other declarations here */
-%}
-
-%include typemaps.i
-
-%rename(mod) my_mod;
-
-%inline %{
-extern double My_variable;
-extern int fact(int);
-extern int my_mod(int n, int m);
-extern char *get_time();
-%}
diff --git a/Examples/chicken/simple/runme.scm b/Examples/chicken/simple/runme.scm
deleted file mode 100644
index 05aa87081..000000000
--- a/Examples/chicken/simple/runme.scm
+++ /dev/null
@@ -1,28 +0,0 @@
-;; feel free to uncomment and comment sections
-(load-library 'example "simple.so")
-
-(display "(My-variable): ")
-(display (My-variable))
-(display "\n")
-
-(display "(My-variable 3.141259): ")
-(display (My-variable 3.141259))
-(display "\n")
-
-(display "(My-variable): ")
-(display (My-variable))
-(display "\n")
-
-(display "(fact 5): ")
-(display (fact 5))
-(display "\n")
-
-(display "(mod 75 7): ")
-(display (mod 75 7))
-(display "\n")
-
-(display "(get-time): ")
-(display (get-time))
-(display "\n")
-
-(exit)
diff --git a/Examples/contract/simple_c/example.c b/Examples/contract/simple_c/example.c
deleted file mode 100644
index 85a3e1417..000000000
--- a/Examples/contract/simple_c/example.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include
-
-int Circle (int x, int y, int radius) {
- /* Draw Circle */
- printf("Drawing the circle...\n");
- /* Return -1 to test contract post assertion */
- if (radius == 2)
- return -1;
- else
- return 1;
-}
diff --git a/Examples/contract/simple_c/example.i b/Examples/contract/simple_c/example.i
deleted file mode 100644
index 49df09af6..000000000
--- a/Examples/contract/simple_c/example.i
+++ /dev/null
@@ -1,19 +0,0 @@
-/* File : example.i */
-
-/* Basic C example for swig contract */
-/* Tiger, University of Chicago, 2003 */
-
-%module example
-
-%contract Circle (int x, int y, int radius) {
-require:
- x >= 0;
- y >= 0;
- radius > x;
-ensure:
- Circle >= 0;
-}
-
-%inline %{
-extern int Circle (int x, int y, int radius);
-%}
diff --git a/Examples/contract/simple_c/runme1.py b/Examples/contract/simple_c/runme1.py
deleted file mode 100644
index abd8df62f..000000000
--- a/Examples/contract/simple_c/runme1.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import example
-# Call the Circle() function correctly
-
-x = 1;
-y = 1;
-r = 3;
-
-c = example.Circle(x, y, r)
-
-# test post-assertion
-x = 1;
-y = 1;
-r = 2;
-
-c = example.Circle(x, y, r)
-
-print "The return value of Circle(%d, %d, %d) is %d" % (x,y,r,c)
diff --git a/Examples/contract/simple_c/runme2.py b/Examples/contract/simple_c/runme2.py
deleted file mode 100644
index 48d4a3f10..000000000
--- a/Examples/contract/simple_c/runme2.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import example
-
-# Call the Circle() function correctly
-
-x = 1;
-y = 1;
-r = 3;
-
-c = example.Circle(x, y, r)
-
-print "The return value of Circle(%d, %d, %d) is %d" % (x,y,r,c)
-
-# test pre-assertion
-x = 1;
-y = -1;
-r = 3;
-
-c = example.Circle(x, y, r)
-
-print "The return value of Circle(%d, %d, %d) is %d" % (x,y,r,c)
diff --git a/Examples/contract/simple_cxx/example.cxx b/Examples/contract/simple_cxx/example.cxx
deleted file mode 100644
index e3dd2ca7a..000000000
--- a/Examples/contract/simple_cxx/example.cxx
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "example.h"
-
-#define M_PI 3.14159265358979323846
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
- x += dx;
- y += dy;
-}
-
-int Shape::nshapes = 0;
-
-double Circle::area(void) {
- /* return -1 is to test post-assertion */
- if (radius == 1)
- return -1;
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter(void) {
- return 2*M_PI*radius;
-}
-
-double Square::area(void) {
- return width*width;
-}
-
-double Square::perimeter(void) {
- return 4*width;
-}
diff --git a/Examples/contract/simple_cxx/example.h b/Examples/contract/simple_cxx/example.h
deleted file mode 100644
index de708bb7b..000000000
--- a/Examples/contract/simple_cxx/example.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* File : example.h */
-
-class Shape {
-public:
- Shape() {
- nshapes++;
- }
- virtual ~Shape() {
- nshapes--;
- }
- double x, y;
- void move(double dx, double dy);
- virtual double area(void) = 0;
- virtual double perimeter(void) = 0;
- static int nshapes;
-};
-
-class Circle : public Shape {
-private:
- double radius;
-public:
- Circle(double r) : radius(r) { }
- virtual double area(void);
- virtual double perimeter(void);
-};
-
-class Square : public Shape {
-private:
- double width;
-public:
- Square(double w) : width(w) { }
- virtual double area(void);
- virtual double perimeter(void);
-};
diff --git a/Examples/contract/simple_cxx/example.i b/Examples/contract/simple_cxx/example.i
deleted file mode 100644
index 9b47409d0..000000000
--- a/Examples/contract/simple_cxx/example.i
+++ /dev/null
@@ -1,28 +0,0 @@
-%module example
-
-%contract Circle::Circle(double radius) {
-require:
- radius > 0;
-}
-
-%contract Circle::area(void) {
-ensure:
- area > 0;
-}
-
-%contract Shape::move(double dx, double dy) {
-require:
- dx > 0;
-}
-
-/* should be no effect, since there is no move() for class Circle */
-%contract Circle::move(double dx, double dy) {
-require:
- dy > 1;
-}
-
-# include must be after contracts
-%{
-#include "example.h"
-%}
-%include "example.h"
diff --git a/Examples/contract/simple_cxx/runme1.py b/Examples/contract/simple_cxx/runme1.py
deleted file mode 100644
index 9028d02d9..000000000
--- a/Examples/contract/simple_cxx/runme1.py
+++ /dev/null
@@ -1,33 +0,0 @@
-import example
-
-# Create the Circle object
-
-r = 2;
-print " Creating circle (radium: %d) :" % r
-c = example.Circle(r)
-
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print " Here is its current position:"
-print " Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n Here are some properties of the Circle:"
-print " area = ", c.area()
-print " perimeter = ", c.perimeter()
-dx = 1;
-dy = 1;
-print " Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
-
-del c
-
-print "==================================="
-
-# test construction */
-r = -1;
-print " Creating circle (radium: %d) :" % r
-c = example.Circle(r)
diff --git a/Examples/contract/simple_cxx/runme2.py b/Examples/contract/simple_cxx/runme2.py
deleted file mode 100644
index 5f9c0df5b..000000000
--- a/Examples/contract/simple_cxx/runme2.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import example
-
-# Create the Circle object
-
-r = 2;
-print " Creating circle (radium: %d) :" % r
-c = example.Circle(r)
-
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print " Here is its current position:"
-print " Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n Here are some properties of the Circle:"
-print " area = ", c.area()
-print " perimeter = ", c.perimeter()
-dx = 1;
-dy = 1;
-print " Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
-
-del c
-
-print "==================================="
-
-# test area function */
-r = 1;
-print " Creating circle (radium: %d) :" % r
-c = example.Circle(r)
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print " Here is its current position:"
-print " Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n Here are some properties of the Circle:"
-print " area = ", c.area()
diff --git a/Examples/contract/simple_cxx/runme3.py b/Examples/contract/simple_cxx/runme3.py
deleted file mode 100644
index a663732b1..000000000
--- a/Examples/contract/simple_cxx/runme3.py
+++ /dev/null
@@ -1,57 +0,0 @@
-import example
-
-# Create the Circle object
-
-r = 2;
-print " Creating circle (radium: %d) :" % r
-c = example.Circle(r)
-
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print " Here is its current position:"
-print " Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n Here are some properties of the Circle:"
-print " area = ", c.area()
-print " perimeter = ", c.perimeter()
-dx = 1;
-dy = 1;
-print " Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
-
-del c
-
-print "==================================="
-
-# test move function */
-r = 2;
-print " Creating circle (radium: %d) :" % r
-c = example.Circle(r)
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print " Here is its current position:"
-print " Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n Here are some properties of the Circle:"
-print " area = ", c.area()
-print " perimeter = ", c.perimeter()
-
-# no error for Circle's pre-assertion
-dx = 1;
-dy = -1;
-print " Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
-
-# error with Shape's pre-assertion
-dx = -1;
-dy = 1;
-print " Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
diff --git a/Examples/go/callback/runme.go b/Examples/go/callback/runme.go
index 2c1d81343..7c9ffd681 100644
--- a/Examples/go/callback/runme.go
+++ b/Examples/go/callback/runme.go
@@ -3,7 +3,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/class/runme.go b/Examples/go/class/runme.go
index d2f292ed4..a09a18247 100644
--- a/Examples/go/class/runme.go
+++ b/Examples/go/class/runme.go
@@ -5,7 +5,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/constants/runme.go b/Examples/go/constants/runme.go
index d56fd62c8..57ef21a8b 100644
--- a/Examples/go/constants/runme.go
+++ b/Examples/go/constants/runme.go
@@ -3,7 +3,7 @@ package main
import (
"fmt"
- "example"
+ "swigtests/example"
)
func main() {
diff --git a/Examples/go/director/runme.go b/Examples/go/director/runme.go
index 0e0da07bd..e28eccba6 100644
--- a/Examples/go/director/runme.go
+++ b/Examples/go/director/runme.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- "example"
+ "swigtests/example"
)
func Compare(name string, got string, exp string) error {
diff --git a/Examples/go/enum/runme.go b/Examples/go/enum/runme.go
index 50887056e..c0642e0b5 100644
--- a/Examples/go/enum/runme.go
+++ b/Examples/go/enum/runme.go
@@ -3,7 +3,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/extend/runme.go b/Examples/go/extend/runme.go
index af64a6e5d..716af52c5 100644
--- a/Examples/go/extend/runme.go
+++ b/Examples/go/extend/runme.go
@@ -5,7 +5,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/funcptr/runme.go b/Examples/go/funcptr/runme.go
index 4b20db4fb..87ec7d495 100644
--- a/Examples/go/funcptr/runme.go
+++ b/Examples/go/funcptr/runme.go
@@ -3,7 +3,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/multimap/runme.go b/Examples/go/multimap/runme.go
index 571fac7c2..2f8b20568 100644
--- a/Examples/go/multimap/runme.go
+++ b/Examples/go/multimap/runme.go
@@ -3,7 +3,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/pointer/runme.go b/Examples/go/pointer/runme.go
index 0cf340f51..73c6b2b3c 100644
--- a/Examples/go/pointer/runme.go
+++ b/Examples/go/pointer/runme.go
@@ -3,7 +3,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/reference/runme.go b/Examples/go/reference/runme.go
index 9999733b3..7391d9c8b 100644
--- a/Examples/go/reference/runme.go
+++ b/Examples/go/reference/runme.go
@@ -5,7 +5,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/simple/runme.go b/Examples/go/simple/runme.go
index 0bd4657f9..5bc055f2e 100644
--- a/Examples/go/simple/runme.go
+++ b/Examples/go/simple/runme.go
@@ -3,7 +3,7 @@ package main
import (
"fmt"
- "example"
+ "swigtests/example"
)
func main() {
diff --git a/Examples/go/template/runme.go b/Examples/go/template/runme.go
index 347795377..e000b1579 100644
--- a/Examples/go/template/runme.go
+++ b/Examples/go/template/runme.go
@@ -5,7 +5,7 @@ package main
import (
"fmt"
- . "example"
+ . "swigtests/example"
)
func main() {
diff --git a/Examples/go/variables/runme.go b/Examples/go/variables/runme.go
index e2dd0c67f..85ca8c638 100644
--- a/Examples/go/variables/runme.go
+++ b/Examples/go/variables/runme.go
@@ -5,7 +5,7 @@ package main
import (
"fmt"
- "example"
+ "swigtests/example"
)
func main() {
diff --git a/Examples/guile/check.list b/Examples/guile/check.list
index 726e6ab75..1f22adf78 100644
--- a/Examples/guile/check.list
+++ b/Examples/guile/check.list
@@ -1,9 +1,9 @@
# see top-level Makefile.in
-constants
class
-port
-simple
-std_vector
+constants
matrix
multimap
multivalue
+port
+simple
+std_vector
diff --git a/Examples/javascript/check.list b/Examples/javascript/check.list
index 9707e77d4..977835755 100644
--- a/Examples/javascript/check.list
+++ b/Examples/javascript/check.list
@@ -3,6 +3,7 @@ constant
enum
exception
functor
+native
nspace
operator
overload
diff --git a/Examples/javascript/native/Makefile b/Examples/javascript/native/Makefile
new file mode 100644
index 000000000..0402f8d09
--- /dev/null
+++ b/Examples/javascript/native/Makefile
@@ -0,0 +1,3 @@
+SRCS =
+
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/native/binding.gyp.in b/Examples/javascript/native/binding.gyp.in
new file mode 100644
index 000000000..59779aef4
--- /dev/null
+++ b/Examples/javascript/native/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/native/example.i b/Examples/javascript/native/example.i
new file mode 100644
index 000000000..a9ca094a7
--- /dev/null
+++ b/Examples/javascript/native/example.i
@@ -0,0 +1,47 @@
+/* File : example.i */
+%module example
+
+// placeholder() used to help SWIG generate "SWIG_From_int" call
+%{
+ int placeholder();
+%}
+int placeholder() { return 0; }
+
+// actual demo code
+%wrapper
+%{
+#ifdef SWIG_V8_VERSION /* Engine: Node || V8 */
+
+ static SwigV8ReturnValue JavaScript_do_work(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+ const int MY_MAGIC_NUMBER = 5;
+ SWIGV8_VALUE jsresult =
+ SWIG_From_int(static_cast< int >(MY_MAGIC_NUMBER));
+ if (args.Length() != 0)
+ SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+ SWIGV8_RETURN(jsresult);
+ fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+ }
+
+#else /* Engine: JavaScriptCore */
+
+ static JSValueRef JavaScript_do_work(JSContextRef context,
+ JSObjectRef function, JSObjectRef thisObject, size_t argc,
+ const JSValueRef argv[], JSValueRef* exception) {
+ const int MY_MAGIC_NUMBER = 5;
+ JSValueRef jsresult =
+ SWIG_From_int SWIG_JSC_FROM_CALL_ARGS(
+ static_cast< int >(MY_MAGIC_NUMBER));
+ if (argc != 0)
+ SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+ return jsresult;
+ fail:
+ return JSValueMakeUndefined(context);
+ }
+
+#endif
+%}
+
+
+%native(magicNumber) void JavaScript_do_work();
diff --git a/Examples/javascript/native/example.js b/Examples/javascript/native/example.js
new file mode 100644
index 000000000..2e7f83a06
--- /dev/null
+++ b/Examples/javascript/native/example.js
@@ -0,0 +1 @@
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/native/index.html b/Examples/javascript/native/index.html
new file mode 100644
index 000000000..7c7d6b071
--- /dev/null
+++ b/Examples/javascript/native/index.html
@@ -0,0 +1,31 @@
+
+
+SWIG:Examples:javascript:native
+
+
+
+
+
+SWIG/Examples/javascript/native/
+
+
+Manually wrapped callback function in JavaScript
+
+
+This example demonstrates how to manually add callback feature support to a SWIG module.
+
+
+
+- example.i. Interface file containing the API function and async behind-the-scenes functions.
+
- runme.js. Sample JavaScript program showing the API function being called with a callback function parameter.
+
+
+Notes
+
+The V8 code queues the callback request for processing using the UV interface. An async function callback is invoked when the system is ready to process the next request. When the async function finishes, a completion function callback is invoked to finalize the request. Here the callback function parameter is invoked.
+
+UV request queueing is only necessary for operations that would take a really long or otherwise unpredictable amount of time (async operations). A callback parameter could also be invoked immediately within the API function.
+
+
+
+
diff --git a/Examples/javascript/native/runme.js b/Examples/javascript/native/runme.js
new file mode 100644
index 000000000..b5e14d037
--- /dev/null
+++ b/Examples/javascript/native/runme.js
@@ -0,0 +1,3 @@
+var example = require("example");
+
+console.log("My magic number is: ", example.magicNumber());
diff --git a/Examples/lua/owner/example.cxx b/Examples/lua/owner/example.cxx
index c2c073d79..a4dcc68a1 100644
--- a/Examples/lua/owner/example.cxx
+++ b/Examples/lua/owner/example.cxx
@@ -3,7 +3,9 @@
#include "example.h"
#include
+#ifndef M_PI
#define M_PI 3.14159265358979323846
+#endif
/* Move the shape to a new location */
void Shape::move(double dx, double dy) {
diff --git a/Examples/modula3/check.list b/Examples/modula3/check.list
deleted file mode 100644
index 37ac8c105..000000000
--- a/Examples/modula3/check.list
+++ /dev/null
@@ -1,7 +0,0 @@
-# see top-level Makefile.in
-class
-enum
-exception
-reference
-simple
-typemap
diff --git a/Examples/modula3/class/Makefile b/Examples/modula3/class/Makefile
deleted file mode 100644
index b25f636c3..000000000
--- a/Examples/modula3/class/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
-TARGET = example
-PLATFORM = LINUXLIBC6
-INTERFACE = example.i
-SWIGOPT = -c++
-MODULA3SRCS = *.[im]3
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
- m3ppinplace $(MODULA3SRCS)
-# compilation of example_wrap.cxx is started by cm3
-# $(CXX) -c $(TARGET)_wrap.cxx
- mv example_wrap.cxx m3makefile $(MODULA3SRCS) src/
- ln -sf ../example.h src/example.h
- cm3
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
diff --git a/Examples/modula3/class/example.cxx b/Examples/modula3/class/example.cxx
deleted file mode 100644
index 046304519..000000000
--- a/Examples/modula3/class/example.cxx
+++ /dev/null
@@ -1,28 +0,0 @@
-/* File : example.cxx */
-
-#include "example.h"
-#define M_PI 3.14159265358979323846
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
- x += dx;
- y += dy;
-}
-
-int Shape::nshapes = 0;
-
-double Circle::area() {
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter() {
- return 2*M_PI*radius;
-}
-
-double Square::area() {
- return width*width;
-}
-
-double Square::perimeter() {
- return 4*width;
-}
diff --git a/Examples/modula3/class/example.h b/Examples/modula3/class/example.h
deleted file mode 100644
index 0dff185b2..000000000
--- a/Examples/modula3/class/example.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* File : example.h */
-
-class Shape {
-public:
- Shape() {
- nshapes++;
- }
- virtual ~Shape() {
- nshapes--;
- }
- double x, y;
- void move(double dx, double dy);
- virtual double area() = 0;
- virtual double perimeter() = 0;
- static int nshapes;
-};
-
-class Circle : public Shape {
-private:
- double radius;
-public:
- Circle(double r) : radius(r) { }
- virtual double area();
- virtual double perimeter();
-};
-
-class Square : public Shape {
-private:
- double width;
-public:
- Square(double w) : width(w) { }
- virtual double area();
- virtual double perimeter();
-};
diff --git a/Examples/modula3/class/example.i b/Examples/modula3/class/example.i
deleted file mode 100644
index 2fafadbd6..000000000
--- a/Examples/modula3/class/example.i
+++ /dev/null
@@ -1,32 +0,0 @@
-/* File : example.i */
-%module Example
-
-%{
-#include "example.h"
-%}
-
-%insert(m3makefile) %{template("../swig")
-cxx_source("example_wrap")%}
-
-%typemap(m3rawinmode) Shape *, Circle *, Square * ""
-%typemap(m3rawrettype) Shape *, Circle *, Square * "$1_basetype"
-
-%typemap(m3wrapinmode) Shape *, Circle *, Square * ""
-%typemap(m3wrapargraw) Shape *, Circle *, Square * "self.cxxObj"
-
-%typemap(m3wrapretvar) Circle *, Square * "cxxObj : ExampleRaw.$1_basetype;"
-%typemap(m3wrapretraw) Circle *, Square * "cxxObj"
-%typemap(m3wrapretconv) Circle *, Square * "NEW($1_basetype,cxxObj:=cxxObj)"
-%typemap(m3wraprettype) Circle *, Square * "$1_basetype"
-
-/* Should work with and without renaming
-%rename(M3Shape) Shape;
-%rename(M3Circle) Circle;
-%rename(M3Square) Square;
-%typemap(m3wrapintype) Shape *, Circle *, Square * "M3$1_basetype"
-%typemap(m3wraprettype) Shape *, Circle *, Square * "M3$1_basetype"
-%typemap(m3wrapretconv) Circle *, Square * "NEW(M3$1_basetype,cxxObj:=cxxObj)"
-*/
-
-/* Let's just grab the original header file here */
-%include "example.h"
diff --git a/Examples/modula3/class/swig.tmpl b/Examples/modula3/class/swig.tmpl
deleted file mode 100644
index e3e9bf178..000000000
--- a/Examples/modula3/class/swig.tmpl
+++ /dev/null
@@ -1,11 +0,0 @@
-
-readonly proc cxx_source (X) is
- local cxxfile = X&".cxx"
- local objfile = X&".o"
- %exec("echo $PWD")
- if stale(objfile,cxxfile)
- exec("cd",path(),"; g++ -I.. -c -o",objfile,cxxfile)
- end
- import_obj(X)
- %unlink_file(path()&SL&objfile)
-end
diff --git a/Examples/modula3/enum/Makefile b/Examples/modula3/enum/Makefile
deleted file mode 100644
index 2c5c9b0a5..000000000
--- a/Examples/modula3/enum/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
-TARGET = example
-INTERFACE = example.i
-CONSTNUMERIC = example_const
-SWIGOPT = -c++
-MODULA3SRCS = *.[im]3
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
-
-build:
- $(SWIGEXE) -modula3 $(SWIGOPT) -module Example -generateconst $(CONSTNUMERIC) $(TARGET).h
- $(CXX) -Wall $(CONSTNUMERIC).c -o $(CONSTNUMERIC)
- $(CONSTNUMERIC) >$(CONSTNUMERIC).i
-
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
- m3ppinplace $(MODULA3SRCS)
- mv m3makefile $(MODULA3SRCS) src/
- cm3
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
diff --git a/Examples/modula3/enum/example.cxx b/Examples/modula3/enum/example.cxx
deleted file mode 100644
index bd808ff7c..000000000
--- a/Examples/modula3/enum/example.cxx
+++ /dev/null
@@ -1,32 +0,0 @@
-/* File : example.cxx */
-
-#include "example.h"
-#include
-
-void Foo::enum_test(speed s) {
- if (s == IMPULSE) {
- printf("IMPULSE speed\n");
- } else if (s == WARP) {
- printf("WARP speed\n");
- } else if (s == LUDICROUS) {
- printf("LUDICROUS speed\n");
- } else if (s == HYPER) {
- printf("HYPER speed\n");
- } else {
- printf("Unknown speed\n");
- }
-}
-
-void enum_test(color c, Foo::speed s) {
- if (c == RED) {
- printf("color = RED, ");
- } else if (c == BLUE) {
- printf("color = BLUE, ");
- } else if (c == GREEN) {
- printf("color = GREEN, ");
- } else {
- printf("color = Unknown color!, ");
- }
- Foo obj;
- obj.enum_test(s);
-}
diff --git a/Examples/modula3/enum/example.h b/Examples/modula3/enum/example.h
deleted file mode 100644
index 2f44a6ccf..000000000
--- a/Examples/modula3/enum/example.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* File : example.h */
-
-#define PI 3.141
-
-#define DAY_MONDAY 0
-#define DAY_TUESDAY 1
-#define DAY_WEDNESDAY 2
-#define DAY_THURSDAY 3
-#define DAY_FRIDAY 4
-#define DAY_SATURDAY 5
-#define DAY_SUNDAY 6
-
-enum color { BLUE, RED, GREEN };
-
-#define CLB_BLACK 0
-#define CLB_BLUE 1
-#define CLB_RED 2
-#define CLB_MAGENTA 3
-#define CLB_GREEN 4
-#define CLB_CYAN 5
-#define CLB_YELLOW 6
-#define CLB_WHITE 7
-
-/* Using this would be good style
- which cannot be expected for general C header files.
- Instead I want to demonstrate how to live without it.
-enum month {
- MTHF_JANUARY,
- MTHF_FEBRUARY,
- MTHF_MARCH,
- MTHF_APRIL,
- MTHF_MAY,
- MTHF_JUNE,
- MTHF_JULY,
- MTHF_AUGUST,
- MTHF_SEPTEMBER,
- MTHF_OCTOBER,
- MTHF_NOVEMBER,
- MTHF_DECEMBER,
-}
-*/
-
-/* Since there are no compile time constants in C / C++
- it is a common abuse
- to declare bit set (flag) constants
- as enumerations. */
-enum calendar {
- MTHB_JANUARY = 1 << 0, /* 1 << MTHF_JANUARY, */
- MTHB_FEBRUARY = 1 << 1, /* 1 << MTHF_FEBRUARY, */
- MTHB_MARCH = 1 << 2, /* 1 << MTHF_MARCH, */
- MTHB_APRIL = 1 << 3, /* 1 << MTHF_APRIL, */
- MTHB_MAY = 1 << 4, /* 1 << MTHF_MAY, */
- MTHB_JUNE = 1 << 5, /* 1 << MTHF_JUNE, */
- MTHB_JULY = 1 << 6, /* 1 << MTHF_JULY, */
- MTHB_AUGUST = 1 << 7, /* 1 << MTHF_AUGUST, */
- MTHB_SEPTEMBER = 1 << 8, /* 1 << MTHF_SEPTEMBER, */
- MTHB_OCTOBER = 1 << 9, /* 1 << MTHF_OCTOBER, */
- MTHB_NOVEMBER = 1 << 10, /* 1 << MTHF_NOVEMBER, */
- MTHB_DECEMBER = 1 << 11, /* 1 << MTHF_DECEMBER, */
-
- MTHB_SPRING = MTHB_MARCH | MTHB_APRIL | MTHB_MAY,
- MTHB_SUMMER = MTHB_JUNE | MTHB_JULY | MTHB_AUGUST,
- MTHB_AUTUMN = MTHB_SEPTEMBER | MTHB_OCTOBER | MTHB_NOVEMBER,
- MTHB_WINTER = MTHB_DECEMBER | MTHB_JANUARY | MTHB_FEBRUARY,
-};
-
-
-namespace Answer {
- enum {
- UNIVERSE_AND_EVERYTHING = 42,
- SEVENTEEN_AND_FOUR = 21,
- TWOHUNDRED_PERCENT_OF_NOTHING = 0,
- };
-
- class Foo {
- public:
- Foo() { }
- enum speed { IMPULSE = -2, WARP = 0, HYPER, LUDICROUS = 3};
- void enum_test(speed s);
- };
-};
-
-void enum_test(color c, Answer::Foo::speed s);
diff --git a/Examples/modula3/enum/example.i b/Examples/modula3/enum/example.i
deleted file mode 100644
index f5947b3bc..000000000
--- a/Examples/modula3/enum/example.i
+++ /dev/null
@@ -1,72 +0,0 @@
-/* File : example.i */
-%module Example
-
-%{
-#include "example.h"
-%}
-
-%include "example_const.i"
-
-// such features are generated by the following pragmas
-#if 0
-%feature("modula3:enumitem:enum","Days") DAY_MONDAY;
-%feature("modula3:enumitem:name","monday") DAY_MONDAY;
-%feature("modula3:enumitem:conv","int:int") DAY_MONDAY;
-
-%feature("modula3:enumitem:enum","Month") MTHB_JANUARY;
-%feature("modula3:enumitem:name","january") MTHB_JANUARY;
-%feature("modula3:enumitem:conv","set:int") MTHB_JANUARY;
-//%feature("modula3:constset:type","MonthSet") MTHB_JANUARY; /*type in the constant definition*/
-%feature("modula3:constset:set", "MonthSet") MTHB_JANUARY; /*remarks that the 'type' is a set type*/
-%feature("modula3:constset:base","Month") MTHB_JANUARY;
-%feature("modula3:constset:name","monthsJanuary") MTHB_JANUARY;
-%feature("modula3:constset:conv","set:set") MTHB_JANUARY; /*conversion of the bit pattern: no change*/
-
-%feature("modula3:enumitem:enum","Color") BLUE;
-%feature("modula3:enumitem:name","blue") BLUE;
-%feature("modula3:enumitem:conv","int:int") BLUE;
-
-%feature("modula3:constint:type","INTEGER") Foo::IMPULSE;
-%feature("modula3:constint:name","impulse") Foo::IMPULSE;
-%feature("modula3:constint:conv","int:int") Foo::IMPULSE;
-#endif
-
-%rename(pi) PI;
-
-%pragma(modula3) enumitem="prefix=DAY_;int;srcstyle=underscore;Day";
-
-%pragma(modula3) enumitem="enum=color;int;srcstyle=underscore;Color";
-%pragma(modula3) makesetofenum="Color";
-%pragma(modula3) constset="prefix=CLB_;set;srcstyle=underscore,prefix=clb;ColorSet,Color";
-
-%pragma(modula3) enumitem="prefix=MTHB_,enum=calendar;set;srcstyle=underscore;Month";
-%pragma(modula3) makesetofenum="Month";
-%pragma(modula3) constset="prefix=MTHB_,enum=calendar;set;srcstyle=underscore,prefix=monthset;MonthSet,Month";
-
-%pragma(modula3) constint="prefix=Answer::Foo::,enum=Answer::Foo::speed;int;srcstyle=underscore,prefix=speed;INTEGER";
-
-%pragma(modula3) constint="prefix=Answer::,enum=Answer::;int;srcstyle=underscore,prefix=answer;CARDINAL";
-
-%rename(AnswerFoo) Answer::Foo;
-%typemap("m3rawrettype") Answer::Foo * %{AnswerFoo%}
-%typemap("m3rawintype") Answer::Foo * %{AnswerFoo%}
-%typemap("m3rawinmode") Answer::Foo * %{%}
-%typemap("m3wraprettype") Answer::Foo * %{AnswerFoo%}
-%typemap("m3wrapintype") Answer::Foo * %{AnswerFoo%}
-%typemap("m3wrapinmode") Answer::Foo * %{%}
-%typemap("m3wrapargraw") Answer::Foo * %{self.cxxObj%}
-
-%typemap("m3wrapretvar") Answer::Foo * %{cxxObj : ExampleRaw.AnswerFoo;%}
-%typemap("m3wrapretraw") Answer::Foo * %{cxxObj%}
-%typemap("m3wrapretconv") Answer::Foo * %{NEW(AnswerFoo,cxxObj:=cxxObj)%}
-
-
-%typemap("m3rawintype") Answer::Foo::speed %{C.int%};
-%typemap("m3rawintype:import") Answer::Foo::speed %{Ctypes AS C%};
-%typemap("m3wrapintype") Answer::Foo::speed %{[-2..3]%};
-
-%typemap("m3wrapintype") color %{Color%};
-%typemap("m3wrapargraw") color %{ORD($1_name)%};
-
-/* Let's just grab the original header file here */
-%include "example.h"
diff --git a/Examples/modula3/exception/Makefile b/Examples/modula3/exception/Makefile
deleted file mode 100644
index 8d12ef19e..000000000
--- a/Examples/modula3/exception/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-SWIGOPT =
-MODULA3SRCS = *.[im]3
-MODULA3FLAGS= -o runme
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3_cpp
-# $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MODULA3SRCS='$(MODULA3SRCS)' MODULA3FLAGS='$(MODULA3FLAGS)' modula3_compile
- m3ppinplace $(MODULA3SRCS)
- mv m3makefile $(MODULA3SRCS) src/
- cm3
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
diff --git a/Examples/modula3/exception/example.h b/Examples/modula3/exception/example.h
deleted file mode 100644
index 0e9e0e81d..000000000
--- a/Examples/modula3/exception/example.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* File : example.h */
-
-enum error {OK, OVERFLOW, DIVISION_BY_ZERO, NEGATIVE_RADICAND, NEGATIVE_BASE};
-typedef error errorstate; /* just to separate the typemaps */
-
-error acc_add (double &x, double y);
-error acc_sub (double &x, double y);
-error acc_mul (double &x, double y);
-error acc_div (double &x, double y);
-
-double op_add (double x, double y, errorstate &err);
-double op_sub (double x, double y, errorstate &err);
-double op_mul (double x, double y, errorstate &err);
-double op_div (double x, double y, errorstate &err);
-double op_sqrt (double x, errorstate &err);
-double op_pow (double x, double y, errorstate &err);
-
-double op_noexc (double x, double y);
diff --git a/Examples/modula3/exception/example.i b/Examples/modula3/exception/example.i
deleted file mode 100644
index 92a716fae..000000000
--- a/Examples/modula3/exception/example.i
+++ /dev/null
@@ -1,43 +0,0 @@
-/* File : example.i */
-%module Example
-
-%{
-#include "example.h"
-%}
-
-%insert(m3wrapintf) %{
-EXCEPTION E(Error);
-%}
-%insert(m3wrapimpl) %{
-IMPORT Ctypes AS C;
-%}
-
-%pragma(modula3) enumitem="enum=error;int;srcstyle=underscore;Error";
-
-%typemap("m3rawintype") double & %{C.double%};
-%typemap("m3wrapintype") double & %{LONGREAL%};
-
-%typemap("m3wraprettype") error ""
-%typemap("m3wrapretvar") error "rawerr: C.int;"
-%typemap("m3wrapretraw") error "rawerr"
-%typemap("m3wrapretcheck:throws") error "E"
-%typemap("m3wrapretcheck") error
-%{VAR err := VAL(rawerr, Error);
-BEGIN
-IF err # Error.ok THEN
-RAISE E(err);
-END;
-END;%}
-
-%typemap("m3rawintype") errorstate & %{C.int%};
-%typemap("m3wrapintype",numinputs=0) errorstate & %{%};
-%typemap("m3wrapargvar") errorstate & %{err:C.int:=ORD(Error.ok);%};
-%typemap("m3wrapoutcheck:throws") errorstate & "E";
-%typemap("m3wrapoutcheck") errorstate &
-%{IF VAL(err,Error) # Error.ok THEN
-RAISE E(VAL(err,Error));
-END;%}
-
-/* Let's just grab the original header file here */
-
-%include "example.h"
diff --git a/Examples/modula3/reference/Makefile b/Examples/modula3/reference/Makefile
deleted file mode 100644
index eaceceb1f..000000000
--- a/Examples/modula3/reference/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
-TARGET = example
-INTERFACE = example.i
-SWIGOPT = -c++
-MODULA3SRCS = *.[im]3
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
- m3ppinplace $(MODULA3SRCS)
- mv m3makefile $(MODULA3SRCS) src/
- cm3
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
diff --git a/Examples/modula3/reference/example.cxx b/Examples/modula3/reference/example.cxx
deleted file mode 100644
index 9dbaed2ee..000000000
--- a/Examples/modula3/reference/example.cxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* File : example.cxx */
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-#include "example.h"
-#include
-#include
-
-Vector operator+(const Vector &a, const Vector &b) {
- Vector r;
- r.x = a.x + b.x;
- r.y = a.y + b.y;
- r.z = a.z + b.z;
- return r;
-}
-
-char *Vector::print() {
- static char temp[512];
- sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
- return temp;
-}
-
-VectorArray::VectorArray(int size) {
- items = new Vector[size];
- maxsize = size;
-}
-
-VectorArray::~VectorArray() {
- delete [] items;
-}
-
-Vector &VectorArray::operator[](int index) {
- if ((index < 0) || (index >= maxsize)) {
- printf("Panic! Array index out of bounds.\n");
- exit(1);
- }
- return items[index];
-}
-
-int VectorArray::size() {
- return maxsize;
-}
-
diff --git a/Examples/modula3/reference/example.h b/Examples/modula3/reference/example.h
deleted file mode 100644
index 7b4ba8fb8..000000000
--- a/Examples/modula3/reference/example.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* File : example.h */
-
-struct Vector {
-private:
- double x,y,z;
-public:
- Vector() : x(0), y(0), z(0) { }
- Vector(double x, double y, double z) : x(x), y(y), z(z) { }
- Vector operator+(const Vector &b) const;
- char *print();
-};
-
-struct VectorArray {
-private:
- Vector *items;
- int maxsize;
-public:
- VectorArray(int maxsize);
- ~VectorArray();
- Vector &operator[](int);
- int size();
-};
diff --git a/Examples/modula3/reference/example.i b/Examples/modula3/reference/example.i
deleted file mode 100644
index 002090918..000000000
--- a/Examples/modula3/reference/example.i
+++ /dev/null
@@ -1,32 +0,0 @@
-/* File : example.i */
-
-/* This file has a few "typical" uses of C++ references. */
-
-%module Example
-
-%{
-#include "example.h"
-%}
-
-%pragma(modula3) unsafe="1";
-
-%insert(m3wrapintf) %{FROM ExampleRaw IMPORT Vector, VectorArray;%}
-%insert(m3wrapimpl) %{FROM ExampleRaw IMPORT Vector, VectorArray;%}
-
-%typemap(m3wrapretvar) Vector %{vec: UNTRACED REF Vector;%}
-%typemap(m3wrapretraw) Vector %{vec%}
-%typemap(m3wrapretconv) Vector %{vec^%}
-
-
-/* This helper function calls an overloaded operator */
-%inline %{
-Vector addv(const Vector &a, const Vector &b) {
- return a+b;
-}
-%}
-
-%rename(Vector_Clear) Vector::Vector();
-%rename(Add) Vector::operator+;
-%rename(GetItem) VectorArray::operator[];
-
-%include "example.h"
diff --git a/Examples/modula3/simple/Makefile b/Examples/modula3/simple/Makefile
deleted file mode 100644
index 3ba35d18b..000000000
--- a/Examples/modula3/simple/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
-TARGET = example
-INTERFACE = example.i
-SWIGOPT =
-MODULA3SRCS = *.[im]3
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
- m3ppinplace $(MODULA3SRCS)
- mv m3makefile $(MODULA3SRCS) src/
- cm3
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
diff --git a/Examples/modula3/simple/example.c b/Examples/modula3/simple/example.c
deleted file mode 100644
index 1c2af789c..000000000
--- a/Examples/modula3/simple/example.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* File : example.c */
-
-/* A global variable */
-double Foo = 3.0;
-
-/* Compute the greatest common divisor of positive integers */
-int gcd(int x, int y) {
- int g;
- g = y;
- while (x > 0) {
- g = x;
- x = y % x;
- y = g;
- }
- return g;
-}
-
-
diff --git a/Examples/modula3/simple/example.i b/Examples/modula3/simple/example.i
deleted file mode 100644
index 1694e6dbe..000000000
--- a/Examples/modula3/simple/example.i
+++ /dev/null
@@ -1,7 +0,0 @@
-/* File : example.i */
-%module Example
-
-%inline %{
-extern int gcd(int x, int y);
-extern double Foo;
-%}
diff --git a/Examples/modula3/typemap/Makefile b/Examples/modula3/typemap/Makefile
deleted file mode 100644
index 3ba35d18b..000000000
--- a/Examples/modula3/typemap/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
-TARGET = example
-INTERFACE = example.i
-SWIGOPT =
-MODULA3SRCS = *.[im]3
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
- m3ppinplace $(MODULA3SRCS)
- mv m3makefile $(MODULA3SRCS) src/
- cm3
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
diff --git a/Examples/modula3/typemap/example.i b/Examples/modula3/typemap/example.i
deleted file mode 100644
index 2f454eff3..000000000
--- a/Examples/modula3/typemap/example.i
+++ /dev/null
@@ -1,90 +0,0 @@
-/* File : example.i */
-%module Example
-
-%pragma(modula3) unsafe="true";
-
-%insert(m3wrapintf) %{FROM ExampleRaw IMPORT Window, Point;
-%}
-%insert(m3wrapimpl) %{FROM ExampleRaw IMPORT Window, Point;
-IMPORT M3toC;
-IMPORT Ctypes AS C;
-%}
-
-/* Typemap applied to patterns of multiple arguments */
-
-%typemap(m3rawinmode) (char *outstr) %{VAR%}
-%typemap(m3rawintype) (char *outstr) %{CHAR%}
-%typemap(m3wrapinmode) (char *outstr, int size) %{VAR%}
-%typemap(m3wrapintype) (char *outstr, int size) %{ARRAY OF CHAR%}
-%typemap(m3wrapargraw) (char *outstr, int size) %{$1_name[0], NUMBER($1_name)%}
-
-
-%typemap(m3rawinmode) (const struct Window *) %{READONLY%}
-%typemap(m3wrapinmode) (const struct Window *) %{READONLY%}
-%typemap(m3rawintype) ( struct Window *) %{Window%}
-%typemap(m3wrapintype) ( struct Window *) %{Window%}
-
-%typemap(m3rawinmode) (const char *str []) %{READONLY%}
-%typemap(m3wrapinmode) (const char *str []) %{READONLY%}
-%typemap(m3rawintype) (const char *str []) %{(*ARRAY OF*) C.char_star%}
-%typemap(m3wrapintype) (const char *str []) %{ARRAY OF TEXT%}
-%typemap(m3wrapargvar) (const char *str []) %{$1: REF ARRAY OF C.char_star;%}
-%typemap(m3wrapargraw) (const char *str []) %{$1[0]%}
-%typemap(m3wrapinconv) (const char *str []) %{$1:= NEW(REF ARRAY OF C.char_star,NUMBER($1_name));
-FOR i:=FIRST($1_name) TO LAST($1_name) DO
-$1[i]:=M3toC.SharedTtoS($1_name[i]);
-END;%}
-%typemap(m3wrapfreearg) (const char *str [])
-%{FOR i:=FIRST($1_name) TO LAST($1_name) DO
-M3toC.FreeSharedS($1_name[i],$1[i]);
-END;%}
-
-%typemap(m3wraprettype) char * %{TEXT%}
-%typemap(m3wrapretvar) char * %{result_string: C.char_star;%}
-%typemap(m3wrapretraw) char * %{result_string%}
-%typemap(m3wrapretconv) char * %{M3toC.CopyStoT(result_string)%}
-
-struct Window {
- char *label;
- int left,top,width,height;
-};
-
-
-%typemap(m3wrapinname) (int x, int y) %{p%}
-%typemap(m3wrapinmode) (int x, int y) %{READONLY%}
-%typemap(m3wrapintype) (int x, int y) %{Point%}
-%typemap(m3wrapargraw) (int x, int y) %{p.$1_name, p.$2_name%}
-
-%typemap(m3wrapargraw) (int &x, int &y) %{p.$1_name, p.$2_name%}
-%typemap(m3wrapintype) (int &x, int &y) %{Point%}
-%typemap(m3wrapoutname) (int &x, int &y) %{p%}
-%typemap(m3wrapouttype) (int &x, int &y) %{Point%}
-%typemap(m3wrapargdir) (int &x, int &y) "out"
-
-
-%typemap(m3wrapargvar) int &left, int &top, int &width, int &height "$1:C.int;"
-%typemap(m3wrapargraw) int &left, int &top, int &width, int &height "$1"
-%typemap(m3wrapoutconv) int &left, int &top, int &width, int &height "$1"
-
-%typemap(m3wrapargdir) int &left, int &top "out"
-
-%typemap(m3wrapouttype) int &width, int &height "CARDINAL"
-%typemap(m3wrapargdir) int &width, int &height "out"
-
-struct Point {
- int x,y;
-};
-
-%m3multiretval get_box;
-
-void set_label ( struct Window *win, const char *str, bool activate);
-void set_multi_label ( struct Window *win, const char *str []);
-void write_label (const struct Window *win, char *outstr, int size);
-int get_label (const struct Window *win, char *outstr, int size);
-char *get_label_ptr (const struct Window *win);
-void move(struct Window *win, int x, int y);
-int get_area(const struct Window *win);
-void get_box(const struct Window *win, int &left, int &top, int &width, int &height);
-void get_left(const struct Window *win, int &left);
-void get_mouse(const struct Window *win, int &x, int &y);
-int get_attached_data(const struct Window *win, const char *id);
diff --git a/Examples/ocaml/shapes/example.i b/Examples/ocaml/shapes/example.i
index ac0fa4a56..a261b92e7 100644
--- a/Examples/ocaml/shapes/example.i
+++ b/Examples/ocaml/shapes/example.i
@@ -1,10 +1,8 @@
/* File : example.i */
%module(directors="1") example
-#ifndef SWIGSEXP
%{
#include "example.h"
%}
-#endif
%feature("director");
%include "example.h"
diff --git a/Examples/octave/check.list b/Examples/octave/check.list
index e9c719231..54a591042 100644
--- a/Examples/octave/check.list
+++ b/Examples/octave/check.list
@@ -8,8 +8,8 @@ extend
funcptr
funcptr2
functor
-operator
module_load
+operator
pointer
reference
simple
diff --git a/Examples/octave/example.mk b/Examples/octave/example.mk
index 1ab96f038..88608a12b 100644
--- a/Examples/octave/example.mk
+++ b/Examples/octave/example.mk
@@ -8,25 +8,25 @@ TARGET = swigexample
INTERFACE = example.i
check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
+ $(MAKE) -f $(TOP)/Makefile PCHSUPPORT=no SRCDIR='$(SRCDIR)' octave_run
build:
ifneq (,$(SRCS))
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ $(MAKE) -f $(TOP)/Makefile PCHSUPPORT=no SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
else
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ $(MAKE) -f $(TOP)/Makefile PCHSUPPORT=no SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
endif
ifneq (,$(TARGET2)$(SWIGOPT2))
ifneq (,$(SRCS))
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ $(MAKE) -f $(TOP)/Makefile PCHSUPPORT=no SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT2)' TARGET='$(TARGET2)' INTERFACE='$(INTERFACE)' octave
else
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ $(MAKE) -f $(TOP)/Makefile PCHSUPPORT=no SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT2)' TARGET='$(TARGET2)' INTERFACE='$(INTERFACE)' octave_cpp
endif
@@ -34,4 +34,4 @@ endif
clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+ $(MAKE) -f $(TOP)/Makefile PCHSUPPORT=no SRCDIR='$(SRCDIR)' octave_clean
diff --git a/Examples/php/callback/runme.php b/Examples/php/callback/runme.php
index 2be71994f..e7093209c 100644
--- a/Examples/php/callback/runme.php
+++ b/Examples/php/callback/runme.php
@@ -2,8 +2,6 @@
# This file illustrates the cross language polymorphism using directors.
-require("example.php");
-
# Class, which overwrites Callback::run().
class PhpCallback extends Callback {
@@ -43,5 +41,3 @@ $caller->delCallback();
# All done.
print "php exit\n";
-
-?>
diff --git a/Examples/php/class/runme.php b/Examples/php/class/runme.php
index 99c253b46..0f667695b 100644
--- a/Examples/php/class/runme.php
+++ b/Examples/php/class/runme.php
@@ -2,8 +2,6 @@
# This example illustrates how member variables are wrapped.
-require("example.php");
-
# ----- Object creation -----
print "Creating some objects:\n";
@@ -56,5 +54,3 @@ $o = NULL;
print Shape::nshapes() . " shapes remain\n";
print "Goodbye\n";
-
-?>
diff --git a/Examples/php/constants/runme.php b/Examples/php/constants/runme.php
index 91c597a40..e561626d8 100644
--- a/Examples/php/constants/runme.php
+++ b/Examples/php/constants/runme.php
@@ -1,7 +1,5 @@
diff --git a/Examples/php/cpointer/runme.php b/Examples/php/cpointer/runme.php
index 22e8a681a..f552ed78a 100644
--- a/Examples/php/cpointer/runme.php
+++ b/Examples/php/cpointer/runme.php
@@ -1,7 +1,5 @@
diff --git a/Examples/php/disown/runme.php b/Examples/php/disown/runme.php
index a70d7b061..e847dc71d 100644
--- a/Examples/php/disown/runme.php
+++ b/Examples/php/disown/runme.php
@@ -4,8 +4,6 @@
# created by SWIG. In this case, all of our C++ classes
# get converted into function calls.
-require("example.php");
-
# ----- Object creation -----
print "Creating some objects:\n";
@@ -45,5 +43,3 @@ $container = NULL;
print "\nA total of " . Shape::nshapes() . " shapes remain\n";
print "Goodbye\n";
-
-?>
diff --git a/Examples/php/enum/runme.php b/Examples/php/enum/runme.php
index 813476645..bf5ba881f 100644
--- a/Examples/php/enum/runme.php
+++ b/Examples/php/enum/runme.php
@@ -1,7 +1,5 @@
enum_test(Foo::IMPULSE);
$f->enum_test(Foo::WARP);
$f->enum_test(Foo::LUDICROUS);
-
-?>
diff --git a/Examples/php/extend/runme.php b/Examples/php/extend/runme.php
index 158683142..93eedee99 100644
--- a/Examples/php/extend/runme.php
+++ b/Examples/php/extend/runme.php
@@ -2,8 +2,6 @@
# This file illustrates the cross language polymorphism using directors.
-require("example.php");
-
# CEO class, which overrides Employee::getPosition().
class CEO extends Manager {
@@ -72,5 +70,3 @@ print "----------------------\n";
# All done.
print "php exit\n";
-
-?>
diff --git a/Examples/php/funcptr/runme.php b/Examples/php/funcptr/runme.php
index 712d4147c..d76a19bc7 100644
--- a/Examples/php/funcptr/runme.php
+++ b/Examples/php/funcptr/runme.php
@@ -1,7 +1,5 @@
-
+print " ADD = " . example::ADD . "\n";
+print " SUB = " . example::SUB . "\n";
+print " MUL = " . example::MUL . "\n";
diff --git a/Examples/php/overloading/runme.php b/Examples/php/overloading/runme.php
index 56d515138..d4df899f0 100644
--- a/Examples/php/overloading/runme.php
+++ b/Examples/php/overloading/runme.php
@@ -4,8 +4,6 @@
# created by SWIG. In this case, all of our C++ classes
# get converted into function calls.
-include("example.php");
-
# ----- Object creation -----
print "Creating some objects:\n";
@@ -54,5 +52,3 @@ $s = 42;
print Shape::nshapes() . " shapes remain\n";
print "Goodbye\n";
-
-?>
diff --git a/Examples/php/pointer/example.i b/Examples/php/pointer/example.i
index 1f0059406..31d2a03e0 100644
--- a/Examples/php/pointer/example.i
+++ b/Examples/php/pointer/example.i
@@ -21,10 +21,5 @@ extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
/* Next we'll use typemaps and the %apply directive */
-//%apply int *OUTPUT { int *r };
-//extern int divide(int n, int d, int *r);
-
-
-
-
-
+%apply int *OUTPUT { int *r };
+extern int divide(int n, int d, int *r);
diff --git a/Examples/php/pointer/runme.php b/Examples/php/pointer/runme.php
index e79b23810..8dc3ab887 100644
--- a/Examples/php/pointer/runme.php
+++ b/Examples/php/pointer/runme.php
@@ -1,7 +1,5 @@
+ print "Testing multiple return values\n";
+ $a = divide(42,37);
+ $q = $a[0];
+ $r = $a[1];
+ print " 42/37 = $q remainder $r\n";
diff --git a/Examples/php/pragmas/include.php b/Examples/php/pragmas/include.php
index 11d985d66..442f8e2e0 100644
--- a/Examples/php/pragmas/include.php
+++ b/Examples/php/pragmas/include.php
@@ -2,6 +2,3 @@
# This code is inserted into example.php
echo "This is include.php\n";
-
-
-?>
diff --git a/Examples/php/pragmas/runme.php b/Examples/php/pragmas/runme.php
index 7b2c179cb..e2b276313 100644
--- a/Examples/php/pragmas/runme.php
+++ b/Examples/php/pragmas/runme.php
@@ -6,4 +6,3 @@ set_include_path(realpath(dirname(__FILE__)) . PATH_SEPARATOR . get_include_path
require "example.php";
echo "Version - " . ((new ReflectionExtension('example'))->getVersion()) . "\n";
-?>
diff --git a/Examples/php/proxy/runme.php b/Examples/php/proxy/runme.php
index e70ab229f..0f156b6ad 100644
--- a/Examples/php/proxy/runme.php
+++ b/Examples/php/proxy/runme.php
@@ -4,8 +4,6 @@
# created by SWIG. In this case, all of our C++ classes
# get converted into function calls.
-include("example.php");
-
# ----- Object creation -----
print "Creating some objects:\n";
@@ -64,5 +62,3 @@ Shape::nshapes(42);
print Shape::get_nshapes() ." == 42\n";
print "Goodbye\n";
-
-?>
diff --git a/Examples/php/reference/runme.php b/Examples/php/reference/runme.php
index 5d264ee43..5c7fc9a88 100644
--- a/Examples/php/reference/runme.php
+++ b/Examples/php/reference/runme.php
@@ -2,8 +2,6 @@
# This file illustrates the manipulation of C++ references in PHP.
-require "example.php";
-
# ----- Object creation -----
print "Creating some objects:\n";
@@ -45,5 +43,3 @@ print "Getting some array values\n";
for ($i = 0; $i < 5; $i++) {
print " va[$i] = {$va->get($i)->as_string()}\n";
}
-
-?>
diff --git a/Examples/php/simple/runme.php b/Examples/php/simple/runme.php
index 0e96fe800..2795f32a0 100644
--- a/Examples/php/simple/runme.php
+++ b/Examples/php/simple/runme.php
@@ -1,7 +1,5 @@
diff --git a/Examples/php/sync/example.cxx b/Examples/php/sync/example.cxx
index 0942279b2..2001a5b4e 100644
--- a/Examples/php/sync/example.cxx
+++ b/Examples/php/sync/example.cxx
@@ -1,13 +1,19 @@
#include "example.h"
-#include
+#include
int x = 42;
-char *s = (char *)"Test";
+std::string s = "Test";
-void Sync::printer(void) {
-
- printf("The value of global s is %s\n", s);
- printf("The value of global x is %d\n", x);
- printf("The value of class s is %s\n", s);
- printf("The value of class x is %d\n", x);
+void Sync::printer() {
+ std::cout << "The value of global s is " << ::s << '\n';
+ std::cout << "The value of global x is " << ::x << '\n';
+ std::cout << "The value of class s is " << this->s << '\n';
+ std::cout << "The value of class x is " << this->x << '\n';
+}
+
+void Sync::all_change() {
+ ::s = "global change";
+ ++::x;
+ this->s = "local change";
+ ++this->x;
}
diff --git a/Examples/php/sync/example.h b/Examples/php/sync/example.h
index d67ec21dc..381473f2e 100644
--- a/Examples/php/sync/example.h
+++ b/Examples/php/sync/example.h
@@ -1,9 +1,14 @@
-extern char *s;
+#include
+
+extern std::string s;
extern int x;
class Sync {
- public:
- int x;
- char *s;
- void printer(void);
+ public:
+ int x;
+ std::string s;
+ void printer();
+ void all_change();
+
+ Sync() : x(0) { }
};
diff --git a/Examples/php/sync/example.i b/Examples/php/sync/example.i
index 17ff87cf3..bc10e0fb7 100644
--- a/Examples/php/sync/example.i
+++ b/Examples/php/sync/example.i
@@ -1,5 +1,7 @@
%module example
+%include
+
%{
#include "example.h"
%}
diff --git a/Examples/php/sync/runme.php b/Examples/php/sync/runme.php
index a7c43474f..f01a9b3f6 100644
--- a/Examples/php/sync/runme.php
+++ b/Examples/php/sync/runme.php
@@ -1,15 +1,29 @@
-// Load module and PHP classes.
-include("example.php");
+echo "PHP reading globals: string is '", s_get(), "' and value is ", x_get(), "\n";
-echo "Got new object\n";
-echo "Got string $s and value $x \n";
-
-$s = new Sync();
+$o = new Sync();
echo "Got new object\n";
-$s->printer();
+echo "PHP reading object: string is '", $o->s, "' and value is ", $o->x, "\n";
-?>
+$o->printer();
+example::s_set("global string");
+example::x_set(42);
+
+$o->s = "object string";
+$o->x = 1234;
+
+echo "PHP reading globals: string is '", example::s_get(), "' and int is ", example::x_get(), "\n";
+echo "PHP reading object: string is '", $o->s, "' and int is ", $o->x, "\n";
+
+$o->printer();
+
+echo "Calling all_change() method\n";
+$o->all_change();
+
+echo "PHP reading globals: string is '", example::s_get(), "' and int is ", example::x_get(), "\n";
+echo "PHP reading object: string is '", $o->s, "' and int is ", $o->x, "\n";
+
+$o->printer();
diff --git a/Examples/php/value/runme.php b/Examples/php/value/runme.php
index 569c87cf5..754f94233 100644
--- a/Examples/php/value/runme.php
+++ b/Examples/php/value/runme.php
@@ -1,8 +1,5 @@
x = 1.0;
$v->y = 2.0;
@@ -34,10 +31,6 @@
echo "\nNow I'm going to clean up the return result\n";
-# free($r);
+ unset($r);
echo "Good\n";
-
-?>
-
-
diff --git a/Examples/php/variables/runme.php b/Examples/php/variables/runme.php
index 14f27f389..a14fede72 100644
--- a/Examples/php/variables/runme.php
+++ b/Examples/php/variables/runme.php
@@ -1,6 +1,5 @@
-
diff --git a/Examples/pike/check.list b/Examples/pike/check.list
deleted file mode 100644
index d6c8e2e7b..000000000
--- a/Examples/pike/check.list
+++ /dev/null
@@ -1,7 +0,0 @@
-# see top-level Makefile.in
-class
-constants
-enum
-overload
-simple
-template
diff --git a/Examples/pike/class/Makefile b/Examples/pike/class/Makefile
deleted file mode 100644
index e5319dbe2..000000000
--- a/Examples/pike/class/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp
-
-static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean
diff --git a/Examples/pike/class/example.cxx b/Examples/pike/class/example.cxx
deleted file mode 100644
index 046304519..000000000
--- a/Examples/pike/class/example.cxx
+++ /dev/null
@@ -1,28 +0,0 @@
-/* File : example.cxx */
-
-#include "example.h"
-#define M_PI 3.14159265358979323846
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
- x += dx;
- y += dy;
-}
-
-int Shape::nshapes = 0;
-
-double Circle::area() {
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter() {
- return 2*M_PI*radius;
-}
-
-double Square::area() {
- return width*width;
-}
-
-double Square::perimeter() {
- return 4*width;
-}
diff --git a/Examples/pike/class/example.h b/Examples/pike/class/example.h
deleted file mode 100644
index 0dff185b2..000000000
--- a/Examples/pike/class/example.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* File : example.h */
-
-class Shape {
-public:
- Shape() {
- nshapes++;
- }
- virtual ~Shape() {
- nshapes--;
- }
- double x, y;
- void move(double dx, double dy);
- virtual double area() = 0;
- virtual double perimeter() = 0;
- static int nshapes;
-};
-
-class Circle : public Shape {
-private:
- double radius;
-public:
- Circle(double r) : radius(r) { }
- virtual double area();
- virtual double perimeter();
-};
-
-class Square : public Shape {
-private:
- double width;
-public:
- Square(double w) : width(w) { }
- virtual double area();
- virtual double perimeter();
-};
diff --git a/Examples/pike/class/example.i b/Examples/pike/class/example.i
deleted file mode 100644
index fbdf7249f..000000000
--- a/Examples/pike/class/example.i
+++ /dev/null
@@ -1,9 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/* Let's just grab the original header file here */
-%include "example.h"
diff --git a/Examples/pike/class/runme.pike b/Examples/pike/class/runme.pike
deleted file mode 100644
index a6377600e..000000000
--- a/Examples/pike/class/runme.pike
+++ /dev/null
@@ -1,53 +0,0 @@
-import .example;
-
-int main()
-{
- // ----- Object creation -----
-
- write("Creating some objects:\n");
- Circle c = Circle(10.0);
- write(" Created circle.\n");
- Square s = Square(10.0);
- write(" Created square.\n");
-
- // ----- Access a static member -----
-
- write("\nA total of " + Shape_nshapes_get() + " shapes were created\n");
-
- // ----- Member data access -----
-
- // Set the location of the object
-
- c->x_set(20.0);
- c->y_set(30.0);
-
- s->x_set(-10.0);
- s->y_set(5.0);
-
- write("\nHere is their current position:\n");
- write(" Circle = (%f, %f)\n", c->x_get(), c->y_get());
- write(" Square = (%f, %f)\n", s->x_get(), s->y_get());
-
- // ----- Call some methods -----
-
- write("\nHere are some properties of the shapes:\n");
- write(" The circle:\n");
- write(" area = %f.\n", c->area());
- write(" perimeter = %f.\n", c->perimeter());
- write(" The square:\n");
- write(" area = %f.\n", s->area());
- write(" perimeter = %f.\n", s->perimeter());
-
- write("\nGuess I'll clean up now\n");
-
- /* See if we can force 's' to be garbage-collected */
- s = 0;
-
- /* Now we should be down to only 1 shape */
- write("%d shapes remain\n", Shape_nshapes_get());
-
- /* Done */
- write("Goodbye\n");
-
- return 0;
-}
diff --git a/Examples/pike/constants/Makefile b/Examples/pike/constants/Makefile
deleted file mode 100644
index 45da7d269..000000000
--- a/Examples/pike/constants/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS =
-TARGET = example
-INTERFACE = example.i
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike
-
-static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean
diff --git a/Examples/pike/constants/example.i b/Examples/pike/constants/example.i
deleted file mode 100644
index 4f7b1a4d7..000000000
--- a/Examples/pike/constants/example.i
+++ /dev/null
@@ -1,27 +0,0 @@
-/* File : example.i */
-%module example
-
-/* A few preprocessor macros */
-
-#define ICONST 42
-#define FCONST 2.1828
-#define CCONST 'x'
-#define CCONST2 '\n'
-#define SCONST "Hello World"
-#define SCONST2 "\"Hello World\""
-
-/* This should work just fine */
-#define EXPR ICONST + 3*(FCONST)
-
-/* This shouldn't do anything */
-#define EXTERN extern
-
-/* Neither should this (BAR isn't defined) */
-#define FOO (ICONST + BAR)
-
-/* The following directives also produce constants */
-
-%constant int iconst = 37;
-%constant double fconst = 3.14;
-
-
diff --git a/Examples/pike/constants/runme.pike b/Examples/pike/constants/runme.pike
deleted file mode 100644
index a8d9f944f..000000000
--- a/Examples/pike/constants/runme.pike
+++ /dev/null
@@ -1,24 +0,0 @@
-int main()
-{
- write("ICONST = %d (should be 42)\n", .example.ICONST);
- write("FCONST = %f (should be 2.1828)\n", .example.FCONST);
- write("CCONST = %c (should be 'x')\n", .example.CCONST);
- write("CCONST2 = %c (this should be on a new line)\n", .example.CCONST2);
- write("SCONST = %s (should be 'Hello World')\n", .example.SCONST);
- write("SCONST2 = %s (should be '\"Hello World\"')\n", .example.SCONST2);
- write("EXPR = %f (should be 48.5484)\n", .example.EXPR);
- write("iconst = %d (should be 37)\n", .example.iconst);
- write("fconst = %f (should be 3.14)\n", .example.fconst);
-
- if (search(indices(.example), "EXTERN") == -1)
- write("EXTERN isn't defined (good)\n");
- else
- write("EXTERN is defined (bad)\n");
-
- if (search(indices(.example), "FOO") == -1)
- write("FOO isn't defined (good)\n");
- else
- write("FOO is defined (bad)\n");
-
- return 0;
-}
diff --git a/Examples/pike/enum/Makefile b/Examples/pike/enum/Makefile
deleted file mode 100644
index e5319dbe2..000000000
--- a/Examples/pike/enum/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp
-
-static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean
diff --git a/Examples/pike/enum/README b/Examples/pike/enum/README
deleted file mode 100644
index 055aa9fce..000000000
--- a/Examples/pike/enum/README
+++ /dev/null
@@ -1,13 +0,0 @@
-This example will not compile with Pike versions 7.4.20 unless you first
-patch the Pike sources. The problem is for line 91 of Pike's "stralloc.h"
-(usually installed as /usr/local/pike/7.4.10/include/pike/stralloc.h). That
-line reads:
-
- tmp.ptr=ptr;
-
-but should be patched to read:
-
- tmp.ptr=(p_wchar0 *) ptr;
-
-This bug has been reported to the Pike developers.
-
diff --git a/Examples/pike/enum/example.cxx b/Examples/pike/enum/example.cxx
deleted file mode 100644
index 6785e57ac..000000000
--- a/Examples/pike/enum/example.cxx
+++ /dev/null
@@ -1,37 +0,0 @@
-/* File : example.c */
-
-#include "example.h"
-#include
-
-void Foo::enum_test(speed s) {
- if (s == IMPULSE) {
- printf("IMPULSE speed\n");
- } else if (s == WARP) {
- printf("WARP speed\n");
- } else if (s == LUDICROUS) {
- printf("LUDICROUS speed\n");
- } else {
- printf("Unknown speed\n");
- }
-}
-
-void enum_test(color c, Foo::speed s) {
- if (c == RED) {
- printf("color = RED, ");
- } else if (c == BLUE) {
- printf("color = BLUE, ");
- } else if (c == GREEN) {
- printf("color = GREEN, ");
- } else {
- printf("color = Unknown color!, ");
- }
- if (s == Foo::IMPULSE) {
- printf("speed = IMPULSE speed\n");
- } else if (s == Foo::WARP) {
- printf("speed = WARP speed\n");
- } else if (s == Foo::LUDICROUS) {
- printf("speed = LUDICROUS speed\n");
- } else {
- printf("speed = Unknown speed!\n");
- }
-}
diff --git a/Examples/pike/enum/example.h b/Examples/pike/enum/example.h
deleted file mode 100644
index 525d62afc..000000000
--- a/Examples/pike/enum/example.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* File : example.h */
-
-enum color { RED, BLUE, GREEN };
-
-class Foo {
- public:
- Foo() { }
- enum speed { IMPULSE, WARP, LUDICROUS };
- void enum_test(speed s);
-};
-
-void enum_test(color c, Foo::speed s);
-
diff --git a/Examples/pike/enum/example.i b/Examples/pike/enum/example.i
deleted file mode 100644
index 23ee8a822..000000000
--- a/Examples/pike/enum/example.i
+++ /dev/null
@@ -1,11 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/* Let's just grab the original header file here */
-
-%include "example.h"
-
diff --git a/Examples/pike/enum/runme.pike b/Examples/pike/enum/runme.pike
deleted file mode 100644
index 4846356b3..000000000
--- a/Examples/pike/enum/runme.pike
+++ /dev/null
@@ -1,28 +0,0 @@
-int main()
-{
- write("*** color ***\n");
- write(" RED = " + .example.RED + "\n");
- write(" BLUE = " + .example.BLUE + "\n");
- write(" GREEN = " + .example.GREEN + "\n");
-
- write("\n*** Foo::speed ***\n");
- write(" Foo_IMPULSE = " + .example.Foo.IMPULSE + "\n");
- write(" Foo_WARP = " + .example.Foo.WARP + "\n");
- write(" Foo_LUDICROUS = " + .example.Foo.LUDICROUS + "\n");
-
- write("\nTesting use of enums with functions\n\n");
-
- .example.enum_test(.example.RED, .example.Foo.IMPULSE);
- .example.enum_test(.example.BLUE, .example.Foo.WARP);
- .example.enum_test(.example.GREEN, .example.Foo.LUDICROUS);
- .example.enum_test(1234, 5678);
-
- write("\nTesting use of enum with class method\n");
- .example.Foo f = .example.Foo();
-
- f->enum_test(.example.Foo.IMPULSE);
- f->enum_test(.example.Foo.WARP);
- f->enum_test(.example.Foo.LUDICROUS);
-
- return 0;
-}
diff --git a/Examples/pike/overload/Makefile b/Examples/pike/overload/Makefile
deleted file mode 100644
index 5e5fe669b..000000000
--- a/Examples/pike/overload/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-LIBS = -lstdc++ -lm
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp
-
-static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean
diff --git a/Examples/pike/overload/example.cxx b/Examples/pike/overload/example.cxx
deleted file mode 100644
index 3760fdd49..000000000
--- a/Examples/pike/overload/example.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-#include
-
-#include "example.h"
-
-// Overloaded constructors for class Bar
-Bar::Bar() {
- std::cout << "Called Bar::Bar()" << std::endl;
-}
-
-Bar::Bar(const Bar&) {
- std::cout << "Called Bar::Bar(const Bar&)" << std::endl;
-}
-
-Bar::Bar(double x) {
- std::cout << "Called Bar::Bar(double) with x = " << x << std::endl;
-}
-
-Bar::Bar(double x, char *y) {
- std::cout << "Called Bar::Bar(double, char *) with x, y = " << x << ", \"" << y << "\"" << std::endl;
-}
-
-Bar::Bar(int x, int y) {
- std::cout << "Called Bar::Bar(int, int) with x, y = " << x << ", " << y << std::endl;
-}
-
-Bar::Bar(char *x) {
- std::cout << "Called Bar::Bar(char *) with x = \"" << x << "\"" << std::endl;
-}
-
-Bar::Bar(int x) {
- std::cout << "Called Bar::Bar(int) with x = " << x << std::endl;
-}
-
-Bar::Bar(long x) {
- std::cout << "Called Bar::Bar(long) with x = " << x << std::endl;
-}
-
-Bar::Bar(Bar *x) {
- std::cout << "Called Bar::Bar(Bar *) with x = " << x << std::endl;
-}
-
-// Overloaded member functions
-void Bar::foo(const Bar& x) {
- std::cout << "Called Bar::foo(const Bar&) with &x = " << &x << std::endl;
-}
-
-void Bar::foo(double x) {
- std::cout << "Called Bar::foo(double) with x = " << x << std::endl;
-}
-
-void Bar::foo(double x, char *y) {
- std::cout << "Called Bar::foo(double, char *) with x, y = " << x << ", \"" << y << "\"" << std::endl;
-}
-
-void Bar::foo(int x, int y) {
- std::cout << "Called Bar::foo(int, int) with x, y = " << x << ", " << y << std::endl;
-}
-
-void Bar::foo(char *x) {
- std::cout << "Called Bar::foo(char *) with x = \"" << x << "\"" << std::endl;
-}
-
-void Bar::foo(int x) {
- std::cout << "Called Bar::foo(int) with x = " << x << std::endl;
-}
-
-void Bar::foo(long x) {
- std::cout << "Called Bar::foo(long) with x = " << x << std::endl;
-}
-
-void Bar::foo(Bar *x) {
- std::cout << "Called Bar::foo(Bar *) with x = " << x << std::endl;
-}
-
-void Bar::spam(int x, int y, int z) {
- std::cout << "Called Bar::spam(int, int, int) with x, y, z = " << x << ", " << y << ", " << z << std::endl;
-}
-
-void Bar::spam(double x, int y, int z) {
- std::cout << "Called Bar::spam(double, int, int) with x, y, z = " << x << ", " << y << ", " << z << std::endl;
-}
-
-// Overloaded global methods
-void foo(const Bar& x) {
- std::cout << "Called foo(const Bar& x) with &x = " << &x << std::endl;
-}
-
-void foo(double x) {
- std::cout << "Called foo(double) with x = " << x << std::endl;
-}
-
-void foo(double x, char *y) {
- std::cout << "Called foo(double, char *) with x, y = " << x << ", \"" << y << "\"" << std::endl;
-}
-
-void foo(int x, int y) {
- std::cout << "Called foo(int, int) with x, y = " << x << ", " << y << std::endl;
-}
-
-void foo(char *x) {
- std::cout << "Called foo(char *) with x = \"" << x << "\"" << std::endl;
-}
-
-void foo(int x) {
- std::cout << "Called foo(int) with x = " << x << std::endl;
-}
-
-void foo(long x) {
- std::cout << "Called foo(long) with x = " << x << std::endl;
-}
-
-void foo(Bar *x) {
- std::cout << "Called foo(Bar *) with x = " << x << std::endl;
-}
-
diff --git a/Examples/pike/overload/example.h b/Examples/pike/overload/example.h
deleted file mode 100644
index e47a122ee..000000000
--- a/Examples/pike/overload/example.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef EXAMPLE_H
-#define EXAMPLE_H
-
-class Bar {
-public:
- Bar();
- Bar(const Bar&);
- Bar(double);
- Bar(double, char *);
- Bar(int, int);
- Bar(char *);
- Bar(long);
- Bar(int);
- Bar(Bar *);
-
- void foo(const Bar&);
- void foo(double);
- void foo(double, char *);
- void foo(int, int);
- void foo(char *);
- void foo(long);
- void foo(int);
- void foo(Bar *);
-
- void spam(int x, int y=2, int z=3);
- void spam(double x, int y=2, int z=3);
-};
-
-void foo(const Bar&);
-void foo(double);
-void foo(double, char *);
-void foo(int, int);
-void foo(char *);
-void foo(int);
-void foo(long);
-void foo(Bar *);
-
-void spam(int x, int y=2, int z=3);
-void spam(double x, int y=2, int z=3);
-
-#endif
diff --git a/Examples/pike/overload/example.i b/Examples/pike/overload/example.i
deleted file mode 100644
index ddcd006be..000000000
--- a/Examples/pike/overload/example.i
+++ /dev/null
@@ -1,28 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/**
- * These overloaded declarations conflict with other overloads (as far as
- * SWIG's Ruby module's implementation for overloaded methods is concerned).
- * One option is use the %rename directive to rename the conflicting methods;
- * here, we're just using %ignore to avoid wrapping some of the overloaded
- * functions altogether.
- */
-
-%ignore Bar;
-
-%ignore Bar::Bar(Bar *);
-%ignore Bar::Bar(long);
-
-%ignore Bar::foo(const Bar&);
-%ignore Bar::foo(long);
-
-%ignore ::foo(const Bar&);
-%ignore ::foo(int);
-
-/* Let's just grab the original header file here */
-%include "example.h"
diff --git a/Examples/pike/overload/runme.pike b/Examples/pike/overload/runme.pike
deleted file mode 100644
index d30e947b3..000000000
--- a/Examples/pike/overload/runme.pike
+++ /dev/null
@@ -1,83 +0,0 @@
-// import .example;
-
-int main()
-{
- // This should invoke foo(double)
- .example.foo(3.14159);
-
- // This should invoke foo(double, char *)
- .example.foo(3.14159, "Pi");
-
- // This should invoke foo(int, int)
- .example.foo(3, 4);
-
- // This should invoke foo(char *)
- .example.foo("This is a test");
-
- // This should invoke foo(long)
- .example.foo(42);
-
- /*
- // This should invoke Bar::Bar() followed by foo(Bar *)
- foo(Bar.new);
-
- // Skip a line
- write("\n");
-
- // This should invoke Bar::Bar(double)
- Bar.new(3.14159);
-
- // This should invoke Bar::Bar(double, char *)
- Bar.new(3.14159, "Pi");
-
- // This should invoke Bar::Bar(int, int)
- Bar.new(3, 4);
-
- // This should invoke Bar::Bar(char *)
- Bar.new("This is a test");
-
- // This should invoke Bar::Bar(int)
- Bar.new(42);
-
- // This should invoke Bar::Bar() for the input argument,
- // followed by Bar::Bar(const Bar&).
- Bar.new(Bar.new);
-
- // Skip a line
- write("\n");
- */
-
- // Construct a new Bar instance (invokes Bar::Bar())
- /*
- bar = Bar.new;
-
- // This should invoke Bar::foo(double)
- bar.foo(3.14159);
-
- // This should invoke Bar::foo(double, char *)
- bar.foo(3.14159, "Pi");
-
- // This should invoke Bar::foo(int, int)
- bar.foo(3, 4);
-
- // This should invoke Bar::foo(char *)
- bar.foo("This is a test");
-
- // This should invoke Bar::foo(int)
- bar.foo(42);
-
- // This should invoke Bar::Bar() to construct the input
- // argument, followed by Bar::foo(Bar *).
- bar.foo(Example::Bar.new);
-
- // This should invoke Bar::spam(int x, int y, int z)
- bar.spam(1);
-
- // This should invoke Bar::spam(double x, int y, int z)
- bar.spam(3.14159);
- */
-
- write("Goodbye\n");
-
- return 0;
-}
diff --git a/Examples/pike/simple/Makefile b/Examples/pike/simple/Makefile
deleted file mode 100644
index 8b49b4ea5..000000000
--- a/Examples/pike/simple/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-SRCS = example.c
-TARGET = example
-INTERFACE = example.i
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike
-
-static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean
diff --git a/Examples/pike/simple/example.c b/Examples/pike/simple/example.c
deleted file mode 100644
index 1c2af789c..000000000
--- a/Examples/pike/simple/example.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* File : example.c */
-
-/* A global variable */
-double Foo = 3.0;
-
-/* Compute the greatest common divisor of positive integers */
-int gcd(int x, int y) {
- int g;
- g = y;
- while (x > 0) {
- g = x;
- x = y % x;
- y = g;
- }
- return g;
-}
-
-
diff --git a/Examples/pike/simple/example.i b/Examples/pike/simple/example.i
deleted file mode 100644
index 24093b9bf..000000000
--- a/Examples/pike/simple/example.i
+++ /dev/null
@@ -1,7 +0,0 @@
-/* File : example.i */
-%module example
-
-%inline %{
-extern int gcd(int x, int y);
-extern double Foo;
-%}
diff --git a/Examples/pike/simple/runme.pike b/Examples/pike/simple/runme.pike
deleted file mode 100644
index a6a78e9e7..000000000
--- a/Examples/pike/simple/runme.pike
+++ /dev/null
@@ -1,20 +0,0 @@
-int main()
-{
- /* Call our gcd() function */
- int x = 42;
- int y = 105;
- int g = .example.gcd(x, y);
- write("The gcd of %d and %d is %d\n", x, y, g);
-
- /* Manipulate the Foo global variable */
- /* Output its current value */
- write("Foo = %f\n", .example->Foo_get());
-
- /* Change its value */
- .example->Foo_set(3.1415926);
-
- /* See if the change took effect */
- write("Foo = %f\n", .example->Foo_get());
-
- return 0;
-}
diff --git a/Examples/pike/template/Makefile b/Examples/pike/template/Makefile
deleted file mode 100644
index 513dc3b4b..000000000
--- a/Examples/pike/template/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-CXXSRCS =
-TARGET = example
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp
-
-static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- SWIGOPT='$(SWIGOPT)' TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean
diff --git a/Examples/pike/template/example.h b/Examples/pike/template/example.h
deleted file mode 100644
index 7401df650..000000000
--- a/Examples/pike/template/example.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* File : example.h */
-
-// Some template definitions
-
-template T max(T a, T b) { return a>b ? a : b; }
-
-template class vector {
- T *v;
- int sz;
- public:
- vector(int _sz) {
- v = new T[_sz];
- sz = _sz;
- }
- T &get(int index) {
- return v[index];
- }
- void set(int index, T &val) {
- v[index] = val;
- }
-#ifdef SWIG
- %extend {
- T getitem(int index) {
- return $self->get(index);
- }
- void setitem(int index, T val) {
- $self->set(index,val);
- }
- }
-#endif
-};
-
diff --git a/Examples/pike/template/example.i b/Examples/pike/template/example.i
deleted file mode 100644
index 8f94c4da1..000000000
--- a/Examples/pike/template/example.i
+++ /dev/null
@@ -1,17 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/* Let's just grab the original header file here */
-%include "example.h"
-
-/* Now instantiate some specific template declarations */
-
-%template(maxint) max;
-%template(maxdouble) max;
-%template(vecint) vector;
-%template(vecdouble) vector;
-
diff --git a/Examples/pike/template/runme.pike b/Examples/pike/template/runme.pike
deleted file mode 100644
index 36825c3e3..000000000
--- a/Examples/pike/template/runme.pike
+++ /dev/null
@@ -1,33 +0,0 @@
-int main()
-{
- // Call some templated functions
- write(sprintf("%d\n", .example.maxint(3, 7)));
- write(sprintf("%f\n", .example.maxdouble(3.14, 2.18)));
-
- // Create some objects
- .example.vecint iv = .example.vecint(100);
- .example.vecdouble dv = .example.vecdouble(1000);
-
- for (int i = 0; i < 100; i++) {
- iv->setitem(i, 2*i);
- }
-
- for (int i = 0; i < 1000; i++) {
- dv->setitem(i, 1.0/(i+1));
- }
-
- int isum = 0;
- for (int i = 0; i < 100; i++) {
- isum += iv->getitem(i);
- }
-
- write(sprintf("%d\n", isum));
-
- float fsum = 0.0;
- for (int i = 0; i < 1000; i++) {
- fsum += dv->getitem(i);
- }
- write(sprintf("%f\n", fsum));
-
- return 0;
-}
diff --git a/Examples/python/callback/runme.py b/Examples/python/callback/runme.py
index 345a3eb6e..41deb8386 100644
--- a/Examples/python/callback/runme.py
+++ b/Examples/python/callback/runme.py
@@ -11,7 +11,7 @@ class PyCallback(example.Callback):
example.Callback.__init__(self)
def run(self):
- print "PyCallback.run()"
+ print("PyCallback.run()")
# Create an Caller instance
@@ -20,8 +20,8 @@ caller = example.Caller()
# Add a simple C++ callback (caller owns the callback, so
# we disown it first by clearing the .thisown flag).
-print "Adding and calling a normal C++ callback"
-print "----------------------------------------"
+print("Adding and calling a normal C++ callback")
+print("----------------------------------------")
callback = example.Callback()
callback.thisown = 0
@@ -29,9 +29,9 @@ caller.setCallback(callback)
caller.call()
caller.delCallback()
-print
-print "Adding and calling a Python callback"
-print "------------------------------------"
+print("")
+print("Adding and calling a Python callback")
+print("------------------------------------")
# Add a Python callback (caller owns the callback, so we
# disown it first by calling __disown__).
@@ -40,9 +40,9 @@ caller.setCallback(PyCallback().__disown__())
caller.call()
caller.delCallback()
-print
-print "Adding and calling another Python callback"
-print "------------------------------------------"
+print("")
+print("Adding and calling another Python callback")
+print("------------------------------------------")
# Let's do the same but use the weak reference this time.
@@ -53,5 +53,5 @@ caller.delCallback()
# All done.
-print
-print "python exit"
+print("")
+print("python exit")
diff --git a/Examples/python/check.list b/Examples/python/check.list
index 0798b5f7e..025278f89 100644
--- a/Examples/python/check.list
+++ b/Examples/python/check.list
@@ -13,8 +13,8 @@ funcptr
funcptr2
functor
import
-import_template
import_packages
+import_template
#libffi
multimap
operator
@@ -22,8 +22,8 @@ pointer
reference
simple
smartptr
-std_vector
std_map
+std_vector
template
varargs
variables
diff --git a/Examples/python/class/runme.py b/Examples/python/class/runme.py
index 34d21505c..adade7468 100644
--- a/Examples/python/class/runme.py
+++ b/Examples/python/class/runme.py
@@ -7,15 +7,15 @@ import example
# ----- Object creation -----
-print "Creating some objects:"
+print("Creating some objects:")
c = example.Circle(10)
-print " Created circle", c
+print(" Created circle %s" % c)
s = example.Square(10)
-print " Created square", s
+print(" Created square %s" % s)
# ----- Access a static member -----
-print "\nA total of", example.cvar.Shape_nshapes, "shapes were created"
+print("\nA total of %d shapes were created" % example.cvar.Shape_nshapes)
# ----- Member data access -----
@@ -27,25 +27,25 @@ c.y = 30
s.x = -10
s.y = 5
-print "\nHere is their current position:"
-print " Circle = (%f, %f)" % (c.x, c.y)
-print " Square = (%f, %f)" % (s.x, s.y)
+print("\nHere is their current position:")
+print(" Circle = (%f, %f)" % (c.x, c.y))
+print(" Square = (%f, %f)" % (s.x, s.y))
# ----- Call some methods -----
-print "\nHere are some properties of the shapes:"
+print("\nHere are some properties of the shapes:")
for o in [c, s]:
- print " ", o
- print " area = ", o.area()
- print " perimeter = ", o.perimeter()
+ print(" %s" % o)
+ print(" area = %s" % o.area())
+ print(" perimeter = %s" % o.perimeter())
# prevent o from holding a reference to the last object looked at
o = None
-print "\nGuess I'll clean up now"
+print("\nGuess I'll clean up now")
# Note: this invokes the virtual destructor
del c
del s
-print example.cvar.Shape_nshapes, "shapes remain"
-print "Goodbye"
+print("%d shapes remain" % example.cvar.Shape_nshapes)
+print("Goodbye")
diff --git a/Examples/python/constants/runme.py b/Examples/python/constants/runme.py
index 415d1adc4..808bf1fe6 100644
--- a/Examples/python/constants/runme.py
+++ b/Examples/python/constants/runme.py
@@ -2,22 +2,24 @@
import example
-print "ICONST =", example.ICONST, "(should be 42)"
-print "FCONST =", example.FCONST, "(should be 2.1828)"
-print "CCONST =", example.CCONST, "(should be 'x')"
-print "CCONST2 =", example.CCONST2, "(this should be on a new line)"
-print "SCONST =", example.SCONST, "(should be 'Hello World')"
-print "SCONST2 =", example.SCONST2, "(should be '\"Hello World\"')"
-print "EXPR =", example.EXPR, "(should be 48.5484)"
-print "iconst =", example.iconst, "(should be 37)"
-print "fconst =", example.fconst, "(should be 3.14)"
+print("ICONST = %s (should be 42)" % example.ICONST)
+print("FCONST = %s (should be 2.1828)" % example.FCONST)
+print("CCONST = %s (should be 'x')" % example.CCONST)
+print("CCONST2 = %s (this should be on a new line)" % example.CCONST2)
+print("SCONST = %s (should be 'Hello World')" % example.SCONST)
+print("SCONST2 = %s (should be '\"Hello World\"')" % example.SCONST2)
+print("EXPR = %s (should be 48.5484)" % example.EXPR)
+print("iconst = %s (should be 37)" % example.iconst)
+print("fconst = %s (should be 3.14)" % example.fconst)
try:
- print "EXTERN = ", example.EXTERN, "(Arg! This shouldn't print anything)"
+ x = example.EXTERN
+ print("%s (Arg! This shouldn't print anything)" % x)
except AttributeError:
- print "EXTERN isn't defined (good)"
+ print("EXTERN isn't defined (good)")
try:
- print "FOO = ", example.FOO, "(Arg! This shouldn't print anything)"
+ x = example.FOO
+ print("%s (Arg! This shouldn't print anything)" % x)
except AttributeError:
- print "FOO isn't defined (good)"
+ print("FOO isn't defined (good)")
diff --git a/Examples/python/contract/runme.py b/Examples/python/contract/runme.py
index ce01e5a1d..ec0aceb45 100644
--- a/Examples/python/contract/runme.py
+++ b/Examples/python/contract/runme.py
@@ -7,15 +7,15 @@ import example
x = 42
y = 105
g = example.gcd(x, y)
-print "The gcd of %d and %d is %d" % (x, y, g)
+print("The gcd of %d and %d is %d" % (x, y, g))
# Manipulate the Foo global variable
# Output its current value
-print "Foo = ", example.cvar.Foo
+print("Foo = %s" % example.cvar.Foo)
# Change its value
example.cvar.Foo = 3.1415926
# See if the change took effect
-print "Foo = ", example.cvar.Foo
+print("Foo = %s" % example.cvar.Foo)
diff --git a/Examples/python/docstrings/runme.py b/Examples/python/docstrings/runme.py
index c25d291b6..76386d214 100644
--- a/Examples/python/docstrings/runme.py
+++ b/Examples/python/docstrings/runme.py
@@ -2,4 +2,4 @@
import example
-print "example.Foo.bar.__doc__ =", repr(example.Foo.bar.__doc__), "(Should be 'No comment')"
+print("example.Foo.bar.__doc__ = %s (Should be 'No comment')" % repr(example.Foo.bar.__doc__))
diff --git a/Examples/python/doxygen/runme.py b/Examples/python/doxygen/runme.py
index e23528874..657535cc2 100644
--- a/Examples/python/doxygen/runme.py
+++ b/Examples/python/doxygen/runme.py
@@ -5,24 +5,24 @@
import example
-print "Creating some objects:"
+print("Creating some objects:")
c = example.MakeCircle(10)
-print " Created circle", c
+print(" Created circle %s" % c)
s = example.MakeSquare(10)
-print " Created square", s
+print(" Created square %s" % s)
r = example.MakeRectangleInt(10, 20)
-print " Created rectangle", r
+print(" Created rectangle %s" % r)
-print "\nHere are some properties of the shapes:"
+print("\nHere are some properties of the shapes:")
for o in [c, s, r]:
- print " ", o
- print " area = ", o.area()
- print " perimeter = ", o.perimeter()
+ print(" %s" % o)
+ print(" area = %s" % o.area())
+ print(" perimeter = %s" % o.perimeter())
-print "\nRunning pydoc, this is the equivalent to executing: pydoc -w ./example.py"
+print("\nRunning pydoc, this is the equivalent to executing: pydoc -w ./example.py")
import pydoc
pydoc.writedoc("example")
-print "Open example.html in your browser to view the generated python docs"
+print("Open example.html in your browser to view the generated python docs")
diff --git a/Examples/python/enum/runme.py b/Examples/python/enum/runme.py
index def01b147..4920c1dcf 100644
--- a/Examples/python/enum/runme.py
+++ b/Examples/python/enum/runme.py
@@ -5,24 +5,24 @@ import example
# ----- Object creation -----
# Print out the value of some enums
-print "*** color ***"
-print " RED =", example.RED
-print " BLUE =", example.BLUE
-print " GREEN =", example.GREEN
+print("*** color ***")
+print(" RED = %s" % example.RED)
+print(" BLUE = %s" % example.BLUE)
+print(" GREEN = %s" % example.GREEN)
-print "\n*** Foo::speed ***"
-print " Foo_IMPULSE =", example.Foo.IMPULSE
-print " Foo_WARP =", example.Foo.WARP
-print " Foo_LUDICROUS =", example.Foo.LUDICROUS
+print("\n*** Foo::speed ***")
+print(" Foo_IMPULSE = %s" % example.Foo.IMPULSE)
+print(" Foo_WARP = %s" % example.Foo.WARP)
+print(" Foo_LUDICROUS = %s" % example.Foo.LUDICROUS)
-print "\nTesting use of enums with functions\n"
+print("\nTesting use of enums with functions\n")
example.enum_test(example.RED, example.Foo.IMPULSE)
example.enum_test(example.BLUE, example.Foo.WARP)
example.enum_test(example.GREEN, example.Foo.LUDICROUS)
example.enum_test(1234, 5678)
-print "\nTesting use of enum with class method"
+print("\nTesting use of enum with class method")
f = example.Foo()
f.enum_test(example.Foo.IMPULSE)
diff --git a/Examples/python/exception/runme.py b/Examples/python/exception/runme.py
index 7fae49030..7b5c10d19 100644
--- a/Examples/python/exception/runme.py
+++ b/Examples/python/exception/runme.py
@@ -7,36 +7,36 @@ import example
t = example.Test()
try:
t.unknown()
-except RuntimeError, e:
- print "incomplete type", e.args[0]
+except RuntimeError as e:
+ print("incomplete type %s" % e.args[0])
try:
t.simple()
-except RuntimeError, e:
- print e.args[0]
+except RuntimeError as e:
+ print(e.args[0])
try:
t.message()
-except RuntimeError, e:
- print e.args[0]
+except RuntimeError as e:
+ print(e.args[0])
if not example.is_python_builtin():
try:
t.hosed()
- except example.Exc, e:
- print e.code, e.msg
+ except example.Exc as e:
+ print("%s %s" % (e.code, e.msg))
else:
try:
t.hosed()
- except BaseException, e:
+ except BaseException as e:
# Throwing builtin classes as exceptions not supported (-builtin
# option)
- print e
+ print(e)
for i in range(1, 4):
try:
t.multi(i)
- except RuntimeError, e:
- print e.args[0]
- except example.Exc, e:
- print e.code, e.msg
+ except RuntimeError as e:
+ print(e.args[0])
+ except example.Exc as e:
+ print("%s %s" % (e.code, e.msg))
diff --git a/Examples/python/exceptproxy/runme.py b/Examples/python/exceptproxy/runme.py
index 970d6201d..d25fb6de6 100644
--- a/Examples/python/exceptproxy/runme.py
+++ b/Examples/python/exceptproxy/runme.py
@@ -2,44 +2,44 @@
import example
if example.is_python_builtin():
- print "Skipping example: -builtin option does not support %exceptionclass"
+ print("Skipping example: -builtin option does not support %exceptionclass")
exit(0)
q = example.intQueue(10)
-print "Inserting items into intQueue"
+print("Inserting items into intQueue")
-print type(example.FullError)
+print(type(example.FullError))
try:
for i in range(0, 100):
q.enqueue(i)
-except example.FullError, e:
- print "Maxsize is", e.maxsize
+except example.FullError as e:
+ print("Maxsize is %s" % e.maxsize)
-print "Removing items"
+print("Removing items")
try:
- while 1:
+ while True:
q.dequeue()
-except example.EmptyError, e:
+except example.EmptyError as e:
pass
q = example.doubleQueue(1000)
-print "Inserting items into doubleQueue"
+print("Inserting items into doubleQueue")
try:
for i in range(0, 10000):
q.enqueue(i * 1.5)
-except example.FullError, e:
- print "Maxsize is", e.maxsize
+except example.FullError as e:
+ print("Maxsize is %s" % e.maxsize)
-print "Removing items"
+print("Removing items")
try:
- while 1:
+ while True:
q.dequeue()
-except example.EmptyError, e:
+except example.EmptyError as e:
pass
diff --git a/Examples/python/extend/runme.py b/Examples/python/extend/runme.py
index e97358b99..d7e626ec2 100644
--- a/Examples/python/extend/runme.py
+++ b/Examples/python/extend/runme.py
@@ -21,9 +21,9 @@ class CEO(example.Manager):
# the director wrappers to call CEO.getPosition.
e = CEO("Alice")
-print e.getName(), "is a", e.getPosition()
-print "Just call her \"%s\"" % e.getTitle()
-print "----------------------"
+print("%s is a %s" % (e.getName(), e.getPosition()))
+print("Just call her \"%s\"" % e.getTitle())
+print("----------------------")
# Create a new EmployeeList instance. This class does not have a C++
@@ -40,7 +40,7 @@ list = example.EmployeeList()
e = e.__disown__()
list.addEmployee(e)
-print "----------------------"
+print("----------------------")
# Now we access the first four items in list (three are C++ objects that
# EmployeeList's constructor adds, the last is our CEO). The virtual
@@ -59,13 +59,13 @@ print "----------------------"
# passes down through the C++ director class to the Python implementation
# in CEO. All this routing takes place transparently.
-print "(position, title) for items 0-3:"
+print("(position, title) for items 0-3:")
-print " %s, \"%s\"" % (list.get_item(0).getPosition(), list.get_item(0).getTitle())
-print " %s, \"%s\"" % (list.get_item(1).getPosition(), list.get_item(1).getTitle())
-print " %s, \"%s\"" % (list.get_item(2).getPosition(), list.get_item(2).getTitle())
-print " %s, \"%s\"" % (list.get_item(3).getPosition(), list.get_item(3).getTitle())
-print "----------------------"
+print(" %s, \"%s\"" % (list.get_item(0).getPosition(), list.get_item(0).getTitle()))
+print(" %s, \"%s\"" % (list.get_item(1).getPosition(), list.get_item(1).getTitle()))
+print(" %s, \"%s\"" % (list.get_item(2).getPosition(), list.get_item(2).getTitle()))
+print(" %s, \"%s\"" % (list.get_item(3).getPosition(), list.get_item(3).getTitle()))
+print("----------------------")
# Time to delete the EmployeeList, which will delete all the Employee*
# items it contains. The last item is our CEO, which gets destroyed as its
@@ -75,8 +75,8 @@ print "----------------------"
# usual to destroy the object.
del list
-print "----------------------"
+print("----------------------")
# All done.
-print "python exit"
+print("python exit")
diff --git a/Examples/python/funcptr/runme.py b/Examples/python/funcptr/runme.py
index bf0c6e1ac..4248f928d 100644
--- a/Examples/python/funcptr/runme.py
+++ b/Examples/python/funcptr/runme.py
@@ -7,14 +7,14 @@ b = 42
# Now call our C function with a bunch of callbacks
-print "Trying some C callback functions"
-print " a =", a
-print " b =", b
-print " ADD(a,b) =", example.do_op(a, b, example.ADD)
-print " SUB(a,b) =", example.do_op(a, b, example.SUB)
-print " MUL(a,b) =", example.do_op(a, b, example.MUL)
+print("Trying some C callback functions")
+print(" a = %s" % a)
+print(" b = %s" % b)
+print(" ADD(a,b) = %s" % example.do_op(a, b, example.ADD))
+print(" SUB(a,b) = %s" % example.do_op(a, b, example.SUB))
+print(" MUL(a,b) = %s" % example.do_op(a, b, example.MUL))
-print "Here is what the C callback function objects look like in Python"
-print " ADD =", example.ADD
-print " SUB =", example.SUB
-print " MUL =", example.MUL
+print("Here is what the C callback function objects look like in Python")
+print(" ADD = %s" % example.ADD)
+print(" SUB = %s" % example.SUB)
+print(" MUL = %s" % example.MUL)
diff --git a/Examples/python/funcptr2/runme.py b/Examples/python/funcptr2/runme.py
index a4405d9d9..afa2e2db6 100644
--- a/Examples/python/funcptr2/runme.py
+++ b/Examples/python/funcptr2/runme.py
@@ -7,18 +7,18 @@ b = 42
# Now call our C function with a bunch of callbacks
-print "Trying some C callback functions"
-print " a =", a
-print " b =", b
-print " ADD(a,b) =", example.do_op(a, b, example.ADD)
-print " SUB(a,b) =", example.do_op(a, b, example.SUB)
-print " MUL(a,b) =", example.do_op(a, b, example.MUL)
+print("Trying some C callback functions")
+print(" a = %s" % a)
+print(" b = %s" % b)
+print(" ADD(a,b) = %s" % example.do_op(a, b, example.ADD))
+print(" SUB(a,b) = %s" % example.do_op(a, b, example.SUB))
+print(" MUL(a,b) = %s" % example.do_op(a, b, example.MUL))
-print "Here is what the C callback function objects look like in Python"
-print " ADD =", example.ADD
-print " SUB =", example.SUB
-print " MUL =", example.MUL
+print("Here is what the C callback function objects look like in Python")
+print(" ADD = %s" % example.ADD)
+print(" SUB = %s" % example.SUB)
+print(" MUL = %s" % example.MUL)
-print "Call the functions directly..."
-print " add(a,b) =", example.add(a, b)
-print " sub(a,b) =", example.sub(a, b)
+print("Call the functions directly...")
+print(" add(a,b) = %s" % example.add(a, b))
+print(" sub(a,b) = %s" % example.sub(a, b))
diff --git a/Examples/python/functor/runme.py b/Examples/python/functor/runme.py
index 7f6f2b649..69289a78b 100644
--- a/Examples/python/functor/runme.py
+++ b/Examples/python/functor/runme.py
@@ -12,5 +12,5 @@ for i in range(0, 100):
a(i) # Note: function call
b(math.sqrt(i)) # Note: function call
-print a.result()
-print b.result()
+print(a.result())
+print(b.result())
diff --git a/Examples/python/import/runme.py b/Examples/python/import/runme.py
index 0e83acad0..afa21a2b3 100644
--- a/Examples/python/import/runme.py
+++ b/Examples/python/import/runme.py
@@ -1,15 +1,22 @@
# file: runme.py
# Test various properties of classes defined in separate modules
+import sys
+
+print("Testing the %import directive")
-print "Testing the %import directive"
import base
import foo
import bar
import spam
+def write_flush(s):
+ # Python 2/3 compatible write and flush
+ sys.stdout.write(s)
+ sys.stdout.flush()
+
# Create some objects
-print "Creating some objects"
+print("Creating some objects")
a = base.Base()
b = foo.Foo()
@@ -17,91 +24,74 @@ c = bar.Bar()
d = spam.Spam()
# Try calling some methods
-print "Testing some methods"
-print "",
-print "Should see 'Base::A' ---> ",
+print("Testing some methods")
+
+write_flush(" Should see 'Base::A' ---> ")
a.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
a.B()
-print "Should see 'Foo::A' ---> ",
+write_flush(" Should see 'Foo::A' ---> ")
b.A()
-print "Should see 'Foo::B' ---> ",
+write_flush(" Should see 'Foo::B' ---> ")
b.B()
-print "Should see 'Bar::A' ---> ",
+write_flush(" Should see 'Bar::A' ---> ")
c.A()
-print "Should see 'Bar::B' ---> ",
+write_flush(" Should see 'Bar::B' ---> ")
c.B()
-print "Should see 'Spam::A' ---> ",
+write_flush(" Should see 'Spam::A' ---> ")
d.A()
-print "Should see 'Spam::B' ---> ",
+write_flush(" Should see 'Spam::B' ---> ")
d.B()
# Try some casts
-print "\nTesting some casts\n"
-print "",
+print("\nTesting some casts\n")
x = a.toBase()
-print "Should see 'Base::A' ---> ",
+write_flush(" Should see 'Base::A' ---> ")
x.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
x.B()
x = b.toBase()
-print "Should see 'Foo::A' ---> ",
+write_flush(" Should see 'Foo::A' ---> ")
x.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
x.B()
x = c.toBase()
-print "Should see 'Bar::A' ---> ",
+write_flush(" Should see 'Bar::A' ---> ")
x.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
x.B()
x = d.toBase()
-print "Should see 'Spam::A' ---> ",
+write_flush(" Should see 'Spam::A' ---> ")
x.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
x.B()
x = d.toBar()
-print "Should see 'Bar::B' ---> ",
+write_flush(" Should see 'Bar::B' ---> ")
x.B()
-print "\nTesting some dynamic casts\n"
+print("\nTesting some dynamic casts\n")
x = d.toBase()
-print " Spam -> Base -> Foo : ",
y = foo.Foo_fromBase(x)
-if y:
- print "bad swig"
-else:
- print "good swig"
+print(" Spam -> Base -> Foo : {} swig".format("bad" if y else "good"))
-print " Spam -> Base -> Bar : ",
y = bar.Bar_fromBase(x)
-if y:
- print "good swig"
-else:
- print "bad swig"
+print(" Spam -> Base -> Bar : {} swig".format("good" if y else "bad"))
-print " Spam -> Base -> Spam : ",
y = spam.Spam_fromBase(x)
-if y:
- print "good swig"
-else:
- print "bad swig"
+print(" Spam -> Base -> Spam : {} swig".format("good" if y else "bad"))
-print " Foo -> Spam : ",
y = spam.Spam_fromBase(b)
-if y:
- print "bad swig"
-else:
- print "good swig"
+print(" Foo -> Spam : {} swig".format("bad" if y else "good"))
diff --git a/Examples/python/import_packages/from_init1/runme.py b/Examples/python/import_packages/from_init1/runme.py
index a663a136b..c76716f16 100644
--- a/Examples/python/import_packages/from_init1/runme.py
+++ b/Examples/python/import_packages/from_init1/runme.py
@@ -6,26 +6,26 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
if sys.version_info < (2, 5):
- print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
sys.exit(0)
if sys.version_info < (3, 0):
import py2.pkg2
- print " Finished importing py2.pkg2"
+ print(" Finished importing py2.pkg2")
commandline = sys.executable + " -m py2.pkg2.bar"
run_except_on_windows(commandline)
commandline = sys.executable + " -m py2.pkg2.foo"
run_except_on_windows(commandline)
else:
import py3.pkg2
- print " Finished importing py3.pkg2"
+ print(" Finished importing py3.pkg2")
# commandline = sys.executable + " -m py3.pkg2.bar"
# run_except_on_windows(commandline)
# commandline = sys.executable + " -m py3.pkg2.foo"
diff --git a/Examples/python/import_packages/from_init2/runme.py b/Examples/python/import_packages/from_init2/runme.py
index 3c7b12693..c9c46a4da 100644
--- a/Examples/python/import_packages/from_init2/runme.py
+++ b/Examples/python/import_packages/from_init2/runme.py
@@ -6,24 +6,24 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
if sys.version_info < (2, 5):
- print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
sys.exit(0)
if sys.version_info < (3, 0):
import py2.pkg2
- print " Finished importing py2.pkg2"
+ print(" Finished importing py2.pkg2")
commandline = sys.executable + " -m py2.pkg2.bar"
run_except_on_windows(commandline)
else:
import py3.pkg2
- print " Finished importing py3.pkg2"
+ print(" Finished importing py3.pkg2")
# commandline = sys.executable + " -m py3.pkg2.bar"
# run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/from_init3/runme.py b/Examples/python/import_packages/from_init3/runme.py
index 3c7b12693..c9c46a4da 100644
--- a/Examples/python/import_packages/from_init3/runme.py
+++ b/Examples/python/import_packages/from_init3/runme.py
@@ -6,24 +6,24 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
if sys.version_info < (2, 5):
- print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
sys.exit(0)
if sys.version_info < (3, 0):
import py2.pkg2
- print " Finished importing py2.pkg2"
+ print(" Finished importing py2.pkg2")
commandline = sys.executable + " -m py2.pkg2.bar"
run_except_on_windows(commandline)
else:
import py3.pkg2
- print " Finished importing py3.pkg2"
+ print(" Finished importing py3.pkg2")
# commandline = sys.executable + " -m py3.pkg2.bar"
# run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/module_is_init/runme.py b/Examples/python/import_packages/module_is_init/runme.py
index b5e646e85..c4806cdf8 100644
--- a/Examples/python/import_packages/module_is_init/runme.py
+++ b/Examples/python/import_packages/module_is_init/runme.py
@@ -3,10 +3,10 @@ import sys
# Test import of a SWIG generated module renamed as the package's __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - module renamed as __init__.py"
+print("Testing " + testname + " - module renamed as __init__.py")
if sys.version_info >= (3, 0, 0) and sys.version_info < (3, 3, 0):
- print " Not importing as Python version is >= 3.0 and < 3.3"
+ print(" Not importing as Python version is >= 3.0 and < 3.3")
# Package detection does not work in these versions.
# Can be fixed by using this in the interface file:
# %module(moduleimport="from . import $module") foo # without -builtin
@@ -14,7 +14,7 @@ if sys.version_info >= (3, 0, 0) and sys.version_info < (3, 3, 0):
sys.exit(0)
import pkg1
-print " Finished importing pkg1"
+print(" Finished importing pkg1")
if pkg1.foofunction(123) != 1230:
raise RuntimeError("foofunction failed")
@@ -23,4 +23,4 @@ fc = pkg1.FooClass()
if fc.foomethod(1) != 6:
raise RuntimeError("foomethod failed")
-print " Finished testing pkg1"
+print(" Finished testing pkg1")
diff --git a/Examples/python/import_packages/namespace_pkg/runme.py b/Examples/python/import_packages/namespace_pkg/runme.py
index d2af05619..54a8e4ee6 100644
--- a/Examples/python/import_packages/namespace_pkg/runme.py
+++ b/Examples/python/import_packages/namespace_pkg/runme.py
@@ -5,14 +5,14 @@ import subprocess
import sys
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - namespace packages"
+print("Testing " + testname + " - namespace packages")
if sys.version_info < (3, 3, 0):
- print " Not importing nstest as Python version is < 3.3"
+ print(" Not importing nstest as Python version is < 3.3")
sys.exit(0)
import nstest
-print " Finished importing nstest"
+print(" Finished importing nstest")
nstest.main()
diff --git a/Examples/python/import_packages/relativeimport1/runme.py b/Examples/python/import_packages/relativeimport1/runme.py
index 87101ea46..3073cb5a7 100644
--- a/Examples/python/import_packages/relativeimport1/runme.py
+++ b/Examples/python/import_packages/relativeimport1/runme.py
@@ -6,26 +6,26 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) with -relativeimport"
+print("Testing " + testname + " - %module(package=...) with -relativeimport")
if sys.version_info < (2, 5):
- print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
sys.exit(0)
if sys.version_info < (3, 0):
import py2.pkg2.bar
- print " Finished importing py2.pkg2.bar"
+ print(" Finished importing py2.pkg2.bar")
commandline = sys.executable + " -m py2.pkg2.bar"
run_except_on_windows(commandline)
commandline = sys.executable + " -m py2.pkg2.pkg3.foo"
run_except_on_windows(commandline)
else:
import py3.pkg2.bar
- print " Finished importing py3.pkg2.bar"
+ print(" Finished importing py3.pkg2.bar")
commandline = sys.executable + " -m py3.pkg2.bar"
run_except_on_windows(commandline)
commandline = sys.executable + " -m py3.pkg2.pkg3.foo"
diff --git a/Examples/python/import_packages/relativeimport2/runme.py b/Examples/python/import_packages/relativeimport2/runme.py
index f5b55782f..9ab8d9471 100644
--- a/Examples/python/import_packages/relativeimport2/runme.py
+++ b/Examples/python/import_packages/relativeimport2/runme.py
@@ -6,26 +6,26 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
if sys.version_info < (2, 5):
- print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
sys.exit(0)
if sys.version_info < (3, 0):
import py2.pkg2.bar
- print " Finished importing py2.pkg2.bar"
+ print(" Finished importing py2.pkg2.bar")
commandline = sys.executable + " -m py2.pkg2.bar"
run_except_on_windows(commandline)
commandline = sys.executable + " -m py2.pkg2.pkg3.pkg4.foo"
run_except_on_windows(commandline)
else:
import py3.pkg2.bar
- print " Finished importing py3.pkg2.bar"
+ print(" Finished importing py3.pkg2.bar")
commandline = sys.executable + " -m py3.pkg2.bar"
run_except_on_windows(commandline)
commandline = sys.executable + " -m py3.pkg2.pkg3.pkg4.foo"
diff --git a/Examples/python/import_packages/relativeimport3/runme.py b/Examples/python/import_packages/relativeimport3/runme.py
index 87101ea46..3073cb5a7 100644
--- a/Examples/python/import_packages/relativeimport3/runme.py
+++ b/Examples/python/import_packages/relativeimport3/runme.py
@@ -6,26 +6,26 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
# Test import of modules content from within __init__.py
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) with -relativeimport"
+print("Testing " + testname + " - %module(package=...) with -relativeimport")
if sys.version_info < (2, 5):
- print " Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+ print(" Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
sys.exit(0)
if sys.version_info < (3, 0):
import py2.pkg2.bar
- print " Finished importing py2.pkg2.bar"
+ print(" Finished importing py2.pkg2.bar")
commandline = sys.executable + " -m py2.pkg2.bar"
run_except_on_windows(commandline)
commandline = sys.executable + " -m py2.pkg2.pkg3.foo"
run_except_on_windows(commandline)
else:
import py3.pkg2.bar
- print " Finished importing py3.pkg2.bar"
+ print(" Finished importing py3.pkg2.bar")
commandline = sys.executable + " -m py3.pkg2.bar"
run_except_on_windows(commandline)
commandline = sys.executable + " -m py3.pkg2.pkg3.foo"
diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py
index a64551bfd..05846ed9d 100644
--- a/Examples/python/import_packages/same_modnames1/runme.py
+++ b/Examples/python/import_packages/same_modnames1/runme.py
@@ -6,21 +6,21 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
# Test import of same modules from different packages
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
import pkg2.foo
-print " Finished importing pkg2.foo"
+print(" Finished importing pkg2.foo")
var2 = pkg2.foo.Pkg2_Foo()
classname = str(type(var2))
if classname.find("pkg2.foo.Pkg2_Foo") == -1:
raise RuntimeError("failed type checking: " + classname)
-print " Successfully created object pkg2.foo.Pkg2_Foo"
+print(" Successfully created object pkg2.foo.Pkg2_Foo")
commandline = sys.executable + " -m pkg2.foo"
run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/same_modnames2/runme.py b/Examples/python/import_packages/same_modnames2/runme.py
index c2cf2744c..190dadc77 100644
--- a/Examples/python/import_packages/same_modnames2/runme.py
+++ b/Examples/python/import_packages/same_modnames2/runme.py
@@ -6,20 +6,20 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
import pkg1.pkg2.foo
-print " Finished importing pkg1.pkg2.foo"
+print(" Finished importing pkg1.pkg2.foo")
var2 = pkg1.pkg2.foo.Pkg2_Foo()
classname = str(type(var2))
if classname.find("pkg1.pkg2.foo.Pkg2_Foo") == -1:
raise RuntimeError("failed type checking: " + classname)
-print " Successfully created object pkg1.pkg2.foo.Pkg2_Foo"
+print(" Successfully created object pkg1.pkg2.foo.Pkg2_Foo")
commandline = sys.executable + " -m pkg1.pkg2.foo"
run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/split_modules/vanilla/runme.py b/Examples/python/import_packages/split_modules/vanilla/runme.py
index 79d79b4c3..0f7b8806b 100644
--- a/Examples/python/import_packages/split_modules/vanilla/runme.py
+++ b/Examples/python/import_packages/split_modules/vanilla/runme.py
@@ -6,14 +6,14 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - split modules"
+print("Testing " + testname + " - split modules")
import pkg1.foo
-print " Finished importing pkg1.foo"
+print(" Finished importing pkg1.foo")
if not(pkg1.foo.count() == 3):
raise RuntimeError("test failed")
diff --git a/Examples/python/import_packages/split_modules/vanilla_split/runme.py b/Examples/python/import_packages/split_modules/vanilla_split/runme.py
index 79d79b4c3..0f7b8806b 100644
--- a/Examples/python/import_packages/split_modules/vanilla_split/runme.py
+++ b/Examples/python/import_packages/split_modules/vanilla_split/runme.py
@@ -6,14 +6,14 @@ def run_except_on_windows(commandline, env=None):
if os.name != "nt" and sys.platform != "cygwin":
# Strange failures on windows/cygin/mingw
subprocess.check_call(commandline, env=env, shell=True)
- print(" Finished running: " + commandline)
+ print((" Finished running: " + commandline))
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - split modules"
+print("Testing " + testname + " - split modules")
import pkg1.foo
-print " Finished importing pkg1.foo"
+print(" Finished importing pkg1.foo")
if not(pkg1.foo.count() == 3):
raise RuntimeError("test failed")
diff --git a/Examples/python/import_template/runme.py b/Examples/python/import_template/runme.py
index 35f8924c1..b14f8d35e 100644
--- a/Examples/python/import_template/runme.py
+++ b/Examples/python/import_template/runme.py
@@ -1,15 +1,22 @@
# file: runme.py
# Test various properties of classes defined in separate modules
+import sys
+
+print("Testing the %import directive with templates")
-print "Testing the %import directive with templates"
import base
import foo
import bar
import spam
+def write_flush(s):
+ # Python 2/3 compatible write and flush
+ sys.stdout.write(s)
+ sys.stdout.flush()
+
# Create some objects
-print "Creating some objects"
+print("Creating some objects")
a = base.intBase()
b = foo.intFoo()
@@ -17,91 +24,74 @@ c = bar.intBar()
d = spam.intSpam()
# Try calling some methods
-print "Testing some methods"
-print "",
-print "Should see 'Base::A' ---> ",
+print("Testing some methods")
+
+write_flush(" Should see 'Base::A' ---> ")
a.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
a.B()
-print "Should see 'Foo::A' ---> ",
+write_flush(" Should see 'Foo::A' ---> ")
b.A()
-print "Should see 'Foo::B' ---> ",
+write_flush(" Should see 'Foo::B' ---> ")
b.B()
-print "Should see 'Bar::A' ---> ",
+write_flush(" Should see 'Bar::A' ---> ")
c.A()
-print "Should see 'Bar::B' ---> ",
+write_flush(" Should see 'Bar::B' ---> ")
c.B()
-print "Should see 'Spam::A' ---> ",
+write_flush(" Should see 'Spam::A' ---> ")
d.A()
-print "Should see 'Spam::B' ---> ",
+write_flush(" Should see 'Spam::B' ---> ")
d.B()
# Try some casts
-print "\nTesting some casts\n"
-print "",
+print("\nTesting some casts\n")
x = a.toBase()
-print "Should see 'Base::A' ---> ",
+write_flush(" Should see 'Base::A' ---> ")
x.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
x.B()
x = b.toBase()
-print "Should see 'Foo::A' ---> ",
+write_flush(" Should see 'Foo::A' ---> ")
x.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
x.B()
x = c.toBase()
-print "Should see 'Bar::A' ---> ",
+write_flush(" Should see 'Bar::A' ---> ")
x.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
x.B()
x = d.toBase()
-print "Should see 'Spam::A' ---> ",
+write_flush(" Should see 'Spam::A' ---> ")
x.A()
-print "Should see 'Base::B' ---> ",
+write_flush(" Should see 'Base::B' ---> ")
x.B()
x = d.toBar()
-print "Should see 'Bar::B' ---> ",
+write_flush(" Should see 'Bar::B' ---> ")
x.B()
-print "\nTesting some dynamic casts\n"
+print("\nTesting some dynamic casts\n")
x = d.toBase()
-print " Spam -> Base -> Foo : ",
y = foo.intFoo_fromBase(x)
-if y:
- print "bad swig"
-else:
- print "good swig"
+print(" Spam -> Base -> Foo : {} swig".format("bad" if y else "good"))
-print " Spam -> Base -> Bar : ",
y = bar.intBar_fromBase(x)
-if y:
- print "good swig"
-else:
- print "bad swig"
+print(" Spam -> Base -> Bar : {} swig".format("good" if y else "bad"))
-print " Spam -> Base -> Spam : ",
y = spam.intSpam_fromBase(x)
-if y:
- print "good swig"
-else:
- print "bad swig"
+print(" Spam -> Base -> Spam : {} swig".format("good" if y else "bad"))
-print " Foo -> Spam : ",
y = spam.intSpam_fromBase(b)
-if y:
- print "bad swig"
-else:
- print "good swig"
+print(" Foo -> Spam : {} swig".format("bad" if y else "good"))
diff --git a/Examples/python/index.html b/Examples/python/index.html
index 3bbdd66e8..750c0f04a 100644
--- a/Examples/python/index.html
+++ b/Examples/python/index.html
@@ -89,7 +89,6 @@ to look at the distutils
Compatibility
For Python 3, set the environment variable PY3=1.
-This will ensure the 2to3 program is run prior to running any example.
Your mileage may vary. If you experience a problem, please let us know by
diff --git a/Examples/python/multimap/runme.py b/Examples/python/multimap/runme.py
index ad693b73a..e24f54ee1 100644
--- a/Examples/python/multimap/runme.py
+++ b/Examples/python/multimap/runme.py
@@ -7,14 +7,14 @@ import example
x = 42
y = 105
g = example.gcd(x, y)
-print "The gcd of %d and %d is %d" % (x, y, g)
+print("The gcd of %d and %d is %d" % (x, y, g))
# Call the gcdmain() function
example.gcdmain(["gcdmain", "42", "105"])
# Call the count function
-print example.count("Hello World", "l")
+print(example.count("Hello World", "l"))
# Call the capitalize function
-print example.capitalize("hello world")
+print(example.capitalize("hello world"))
diff --git a/Examples/python/operator/runme.py b/Examples/python/operator/runme.py
index ac48f2676..ee479f0b5 100644
--- a/Examples/python/operator/runme.py
+++ b/Examples/python/operator/runme.py
@@ -4,17 +4,17 @@ import example
a = example.Complex(2, 3)
b = example.Complex(-5, 10)
-print "a =", a
-print "b =", b
+print("a = %s" % a)
+print("b = %s" % b)
c = a + b
-print "c =", c
-print "a*b =", a * b
-print "a-c =", a - c
+print("c = %s" % c)
+print("a*b = %s" % (a * b))
+print("a-c = %s" % (a - c))
e = example.ComplexCopy(a - c)
-print "e =", e
+print("e = %s" % e)
# Big expression
f = ((a + b) * (c + b * e)) + (-a)
-print "f =", f
+print("f = %s" % f)
diff --git a/Examples/python/pointer/runme.py b/Examples/python/pointer/runme.py
index 5b5f16bc2..46371b89a 100644
--- a/Examples/python/pointer/runme.py
+++ b/Examples/python/pointer/runme.py
@@ -3,23 +3,23 @@
import example
# First create some objects using the pointer library.
-print "Testing the pointer library"
+print("Testing the pointer library")
a = example.new_intp()
b = example.new_intp()
c = example.new_intp()
example.intp_assign(a, 37)
example.intp_assign(b, 42)
-print " a =", a
-print " b =", b
-print " c =", c
+print(" a = %s" % a)
+print(" b = %s" % b)
+print(" c = %s" % c)
# Call the add() function with some pointers
example.add(a, b, c)
# Now get the result
r = example.intp_value(c)
-print " 37 + 42 =", r
+print(" 37 + 42 = %s" % r)
# Clean up the pointers
example.delete_intp(a)
@@ -30,12 +30,12 @@ example.delete_intp(c)
# This should be much easier. Now how it is no longer
# necessary to manufacture pointers.
-print "Trying the typemap library"
+print("Trying the typemap library")
r = example.sub(37, 42)
-print " 37 - 42 =", r
+print(" 37 - 42 = %s" % r)
# Now try the version with multiple return values
-print "Testing multiple return values"
+print("Testing multiple return values")
q, r = example.divide(42, 37)
-print " 42/37 = %d remainder %d" % (q, r)
+print(" 42/37 = %d remainder %d" % (q, r))
diff --git a/Examples/python/reference/runme.py b/Examples/python/reference/runme.py
index 0ff217b02..8a96e03a7 100644
--- a/Examples/python/reference/runme.py
+++ b/Examples/python/reference/runme.py
@@ -6,12 +6,12 @@ import example
# ----- Object creation -----
-print "Creating some objects:"
+print("Creating some objects:")
a = example.Vector(3, 4, 5)
b = example.Vector(10, 11, 12)
-print " Created", a.cprint()
-print " Created", b.cprint()
+print(" Created %s" % a.cprint())
+print(" Created %s" % b.cprint())
# ----- Call an overloaded operator -----
@@ -21,9 +21,9 @@ print " Created", b.cprint()
#
# It returns a new allocated object.
-print "Adding a+b"
+print("Adding a+b")
c = example.addv(a, b)
-print " a+b =", c.cprint()
+print(" a+b = %s" % c.cprint())
# Note: Unless we free the result, a memory leak will occur
del c
@@ -31,9 +31,9 @@ del c
# ----- Create a vector array -----
# Note: Using the high-level interface here
-print "Creating an array of vectors"
+print("Creating an array of vectors")
va = example.VectorArray(10)
-print " va = ", va
+print(" va = %s" % va)
# ----- Set some values in the array -----
@@ -45,17 +45,17 @@ va.set(2, example.addv(a, b))
# Get some values from the array
-print "Getting some array values"
+print("Getting some array values")
for i in range(0, 5):
- print " va(%d) = %s" % (i, va.get(i).cprint())
+ print(" va(%d) = %s" % (i, va.get(i).cprint()))
# Watch under resource meter to check on this
-print "Making sure we don't leak memory."
-for i in xrange(0, 1000000):
+print("Making sure we don't leak memory.")
+for i in range(0, 1000000):
c = va.get(i % 10)
# ----- Clean up -----
-print "Cleaning up"
+print("Cleaning up")
del va
del a
diff --git a/Examples/python/simple/runme.py b/Examples/python/simple/runme.py
index ce01e5a1d..ec0aceb45 100644
--- a/Examples/python/simple/runme.py
+++ b/Examples/python/simple/runme.py
@@ -7,15 +7,15 @@ import example
x = 42
y = 105
g = example.gcd(x, y)
-print "The gcd of %d and %d is %d" % (x, y, g)
+print("The gcd of %d and %d is %d" % (x, y, g))
# Manipulate the Foo global variable
# Output its current value
-print "Foo = ", example.cvar.Foo
+print("Foo = %s" % example.cvar.Foo)
# Change its value
example.cvar.Foo = 3.1415926
# See if the change took effect
-print "Foo = ", example.cvar.Foo
+print("Foo = %s" % example.cvar.Foo)
diff --git a/Examples/python/smartptr/runme.py b/Examples/python/smartptr/runme.py
index 5f8b73476..f01636ad6 100644
--- a/Examples/python/smartptr/runme.py
+++ b/Examples/python/smartptr/runme.py
@@ -7,17 +7,17 @@ import example
# ----- Object creation -----
-print "Creating some objects:"
+print("Creating some objects:")
cc = example.Circle(10)
c = example.ShapePtr(cc)
-print " Created circle", c
+print(" Created circle %s" % c)
ss = example.Square(10)
s = example.ShapePtr(ss)
-print " Created square", s
+print(" Created square %s" % s)
# ----- Access a static member -----
-print "\nA total of", example.cvar.Shape_nshapes, "shapes were created"
+print("\nA total of %s shapes were created" % example.cvar.Shape_nshapes)
# ----- Member data access -----
@@ -29,19 +29,19 @@ c.y = 30
s.x = -10
s.y = 5
-print "\nHere is their current position:"
-print " Circle = (%f, %f)" % (c.x, c.y)
-print " Square = (%f, %f)" % (s.x, s.y)
+print("\nHere is their current position:")
+print(" Circle = (%f, %f)" % (c.x, c.y))
+print(" Square = (%f, %f)" % (s.x, s.y))
# ----- Call some methods -----
-print "\nHere are some properties of the shapes:"
+print("\nHere are some properties of the shapes:")
for o in [c, s]:
- print " ", o
- print " area = ", o.area()
- print " perimeter = ", o.perimeter()
+ print(" %s" % o)
+ print(" area = %s" % o.area())
+ print(" perimeter = %s" % o.perimeter())
-print "\nGuess I'll clean up now"
+print("\nGuess I'll clean up now")
# Note: this invokes the virtual destructor
del c
@@ -50,5 +50,5 @@ del cc
del ss
s = 3
-print example.cvar.Shape_nshapes, "shapes remain"
-print "Goodbye"
+print("%d shapes remain" % example.cvar.Shape_nshapes)
+print("Goodbye")
diff --git a/Examples/python/std_map/runme.py b/Examples/python/std_map/runme.py
index 26031f3f4..e86f613fa 100644
--- a/Examples/python/std_map/runme.py
+++ b/Examples/python/std_map/runme.py
@@ -11,45 +11,45 @@ dmap = {}
dmap["hello"] = 1.0
dmap["hi"] = 2.0
-print dmap.items()
-print dmap.keys()
-print dmap.values()
+print(list(dmap.items()))
+print(list(dmap.keys()))
+print(list(dmap.values()))
-print dmap
+print(dmap)
hmap = example.halfd(dmap)
dmap = hmap
-print dmap
-for i in dmap.iterkeys():
- print "key", i
+print(dmap)
+for i in dmap.keys():
+ print("key %s" % i)
-for i in dmap.itervalues():
- print "val", i
+for i in dmap.values():
+ print("val %s" % i)
-for k, v in dmap.iteritems():
- print "item", k, v
+for k, v in dmap.items():
+ print("item %s %s" % (k, v))
dmap = example.DoubleMap()
dmap["hello"] = 1.0
dmap["hi"] = 2.0
-for i in dmap.iterkeys():
- print "key", i
+for i in dmap.keys():
+ print("key %s" % i)
-for i in dmap.itervalues():
- print "val", i
+for i in dmap.values():
+ print("val %s" % i)
-for k, v in dmap.iteritems():
- print "item", k, v
+for k, v in dmap.items():
+ print("item %s %s" % (k, v))
-print dmap.items()
-print dmap.keys()
-print dmap.values()
+print(list(dmap.items()))
+print(list(dmap.keys()))
+print(list(dmap.values()))
hmap = example.halfd(dmap)
-print hmap.keys()
-print hmap.values()
+print(list(hmap.keys()))
+print(list(hmap.values()))
dmap = {}
@@ -57,23 +57,23 @@ dmap["hello"] = 2
dmap["hi"] = 4
hmap = example.halfi(dmap)
-print hmap
-print hmap.keys()
-print hmap.values()
+print(hmap)
+print(list(hmap.keys()))
+print(list(hmap.values()))
dmap = hmap
-for i in dmap.iterkeys():
- print "key", i
+for i in dmap.keys():
+ print("key %s" % i)
-for i in dmap.itervalues():
- print "val", i
+for i in dmap.values():
+ print("val %s" % i)
-for i in dmap.iteritems():
- print "item", i
+for i in dmap.items():
+ print("item %s" % str(i))
-for k, v in dmap.iteritems():
- print "item", k, v
+for k, v in dmap.items():
+ print("item %s %s" % (k, v))
-print dmap
+print(dmap)
diff --git a/Examples/python/std_vector/runme.py b/Examples/python/std_vector/runme.py
index d7d3c2ea4..3f1106d59 100644
--- a/Examples/python/std_vector/runme.py
+++ b/Examples/python/std_vector/runme.py
@@ -4,32 +4,30 @@ import example
# Call average with a Python list...
-print example.average([1, 2, 3, 4])
+print(example.average([1, 2, 3, 4]))
# ... or a wrapped std::vector
v = example.IntVector(4)
for i in range(len(v)):
v[i] = i + 1
-print example.average(v)
+print(example.average(v))
# half will return a Python list.
# Call it with a Python tuple...
-print example.half((1.0, 1.5, 2.0, 2.5, 3.0))
+print(example.half((1.0, 1.5, 2.0, 2.5, 3.0)))
# ... or a wrapped std::vector
v = example.DoubleVector()
for i in [1, 2, 3, 4]:
v.append(i)
-print example.half(v)
+print(example.half(v))
# now halve a wrapped std::vector in place
example.halve_in_place(v)
-for i in range(len(v)):
- print v[i], "; ",
-print
+print([i for i in v])
diff --git a/Examples/python/template/runme.py b/Examples/python/template/runme.py
index e408e15f9..85b1ba937 100644
--- a/Examples/python/template/runme.py
+++ b/Examples/python/template/runme.py
@@ -3,8 +3,8 @@
import example
# Call some templated functions
-print example.maxint(3, 7)
-print example.maxdouble(3.14, 2.18)
+print(example.maxint(3, 7))
+print(example.maxdouble(3.14, 2.18))
# Create some class
@@ -21,12 +21,12 @@ sum = 0
for i in range(0, 100):
sum = sum + iv.getitem(i)
-print sum
+print(sum)
sum = 0.0
for i in range(0, 1000):
sum = sum + dv.getitem(i)
-print sum
+print(sum)
del iv
del dv
diff --git a/Examples/python/variables/runme.py b/Examples/python/variables/runme.py
index 4d34e92dd..d59e0aa3e 100644
--- a/Examples/python/variables/runme.py
+++ b/Examples/python/variables/runme.py
@@ -22,51 +22,51 @@ example.cvar.name = "Bill"
# Now print out the values of the variables
-print "Variables (values printed from Python)"
+print("Variables (values printed from Python)")
-print "ivar =", example.cvar.ivar
-print "svar =", example.cvar.svar
-print "lvar =", example.cvar.lvar
-print "uivar =", example.cvar.uivar
-print "usvar =", example.cvar.usvar
-print "ulvar =", example.cvar.ulvar
-print "scvar =", example.cvar.scvar
-print "ucvar =", example.cvar.ucvar
-print "fvar =", example.cvar.fvar
-print "dvar =", example.cvar.dvar
-print "cvar =", example.cvar.cvar
-print "strvar =", example.cvar.strvar
-print "cstrvar =", example.cvar.cstrvar
-print "iptrvar =", example.cvar.iptrvar
-print "name =", example.cvar.name
-print "ptptr =", example.cvar.ptptr, example.Point_print(example.cvar.ptptr)
-print "pt =", example.cvar.pt, example.Point_print(example.cvar.pt)
+print("ivar = %s" % example.cvar.ivar)
+print("svar = %s" % example.cvar.svar)
+print("lvar = %s" % example.cvar.lvar)
+print("uivar = %s" % example.cvar.uivar)
+print("usvar = %s" % example.cvar.usvar)
+print("ulvar = %s" % example.cvar.ulvar)
+print("scvar = %s" % example.cvar.scvar)
+print("ucvar = %s" % example.cvar.ucvar)
+print("fvar = %s" % example.cvar.fvar)
+print("dvar = %s" % example.cvar.dvar)
+print("cvar = %s" % example.cvar.cvar)
+print("strvar = %s" % example.cvar.strvar)
+print("cstrvar = %s" % example.cvar.cstrvar)
+print("iptrvar = %s" % example.cvar.iptrvar)
+print("name = %s" % example.cvar.name)
+print("ptptr = %s %s" % (example.cvar.ptptr, example.Point_print(example.cvar.ptptr)))
+print("pt = %s %s" % (example.cvar.pt, example.Point_print(example.cvar.pt)))
-print "\nVariables (values printed from C)"
+print("\nVariables (values printed from C)")
example.print_vars()
-print "\nNow I'm going to try and modify some read only variables"
+print("\nNow I'm going to try and modify some read only variables")
-print " Trying to set 'path'"
+print(" Trying to set 'path'")
try:
example.cvar.path = "Whoa!"
- print "Hey, what's going on?!?! This shouldn't work"
+ print("Hey, what's going on?!?! This shouldn't work")
except Exception:
- print "Good."
+ print("Good.")
-print " Trying to set 'status'"
+print(" Trying to set 'status'")
try:
example.cvar.status = 0
- print "Hey, what's going on?!?! This shouldn't work"
+ print("Hey, what's going on?!?! This shouldn't work")
except Exception:
- print "Good."
+ print("Good.")
-print "\nI'm going to try and update a structure variable.\n"
+print("\nI'm going to try and update a structure variable.\n")
example.cvar.pt = example.cvar.ptptr
-print "The new value is"
+print("The new value is")
example.pt_print()
-print "You should see the value", example.Point_print(example.cvar.ptptr)
+print("You should see the value %s" % example.Point_print(example.cvar.ptptr))
diff --git a/Examples/s-exp/uffi.lisp b/Examples/s-exp/uffi.lisp
deleted file mode 100644
index aea9a1405..000000000
--- a/Examples/s-exp/uffi.lisp
+++ /dev/null
@@ -1,389 +0,0 @@
-;;; This is experimental code that uses the s-expression
-;;; representation of a C/C++ library interface to generate Foreign
-;;; Function Interface definitions for use with Kevin Rosenberg's
-;;; UFFI.
-;;;
-;;; Written by Matthias Koeppe
-
-(eval-when (:compile-toplevel :load-toplevel :execute)
- (require 'port) ; from CLOCC
- (require 'uffi))
-
-(in-package :cl-user)
-
-;; Interaction with the SWIG binary
-
-(defvar *swig-source-directory* #p"/home/mkoeppe/s/swig1.3/")
-
-(defvar *swig-program* (merge-pathnames "swig" *swig-source-directory*))
-
-(defun run-swig (swig-interface-file-name &key directory-search-list module
- ignore-errors c++)
- (let ((temp-file-name "/tmp/swig.lsp"))
- (let ((process
- (port:run-prog (namestring *swig-program*)
- :output t
- :args `(,@(and c++ '("-c++"))
- "-sexp"
- ,@(mapcar (lambda (dir)
- (concatenate 'string
- "-I" (namestring dir)))
- directory-search-list)
- ,@(and module
- `("-module" ,module))
- "-o" ,temp-file-name
- ,(namestring swig-interface-file-name)))))
- #+cmu (unless (or (zerop (ext:process-exit-code process))
- ignore-errors)
- (error "Process swig exited abnormally"))
- (with-open-file (s temp-file-name)
- (read s)))))
-
-;; Type system
-
-(defun parse-swigtype (type-string &key start end junk-ok)
- "Parse TYPE-STRING as SWIG's internal representation of C/C++
-types. Return two values: The type description (an improper list) and
-the terminating index into TYPE-STRING."
- ;; SWIG's internal representation is described in Source/Swig/stype.c
- (unless start
- (setq start 0))
- (unless end
- (setq end (length type-string)))
- (flet ((prefix-match (prefix)
- (let ((position (mismatch prefix type-string :start2 start :end2 end)))
- (or (not position)
- (= position (length prefix)))))
- (bad-type-error (reason)
- (error "Bad SWIG type (~A): ~A" reason
- (subseq type-string start end)))
- (type-char (index)
- (and (< index (length type-string))
- (char type-string index)))
- (cons-and-recurse (prefix start end)
- (multiple-value-bind (type-description index)
- (parse-swigtype type-string :start start :end end
- :junk-ok junk-ok)
- (values (cons prefix type-description)
- index))))
- (cond
- ((prefix-match "p.") ; pointer
- (cons-and-recurse '* (+ start 2) end))
- ((prefix-match "r.") ; C++ reference
- (cons-and-recurse '& (+ start 2) end))
- ((prefix-match "a(") ; array
- (let ((closing-paren (position #\) type-string
- :start (+ start 2)
- :end end)))
- (unless closing-paren
- (bad-type-error "missing right paren"))
- (unless (eql (type-char (+ closing-paren 1)) #\.)
- (bad-type-error "missing dot"))
- (cons-and-recurse (list 'ARRAY (subseq type-string (+ start 2) closing-paren))
- (+ closing-paren 2) end)))
- ((prefix-match "q(") ; qualifier (const, volatile)
- (let ((closing-paren (position #\) type-string
- :start (+ start 2)
- :end end)))
- (unless closing-paren
- (bad-type-error "missing right paren"))
- (unless (eql (type-char (+ closing-paren 1)) #\.)
- (bad-type-error "missing dot"))
- (cons-and-recurse (list 'QUALIFIER (subseq type-string (+ start 2) closing-paren))
- (+ closing-paren 2) end)))
- ((prefix-match "m(") ; C++ member pointer
- (multiple-value-bind (class-type class-end-index)
- (parse-swigtype type-string :junk-ok t
- :start (+ start 2) :end end)
- (unless (eql (type-char class-end-index) #\))
- (bad-type-error "missing right paren"))
- (unless (eql (type-char (+ class-end-index 1)) #\.)
- (bad-type-error "missing dot"))
- (cons-and-recurse (list 'MEMBER-POINTER class-type)
- (+ class-end-index 2) end)))
- ((prefix-match "f(") ; function
- (loop with index = (+ start 2)
- until (eql (type-char index) #\))
- collect (multiple-value-bind (arg-type arg-end-index)
- (parse-swigtype type-string :junk-ok t
- :start index :end end)
- (case (type-char arg-end-index)
- (#\, (setq index (+ arg-end-index 1)))
- (#\) (setq index arg-end-index))
- (otherwise (bad-type-error "comma or right paren expected")))
- arg-type)
- into arg-types
- finally (unless (eql (type-char (+ index 1)) #\.)
- (bad-type-error "missing dot"))
- (return (cons-and-recurse (cons 'FUNCTION arg-types)
- (+ index 2) end))))
- ((prefix-match "v(") ;varargs
- (let ((closing-paren (position #\) type-string
- :start (+ start 2)
- :end end)))
- (unless closing-paren
- (bad-type-error "missing right paren"))
- (values (list 'VARARGS (subseq type-string (+ start 2) closing-paren))
- (+ closing-paren 1))))
- (t (let ((junk-position (position-if (lambda (char)
- (member char '(#\, #\( #\) #\.)))
- type-string
- :start start :end end)))
- (cond (junk-position ; found junk
- (unless junk-ok
- (bad-type-error "trailing junk"))
- (values (subseq type-string start junk-position)
- junk-position))
- (t
- (values (subseq type-string start end)
- end))))))))
-
-(defun swigtype-function-p (swigtype)
- "Check whether SWIGTYPE designates a function. If so, the second
-value is the list of argument types, and the third value is the return
-type."
- (if (and (consp swigtype)
- (consp (first swigtype))
- (eql (first (first swigtype)) 'FUNCTION))
- (values t (rest (first swigtype)) (rest swigtype))
- (values nil nil nil)))
-
-
-;; UFFI
-
-(defvar *uffi-definitions* '())
-
-(defconstant *uffi-default-primitive-type-alist*
- '(("char" . :char)
- ("unsigned char" . :unsigned-byte)
- ("signed char" . :byte)
- ("short" . :short)
- ("signed short" . :short)
- ("unsigned short" . :unsigned-short)
- ("int" . :int)
- ("signed int" . :int)
- ("unsigned int" . :unsigned-int)
- ("long" . :long)
- ("signed long" . :long)
- ("unsigned long" . :unsigned-long)
- ("float" . :float)
- ("double" . :double)
- ((* . "char") . :cstring)
- ((* . "void") . :pointer-void)
- ("void" . :void)))
-
-(defvar *uffi-primitive-type-alist* *uffi-default-primitive-type-alist*)
-
-(defun uffi-type-spec (type-list)
- "Return the UFFI type spec equivalent to TYPE-LIST, or NIL if there
-is no representation."
- (let ((primitive-type-pair
- (assoc type-list *uffi-primitive-type-alist* :test 'equal)))
- (cond
- (primitive-type-pair
- (cdr primitive-type-pair))
- ((and (consp type-list)
- (eql (first type-list) '*))
- (let ((base-type-spec (uffi-type-spec (rest type-list))))
- (cond
- ((not base-type-spec)
- :pointer-void)
- (t
- (list '* base-type-spec)))))
- (t nil))))
-
-;; Parse tree
-
-(defvar *uffi-output* nil)
-
-(defun emit-uffi-definition (uffi-definition)
- (format *uffi-output* "~&~S~%" uffi-definition)
- (push uffi-definition *uffi-definitions*))
-
-(defun make-cl-symbol (c-identifier &key uninterned)
- (let ((name (substitute #\- #\_ (string-upcase c-identifier))))
- (if uninterned
- (make-symbol name)
- (intern name))))
-
-(defvar *class-scope* '() "A stack of names of nested C++ classes.")
-
-(defvar *struct-fields* '())
-
-(defvar *linkage* :C "NIL or :C")
-
-(defgeneric handle-node (node-type &key &allow-other-keys)
- (:documentation "Handle a node of SWIG's parse tree of a C/C++ program"))
-
-(defmethod handle-node ((node-type t) &key &allow-other-keys)
- ;; do nothing for unknown node types
- nil)
-
-(defmethod handle-node ((node-type (eql 'cdecl)) &key name decl storage parms type &allow-other-keys)
- (let ((swigtype (parse-swigtype (concatenate 'string decl type))))
- (let ((*print-pretty* nil) ; or FUNCTION would be printed as #' by cmucl
- (*print-circle* t))
- (format *uffi-output* "~&;; C Declaration: ~A ~A ~A ~A~%;; with-parms ~W~%;; of-type ~W~%"
- storage type name decl parms swigtype))
- (multiple-value-bind (function-p arg-swigtype-list return-swigtype)
- (swigtype-function-p swigtype)
- (declare (ignore arg-swigtype-list))
- (cond
- ((and (null *class-scope*) function-p
- (or (eql *linkage* :c)
- (string= storage "externc")))
- ;; ordinary top-level function with C linkage
- (let ((argnum 0)
- (argname-list '()))
- (flet ((unique-argname (name)
- ;; Sometimes the functions in SWIG interfaces
- ;; do not have unique names. Make them unique
- ;; by adding a suffix. Also avoid symbols
- ;; that are specially bound.
- (unless name
- (setq name (format nil "arg~D" argnum)))
- (let ((argname (make-cl-symbol name)))
- (when (boundp argname) ;specially bound
- (setq argname (make-cl-symbol name :uninterned t)))
- (push argname argname-list)
- argname)))
- (let ((uffi-arg-list
- (mapcan (lambda (param)
- (incf argnum)
- (destructuring-bind (&key name type &allow-other-keys) param
- (let ((uffi-type (uffi-type-spec (parse-swigtype type))))
- (cond
- ((not uffi-type)
- (format *uffi-output* "~&;; Warning: Cannot handle type ~S of argument `~A'~%"
- type name)
- (return-from handle-node))
- ((eq uffi-type :void)
- '())
- (t
- (let ((symbol (unique-argname name)))
- (list `(,symbol ,uffi-type))))))))
- parms))
- (uffi-return-type
- (uffi-type-spec return-swigtype)))
- (unless uffi-return-type
- (format *uffi-output* "~&;; Warning: Cannot handle return type `~S'~%"
- return-swigtype)
- (return-from handle-node))
- (emit-uffi-definition `(UFFI:DEF-FUNCTION ,name ,uffi-arg-list :RETURNING ,uffi-return-type))))))
- ((and (not (null *class-scope*)) (null (rest *class-scope*))
- (not function-p)) ; class/struct member (no nested structs)
- (let ((uffi-type (uffi-type-spec swigtype)))
- (unless uffi-type
- (format *uffi-output* "~&;; Warning: Cannot handle type ~S of struct field `~A'~%"
- type name)
- (return-from handle-node))
- (push `(,(make-cl-symbol name) ,uffi-type) *struct-fields*)))))))
-
-(defmethod handle-node ((node-type (eql 'class)) &key name children kind &allow-other-keys)
- (format *uffi-output* "~&;; Class ~A~%" name)
- (let ((*class-scope* (cons name *class-scope*))
- (*struct-fields* '()))
- (dolist (child children)
- (apply 'handle-node child))
- (emit-uffi-definition `(,(if (string= kind "union")
- 'UFFI:DEF-UNION
- 'UFFI:DEF-STRUCT)
- ,(make-cl-symbol name) ,@(nreverse *struct-fields*)))))
-
-(defmethod handle-node ((node-type (eql 'top)) &key children &allow-other-keys)
- (dolist (child children)
- (apply 'handle-node child)))
-
-(defmethod handle-node ((node-type (eql 'include)) &key name children &allow-other-keys)
- (format *uffi-output* ";; INCLUDE ~A~%" name)
- (dolist (child children)
- (apply 'handle-node child)))
-
-(defmethod handle-node ((node-type (eql 'extern)) &key name children &allow-other-keys)
- (format *uffi-output* ";; EXTERN \"C\" ~A~%" name)
- (let ((*linkage* :c))
- (dolist (child children)
- (apply 'handle-node child))))
-
-;;(defun compute-uffi-definitions (swig-interface)
-;; (let ((*uffi-definitions* '()))
-;; (handle-node swig-interface)
-;; *uffi-definitions*))
-
-;; Test instances
-
-;;; Link to SWIG itself
-
-#||
-
-(defparameter *c++-compiler* "g++")
-
-(defun stdc++-library (&key env)
- (let ((error-output (make-string-output-stream)))
- (let ((name-output (make-string-output-stream)))
- (let ((proc (ext:run-program
- *c++-compiler*
- '("-print-file-name=libstdc++.so")
- :env env
- :input nil
- :output name-output
- :error error-output)))
- (unless proc
- (error "Could not run ~A" *c++-compiler*))
- (unless (zerop (ext:process-exit-code proc))
- (system:serve-all-events 0)
- (error "~A failed:~%~A" *c++-compiler*
- (get-output-stream-string error-output))))
- (string-right-trim '(#\Newline) (get-output-stream-string name-output)))))
-
-(defvar *swig-interface* nil)
-
-(defvar *swig-uffi-pathname* #p"/tmp/swig-uffi.lisp")
-
-(defun link-swig ()
- (setq *swig-interface*
- (run-swig (merge-pathnames "Source/swig.i" *swig-source-directory*)
- :directory-search-list
- (list (merge-pathnames "Source/" *swig-source-directory*))
- :module "swig"
- :ignore-errors t
- :c++ t))
- (with-open-file (f *swig-uffi-pathname* :direction :output)
- (let ((*linkage* :c++)
- (*uffi-definitions* '())
- (*uffi-output* f)
- (*uffi-primitive-type-alist* *uffi-default-primitive-type-alist*))
- (apply 'handle-node *swig-interface*)))
- (compile-file *swig-uffi-pathname*)
- (alien:load-foreign (merge-pathnames "Source/libswig.a"
- *swig-source-directory*)
- :libraries (list (stdc++-library)))
- ;; FIXME: UFFI stuffes a "-l" in front of the passed library names
- ;; (uffi:load-foreign-library (merge-pathnames "Source/libswig.a"
- ;; *swig-source-directory*)
- ;; :supporting-libraries
- ;; (list (stdc++-library)))
- (load (compile-file-pathname *swig-uffi-pathname*)))
-
-||#
-
-;;;; TODO:
-
-;; * How to do type lookups? Is everything important that SWIG knows
-;; about the types written out? What to make of typemaps?
-;;
-;; * Wrapped functions should probably automatically COERCE their
-;; arguments (as of type DOUBLE-FLOAT), to make the functions more
-;; flexible?
-;;
-;; * Why are the functions created by FFI interpreted?
-;;
-;; * We can't deal with more complicated structs and C++ classes
-;; directly with the FFI; we have to emit SWIG wrappers that access
-;; those classes.
-;;
-;; * A CLOS layer where structure fields are mapped as slots. It
-;; looks like we need MOP functions to implement this.
-;;
-;; * Maybe modify SWIG so that key-value hashes are distinguished from
-;; value-value hashes.
diff --git a/Examples/scilab/check.list b/Examples/scilab/check.list
index 0bcf457c2..d57cfab64 100644
--- a/Examples/scilab/check.list
+++ b/Examples/scilab/check.list
@@ -13,4 +13,3 @@ std_vector
struct
template
variables
-
diff --git a/Examples/test-suite/allegrocl/Makefile.in b/Examples/test-suite/allegrocl/Makefile.in
deleted file mode 100644
index b13d546da..000000000
--- a/Examples/test-suite/allegrocl/Makefile.in
+++ /dev/null
@@ -1,126 +0,0 @@
-#######################################################################
-# Makefile for allegrocl test-suite
-#######################################################################
-
-LANGUAGE = allegrocl
-ALLEGROCL = @ALLEGROCLBIN@
-SCRIPTSUFFIX = _runme.lisp
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
-
-
-# these cpp tests generate warnings/errors when compiling
-# the wrapper .cxx file.
-CPP_TEST_BROKEN_CXX =
-# the error is wrap:action code generated by swig. \
-# error: can't convert [std::string] 'b' to 'bool' \
-# might just need a bool overload op for std::string. \
- global_vars \
-# same as w/ global_vars but with more errors in cxx file \
- naturalvar \
-
-# these cpp tests aren't working. Fix 'em
-# need to further separate these into tests requiring
-# std libraries, or the $ldestructor problem.
-CPP_TEST_BROKEN_ACL = \
- contract \
- allprotected \
-# 'throws' typemap entries. \
- cplusplus_throw \
-# 'throws' typemap entries. \
- default_args \
-# missing typemaps. suspect module support needed \
- dynamic_cast \
- extend_variable \
-# cdata.i support needed \
- li_cdata_cpp \
-# warning generated. otherwise all good. \
- operator_overload \
-# std_common.i support \
- sizet \
-# std_vector.i support. \
- template_default \
-# *** line 31. can't copy typemap?? \
- typemap_namespace \
-
-# these aren't working due to longlong support. (low hanging fruit)
-CPP_TEST_BROKEN_LONGLONG = \
- arrays_dimensionless \
- arrays_global \
- arrays_global_twodim \
- li_typemaps \
- li_windows \
- long_long_apply \
- primitive_ref \
- reference_global_vars \
- template_default_arg
-
-# These are currently unsupported.
-CPP_TEST_CASES_ACL_UNSUPPORTED = \
-# contract support \
- aggregate \
-# directors support \
- apply_signed_char \
-# contract support \
- contract \
- director_exception \
- director_protected \
- exception_order \
-# 'throws' typemap support \
- extern_throws \
- throw_exception \
- using_pointers \
-
-C_TEST_CASES_ACL_BROKEN = \
-# 'cdate.i' module support \
- li_cdata \
-# adding an existing type defnition... \
- typedef_struct \
-# swigrun.swg support. \
- typemap_subst
-
-C_TEST_BROKEN_LONGLONG = \
- long_long
-
-
-# std lib support hasn't been done yet.
-SKIP_CPP_STD_CASES = Yes
-
-include $(srcdir)/../common.mk
-
-# Overridden variables here
-# SWIGOPT += -debug-module 4
-
-# Custom tests - tests with additional commandline options
-# none!
-
-# Rules for the different types of tests
-%.cpptest:
- $(setup)
- +$(swig_and_compile_cpp)
- $(run_testcase)
-
-%.ctest:
- $(setup)
- +$(swig_and_compile_c)
- $(run_testcase)
-
-%.multicpptest:
- $(setup)
- +$(swig_and_compile_multi_cpp)
- $(run_testcase)
-
-# Runs the testcase. A testcase is only run if
-# a file is found which has _runme.lisp appended after the testcase name.
-run_testcase = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
- fi
-
-%.clean:
- @rm -f $*.cl
-
-clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" allegrocl_clean
diff --git a/Examples/test-suite/allowexcept.i b/Examples/test-suite/allowexcept.i
index c901295df..229e65cc9 100644
--- a/Examples/test-suite/allowexcept.i
+++ b/Examples/test-suite/allowexcept.i
@@ -26,17 +26,6 @@ UVW Bar::static_member_variable;
struct XYZ {
};
-// The operator& trick doesn't work for SWIG/PHP because the generated code
-// takes the address of the variable in the code in the "vinit" section.
-#ifdef SWIGPHP
-%{
-struct XYZ {
- void foo() {}
-private:
- XYZ& operator=(const XYZ& other); // prevent assignment used in normally generated set method
-};
-%}
-#else
%{
struct XYZ {
void foo() {}
@@ -45,7 +34,6 @@ private:
XYZ* operator&(); // prevent dereferencing used in normally generated get method
};
%}
-#endif
#if defined(SWIGUTL)
%exception {
/*
diff --git a/Examples/test-suite/apply_strings.i b/Examples/test-suite/apply_strings.i
index 695dd068f..14283bb11 100644
--- a/Examples/test-suite/apply_strings.i
+++ b/Examples/test-suite/apply_strings.i
@@ -44,8 +44,6 @@
// unsigned char* as strings
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
-/* Note: Chicken does not allow unsigned char * in strings */
-
%apply char [ANY] {TAscii[ANY]}
%apply char [] {TAscii []}
%apply char * {TAscii *}
diff --git a/Examples/test-suite/autodoc.i b/Examples/test-suite/autodoc.i
index 9f4365ee1..efc720155 100644
--- a/Examples/test-suite/autodoc.i
+++ b/Examples/test-suite/autodoc.i
@@ -183,3 +183,12 @@ const int PROCESS_DEFAULT_VALUE = 17;
typedef long int some_type;
int process_complex_defval(int val = PROCESS_DEFAULT_VALUE, int factor = some_type(-1)) { return val*factor; }
%}
+
+// Test for empty docstring, which should be ignored.
+%feature("docstring") ""
+
+%inline %{
+struct a_structure{
+ char my_array[1];
+};
+%}
diff --git a/Examples/test-suite/ccomplextest.i b/Examples/test-suite/ccomplextest.i
new file mode 100644
index 000000000..c631dc02e
--- /dev/null
+++ b/Examples/test-suite/ccomplextest.i
@@ -0,0 +1,81 @@
+%module ccomplextest
+
+%include
+
+%{
+#include
+
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199001L
+#define HAS_C99_COMPLEX_FOR_TESTING 1
+#else
+/* c99 complex not supported - super hack tests to just test plain floating point numbers */
+/* some pre c99 compilers (gcc-4.x) don't define _Complex but do define complex */
+#define _Complex
+#if !defined(complex)
+# define complex
+#endif
+#define conj
+#define conjf
+#define creal
+#define cimag
+#if defined(I)
+# undef I
+# define I 1
+#endif
+#define HAS_C99_COMPLEX_FOR_TESTING 0
+#endif
+%}
+
+%inline
+{
+ int has_c99_complex(void) {
+ return HAS_C99_COMPLEX_FOR_TESTING;
+ }
+
+ complex double Conj(complex double a)
+ {
+ return conj(a);
+ }
+
+
+ complex float Conjf(complex float a)
+ {
+ return conjf(a);
+ }
+
+
+ double complex Conj1(double complex a)
+ {
+ return conj(a);
+ }
+
+
+ float complex Conjf1(float complex a)
+ {
+ return conjf(a);
+ }
+
+
+ _Complex double Conj2(_Complex double a)
+ {
+ return conj(a);
+ }
+
+
+ _Complex float Conjf2(_Complex float a)
+ {
+ return conjf(a);
+ }
+
+
+ double _Complex Conj3(double _Complex a)
+ {
+ return conj(a);
+ }
+
+
+ float _Complex Conjf3(float _Complex a)
+ {
+ return conjf(a);
+ }
+}
diff --git a/Examples/test-suite/chicken/Makefile.in b/Examples/test-suite/chicken/Makefile.in
deleted file mode 100644
index b3dccc9c3..000000000
--- a/Examples/test-suite/chicken/Makefile.in
+++ /dev/null
@@ -1,101 +0,0 @@
-#######################################################################
-# Makefile for chicken test-suite
-#######################################################################
-
-LANGUAGE = chicken
-VARIANT =
-SCRIPTSUFFIX = _runme.ss
-PROXYSUFFIX = _runme_proxy.ss
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
-
-CHICKEN_CSI = @CHICKEN_CSI@ -quiet -batch -no-init
-SO = @SO@
-
-#C_TEST_CASES = long_long list_vector pointer_in_out multivalue
-
-# Skip the STD cases for now, except for li_std_string.i
-SKIP_CPP_STD_CASES = Yes
-
-CPP_TEST_CASES += li_std_string
-
-EXTRA_TEST_CASES += chicken_ext_test.externaltest
-
-include $(srcdir)/../common.mk
-
-# Overridden variables here
-SWIGOPT += -nounit
-
-# Custom tests - tests with additional commandline options
-# If there exists a PROXYSUFFIX runme file, we also generate the wrapper
-# with the -proxy argument
-%.cppproxy: SWIGOPT += -proxy
-%.cppproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
-
-%.cproxy: SWIGOPT += -proxy
-%.cproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
-
-%.multiproxy: SWIGOPT += -proxy -noclosuses
-%.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
-
-# Rules for the different types of tests
-%.cpptest:
- $(setup)
- +$(swig_and_compile_cpp)
- $(run_testcase)
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
- $(MAKE) $*.cppproxy; \
- fi
-
-%.ctest:
- $(setup)
- +$(swig_and_compile_c)
- $(run_testcase)
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
- $(MAKE) $*.cproxy; \
- fi
-
-%.multicpptest:
- $(setup)
- +$(swig_and_compile_multi_cpp)
- $(run_testcase)
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
- $(MAKE) $*.multiproxy; \
- fi
-
-%.externaltest:
- $(setup)
- +$(swig_and_compile_external)
- $(run_testcase)
-
-%.cppproxy:
- echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test) with -proxy"
- +$(swig_and_compile_cpp)
- $(run_testcase)
-
-%.cproxy:
- echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test) with -proxy"
- +$(swig_and_compile_c)
- $(run_testcase)
-
-%.multiproxy:
- echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test) with -proxy"
- +$(swig_and_compile_multi_cpp)
- $(run_testcase)
-
-# Runs the testcase. A testcase is only run if
-# a file is found which has _runme.scm appended after the testcase name.
-run_testcase = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
- fi
-
-# Clean
-%.clean:
- @exit 0
-
-clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
- rm -f *.scm
diff --git a/Examples/test-suite/chicken/README b/Examples/test-suite/chicken/README
deleted file mode 100644
index aad730ec4..000000000
--- a/Examples/test-suite/chicken/README
+++ /dev/null
@@ -1,11 +0,0 @@
-See ../README for common README file.
-
-Any testcases which have _runme.ss appended after the testcase name will be detected and run.
-NOTE: I had to use _runme.ss because otherwise it would be hard to implement make clean
-Since when SWIG runs it generates an example.scm file for every test, to clean those files
-I needed to add a rm -f *.scm to make clean. But we don't want the runme scripts to
-disappear as well!
-
-Any testcases which have _runme_proxy.ss appended after the testcase name will be detected
-and run with the -proxy argument passed to SWIG. SWIG will not be run with the -unhide-primitive
-option, so the _runme_proxy.ss file must use only the tinyclos exported interface.
diff --git a/Examples/test-suite/chicken/casts_runme.ss b/Examples/test-suite/chicken/casts_runme.ss
deleted file mode 100644
index 2eca46149..000000000
--- a/Examples/test-suite/chicken/casts_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "casts.so")
-(include "../schemerunme/casts.scm")
diff --git a/Examples/test-suite/chicken/char_constant_runme.ss b/Examples/test-suite/chicken/char_constant_runme.ss
deleted file mode 100644
index 50dff3018..000000000
--- a/Examples/test-suite/chicken/char_constant_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "char_constant.so")
-(include "../schemerunme/char_constant.scm")
diff --git a/Examples/test-suite/chicken/chicken_ext_test_external.cxx b/Examples/test-suite/chicken/chicken_ext_test_external.cxx
deleted file mode 100644
index 1dd6a7d53..000000000
--- a/Examples/test-suite/chicken/chicken_ext_test_external.cxx
+++ /dev/null
@@ -1,21 +0,0 @@
-#include
-#include
-
-void test_create(C_word,C_word,C_word) C_noret;
-void test_create(C_word argc, C_word closure, C_word continuation) {
- C_word resultobj;
- swig_type_info *type;
- A *newobj;
- C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
-
- C_trace("test-create");
- if (argc!=2) C_bad_argc(argc,2);
-
-
- newobj = new A();
-
- type = SWIG_TypeQuery("A *");
- resultobj = SWIG_NewPointerObj(newobj, type, 1);
-
- C_kontinue(continuation, resultobj);
-}
diff --git a/Examples/test-suite/chicken/chicken_ext_test_runme.ss b/Examples/test-suite/chicken/chicken_ext_test_runme.ss
deleted file mode 100644
index 65fa4e085..000000000
--- a/Examples/test-suite/chicken/chicken_ext_test_runme.ss
+++ /dev/null
@@ -1,5 +0,0 @@
-(load "chicken_ext_test.so")
-
-(define a (test-create))
-
-(A-hello a)
diff --git a/Examples/test-suite/chicken/class_ignore_runme.ss b/Examples/test-suite/chicken/class_ignore_runme.ss
deleted file mode 100644
index ba84810a3..000000000
--- a/Examples/test-suite/chicken/class_ignore_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "class_ignore.so")
-(include "../schemerunme/class_ignore.scm")
diff --git a/Examples/test-suite/chicken/clientdata_prop_runme_proxy.ss b/Examples/test-suite/chicken/clientdata_prop_runme_proxy.ss
deleted file mode 100644
index 62f2c2053..000000000
--- a/Examples/test-suite/chicken/clientdata_prop_runme_proxy.ss
+++ /dev/null
@@ -1,95 +0,0 @@
-(require 'clientdata_prop_a)
-(require 'clientdata_prop_b)
-
-(define a (make ))
-(test-A a)
-(test-tA a)
-(test-t2A a)
-(test-t3A a)
-(fA a)
-
-(define b (make ))
-(test-A b)
-(test-tA b)
-(test-t2A b)
-(test-t3A b)
-(test-B b)
-(fA b)
-(fB b)
-
-(define c (make ))
-(test-A c)
-(test-tA c)
-(test-t2A c)
-(test-t3A c)
-(test-C c)
-(fA c)
-(fC c)
-
-(define d (make ))
-(test-A d)
-(test-tA d)
-(test-t2A d)
-(test-t3A d)
-(test-D d)
-(test-tD d)
-(test-t2D d)
-(fA d)
-(fD d)
-
-;; here are the real tests... if the clientdata is correctly
-;; propegated, new-tA, new-t2A, should all return wrapped proxy's
-;; of class
-
-(define a2 (new-tA))
-(if (not (eq? (class-of a2) ))
- (error "Error 1"))
-(test-A a2)
-(test-tA a2)
-(test-t2A a2)
-(test-t3A a2)
-(fA a2)
-
-(define a3 (new-t2A))
-(if (not (eq? (class-of a3) ))
- (error "Error 2"))
-(test-A a3)
-(test-tA a3)
-(test-t2A a3)
-(test-t3A a3)
-(fA a3)
-
-(define a4 (new-t3A))
-(if (not (eq? (class-of a4) ))
- (error "Error 3"))
-(test-A a4)
-(test-tA a4)
-(test-t2A a4)
-(test-t3A a4)
-(fA a4)
-
-(define d2 (new-tD))
-(if (not (eq? (class-of d2) ))
- (error "Error 4"))
-(test-A d2)
-(test-tA d2)
-(test-t2A d2)
-(test-t3A d2)
-(test-D d2)
-(test-tD d2)
-(fA d2)
-(fD d2)
-
-(define d3 (new-t2D))
-(if (not (eq? (class-of d3) ))
- (error "Error 5"))
-(test-A d3)
-(test-tA d3)
-(test-t2A d3)
-(test-t3A d3)
-(test-D d3)
-(test-tD d3)
-(fA d3)
-(fD d3)
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/constover_runme.ss b/Examples/test-suite/chicken/constover_runme.ss
deleted file mode 100644
index eb39c7ff0..000000000
--- a/Examples/test-suite/chicken/constover_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "constover.so")
-(include "../schemerunme/constover.scm")
diff --git a/Examples/test-suite/chicken/contract_runme.ss b/Examples/test-suite/chicken/contract_runme.ss
deleted file mode 100644
index 006bcfdec..000000000
--- a/Examples/test-suite/chicken/contract_runme.ss
+++ /dev/null
@@ -1,3 +0,0 @@
-(load "contract.so")
-(include "testsuite.ss")
-(include "../schemerunme/contract.scm")
diff --git a/Examples/test-suite/chicken/cpp_basic_runme_proxy.ss b/Examples/test-suite/chicken/cpp_basic_runme_proxy.ss
deleted file mode 100644
index 7b0b6d722..000000000
--- a/Examples/test-suite/chicken/cpp_basic_runme_proxy.ss
+++ /dev/null
@@ -1,64 +0,0 @@
-(require 'cpp_basic)
-
-(define-macro (check test)
- `(if (not ,test) (error "Error in test " ',test)))
-
-(define f (make 4))
-(check (= (slot-ref f 'num) 4))
-(slot-set! f 'num -17)
-(check (= (slot-ref f 'num) -17))
-
-(define b (make ))
-
-(slot-set! b 'fptr f)
-(check (= (slot-ref (slot-ref b 'fptr) 'num) -17))
-(check (= (test b -3 (slot-ref b 'fptr)) -5))
-(slot-set! f 'num 12)
-(check (= (slot-ref (slot-ref b 'fptr) 'num) 12))
-
-(check (= (slot-ref (slot-ref b 'fref) 'num) -4))
-(check (= (test b 12 (slot-ref b 'fref)) 23))
-;; references don't take ownership, so if we didn't define this here it might get garbage collected
-(define f2 (make 23))
-(slot-set! b 'fref f2)
-(check (= (slot-ref (slot-ref b 'fref) 'num) 23))
-(check (= (test b -3 (slot-ref b 'fref)) 35))
-
-(check (= (slot-ref (slot-ref b 'fval) 'num) 15))
-(check (= (test b 3 (slot-ref b 'fval)) 33))
-(slot-set! b 'fval (make -15))
-(check (= (slot-ref (slot-ref b 'fval) 'num) -15))
-(check (= (test b 3 (slot-ref b 'fval)) -27))
-
-(define f3 (testFoo b 12 (slot-ref b 'fref)))
-(check (= (slot-ref f3 'num) 32))
-
-;; now test global
-(define f4 (make 6))
-(Bar-global-fptr f4)
-(check (= (slot-ref (Bar-global-fptr) 'num) 6))
-(slot-set! f4 'num 8)
-(check (= (slot-ref (Bar-global-fptr) 'num) 8))
-
-(check (= (slot-ref (Bar-global-fref) 'num) 23))
-(Bar-global-fref (make -7))
-(check (= (slot-ref (Bar-global-fref) 'num) -7))
-
-(check (= (slot-ref (Bar-global-fval) 'num) 3))
-(Bar-global-fval (make -34))
-(check (= (slot-ref (Bar-global-fval) 'num) -34))
-
-;; Now test function pointers
-(define func1ptr (get-func1-ptr))
-(define func2ptr (get-func2-ptr))
-
-(slot-set! f 'num 4)
-(check (= (func1 f 2) 16))
-(check (= (func2 f 2) -8))
-
-(slot-set! f 'func-ptr func1ptr)
-(check (= (test-func-ptr f 2) 16))
-(slot-set! f 'func-ptr func2ptr)
-(check (= (test-func-ptr f 2) -8))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/cpp_enum_runme.ss b/Examples/test-suite/chicken/cpp_enum_runme.ss
deleted file mode 100644
index 4d4ec7623..000000000
--- a/Examples/test-suite/chicken/cpp_enum_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "cpp_enum.so")
-(include "../schemerunme/cpp_enum.scm")
diff --git a/Examples/test-suite/chicken/cpp_namespace_runme.ss b/Examples/test-suite/chicken/cpp_namespace_runme.ss
deleted file mode 100644
index 800172ed8..000000000
--- a/Examples/test-suite/chicken/cpp_namespace_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "cpp_namespace.so")
-(include "../schemerunme/cpp_namespace.scm")
diff --git a/Examples/test-suite/chicken/dynamic_cast_runme.ss b/Examples/test-suite/chicken/dynamic_cast_runme.ss
deleted file mode 100644
index 1e81d5555..000000000
--- a/Examples/test-suite/chicken/dynamic_cast_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "dynamic_cast.so")
-(include "../schemerunme/dynamic_cast.scm")
diff --git a/Examples/test-suite/chicken/global_vars_runme.ss b/Examples/test-suite/chicken/global_vars_runme.ss
deleted file mode 100644
index 802205b7c..000000000
--- a/Examples/test-suite/chicken/global_vars_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(require 'global_vars)
-(load "../schemerunme/global_vars.scm")
diff --git a/Examples/test-suite/chicken/global_vars_runme_proxy.ss b/Examples/test-suite/chicken/global_vars_runme_proxy.ss
deleted file mode 100644
index 3c4500d6b..000000000
--- a/Examples/test-suite/chicken/global_vars_runme_proxy.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(require 'global_vars)
-(load "../schemerunme/global_vars_proxy.scm")
diff --git a/Examples/test-suite/chicken/import_nomodule_runme.ss b/Examples/test-suite/chicken/import_nomodule_runme.ss
deleted file mode 100644
index 7e64053bc..000000000
--- a/Examples/test-suite/chicken/import_nomodule_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "import_nomodule.so")
-(include "../schemerunme/import_nomodule.scm")
diff --git a/Examples/test-suite/chicken/imports_runme.ss b/Examples/test-suite/chicken/imports_runme.ss
deleted file mode 100644
index ac5fb9890..000000000
--- a/Examples/test-suite/chicken/imports_runme.ss
+++ /dev/null
@@ -1,3 +0,0 @@
-(load "imports_a.so")
-(load "imports_b.so")
-(include "../schemerunme/imports.scm")
diff --git a/Examples/test-suite/chicken/inherit_missing_runme.ss b/Examples/test-suite/chicken/inherit_missing_runme.ss
deleted file mode 100644
index 50a084a95..000000000
--- a/Examples/test-suite/chicken/inherit_missing_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "inherit_missing.so")
-(include "../schemerunme/inherit_missing.scm")
diff --git a/Examples/test-suite/chicken/li_std_string_runme.ss b/Examples/test-suite/chicken/li_std_string_runme.ss
deleted file mode 100644
index cc64287dd..000000000
--- a/Examples/test-suite/chicken/li_std_string_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "li_std_string.so")
-(include "../schemerunme/li_std_string.scm")
diff --git a/Examples/test-suite/chicken/li_std_string_runme_proxy.ss b/Examples/test-suite/chicken/li_std_string_runme_proxy.ss
deleted file mode 100644
index e1e240970..000000000
--- a/Examples/test-suite/chicken/li_std_string_runme_proxy.ss
+++ /dev/null
@@ -1,47 +0,0 @@
-(load "li_std_string.so")
-
-(define x "hello")
-
-(if (not (string=? (test-value x) x))
- (begin (error "Error 1") (exit 1)))
-
-(if (not (string=? (test-const-reference x) x))
- (begin (error "Error 2") (exit 1)))
-
-(define y (test-pointer-out))
-(test-pointer y)
-(define z (test-const-pointer-out))
-(test-const-pointer z)
-
-(define a (test-reference-out))
-(test-reference a)
-
-;; test global variables
-(GlobalString "whee")
-(if (not (string=? (GlobalString) "whee"))
- (error "Error 3"))
-(if (not (string=? (GlobalString2) "global string 2"))
- (error "Error 4"))
-
-(define struct (make ))
-
-;; MemberString should be a wrapped class
-(if (not (string=? (slot-ref struct 'MemberString) ""))
- (error "Error 4.5"))
-;(slot-set! (slot-ref struct 'MemberString) "and how")
-;;(if (not (string=? (slot-ref struct 'MemberString) "and how"))
-;; (error "Error 5"))
-(if (not (string=? (slot-ref struct 'MemberString2) "member string 2"))
- (error "Error 6"))
-(Structure-StaticMemberString "static str")
-(if (not (string=? (Structure-StaticMemberString) "static str"))
- (error "Error 7"))
-(if (not (string=? (Structure-StaticMemberString2) "static member string 2"))
- (error "Error 8"))
-
-;(if (not (string=? (Structure-ConstMemberString-get struct) "const member string"))
-; (error "Error 9"))
-(if (not (string=? (Structure-ConstStaticMemberString) "const static member string"))
- (error "Error 10"))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/li_typemaps_runme.ss b/Examples/test-suite/chicken/li_typemaps_runme.ss
deleted file mode 100644
index 1ad6e921e..000000000
--- a/Examples/test-suite/chicken/li_typemaps_runme.ss
+++ /dev/null
@@ -1,12 +0,0 @@
-(require 'li_typemaps)
-(load "../schemerunme/li_typemaps.scm")
-
-(call-with-values (lambda () (inoutr-int2 3 -2))
- (lambda (a b)
- (if (not (and (= a 3) (= b -2)))
- (error "Error in inoutr-int2"))))
-(call-with-values (lambda () (out-foo 4))
- (lambda (a b)
- (if (not (and (= (Foo-a-get a) 4) (= b 8)))
- (error "Error in out-foo"))))
-(exit 0)
diff --git a/Examples/test-suite/chicken/li_typemaps_runme_proxy.ss b/Examples/test-suite/chicken/li_typemaps_runme_proxy.ss
deleted file mode 100644
index 52997c6fe..000000000
--- a/Examples/test-suite/chicken/li_typemaps_runme_proxy.ss
+++ /dev/null
@@ -1,13 +0,0 @@
-(require 'li_typemaps)
-(load "../schemerunme/li_typemaps_proxy.scm")
-
-(call-with-values (lambda () (inoutr-int2 3 -2))
- (lambda (a b)
- (if (not (and (= a 3) (= b -2)))
- (error "Error in inoutr-int2"))))
-(call-with-values (lambda () (out-foo 4))
- (lambda (a b)
- (if (not (and (= (slot-ref a 'a) 4) (= b 8)))
- (error "Error in out-foo"))))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/list_vector_runme.ss b/Examples/test-suite/chicken/list_vector_runme.ss
deleted file mode 100644
index 67d52f609..000000000
--- a/Examples/test-suite/chicken/list_vector_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "list_vector.so")
-(include "../schemerunme/list_vector.scm")
diff --git a/Examples/test-suite/chicken/member_pointer_runme.ss b/Examples/test-suite/chicken/member_pointer_runme.ss
deleted file mode 100644
index f2226b20a..000000000
--- a/Examples/test-suite/chicken/member_pointer_runme.ss
+++ /dev/null
@@ -1,28 +0,0 @@
-(require 'member_pointer)
-
-(define (check-eq? msg expected actual)
- (if (not (= expected actual))
- (error "Error " msg ": expected " expected " got " actual)))
-
-(define area-pt (areapt))
-(define perim-pt (perimeterpt))
-
-(define s (new-Square 10))
-
-(check-eq? "Square area" 100.0 (do-op s area-pt))
-(check-eq? "Square perim" 40.0 (do-op s perim-pt))
-
-(check-eq? "Square area" 100.0 (do-op s (areavar)))
-(check-eq? "Square perim" 40.0 (do-op s (perimetervar)))
-
-;; Set areavar to return value of function
-(areavar perim-pt)
-(check-eq? "Square perim" 40 (do-op s (areavar)))
-
-(check-eq? "Square area" 100.0 (do-op s (AREAPT)))
-(check-eq? "Square perim" 40.0 (do-op s (PERIMPT)))
-
-(define test (NULLPT))
-
-(perimetervar (AREAPT))
-(check-eq? "Square area" 100.0 (do-op s (perimetervar)))
diff --git a/Examples/test-suite/chicken/multiple_inheritance_runme_proxy.ss b/Examples/test-suite/chicken/multiple_inheritance_runme_proxy.ss
deleted file mode 100644
index 313157c70..000000000
--- a/Examples/test-suite/chicken/multiple_inheritance_runme_proxy.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(require 'multiple_inheritance)
-(load "../schemerunme/multiple_inheritance_proxy.scm")
diff --git a/Examples/test-suite/chicken/multivalue_runme.ss b/Examples/test-suite/chicken/multivalue_runme.ss
deleted file mode 100644
index f5aafcbf4..000000000
--- a/Examples/test-suite/chicken/multivalue_runme.ss
+++ /dev/null
@@ -1,4 +0,0 @@
-;; this doesn't work yet :(
-(load "multivalue.so")
-(include "../schemerunme/multivalue.scm")
-(exit 0)
diff --git a/Examples/test-suite/chicken/name_runme.ss b/Examples/test-suite/chicken/name_runme.ss
deleted file mode 100644
index 938915dcb..000000000
--- a/Examples/test-suite/chicken/name_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "name.so")
-(include "../schemerunme/name.scm")
diff --git a/Examples/test-suite/chicken/newobject1_runme_proxy.ss b/Examples/test-suite/chicken/newobject1_runme_proxy.ss
deleted file mode 100644
index 7bc5a241a..000000000
--- a/Examples/test-suite/chicken/newobject1_runme_proxy.ss
+++ /dev/null
@@ -1,30 +0,0 @@
-(require 'newobject1)
-
-(define-macro (check-count val)
- `(if (not (= (Foo-fooCount) ,val)) (error "Error checking val " ,val " != " ,(Foo-fooCount))))
-
-(define f (Foo-makeFoo))
-
-(check-count 1)
-
-(define f2 (makeMore f))
-
-(check-count 2)
-
-(set! f #f)
-(gc #t)
-
-(check-count 1)
-
-(define f3 (makeMore f2))
-
-(check-count 2)
-
-(set! f3 #f)
-(set! f2 #f)
-
-(gc #t)
-
-(check-count 0)
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/newobject2_runme.ss b/Examples/test-suite/chicken/newobject2_runme.ss
deleted file mode 100644
index cc445f477..000000000
--- a/Examples/test-suite/chicken/newobject2_runme.ss
+++ /dev/null
@@ -1,29 +0,0 @@
-(load "newobject2.so")
-
-(define f (new-Foo))
-
-(Foo-dummy-set f 14)
-(if (not (= (Foo-dummy-get f) 14))
- (error "Bad dummy value"))
-
-(if (not (= (fooCount) 0))
- (error "Bad foo count 1"))
-
-(define f2 (makeFoo))
-
-(if (not (= (fooCount) 1))
- (error "Bad foo count 2"))
-
-(Foo-dummy-set f2 16)
-(if (not (= (Foo-dummy-get f2) 16))
- (error "Bad dummy value for f2"))
-
-(set! f #f)
-(set! f2 #f)
-
-(gc #t)
-
-(if (not (= (fooCount) -1))
- (error "Bad foo count 3"))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/newobject2_runme_proxy.ss b/Examples/test-suite/chicken/newobject2_runme_proxy.ss
deleted file mode 100644
index 36b8cda7f..000000000
--- a/Examples/test-suite/chicken/newobject2_runme_proxy.ss
+++ /dev/null
@@ -1,29 +0,0 @@
-(load "newobject2.so")
-
-(define f (make ))
-
-(slot-set! f 'dummy 14)
-(if (not (= (slot-ref f 'dummy) 14))
- (error "Bad dummy value"))
-
-(if (not (= (fooCount) 0))
- (error "Bad foo count 1"))
-
-(define f2 (makeFoo))
-
-(if (not (= (fooCount) 1))
- (error "Bad foo count 2"))
-
-(slot-set! f2 'dummy 16)
-(if (not (= (slot-ref f2 'dummy) 16))
- (error "Bad dummy value for f2"))
-
-(set! f #f)
-(set! f2 #f)
-
-(gc #t)
-
-(if (not (= (fooCount) -1))
- (error "Bad foo count 3"))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/overload_complicated_runme.ss b/Examples/test-suite/chicken/overload_complicated_runme.ss
deleted file mode 100644
index f89f70bde..000000000
--- a/Examples/test-suite/chicken/overload_complicated_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "overload_complicated.so")
-(include "../schemerunme/overload_complicated.scm")
diff --git a/Examples/test-suite/chicken/overload_copy_runme.ss b/Examples/test-suite/chicken/overload_copy_runme.ss
deleted file mode 100644
index 4ec542205..000000000
--- a/Examples/test-suite/chicken/overload_copy_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "overload_copy.so")
-(include "../schemerunme/overload_copy.scm")
diff --git a/Examples/test-suite/chicken/overload_copy_runme_proxy.ss b/Examples/test-suite/chicken/overload_copy_runme_proxy.ss
deleted file mode 100644
index 5f4808070..000000000
--- a/Examples/test-suite/chicken/overload_copy_runme_proxy.ss
+++ /dev/null
@@ -1,6 +0,0 @@
-(load "./overload_copy.so")
-
-(define f (make ))
-(define g (make f))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/overload_extend_c_runme.ss b/Examples/test-suite/chicken/overload_extend_c_runme.ss
deleted file mode 100644
index 75c0ea8a8..000000000
--- a/Examples/test-suite/chicken/overload_extend_c_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "overload_extend_c.so")
-(include "../schemerunme/overload_extend_c.scm")
diff --git a/Examples/test-suite/chicken/overload_extend_runme.ss b/Examples/test-suite/chicken/overload_extend_runme.ss
deleted file mode 100644
index a19cb29a9..000000000
--- a/Examples/test-suite/chicken/overload_extend_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "overload_extend.so")
-(include "../schemerunme/overload_extend.scm")
diff --git a/Examples/test-suite/chicken/overload_extend_runme_proxy.ss b/Examples/test-suite/chicken/overload_extend_runme_proxy.ss
deleted file mode 100644
index 2a6867e22..000000000
--- a/Examples/test-suite/chicken/overload_extend_runme_proxy.ss
+++ /dev/null
@@ -1,14 +0,0 @@
-(load "./overload_extend.so")
-
-(define f (make ))
-
-(if (not (= (test f 3) 1))
- (error "test integer bad"))
-
-(if (not (= (test f "hello") 2))
- (error "test string bad"))
-
-(if (not (= (test f 3.5 2.5) 6.0))
- (error "test reals bad"))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/overload_simple_runme.ss b/Examples/test-suite/chicken/overload_simple_runme.ss
deleted file mode 100644
index 24fa67aec..000000000
--- a/Examples/test-suite/chicken/overload_simple_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "overload_simple.so")
-(include "../schemerunme/overload_simple.scm")
diff --git a/Examples/test-suite/chicken/overload_simple_runme_proxy.ss b/Examples/test-suite/chicken/overload_simple_runme_proxy.ss
deleted file mode 100644
index 0ae3e6215..000000000
--- a/Examples/test-suite/chicken/overload_simple_runme_proxy.ss
+++ /dev/null
@@ -1,56 +0,0 @@
-(load "overload_simple.so")
-
-(define-macro (check test)
- `(if (not ,test) (error ',test)))
-
-(check (string=? (foo) "foo:"))
-(check (string=? (foo 3) "foo:int"))
-(check (string=? (foo 3.01) "foo:double"))
-(check (string=? (foo "hey") "foo:char *"))
-
-(define f (make ))
-(define b (make ))
-(define b2 (make 3))
-
-(check (= (slot-ref b 'num) 0))
-(check (= (slot-ref b2 'num) 3))
-
-(check (string=? (foo f) "foo:Foo *"))
-(check (string=? (foo b) "foo:Bar *"))
-(check (string=? (foo f 3) "foo:Foo *,int"))
-(check (string=? (foo 3.2 b) "foo:double,Bar *"))
-
-;; now check blah
-(check (string=? (blah 2.01) "blah:double"))
-(check (string=? (blah "hey") "blah:char *"))
-
-;; now check spam member functions
-(define s (make ))
-(define s2 (make 3))
-(define s3 (make 3.2))
-(define s4 (make "whee"))
-(define s5 (make f))
-(define s6 (make b))
-
-(check (string=? (slot-ref s 'type) "none"))
-(check (string=? (slot-ref s2 'type) "int"))
-(check (string=? (slot-ref s3 'type) "double"))
-(check (string=? (slot-ref s4 'type) "char *"))
-(check (string=? (slot-ref s5 'type) "Foo *"))
-(check (string=? (slot-ref s6 'type) "Bar *"))
-
-;; now check Spam member functions
-(check (string=? (foo s 2) "foo:int"))
-(check (string=? (foo s 2.1) "foo:double"))
-(check (string=? (foo s "hey") "foo:char *"))
-(check (string=? (foo s f) "foo:Foo *"))
-(check (string=? (foo s b) "foo:Bar *"))
-
-;; check static member funcs
-(check (string=? (Spam-bar 3) "bar:int"))
-(check (string=? (Spam-bar 3.2) "bar:double"))
-(check (string=? (Spam-bar "hey") "bar:char *"))
-(check (string=? (Spam-bar f) "bar:Foo *"))
-(check (string=? (Spam-bar b) "bar:Bar *"))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/overload_subtype_runme.ss b/Examples/test-suite/chicken/overload_subtype_runme.ss
deleted file mode 100644
index b3663b719..000000000
--- a/Examples/test-suite/chicken/overload_subtype_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "overload_subtype.so")
-(include "../schemerunme/overload_subtype.scm")
diff --git a/Examples/test-suite/chicken/overload_subtype_runme_proxy.ss b/Examples/test-suite/chicken/overload_subtype_runme_proxy.ss
deleted file mode 100644
index d83d59a11..000000000
--- a/Examples/test-suite/chicken/overload_subtype_runme_proxy.ss
+++ /dev/null
@@ -1,12 +0,0 @@
-(load "./overload_subtype.so")
-
-(define f (make ))
-(define b (make ))
-
-(if (not (= (spam f) 1))
- (error "Error in foo"))
-
-(if (not (= (spam b) 2))
- (error "Error in bar"))
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/pointer_in_out_runme.ss b/Examples/test-suite/chicken/pointer_in_out_runme.ss
deleted file mode 100644
index 807c4ebad..000000000
--- a/Examples/test-suite/chicken/pointer_in_out_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "pointer_in_out.so")
-(include "../schemerunme/pointer_in_out.scm")
diff --git a/Examples/test-suite/chicken/reference_global_vars_runme.ss b/Examples/test-suite/chicken/reference_global_vars_runme.ss
deleted file mode 100644
index 1e1914be3..000000000
--- a/Examples/test-suite/chicken/reference_global_vars_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "reference_global_vars.so")
-(include "../schemerunme/reference_global_vars.scm")
diff --git a/Examples/test-suite/chicken/testsuite.ss b/Examples/test-suite/chicken/testsuite.ss
deleted file mode 100644
index e1152a6fe..000000000
--- a/Examples/test-suite/chicken/testsuite.ss
+++ /dev/null
@@ -1,12 +0,0 @@
-(define (lookup-ext-tag tag)
- (cond
- ((equal? tag '(quote swig-contract-assertion-failed))
- '( ((exn type) #f)) )
- (#t '())))
-
-(define-macro (expect-throw tag-form form)
- `(if (condition-case (begin ,form #t)
- ,@(lookup-ext-tag tag-form)
- ((exn) (print "The form threw a different error than expected: " ',form) (exit 1))
- (var () (print "The form did not error as expected: " ',form) (exit 1)))
- (begin (print "The form returned normally when it was expected to throw an error: " ',form) (exit 1))))
diff --git a/Examples/test-suite/chicken/throw_exception_runme.ss b/Examples/test-suite/chicken/throw_exception_runme.ss
deleted file mode 100644
index 62bc7befb..000000000
--- a/Examples/test-suite/chicken/throw_exception_runme.ss
+++ /dev/null
@@ -1,29 +0,0 @@
-(load "throw_exception.so")
-
-(define-macro (check-throw expr check)
- `(if (handle-exceptions exvar (if ,check #f (begin (print "Error executing: " ',expr " " exvar) (exit 1))) ,expr #t)
- (print "Expression did not throw an error: " ',expr)))
-
-(define f (new-Foo))
-
-(check-throw (Foo-test-int f) (= exvar 37))
-(check-throw (Foo-test-msg f) (string=? exvar "Dead"))
-(check-throw (Foo-test-cls f) (test-is-Error exvar))
-(check-throw (Foo-test-cls-ptr f) (test-is-Error exvar))
-(check-throw (Foo-test-cls-ref f) (test-is-Error exvar))
-(check-throw (Foo-test-cls-td f) (test-is-Error exvar))
-(check-throw (Foo-test-cls-ptr-td f) (test-is-Error exvar))
-(check-throw (Foo-test-cls-ref-td f) (test-is-Error exvar))
-(check-throw (Foo-test-enum f) (= exvar (enum2)))
-
-; don't know how to test this... it is returning a SWIG wrapped int *
-;(check-throw (Foo-test-array f) (equal? exvar '(0 1 2 3 4 5 6 7 8 9)))
-
-(check-throw (Foo-test-multi f 1) (= exvar 37))
-(check-throw (Foo-test-multi f 2) (string=? exvar "Dead"))
-(check-throw (Foo-test-multi f 3) (test-is-Error exvar))
-
-(set! f #f)
-(gc #t)
-
-(exit 0)
diff --git a/Examples/test-suite/chicken/typedef_inherit_runme.ss b/Examples/test-suite/chicken/typedef_inherit_runme.ss
deleted file mode 100644
index 111296d60..000000000
--- a/Examples/test-suite/chicken/typedef_inherit_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "typedef_inherit.so")
-(include "../schemerunme/typedef_inherit.scm")
diff --git a/Examples/test-suite/chicken/typename_runme.ss b/Examples/test-suite/chicken/typename_runme.ss
deleted file mode 100644
index 60fc3203b..000000000
--- a/Examples/test-suite/chicken/typename_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "typename.so")
-(include "../schemerunme/typename.scm")
diff --git a/Examples/test-suite/chicken/unions_runme.ss b/Examples/test-suite/chicken/unions_runme.ss
deleted file mode 100644
index 465784a43..000000000
--- a/Examples/test-suite/chicken/unions_runme.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "unions.so")
-(include "../schemerunme/unions.scm")
diff --git a/Examples/test-suite/chicken/unions_runme_proxy.ss b/Examples/test-suite/chicken/unions_runme_proxy.ss
deleted file mode 100644
index 4dd14148d..000000000
--- a/Examples/test-suite/chicken/unions_runme_proxy.ss
+++ /dev/null
@@ -1,2 +0,0 @@
-(load "unions.so")
-(include "../schemerunme/unions_proxy.scm")
diff --git a/Examples/test-suite/chicken_ext_test.i b/Examples/test-suite/chicken_ext_test.i
deleted file mode 100644
index b4f726cc7..000000000
--- a/Examples/test-suite/chicken_ext_test.i
+++ /dev/null
@@ -1,21 +0,0 @@
-%module chicken_ext_test
-
-/* just use the imports_a.h header... for this test we only need a class */
-%{
-#include "imports_a.h"
-%}
-
-%include "imports_a.h"
-
-%{
-void test_create(C_word,C_word,C_word) C_noret;
-%}
-
-%init %{
- {
- C_word *space = C_alloc(2 + C_SIZEOF_INTERNED_SYMBOL(11));
- sym = C_intern (&space, 11, "test-create");
- C_mutate ((C_word*)sym+1, (*space=C_CLOSURE_TYPE|1, space[1]=(C_word)test_create, tmp=(C_word)space, space+=2, tmp));
- }
-%}
-
diff --git a/Examples/test-suite/clisp/Makefile.in b/Examples/test-suite/clisp/Makefile.in
deleted file mode 100644
index 3d207178f..000000000
--- a/Examples/test-suite/clisp/Makefile.in
+++ /dev/null
@@ -1,51 +0,0 @@
-#######################################################################
-# Makefile for clisp test-suite
-#######################################################################
-
-LANGUAGE = clisp
-CLISP = @CLISPBIN@
-SCRIPTSUFFIX = _runme.lisp
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
-
-include $(srcdir)/../common.mk
-
-# Overridden variables here
-# no C++ tests for now
-CPP_TEST_CASES =
-#C_TEST_CASES +=
-
-# Custom tests - tests with additional commandline options
-# none!
-
-# Rules for the different types of tests
-%.cpptest:
- $(setup)
- +$(swig_and_compile_cpp)
- $(run_testcase)
-
-%.ctest:
- $(setup)
- +$(swig_and_compile_c)
- $(run_testcase)
-
-%.multicpptest:
- $(setup)
- +$(swig_and_compile_multi_cpp)
- $(run_testcase)
-
-# Runs the testcase. A testcase is only run if
-# a file is found which has _runme.lisp appended after the testcase name.
-run_testcase = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISP) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
- fi
-
-# Clean: (does nothing, we dont generate extra clisp code)
-%.clean:
- @exit 0
-
-clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' clisp_clean
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 6d230e68a..5151597e3 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -159,6 +159,7 @@ CPP_TEST_CASES += \
cpp_enum \
cpp_namespace \
cpp_nodefault \
+ cpp_parameters \
cpp_static \
cpp_typedef \
cpp14_binary_integer_literals \
@@ -183,6 +184,8 @@ CPP_TEST_CASES += \
director_classes \
director_classic \
director_constructor \
+ director_comparison_operators \
+ director_conversion_operators \
director_default \
director_detect \
director_enum \
@@ -250,6 +253,7 @@ CPP_TEST_CASES += \
funcptr_cpp \
functors \
fvirtual \
+ global_immutable_vars_cpp \
global_namespace \
global_ns_arg \
global_scope_types \
@@ -326,7 +330,7 @@ CPP_TEST_CASES += \
nested_ignore \
nested_inheritance_interface \
nested_in_template \
- nested_scope \
+ nested_scope_flat \
nested_template_base \
nested_workaround \
newobject1 \
@@ -414,6 +418,7 @@ CPP_TEST_CASES += \
struct_value \
swig_exception \
symbol_clash \
+ sym \
template_arg_replace \
template_arg_scope \
template_arg_typename \
@@ -456,6 +461,7 @@ CPP_TEST_CASES += \
template_using_directive_and_declaration_forward \
template_using_directive_typedef \
template_nested \
+ template_nested_flat \
template_nested_typemaps \
template_ns \
template_ns2 \
@@ -610,11 +616,14 @@ CPP11_TEST_BROKEN = \
# cpp11_reference_wrapper \ # No typemaps
# Doxygen support test cases: can only be used with languages supporting
-# Doxygen comment translation, currently only Python and Java.
+# Doxygen comment translation (currently Python and Java) and only if not
+# disabled by configure via SKIP_DOXYGEN_TEST_CASES.
+ifneq ($(SKIP_DOXYGEN_TEST_CASES),1)
python_HAS_DOXYGEN := 1
java_HAS_DOXYGEN := 1
$(eval HAS_DOXYGEN := $($(LANGUAGE)_HAS_DOXYGEN))
+endif
ifdef HAS_DOXYGEN
DOXYGEN_TEST_CASES += \
@@ -622,6 +631,8 @@ DOXYGEN_TEST_CASES += \
doxygen_basic_notranslate \
doxygen_basic_translate \
doxygen_basic_translate_style2 \
+ doxygen_basic_translate_style3 \
+ doxygen_code_blocks \
doxygen_ignore \
doxygen_misc_constructs \
doxygen_nested_class \
@@ -643,6 +654,7 @@ CPP_STD_TEST_CASES += \
director_string \
ignore_template_constructor \
li_std_combinations \
+ li_std_containers_overload \
li_std_deque \
li_std_except \
li_std_except_as_class \
@@ -665,7 +677,7 @@ ifndef SKIP_CPP_STD_CASES
CPP_TEST_CASES += ${CPP_STD_TEST_CASES}
endif
-ifneq (,$(HAVE_CXX11_COMPILER))
+ifeq (1,$(HAVE_CXX11))
CPP_TEST_CASES += $(CPP11_TEST_CASES)
endif
@@ -688,6 +700,7 @@ C_TEST_CASES += \
funcptr \
function_typedef \
global_functions \
+ global_immutable_vars \
immutable_values \
inctest \
infinity \
@@ -707,6 +720,7 @@ C_TEST_CASES += \
nested_extend_c \
nested_structs \
newobject2 \
+ not_c_keywords \
overload_extend_c \
overload_extend2 \
preproc \
@@ -849,8 +863,6 @@ setup = \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
fi
-
-
#######################################################################
# Clean
#######################################################################
diff --git a/Examples/test-suite/complextest.i b/Examples/test-suite/complextest.i
index 592512b45..6c7b1f44a 100644
--- a/Examples/test-suite/complextest.i
+++ b/Examples/test-suite/complextest.i
@@ -2,7 +2,6 @@
%include
-#ifdef __cplusplus
%{
#include
#include
@@ -10,9 +9,7 @@
%}
%include
-#if 1
%template(VectorStdCplx) std::vector >;
-#endif
%inline
{
@@ -63,26 +60,3 @@
}
}
-
-#else
-
-
-%{
-%}
-
-%inline
-{
- complex Conj(complex a)
- {
- return conj(a);
- }
-
-
- complex float Conjf(float complex a)
- {
- return conj(a);
- }
-}
-
-
-#endif
diff --git a/Examples/test-suite/constant_directive.i b/Examples/test-suite/constant_directive.i
index b102ffea2..3e4775df1 100644
--- a/Examples/test-suite/constant_directive.i
+++ b/Examples/test-suite/constant_directive.i
@@ -14,6 +14,11 @@ struct Type1 {
Type1(int val = 0) : val(val) {}
int val;
};
+enum EnumType
+{
+ EnumValue
+};
+EnumType enumValue = EnumValue;
/* Typedefs for const Type and its pointer */
typedef const Type1 Type1Const;
typedef const Type1* Type1Cptr;
@@ -46,3 +51,4 @@ Type1 getType1Instance() { return Type1(111); }
%constant Type1Cfptr TYPE1CFPTR1DEF_CONSTANT1 = getType1Instance;
/* Regular constant */
%constant int TYPE_INT = 0;
+%constant enum EnumType newValue = enumValue;
diff --git a/Examples/test-suite/cpp11_final_override.i b/Examples/test-suite/cpp11_final_override.i
index 8d275b322..c31ae73b6 100644
--- a/Examples/test-suite/cpp11_final_override.i
+++ b/Examples/test-suite/cpp11_final_override.i
@@ -138,3 +138,31 @@ void DerivedNoVirtualStruct::ef() {}
DerivedNoVirtualStruct::~DerivedNoVirtualStruct() {}
%}
+%inline %{
+namespace Outer {
+ namespace final {
+ template struct smart_ptr {
+ typedef T type;
+ };
+ }
+ namespace override {
+ template struct dumb_ptr {
+ typedef T type;
+ };
+ }
+}
+%}
+
+%template(SmartPtrBaseStruct) Outer::final::smart_ptr;
+
+%inline %{
+class ObjectDB
+{
+public:
+ static void smart1(typename Outer::final::smart_ptr::type *objectT) {}
+ static void smart2(Outer::final::smart_ptr::type *objectT) {}
+ static void dumb1(typename Outer::override::dumb_ptr::type *objectT) {}
+ static void dumb2(Outer::override::dumb_ptr::type *objectT) {}
+ static Outer::final::smart_ptr::type get() { return DerivedStruct(); }
+};
+%}
diff --git a/Examples/test-suite/cpp11_lambda_functions.i b/Examples/test-suite/cpp11_lambda_functions.i
index 3d7d76d60..0096eef11 100644
--- a/Examples/test-suite/cpp11_lambda_functions.i
+++ b/Examples/test-suite/cpp11_lambda_functions.i
@@ -56,7 +56,7 @@ auto lambda4 = [](int x, int y) { return x+y; };
auto lambda5 = []() { return thing; };
#endif
-void fn() {
+void fn1() {
int stuff = 0;
auto lambdaxxxx = [=,&stuff]() { return thing; };
}
diff --git a/Examples/test-suite/cpp11_shared_ptr_template_upcast.i b/Examples/test-suite/cpp11_shared_ptr_template_upcast.i
new file mode 100644
index 000000000..38968bb60
--- /dev/null
+++ b/Examples/test-suite/cpp11_shared_ptr_template_upcast.i
@@ -0,0 +1,88 @@
+%module cpp11_shared_ptr_template_upcast
+
+%{
+#include
+#include
+%}
+
+%include
+%include
+
+%{
+class Base {
+public:
+ Base() : value(0) {}
+ Base(int v) : value(v) {}
+ virtual ~Base() {}
+
+ virtual int GetResult() = 0;
+
+ int value;
+};
+
+class Derived : public Base {
+public:
+ Derived() : Base() {}
+ Derived(int v) : Base(v) {}
+ virtual ~Derived() {}
+
+ int GetResult() { return value*2; }
+};
+
+template class Printable : virtual public T {
+public:
+ Printable(int param) : T(param) {}
+ ~Printable() {}
+
+ std::string GetFormatted() { return std::string("The formatted result is: ").append(std::to_string(this->GetResult())); }
+};
+
+std::shared_ptr > MakePrintableDerived(int param) {
+ return std::make_shared >(param);
+}
+
+%}
+
+%shared_ptr(Base);
+%shared_ptr(Derived);
+%shared_ptr(Printable)
+
+class Base {
+public:
+ Base();
+ Base(int v);
+ virtual ~Base();
+
+ virtual int GetResult() = 0;
+
+ int value;
+};
+
+class Derived : public Base {
+public:
+ Derived();
+ Derived(int v);
+ virtual ~Derived();
+
+ int GetResult();
+};
+
+/*
+ Virtual inheritance is contrived for this case, but exposes whether SWIGSmartPtrUpcast generated a correctly typed shared pointer of the upcasted class type -
+ if the pointer type is incorrect, this will result in a segmentation fault (on Windows, this could manifest as undefined behavior) when trying to access members
+ inherited from T through a shared_ptr >.
+*/
+template class Printable : virtual public T {
+public:
+ Printable(int param);
+ ~Printable();
+
+ std::string GetFormatted();
+};
+
+std::shared_ptr > MakePrintableDerived(int param);
+
+
+%template(PrintableDerived) Printable;
+
+
diff --git a/Examples/test-suite/cpp_basic.i b/Examples/test-suite/cpp_basic.i
index d093e3a5f..1c1c9a902 100644
--- a/Examples/test-suite/cpp_basic.i
+++ b/Examples/test-suite/cpp_basic.i
@@ -1,4 +1,4 @@
-/* This is a basic test of proxy classes, used by chicken */
+/* This is a basic test of proxy classes */
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */
diff --git a/Examples/test-suite/cpp_parameters.i b/Examples/test-suite/cpp_parameters.i
new file mode 100644
index 000000000..e8a4c94fd
--- /dev/null
+++ b/Examples/test-suite/cpp_parameters.i
@@ -0,0 +1,46 @@
+%module cpp_parameters
+
+%{
+// For Perl
+#ifdef Zero
+#undef Zero
+#endif
+%}
+%inline %{
+
+// Zero arguments
+struct Zero {
+ Zero() {}
+ int zero() { return 0; }
+ static int stat_zero() { return 0; }
+};
+// One mandatory argument
+struct One {
+ One(int a) {}
+ int one(int a) { return a; }
+ static int stat_one(int a) { return a; }
+};
+// Two mandatory arguments
+struct Two {
+ Two(int a, int b) {}
+ int two(int a, int b) { return a + b; }
+ static int stat_two(int a, int b) { return a + b; }
+};
+// Single optional argument
+struct Single {
+ Single(int a=0) {}
+ int single(int a=0) { return a; }
+ static int stat_single(int a=0) { return a; }
+};
+
+int global_zero() { return 0; }
+int global_one(int a) { return a; }
+int global_two(int a, int b) { return a + b; }
+int global_single(int a=0) { return a; }
+
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+%}
diff --git a/Examples/test-suite/cpp_typedef.i b/Examples/test-suite/cpp_typedef.i
index b782a3bd3..d77485c77 100644
--- a/Examples/test-suite/cpp_typedef.i
+++ b/Examples/test-suite/cpp_typedef.i
@@ -3,6 +3,9 @@
%module cpp_typedef
%{
+#if defined(_MSC_VER)
+ #pragma warning( disable : 5208) // warning C5208: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes
+#endif
class Bar {
public:
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index 8272864d5..02dcaafb0 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -16,6 +16,7 @@ CPP_TEST_CASES = \
complextest \
csharp_attributes \
csharp_swig2_compatibility \
+ csharp_director_typemaps \
csharp_exceptions \
csharp_features \
csharp_lib_arrays \
@@ -27,6 +28,7 @@ CPP_TEST_CASES = \
enum_thorough_typesafe \
exception_partial_info \
intermediary_classname \
+ nested_scope \
li_boost_intrusive_ptr \
li_std_list \
@@ -34,6 +36,7 @@ CPP11_TEST_CASES = \
cpp11_shared_ptr_const \
cpp11_shared_ptr_nullptr_in_containers \
cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_template_upcast \
cpp11_shared_ptr_upcast \
cpp11_strongly_typed_enumerations_simple \
diff --git a/Examples/test-suite/csharp/cpp11_shared_ptr_template_upcast_runme.cs b/Examples/test-suite/csharp/cpp11_shared_ptr_template_upcast_runme.cs
new file mode 100644
index 000000000..e76d2bada
--- /dev/null
+++ b/Examples/test-suite/csharp/cpp11_shared_ptr_template_upcast_runme.cs
@@ -0,0 +1,15 @@
+// This is the cpp11_shared_ptr_template_upcast runtime testcase. It checks that SWIG generates the appropriate upcasted shared_ptr type for a template instantiation deriving from a base class.
+// For this case, the expected behavior is: given a cptr with underlying type shared_ptr >, PrintableDerived_SWIGSmartPtrUpcast returns a cptr with
+// underlying type std::shared_ptr< Derived >, where Printable inherits from Derived.
+using System;
+using cpp11_shared_ptr_template_upcastNamespace;
+
+public class cpp11_shared_ptr_template_upcast_runme
+{
+ static void Main()
+ {
+ PrintableDerived pd = cpp11_shared_ptr_template_upcast.MakePrintableDerived(20);
+ pd.GetResult();
+ pd.GetFormatted();
+ }
+}
diff --git a/Examples/test-suite/csharp/csharp_director_typemaps_runme.cs b/Examples/test-suite/csharp/csharp_director_typemaps_runme.cs
new file mode 100644
index 000000000..6143332db
--- /dev/null
+++ b/Examples/test-suite/csharp/csharp_director_typemaps_runme.cs
@@ -0,0 +1,53 @@
+
+using System;
+using System.Reflection;
+using csharp_director_typemapsNamespace;
+
+public class csharp_director_typemaps_runme {
+
+ class CSharpDirectorTypemaps_InStreamDerived : InStream
+ {
+ private int constant;
+ public CSharpDirectorTypemaps_InStreamDerived(int constant) { this.constant = constant; }
+ public override int Read(global::System.IntPtr buf, int len, out int readLen) {
+ readLen = (buf == global::System.IntPtr.Zero) ? -len - constant : len + constant;
+ return readLen;
+ }
+ public override int Write(global::System.IntPtr buf, int len, out int writeLen) {
+ writeLen = (buf == global::System.IntPtr.Zero) ? -len - constant : len + constant;
+ return writeLen;
+ }
+ }
+ public static void Main() {
+ int outLen = -1;
+ int k = 100;
+ int j = 23;
+ InStream instream = new CSharpDirectorTypemaps_InStreamDerived(k);
+
+ {
+ int ret = csharp_director_typemaps.callRead(instream, InStream.getCPtr(instream).Handle, j, out outLen);
+ Assert(outLen, j + k);
+ Assert(ret, j + k);
+ }
+ {
+ int ret = csharp_director_typemaps.callRead(instream, global::System.IntPtr.Zero, j, out outLen);
+ Assert(outLen, -j - k);
+ Assert(ret, -j - k);
+ }
+
+ {
+ int ret = csharp_director_typemaps.callWrite(instream, InStream.getCPtr(instream).Handle, j, out outLen);
+ Assert(outLen, j + k);
+ Assert(ret, j + k);
+ }
+ {
+ int ret = csharp_director_typemaps.callWrite(instream, global::System.IntPtr.Zero, j, out outLen);
+ Assert(outLen, -j - k);
+ Assert(ret, -j - k);
+ }
+ }
+ private static void Assert(int i1, int i2) {
+ if (i1 != i2)
+ throw new Exception("assertion failure. " + i1 + " != " + i2);
+ }
+}
diff --git a/Examples/test-suite/csharp/director_void_runme.cs b/Examples/test-suite/csharp/director_void_runme.cs
index 24b470f11..ef440a76a 100644
--- a/Examples/test-suite/csharp/director_void_runme.cs
+++ b/Examples/test-suite/csharp/director_void_runme.cs
@@ -67,6 +67,12 @@ public class runme
if (x != 1334)
throw new Exception("Bad4 should be 1334, got " + x);
}
+ {
+ MemberVoid mv = new MemberVoid();
+ global::System.IntPtr zero = global::System.IntPtr.Zero;
+ mv.memberVariable = zero;
+ zero = mv.memberVariable;
+ }
}
}
diff --git a/Examples/test-suite/csharp/li_std_wstring_runme.cs b/Examples/test-suite/csharp/li_std_wstring_runme.cs
index ab013f923..d2927287f 100644
--- a/Examples/test-suite/csharp/li_std_wstring_runme.cs
+++ b/Examples/test-suite/csharp/li_std_wstring_runme.cs
@@ -75,6 +75,13 @@ public class runme
check_equal(li_std_wstring.test_ccvalue(x), "abc");
check_equal(li_std_wstring.test_wchar_overload(x), "abc");
+ // Member variables
+ var s = new wchar_test_struct();
+ s.wchar_t_member = h;
+ check_equal(s.wchar_t_member, h);
+ s.wchar_t_ptr_member = x;
+ check_equal(s.wchar_t_ptr_member, "abc");
+
{
// Unicode strings
string[] test_strings = {
@@ -99,7 +106,17 @@ public class runme
check_equal(received, expected);
}
- /* Not working on Windows okay on Linux
+ foreach (string expected in test_strings)
+ {
+ s.wchar_t_ptr_member = expected;
+ string received = s.wchar_t_ptr_member;
+ check_equal(received, expected);
+ }
+
+ /* Not working for Japanese and Russian characters on Windows, okay on Linux
+ * Is fixed by adding CharSet=CharSet.Unicode to the DllImport, so change to:
+ * [global::System.Runtime.InteropServices.DllImport("li_std_wstring", CharSet=global::System.Runtime.InteropServices.CharSet.Unicode, EntryPoint="CSharp_li_std_wstringNamespace_test_wcvalue")]
+ * Needs a SWIG code change to support this
foreach (string test_string in test_strings)
{
foreach (char expected in test_string)
diff --git a/Examples/test-suite/csharp/multiple_inheritance_abstract_runme.cs b/Examples/test-suite/csharp/multiple_inheritance_abstract_runme.cs
index 4584be399..512fbf2db 100644
--- a/Examples/test-suite/csharp/multiple_inheritance_abstract_runme.cs
+++ b/Examples/test-suite/csharp/multiple_inheritance_abstract_runme.cs
@@ -216,6 +216,7 @@ public class multiple_inheritance_abstract_runme {
check(multiple_inheritance_abstract.InputCPtrRefBottom1(b1)!=103+104, "InputCPtrRefBottom1() failed");
check(multiple_inheritance_abstract.InputCPtrRefBottom2(b2)!=206+205, "InputCPtrRefBottom2() failed");
check(multiple_inheritance_abstract.InputCPtrRefBottom3(b3)!=307+308+309, "InputCPtrRefBottom3() failed");
+
// Return pointers
check(multiple_inheritance_abstract.MakePtrDerived1_CBase1().cbase1y()!=3, "MakePtrDerived1_CBase1 failed");
check(multiple_inheritance_abstract.MakePtrDerived1_CBase2().cbase2()!=4, "MakePtrDerived1_CBase2 failed");
@@ -234,6 +235,15 @@ public class multiple_inheritance_abstract_runme {
check(multiple_inheritance_abstract.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_abstract.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_abstract.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_abstract.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/csharp/multiple_inheritance_nspace_runme.cs b/Examples/test-suite/csharp/multiple_inheritance_nspace_runme.cs
index 6ed13a6ff..c2792517d 100644
--- a/Examples/test-suite/csharp/multiple_inheritance_nspace_runme.cs
+++ b/Examples/test-suite/csharp/multiple_inheritance_nspace_runme.cs
@@ -217,6 +217,7 @@ public class multiple_inheritance_nspace_runme {
check(multiple_inheritance_nspace.InputCPtrRefBottom1(b1)!=103+104, "InputCPtrRefBottom1() failed");
check(multiple_inheritance_nspace.InputCPtrRefBottom2(b2)!=206+205, "InputCPtrRefBottom2() failed");
check(multiple_inheritance_nspace.InputCPtrRefBottom3(b3)!=307+308+309, "InputCPtrRefBottom3() failed");
+
// Return pointers
check(multiple_inheritance_nspace.MakePtrDerived1_CBase1().cbase1y()!=3, "MakePtrDerived1_CBase1 failed");
check(multiple_inheritance_nspace.MakePtrDerived1_CBase2().cbase2()!=4, "MakePtrDerived1_CBase2 failed");
@@ -235,6 +236,15 @@ public class multiple_inheritance_nspace_runme {
check(multiple_inheritance_nspace.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_nspace.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_nspace.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_nspace.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/csharp/multiple_inheritance_shared_ptr_runme.cs b/Examples/test-suite/csharp/multiple_inheritance_shared_ptr_runme.cs
index 13ffc62a4..fc2263ef5 100644
--- a/Examples/test-suite/csharp/multiple_inheritance_shared_ptr_runme.cs
+++ b/Examples/test-suite/csharp/multiple_inheritance_shared_ptr_runme.cs
@@ -301,6 +301,15 @@ public class multiple_inheritance_shared_ptr_runme {
check(multiple_inheritance_shared_ptr.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_shared_ptr.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_shared_ptr.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_shared_ptr.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/csharp/template_nested_flat_runme.cs b/Examples/test-suite/csharp/template_nested_flat_runme.cs
new file mode 100644
index 000000000..afdbe5ff6
--- /dev/null
+++ b/Examples/test-suite/csharp/template_nested_flat_runme.cs
@@ -0,0 +1,25 @@
+using System;
+using template_nested_flatNamespace;
+#pragma warning disable 219
+
+public class runme {
+ static void Main() {
+ new T_NormalTemplateNormalClass().tmethod(new NormalClass());
+ new OuterClass().T_OuterTMethodNormalClass(new NormalClass());
+
+ TemplateFuncs tf = new TemplateFuncs();
+ if (tf.T_TemplateFuncs1Int(-10) != -10)
+ throw new Exception("it failed");
+ if (tf.T_TemplateFuncs2Double(-12.3) != -12.3)
+ throw new Exception("it failed");
+
+ T_NestedOuterTemplateDouble tn = new T_NestedOuterTemplateDouble();
+ if (tn.hohum(-12.3) != -12.3)
+ throw new Exception("it failed");
+ T_OuterClassInner1Int inner1 = new OuterClass().useInner1(new T_OuterClassInner1Int());
+ T_OuterClassInner2NormalClass inner2 = new T_OuterClassInner2NormalClass();
+ inner2.embeddedVar = 2;
+ T_OuterClassInner2NormalClass inner22 = new OuterClass().useInner2Again(inner2);
+ }
+}
+
diff --git a/Examples/test-suite/csharp_director_typemaps.i b/Examples/test-suite/csharp_director_typemaps.i
new file mode 100644
index 000000000..614bdbf23
--- /dev/null
+++ b/Examples/test-suite/csharp_director_typemaps.i
@@ -0,0 +1,37 @@
+%module (directors="1") csharp_director_typemaps
+
+// This tests that the csout typemap is handled correctly in the director code.
+// The 'out' needs stripping in some parts of the generated director code.
+
+%feature("director") InStream;
+
+%apply void *VOID_INT_PTR { void * }
+
+%typemap(ctype) int* readLen, int* writeLen "/*ctype*/ int*"
+%typemap(imtype) int* readLen, int* writeLen "/*imtype*/ out int"
+%typemap(cstype) int* readLen "/*cstype*/ out int"
+// Note for below: 'out' used in typemap comment
+%typemap(cstype) int* writeLen "/*out cstype out*/ out int"
+%typemap(csin) int* readLen, int* writeLen "/*csin*/ out $csinput"
+%typemap(in) int* readLen, int* writeLen %{/*in*/ $1 = ($1_ltype)$input; %}
+%typemap(out) int* readLen, int* writeLen %{/*out*/ $result = (void *)$1; %}
+%typemap(csdirectorin) int* readLen, int* writeLen "/*csdirectorin*/ out $iminput"
+%typemap(csdirectorout) int* readLen, int* writeLen "/*csdirectorout*/ $cscall"
+%typemap(directorin) int* readLen, int* writeLen "/*directorin*/ $input = $1;"
+%typemap(directorout) int* readLen, int* writeLen %{/*directorout*/ $result = ($1_ltype)$input; %}
+
+%inline %{
+class InStream
+{
+public:
+ virtual int Read(void* buf, int len, int* readLen) = 0;
+ virtual int Write(void* buf, int len, int* writeLen) = 0;
+ virtual ~InStream() {}
+};
+int callRead(InStream* stream, void* buf, int len, int* readLen) {
+ return stream->Read(buf, len, readLen);
+}
+int callWrite(InStream* stream, void* buf, int len, int* writeLen) {
+ return stream->Write(buf, len, writeLen);
+}
+%}
diff --git a/Examples/test-suite/director_basic.i b/Examples/test-suite/director_basic.i
index 07d627589..23d910324 100644
--- a/Examples/test-suite/director_basic.i
+++ b/Examples/test-suite/director_basic.i
@@ -5,6 +5,7 @@
#endif
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) MyClass::pmethod;
+%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) ConstPtrClass::getConstPtr;
%{
#include
@@ -174,7 +175,19 @@ public:
}
};
-
-%}
+ %}
%template(MyClassT_i) MyClassT;
+
+ %feature("director") ConstPtrClass;
+
+ %inline %{
+
+class ConstPtrClass {
+public:
+ virtual ~ConstPtrClass() {}
+ virtual int *const getConstPtr() = 0;
+};
+
+ %}
+
diff --git a/Examples/test-suite/director_comparison_operators.i b/Examples/test-suite/director_comparison_operators.i
new file mode 100644
index 000000000..f2251ed6d
--- /dev/null
+++ b/Examples/test-suite/director_comparison_operators.i
@@ -0,0 +1,23 @@
+%module(directors="1") director_comparison_operators
+
+%include "std_string.i"
+%feature("director");
+
+#if !defined(SWIGLUA) && !defined(SWIGR)
+%rename(EqualEqual) operator ==;
+%rename(NotEqual) operator !=;
+%rename(LessThanEqual) operator <=;
+%rename(GreaterThanEqual) operator >=;
+#endif
+
+%inline %{
+class Foo {
+public:
+ virtual ~Foo() { }
+ virtual bool operator==(const Foo&) const = 0;
+ virtual bool operator>=(const Foo&) const = 0;
+ virtual bool operator<=(const Foo&) const = 0;
+ virtual bool operator!=(const Foo&) const = 0;
+ virtual std::string test(const char *foo="a=1,b=2") { return foo; }
+};
+%}
diff --git a/Examples/test-suite/director_conversion_operators.i b/Examples/test-suite/director_conversion_operators.i
new file mode 100644
index 000000000..afcd49d3f
--- /dev/null
+++ b/Examples/test-suite/director_conversion_operators.i
@@ -0,0 +1,35 @@
+%module(directors="1") director_conversion_operators
+
+%feature("director");
+
+%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) Bar;
+
+%rename(toFoo) Bar::operator Foo();
+%rename(toFooPtr) Bar::operator Foo *();
+%rename(toFooRef) Bar::operator Foo &();
+%rename(toFooPtrRef) Bar::operator Foo *&();
+
+%rename(toOtherFoo) Bar::operator OtherFoo();
+%rename(toOtherFooPtr) Bar::operator OtherFoo *();
+%rename(toOtherFooRef) Bar::operator OtherFoo &();
+%rename(toOtherFooPtrRef) Bar::operator OtherFoo *&();
+
+%inline %{
+ struct Foo {
+ };
+ struct OtherFoo {
+ };
+ struct Bar {
+ Foo myFoo;
+ Foo *myFooPtr;
+ virtual ~Bar() { }
+ virtual operator Foo () { return Foo(); }
+ virtual operator Foo *() { return &myFoo; }
+ virtual operator Foo &() { return myFoo; }
+ virtual operator Foo *&() { return myFooPtr; }
+ virtual operator OtherFoo () = 0;
+ virtual operator OtherFoo *() = 0;
+ virtual operator OtherFoo &() = 0;
+ virtual operator OtherFoo *&() = 0;
+ };
+%}
diff --git a/Examples/test-suite/director_exception.i b/Examples/test-suite/director_exception.i
index 71366bef0..9ff7f3842 100644
--- a/Examples/test-suite/director_exception.i
+++ b/Examples/test-suite/director_exception.i
@@ -18,22 +18,7 @@ namespace Swig {
%include "std_string.i"
-#ifdef SWIGPHP
-
-%feature("director:except") {
- if ($error == FAILURE) {
- Swig::DirectorMethodException::raise("$symname");
- }
-}
-
-%exception {
- try { $action }
- catch (Swig::DirectorException &) { SWIG_fail; }
-}
-
-#endif
-
-#ifdef SWIGPYTHON
+#if defined SWIGPHP || defined SWIGPYTHON
%feature("director:except") {
if ($error != NULL) {
diff --git a/Examples/test-suite/director_nspace.i b/Examples/test-suite/director_nspace.i
index f24227c68..016f61ddf 100644
--- a/Examples/test-suite/director_nspace.i
+++ b/Examples/test-suite/director_nspace.i
@@ -15,7 +15,6 @@ namespace TopLevel
class FooBar {
public:
FooBar() {}
- FooBar(const FooBar&) {}
virtual ~FooBar() {}
std::string FooBarDo() { return "Bar::Foo2::Foo2Bar()"; }
@@ -56,7 +55,6 @@ namespace TopLevel
class FooBar {
public:
FooBar();
- FooBar(const FooBar&);
virtual ~FooBar();
std::string FooBarDo();
diff --git a/Examples/test-suite/director_overload.i b/Examples/test-suite/director_overload.i
index 604ffe5ca..d6feb122b 100644
--- a/Examples/test-suite/director_overload.i
+++ b/Examples/test-suite/director_overload.i
@@ -47,5 +47,14 @@ public:
virtual void notover(int *p) const {}
};
-%}
+class OverloadedGetSet
+{
+ int v;
+public:
+ OverloadedGetSet() : v(42) { }
+ virtual ~OverloadedGetSet() { }
+ virtual int rw() const { return v; }
+ virtual void rw(int new_v) { v = new_v; }
+};
+%}
diff --git a/Examples/test-suite/director_overload2.i b/Examples/test-suite/director_overload2.i
index e467c18ce..ddfa65bb4 100644
--- a/Examples/test-suite/director_overload2.i
+++ b/Examples/test-suite/director_overload2.i
@@ -14,11 +14,15 @@ struct OverloadDerived1 : OverloadBase {
virtual void nnn(int vvv) {}
#if defined(__SUNPRO_CC)
virtual void nnn() {}
+#elif defined(SWIGPHP) // FIXME: Hack to stop director_overload2 failing for PHP8
+ virtual void nnn() {}
#endif
};
struct OverloadDerived2 : OverloadBase {
#if defined(__SUNPRO_CC)
virtual void nnn(int vvv) {}
+#elif defined(SWIGPHP) // FIXME: Hack to stop director_overload2 failing for PHP8
+ virtual void nnn(int vvv) {}
#endif
virtual void nnn() {}
};
diff --git a/Examples/test-suite/director_protected.i b/Examples/test-suite/director_protected.i
index 0299b238d..122addb70 100644
--- a/Examples/test-suite/director_protected.i
+++ b/Examples/test-suite/director_protected.i
@@ -11,13 +11,6 @@
%newobject *::create();
-#ifdef SWIGPHP
-// TODO: Currently we do not track the dynamic type of returned objects
-// in PHP, so we need the factory helper.
-%include factory.i
-%factory(Foo *Bar::create, Bar);
-#endif
-
%rename(a) Bar::hello;
%rename(s) Foo::p;
%rename(q) Foo::r;
diff --git a/Examples/test-suite/director_stl.i b/Examples/test-suite/director_stl.i
index 46946e513..cbcb4ba85 100644
--- a/Examples/test-suite/director_stl.i
+++ b/Examples/test-suite/director_stl.i
@@ -17,11 +17,7 @@
%feature("director") Foo;
%feature("director:except") {
-#ifndef SWIGPHP
if ($error != NULL) {
-#else
- if ($error == FAILURE) {
-#endif
throw Swig::DirectorMethodException();
}
}
diff --git a/Examples/test-suite/director_void.i b/Examples/test-suite/director_void.i
index 40f53b6e2..d9d99aaac 100644
--- a/Examples/test-suite/director_void.i
+++ b/Examples/test-suite/director_void.i
@@ -43,5 +43,9 @@ struct Caller {
return *(int *)p;
}
};
+
+struct MemberVoid {
+ void *memberVariable;
+};
%}
diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i
index da4d80909..4e543fef9 100644
--- a/Examples/test-suite/doxygen_basic_translate.i
+++ b/Examples/test-suite/doxygen_basic_translate.i
@@ -107,6 +107,23 @@ double Atan2(double y, double x)
return 0;
}
+/* Regression test for crash with empty comment: */
+/**/
+
+/**
+ * @brief Test variadic function
+ * @param ... extra args
+ */
+void function8(...) {
+}
+
+/**
+ * @brief Test unnamed argument
+ * @param baz Description of baz
+ */
+void function9(int) {
+}
+
/**
* Comment at the end of file should be ignored.
*/
diff --git a/Examples/test-suite/doxygen_basic_translate_style3.i b/Examples/test-suite/doxygen_basic_translate_style3.i
new file mode 100644
index 000000000..e364b164f
--- /dev/null
+++ b/Examples/test-suite/doxygen_basic_translate_style3.i
@@ -0,0 +1,102 @@
+%module doxygen_basic_translate_style3
+
+%include "doxygen_basic_translate.h"
+
+%inline %{
+
+/// \brief
+/// Brief description.
+///
+/// The comment text.
+///
+/// \author Some author
+///
+/// \return Some number
+///
+/// \sa function2
+int function()
+{
+ return 0;
+}
+
+/// A test of a very very very very very very very very very very very very very very very very
+/// very very very very very long comment string.
+void function2()
+{
+}
+
+/// A test for overloaded functions
+/// This is function \b one
+void function3(int a)
+{
+}
+
+/// A test for overloaded functions
+/// This is function \b two
+void function3(int a, int b)
+{
+}
+
+/// A test of some mixed tag usage
+/// \if CONDITION
+/// This \a code fragment shows us something \.
+/// \par Minuses:
+/// \arg it's senseless
+/// \arg it's stupid
+/// \arg it's null
+///
+/// \warning This may not work as expected
+/// \code
+/// int main() { while(true); }
+///
+/// int testBlankLine() {}
+/// \endcode
+/// \endif
+void function4()
+{
+ // Note: a comment in the above code block will not get processed
+ // correctly with this doxygen comment style, because
+ // DoxygenParser::tokenizeDoxygenComment strips out the leading
+ // comment characters. Whereas it works in the other doxygen
+ // comment styles (as shown in the other variations of
+ // doxygen_basic_translate), this test is modified to remove the
+ // comment within the code block.
+}
+
+
+void function5(int a)
+{
+}
+///< This is a post comment.
+
+/// Test for default args
+/// @param a Some parameter, default is 42
+void function6(int a=42)
+{
+}
+
+class Shape
+{
+public:
+ typedef Shape* superType;
+};
+
+/// Test for a parameter with difficult type
+/// (mostly for python)
+/// @param a Very strange param
+void function7(Shape::superType *a[10])
+{
+}
+
+/// Multiple parameters test.
+///
+/// @param y Vertical coordinate.
+/// @param x Horizontal coordinate.
+/// @return Arc tangent of @c y/x.
+double Atan2(double y, double x)
+{
+ return 0;
+}
+
+/// Comment at the end of file should be ignored.
+%}
diff --git a/Examples/test-suite/doxygen_code_blocks.i b/Examples/test-suite/doxygen_code_blocks.i
new file mode 100644
index 000000000..900e8f9bb
--- /dev/null
+++ b/Examples/test-suite/doxygen_code_blocks.i
@@ -0,0 +1,62 @@
+%module doxygen_code_blocks
+
+// This test is only used with Python
+
+%inline %{
+
+/**
+ * \brief Test for code blocks
+ *
+ * \code
+ * simple code block
+ * \endcode
+ *
+ * More advanced usage with C++ characters:
+ * \code
+ * std::vector first; // empty vector of ints
+ * std::vector second (4,100); // four ints with value 100
+ * std::vector third (second.begin(),second.end()); // iterating through second
+ * std::vector fourth (third); // a copy of third
+ * // the iterator constructor can also be used to construct from arrays:
+ * int myints[] = {16,2,77,29};
+ * std::vector fifth (myints, myints + sizeof(myints) / sizeof(int) );
+ *
+ * std::cout << "The contents of fifth are:";
+ * for (std::vector::iterator it = fifth.begin(); it != fifth.end(); ++it)
+ * std::cout << ' ' << *it;
+ * std::cout << '\n';
+ * \endcode
+ *
+ * A code block for C:
+ * \code{.c}
+ * printf("hello world");
+ * \endcode
+ *
+ * A code block for Java:
+ * \code{.java}
+ * public class HelloWorld {
+ * public static void main(String[] args) {
+ * // Prints "Hello, World" to the terminal window.
+ * System.out.println("Hello, World");
+ * }
+ * }
+ * \endcode
+ *
+ * A code block for python:
+ * \code{.py}
+ * print('hello world')
+ * \endcode
+ *
+ * A python doctest example:
+ * \code{.py}
+ * >>> 1 + 1
+ * 2
+ * \endcode
+ */
+int function()
+{
+ return 0;
+}
+
+
+%}
diff --git a/Examples/test-suite/doxygen_misc_constructs.h b/Examples/test-suite/doxygen_misc_constructs.h
index d677dc3d3..9e81aaf28 100644
--- a/Examples/test-suite/doxygen_misc_constructs.h
+++ b/Examples/test-suite/doxygen_misc_constructs.h
@@ -91,4 +91,12 @@ void backslashC()
void cycle(int id, char *fileName)
{}
+/// This doc comment ends with a quote: "and that's ok"
+void doc_ends_with_quote() {}
+/**
+ This comment contains embedded triple-quoted string:
+
+ """How quaint"""
+ */
+void doc_with_triple_quotes() {}
diff --git a/Examples/test-suite/doxygen_misc_constructs.i b/Examples/test-suite/doxygen_misc_constructs.i
index c1b3eea31..9cf95de39 100644
--- a/Examples/test-suite/doxygen_misc_constructs.i
+++ b/Examples/test-suite/doxygen_misc_constructs.i
@@ -36,7 +36,7 @@
* @param line line number
* @param isGetSize if set, for every object location both address and size are returned
*
- * @link Connection::getId() @endlink
+ * @link Connection::getId() @endlink
*/
void getAddress(int &fileName,
int line,
@@ -62,7 +62,7 @@
* used for unspecified parameters.
*
*
- * @link advancedWinIDEALaunching.py Python example.@endlink
+ * @link advancedWinIDEALaunching.py Python example.@endlink
*/
class CConnectionConfig
{
diff --git a/Examples/test-suite/doxygen_parsing.i b/Examples/test-suite/doxygen_parsing.i
index 40f37a4c2..3a559053d 100644
--- a/Examples/test-suite/doxygen_parsing.i
+++ b/Examples/test-suite/doxygen_parsing.i
@@ -29,6 +29,7 @@ enum SomeEnum
*/
struct SomeStruct
{
+ int width; ///< \**immutable** image width in pixels
};
/**
diff --git a/Examples/test-suite/doxygen_translate_all_tags.i b/Examples/test-suite/doxygen_translate_all_tags.i
index 8da683d52..b54203d0a 100644
--- a/Examples/test-suite/doxygen_translate_all_tags.i
+++ b/Examples/test-suite/doxygen_translate_all_tags.i
@@ -210,7 +210,7 @@ void func05(int a)
*
* \line example
*
- * \link someMember Some description follows \endlink
+ * \link someMember Some description follows\endlink with text after
*
* \mainpage Some title
*
@@ -262,6 +262,9 @@ void func06(int a)
* \paragraph someParagraph Paragraph title
*
* \param a the first param
+ * \param[in] b parameter with intent(in)
+ * \param[out] c parameter with intent(out)
+ * \param[in,out] d parameter with intent(in,out)
*
* \post Some description
*
@@ -273,7 +276,7 @@ void func06(int a)
*
* \property someVar
*/
-void func07(int a)
+void func07(int a, int b, int c, int d)
{
}
diff --git a/Examples/test-suite/errors/Makefile.in b/Examples/test-suite/errors/Makefile.in
index 10e5bdd8f..7137a6862 100644
--- a/Examples/test-suite/errors/Makefile.in
+++ b/Examples/test-suite/errors/Makefile.in
@@ -45,6 +45,11 @@ include $(srcdir)/../common.mk
# whatever we do here.
$(DOXYGEN_ERROR_TEST_CASES): SWIGOPT += -doxygen
+# Unique module names are obtained from the .i file name (required for parallel make).
+# Note: -module overrides %module in the .i file.
+MODULE_OPTION=-module $*
+nomodule.ctest: MODULE_OPTION =
+
# Portable dos2unix / todos for stripping CR
TODOS = tr -d '\r'
#TODOS = sed -e 's/\r$$//' # On Mac OS X behaves as if written 's/r$$//'
@@ -55,12 +60,12 @@ STRIP_SRCDIR = sed -e 's|\\|/|g' -e 's|^$(SRCDIR)||'
# Rules for the different types of tests
%.cpptest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ -$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.ctest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIGINVOKE) -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ -$(SWIGINVOKE) -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.clean:
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.i b/Examples/test-suite/errors/cpp_extra_brackets.i
index 32cf7f72d..81fdb29c4 100644
--- a/Examples/test-suite/errors/cpp_extra_brackets.i
+++ b/Examples/test-suite/errors/cpp_extra_brackets.i
@@ -1,4 +1,4 @@
-%module cpp_extra_brackets
+%module xxx
// Extra brackets was segfaulting in SWIG-3.0.0
struct ABC {
diff --git a/Examples/test-suite/errors/cpp_extra_brackets2.i b/Examples/test-suite/errors/cpp_extra_brackets2.i
index 17a5d5918..194dea435 100644
--- a/Examples/test-suite/errors/cpp_extra_brackets2.i
+++ b/Examples/test-suite/errors/cpp_extra_brackets2.i
@@ -1,4 +1,4 @@
-%module cpp_extra_brackets
+%module xxx
// Extra brackets was segfaulting in SWIG-3.0.0
struct ABC {
diff --git a/Examples/test-suite/errors/cpp_invalid_qualifiers.i b/Examples/test-suite/errors/cpp_invalid_qualifiers.i
index fd3b36332..d0723dff6 100644
--- a/Examples/test-suite/errors/cpp_invalid_qualifiers.i
+++ b/Examples/test-suite/errors/cpp_invalid_qualifiers.i
@@ -1,4 +1,4 @@
-%module cpp_invalid_qualifiers
+%module xxx
// Constructors, destructors and static methods cannot have qualifiers
struct A {
diff --git a/Examples/test-suite/errors/cpp_invalid_template.i b/Examples/test-suite/errors/cpp_invalid_template.i
index ea0d7beac..45ad73908 100644
--- a/Examples/test-suite/errors/cpp_invalid_template.i
+++ b/Examples/test-suite/errors/cpp_invalid_template.i
@@ -1,4 +1,4 @@
-%module cpp_invalid_scope
+%module xxx
%template(abc) SSS::AAA;
diff --git a/Examples/test-suite/errors/cpp_namespace_template_bad.i b/Examples/test-suite/errors/cpp_namespace_template_bad.i
index 5c42d6dcb..f41918f8e 100644
--- a/Examples/test-suite/errors/cpp_namespace_template_bad.i
+++ b/Examples/test-suite/errors/cpp_namespace_template_bad.i
@@ -1,4 +1,4 @@
-%module namespace_template
+%module xxx
namespace test {
template T max(T a, T b) { return (a > b) ? a : b; }
diff --git a/Examples/test-suite/errors/cpp_nested_namespace_alias.i b/Examples/test-suite/errors/cpp_nested_namespace_alias.i
index b7cbceb71..058d34441 100644
--- a/Examples/test-suite/errors/cpp_nested_namespace_alias.i
+++ b/Examples/test-suite/errors/cpp_nested_namespace_alias.i
@@ -1,4 +1,4 @@
-%module cpp_nested_namespace_alias
+%module xxx
// C++17 nested namespaces
diff --git a/Examples/test-suite/errors/cpp_recursive_typedef.i b/Examples/test-suite/errors/cpp_recursive_typedef.i
index 3d65a8817..82d9f7a4a 100644
--- a/Examples/test-suite/errors/cpp_recursive_typedef.i
+++ b/Examples/test-suite/errors/cpp_recursive_typedef.i
@@ -1,4 +1,4 @@
-%module cpp_recursive_typedef
+%module xxx
typedef std::set pds;
diff --git a/Examples/test-suite/errors/cpp_refqualifier.i b/Examples/test-suite/errors/cpp_refqualifier.i
index afd6632fc..3980a812c 100644
--- a/Examples/test-suite/errors/cpp_refqualifier.i
+++ b/Examples/test-suite/errors/cpp_refqualifier.i
@@ -1,4 +1,4 @@
-%module cpp_refqualifier
+%module xxx
%ignore Host::h_ignored;
%ignore Host::i_ignored() &&;
diff --git a/Examples/test-suite/errors/cpp_shared_ptr.i b/Examples/test-suite/errors/cpp_shared_ptr.i
index edbd0cf87..bdcd30f71 100644
--- a/Examples/test-suite/errors/cpp_shared_ptr.i
+++ b/Examples/test-suite/errors/cpp_shared_ptr.i
@@ -1,4 +1,4 @@
-%module cpp_shared_ptr
+%module xxx
%include
diff --git a/Examples/test-suite/errors/cpp_template_duplicate_names.i b/Examples/test-suite/errors/cpp_template_duplicate_names.i
index 67f21d7bb..96076967b 100644
--- a/Examples/test-suite/errors/cpp_template_duplicate_names.i
+++ b/Examples/test-suite/errors/cpp_template_duplicate_names.i
@@ -1,4 +1,4 @@
-%module cpp_template_duplicate_names
+%module xxx
// From test-suite/template_class_reuse.i test
diff --git a/Examples/test-suite/errors/cpp_template_friend.i b/Examples/test-suite/errors/cpp_template_friend.i
index c9d1c9d5d..3b8d85eff 100644
--- a/Examples/test-suite/errors/cpp_template_friend.i
+++ b/Examples/test-suite/errors/cpp_template_friend.i
@@ -1,4 +1,4 @@
-%module cpp_template_friend
+%module xxx
template T template_friend1(T);
template T template_friend1(T);
diff --git a/Examples/test-suite/errors/pp_missing_file.i b/Examples/test-suite/errors/pp_missing_file.i
index 5e3f0ea27..366f159cc 100644
--- a/Examples/test-suite/errors/pp_missing_file.i
+++ b/Examples/test-suite/errors/pp_missing_file.i
@@ -1,3 +1,3 @@
-%module test
+%module xxx
%include "missing_filename.i"
diff --git a/Examples/test-suite/errors/swig_typemap_old.stderr b/Examples/test-suite/errors/swig_typemap_old.stderr
index 23741164e..91bf1151d 100644
--- a/Examples/test-suite/errors/swig_typemap_old.stderr
+++ b/Examples/test-suite/errors/swig_typemap_old.stderr
@@ -1,5 +1,5 @@
-swig_typemap_old.i:6: Warning 450: Deprecated typemap feature ($source/$target).
-swig_typemap_old.i:6: Warning 450: The use of $source and $target in a typemap declaration is deprecated.
+swig_typemap_old.i:6: Error: Obsolete typemap feature ($source/$target).
+swig_typemap_old.i:6: Error: The use of $source and $target in a typemap declaration is no longer supported.
For typemaps related to argument input (in,ignore,default,arginit,check), replace
$source by $input and $target by $1. For typemaps related to return values (out,
argout,ret,except), replace $source by $1 and $target by $result. See the file
diff --git a/Examples/test-suite/exception_partial_info.i b/Examples/test-suite/exception_partial_info.i
index 3ac465cf6..0ff6abc26 100644
--- a/Examples/test-suite/exception_partial_info.i
+++ b/Examples/test-suite/exception_partial_info.i
@@ -30,8 +30,6 @@ class ex2 : public myException
#if !defined(SWIGUTL)
-#if !defined(SWIGCHICKEN)
-
%inline %{
class Impl
{
@@ -41,10 +39,6 @@ class Impl
};
%}
-#else
-#warning "Chicken needs fixing for partial exception information"
-#endif
-
#else
#warning "UTL needs fixing for partial exception information"
#endif
diff --git a/Examples/test-suite/global_immutable_vars.i b/Examples/test-suite/global_immutable_vars.i
new file mode 100644
index 000000000..ab0d4f7a8
--- /dev/null
+++ b/Examples/test-suite/global_immutable_vars.i
@@ -0,0 +1,33 @@
+%module global_immutable_vars
+
+// Test immutable and mutable global variables,
+// see http://www.swig.org/Doc4.0/SWIGDocumentation.html#SWIG_readonly_variables
+
+%inline %{
+ int default_mutable_var = 40;
+%}
+
+%immutable;
+%feature("immutable", "0") specific_mutable_var;
+
+%inline %{
+ int global_immutable_var = 41;
+ int specific_mutable_var = 42;
+%}
+
+%mutable;
+%immutable specific_immutable_var;
+%inline %{
+ int global_mutable_var = 43;
+ int specific_immutable_var = 44;
+
+ int check_values(int default_mutable, int global_immutable, int specific_mutable, int global_mutable, int specific_immutable) {
+ return
+ default_mutable == default_mutable_var &&
+ global_immutable == global_immutable_var &&
+ specific_mutable == specific_mutable_var &&
+ global_mutable == global_mutable_var &&
+ specific_immutable == specific_immutable_var;
+ }
+%}
+
diff --git a/Examples/test-suite/global_immutable_vars_cpp.i b/Examples/test-suite/global_immutable_vars_cpp.i
new file mode 100644
index 000000000..40cc08e54
--- /dev/null
+++ b/Examples/test-suite/global_immutable_vars_cpp.i
@@ -0,0 +1,33 @@
+%module global_immutable_vars_cpp
+
+// Test immutable and mutable global variables,
+// see http://www.swig.org/Doc4.0/SWIGDocumentation.html#SWIG_readonly_variables
+
+%inline %{
+ int default_mutable_var = 40;
+%}
+
+%immutable;
+%feature("immutable", "0") specific_mutable_var;
+
+%inline %{
+ int global_immutable_var = 41;
+ int specific_mutable_var = 42;
+%}
+
+%mutable;
+%immutable specific_immutable_var;
+%inline %{
+ int global_mutable_var = 43;
+ int specific_immutable_var = 44;
+
+ int check_values(int default_mutable, int global_immutable, int specific_mutable, int global_mutable, int specific_immutable) {
+ return
+ default_mutable == default_mutable_var &&
+ global_immutable == global_immutable_var &&
+ specific_mutable == specific_mutable_var &&
+ global_mutable == global_mutable_var &&
+ specific_immutable == specific_immutable_var;
+ }
+%}
+
diff --git a/Examples/test-suite/global_vars.i b/Examples/test-suite/global_vars.i
index d562d1eaa..46133fed9 100644
--- a/Examples/test-suite/global_vars.i
+++ b/Examples/test-suite/global_vars.i
@@ -33,4 +33,8 @@
b = "string b";
x = 1234;
}
+
+ int read_x() { return x; }
+
+ std::string read_b() { return b; }
%}
diff --git a/Examples/test-suite/go/Makefile.in b/Examples/test-suite/go/Makefile.in
index d07a56bec..75debc538 100644
--- a/Examples/test-suite/go/Makefile.in
+++ b/Examples/test-suite/go/Makefile.in
@@ -6,24 +6,10 @@ LANGUAGE = go
GO = @GO@
GOGCC = @GOGCC@
GCCGO = @GCCGO@
-GO1 = @GO1@
-GO12 = @GO12@
-GO13 = @GO13@
-GO15 = @GO15@
-GOC = @GOC@
GOVERSIONOPTION = @GOVERSIONOPTION@
host = @host@
SCRIPTSUFFIX = _runme.go
-GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1); then echo tool $(GOC:c=g); fi`
-GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
-GOTOOL = `if $(GO1) ; then echo go tool; fi`
-GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-
-GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
-
-OSXOLDGOLINKFLAGS = `if [ -n "\`$(GO) $(GOVERSIONOPTION) | grep -E 'go1($|.0|.1|.2|.3)'\`" ] && [ -n "\`echo $(host) | grep darwin\`" ]; then echo "-Wl,-U,__cgo_topofstack"; fi`
-
SO = @SO@
srcdir = @srcdir@
@@ -49,27 +35,11 @@ INCLUDES = -I$(abs_top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase_cpp)
- if ! $(GO15); then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
- TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
- $(LANGUAGE)$(VARIANT)_cpp_nocgo && \
- $(run_testcase_cpp); \
- fi
%.ctest:
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
- if ! $(GO15); then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CSRCS='$(CSRCS)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
- TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
- $(LANGUAGE)$(VARIANT)_nocgo && \
- $(run_testcase); \
- fi
%.multicpptest:
$(setup)
@@ -136,54 +106,66 @@ go_subdir_import.multicpptest:
# Runs the testcase.
run_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- fi && \
+ GOPATH=`pwd`/gopath/; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ mkdir gopath/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
+ cp gopath/src/$*/* gopath/src/swigtests/$*/; \
+ mkdir gopath/src/$*/runme 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
+ (cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
+ cp gopath/src/$*/runme/runme $*_runme; \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
run_testcase_cpp = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GOGCC) ; then \
- $(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a -lstdc++; \
- elif $(GO12) || $(GO13) || $(GO15); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- else \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
- fi && \
+ GOPATH=`pwd`/gopath/; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ mkdir gopath/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
+ cp gopath/src/$*/* gopath/src/swigtests/$*/; \
+ mkdir gopath/src/$*/runme 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
+ (cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
+ cp gopath/src/$*/runme/runme $*_runme; \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
run_multi_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- if $(GO15) || $(GOGCC); then \
- files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
- mkdir gopath/$*/src/$* 2>/dev/null || true; \
- cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
- GOPATH="`pwd`/gopath/$*"; \
- export GOPATH; \
- CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
- export CGO_CPPFLAGS; \
- CGO_CFLAGS="$(CFLAGS)"; \
- export CGO_CFLAGS; \
- CGO_CXXFLAGS="$(CXXFLAGS)"; \
- export CGO_CXXFLAGS; \
- CGO_LDFLAGS="$(LDFLAGS) -lm"; \
- export CGO_LDFLAGS; \
- (cd gopath/$*/src/$* && \
- $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
- fi; \
+ files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
+ mkdir gopath/$*/src/$* 2>/dev/null || true; \
+ cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
+ GOPATH="`pwd`/gopath/$*"; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ (cd gopath/$*/src/$* && \
+ $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
%.clean:
@@ -191,16 +173,17 @@ run_multi_testcase = \
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' go_clean
- rm -f mod_a.go mod_a.gox mod_b.go mod_b.gox
- rm -f imports_a.go imports_a.gox imports_b.go imports_b.gox
rm -f clientdata_prop_a.go clientdata_prop_a.gox
rm -f clientdata_prop_b.go clientdata_prop_b.gox
+ rm -f import_stl_a.go import_stl_a.gox
+ rm -f import_stl_b.go import_stl_b.gox
+ rm -f imports_a.go imports_a.gox imports_b.go imports_b.gox
+ rm -f mod_a.go mod_a.gox mod_b.go mod_b.gox
rm -f multi_import_a.go multi_import_a.gox
rm -f multi_import_b.go multi_import_b.gox
- rm -rf go_subdir_import_a.go go_subdir_import_a.gox testdir
rm -f packageoption_a.go packageoption_a.gox
rm -f packageoption_b.go packageoption_b.gox
rm -f packageoption_c.go packageoption_c.gox
- rm -f import_stl_a.go import_stl_a.gox
- rm -f import_stl_b.go import_stl_b.gox
+ rm -f template_typedef_cplx2.go template_typedef_cplx2.gox
+ rm -rf go_subdir_import_a.go go_subdir_import_a.gox testdir
rm -rf gopath
diff --git a/Examples/test-suite/go/abstract_access_runme.go b/Examples/test-suite/go/abstract_access_runme.go
index 5102236f9..0a0e56fef 100644
--- a/Examples/test-suite/go/abstract_access_runme.go
+++ b/Examples/test-suite/go/abstract_access_runme.go
@@ -1,6 +1,6 @@
package main
-import "abstract_access"
+import "swigtests/abstract_access"
func main() {
d := abstract_access.NewD()
diff --git a/Examples/test-suite/go/abstract_typedef2_runme.go b/Examples/test-suite/go/abstract_typedef2_runme.go
index 76a5fc8de..5e2ed1e7a 100644
--- a/Examples/test-suite/go/abstract_typedef2_runme.go
+++ b/Examples/test-suite/go/abstract_typedef2_runme.go
@@ -1,6 +1,6 @@
package main
-import "abstract_typedef2"
+import "swigtests/abstract_typedef2"
func main() {
abstract_typedef2.NewA_UF()
diff --git a/Examples/test-suite/go/abstract_typedef_runme.go b/Examples/test-suite/go/abstract_typedef_runme.go
index 56aaa613f..1ad49f59d 100644
--- a/Examples/test-suite/go/abstract_typedef_runme.go
+++ b/Examples/test-suite/go/abstract_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import "abstract_typedef"
+import "swigtests/abstract_typedef"
func main() {
e := abstract_typedef.NewEngine()
diff --git a/Examples/test-suite/go/abstract_virtual_runme.go b/Examples/test-suite/go/abstract_virtual_runme.go
index e19eac27d..d333d50b3 100644
--- a/Examples/test-suite/go/abstract_virtual_runme.go
+++ b/Examples/test-suite/go/abstract_virtual_runme.go
@@ -1,6 +1,6 @@
package main
-import "abstract_virtual"
+import "swigtests/abstract_virtual"
func main() {
abstract_virtual.NewD()
diff --git a/Examples/test-suite/go/argout_runme.go b/Examples/test-suite/go/argout_runme.go
index bb8ab9ed2..b2edf54b6 100644
--- a/Examples/test-suite/go/argout_runme.go
+++ b/Examples/test-suite/go/argout_runme.go
@@ -1,6 +1,6 @@
package main
-import wrap "argout"
+import wrap "swigtests/argout"
func main() {
ip := wrap.New_intp()
diff --git a/Examples/test-suite/go/array_member_runme.go b/Examples/test-suite/go/array_member_runme.go
index 4f029db98..d8c3896ee 100644
--- a/Examples/test-suite/go/array_member_runme.go
+++ b/Examples/test-suite/go/array_member_runme.go
@@ -1,6 +1,6 @@
package main
-import . "array_member"
+import . "swigtests/array_member"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/arrays_global_runme.go b/Examples/test-suite/go/arrays_global_runme.go
index 35b049d9a..9c4a9e57a 100644
--- a/Examples/test-suite/go/arrays_global_runme.go
+++ b/Examples/test-suite/go/arrays_global_runme.go
@@ -1,6 +1,6 @@
package main
-import . "arrays_global"
+import . "swigtests/arrays_global"
func main() {
SetArray_i(GetArray_const_i())
diff --git a/Examples/test-suite/go/char_binary_runme.go b/Examples/test-suite/go/char_binary_runme.go
index d47d616af..3c8c2d72d 100644
--- a/Examples/test-suite/go/char_binary_runme.go
+++ b/Examples/test-suite/go/char_binary_runme.go
@@ -1,6 +1,6 @@
package main
-import . "char_binary"
+import . "swigtests/char_binary"
func main() {
t := NewTest()
diff --git a/Examples/test-suite/go/class_ignore_runme.go b/Examples/test-suite/go/class_ignore_runme.go
index 24261c637..11cf81d91 100644
--- a/Examples/test-suite/go/class_ignore_runme.go
+++ b/Examples/test-suite/go/class_ignore_runme.go
@@ -1,6 +1,6 @@
package main
-import "class_ignore"
+import "swigtests/class_ignore"
func main() {
a := class_ignore.NewBar()
diff --git a/Examples/test-suite/go/class_scope_weird_runme.go b/Examples/test-suite/go/class_scope_weird_runme.go
index a42bdad21..477699061 100644
--- a/Examples/test-suite/go/class_scope_weird_runme.go
+++ b/Examples/test-suite/go/class_scope_weird_runme.go
@@ -1,6 +1,6 @@
package main
-import "class_scope_weird"
+import "swigtests/class_scope_weird"
func main() {
f := class_scope_weird.NewFoo()
diff --git a/Examples/test-suite/go/compactdefaultargs_runme.go b/Examples/test-suite/go/compactdefaultargs_runme.go
index fe6224ca2..c9e90087f 100644
--- a/Examples/test-suite/go/compactdefaultargs_runme.go
+++ b/Examples/test-suite/go/compactdefaultargs_runme.go
@@ -1,6 +1,6 @@
package main
-import . "compactdefaultargs"
+import . "swigtests/compactdefaultargs"
func main() {
defaults1 := NewDefaults1(1000)
diff --git a/Examples/test-suite/go/constover_runme.go b/Examples/test-suite/go/constover_runme.go
index 6c837095a..51d965e7f 100644
--- a/Examples/test-suite/go/constover_runme.go
+++ b/Examples/test-suite/go/constover_runme.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- "constover"
+ "swigtests/constover"
)
func main() {
diff --git a/Examples/test-suite/go/constructor_copy_runme.go b/Examples/test-suite/go/constructor_copy_runme.go
index 68c428853..ca4725549 100644
--- a/Examples/test-suite/go/constructor_copy_runme.go
+++ b/Examples/test-suite/go/constructor_copy_runme.go
@@ -1,6 +1,6 @@
package main
-import . "constructor_copy"
+import . "swigtests/constructor_copy"
func main() {
f1 := NewFoo1(3)
diff --git a/Examples/test-suite/go/contract_runme.go b/Examples/test-suite/go/contract_runme.go
index b028855c3..7c9d0979e 100644
--- a/Examples/test-suite/go/contract_runme.go
+++ b/Examples/test-suite/go/contract_runme.go
@@ -1,6 +1,6 @@
package main
-import "contract"
+import "swigtests/contract"
func main() {
contract.Test_preassert(1, 2)
diff --git a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
index f9ca74a1e..926b6f756 100644
--- a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
+++ b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "cpp11_strongly_typed_enumerations"
+import . "swigtests/cpp11_strongly_typed_enumerations"
func enumCheck(actual int, expected int) int {
if actual != expected {
diff --git a/Examples/test-suite/go/cpp_enum_runme.go b/Examples/test-suite/go/cpp_enum_runme.go
index 8906dd4f1..9b8930a44 100644
--- a/Examples/test-suite/go/cpp_enum_runme.go
+++ b/Examples/test-suite/go/cpp_enum_runme.go
@@ -1,6 +1,6 @@
package main
-import "cpp_enum"
+import "swigtests/cpp_enum"
func main() {
f := cpp_enum.NewFoo()
diff --git a/Examples/test-suite/go/cpp_namespace_runme.go b/Examples/test-suite/go/cpp_namespace_runme.go
index aecdd9543..71affc57d 100644
--- a/Examples/test-suite/go/cpp_namespace_runme.go
+++ b/Examples/test-suite/go/cpp_namespace_runme.go
@@ -1,7 +1,7 @@
// Note: This example assumes that namespaces are flattened
package main
-import "cpp_namespace"
+import "swigtests/cpp_namespace"
func main() {
n := cpp_namespace.Fact(4)
diff --git a/Examples/test-suite/go/cpp_static_runme.go b/Examples/test-suite/go/cpp_static_runme.go
index 1ad981a60..d482298eb 100644
--- a/Examples/test-suite/go/cpp_static_runme.go
+++ b/Examples/test-suite/go/cpp_static_runme.go
@@ -1,6 +1,6 @@
package main
-import . "cpp_static"
+import . "swigtests/cpp_static"
func main() {
StaticFunctionTestStatic_func()
diff --git a/Examples/test-suite/go/default_args_runme.go b/Examples/test-suite/go/default_args_runme.go
index a39f95716..5b6f404e3 100644
--- a/Examples/test-suite/go/default_args_runme.go
+++ b/Examples/test-suite/go/default_args_runme.go
@@ -1,6 +1,6 @@
package main
-import "default_args"
+import "swigtests/default_args"
func main() {
if default_args.StaticsStaticmethod() != 60 {
diff --git a/Examples/test-suite/go/default_constructor_runme.go b/Examples/test-suite/go/default_constructor_runme.go
index eeac7eaf8..90d960143 100644
--- a/Examples/test-suite/go/default_constructor_runme.go
+++ b/Examples/test-suite/go/default_constructor_runme.go
@@ -1,6 +1,6 @@
package main
-import dc "default_constructor"
+import dc "swigtests/default_constructor"
func main() {
a := dc.NewA()
diff --git a/Examples/test-suite/go/director_alternating_runme.go b/Examples/test-suite/go/director_alternating_runme.go
index b4793aa8f..2df31db82 100644
--- a/Examples/test-suite/go/director_alternating_runme.go
+++ b/Examples/test-suite/go/director_alternating_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_alternating"
+import . "swigtests/director_alternating"
func main() {
id := GetBar().Id()
diff --git a/Examples/test-suite/go/director_basic_runme.go b/Examples/test-suite/go/director_basic_runme.go
index 360424d9b..c308f2520 100644
--- a/Examples/test-suite/go/director_basic_runme.go
+++ b/Examples/test-suite/go/director_basic_runme.go
@@ -1,6 +1,6 @@
package main
-import "director_basic"
+import "swigtests/director_basic"
type GoFoo struct{}
diff --git a/Examples/test-suite/go/director_classic_runme.go b/Examples/test-suite/go/director_classic_runme.go
index 230c9638d..d8acc1337 100644
--- a/Examples/test-suite/go/director_classic_runme.go
+++ b/Examples/test-suite/go/director_classic_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "director_classic"
+import . "swigtests/director_classic"
type TargetLangPerson struct{} // From Person
func (p *TargetLangPerson) Id() string {
diff --git a/Examples/test-suite/go/director_default_runme.go b/Examples/test-suite/go/director_default_runme.go
index ac2aace1d..557d5c54b 100644
--- a/Examples/test-suite/go/director_default_runme.go
+++ b/Examples/test-suite/go/director_default_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_default"
+import . "swigtests/director_default"
func main() {
NewFoo()
diff --git a/Examples/test-suite/go/director_detect_runme.go b/Examples/test-suite/go/director_detect_runme.go
index 0c3c95fdc..f82a0c04a 100644
--- a/Examples/test-suite/go/director_detect_runme.go
+++ b/Examples/test-suite/go/director_detect_runme.go
@@ -1,6 +1,6 @@
package main
-import "director_detect"
+import "swigtests/director_detect"
type MyBar struct {
val int
diff --git a/Examples/test-suite/go/director_enum_runme.go b/Examples/test-suite/go/director_enum_runme.go
index 002d425d2..3e67417b2 100644
--- a/Examples/test-suite/go/director_enum_runme.go
+++ b/Examples/test-suite/go/director_enum_runme.go
@@ -1,6 +1,6 @@
package main
-import "director_enum"
+import "swigtests/director_enum"
type MyFoo struct{} // From director_enum.Foo
func (p *MyFoo) Say_hi(val director_enum.EnumDirectorHello) director_enum.EnumDirectorHello {
diff --git a/Examples/test-suite/go/director_exception_runme.go b/Examples/test-suite/go/director_exception_runme.go
index 55231ff16..167d75193 100644
--- a/Examples/test-suite/go/director_exception_runme.go
+++ b/Examples/test-suite/go/director_exception_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_exception"
+import . "swigtests/director_exception"
type Exception struct {
msg string
diff --git a/Examples/test-suite/go/director_extend_runme.go b/Examples/test-suite/go/director_extend_runme.go
index 27e55b997..adfb6ddb7 100644
--- a/Examples/test-suite/go/director_extend_runme.go
+++ b/Examples/test-suite/go/director_extend_runme.go
@@ -5,7 +5,7 @@
package main
-import . "director_extend"
+import . "swigtests/director_extend"
func main() {
m := NewSpObject()
diff --git a/Examples/test-suite/go/director_finalizer_runme.go b/Examples/test-suite/go/director_finalizer_runme.go
index d36a4ba33..5cd9d95e0 100644
--- a/Examples/test-suite/go/director_finalizer_runme.go
+++ b/Examples/test-suite/go/director_finalizer_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_finalizer"
+import . "swigtests/director_finalizer"
type MyFoo struct{} // From Foo
func DeleteMyFoo(p Foo) {
diff --git a/Examples/test-suite/go/director_frob_runme.go b/Examples/test-suite/go/director_frob_runme.go
index 3985eb14b..7354fa76b 100644
--- a/Examples/test-suite/go/director_frob_runme.go
+++ b/Examples/test-suite/go/director_frob_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_frob"
+import . "swigtests/director_frob"
func main() {
foo := NewBravo()
diff --git a/Examples/test-suite/go/director_nested_runme.go b/Examples/test-suite/go/director_nested_runme.go
index a1193ad59..b04893582 100644
--- a/Examples/test-suite/go/director_nested_runme.go
+++ b/Examples/test-suite/go/director_nested_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_nested"
+import . "swigtests/director_nested"
type A struct{} // From FooBar_int
func (p *A) Do_step() string {
diff --git a/Examples/test-suite/go/director_profile_runme.go b/Examples/test-suite/go/director_profile_runme.go
index a9bc7934b..da0ea219b 100644
--- a/Examples/test-suite/go/director_profile_runme.go
+++ b/Examples/test-suite/go/director_profile_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "director_profile"
+import "swigtests/director_profile"
type MyB struct{} // From director_profile.B
func (p *MyB) Vfi(a int) int {
diff --git a/Examples/test-suite/go/director_protected_runme.go b/Examples/test-suite/go/director_protected_runme.go
index bfd50c6b2..0012ccdb2 100644
--- a/Examples/test-suite/go/director_protected_runme.go
+++ b/Examples/test-suite/go/director_protected_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_protected"
+import . "swigtests/director_protected"
type FooBar struct{} // From Bar
func (p *FooBar) Ping() string {
diff --git a/Examples/test-suite/go/director_string_runme.go b/Examples/test-suite/go/director_string_runme.go
index f4f9cc150..0c73b6a29 100644
--- a/Examples/test-suite/go/director_string_runme.go
+++ b/Examples/test-suite/go/director_string_runme.go
@@ -1,6 +1,6 @@
package main
-import . "director_string"
+import . "swigtests/director_string"
type B struct { // From A
abi A
diff --git a/Examples/test-suite/go/director_unroll_runme.go b/Examples/test-suite/go/director_unroll_runme.go
index 6a919f656..560034c8a 100644
--- a/Examples/test-suite/go/director_unroll_runme.go
+++ b/Examples/test-suite/go/director_unroll_runme.go
@@ -1,6 +1,6 @@
package main
-import "director_unroll"
+import "swigtests/director_unroll"
type MyFoo struct{} // From director_unroll.Foo
func (p *MyFoo) Ping() string {
diff --git a/Examples/test-suite/go/disown_runme.go b/Examples/test-suite/go/disown_runme.go
index 4484515fd..ba072a888 100644
--- a/Examples/test-suite/go/disown_runme.go
+++ b/Examples/test-suite/go/disown_runme.go
@@ -1,6 +1,6 @@
package main
-import . "disown"
+import . "swigtests/disown"
func main() {
a := NewA()
diff --git a/Examples/test-suite/go/dynamic_cast_runme.go b/Examples/test-suite/go/dynamic_cast_runme.go
index 46ba23698..213bc0ce5 100644
--- a/Examples/test-suite/go/dynamic_cast_runme.go
+++ b/Examples/test-suite/go/dynamic_cast_runme.go
@@ -1,6 +1,6 @@
package main
-import "dynamic_cast"
+import "swigtests/dynamic_cast"
func main() {
f := dynamic_cast.NewFoo()
diff --git a/Examples/test-suite/go/empty_c_runme.go b/Examples/test-suite/go/empty_c_runme.go
index 1a1bd9cc5..f093103f6 100644
--- a/Examples/test-suite/go/empty_c_runme.go
+++ b/Examples/test-suite/go/empty_c_runme.go
@@ -1,6 +1,6 @@
package main
-import _ "empty_c"
+import _ "swigtests/empty_c"
func main() {
}
diff --git a/Examples/test-suite/go/empty_runme.go b/Examples/test-suite/go/empty_runme.go
index 681a6f3ad..03f423b8b 100644
--- a/Examples/test-suite/go/empty_runme.go
+++ b/Examples/test-suite/go/empty_runme.go
@@ -1,6 +1,6 @@
package main
-import _ "empty"
+import _ "swigtests/empty"
func main() {
}
diff --git a/Examples/test-suite/go/enum_template_runme.go b/Examples/test-suite/go/enum_template_runme.go
index c60a452d7..7f43eab68 100644
--- a/Examples/test-suite/go/enum_template_runme.go
+++ b/Examples/test-suite/go/enum_template_runme.go
@@ -1,6 +1,6 @@
package main
-import "enum_template"
+import "swigtests/enum_template"
func main() {
if enum_template.MakeETest() != 1 {
diff --git a/Examples/test-suite/go/enums_runme.go b/Examples/test-suite/go/enums_runme.go
index 7a528b3e2..4a879a048 100644
--- a/Examples/test-suite/go/enums_runme.go
+++ b/Examples/test-suite/go/enums_runme.go
@@ -1,6 +1,6 @@
package main
-import "enums"
+import "swigtests/enums"
func main() {
enums.Bar2(1)
diff --git a/Examples/test-suite/go/exception_order_runme.go b/Examples/test-suite/go/exception_order_runme.go
index 21dcff312..ee67712fc 100644
--- a/Examples/test-suite/go/exception_order_runme.go
+++ b/Examples/test-suite/go/exception_order_runme.go
@@ -1,7 +1,7 @@
package main
import "strings"
-import . "exception_order"
+import . "swigtests/exception_order"
func main() {
a := NewA()
diff --git a/Examples/test-suite/go/extend_placement_runme.go b/Examples/test-suite/go/extend_placement_runme.go
index 253ec6618..879589679 100644
--- a/Examples/test-suite/go/extend_placement_runme.go
+++ b/Examples/test-suite/go/extend_placement_runme.go
@@ -1,6 +1,6 @@
package main
-import "extend_placement"
+import "swigtests/extend_placement"
func main() {
foo := extend_placement.NewFoo()
diff --git a/Examples/test-suite/go/extend_template_ns_runme.go b/Examples/test-suite/go/extend_template_ns_runme.go
index d005172a4..b1dd43a78 100644
--- a/Examples/test-suite/go/extend_template_ns_runme.go
+++ b/Examples/test-suite/go/extend_template_ns_runme.go
@@ -1,6 +1,6 @@
package main
-import . "extend_template_ns"
+import . "swigtests/extend_template_ns"
func main() {
f := NewFoo_One()
diff --git a/Examples/test-suite/go/extend_template_runme.go b/Examples/test-suite/go/extend_template_runme.go
index a5c4da4e1..4a6b7099b 100644
--- a/Examples/test-suite/go/extend_template_runme.go
+++ b/Examples/test-suite/go/extend_template_runme.go
@@ -1,6 +1,6 @@
package main
-import "extend_template"
+import "swigtests/extend_template"
func main() {
f := extend_template.NewFoo_0()
diff --git a/Examples/test-suite/go/extend_variable_runme.go b/Examples/test-suite/go/extend_variable_runme.go
index 9425aee4d..278bffed6 100644
--- a/Examples/test-suite/go/extend_variable_runme.go
+++ b/Examples/test-suite/go/extend_variable_runme.go
@@ -1,6 +1,6 @@
package main
-import . "extend_variable"
+import . "swigtests/extend_variable"
func main() {
if FooBar != 42 {
diff --git a/Examples/test-suite/go/extern_c_runme.go b/Examples/test-suite/go/extern_c_runme.go
index 9bc2cd0cc..1cbfd9d80 100644
--- a/Examples/test-suite/go/extern_c_runme.go
+++ b/Examples/test-suite/go/extern_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "extern_c"
+import "swigtests/extern_c"
func main() {
extern_c.RealFunction(2)
diff --git a/Examples/test-suite/go/friends_runme.go b/Examples/test-suite/go/friends_runme.go
index 2e34a4db0..b6b9e93f3 100644
--- a/Examples/test-suite/go/friends_runme.go
+++ b/Examples/test-suite/go/friends_runme.go
@@ -1,6 +1,6 @@
package main
-import "friends"
+import "swigtests/friends"
func main() {
a := friends.NewA(2)
diff --git a/Examples/test-suite/go/fvirtual_runme.go b/Examples/test-suite/go/fvirtual_runme.go
index 86ef90f18..01b94f419 100644
--- a/Examples/test-suite/go/fvirtual_runme.go
+++ b/Examples/test-suite/go/fvirtual_runme.go
@@ -1,6 +1,6 @@
package main
-import . "fvirtual"
+import . "swigtests/fvirtual"
func main() {
sw := NewNodeSwitch()
diff --git a/Examples/test-suite/go/global_ns_arg_runme.go b/Examples/test-suite/go/global_ns_arg_runme.go
index e86aa6747..aeacd91a3 100644
--- a/Examples/test-suite/go/global_ns_arg_runme.go
+++ b/Examples/test-suite/go/global_ns_arg_runme.go
@@ -1,6 +1,6 @@
package main
-import . "global_ns_arg"
+import . "swigtests/global_ns_arg"
func main() {
Foo(1)
diff --git a/Examples/test-suite/go/go_director_inout_runme.go b/Examples/test-suite/go/go_director_inout_runme.go
index e6768a465..171b3c223 100644
--- a/Examples/test-suite/go/go_director_inout_runme.go
+++ b/Examples/test-suite/go/go_director_inout_runme.go
@@ -1,7 +1,7 @@
package main
import (
- wrap "go_director_inout"
+ wrap "swigtests/go_director_inout"
)
type GoMyClass struct {}
diff --git a/Examples/test-suite/go/go_inout_runme.go b/Examples/test-suite/go/go_inout_runme.go
index 4599aa104..2dc5b9908 100644
--- a/Examples/test-suite/go/go_inout_runme.go
+++ b/Examples/test-suite/go/go_inout_runme.go
@@ -5,7 +5,7 @@ import (
"fmt"
"reflect"
- "go_inout"
+ "swigtests/go_inout"
)
type S struct {
diff --git a/Examples/test-suite/go/grouping_runme.go b/Examples/test-suite/go/grouping_runme.go
index f808e1286..d5f347579 100644
--- a/Examples/test-suite/go/grouping_runme.go
+++ b/Examples/test-suite/go/grouping_runme.go
@@ -1,6 +1,6 @@
package main
-import "grouping"
+import "swigtests/grouping"
func main() {
x := grouping.Test1(42)
diff --git a/Examples/test-suite/go/import_nomodule_runme.go b/Examples/test-suite/go/import_nomodule_runme.go
index 48592df25..23680159d 100644
--- a/Examples/test-suite/go/import_nomodule_runme.go
+++ b/Examples/test-suite/go/import_nomodule_runme.go
@@ -1,6 +1,6 @@
package main
-import . "import_nomodule"
+import . "swigtests/import_nomodule"
func main() {
f := Create_Foo()
diff --git a/Examples/test-suite/go/inctest_runme.go b/Examples/test-suite/go/inctest_runme.go
index 3148abcd2..490721e75 100644
--- a/Examples/test-suite/go/inctest_runme.go
+++ b/Examples/test-suite/go/inctest_runme.go
@@ -1,6 +1,6 @@
package main
-import "inctest"
+import "swigtests/inctest"
func main() {
inctest.NewA()
diff --git a/Examples/test-suite/go/inherit_member_runme.go b/Examples/test-suite/go/inherit_member_runme.go
index 6fd70cf80..10dabad96 100644
--- a/Examples/test-suite/go/inherit_member_runme.go
+++ b/Examples/test-suite/go/inherit_member_runme.go
@@ -1,6 +1,6 @@
package main
-import wrap "inherit_member"
+import wrap "swigtests/inherit_member"
func main() {
s := wrap.NewChild()
diff --git a/Examples/test-suite/go/inherit_missing_runme.go b/Examples/test-suite/go/inherit_missing_runme.go
index c70c48306..b4706e974 100644
--- a/Examples/test-suite/go/inherit_missing_runme.go
+++ b/Examples/test-suite/go/inherit_missing_runme.go
@@ -1,6 +1,6 @@
package main
-import "inherit_missing"
+import "swigtests/inherit_missing"
func main() {
a := inherit_missing.New_Foo()
diff --git a/Examples/test-suite/go/input_runme.go b/Examples/test-suite/go/input_runme.go
index ddc2992fe..c5eb9e45d 100644
--- a/Examples/test-suite/go/input_runme.go
+++ b/Examples/test-suite/go/input_runme.go
@@ -1,6 +1,6 @@
package main
-import . "input"
+import . "swigtests/input"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/keyword_rename_c_runme.go b/Examples/test-suite/go/keyword_rename_c_runme.go
index 26f2ea42b..28f6ddd12 100644
--- a/Examples/test-suite/go/keyword_rename_c_runme.go
+++ b/Examples/test-suite/go/keyword_rename_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "keyword_rename_c"
+import "swigtests/keyword_rename_c"
func main() {
keyword_rename_c.Xgo(1)
diff --git a/Examples/test-suite/go/keyword_rename_runme.go b/Examples/test-suite/go/keyword_rename_runme.go
index 7a40ff83d..f93c7ab14 100644
--- a/Examples/test-suite/go/keyword_rename_runme.go
+++ b/Examples/test-suite/go/keyword_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "keyword_rename"
+import "swigtests/keyword_rename"
func main() {
keyword_rename.Xgo(1)
diff --git a/Examples/test-suite/go/li_attribute_runme.go b/Examples/test-suite/go/li_attribute_runme.go
index b502b8cea..0702b898f 100644
--- a/Examples/test-suite/go/li_attribute_runme.go
+++ b/Examples/test-suite/go/li_attribute_runme.go
@@ -1,6 +1,6 @@
package main
-import "li_attribute"
+import "swigtests/li_attribute"
func main() {
aa := li_attribute.NewA(1, 2, 3)
diff --git a/Examples/test-suite/go/li_carrays_cpp_runme.go b/Examples/test-suite/go/li_carrays_cpp_runme.go
index cfc171284..a96291c7b 100644
--- a/Examples/test-suite/go/li_carrays_cpp_runme.go
+++ b/Examples/test-suite/go/li_carrays_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_carrays_cpp"
+import . "swigtests/li_carrays_cpp"
func main() {
d := NewDoubleArray(10)
diff --git a/Examples/test-suite/go/li_carrays_runme.go b/Examples/test-suite/go/li_carrays_runme.go
index 9128bbfd1..eefc6ad72 100644
--- a/Examples/test-suite/go/li_carrays_runme.go
+++ b/Examples/test-suite/go/li_carrays_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_carrays"
+import . "swigtests/li_carrays"
func main() {
d := NewDoubleArray(10)
diff --git a/Examples/test-suite/go/li_cdata_cpp_runme.go b/Examples/test-suite/go/li_cdata_cpp_runme.go
index daa5384f7..5849c50d4 100644
--- a/Examples/test-suite/go/li_cdata_cpp_runme.go
+++ b/Examples/test-suite/go/li_cdata_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cdata_cpp"
+import . "swigtests/li_cdata_cpp"
func main() {
s := "ABC abc"
diff --git a/Examples/test-suite/go/li_cdata_runme.go b/Examples/test-suite/go/li_cdata_runme.go
index 9458dab43..0c3e591ce 100644
--- a/Examples/test-suite/go/li_cdata_runme.go
+++ b/Examples/test-suite/go/li_cdata_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cdata"
+import . "swigtests/li_cdata"
func main() {
s := "ABC abc"
diff --git a/Examples/test-suite/go/li_cmalloc_runme.go b/Examples/test-suite/go/li_cmalloc_runme.go
index 5b9f9704a..fb1b009c3 100644
--- a/Examples/test-suite/go/li_cmalloc_runme.go
+++ b/Examples/test-suite/go/li_cmalloc_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cmalloc"
+import . "swigtests/li_cmalloc"
func main() {
p := Malloc_int()
diff --git a/Examples/test-suite/go/li_cpointer_cpp_runme.go b/Examples/test-suite/go/li_cpointer_cpp_runme.go
index 0de57c624..f422b2310 100644
--- a/Examples/test-suite/go/li_cpointer_cpp_runme.go
+++ b/Examples/test-suite/go/li_cpointer_cpp_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cpointer_cpp"
+import . "swigtests/li_cpointer_cpp"
func main() {
p := New_intp()
diff --git a/Examples/test-suite/go/li_cpointer_runme.go b/Examples/test-suite/go/li_cpointer_runme.go
index 0fe29e77d..1a83bc62f 100644
--- a/Examples/test-suite/go/li_cpointer_runme.go
+++ b/Examples/test-suite/go/li_cpointer_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_cpointer"
+import . "swigtests/li_cpointer"
func main() {
p := New_intp()
diff --git a/Examples/test-suite/go/li_std_map_runme.go b/Examples/test-suite/go/li_std_map_runme.go
index 5c5cc2e4c..019ac6e30 100644
--- a/Examples/test-suite/go/li_std_map_runme.go
+++ b/Examples/test-suite/go/li_std_map_runme.go
@@ -1,6 +1,6 @@
package main
-import "li_std_map"
+import "swigtests/li_std_map"
func main() {
a1 := li_std_map.NewA(3)
diff --git a/Examples/test-suite/go/li_std_vector_ptr_runme.go b/Examples/test-suite/go/li_std_vector_ptr_runme.go
index d66ff19c6..9a62d3796 100644
--- a/Examples/test-suite/go/li_std_vector_ptr_runme.go
+++ b/Examples/test-suite/go/li_std_vector_ptr_runme.go
@@ -1,6 +1,6 @@
package main
-import . "li_std_vector_ptr"
+import . "swigtests/li_std_vector_ptr"
import "fmt"
func check(val1 int, val2 int) {
diff --git a/Examples/test-suite/go/member_pointer_runme.go b/Examples/test-suite/go/member_pointer_runme.go
index 731526b75..02789382e 100644
--- a/Examples/test-suite/go/member_pointer_runme.go
+++ b/Examples/test-suite/go/member_pointer_runme.go
@@ -3,7 +3,7 @@
package main
import "fmt"
-import . "member_pointer"
+import . "swigtests/member_pointer"
func check(what string, expected float64, actual float64) {
if expected != actual {
diff --git a/Examples/test-suite/go/memberin_extend_c_runme.go b/Examples/test-suite/go/memberin_extend_c_runme.go
index 0551acc90..696f08abb 100644
--- a/Examples/test-suite/go/memberin_extend_c_runme.go
+++ b/Examples/test-suite/go/memberin_extend_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "memberin_extend_c"
+import "swigtests/memberin_extend_c"
func main() {
t := memberin_extend_c.NewPerson()
diff --git a/Examples/test-suite/go/minherit_runme.go b/Examples/test-suite/go/minherit_runme.go
index 9b7873cb0..f1504af31 100644
--- a/Examples/test-suite/go/minherit_runme.go
+++ b/Examples/test-suite/go/minherit_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "minherit"
+import "swigtests/minherit"
func main() {
a := minherit.NewFoo()
diff --git a/Examples/test-suite/go/namespace_class_runme.go b/Examples/test-suite/go/namespace_class_runme.go
index 4c240b6a4..435ee868a 100644
--- a/Examples/test-suite/go/namespace_class_runme.go
+++ b/Examples/test-suite/go/namespace_class_runme.go
@@ -1,6 +1,6 @@
package main
-import . "namespace_class"
+import . "swigtests/namespace_class"
func main() {
EulerT3DToFrame(1, 1, 1)
diff --git a/Examples/test-suite/go/namespace_typemap_runme.go b/Examples/test-suite/go/namespace_typemap_runme.go
index 47e2b64f1..6da43331b 100644
--- a/Examples/test-suite/go/namespace_typemap_runme.go
+++ b/Examples/test-suite/go/namespace_typemap_runme.go
@@ -1,6 +1,6 @@
package main
-import . "namespace_typemap"
+import . "swigtests/namespace_typemap"
func main() {
if Stest1("hello") != "hello" {
diff --git a/Examples/test-suite/go/namespace_virtual_method_runme.go b/Examples/test-suite/go/namespace_virtual_method_runme.go
index a8cb38bad..7ac4d3304 100644
--- a/Examples/test-suite/go/namespace_virtual_method_runme.go
+++ b/Examples/test-suite/go/namespace_virtual_method_runme.go
@@ -1,6 +1,6 @@
package main
-import "namespace_virtual_method"
+import "swigtests/namespace_virtual_method"
func main() {
_ = namespace_virtual_method.NewSpam()
diff --git a/Examples/test-suite/go/naturalvar_runme.go b/Examples/test-suite/go/naturalvar_runme.go
index ed47e9d2d..458745ec4 100644
--- a/Examples/test-suite/go/naturalvar_runme.go
+++ b/Examples/test-suite/go/naturalvar_runme.go
@@ -1,6 +1,6 @@
package main
-import . "naturalvar"
+import . "swigtests/naturalvar"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/nested_workaround_runme.go b/Examples/test-suite/go/nested_workaround_runme.go
index 8b31a7f4b..f42b48764 100644
--- a/Examples/test-suite/go/nested_workaround_runme.go
+++ b/Examples/test-suite/go/nested_workaround_runme.go
@@ -1,6 +1,6 @@
package main
-import . "nested_workaround"
+import . "swigtests/nested_workaround"
func main() {
inner := NewInner(5)
diff --git a/Examples/test-suite/go/overload_complicated_runme.go b/Examples/test-suite/go/overload_complicated_runme.go
index ce9d124c8..c238d974f 100644
--- a/Examples/test-suite/go/overload_complicated_runme.go
+++ b/Examples/test-suite/go/overload_complicated_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_complicated"
+import . "swigtests/overload_complicated"
func main() {
var pInt *int
diff --git a/Examples/test-suite/go/overload_copy_runme.go b/Examples/test-suite/go/overload_copy_runme.go
index 55ec4a333..9815d76ef 100644
--- a/Examples/test-suite/go/overload_copy_runme.go
+++ b/Examples/test-suite/go/overload_copy_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_copy"
+import . "swigtests/overload_copy"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/overload_extend2_runme.go b/Examples/test-suite/go/overload_extend2_runme.go
index db790989c..d549098ba 100644
--- a/Examples/test-suite/go/overload_extend2_runme.go
+++ b/Examples/test-suite/go/overload_extend2_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_extend2"
+import "swigtests/overload_extend2"
func main() {
f := overload_extend2.NewFoo()
diff --git a/Examples/test-suite/go/overload_extend_c_runme.go b/Examples/test-suite/go/overload_extend_c_runme.go
index 4d3b2b6e1..93b91d9e1 100644
--- a/Examples/test-suite/go/overload_extend_c_runme.go
+++ b/Examples/test-suite/go/overload_extend_c_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_extend_c"
+import "swigtests/overload_extend_c"
func main() {
f := overload_extend_c.NewFoo()
diff --git a/Examples/test-suite/go/overload_extend_runme.go b/Examples/test-suite/go/overload_extend_runme.go
index d73d6cf3c..c1435f376 100644
--- a/Examples/test-suite/go/overload_extend_runme.go
+++ b/Examples/test-suite/go/overload_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_extend"
+import "swigtests/overload_extend"
func main() {
f := overload_extend.NewFoo()
diff --git a/Examples/test-suite/go/overload_polymorphic_runme.go b/Examples/test-suite/go/overload_polymorphic_runme.go
index 12b9777e6..6a4301f46 100644
--- a/Examples/test-suite/go/overload_polymorphic_runme.go
+++ b/Examples/test-suite/go/overload_polymorphic_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_polymorphic"
+import "swigtests/overload_polymorphic"
func main(){
t := overload_polymorphic.NewDerived()
diff --git a/Examples/test-suite/go/overload_rename_runme.go b/Examples/test-suite/go/overload_rename_runme.go
index 3bd4a69c5..982b1786a 100644
--- a/Examples/test-suite/go/overload_rename_runme.go
+++ b/Examples/test-suite/go/overload_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "overload_rename"
+import "swigtests/overload_rename"
func main() {
_ = overload_rename.NewFoo(float32(1))
diff --git a/Examples/test-suite/go/overload_simple_runme.go b/Examples/test-suite/go/overload_simple_runme.go
index 3eb859bac..23a80bf69 100644
--- a/Examples/test-suite/go/overload_simple_runme.go
+++ b/Examples/test-suite/go/overload_simple_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_simple"
+import . "swigtests/overload_simple"
func main() {
if Foo(3) != "foo:int" {
diff --git a/Examples/test-suite/go/overload_subtype_runme.go b/Examples/test-suite/go/overload_subtype_runme.go
index 45d5a025f..09f7a83f4 100644
--- a/Examples/test-suite/go/overload_subtype_runme.go
+++ b/Examples/test-suite/go/overload_subtype_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_subtype"
+import . "swigtests/overload_subtype"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/overload_template_fast_runme.go b/Examples/test-suite/go/overload_template_fast_runme.go
index 63809c0ff..3b348f366 100644
--- a/Examples/test-suite/go/overload_template_fast_runme.go
+++ b/Examples/test-suite/go/overload_template_fast_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_template_fast"
+import . "swigtests/overload_template_fast"
func main() {
_ = Foo()
diff --git a/Examples/test-suite/go/overload_template_runme.go b/Examples/test-suite/go/overload_template_runme.go
index f3a08ecd6..b85afb4d1 100644
--- a/Examples/test-suite/go/overload_template_runme.go
+++ b/Examples/test-suite/go/overload_template_runme.go
@@ -1,6 +1,6 @@
package main
-import . "overload_template"
+import . "swigtests/overload_template"
func main() {
_ = Foo()
diff --git a/Examples/test-suite/go/preproc_runme.go b/Examples/test-suite/go/preproc_runme.go
index 3c55aae72..878305463 100644
--- a/Examples/test-suite/go/preproc_runme.go
+++ b/Examples/test-suite/go/preproc_runme.go
@@ -1,6 +1,6 @@
package main
-import "preproc"
+import "swigtests/preproc"
func main() {
if preproc.GetEndif() != 1 {
diff --git a/Examples/test-suite/go/primitive_ref_runme.go b/Examples/test-suite/go/primitive_ref_runme.go
index a1de2f8a5..8dcf9f5a9 100644
--- a/Examples/test-suite/go/primitive_ref_runme.go
+++ b/Examples/test-suite/go/primitive_ref_runme.go
@@ -1,6 +1,6 @@
package main
-import . "primitive_ref"
+import . "swigtests/primitive_ref"
func main() {
if Ref_int(3) != 3 {
diff --git a/Examples/test-suite/go/profiletest_runme.go b/Examples/test-suite/go/profiletest_runme.go
index c2b922ba3..68509f550 100644
--- a/Examples/test-suite/go/profiletest_runme.go
+++ b/Examples/test-suite/go/profiletest_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import "profiletest"
+import "swigtests/profiletest"
func main() {
a := profiletest.NewA()
diff --git a/Examples/test-suite/go/refcount_runme.go b/Examples/test-suite/go/refcount_runme.go
index 07d407273..76e30dda3 100644
--- a/Examples/test-suite/go/refcount_runme.go
+++ b/Examples/test-suite/go/refcount_runme.go
@@ -1,6 +1,6 @@
package main
-import . "refcount"
+import . "swigtests/refcount"
// very innocent example
diff --git a/Examples/test-suite/go/reference_global_vars_runme.go b/Examples/test-suite/go/reference_global_vars_runme.go
index 908358f95..f8c125854 100644
--- a/Examples/test-suite/go/reference_global_vars_runme.go
+++ b/Examples/test-suite/go/reference_global_vars_runme.go
@@ -1,6 +1,6 @@
package main
-import . "reference_global_vars"
+import . "swigtests/reference_global_vars"
func main() {
// const class reference variable
diff --git a/Examples/test-suite/go/rename_scope_runme.go b/Examples/test-suite/go/rename_scope_runme.go
index 13bd3f178..4ad7549ad 100644
--- a/Examples/test-suite/go/rename_scope_runme.go
+++ b/Examples/test-suite/go/rename_scope_runme.go
@@ -1,6 +1,6 @@
package main
-import . "rename_scope"
+import . "swigtests/rename_scope"
func main() {
a := NewNatural_UP()
diff --git a/Examples/test-suite/go/rename_simple_runme.go b/Examples/test-suite/go/rename_simple_runme.go
index bd559ef27..efe1edc7b 100644
--- a/Examples/test-suite/go/rename_simple_runme.go
+++ b/Examples/test-suite/go/rename_simple_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "rename_simple"
+import . "swigtests/rename_simple"
func main() {
s := NewNewStruct()
diff --git a/Examples/test-suite/go/rename_strip_encoder_runme.go b/Examples/test-suite/go/rename_strip_encoder_runme.go
index ae670600c..74a0dbaaf 100644
--- a/Examples/test-suite/go/rename_strip_encoder_runme.go
+++ b/Examples/test-suite/go/rename_strip_encoder_runme.go
@@ -1,6 +1,6 @@
package main
-import . "rename_strip_encoder"
+import . "swigtests/rename_strip_encoder"
func main() {
_ = NewSomeWidget()
diff --git a/Examples/test-suite/go/ret_by_value_runme.go b/Examples/test-suite/go/ret_by_value_runme.go
index 9659d21e9..345868dcd 100644
--- a/Examples/test-suite/go/ret_by_value_runme.go
+++ b/Examples/test-suite/go/ret_by_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "ret_by_value"
+import "swigtests/ret_by_value"
func main() {
a := ret_by_value.Get_test()
diff --git a/Examples/test-suite/go/return_const_value_runme.go b/Examples/test-suite/go/return_const_value_runme.go
index aadb1265e..fc6baa240 100644
--- a/Examples/test-suite/go/return_const_value_runme.go
+++ b/Examples/test-suite/go/return_const_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "return_const_value"
+import "swigtests/return_const_value"
func main() {
p := return_const_value.Foo_ptrGetPtr()
diff --git a/Examples/test-suite/go/smart_pointer_extend_runme.go b/Examples/test-suite/go/smart_pointer_extend_runme.go
index a851e26b7..f91c9ac99 100644
--- a/Examples/test-suite/go/smart_pointer_extend_runme.go
+++ b/Examples/test-suite/go/smart_pointer_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_extend"
+import . "swigtests/smart_pointer_extend"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_member_runme.go b/Examples/test-suite/go/smart_pointer_member_runme.go
index e7fe7c4c2..ca2ac2c76 100644
--- a/Examples/test-suite/go/smart_pointer_member_runme.go
+++ b/Examples/test-suite/go/smart_pointer_member_runme.go
@@ -1,7 +1,7 @@
package main
import "fmt"
-import . "smart_pointer_member"
+import . "swigtests/smart_pointer_member"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_multi_runme.go b/Examples/test-suite/go/smart_pointer_multi_runme.go
index 7c76061af..a8ec39f54 100644
--- a/Examples/test-suite/go/smart_pointer_multi_runme.go
+++ b/Examples/test-suite/go/smart_pointer_multi_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_multi"
+import . "swigtests/smart_pointer_multi"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go b/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
index e584cf7a2..6bfd21ef6 100644
--- a/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
+++ b/Examples/test-suite/go/smart_pointer_multi_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_multi_typedef"
+import . "swigtests/smart_pointer_multi_typedef"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_overload_runme.go b/Examples/test-suite/go/smart_pointer_overload_runme.go
index 9481554f0..c28ce6100 100644
--- a/Examples/test-suite/go/smart_pointer_overload_runme.go
+++ b/Examples/test-suite/go/smart_pointer_overload_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_overload"
+import . "swigtests/smart_pointer_overload"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_rename_runme.go b/Examples/test-suite/go/smart_pointer_rename_runme.go
index 44841f5e6..22c0eb1e9 100644
--- a/Examples/test-suite/go/smart_pointer_rename_runme.go
+++ b/Examples/test-suite/go/smart_pointer_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_rename"
+import . "swigtests/smart_pointer_rename"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_simple_runme.go b/Examples/test-suite/go/smart_pointer_simple_runme.go
index b468bd2e5..8a14dcf9b 100644
--- a/Examples/test-suite/go/smart_pointer_simple_runme.go
+++ b/Examples/test-suite/go/smart_pointer_simple_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_simple"
+import . "swigtests/smart_pointer_simple"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/smart_pointer_templatevariables_runme.go b/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
index 6d4ea91de..8f7102d43 100644
--- a/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
+++ b/Examples/test-suite/go/smart_pointer_templatevariables_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_templatevariables"
+import . "swigtests/smart_pointer_templatevariables"
func main() {
d := NewDiffImContainerPtr_D(Create(1234, 5678))
diff --git a/Examples/test-suite/go/smart_pointer_typedef_runme.go b/Examples/test-suite/go/smart_pointer_typedef_runme.go
index e89a8b150..5468a2926 100644
--- a/Examples/test-suite/go/smart_pointer_typedef_runme.go
+++ b/Examples/test-suite/go/smart_pointer_typedef_runme.go
@@ -1,6 +1,6 @@
package main
-import . "smart_pointer_typedef"
+import . "swigtests/smart_pointer_typedef"
func main() {
f := NewFoo()
diff --git a/Examples/test-suite/go/sneaky1_runme.go b/Examples/test-suite/go/sneaky1_runme.go
index 57c779724..c17f0ffc6 100644
--- a/Examples/test-suite/go/sneaky1_runme.go
+++ b/Examples/test-suite/go/sneaky1_runme.go
@@ -1,6 +1,6 @@
package main
-import "sneaky1"
+import "swigtests/sneaky1"
func main() {
_ = sneaky1.Add(3, 4)
diff --git a/Examples/test-suite/go/special_variable_macros_runme.go b/Examples/test-suite/go/special_variable_macros_runme.go
index 9338e6558..597c48748 100644
--- a/Examples/test-suite/go/special_variable_macros_runme.go
+++ b/Examples/test-suite/go/special_variable_macros_runme.go
@@ -1,6 +1,6 @@
package main
-import "special_variable_macros"
+import "swigtests/special_variable_macros"
func main() {
name := special_variable_macros.NewName()
diff --git a/Examples/test-suite/go/static_const_member_2_runme.go b/Examples/test-suite/go/static_const_member_2_runme.go
index ff8cbbbcd..7586eb404 100644
--- a/Examples/test-suite/go/static_const_member_2_runme.go
+++ b/Examples/test-suite/go/static_const_member_2_runme.go
@@ -1,6 +1,6 @@
package main
-import . "static_const_member_2"
+import . "swigtests/static_const_member_2"
func main() {
_ = NewTest_int()
diff --git a/Examples/test-suite/go/struct_initialization_runme.go b/Examples/test-suite/go/struct_initialization_runme.go
index a815bd3f5..d5eb4e968 100644
--- a/Examples/test-suite/go/struct_initialization_runme.go
+++ b/Examples/test-suite/go/struct_initialization_runme.go
@@ -1,6 +1,6 @@
package main
-import . "struct_initialization"
+import . "swigtests/struct_initialization"
func main() {
if GetInstanceC1().GetX() != 10 {
diff --git a/Examples/test-suite/go/struct_rename_runme.go b/Examples/test-suite/go/struct_rename_runme.go
index de99fc320..6d619e090 100644
--- a/Examples/test-suite/go/struct_rename_runme.go
+++ b/Examples/test-suite/go/struct_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "struct_rename"
+import "swigtests/struct_rename"
func main() {
_ = struct_rename.NewBar()
diff --git a/Examples/test-suite/go/struct_value_runme.go b/Examples/test-suite/go/struct_value_runme.go
index 3b5e5c1dc..c43a67a88 100644
--- a/Examples/test-suite/go/struct_value_runme.go
+++ b/Examples/test-suite/go/struct_value_runme.go
@@ -1,6 +1,6 @@
package main
-import "struct_value"
+import "swigtests/struct_value"
func main() {
b := struct_value.NewBar()
diff --git a/Examples/test-suite/go/template_default_arg_runme.go b/Examples/test-suite/go/template_default_arg_runme.go
index d67e63fa7..9558c7496 100644
--- a/Examples/test-suite/go/template_default_arg_runme.go
+++ b/Examples/test-suite/go/template_default_arg_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_default_arg"
+import "swigtests/template_default_arg"
func main() {
helloInt := template_default_arg.NewHello_int()
diff --git a/Examples/test-suite/go/template_extend1_runme.go b/Examples/test-suite/go/template_extend1_runme.go
index 0912fa6ed..f2469ab15 100644
--- a/Examples/test-suite/go/template_extend1_runme.go
+++ b/Examples/test-suite/go/template_extend1_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_extend1"
+import "swigtests/template_extend1"
func main() {
a := template_extend1.NewLBaz()
diff --git a/Examples/test-suite/go/template_extend2_runme.go b/Examples/test-suite/go/template_extend2_runme.go
index ced3d93cc..c3669bc95 100644
--- a/Examples/test-suite/go/template_extend2_runme.go
+++ b/Examples/test-suite/go/template_extend2_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_extend2"
+import "swigtests/template_extend2"
func main() {
a := template_extend2.NewLBaz()
diff --git a/Examples/test-suite/go/template_inherit_runme.go b/Examples/test-suite/go/template_inherit_runme.go
index a8d5126dc..10071b128 100644
--- a/Examples/test-suite/go/template_inherit_runme.go
+++ b/Examples/test-suite/go/template_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_inherit"
+import . "swigtests/template_inherit"
func main() {
a := NewFooInt()
diff --git a/Examples/test-suite/go/template_ns4_runme.go b/Examples/test-suite/go/template_ns4_runme.go
index 6c658ec97..c1b356b3f 100644
--- a/Examples/test-suite/go/template_ns4_runme.go
+++ b/Examples/test-suite/go/template_ns4_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_ns4"
+import . "swigtests/template_ns4"
func main() {
d := Make_Class_DD()
diff --git a/Examples/test-suite/go/template_ns_runme.go b/Examples/test-suite/go/template_ns_runme.go
index cfc56fa3c..e77c17bf7 100644
--- a/Examples/test-suite/go/template_ns_runme.go
+++ b/Examples/test-suite/go/template_ns_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_ns"
+import . "swigtests/template_ns"
func main() {
p1 := NewPairii(2, 3)
diff --git a/Examples/test-suite/go/template_opaque_runme.go b/Examples/test-suite/go/template_opaque_runme.go
index 71701df53..b3bf61043 100644
--- a/Examples/test-suite/go/template_opaque_runme.go
+++ b/Examples/test-suite/go/template_opaque_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_opaque"
+import "swigtests/template_opaque"
func main() {
v := template_opaque.NewOpaqueVectorType(int64(10))
diff --git a/Examples/test-suite/go/template_ref_type_runme.go b/Examples/test-suite/go/template_ref_type_runme.go
index a01ce3d31..516b6c721 100644
--- a/Examples/test-suite/go/template_ref_type_runme.go
+++ b/Examples/test-suite/go/template_ref_type_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_ref_type"
+import "swigtests/template_ref_type"
func main() {
xr := template_ref_type.NewXC()
diff --git a/Examples/test-suite/go/template_rename_runme.go b/Examples/test-suite/go/template_rename_runme.go
index 6e04f8845..08cf3fb48 100644
--- a/Examples/test-suite/go/template_rename_runme.go
+++ b/Examples/test-suite/go/template_rename_runme.go
@@ -1,6 +1,6 @@
package main
-import "template_rename"
+import "swigtests/template_rename"
func main() {
i := template_rename.NewIFoo()
diff --git a/Examples/test-suite/go/template_static_runme.go b/Examples/test-suite/go/template_static_runme.go
index f10ea78f7..205813dbf 100644
--- a/Examples/test-suite/go/template_static_runme.go
+++ b/Examples/test-suite/go/template_static_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_static"
+import . "swigtests/template_static"
func main() {
FooBar_double(1)
diff --git a/Examples/test-suite/go/template_tbase_template_runme.go b/Examples/test-suite/go/template_tbase_template_runme.go
index e1c46aaf7..a4832439f 100644
--- a/Examples/test-suite/go/template_tbase_template_runme.go
+++ b/Examples/test-suite/go/template_tbase_template_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_tbase_template"
+import . "swigtests/template_tbase_template"
func main() {
a := Make_Class_dd()
diff --git a/Examples/test-suite/go/template_type_namespace_runme.go b/Examples/test-suite/go/template_type_namespace_runme.go
index 1356f9b08..562fae78d 100644
--- a/Examples/test-suite/go/template_type_namespace_runme.go
+++ b/Examples/test-suite/go/template_type_namespace_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_type_namespace"
+import . "swigtests/template_type_namespace"
func main() {
if Foo().Get(0) == "" {
diff --git a/Examples/test-suite/go/template_typedef_cplx3_runme.go b/Examples/test-suite/go/template_typedef_cplx3_runme.go
index 0a2b31301..52a9bc7f6 100644
--- a/Examples/test-suite/go/template_typedef_cplx3_runme.go
+++ b/Examples/test-suite/go/template_typedef_cplx3_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_typedef_cplx3"
+import . "swigtests/template_typedef_cplx3"
func main() {
// this is OK
diff --git a/Examples/test-suite/go/template_typedef_cplx4_runme.go b/Examples/test-suite/go/template_typedef_cplx4_runme.go
index d8952cfb6..84347e404 100644
--- a/Examples/test-suite/go/template_typedef_cplx4_runme.go
+++ b/Examples/test-suite/go/template_typedef_cplx4_runme.go
@@ -1,6 +1,6 @@
package main
-import . "template_typedef_cplx4"
+import . "swigtests/template_typedef_cplx4"
func main() {
// this is OK
diff --git a/Examples/test-suite/go/threads_exception_runme.go b/Examples/test-suite/go/threads_exception_runme.go
index e3da1dc25..b554f0e28 100644
--- a/Examples/test-suite/go/threads_exception_runme.go
+++ b/Examples/test-suite/go/threads_exception_runme.go
@@ -1,7 +1,7 @@
package main
import "strings"
-import "threads_exception"
+import "swigtests/threads_exception"
func main() {
t := threads_exception.NewTest()
diff --git a/Examples/test-suite/go/typedef_class_runme.go b/Examples/test-suite/go/typedef_class_runme.go
index d94126d3b..157a91745 100644
--- a/Examples/test-suite/go/typedef_class_runme.go
+++ b/Examples/test-suite/go/typedef_class_runme.go
@@ -1,6 +1,6 @@
package main
-import "typedef_class"
+import "swigtests/typedef_class"
func main() {
a := typedef_class.NewRealA()
diff --git a/Examples/test-suite/go/typedef_funcptr_runme.go b/Examples/test-suite/go/typedef_funcptr_runme.go
index 9d55f3f04..f76f088af 100644
--- a/Examples/test-suite/go/typedef_funcptr_runme.go
+++ b/Examples/test-suite/go/typedef_funcptr_runme.go
@@ -1,6 +1,6 @@
package main
-import . "typedef_funcptr"
+import . "swigtests/typedef_funcptr"
func main() {
a := 100
diff --git a/Examples/test-suite/go/typedef_inherit_runme.go b/Examples/test-suite/go/typedef_inherit_runme.go
index 7a65569f2..f2dbb3263 100644
--- a/Examples/test-suite/go/typedef_inherit_runme.go
+++ b/Examples/test-suite/go/typedef_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import "typedef_inherit"
+import "swigtests/typedef_inherit"
func main() {
a := typedef_inherit.NewFoo()
diff --git a/Examples/test-suite/go/typedef_scope_runme.go b/Examples/test-suite/go/typedef_scope_runme.go
index af282b16f..9c845bb69 100644
--- a/Examples/test-suite/go/typedef_scope_runme.go
+++ b/Examples/test-suite/go/typedef_scope_runme.go
@@ -1,6 +1,6 @@
package main
-import "typedef_scope"
+import "swigtests/typedef_scope"
func main() {
b := typedef_scope.NewBar()
diff --git a/Examples/test-suite/go/typemap_namespace_runme.go b/Examples/test-suite/go/typemap_namespace_runme.go
index a2880d4a8..f0860803e 100644
--- a/Examples/test-suite/go/typemap_namespace_runme.go
+++ b/Examples/test-suite/go/typemap_namespace_runme.go
@@ -1,6 +1,6 @@
package main
-import . "typemap_namespace"
+import . "swigtests/typemap_namespace"
func main() {
if Test1("hello") != "hello" {
diff --git a/Examples/test-suite/go/typemap_ns_using_runme.go b/Examples/test-suite/go/typemap_ns_using_runme.go
index c4c21cf75..00e1131d6 100644
--- a/Examples/test-suite/go/typemap_ns_using_runme.go
+++ b/Examples/test-suite/go/typemap_ns_using_runme.go
@@ -1,6 +1,6 @@
package main
-import "typemap_ns_using"
+import "swigtests/typemap_ns_using"
func main() {
if typemap_ns_using.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/typemap_out_optimal_runme.go b/Examples/test-suite/go/typemap_out_optimal_runme.go
index 7cc3b38e3..0cccd97a6 100644
--- a/Examples/test-suite/go/typemap_out_optimal_runme.go
+++ b/Examples/test-suite/go/typemap_out_optimal_runme.go
@@ -1,6 +1,6 @@
package main
-import . "typemap_out_optimal"
+import . "swigtests/typemap_out_optimal"
func main() {
SetXXDebug(false)
diff --git a/Examples/test-suite/go/typename_runme.go b/Examples/test-suite/go/typename_runme.go
index d1665099c..1e1696d0a 100644
--- a/Examples/test-suite/go/typename_runme.go
+++ b/Examples/test-suite/go/typename_runme.go
@@ -1,6 +1,6 @@
package main
-import "typename"
+import "swigtests/typename"
func main() {
f := typename.NewFoo()
diff --git a/Examples/test-suite/go/unions_runme.go b/Examples/test-suite/go/unions_runme.go
index b76ca5c75..6e2981192 100644
--- a/Examples/test-suite/go/unions_runme.go
+++ b/Examples/test-suite/go/unions_runme.go
@@ -3,7 +3,7 @@
package main
-import "unions"
+import "swigtests/unions"
func main() {
// Create new instances of SmallStruct and BigStruct for later use
diff --git a/Examples/test-suite/go/using1_runme.go b/Examples/test-suite/go/using1_runme.go
index a6a6fa738..09cc381cc 100644
--- a/Examples/test-suite/go/using1_runme.go
+++ b/Examples/test-suite/go/using1_runme.go
@@ -1,6 +1,6 @@
package main
-import "using1"
+import "swigtests/using1"
func main() {
if using1.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/using2_runme.go b/Examples/test-suite/go/using2_runme.go
index f6b8d49b5..8109037f9 100644
--- a/Examples/test-suite/go/using2_runme.go
+++ b/Examples/test-suite/go/using2_runme.go
@@ -1,6 +1,6 @@
package main
-import "using2"
+import "swigtests/using2"
func main() {
if using2.Spam(37) != 37 {
diff --git a/Examples/test-suite/go/using_composition_runme.go b/Examples/test-suite/go/using_composition_runme.go
index 712d1fad5..7ef09fef9 100644
--- a/Examples/test-suite/go/using_composition_runme.go
+++ b/Examples/test-suite/go/using_composition_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_composition"
+import . "swigtests/using_composition"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_extend_runme.go b/Examples/test-suite/go/using_extend_runme.go
index 27d1ccc62..dac300ba4 100644
--- a/Examples/test-suite/go/using_extend_runme.go
+++ b/Examples/test-suite/go/using_extend_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_extend"
+import . "swigtests/using_extend"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_inherit_runme.go b/Examples/test-suite/go/using_inherit_runme.go
index a88171817..c8755902f 100644
--- a/Examples/test-suite/go/using_inherit_runme.go
+++ b/Examples/test-suite/go/using_inherit_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_inherit"
+import . "swigtests/using_inherit"
func main() {
b := NewBar()
diff --git a/Examples/test-suite/go/using_private_runme.go b/Examples/test-suite/go/using_private_runme.go
index 2da62dc2e..4c86ef514 100644
--- a/Examples/test-suite/go/using_private_runme.go
+++ b/Examples/test-suite/go/using_private_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_private"
+import . "swigtests/using_private"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/using_protected_runme.go b/Examples/test-suite/go/using_protected_runme.go
index 3fd5029f7..431081827 100644
--- a/Examples/test-suite/go/using_protected_runme.go
+++ b/Examples/test-suite/go/using_protected_runme.go
@@ -1,6 +1,6 @@
package main
-import . "using_protected"
+import . "swigtests/using_protected"
func main() {
f := NewFooBar()
diff --git a/Examples/test-suite/go/varargs_overload_runme.go b/Examples/test-suite/go/varargs_overload_runme.go
index 8ce580d65..50a430894 100644
--- a/Examples/test-suite/go/varargs_overload_runme.go
+++ b/Examples/test-suite/go/varargs_overload_runme.go
@@ -1,6 +1,6 @@
package main
-import "varargs_overload"
+import "swigtests/varargs_overload"
func main() {
if varargs_overload.Vararg_over1("Hello") != "Hello" {
diff --git a/Examples/test-suite/go/varargs_runme.go b/Examples/test-suite/go/varargs_runme.go
index 60bd8829a..eb2fa94aa 100644
--- a/Examples/test-suite/go/varargs_runme.go
+++ b/Examples/test-suite/go/varargs_runme.go
@@ -1,6 +1,6 @@
package main
-import "varargs"
+import "swigtests/varargs"
func main() {
if varargs.Test("Hello") != "Hello" {
diff --git a/Examples/test-suite/go/virtual_derivation_runme.go b/Examples/test-suite/go/virtual_derivation_runme.go
index 4e2c6e585..21135308c 100644
--- a/Examples/test-suite/go/virtual_derivation_runme.go
+++ b/Examples/test-suite/go/virtual_derivation_runme.go
@@ -1,6 +1,6 @@
package main
-import . "virtual_derivation"
+import . "swigtests/virtual_derivation"
// very innocent example
diff --git a/Examples/test-suite/go/virtual_poly_runme.go b/Examples/test-suite/go/virtual_poly_runme.go
index 32906b391..9973f24c7 100644
--- a/Examples/test-suite/go/virtual_poly_runme.go
+++ b/Examples/test-suite/go/virtual_poly_runme.go
@@ -1,6 +1,6 @@
package main
-import "virtual_poly"
+import "swigtests/virtual_poly"
func main() {
d := virtual_poly.NewNDouble(3.5)
diff --git a/Examples/test-suite/go/voidtest_runme.go b/Examples/test-suite/go/voidtest_runme.go
index 133545cea..35c5289fd 100644
--- a/Examples/test-suite/go/voidtest_runme.go
+++ b/Examples/test-suite/go/voidtest_runme.go
@@ -1,6 +1,6 @@
package main
-import "voidtest"
+import "swigtests/voidtest"
func main() {
voidtest.Globalfunc()
diff --git a/Examples/test-suite/go/wrapmacro_runme.go b/Examples/test-suite/go/wrapmacro_runme.go
index a251a05e8..d792d4ffe 100644
--- a/Examples/test-suite/go/wrapmacro_runme.go
+++ b/Examples/test-suite/go/wrapmacro_runme.go
@@ -1,6 +1,6 @@
package main
-import "wrapmacro"
+import "swigtests/wrapmacro"
func main() {
a := 2
diff --git a/Examples/test-suite/grouping.i b/Examples/test-suite/grouping.i
index 5632231d0..24acf6922 100644
--- a/Examples/test-suite/grouping.i
+++ b/Examples/test-suite/grouping.i
@@ -14,7 +14,7 @@ int *(test2)(int x) {
return &y;
}
-int (test3) = 37;
+int test3 = 37;
typedef Integer (UnaryOp)(Integer);
diff --git a/Examples/test-suite/import_nomodule.i b/Examples/test-suite/import_nomodule.i
index 60ef7e0f6..48e119517 100644
--- a/Examples/test-suite/import_nomodule.i
+++ b/Examples/test-suite/import_nomodule.i
@@ -8,7 +8,7 @@
%import "import_nomodule.h"
-#if !defined(SWIGJAVA) && !defined(SWIGRUBY) && !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGPYTHON_BUILTIN)
+#if !defined(SWIGJAVA) && !defined(SWIGRUBY) && !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGPYTHON_BUILTIN) && !defined(SWIGPHP)
/**
* The proxy class does not have Bar derived from Foo, yet an instance of Bar
@@ -16,8 +16,8 @@
* language modules).
*
* This violation of the type system is not possible in Java, C# and D due to
- * static type checking. It's also not (currently) possible in Ruby, but this may
- * be fixable (needs more investigation).
+ * static type checking. It's also not (currently) possible in PHP or Ruby, but
+ * this may be fixable (needs more investigation).
*/
%newobject create_Foo;
diff --git a/Examples/test-suite/java/CommentParser.java b/Examples/test-suite/java/CommentParser.java
index 7dc6d591d..1fc6f646a 100644
--- a/Examples/test-suite/java/CommentParser.java
+++ b/Examples/test-suite/java/CommentParser.java
@@ -1,5 +1,6 @@
-import com.sun.javadoc.*;
+import com.sun.source.doctree.*;
+import com.sun.source.util.DocTrees;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Map;
@@ -9,45 +10,120 @@ import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.*;
+import java.util.spi.ToolProvider;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.*;
+import jdk.javadoc.doclet.*;
-public class CommentParser {
+public class CommentParser implements Doclet {
private static Map m_parsedComments = new HashMap();
- public static boolean start(RootDoc root) {
+ // We need to implement these base class pure virtual methods.
+ @Override
+ public void init(Locale locale, Reporter reporter) {
+ }
+
+ @Override
+ public Set extends Option> getSupportedOptions() {
+ return new HashSet<>();
+ }
+
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latest();
+ }
+
+ @Override
+ public String getName() {
+ return "CommentParser";
+ }
+
+ // Element name must be the fully qualified name of the element.
+ //
+ // If there is no comment associated with this element, simply do nothing.
+ private void storeCommentFor(DocTrees docTrees, String fullName, Element e) {
+ DocCommentTree docCommentTree = docTrees.getDocCommentTree(e);
+ if (docCommentTree == null)
+ return;
+
+ StringBuilder name = new StringBuilder(fullName);
+
+ // We must use signature in the key for methods for compatibility with
+ // the existing tests and to allow distinguishing between overloaded
+ // methods.
+ if (e instanceof ExecutableElement) {
+ ExecutableElement ex = (ExecutableElement)e;
+ name.append("(");
+
+ boolean firstParam = true;
+ for (VariableElement p : ex.getParameters()) {
+ if (firstParam) {
+ firstParam = false;
+ } else {
+ name.append(", ");
+ }
+
+ name.append(p.asType().toString());
+ }
+
+ name.append(")");
+ }
+
+ // For some reason the comment in the source is split into "body" and
+ // "block tags" parts, so we need to concatenate them back together.
+ StringBuilder comment = new StringBuilder();
+ for (DocTree d : docCommentTree.getFullBody()) {
+ comment.append(d.toString());
+ comment.append("\n");
+ }
+
+ boolean firstBlockTag = true;
+ for (DocTree d : docCommentTree.getBlockTags()) {
+ if (firstBlockTag) {
+ firstBlockTag = false;
+ comment.append("\n");
+ }
+
+ comment.append(d.toString());
+ comment.append("\n");
+ }
+
+ m_parsedComments.put(name.toString(), comment.toString());
+ }
+
+ @Override
+ public boolean run(DocletEnvironment docEnv) {
/*
* This method is called by 'javadoc' and gets the whole parsed java
* file, we get comments and store them
*/
+ DocTrees docTrees = docEnv.getDocTrees();
+ for (TypeElement t : ElementFilter.typesIn(docEnv.getIncludedElements())) {
+ String typeName = t.getQualifiedName().toString();
- for (ClassDoc classDoc : root.classes()) {
+ storeCommentFor(docTrees, typeName, t);
- if (classDoc.getRawCommentText().length() > 0)
- m_parsedComments.put(classDoc.qualifiedName(), classDoc.getRawCommentText());
+ for (Element e : t.getEnclosedElements()) {
+ // Omit the method name for ctors: this is a bit weird, but
+ // this is what the existing tests expect.
+ String fullName = typeName;
+ if (e.getKind() != ElementKind.CONSTRUCTOR) {
+ fullName = fullName + "." + e.getSimpleName();
+ }
- for (FieldDoc f : classDoc.enumConstants()) {
- if (f.getRawCommentText().length() > 0)
- m_parsedComments.put(f.qualifiedName(), f.getRawCommentText());
- }
- for (FieldDoc f : classDoc.fields()) {
- if (f.getRawCommentText().length() > 0)
- m_parsedComments.put(f.qualifiedName(), f.getRawCommentText());
- }
- for (ConstructorDoc c : classDoc.constructors()) {
- if (c.getRawCommentText().length() > 0)
- m_parsedComments.put(c.toString(), c.getRawCommentText());
- }
- for (MethodDoc m : classDoc.methods()) {
- if (m.getRawCommentText().length() > 0)
- m_parsedComments.put(m.toString(), m.getRawCommentText());
+ storeCommentFor(docTrees, fullName, e);
}
}
+
return true;
}
- public int check(Map wantedComments) {
+ public static int check(Map wantedComments) {
int errorCount=0;
Iterator> it = m_parsedComments.entrySet().iterator();
@@ -93,13 +169,14 @@ public class CommentParser {
System.out.println("Output is also saved to files '" + expectedFileName +
"' and '" + gotFileName + "'");
// here we print original strings, for nicer output
- System.out.println("\n\n---\nexpected:\n" + wantedComments.get(e.getKey()));
+ System.out.println("\n\n---\nexpected:\n" + wantedStr);
System.out.println("\n\n---\ngot:\n" + e.getValue());
try {
// write expected string to file
BufferedWriter expectedFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(expectedFileName)));
- expectedFile.write(wantedComments.get(e.getKey()));
+ if (wantedStr != null)
+ expectedFile.write(wantedStr);
expectedFile.close();
// write translated string to file
@@ -130,7 +207,7 @@ public class CommentParser {
}
- private void printKeys(Map map) {
+ private static void printKeys(Map map) {
Set keys = map.keySet();
for (String key : keys) {
@@ -154,6 +231,15 @@ public class CommentParser {
}
}
+ public static void parse(String sourcefile) {
+ ToolProvider javadoc = ToolProvider.findFirst("javadoc").orElseThrow();
+ int result = javadoc.run(System.out, System.err, new String[]{"-quiet", "-doclet", "CommentParser", sourcefile});
+ if (result != 0) {
+ System.err.println("Executing javadoc failed.");
+ System.exit(result);
+ }
+ }
+
public static void main(String argv[]) {
@@ -162,8 +248,7 @@ public class CommentParser {
System.exit(1);
}
- com.sun.tools.javadoc.Main.execute("The comment parser program",
- "CommentParser", new String[]{"-quiet", argv[0]});
+ parse(argv[0]);
// if we are run as standalone app, print the list of found comments as it would appear in java source
diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in
index 2e788fa07..e2a3d2472 100644
--- a/Examples/test-suite/java/Makefile.in
+++ b/Examples/test-suite/java/Makefile.in
@@ -9,6 +9,7 @@ JAVAFLAGS = @JAVAFLAGS@
JAVA_CLASSPATH_SEP = @JAVA_CLASSPATH_SEP@
JAVA_TOOLS_JAR = @JAVA_TOOLS_JAR@
SCRIPTSUFFIX = _runme.java
+SKIP_DOXYGEN_TEST_CASES = @JAVA_SKIP_DOXYGEN_TEST_CASES@
srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
@@ -43,8 +44,8 @@ CPP_TEST_CASES = \
java_throws \
java_typemaps_proxy \
java_typemaps_typewrapper \
+ nested_scope \
li_std_list \
- li_std_map \
li_std_set \
# li_boost_intrusive_ptr
@@ -52,6 +53,7 @@ CPP11_TEST_CASES = \
cpp11_shared_ptr_const \
cpp11_shared_ptr_nullptr_in_containers \
cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_template_upcast \
cpp11_shared_ptr_upcast \
cpp11_std_unordered_map \
cpp11_std_unordered_set \
@@ -108,13 +110,11 @@ setup = \
mkdir $(JAVA_PACKAGE); \
fi
-# Doxygen test cases need to be compiled together with the CommentParser class
-# which depends on com.sun.javadoc package which is located in this JAR.
+# Doxygen test cases need to be compiled together with the CommentParser class.
CommentParser.class:
$(COMPILETOOL) $(JAVAC) -classpath $(JAVA_CLASSPATH) -d . $(srcdir)/CommentParser.java
JAVA_CLASSPATH := .
-$(DOXYGEN_TEST_CASES:=.cpptest): JAVA_CLASSPATH := "$(JAVA_TOOLS_JAR)$(JAVA_CLASSPATH_SEP)."
$(DOXYGEN_TEST_CASES:=.cpptest): CommentParser.class
# Compiles java files then runs the testcase. A testcase is only run if
diff --git a/Examples/test-suite/java/cpp11_shared_ptr_template_upcast_runme.java b/Examples/test-suite/java/cpp11_shared_ptr_template_upcast_runme.java
new file mode 100644
index 000000000..2826f580d
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_shared_ptr_template_upcast_runme.java
@@ -0,0 +1,24 @@
+// This is the cpp11_shared_ptr_template_upcast runtime testcase. It checks that SWIG generates the appropriate upcasted shared_ptr type for a template instantiation deriving from a base class.
+// For this case, the expected behavior is: given a cptr with underlying type shared_ptr >, PrintableDerived_SWIGSmartPtrUpcast returns a cptr with
+// underlying type std::shared_ptr< Derived >, where Printable inherits from Derived.
+
+import cpp11_shared_ptr_template_upcast.*;
+
+public class cpp11_shared_ptr_template_upcast_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_shared_ptr_template_upcast");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ PrintableDerived pd = cpp11_shared_ptr_template_upcast.MakePrintableDerived(20);
+ pd.GetResult();
+ pd.GetFormatted();
+ }
+}
+
diff --git a/Examples/test-suite/java/director_string_runme.java b/Examples/test-suite/java/director_string_runme.java
index a6ed67100..67cb0fe60 100644
--- a/Examples/test-suite/java/director_string_runme.java
+++ b/Examples/test-suite/java/director_string_runme.java
@@ -19,7 +19,7 @@ public class director_string_runme {
director_string_A c = new director_string_A("hi");
for (int i=0; i<3; i++) {
s = c.call_get(i);
- if (!s.equals(new Integer(i).toString())) throw new RuntimeException("director_string_A.get(" + i + ") failed. Got:" + s);
+ if (!s.equals(Integer.valueOf(i).toString())) throw new RuntimeException("director_string_A.get(" + i + ") failed. Got:" + s);
}
director_string_B b = new director_string_B("hello");
@@ -50,7 +50,7 @@ class director_string_A extends A {
super(first);
}
public String get(int n) {
- return new Integer(n).toString();
+ return Integer.valueOf(n).toString();
}
}
diff --git a/Examples/test-suite/java/doxygen_alias_runme.java b/Examples/test-suite/java/doxygen_alias_runme.java
index e21ed6d19..98cd97752 100644
--- a/Examples/test-suite/java/doxygen_alias_runme.java
+++ b/Examples/test-suite/java/doxygen_alias_runme.java
@@ -1,6 +1,5 @@
import doxygen_alias.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_alias_runme {
@@ -15,10 +14,7 @@ public class doxygen_alias_runme {
public static void main(String argv[])
{
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_alias runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_alias"});
+ CommentParser.parse("doxygen_alias");
HashMap wantedComments = new HashMap();
wantedComments.put("doxygen_alias.doxygen_alias.make_something()",
@@ -27,6 +23,6 @@ public class doxygen_alias_runme {
" @return A new object which may be null.\n" +
"");
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_basic_notranslate_runme.java b/Examples/test-suite/java/doxygen_basic_notranslate_runme.java
index e3d9b0279..621cc9eef 100644
--- a/Examples/test-suite/java/doxygen_basic_notranslate_runme.java
+++ b/Examples/test-suite/java/doxygen_basic_notranslate_runme.java
@@ -1,6 +1,5 @@
import doxygen_basic_notranslate.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_basic_notranslate_runme {
@@ -15,14 +14,7 @@ public class doxygen_basic_notranslate_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_basic_notranslate runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_basic_notranslate"});
+ CommentParser.parse("doxygen_basic_notranslate");
HashMap wantedComments = new HashMap();
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function3(int)",
@@ -97,6 +89,6 @@ public class doxygen_basic_notranslate_runme {
"");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java
index ab343b560..c64262a67 100644
--- a/Examples/test-suite/java/doxygen_basic_translate_runme.java
+++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java
@@ -1,6 +1,5 @@
import doxygen_basic_translate.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_basic_translate_runme {
@@ -15,14 +14,7 @@ public class doxygen_basic_translate_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_basic_translate runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_basic_translate"});
+ CommentParser.parse("doxygen_basic_translate");
HashMap wantedComments = new HashMap();
@@ -94,8 +86,15 @@ public class doxygen_basic_translate_runme {
" @param x Horizontal coordinate.\n" +
" @return Arc tangent of y/x.\n" +
"");
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function8()",
+ " Test variadic function\n" +
+ "");
+
+ wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function9(int)",
+ " Test unnamed argument\n" +
+ "");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java b/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
index 05e51cff8..28cf2daba 100644
--- a/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
+++ b/Examples/test-suite/java/doxygen_basic_translate_style2_runme.java
@@ -1,6 +1,5 @@
import doxygen_basic_translate_style2.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_basic_translate_style2_runme {
@@ -15,14 +14,7 @@ public class doxygen_basic_translate_style2_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_basic_translate_style2 runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_basic_translate_style2"});
+ CommentParser.parse("doxygen_basic_translate_style2");
HashMap wantedComments = new HashMap();
@@ -96,6 +88,6 @@ public class doxygen_basic_translate_style2_runme {
"");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_basic_translate_style3_runme.java b/Examples/test-suite/java/doxygen_basic_translate_style3_runme.java
new file mode 100644
index 000000000..a0953644a
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_basic_translate_style3_runme.java
@@ -0,0 +1,93 @@
+
+import doxygen_basic_translate_style3.*;
+import java.util.HashMap;
+
+public class doxygen_basic_translate_style3_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_basic_translate_style3");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ CommentParser.parse("doxygen_basic_translate_style3");
+
+ HashMap wantedComments = new HashMap();
+
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function()",
+ " \n" +
+ " Brief description.\n" +
+ " \n" +
+ " The comment text.\n" +
+ " @author Some author\n" +
+ " @return Some number\n" +
+ " @see function2\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function2()",
+ " A test of a very very very very very very very very very very very very very very very very \n" +
+ " very very very very very long comment string. \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function4()",
+ " A test of some mixed tag usage \n" +
+ " If: CONDITION {\n" +
+ " This code fragment shows us something . \n" +
+ " \n" +
+ " - it's senseless \n" +
+ "
- it's stupid \n" +
+ "
- it's null \n" +
+ " \n" +
+ "
Warning: This may not work as expected \n" +
+ " \n" +
+ " {@code \n" +
+ "int main() { while(true); } \n" +
+ "\n" +
+ "int testBlankLine() {} \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function3(int)",
+ " A test for overloaded functions \n" +
+ " This is function one \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function5(int)",
+ " This is a post comment. \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function6(int)",
+ " Test for default args \n" +
+ " @param a Some parameter, default is 42" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function6()",
+ " Test for default args \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function7(doxygen_basic_translate_style3.SWIGTYPE_p_p_p_Shape)",
+ " Test for a parameter with difficult type \n" +
+ " (mostly for python) \n" +
+ " @param a Very strange param \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.function3(int, int)",
+ " A test for overloaded functions \n" +
+ " This is function two \n" +
+ " \n" +
+ "");
+ wantedComments.put("doxygen_basic_translate_style3.doxygen_basic_translate_style3.Atan2(double, double)",
+ " Multiple parameters test.\n" +
+ " \n" +
+ " @param y Vertical coordinate.\n" +
+ " @param x Horizontal coordinate.\n" +
+ " @return Arc tangent of y/x.\n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(CommentParser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_code_blocks_runme.java b/Examples/test-suite/java/doxygen_code_blocks_runme.java
new file mode 100644
index 000000000..8e8373b78
--- /dev/null
+++ b/Examples/test-suite/java/doxygen_code_blocks_runme.java
@@ -0,0 +1,75 @@
+
+import doxygen_code_blocks.*;
+import java.util.HashMap;
+
+public class doxygen_code_blocks_runme {
+ static {
+ try {
+ System.loadLibrary("doxygen_code_blocks");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ CommentParser.parse("doxygen_code_blocks");
+
+ HashMap wantedComments = new HashMap();
+
+ wantedComments.put("doxygen_code_blocks.doxygen_code_blocks.function()",
+ " Test for code blocks\n \n" +
+ " \n \n" +
+ " {@code \n" +
+ " simple code block \n" +
+ " }\n \n" +
+ " \n \n" +
+ " More advanced usage with C++ characters:\n \n" +
+ " {@code \n" +
+ " std::vector first; // empty vector of ints \n" +
+ " std::vector second (4,100); // four ints with value 100 \n" +
+ " std::vector third (second.begin(),second.end()); // iterating through second \n" +
+ " std::vector fourth (third); // a copy of third \n" +
+ " // the iterator constructor can also be used to construct from arrays: \n" +
+ " int myints[] = {16,2,77,29}; \n" +
+ " std::vector fifth (myints, myints + sizeof(myints) / sizeof(int) ); \n" +
+ " \n" +
+ " std::cout << \"The contents of fifth are:\"; \n" +
+ " for (std::vector::iterator it = fifth.begin(); it != fifth.end(); ++it) \n" +
+ " std::cout << \' \' << *it; \n" +
+ " std::cout << \'\\n\'; \n" +
+ " }\n \n" +
+ " \n \n" +
+ " A code block for C:\n \n" +
+ " {@code \n" +
+ " printf(\"hello world\"); \n" +
+ " }\n \n" +
+ " \n \n" +
+ " A code block for Java:\n \n" +
+ " {@code \n" +
+ " public class HelloWorld { \n" +
+ " public static void main(String[] args) { \n" +
+ " // Prints \"Hello, World\" to the terminal window. \n" +
+ " System.out.println(\"Hello, World\"); \n" +
+ " } \n" +
+ " } \n" +
+ " }\n \n" +
+ " \n \n" +
+ " A code block for python:\n \n" +
+ " {@code \n" +
+ " print(\'hello world\') \n" +
+ " }\n \n" +
+ " \n \n" +
+ " A python doctest example:\n \n" +
+ " {@code \n" +
+ " >>> 1 + 1 \n" +
+ " 2 \n" +
+ " } \n" +
+ " \n" +
+ "");
+
+ // and ask the parser to check comments for us
+ System.exit(CommentParser.check(wantedComments));
+ }
+}
diff --git a/Examples/test-suite/java/doxygen_ignore_runme.java b/Examples/test-suite/java/doxygen_ignore_runme.java
index 6250ce525..29b6e0640 100644
--- a/Examples/test-suite/java/doxygen_ignore_runme.java
+++ b/Examples/test-suite/java/doxygen_ignore_runme.java
@@ -1,6 +1,5 @@
import doxygen_ignore.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_ignore_runme {
@@ -15,10 +14,7 @@ public class doxygen_ignore_runme {
public static void main(String argv[])
{
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_ignore runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_ignore"});
+ CommentParser.parse("doxygen_ignore");
HashMap wantedComments = new HashMap();
wantedComments.put("doxygen_ignore.doxygen_ignore.func()",
@@ -39,6 +35,6 @@ public class doxygen_ignore_runme {
"\n" +
"");
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_misc_constructs_runme.java b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
index 5d95bd565..cae2b2192 100644
--- a/Examples/test-suite/java/doxygen_misc_constructs_runme.java
+++ b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
@@ -1,6 +1,5 @@
import doxygen_misc_constructs.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_misc_constructs_runme {
@@ -15,14 +14,7 @@ public class doxygen_misc_constructs_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_misc_constructs runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_misc_constructs"});
+ CommentParser.parse("doxygen_misc_constructs");
HashMap wantedComments = new HashMap();
@@ -193,8 +185,14 @@ public class doxygen_misc_constructs_runme {
"\n" +
" @param fileName name of the log file\n");
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.doc_ends_with_quote()",
+ "This doc comment ends with a quote: \"and that's ok\"");
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.doc_with_triple_quotes()",
+ "This comment contains embedded triple-quoted string:\n" +
+ "\"\"\"How quaint\"\"\"");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_nested_class_runme.java b/Examples/test-suite/java/doxygen_nested_class_runme.java
index 3ffa796f0..e9d1a068e 100644
--- a/Examples/test-suite/java/doxygen_nested_class_runme.java
+++ b/Examples/test-suite/java/doxygen_nested_class_runme.java
@@ -1,5 +1,4 @@
import doxygen_nested_class.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_nested_class_runme {
@@ -14,14 +13,7 @@ public class doxygen_nested_class_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_nested_class runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_nested_class"});
+ CommentParser.parse("doxygen_nested_class");
HashMap wantedComments = new HashMap();
@@ -43,6 +35,6 @@ public class doxygen_nested_class_runme {
" doxShort const variable ");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java
index ef1f06af5..6b1e2b08e 100644
--- a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java
@@ -1,6 +1,5 @@
import doxygen_parsing_enums_proper.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_enums_proper_runme {
@@ -15,14 +14,7 @@ public class doxygen_parsing_enums_proper_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_proper runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_parsing_enums_proper"});
+ CommentParser.parse("doxygen_parsing_enums_proper");
HashMap wantedComments = new HashMap();
@@ -61,6 +53,6 @@ public class doxygen_parsing_enums_proper_runme {
"Post comment after last comma.");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java
index 85ec0cb55..1e0dd74ee 100644
--- a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java
@@ -1,6 +1,5 @@
import doxygen_parsing_enums_simple.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_enums_simple_runme {
@@ -15,14 +14,7 @@ public class doxygen_parsing_enums_simple_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_simple runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_parsing_enums_simple"});
+ CommentParser.parse("doxygen_parsing_enums_simple");
HashMap wantedComments = new HashMap();
@@ -53,6 +45,6 @@ public class doxygen_parsing_enums_simple_runme {
"Post comment after last comma.");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java
index 4e5f4b489..7cf3b17ef 100644
--- a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java
@@ -1,6 +1,5 @@
import doxygen_parsing_enums_typesafe.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_enums_typesafe_runme {
@@ -15,14 +14,7 @@ public class doxygen_parsing_enums_typesafe_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typesafe runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_parsing_enums_typesafe"});
+ CommentParser.parse("doxygen_parsing_enums_typesafe");
HashMap wantedComments = new HashMap();
@@ -62,6 +54,6 @@ public class doxygen_parsing_enums_typesafe_runme {
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java
index 428649196..3a41fe56f 100644
--- a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java
@@ -1,6 +1,5 @@
import doxygen_parsing_enums_typeunsafe.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_enums_typeunsafe_runme {
@@ -15,14 +14,7 @@ public class doxygen_parsing_enums_typeunsafe_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typeunsafe runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_parsing_enums_typeunsafe"});
+ CommentParser.parse("doxygen_parsing_enums_typeunsafe");
HashMap wantedComments = new HashMap();
@@ -61,6 +53,6 @@ public class doxygen_parsing_enums_typeunsafe_runme {
"Post comment after last comma.");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java
index d58b1f486..29e524f78 100644
--- a/Examples/test-suite/java/doxygen_parsing_runme.java
+++ b/Examples/test-suite/java/doxygen_parsing_runme.java
@@ -1,6 +1,5 @@
import doxygen_parsing.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_runme {
@@ -15,14 +14,7 @@ public class doxygen_parsing_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_parsing runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_parsing"});
+ CommentParser.parse("doxygen_parsing");
HashMap wantedComments = new HashMap();
@@ -53,6 +45,12 @@ public class doxygen_parsing_runme {
" The struct comment \n" +
" \n" +
"");
+ wantedComments.put("doxygen_parsing.SomeStruct.setWidth(int)",
+ "**immutable** image width in pixels \n" +
+ "");
+ wantedComments.put("doxygen_parsing.SomeStruct.getWidth()",
+ "**immutable** image width in pixels \n" +
+ "");
wantedComments.put("doxygen_parsing.doxygen_parsing.setSomeVar(int)",
" The var comment \n" +
" \n" +
@@ -136,6 +134,6 @@ public class doxygen_parsing_runme {
"");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
index d5c533f4e..56272bf84 100644
--- a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
+++ b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
@@ -1,6 +1,5 @@
import doxygen_translate_all_tags.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_translate_all_tags_runme {
@@ -15,14 +14,7 @@ public class doxygen_translate_all_tags_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_translate_all_tags runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_translate_all_tags"});
+ CommentParser.parse("doxygen_translate_all_tags");
HashMap wantedComments = new HashMap();
@@ -101,10 +93,10 @@ public class doxygen_translate_all_tags_runme {
" - With lots of items \n" +
"
- lots of lots of items \n" +
"
\n" +
- " {@link someMember Some description follows }\n" +
+ " {@link someMember Some description follows} with text after\n" +
" This will only appear in man\n");
- wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func07(int)",
+ wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func07(int, int, int, int)",
" Comment for func07().\n" +
" Note: Here \n" +
" is the note! \n" +
@@ -115,7 +107,10 @@ public class doxygen_translate_all_tags_runme {
" The paragraph text. \n" +
" Maybe even multiline \n" +
" \n" +
- " @param a the first param\n");
+ " @param a the first param\n" +
+ " @param b parameter with intent(in)\n" +
+ " @param c parameter with intent(out)\n" +
+ " @param d parameter with intent(in,out)\n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func08(int)",
"\n" +
@@ -154,6 +149,6 @@ public class doxygen_translate_all_tags_runme {
" And here goes simple text \n" +
"");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/doxygen_translate_links_runme.java b/Examples/test-suite/java/doxygen_translate_links_runme.java
index 6d74e16fe..afee4eac6 100644
--- a/Examples/test-suite/java/doxygen_translate_links_runme.java
+++ b/Examples/test-suite/java/doxygen_translate_links_runme.java
@@ -1,6 +1,5 @@
import doxygen_translate_links.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_translate_links_runme {
@@ -15,14 +14,7 @@ public class doxygen_translate_links_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_translate_links runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_translate_links"});
+ CommentParser.parse("doxygen_translate_links");
HashMap wantedComments = new HashMap();
@@ -64,6 +56,6 @@ public class doxygen_translate_links_runme {
"");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
\ No newline at end of file
diff --git a/Examples/test-suite/java/doxygen_translate_runme.java b/Examples/test-suite/java/doxygen_translate_runme.java
index 55e5d23d3..b049a6466 100644
--- a/Examples/test-suite/java/doxygen_translate_runme.java
+++ b/Examples/test-suite/java/doxygen_translate_runme.java
@@ -1,6 +1,5 @@
import doxygen_translate.*;
-import com.sun.javadoc.*;
import java.util.HashMap;
import java.util.Map;
@@ -16,14 +15,7 @@ public class doxygen_translate_runme {
public static void main(String argv[])
{
- /*
- Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
- and calls the start() method of that class with parsed information.
- */
- CommentParser parser = new CommentParser();
- com.sun.tools.javadoc.Main.execute("doxygen_translate runtime test",
- "CommentParser",
- new String[]{"-quiet", "doxygen_translate"});
+ CommentParser.parse("doxygen_translate");
Map wantedComments = new HashMap();
@@ -274,6 +266,6 @@ public class doxygen_translate_runme {
"");
// and ask the parser to check comments for us
- System.exit(parser.check(wantedComments));
+ System.exit(CommentParser.check(wantedComments));
}
}
diff --git a/Examples/test-suite/java/multiple_inheritance_abstract_runme.java b/Examples/test-suite/java/multiple_inheritance_abstract_runme.java
index 1489d92a7..4230e7b9a 100644
--- a/Examples/test-suite/java/multiple_inheritance_abstract_runme.java
+++ b/Examples/test-suite/java/multiple_inheritance_abstract_runme.java
@@ -224,6 +224,7 @@ public class multiple_inheritance_abstract_runme {
check(multiple_inheritance_abstract.InputCPtrRefBottom1(b1)!=103+104, "InputCPtrRefBottom1() failed");
check(multiple_inheritance_abstract.InputCPtrRefBottom2(b2)!=206+205, "InputCPtrRefBottom2() failed");
check(multiple_inheritance_abstract.InputCPtrRefBottom3(b3)!=307+308+309, "InputCPtrRefBottom3() failed");
+
// Return pointers
check(multiple_inheritance_abstract.MakePtrDerived1_CBase1().cbase1y()!=3, "MakePtrDerived1_CBase1 failed");
check(multiple_inheritance_abstract.MakePtrDerived1_CBase2().cbase2()!=4, "MakePtrDerived1_CBase2 failed");
@@ -242,6 +243,15 @@ public class multiple_inheritance_abstract_runme {
check(multiple_inheritance_abstract.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_abstract.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_abstract.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_abstract.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_abstract.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/java/multiple_inheritance_nspace_runme.java b/Examples/test-suite/java/multiple_inheritance_nspace_runme.java
index 461c7a131..ed2d3377a 100644
--- a/Examples/test-suite/java/multiple_inheritance_nspace_runme.java
+++ b/Examples/test-suite/java/multiple_inheritance_nspace_runme.java
@@ -244,6 +244,15 @@ public class multiple_inheritance_nspace_runme {
check(multiple_inheritance_nspace.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_nspace.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_nspace.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_nspace.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_nspace.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java b/Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java
index 6472a911e..910913027 100644
--- a/Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java
+++ b/Examples/test-suite/java/multiple_inheritance_shared_ptr_runme.java
@@ -309,6 +309,15 @@ public class multiple_inheritance_shared_ptr_runme {
check(multiple_inheritance_shared_ptr.MakeRefDerived3_CBase1().cbase1y()!=7, "MakeRefDerived3_CBase1 failed");
check(multiple_inheritance_shared_ptr.MakeRefDerived3_CBase2().cbase2()!=8, "MakeRefDerived3_CBase2 failed");
+ // Return const pointer references
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived1_CBase1().cbase1y()!=3, "MakeConstPtrRefDerived1_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived1_CBase2().cbase2()!=4, "MakeConstPtrRefDerived1_CBase2 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived2_CBase1().cbase1y()!=6, "MakeConstPtrRefDerived2_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived2_ABase1().abase1()!=5, "MakeConstPtrRefDerived2_ABase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_ABase1().abase1()!=9, "MakeConstPtrRefDerived3_ABase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_CBase1().cbase1y()!=7, "MakeConstPtrRefDerived3_CBase1 failed");
+ check(multiple_inheritance_shared_ptr.MakeConstPtrRefDerived3_CBase2().cbase2()!=8, "MakeConstPtrRefDerived3_CBase2 failed");
+
// Return by value (sliced objects)
check(multiple_inheritance_shared_ptr.MakeValDerived1_CBase1().cbase1y()!=1, "MakeValDerived1_CBase1 failed");
check(multiple_inheritance_shared_ptr.MakeValDerived1_CBase2().cbase2()!=2, "MakeValDerived1_CBase2 failed");
diff --git a/Examples/test-suite/java/rname_runme.java b/Examples/test-suite/java/rname_runme.java
index dac0a1ecf..4af6581c2 100644
--- a/Examples/test-suite/java/rname_runme.java
+++ b/Examples/test-suite/java/rname_runme.java
@@ -25,7 +25,7 @@ public class rname_runme {
bar.foo_u((long)10);
RenamedBase base = new RenamedBase();
- base.fn(base, base, base);
+ base.fn1(base, base, base);
if (!base.newname(10.0).equals("Base"))
throw new RuntimeException("base.newname");
diff --git a/Examples/test-suite/java/template_nested_flat_runme.java b/Examples/test-suite/java/template_nested_flat_runme.java
new file mode 100644
index 000000000..023c18590
--- /dev/null
+++ b/Examples/test-suite/java/template_nested_flat_runme.java
@@ -0,0 +1,35 @@
+
+import template_nested_flat.*;
+
+public class template_nested_flat_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_nested_flat");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ new T_NormalTemplateNormalClass().tmethod(new NormalClass());
+ new OuterClass().T_OuterTMethodNormalClass(new NormalClass());
+
+ TemplateFuncs tf = new TemplateFuncs();
+ if (tf.T_TemplateFuncs1Int(-10) != -10)
+ throw new RuntimeException("it failed");
+ if (tf.T_TemplateFuncs2Double(-12.3) != -12.3)
+ throw new RuntimeException("it failed");
+
+ T_NestedOuterTemplateDouble tn = new T_NestedOuterTemplateDouble();
+ if (tn.hohum(-12.3) != -12.3)
+ throw new RuntimeException("it failed");
+ T_OuterClassInner1Int inner1 = new OuterClass().useInner1(new T_OuterClassInner1Int());
+ T_OuterClassInner2NormalClass inner2 = new T_OuterClassInner2NormalClass();
+ inner2.setEmbeddedVar(2);
+ T_OuterClassInner2NormalClass inner22 = new OuterClass().useInner2Again(inner2);
+ T_OuterClassInner1Double inner3 = new T_OuterClassInner1Double();
+ }
+}
+
diff --git a/Examples/test-suite/java/template_template_parameters_runme.java b/Examples/test-suite/java/template_template_parameters_runme.java
index 42135b982..613f9087c 100644
--- a/Examples/test-suite/java/template_template_parameters_runme.java
+++ b/Examples/test-suite/java/template_template_parameters_runme.java
@@ -14,15 +14,33 @@ public class template_template_parameters_runme {
}
public static void main(String argv[]) {
+ // Test first part
ListFastBool listBool = new ListFastBool();
listBool.setItem(true);
+ boolean x_boolean = listBool.getAllotype();
if (listBool.getItem() != true)
throw new RuntimeException("Failed");
ListDefaultDouble listDouble = new ListDefaultDouble();
listDouble.setItem(10.2);
+ double x_double = listDouble.getAllotype();
if (listDouble.getItem() != 10.2)
throw new RuntimeException("Failed");
+
+ // Test second part
+ FloatTestStruct floatTestStruct = new FloatTestStruct();
+ FloatContainer2 floatContainer2 = floatTestStruct.getX();
+ floatContainer2.setX(8.1f);
+ IntTestStruct intTestStruct = new IntTestStruct();
+ IntContainer1 intContainer1 = intTestStruct.getX();
+ intContainer1.setX(91);
+ if (intContainer1.getX() != 91)
+ throw new RuntimeException("Failed");
+ if (intTestStruct.getX().getX() != 91)
+ throw new RuntimeException("Failed");
+ IntTestStruct intTestStructReturned = template_template_parameters.TestStructContainer1Method(intTestStruct);
+ if (intTestStructReturned.getX().getX() != 101)
+ throw new RuntimeException("Failed");
}
}
diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
index 8127415f1..0e11f3d9d 100644
--- a/Examples/test-suite/javascript/Makefile.in
+++ b/Examples/test-suite/javascript/Makefile.in
@@ -13,6 +13,9 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
+CPP_TEST_CASES += \
+ javascript_lib_arrays \
+
SWIGEXE = $(top_builddir)/swig
SWIG_LIB_DIR = $(top_srcdir)/Lib
@@ -51,7 +54,10 @@ ifeq (node,$(JSENGINE))
# dunno... ignoring generously
apply_signed_char.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+ cpp11_ref_qualifiers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+ director_basic.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+ member_funcptr_galore.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
setup_node = \
test -d $* || mkdir $* && \
@@ -133,4 +139,5 @@ clean:
rm -f mod_a$${ext} mod_b$${ext}; \
rm -f multi_import_a$${ext} multi_import_b$${ext}; \
rm -f packageoption_a$${ext} packageoption_b$${ext} packageoption_c$${ext}; \
+ rm -f template_typedef_cplx2$${ext}; \
done
diff --git a/Examples/test-suite/javascript/class_scope_weird_runme.js b/Examples/test-suite/javascript/class_scope_weird_runme.js
index 73c118d61..ca18c1b4d 100644
--- a/Examples/test-suite/javascript/class_scope_weird_runme.js
+++ b/Examples/test-suite/javascript/class_scope_weird_runme.js
@@ -4,3 +4,14 @@ f = new class_scope_weird.Foo();
g = new class_scope_weird.Foo(3);
if (f.bar(3) != 3)
throw RuntimeError;
+
+// Test missing new keyword during constructor call
+var caughtException = false;
+try {
+ g = class_scope_weird.Foo(4);
+} catch (err) {
+ caughtException = true;
+}
+if (!caughtException) {
+ throw new Error("Instantiation exception not thrown");
+}
diff --git a/Examples/test-suite/javascript/inherit_missing_runme.js b/Examples/test-suite/javascript/inherit_missing_runme.js
new file mode 100644
index 000000000..05f5760e2
--- /dev/null
+++ b/Examples/test-suite/javascript/inherit_missing_runme.js
@@ -0,0 +1,19 @@
+var inherit_missing = require("inherit_missing");
+
+a = inherit_missing.new_Foo()
+b = new inherit_missing.Bar()
+c = new inherit_missing.Spam()
+
+x = inherit_missing.do_blah(a)
+if (x != "Foo::blah")
+ throw new Error("Whoa! Bad return {}".format(x))
+
+x = inherit_missing.do_blah(b)
+if (x != "Bar::blah")
+ throw new Error("Whoa! Bad return {}".format(x))
+
+x = inherit_missing.do_blah(c)
+if (x != "Spam::blah")
+ throw new Error("Whoa! Bad return {}".format(x))
+
+inherit_missing.delete_Foo(a)
diff --git a/Examples/test-suite/javascript/integers_runme.js b/Examples/test-suite/javascript/integers_runme.js
new file mode 100644
index 000000000..0356176ad
--- /dev/null
+++ b/Examples/test-suite/javascript/integers_runme.js
@@ -0,0 +1,18 @@
+var integers = require("integers");
+
+var val = 3902408827
+ret = integers.signed_long_identity(val)
+if (ret != val)
+ throw "Incorrect value: " + ret
+
+ret = integers.unsigned_long_identity(val)
+if (ret != val)
+ throw "Incorrect value: " + ret
+
+ret = integers.signed_long_long_identity(val)
+if (ret != val)
+ throw "Incorrect value: " + ret
+
+ret = integers.unsigned_long_long_identity(val)
+if (ret != val)
+ throw "Incorrect value: " + ret
diff --git a/Examples/test-suite/javascript/javascript_lib_arrays_runme.js b/Examples/test-suite/javascript/javascript_lib_arrays_runme.js
new file mode 100644
index 000000000..1eb586134
--- /dev/null
+++ b/Examples/test-suite/javascript/javascript_lib_arrays_runme.js
@@ -0,0 +1,20 @@
+var javascript_lib_arrays = require("javascript_lib_arrays");
+
+var arr = [1, 2, 3, 4, 5];
+
+function check(a, b) {
+ if (a !== b) {
+ throw new Error("Not equal: " + a + " " + b)
+ }
+}
+
+function check_array(a, b) {
+ if (a.length != b.length)
+ throw new Error("Array length mismatch " + a.length + " " + b.length)
+ if (!a.every(function(element, index) { return element === b[index]; }))
+ throw new Error("Arrays don't match a:" + a + " b:" + b)
+}
+
+check(15, javascript_lib_arrays.sum1(arr, arr.length));
+check(6, javascript_lib_arrays.sum2(arr));
+check_array([1, 2, 3, 4], javascript_lib_arrays.data3)
diff --git a/Examples/test-suite/javascript/li_typemaps_runme.js b/Examples/test-suite/javascript/li_typemaps_runme.js
new file mode 100644
index 000000000..c0b1b43b0
--- /dev/null
+++ b/Examples/test-suite/javascript/li_typemaps_runme.js
@@ -0,0 +1,50 @@
+var li_typemaps = require("li_typemaps");
+
+function check(a, b) {
+ if (a !== b) {
+ throw new Error("Not equal: " + a + " " + b)
+ }
+}
+
+function check_array(a, b) {
+ if (a.length != b.length)
+ throw new Error("Array length mismatch " + a.length + " " + b.length)
+ if (!a.every(function(element, index) { return element === b[index]; }))
+ throw new Error("Arrays don't match a:" + a + " b:" + b)
+}
+
+// Check double INPUT typemaps
+check(li_typemaps.in_double(22.22), 22.22)
+check(li_typemaps.inr_double(22.22), 22.22)
+
+// Check double OUTPUT typemaps
+check_array(li_typemaps.out_double(22.22), [22.22])
+check_array(li_typemaps.outr_double(22.22), [22.22])
+
+// Check double INOUT typemaps
+check_array(li_typemaps.inout_double(22.22), [22.22])
+check_array(li_typemaps.inoutr_double(22.22), [22.22])
+
+// check long long
+check(li_typemaps.in_ulonglong(20), 20)
+check(li_typemaps.inr_ulonglong(20), 20)
+check_array(li_typemaps.out_ulonglong(20), [20])
+check_array(li_typemaps.outr_ulonglong(20), [20])
+check_array(li_typemaps.inout_ulonglong(20), [20])
+check_array(li_typemaps.inoutr_ulonglong(20), [20])
+
+// check bools
+check(li_typemaps.in_bool(true), true)
+check(li_typemaps.inr_bool(false), false)
+check_array(li_typemaps.out_bool(true), [true])
+check_array(li_typemaps.outr_bool(false), [false])
+check_array(li_typemaps.inout_bool(true), [true])
+check_array(li_typemaps.inoutr_bool(false), [false])
+
+// the others
+check_array(li_typemaps.inoutr_int2(1,2), [1, 2])
+
+fi = li_typemaps.out_foo(10)
+check(fi[0].a, 10)
+check(fi[1], 20)
+check(fi[2], 30)
diff --git a/Examples/test-suite/javascript/native_directive_runme.js b/Examples/test-suite/javascript/native_directive_runme.js
new file mode 100644
index 000000000..5c1d69cf1
--- /dev/null
+++ b/Examples/test-suite/javascript/native_directive_runme.js
@@ -0,0 +1,9 @@
+var native_directive = require("native_directive");
+
+(function main() {
+ var s = "abc.DEF-123";
+ if (native_directive.CountAlphas(s) !== 6)
+ throw "CountAlphas failed";
+ if (native_directive.CountAlphaCharacters(s) !== 6)
+ throw "CountAlphaCharacters failed";
+})();
diff --git a/Examples/test-suite/javascript/types_directive_runme.js b/Examples/test-suite/javascript/types_directive_runme.js
new file mode 100644
index 000000000..f4f0a2b7a
--- /dev/null
+++ b/Examples/test-suite/javascript/types_directive_runme.js
@@ -0,0 +1,14 @@
+var types_directive = require("types_directive");
+
+d1 = new types_directive.Time1(2001, 2, 3, 60)
+// check that a Time1 instance is accepted where Date is expected
+newDate = types_directive.add(d1, 7)
+if (newDate.day != 10)
+ throw new Error("newDate mismatch")
+
+d2 = new types_directive.Time2(1999, 8, 7, 60)
+// check that a Time2 instance is accepted where Date is expected
+newDate = types_directive.add(d2, 7)
+if (newDate.day != 14)
+ throw new Error("newDate mismatch")
+
diff --git a/Examples/test-suite/javascript/virtual_derivation_runme.js b/Examples/test-suite/javascript/virtual_derivation_runme.js
new file mode 100644
index 000000000..be87a5d9a
--- /dev/null
+++ b/Examples/test-suite/javascript/virtual_derivation_runme.js
@@ -0,0 +1,8 @@
+var virtual_derivation = require("virtual_derivation");
+//
+// very innocent example
+//
+b = new virtual_derivation.B(3)
+if (b.get_a() != b.get_b())
+ throw new Error("something is really wrong")
+
diff --git a/Examples/test-suite/javascript_lib_arrays.i b/Examples/test-suite/javascript_lib_arrays.i
new file mode 100644
index 000000000..512084ad5
--- /dev/null
+++ b/Examples/test-suite/javascript_lib_arrays.i
@@ -0,0 +1,30 @@
+%module javascript_lib_arrays
+
+%include
+
+%apply int[] { int *data1 }
+%apply int[3] { int data2[3] }
+%apply int[4] { int data3[4] }
+
+%inline %{
+
+int sum1(int *data1, int size) {
+ int sum = 0;
+ for (int i = 0; i < size; i++) {
+ sum += data1[i];
+ }
+ return sum;
+}
+
+int sum2(int data2[3]) {
+ int sum = 0;
+ for (int i = 0; i < 3; i++) {
+ sum += data2[i];
+ }
+ return sum;
+}
+
+int data3[4] = {1, 2, 3, 4};
+
+%}
+
diff --git a/Examples/test-suite/keyword_rename.i b/Examples/test-suite/keyword_rename.i
index 23c01087d..645f02661 100644
--- a/Examples/test-suite/keyword_rename.i
+++ b/Examples/test-suite/keyword_rename.i
@@ -27,7 +27,7 @@ KW(synchronized, final)
/* C# Keywords */
KW(string, out)
-struct sealed {int i;};
+struct stackalloc {int i;};
/* Go Keywords */
KW(go, defer)
diff --git a/Examples/test-suite/kwargs_feature.i b/Examples/test-suite/kwargs_feature.i
index a8d1c38d8..dd5b2638d 100644
--- a/Examples/test-suite/kwargs_feature.i
+++ b/Examples/test-suite/kwargs_feature.i
@@ -100,3 +100,47 @@
int foo_mm(int min = 1, int max = 2) {return min + max; }
%}
+
+
+// Extended constructors
+%extend Extending0 {
+ Extending0() { return new Extending0(); }
+}
+%extend Extending1 {
+ Extending1(int one) { return new Extending1(); }
+}
+%extend Extending2 {
+ Extending2(int one, const char *two) { return new Extending2(); }
+}
+%extend ExtendingOptArgs1 {
+ ExtendingOptArgs1(int one = 0) { return new ExtendingOptArgs1(); }
+}
+%extend ExtendingOptArgs2 {
+ ExtendingOptArgs2(int one = 0, const char* two = NULL) { return new ExtendingOptArgs2(); }
+}
+
+%inline %{
+struct Extending0 {};
+struct Extending1 {};
+struct Extending2 {};
+struct ExtendingOptArgs1 {};
+struct ExtendingOptArgs2 {};
+%}
+
+// Varargs
+%warnfilter(SWIGWARN_LANG_VARARGS_KEYWORD) VarargConstructor::VarargConstructor; // Can't wrap varargs with keyword arguments enabled
+%warnfilter(SWIGWARN_LANG_VARARGS_KEYWORD) VarargConstructor::vararg_method; // Can't wrap varargs with keyword arguments enabled
+%inline %{
+struct VarargConstructor {
+ char *str;
+ VarargConstructor(const char *fmt, ...) {
+ str = new char[strlen(fmt) + 1];
+ strcpy(str, fmt);
+ }
+ void vararg_method(const char *fmt, ...) {
+ delete [] str;
+ str = new char[strlen(fmt) + 1];
+ strcpy(str, fmt);
+ }
+};
+%}
diff --git a/Examples/test-suite/li_attribute.i b/Examples/test-suite/li_attribute.i
index 4f9497afb..95389b2b6 100644
--- a/Examples/test-suite/li_attribute.i
+++ b/Examples/test-suite/li_attribute.i
@@ -95,6 +95,7 @@ struct MyFoo; // %attribute2 does not work with templates
// class/struct attribute with get/set methods using return/pass by reference
%attribute2(MyClass, MyFoo, Foo, GetFoo, SetFoo);
+%attribute2ref(MyClass, MyFoo, Foo2);
%inline %{
struct MyFoo {
MyFoo() : x(-1) {}
@@ -102,9 +103,11 @@ struct MyFoo; // %attribute2 does not work with templates
};
class MyClass {
MyFoo foo;
+ MyFoo foo2;
public:
MyFoo& GetFoo() { return foo; }
void SetFoo(const MyFoo& other) { foo = other; }
+ MyFoo& Foo2() { return foo2; }
};
%}
diff --git a/Examples/test-suite/li_math.i b/Examples/test-suite/li_math.i
index 3aa3db303..db39cd3de 100644
--- a/Examples/test-suite/li_math.i
+++ b/Examples/test-suite/li_math.i
@@ -1,7 +1,2 @@
%module li_math
-#ifdef SWIGPHP
-// PHP already provides these functions with the same names, so just kill that
-// warning.
-%warnfilter(SWIGWARN_PARSE_KEYWORD);
-#endif
%include math.i
diff --git a/Examples/test-suite/li_std_auto_ptr.i b/Examples/test-suite/li_std_auto_ptr.i
index 5bde387a3..d83732af0 100644
--- a/Examples/test-suite/li_std_auto_ptr.i
+++ b/Examples/test-suite/li_std_auto_ptr.i
@@ -12,7 +12,7 @@
#endif
%}
-#if defined(SWIGCSHARP) || defined(SWIGJAVA) || defined(SWIGPYTHON)
+#if defined(SWIGCSHARP) || defined(SWIGJAVA) || defined(SWIGPYTHON) || defined(SWIGRUBY)
%include "std_auto_ptr.i"
diff --git a/Examples/test-suite/li_std_containers_overload.i b/Examples/test-suite/li_std_containers_overload.i
new file mode 100644
index 000000000..5e7c28e37
--- /dev/null
+++ b/Examples/test-suite/li_std_containers_overload.i
@@ -0,0 +1,33 @@
+%module li_std_containers_overload
+
+// Suppress warning that ought not to appear, but there is no easy fix
+%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) VectorOverload;
+
+%include
+%include
+
+%inline %{
+struct X {};
+struct Y {};
+%}
+
+%template(VectorX) std::vector;
+%template(VectorY) std::vector;
+%template(VectorString) std::vector;
+%template(VectorInt) std::vector;
+
+%inline %{
+using namespace std;
+string VectorOverload(vector v) {
+ return "vector";
+}
+string VectorOverload(vector v) {
+ return "vector";
+}
+string VectorOverload(vector v) {
+ return "vector";
+}
+string VectorOverload(vector v) {
+ return "vector";
+}
+%}
diff --git a/Examples/test-suite/li_std_wstring.i b/Examples/test-suite/li_std_wstring.i
index 55d45383e..a790ca7e0 100644
--- a/Examples/test-suite/li_std_wstring.i
+++ b/Examples/test-suite/li_std_wstring.i
@@ -70,6 +70,11 @@ size_t size_wstring(const std::wstring& s) {
return s.size();
}
+struct wchar_test_struct {
+ wchar_t wchar_t_member;
+ wchar_t* wchar_t_ptr_member;
+};
+
%}
#endif
diff --git a/Examples/test-suite/li_typemaps.i b/Examples/test-suite/li_typemaps.i
index a53c1c74a..d508c1c84 100644
--- a/Examples/test-suite/li_typemaps.i
+++ b/Examples/test-suite/li_typemaps.i
@@ -2,6 +2,7 @@
%include "typemaps.i"
+%apply int *OUTPUT { int *OUTPUT2 };
%apply int &INOUT { int &INOUT2 };
%newobject out_foo;
%inline %{
@@ -51,10 +52,13 @@ void out_longlong(long long x, long long *OUTPUT) { *OUTPUT = x; }
void out_ulonglong(unsigned long long x, unsigned long long *OUTPUT) { *OUTPUT = x; }
/* Tests a returning a wrapped pointer and an output argument */
-struct Foo *out_foo(int a, int *OUTPUT) {
+struct Foo *out_foo(int a, int *OUTPUT, int *OUTPUT2) {
struct Foo *f = new struct Foo();
f->a = a;
*OUTPUT = a * 2;
+ struct Foo *f2 = new struct Foo();
+ f2->a = a;
+ *OUTPUT2 = a * 3;
return f;
}
diff --git a/Examples/test-suite/lua/Makefile.in b/Examples/test-suite/lua/Makefile.in
index 63b8692b1..92559bb8f 100644
--- a/Examples/test-suite/lua/Makefile.in
+++ b/Examples/test-suite/lua/Makefile.in
@@ -15,6 +15,7 @@ top_builddir = @top_builddir@
CPP_TEST_CASES += \
lua_no_module_global \
lua_inherit_getitem \
+ lua_lightuserdata \
C_TEST_CASES += \
diff --git a/Examples/test-suite/lua/li_typemaps_runme.lua b/Examples/test-suite/lua/li_typemaps_runme.lua
index 7456d8245..342634a5b 100644
--- a/Examples/test-suite/lua/li_typemaps_runme.lua
+++ b/Examples/test-suite/lua/li_typemaps_runme.lua
@@ -38,5 +38,5 @@ assert(li_typemaps.inoutr_bool(false)==false)
a,b=li_typemaps.inoutr_int2(1,2)
assert(a==1 and b==2)
-f,i=li_typemaps.out_foo(10)
-assert(f.a==10 and i==20)
+f,i,i2=li_typemaps.out_foo(10)
+assert(f.a==10 and i==20 and i2==30)
diff --git a/Examples/test-suite/lua/lua_lightuserdata_runme.lua b/Examples/test-suite/lua/lua_lightuserdata_runme.lua
new file mode 100644
index 000000000..c1c3c1d73
--- /dev/null
+++ b/Examples/test-suite/lua/lua_lightuserdata_runme.lua
@@ -0,0 +1,7 @@
+require("import") -- the import fn
+import("lua_lightuserdata") -- import lib
+
+local t = lua_lightuserdata
+local d = t.get_lightuserdata()
+local r = t.check_lighuserdata(d)
+assert(r)
diff --git a/Examples/test-suite/lua_lightuserdata.i b/Examples/test-suite/lua_lightuserdata.i
new file mode 100644
index 000000000..9069b6ab4
--- /dev/null
+++ b/Examples/test-suite/lua_lightuserdata.i
@@ -0,0 +1,17 @@
+%module lua_lightuserdata
+
+%native(get_lightuserdata) int get_lightuserdata(lua_State* L);
+%{
+static int foo;
+int get_lightuserdata(lua_State* L)
+{
+ lua_pushlightuserdata(L, &foo);
+ return 1;
+}
+%}
+
+%inline %{
+bool check_lighuserdata(const void* d) {
+ return d == &foo;
+}
+%}
diff --git a/Examples/test-suite/memberin_extend_c.i b/Examples/test-suite/memberin_extend_c.i
index 0599e65a0..c7e017305 100644
--- a/Examples/test-suite/memberin_extend_c.i
+++ b/Examples/test-suite/memberin_extend_c.i
@@ -32,7 +32,8 @@ char *Person_name_get(Person *p) {
}
void Person_name_set(Person *p, char *val) {
- strncpy(p->name,val,50);
+ p->name[0] = '\0';
+ strncat(p->name, val, sizeof(p->name) - 1);
make_upper(p->name);
}
%}
diff --git a/Examples/test-suite/multiple_inheritance_abstract.i b/Examples/test-suite/multiple_inheritance_abstract.i
index b54a37dea..9ac16a235 100644
--- a/Examples/test-suite/multiple_inheritance_abstract.i
+++ b/Examples/test-suite/multiple_inheritance_abstract.i
@@ -1,9 +1,8 @@
// This is a copy of the multiple_inheritance_abstract test
-%module multiple_inheritance_abstract
+%module(ruby_minherit="1") multiple_inheritance_abstract
-%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
- SWIGWARN_D_MULTIPLE_INHERITANCE,
- SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
+%warnfilter(SWIGWARN_D_MULTIPLE_INHERITANCE,
+ SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance */
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
%include "swiginterface.i"
@@ -23,7 +22,7 @@ namespace Space {
struct CBase1 {
virtual void cbase1x() {
return;
- }
+ }
virtual int cbase1y() {
return 1;
}
@@ -307,6 +306,36 @@ namespace Space {
return d;
}
+ // Return const pointer references
+ CBase1 *const&MakeConstPtrRefDerived1_CBase1() {
+ static CBase1 *d = new Derived1();
+ return d;
+ }
+ CBase2 *const&MakeConstPtrRefDerived1_CBase2() {
+ static CBase2 *const& d = new Derived1();
+ return d;
+ }
+ CBase1 *const&MakeConstPtrRefDerived2_CBase1() {
+ static CBase1 *const& d = new Derived2();
+ return d;
+ }
+ ABase1 *const&MakeConstPtrRefDerived2_ABase1() {
+ static ABase1 *const& d = new Derived2();
+ return d;
+ }
+ ABase1 *const&MakeConstPtrRefDerived3_ABase1() {
+ static ABase1 *const& d = new Derived3();
+ return d;
+ }
+ CBase1 *const&MakeConstPtrRefDerived3_CBase1() {
+ static CBase1 *const& d = new Derived3();
+ return d;
+ }
+ CBase2 *const&MakeConstPtrRefDerived3_CBase2() {
+ static CBase2 *const& d = new Derived3();
+ return d;
+ }
+
// Return by value (sliced objects)
CBase1 MakeValDerived1_CBase1() {
return Derived1();
diff --git a/Examples/test-suite/multiple_inheritance_interfaces.i b/Examples/test-suite/multiple_inheritance_interfaces.i
index 2972922fb..6bb1d50cb 100644
--- a/Examples/test-suite/multiple_inheritance_interfaces.i
+++ b/Examples/test-suite/multiple_inheritance_interfaces.i
@@ -1,8 +1,7 @@
-%module multiple_inheritance_interfaces
+%module(ruby_minherit="1") multiple_inheritance_interfaces
-%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
- SWIGWARN_D_MULTIPLE_INHERITANCE,
- SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
+%warnfilter(SWIGWARN_D_MULTIPLE_INHERITANCE,
+ SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance */
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
%include "swiginterface.i"
@@ -64,3 +63,32 @@ struct DerivedOverloaded : public BaseOverloaded {
virtual void identical_overload(int i, const PTypedef &p = PTypedef()) {}
};
%}
+
+
+#if defined(SWIGJAVA) || defined(SWIGCSHARP)
+%interface(Space::X)
+#endif
+
+// Test the csinterfacemodifiers and javainterfacemodifiers typemaps.
+#if defined(SWIGCSHARP)
+/* change access from default "public class" to "internal class" */
+%typemap(csclassmodifiers) InternalAccess "internal class"
+/* The following modifiers are also needed with the above access modifier change */
+%typemap(csclassmodifiers) Space::X "internal class"
+%typemap(csinterfacemodifiers) Space::X "internal interface"
+#elif defined(SWIGJAVA)
+%typemap(javaclassmodifiers) InternalAccess "final /*notpublic*/ class"
+%typemap(javaclassmodifiers) Space::X "final class"
+%typemap(javainterfacemodifiers) Space::X "/*notpublic*/ interface"
+#endif
+
+%inline %{
+struct InternalAccess {};
+namespace Space {
+ class X {
+ public:
+ virtual void x(const InternalAccess& date) const = 0;
+ virtual ~X() {}
+ };
+}
+%}
diff --git a/Examples/test-suite/multiple_inheritance_nspace.i b/Examples/test-suite/multiple_inheritance_nspace.i
index 4faef5749..002e6d6ee 100644
--- a/Examples/test-suite/multiple_inheritance_nspace.i
+++ b/Examples/test-suite/multiple_inheritance_nspace.i
@@ -1,9 +1,8 @@
// This is a copy of the multiple_inheritance_abstract test
-%module multiple_inheritance_nspace
+%module(ruby_minherit="1") multiple_inheritance_nspace
-%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
- SWIGWARN_D_MULTIPLE_INHERITANCE,
- SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
+%warnfilter(SWIGWARN_D_MULTIPLE_INHERITANCE,
+ SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance */
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
@@ -32,7 +31,7 @@ namespace Space {
struct CBase1 {
virtual void cbase1x() {
return;
- }
+ }
virtual int cbase1y() {
return 1;
}
@@ -316,6 +315,36 @@ namespace Space {
return d;
}
+ // Return const pointer references
+ CBase1 *const&MakeConstPtrRefDerived1_CBase1() {
+ static CBase1 *d = new Derived1();
+ return d;
+ }
+ CBase2 *const&MakeConstPtrRefDerived1_CBase2() {
+ static CBase2 *const& d = new Derived1();
+ return d;
+ }
+ CBase1 *const&MakeConstPtrRefDerived2_CBase1() {
+ static CBase1 *const& d = new Derived2();
+ return d;
+ }
+ ABase1 *const&MakeConstPtrRefDerived2_ABase1() {
+ static ABase1 *const& d = new Derived2();
+ return d;
+ }
+ ABase1 *const&MakeConstPtrRefDerived3_ABase1() {
+ static ABase1 *const& d = new Derived3();
+ return d;
+ }
+ CBase1 *const&MakeConstPtrRefDerived3_CBase1() {
+ static CBase1 *const& d = new Derived3();
+ return d;
+ }
+ CBase2 *const&MakeConstPtrRefDerived3_CBase2() {
+ static CBase2 *const& d = new Derived3();
+ return d;
+ }
+
// Return by value (sliced objects)
CBase1 MakeValDerived1_CBase1() {
return Derived1();
diff --git a/Examples/test-suite/multiple_inheritance_shared_ptr.i b/Examples/test-suite/multiple_inheritance_shared_ptr.i
index 3c061e1a9..061db57d9 100644
--- a/Examples/test-suite/multiple_inheritance_shared_ptr.i
+++ b/Examples/test-suite/multiple_inheritance_shared_ptr.i
@@ -1,9 +1,8 @@
// This is a copy of the multiple_inheritance_abstract test and extended for testing %shared_ptr and %interface_impl
-%module multiple_inheritance_shared_ptr
+%module(ruby_minherit="1") multiple_inheritance_shared_ptr
-%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
- SWIGWARN_D_MULTIPLE_INHERITANCE,
- SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
+%warnfilter(SWIGWARN_D_MULTIPLE_INHERITANCE,
+ SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance */
// Typemap changes required to mix %shared_ptr and %interface_impl
// Note we don't have a way to use $javainterfacename/$csinterfacename (yet),
@@ -425,6 +424,36 @@ namespace Space {
return d;
}
+ // Return const pointer references
+ CBase1 *const&MakeConstPtrRefDerived1_CBase1() {
+ static CBase1 *d = new Derived1();
+ return d;
+ }
+ CBase2 *const&MakeConstPtrRefDerived1_CBase2() {
+ static CBase2 *const& d = new Derived1();
+ return d;
+ }
+ CBase1 *const&MakeConstPtrRefDerived2_CBase1() {
+ static CBase1 *const& d = new Derived2();
+ return d;
+ }
+ ABase1 *const&MakeConstPtrRefDerived2_ABase1() {
+ static ABase1 *const& d = new Derived2();
+ return d;
+ }
+ ABase1 *const&MakeConstPtrRefDerived3_ABase1() {
+ static ABase1 *const& d = new Derived3();
+ return d;
+ }
+ CBase1 *const&MakeConstPtrRefDerived3_CBase1() {
+ static CBase1 *const& d = new Derived3();
+ return d;
+ }
+ CBase2 *const&MakeConstPtrRefDerived3_CBase2() {
+ static CBase2 *const& d = new Derived3();
+ return d;
+ }
+
// Return by value (sliced objects)
CBase1 MakeValDerived1_CBase1() {
return Derived1();
diff --git a/Examples/test-suite/native_directive.i b/Examples/test-suite/native_directive.i
index d08c9a954..3d4858032 100644
--- a/Examples/test-suite/native_directive.i
+++ b/Examples/test-suite/native_directive.i
@@ -41,3 +41,62 @@ extern "C" JNIEXPORT jint JNICALL Java_native_1directive_native_1directiveJNI_Co
%}
#endif
+
+// TODO: C#
+// TODO: Python
+
+
+#ifdef SWIGJAVASCRIPT
+%native(CountAlphaCharacters) void JavaScript_alpha_count();
+%{
+#ifdef SWIG_V8_VERSION /* engine = node || v8 */
+
+static SwigV8ReturnValue JavaScript_alpha_count(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+ SWIGV8_VALUE jsresult;
+ char *arg1 = (char *)0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int result;
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_alpha_count.");
+ res1 = SWIG_AsCharPtrAndSize(args[0], &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1))
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "alpha_count" "', argument " "1"" of type '" "char const *""'");
+ arg1 = reinterpret_cast< char * >(buf1);
+ result = (int)alpha_count((char const *)arg1);
+ jsresult = SWIG_From_int(static_cast< int >(result));
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ SWIGV8_RETURN(jsresult);
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+#else /* engine = jsc */
+
+static JSValueRef JavaScript_alpha_count(JSContextRef context, JSObjectRef function,
+ JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ char *arg1 = (char *)0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int result;
+ JSValueRef jsresult;
+ if (argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
+ res1 = SWIG_JSC_AsCharPtrAndSize(context, argv[0], &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1))
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "alpha_count" "', argument " "1"" of type '" "char const *""'");
+ arg1 = reinterpret_cast< char * >(buf1);
+ result = (int)alpha_count((char const *)arg1);
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS(static_cast< int >(result));
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ return jsresult;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+#endif /* engine */
+%}
+#endif /* SWIGJAVASCRIPT */
+
diff --git a/Examples/test-suite/nested_scope.i b/Examples/test-suite/nested_scope.i
index bd66eec73..dabea310e 100644
--- a/Examples/test-suite/nested_scope.i
+++ b/Examples/test-suite/nested_scope.i
@@ -1,9 +1,5 @@
%module nested_scope
-#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
-%feature ("flatnested");
-#endif
-
%inline %{
namespace ns {
// "global" is a case-insensitive keyword in PHP.
@@ -31,9 +27,9 @@ namespace ns {
public:
struct Nested2;
#ifdef __clang__
- struct Nested2 {
- int data;
- };
+ struct Nested2 {
+ int data;
+ };
#endif
template class AbstractClass;
class Real;
diff --git a/Examples/test-suite/nested_scope_flat.i b/Examples/test-suite/nested_scope_flat.i
new file mode 100644
index 000000000..6aab72349
--- /dev/null
+++ b/Examples/test-suite/nested_scope_flat.i
@@ -0,0 +1,5 @@
+%module nested_scope_flat
+
+%feature ("flatnested");
+
+%include "nested_scope.i"
diff --git a/Examples/test-suite/not_c_keywords.i b/Examples/test-suite/not_c_keywords.i
new file mode 100644
index 000000000..013575bc6
--- /dev/null
+++ b/Examples/test-suite/not_c_keywords.i
@@ -0,0 +1,13 @@
+%module not_c_keywords
+
+%extend ComplexStruct {
+void init() {
+ $self->complex = 123;
+}
+}
+
+%inline %{
+struct ComplexStruct {
+ int complex; /* complex as variable name */
+};
+%}
diff --git a/Examples/test-suite/ocaml/Makefile.in b/Examples/test-suite/ocaml/Makefile.in
index 775b1ea71..c44f02a72 100644
--- a/Examples/test-suite/ocaml/Makefile.in
+++ b/Examples/test-suite/ocaml/Makefile.in
@@ -20,6 +20,7 @@ apply_strings \
cpp_enum \
default_constructor \
director_binary_string \
+director_comparison_operators \
director_enum \
director_primitives \
director_redefined \
@@ -101,6 +102,10 @@ $(MULTI_CPP_TEST_CASES:=.multicpptest): extra_objects
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' ocaml_clean
- rm -f clientdata_prop_a.ml clientdata_prop_b.ml import_stl_a.ml import_stl_b.ml
- rm -f imports_a.ml imports_b.ml mod_a.ml mod_b.ml multi_import_a.ml
- rm -f multi_import_b.ml packageoption_a.ml packageoption_b.ml packageoption_c.ml
+ rm -f clientdata_prop_a.ml clientdata_prop_b.ml
+ rm -f import_stl_a.ml import_stl_b.ml
+ rm -f imports_a.ml imports_b.ml
+ rm -f mod_a.ml mod_b.ml
+ rm -f multi_import_a.ml multi_import_b.ml
+ rm -f packageoption_a.ml packageoption_b.ml packageoption_c.ml
+ rm -f template_typedef_cplx2.ml
diff --git a/Examples/test-suite/octave/Makefile.in b/Examples/test-suite/octave/Makefile.in
index 3c8f3b165..9602d85f5 100644
--- a/Examples/test-suite/octave/Makefile.in
+++ b/Examples/test-suite/octave/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = octave
OCTAVE = @OCTAVE@
SCRIPTSUFFIX = _runme.m
+PCHSUPPORT = @PCHSUPPORT@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -28,14 +29,6 @@ CPP_TEST_BROKEN += \
li_std_set \
li_std_stream
-#C_TEST_CASES +=
-
-#
-# This test only works with modern C compilers
-#
-#C_TEST_CASES += \
-# complextest
-
include $(srcdir)/../common.mk
# Overridden variables here
@@ -61,6 +54,23 @@ CSRCS = octave_empty.c
+$(swig_and_compile_multi_cpp)
$(run_testcase)
+# Pre-compile Octave headers, if supported
+
+ifeq (yes,$(PCHSUPPORT))
+
+export OCTHEADERSSRC = @top_srcdir@/Lib/octave/octheaders.hpp
+export OCTHEADERS = @top_builddir@/Examples/test-suite/octave/octheaders.hpp
+export OCTHEADERSGCH = $(OCTHEADERS).gch
+export SWIGOCTHDROPT = -DSWIG_OCTAVE_EXTERNAL_OCTHEADERS
+export IOCTHEADERS = -I@top_builddir@/Examples/test-suite/octave @PCHINCLUDEARG@ $(OCTHEADERS)@PCHINCLUDEEXT@
+
+$(OCTHEADERSGCH): $(OCTHEADERSSRC)
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile octave_precompile_headers
+
+$(NOT_BROKEN_TEST_CASES) $(BROKEN_TEST_CASES): $(OCTHEADERSGCH)
+
+endif
+
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.m appended after the testcase name.
run_testcase = \
diff --git a/Examples/test-suite/octave/abstract_access_runme.m b/Examples/test-suite/octave/abstract_access_runme.m
index e49343a92..e47223c47 100644
--- a/Examples/test-suite/octave/abstract_access_runme.m
+++ b/Examples/test-suite/octave/abstract_access_runme.m
@@ -2,6 +2,6 @@ abstract_access
d = abstract_access.D();
if (d.do_x() != 1)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/abstract_typedef_runme.m b/Examples/test-suite/octave/abstract_typedef_runme.m
index e57f71504..6f90b8159 100644
--- a/Examples/test-suite/octave/abstract_typedef_runme.m
+++ b/Examples/test-suite/octave/abstract_typedef_runme.m
@@ -10,7 +10,7 @@ a = A();
if (a.write(e) != 1)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/callback_runme.m b/Examples/test-suite/octave/callback_runme.m
index db9f7888d..95df598f1 100644
--- a/Examples/test-suite/octave/callback_runme.m
+++ b/Examples/test-suite/octave/callback_runme.m
@@ -2,39 +2,39 @@ _callback
callback
if (foo(2) != 2)
- error
+ error("failed");
endif
if (A_bar(2) != 4)
- error
+ error("failed");
endif
if (foobar(3, _callback.foo) != foo(3))
- error
+ error("failed");
endif
if (foobar(3, foo) != foo(3))
- error
+ error("failed");
endif
if (foobar(3, A_bar) != A_bar(3))
- error
+ error("failed");
endif
if (foobar(3, foof) != foof(3))
- error
+ error("failed");
endif
if (foobar_i(3, foo_i) != foo_i(3))
- error
+ error("failed");
endif
if (foobar_d(3.5, foo_d) != foo_d(3.5))
- error
+ error("failed");
endif
a = A();
if (foobarm(3, a, A.foom_cb_ptr) != a.foom(3))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/class_ignore_runme.m b/Examples/test-suite/octave/class_ignore_runme.m
index 3e52047c2..53cad9570 100644
--- a/Examples/test-suite/octave/class_ignore_runme.m
+++ b/Examples/test-suite/octave/class_ignore_runme.m
@@ -8,5 +8,5 @@ class_ignore
a = class_ignore.Bar();
if (!strcmp(class_ignore.do_blah(a),"Bar::blah"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/class_scope_weird_runme.m b/Examples/test-suite/octave/class_scope_weird_runme.m
index 2fc857808..b0e975359 100644
--- a/Examples/test-suite/octave/class_scope_weird_runme.m
+++ b/Examples/test-suite/octave/class_scope_weird_runme.m
@@ -3,5 +3,5 @@ class_scope_weird
f = class_scope_weird.Foo();
g = class_scope_weird.Foo(3);
if (f.bar(3) != 3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/compactdefaultargs_runme.m b/Examples/test-suite/octave/compactdefaultargs_runme.m
index 08e872724..ada60dcbe 100644
--- a/Examples/test-suite/octave/compactdefaultargs_runme.m
+++ b/Examples/test-suite/octave/compactdefaultargs_runme.m
@@ -4,21 +4,21 @@ defaults1 = Defaults1(1000);
defaults1 = Defaults1();
if (defaults1.ret(10.0) != 10.0)
- error
+ error("failed");
endif
if (defaults1.ret() != -1.0)
- error
+ error("failed");
endif
defaults2 = Defaults2(1000);
defaults2 = Defaults2();
if (defaults2.ret(10.0) != 10.0)
- error
+ error("failed");
endif
if (defaults2.ret() != -1.0)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/constructor_copy_runme.m b/Examples/test-suite/octave/constructor_copy_runme.m
index e450214c6..b6d3c3b6a 100644
--- a/Examples/test-suite/octave/constructor_copy_runme.m
+++ b/Examples/test-suite/octave/constructor_copy_runme.m
@@ -10,7 +10,7 @@ f11 = Foo1(f1);
if (f1.x != f11.x)
- error
+ error("failed");
endif
@@ -23,7 +23,7 @@ catch
end_try_catch
if (!good)
- error
+ error("failed");
endif
@@ -31,7 +31,7 @@ bi = Bari(5);
bc = Bari(bi);
if (bi.x != bc.x)
- error
+ error("failed");
endif
@@ -44,6 +44,6 @@ catch
end_try_catch
if (!good)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/default_args_runme.m b/Examples/test-suite/octave/default_args_runme.m
index 3d00f63e0..d2c6b4a6f 100644
--- a/Examples/test-suite/octave/default_args_runme.m
+++ b/Examples/test-suite/octave/default_args_runme.m
@@ -7,19 +7,19 @@ default_args
if (default_args.Statics.staticmethod() != 60)
- error
+ error("failed");
endif
if (default_args.cfunc1(1) != 2)
- error
+ error("failed");
endif
if (default_args.cfunc2(1) != 3)
- error
+ error("failed");
endif
if (default_args.cfunc3(1) != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_abstract_runme.m b/Examples/test-suite/octave/director_abstract_runme.m
index 657e2e1d9..c96cf7554 100644
--- a/Examples/test-suite/octave/director_abstract_runme.m
+++ b/Examples/test-suite/octave/director_abstract_runme.m
@@ -28,17 +28,17 @@ MyExample3=@() subclass(director_abstract.Example3_i(),'Color',@(self,r,g,b) b);
me1 = MyExample1();
if (director_abstract.Example1.get_color(me1, 1,2,3) != 1)
- error
+ error("failed");
endif
me2 = MyExample2(1,2);
if (me2.get_color(me2, 1,2,3) != 2)
- error
+ error("failed");
endif
me3 = MyExample3();
if (me3.get_color(me3, 1,2,3) != 3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_basic_runme.m b/Examples/test-suite/octave/director_basic_runme.m
index 9de54a385..9a411a703 100644
--- a/Examples/test-suite/octave/director_basic_runme.m
+++ b/Examples/test-suite/octave/director_basic_runme.m
@@ -33,7 +33,7 @@ endif
a = director_basic.A1(1);
if (a.rg(2) != 2)
- error
+ error("failed");
endif
function self=OctClass()
@@ -62,16 +62,16 @@ bd = dd.cmethod(b);
cc.method(b);
if (c.cmethod != 7)
- error
+ error("failed");
endif
if (bc.x != 34)
- error
+ error("failed");
endif
if (bd.x != 16)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_enum_runme.m b/Examples/test-suite/octave/director_enum_runme.m
index 96f158d39..59a5ccf8b 100644
--- a/Examples/test-suite/octave/director_enum_runme.m
+++ b/Examples/test-suite/octave/director_enum_runme.m
@@ -6,5 +6,5 @@ b = director_enum.Foo();
a = MyFoo();
if (a.say_hi(director_enum.hello) != b.say_hello(director_enum.hi))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_nested_runme.m b/Examples/test-suite/octave/director_nested_runme.m
index 6e1d0ded9..614af0c60 100644
--- a/Examples/test-suite/octave/director_nested_runme.m
+++ b/Examples/test-suite/octave/director_nested_runme.m
@@ -31,9 +31,9 @@ c = FooBar_int_get_self(cc);
c.advance();
if (!strcmp(c.get_name(),"FooBar::get_name hello"))
- error
+ error("failed");
endif
if (!strcmp(c.name(),"FooBar::get_name hello"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_unroll_runme.m b/Examples/test-suite/octave/director_unroll_runme.m
index 6ca213c4c..607b9d5ef 100644
--- a/Examples/test-suite/octave/director_unroll_runme.m
+++ b/Examples/test-suite/octave/director_unroll_runme.m
@@ -11,6 +11,6 @@ c = b.get();
if (swig_this(a) != swig_this(c))
a,c
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/enum_template_runme.m b/Examples/test-suite/octave/enum_template_runme.m
index a9f940a9f..1474ce1cc 100644
--- a/Examples/test-suite/octave/enum_template_runme.m
+++ b/Examples/test-suite/octave/enum_template_runme.m
@@ -6,13 +6,13 @@ endif
enum_template
if (enum_template.MakeETest() != 1)
- error
+ error("failed");
endif
enum_template.TakeETest(0);
try
a=enum_template.TakeETest(0);
- error
+ error("failed");
catch
end_try_catch
diff --git a/Examples/test-suite/octave/enums_runme.m b/Examples/test-suite/octave/enums_runme.m
index b654d9d04..5f6bd6951 100644
--- a/Examples/test-suite/octave/enums_runme.m
+++ b/Examples/test-suite/octave/enums_runme.m
@@ -6,18 +6,18 @@ enums.bar3(1)
enums.bar1(1)
if (enums.cvar.enumInstance != 2)
- error
+ error("failed");
endif
if (enums.cvar.Slap != 10)
- error
+ error("failed");
endif
if (enums.cvar.Mine != 11)
- error
+ error("failed");
endif
if (enums.cvar.Thigh != 12)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/extend_template_ns_runme.m b/Examples/test-suite/octave/extend_template_ns_runme.m
index e79a00dda..7196fac73 100644
--- a/Examples/test-suite/octave/extend_template_ns_runme.m
+++ b/Examples/test-suite/octave/extend_template_ns_runme.m
@@ -7,9 +7,9 @@ extend_template_ns
f = Foo_One();
if (f.test1(37) != 37)
- error
+ error("failed");
endif
if (f.test2(42) != 42)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/extend_template_runme.m b/Examples/test-suite/octave/extend_template_runme.m
index 1cad7bfc9..125bd4a5a 100644
--- a/Examples/test-suite/octave/extend_template_runme.m
+++ b/Examples/test-suite/octave/extend_template_runme.m
@@ -2,9 +2,9 @@ extend_template
f = extend_template.Foo_0();
if (f.test1(37) != 37)
- error
+ error("failed");
endif
if (f.test2(42) != 42)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/extend_variable_runme.m b/Examples/test-suite/octave/extend_variable_runme.m
index c55b6c55c..89af26c9d 100644
--- a/Examples/test-suite/octave/extend_variable_runme.m
+++ b/Examples/test-suite/octave/extend_variable_runme.m
@@ -1,6 +1,6 @@
extend_variable
if (Foo.Bar != 42)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/friends_runme.m b/Examples/test-suite/octave/friends_runme.m
index 31211567f..50a5b20ef 100644
--- a/Examples/test-suite/octave/friends_runme.m
+++ b/Examples/test-suite/octave/friends_runme.m
@@ -8,25 +8,25 @@ friends
a = friends.A(2);
if (friends.get_val1(a) != 2)
- error
+ error("failed");
endif
if (friends.get_val2(a) != 4)
- error
+ error("failed");
endif
if (friends.get_val3(a) != 6)
- error
+ error("failed");
endif
# nice overload working fine
if (friends.get_val1(1,2,3) != 1)
- error
+ error("failed");
endif
b = friends.B(3);
# David's case
if (friends.mix(a,b) != 5)
- error
+ error("failed");
endif
di = friends.D_d(2);
@@ -34,18 +34,18 @@ dd = friends.D_d(3.3);
# incredible template overloading working just fine
if (friends.get_val1(di) != 2)
- error
+ error("failed");
endif
if (friends.get_val1(dd) != 3.3)
- error
+ error("failed");
endif
friends.set(di, 4);
friends.set(dd, 1.3);
if (friends.get_val1(di) != 4)
- error
+ error("failed");
endif
if (friends.get_val1(dd) != 1.3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/grouping_runme.m b/Examples/test-suite/octave/grouping_runme.m
index 6d1a2d673..4e2c9ea2d 100644
--- a/Examples/test-suite/octave/grouping_runme.m
+++ b/Examples/test-suite/octave/grouping_runme.m
@@ -7,14 +7,14 @@ grouping
x = grouping.test1(42);
if (x != 42)
- error
+ error("failed");
endif
grouping.test2(42);
x = (grouping.do_unary(37, grouping.NEGATE));
if (x != -37)
- error
+ error("failed");
endif
grouping.cvar.test3 = 42;
diff --git a/Examples/test-suite/octave/iadd_runme.m b/Examples/test-suite/octave/iadd_runme.m
index c386c669e..70cd75dae 100644
--- a/Examples/test-suite/octave/iadd_runme.m
+++ b/Examples/test-suite/octave/iadd_runme.m
@@ -6,5 +6,5 @@ f.AsA.x = 3;
f.AsA += f.AsA;
if (f.AsA.x != 6)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/inout_runme.m b/Examples/test-suite/octave/inout_runme.m
index 74caaff46..c5d293eb6 100644
--- a/Examples/test-suite/octave/inout_runme.m
+++ b/Examples/test-suite/octave/inout_runme.m
@@ -2,26 +2,26 @@ inout
a = inout.AddOne1(1);
if (a != 2)
- error
+ error("failed");
endif
a = inout.AddOne3(1,1,1);
if (a != [2,2,2])
- error
+ error("failed");
endif
a = inout.AddOne1p((1,1));
if (a != (2,2))
- error
+ error("failed");
endif
a = inout.AddOne2p((1,1),1);
if (a != [(2,2),2])
- error
+ error("failed");
endif
a = inout.AddOne3p(1,(1,1),1);
if (a != [2,(2,2),2])
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/inplaceadd_runme.m b/Examples/test-suite/octave/inplaceadd_runme.m
index 2bc193793..50b680aba 100644
--- a/Examples/test-suite/octave/inplaceadd_runme.m
+++ b/Examples/test-suite/octave/inplaceadd_runme.m
@@ -3,22 +3,22 @@ a = inplaceadd.A(7);
a += 5;
if (a.val != 12)
- error
+ error("failed");
endif
a -= 5;
if a.val != 7:
- error
+ error("failed");
endif
a *= 2;
if (a.val != 14)
- error
+ error("failed");
endif
a += a;
if (a.val != 28)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/input_runme.m b/Examples/test-suite/octave/input_runme.m
index 1a92d032b..477ffaac1 100644
--- a/Examples/test-suite/octave/input_runme.m
+++ b/Examples/test-suite/octave/input_runme.m
@@ -7,21 +7,21 @@ input
f = Foo();
if (f.foo(2) != 4)
- error
+ error("failed");
endif
try
a=f.foo();
- error
+ error("failed");
catch
end_try_catch
if (!strcmp(sfoo("Hello"),"Hello world"))
- error
+ error("failed");
endif
try
a=sfoo();
- error
+ error("failed");
catch
end_try_catch
diff --git a/Examples/test-suite/octave/li_attribute_runme.m b/Examples/test-suite/octave/li_attribute_runme.m
index ed051d9df..5e239045f 100644
--- a/Examples/test-suite/octave/li_attribute_runme.m
+++ b/Examples/test-suite/octave/li_attribute_runme.m
@@ -8,7 +8,7 @@ li_attribute
aa = li_attribute.A(1,2,3);
if (aa.a != 1)
- error
+ error("failed");
endif
aa.a = 3;
if (aa.a != 3)
@@ -20,31 +20,31 @@ if (aa.b != 2)
endif
aa.b = 5;
if (aa.b != 5)
- error
+ error("failed");
endif
if (aa.d != aa.b)
- error
+ error("failed");
endif
if (aa.c != 3)
- error
+ error("failed");
endif
pi = li_attribute.Param_i(7);
if (pi.value != 7)
- error
+ error("failed");
endif
pi.value=3;
if (pi.value != 3)
- error
+ error("failed");
endif
b = li_attribute.B(aa);
if (b.a.c != 3)
- error
+ error("failed");
endif
# class/struct attribute with get/set methods using return/pass by reference
@@ -53,38 +53,38 @@ myFoo.x = 8;
myClass = li_attribute.MyClass();
myClass.Foo = myFoo;
if (myClass.Foo.x != 8)
- error
+ error("failed");
endif
# class/struct attribute with get/set methods using return/pass by value
myClassVal = li_attribute.MyClassVal();
if (myClassVal.ReadWriteFoo.x != -1)
- error
+ error("failed");
endif
if (myClassVal.ReadOnlyFoo.x != -1)
- error
+ error("failed");
endif
myClassVal.ReadWriteFoo = myFoo;
if (myClassVal.ReadWriteFoo.x != 8)
- error
+ error("failed");
endif
if (myClassVal.ReadOnlyFoo.x != 8)
- error
+ error("failed");
endif
# string attribute with get/set methods using return/pass by value
myStringyClass = li_attribute.MyStringyClass("initial string");
if (myStringyClass.ReadWriteString != "initial string")
- error
+ error("failed");
endif
if (myStringyClass.ReadOnlyString != "initial string")
- error
+ error("failed");
endif
myStringyClass.ReadWriteString = "changed string";
if (myStringyClass.ReadWriteString != "changed string")
- error
+ error("failed");
endif
if (myStringyClass.ReadOnlyString != "changed string")
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_carrays_cpp_runme.m b/Examples/test-suite/octave/li_carrays_cpp_runme.m
index b3b520920..57e3e9a87 100644
--- a/Examples/test-suite/octave/li_carrays_cpp_runme.m
+++ b/Examples/test-suite/octave/li_carrays_cpp_runme.m
@@ -11,5 +11,5 @@ d(0) = 7;
d(5) = d(0) + 3;
if (d(5) + d(0) != 17)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_carrays_runme.m b/Examples/test-suite/octave/li_carrays_runme.m
index c6b5f1619..5f180cce3 100644
--- a/Examples/test-suite/octave/li_carrays_runme.m
+++ b/Examples/test-suite/octave/li_carrays_runme.m
@@ -11,5 +11,5 @@ d(0) = 7;
d(5) = d(0) + 3;
if (d(5) + d(0) != 17)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_cmalloc_runme.m b/Examples/test-suite/octave/li_cmalloc_runme.m
index 92bcd9515..5daea2cb9 100644
--- a/Examples/test-suite/octave/li_cmalloc_runme.m
+++ b/Examples/test-suite/octave/li_cmalloc_runme.m
@@ -17,6 +17,6 @@ catch
end_try_catch
if (ok != 1)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_cpointer_cpp_runme.m b/Examples/test-suite/octave/li_cpointer_cpp_runme.m
index 463cf44f8..3551a17a9 100644
--- a/Examples/test-suite/octave/li_cpointer_cpp_runme.m
+++ b/Examples/test-suite/octave/li_cpointer_cpp_runme.m
@@ -5,7 +5,7 @@ p = new_intp();
intp_assign(p,3);
if (intp_value(p) != 3)
- error
+ error("failed");
endif
delete_intp(p);
diff --git a/Examples/test-suite/octave/li_cpointer_runme.m b/Examples/test-suite/octave/li_cpointer_runme.m
index ce055cddd..995cc2abf 100644
--- a/Examples/test-suite/octave/li_cpointer_runme.m
+++ b/Examples/test-suite/octave/li_cpointer_runme.m
@@ -10,7 +10,7 @@ p = new_intp();
intp_assign(p,3);
if (intp_value(p) != 3)
- error
+ error("failed");
endif
delete_intp(p);
diff --git a/Examples/test-suite/octave/li_cstring_runme.m b/Examples/test-suite/octave/li_cstring_runme.m
index 8aea6b709..4a706d33f 100644
--- a/Examples/test-suite/octave/li_cstring_runme.m
+++ b/Examples/test-suite/octave/li_cstring_runme.m
@@ -7,15 +7,15 @@ li_cstring
if (count("ab\0ab\0ab\0", 0) != 3)
- error
+ error("failed");
endif
if (!strcmp(test1(),"Hello World"))
- error
+ error("failed");
endif
if (!strcmp(test2()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
- error
+ error("failed");
endif
if (!strcmp(test3("hello"),"hello-suffix"))
@@ -27,18 +27,18 @@ if (!strcmp(test4("hello"),"hello-suffix"))
endif
if (!strcmp(test5(4),'xxxx'))
- error
+ error("failed");
endif
if (!strcmp(test6(10),'xxxxx'))
- error
+ error("failed");
endif
if (!strcmp(test7(),"Hello world!"))
- error
+ error("failed");
endif
if (!strcmp(test8()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_cwstring_runme.m b/Examples/test-suite/octave/li_cwstring_runme.m
index 1fb0962e7..5b9055110 100644
--- a/Examples/test-suite/octave/li_cwstring_runme.m
+++ b/Examples/test-suite/octave/li_cwstring_runme.m
@@ -6,38 +6,38 @@ endif
li_cwstring
if (count("ab\0ab\0ab\0", 0) != 3)
- error
+ error("failed");
endif
if (!strcmp(test1(),"Hello World"))
- error
+ error("failed");
endif
if (!strcmp(test2()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
- error
+ error("failed");
endif
if (!strcmp(test3("hello"),"hello-suffix"))
- error
+ error("failed");
endif
if (!strcmp(test4("hello"),"hello-suffix"))
- error
+ error("failed");
endif
if (!strcmp(test5(4),'xxxx'))
- error
+ error("failed");
endif
if (!strcmp(test6(10),'xxxxx'))
- error
+ error("failed");
endif
if (!strcmp(test7(),"Hello world!"))
- error
+ error("failed");
endif
if (!strcmp(test8()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_factory_runme.m b/Examples/test-suite/octave/li_factory_runme.m
index 5ea9b779f..7c07825f4 100644
--- a/Examples/test-suite/octave/li_factory_runme.m
+++ b/Examples/test-suite/octave/li_factory_runme.m
@@ -8,11 +8,11 @@ li_factory
circle = Geometry_create(Geometry.CIRCLE);
r = circle.radius();
if (r != 1.5)
- error
+ error("failed");
endif
point = Geometry_create(Geometry.POINT);
w = point.width();
if (w != 1.0)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_std_carray_runme.m b/Examples/test-suite/octave/li_std_carray_runme.m
index 4943fa8a2..f7212dc9a 100644
--- a/Examples/test-suite/octave/li_std_carray_runme.m
+++ b/Examples/test-suite/octave/li_std_carray_runme.m
@@ -9,7 +9,7 @@ endfor
i = 0;
for d in v3,
if (d != i)
- error
+ error("failed");
endif
i = i + 1;
endfor
@@ -29,7 +29,7 @@ for v3 in m3,
j = 0;
for d in v3,
if (d != i + j)
- error
+ error("failed");
endif
j = j + 1;
endfor
@@ -39,7 +39,7 @@ endfor
for i=0:len(m3),
for j=0:len(m3),
if (m3(i,j) != i + j)
- error
+ error("failed");
endif
endfor
endfor
diff --git a/Examples/test-suite/octave/li_std_containers_overload_runme.m b/Examples/test-suite/octave/li_std_containers_overload_runme.m
new file mode 100644
index 000000000..786d63466
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_containers_overload_runme.m
@@ -0,0 +1,37 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+li_std_containers_overload
+
+function check(got, expected)
+ if (!strcmp(got, expected))
+ error("Failed check. '%s' != '%s'", got, expected)
+ endif
+end
+
+v = VectorX();
+check(VectorOverload(v), "vector");
+
+v = VectorY();
+check(VectorOverload(v), "vector");
+
+v = VectorInt();
+check(VectorOverload(v), "vector");
+
+v = VectorString();
+check(VectorOverload(v), "vector");
+
+# TODO: Conversion from an Octave sequence not implemented yet
+# v = {X()};
+# check(VectorOverload(v), "vector");
+
+# v = {Y()};
+# check(VectorOverload(v), "vector");
+
+# v = {1, 2, 3};
+# check(VectorOverload(v), "vector");
+
+# v = {"aaa", "bbb", "ccc"};
+# check(VectorOverload(v), "vector");
diff --git a/Examples/test-suite/octave/li_std_set_runme.m b/Examples/test-suite/octave/li_std_set_runme.m
index 9bd4f152c..7f43f2f13 100644
--- a/Examples/test-suite/octave/li_std_set_runme.m
+++ b/Examples/test-suite/octave/li_std_set_runme.m
@@ -11,15 +11,15 @@ for i in s:
sum = sum + i
if (sum != "abc")
- error
+ error("failed");
i = s.__iter__()
if i.next() != "a":
- error
+ error("failed");
if i.next() != "b":
- error
+ error("failed");
if i.next() != "c":
- error
+ error("failed");
b = s.begin()
@@ -28,7 +28,7 @@ sum = ""
while (b != e):
sum = sum + b.next()
if sum != "abc":
- error
+ error("failed");
b = s.rbegin()
e = s.rend()
@@ -37,7 +37,7 @@ while (b != e):
sum = sum + b.next()
if sum != "cba":
- error
+ error("failed");
@@ -49,11 +49,11 @@ si.append(3)
i = si.__iter__()
if i.next() != 1:
- error
+ error("failed");
if i.next() != 2:
- error
+ error("failed");
if i.next() != 3:
- error
+ error("failed");
@@ -68,17 +68,17 @@ sum = ""
while (b != e):
sum = sum + b.next()
if sum != "ac":
- error
+ error("failed");
b = s.begin()
e = s.end()
if e - b != 2:
- error
+ error("failed");
m = b + 1
if m.value() != "c":
- error
+ error("failed");
@@ -93,4 +93,4 @@ for i in s:
sum = sum + (i,)
if sum != (1, 'hello', (1, 2)):
- error
+ error("failed");
diff --git a/Examples/test-suite/octave/li_std_stream_runme.m b/Examples/test-suite/octave/li_std_stream_runme.m
index bf9402e16..cedc8e59c 100644
--- a/Examples/test-suite/octave/li_std_stream_runme.m
+++ b/Examples/test-suite/octave/li_std_stream_runme.m
@@ -8,6 +8,6 @@ o << a << " " << 2345 << " " << 1.435;
if (o.str() != "A class 2345 1.435")
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_std_string_extra_runme.m b/Examples/test-suite/octave/li_std_string_extra_runme.m
index 8d506af8a..15e18eec7 100644
--- a/Examples/test-suite/octave/li_std_string_extra_runme.m
+++ b/Examples/test-suite/octave/li_std_string_extra_runme.m
@@ -140,23 +140,23 @@ endif
if (li_std_string_extra.test_reference_input("hello") != "hello")
- error
+ error("failed");
endif
s = li_std_string_extra.test_reference_inout("hello");
if (s != "hellohello")
- error
+ error("failed");
endif
if (li_std_string_extra.stdstring_empty() != "")
- error
+ error("failed");
endif
if (li_std_string_extra.c_empty() != "")
- error
+ error("failed");
endif
#if (li_std_string_extra.c_null() != None)
-# error
+# error("failed");
#endif
diff --git a/Examples/test-suite/octave/li_std_wstream_runme.m b/Examples/test-suite/octave/li_std_wstream_runme.m
index a017e8acd..4f1c62166 100644
--- a/Examples/test-suite/octave/li_std_wstream_runme.m
+++ b/Examples/test-suite/octave/li_std_wstream_runme.m
@@ -9,6 +9,6 @@ o = wostringstream();
o << a << u" " << 2345 << u" " << 1.435 << wends;
if (o.str() != "A class 2345 1.435\0")
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/multi_import_runme.m b/Examples/test-suite/octave/multi_import_runme.m
index 2b7a610d4..d22ff5c81 100644
--- a/Examples/test-suite/octave/multi_import_runme.m
+++ b/Examples/test-suite/octave/multi_import_runme.m
@@ -8,22 +8,22 @@ multi_import_b;
x = multi_import_b.XXX();
if (x.testx() != 0)
- error
+ error("failed");
endif
y = multi_import_b.YYY();
if (y.testx() != 0)
- error
+ error("failed");
endif
if (y.testy() != 1)
- error
+ error("failed");
endif
z = multi_import_a.ZZZ();
if (z.testx() != 0)
- error
+ error("failed");
endif
if (z.testz() != 2)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/namespace_typemap_runme.m b/Examples/test-suite/octave/namespace_typemap_runme.m
index ca3730773..d7e338104 100644
--- a/Examples/test-suite/octave/namespace_typemap_runme.m
+++ b/Examples/test-suite/octave/namespace_typemap_runme.m
@@ -1,106 +1,106 @@
namespace_typemap
if (!strcmp(stest1("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest2("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest3("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest4("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest5("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest6("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest7("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest8("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest9("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest10("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest11("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest12("hello"),"hello"))
- error
+ error("failed");
endif
c = complex(2,3);
r = real(c);
if (ctest1(c) != r)
- error
+ error("failed");
endif
if (ctest2(c) != r)
- error
+ error("failed");
endif
if (ctest3(c) != r)
- error
+ error("failed");
endif
if (ctest4(c) != r)
- error
+ error("failed");
endif
if (ctest5(c) != r)
- error
+ error("failed");
endif
if (ctest6(c) != r)
- error
+ error("failed");
endif
if (ctest7(c) != r)
- error
+ error("failed");
endif
if (ctest8(c) != r)
- error
+ error("failed");
endif
if (ctest9(c) != r)
- error
+ error("failed");
endif
if (ctest10(c) != r)
- error
+ error("failed");
endif
if (ctest11(c) != r)
- error
+ error("failed");
endif
if (ctest12(c) != r)
- error
+ error("failed");
endif
try
ttest1(-14)
- error
+ error("failed");
catch
end_try_catch
diff --git a/Examples/test-suite/octave/naturalvar_runme.m b/Examples/test-suite/octave/naturalvar_runme.m
index 6059b0273..40546f26c 100644
--- a/Examples/test-suite/octave/naturalvar_runme.m
+++ b/Examples/test-suite/octave/naturalvar_runme.m
@@ -14,6 +14,6 @@ cvar.s = "hello";
b.s = "hello";
if (b.s != cvar.s)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/overload_extend2_runme.m b/Examples/test-suite/octave/overload_extend2_runme.m
index 6db6b66bb..e4611948e 100644
--- a/Examples/test-suite/octave/overload_extend2_runme.m
+++ b/Examples/test-suite/octave/overload_extend2_runme.m
@@ -2,29 +2,29 @@ overload_extend2
f = overload_extend2.Foo();
if (f.test(3) != 1)
- error
+ error("failed");
endif
if (f.test("hello") != 2)
- error
+ error("failed");
endif
if (f.test(3.5,2.5) != 3)
- error
+ error("failed");
endif
if (f.test("hello",20) != 1020)
- error
+ error("failed");
endif
if (f.test("hello",20,100) != 120)
- error
+ error("failed");
endif
# C default args
if (f.test(f) != 30)
- error
+ error("failed");
endif
if (f.test(f,100) != 120)
- error
+ error("failed");
endif
if (f.test(f,100,200) != 300)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/overload_extend_c_runme.m b/Examples/test-suite/octave/overload_extend_c_runme.m
index 79b92ca47..2a6c5c21e 100644
--- a/Examples/test-suite/octave/overload_extend_c_runme.m
+++ b/Examples/test-suite/octave/overload_extend_c_runme.m
@@ -7,18 +7,18 @@ overload_extend_c
f = overload_extend_c.Foo();
if (f.test() != 0)
- error
+ error("failed");
endif
if (f.test(3) != 1)
- error
+ error("failed");
endif
if (f.test("hello") != 2)
- error
+ error("failed");
endif
if (f.test(3,2) != 5)
- error
+ error("failed");
endif
if (f.test(3.1)-.1 != 1003) # :)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/overload_extend_runme.m b/Examples/test-suite/octave/overload_extend_runme.m
index d9959804f..a29f1910e 100644
--- a/Examples/test-suite/octave/overload_extend_runme.m
+++ b/Examples/test-suite/octave/overload_extend_runme.m
@@ -7,18 +7,18 @@ overload_extend
f = overload_extend.Foo();
if (f.test() != 0)
- error
+ error("failed");
endif
if (f.test(3) != 1)
- error
+ error("failed");
endif
if (f.test("hello") != 2)
- error
+ error("failed");
endif
if (f.test(3,2) != 5)
- error
+ error("failed");
endif
if (f.test(3.1)-.1 != 1003) # :)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/preproc_runme.m b/Examples/test-suite/octave/preproc_runme.m
index e9af66e78..80f1d32ba 100644
--- a/Examples/test-suite/octave/preproc_runme.m
+++ b/Examples/test-suite/octave/preproc_runme.m
@@ -6,18 +6,18 @@ endif
preproc
if (preproc.cvar.endif != 1)
- error
+ error("failed");
endif
if (preproc.cvar.define != 1)
- error
+ error("failed");
endif
if (preproc.cvar.defined != 1)
- error
+ error("failed");
endif
if (2*preproc.one != preproc.two)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/primitive_ref_runme.m b/Examples/test-suite/octave/primitive_ref_runme.m
index 68a5750c3..799b6db17 100644
--- a/Examples/test-suite/octave/primitive_ref_runme.m
+++ b/Examples/test-suite/octave/primitive_ref_runme.m
@@ -1,53 +1,53 @@
primitive_ref
if (ref_int(3) != 3)
- error
+ error("failed");
endif
if (ref_uint(3) != 3)
- error
+ error("failed");
endif
if (ref_short(3) != 3)
- error
+ error("failed");
endif
if (ref_ushort(3) != 3)
- error
+ error("failed");
endif
if (ref_long(3) != 3)
- error
+ error("failed");
endif
if (ref_ulong(3) != 3)
- error
+ error("failed");
endif
if (ref_schar(3) != 3)
- error
+ error("failed");
endif
if (ref_uchar(3) != 3)
- error
+ error("failed");
endif
if (ref_float(3.5) != 3.5)
- error
+ error("failed");
endif
if (ref_double(3.5) != 3.5)
- error
+ error("failed");
endif
if (ref_bool(true) != true)
- error
+ error("failed");
endif
if (!strcmp(ref_char('x'),'x'))
- error
+ error("failed");
endif
if (ref_over(0) != 0)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/reference_global_vars_runme.m b/Examples/test-suite/octave/reference_global_vars_runme.m
index 67ad9c514..c7f4f56b7 100644
--- a/Examples/test-suite/octave/reference_global_vars_runme.m
+++ b/Examples/test-suite/octave/reference_global_vars_runme.m
@@ -2,90 +2,90 @@ reference_global_vars
# const class reference variable
if (getconstTC().num != 33)
- error
+ error("failed");
endif
# primitive reference variables
cvar.var_bool = createref_bool(false);
if (value_bool(cvar.var_bool) != 0)
- error
+ error("failed");
endif
cvar.var_bool = createref_bool(true);
if (value_bool(cvar.var_bool) != 1)
- error
+ error("failed");
endif
cvar.var_char = createref_char('w');
if (!strcmp(value_char(cvar.var_char),'w'))
- error
+ error("failed");
endif
cvar.var_unsigned_char = createref_unsigned_char(10);
if (value_unsigned_char(cvar.var_unsigned_char) != 10)
- error
+ error("failed");
endif
cvar.var_signed_char = createref_signed_char(10);
if (value_signed_char(cvar.var_signed_char) != 10)
- error
+ error("failed");
endif
cvar.var_short = createref_short(10);
if (value_short(cvar.var_short) != 10)
- error
+ error("failed");
endif
cvar.var_unsigned_short = createref_unsigned_short(10);
if (value_unsigned_short(cvar.var_unsigned_short) != 10)
- error
+ error("failed");
endif
cvar.var_int = createref_int(10);
if (value_int(cvar.var_int) != 10)
- error
+ error("failed");
endif
cvar.var_unsigned_int = createref_unsigned_int(10);
if (value_unsigned_int(cvar.var_unsigned_int) != 10)
- error
+ error("failed");
endif
cvar.var_long = createref_long(10);
if (value_long(cvar.var_long) != 10)
- error
+ error("failed");
endif
cvar.var_unsigned_long = createref_unsigned_long(10);
if (value_unsigned_long(cvar.var_unsigned_long) != 10)
- error
+ error("failed");
endif
cvar.var_long_long = createref_long_long(int64(0x6FFFFFFFFFFFFFF8));
if (value_long_long(cvar.var_long_long) != int64(0x6FFFFFFFFFFFFFF8))
- error
+ error("failed");
endif
#ull = abs(0xFFFFFFF2FFFFFFF0)
ull = uint64(55834574864);
cvar.var_unsigned_long_long = createref_unsigned_long_long(ull);
if (value_unsigned_long_long(cvar.var_unsigned_long_long) != ull)
- error
+ error("failed");
endif
cvar.var_float = createref_float(10.5);
if (value_float(cvar.var_float) != 10.5)
- error
+ error("failed");
endif
cvar.var_double = createref_double(10.5);
if (value_double(cvar.var_double) != 10.5)
- error
+ error("failed");
endif
# class reference variable
cvar.var_TestClass = createref_TestClass(TestClass(20));
if (value_TestClass(cvar.var_TestClass).num != 20)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/rename_scope_runme.m b/Examples/test-suite/octave/rename_scope_runme.m
index 154f99dfe..776d218c5 100644
--- a/Examples/test-suite/octave/rename_scope_runme.m
+++ b/Examples/test-suite/octave/rename_scope_runme.m
@@ -4,11 +4,11 @@ a = Natural_UP();
b = Natural_BP();
if (a.rtest() != 1)
- error
+ error("failed");
endif
if (b.rtest() != 1)
- error
+ error("failed");
endif
f = @equals;
diff --git a/Examples/test-suite/octave/ret_by_value_runme.m b/Examples/test-suite/octave/ret_by_value_runme.m
index 67f80aae2..c1c508353 100644
--- a/Examples/test-suite/octave/ret_by_value_runme.m
+++ b/Examples/test-suite/octave/ret_by_value_runme.m
@@ -7,9 +7,9 @@ ret_by_value
a = ret_by_value.get_test();
if (a.myInt != 100)
- error
+ error("failed");
endif
if (a.myShort != 200)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_extend_runme.m b/Examples/test-suite/octave/smart_pointer_extend_runme.m
index 6c9258e6d..cf82f7350 100644
--- a/Examples/test-suite/octave/smart_pointer_extend_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_extend_runme.m
@@ -9,7 +9,7 @@ f = Foo();
b = Bar(f);
if (b.extension() != f.extension())
- error
+ error("failed");
endif
@@ -18,15 +18,15 @@ d = CDerived();
p = CPtr();
if (b.bar() != p.bar())
- error
+ error("failed");
endif
if (d.foo() != p.foo())
- error
+ error("failed");
endif
if (b.hello() != p.hello())
- error
+ error("failed");
endif
@@ -36,11 +36,11 @@ d = DFoo();
dp = DPtrFoo(d);
if (d.SExt(1) != dp.SExt(1))
- error
+ error("failed");
endif
if (d.Ext(1) != dp.Ext(1))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_member_runme.m b/Examples/test-suite/octave/smart_pointer_member_runme.m
index 30251c3a8..1c2d0e9ed 100644
--- a/Examples/test-suite/octave/smart_pointer_member_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_member_runme.m
@@ -4,7 +4,7 @@ f = Foo();
f.y = 1;
if (f.y != 1)
- error
+ error("failed");
endif
b = Bar(f);
@@ -15,18 +15,18 @@ if (f.y != 2)
endif
if (swig_this(b.x) != swig_this(f.x))
- error
+ error("failed");
endif
if (b.z != f.z)
- error
+ error("failed");
endif
try
if (Foo.z == Bar.z)
- error
+ error("failed");
endif
- error
+ error("failed");
catch
end_try_catch
diff --git a/Examples/test-suite/octave/smart_pointer_multi_runme.m b/Examples/test-suite/octave/smart_pointer_multi_runme.m
index 71ef9109a..ea15d04b9 100644
--- a/Examples/test-suite/octave/smart_pointer_multi_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_multi_runme.m
@@ -7,11 +7,11 @@ g = Grok(b);
s.x = 3;
if (s.getx() != 3)
- error
+ error("failed");
endif
g.x = 4;
if (g.getx() != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m b/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
index 4b77e0eea..c2ab78714 100644
--- a/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
@@ -7,12 +7,12 @@ g = Grok(b);
s.x = 3;
if (s.getx() != 3)
- error
+ error("failed");
endif
g.x = 4;
if (g.getx() != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_overload_runme.m b/Examples/test-suite/octave/smart_pointer_overload_runme.m
index a5df0ded4..1bfb68354 100644
--- a/Examples/test-suite/octave/smart_pointer_overload_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_overload_runme.m
@@ -10,23 +10,23 @@ b = Bar(f);
if (f.test(3) != 1)
- error
+ error("failed");
endif
if (f.test(3.5) != 2)
- error
+ error("failed");
endif
if (f.test("hello") != 3)
- error
+ error("failed");
endif
if (b.test(3) != 1)
- error
+ error("failed");
endif
if (b.test(3.5) != 2)
- error
+ error("failed");
endif
if (b.test("hello") != 3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_rename_runme.m b/Examples/test-suite/octave/smart_pointer_rename_runme.m
index 5eb6d4c3c..307bd8f95 100644
--- a/Examples/test-suite/octave/smart_pointer_rename_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_rename_runme.m
@@ -9,14 +9,14 @@ f = Foo();
b = Bar(f);
if (b.test() != 3)
- error
+ error("failed");
endif
if (b.ftest1(1) != 1)
- error
+ error("failed");
endif
if (b.ftest2(2,3) != 2)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_simple_runme.m b/Examples/test-suite/octave/smart_pointer_simple_runme.m
index 30b1387c4..c15c43ca9 100644
--- a/Examples/test-suite/octave/smart_pointer_simple_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_simple_runme.m
@@ -10,11 +10,11 @@ b = Bar(f);
b.x = 3;
if (b.getx() != 3)
- error
+ error("failed");
endif
fp = b.__deref__();
fp.x = 4;
if (fp.getx() != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m b/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
index 4884fa24b..ee45f68f9 100644
--- a/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
@@ -3,17 +3,17 @@ smart_pointer_templatevariables
d = DiffImContainerPtr_D(create(1234, 5678));
if (d.id != 1234)
- error
+ error("failed");
endif
#if (d.xyz != 5678):
-# error
+# error("failed");
d.id = 4321;
#d.xyz = 8765
if (d.id != 4321)
- error
+ error("failed");
endif
#if (d.xyz != 8765):
-# error
+# error("failed");
diff --git a/Examples/test-suite/octave/smart_pointer_typedef_runme.m b/Examples/test-suite/octave/smart_pointer_typedef_runme.m
index 0e1c8a61e..3a094670f 100644
--- a/Examples/test-suite/octave/smart_pointer_typedef_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_typedef_runme.m
@@ -10,11 +10,11 @@ b = Bar(f);
b.x = 3;
if (b.getx() != 3)
- error
+ error("failed");
endif
fp = b.__deref__();
fp.x = 4;
if (fp.getx() != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/static_const_member_2_runme.m b/Examples/test-suite/octave/static_const_member_2_runme.m
index 73260bae7..8619fd1eb 100644
--- a/Examples/test-suite/octave/static_const_member_2_runme.m
+++ b/Examples/test-suite/octave/static_const_member_2_runme.m
@@ -18,6 +18,6 @@ end_try_catch
if (Foo.BAZ.val != 2*Foo.BAR.val)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/std_containers_runme.m b/Examples/test-suite/octave/std_containers_runme.m
index eae3d5d9f..d069b585c 100644
--- a/Examples/test-suite/octave/std_containers_runme.m
+++ b/Examples/test-suite/octave/std_containers_runme.m
@@ -132,7 +132,7 @@ s.append(3);
j=1;
for i in s,
if (i != j)
- error
+ error("failed");
endif
j = j + 1;
endfor
diff --git a/Examples/test-suite/octave/struct_value_runme.m b/Examples/test-suite/octave/struct_value_runme.m
index ff344047e..7f7448bb6 100644
--- a/Examples/test-suite/octave/struct_value_runme.m
+++ b/Examples/test-suite/octave/struct_value_runme.m
@@ -9,10 +9,10 @@ b = struct_value.Bar();
b.a.x = 3;
if (b.a.x != 3)
- error
+ error("failed");
endif
b.b.x = 3;
if (b.b.x != 3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/swigobject_runme.m b/Examples/test-suite/octave/swigobject_runme.m
index 73167e497..9ab3aa8c6 100644
--- a/Examples/test-suite/octave/swigobject_runme.m
+++ b/Examples/test-suite/octave/swigobject_runme.m
@@ -11,7 +11,7 @@ a1 = a_ptr(a);
a2 = a_ptr(a);
if (swig_this(a1) != swig_this(a2))
- error
+ error("failed");
endif
@@ -20,7 +20,7 @@ xstr1 = printf("0x%x",lthis);
xstr2 = pointer_str(a);
if (xstr1 != xstr2)
- error
+ error("failed");
endif
s = str(a.this);
@@ -29,5 +29,5 @@ r = repr(a.this);
v1 = v_ptr(a);
v2 = v_ptr(a);
if (uint64(v1) != uint64(v2))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_extend1_runme.m b/Examples/test-suite/octave/template_extend1_runme.m
index 5035debf5..05e534107 100644
--- a/Examples/test-suite/octave/template_extend1_runme.m
+++ b/Examples/test-suite/octave/template_extend1_runme.m
@@ -9,9 +9,9 @@ a = template_extend1.lBaz();
b = template_extend1.dBaz();
if (!strcmp(a.foo(),"lBaz::foo"))
- error
+ error("failed");
endif
if (!strcmp(b.foo(),"dBaz::foo"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_extend2_runme.m b/Examples/test-suite/octave/template_extend2_runme.m
index 24472a9ed..e9b5fb799 100644
--- a/Examples/test-suite/octave/template_extend2_runme.m
+++ b/Examples/test-suite/octave/template_extend2_runme.m
@@ -9,9 +9,9 @@ a = template_extend2.lBaz();
b = template_extend2.dBaz();
if (!strcmp(a.foo(),"lBaz::foo"))
- error
+ error("failed");
endif
if (!strcmp(b.foo(),"dBaz::foo"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_inherit_runme.m b/Examples/test-suite/octave/template_inherit_runme.m
index 368cce227..72d7e7511 100644
--- a/Examples/test-suite/octave/template_inherit_runme.m
+++ b/Examples/test-suite/octave/template_inherit_runme.m
@@ -12,62 +12,62 @@ e = FooUInt();
f = BarUInt();
if (!strcmp(a.blah(),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(b.blah(),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(e.blah(),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(c.blah(),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(d.blah(),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(f.blah(),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(c.foomethod(),"foomethod"))
- error
+ error("failed");
endif
if (!strcmp(d.foomethod(),"foomethod"))
- error
+ error("failed");
endif
if (!strcmp(f.foomethod(),"foomethod"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_int(a),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_int(c),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_double(b),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_double(d),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_uint(e),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_uint(f),"Bar"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_ns4_runme.m b/Examples/test-suite/octave/template_ns4_runme.m
index b5746427b..6dff55694 100644
--- a/Examples/test-suite/octave/template_ns4_runme.m
+++ b/Examples/test-suite/octave/template_ns4_runme.m
@@ -7,5 +7,5 @@ template_ns4
d = make_Class_DD();
if (!strcmp(d.test(),"test"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_ns_runme.m b/Examples/test-suite/octave/template_ns_runme.m
index 29a2f53f6..44b13e62c 100644
--- a/Examples/test-suite/octave/template_ns_runme.m
+++ b/Examples/test-suite/octave/template_ns_runme.m
@@ -3,19 +3,19 @@ p1 = pairii(2,3);
p2 = pairii(p1);
if (p2.first != 2)
- error
+ error("failed");
endif
if (p2.second != 3)
- error
+ error("failed");
endif
p3 = pairdd(3.5,2.5);
p4 = pairdd(p3);
if (p4.first != 3.5)
- error
+ error("failed");
endif
if (p4.second != 2.5)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_tbase_template_runme.m b/Examples/test-suite/octave/template_tbase_template_runme.m
index da8ec4c69..b1bfd8f7d 100644
--- a/Examples/test-suite/octave/template_tbase_template_runme.m
+++ b/Examples/test-suite/octave/template_tbase_template_runme.m
@@ -2,5 +2,5 @@ template_tbase_template
a = make_Class_dd();
if (!strcmp(a.test(),"test"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_typedef_cplx2_runme.m b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
index a72e0f1e0..eb783fe81 100644
--- a/Examples/test-suite/octave/template_typedef_cplx2_runme.m
+++ b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
@@ -15,7 +15,7 @@ end_try_catch
if (strfind('ArithUnaryFunction',swig_type(d)) != 1)
d
error("is not an ArithUnaryFunction")
- error
+ error("failed");
endif
try
@@ -77,7 +77,7 @@ end_try_catch
if (strfind('ArithUnaryFunction',swig_type(g)) != 1)
g
error("is not an ArithUnaryFunction")
- error
+ error("failed");
endif
@@ -98,6 +98,6 @@ try
a = g.get_value();
catch
error(g, "has not get_value() method")
- error
+ error("failed");
end_try_catch
diff --git a/Examples/test-suite/octave/template_typedef_runme.m b/Examples/test-suite/octave/template_typedef_runme.m
index 8d8af795b..2a734e207 100644
--- a/Examples/test-suite/octave/template_typedef_runme.m
+++ b/Examples/test-suite/octave/template_typedef_runme.m
@@ -8,7 +8,7 @@ try
a = swig_this(d);
a = swig_this(c);
catch
- error
+ error("failed");
end_try_catch
try
@@ -37,15 +37,15 @@ end_try_catch
# the old large format
if (strcmp("",swig_typequery("vfncs::ArithUnaryFunction::argument_type,vfncs::arith_traits::result_type > *")))
- error
+ error("failed");
endif
# the reduced format
if (strcmp("",swig_typequery("vfncs::ArithUnaryFunction *")))
- error
+ error("failed");
endif
# this is a bad name
if (!strcmp("",swig_typequery("vfncs::ArithUnaryFunction *")))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/typemap_namespace_runme.m b/Examples/test-suite/octave/typemap_namespace_runme.m
index ec62a3910..e67781c66 100644
--- a/Examples/test-suite/octave/typemap_namespace_runme.m
+++ b/Examples/test-suite/octave/typemap_namespace_runme.m
@@ -1,10 +1,10 @@
typemap_namespace
if (!strcmp(test1("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(test2("hello"),"hello"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/typemap_ns_using_runme.m b/Examples/test-suite/octave/typemap_ns_using_runme.m
index dd3f657f0..d94241b9c 100644
--- a/Examples/test-suite/octave/typemap_ns_using_runme.m
+++ b/Examples/test-suite/octave/typemap_ns_using_runme.m
@@ -1,5 +1,5 @@
typemap_ns_using
if (typemap_ns_using.spam(37) != 37)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/types_directive_runme.m b/Examples/test-suite/octave/types_directive_runme.m
index 0757c6c39..5ad4af1bb 100644
--- a/Examples/test-suite/octave/types_directive_runme.m
+++ b/Examples/test-suite/octave/types_directive_runme.m
@@ -3,13 +3,13 @@ types_directive
d1 = Time1(2001, 2, 3, 60);
newDate = add(d1, 7); # check that a Time1 instance is accepted where Date is expected
if (newDate.day != 10)
- error
+ error("failed");
endif
d2 = Time2(1999, 8, 7, 60);
newDate = add(d2, 7); # check that a Time2 instance is accepted where Date is expected
if (newDate.day != 14)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/using1_runme.m b/Examples/test-suite/octave/using1_runme.m
index 9253a1d35..e25128ec7 100644
--- a/Examples/test-suite/octave/using1_runme.m
+++ b/Examples/test-suite/octave/using1_runme.m
@@ -6,5 +6,5 @@ endif
using1
if (using1.spam(37) != 37)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/using2_runme.m b/Examples/test-suite/octave/using2_runme.m
index 7cc668940..0213ee7c6 100644
--- a/Examples/test-suite/octave/using2_runme.m
+++ b/Examples/test-suite/octave/using2_runme.m
@@ -6,5 +6,5 @@ endif
using2
if (using2.spam(37) != 37)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/virtual_poly_runme.m b/Examples/test-suite/octave/virtual_poly_runme.m
index 0c7c95153..363f86798 100644
--- a/Examples/test-suite/octave/virtual_poly_runme.m
+++ b/Examples/test-suite/octave/virtual_poly_runme.m
@@ -10,23 +10,23 @@ dc = d.copy();
ic = i.copy();
if (d.get() != dc.get())
- error
+ error("failed");
endif
if (i.get() != ic.get())
- error
+ error("failed");
endif
virtual_poly.incr(ic);
if ((i.get() + 1) != ic.get())
- error
+ error("failed");
endif
dr = d.ref_this();
if (d.get() != dr.get())
- error
+ error("failed");
endif
@@ -35,10 +35,10 @@ endif
#
ddc = virtual_poly.NDouble_narrow(d.nnumber());
if (d.get() != ddc.get())
- error
+ error("failed");
endif
dic = virtual_poly.NInt_narrow(i.nnumber());
if (i.get() != dic.get())
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/voidtest_runme.m b/Examples/test-suite/octave/voidtest_runme.m
index fb411ee4e..c4815a597 100644
--- a/Examples/test-suite/octave/voidtest_runme.m
+++ b/Examples/test-suite/octave/voidtest_runme.m
@@ -27,16 +27,16 @@ end_try_catch
v1 = voidtest.vfunc1(f);
v2 = voidtest.vfunc2(f);
if (swig_this(v1) != swig_this(v2))
- error
+ error("failed");
endif
v3 = voidtest.vfunc3(v1);
if (swig_this(v3) != swig_this(f))
- error
+ error("failed");
endif
v4 = voidtest.vfunc1(f);
if (swig_this(v4) != swig_this(v1))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/overload_arrays.i b/Examples/test-suite/overload_arrays.i
index 272c96a3d..e6bd09adf 100644
--- a/Examples/test-suite/overload_arrays.i
+++ b/Examples/test-suite/overload_arrays.i
@@ -2,10 +2,6 @@
// Based on overload_simple testcase
%module overload_arrays
-#ifdef SWIGCHICKEN
-%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) fbool;
-#endif
-
#ifdef SWIGLUA
// lua only has one numeric type, so most of the overloads shadow each other creating warnings
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) foo;
diff --git a/Examples/test-suite/overload_polymorphic.i b/Examples/test-suite/overload_polymorphic.i
index ac004f948..72aabd840 100644
--- a/Examples/test-suite/overload_polymorphic.i
+++ b/Examples/test-suite/overload_polymorphic.i
@@ -23,4 +23,7 @@ class Unknown;
int test2(Unknown* unknown) { return 0; }
int test2(Base* base) { return 1; }
+int test3(const char*, const Base* = 0, bool = false) { return 0; }
+int test3(Base&, const char* = 0, const Base* = 0, bool = false) { return 1; }
+
%}
diff --git a/Examples/test-suite/overload_simple.i b/Examples/test-suite/overload_simple.i
index ba1900b40..fa2e335bb 100644
--- a/Examples/test-suite/overload_simple.i
+++ b/Examples/test-suite/overload_simple.i
@@ -1,10 +1,6 @@
// Simple tests of overloaded functions
%module overload_simple
-#ifdef SWIGCHICKEN
-%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) fbool;
-#endif
-
#ifdef SWIGLUA
// lua only has one numeric type, so most of the overloads shadow each other creating warnings
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) foo;
diff --git a/Examples/test-suite/perl5/Makefile.in b/Examples/test-suite/perl5/Makefile.in
index 48d5fa5d1..6388e5b32 100644
--- a/Examples/test-suite/perl5/Makefile.in
+++ b/Examples/test-suite/perl5/Makefile.in
@@ -16,11 +16,13 @@ CPP_TEST_CASES += \
li_cstring \
li_cdata_carrays_cpp \
li_reference \
+ memberin1 \
director_nestedmodule \
C_TEST_CASES += \
li_cstring \
li_cdata_carrays \
+ multivalue \
include $(srcdir)/../common.mk
diff --git a/Examples/test-suite/perl5/li_typemaps_runme.pl b/Examples/test-suite/perl5/li_typemaps_runme.pl
index a573b89a0..2755862a2 100644
--- a/Examples/test-suite/perl5/li_typemaps_runme.pl
+++ b/Examples/test-suite/perl5/li_typemaps_runme.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 415;
+use Test::More tests => 416;
BEGIN { use_ok('li_typemaps') }
require_ok('li_typemaps');
@@ -75,10 +75,11 @@ SKIP: {
batch('ulonglong', $c);
}
-my($foo, $int) = li_typemaps::out_foo(10);
+my($foo, $int, $int2) = li_typemaps::out_foo(10);
isa_ok($foo, 'li_typemaps::Foo');
is($foo->{a}, 10);
is($int, 20);
+is($int2, 30);
my($a, $b) = li_typemaps::inoutr_int2(13, 31);
is($a, 13);
diff --git a/Examples/test-suite/perl5/multivalue_runme.pl b/Examples/test-suite/perl5/multivalue_runme.pl
new file mode 100644
index 000000000..b58a58a11
--- /dev/null
+++ b/Examples/test-suite/perl5/multivalue_runme.pl
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+use Test::More tests => 8;
+
+BEGIN { use_ok('multivalue') }
+require_ok('multivalue');
+
+my ($q, $r);
+
+($q, $r) = multivalue::divide_l(37, 5);
+is($q, 7, "Test divide_l quotient");
+is($r, 2, "Test divide_l remainder");
+
+($q, $r) = multivalue::divide_v(41, 7);
+is($q, 5, "Test divide_v quotient");
+is($r, 6, "Test divide_v remainder");
+
+($q, $r) = multivalue::divide_mv(91, 13);
+is($q, 7, "Test divide_mv quotient");
+is($r, 0, "Test divide_mv remainder");
diff --git a/Examples/test-suite/php/Makefile.in b/Examples/test-suite/php/Makefile.in
index 64f0d1f9d..b64918df7 100644
--- a/Examples/test-suite/php/Makefile.in
+++ b/Examples/test-suite/php/Makefile.in
@@ -11,10 +11,19 @@ top_builddir = @top_builddir@
CPP_TEST_CASES += \
callback \
+ director_stl \
+ exception_partial_info \
+ inout \
+ li_cdata_carrays_cpp \
li_factory \
php_iterator \
php_namewarn_rename \
php_pragma \
+ prefix \
+
+C_TEST_CASES += \
+ li_cdata_carrays \
+ multivalue \
include $(srcdir)/../common.mk
@@ -62,9 +71,9 @@ missingtests: missingcpptests missingctests
# found, runs testcase.php, except for multicpptests.
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL='$(RUNTOOL)' php_run; \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_EXTENSION=$(TARGETPREFIX)$*@PHP_SO@ PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL='$(RUNTOOL)' php_run; \
elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php RUNTOOL='$(RUNTOOL)' php_run; \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_EXTENSION=$(TARGETPREFIX)$*@PHP_SO@ PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php RUNTOOL='$(RUNTOOL)' php_run; \
fi
# Clean: remove the generated .php file
@@ -79,3 +88,4 @@ clean:
rm -f mod_a.php mod_b.php php_mod_a.h php_mod_b.h
rm -f multi_import_a.php multi_import_b.php php_multi_import_a.h php_multi_import_b.h
rm -f packageoption_a.php packageoption_b.php packageoption_c.php php_packageoption_a.h php_packageoption_b.h php_packageoption_c.h
+ rm -f template_typedef_cplx2.php php_template_typedef_cplx2.h
diff --git a/Examples/test-suite/php/abstract_inherit_ok_runme.php b/Examples/test-suite/php/abstract_inherit_ok_runme.php
index c2c343dac..6cfea2341 100644
--- a/Examples/test-suite/php/abstract_inherit_ok_runme.php
+++ b/Examples/test-suite/php/abstract_inherit_ok_runme.php
@@ -1,7 +1,6 @@
blah(),"spam object method");
check::done();
-?>
diff --git a/Examples/test-suite/php/abstract_inherit_runme.php b/Examples/test-suite/php/abstract_inherit_runme.php
index 514bbc3b0..6a0180d78 100644
--- a/Examples/test-suite/php/abstract_inherit_runme.php
+++ b/Examples/test-suite/php/abstract_inherit_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/add_link_runme.php b/Examples/test-suite/php/add_link_runme.php
index 3e16fa1df..073dee36d 100644
--- a/Examples/test-suite/php/add_link_runme.php
+++ b/Examples/test-suite/php/add_link_runme.php
@@ -1,10 +1,9 @@
diff --git a/Examples/test-suite/php/argout_runme.php b/Examples/test-suite/php/argout_runme.php
index 8b66613fd..d233cf0f6 100644
--- a/Examples/test-suite/php/argout_runme.php
+++ b/Examples/test-suite/php/argout_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/arrayptr_runme.php b/Examples/test-suite/php/arrayptr_runme.php
deleted file mode 100644
index 86b7f8628..000000000
--- a/Examples/test-suite/php/arrayptr_runme.php
+++ /dev/null
@@ -1,14 +0,0 @@
-
diff --git a/Examples/test-suite/php/arrays_global_runme.php b/Examples/test-suite/php/arrays_global_runme.php
index 95a300775..6a97db91e 100644
--- a/Examples/test-suite/php/arrays_global_runme.php
+++ b/Examples/test-suite/php/arrays_global_runme.php
@@ -1,11 +1,11 @@
diff --git a/Examples/test-suite/php/arrays_global_twodim_runme.php b/Examples/test-suite/php/arrays_global_twodim_runme.php
index d9f50a6de..e6fbf52d9 100644
--- a/Examples/test-suite/php/arrays_global_twodim_runme.php
+++ b/Examples/test-suite/php/arrays_global_twodim_runme.php
@@ -1,11 +1,11 @@
diff --git a/Examples/test-suite/php/arrays_runme.php b/Examples/test-suite/php/arrays_runme.php
index c6e9e8f70..eb06fbfd8 100644
--- a/Examples/test-suite/php/arrays_runme.php
+++ b/Examples/test-suite/php/arrays_runme.php
@@ -1,10 +1,10 @@
array_c,"a",'$as->array_c=="a"');
check::equal(isset($as->array_const_i),TRUE,'isset($as->array_const_i)');
check::done();
-?>
diff --git a/Examples/test-suite/php/arrays_scope_runme.php b/Examples/test-suite/php/arrays_scope_runme.php
index 11c180870..f18037ca7 100644
--- a/Examples/test-suite/php/arrays_scope_runme.php
+++ b/Examples/test-suite/php/arrays_scope_runme.php
@@ -1,16 +1,14 @@
diff --git a/Examples/test-suite/php/callback_runme.php b/Examples/test-suite/php/callback_runme.php
index fefa32502..717185649 100644
--- a/Examples/test-suite/php/callback_runme.php
+++ b/Examples/test-suite/php/callback_runme.php
@@ -1,9 +1,10 @@
diff --git a/Examples/test-suite/php/casts_runme.php b/Examples/test-suite/php/casts_runme.php
index a9623a328..6234f0fab 100644
--- a/Examples/test-suite/php/casts_runme.php
+++ b/Examples/test-suite/php/casts_runme.php
@@ -1,13 +1,12 @@
hello();
check::done();
-?>
diff --git a/Examples/test-suite/php/char_strings_runme.php b/Examples/test-suite/php/char_strings_runme.php
index e06ee9d2b..7dc8fe74d 100644
--- a/Examples/test-suite/php/char_strings_runme.php
+++ b/Examples/test-suite/php/char_strings_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/class_ignore_runme.php b/Examples/test-suite/php/class_ignore_runme.php
index ae4881f27..f52bc1a13 100644
--- a/Examples/test-suite/php/class_ignore_runme.php
+++ b/Examples/test-suite/php/class_ignore_runme.php
@@ -1,9 +1,8 @@
diff --git a/Examples/test-suite/php/conversion_namespace_runme.php b/Examples/test-suite/php/conversion_namespace_runme.php
index e21ff7438..858bf89d9 100644
--- a/Examples/test-suite/php/conversion_namespace_runme.php
+++ b/Examples/test-suite/php/conversion_namespace_runme.php
@@ -1,7 +1,6 @@
toFoo();
check::classname("foo",$foo);
check::done();
-?>
diff --git a/Examples/test-suite/php/conversion_ns_template_runme.php b/Examples/test-suite/php/conversion_ns_template_runme.php
index 9702eedb7..4157b106a 100644
--- a/Examples/test-suite/php/conversion_ns_template_runme.php
+++ b/Examples/test-suite/php/conversion_ns_template_runme.php
@@ -1,10 +1,8 @@
diff --git a/Examples/test-suite/php/conversion_runme.php b/Examples/test-suite/php/conversion_runme.php
index 1a10ff4f4..858bf89d9 100644
--- a/Examples/test-suite/php/conversion_runme.php
+++ b/Examples/test-suite/php/conversion_runme.php
@@ -1,7 +1,6 @@
toFoo();
check::classname("foo",$foo);
check::done();
-?>
diff --git a/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php b/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php
index bee59b209..82296deb7 100644
--- a/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php
+++ b/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php
@@ -1,7 +1,6 @@
class1Test2(Class1::Enum12_Val5c), 1121);
enumCheck(globalTest1(Enum1_Val5a), 13);
enumCheck(globalTest2(Class1::Enum12_Val5c), 1121);
#enumCheck(globalTest3(Class1::Struct1.Enum12_Val5f), 3121);
-
-?>
diff --git a/Examples/test-suite/php/cpp_basic_runme.php b/Examples/test-suite/php/cpp_basic_runme.php
index b24cf7000..fb34bc936 100644
--- a/Examples/test-suite/php/cpp_basic_runme.php
+++ b/Examples/test-suite/php/cpp_basic_runme.php
@@ -1,14 +1,13 @@
func_ptr = get_func1_ptr();
@@ -16,5 +15,12 @@ check::equal(test_func_ptr($f, 7), 2*7*3, "get_func1_ptr() didn't work");
$f->func_ptr = get_func2_ptr();
check::equal(test_func_ptr($f, 7), -7*3, "get_func2_ptr() didn't work");
+// Test that custom properties work - standard PHP objects support them,
+// so PHP developers will expect them to work for SWIG-wrapped objects too.
+check::equal($f->custom_prop, NULL, "Test unset custom property");
+$f->custom_prop = "test";
+check::equal($f->custom_prop, "test", "Test custom property setting");
+$f->custom_prop = 42;
+check::equal($f->custom_prop, 42, "Test custom property setting");
+
check::done();
-?>
diff --git a/Examples/test-suite/php/cpp_static_runme.php b/Examples/test-suite/php/cpp_static_runme.php
index 20b50dd9e..a1fd85c2e 100644
--- a/Examples/test-suite/php/cpp_static_runme.php
+++ b/Examples/test-suite/php/cpp_static_runme.php
@@ -1,14 +1,12 @@
diff --git a/Examples/test-suite/php/director_abstract_runme.php b/Examples/test-suite/php/director_abstract_runme.php
index 1a119cfd5..bb424f9ea 100644
--- a/Examples/test-suite/php/director_abstract_runme.php
+++ b/Examples/test-suite/php/director_abstract_runme.php
@@ -1,13 +1,12 @@
isAbstract(), true, "Example3_i abstractness failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/director_basic_runme.php b/Examples/test-suite/php/director_basic_runme.php
index 478a36f80..db7adefc1 100644
--- a/Examples/test-suite/php/director_basic_runme.php
+++ b/Examples/test-suite/php/director_basic_runme.php
@@ -1,14 +1,12 @@
x, 34, "bc failed");
check::equal($bd->x, 16, "bd failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/director_classic_runme.php b/Examples/test-suite/php/director_classic_runme.php
index a44881e04..e2ac1f7a7 100644
--- a/Examples/test-suite/php/director_classic_runme.php
+++ b/Examples/test-suite/php/director_classic_runme.php
@@ -1,13 +1,12 @@
id();
if ($debug)
print $ret . "\n";
- # TODO: Currently we do not track the dynamic type of returned
- # objects, so in case it's possible that the dynamic type is not equal
- # to the static type, we skip this check.
- if (get_parent_class($person) === false)
- check::equal($ret, $expected, "#3 failed");
+ check::equal($ret, $expected, "#3 failed");
$caller->resetCallback();
if ($debug)
@@ -147,4 +142,3 @@ mycheck($person, "TargetLangOrphanChild");
unset($person);
check::done();
-?>
diff --git a/Examples/test-suite/php/director_default_runme.php b/Examples/test-suite/php/director_default_runme.php
index c459ce3ec..92e415041 100644
--- a/Examples/test-suite/php/director_default_runme.php
+++ b/Examples/test-suite/php/director_default_runme.php
@@ -1,13 +1,12 @@
diff --git a/Examples/test-suite/php/director_detect_runme.php b/Examples/test-suite/php/director_detect_runme.php
index a6d3aebd6..ae92f7a0c 100644
--- a/Examples/test-suite/php/director_detect_runme.php
+++ b/Examples/test-suite/php/director_detect_runme.php
@@ -1,13 +1,12 @@
val, 5, "b: Bad virtual detection");
check::equal($vc, 6, "c: Bad virtual detection");
check::done();
-?>
diff --git a/Examples/test-suite/php/director_enum_runme.php b/Examples/test-suite/php/director_enum_runme.php
index 0571ec0da..21e07a57b 100644
--- a/Examples/test-suite/php/director_enum_runme.php
+++ b/Examples/test-suite/php/director_enum_runme.php
@@ -1,13 +1,12 @@
say_hi(director_enum::hello), $b->say_hello(director_enum::hi), "say failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/director_exception_runme.php b/Examples/test-suite/php/director_exception_runme.php
index dd2d04e8a..e49c12da6 100644
--- a/Examples/test-suite/php/director_exception_runme.php
+++ b/Examples/test-suite/php/director_exception_runme.php
@@ -1,13 +1,12 @@
pong();
@@ -124,4 +121,3 @@ try {
}
check::done();
-?>
diff --git a/Examples/test-suite/php/director_extend_runme.php b/Examples/test-suite/php/director_extend_runme.php
index 7aa2e0f78..418985476 100644
--- a/Examples/test-suite/php/director_extend_runme.php
+++ b/Examples/test-suite/php/director_extend_runme.php
@@ -1,13 +1,12 @@
dummy(), 666, "1st call");
check::equal($m->dummy(), 666, "2st call"); // Locked system
check::done();
-?>
diff --git a/Examples/test-suite/php/director_finalizer_runme.php b/Examples/test-suite/php/director_finalizer_runme.php
index 96bb5c179..f3a0c2c40 100644
--- a/Examples/test-suite/php/director_finalizer_runme.php
+++ b/Examples/test-suite/php/director_finalizer_runme.php
@@ -1,18 +1,22 @@
orStatus(2);
+ # It's not safe to call methods on the C++ object from the PHP destructor
+ # if the object has been disowned, since the C++ object will already have
+ # been destroyed by the time the PHP destructor runs.
+ if ($this->thisown) {
+ $this->orStatus(2);
+ }
if (method_exists(get_parent_class(), "__destruct")) {
parent::__destruct();
}
@@ -41,21 +45,24 @@ resetStatus();
$a = new MyFoo();
$a->thisown = 0;
+check::equal(getStatus(), 0, "shadow release does not fire destructor of disowned object");
+
deleteFoo($a);
unset($a);
-check::equal(getStatus(), 3, "getStatus() failed #4");
+# getStatus() would ideally return 3 here.
+check::equal(getStatus(), 1, "getStatus() failed #4");
resetStatus();
$a = new MyFoo();
$a->thisown = 0;
-deleteFoo(launder($a));
+$g = launder($a);
unset($a);
-
-check::equal(getStatus(), 3, "getStatus() failed #5");
+deleteFoo($g);
+# getStatus() would ideally return 3 here.
+check::equal(getStatus(), 1, "getStatus() failed #5");
resetStatus();
check::done();
-?>
diff --git a/Examples/test-suite/php/director_frob_runme.php b/Examples/test-suite/php/director_frob_runme.php
index 450a1234b..732b9d500 100644
--- a/Examples/test-suite/php/director_frob_runme.php
+++ b/Examples/test-suite/php/director_frob_runme.php
@@ -1,14 +1,13 @@
abs_method();
@@ -16,4 +15,3 @@ $s = $foo->abs_method();
check::equal($s, "Bravo::abs_method()", "s failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/director_nested_runme.php b/Examples/test-suite/php/director_nested_runme.php
index 9a094a182..adf9f6206 100644
--- a/Examples/test-suite/php/director_nested_runme.php
+++ b/Examples/test-suite/php/director_nested_runme.php
@@ -1,13 +1,12 @@
advance();
check::equal($c->get_name(), "FooBar::get_name hello", "get_name failed");
@@ -71,4 +67,3 @@ check::equal($c->get_name(), "FooBar::get_name hello", "get_name failed");
check::equal($c->name(), "FooBar::get_name hello", "name failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/director_overload_runme.php b/Examples/test-suite/php/director_overload_runme.php
new file mode 100644
index 000000000..07b485d95
--- /dev/null
+++ b/Examples/test-suite/php/director_overload_runme.php
@@ -0,0 +1,14 @@
+rw(), 42, "get_set() initial value not 42");
+check::equal($o->rw(7), null, "get_set() failed to set");
+check::equal($o->rw(), 7, "get_set() didn't return back set value");
+
+check::done();
diff --git a/Examples/test-suite/php/director_pass_by_value_runme.php b/Examples/test-suite/php/director_pass_by_value_runme.php
index 8a8b84d67..d3763292f 100644
--- a/Examples/test-suite/php/director_pass_by_value_runme.php
+++ b/Examples/test-suite/php/director_pass_by_value_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/director_profile_runme.php b/Examples/test-suite/php/director_profile_runme.php
index c6f4c3c94..219ec815a 100644
--- a/Examples/test-suite/php/director_profile_runme.php
+++ b/Examples/test-suite/php/director_profile_runme.php
@@ -1,13 +1,12 @@
diff --git a/Examples/test-suite/php/director_protected_runme.php b/Examples/test-suite/php/director_protected_runme.php
index e759fed25..b73c8f872 100644
--- a/Examples/test-suite/php/director_protected_runme.php
+++ b/Examples/test-suite/php/director_protected_runme.php
@@ -1,11 +1,12 @@
callping(), "Bar::ping();", "bad fb3::callping");
check::equal($fb3->callcheer(), "FooBar3::cheer();", "bad fb3::callcheer");
check::done();
-?>
diff --git a/Examples/test-suite/php/director_stl_runme.php b/Examples/test-suite/php/director_stl_runme.php
index f7a5c0aa0..654251a30 100644
--- a/Examples/test-suite/php/director_stl_runme.php
+++ b/Examples/test-suite/php/director_stl_runme.php
@@ -1,13 +1,12 @@
tvidents($vs);*/
check::done();
-?>
diff --git a/Examples/test-suite/php/director_string_runme.php b/Examples/test-suite/php/director_string_runme.php
index 77e84c9bf..3127f13fb 100644
--- a/Examples/test-suite/php/director_string_runme.php
+++ b/Examples/test-suite/php/director_string_runme.php
@@ -1,14 +1,13 @@
call_process_func();
check::equal($b->smem, "hello", "smem failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/director_thread_runme.php b/Examples/test-suite/php/director_thread_runme.php
index 2a640a022..190dbad71 100644
--- a/Examples/test-suite/php/director_thread_runme.php
+++ b/Examples/test-suite/php/director_thread_runme.php
@@ -1,18 +1,17 @@
val >= 0) {
$d->stop();
check::done();
-?>
diff --git a/Examples/test-suite/php/director_unroll_runme.php b/Examples/test-suite/php/director_unroll_runme.php
index e3101887d..7f94753f5 100644
--- a/Examples/test-suite/php/director_unroll_runme.php
+++ b/Examples/test-suite/php/director_unroll_runme.php
@@ -1,14 +1,13 @@
set($a);
$c = $b->get();
-// FIXME: This doesn't work for checking that they wrap the same C++ object
-// because the two objects have different PHP resources, and we can't easily
-// look inside those resources to see which C++ objects they refer to.
-//check::equal($a->_cPtr, $c->_cPtr, "_cPtr check failed");
+// FIXME: The python version checks that a.this == c.this, but we don't seem
+// to have a way to check this with the PHP bindings we generate.
check::done();
-?>
diff --git a/Examples/test-suite/php/enum_scope_template_runme.php b/Examples/test-suite/php/enum_scope_template_runme.php
index 85ba467b7..d5aed62f7 100644
--- a/Examples/test-suite/php/enum_scope_template_runme.php
+++ b/Examples/test-suite/php/enum_scope_template_runme.php
@@ -1,15 +1,16 @@
diff --git a/Examples/test-suite/php/evil_diamond_ns_runme.php b/Examples/test-suite/php/evil_diamond_ns_runme.php
index fcce0f767..f2115bf36 100644
--- a/Examples/test-suite/php/evil_diamond_ns_runme.php
+++ b/Examples/test-suite/php/evil_diamond_ns_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/evil_diamond_prop_runme.php b/Examples/test-suite/php/evil_diamond_prop_runme.php
index 9bdb7435f..611f17d6a 100644
--- a/Examples/test-suite/php/evil_diamond_prop_runme.php
+++ b/Examples/test-suite/php/evil_diamond_prop_runme.php
@@ -1,7 +1,6 @@
_foo,"1==spam->_foo");
check::equal(2,$spam->_bar,"2==spam->_bar");
// multiple inheritance not supported in PHP
-set_error_handler(NULL, 0); // Don't complain that _baz is unknown.
check::equal(null,$spam->_baz,"null==spam->_baz");
-restore_error_handler();
check::equal(4,$spam->_spam,"4==spam->_spam");
check::done();
-?>
diff --git a/Examples/test-suite/php/evil_diamond_runme.php b/Examples/test-suite/php/evil_diamond_runme.php
index a587ca359..7d01c98ec 100644
--- a/Examples/test-suite/php/evil_diamond_runme.php
+++ b/Examples/test-suite/php/evil_diamond_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/exception_order_runme.php b/Examples/test-suite/php/exception_order_runme.php
index 77f115fa1..9a2c9118b 100644
--- a/Examples/test-suite/php/exception_order_runme.php
+++ b/Examples/test-suite/php/exception_order_runme.php
@@ -1,10 +1,9 @@
require "tests.php";
-require "exception_order.php";
-check::functions(array('a_foo','a_bar','a_foobar','a_barfoo','is_python_builtin'));
+check::functions(array('is_python_builtin'));
check::classes(array('A','E1','E2','E3','exception_order','ET_i','ET_d'));
-check::globals(array('efoovar','foovar','cfoovar','a_sfoovar','a_foovar','a_efoovar'));
+check::globals(array('efoovar','foovar','cfoovar'));
$a = new A();
try {
@@ -36,4 +35,3 @@ try {
} catch (Exception $e) {
check::equal($e->getMessage(), 'C++ E2 * exception thrown', '');
}
-?>
diff --git a/Examples/test-suite/php/extend_template_ns_runme.php b/Examples/test-suite/php/extend_template_ns_runme.php
index e6d3e9f73..46158672b 100644
--- a/Examples/test-suite/php/extend_template_ns_runme.php
+++ b/Examples/test-suite/php/extend_template_ns_runme.php
@@ -1,7 +1,6 @@
test1(2),"test1");
check::equal(3,$foo->test2(3),"test2");
check::done();
-?>
diff --git a/Examples/test-suite/php/extend_template_runme.php b/Examples/test-suite/php/extend_template_runme.php
index 41bde4458..a6579dce9 100644
--- a/Examples/test-suite/php/extend_template_runme.php
+++ b/Examples/test-suite/php/extend_template_runme.php
@@ -1,7 +1,6 @@
test1(2),"test1");
check::equal(3,$foo->test2(3),"test2");
check::done();
-?>
diff --git a/Examples/test-suite/php/global_vars_runme.php b/Examples/test-suite/php/global_vars_runme.php
new file mode 100644
index 000000000..c3fe7d8aa
--- /dev/null
+++ b/Examples/test-suite/php/global_vars_runme.php
@@ -0,0 +1,27 @@
+
diff --git a/Examples/test-suite/php/ignore_parameter_runme.php b/Examples/test-suite/php/ignore_parameter_runme.php
index b9c2b777d..d9db2d795 100644
--- a/Examples/test-suite/php/ignore_parameter_runme.php
+++ b/Examples/test-suite/php/ignore_parameter_runme.php
@@ -1,10 +1,9 @@
diff --git a/Examples/test-suite/php/import_nomodule_runme.php b/Examples/test-suite/php/import_nomodule_runme.php
index e5ea761f7..e639c781d 100644
--- a/Examples/test-suite/php/import_nomodule_runme.php
+++ b/Examples/test-suite/php/import_nomodule_runme.php
@@ -1,14 +1,16 @@
diff --git a/Examples/test-suite/php/li_carrays_cpp_runme.php b/Examples/test-suite/php/li_carrays_cpp_runme.php
index 3e8a443f6..ccbcf7dde 100644
--- a/Examples/test-suite/php/li_carrays_cpp_runme.php
+++ b/Examples/test-suite/php/li_carrays_cpp_runme.php
@@ -1,16 +1,16 @@
setitem(5, $d->getitem(0) + 3);
check::equal($d->getitem(0) + $d->getitem(5), 17., "7+10==17");
check::done();
-?>
diff --git a/Examples/test-suite/php/li_carrays_runme.php b/Examples/test-suite/php/li_carrays_runme.php
index abe358101..df54e04f5 100644
--- a/Examples/test-suite/php/li_carrays_runme.php
+++ b/Examples/test-suite/php/li_carrays_runme.php
@@ -1,16 +1,16 @@
setitem(5, $d->getitem(0) + 3);
check::equal($d->getitem(0) + $d->getitem(5), 17., "7+10==17");
check::done();
-?>
diff --git a/Examples/test-suite/php/li_factory_runme.php b/Examples/test-suite/php/li_factory_runme.php
index 982d7b1fd..3ccdd035f 100644
--- a/Examples/test-suite/php/li_factory_runme.php
+++ b/Examples/test-suite/php/li_factory_runme.php
@@ -1,13 +1,12 @@
width();
check::equal($w, 1.0, "w failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/li_std_string_runme.php b/Examples/test-suite/php/li_std_string_runme.php
index 04ee3fc86..680b7ce98 100644
--- a/Examples/test-suite/php/li_std_string_runme.php
+++ b/Examples/test-suite/php/li_std_string_runme.php
@@ -1,11 +1,34 @@
ConstMemberString, "const member string", "ConstMembe
check::equal(Structure::StaticMemberString2(), "static member string 2", "StaticMemberString2 test 1");
Structure::StaticMemberString2($s);
check::equal(Structure::StaticMemberString2(), $s, "StaticMemberString2 test 2");
-// below broken ?
-//check::equal(Structure::ConstStaticMemberString(), "const static member string", "ConstStaticMemberString test");
+check::equal(Structure::ConstStaticMemberString(), "const static member string", "ConstStaticMemberString test");
// This used to give "Undefined variable: r"
li_std_string::test_const_reference_returning_void("foo");
check::done();
-?>
diff --git a/Examples/test-suite/php/li_std_vector_member_var_runme.php b/Examples/test-suite/php/li_std_vector_member_var_runme.php
index 238350352..32ce484fc 100644
--- a/Examples/test-suite/php/li_std_vector_member_var_runme.php
+++ b/Examples/test-suite/php/li_std_vector_member_var_runme.php
@@ -1,7 +1,6 @@
start_t->x, 4, "S::x != 4");
check::equal($T->length, 7, "T::length != 7");
check::done();
-?>
diff --git a/Examples/test-suite/php/member_pointer_const_runme.php b/Examples/test-suite/php/member_pointer_const_runme.php
new file mode 100644
index 000000000..3f55549a8
--- /dev/null
+++ b/Examples/test-suite/php/member_pointer_const_runme.php
@@ -0,0 +1,59 @@
+makeMore();
check::equal(get_class($bar), "Foo", "regular failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/newobject3_runme.php b/Examples/test-suite/php/newobject3_runme.php
index edd5d8608..8efa9891d 100644
--- a/Examples/test-suite/php/newobject3_runme.php
+++ b/Examples/test-suite/php/newobject3_runme.php
@@ -1,7 +1,6 @@
create(0), "create(0) should be NULL");
check::isnull($factory->create(7, -1), "create(7, -1) should be NULL");
check::isnull($factory->create(0, -1), "create(0, -1) should be NULL");
check::isnull($factory->create("bad", -1), "create(\"bad\", -1) should be NULL");
-
-?>
diff --git a/Examples/test-suite/php/overload_null_runme.php b/Examples/test-suite/php/overload_null_runme.php
index 22824d4fb..b4b28e44f 100644
--- a/Examples/test-suite/php/overload_null_runme.php
+++ b/Examples/test-suite/php/overload_null_runme.php
@@ -1,7 +1,6 @@
byval1forwardref($x), "test 21");
check::equal(22, $o->byval2forwardref($x), "test 22");
check::done();
-?>
diff --git a/Examples/test-suite/php/overload_polymorphic_runme.php b/Examples/test-suite/php/overload_polymorphic_runme.php
new file mode 100644
index 000000000..908988291
--- /dev/null
+++ b/Examples/test-suite/php/overload_polymorphic_runme.php
@@ -0,0 +1,12 @@
+
diff --git a/Examples/test-suite/php/overload_return_type_runme.php b/Examples/test-suite/php/overload_return_type_runme.php
index 4fa19d22a..5f01bbe19 100644
--- a/Examples/test-suite/php/overload_return_type_runme.php
+++ b/Examples/test-suite/php/overload_return_type_runme.php
@@ -1,7 +1,6 @@
foo(1), 0, "");
@@ -9,5 +8,3 @@ check::classname("A", $b->foo("test"));
check::equal(overload_return_type::foo(), 1, "overload_return_type::foo() should be 1");
check::equal(overload_return_type::bar(), 1, "overload_return_type::bar() should be 1");
-
-?>
diff --git a/Examples/test-suite/php/php_iterator_runme.php b/Examples/test-suite/php/php_iterator_runme.php
index fd645ccb2..76b4757fc 100644
--- a/Examples/test-suite/php/php_iterator_runme.php
+++ b/Examples/test-suite/php/php_iterator_runme.php
@@ -1,9 +1,9 @@
$v) {
check::equal($s, '(0=>2)(1=>3)(2=>4)', 'Simple iteration failed');
check::done();
-?>
diff --git a/Examples/test-suite/php/php_pragma_runme.php b/Examples/test-suite/php/php_pragma_runme.php
index c76cfc9b5..e70f2ceda 100644
--- a/Examples/test-suite/php/php_pragma_runme.php
+++ b/Examples/test-suite/php/php_pragma_runme.php
@@ -1,11 +1,7 @@
getVersion(),"1.5==version(php_pragma)");
check::done();
-
-?>
diff --git a/Examples/test-suite/php/pointer_reference_runme.php b/Examples/test-suite/php/pointer_reference_runme.php
index 52946177e..a8a511271 100644
--- a/Examples/test-suite/php/pointer_reference_runme.php
+++ b/Examples/test-suite/php/pointer_reference_runme.php
@@ -1,7 +1,6 @@
value, 10, "pointer_reference::get() failed");
@@ -15,4 +14,3 @@ check::equal(pointer_reference::overloading(1), 111, "overload test 1 failed");
check::equal(pointer_reference::overloading($ss), 222, "overload test 2 failed");
check::done();
-?>
diff --git a/Examples/test-suite/php/prefix_runme.php b/Examples/test-suite/php/prefix_runme.php
index fcf7c66f6..d1c0ab1ea 100644
--- a/Examples/test-suite/php/prefix_runme.php
+++ b/Examples/test-suite/php/prefix_runme.php
@@ -1,13 +1,12 @@
get_self();
check::done();
-?>
diff --git a/Examples/test-suite/php/preproc_constants_c_runme.php b/Examples/test-suite/php/preproc_constants_c_runme.php
index 20868dcc0..a26892b42 100644
--- a/Examples/test-suite/php/preproc_constants_c_runme.php
+++ b/Examples/test-suite/php/preproc_constants_c_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/preproc_constants_runme.php b/Examples/test-suite/php/preproc_constants_runme.php
index bd216c269..7f45a1bae 100644
--- a/Examples/test-suite/php/preproc_constants_runme.php
+++ b/Examples/test-suite/php/preproc_constants_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/primitive_ref_runme.php b/Examples/test-suite/php/primitive_ref_runme.php
index 263a28074..9b281cf50 100644
--- a/Examples/test-suite/php/primitive_ref_runme.php
+++ b/Examples/test-suite/php/primitive_ref_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/rename_scope_runme.php b/Examples/test-suite/php/rename_scope_runme.php
index df620d796..e1db4f59c 100644
--- a/Examples/test-suite/php/rename_scope_runme.php
+++ b/Examples/test-suite/php/rename_scope_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/skel.php b/Examples/test-suite/php/skel.php
index 780a999ed..7fdebc7d6 100644
--- a/Examples/test-suite/php/skel.php
+++ b/Examples/test-suite/php/skel.php
@@ -2,14 +2,12 @@
// Sample test file
require "tests.php";
-require "____.php";
// No new functions
check::functions(array());
// No new classes
check::classes(array());
-// now new vars
+// No new vars
check::globals(array());
check::done();
-?>
diff --git a/Examples/test-suite/php/smart_pointer_rename_runme.php b/Examples/test-suite/php/smart_pointer_rename_runme.php
index 26692dde5..094860386 100644
--- a/Examples/test-suite/php/smart_pointer_rename_runme.php
+++ b/Examples/test-suite/php/smart_pointer_rename_runme.php
@@ -1,7 +1,6 @@
test(),"bar->test");
check::classname("foo",$bar->__deref__());
check::done();
-?>
diff --git a/Examples/test-suite/php/swig_exception_runme.php b/Examples/test-suite/php/swig_exception_runme.php
index 76641996e..37a7a59ee 100644
--- a/Examples/test-suite/php/swig_exception_runme.php
+++ b/Examples/test-suite/php/swig_exception_runme.php
@@ -1,6 +1,5 @@
diff --git a/Examples/test-suite/php/sym_runme.php b/Examples/test-suite/php/sym_runme.php
index 127d28fd9..7e8f914c1 100644
--- a/Examples/test-suite/php/sym_runme.php
+++ b/Examples/test-suite/php/sym_runme.php
@@ -1,13 +1,12 @@
jam(),"flam-jam","flam()->jam==flam-jam");
check::equal($flam->jar(),"flam-jar","flam()->jar==flam-jar");
check::done();
-?>
diff --git a/Examples/test-suite/php/template_arg_typename_runme.php b/Examples/test-suite/php/template_arg_typename_runme.php
index e609240e7..c7fcbbd9d 100644
--- a/Examples/test-suite/php/template_arg_typename_runme.php
+++ b/Examples/test-suite/php/template_arg_typename_runme.php
@@ -1,7 +1,6 @@
diff --git a/Examples/test-suite/php/template_construct_runme.php b/Examples/test-suite/php/template_construct_runme.php
index b227d9fec..d09bc4d37 100644
--- a/Examples/test-suite/php/template_construct_runme.php
+++ b/Examples/test-suite/php/template_construct_runme.php
@@ -1,11 +1,9 @@
diff --git a/Examples/test-suite/php/tests.php b/Examples/test-suite/php/tests.php
index 20fa1ed98..cec6e581f 100644
--- a/Examples/test-suite/php/tests.php
+++ b/Examples/test-suite/php/tests.php
@@ -1,86 +1,24 @@
getClassNames(),
+ function ($e) { return !preg_match('/^SWIG\\\\/', $e); }));
foreach($classes as $class) {
if (! class_exists($class)) $missing[]=$class;
else unset($extra[$class]);
@@ -164,15 +103,16 @@ class check {
if (! is_array($functions)) $functions=array($functions);
$message=array();
$missing=array();
- $extra=array_flip(check::get_extra_functions());
-
+ $extra = self::$_extension->getFunctions();
foreach ($functions as $func) {
if (! function_exists($func)) $missing[]=$func;
else unset($extra[$func]);
}
+ $extra = array_filter(array_keys($extra),
+ function ($e) { return !preg_match('/_[gs]et$/', $e); });
if ($missing) $message[]=sprintf("Functions missing: %s",join(",",$missing));
if ($message) return check::fail(join("\n ",$message));
- if ($extra) $message[]=sprintf("These extra functions are defined: %s",join(",",array_keys($extra)));
+ if ($extra) $message[]=sprintf("These extra functions are defined: %s",join(",",$extra));
if ($message) return check::warn(join("\n ",$message));
return TRUE;
}
@@ -181,19 +121,19 @@ class check {
if (! is_array($globals)) $globals=array($globals);
$message=array();
$missing=array();
- $extra=array_flip(check::get_extra_globals());
+ $extra = self::$_extension->getFunctions();
foreach ($globals as $glob) {
- if (self::GETSET) {
- if (! isset($extra[$glob])) $missing[]=$glob;
- else unset($extra[$glob]);
- } else {
- if (! isset($GLOBALS[$glob])) $missing[]=$glob;
- else unset($extra[$glob]);
+ if (! function_exists($glob . "_get") && ! function_exists($glob . "_set")) $missing[]=$glob;
+ else {
+ unset($extra[$glob . "_get"]);
+ unset($extra[$glob . "_set"]);
}
}
+ $extra = array_filter(array_keys($extra),
+ function ($e) { return preg_match('/_[gs]et$/', $e); });
if ($missing) $message[]=sprintf("Globals missing: %s",join(",",$missing));
if ($message) return check::fail(join("\n ",$message));
- if ($extra) $message[]=sprintf("These extra globals are defined: %s",join(",",array_keys($extra)));
+ if ($extra) $message[]=sprintf("These extra globals are defined: %s",join(",",$extra));
if ($message) return check::warn(join("\n ",$message));
return TRUE;
@@ -210,24 +150,13 @@ class check {
return TRUE;
}
- static function resource($a,$b,$message) {
- $resource=trim(check::var_dump($a));
- if (! preg_match("/^resource\([0-9]+\) of type \($b\)/i", $resource))
- return check::fail($message);
+ static function equivalent($a,$b,$message) {
+ if (! ($a==$b)) return check::fail($message . ": '$a'!='$b'");
return TRUE;
}
static function isnull($a,$message) {
- $value=trim(check::var_dump($a));
- return check::equal($value,"NULL",$message);
- }
-
- static function var_dump($arg) {
- ob_start();
- var_dump($arg);
- $result=ob_get_contents();
- ob_end_clean();
- return $result;
+ return check::equal($a,NULL,$message);
}
static function fail($pattern) {
@@ -246,4 +175,5 @@ class check {
# print $_SERVER[argv][0]." ok\n";
}
}
-?>
+
+check::init();
diff --git a/Examples/test-suite/php/threads_exception_runme.php b/Examples/test-suite/php/threads_exception_runme.php
index 80717eb88..38873dffd 100644
--- a/Examples/test-suite/php/threads_exception_runme.php
+++ b/Examples/test-suite/php/threads_exception_runme.php
@@ -1,14 +1,13 @@
diff --git a/Examples/test-suite/php/typemap_ns_using_runme.php b/Examples/test-suite/php/typemap_ns_using_runme.php
index 6a599f008..e15427856 100644
--- a/Examples/test-suite/php/typemap_ns_using_runme.php
+++ b/Examples/test-suite/php/typemap_ns_using_runme.php
@@ -1,9 +1,8 @@
diff --git a/Examples/test-suite/php/using1_runme.php b/Examples/test-suite/php/using1_runme.php
index 51841bc78..e15427856 100644
--- a/Examples/test-suite/php/using1_runme.php
+++ b/Examples/test-suite/php/using1_runme.php
@@ -1,9 +1,8 @@
diff --git a/Examples/test-suite/php/using2_runme.php b/Examples/test-suite/php/using2_runme.php
index 391a98f52..e15427856 100644
--- a/Examples/test-suite/php/using2_runme.php
+++ b/Examples/test-suite/php/using2_runme.php
@@ -1,9 +1,8 @@
diff --git a/Examples/test-suite/php/valuewrapper_base_runme.php b/Examples/test-suite/php/valuewrapper_base_runme.php
index 6a1abdbd2..3f4c38e5b 100644
--- a/Examples/test-suite/php/valuewrapper_base_runme.php
+++ b/Examples/test-suite/php/valuewrapper_base_runme.php
@@ -1,13 +1,11 @@
diff --git a/Examples/test-suite/php/virtual_vs_nonvirtual_base_runme.php b/Examples/test-suite/php/virtual_vs_nonvirtual_base_runme.php
index 0d4aa3d5f..abfb4d307 100644
--- a/Examples/test-suite/php/virtual_vs_nonvirtual_base_runme.php
+++ b/Examples/test-suite/php/virtual_vs_nonvirtual_base_runme.php
@@ -1,11 +1,8 @@
require "tests.php";
-require "virtual_vs_nonvirtual_base.php";
$fail = new SimpleClassFail();
$work = new SimpleClassWork();
check::equal($work->getInner()->get(), $fail->getInner()->get(), "should both be 10");
-
-?>
diff --git a/Examples/test-suite/php/wrapmacro_runme.php b/Examples/test-suite/php/wrapmacro_runme.php
index f32da990e..18b2ef1e1 100644
--- a/Examples/test-suite/php/wrapmacro_runme.php
+++ b/Examples/test-suite/php/wrapmacro_runme.php
@@ -1,12 +1,10 @@
diff --git a/Examples/test-suite/php_namewarn_rename.i b/Examples/test-suite/php_namewarn_rename.i
index d84e2196f..bb54dba5e 100644
--- a/Examples/test-suite/php_namewarn_rename.i
+++ b/Examples/test-suite/php_namewarn_rename.i
@@ -5,6 +5,9 @@
%warnfilter(SWIGWARN_PARSE_KEYWORD) stdClass;
%warnfilter(SWIGWARN_PARSE_KEYWORD) directory;
%warnfilter(SWIGWARN_PARSE_KEYWORD) Hello::empty();
+%warnfilter(SWIGWARN_PARSE_KEYWORD) null;
+%warnfilter(SWIGWARN_PARSE_KEYWORD) True;
+%warnfilter(SWIGWARN_PARSE_KEYWORD) FALSE;
#endif
%ignore prev::operator++;
@@ -36,4 +39,15 @@
prev operator++(int) { return *this; }
};
+ class null
+ {
+ };
+
+ class True
+ {
+ };
+
+ class FALSE
+ {
+ };
%}
diff --git a/Examples/test-suite/pike/Makefile.in b/Examples/test-suite/pike/Makefile.in
deleted file mode 100644
index 6e1bdfbff..000000000
--- a/Examples/test-suite/pike/Makefile.in
+++ /dev/null
@@ -1,49 +0,0 @@
-#######################################################################
-# Makefile for Pike test-suite
-#######################################################################
-
-LANGUAGE = pike
-PIKE = pike
-SCRIPTSUFFIX = _runme.pike
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
-
-include $(srcdir)/../common.mk
-
-# Overridden variables here
-# none!
-
-# Custom tests - tests with additional commandline options
-# none!
-
-# Rules for the different types of tests
-%.cpptest:
- $(setup)
- +$(swig_and_compile_cpp)
- $(run_testcase)
-
-%.ctest:
- $(setup)
- +$(swig_and_compile_c)
- $(run_testcase)
-
-%.multicpptest:
- $(setup)
- +$(swig_and_compile_multi_cpp)
- $(run_testcase)
-
-# Runs the testcase. A testcase is only run if
-# a file is found which has _runme.pike appended after the testcase name.
-run_testcase = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PIKE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
- fi
-
-# Clean: remove the generated .pike file
-%.clean:
- @rm -f $*.pike;
-
-clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' pike_clean
diff --git a/Examples/test-suite/prefix.i b/Examples/test-suite/prefix.i
index b0cb31205..90cdf5593 100644
--- a/Examples/test-suite/prefix.i
+++ b/Examples/test-suite/prefix.i
@@ -11,4 +11,10 @@ public:
}
};
+// This failed in git pre 4.1.0 - the calls to the parent class' magic __get,
+// __set and __isset methods weren't getting the prefix.
+class Bar : public Foo {
+public:
+};
+
%}
diff --git a/Examples/test-suite/preproc.i b/Examples/test-suite/preproc.i
index 215fdd0ef..1bcdcf7ac 100644
--- a/Examples/test-suite/preproc.i
+++ b/Examples/test-suite/preproc.i
@@ -298,11 +298,6 @@ inline const char* mangle_macro ## #@__VA_ARGS__ () {
/* chiao */
#endif;
-#ifdef SWIGCHICKEN
-/* define is a scheme keyword (and thus an invalid variable name), so SWIG warns about it */
-%warnfilter(SWIGWARN_PARSE_KEYWORD) define;
-#endif
-
#ifdef SWIGRUBY
%rename(ddefined) defined;
#endif
diff --git a/Examples/test-suite/private_assign.i b/Examples/test-suite/private_assign.i
index acc4d0bc9..d9ba70cf4 100644
--- a/Examples/test-suite/private_assign.i
+++ b/Examples/test-suite/private_assign.i
@@ -14,6 +14,8 @@
return *this;
}
public:
+ Foo() { }
+ Foo(const Foo &f) { } // copy ctor can still be public, however.
void bar() { }
};
diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in
index be06f7e51..0bdbad51e 100644
--- a/Examples/test-suite/python/Makefile.in
+++ b/Examples/test-suite/python/Makefile.in
@@ -10,19 +10,9 @@ endif
LANGUAGE = python
PYTHON = $(PYBIN)
+SCRIPTSUFFIX = _runme.py
PYCODESTYLE = @PYCODESTYLE@
-PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391
-
-#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
-PY2SCRIPTSUFFIX = _runme.py
-PY3SCRIPTSUFFIX = _runme3.py
-PY2TO3 = @PY2TO3@ -x import
-
-ifeq (,$(PY3))
- SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX)
-else
- SCRIPTSUFFIX = $(PY3SCRIPTSUFFIX)
-endif
+PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,E741,W291,W391
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -85,6 +75,7 @@ CPP11_TEST_CASES = \
cpp11_shared_ptr_const \
cpp11_shared_ptr_nullptr_in_containers \
cpp11_shared_ptr_overload \
+ cpp11_shared_ptr_template_upcast \
cpp11_shared_ptr_upcast \
cpp11_std_unordered_map \
cpp11_std_unordered_multimap \
@@ -92,22 +83,16 @@ CPP11_TEST_CASES = \
cpp11_std_unordered_set \
C_TEST_CASES += \
+ ccomplextest \
file_test \
li_cstring \
li_cwstring \
python_nondynamic \
python_varargs_typemap \
-#
-# This test only works with modern C compilers
-#
-#C_TEST_CASES += \
-# complextest
-
include $(srcdir)/../common.mk
# Overridden variables here
-SCRIPTDIR = .
LIBS = -L.
VALGRIND_OPT += --suppressions=pythonswig.supp
@@ -116,35 +101,25 @@ VALGRIND_OPT += --suppressions=pythonswig.supp
# Rules for the different types of tests
%.cpptest:
- +$(convert_testcase)
$(setup)
+$(swig_and_compile_cpp)
$(check_pep8)
$(run_testcase)
%.ctest:
- +$(convert_testcase)
$(setup)
+$(swig_and_compile_c)
$(check_pep8)
$(run_testcase)
%.multicpptest:
- +$(convert_testcase)
$(setup)
+$(swig_and_compile_multi_cpp)
$(check_pep8_multi_cpp)
$(run_testcase)
-
-# Runs the testcase. A testcase is only run if
-# a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name.
-
-py_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
-py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
-py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
-
+# Python code style checking
ifneq (,$(PYCODESTYLE))
check_pep8 = $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(SCRIPTPREFIX)$*.py
@@ -154,77 +129,24 @@ check_pep8_multi_cpp = \
done
endif
-run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(py_runme)
-
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.py appended after the testcase name.
run_testcase = \
- if [ -f $(SCRIPTDIR)/$(py_runme) ]; then \
- $(run_python);\
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
-# Grab runme file ready for running: copied for out of source tree builds, and/or run 2to3
-# Note terminal (double colon) rules creating runme files to fix possible infinite recursion,
-# see https://github.com/swig/swig/pull/688
-ifeq ($(SCRIPTDIR),$(srcdir))
- # in source tree build
- ifeq (,$(PY3))
- convert_testcase =
- else
- convert_testcase = \
- if [ -f $(srcdir)/$(py2_runme) ]; then \
- $(MAKE) $(SCRIPTDIR)/$(py_runme); \
- fi
-
-# For converting python 2 tests into Python 3 tests
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
- cp $< $@
- $(PY2TO3) -w $@ >/dev/null 2>&1
-
- endif
-else
- # out of source tree build
- ifeq (,$(PY3))
- convert_testcase = \
- if [ -f $(srcdir)/$(py2_runme) ]; then \
- $(MAKE) $(SCRIPTDIR)/$(py_runme); \
- fi
-
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
- cp $< $@
-
- else
- convert_testcase = \
- if [ -f $(srcdir)/$(py2_runme) ]; then \
- $(MAKE) $(SCRIPTDIR)/$(py_runme); \
- elif [ -f $(srcdir)/$(py3_runme) ]; then \
- $(MAKE) $(SCRIPTDIR)/$(py3_runme); \
- fi
-
-# For when there is a _runme3.py instead of a _runme.py, ie a Python 3 only run test
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY3SCRIPTSUFFIX)
- cp $< $@
-
-# For converting python 2 tests into Python 3 tests
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
- cp $< $@
- $(PY2TO3) -w $@ >/dev/null 2>&1
-
- endif
-
-endif
-
# Clean: remove the generated .py file
-# We only remove the _runme3.py if it is generated by 2to3 from a _runme.py.
%.clean:
@rm -f $*.py
- @if test -f $(srcdir)/$(py2_runme); then rm -f $(SCRIPTDIR)/$(py3_runme) $(SCRIPTDIR)/$(py3_runme).bak; fi
- @if test "x$(SCRIPTDIR)" != "x$(srcdir)"; then rm -f $(SCRIPTDIR)/$(py_runme); fi
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' python_clean
- rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
rm -f clientdata_prop_a.py clientdata_prop_b.py import_stl_a.py import_stl_b.py
+ rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
rm -f imports_a.py imports_b.py mod_a.py mod_b.py multi_import_a.py
rm -f multi_import_b.py packageoption_a.py packageoption_b.py packageoption_c.py
+ rm -f template_typedef_cplx2.py
hugemod_runme = hugemod$(SCRIPTPREFIX)
diff --git a/Examples/test-suite/python/argcargvtest_runme.py b/Examples/test-suite/python/argcargvtest_runme.py
index b0345746f..eb57f79ea 100644
--- a/Examples/test-suite/python/argcargvtest_runme.py
+++ b/Examples/test-suite/python/argcargvtest_runme.py
@@ -6,7 +6,6 @@ if mainc(largs) != 3:
targs = ("hi", "hola")
if mainv(targs, 1) != "hola":
- print(mainv(targs, 1))
raise RuntimeError("bad main typemap")
targs = ("hi", "hola")
diff --git a/Examples/test-suite/python/array_member_runme.py b/Examples/test-suite/python/array_member_runme.py
index de6e0f3e7..2708a6f37 100644
--- a/Examples/test-suite/python/array_member_runme.py
+++ b/Examples/test-suite/python/array_member_runme.py
@@ -5,7 +5,7 @@ f.data = cvar.global_data
for i in range(0, 8):
if get_value(f.data, i) != get_value(cvar.global_data, i):
- raise RuntimeError, "Bad array assignment"
+ raise RuntimeError("Bad array assignment")
for i in range(0, 8):
@@ -15,4 +15,4 @@ cvar.global_data = f.data
for i in range(0, 8):
if get_value(f.data, i) != get_value(cvar.global_data, i):
- raise RuntimeError, "Bad array assignment"
+ raise RuntimeError("Bad array assignment")
diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py
index 6002d49fe..7bc918644 100644
--- a/Examples/test-suite/python/autodoc_runme.py
+++ b/Examples/test-suite/python/autodoc_runme.py
@@ -279,3 +279,5 @@ check(inspect.getdoc(process3), "process3(int _from, int _in, int var) -> int")
check(inspect.getdoc(process4), "process4(int _from=0, int _in=1, int var=2) -> int")
check(inspect.getdoc(process_complex_defval), "process_complex_defval(val=PROCESS_DEFAULT_VALUE, factor=some_type(-1)) -> int")
+
+check(inspect.getdoc(a_structure.__init__), "__init__(a_structure self) -> a_structure", None, skip)
diff --git a/Examples/test-suite/python/ccomplextest_runme.py b/Examples/test-suite/python/ccomplextest_runme.py
new file mode 100644
index 000000000..63a663f50
--- /dev/null
+++ b/Examples/test-suite/python/ccomplextest_runme.py
@@ -0,0 +1,22 @@
+import ccomplextest
+
+a = complex(-1, 2)
+
+if ccomplextest.has_c99_complex():
+ if ccomplextest.Conj(a) != a.conjugate():
+ raise RuntimeError("bad complex mapping")
+
+ if ccomplextest.Conjf(a) != a.conjugate():
+ raise RuntimeError("bad complex mapping")
+
+ if ccomplextest.Conj2(a) != a.conjugate():
+ raise RuntimeError("bad complex mapping")
+
+ if ccomplextest.Conjf2(a) != a.conjugate():
+ raise RuntimeError("bad complex mapping")
+
+ if ccomplextest.Conj3(a) != a.conjugate():
+ raise RuntimeError("bad complex mapping")
+
+ if ccomplextest.Conjf3(a) != a.conjugate():
+ raise RuntimeError("bad complex mapping")
diff --git a/Examples/test-suite/python/char_binary_runme.py b/Examples/test-suite/python/char_binary_runme.py
index 0425fe1c9..39c0b2447 100644
--- a/Examples/test-suite/python/char_binary_runme.py
+++ b/Examples/test-suite/python/char_binary_runme.py
@@ -2,16 +2,14 @@ from char_binary import *
t = Test()
if t.strlen("hile") != 4:
- print t.strlen("hile")
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap {}".format(t.strlen("hile")))
if t.ustrlen("hile") != 4:
- print t.ustrlen("hile")
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap {}".format(t.ustrlen("hile")))
if t.strlen("hil\0") != 4:
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap")
if t.ustrlen("hil\0") != 4:
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap")
#
# creating a raw char*
@@ -25,18 +23,17 @@ pchar_setitem(pc, 4, 0)
if t.strlen(pc) != 4:
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap")
if t.ustrlen(pc) != 4:
- raise RuntimeError, "bad multi-arg typemap"
+ raise RuntimeError("bad multi-arg typemap")
cvar.var_pchar = pc
if cvar.var_pchar != "hola":
- print cvar.var_pchar
- raise RuntimeError, "bad pointer case"
+ raise RuntimeError("bad pointer case {}".format(cvar.var_pchar))
cvar.var_namet = pc
# if cvar.var_namet != "hola\0":
if cvar.var_namet != "hola":
- raise RuntimeError, "bad pointer case"
+ raise RuntimeError("bad pointer case")
delete_pchar(pc)
diff --git a/Examples/test-suite/python/complextest_runme.py b/Examples/test-suite/python/complextest_runme.py
index 5cfc7ccab..1b9ad6629 100644
--- a/Examples/test-suite/python/complextest_runme.py
+++ b/Examples/test-suite/python/complextest_runme.py
@@ -3,17 +3,16 @@ import complextest
a = complex(-1, 2)
if complextest.Conj(a) != a.conjugate():
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
if complextest.Conjf(a) != a.conjugate():
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
if complextest.Conj2(a) != a.conjugate():
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
if complextest.Conjf2(a) != a.conjugate():
- raise RuntimeError, "bad complex mapping"
-
+ raise RuntimeError("bad complex mapping")
v = (complex(1, 2), complex(2, 3), complex(4, 3), 1)
@@ -27,4 +26,4 @@ p = complextest.ComplexPair()
p.z1 = complex(0, 1)
p.z2 = complex(0, -1)
if complextest.Conj(p.z2) != p.z1:
- raise RuntimeError, "bad complex mapping"
+ raise RuntimeError("bad complex mapping")
diff --git a/Examples/test-suite/python/constover_runme.py b/Examples/test-suite/python/constover_runme.py
index 2d28a55cc..0c03967f6 100644
--- a/Examples/test-suite/python/constover_runme.py
+++ b/Examples/test-suite/python/constover_runme.py
@@ -4,33 +4,26 @@ error = 0
p = constover.test("test")
if p != "test":
- print "test failed!"
- error = 1
+ raise RuntimeError("test failed!")
p = constover.test_pconst("test")
if p != "test_pconst":
- print "test_pconst failed!"
- error = 1
+ raise RuntimeError("test_pconst failed!")
f = constover.Foo()
p = f.test("test")
if p != "test":
- print "member-test failed!"
- error = 1
+ raise RuntimeError("member-test failed!")
p = f.test_pconst("test")
if p != "test_pconst":
- print "member-test_pconst failed!"
- error = 1
+ raise RuntimeError("member-test_pconst failed!")
p = f.test_constm("test")
if p != "test_constmethod":
- print "member-test_constm failed!"
- error = 1
+ raise RuntimeError("member-test_constm failed!")
p = f.test_pconstm("test")
if p != "test_pconstmethod":
- print "member-test_pconstm failed!"
- error = 1
+ raise RuntimeError("member-test_pconstm failed!")
-sys.exit(error)
diff --git a/Examples/test-suite/python/contract_runme.py b/Examples/test-suite/python/contract_runme.py
index cd75a51d2..b6bab3a09 100644
--- a/Examples/test-suite/python/contract_runme.py
+++ b/Examples/test-suite/python/contract_runme.py
@@ -2,141 +2,141 @@ import contract
contract.test_preassert(1, 2)
try:
- contract.test_preassert(-1)
- print "Failed! Preassertions are broken"
-except:
+ contract.test_preassert(-1, 3)
+ raise Exception("Failed! Preassertions are broken")
+except RuntimeError:
pass
contract.test_postassert(3)
try:
contract.test_postassert(-3)
- print "Failed! Postassertions are broken"
-except:
+ raise Exception("Failed! Postassertions are broken")
+except RuntimeError:
pass
contract.test_prepost(2, 3)
contract.test_prepost(5, -4)
try:
contract.test_prepost(-3, 4)
- print "Failed! Preassertions are broken"
-except:
+ raise Exception("Failed! Preassertions are broken")
+except RuntimeError:
pass
try:
contract.test_prepost(4, -10)
- print "Failed! Postassertions are broken"
+ raise Exception("Failed! Postassertions are broken")
-except:
+except RuntimeError:
pass
f = contract.Foo()
f.test_preassert(4, 5)
try:
f.test_preassert(-2, 3)
- print "Failed! Method preassertion."
-except:
+ raise Exception("Failed! Method preassertion.")
+except RuntimeError:
pass
f.test_postassert(4)
try:
f.test_postassert(-4)
- print "Failed! Method postassertion"
-except:
+ raise Exception("Failed! Method postassertion")
+except RuntimeError:
pass
f.test_prepost(3, 4)
f.test_prepost(4, -3)
try:
f.test_prepost(-4, 2)
- print "Failed! Method preassertion."
-except:
+ raise Exception("Failed! Method preassertion.")
+except RuntimeError:
pass
try:
f.test_prepost(4, -10)
- print "Failed! Method postassertion."
-except:
+ raise Exception("Failed! Method postassertion.")
+except RuntimeError:
pass
contract.Foo_stest_prepost(4, 0)
try:
contract.Foo_stest_prepost(-4, 2)
- print "Failed! Static method preassertion"
-except:
+ raise Exception("Failed! Static method preassertion")
+except RuntimeError:
pass
try:
contract.Foo_stest_prepost(4, -10)
- print "Failed! Static method posteassertion"
-except:
+ raise Exception("Failed! Static method posteassertion")
+except RuntimeError:
pass
b = contract.Bar()
try:
b.test_prepost(2, -4)
- print "Failed! Inherited preassertion."
-except:
+ raise Exception("Failed! Inherited preassertion.")
+except RuntimeError:
pass
d = contract.D()
try:
d.foo(-1, 1, 1, 1, 1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.foo(1, -1, 1, 1, 1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.foo(1, 1, -1, 1, 1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.foo(1, 1, 1, -1, 1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.foo(1, 1, 1, 1, -1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.bar(-1, 1, 1, 1, 1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.bar(1, -1, 1, 1, 1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.bar(1, 1, -1, 1, 1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.bar(1, 1, 1, -1, 1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
try:
d.bar(1, 1, 1, 1, -1)
- print "Failed! Inherited preassertion (D)."
-except:
+ raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
pass
# Namespace
my = contract.myClass(1)
try:
my = contract.myClass(0)
- print "Failed! constructor preassertion"
-except:
+ raise Exception("Failed! constructor preassertion")
+except RuntimeError:
pass
diff --git a/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py b/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
index cc7b5cd91..e46a4772f 100644
--- a/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
+++ b/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
@@ -4,20 +4,20 @@ a = cpp11_alternate_function_syntax.SomeStruct()
res = a.addNormal(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
res = a.addAlternate(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")
res = a.addAlternateConst(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternateConst(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addAlternateConst(4,5) returns ", res, " should be 9.")
res = a.addAlternateNoExcept(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternateNoExcept(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addAlternateNoExcept(4,5) returns ", res, " should be 9.")
res = a.addAlternateConstNoExcept(4, 5)
if res != 9:
- raise RuntimeError, ("SomeStruct::addAlternateConstNoExcept(4,5) returns ", res, " should be 9.")
+ raise RuntimeError("SomeStruct::addAlternateConstNoExcept(4,5) returns ", res, " should be 9.")
diff --git a/Examples/test-suite/python/cpp11_decltype_runme.py b/Examples/test-suite/python/cpp11_decltype_runme.py
index 1650d9004..a18f334dc 100644
--- a/Examples/test-suite/python/cpp11_decltype_runme.py
+++ b/Examples/test-suite/python/cpp11_decltype_runme.py
@@ -3,16 +3,16 @@ import cpp11_decltype
a = cpp11_decltype.A()
a.i = 5
if a.i != 5:
- raise RuntimeError, "Assignment to a.i failed."
+ raise RuntimeError("Assignment to a.i failed.")
a.j = 10
if a.j != 10:
- raise RuntimeError, "Assignment to a.j failed."
+ raise RuntimeError("Assignment to a.j failed.")
b = a.foo(5)
if b != 10:
- raise RuntimeError, "foo(5) should return 10."
+ raise RuntimeError("foo(5) should return 10.")
b = a.foo(6)
if b != 0:
- raise RuntimeError, "foo(6) should return 0."
+ raise RuntimeError("foo(6) should return 0.")
diff --git a/Examples/test-suite/python/cpp11_hash_tables_runme.py b/Examples/test-suite/python/cpp11_hash_tables_runme.py
index 7b772ff9a..3e7be49d0 100644
--- a/Examples/test-suite/python/cpp11_hash_tables_runme.py
+++ b/Examples/test-suite/python/cpp11_hash_tables_runme.py
@@ -10,14 +10,14 @@ for x in [cpp11_hash_tables.MapIntInt({1:7}),
cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})
]:
- swig_assert_equal([(k, v) for k, v in x.iteritems()], [(1, 7)])
- swig_assert_equal(x.keys(), [1])
- swig_assert_equal(x.values(), [7])
- swig_assert_equal(x.items(), [(1, 7)])
+ swig_assert_equal([(k, v) for k, v in x.items()], [(1, 7)])
+ swig_assert_equal(list(x.keys()), [1])
+ swig_assert_equal(list(x.values()), [7])
+ swig_assert_equal(list(x.items()), [(1, 7)])
swig_assert_equal([k for k in x], [1])
- swig_assert_equal([i for i in x.iterkeys()], [1])
- swig_assert_equal([i for i in x.itervalues()], [7])
- swig_assert_equal([i for i in x.iteritems()], [(1, 7)])
+ swig_assert_equal([i for i in x.keys()], [1])
+ swig_assert_equal([i for i in x.values()], [7])
+ swig_assert_equal([i for i in x.items()], [(1, 7)])
swig_assert_equal(x[1], 7)
swig_assert_equal(2 in x, False)
@@ -33,7 +33,7 @@ for x in [cpp11_hash_tables.MapIntInt({1:7}),
for x in [cpp11_hash_tables.MultiMapIntInt({1:7}),
cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})]:
x[1] = 9
- swig_assert_equal(sorted([v for k, v in x.iteritems()]), [7, 9])
+ swig_assert_equal(sorted([v for k, v in x.items()]), [7, 9])
swig_assert_equal(len(x), 2)
for x in [cpp11_hash_tables.SetInt([1]),
diff --git a/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py b/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
index 54a8fe0eb..c39760344 100644
--- a/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
+++ b/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
@@ -3,15 +3,15 @@ import cpp11_null_pointer_constant
a = cpp11_null_pointer_constant.A()
if a._myA != None:
- raise RuntimeError, (
+ raise RuntimeError(
"cpp11_null_pointer_constant: _myA should be None, but is ", a._myA)
b = cpp11_null_pointer_constant.A()
if a._myA != b._myA:
- raise RuntimeError, (
+ raise RuntimeError(
"cpp11_null_pointer_constant: a._myA should be the same as b._myA, but ", a._myA, "!=", b._myA)
a._myA = cpp11_null_pointer_constant.A()
if a._myA == None:
- raise RuntimeError, (
- "cpp11_null_pointer_constant: _myA should be object, but is None")
+ raise RuntimeError((
+ "cpp11_null_pointer_constant: _myA should be object, but is None"))
diff --git a/Examples/test-suite/python/cpp11_raw_string_literals_runme.py b/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
index 6a587b860..90e450f8b 100644
--- a/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
+++ b/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
@@ -34,19 +34,19 @@ if cvar.aa != "Wide string":
raise RuntimeError
if cvar.bb != "UTF-8 string":
- raise RuntimeError, cvar.wide
+ raise RuntimeError(cvar.wide)
if cvar.xx != ")I'm an \"ascii\" \\ string.":
- raise RuntimeError, cvar.xx
+ raise RuntimeError(cvar.xx)
if cvar.ee != ")I'm an \"ascii\" \\ string.":
- raise RuntimeError, cvar.ee
+ raise RuntimeError(cvar.ee)
if cvar.ff != "I'm a \"raw wide\" \\ string.":
- raise RuntimeError, cvar.ff
+ raise RuntimeError(cvar.ff)
if cvar.gg != "I'm a \"raw UTF-8\" \\ string.":
- raise RuntimeError, cvar.gg
+ raise RuntimeError(cvar.gg)
def check(got, expected):
diff --git a/Examples/test-suite/python/cpp11_result_of_runme.py b/Examples/test-suite/python/cpp11_result_of_runme.py
index 4469efd81..691d2a2d8 100644
--- a/Examples/test-suite/python/cpp11_result_of_runme.py
+++ b/Examples/test-suite/python/cpp11_result_of_runme.py
@@ -2,10 +2,10 @@ import cpp11_result_of
result = cpp11_result_of.test_result(cpp11_result_of.SQUARE, 3.0)
if result != 9.0:
- raise RuntimeError, "test_result(square, 3.0) is not 9.0. Got: " + str(
- result)
+ raise RuntimeError("test_result(square, 3.0) is not 9.0. Got: " + str(
+ result))
result = cpp11_result_of.test_result_alternative1(cpp11_result_of.SQUARE, 3.0)
if result != 9.0:
- raise RuntimeError, "test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(
- result)
+ raise RuntimeError("test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(
+ result))
diff --git a/Examples/test-suite/python/cpp11_rvalue_reference_runme.py b/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
index c1cd3bf26..85d64a581 100644
--- a/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
+++ b/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
@@ -4,24 +4,24 @@ a = cpp11_rvalue_reference.A()
a.setAcopy(5)
if a.getAcopy() != 5:
- raise RunTimeError, ("int A::getAcopy() value is ",
+ raise RunTimeError("int A::getAcopy() value is ",
a.getAcopy(), " should be 5")
ptr = a.getAptr()
a.setAptr(ptr)
if a.getAcopy() != 5:
- raise RunTimeError, ("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(
+ raise RunTimeError("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(
), " should be 5")
a.setAref(ptr)
if a.getAcopy() != 5:
- raise RunTimeError, ("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(
+ raise RunTimeError("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(
), " should be 5")
rvalueref = a.getAmove()
a.setAmove(rvalueref)
if a.getAcopy() != 5:
- raise RunTimeError, ("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(
+ raise RunTimeError("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(
), " should be 5")
diff --git a/Examples/test-suite/python/cpp11_shared_ptr_template_upcast_runme.py b/Examples/test-suite/python/cpp11_shared_ptr_template_upcast_runme.py
new file mode 100644
index 000000000..08a95c2ce
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_shared_ptr_template_upcast_runme.py
@@ -0,0 +1,5 @@
+from cpp11_shared_ptr_template_upcast import *
+
+pd = MakePrintableDerived(20)
+pd.GetResult()
+pd.GetFormatted()
diff --git a/Examples/test-suite/python/cpp11_shared_ptr_upcast_runme.py b/Examples/test-suite/python/cpp11_shared_ptr_upcast_runme.py
new file mode 100644
index 000000000..08546a45e
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_shared_ptr_upcast_runme.py
@@ -0,0 +1,63 @@
+from cpp11_shared_ptr_upcast import *
+
+# This is a port from the Ruby equivalent test and some tests ported from
+# Examples/test-suite/ruby/cpp11_shared_ptr_upcast_runme.rb are not working and commented out with:
+# not working:
+
+def swig_assert_equal_simple(expected, got):
+ if expected != got:
+ raise RuntimeError("Expected: {}. Got: {}")
+
+# non-overloaded
+swig_assert_equal_simple(7, derived_num1(Derived(7)))
+swig_assert_equal_simple(7, derived_num2([Derived(7)]))
+swig_assert_equal_simple(7, derived_num3({0: Derived(7)}))
+
+swig_assert_equal_simple(-1, base_num1(Derived(7)))
+swig_assert_equal_simple(-1, base_num2([Derived(7)]))
+swig_assert_equal_simple(-1, base_num3({0: Derived(7)}))
+
+swig_assert_equal_simple(999, derived_num1(None))
+# not working: swig_assert_equal_simple(999, derived_num2([None]))
+# not working: swig_assert_equal_simple(999, derived_num3({0: None}))
+
+swig_assert_equal_simple(999, base_num1(None))
+# not working: swig_assert_equal_simple(999, base_num2([None]))
+# not working: swig_assert_equal_simple(999, base_num3({0: None}))
+
+# overloaded
+swig_assert_equal_simple(7, derived_num(Derived(7)))
+swig_assert_equal_simple(7, derived_num([Derived(7)]))
+swig_assert_equal_simple(7, derived_num({0: Derived(7)}))
+
+swig_assert_equal_simple(-1, base_num(Derived(7)))
+swig_assert_equal_simple(-1, base_num([Derived(7)]))
+swig_assert_equal_simple(-1, base_num({0: Derived(7)}))
+
+# ptr to shared_ptr
+swig_assert_equal_simple(7, derived2_num1(Derived2(7)))
+swig_assert_equal_simple(7, derived2_num2([Derived2(7)]))
+swig_assert_equal_simple(7, derived2_num3({0: Derived2(7)}))
+
+swig_assert_equal_simple(-1, base2_num1(Derived2(7)))
+
+# not working: try:
+# not working: # Upcast for pointers to shared_ptr in this generic framework has not been implemented
+# not working: swig_assert_equal_simple(-1, base2_num2([Derived2(7)]))
+# not working: raise RuntimeError, "Failed to catch TypeError"
+# not working: except TypeError:
+# not working: pass
+# not working: try:
+# not working: # Upcast for pointers to shared_ptr in this generic framework has not been implemented
+# not working: swig_assert_equal_simple(-1, base2_num3({0: Derived2(7)}))
+# not working: raise RuntimeError, "Failed to catch TypeError"
+# not working: except TypeError:
+# not working: pass
+
+swig_assert_equal_simple(888, derived2_num1(None))
+swig_assert_equal_simple(999, derived2_num2([None])) # although 888 would be more consistent
+swig_assert_equal_simple(999, derived2_num3({0: None})) # although 888 would be more consistent
+
+swig_assert_equal_simple(888, base2_num1(None))
+swig_assert_equal_simple(999, base2_num2([None])) # although 888 would be more consistent
+swig_assert_equal_simple(999, base2_num3({0: None})) # although 888 would be more consistent
diff --git a/Examples/test-suite/python/cpp11_std_array_runme.py b/Examples/test-suite/python/cpp11_std_array_runme.py
index e5e7373dd..9e11a3e5b 100644
--- a/Examples/test-suite/python/cpp11_std_array_runme.py
+++ b/Examples/test-suite/python/cpp11_std_array_runme.py
@@ -3,7 +3,7 @@ import sys
def failed(a, b, msg):
- raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
+ raise RuntimeError(msg + " " + str(list(a)) + " " + str(list(b)))
def compare_sequences(a, b):
@@ -26,8 +26,8 @@ def steps_exception(swigarray, i, j, step):
a = swigarray[i::step]
else:
a = swigarray[i:j:step]
- raise RuntimeError, "swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed steps exception for " + str(list(swigarray))
- except ValueError, e:
+ raise RuntimeError("swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed steps exception for " + str(list(swigarray)))
+ except ValueError as e:
# print("exception: {}".format(e))
pass
@@ -43,16 +43,16 @@ def del_exception(swigarray, i, j, step):
del swigarray[i::step]
else:
del swigarray[i:j:step]
- raise RuntimeError, "swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed del exception for " + str(list(swigarray))
- except ValueError, e:
+ raise RuntimeError("swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed del exception for " + str(list(swigarray)))
+ except ValueError as e:
# print("exception: {}".format(e))
pass
def setslice_exception(swigarray, newval):
try:
swigarray[::] = newval
- raise RuntimeError, "swigarray[::] = " + str(newval) + " missed set exception for swigarray:" + str(list(swigarray))
- except TypeError, e:
+ raise RuntimeError("swigarray[::] = " + str(newval) + " missed set exception for swigarray:" + str(list(swigarray)))
+ except TypeError as e:
# print("exception: {}".format(e))
pass
diff --git a/Examples/test-suite/python/cpp11_uniform_initialization_runme.py b/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
index ecb468ccb..b01557a6f 100644
--- a/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
+++ b/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
@@ -9,13 +9,13 @@ if var2.getX() != 2:
m = cpp11_uniform_initialization.MoreInit()
if m.charptr != None:
- raise RuntimeError, m.charptr
+ raise RuntimeError(m.charptr)
m.charptr = "hello sir"
if m.charptr != "hello sir":
- raise RuntimeError, m.charptr
+ raise RuntimeError(m.charptr)
if m.more1(m.vi) != 15:
- raise RuntimeError, m.vi
+ raise RuntimeError(m.vi)
if m.more1([-1, 1, 2]) != 2:
- raise RuntimeError, m.vi
+ raise RuntimeError(m.vi)
if m.more1() != 10:
raise RuntimeError
diff --git a/Examples/test-suite/python/cpp_enum_runme.py b/Examples/test-suite/python/cpp_enum_runme.py
index 5f1e91c97..910d378e4 100644
--- a/Examples/test-suite/python/cpp_enum_runme.py
+++ b/Examples/test-suite/python/cpp_enum_runme.py
@@ -3,21 +3,17 @@ import cpp_enum
f = cpp_enum.Foo()
if f.hola != f.Hello:
- print f.hola
- raise RuntimeError
+ raise RuntimeError("f.hola: {}".format(f.hola))
f.hola = f.Hi
if f.hola != f.Hi:
- print f.hola
- raise RuntimeError
+ raise RuntimeError("f.hola: {}".format(f.hola))
f.hola = f.Hello
if f.hola != f.Hello:
- print f.hola
- raise RuntimeError
+ raise RuntimeError("f.hola: {}".format(f.hola))
cpp_enum.cvar.hi = cpp_enum.Hello
if cpp_enum.cvar.hi != cpp_enum.Hello:
- print cpp_enum.cvar.hi
- raise RuntimeError
+ raise RuntimeError("cpp_enum.cvar.hi: {}".format(cpp_enum.cvar.hi))
diff --git a/Examples/test-suite/python/cpp_parameters_runme.py b/Examples/test-suite/python/cpp_parameters_runme.py
new file mode 100644
index 000000000..99d14ad74
--- /dev/null
+++ b/Examples/test-suite/python/cpp_parameters_runme.py
@@ -0,0 +1,296 @@
+from cpp_parameters import *
+
+# Testing correct and incorrect parameter counts being passed (kwargs and non-kwargs)
+# Note that the implementation depends a lot on whether zero, one, two or more args are being wrapped
+
+def is_python_fastproxy():
+ """Return True if SWIG is generating Python code using -fastproxy."""
+ import cpp_parameters
+ # Note: _swig_new_instance_method is only generated when using -fastproxy
+ return hasattr(cpp_parameters, "_swig_new_instance_method")
+
+# Zero parameters expected
+x = Zero()
+try:
+ x = Zero(z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ x = Zero(0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ x.zero(z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ x.zero(0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ Zero.stat_zero(z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ Zero.stat_zero(0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ global_zero(z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ global_zero(0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+# One mandatory parameter expected
+x = One(1)
+try:
+ x = One(a=1, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ x = One(1, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ x.one(a=1, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ x.one(1, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ One.stat_one(a=1, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ One.stat_one(1, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ global_one(a=1, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ global_one(1, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+# Two mandatory parameters expected
+x = Two(1, 2)
+try:
+ x = Two(a=1, b=2, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ x = Two(1, 2, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ x.two(a=1, b=2, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ x.two(1, 2, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ Two.stat_two(a=1, b=2, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ Two.stat_two(1, 2, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ global_two(a=1, b=2, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ global_two(1, 2, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+# Single optional parameter expected
+x = Single(1)
+try:
+ x = Single(a=1, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ x = Single(1, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ x.single(a=1, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ x.single(1, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ Single.stat_single(a=1, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ Single.stat_single(1, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+try:
+ global_single(a=1, z=0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+try:
+ global_single(1, 0)
+ raise RuntimeError("Missed throw")
+except TypeError:
+ pass
+
+# Test that -builtin option throws TypeError if kwargs are used even when they look like they should work, kwargs are not supported unless using -keyword.
+# Also same for -fastproxy option except that kwargs are supported by default for constructors. TODO: Fix inconsistency.
+
+if is_python_builtin() or is_python_fastproxy():
+ # One mandatory parameter in API
+ x = One(1)
+ if is_python_fastproxy():
+ x = One(a=1)
+ else:
+ try:
+ x = One(a=1)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ x.one(a=1)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ One.stat_one(a=1)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ global_one(a=1)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+
+ # Two mandatory parameters in API
+ x = Two(1, 2)
+ if is_python_fastproxy():
+ x = Two(a=1, b=2)
+ else:
+ try:
+ x = Two(a=1, b=2)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ x.two(a=1, b=2)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ Two.stat_two(a=1, b=2)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ global_two(a=1, b=2)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+
+ # Single optional parameter in API
+ x = Single(1)
+ if is_python_fastproxy():
+ x = Single(a=1)
+ else:
+ try:
+ x = Single(a=1)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ x.single(a=1)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ Single.stat_single(a=1)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+ try:
+ global_single(a=1)
+ raise RuntimeError("Missed throw")
+ except TypeError:
+ pass
+
+else:
+ # Non-builtin should work as expected
+ # One mandatory parameter in API
+ x = One(a=1)
+ x.one(a=1)
+ One.stat_one(a=1)
+ global_one(a=1)
+
+ # Two mandatory parameters in API
+ x = Two(a=1, b=2)
+ x.two(a=1, b=2)
+ Two.stat_two(a=1, b=2)
+ global_two(a=1, b=2)
+
+ # Single optional parameter in API
+ x = Single(a=1)
+ x.single(a=1)
+ Single.stat_single(a=1)
+ global_single(a=1)
diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py
index 14ef8c594..0ce47ab79 100644
--- a/Examples/test-suite/python/default_args_runme.py
+++ b/Examples/test-suite/python/default_args_runme.py
@@ -108,48 +108,34 @@ def run(module_name):
if Klass_inc().val != 0:
raise RuntimeError("Klass::inc failed")
- tricky_failure = False
tricky = default_args.TrickyInPython()
if tricky.value_m1(10) != -1:
- print "trickyvalue_m1 failed"
- tricky_failure = True
+ raise RuntimeError("trickyvalue_m1 failed")
if tricky.value_m1(10, 10) != 10:
- print "trickyvalue_m1 failed"
- tricky_failure = True
+ raise RuntimeError("trickyvalue_m1 failed")
if tricky.value_0xabcdef(10) != 0xabcdef:
- print "trickyvalue_0xabcdef failed"
- tricky_failure = True
+ raise RuntimeError("trickyvalue_0xabcdef failed")
if tricky.value_0644(10) != 420:
- print "trickyvalue_0644 failed"
- tricky_failure = True
+ raise RuntimeError("trickyvalue_0644 failed")
if tricky.value_perm(10) != 420:
- print "trickyvalue_perm failed"
- tricky_failure = True
+ raise RuntimeError("trickyvalue_perm failed")
if tricky.value_m01(10) != -1:
- print "trickyvalue_m01 failed"
- tricky_failure = True
+ raise RuntimeError("trickyvalue_m01 failed")
if not tricky.booltest2():
- print "booltest2 failed"
- tricky_failure = True
+ raise RuntimeError("booltest2 failed")
if tricky.max_32bit_int1() != 0x7FFFFFFF:
- print "max_32bit_int1 failed"
- tricky_failure = True
+ raise RuntimeError("max_32bit_int1 failed")
if tricky.min_32bit_int1() != -2147483648:
- print "min_32bit_int1 failed"
- tricky_failure = True
+ raise RuntimeError("min_32bit_int1 failed")
if tricky.max_32bit_int2() != 0x7FFFFFFF:
- print "max_32bit_int2 failed"
- tricky_failure = True
+ raise RuntimeError("max_32bit_int2 failed")
tricky.too_big_32bit_int1()
tricky.too_small_32bit_int1()
tricky.too_big_32bit_int2()
tricky.too_small_32bit_int2()
- if tricky_failure:
- raise RuntimeError
-
default_args.seek()
default_args.seek(10)
diff --git a/Examples/test-suite/python/default_constructor_runme.py b/Examples/test-suite/python/default_constructor_runme.py
index 1e877adda..2943dc960 100644
--- a/Examples/test-suite/python/default_constructor_runme.py
+++ b/Examples/test-suite/python/default_constructor_runme.py
@@ -16,24 +16,24 @@ dc.delete_AA(aa)
try:
b = dc.new_B()
- print "Whoa. new_BB created."
-except:
+ raise RuntimeError("Whoa. new_BB created.")
+except TypeError:
pass
del_b = dc.delete_B
try:
bb = dc.new_BB()
- print "Whoa. new_BB created."
-except:
+ raise RuntimeError("Whoa. new_BB created.")
+except AttributeError:
pass
del_bb = dc.delete_BB
try:
c = dc.new_C()
- print "Whoa. new_C created."
-except:
+ raise RuntimeError("Whoa. new_C created.")
+except AttributeError:
pass
del_c = dc.delete_C
@@ -43,24 +43,24 @@ dc.delete_CC(cc)
try:
d = dc.new_D()
- print "Whoa. new_D created"
-except:
+ raise RuntimeError("Whoa. new_D created")
+except AttributeError:
pass
del_d = dc.delete_D
try:
dd = dc.new_DD()
- print "Whoa. new_DD created"
-except:
+ raise RuntimeError("Whoa. new_DD created")
+except AttributeError:
pass
dd = dc.delete_DD
try:
ad = dc.new_AD()
- print "Whoa. new_AD created"
-except:
+ raise RuntimeError("Whoa. new_AD created")
+except AttributeError:
pass
del_ad = dc.delete_AD
@@ -73,8 +73,8 @@ dc.delete_EE(ee)
try:
eb = dc.new_EB()
- print "Whoa. new_EB created"
-except:
+ raise RuntimeError("Whoa. new_EB created")
+except AttributeError:
pass
del_eb = dc.delete_EB
@@ -83,7 +83,7 @@ f = dc.new_F()
try:
del_f = dc.delete_F
- print "Whoa. delete_F created"
+ raise RuntimeError("Whoa. delete_F created")
except AttributeError:
pass
@@ -93,7 +93,7 @@ g = dc.new_G()
try:
del_g = dc.delete_G
- print "Whoa. delete_G created"
+ raise RuntimeError("Whoa. delete_G created")
except AttributeError:
pass
diff --git a/Examples/test-suite/python/director_abstract_runme.py b/Examples/test-suite/python/director_abstract_runme.py
index 333b75fe5..c8c4b36dc 100644
--- a/Examples/test-suite/python/director_abstract_runme.py
+++ b/Examples/test-suite/python/director_abstract_runme.py
@@ -13,10 +13,10 @@ class MyFoo(director_abstract.Foo):
a = MyFoo()
if a.ping() != "MyFoo::ping()":
- raise RuntimeError, a.ping()
+ raise RuntimeError(a.ping())
if a.pong() != "Foo::pong();MyFoo::ping()":
- raise RuntimeError, a.pong()
+ raise RuntimeError(a.pong())
class MyExample1(director_abstract.Example1):
diff --git a/Examples/test-suite/python/director_alternating_runme.py b/Examples/test-suite/python/director_alternating_runme.py
index a93ffec34..dc85351b5 100644
--- a/Examples/test-suite/python/director_alternating_runme.py
+++ b/Examples/test-suite/python/director_alternating_runme.py
@@ -2,4 +2,4 @@ from director_alternating import *
id = getBar().id()
if id != idFromGetBar():
- raise RuntimeError, "Got wrong id: " + str(id)
+ raise RuntimeError("Got wrong id: " + str(id))
diff --git a/Examples/test-suite/python/director_basic_runme.py b/Examples/test-suite/python/director_basic_runme.py
index 6564c95a2..79cd0e2eb 100644
--- a/Examples/test-suite/python/director_basic_runme.py
+++ b/Examples/test-suite/python/director_basic_runme.py
@@ -10,18 +10,18 @@ class PyFoo(director_basic.Foo):
a = PyFoo()
if a.ping() != "PyFoo::ping()":
- raise RuntimeError, a.ping()
+ raise RuntimeError(a.ping())
if a.pong() != "Foo::pong();PyFoo::ping()":
- raise RuntimeError, a.pong()
+ raise RuntimeError(a.pong())
b = director_basic.Foo()
if b.ping() != "Foo::ping()":
- raise RuntimeError, b.ping()
+ raise RuntimeError(b.ping())
if b.pong() != "Foo::pong();Foo::ping()":
- raise RuntimeError, b.pong()
+ raise RuntimeError(b.pong())
a = director_basic.A1(1)
diff --git a/Examples/test-suite/python/director_comparison_operators_runme.py b/Examples/test-suite/python/director_comparison_operators_runme.py
new file mode 100644
index 000000000..e9bf9438d
--- /dev/null
+++ b/Examples/test-suite/python/director_comparison_operators_runme.py
@@ -0,0 +1,11 @@
+import director_comparison_operators
+
+
+class PyFoo(director_comparison_operators.Foo):
+ pass
+
+
+a = PyFoo()
+
+if a.test() != "a=1,b=2":
+ raise RuntimeError(a.test())
diff --git a/Examples/test-suite/python/director_detect_runme.py b/Examples/test-suite/python/director_detect_runme.py
index 345051982..b9c73eb45 100644
--- a/Examples/test-suite/python/director_detect_runme.py
+++ b/Examples/test-suite/python/director_detect_runme.py
@@ -35,4 +35,4 @@ c = b.clone()
vc = c.get_value()
if (v != 3) or (b.val != 5) or (vc != 6):
- raise RuntimeError, "Bad virtual detection"
+ raise RuntimeError("Bad virtual detection")
diff --git a/Examples/test-suite/python/director_exception_runme.py b/Examples/test-suite/python/director_exception_runme.py
index 06856f30a..458983c6a 100644
--- a/Examples/test-suite/python/director_exception_runme.py
+++ b/Examples/test-suite/python/director_exception_runme.py
@@ -10,7 +10,7 @@ class MyException(Exception):
class MyFoo(Foo):
def ping(self):
- raise NotImplementedError, "MyFoo::ping() EXCEPTION"
+ raise NotImplementedError("MyFoo::ping() EXCEPTION")
class MyFoo2(Foo):
@@ -28,74 +28,58 @@ class MyFoo3(Foo):
class MyFoo4(Foo):
def ping(self, *args):
- print(type("bad", "call")) # throws TypeError message: type() takes 1 or 3 arguments
+ t = type("bad", "call") # throws TypeError message: type() takes 1 or 3 arguments
return "Foo4.ping"
# Check that the NotImplementedError raised by MyFoo.ping() is returned by
# MyFoo.pong().
-ok = 0
a = MyFoo()
b = launder(a)
try:
b.pong()
-except NotImplementedError, e:
- if str(e) == "MyFoo::ping() EXCEPTION":
- ok = 1
- else:
- print "Unexpected error message: %s" % str(e)
-except:
+ raise RuntimeError("Exception was not thrown")
+except NotImplementedError as e:
+ if not str(e) == "MyFoo::ping() EXCEPTION":
+ raise RuntimeError("Unexpected error message: %s" % str(e))
+except TypeError:
pass
-if not ok:
- raise RuntimeError
# Check that the director returns the appropriate TypeError if the return type
# is wrong.
-ok = 0
a = MyFoo2()
b = launder(a)
try:
b.pong()
-except TypeError, e:
+ raise RuntimeError("Exception was not thrown")
+except TypeError as e:
# fastdispatch mode adds on Additional Information to the exception message - just check the main exception message exists
- if str(e).startswith("SWIG director type mismatch in output value of type 'std::string'"):
- ok = 1
- else:
- print "Unexpected error message: %s" % str(e)
-if not ok:
- raise RuntimeError
+ if not str(e).startswith("SWIG director type mismatch in output value of type 'std::string'"):
+ raise RuntimeError("Unexpected error message: %s" % str(e))
# Check that the director can return an exception which requires two arguments
# to the constructor, without mangling it.
-ok = 0
a = MyFoo3()
b = launder(a)
try:
b.pong()
-except MyException, e:
- if e.msg == "foobar":
- ok = 1
- else:
- print "Unexpected error message: %s" % str(e)
-if not ok:
- raise RuntimeError
+ raise RuntimeError("Exception was not thrown")
+except MyException as e:
+ if e.msg != "foobar":
+ raise RuntimeError("Unexpected error message: %s" % str(e))
# Check that the director returns the appropriate TypeError thrown in a director method
-ok = 0
a = MyFoo4()
b = launder(a)
try:
b.pong()
+ raise RuntimeError("Exception was not thrown")
except TypeError as e:
- if str(e).startswith("type() takes 1 or 3 arguments"):
- ok = 1
- else:
- print "Unexpected error message: %s" % str(e)
-if not ok:
- raise RuntimeError
+ if not str(e).startswith("type() takes 1 or 3 arguments"):
+ raise RuntimeError("Unexpected error message: %s" % str(e))
# This is expected to fail with -builtin option
diff --git a/Examples/test-suite/python/director_extend_runme.py b/Examples/test-suite/python/director_extend_runme.py
index a5aad8245..870443d1f 100644
--- a/Examples/test-suite/python/director_extend_runme.py
+++ b/Examples/test-suite/python/director_extend_runme.py
@@ -17,6 +17,6 @@ class MyObject(SpObject):
m = MyObject()
if m.dummy() != 666:
- raise RuntimeError, "1st call"
+ raise RuntimeError("1st call")
if m.dummy() != 666: # Locked system
- raise RuntimeError, "2nd call"
+ raise RuntimeError("2nd call")
diff --git a/Examples/test-suite/python/director_frob_runme.py b/Examples/test-suite/python/director_frob_runme.py
index 0ef4ad900..6c8fcad06 100644
--- a/Examples/test-suite/python/director_frob_runme.py
+++ b/Examples/test-suite/python/director_frob_runme.py
@@ -4,4 +4,4 @@ foo = Bravo()
s = foo.abs_method()
if s != "Bravo::abs_method()":
- raise RuntimeError, s
+ raise RuntimeError(s)
diff --git a/Examples/test-suite/python/director_nested_runme.py b/Examples/test-suite/python/director_nested_runme.py
index f3d973630..b2c4b0d40 100644
--- a/Examples/test-suite/python/director_nested_runme.py
+++ b/Examples/test-suite/python/director_nested_runme.py
@@ -14,7 +14,7 @@ class A(FooBar_int):
a = A()
if a.step() != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;":
- raise RuntimeError, "Bad A virtual resolution"
+ raise RuntimeError("Bad A virtual resolution")
class B(FooBar_int):
@@ -34,7 +34,7 @@ class B(FooBar_int):
b = B()
if b.step() != "Bar::step;Foo::advance;B::do_advance;B::do_step;":
- raise RuntimeError, "Bad B virtual resolution"
+ raise RuntimeError("Bad B virtual resolution")
class C(FooBar_int):
diff --git a/Examples/test-suite/python/director_profile_runme.py b/Examples/test-suite/python/director_profile_runme.py
index 035007c61..7c269c3f7 100644
--- a/Examples/test-suite/python/director_profile_runme.py
+++ b/Examples/test-suite/python/director_profile_runme.py
@@ -38,4 +38,4 @@ while i:
a = fi(a) # 20
i -= 1
-print a
+print("a: {}".format(a))
diff --git a/Examples/test-suite/python/director_protected_runme.py b/Examples/test-suite/python/director_protected_runme.py
index c3118a7c0..94eab69a6 100644
--- a/Examples/test-suite/python/director_protected_runme.py
+++ b/Examples/test-suite/python/director_protected_runme.py
@@ -35,7 +35,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, "bad FooBar::used"
+ raise RuntimeError("bad FooBar::used")
try:
s = fb2.used()
@@ -43,7 +43,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, "bad FooBar2::used"
+ raise RuntimeError("bad FooBar2::used")
try:
s = b.pong()
@@ -51,7 +51,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, "bad Bar::pong"
+ raise RuntimeError("bad Bar::pong")
try:
s = f.pong()
@@ -59,7 +59,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, " bad Foo::pong"
+ raise RuntimeError(" bad Foo::pong")
try:
s = fb.pong()
@@ -67,7 +67,7 @@ try:
raise RuntimeError
pass
except:
- raise RuntimeError, " bad FooBar::pong"
+ raise RuntimeError(" bad FooBar::pong")
protected = 1
try:
@@ -76,7 +76,7 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "Foo::ping is protected"
+ raise RuntimeError("Foo::ping is protected")
protected = 1
try:
@@ -85,7 +85,7 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "Foo::ping is protected"
+ raise RuntimeError("Foo::ping is protected")
protected = 1
@@ -95,7 +95,7 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "FooBar::pang is protected"
+ raise RuntimeError("FooBar::pang is protected")
protected = 1
@@ -105,7 +105,7 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "Bar::cheer is protected"
+ raise RuntimeError("Bar::cheer is protected")
protected = 1
try:
@@ -114,19 +114,19 @@ try:
except:
pass
if not protected:
- raise RuntimeError, "Foo::cheer is protected"
+ raise RuntimeError("Foo::cheer is protected")
if fb3.cheer() != "FooBar3::cheer();":
- raise RuntimeError, "bad fb3::cheer"
+ raise RuntimeError("bad fb3::cheer")
if fb2.callping() != "FooBar2::ping();":
- raise RuntimeError, "bad fb2.callping"
+ raise RuntimeError("bad fb2.callping")
if fb2.callcheer() != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();":
- raise RuntimeError, "bad fb2.callcheer"
+ raise RuntimeError("bad fb2.callcheer")
if fb3.callping() != "Bar::ping();":
- raise RuntimeError, "bad fb3.callping"
+ raise RuntimeError("bad fb3.callping")
if fb3.callcheer() != "FooBar3::cheer();":
- raise RuntimeError, "bad fb3.callcheer"
+ raise RuntimeError("bad fb3.callcheer")
diff --git a/Examples/test-suite/python/director_smartptr_runme.py b/Examples/test-suite/python/director_smartptr_runme.py
index 23e22d0fb..b4cbafe32 100644
--- a/Examples/test-suite/python/director_smartptr_runme.py
+++ b/Examples/test-suite/python/director_smartptr_runme.py
@@ -31,7 +31,7 @@ class director_smartptr_MyBarFooDerived(FooDerived):
def check(got, expected):
if (got != expected):
- raise RuntimeError, "Failed, got: " + got + " expected: " + expected
+ raise RuntimeError("Failed, got: " + got + " expected: " + expected)
fooBar = FooBar()
diff --git a/Examples/test-suite/python/director_string_runme.py b/Examples/test-suite/python/director_string_runme.py
index dcd47d647..c6d4c8121 100644
--- a/Examples/test-suite/python/director_string_runme.py
+++ b/Examples/test-suite/python/director_string_runme.py
@@ -18,12 +18,10 @@ b = B("hello")
b.get(0)
if b.get_first() != "hello world!":
- print b.get_first()
- raise RuntimeError
+ raise RuntimeError("b.get_first(): {}".format(b.get_first()))
b.call_process_func()
if b.smem != "hello":
- print smem
- raise RuntimeError
+ raise RuntimeError("smem: {}".format(smem))
diff --git a/Examples/test-suite/python/director_thread_runme.py b/Examples/test-suite/python/director_thread_runme.py
index 4fcf3bfd1..21a8ce1b0 100644
--- a/Examples/test-suite/python/director_thread_runme.py
+++ b/Examples/test-suite/python/director_thread_runme.py
@@ -14,7 +14,6 @@ d = Derived()
d.run()
if d.val >= 0:
- print d.val
- raise RuntimeError
+ raise RuntimeError("d.val: {}".format(d.val))
d.stop()
diff --git a/Examples/test-suite/python/director_unroll_runme.py b/Examples/test-suite/python/director_unroll_runme.py
index 60bc05585..ea602d8e2 100644
--- a/Examples/test-suite/python/director_unroll_runme.py
+++ b/Examples/test-suite/python/director_unroll_runme.py
@@ -16,5 +16,4 @@ c = b.get()
if not (a.this == c.this):
- print a, c
- raise RuntimeError
+ raise RuntimeError("{} {}".format(a, c))
diff --git a/Examples/test-suite/python/director_wstring_runme.py b/Examples/test-suite/python/director_wstring_runme.py
index 242b27582..5facc1f1d 100644
--- a/Examples/test-suite/python/director_wstring_runme.py
+++ b/Examples/test-suite/python/director_wstring_runme.py
@@ -7,22 +7,20 @@ class B(A):
A.__init__(self, string)
def get_first(self):
- return A.get_first(self) + u" world!"
+ return A.get_first(self) + " world!"
- def process_text(self, string):
- self.smem = u"hello"
+ def process_text(self, s):
+ self.smem = s
-b = B(u"hello")
+b = B("hello")
b.get(0)
-if b.get_first() != u"hello world!":
- print b.get_first()
- raise RuntimeError
+if b.get_first() != "hello world!":
+ raise RuntimeError("b.get_first(): {}".format(b.get_first()))
b.call_process_func()
-if b.smem != u"hello":
- print smem
- raise RuntimeError
+if b.smem != "hello":
+ raise RuntimeError("smem: {}".format(smem))
diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py
index 9ef8dbd52..4cd500178 100644
--- a/Examples/test-suite/python/doxygen_basic_translate_runme.py
+++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py
@@ -60,7 +60,7 @@ comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function5),
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function6),
"""\
Test for default args
-:type a: int
+:type a: int, optional
:param a: Some parameter, default is 42"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function7),
@@ -70,6 +70,16 @@ Test for a parameter with difficult type
:type a: :py:class:`Shape`
:param a: Very strange param"""
)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function8),
+ """\
+Test variadic function
+:param ...: extra args"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function9),
+ """\
+Test unnamed argument
+:param baz: Description of baz"""
+)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.Atan2),
"""\
diff --git a/Examples/test-suite/python/doxygen_basic_translate_style2_runme.py b/Examples/test-suite/python/doxygen_basic_translate_style2_runme.py
index b75045d59..a24f5defc 100644
--- a/Examples/test-suite/python/doxygen_basic_translate_style2_runme.py
+++ b/Examples/test-suite/python/doxygen_basic_translate_style2_runme.py
@@ -58,7 +58,7 @@ comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function5),
comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function6),
"""\
Test for default args
-:type a: int
+:type a: int, optional
:param a: Some parameter, default is 42"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style2.function7),
diff --git a/Examples/test-suite/python/doxygen_basic_translate_style3_runme.py b/Examples/test-suite/python/doxygen_basic_translate_style3_runme.py
new file mode 100644
index 000000000..687270351
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_basic_translate_style3_runme.py
@@ -0,0 +1,82 @@
+import doxygen_basic_translate_style3
+import inspect
+import string
+import sys
+import comment_verifier
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style3.function),
+ """\
+Brief description.
+
+The comment text.
+
+Author: Some author
+
+:rtype: int
+:return: Some number
+
+See also: function2"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style3.function2),
+ """\
+A test of a very very very very very very very very very very very very very very very very
+very very very very very long comment string."""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style3.function3),
+ """*Overload 1:*
+A test for overloaded functions
+This is function **one**
+
+|
+
+*Overload 2:*
+A test for overloaded functions
+This is function **two**"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style3.function4),
+ """\
+A test of some mixed tag usage
+If: CONDITION {
+This *code* fragment shows us something .
+Title: Minuses:
+* it\'s senseless
+* it\'s stupid
+* it\'s null
+
+Warning: This may not work as expected
+
+.. code-block:: c++
+
+ int main() { while(true); }
+
+ int testBlankLine() {}
+}"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style3.function5),
+ """This is a post comment."""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style3.function6),
+ """\
+Test for default args
+:type a: int, optional
+:param a: Some parameter, default is 42"""
+)
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style3.function7),
+ """\
+Test for a parameter with difficult type
+(mostly for python)
+:type a: :py:class:`Shape`
+:param a: Very strange param"""
+)
+
+comment_verifier.check(inspect.getdoc(doxygen_basic_translate_style3.Atan2),
+ """\
+Multiple parameters test.
+
+:type y: float
+:param y: Vertical coordinate.
+:type x: float
+:param x: Horizontal coordinate.
+:rtype: float
+:return: Arc tangent of ``y/x``."""
+)
diff --git a/Examples/test-suite/python/doxygen_code_blocks_runme.py b/Examples/test-suite/python/doxygen_code_blocks_runme.py
new file mode 100644
index 000000000..46a0a3d84
--- /dev/null
+++ b/Examples/test-suite/python/doxygen_code_blocks_runme.py
@@ -0,0 +1,58 @@
+import doxygen_code_blocks
+import inspect
+import string
+import sys
+import comment_verifier
+
+comment_verifier.check(inspect.getdoc(doxygen_code_blocks.function),
+ """\
+Test for code blocks
+
+.. code-block:: c++
+
+ simple code block
+
+More advanced usage with C++ characters:
+
+.. code-block:: c++
+
+ std::vector first; // empty vector of ints
+ std::vector second (4,100); // four ints with value 100
+ std::vector third (second.begin(),second.end()); // iterating through second
+ std::vector fourth (third); // a copy of third
+ // the iterator constructor can also be used to construct from arrays:
+ int myints[] = {16,2,77,29};
+ std::vector fifth (myints, myints + sizeof(myints) / sizeof(int) );
+
+ std::cout << "The contents of fifth are:";
+ for (std::vector::iterator it = fifth.begin(); it != fifth.end(); ++it)
+ std::cout << ' ' << *it;
+ std::cout << '\\n';
+
+A code block for C:
+
+.. code-block:: c
+
+ printf("hello world");
+
+A code block for Java:
+
+.. code-block:: java
+
+ public class HelloWorld {
+ public static void main(String[] args) {
+ // Prints "Hello, World" to the terminal window.
+ System.out.println("Hello, World");
+ }
+ }
+
+A code block for python:
+
+.. code-block:: python
+
+ print('hello world')
+
+A python doctest example:
+
+>>> 1 + 1
+2""")
diff --git a/Examples/test-suite/python/doxygen_misc_constructs_runme.py b/Examples/test-suite/python/doxygen_misc_constructs_runme.py
index 11aa53ba3..44f607fee 100644
--- a/Examples/test-suite/python/doxygen_misc_constructs_runme.py
+++ b/Examples/test-suite/python/doxygen_misc_constructs_runme.py
@@ -12,7 +12,7 @@ comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getAddress),
:param fileName: name of the file, where the source line is located
:type line: int
:param line: line number
-:type isGetSize: boolean
+:type isGetSize: boolean, optional
:param isGetSize: if set, for every object location both address and size are returned
Connection::getId() """)
@@ -131,3 +131,13 @@ Spaces at the start of line should be taken into account:
:type fileName: string
:param fileName: name of the log file"""
);
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.doc_ends_with_quote),
+ r'''This doc comment ends with a quote: "and that's ok"'''
+);
+
+comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.doc_with_triple_quotes),
+ r'''This comment contains embedded triple-quoted string:
+
+ """How quaint"""'''
+);
diff --git a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py
index df1c0eba5..e884cf9ef 100644
--- a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py
+++ b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py
@@ -82,7 +82,7 @@ r"""Comment for **func03()**.
*italicword*
-emphazedWord
+*emphazedWord*
@@ -175,7 +175,7 @@ This will only appear in LATeX
-someMember Some description follows
+someMember Some description follows with text after
@@ -196,7 +196,7 @@ is the note!
This is an overloaded member function, provided for convenience.
It differs from the above function only in what argument(s) it accepts.
-someword
+``someword``
@@ -209,7 +209,13 @@ Maybe even multiline
:type a: int
-:param a: the first param""")
+:param a: the first param
+:type b: int, in
+:param b: parameter with intent(in)
+:type c: int, out
+:param c: parameter with intent(out)
+:type d: int, in/out
+:param d: parameter with intent(in,out)""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func08),
r"""Text after anchor.
diff --git a/Examples/test-suite/python/doxygen_translate_runme.py b/Examples/test-suite/python/doxygen_translate_runme.py
index d698ba873..38dca2ef9 100644
--- a/Examples/test-suite/python/doxygen_translate_runme.py
+++ b/Examples/test-suite/python/doxygen_translate_runme.py
@@ -80,7 +80,7 @@ is the note!
This is an overloaded member function, provided for convenience.
It differs from the above function only in what argument(s) it accepts.
-someword
+``someword``
diff --git a/Examples/test-suite/python/dynamic_cast_runme.py b/Examples/test-suite/python/dynamic_cast_runme.py
index 59e86d34c..ae080833b 100644
--- a/Examples/test-suite/python/dynamic_cast_runme.py
+++ b/Examples/test-suite/python/dynamic_cast_runme.py
@@ -8,4 +8,4 @@ y = b.blah()
a = dynamic_cast.do_test(y)
if a != "Bar::test":
- print "Failed!!"
+ raise RuntimeError("Failed!!")
diff --git a/Examples/test-suite/python/exception_order_runme.py b/Examples/test-suite/python/exception_order_runme.py
index c53521e3e..5c1529999 100644
--- a/Examples/test-suite/python/exception_order_runme.py
+++ b/Examples/test-suite/python/exception_order_runme.py
@@ -9,36 +9,35 @@ a = A()
try:
a.foo()
-except E1, e:
+except E1 as e:
pass
except:
- raise RuntimeError, "bad exception order"
+ raise RuntimeError("bad exception order")
try:
a.bar()
-except E2, e:
+except E2 as e:
pass
except:
- raise RuntimeError, "bad exception order"
+ raise RuntimeError("bad exception order")
try:
a.foobar()
-except RuntimeError, e:
+except RuntimeError as e:
if e.args[0] != "postcatch unknown":
- print "bad exception order",
- raise RuntimeError, e.args
+ raise RuntimeError("bad exception order {}".format(e.args))
try:
a.barfoo(1)
-except E1, e:
+except E1 as e:
pass
except:
- raise RuntimeError, "bad exception order"
+ raise RuntimeError("bad exception order")
try:
a.barfoo(2)
-except E2, e:
+except E2 as e:
pass
except:
- raise RuntimeError, "bad exception order"
+ raise RuntimeError("bad exception order")
diff --git a/Examples/test-suite/python/fvirtual_runme.py b/Examples/test-suite/python/fvirtual_runme.py
index 99f5dc6b0..fe211b441 100644
--- a/Examples/test-suite/python/fvirtual_runme.py
+++ b/Examples/test-suite/python/fvirtual_runme.py
@@ -5,4 +5,4 @@ n = Node()
i = sw.addChild(n)
if i != 2:
- raise RuntimeError, "addChild"
+ raise RuntimeError("addChild")
diff --git a/Examples/test-suite/python/global_functions_runme.py b/Examples/test-suite/python/global_functions_runme.py
index f411261b6..4aab1b082 100644
--- a/Examples/test-suite/python/global_functions_runme.py
+++ b/Examples/test-suite/python/global_functions_runme.py
@@ -11,7 +11,7 @@ check(global_two(2, 2), 4)
fail = True
try:
global_void(1)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -19,7 +19,7 @@ if fail:
fail = True
try:
global_one()
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -27,7 +27,7 @@ if fail:
fail = True
try:
global_one(2, 2)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
@@ -36,7 +36,7 @@ if fail:
fail = True
try:
global_two(1)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
@@ -45,7 +45,7 @@ if fail:
fail = True
try:
global_two(3, 3, 3)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
diff --git a/Examples/test-suite/python/global_vars_runme.py b/Examples/test-suite/python/global_vars_runme.py
index 3ef0b494f..015519ec8 100644
--- a/Examples/test-suite/python/global_vars_runme.py
+++ b/Examples/test-suite/python/global_vars_runme.py
@@ -20,7 +20,7 @@ if x != 9876:
fail = True
try:
global_vars.cvar.notexist = "something"
-except AttributeError, e:
+except AttributeError as e:
fail = False
if fail:
raise RuntimeError("AttributeError should have been thrown")
@@ -28,7 +28,7 @@ if fail:
fail = True
try:
g = global_vars.cvar.notexist
-except AttributeError, e:
+except AttributeError as e:
fail = False
if fail:
raise RuntimeError("AttributeError should have been thrown")
diff --git a/Examples/test-suite/python/import_stl_runme.py b/Examples/test-suite/python/import_stl_runme.py
index 69fe812b9..d0efbd083 100644
--- a/Examples/test-suite/python/import_stl_runme.py
+++ b/Examples/test-suite/python/import_stl_runme.py
@@ -3,4 +3,4 @@ import import_stl_a
v_new = import_stl_b.process_vector([1, 2, 3])
if v_new != (1, 2, 3, 4):
- raise RuntimeError, v_new
+ raise RuntimeError(v_new)
diff --git a/Examples/test-suite/python/inctest_runme.py b/Examples/test-suite/python/inctest_runme.py
index fa3492932..c2746560d 100644
--- a/Examples/test-suite/python/inctest_runme.py
+++ b/Examples/test-suite/python/inctest_runme.py
@@ -1,31 +1,21 @@
import inctest
-error = 0
try:
a = inctest.A()
except:
- print "didn't find A"
- print "therefore, I didn't include 'testdir/subdir1/hello.i'"
- error = 1
+ raise RuntimeError("didn't find A, therefore, I didn't include 'testdir/subdir1/hello.i'")
pass
try:
b = inctest.B()
except:
- print "didn't find B"
- print "therefore, I didn't include 'testdir/subdir2/hello.i'"
- error = 1
+ raise RuntimeError("didn't find B, therefore, I didn't include 'testdir/subdir2/hello.i'")
pass
-if error == 1:
- raise RuntimeError
-
# Check the import in subdirectory worked
if inctest.importtest1(5) != 15:
- print "import test 1 failed"
- raise RuntimeError
+ raise RuntimeError("import test 1 failed")
if inctest.importtest2("black") != "white":
- print "import test 2 failed"
- raise RuntimeError
+ raise RuntimeError("import test 2 failed")
diff --git a/Examples/test-suite/python/inherit_missing_runme.py b/Examples/test-suite/python/inherit_missing_runme.py
index 044c166fb..57a245e44 100644
--- a/Examples/test-suite/python/inherit_missing_runme.py
+++ b/Examples/test-suite/python/inherit_missing_runme.py
@@ -6,14 +6,14 @@ c = inherit_missing.Spam()
x = inherit_missing.do_blah(a)
if x != "Foo::blah":
- print "Whoa! Bad return", x
+ raise RuntimeError("Whoa! Bad return {}".format(x))
x = inherit_missing.do_blah(b)
if x != "Bar::blah":
- print "Whoa! Bad return", x
+ raise RuntimeError("Whoa! Bad return {}".format(x))
x = inherit_missing.do_blah(c)
if x != "Spam::blah":
- print "Whoa! Bad return", x
+ raise RuntimeError("Whoa! Bad return {}".format(x))
inherit_missing.delete_Foo(a)
diff --git a/Examples/test-suite/python/inplaceadd_runme.py b/Examples/test-suite/python/inplaceadd_runme.py
index 7f292cbb5..3d5a1fd40 100644
--- a/Examples/test-suite/python/inplaceadd_runme.py
+++ b/Examples/test-suite/python/inplaceadd_runme.py
@@ -3,8 +3,7 @@ a = inplaceadd.A(7)
a += 5
if a.val != 12:
- print a.val
- raise RuntimeError
+ raise RuntimeError("a.val: {}".format(a.val))
a -= 5
if a.val != 7:
diff --git a/Examples/test-suite/python/kwargs_feature_runme.py b/Examples/test-suite/python/kwargs_feature_runme.py
index a2d4731ab..387658ec3 100644
--- a/Examples/test-suite/python/kwargs_feature_runme.py
+++ b/Examples/test-suite/python/kwargs_feature_runme.py
@@ -79,3 +79,61 @@ if rfoo(n=11, x=22) != -11:
if rfoo(x=11, n=22) != 11:
raise RuntimeError
+
+# Extended constructors
+e = Extending0()
+e = Extending1(one=1)
+e = Extending1(1)
+e = Extending2(1, "two")
+e = Extending2(1, two="two")
+e = Extending2(two="two", one=1)
+e = ExtendingOptArgs1()
+e = ExtendingOptArgs1(1)
+e = ExtendingOptArgs2(one=1)
+e = ExtendingOptArgs2()
+e = ExtendingOptArgs2(one=1)
+e = ExtendingOptArgs2(two="two")
+e = ExtendingOptArgs2(two="two", one=1)
+
+# Invalid kwargs test
+h = Hello()
+try:
+ h = Hello(nonexistent=10)
+ raise RuntimeError("missed exception")
+except TypeError as e:
+ pass
+
+f = Foo(1)
+f = Foo(a=1)
+try:
+ f = Foo(nonexistent=10)
+ raise RuntimeError("missed exception")
+except TypeError as e:
+ pass
+
+try:
+ f = Foo(a=1, nonexistent=10)
+ raise RuntimeError("missed exception")
+except TypeError as e:
+ pass
+
+try:
+ f = Foo(1, nonexistent=10)
+ raise RuntimeError("missed exception")
+except TypeError as e:
+ pass
+
+# Varargs
+f = VarargConstructor(fmt="Ciao")
+f.vararg_method(fmt="Bonjour")
+try:
+ f = VarargConstructor(nonexistent="Ciao")
+ raise RuntimeError("missed exception")
+except TypeError as e:
+ pass
+
+try:
+ f.vararg_method(nonexistent="Bonjour")
+ raise RuntimeError("missed exception")
+except TypeError as e:
+ pass
diff --git a/Examples/test-suite/python/li_attribute_runme.py b/Examples/test-suite/python/li_attribute_runme.py
index 80e793618..d26bf0b68 100644
--- a/Examples/test-suite/python/li_attribute_runme.py
+++ b/Examples/test-suite/python/li_attribute_runme.py
@@ -8,12 +8,10 @@ if aa.a != 1:
raise RuntimeError
aa.a = 3
if aa.a != 3:
- print aa.a
- raise RuntimeError
+ raise RuntimeError("aa.a: {}".format(aa.a))
if aa.b != 2:
- print aa.b
- raise RuntimeError
+ raise RuntimeError("aa.b: {}".format(aa.b))
aa.b = 5
if aa.b != 5:
raise RuntimeError
@@ -47,6 +45,9 @@ myClass = li_attribute.MyClass()
myClass.Foo = myFoo
if myClass.Foo.x != 8:
raise RuntimeError
+myClass.Foo2 = myFoo
+if myClass.Foo2.x != 8:
+ raise RuntimeError
# class/struct attribute with get/set methods using return/pass by value
myClassVal = li_attribute.MyClassVal()
@@ -77,7 +78,7 @@ if myStringyClass.ReadOnlyString != "changed string":
try:
x = myFoo.does_not_exist
raise RuntimeError
-except AttributeError, e:
+except AttributeError as e:
if str(e).find("does_not_exist") == -1:
raise RuntimeError
diff --git a/Examples/test-suite/python/li_attribute_template_runme.py b/Examples/test-suite/python/li_attribute_template_runme.py
index d33b12309..f0a774995 100644
--- a/Examples/test-suite/python/li_attribute_template_runme.py
+++ b/Examples/test-suite/python/li_attribute_template_runme.py
@@ -7,8 +7,7 @@ chell = li_attribute_template.Cintint(1, 2, 3)
def rassert(what, master):
if what != master:
- print what
- raise RuntimeError
+ raise RuntimeError("what: {}".format(what))
# Testing primitive by value attribute
rassert(chell.a, 1)
diff --git a/Examples/test-suite/python/li_boost_shared_ptr_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_runme.py
index c960625ad..ecda7fdb1 100644
--- a/Examples/test-suite/python/li_boost_shared_ptr_runme.py
+++ b/Examples/test-suite/python/li_boost_shared_ptr_runme.py
@@ -10,7 +10,7 @@ class li_boost_shared_ptr_runme:
def main(self):
if (debug):
- print "Started"
+ print("Started")
li_boost_shared_ptr.cvar.debug_shared = debug
@@ -32,7 +32,7 @@ class li_boost_shared_ptr_runme:
"shared_ptr wrapper count=%s" % wrapper_count)
if (debug):
- print "Finished"
+ print("Finished")
def runtest(self):
# simple shared_ptr usage - created in C++
diff --git a/Examples/test-suite/python/li_cstring_runme.py b/Examples/test-suite/python/li_cstring_runme.py
index b718f1352..d22fc261b 100644
--- a/Examples/test-suite/python/li_cstring_runme.py
+++ b/Examples/test-suite/python/li_cstring_runme.py
@@ -11,12 +11,10 @@ if test2() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^
raise RuntimeError
if test3("hello") != "hello-suffix":
- print test3("hello")
- raise RuntimeError
+ raise RuntimeError("test3(\"hello\")")
if test4("hello") != "hello-suffix":
- print test4("hello")
- raise RuntimeError
+ raise RuntimeError("test4(\"hello\")")
if test5(4) != "xxxx":
raise RuntimeError
diff --git a/Examples/test-suite/python/li_cwstring_runme.py b/Examples/test-suite/python/li_cwstring_runme.py
index 5dd7b9b20..9216445c6 100644
--- a/Examples/test-suite/python/li_cwstring_runme.py
+++ b/Examples/test-suite/python/li_cwstring_runme.py
@@ -1,28 +1,28 @@
from li_cwstring import *
-if count(u"ab\0ab\0ab\0", 0) != 3:
+if count("ab\0ab\0ab\0", 0) != 3:
raise RuntimeError
-if test1() != u"Hello World":
+if test1() != "Hello World":
raise RuntimeError
-if test2() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
+if test2() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
raise RuntimeError
-if test3("hello") != u"hello-suffix":
+if test3("hello") != "hello-suffix":
raise RuntimeError
-if test4("hello") != u"hello-suffix":
+if test4("hello") != "hello-suffix":
raise RuntimeError
-if test5(4) != u"xxxx":
+if test5(4) != "xxxx":
raise RuntimeError
-if test6(10) != u"xxxxx":
+if test6(10) != "xxxxx":
raise RuntimeError
-if test7() != u"Hello world!":
+if test7() != "Hello world!":
raise RuntimeError
-if test8() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
+if test8() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
raise RuntimeError
diff --git a/Examples/test-suite/python/li_implicit_runme.py b/Examples/test-suite/python/li_implicit_runme.py
index d8dd0fdcc..5d5c6caa0 100644
--- a/Examples/test-suite/python/li_implicit_runme.py
+++ b/Examples/test-suite/python/li_implicit_runme.py
@@ -9,8 +9,8 @@ ad, get(ad)
ab, get(ab)
if get(ai) != get(1):
- raise RuntimeError, "bad implicit type"
+ raise RuntimeError("bad implicit type")
if get(ad) != get(2.0):
- raise RuntimeError, "bad implicit type"
+ raise RuntimeError("bad implicit type")
if get(ab) != get(b):
- raise RuntimeError, "bad implicit type"
+ raise RuntimeError("bad implicit type")
diff --git a/Examples/test-suite/python/li_std_containers_int_runme.py b/Examples/test-suite/python/li_std_containers_int_runme.py
index 941838a5f..f346de220 100644
--- a/Examples/test-suite/python/li_std_containers_int_runme.py
+++ b/Examples/test-suite/python/li_std_containers_int_runme.py
@@ -6,7 +6,7 @@ import sys
def failed(a, b, msg):
- raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
+ raise RuntimeError(msg + " " + str(list(a)) + " " + str(list(b)))
def compare_sequences(a, b):
@@ -26,7 +26,7 @@ def compare_containers(pythonlist, swigvector, swiglist):
def container_insert_step(i, j, step, newval):
- ps = range(6)
+ ps = list(range(6))
iv = vector_int(ps)
il = list_int(ps)
@@ -43,9 +43,9 @@ def container_insert_step(i, j, step, newval):
else:
ps[i:j:step] = newval
ps_error = None
- except ValueError, e:
+ except ValueError as e:
ps_error = e
- except IndexError, e:
+ except IndexError as e:
ps_error = e
# std::vector
@@ -61,9 +61,9 @@ def container_insert_step(i, j, step, newval):
else:
iv[i:j:step] = newval
iv_error = None
- except ValueError, e:
+ except ValueError as e:
iv_error = e
- except IndexError, e:
+ except IndexError as e:
iv_error = e
# std::list
@@ -79,14 +79,14 @@ def container_insert_step(i, j, step, newval):
else:
il[i:j:step] = newval
il_error = None
- except ValueError, e:
+ except ValueError as e:
il_error = e
- except IndexError, e:
+ except IndexError as e:
il_error = e
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
- raise RuntimeError, "ValueError exception not consistently thrown: " + \
- str(ps_error) + " " + str(iv_error) + " " + str(il_error)
+ raise RuntimeError("ValueError exception not consistently thrown: " + \
+ str(ps_error) + " " + str(iv_error) + " " + str(il_error))
compare_containers(ps, iv, il)
@@ -94,7 +94,7 @@ def container_insert_step(i, j, step, newval):
# Check std::vector and std::list delete behaves same as Python list
# delete including exceptions
def container_delete_step(i, j, step):
- ps = range(6)
+ ps = list(range(6))
iv = vector_int(ps)
il = list_int(ps)
@@ -111,9 +111,9 @@ def container_delete_step(i, j, step):
else:
del ps[i:j:step]
ps_error = None
- except ValueError, e:
+ except ValueError as e:
ps_error = e
- except IndexError, e:
+ except IndexError as e:
ps_error = e
# std::vector
@@ -129,9 +129,9 @@ def container_delete_step(i, j, step):
else:
del iv[i:j:step]
iv_error = None
- except ValueError, e:
+ except ValueError as e:
iv_error = e
- except IndexError, e:
+ except IndexError as e:
iv_error = e
# std::list
@@ -147,14 +147,14 @@ def container_delete_step(i, j, step):
else:
del il[i:j:step]
il_error = None
- except ValueError, e:
+ except ValueError as e:
il_error = e
- except IndexError, e:
+ except IndexError as e:
il_error = e
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
- raise RuntimeError, "ValueError exception not consistently thrown: " + \
- str(ps_error) + " " + str(iv_error) + " " + str(il_error)
+ raise RuntimeError("ValueError exception not consistently thrown: " + \
+ str(ps_error) + " " + str(iv_error) + " " + str(il_error))
compare_containers(ps, iv, il)
@@ -252,7 +252,7 @@ for start in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 10
for step in range(-7, 7):
container_delete_step(start, end, step)
-ps = range(6)
+ps = list(range(6))
iv = vector_int(ps)
il = list_int(ps)
del ps[:]
diff --git a/Examples/test-suite/python/li_std_containers_overload_runme.py b/Examples/test-suite/python/li_std_containers_overload_runme.py
new file mode 100644
index 000000000..dcb383511
--- /dev/null
+++ b/Examples/test-suite/python/li_std_containers_overload_runme.py
@@ -0,0 +1,29 @@
+from li_std_containers_overload import *
+
+def check(got, expected):
+ if got != expected:
+ raise RuntimeError("Failed check. '{}' != '{}'".format(got, expected))
+
+v = VectorX()
+check(VectorOverload(v), "vector")
+
+v = VectorY()
+check(VectorOverload(v), "vector")
+
+v = VectorInt()
+check(VectorOverload(v), "vector")
+
+v = VectorString()
+check(VectorOverload(v), "vector")
+
+v = [X()]
+check(VectorOverload(v), "vector")
+
+v = [Y()]
+check(VectorOverload(v), "vector")
+
+v = [1, 2, 3]
+check(VectorOverload(v), "vector")
+
+v = ["aaa", "bbb", "ccc"]
+check(VectorOverload(v), "vector")
diff --git a/Examples/test-suite/python/li_std_map_runme.py b/Examples/test-suite/python/li_std_map_runme.py
index ac214dd45..765527ea4 100644
--- a/Examples/test-suite/python/li_std_map_runme.py
+++ b/Examples/test-suite/python/li_std_map_runme.py
@@ -25,8 +25,7 @@ for k in m:
for k in m:
if pm[k].this != m[k].this:
- print pm[k], m[k]
- raise RuntimeError
+ raise RuntimeError("Not equal {} {}".format(pm[k], m[k]))
m = {}
@@ -51,31 +50,31 @@ mii[1] = 2
if mii[1] != 2:
raise RuntimeError
-if mii.keys() != [1]:
+if list(mii.keys()) != [1]:
raise RuntimeError("keys")
-if mii.values() != [2]:
+if list(mii.values()) != [2]:
raise RuntimeError("values")
-if mii.items() != [(1, 2)]:
+if list(mii.items()) != [(1, 2)]:
raise RuntimeError("items")
if [k for k in mii] != [1]:
raise RuntimeError("iteration")
-if [i for i in mii.iterkeys()] != [1]:
+if [i for i in mii.keys()] != [1]:
raise RuntimeError("iterkeys")
-if [i for i in mii.itervalues()] != [2]:
+if [i for i in mii.values()] != [2]:
raise RuntimeError("itervalues")
-if [i for i in mii.iteritems()] != [(1, 2)]:
+if [i for i in mii.items()] != [(1, 2)]:
raise RuntimeError("iteritems")
slmap = li_std_map.StringLengthNumberMap()
li_std_map.populate(slmap)
-keys = " ".join([k for k in slmap.keys()])
+keys = " ".join([k for k in list(slmap.keys())])
if keys != "a aa zzz xxxx aaaaa":
raise RuntimeError("Keys are wrong or in wrong order: " + keys)
-values = " ".join([str(v) for v in slmap.values()])
+values = " ".join([str(v) for v in list(slmap.values())])
if values != "1 2 3 4 5":
raise RuntimeError("Values are wrong or in wrong order: " + values)
diff --git a/Examples/test-suite/python/li_std_pair_runme.py b/Examples/test-suite/python/li_std_pair_runme.py
new file mode 100644
index 000000000..4150e5cc8
--- /dev/null
+++ b/Examples/test-suite/python/li_std_pair_runme.py
@@ -0,0 +1,47 @@
+from li_std_pair import *
+
+def check(flag):
+ if not flag:
+ raise RuntimeError("Check failed")
+
+intPair = makeIntPair(7, 6)
+check(isinstance(intPair, tuple))
+check(len(intPair) == 2)
+check(intPair[0] == 7)
+check(intPair[1] == 6)
+
+intPairConstRef = makeIntPairConstRef(7, 6)
+check(isinstance(intPairConstRef, tuple))
+check(intPairConstRef[0] == 7)
+check(intPairConstRef[1] == 6)
+
+#
+# Each of these should return a reference to a wrapped
+# std::pair object (i.e. an IntPair instance).
+#
+intPairPtr = makeIntPairPtr(7, 6)
+check(isinstance(intPairPtr, IntPair))
+check(intPairPtr[0] == 7)
+check(intPairPtr[1] == 6)
+
+intPairRef = makeIntPairRef(7, 6)
+check(isinstance(intPairRef, IntPair))
+check(intPairRef[0] == 7)
+check(intPairRef[1] == 6)
+#
+# Now test various input typemaps. Each of the wrapped C++ functions
+# (product1, product2 and product3) is expecting an argument of a
+# different type (see li_std_pair.i). Typemaps should be in place to
+# convert this tuple into the expected argument type.
+#
+check(product1(intPair) == 42)
+check(product2(intPair) == 42)
+# check(product3(intPair) == 42) # TODO, if desirable to match Ruby wrappers behaviour. Requires equivalent to typemap(in) std::pair* in Lib/ruby/std_pair.i and further fixes to stop recursive calls to swig::asptr which this testcase shows. Plus further changes for any type of sequence type (including other STL containers) to be accepted by all methods taking an STL container to match Ruby behaviour.
+
+#
+# Similarly, each of the input typemaps should know what to do
+# with an IntPair instance.
+#
+check(product1(intPairPtr) == 42)
+check(product2(intPairPtr) == 42)
+check(product3(intPairPtr) == 42)
diff --git a/Examples/test-suite/python/li_std_set_runme.py b/Examples/test-suite/python/li_std_set_runme.py
index 5e5b72442..34a1eb19c 100644
--- a/Examples/test-suite/python/li_std_set_runme.py
+++ b/Examples/test-suite/python/li_std_set_runme.py
@@ -14,11 +14,11 @@ if sum != "abc":
raise RuntimeError
i = s.__iter__()
-if i.next() != "a":
+if next(i) != "a":
raise RuntimeError
-if i.next() != "b":
+if next(i) != "b":
raise RuntimeError
-if i.next() != "c":
+if next(i) != "c":
raise RuntimeError
@@ -26,7 +26,7 @@ b = s.begin()
e = s.end()
sum = ""
while (b != e):
- sum = sum + b.next()
+ sum = sum + next(b)
if sum != "abc":
raise RuntimeError
@@ -34,7 +34,7 @@ b = s.rbegin()
e = s.rend()
sum = ""
while (b != e):
- sum = sum + b.next()
+ sum = sum + next(b)
if sum != "cba":
raise RuntimeError
@@ -47,25 +47,25 @@ si.append(2)
si.append(3)
i = si.__iter__()
-if i.next() != 1:
+if next(i) != 1:
raise RuntimeError
-if i.next() != 2:
+if next(i) != 2:
raise RuntimeError
-if i.next() != 3:
+if next(i) != 3:
raise RuntimeError
if si[0] != 1:
raise RuntimeError
i = s.begin()
-i.next()
+next(i)
s.erase(i)
b = s.begin()
e = s.end()
sum = ""
while (b != e):
- sum = sum + b.next()
+ sum = sum + next(b)
if sum != "ac":
raise RuntimeError
diff --git a/Examples/test-suite/python/li_std_stream_runme.py b/Examples/test-suite/python/li_std_stream_runme.py
index 08c308856..a4526f07b 100644
--- a/Examples/test-suite/python/li_std_stream_runme.py
+++ b/Examples/test-suite/python/li_std_stream_runme.py
@@ -9,5 +9,4 @@ o << a << " " << 2345 << " " << 1.435
if o.str() != "A class 2345 1.435":
- print "\"%s\"" % (o.str(),)
- raise RuntimeError
+ raise RuntimeError("str failed: \"%s\"".format(o.str()))
diff --git a/Examples/test-suite/python/li_std_string_extra_runme.py b/Examples/test-suite/python/li_std_string_extra_runme.py
index 087d92b19..96c64163d 100644
--- a/Examples/test-suite/python/li_std_string_extra_runme.py
+++ b/Examples/test-suite/python/li_std_string_extra_runme.py
@@ -4,17 +4,16 @@ x = "hello"
if li_std_string_extra.test_ccvalue(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_cvalue(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value(x) != x:
- print x, li_std_string_extra.test_value(x)
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping {} {}".format(x, li_std_string_extra.test_value(x)))
if li_std_string_extra.test_const_reference(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
s = li_std_string_extra.string("he")
@@ -23,45 +22,43 @@ s = li_std_string_extra.string("he")
s = s + "llo"
if s != x:
- print s, x
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping {} {}".format(s, x))
if s[1:4] != x[1:4]:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value(s) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_const_reference(s) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
a = li_std_string_extra.A(s)
if li_std_string_extra.test_value(a) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_const_reference(a) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
b = li_std_string_extra.string(" world")
s = a + b
if a + b != "hello world":
- print a + b
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping {}".format(a + b))
if a + " world" != "hello world":
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
# This is expected to fail with -builtin option
# Reverse operators not supported in builtin types
if not li_std_string_extra.is_python_builtin():
if "hello" + b != "hello world":
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
c = "hello" + b
if c.find_last_of("l") != 9:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
s = "hello world"
@@ -69,33 +66,33 @@ b = li_std_string_extra.B("hi")
b.name = li_std_string_extra.string("hello")
if b.name != "hello":
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
b.a = li_std_string_extra.A("hello")
if b.a != "hello":
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value_basic1(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value_basic2(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value_basic3(x) != x:
- raise RuntimeError, "bad string mapping"
+ raise RuntimeError("bad string mapping")
if li_std_string_extra.test_value_basic_overload(x) != x:
- raise RuntimeError, "bad overload string"
+ raise RuntimeError("bad overload string")
if li_std_string_extra.test_value_basic_overload(123) != "int":
- raise RuntimeError, "bad overload int"
+ raise RuntimeError("bad overload int")
try:
li_std_string_extra.test_value_basic_overload([x])
- raise RuntimeError, "should throw TypeError"
+ raise RuntimeError("should throw TypeError")
except TypeError as e:
if str(e).find("Possible C/C++ prototypes are:") == -1:
raise RuntimeError("Incorrect error message text:\n{}".format(e))
@@ -103,7 +100,7 @@ except TypeError as e:
try:
li_std_string_extra.test_value_basic_overload([123])
- raise RuntimeError, "should throw TypeError"
+ raise RuntimeError("should throw TypeError")
except TypeError as e:
if str(e).find("Possible C/C++ prototypes are:") == -1:
raise RuntimeError("Incorrect error message text:\n{}".format(e))
@@ -112,30 +109,30 @@ except TypeError as e:
# Global variables
s = "initial string"
if li_std_string_extra.cvar.GlobalString2 != "global string 2":
- raise RuntimeError, "GlobalString2 test 1"
+ raise RuntimeError("GlobalString2 test 1")
li_std_string_extra.cvar.GlobalString2 = s
if li_std_string_extra.cvar.GlobalString2 != s:
- raise RuntimeError, "GlobalString2 test 2"
+ raise RuntimeError("GlobalString2 test 2")
if li_std_string_extra.cvar.ConstGlobalString != "const global string":
- raise RuntimeError, "ConstGlobalString test"
+ raise RuntimeError("ConstGlobalString test")
# Member variables
myStructure = li_std_string_extra.Structure()
if myStructure.MemberString2 != "member string 2":
- raise RuntimeError, "MemberString2 test 1"
+ raise RuntimeError("MemberString2 test 1")
myStructure.MemberString2 = s
if myStructure.MemberString2 != s:
- raise RuntimeError, "MemberString2 test 2"
+ raise RuntimeError("MemberString2 test 2")
if myStructure.ConstMemberString != "const member string":
- raise RuntimeError, "ConstMemberString test"
+ raise RuntimeError("ConstMemberString test")
if li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2":
- raise RuntimeError, "StaticMemberString2 test 1"
+ raise RuntimeError("StaticMemberString2 test 1")
li_std_string_extra.cvar.Structure_StaticMemberString2 = s
if li_std_string_extra.cvar.Structure_StaticMemberString2 != s:
- raise RuntimeError, "StaticMemberString2 test 2"
+ raise RuntimeError("StaticMemberString2 test 2")
if li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string":
- raise RuntimeError, "ConstStaticMemberString test"
+ raise RuntimeError("ConstStaticMemberString test")
if li_std_string_extra.test_reference_input("hello") != "hello":
diff --git a/Examples/test-suite/python/li_std_vector_enum_runme.py b/Examples/test-suite/python/li_std_vector_enum_runme.py
index 318d1bff6..587f20b37 100644
--- a/Examples/test-suite/python/li_std_vector_enum_runme.py
+++ b/Examples/test-suite/python/li_std_vector_enum_runme.py
@@ -14,7 +14,7 @@ check(ev.nums[2], 30)
it = ev.nums.iterator()
v = it.value()
check(v, 10)
-it.next()
+next(it)
v = it.value()
check(v, 20)
diff --git a/Examples/test-suite/python/li_std_vector_extra_runme.py b/Examples/test-suite/python/li_std_vector_extra_runme.py
index 59e729a27..40444552b 100644
--- a/Examples/test-suite/python/li_std_vector_extra_runme.py
+++ b/Examples/test-suite/python/li_std_vector_extra_runme.py
@@ -23,20 +23,20 @@ bv[2] = bool(4)
bv[3] = bool(0)
if bv[0] != bv[2]:
- raise RuntimeError, "bad std::vector mapping"
+ raise RuntimeError("bad std::vector mapping")
b = B(5)
va = VecA([b, None, b, b])
if va[0].f(1) != 6:
- raise RuntimeError, "bad std::vector mapping"
+ raise RuntimeError("bad std::vector mapping")
if vecAptr(va) != 6:
- raise RuntimeError, "bad std::vector mapping"
+ raise RuntimeError("bad std::vector mapping")
b.val = 7
if va[3].f(1) != 8:
- raise RuntimeError, "bad std::vector mapping"
+ raise RuntimeError("bad std::vector mapping")
ip = PtrInt()
@@ -47,7 +47,7 @@ ArrInt_setitem(ap, 2, 123)
vi = IntPtrVector((ip, ap, None))
if ArrInt_getitem(vi[0], 0) != ArrInt_getitem(vi[1], 2):
- raise RuntimeError, "bad std::vector mapping"
+ raise RuntimeError("bad std::vector mapping")
delete_ArrInt(ap)
@@ -57,42 +57,42 @@ a = halfs([10, 8, 4, 3])
v = IntVector()
v[0:2] = [1, 2]
if v[0] != 1 or v[1] != 2:
- raise RuntimeError, "bad setslice"
+ raise RuntimeError("bad setslice")
if v[0:-1][0] != 1:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
if v[0:-2].size() != 0:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
v[0:1] = [2]
if v[0] != 2:
- raise RuntimeError, "bad setslice"
+ raise RuntimeError("bad setslice")
v[1:] = [3]
if v[1] != 3:
- raise RuntimeError, "bad setslice"
+ raise RuntimeError("bad setslice")
v[2:] = [3]
if v[2] != 3:
- raise RuntimeError, "bad setslice"
+ raise RuntimeError("bad setslice")
if v[0:][0] != v[0]:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
del v[:]
if v.size() != 0:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
del v[:]
if v.size() != 0:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
v = vecStr(["hello ", "world"])
if v[0] != "hello world":
- raise RuntimeError, "bad std::string+std::vector"
+ raise RuntimeError("bad std::string+std::vector")
pv = pyvector([1, "hello", (1, 2)])
diff --git a/Examples/test-suite/python/li_std_wstream_runme.py b/Examples/test-suite/python/li_std_wstream_runme.py
index 045645b61..0ecdddbf8 100644
--- a/Examples/test-suite/python/li_std_wstream_runme.py
+++ b/Examples/test-suite/python/li_std_wstream_runme.py
@@ -5,8 +5,7 @@ a = A()
o = wostringstream()
-o << a << u" " << 2345 << u" " << 1.435 << wends
+o << a << " " << 2345 << " " << 1.435 << wends
if o.str() != "A class 2345 1.435\0":
- print "\"%s\"" % (o.str(),)
- raise RuntimeError
+ raise RuntimeError("str failed: \"%s\"".format(o.str()))
diff --git a/Examples/test-suite/python/li_std_wstring_inherit_runme.py b/Examples/test-suite/python/li_std_wstring_inherit_runme.py
index 558914e7e..bd585890c 100644
--- a/Examples/test-suite/python/li_std_wstring_inherit_runme.py
+++ b/Examples/test-suite/python/li_std_wstring_inherit_runme.py
@@ -1,14 +1,13 @@
import li_std_wstring_inherit
import sys
-x = u"hello"
+x = "hello"
-s = li_std_wstring_inherit.wstring(u"he")
-s = s + u"llo"
+s = li_std_wstring_inherit.wstring("he")
+s = s + "llo"
if s != x:
- print s, x
- raise RuntimeError("bad string mapping")
+ raise RuntimeError("bad string mapping {} {}".format(s, x))
if s[1:4] != x[1:4]:
raise RuntimeError("bad string mapping")
@@ -34,12 +33,12 @@ if not li_std_wstring_inherit.is_python_builtin():
b = li_std_wstring_inherit.B("hi")
-b.name = li_std_wstring_inherit.wstring(u"hello")
+b.name = li_std_wstring_inherit.wstring("hello")
if b.name != "hello":
raise RuntimeError("bad string mapping")
b.a = li_std_wstring_inherit.A("hello")
-if b.a != u"hello":
+if b.a != "hello":
raise RuntimeError("bad string mapping")
diff --git a/Examples/test-suite/python/li_std_wstring_runme.py b/Examples/test-suite/python/li_std_wstring_runme.py
index c6210e2de..ca8dc3184 100644
--- a/Examples/test-suite/python/li_std_wstring_runme.py
+++ b/Examples/test-suite/python/li_std_wstring_runme.py
@@ -5,10 +5,10 @@ def check_equal(a, b):
if a != b:
raise RuntimeError("failed {} {}".format(a, b))
-h = u"h"
+h = "h"
check_equal(li_std_wstring.test_wcvalue(h), h)
-x = u"abc"
+x = "abc"
check_equal(li_std_wstring.test_ccvalue(x), x)
check_equal(li_std_wstring.test_cvalue(x), x)
@@ -54,6 +54,12 @@ check_equal(li_std_wstring.test_value(x), x)
check_equal(li_std_wstring.test_ccvalue(x), "abc")
check_equal(li_std_wstring.test_wchar_overload(x), "abc")
+ts = li_std_wstring.wchar_test_struct()
+ts.wchar_t_member = h
+check_equal(ts.wchar_t_member, h)
+ts.wchar_t_ptr_member = s
+check_equal(ts.wchar_t_ptr_member, s)
+
################### Python specific
# Byte strings only converted in Python 2
@@ -72,7 +78,7 @@ except TypeError:
# Check surrogateescape
if sys.version_info[0:2] > (3, 1):
- x = u"h\udce9llo" # surrogate escaped representation of C char*: "h\xe9llo"
+ x = "h\udce9llo" # surrogate escaped representation of C char*: "h\xe9llo"
if li_std_wstring.non_utf8_c_str() != x:
raise RuntimeError("surrogateescape not working")
if li_std_wstring.size_wstring(x) != 5 and len(x) != 5:
diff --git a/Examples/test-suite/python/minherit_runme.py b/Examples/test-suite/python/minherit_runme.py
index b7e7d019c..8638d2357 100644
--- a/Examples/test-suite/python/minherit_runme.py
+++ b/Examples/test-suite/python/minherit_runme.py
@@ -7,31 +7,31 @@ c = minherit.FooBar()
d = minherit.Spam()
if a.xget() != 1:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if b.yget() != 2:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if c.xget() != 1 or c.yget() != 2 or c.zget() != 3:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if d.xget() != 1 or d.yget() != 2 or d.zget() != 3 or d.wget() != 4:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if minherit.xget(a) != 1:
- raise RuntimeError, "Bad attribute value %d" % (minherit.xget(a))
+ raise RuntimeError("Bad attribute value %d" % (minherit.xget(a)))
if minherit.yget(b) != 2:
- raise RuntimeError, "Bad attribute value %d" % (minherit.yget(b))
+ raise RuntimeError("Bad attribute value %d" % (minherit.yget(b)))
if minherit.xget(c) != 1 or minherit.yget(c) != 2 or minherit.zget(c) != 3:
- raise RuntimeError, "Bad attribute value %d %d %d" % (
- minherit.xget(c), minherit.yget(c), minherit.zget(c))
+ raise RuntimeError("Bad attribute value %d %d %d" % (
+ minherit.xget(c), minherit.yget(c), minherit.zget(c)))
if minherit.xget(d) != 1 or minherit.yget(d) != 2 or minherit.zget(d) != 3 or minherit.wget(d) != 4:
- raise RuntimeError, "Bad attribute value %d %d %d %d" % (
- minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d))
+ raise RuntimeError("Bad attribute value %d %d %d %d" % (
+ minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d)))
# Cleanse all of the pointers and see what happens
@@ -41,27 +41,27 @@ cc = minherit.toFooBarPtr(c)
dd = minherit.toSpamPtr(d)
if aa.xget() != 1:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if bb.yget() != 2:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if cc.xget() != 1 or cc.yget() != 2 or cc.zget() != 3:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if dd.xget() != 1 or dd.yget() != 2 or dd.zget() != 3 or dd.wget() != 4:
- raise RuntimeError, "Bad attribute value"
+ raise RuntimeError("Bad attribute value")
if minherit.xget(aa) != 1:
- raise RuntimeError, "Bad attribute value %d" % (minherit.xget(aa))
+ raise RuntimeError("Bad attribute value %d" % (minherit.xget(aa)))
if minherit.yget(bb) != 2:
- raise RuntimeError, "Bad attribute value %d" % (minherit.yget(bb))
+ raise RuntimeError("Bad attribute value %d" % (minherit.yget(bb)))
if minherit.xget(cc) != 1 or minherit.yget(cc) != 2 or minherit.zget(cc) != 3:
- raise RuntimeError, "Bad attribute value %d %d %d" % (
- minherit.xget(cc), minherit.yget(cc), minherit.zget(cc))
+ raise RuntimeError("Bad attribute value %d %d %d" % (
+ minherit.xget(cc), minherit.yget(cc), minherit.zget(cc)))
if minherit.xget(dd) != 1 or minherit.yget(dd) != 2 or minherit.zget(dd) != 3 or minherit.wget(dd) != 4:
- raise RuntimeError, "Bad attribute value %d %d %d %d" % (
- minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd))
+ raise RuntimeError("Bad attribute value %d %d %d %d" % (
+ minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd)))
diff --git a/Examples/test-suite/python/namespace_class_runme.py b/Examples/test-suite/python/namespace_class_runme.py
index aa5165562..9349f2430 100644
--- a/Examples/test-suite/python/namespace_class_runme.py
+++ b/Examples/test-suite/python/namespace_class_runme.py
@@ -7,7 +7,7 @@ except:
error = 0
if (error):
- raise RuntimeError, "Private1 is private"
+ raise RuntimeError("Private1 is private")
try:
p = Private2()
@@ -16,7 +16,7 @@ except:
error = 0
if (error):
- raise RuntimeError, "Private2 is private"
+ raise RuntimeError("Private2 is private")
EulerT3D.toFrame(1, 1, 1)
diff --git a/Examples/test-suite/python/not_c_keywords_runme.py b/Examples/test-suite/python/not_c_keywords_runme.py
new file mode 100644
index 000000000..7f0772407
--- /dev/null
+++ b/Examples/test-suite/python/not_c_keywords_runme.py
@@ -0,0 +1,7 @@
+from not_c_keywords import *
+
+cs = ComplexStruct()
+cs.init()
+if cs.complex != 123:
+ raise RuntimeError("complex not correct")
+cs.complex = 456
diff --git a/Examples/test-suite/python/overload_complicated_runme.py b/Examples/test-suite/python/overload_complicated_runme.py
index 2593c4f16..8794da12b 100644
--- a/Examples/test-suite/python/overload_complicated_runme.py
+++ b/Examples/test-suite/python/overload_complicated_runme.py
@@ -10,38 +10,38 @@ p = Pop(pInt, False)
# Check overloaded in const only and pointers/references which target
# languages cannot disambiguate
if p.hip(False) != 701:
- raise RuntimeError, "Test 1 failed"
+ raise RuntimeError("Test 1 failed")
if p.hip(pInt) != 702:
- raise RuntimeError, "Test 2 failed"
+ raise RuntimeError("Test 2 failed")
# Reverse the order for the above
if p.hop(pInt) != 805:
- raise RuntimeError, "Test 3 failed"
+ raise RuntimeError("Test 3 failed")
if p.hop(False) != 801:
- raise RuntimeError, "Test 4 failed"
+ raise RuntimeError("Test 4 failed")
# Few more variations and order shuffled
if p.pop(False) != 901:
- raise RuntimeError, "Test 5 failed"
+ raise RuntimeError("Test 5 failed")
if p.pop(pInt) != 904:
- raise RuntimeError, "Test 6 failed"
+ raise RuntimeError("Test 6 failed")
if p.pop() != 905:
- raise RuntimeError, "Test 7 failed"
+ raise RuntimeError("Test 7 failed")
# Overload on const only
if p.bop(pInt) != 1001:
- raise RuntimeError, "Test 8 failed"
+ raise RuntimeError("Test 8 failed")
if p.bip(pInt) != 2002:
- raise RuntimeError, "Test 9 failed"
+ raise RuntimeError("Test 9 failed")
# Globals
if muzak(False) != 3001:
- raise RuntimeError, "Test 10 failed"
+ raise RuntimeError("Test 10 failed")
if muzak(pInt) != 3002:
- raise RuntimeError, "Test 11 failed"
+ raise RuntimeError("Test 11 failed")
diff --git a/Examples/test-suite/python/overload_simple_runme.py b/Examples/test-suite/python/overload_simple_runme.py
index 6d72ec081..8ad813b86 100644
--- a/Examples/test-suite/python/overload_simple_runme.py
+++ b/Examples/test-suite/python/overload_simple_runme.py
@@ -1,95 +1,95 @@
from overload_simple import *
if foo(3) != "foo:int":
- raise RuntimeError, "foo(int)"
+ raise RuntimeError("foo(int)")
if foo(3.0) != "foo:double":
- raise RuntimeError, "foo(double)"
+ raise RuntimeError("foo(double)")
if foo("hello") != "foo:char *":
- raise RuntimeError, "foo(char *)"
+ raise RuntimeError("foo(char *)")
f = Foo()
b = Bar()
if foo(f) != "foo:Foo *":
- raise RuntimeError, "foo(Foo *)"
+ raise RuntimeError("foo(Foo *)")
if foo(b) != "foo:Bar *":
- raise RuntimeError, "foo(Bar *)"
+ raise RuntimeError("foo(Bar *)")
v = malloc_void(32)
if foo(v) != "foo:void *":
- raise RuntimeError, "foo(void *)"
+ raise RuntimeError("foo(void *)")
s = Spam()
if s.foo(3) != "foo:int":
- raise RuntimeError, "Spam::foo(int)"
+ raise RuntimeError("Spam::foo(int)")
if s.foo(3.0) != "foo:double":
- raise RuntimeError, "Spam::foo(double)"
+ raise RuntimeError("Spam::foo(double)")
if s.foo("hello") != "foo:char *":
- raise RuntimeError, "Spam::foo(char *)"
+ raise RuntimeError("Spam::foo(char *)")
if s.foo(f) != "foo:Foo *":
- raise RuntimeError, "Spam::foo(Foo *)"
+ raise RuntimeError("Spam::foo(Foo *)")
if s.foo(b) != "foo:Bar *":
- raise RuntimeError, "Spam::foo(Bar *)"
+ raise RuntimeError("Spam::foo(Bar *)")
if s.foo(v) != "foo:void *":
- raise RuntimeError, "Spam::foo(void *)"
+ raise RuntimeError("Spam::foo(void *)")
if Spam_bar(3) != "bar:int":
- raise RuntimeError, "Spam::bar(int)"
+ raise RuntimeError("Spam::bar(int)")
if Spam_bar(3.0) != "bar:double":
- raise RuntimeError, "Spam::bar(double)"
+ raise RuntimeError("Spam::bar(double)")
if Spam_bar("hello") != "bar:char *":
- raise RuntimeError, "Spam::bar(char *)"
+ raise RuntimeError("Spam::bar(char *)")
if Spam_bar(f) != "bar:Foo *":
- raise RuntimeError, "Spam::bar(Foo *)"
+ raise RuntimeError("Spam::bar(Foo *)")
if Spam_bar(b) != "bar:Bar *":
- raise RuntimeError, "Spam::bar(Bar *)"
+ raise RuntimeError("Spam::bar(Bar *)")
if Spam_bar(v) != "bar:void *":
- raise RuntimeError, "Spam::bar(void *)"
+ raise RuntimeError("Spam::bar(void *)")
# Test constructors
s = Spam()
if s.type != "none":
- raise RuntimeError, "Spam()"
+ raise RuntimeError("Spam()")
s = Spam(3)
if s.type != "int":
- raise RuntimeError, "Spam(int)"
+ raise RuntimeError("Spam(int)")
s = Spam(3.4)
if s.type != "double":
- raise RuntimeError, "Spam(double)"
+ raise RuntimeError("Spam(double)")
s = Spam("hello")
if s.type != "char *":
- raise RuntimeError, "Spam(char *)"
+ raise RuntimeError("Spam(char *)")
s = Spam(f)
if s.type != "Foo *":
- raise RuntimeError, "Spam(Foo *)"
+ raise RuntimeError("Spam(Foo *)")
s = Spam(b)
if s.type != "Bar *":
- raise RuntimeError, "Spam(Bar *)"
+ raise RuntimeError("Spam(Bar *)")
s = Spam(v)
if s.type != "void *":
- raise RuntimeError, "Spam(void *)"
+ raise RuntimeError("Spam(void *)")
free_void(v)
diff --git a/Examples/test-suite/python/overload_subtype_runme.py b/Examples/test-suite/python/overload_subtype_runme.py
index 3f32a5583..b02e62ff3 100644
--- a/Examples/test-suite/python/overload_subtype_runme.py
+++ b/Examples/test-suite/python/overload_subtype_runme.py
@@ -4,7 +4,7 @@ f = Foo()
b = Bar()
if spam(f) != 1:
- raise RuntimeError, "foo"
+ raise RuntimeError("foo")
if spam(b) != 2:
- raise RuntimeError, "bar"
+ raise RuntimeError("bar")
diff --git a/Examples/test-suite/python/overload_template_fast_runme.py b/Examples/test-suite/python/overload_template_fast_runme.py
index ca3cac9b5..e4eb33288 100644
--- a/Examples/test-suite/python/overload_template_fast_runme.py
+++ b/Examples/test-suite/python/overload_template_fast_runme.py
@@ -7,74 +7,74 @@ b = maximum(3.4, 5.2)
# mix 1
if (mix1("hi") != 101):
- raise RuntimeError, ("mix1(const char*)")
+ raise RuntimeError(("mix1(const char*)"))
if (mix1(1.0, 1.0) != 102):
- raise RuntimeError, ("mix1(double, const double &)")
+ raise RuntimeError(("mix1(double, const double &)"))
if (mix1(1.0) != 103):
- raise RuntimeError, ("mix1(double)")
+ raise RuntimeError(("mix1(double)"))
# mix 2
if (mix2("hi") != 101):
- raise RuntimeError, ("mix2(const char*)")
+ raise RuntimeError(("mix2(const char*)"))
if (mix2(1.0, 1.0) != 102):
- raise RuntimeError, ("mix2(double, const double &)")
+ raise RuntimeError(("mix2(double, const double &)"))
if (mix2(1.0) != 103):
- raise RuntimeError, ("mix2(double)")
+ raise RuntimeError(("mix2(double)"))
# mix 3
if (mix3("hi") != 101):
- raise RuntimeError, ("mix3(const char*)")
+ raise RuntimeError(("mix3(const char*)"))
if (mix3(1.0, 1.0) != 102):
- raise RuntimeError, ("mix3(double, const double &)")
+ raise RuntimeError(("mix3(double, const double &)"))
if (mix3(1.0) != 103):
- raise RuntimeError, ("mix3(double)")
+ raise RuntimeError(("mix3(double)"))
# Combination 1
if (overtparams1(100) != 10):
- raise RuntimeError, ("overtparams1(int)")
+ raise RuntimeError(("overtparams1(int)"))
if (overtparams1(100.0, 100) != 20):
- raise RuntimeError, ("overtparams1(double, int)")
+ raise RuntimeError(("overtparams1(double, int)"))
# Combination 2
if (overtparams2(100.0, 100) != 40):
- raise RuntimeError, ("overtparams2(double, int)")
+ raise RuntimeError(("overtparams2(double, int)"))
# Combination 3
if (overloaded() != 60):
- raise RuntimeError, ("overloaded()")
+ raise RuntimeError(("overloaded()"))
if (overloaded(100.0, 100) != 70):
- raise RuntimeError, ("overloaded(double, int)")
+ raise RuntimeError(("overloaded(double, int)"))
# Combination 4
if (overloadedagain("hello") != 80):
- raise RuntimeError, ("overloadedagain(const char *)")
+ raise RuntimeError(("overloadedagain(const char *)"))
if (overloadedagain() != 90):
- raise RuntimeError, ("overloadedagain(double)")
+ raise RuntimeError(("overloadedagain(double)"))
# specializations
if (specialization(10) != 202):
- raise RuntimeError, ("specialization(int)")
+ raise RuntimeError(("specialization(int)"))
if (specialization(10.0) != 203):
- raise RuntimeError, ("specialization(double)")
+ raise RuntimeError(("specialization(double)"))
if (specialization(10, 10) != 204):
- raise RuntimeError, ("specialization(int, int)")
+ raise RuntimeError(("specialization(int, int)"))
if (specialization(10.0, 10.0) != 205):
- raise RuntimeError, ("specialization(double, double)")
+ raise RuntimeError(("specialization(double, double)"))
if (specialization("hi", "hi") != 201):
- raise RuntimeError, ("specialization(const char *, const char *)")
+ raise RuntimeError(("specialization(const char *, const char *)"))
# simple specialization
@@ -84,61 +84,61 @@ xyz_double()
# a bit of everything
if (overload("hi") != 0):
- raise RuntimeError, ("overload()")
+ raise RuntimeError(("overload()"))
if (overload(1) != 10):
- raise RuntimeError, ("overload(int t)")
+ raise RuntimeError(("overload(int t)"))
if (overload(1, 1) != 20):
- raise RuntimeError, ("overload(int t, const int &)")
+ raise RuntimeError(("overload(int t, const int &)"))
if (overload(1, "hello") != 30):
- raise RuntimeError, ("overload(int t, const char *)")
+ raise RuntimeError(("overload(int t, const char *)"))
k = Klass()
if (overload(k) != 10):
- raise RuntimeError, ("overload(Klass t)")
+ raise RuntimeError(("overload(Klass t)"))
if (overload(k, k) != 20):
- raise RuntimeError, ("overload(Klass t, const Klass &)")
+ raise RuntimeError(("overload(Klass t, const Klass &)"))
if (overload(k, "hello") != 30):
- raise RuntimeError, ("overload(Klass t, const char *)")
+ raise RuntimeError(("overload(Klass t, const char *)"))
if (overload(10.0, "hi") != 40):
- raise RuntimeError, ("overload(double t, const char *)")
+ raise RuntimeError(("overload(double t, const char *)"))
if (overload() != 50):
- raise RuntimeError, ("overload(const char *)")
+ raise RuntimeError(("overload(const char *)"))
# everything put in a namespace
if (nsoverload("hi") != 1000):
- raise RuntimeError, ("nsoverload()")
+ raise RuntimeError(("nsoverload()"))
if (nsoverload(1) != 1010):
- raise RuntimeError, ("nsoverload(int t)")
+ raise RuntimeError(("nsoverload(int t)"))
if (nsoverload(1, 1) != 1020):
- raise RuntimeError, ("nsoverload(int t, const int &)")
+ raise RuntimeError(("nsoverload(int t, const int &)"))
if (nsoverload(1, "hello") != 1030):
- raise RuntimeError, ("nsoverload(int t, const char *)")
+ raise RuntimeError(("nsoverload(int t, const char *)"))
if (nsoverload(k) != 1010):
- raise RuntimeError, ("nsoverload(Klass t)")
+ raise RuntimeError(("nsoverload(Klass t)"))
if (nsoverload(k, k) != 1020):
- raise RuntimeError, ("nsoverload(Klass t, const Klass &)")
+ raise RuntimeError(("nsoverload(Klass t, const Klass &)"))
if (nsoverload(k, "hello") != 1030):
- raise RuntimeError, ("nsoverload(Klass t, const char *)")
+ raise RuntimeError(("nsoverload(Klass t, const char *)"))
if (nsoverload(10.0, "hi") != 1040):
- raise RuntimeError, ("nsoverload(double t, const char *)")
+ raise RuntimeError(("nsoverload(double t, const char *)"))
if (nsoverload() != 1050):
- raise RuntimeError, ("nsoverload(const char *)")
+ raise RuntimeError(("nsoverload(const char *)"))
A.foo(1)
diff --git a/Examples/test-suite/python/overload_template_runme.py b/Examples/test-suite/python/overload_template_runme.py
index 014ec71cb..a484d8f0e 100644
--- a/Examples/test-suite/python/overload_template_runme.py
+++ b/Examples/test-suite/python/overload_template_runme.py
@@ -6,74 +6,74 @@ b = maximum(3.4, 5.2)
# mix 1
if (mix1("hi") != 101):
- raise RuntimeError, ("mix1(const char*)")
+ raise RuntimeError(("mix1(const char*)"))
if (mix1(1.0, 1.0) != 102):
- raise RuntimeError, ("mix1(double, const double &)")
+ raise RuntimeError(("mix1(double, const double &)"))
if (mix1(1.0) != 103):
- raise RuntimeError, ("mix1(double)")
+ raise RuntimeError(("mix1(double)"))
# mix 2
if (mix2("hi") != 101):
- raise RuntimeError, ("mix2(const char*)")
+ raise RuntimeError(("mix2(const char*)"))
if (mix2(1.0, 1.0) != 102):
- raise RuntimeError, ("mix2(double, const double &)")
+ raise RuntimeError(("mix2(double, const double &)"))
if (mix2(1.0) != 103):
- raise RuntimeError, ("mix2(double)")
+ raise RuntimeError(("mix2(double)"))
# mix 3
if (mix3("hi") != 101):
- raise RuntimeError, ("mix3(const char*)")
+ raise RuntimeError(("mix3(const char*)"))
if (mix3(1.0, 1.0) != 102):
- raise RuntimeError, ("mix3(double, const double &)")
+ raise RuntimeError(("mix3(double, const double &)"))
if (mix3(1.0) != 103):
- raise RuntimeError, ("mix3(double)")
+ raise RuntimeError(("mix3(double)"))
# Combination 1
if (overtparams1(100) != 10):
- raise RuntimeError, ("overtparams1(int)")
+ raise RuntimeError(("overtparams1(int)"))
if (overtparams1(100.0, 100) != 20):
- raise RuntimeError, ("overtparams1(double, int)")
+ raise RuntimeError(("overtparams1(double, int)"))
# Combination 2
if (overtparams2(100.0, 100) != 40):
- raise RuntimeError, ("overtparams2(double, int)")
+ raise RuntimeError(("overtparams2(double, int)"))
# Combination 3
if (overloaded() != 60):
- raise RuntimeError, ("overloaded()")
+ raise RuntimeError(("overloaded()"))
if (overloaded(100.0, 100) != 70):
- raise RuntimeError, ("overloaded(double, int)")
+ raise RuntimeError(("overloaded(double, int)"))
# Combination 4
if (overloadedagain("hello") != 80):
- raise RuntimeError, ("overloadedagain(const char *)")
+ raise RuntimeError(("overloadedagain(const char *)"))
if (overloadedagain() != 90):
- raise RuntimeError, ("overloadedagain(double)")
+ raise RuntimeError(("overloadedagain(double)"))
# specializations
if (specialization(10) != 202):
- raise RuntimeError, ("specialization(int)")
+ raise RuntimeError(("specialization(int)"))
if (specialization(10.0) != 203):
- raise RuntimeError, ("specialization(double)")
+ raise RuntimeError(("specialization(double)"))
if (specialization(10, 10) != 204):
- raise RuntimeError, ("specialization(int, int)")
+ raise RuntimeError(("specialization(int, int)"))
if (specialization(10.0, 10.0) != 205):
- raise RuntimeError, ("specialization(double, double)")
+ raise RuntimeError(("specialization(double, double)"))
if (specialization("hi", "hi") != 201):
- raise RuntimeError, ("specialization(const char *, const char *)")
+ raise RuntimeError(("specialization(const char *, const char *)"))
# simple specialization
@@ -83,61 +83,61 @@ xyz_double()
# a bit of everything
if (overload("hi") != 0):
- raise RuntimeError, ("overload()")
+ raise RuntimeError(("overload()"))
if (overload(1) != 10):
- raise RuntimeError, ("overload(int t)")
+ raise RuntimeError(("overload(int t)"))
if (overload(1, 1) != 20):
- raise RuntimeError, ("overload(int t, const int &)")
+ raise RuntimeError(("overload(int t, const int &)"))
if (overload(1, "hello") != 30):
- raise RuntimeError, ("overload(int t, const char *)")
+ raise RuntimeError(("overload(int t, const char *)"))
k = Klass()
if (overload(k) != 10):
- raise RuntimeError, ("overload(Klass t)")
+ raise RuntimeError(("overload(Klass t)"))
if (overload(k, k) != 20):
- raise RuntimeError, ("overload(Klass t, const Klass &)")
+ raise RuntimeError(("overload(Klass t, const Klass &)"))
if (overload(k, "hello") != 30):
- raise RuntimeError, ("overload(Klass t, const char *)")
+ raise RuntimeError(("overload(Klass t, const char *)"))
if (overload(10.0, "hi") != 40):
- raise RuntimeError, ("overload(double t, const char *)")
+ raise RuntimeError(("overload(double t, const char *)"))
if (overload() != 50):
- raise RuntimeError, ("overload(const char *)")
+ raise RuntimeError(("overload(const char *)"))
# everything put in a namespace
if (nsoverload("hi") != 1000):
- raise RuntimeError, ("nsoverload()")
+ raise RuntimeError(("nsoverload()"))
if (nsoverload(1) != 1010):
- raise RuntimeError, ("nsoverload(int t)")
+ raise RuntimeError(("nsoverload(int t)"))
if (nsoverload(1, 1) != 1020):
- raise RuntimeError, ("nsoverload(int t, const int &)")
+ raise RuntimeError(("nsoverload(int t, const int &)"))
if (nsoverload(1, "hello") != 1030):
- raise RuntimeError, ("nsoverload(int t, const char *)")
+ raise RuntimeError(("nsoverload(int t, const char *)"))
if (nsoverload(k) != 1010):
- raise RuntimeError, ("nsoverload(Klass t)")
+ raise RuntimeError(("nsoverload(Klass t)"))
if (nsoverload(k, k) != 1020):
- raise RuntimeError, ("nsoverload(Klass t, const Klass &)")
+ raise RuntimeError(("nsoverload(Klass t, const Klass &)"))
if (nsoverload(k, "hello") != 1030):
- raise RuntimeError, ("nsoverload(Klass t, const char *)")
+ raise RuntimeError(("nsoverload(Klass t, const char *)"))
if (nsoverload(10.0, "hi") != 1040):
- raise RuntimeError, ("nsoverload(double t, const char *)")
+ raise RuntimeError(("nsoverload(double t, const char *)"))
if (nsoverload() != 1050):
- raise RuntimeError, ("nsoverload(const char *)")
+ raise RuntimeError(("nsoverload(const char *)"))
A_foo(1)
diff --git a/Examples/test-suite/python/pointer_reference_runme.py b/Examples/test-suite/python/pointer_reference_runme.py
index b9b47881d..f12648696 100644
--- a/Examples/test-suite/python/pointer_reference_runme.py
+++ b/Examples/test-suite/python/pointer_reference_runme.py
@@ -2,15 +2,15 @@ import pointer_reference
s = pointer_reference.get()
if s.value != 10:
- raise RuntimeError, "get test failed"
+ raise RuntimeError("get test failed")
ss = pointer_reference.Struct(20)
pointer_reference.set(ss)
if pointer_reference.cvar.Struct_instance.value != 20:
- raise RuntimeError, "set test failed"
+ raise RuntimeError("set test failed")
if pointer_reference.overloading(1) != 111:
- raise RuntimeError, "overload test 1 failed"
+ raise RuntimeError("overload test 1 failed")
if pointer_reference.overloading(ss) != 222:
- raise RuntimeError, "overload test 2 failed"
+ raise RuntimeError("overload test 2 failed")
diff --git a/Examples/test-suite/python/primitive_types_runme.py b/Examples/test-suite/python/primitive_types_runme.py
index 04588ddf2..7ed4b52d1 100644
--- a/Examples/test-suite/python/primitive_types_runme.py
+++ b/Examples/test-suite/python/primitive_types_runme.py
@@ -31,8 +31,7 @@ v_check()
def pyerror(name, val, cte):
- print "bad val/cte", name, val, cte
- raise RuntimeError
+ raise RuntimeError("bad val/cte {} {} {}".format(name, val, cte))
pass
if cvar.var_bool != cct_bool:
@@ -173,7 +172,7 @@ p = PyTest()
# internal call check
if t.c_check() != p.c_check():
- raise RuntimeError, "bad director"
+ raise RuntimeError("bad director")
p.var_bool = p.stc_bool
p.var_schar = p.stc_schar
@@ -228,63 +227,57 @@ t.v_check()
# this value contains a '0' char!
if def_namet != "hola":
- print "bad namet", def_namet
- raise RuntimeError
+ raise RuntimeError("bad namet {}".format(def_namet))
t.var_namet = def_namet
if t.var_namet != def_namet:
- print "bad namet", t.var_namet, def_namet
- raise RuntimeError
+ raise RuntimeError("bad namet {} {}".format(t.var_namet, def_namet))
t.var_namet = "hola"
if t.var_namet != "hola":
- print "bad namet", t.var_namet
- raise RuntimeError
+ raise RuntimeError("bad namet {}".format(t.var_namet))
t.var_namet = "hol"
if t.var_namet != "hol":
# if t.var_namet != "hol\0\0":
- print "bad namet", t.var_namet
- raise RuntimeError
+ raise RuntimeError("bad namet {}".format(t.var_namet))
cvar.var_char = "\0"
if cvar.var_char != "\0":
- raise RuntimeError, "bad char '0' case"
+ raise RuntimeError("bad char '0' case")
cvar.var_char = 0
if cvar.var_char != "\0":
- raise RuntimeError, "bad char '0' case"
+ raise RuntimeError("bad char '0' case")
cvar.var_namet = "\0"
# if cvar.var_namet != "\0\0\0\0\0":
if cvar.var_namet != "":
- print "hola", "", cvar.var_namet
- raise RuntimeError, "bad char '\0' case"
+ raise RuntimeError("bad char '\0' case hola {}".format(cvar.var_namet))
cvar.var_namet = ""
# if cvar.var_namet != "\0\0\0\0\0":
if cvar.var_namet != "":
- raise RuntimeError, "bad char empty case"
+ raise RuntimeError("bad char empty case")
cvar.var_pchar = None
if cvar.var_pchar != None:
- raise RuntimeError, "bad None case"
+ raise RuntimeError("bad None case")
cvar.var_pchar = ""
if cvar.var_pchar != "":
- print "%c" % (cvar.var_pchar[0],)
- raise RuntimeError, "bad char empty case"
+ raise RuntimeError("bad char empty case %c" % (cvar.var_pchar[0],))
cvar.var_pcharc = None
if cvar.var_pcharc != None:
- raise RuntimeError, "bad None case"
+ raise RuntimeError("bad None case")
cvar.var_pcharc = ""
if cvar.var_pcharc != "":
- raise RuntimeError, "bad char empty case"
+ raise RuntimeError("bad char empty case")
#
@@ -300,13 +293,12 @@ pchar_setitem(pc, 4, 0)
cvar.var_pchar = pc
if cvar.var_pchar != "hola":
- print cvar.var_pchar
- raise RuntimeError, "bad pointer case"
+ raise RuntimeError("bad pointer case {}".format(cvar.var_pchar))
cvar.var_namet = pc
# if cvar.var_namet != "hola\0":
if cvar.var_namet != "hola":
- raise RuntimeError, "bad pointer case"
+ raise RuntimeError("bad pointer case")
delete_pchar(pc)
@@ -325,7 +317,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad uchar typemap"
+ raise RuntimeError("bad uchar typemap")
try:
@@ -338,7 +330,7 @@ except TypeError:
error = 1
pass
if error:
- raise RuntimeError, "bad char typemap"
+ raise RuntimeError("bad char typemap")
try:
error = 0
@@ -350,7 +342,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad ushort typemap"
+ raise RuntimeError("bad ushort typemap")
try:
error = 0
@@ -362,7 +354,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad uint typemap"
+ raise RuntimeError("bad uint typemap")
try:
error = 0
@@ -374,7 +366,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad sizet typemap"
+ raise RuntimeError("bad sizet typemap")
try:
error = 0
@@ -386,7 +378,7 @@ except OverflowError:
error = 1
pass
if error:
- raise RuntimeError, "bad ulong typemap"
+ raise RuntimeError("bad ulong typemap")
#
#
@@ -400,43 +392,43 @@ except TypeError:
error = 1
pass
if error:
- raise RuntimeError, "bad namet typemap"
+ raise RuntimeError("bad namet typemap")
#
#
#
t2 = p.vtest(t)
if t.var_namet != t2.var_namet:
- raise RuntimeError, "bad SWIGTYPE* typemap"
+ raise RuntimeError("bad SWIGTYPE* typemap")
if cvar.fixsize != "ho\0la\0\0\0":
- raise RuntimeError, "bad FIXSIZE typemap"
+ raise RuntimeError("bad FIXSIZE typemap")
cvar.fixsize = "ho"
if cvar.fixsize != "ho\0\0\0\0\0\0":
- raise RuntimeError, "bad FIXSIZE typemap"
+ raise RuntimeError("bad FIXSIZE typemap")
f = Foo(3)
f1 = fptr_val(f)
f2 = fptr_ref(f)
if f1._a != f2._a:
- raise RuntimeError, "bad const ptr& typemap"
+ raise RuntimeError("bad const ptr& typemap")
v = char_foo(1, 3)
if v != 3:
- raise RuntimeError, "bad int typemap"
+ raise RuntimeError("bad int typemap")
s = char_foo(1, "hello")
if s != "hello":
- raise RuntimeError, "bad char* typemap"
+ raise RuntimeError("bad char* typemap")
v = SetPos(1, 3)
if v != 4:
- raise RuntimeError, "bad int typemap"
+ raise RuntimeError("bad int typemap")
#
# Check the bounds for converting various types
@@ -481,7 +473,7 @@ maxullong = 2 * maxllong + 1
# Make sure Python 2's sys.maxint is the same as the maxlong we calculated
if sys.version_info[0] <= 2 and maxlong != sys.maxint:
- raise RuntimeError, "sys.maxint is not the maximum value of a signed long"
+ raise RuntimeError("sys.maxint is not the maximum value of a signed long")
def checkType(t, e, val, delta):
"""t = Test object, e = type name (e.g. ulong), val = max or min allowed value, delta = +1 for max, -1 for min"""
@@ -511,7 +503,7 @@ def checkType(t, e, val, delta):
except OverflowError:
pass
if error:
- raise RuntimeError, "bad " + e + " typemap"
+ raise RuntimeError("bad " + e + " typemap")
def checkFull(t, e, maxval, minval):
"""Check the maximum and minimum bounds for the type given by e"""
@@ -543,17 +535,17 @@ def checkOverload(t, name, val, delta, prevval, limit):
if val != prevval:
# Make sure the most extreme value of this type gives the name of this type
if t.ovr_str(val) != name:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
# Make sure a more extreme value doesn't give the name of this type
try:
if t.ovr_str(val + delta) == name:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
if val == limit:
# Should raise TypeError here since this is the largest integral type
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
except TypeError:
if val != limit:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
# Check that overloading works: uchar > schar > ushort > short > uint > int > ulong > long > ullong > llong
checkOverload(t, "uchar", maxuchar, +1, 0, maxullong)
@@ -568,22 +560,22 @@ checkOverload(t, "long", minlong, -1, minint, minllong)
checkOverload(t, "llong", minllong, -1, minlong, minllong)
# Make sure that large ints can be converted to doubles properly
-if val_double(sys.maxint + 1) != float(sys.maxint + 1):
- raise RuntimeError, "bad double typemap"
-if val_double(-sys.maxint - 2) != float(-sys.maxint - 2):
- raise RuntimeError, "bad double typemap"
+if val_double(sys.maxsize + 1) != float(sys.maxsize + 1):
+ raise RuntimeError("bad double typemap")
+if val_double(-sys.maxsize - 2) != float(-sys.maxsize - 2):
+ raise RuntimeError("bad double typemap")
# Check the minimum and maximum values that fit in ptrdiff_t and size_t
def checkType(name, maxfunc, maxval, minfunc, minval, echofunc):
if maxfunc() != maxval:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
if minfunc() != minval:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
if echofunc(maxval) != maxval:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
if echofunc(minval) != minval:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
error = 0
try:
echofunc(maxval + 1)
@@ -591,14 +583,14 @@ def checkType(name, maxfunc, maxval, minfunc, minval, echofunc):
except OverflowError:
pass
if error == 1:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
try:
echofunc(minval - 1)
error = 1
except OverflowError:
pass
if error == 1:
- raise RuntimeError, "bad " + name + " typemap"
+ raise RuntimeError("bad " + name + " typemap")
# sys.maxsize is the largest value supported by Py_ssize_t, which should be the same as ptrdiff_t
if sys.version_info[0:2] >= (2, 6):
diff --git a/Examples/test-suite/python/python_abstractbase_runme3.py b/Examples/test-suite/python/python_abstractbase_runme.py
similarity index 100%
rename from Examples/test-suite/python/python_abstractbase_runme3.py
rename to Examples/test-suite/python/python_abstractbase_runme.py
diff --git a/Examples/test-suite/python/python_append_runme.py b/Examples/test-suite/python/python_append_runme.py
index eddda53ff..e5f6b07cf 100644
--- a/Examples/test-suite/python/python_append_runme.py
+++ b/Examples/test-suite/python/python_append_runme.py
@@ -21,3 +21,16 @@ if grabstaticpath() != None:
Test.static_func()
if grabstaticpath() != os.path.basename(mypath):
raise RuntimeError("grabstaticpath failed")
+
+# slots test
+fs = ForSlots()
+if fs.ValidVariable != 99:
+ raise RuntimeError("ValidVariable failed")
+fs.ValidVariable = 11
+if fs.ValidVariable != 11:
+ raise RuntimeError("ValidVariable failed")
+try:
+ fs.Invalid = 22
+ raise RuntimeError("It should not be possible to set a random variable name")
+except AttributeError:
+ pass
diff --git a/Examples/test-suite/python/python_builtin_runme.py b/Examples/test-suite/python/python_builtin_runme.py
index 26e757ca7..8a42a2607 100644
--- a/Examples/test-suite/python/python_builtin_runme.py
+++ b/Examples/test-suite/python/python_builtin_runme.py
@@ -32,7 +32,7 @@ if is_python_builtin():
passed = False
try:
h = hash(ExceptionHashFunction())
- except RuntimeError, e:
+ except RuntimeError as e:
passed = str(e).find("oops") != -1
pass
diff --git a/Examples/test-suite/python/python_destructor_exception_runme.py b/Examples/test-suite/python/python_destructor_exception_runme.py
index ee71ab33b..47659531b 100644
--- a/Examples/test-suite/python/python_destructor_exception_runme.py
+++ b/Examples/test-suite/python/python_destructor_exception_runme.py
@@ -1,7 +1,11 @@
import python_destructor_exception
-from StringIO import StringIO
import sys
+if sys.version_info[0:2] < (3, 0):
+ import StringIO as io
+else:
+ import io
+
def error_function():
python_destructor_exception.ClassWithThrowingDestructor().GetBlah()
@@ -9,13 +13,13 @@ def runtest():
attributeErrorOccurred = False
try:
error_function()
- except AttributeError, e:
+ except AttributeError:
attributeErrorOccurred = True
return attributeErrorOccurred
def test1():
stderr_saved = sys.stderr
- buffer = StringIO()
+ buffer = io.StringIO()
attributeErrorOccurred = False
try:
# Suppress stderr while making this call to suppress the output shown by PyErr_WriteUnraisable
diff --git a/Examples/test-suite/python/python_nondynamic_runme.py b/Examples/test-suite/python/python_nondynamic_runme.py
index fbb60ad36..524f4d1c4 100644
--- a/Examples/test-suite/python/python_nondynamic_runme.py
+++ b/Examples/test-suite/python/python_nondynamic_runme.py
@@ -51,9 +51,7 @@ if python_nondynamic.retrieve_A_b(bb) != 5: raise RuntimeError("b not set correc
try:
bb.c = 3
- print("bb.c = {}".format(bb.c))
- print("B.c = {}".format(B.c))
- raise RuntimeError("B.c class variable messes up nondynamic-ness of B")
+ raise RuntimeError("B.c class variable messes up nondynamic-ness of B bb.c={} B.c={}".format(bb.c, B.c))
except AttributeError as e:
debug_print(e)
pass
@@ -99,9 +97,7 @@ if is_python_modern() and not python_nondynamic.is_python_builtin():
if not python_nondynamic.is_python_builtin():
try:
bb.cc = 3
- print("bb.cc = {}".format(bb.cc))
- print("B.cc = {}".format(B.cc))
- raise RuntimeError("B.cc class variable messes up nondynamic-ness of B")
+ raise RuntimeError("B.cc class variable messes up nondynamic-ness of B bb.cc={} B.cc={}".format(bb.cc, B.cc))
except AttributeError as e:
debug_print(e)
pass
diff --git a/Examples/test-suite/python/python_overload_simple_cast_runme.py b/Examples/test-suite/python/python_overload_simple_cast_runme.py
index d4cb8a37a..fc398ab29 100644
--- a/Examples/test-suite/python/python_overload_simple_cast_runme.py
+++ b/Examples/test-suite/python/python_overload_simple_cast_runme.py
@@ -30,136 +30,136 @@ except:
good = 1
if not good:
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fint(ad) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fdouble(ad) != "fdouble:double":
- raise RuntimeError, "fdouble(double)"
+ raise RuntimeError("fdouble(double)")
if fint(ai) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fint(5.0) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fint(3) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fint(3.0) != "fint:int":
- raise RuntimeError, "fint(int)"
+ raise RuntimeError("fint(int)")
if fdouble(ad) != "fdouble:double":
- raise RuntimeError, "fdouble(double)"
+ raise RuntimeError("fdouble(double)")
if fdouble(3) != "fdouble:double":
- raise RuntimeError, "fdouble(double)"
+ raise RuntimeError("fdouble(double)")
if fdouble(3.0) != "fdouble:double":
- raise RuntimeError, "fdouble(double)"
+ raise RuntimeError("fdouble(double)")
if fid(3, 3.0) != "fid:intdouble":
- raise RuntimeError, "fid:intdouble"
+ raise RuntimeError("fid:intdouble")
if fid(3.0, 3) != "fid:doubleint":
- raise RuntimeError, "fid:doubleint"
+ raise RuntimeError("fid:doubleint")
if fid(ad, ai) != "fid:doubleint":
- raise RuntimeError, "fid:doubleint"
+ raise RuntimeError("fid:doubleint")
if fid(ai, ad) != "fid:intdouble":
- raise RuntimeError, "fid:intdouble"
+ raise RuntimeError("fid:intdouble")
if foo(3) != "foo:int":
- raise RuntimeError, "foo(int)"
+ raise RuntimeError("foo(int)")
if foo(3.0) != "foo:double":
- raise RuntimeError, "foo(double)"
+ raise RuntimeError("foo(double)")
if foo("hello") != "foo:char *":
- raise RuntimeError, "foo(char *)"
+ raise RuntimeError("foo(char *)")
f = Foo()
b = Bar()
if foo(f) != "foo:Foo *":
- raise RuntimeError, "foo(Foo *)"
+ raise RuntimeError("foo(Foo *)")
if foo(b) != "foo:Bar *":
- raise RuntimeError, "foo(Bar *)"
+ raise RuntimeError("foo(Bar *)")
v = malloc_void(32)
if foo(v) != "foo:void *":
- raise RuntimeError, "foo(void *)"
+ raise RuntimeError("foo(void *)")
s = Spam()
if s.foo(3) != "foo:int":
- raise RuntimeError, "Spam::foo(int)"
+ raise RuntimeError("Spam::foo(int)")
if s.foo(3.0) != "foo:double":
- raise RuntimeError, "Spam::foo(double)"
+ raise RuntimeError("Spam::foo(double)")
if s.foo("hello") != "foo:char *":
- raise RuntimeError, "Spam::foo(char *)"
+ raise RuntimeError("Spam::foo(char *)")
if s.foo(f) != "foo:Foo *":
- raise RuntimeError, "Spam::foo(Foo *)"
+ raise RuntimeError("Spam::foo(Foo *)")
if s.foo(b) != "foo:Bar *":
- raise RuntimeError, "Spam::foo(Bar *)"
+ raise RuntimeError("Spam::foo(Bar *)")
if s.foo(v) != "foo:void *":
- raise RuntimeError, "Spam::foo(void *)"
+ raise RuntimeError("Spam::foo(void *)")
if Spam_bar(3) != "bar:int":
- raise RuntimeError, "Spam::bar(int)"
+ raise RuntimeError("Spam::bar(int)")
if Spam_bar(3.0) != "bar:double":
- raise RuntimeError, "Spam::bar(double)"
+ raise RuntimeError("Spam::bar(double)")
if Spam_bar("hello") != "bar:char *":
- raise RuntimeError, "Spam::bar(char *)"
+ raise RuntimeError("Spam::bar(char *)")
if Spam_bar(f) != "bar:Foo *":
- raise RuntimeError, "Spam::bar(Foo *)"
+ raise RuntimeError("Spam::bar(Foo *)")
if Spam_bar(b) != "bar:Bar *":
- raise RuntimeError, "Spam::bar(Bar *)"
+ raise RuntimeError("Spam::bar(Bar *)")
if Spam_bar(v) != "bar:void *":
- raise RuntimeError, "Spam::bar(void *)"
+ raise RuntimeError("Spam::bar(void *)")
# Test constructors
s = Spam()
if s.type != "none":
- raise RuntimeError, "Spam()"
+ raise RuntimeError("Spam()")
s = Spam(3)
if s.type != "int":
- raise RuntimeError, "Spam(int)"
+ raise RuntimeError("Spam(int)")
s = Spam(3.4)
if s.type != "double":
- raise RuntimeError, "Spam(double)"
+ raise RuntimeError("Spam(double)")
s = Spam("hello")
if s.type != "char *":
- raise RuntimeError, "Spam(char *)"
+ raise RuntimeError("Spam(char *)")
s = Spam(f)
if s.type != "Foo *":
- raise RuntimeError, "Spam(Foo *)"
+ raise RuntimeError("Spam(Foo *)")
s = Spam(b)
if s.type != "Bar *":
- raise RuntimeError, "Spam(Bar *)"
+ raise RuntimeError("Spam(Bar *)")
s = Spam(v)
if s.type != "void *":
- raise RuntimeError, "Spam(void *)"
+ raise RuntimeError("Spam(void *)")
# unsigned long long
@@ -168,13 +168,13 @@ ullmaxd = 9007199254740992.0
ullmin = 0
ullmind = 0.0
if ull(ullmin) != ullmin:
- raise RuntimeError, "ull(ullmin)"
+ raise RuntimeError("ull(ullmin)")
if ull(ullmax) != ullmax:
- raise RuntimeError, "ull(ullmax)"
+ raise RuntimeError("ull(ullmax)")
if ull(ullmind) != ullmind:
- raise RuntimeError, "ull(ullmind)"
+ raise RuntimeError("ull(ullmind)")
if ull(ullmaxd) != ullmaxd:
- raise RuntimeError, "ull(ullmaxd)"
+ raise RuntimeError("ull(ullmaxd)")
# long long
llmax = 9223372036854775807 # 0x7fffffffffffffff
@@ -183,13 +183,13 @@ llmin = -9223372036854775808
llmaxd = 9007199254740992.0
llmind = -9007199254740992.0
if ll(llmin) != llmin:
- raise RuntimeError, "ll(llmin)"
+ raise RuntimeError("ll(llmin)")
if ll(llmax) != llmax:
- raise RuntimeError, "ll(llmax)"
+ raise RuntimeError("ll(llmax)")
if ll(llmind) != llmind:
- raise RuntimeError, "ll(llmind)"
+ raise RuntimeError("ll(llmind)")
if ll(llmaxd) != llmaxd:
- raise RuntimeError, "ll(llmaxd)"
+ raise RuntimeError("ll(llmaxd)")
free_void(v)
diff --git a/Examples/test-suite/python/python_pickle_runme.py b/Examples/test-suite/python/python_pickle_runme.py
index 27c67ae10..cbe425fa2 100644
--- a/Examples/test-suite/python/python_pickle_runme.py
+++ b/Examples/test-suite/python/python_pickle_runme.py
@@ -15,15 +15,15 @@ check(p)
r = p.__reduce__()
if python_pickle.cvar.debug:
- print "__reduce__ returned:", r
+ print("__reduce__ returned: {}".format(r))
pickle_string = pickle.dumps(p)
newp = pickle.loads(pickle_string)
check(newp)
# Not yet working... some crash and others are not producing a sensible "can't be pickled" error
#nfp = python_pickle.NotForPickling("no no")
-#print nfp.__reduce__()
+#print("{}".format(nfp.__reduce__()))
#pickle_string = pickle.dumps(nfp)
-#print pickle_string
+#print("{}".format(pickle_string))
#newp = pickle.loads(pickle_string)
-#print newp.msg
+#print("{}".format(newp.msg))
diff --git a/Examples/test-suite/python/python_pybuffer_runme.py b/Examples/test-suite/python/python_pybuffer_runme.py
index 8ecdb523b..65079200b 100644
--- a/Examples/test-suite/python/python_pybuffer_runme.py
+++ b/Examples/test-suite/python/python_pybuffer_runme.py
@@ -17,13 +17,13 @@ if len(sys.argv) >= 2 and sys.argv[1] == "benchmark":
a = bytearray(b"hello world")
for i in range(k):
python_pybuffer.title1(a)
- print "Time used by bytearray:", time.time() - t
+ print("Time used by bytearray: {}".format(time.time() - t))
t = time.time()
b = "hello world"
for i in range(k):
python_pybuffer.title2(b)
- print "Time used by string:", time.time() - t
+ print("Time used by string: {}".format(time.time() - t))
else:
# run the test case
buf1 = bytearray(10)
@@ -44,3 +44,27 @@ else:
buf3 = bytearray(b"hello")
python_pybuffer.title1(buf3)
check(buf3 == b"Hello")
+
+ try:
+ python_pybuffer.func1(1)
+ raise RuntimeError("should throw TypeError")
+ except TypeError as e:
+ check("(char *buf1, int len)" in str(e))
+
+ try:
+ python_pybuffer.func2(1)
+ raise RuntimeError("should throw TypeError")
+ except TypeError as e:
+ check("(char *buf2)" in str(e))
+
+ try:
+ python_pybuffer.func3(1)
+ raise RuntimeError("should throw TypeError")
+ except TypeError as e:
+ check("(const char *buf3, int len)" in str(e))
+
+ try:
+ python_pybuffer.func4(1)
+ raise RuntimeError("should throw TypeError")
+ except TypeError as e:
+ check("(const char *buf4)" in str(e))
diff --git a/Examples/test-suite/python/python_richcompare_runme.py b/Examples/test-suite/python/python_richcompare_runme.py
index 724d1d73c..988a3f91f 100644
--- a/Examples/test-suite/python/python_richcompare_runme.py
+++ b/Examples/test-suite/python/python_richcompare_runme.py
@@ -114,22 +114,22 @@ else:
try:
res = base1 < 42
raise RuntimeError("Failed to throw")
- except TypeError,e:
+ except TypeError as e:
check_unorderable_types(e)
try:
res = base1 <= 42
raise RuntimeError("Failed to throw")
- except TypeError,e:
+ except TypeError as e:
check_unorderable_types(e)
try:
res = base1 > 42
raise RuntimeError("Failed to throw")
- except TypeError,e:
+ except TypeError as e:
check_unorderable_types(e)
try:
res = base1 >= 42
raise RuntimeError("Failed to throw")
- except TypeError,e:
+ except TypeError as e:
check_unorderable_types(e)
# Check inequalities used for ordering
diff --git a/Examples/test-suite/python/python_strict_unicode_runme.py b/Examples/test-suite/python/python_strict_unicode_runme.py
index e7fae2556..79c768de1 100644
--- a/Examples/test-suite/python/python_strict_unicode_runme.py
+++ b/Examples/test-suite/python/python_strict_unicode_runme.py
@@ -1,8 +1,20 @@
import python_strict_unicode
+import sys
test_bytes = b"hello \x01world\x99"
BYTES = b"BYTES"
-test_unicode = u"h\udce9llo w\u00f6rld"
+
+if sys.version_info[0:2] < (3, 0):
+ # Python 3.0-3.2 results in a SyntaxError when using u"" string literals, so we use a
+ # convoluted unicode string construction using unicode() and unichr().
+ # Conventional Python 2 syntax shown in comments.
+ test_unicode = unicode("h" + unichr(0xdce9) + "llo w" + unichr(0x00f6) + "rld") # u"h\udce9llo w\u00f6rld"
+ UNICODE = unicode("UNICODE")
+ type_unicode_string = type(UNICODE)
+else:
+ test_unicode = "h\udce9llo w\u00f6rld"
+ UNICODE = "UNICODE"
+ type_unicode_string = type(UNICODE)
# Test that byte string inputs and outputs work as expected
bdbl = python_strict_unicode.double_str(test_bytes)
@@ -20,12 +32,12 @@ if type(bout) != type(BYTES):
udbl = python_strict_unicode.double_wstr(test_unicode)
if udbl != test_unicode + test_unicode:
raise RuntimeError("Failed to double wide string")
-if type(udbl) != type(u""):
+if type(udbl) != type_unicode_string:
raise RuntimeError("Wrong type output for wide string")
uout = python_strict_unicode.same_wstr(test_unicode)
if uout != test_unicode:
raise RuntimeError("Failed to copy wchar_t*")
-if type(uout) != type(u""):
+if type(uout) != type_unicode_string:
raise RuntimeError("Wrong type output for wchar_t*")
# Test that overloading is handled properly
@@ -35,9 +47,9 @@ if bovr != BYTES:
if type(bovr) != type(BYTES):
raise RuntimeError("Wrong type output from overload")
uovr = python_strict_unicode.overload(test_unicode)
-if uovr != u"UNICODE":
+if uovr != UNICODE:
raise RuntimeError("Failed to return unicode from overload")
-if type(uovr) != type(u""):
+if type(uovr) != type_unicode_string:
raise RuntimeERror("Wrong type output from overload")
# Test that bytes aren't accepted as wide strings and unicode isn't accepted as narrow strings
diff --git a/Examples/test-suite/python/return_const_value_runme.py b/Examples/test-suite/python/return_const_value_runme.py
index ff3bd5f02..809eed97a 100644
--- a/Examples/test-suite/python/return_const_value_runme.py
+++ b/Examples/test-suite/python/return_const_value_runme.py
@@ -3,10 +3,8 @@ import sys
p = return_const_value.Foo_ptr_getPtr()
if (p.getVal() != 17):
- print "Runtime test1 failed. p.getVal()=", p.getVal()
- sys.exit(1)
+ raise RuntimeError("Runtime test1 failed. p.getVal()={}".format(p.getVal()))
p = return_const_value.Foo_ptr_getConstPtr()
if (p.getVal() != 17):
- print "Runtime test2 failed. p.getVal()=", p.getVal()
- sys.exit(1)
+ raise RuntimeError("Runtime test2 failed. p.getVal()={}".format(p.getVal()))
diff --git a/Examples/test-suite/python/smart_pointer_member_runme.py b/Examples/test-suite/python/smart_pointer_member_runme.py
index d2ed87e79..9758b0ba4 100644
--- a/Examples/test-suite/python/smart_pointer_member_runme.py
+++ b/Examples/test-suite/python/smart_pointer_member_runme.py
@@ -11,9 +11,7 @@ b = Bar(f)
b.y = 2
if f.y != 2:
- print f.y
- print b.y
- raise RuntimeError
+ raise RuntimeError("Failed {} {}".format(f.y, b.y))
if b.x != f.x:
raise RuntimeError
diff --git a/Examples/test-suite/python/smart_pointer_not_runme.py b/Examples/test-suite/python/smart_pointer_not_runme.py
index 69704c4ef..8cd9f11f3 100644
--- a/Examples/test-suite/python/smart_pointer_not_runme.py
+++ b/Examples/test-suite/python/smart_pointer_not_runme.py
@@ -7,36 +7,36 @@ g = Grok(f)
try:
x = b.x
- print "Error! b.x"
-except:
+ raise RuntimeError("Error! b.x")
+except AttributeError:
pass
try:
x = s.x
- print "Error! s.x"
-except:
+ raise RuntimeError("Error! s.x")
+except AttributeError:
pass
try:
x = g.x
- print "Error! g.x"
-except:
+ raise RuntimeError("Error! g.x")
+except AttributeError:
pass
try:
x = b.getx()
- print "Error! b.getx()"
-except:
+ raise RuntimeError("Error! b.getx()")
+except AttributeError:
pass
try:
x = s.getx()
- print "Error! s.getx()"
-except:
+ raise RuntimeError("Error! s.getx()")
+except AttributeError:
pass
try:
x = g.getx()
- print "Error! g.getx()"
-except:
+ raise RuntimeError("Error! g.getx()")
+except AttributeError:
pass
diff --git a/Examples/test-suite/python/std_containers_runme.py b/Examples/test-suite/python/std_containers_runme.py
index 7404cd5f4..820c8f454 100644
--- a/Examples/test-suite/python/std_containers_runme.py
+++ b/Examples/test-suite/python/std_containers_runme.py
@@ -7,34 +7,33 @@ cube = (((1, 2), (3, 4)), ((5, 6), (7, 8)))
icube = std_containers.cident(cube)
for i in range(0, len(cube)):
if cube[i] != icube[i]:
- raise RuntimeError, "bad cident"
+ raise RuntimeError("bad cident")
p = (1, 2)
if p != std_containers.pident(p):
- raise RuntimeError, "bad pident"
+ raise RuntimeError("bad pident")
v = (1, 2, 3, 4, 5, 6)
iv = std_containers.vident(v)
for i in range(0, len(v)):
if v[i] != iv[i]:
- raise RuntimeError, "bad vident"
+ raise RuntimeError("bad vident")
iv = std_containers.videntu(v)
for i in range(0, len(v)):
if v[i] != iv[i]:
- raise RuntimeError, "bad videntu"
+ raise RuntimeError("bad videntu")
vu = std_containers.vector_ui(v)
if vu[2] != std_containers.videntu(vu)[2]:
- raise RuntimeError, "bad videntu"
+ raise RuntimeError("bad videntu")
if v[0:3][1] != vu[0:3][1]:
- print v[0:3][1], vu[0:3][1]
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice {} {}".format(v[0:3][1], vu[0:3][1]))
m = ((1, 2, 3), (2, 3), (3, 4))
@@ -43,20 +42,20 @@ im = std_containers.midenti(m)
for i in range(0, len(m)):
for j in range(0, len(m[i])):
if m[i][j] != im[i][j]:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
m = ((True, False, True), (True, True), (True, True))
im = std_containers.midentb(m)
for i in range(0, len(m)):
for j in range(0, len(m[i])):
if m[i][j] != im[i][j]:
- raise RuntimeError, "bad getslice"
+ raise RuntimeError("bad getslice")
mi = std_containers.imatrix(m)
mc = std_containers.cmatrix(m)
if mi[0][1] != mc[0][1]:
- raise RuntimeError, "bad matrix"
+ raise RuntimeError("bad matrix")
map = {}
@@ -67,7 +66,7 @@ map["3"] = 2
imap = std_containers.mapident(map)
for k in map:
if map[k] != imap[k]:
- raise RuntimeError, "bad map"
+ raise RuntimeError("bad map")
# Test __contains__ (required for 'x in y' to work)
if not imap.__contains__("hello"):
diff --git a/Examples/test-suite/python/struct_value_runme.py b/Examples/test-suite/python/struct_value_runme.py
index aa3ece38c..9fe5c815c 100644
--- a/Examples/test-suite/python/struct_value_runme.py
+++ b/Examples/test-suite/python/struct_value_runme.py
@@ -17,7 +17,7 @@ b.added = 123
if b.added != 123:
raise RuntimeError("Wrong attribute value")
-if not b.__dict__.has_key("added"):
+if "added" not in b.__dict__:
raise RuntimeError("Missing added attribute in __dict__")
@@ -28,7 +28,7 @@ class PyBar(struct_value.Bar):
struct_value.Bar.__init__(self)
pybar = PyBar()
-if not pybar.__dict__.has_key("extra"):
+if "extra" not in pybar.__dict__:
raise RuntimeError("Missing extra attribute in __dict__")
if pybar.extra != "hi":
raise RuntimeError("Incorrect attribute value for extra")
diff --git a/Examples/test-suite/python/swigobject_runme.py b/Examples/test-suite/python/swigobject_runme.py
index de232f580..e28e187c9 100644
--- a/Examples/test-suite/python/swigobject_runme.py
+++ b/Examples/test-suite/python/swigobject_runme.py
@@ -1,5 +1,5 @@
-
from swigobject import *
+import sys
a = A()
@@ -11,7 +11,11 @@ if a1.this != a2.this:
raise RuntimeError
-lthis = long(a.this)
+if sys.version_info[0:2] < (3, 0):
+ lthis = long(a.this)
+else:
+ lthis = int(a.this)
+
# match pointer value, but deal with leading zeros on 8/16 bit systems and
# different C++ compilers interpretation of %p
xstr1 = "%016X" % (lthis,)
@@ -23,13 +27,17 @@ xstr2 = str.lstrip(xstr2, "0")
xstr2 = str.upper(xstr2)
if xstr1 != xstr2:
- print xstr1, xstr2
- raise RuntimeError
+ raise RuntimeError("Not equal failed {} {}".format(xstr1, xstr2))
s = str(a.this)
r = repr(a.this)
v1 = v_ptr(a)
v2 = v_ptr(a)
-if long(v1) != long(v2):
- raise RuntimeError
+
+if sys.version_info[0:2] < (3, 0):
+ if long(v1) != long(v2):
+ raise RuntimeError
+else:
+ if int(v1) != int(v2):
+ raise RuntimeError
diff --git a/Examples/test-suite/python/template_classes_runme.py b/Examples/test-suite/python/template_classes_runme.py
index 38b2d7a62..1bd133975 100644
--- a/Examples/test-suite/python/template_classes_runme.py
+++ b/Examples/test-suite/python/template_classes_runme.py
@@ -13,7 +13,7 @@ RectangleInt.static_onearg(1)
fail = True
try:
rectangle.setPoint()
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -22,7 +22,7 @@ if fail:
fail = True
try:
rectangle.getPoint(0)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -30,7 +30,7 @@ if fail:
fail = True
try:
RectangleInt.static_noargs(0)
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
@@ -38,7 +38,7 @@ if fail:
fail = True
try:
RectangleInt.static_onearg()
-except TypeError, e:
+except TypeError as e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
diff --git a/Examples/test-suite/python/template_default_arg_runme.py b/Examples/test-suite/python/template_default_arg_runme.py
index 91b1e0e8c..e9ef00f99 100644
--- a/Examples/test-suite/python/template_default_arg_runme.py
+++ b/Examples/test-suite/python/template_default_arg_runme.py
@@ -7,25 +7,25 @@ helloInt.foo(template_default_arg.Hello_int.hi)
x = template_default_arg.X_int()
if (x.meth(20.0, 200) != 200):
- raise RuntimeError, ("X_int test 1 failed")
+ raise RuntimeError(("X_int test 1 failed"))
if (x.meth(20) != 20):
- raise RuntimeError, ("X_int test 2 failed")
+ raise RuntimeError(("X_int test 2 failed"))
if (x.meth() != 0):
- raise RuntimeError, ("X_int test 3 failed")
+ raise RuntimeError(("X_int test 3 failed"))
y = template_default_arg.Y_unsigned()
if (y.meth(20.0, 200) != 200):
- raise RuntimeError, ("Y_unsigned test 1 failed")
+ raise RuntimeError(("Y_unsigned test 1 failed"))
if (y.meth(20) != 20):
- raise RuntimeError, ("Y_unsigned test 2 failed")
+ raise RuntimeError(("Y_unsigned test 2 failed"))
if (y.meth() != 0):
- raise RuntimeError, ("Y_unsigned test 3 failed")
+ raise RuntimeError(("Y_unsigned test 3 failed"))
x = template_default_arg.X_longlong()
x = template_default_arg.X_longlong(20.0)
-x = template_default_arg.X_longlong(20.0, 200L)
+x = template_default_arg.X_longlong(20.0, 200)
x = template_default_arg.X_int()
@@ -54,40 +54,40 @@ fzc = x.meth(fz)
# plain function: int ott(Foo)
if (template_default_arg.ott(template_default_arg.Foo_int()) != 30):
- raise RuntimeError, ("ott test 1 failed")
+ raise RuntimeError(("ott test 1 failed"))
# %template(ott) ott
if (template_default_arg.ott() != 10):
- raise RuntimeError, ("ott test 2 failed")
+ raise RuntimeError(("ott test 2 failed"))
if (template_default_arg.ott(1) != 10):
- raise RuntimeError, ("ott test 3 failed")
+ raise RuntimeError(("ott test 3 failed"))
if (template_default_arg.ott(1, 1) != 10):
- raise RuntimeError, ("ott test 4 failed")
+ raise RuntimeError(("ott test 4 failed"))
if (template_default_arg.ott("hi") != 20):
- raise RuntimeError, ("ott test 5 failed")
+ raise RuntimeError(("ott test 5 failed"))
if (template_default_arg.ott("hi", 1) != 20):
- raise RuntimeError, ("ott test 6 failed")
+ raise RuntimeError(("ott test 6 failed"))
if (template_default_arg.ott("hi", 1, 1) != 20):
- raise RuntimeError, ("ott test 7 failed")
+ raise RuntimeError(("ott test 7 failed"))
# %template(ott) ott
if (template_default_arg.ottstring(template_default_arg.Hello_int(), "hi") != 40):
- raise RuntimeError, ("ott test 8 failed")
+ raise RuntimeError(("ott test 8 failed"))
if (template_default_arg.ottstring(template_default_arg.Hello_int()) != 40):
- raise RuntimeError, ("ott test 9 failed")
+ raise RuntimeError(("ott test 9 failed"))
# %template(ott) ott
if (template_default_arg.ottint(template_default_arg.Hello_int(), 1) != 50):
- raise RuntimeError, ("ott test 10 failed")
+ raise RuntimeError(("ott test 10 failed"))
if (template_default_arg.ottint(template_default_arg.Hello_int()) != 50):
- raise RuntimeError, ("ott test 11 failed")
+ raise RuntimeError(("ott test 11 failed"))
# %template(ott) ott
if (template_default_arg.ott(template_default_arg.Hello_int(), 1.0) != 60):
- raise RuntimeError, ("ott test 12 failed")
+ raise RuntimeError(("ott test 12 failed"))
if (template_default_arg.ott(template_default_arg.Hello_int()) != 60):
- raise RuntimeError, ("ott test 13 failed")
+ raise RuntimeError(("ott test 13 failed"))
diff --git a/Examples/test-suite/python/template_template_parameters_runme.py b/Examples/test-suite/python/template_template_parameters_runme.py
new file mode 100644
index 000000000..4b0e27d9c
--- /dev/null
+++ b/Examples/test-suite/python/template_template_parameters_runme.py
@@ -0,0 +1,30 @@
+from template_template_parameters import *
+
+# Test first part
+listBool = ListFastBool()
+listBool.item = True
+x_boolean = listBool.allotype
+if listBool.item != True:
+ raise RuntimeError("Failed")
+
+listDouble = ListDefaultDouble()
+listDouble.item = 10.2
+x_double = listDouble.allotype
+if listDouble.item != 10.2:
+ raise RuntimeError("Failed")
+
+# Test second part
+floatTestStruct = FloatTestStruct()
+floatContainer2 = floatTestStruct.x
+floatContainer2.x = 8.1
+intTestStruct = IntTestStruct()
+intContainer1 = intTestStruct.x
+intContainer1.x = 91
+if intContainer1.x != 91:
+ raise RuntimeError("Failed")
+if intTestStruct.x.x != 91:
+ raise RuntimeError("Failed")
+intTestStructReturned = TestStructContainer1Method(intTestStruct)
+if intTestStructReturned.x.x != 101:
+ raise RuntimeError("Failed")
+
diff --git a/Examples/test-suite/python/template_typedef_cplx2_runme.py b/Examples/test-suite/python/template_typedef_cplx2_runme.py
index 161bd51fc..23f19efb9 100644
--- a/Examples/test-suite/python/template_typedef_cplx2_runme.py
+++ b/Examples/test-suite/python/template_typedef_cplx2_runme.py
@@ -8,25 +8,21 @@ try:
d = make_Identity_double()
a = d.this
except:
- print d, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(d))
s = "%s" % d
if str.find(s, "ArithUnaryFunction") == -1:
- print d, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(d))
try:
e = make_Multiplies_double_double_double_double(d, d)
a = e.this
except:
- print e, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(e))
s = "%s" % e
if str.find(s, "ArithUnaryFunction") == -1:
- print e, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(e))
#
@@ -37,25 +33,21 @@ try:
c = make_Identity_complex()
a = c.this
except:
- print c, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(c))
s = "%s" % c
if str.find(s, "ArithUnaryFunction") == -1:
- print c, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(c))
try:
f = make_Multiplies_complex_complex_complex_complex(c, c)
a = f.this
except:
- print f, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(f))
s = "%s" % f
if str.find(s, "ArithUnaryFunction") == -1:
- print f, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(f))
#
# Mix case
@@ -65,29 +57,24 @@ try:
g = make_Multiplies_double_double_complex_complex(d, c)
a = g.this
except:
- print g, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(g))
s = "%s" % g
if str.find(s, "ArithUnaryFunction") == -1:
- print g, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(g))
try:
h = make_Multiplies_complex_complex_double_double(c, d)
a = h.this
except:
- print h, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(h))
s = "%s" % h
if str.find(s, "ArithUnaryFunction") == -1:
- print h, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(h))
try:
a = g.get_value()
except:
- print g, "has not get_value() method"
- raise RuntimeError
+ raise RuntimeError("{}, has not get_value() method".format(g))
diff --git a/Examples/test-suite/python/template_typedef_cplx_runme.py b/Examples/test-suite/python/template_typedef_cplx_runme.py
index 1846739eb..69d5642d6 100644
--- a/Examples/test-suite/python/template_typedef_cplx_runme.py
+++ b/Examples/test-suite/python/template_typedef_cplx_runme.py
@@ -8,25 +8,21 @@ try:
d = make_Identity_double()
a = d.this
except:
- print d, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(d))
s = "%s" % d
if str.find(s, "ArithUnaryFunction") == -1:
- print d, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(d))
try:
e = make_Multiplies_double_double_double_double(d, d)
a = e.this
except:
- print e, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(e))
s = "%s" % e
if str.find(s, "ArithUnaryFunction") == -1:
- print e, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(e))
#
@@ -37,25 +33,21 @@ try:
c = make_Identity_complex()
a = c.this
except:
- print c, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(c))
s = "%s" % c
if str.find(s, "ArithUnaryFunction") == -1:
- print c, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(c))
try:
f = make_Multiplies_complex_complex_complex_complex(c, c)
a = f.this
except:
- print f, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(f))
s = "%s" % f
if str.find(s, "ArithUnaryFunction") == -1:
- print f, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(f))
#
# Mix case
@@ -65,23 +57,19 @@ try:
g = make_Multiplies_double_double_complex_complex(d, c)
a = g.this
except:
- print g, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(g))
s = "%s" % g
if str.find(s, "ArithUnaryFunction") == -1:
- print g, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(g))
try:
h = make_Multiplies_complex_complex_double_double(c, d)
a = h.this
except:
- print h, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(h))
s = "%s" % h
if str.find(s, "ArithUnaryFunction") == -1:
- print h, "is not an ArithUnaryFunction"
- raise RuntimeError
+ raise RuntimeError("{} is not an ArithUnaryFunction".format(h))
diff --git a/Examples/test-suite/python/template_typedef_runme.py b/Examples/test-suite/python/template_typedef_runme.py
index 16695bada..5723e4f59 100644
--- a/Examples/test-suite/python/template_typedef_runme.py
+++ b/Examples/test-suite/python/template_typedef_runme.py
@@ -14,22 +14,19 @@ try:
e = make_Multiplies_float_float_float_float(d, d)
a = e.this
except:
- print e, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(e))
try:
f = make_Multiplies_reald_reald_reald_reald(c, c)
a = f.this
except:
- print f, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(f))
try:
g = make_Multiplies_float_float_reald_reald(d, c)
a = g.this
except:
- print g, "is not an instance"
- raise RuntimeError
+ raise RuntimeError("{} is not an instance".format(g))
# the old large format
diff --git a/Examples/test-suite/python/template_typemaps_typedef2_runme.py b/Examples/test-suite/python/template_typemaps_typedef2_runme.py
index 258f44366..da26a9f76 100644
--- a/Examples/test-suite/python/template_typemaps_typedef2_runme.py
+++ b/Examples/test-suite/python/template_typemaps_typedef2_runme.py
@@ -5,7 +5,7 @@ m1 = MultimapIntA()
dummy_pair = m1.make_dummy_pair()
val = m1.typemap_test(dummy_pair).val
if val != 1234:
- raise RuntimeError, "typemaps not working"
+ raise RuntimeError("typemaps not working")
m2 = MultimapAInt()
@@ -13,24 +13,24 @@ m2 = MultimapAInt()
#dummy_pair = m2.make_dummy_pair()
#val = m2.typemap_test(dummy_pair)
-# print val
+# print("{}".format(val))
# if val != 4321:
# raise RuntimeError, "typemaps not working"
if typedef_test1(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test1 not working"
+ raise RuntimeError("typedef_test1 not working")
if typedef_test2(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test2 not working"
+ raise RuntimeError("typedef_test2 not working")
if typedef_test3(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test3 not working"
+ raise RuntimeError("typedef_test3 not working")
if typedef_test4(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test4 not working"
+ raise RuntimeError("typedef_test4 not working")
if typedef_test5(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test5 not working"
+ raise RuntimeError("typedef_test5 not working")
if typedef_test6(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test6 not working"
+ raise RuntimeError("typedef_test6 not working")
diff --git a/Examples/test-suite/python/template_typemaps_typedef_runme.py b/Examples/test-suite/python/template_typemaps_typedef_runme.py
index 1ca3f835c..a5209b71f 100644
--- a/Examples/test-suite/python/template_typemaps_typedef_runme.py
+++ b/Examples/test-suite/python/template_typemaps_typedef_runme.py
@@ -5,7 +5,7 @@ m1 = MultimapIntA()
dummy_pair = m1.make_dummy_pair()
val = m1.typemap_test(dummy_pair).val
if val != 1234:
- raise RuntimeError, "typemaps not working"
+ raise RuntimeError("typemaps not working")
m2 = MultimapAInt()
@@ -13,24 +13,24 @@ m2 = MultimapAInt()
#dummy_pair = m2.make_dummy_pair()
#val = m2.typemap_test(dummy_pair)
-# print val
+# print("{}".format(val))
# if val != 4321:
# raise RuntimeError, "typemaps not working"
if typedef_test1(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test1 not working"
+ raise RuntimeError("typedef_test1 not working")
if typedef_test2(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test2 not working"
+ raise RuntimeError("typedef_test2 not working")
if typedef_test3(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test3 not working"
+ raise RuntimeError("typedef_test3 not working")
if typedef_test4(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test4 not working"
+ raise RuntimeError("typedef_test4 not working")
if typedef_test5(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test5 not working"
+ raise RuntimeError("typedef_test5 not working")
if typedef_test6(dummy_pair).val != 1234:
- raise RuntimeError, "typedef_test6 not working"
+ raise RuntimeError("typedef_test6 not working")
diff --git a/Examples/test-suite/python/threads_exception_runme.py b/Examples/test-suite/python/threads_exception_runme.py
index 056bd849b..e3f6299e7 100644
--- a/Examples/test-suite/python/threads_exception_runme.py
+++ b/Examples/test-suite/python/threads_exception_runme.py
@@ -3,18 +3,18 @@ import threads_exception
t = threads_exception.Test()
try:
t.unknown()
-except RuntimeError, e:
+except RuntimeError as e:
pass
try:
t.simple()
-except RuntimeError, e:
+except RuntimeError as e:
if e.args[0] != 37:
raise RuntimeError
try:
t.message()
-except RuntimeError, e:
+except RuntimeError as e:
if e.args[0] != "I died.":
raise RuntimeError
@@ -23,18 +23,18 @@ except RuntimeError, e:
if not threads_exception.is_python_builtin():
try:
t.hosed()
- except threads_exception.Exc, e:
+ except threads_exception.Exc as e:
code = e.code
if code != 42:
- raise RuntimeError, "bad... code: %d" % code
+ raise RuntimeError("bad... code: %d" % code)
msg = e.msg
if msg != "Hosed":
- raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg))
+ raise RuntimeError("bad... msg: '%s' len: %d" % (msg, len(msg)))
for i in range(1, 4):
try:
t.multi(i)
- except RuntimeError, e:
+ except RuntimeError as e:
pass
- except threads_exception.Exc, e:
+ except threads_exception.Exc as e:
pass
diff --git a/Examples/test-suite/python/typedef_inherit_runme.py b/Examples/test-suite/python/typedef_inherit_runme.py
index 6b7f2d872..3c552ec65 100644
--- a/Examples/test-suite/python/typedef_inherit_runme.py
+++ b/Examples/test-suite/python/typedef_inherit_runme.py
@@ -5,19 +5,19 @@ b = typedef_inherit.Bar()
x = typedef_inherit.do_blah(a)
if x != "Foo::blah":
- print "Whoa! Bad return", x
+ raise RuntimeError("Whoa! Bad return {}".format(x))
x = typedef_inherit.do_blah(b)
if x != "Bar::blah":
- print "Whoa! Bad return", x
+ raise RuntimeError("Whoa! Bad return {}".format(x))
c = typedef_inherit.Spam()
d = typedef_inherit.Grok()
x = typedef_inherit.do_blah2(c)
if x != "Spam::blah":
- print "Whoa! Bad return", x
+ raise RuntimeError("Whoa! Bad return {}".format(x))
x = typedef_inherit.do_blah2(d)
if x != "Grok::blah":
- print "Whoa! Bad return", x
+ raise RuntimeError("Whoa! Bad return {}".format(x))
diff --git a/Examples/test-suite/python/typedef_scope_runme.py b/Examples/test-suite/python/typedef_scope_runme.py
index edd3e9f3a..0294c4a07 100644
--- a/Examples/test-suite/python/typedef_scope_runme.py
+++ b/Examples/test-suite/python/typedef_scope_runme.py
@@ -3,8 +3,8 @@ import typedef_scope
b = typedef_scope.Bar()
x = b.test1(42, "hello")
if x != 42:
- print "Failed!!"
+ raise RuntimeError("Failed!!")
x = b.test2(42, "hello")
if x != "hello":
- print "Failed!!"
+ raise RuntimeError("Failed!!")
diff --git a/Examples/test-suite/python/typemap_arrays_runme.py b/Examples/test-suite/python/typemap_arrays_runme.py
index ea0f08d6b..7bc45f908 100644
--- a/Examples/test-suite/python/typemap_arrays_runme.py
+++ b/Examples/test-suite/python/typemap_arrays_runme.py
@@ -1,4 +1,4 @@
from typemap_arrays import *
if sumA(None) != 60:
- raise RuntimeError, "Sum is wrong"
+ raise RuntimeError("Sum is wrong")
diff --git a/Examples/test-suite/python/typename_runme.py b/Examples/test-suite/python/typename_runme.py
index aac936fde..a4f76fc36 100644
--- a/Examples/test-suite/python/typename_runme.py
+++ b/Examples/test-suite/python/typename_runme.py
@@ -4,8 +4,8 @@ f = typename.Foo()
b = typename.Bar()
x = typename.twoFoo(f)
-if not isinstance(x, types.FloatType):
- raise RuntimeError, "Wrong return type (FloatType) !"
+if not isinstance(x, float):
+ raise RuntimeError("Wrong return type (FloatType) !")
y = typename.twoBar(b)
-if not isinstance(y, types.IntType):
- raise RuntimeError, "Wrong return type (IntType)!"
+if not isinstance(y, int):
+ raise RuntimeError("Wrong return type (IntType)!")
diff --git a/Examples/test-suite/python/unicode_strings_runme.py b/Examples/test-suite/python/unicode_strings_runme.py
index 4e661f00e..57bd7abca 100644
--- a/Examples/test-suite/python/unicode_strings_runme.py
+++ b/Examples/test-suite/python/unicode_strings_runme.py
@@ -2,12 +2,8 @@ import sys
import unicode_strings
-# The 'u' string prefix isn't valid in Python 3.0 - 3.2 and is redundant
-# in 3.3+. Since this file is run through 2to3 before testing, though,
-# mark this as a unicode string in 2.x so it'll become a str in 3.x.
-test_string = u"h\udce9llo w\u00f6rld"
-
if sys.version_info[0:2] >= (3, 1):
+ test_string = "h\udce9llo w\u00f6rld"
if unicode_strings.non_utf8_c_str() != test_string:
raise ValueError("Test comparison mismatch")
if unicode_strings.non_utf8_std_string() != test_string:
@@ -19,19 +15,24 @@ def check(s1, s2):
# Testing SWIG_PYTHON_2_UNICODE flag which allows unicode strings to be passed to C
if sys.version_info[0:2] < (3, 0):
+ # Python 3.0-3.2 results in a SyntaxError when using u"" string literals, so we use a
+ # convoluted unicode string construction using unicode() and unichr().
+ # Conventional Python 2 syntax shown in comments.
check(unicode_strings.charstring("hello1"), "hello1")
- check(unicode_strings.charstring(str(u"hello2")), "hello2")
- check(unicode_strings.charstring(u"hello3"), "hello3")
- check(unicode_strings.charstring(unicode("hello4")), "hello4")
- unicode_strings.charstring(u"hell\xb05")
- unicode_strings.charstring(u"hell\u00f66")
-
-low_surrogate_string = u"\udcff"
-try:
+ check(unicode_strings.charstring(str(unicode("hello2"))), "hello2") # u"hello2"
+ check(unicode_strings.charstring(unicode("hello3")), "hello3") # u"hello3"
+ check(unicode_strings.charstring(str("hello4")), "hello4")
+ unicode_strings.charstring(unicode("hell" + unichr(0xb0) + "5")) # u"hell\xb05"
+ unicode_strings.charstring(unicode("hell" + unichr(0x00f6) +"6")) # u"hell\u00f66"
+ low_surrogate_string = unichr(0xdcff) # u"\udcff"
unicode_strings.instring(low_surrogate_string)
- # Will succeed with Python 2
-except TypeError, e:
- # Python 3 will fail the PyUnicode_AsUTF8String conversion resulting in a TypeError.
- # The real error is actually:
- # UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 0: surrogates not allowed
- pass
+else:
+ low_surrogate_string = "\udcff"
+ try:
+ unicode_strings.instring(low_surrogate_string)
+ raise RuntimeError("Exception should have been thrown")
+ except TypeError as e:
+ # Python 3 will fail the PyUnicode_AsUTF8String conversion resulting in a TypeError.
+ # The real error is actually:
+ # UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 0: surrogates not allowed
+ pass
diff --git a/Examples/test-suite/python/unions_runme.py b/Examples/test-suite/python/unions_runme.py
index 387a048c8..5a3ee3b5c 100644
--- a/Examples/test-suite/python/unions_runme.py
+++ b/Examples/test-suite/python/unions_runme.py
@@ -3,7 +3,6 @@
# union embedded within a struct can be set and read correctly.
import unions
-import sys
import string
# Create new instances of SmallStruct and BigStruct for later use
@@ -23,28 +22,23 @@ eut.number = 1
eut.uni.small = small
Jill1 = eut.uni.small.jill
if (Jill1 != 200):
- print "Runtime test1 failed. eut.uni.small.jill=", Jill1
- sys.exit(1)
+ raise RuntimeError("Runtime test1 failed. eut.uni.small.jill={}".format(Jill1))
Num1 = eut.number
if (Num1 != 1):
- print "Runtime test2 failed. eut.number=", Num1
- sys.exit(1)
+ raise RuntimeError("Runtime test2 failed. eut.number=".format(Num1))
# Secondly check the BigStruct in EmbeddedUnionTest
eut.number = 2
eut.uni.big = big
Jack1 = eut.uni.big.jack
if (Jack1 != 300):
- print "Runtime test3 failed. eut.uni.big.jack=", Jack1
- sys.exit(1)
+ raise RuntimeError("Runtime test3 failed. eut.uni.big.jack={}".format(Jack1))
Jill2 = eut.uni.big.smallstruct.jill
if (Jill2 != 200):
- print "Runtime test4 failed. eut.uni.big.smallstruct.jill=", Jill2
- sys.exit(1)
+ raise RuntimeError("Runtime test4 failed. eut.uni.big.smallstruct.jill={}".format(Jill2))
Num2 = eut.number
if (Num2 != 2):
- print "Runtime test5 failed. eut.number=", Num2
- sys.exit(1)
+ raise RuntimeError("Runtime test5 failed. eut.number={}".format(Num2))
diff --git a/Examples/test-suite/python/using_composition_runme.py b/Examples/test-suite/python/using_composition_runme.py
index c4f339095..67f72bc2f 100644
--- a/Examples/test-suite/python/using_composition_runme.py
+++ b/Examples/test-suite/python/using_composition_runme.py
@@ -2,32 +2,32 @@ from using_composition import *
f = FooBar()
if f.blah(3) != 3:
- raise RuntimeError, "FooBar::blah(int)"
+ raise RuntimeError("FooBar::blah(int)")
if f.blah(3.5) != 3.5:
- raise RuntimeError, "FooBar::blah(double)"
+ raise RuntimeError("FooBar::blah(double)")
if f.blah("hello") != "hello":
- raise RuntimeError, "FooBar::blah(char *)"
+ raise RuntimeError("FooBar::blah(char *)")
f = FooBar2()
if f.blah(3) != 3:
- raise RuntimeError, "FooBar2::blah(int)"
+ raise RuntimeError("FooBar2::blah(int)")
if f.blah(3.5) != 3.5:
- raise RuntimeError, "FooBar2::blah(double)"
+ raise RuntimeError("FooBar2::blah(double)")
if f.blah("hello") != "hello":
- raise RuntimeError, "FooBar2::blah(char *)"
+ raise RuntimeError("FooBar2::blah(char *)")
f = FooBar3()
if f.blah(3) != 3:
- raise RuntimeError, "FooBar3::blah(int)"
+ raise RuntimeError("FooBar3::blah(int)")
if f.blah(3.5) != 3.5:
- raise RuntimeError, "FooBar3::blah(double)"
+ raise RuntimeError("FooBar3::blah(double)")
if f.blah("hello") != "hello":
- raise RuntimeError, "FooBar3::blah(char *)"
+ raise RuntimeError("FooBar3::blah(char *)")
diff --git a/Examples/test-suite/python/using_extend_runme.py b/Examples/test-suite/python/using_extend_runme.py
index 038a1686a..7e0912926 100644
--- a/Examples/test-suite/python/using_extend_runme.py
+++ b/Examples/test-suite/python/using_extend_runme.py
@@ -2,20 +2,20 @@ from using_extend import *
f = FooBar()
if f.blah(3) != 3:
- raise RuntimeError, "blah(int)"
+ raise RuntimeError("blah(int)")
if f.blah(3.5) != 3.5:
- raise RuntimeError, "blah(double)"
+ raise RuntimeError("blah(double)")
if f.blah("hello") != "hello":
- raise RuntimeError, "blah(char *)"
+ raise RuntimeError("blah(char *)")
if f.blah(3, 4) != 7:
- raise RuntimeError, "blah(int,int)"
+ raise RuntimeError("blah(int,int)")
if f.blah(3.5, 7.5) != (3.5 + 7.5):
- raise RuntimeError, "blah(double,double)"
+ raise RuntimeError("blah(double,double)")
if f.duh(3) != 3:
- raise RuntimeError, "duh(int)"
+ raise RuntimeError("duh(int)")
diff --git a/Examples/test-suite/python/using_inherit_runme.py b/Examples/test-suite/python/using_inherit_runme.py
index 4fd595968..ccdeece8d 100644
--- a/Examples/test-suite/python/using_inherit_runme.py
+++ b/Examples/test-suite/python/using_inherit_runme.py
@@ -2,47 +2,47 @@ from using_inherit import *
b = Bar()
if b.test(3) != 3:
- raise RuntimeError, "Bar::test(int)"
+ raise RuntimeError("Bar::test(int)")
if b.test(3.5) != 3.5:
- raise RuntimeError, "Bar::test(double)"
+ raise RuntimeError("Bar::test(double)")
b = Bar2()
if b.test(3) != 6:
- raise RuntimeError, "Bar2::test(int)"
+ raise RuntimeError("Bar2::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Bar2::test(double)"
+ raise RuntimeError("Bar2::test(double)")
b = Bar3()
if b.test(3) != 6:
- raise RuntimeError, "Bar3::test(int)"
+ raise RuntimeError("Bar3::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Bar3::test(double)"
+ raise RuntimeError("Bar3::test(double)")
b = Bar4()
if b.test(3) != 6:
- raise RuntimeError, "Bar4::test(int)"
+ raise RuntimeError("Bar4::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Bar4::test(double)"
+ raise RuntimeError("Bar4::test(double)")
b = Fred1()
if b.test(3) != 3:
- raise RuntimeError, "Fred1::test(int)"
+ raise RuntimeError("Fred1::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Fred1::test(double)"
+ raise RuntimeError("Fred1::test(double)")
b = Fred2()
if b.test(3) != 3:
- raise RuntimeError, "Fred2::test(int)"
+ raise RuntimeError("Fred2::test(int)")
if b.test(3.5) != 7.0:
- raise RuntimeError, "Fred2::test(double)"
+ raise RuntimeError("Fred2::test(double)")
diff --git a/Examples/test-suite/python/using_private_runme.py b/Examples/test-suite/python/using_private_runme.py
index 00c9a8d25..9e0a15f12 100644
--- a/Examples/test-suite/python/using_private_runme.py
+++ b/Examples/test-suite/python/using_private_runme.py
@@ -4,10 +4,10 @@ f = FooBar()
f.x = 3
if f.blah(4) != 4:
- raise RuntimeError, "blah(int)"
+ raise RuntimeError("blah(int)")
if f.defaulted() != -1:
- raise RuntimeError, "defaulted()"
+ raise RuntimeError("defaulted()")
if f.defaulted(222) != 222:
- raise RuntimeError, "defaulted(222)"
+ raise RuntimeError("defaulted(222)")
diff --git a/Examples/test-suite/python/using_protected_runme.py b/Examples/test-suite/python/using_protected_runme.py
index 525a1cde4..dd477237e 100644
--- a/Examples/test-suite/python/using_protected_runme.py
+++ b/Examples/test-suite/python/using_protected_runme.py
@@ -4,4 +4,4 @@ f = FooBar()
f.x = 3
if f.blah(4) != 4:
- raise RuntimeError, "blah(int)"
+ raise RuntimeError("blah(int)")
diff --git a/Examples/test-suite/python/varargs_overload_runme.py b/Examples/test-suite/python/varargs_overload_runme.py
index 6f5a70222..ffa763450 100644
--- a/Examples/test-suite/python/varargs_overload_runme.py
+++ b/Examples/test-suite/python/varargs_overload_runme.py
@@ -1,62 +1,62 @@
import varargs_overload
if varargs_overload.vararg_over1("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over1(2) != "2":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over2("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over2(2, 2.2) != "2 2.2":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over3("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over3(2, 2.2, "hey") != "2 2.2 hey":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over4("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over4(123) != "123":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over4("Hello", 123) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
# Same as above but non-vararg function declared first
if varargs_overload.vararg_over6("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over6(2) != "2":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over7("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over7(2, 2.2) != "2 2.2":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over8("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over8(2, 2.2, "hey") != "2 2.2 hey":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over9("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over9(123) != "123":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs_overload.vararg_over9("Hello", 123) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
diff --git a/Examples/test-suite/python/varargs_runme.py b/Examples/test-suite/python/varargs_runme.py
index 277ea757a..13f85a75f 100644
--- a/Examples/test-suite/python/varargs_runme.py
+++ b/Examples/test-suite/python/varargs_runme.py
@@ -1,31 +1,35 @@
import varargs
if varargs.test("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
+
+vc = varargs.VarargConstructor("Hey there")
+if vc.str != "Hey there":
+ raise RuntimeError("Failed")
f = varargs.Foo("Greetings")
if f.str != "Greetings":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if f.test("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs.test_def("Hello", 1) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs.test_def("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
###
if varargs.test_plenty("Hello") != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs.test_plenty("Hello", 1) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
if varargs.test_plenty("Hello", 1, 2) != "Hello":
- raise RuntimeError, "Failed"
+ raise RuntimeError("Failed")
try:
varargs.test_plenty("Hello", 1, 2, 3)
diff --git a/Examples/test-suite/python/virtual_derivation_runme.py b/Examples/test-suite/python/virtual_derivation_runme.py
index 68546c6eb..21014bd02 100644
--- a/Examples/test-suite/python/virtual_derivation_runme.py
+++ b/Examples/test-suite/python/virtual_derivation_runme.py
@@ -4,4 +4,4 @@ from virtual_derivation import *
#
b = B(3)
if b.get_a() != b.get_b():
- raise RuntimeError, "something is really wrong"
+ raise RuntimeError("something is really wrong")
diff --git a/Examples/test-suite/python_append.i b/Examples/test-suite/python_append.i
index 049494319..883097ec6 100644
--- a/Examples/test-suite/python_append.i
+++ b/Examples/test-suite/python_append.i
@@ -42,13 +42,31 @@ import os.path
%}
%inline %{
-
class Test {
public:
static void static_func() {};
void funk() {};
};
+%}
+// Github issue #1674
+%extend ForSlots {
+ %pythoncode %{
+ __slots__ = ["this"]
+ %}
+}
+// While __slots__ does not contain 'ValidVariable' in the list, it is still possible
+// to set 'ValidVariable'. A little odd, but the whole attribute setting is bypassed
+// for setting C/C++ member variables.
+// Not sure how to test the equivalent for -builtin.
+%inline %{
+struct ForSlots {
+ int ValidVariable;
+ ForSlots() : ValidVariable(99) {}
+};
+%}
+
+%inline %{
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else
diff --git a/Examples/test-suite/r/Makefile.in b/Examples/test-suite/r/Makefile.in
index 33e9d90da..98835b958 100644
--- a/Examples/test-suite/r/Makefile.in
+++ b/Examples/test-suite/r/Makefile.in
@@ -18,6 +18,7 @@ C_TEST_CASES += \
CPP_TEST_CASES += \
r_double_delete \
+ r_memory_leak \
r_overload_array \
r_sexp \
r_overload_comma \
diff --git a/Examples/test-suite/r/abstract_access_runme.R b/Examples/test-suite/r/abstract_access_runme.R
new file mode 100644
index 000000000..f6fb4099d
--- /dev/null
+++ b/Examples/test-suite/r/abstract_access_runme.R
@@ -0,0 +1,74 @@
+clargs <- commandArgs(trailing=TRUE)
+source(file.path(clargs[1], "unittest.R"))
+
+dyn.load(paste("abstract_access", .Platform$dynlib.ext, sep=""))
+source("abstract_access.R")
+
+dd <- D()
+unittest(1, dd$z())
+unittest(1, dd$do_x())
+
+## Original version allowed dd$z <- 2
+tryCatch({
+ dd$z <- 2
+ # force an error if the previous line doesn't raise an exception
+ stop("Test Failure A")
+}, error = function(e) {
+ if (e$message == "Test Failure A") {
+ # Raise the error again to cause a failed test
+ stop(e)
+ }
+ message("Correct - no dollar assignment method found")
+}
+)
+
+tryCatch({
+ dd[["z"]] <- 2
+ # force an error if the previous line doesn't raise an exception
+ stop("Test Failure B")
+}, error = function(e) {
+ if (e$message == "Test Failure B") {
+ # Raise the error again to cause a failed test
+ stop(e)
+ }
+ message("Correct - no dollar assignment method found")
+}
+)
+
+## The methods are attached to the parent class - see if we can get
+## them
+tryCatch({
+ m1 <- getMethod('$', "_p_A")
+}, error = function(e) {
+ stop("No $ method found - there should be one")
+}
+)
+
+## These methods should not be present
+## They correspond to the tests that are expected
+## to fail above.
+tryCatch({
+ m2 <- getMethod('$<-', "_p_A")
+ # force an error if the previous line doesn't raise an exception
+ stop("Test Failure C")
+}, error = function(e) {
+ if (e$message == "Test Failure C") {
+ # Raise the error again to cause a failed test
+ stop(e)
+ }
+ message("Correct - no dollar assignment method found")
+}
+)
+
+tryCatch({
+ m3 <- getMethod('[[<-', "_p_A")
+ # force an error if the previous line doesn't raise an exception
+ stop("Test Failure D")
+}, error = function(e) {
+ if (e$message == "Test Failure D") {
+ # Raise the error again to cause a failed test
+ stop(e)
+ }
+ message("Correct - no list assignment method found")
+}
+)
diff --git a/Examples/test-suite/r/r_memory_leak_runme.R b/Examples/test-suite/r/r_memory_leak_runme.R
new file mode 100644
index 000000000..ef6533aef
--- /dev/null
+++ b/Examples/test-suite/r/r_memory_leak_runme.R
@@ -0,0 +1,26 @@
+clargs <- commandArgs(trailing=TRUE)
+source(file.path(clargs[1], "unittest.R"))
+
+dyn.load(paste("r_memory_leak", .Platform$dynlib.ext, sep=""))
+source("r_memory_leak.R")
+cacheMetaData(1)
+
+a <- Foo();
+unittest(Foo_get_count(), 1);
+b <- Foo();
+unittest(Foo_get_count(), 2);
+
+# Normal behaviour
+invisible(trigger_internal_swig_exception("no problem", a));
+unittest(Foo_get_count(), 2);
+# SWIG exception introduced
+result <- tryCatch({
+ trigger_internal_swig_exception("null", b);
+}, warning = function(w) {
+ # print(" Hum... We received a warning, but this should be an error");
+ unittest(1,0);
+}, error = function(e) {
+ # print(" Gotcha!");
+ unittest(1,1);
+})
+unittest(Foo_get_count(), 2);
diff --git a/Examples/test-suite/r_memory_leak.i b/Examples/test-suite/r_memory_leak.i
new file mode 100644
index 000000000..a240097e3
--- /dev/null
+++ b/Examples/test-suite/r_memory_leak.i
@@ -0,0 +1,40 @@
+%module r_memory_leak
+
+%include
+
+%typemap(in) Foo* foo
+{
+ $1 = new Foo;
+}
+%typemap(freearg) Foo* foo
+{
+ printf(" \" Object deleted\"\n");
+ delete $1;
+}
+%typemap(out) Foo* verify_no_memory_leak
+{
+ if ($1 == NULL)
+ SWIG_exception_fail(SWIG_RuntimeError, "Let's see how the bindings manage this exception!");
+}
+%typemap(scoerceout) Foo*
+ %{ if (!is.null($result) && !is.logical($result)) {$result <- new("$R_class", ref=$result) ;}; %}
+
+%inline %{
+ #include
+
+ class Foo {
+ static unsigned count;
+ public:
+ Foo() { ++count; }
+ ~Foo() { --count; }
+ static unsigned get_count() { return count; }
+ };
+
+ unsigned Foo::count = 0;
+
+ static Foo* trigger_internal_swig_exception(const std::string& message, Foo* foo)
+ {
+ return (message == "null") ? NULL : foo;
+ };
+
+%}
diff --git a/Examples/test-suite/rname.i b/Examples/test-suite/rname.i
index 09d6e3e3b..b7cf5d22b 100644
--- a/Examples/test-suite/rname.i
+++ b/Examples/test-suite/rname.i
@@ -22,7 +22,7 @@
%rename (newname) Space::Base::oldname(double d) const;
/* Rename derived class method only */
-%rename (Xfunc) Space::Derived::fn(Base baseValue, Base* basePtr, Base& baseRef);
+%rename (Xfunc) Space::Derived::fn1(Base baseValue, Base* basePtr, Base& baseRef);
%inline %{
class Bar {
@@ -43,14 +43,14 @@ class Base {
public:
Base(){};
virtual ~Base(){};
- void fn(Base baseValue, Base* basePtr, Base& baseRef){}
+ void fn1(Base baseValue, Base* basePtr, Base& baseRef){}
virtual const char * oldname(double d) const { return "Base"; }
};
class Derived : public Base {
public:
Derived(){}
~Derived(){}
- void fn(Base baseValue, Base* basePtr, Base& baseRef){}
+ void fn1(Base baseValue, Base* basePtr, Base& baseRef){}
virtual const char * oldname(double d) const { return "Derived"; }
};
}
diff --git a/Examples/test-suite/ruby/Makefile.in b/Examples/test-suite/ruby/Makefile.in
index d75cdb058..f982eca1f 100644
--- a/Examples/test-suite/ruby/Makefile.in
+++ b/Examples/test-suite/ruby/Makefile.in
@@ -23,6 +23,7 @@ CPP_TEST_CASES = \
li_std_wstring_inherit \
primitive_types \
ruby_alias_method \
+ ruby_global_immutable_vars_cpp \
ruby_keywords \
ruby_minherit_shared_ptr \
ruby_naming \
@@ -48,6 +49,7 @@ C_TEST_CASES += \
li_cstring \
ruby_alias_global_function \
ruby_alias_module_function \
+ ruby_global_immutable_vars \
ruby_manual_proxy \
include $(srcdir)/../common.mk
@@ -57,6 +59,8 @@ SWIGOPT += -w801 -noautorename -features autodoc=4
# Custom tests - tests with additional commandline options
ruby_alias_global_function.ctest: SWIGOPT += -globalmodule
+ruby_global_immutable_vars.ctest: SWIGOPT += -globalmodule
+ruby_global_immutable_vars_cpp.cpptest: SWIGOPT += -globalmodule
ruby_naming.cpptest: SWIGOPT += -autorename
# Rules for the different types of tests
@@ -80,6 +84,8 @@ ruby_naming.cpptest: SWIGOPT += -autorename
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) $(RUBYFLAGS) -I$(srcdir):. $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*.so ] ; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) $(RUBYFLAGS) -I$(srcdir):. -r$(SCRIPTDIR)/$(SCRIPTPREFIX)$*.so -e '' ; \
fi
# Clean
diff --git a/Examples/test-suite/ruby/constant_directive_runme.rb b/Examples/test-suite/ruby/constant_directive_runme.rb
new file mode 100644
index 000000000..ae6cf4fb3
--- /dev/null
+++ b/Examples/test-suite/ruby/constant_directive_runme.rb
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'swig_assert'
+require 'constant_directive'
+
+swig_assert("Constant_directive::TYPE1_CONSTANT1.is_a?(Constant_directive::Type1)", binding)
+swig_assert("Constant_directive::getType1Instance().is_a?(Constant_directive::Type1)", binding)
+
+swig_assert_equal('Constant_directive::TYPE1_CONSTANT1.val', '1', binding)
+swig_assert_equal('Constant_directive::TYPE1_CONSTANT2.val', '2', binding)
+swig_assert_equal('Constant_directive::TYPE1_CONSTANT3.val', '3', binding)
+swig_assert_equal('Constant_directive::TYPE1CONST_CONSTANT1.val', '1', binding)
+swig_assert_equal('Constant_directive::TYPE1CPTR_CONSTANT1.val', '1', binding)
diff --git a/Examples/test-suite/ruby/contract_runme.rb b/Examples/test-suite/ruby/contract_runme.rb
new file mode 100644
index 000000000..df7fd3d8f
--- /dev/null
+++ b/Examples/test-suite/ruby/contract_runme.rb
@@ -0,0 +1,69 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'swig_assert'
+require 'contract'
+
+def swig_assert_runtime_error(msg, type, &block)
+ begin
+ yield(block)
+ raise SwigRubyError.new("#{msg} failed")
+ rescue RuntimeError => e
+ reason = e.to_s
+ if reason =~ /\bcontract violation\b/i && reason =~ /\b#{type}\b/i
+ # OK
+ else
+ raise e
+ end
+ end
+end
+
+Contract::test_preassert(1, 2)
+swig_assert_runtime_error("Preassertions", "require") { Contract::test_preassert(-1, 3) }
+
+Contract::test_postassert(3)
+swig_assert_runtime_error("Postassertions", "ensure") { Contract::test_postassert(-3) }
+
+Contract::test_prepost(2, 3)
+Contract::test_prepost(5, -4)
+swig_assert_runtime_error("Preassertions", "require") { Contract::test_prepost(-3, 4) }
+swig_assert_runtime_error("Postassertions", "ensure") { Contract::test_prepost(4, -10) }
+
+f = Contract::Foo.new
+f.test_preassert(4, 5)
+swig_assert_runtime_error("Method preassertion", "require") { f.test_preassert(-2, 3) }
+
+f.test_postassert(4)
+swig_assert_runtime_error("Method postassertion", "ensure") { f.test_postassert(-4) }
+
+f.test_prepost(3, 4)
+f.test_prepost(4, -3)
+swig_assert_runtime_error("Method preassertion", "require") { f.test_prepost(-4, 2) }
+swig_assert_runtime_error("Method postassertion", "ensure") { f.test_prepost(4, -10) }
+
+Contract::Foo.stest_prepost(4, 0)
+swig_assert_runtime_error("Static method preassertion", "require") { Contract::Foo.stest_prepost(-4, 2) }
+swig_assert_runtime_error("Static method postassertion", "ensure") { Contract::Foo.stest_prepost(4, -10) }
+
+b = Contract::Bar.new
+swig_assert_runtime_error("Inherited preassertion", "require") { b.test_prepost(2, -4) }
+
+d = Contract::D.new
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.foo(-1, 1, 1, 1, 1) }
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.foo(1, -1, 1, 1, 1) }
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.foo(1, 1, -1, 1, 1) }
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.foo(1, 1, 1, -1, 1) }
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.foo(1, 1, 1, 1, -1) }
+
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.bar(-1, 1, 1, 1, 1) }
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.bar(1, -1, 1, 1, 1) }
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.bar(1, 1, -1, 1, 1) }
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.bar(1, 1, 1, -1, 1) }
+swig_assert_runtime_error("Inherited preassertion (D)", "require") { d.bar(1, 1, 1, 1, -1) }
+
+# namespace
+Contract::MyClass.new(1)
+swig_assert_runtime_error("Constructor preassertion", "require") { Contract::MyClass.new(0) }
+
diff --git a/Examples/test-suite/ruby/cpp11_alias_nested_template_scoping_runme.rb b/Examples/test-suite/ruby/cpp11_alias_nested_template_scoping_runme.rb
new file mode 100644
index 000000000..c6e2b8559
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp11_alias_nested_template_scoping_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Java counterpart.
+#
+
+require 'swig_assert'
+require 'cpp11_alias_nested_template_scoping'
+
+ys = Cpp11_alias_nested_template_scoping::Yshort.new
+val = ys.create1
+val = ys.create2
+val = ys.create3
+val = ys.create4
+val = ys.create5
+val = ys.create6
+val = ys.create7
+
+val = ys.create13
+
+val = ys.create15
+val = ys.create16
+val = ys.create17
+
diff --git a/Examples/test-suite/ruby/cpp17_nested_namespaces_runme.rb b/Examples/test-suite/ruby/cpp17_nested_namespaces_runme.rb
new file mode 100644
index 000000000..e9e841179
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp17_nested_namespaces_runme.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Java counterpart.
+#
+
+require 'cpp17_nested_namespaces'
+
+Cpp17_nested_namespaces::A1Struct.new.A1Method
+Cpp17_nested_namespaces::B1Struct.new.B1Method
+Cpp17_nested_namespaces::C1Struct.new.C1Method
+
+Cpp17_nested_namespaces.createA1Struct().A1Method
+Cpp17_nested_namespaces.createB1Struct().B1Method
+Cpp17_nested_namespaces.createC1Struct().C1Method
+
+Cpp17_nested_namespaces::B2Struct.new.B2Method
+Cpp17_nested_namespaces::C2Struct.new.C2Method
+Cpp17_nested_namespaces.createB2Struct().B2Method
+Cpp17_nested_namespaces.createC2Struct().C2Method
+
+Cpp17_nested_namespaces::B3Struct.new.B3Method
+Cpp17_nested_namespaces::C3Struct.new.C3Method
+Cpp17_nested_namespaces.createB3Struct().B3Method
+Cpp17_nested_namespaces.createC3Struct().C3Method
diff --git a/Examples/test-suite/ruby/cpp_enum_runme.rb b/Examples/test-suite/ruby/cpp_enum_runme.rb
new file mode 100644
index 000000000..0a395e0e0
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp_enum_runme.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'swig_assert'
+require 'cpp_enum'
+
+f = Cpp_enum::Foo.new
+swig_assert_equal('f.hola', 'Cpp_enum::Foo::Hello', binding)
+
+f.hola = Cpp_enum::Foo::Hi
+swig_assert_equal('f.hola', 'Cpp_enum::Foo::Hi', binding)
+
+f.hola = Cpp_enum::Foo::Hello
+swig_assert_equal('f.hola', 'Cpp_enum::Foo::Hello', binding)
+
+Cpp_enum::hi = Cpp_enum::Hello
+swig_assert_equal('Cpp_enum::hi', 'Cpp_enum::Hello', binding)
diff --git a/Examples/test-suite/ruby/cpp_static_runme.rb b/Examples/test-suite/ruby/cpp_static_runme.rb
new file mode 100644
index 000000000..85bdb7028
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp_static_runme.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is derived from its Python counterpart.
+#
+
+require 'swig_assert'
+require 'cpp_static'
+
+Cpp_static::StaticFunctionTest.static_func()
+Cpp_static::StaticFunctionTest.static_func_2(1)
+Cpp_static::StaticFunctionTest.static_func_3(1, 2)
+
+swig_assert_equal("Cpp_static::StaticMemberTest.static_int", "99", binding)
+Cpp_static::StaticMemberTest.static_int = 10
+swig_assert_equal("Cpp_static::StaticMemberTest.static_int", "10", binding)
+
+swig_assert_equal("Cpp_static::StaticBase.statty", "11", binding)
+swig_assert_equal("Cpp_static::StaticBase.grab_statty_base", "11", binding)
+swig_assert_equal("Cpp_static::StaticDerived.statty", "111", binding)
+swig_assert_equal("Cpp_static::StaticDerived.grab_statty_derived", "111", binding)
+Cpp_static::StaticBase.statty = 22
+Cpp_static::StaticDerived.statty = 222
+swig_assert_equal("Cpp_static::StaticBase.statty", "22", binding)
+swig_assert_equal("Cpp_static::StaticBase.grab_statty_base", "22", binding)
+swig_assert_equal("Cpp_static::StaticDerived.statty", "222", binding)
+swig_assert_equal("Cpp_static::StaticDerived.grab_statty_derived", "222", binding)
diff --git a/Examples/test-suite/ruby/enums_runme.rb b/Examples/test-suite/ruby/enums_runme.rb
index cafac25fa..274d59568 100644
--- a/Examples/test-suite/ruby/enums_runme.rb
+++ b/Examples/test-suite/ruby/enums_runme.rb
@@ -25,10 +25,7 @@ Enums::BAR1 == 0
Enums::BAR2 == 1
EOF
-#
-# @bug:
-#
-# swig_assert_each_line( < e
+ had_exception = true
+end
+swig_assert(had_exception, nil,
+ "Global_immutable_vars_cpp::global_immutable_var is writable (expected to be immutable)")
+
+had_exception = false
+begin
+ Global_immutable_vars_cpp::specific_immutable_var = 81
+rescue NoMethodError => e
+ had_exception = true
+end
+swig_assert(had_exception, nil,
+ "Global_immutable_vars_cpp::specific_immutable_var is writable (expected to be immutable)")
+
+swig_assert(Global_immutable_vars_cpp::check_values(80, 41, 82, 83, 44) == 1, nil, "Check values failed")
diff --git a/Examples/test-suite/ruby/global_immutable_vars_runme.rb b/Examples/test-suite/ruby/global_immutable_vars_runme.rb
new file mode 100644
index 000000000..ffbea270f
--- /dev/null
+++ b/Examples/test-suite/ruby/global_immutable_vars_runme.rb
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+#
+# Here the proper generation of mutable and immutable variables is tested
+# in the target language.
+# Immutable variables do not have "=" methods generated by SWIG,
+# therefore trying to assign these variables shall throw a NoMethodError
+# exception.
+#
+
+require 'swig_assert'
+
+require 'global_immutable_vars'
+
+# first check if all variables can be read
+swig_assert_each_line( < e
+ had_exception = true
+end
+swig_assert(had_exception, nil,
+ "Global_immutable_vars::global_immutable_var is writable (expected to be immutable)")
+
+had_exception = false
+begin
+ Global_immutable_vars::specific_immutable_var = 81
+rescue NoMethodError => e
+ had_exception = true
+end
+swig_assert(had_exception, nil,
+ "Global_immutable_vars::specific_immutable_var is writable (expected to be immutable)")
+
+swig_assert(Global_immutable_vars::check_values(80, 41, 82, 83, 44) == 1, nil, "Check values failed")
diff --git a/Examples/test-suite/ruby/import_fragments_runme.rb b/Examples/test-suite/ruby/import_fragments_runme.rb
new file mode 100644
index 000000000..a529980c0
--- /dev/null
+++ b/Examples/test-suite/ruby/import_fragments_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+exception_file = nil
+
+begin
+ require 'import_fragments'
+rescue LoadError => e
+ # due to missing import_fragments_a
+ exception_file = e.respond_to?(:path) ? e.path : e.to_s.sub(/.* -- /, '')
+end
+
+swig_assert(exception_file == "import_fragments_a",
+ msg: "Loading should have failed due to missing 'import_fragments_a'")
+
diff --git a/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb b/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb
new file mode 100644
index 000000000..cec48a58c
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+
+require 'swig_assert'
+
+require 'li_std_auto_ptr'
+
+def gc_check(expected_count)
+# GC.start(full_mark: true, immediate_sweep: true)
+ GC.start
+# GC is not reliably run, skip check
+# swig_assert_equal_simple(expected_count, Li_std_auto_ptr::Klass::getTotal_count())
+end
+
+k1 = Li_std_auto_ptr::makeKlassAutoPtr("first")
+k2 = Li_std_auto_ptr::makeKlassAutoPtr("second")
+swig_assert_equal_simple(2, Li_std_auto_ptr::Klass::getTotal_count())
+
+gc_check(2)
+k1 = nil
+gc_check(1)
+
+swig_assert_equal_simple(k2.getLabel(), "second")
+gc_check(1)
+
+k2 = nil
+gc_check(0)
+
diff --git a/Examples/test-suite/ruby/li_std_containers_overload_runme.rb b/Examples/test-suite/ruby/li_std_containers_overload_runme.rb
new file mode 100644
index 000000000..913b6113a
--- /dev/null
+++ b/Examples/test-suite/ruby/li_std_containers_overload_runme.rb
@@ -0,0 +1,44 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'li_std_containers_overload'
+
+include Li_std_containers_overload
+
+def check(got, expected)
+ if (got != expected)
+ raise RuntimeError, "Failed check. '#{got}' != '#{expected}'"
+ end
+end
+
+v = VectorX.new()
+check(VectorOverload(v), "vector")
+
+v = VectorY.new()
+check(VectorOverload(v), "vector")
+
+v = VectorInt.new()
+check(VectorOverload(v), "vector")
+
+v = VectorString.new()
+check(VectorOverload(v), "vector")
+
+v = [X.new()]
+check(VectorOverload(v), "vector")
+
+v = [Y.new()]
+check(VectorOverload(v), "vector")
+
+v = [1, 2, 3]
+check(VectorOverload(v), "vector")
+
+v = ["aaa", "bbb", "ccc"]
+check(VectorOverload(v), "vector")
diff --git a/Examples/test-suite/ruby/li_std_functors_runme.rb b/Examples/test-suite/ruby/li_std_functors_runme.rb
index 5623d49f0..a2a7c6f3d 100644
--- a/Examples/test-suite/ruby/li_std_functors_runme.rb
+++ b/Examples/test-suite/ruby/li_std_functors_runme.rb
@@ -63,7 +63,9 @@ def test
yield method(:_map), Li_std_functors::Map
end
-# these should fail and not segfault
+# these should fail and not segfault but currently do segfault with Ruby 2.6
+# in GitHub Actions environment
+if RUBY_VERSION != '2.6.6'
begin
Li_std_functors::Set.new('sd')
rescue
@@ -72,5 +74,4 @@ end
test do |proc, container|
proc.call(container)
end
-
-
+end
diff --git a/Examples/test-suite/ruby/li_std_wstring_runme.rb b/Examples/test-suite/ruby/li_std_wstring_runme.rb
index 4922d8d90..170f80ebf 100644
--- a/Examples/test-suite/ruby/li_std_wstring_runme.rb
+++ b/Examples/test-suite/ruby/li_std_wstring_runme.rb
@@ -50,3 +50,10 @@ x = "abc\0def"
swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding)
swig_assert_equal("Li_std_wstring.test_ccvalue(x)", '"abc"', binding)
swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", '"abc"', binding)
+
+ts = Li_std_wstring::Wchar_test_struct.new
+ts.wchar_t_member = h
+swig_assert_equal("ts.wchar_t_member", "h", binding)
+ts.wchar_t_ptr_member = s
+swig_assert_equal("ts.wchar_t_ptr_member", "s", binding)
+
diff --git a/Examples/test-suite/ruby/multiple_inheritance_abstract_runme.rb b/Examples/test-suite/ruby/multiple_inheritance_abstract_runme.rb
new file mode 100644
index 000000000..01e9e6e4e
--- /dev/null
+++ b/Examples/test-suite/ruby/multiple_inheritance_abstract_runme.rb
@@ -0,0 +1,243 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Java counterpart.
+#
+
+require 'swig_assert'
+require 'multiple_inheritance_abstract'
+
+# Test base class as a parameter in Ruby
+
+def jcbase1b(cb1)
+ cb1.cbase1y
+end
+
+def jabase1(ab1)
+ ab1.abase1
+end
+
+def jcbase2(cb2)
+ cb2.cbase2
+end
+
+# test Derived1
+d1 = Multiple_inheritance_abstract::Derived1.new
+swig_assert_equal('d1.cbase1y', '3', binding, 'Derived1::cbase1y() failed')
+swig_assert_equal('d1.cbase2', '4', binding, 'Derived1::cbase2() failed')
+
+# test Derived2
+d2 = Multiple_inheritance_abstract::Derived2.new
+swig_assert_equal('d2.cbase1y', '6', binding, 'Derived2::cbase1y() failed')
+swig_assert_equal('d2.abase1', '5', binding, 'Derived2::cbase1y() failed')
+
+# test Derived3
+d3 = Multiple_inheritance_abstract::Derived3.new
+swig_assert_equal('d3.cbase1y', '7', binding, 'Derived3::cbase1y() failed')
+swig_assert_equal('d3.cbase2', '8', binding, 'Derived3::cbase2() failed')
+swig_assert_equal('d3.abase1', '9', binding, 'Derived3::abase1() failed')
+
+# test Bottom1
+b1 = Multiple_inheritance_abstract::Bottom1.new
+swig_assert_equal('b1.cbase1y', '103', binding, 'Bottom1::cbase1y() failed')
+swig_assert_equal('b1.cbase2', '104', binding, 'Bottom1::cbase2() failed')
+
+# test Bottom2
+b2 = Multiple_inheritance_abstract::Bottom2.new
+swig_assert_equal('b2.cbase1y', '206', binding, 'Bottom2::cbase1y() failed')
+swig_assert_equal('b2.abase1', '205', binding, 'Bottom2::abase1() failed')
+
+# test Bottom3
+b3 = Multiple_inheritance_abstract::Bottom3.new
+swig_assert_equal('b3.cbase1y', '307', binding, 'Bottom3::cbase1y() failed')
+swig_assert_equal('b3.cbase2', '308', binding, 'Bottom3::cbase2() failed')
+swig_assert_equal('b3.abase1', '309', binding, 'Bottom3::abase1() failed')
+
+# test interfaces from C++ classes
+cb1 = Multiple_inheritance_abstract::CBase1.new
+cb2 = Multiple_inheritance_abstract::CBase2.new
+swig_assert_equal('cb1.cbase1y', '1', binding, 'CBase1::cbase1y() failed')
+swig_assert_equal('cb2.cbase2', '2', binding, 'CBase2::cbase2() failed')
+
+# test nspace class as return value
+ab1 = d3.cloneit
+swig_assert_equal('ab1.abase1', '9', binding, 'Derived3::abase1() through ABase1 failed')
+
+# test concrete base class as return value
+cb6 = d2.cloneit
+cb7 = d1.cloneit
+swig_assert_equal('cb6.cbase1y', '6', binding, 'Derived2::cbase1y() through CBase1 failed')
+swig_assert_equal('cb7.cbase2', '4', binding, 'Derived1:cbase2() through ABase1 failed')
+
+# test multi inheritance
+cb3 = Multiple_inheritance_abstract::Derived1.new
+cb4 = Multiple_inheritance_abstract::Derived3.new
+cb5 = Multiple_inheritance_abstract::Derived3.new
+ab6 = Multiple_inheritance_abstract::Derived2.new
+swig_assert_equal('cb3.cbase1y', '3', binding, 'Derived1::cbase1y() through CBase1 failed')
+swig_assert_equal('cb4.cbase1y', '7', binding, 'Derived3::cbase1y() through CBase1 failed')
+swig_assert_equal('cb5.cbase2', '8', binding, 'Derived3::cbase2() through CBase2 failed')
+swig_assert_equal('ab6.abase1', '5', binding, 'Derived2::abase1() through ABase1 failed')
+
+# test base classes as parameter in Ruby
+swig_assert_equal('jcbase1b(d1)', '3', binding, 'jcbase1b() through Derived1 as parameter failed')
+swig_assert_equal('jcbase1b(d2)', '6', binding, 'jcbase1b() through Derived2 as parameter failed')
+swig_assert_equal('jcbase1b(d3)', '7', binding, 'jcbase1b() through Derived3 as parameter failed')
+swig_assert_equal('jcbase2(d1)', '4', binding, 'jcbase2() through Derived1 as parameter failed')
+swig_assert_equal('jcbase2(d3)', '8', binding, 'jcbase2() through Derived3 as parameter failed')
+swig_assert_equal('jabase1(d2)', '5', binding, 'jabase1() through Derived2 as parameter failed')
+swig_assert_equal('jabase1(d3)', '9', binding, 'jabase1() through Derived3 as parameter failed')
+
+# value parameters
+# test CBase1 CBase2 as parameters (note slicing for Derived and Bottom classes)
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase1(d1)', '1', binding, 'InputValCBase1(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase1(d2)', '1', binding, 'InputValCBase1(), Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase1(d3)', '1', binding, 'InputValCBase1(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase2(d3)', '2', binding, 'InputValCBase2(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase2(d1)', '2', binding, 'InputValCBase2(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase1(cb1)', '1', binding, 'InputValCBase1(), CBase1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase2(cb2)', '2', binding, 'InputValCBase2(), CBase2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase1(b1)', '1', binding, 'InputValCBase1(), Bottom1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase1(b2)', '1', binding, 'InputValCBase1(), Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase1(b3)', '1', binding, 'InputValCBase1(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase2(b3)', '2', binding, 'InputValCBase2(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValCBase2(b1)', '2', binding, 'InputValCBase2(), Bottom1 as a parameter failed')
+
+# pointer parameters
+# test ABase1 as a parameter
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrABase1(d2)', '5', binding, 'InputPtrABase1() through Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrABase1(d3)', '9', binding, 'InputPtrABase1() through Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrABase1(b2)', '205', binding, 'InputPtrABase1() through Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrABase1(b3)', '309', binding, 'InputPtrABase1() through Bottom3 as a parameter failed')
+
+# test CBase1 CBase2 as parameters
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase1(d1)', '3', binding, 'InputPtrCBase1(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase1(d2)', '6', binding, 'InputPtrCBase1(), Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase1(d3)', '7', binding, 'InputPtrCBase1(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase2(d3)', '8', binding, 'InputPtrCBase2(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase2(d1)', '4', binding, 'InputPtrCBase2(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase1(cb1)', '1', binding, 'InputPtrCBase1(), CBase1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase2(cb2)', '2', binding, 'InputPtrCBase2(), CBase2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase1(b1)', '103', binding, 'InputPtrCBase1(), Bottom1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase1(b2)', '206', binding, 'InputPtrCBase1(), Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase1(b3)', '307', binding, 'InputPtrCBase1(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase2(b3)', '308', binding, 'InputPtrCBase2(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrCBase2(b1)', '104', binding, 'InputPtrCBase2(), Bottom1 as a parameter failed')
+
+# reference parameters
+# test ABase1 as a parameter
+swig_assert_equal('Multiple_inheritance_abstract::InputRefABase1(d2)', '5', binding, 'InputRefABase1() through Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefABase1(d3)', '9', binding, 'InputRefABase1() through Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefABase1(b2)', '205', binding, 'InputRefABase1() through Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefABase1(b3)', '309', binding, 'InputRefABase1() through Bottom3 as a parameter failed')
+
+# test CBase1 CBase2 as parameters
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase1(d1)', '3', binding, 'InputRefCBase1(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase1(d2)', '6', binding, 'InputRefCBase1(), Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase1(d3)', '7', binding, 'InputRefCBase1(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase2(d3)', '8', binding, 'InputRefCBase2(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase2(d1)', '4', binding, 'InputRefCBase2(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase1(cb1)', '1', binding, 'InputRefCBase1(), CBase1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase2(cb2)', '2', binding, 'InputRefCBase2(), CBase2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase1(b1)', '103', binding, 'InputRefCBase1(), Bottom1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase1(b2)', '206', binding, 'InputRefCBase1(), Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase1(b3)', '307', binding, 'InputRefCBase1(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase2(b3)', '308', binding, 'InputRefCBase2(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefCBase2(b1)', '104', binding, 'InputRefCBase2(), Bottom1 as a parameter failed')
+
+# const reference pointer parameters
+# test ABase1 as a parameter
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefABase1(d2)', '5', binding, 'InputCPtrRefABase1() through Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefABase1(d3)', '9', binding, 'InputCPtrRefABase1() through Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefABase1(b2)', '205', binding, 'InputCPtrRefABase1() through Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefABase1(b3)', '309', binding, 'InputCPtrRefABase1() through Bottom3 as a parameter failed')
+
+# test CBase1 CBase2 as parameters
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase1(d1)', '3', binding, 'InputCPtrRefCBase1(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase1(d2)', '6', binding, 'InputCPtrRefCBase1(), Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase1(d3)', '7', binding, 'InputCPtrRefCBase1(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase2(d3)', '8', binding, 'InputCPtrRefCBase2(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase2(d1)', '4', binding, 'InputCPtrRefCBase2(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase1(cb1)', '1', binding, 'InputCPtrRefCBase1(), CBase1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase2(cb2)', '2', binding, 'InputCPtrRefCBase2(), CBase2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase1(b1)', '103', binding, 'InputCPtrRefCBase1(), Bottom1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase1(b2)', '206', binding, 'InputCPtrRefCBase1(), Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase1(b3)', '307', binding, 'InputCPtrRefCBase1(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase2(b3)', '308', binding, 'InputCPtrRefCBase2(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefCBase2(b1)', '104', binding, 'InputCPtrRefCBase2(), Bottom1 as a parameter failed')
+
+# derived classes as parameters
+swig_assert_equal('Multiple_inheritance_abstract::InputValDerived1(d1)', '3+4', binding, 'InputValDerived1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValDerived2(d2)', '6+5', binding, 'InputValDerived2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValDerived3(d3)', '7+8+9', binding, 'InputValDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputRefDerived1(d1)', '3+4', binding, 'InputRefDerived1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefDerived2(d2)', '6+5', binding, 'InputRefDerived2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefDerived3(d3)', '7+8+9', binding, 'InputRefDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrDerived1(d1)', '3+4', binding, 'InputPtrDerived1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrDerived2(d2)', '6+5', binding, 'InputPtrDerived2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrDerived3(d3)', '7+8+9', binding, 'InputPtrDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefDerived1(d1)', '3+4', binding, 'InputCPtrRefDerived1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefDerived2(d2)', '6+5', binding, 'InputCPtrRefDerived2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefDerived3(d3)', '7+8+9', binding, 'InputCPtrRefDerived3() failed')
+
+# bottom classes as Derived parameters
+swig_assert_equal('Multiple_inheritance_abstract::InputValDerived1(b1)', '3+4', binding, 'InputValDerived1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValDerived2(b2)', '6+5', binding, 'InputValDerived2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValDerived3(b3)', '7+8+9', binding, 'InputValDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputRefDerived1(b1)', '103+104', binding, 'InputRefDerived1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefDerived2(b2)', '206+205', binding, 'InputRefDerived2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefDerived3(b3)', '307+308+309', binding, 'InputRefDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrDerived1(b1)', '103+104', binding, 'InputPtrDerived1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrDerived2(b2)', '206+205', binding, 'InputPtrDerived2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrDerived3(b3)', '307+308+309', binding, 'InputPtrDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefDerived1(b1)', '103+104', binding, 'InputCPtrRefDerived1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefDerived2(b2)', '206+205', binding, 'InputCPtrRefDerived2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefDerived3(b3)', '307+308+309', binding, 'InputCPtrRefDerived3() failed')
+
+# bottom classes as Bottom parameters
+swig_assert_equal('Multiple_inheritance_abstract::InputValBottom1(b1)', '103+104', binding, 'InputValBottom1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValBottom2(b2)', '206+205', binding, 'InputValBottom2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputValBottom3(b3)', '307+308+309', binding, 'InputValBottom3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputRefBottom1(b1)', '103+104', binding, 'InputRefBottom1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefBottom2(b2)', '206+205', binding, 'InputRefBottom2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputRefBottom3(b3)', '307+308+309', binding, 'InputRefBottom3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrBottom1(b1)', '103+104', binding, 'InputPtrBottom1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrBottom2(b2)', '206+205', binding, 'InputPtrBottom2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputPtrBottom3(b3)', '307+308+309', binding, 'InputPtrBottom3() failed')
+
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefBottom1(b1)', '103+104', binding, 'InputCPtrRefBottom1() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefBottom2(b2)', '206+205', binding, 'InputCPtrRefBottom2() failed')
+swig_assert_equal('Multiple_inheritance_abstract::InputCPtrRefBottom3(b3)', '307+308+309', binding, 'InputCPtrRefBottom3() failed')
+
+# return pointers
+swig_assert_equal('Multiple_inheritance_abstract::MakePtrDerived1_CBase1().cbase1y', '3', binding, 'MakePtrDerived1_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakePtrDerived1_CBase2().cbase2', '4', binding, 'MakePtrDerived1_CBase2 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakePtrDerived2_CBase1().cbase1y', '6', binding, 'MakePtrDerived2_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakePtrDerived2_ABase1().abase1', '5', binding, 'MakePtrDerived2_ABase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakePtrDerived3_ABase1().abase1', '9', binding, 'MakePtrDerived3_ABase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakePtrDerived3_CBase1().cbase1y', '7', binding, 'MakePtrDerived3_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakePtrDerived3_CBase2().cbase2', '8', binding, 'MakePtrDerived3_CBase2 failed')
+
+# return references
+swig_assert_equal('Multiple_inheritance_abstract::MakeRefDerived1_CBase1().cbase1y', '3', binding, 'MakeRefDerived1_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeRefDerived1_CBase2().cbase2', '4', binding, 'MakeRefDerived1_CBase2 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeRefDerived2_CBase1().cbase1y', '6', binding, 'MakeRefDerived2_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeRefDerived2_ABase1().abase1', '5', binding, 'MakeRefDerived2_ABase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeRefDerived3_ABase1().abase1', '9', binding, 'MakeRefDerived3_ABase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeRefDerived3_CBase1().cbase1y', '7', binding, 'MakeRefDerived3_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeRefDerived3_CBase2().cbase2', '8', binding, 'MakeRefDerived3_CBase2 failed')
+
+# return by value (sliced objects)
+swig_assert_equal('Multiple_inheritance_abstract::MakeValDerived1_CBase1().cbase1y', '1', binding, 'MakeValDerived1_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeValDerived1_CBase2().cbase2', '2', binding, 'MakeValDerived1_CBase2 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeValDerived2_CBase1().cbase1y', '1', binding, 'MakeValDerived2_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeValDerived3_CBase1().cbase1y', '1', binding, 'MakeValDerived3_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_abstract::MakeValDerived3_CBase2().cbase2', '2', binding, 'MakeValDerived3_CBase2 failed')
+
diff --git a/Examples/test-suite/ruby/multiple_inheritance_nspace_runme.rb b/Examples/test-suite/ruby/multiple_inheritance_nspace_runme.rb
new file mode 100644
index 000000000..fb28a0f83
--- /dev/null
+++ b/Examples/test-suite/ruby/multiple_inheritance_nspace_runme.rb
@@ -0,0 +1,243 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Java counterpart.
+#
+
+require 'swig_assert'
+require 'multiple_inheritance_nspace'
+
+# Test base class as a parameter in Ruby
+
+def jcbase1b(cb1)
+ cb1.cbase1y
+end
+
+def jabase1(ab1)
+ ab1.abase1
+end
+
+def jcbase2(cb2)
+ cb2.cbase2
+end
+
+# test Derived1
+d1 = Multiple_inheritance_nspace::Derived1.new
+swig_assert_equal('d1.cbase1y', '3', binding, 'Derived1::cbase1y() failed')
+swig_assert_equal('d1.cbase2', '4', binding, 'Derived1::cbase2() failed')
+
+# test Derived2
+d2 = Multiple_inheritance_nspace::Derived2.new
+swig_assert_equal('d2.cbase1y', '6', binding, 'Derived2::cbase1y() failed')
+swig_assert_equal('d2.abase1', '5', binding, 'Derived2::cbase1y() failed')
+
+# test Derived3
+d3 = Multiple_inheritance_nspace::Derived3.new
+swig_assert_equal('d3.cbase1y', '7', binding, 'Derived3::cbase1y() failed')
+swig_assert_equal('d3.cbase2', '8', binding, 'Derived3::cbase2() failed')
+swig_assert_equal('d3.abase1', '9', binding, 'Derived3::abase1() failed')
+
+# test Bottom1
+b1 = Multiple_inheritance_nspace::Bottom1.new
+swig_assert_equal('b1.cbase1y', '103', binding, 'Bottom1::cbase1y() failed')
+swig_assert_equal('b1.cbase2', '104', binding, 'Bottom1::cbase2() failed')
+
+# test Bottom2
+b2 = Multiple_inheritance_nspace::Bottom2.new
+swig_assert_equal('b2.cbase1y', '206', binding, 'Bottom2::cbase1y() failed')
+swig_assert_equal('b2.abase1', '205', binding, 'Bottom2::abase1() failed')
+
+# test Bottom3
+b3 = Multiple_inheritance_nspace::Bottom3.new
+swig_assert_equal('b3.cbase1y', '307', binding, 'Bottom3::cbase1y() failed')
+swig_assert_equal('b3.cbase2', '308', binding, 'Bottom3::cbase2() failed')
+swig_assert_equal('b3.abase1', '309', binding, 'Bottom3::abase1() failed')
+
+# test interfaces from C++ classes
+cb1 = Multiple_inheritance_nspace::CBase1.new
+cb2 = Multiple_inheritance_nspace::CBase2.new
+swig_assert_equal('cb1.cbase1y', '1', binding, 'CBase1::cbase1y() failed')
+swig_assert_equal('cb2.cbase2', '2', binding, 'CBase2::cbase2() failed')
+
+# test nspace class as return value
+ab1 = d3.cloneit
+swig_assert_equal('ab1.abase1', '9', binding, 'Derived3::abase1() through ABase1 failed')
+
+# test concrete base class as return value
+cb6 = d2.cloneit
+cb7 = d1.cloneit
+swig_assert_equal('cb6.cbase1y', '6', binding, 'Derived2::cbase1y() through CBase1 failed')
+swig_assert_equal('cb7.cbase2', '4', binding, 'Derived1:cbase2() through ABase1 failed')
+
+# test multi inheritance
+cb3 = Multiple_inheritance_nspace::Derived1.new
+cb4 = Multiple_inheritance_nspace::Derived3.new
+cb5 = Multiple_inheritance_nspace::Derived3.new
+ab6 = Multiple_inheritance_nspace::Derived2.new
+swig_assert_equal('cb3.cbase1y', '3', binding, 'Derived1::cbase1y() through CBase1 failed')
+swig_assert_equal('cb4.cbase1y', '7', binding, 'Derived3::cbase1y() through CBase1 failed')
+swig_assert_equal('cb5.cbase2', '8', binding, 'Derived3::cbase2() through CBase2 failed')
+swig_assert_equal('ab6.abase1', '5', binding, 'Derived2::abase1() through ABase1 failed')
+
+# test base classes as parameter in Ruby
+swig_assert_equal('jcbase1b(d1)', '3', binding, 'jcbase1b() through Derived1 as parameter failed')
+swig_assert_equal('jcbase1b(d2)', '6', binding, 'jcbase1b() through Derived2 as parameter failed')
+swig_assert_equal('jcbase1b(d3)', '7', binding, 'jcbase1b() through Derived3 as parameter failed')
+swig_assert_equal('jcbase2(d1)', '4', binding, 'jcbase2() through Derived1 as parameter failed')
+swig_assert_equal('jcbase2(d3)', '8', binding, 'jcbase2() through Derived3 as parameter failed')
+swig_assert_equal('jabase1(d2)', '5', binding, 'jabase1() through Derived2 as parameter failed')
+swig_assert_equal('jabase1(d3)', '9', binding, 'jabase1() through Derived3 as parameter failed')
+
+# value parameters
+# test CBase1 CBase2 as parameters (note slicing for Derived and Bottom classes)
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase1(d1)', '1', binding, 'InputValCBase1(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase1(d2)', '1', binding, 'InputValCBase1(), Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase1(d3)', '1', binding, 'InputValCBase1(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase2(d3)', '2', binding, 'InputValCBase2(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase2(d1)', '2', binding, 'InputValCBase2(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase1(cb1)', '1', binding, 'InputValCBase1(), CBase1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase2(cb2)', '2', binding, 'InputValCBase2(), CBase2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase1(b1)', '1', binding, 'InputValCBase1(), Bottom1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase1(b2)', '1', binding, 'InputValCBase1(), Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase1(b3)', '1', binding, 'InputValCBase1(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase2(b3)', '2', binding, 'InputValCBase2(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValCBase2(b1)', '2', binding, 'InputValCBase2(), Bottom1 as a parameter failed')
+
+# pointer parameters
+# test ABase1 as a parameter
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrABase1(d2)', '5', binding, 'InputPtrABase1() through Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrABase1(d3)', '9', binding, 'InputPtrABase1() through Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrABase1(b2)', '205', binding, 'InputPtrABase1() through Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrABase1(b3)', '309', binding, 'InputPtrABase1() through Bottom3 as a parameter failed')
+
+# test CBase1 CBase2 as parameters
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase1(d1)', '3', binding, 'InputPtrCBase1(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase1(d2)', '6', binding, 'InputPtrCBase1(), Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase1(d3)', '7', binding, 'InputPtrCBase1(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase2(d3)', '8', binding, 'InputPtrCBase2(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase2(d1)', '4', binding, 'InputPtrCBase2(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase1(cb1)', '1', binding, 'InputPtrCBase1(), CBase1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase2(cb2)', '2', binding, 'InputPtrCBase2(), CBase2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase1(b1)', '103', binding, 'InputPtrCBase1(), Bottom1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase1(b2)', '206', binding, 'InputPtrCBase1(), Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase1(b3)', '307', binding, 'InputPtrCBase1(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase2(b3)', '308', binding, 'InputPtrCBase2(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrCBase2(b1)', '104', binding, 'InputPtrCBase2(), Bottom1 as a parameter failed')
+
+# reference parameters
+# test ABase1 as a parameter
+swig_assert_equal('Multiple_inheritance_nspace::InputRefABase1(d2)', '5', binding, 'InputRefABase1() through Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefABase1(d3)', '9', binding, 'InputRefABase1() through Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefABase1(b2)', '205', binding, 'InputRefABase1() through Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefABase1(b3)', '309', binding, 'InputRefABase1() through Bottom3 as a parameter failed')
+
+# test CBase1 CBase2 as parameters
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase1(d1)', '3', binding, 'InputRefCBase1(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase1(d2)', '6', binding, 'InputRefCBase1(), Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase1(d3)', '7', binding, 'InputRefCBase1(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase2(d3)', '8', binding, 'InputRefCBase2(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase2(d1)', '4', binding, 'InputRefCBase2(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase1(cb1)', '1', binding, 'InputRefCBase1(), CBase1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase2(cb2)', '2', binding, 'InputRefCBase2(), CBase2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase1(b1)', '103', binding, 'InputRefCBase1(), Bottom1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase1(b2)', '206', binding, 'InputRefCBase1(), Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase1(b3)', '307', binding, 'InputRefCBase1(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase2(b3)', '308', binding, 'InputRefCBase2(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefCBase2(b1)', '104', binding, 'InputRefCBase2(), Bottom1 as a parameter failed')
+
+# const reference pointer parameters
+# test ABase1 as a parameter
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefABase1(d2)', '5', binding, 'InputCPtrRefABase1() through Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefABase1(d3)', '9', binding, 'InputCPtrRefABase1() through Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefABase1(b2)', '205', binding, 'InputCPtrRefABase1() through Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefABase1(b3)', '309', binding, 'InputCPtrRefABase1() through Bottom3 as a parameter failed')
+
+# test CBase1 CBase2 as parameters
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase1(d1)', '3', binding, 'InputCPtrRefCBase1(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase1(d2)', '6', binding, 'InputCPtrRefCBase1(), Derived2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase1(d3)', '7', binding, 'InputCPtrRefCBase1(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase2(d3)', '8', binding, 'InputCPtrRefCBase2(), Derived3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase2(d1)', '4', binding, 'InputCPtrRefCBase2(), Derived1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase1(cb1)', '1', binding, 'InputCPtrRefCBase1(), CBase1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase2(cb2)', '2', binding, 'InputCPtrRefCBase2(), CBase2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase1(b1)', '103', binding, 'InputCPtrRefCBase1(), Bottom1 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase1(b2)', '206', binding, 'InputCPtrRefCBase1(), Bottom2 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase1(b3)', '307', binding, 'InputCPtrRefCBase1(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase2(b3)', '308', binding, 'InputCPtrRefCBase2(), Bottom3 as a parameter failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefCBase2(b1)', '104', binding, 'InputCPtrRefCBase2(), Bottom1 as a parameter failed')
+
+# derived classes as parameters
+swig_assert_equal('Multiple_inheritance_nspace::InputValDerived1(d1)', '3+4', binding, 'InputValDerived1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValDerived2(d2)', '6+5', binding, 'InputValDerived2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValDerived3(d3)', '7+8+9', binding, 'InputValDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputRefDerived1(d1)', '3+4', binding, 'InputRefDerived1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefDerived2(d2)', '6+5', binding, 'InputRefDerived2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefDerived3(d3)', '7+8+9', binding, 'InputRefDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrDerived1(d1)', '3+4', binding, 'InputPtrDerived1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrDerived2(d2)', '6+5', binding, 'InputPtrDerived2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrDerived3(d3)', '7+8+9', binding, 'InputPtrDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefDerived1(d1)', '3+4', binding, 'InputCPtrRefDerived1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefDerived2(d2)', '6+5', binding, 'InputCPtrRefDerived2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefDerived3(d3)', '7+8+9', binding, 'InputCPtrRefDerived3() failed')
+
+# bottom classes as Derived parameters
+swig_assert_equal('Multiple_inheritance_nspace::InputValDerived1(b1)', '3+4', binding, 'InputValDerived1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValDerived2(b2)', '6+5', binding, 'InputValDerived2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValDerived3(b3)', '7+8+9', binding, 'InputValDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputRefDerived1(b1)', '103+104', binding, 'InputRefDerived1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefDerived2(b2)', '206+205', binding, 'InputRefDerived2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefDerived3(b3)', '307+308+309', binding, 'InputRefDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrDerived1(b1)', '103+104', binding, 'InputPtrDerived1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrDerived2(b2)', '206+205', binding, 'InputPtrDerived2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrDerived3(b3)', '307+308+309', binding, 'InputPtrDerived3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefDerived1(b1)', '103+104', binding, 'InputCPtrRefDerived1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefDerived2(b2)', '206+205', binding, 'InputCPtrRefDerived2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefDerived3(b3)', '307+308+309', binding, 'InputCPtrRefDerived3() failed')
+
+# bottom classes as Bottom parameters
+swig_assert_equal('Multiple_inheritance_nspace::InputValBottom1(b1)', '103+104', binding, 'InputValBottom1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValBottom2(b2)', '206+205', binding, 'InputValBottom2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputValBottom3(b3)', '307+308+309', binding, 'InputValBottom3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputRefBottom1(b1)', '103+104', binding, 'InputRefBottom1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefBottom2(b2)', '206+205', binding, 'InputRefBottom2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputRefBottom3(b3)', '307+308+309', binding, 'InputRefBottom3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrBottom1(b1)', '103+104', binding, 'InputPtrBottom1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrBottom2(b2)', '206+205', binding, 'InputPtrBottom2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputPtrBottom3(b3)', '307+308+309', binding, 'InputPtrBottom3() failed')
+
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefBottom1(b1)', '103+104', binding, 'InputCPtrRefBottom1() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefBottom2(b2)', '206+205', binding, 'InputCPtrRefBottom2() failed')
+swig_assert_equal('Multiple_inheritance_nspace::InputCPtrRefBottom3(b3)', '307+308+309', binding, 'InputCPtrRefBottom3() failed')
+
+# return pointers
+swig_assert_equal('Multiple_inheritance_nspace::MakePtrDerived1_CBase1().cbase1y', '3', binding, 'MakePtrDerived1_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakePtrDerived1_CBase2().cbase2', '4', binding, 'MakePtrDerived1_CBase2 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakePtrDerived2_CBase1().cbase1y', '6', binding, 'MakePtrDerived2_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakePtrDerived2_ABase1().abase1', '5', binding, 'MakePtrDerived2_ABase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakePtrDerived3_ABase1().abase1', '9', binding, 'MakePtrDerived3_ABase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakePtrDerived3_CBase1().cbase1y', '7', binding, 'MakePtrDerived3_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakePtrDerived3_CBase2().cbase2', '8', binding, 'MakePtrDerived3_CBase2 failed')
+
+# return references
+swig_assert_equal('Multiple_inheritance_nspace::MakeRefDerived1_CBase1().cbase1y', '3', binding, 'MakeRefDerived1_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeRefDerived1_CBase2().cbase2', '4', binding, 'MakeRefDerived1_CBase2 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeRefDerived2_CBase1().cbase1y', '6', binding, 'MakeRefDerived2_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeRefDerived2_ABase1().abase1', '5', binding, 'MakeRefDerived2_ABase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeRefDerived3_ABase1().abase1', '9', binding, 'MakeRefDerived3_ABase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeRefDerived3_CBase1().cbase1y', '7', binding, 'MakeRefDerived3_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeRefDerived3_CBase2().cbase2', '8', binding, 'MakeRefDerived3_CBase2 failed')
+
+# return by value (sliced objects)
+swig_assert_equal('Multiple_inheritance_nspace::MakeValDerived1_CBase1().cbase1y', '1', binding, 'MakeValDerived1_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeValDerived1_CBase2().cbase2', '2', binding, 'MakeValDerived1_CBase2 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeValDerived2_CBase1().cbase1y', '1', binding, 'MakeValDerived2_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeValDerived3_CBase1().cbase1y', '1', binding, 'MakeValDerived3_CBase1 failed')
+swig_assert_equal('Multiple_inheritance_nspace::MakeValDerived3_CBase2().cbase2', '2', binding, 'MakeValDerived3_CBase2 failed')
+
diff --git a/Examples/test-suite/ruby/namespace_chase_runme.rb b/Examples/test-suite/ruby/namespace_chase_runme.rb
new file mode 100644
index 000000000..c5f227dfd
--- /dev/null
+++ b/Examples/test-suite/ruby/namespace_chase_runme.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Java counterpart.
+#
+
+require 'swig_assert'
+require 'namespace_chase'
+
+s1a = Namespace_chase::Struct1A.new
+s1b = Namespace_chase::Struct1B.new
+s1c = Namespace_chase::Struct1C.new
+
+Namespace_chase.sss3a(s1a, s1b, s1c)
+Namespace_chase.sss3b(s1a, s1b, s1c)
diff --git a/Examples/test-suite/ruby/namespace_class_runme.rb b/Examples/test-suite/ruby/namespace_class_runme.rb
new file mode 100644
index 000000000..fd9345814
--- /dev/null
+++ b/Examples/test-suite/ruby/namespace_class_runme.rb
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'swig_assert'
+require 'namespace_class'
+
+begin
+ p = Namespace_class::Private1.new
+ raise SwigRubyError.new("Private1 is private")
+rescue NameError => e
+ # OK
+end
+
+begin
+ p = Namespace_class::Private2.new
+ raise SwigRubyError.new("Private2 is private")
+rescue NameError => e
+ # OK
+end
+
+Namespace_class::EulerT3D.toFrame(1, 1, 1)
+
+b = Namespace_class::BooT_i.new
+b = Namespace_class::BooT_H.new
+
+
+f = Namespace_class::FooT_i.new
+f.quack(1)
+
+f = Namespace_class::FooT_d.new
+f.moo(1)
+
+f = Namespace_class::FooT_H.new
+f.foo(Namespace_class::Hi)
+
+f_type = f.class.to_s
+swig_assert_equal('f_type', '"Namespace_class::FooT_H"', binding)
+
diff --git a/Examples/test-suite/ruby/namespace_forward_declaration_runme.rb b/Examples/test-suite/ruby/namespace_forward_declaration_runme.rb
new file mode 100644
index 000000000..0e6b50eb8
--- /dev/null
+++ b/Examples/test-suite/ruby/namespace_forward_declaration_runme.rb
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Java counterpart.
+#
+
+require 'swig_assert'
+require 'namespace_forward_declaration'
+
+xxx = Namespace_forward_declaration::XXX.new
+Namespace_forward_declaration.testXXX1(xxx)
+Namespace_forward_declaration.testXXX2(xxx)
+Namespace_forward_declaration.testXXX3(xxx)
+yyy = Namespace_forward_declaration::YYY.new
+Namespace_forward_declaration.testYYY1(yyy)
+Namespace_forward_declaration.testYYY2(yyy)
+Namespace_forward_declaration.testYYY3(yyy)
diff --git a/Examples/test-suite/ruby/namespace_virtual_method_runme.rb b/Examples/test-suite/ruby/namespace_virtual_method_runme.rb
new file mode 100644
index 000000000..54e4a7a21
--- /dev/null
+++ b/Examples/test-suite/ruby/namespace_virtual_method_runme.rb
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'namespace_virtual_method'
+
+x = Namespace_virtual_method::Spam.new
diff --git a/Examples/test-suite/ruby/nested_class_runme.rb b/Examples/test-suite/ruby/nested_class_runme.rb
new file mode 100644
index 000000000..2cf3bf96a
--- /dev/null
+++ b/Examples/test-suite/ruby/nested_class_runme.rb
@@ -0,0 +1,54 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Java counterpart.
+#
+
+require 'swig_assert'
+require 'nested_class'
+
+outer = Nested_class::Outer.new
+is1 = outer.makeInnerStruct1
+ic1 = outer.makeInnerClass1
+iu1 = outer.makeInnerUnion1
+
+is2 = outer.makeInnerStruct2
+ic2 = outer.makeInnerClass2
+iu2 = outer.makeInnerUnion2
+
+ic4 = outer.makeInnerClass4Typedef
+is4 = outer.makeInnerStruct4Typedef
+iu4 = outer.makeInnerUnion4Typedef
+
+ic5 = outer.makeInnerClass5
+is5 = outer.makeInnerStruct5
+iu5 = outer.makeInnerUnion5
+
+ic5 = outer.makeInnerClass5Typedef
+is5 = outer.makeInnerStruct5Typedef
+iu5 = outer.makeInnerUnion5Typedef
+
+im1 = outer.MultipleInstance1
+im2 = outer.MultipleInstance2
+im3 = outer.MultipleInstance3
+im4 = outer.MultipleInstance4
+
+im1 = outer.MultipleDerivedInstance1
+im2 = outer.MultipleDerivedInstance2
+im3 = outer.MultipleDerivedInstance3
+im4 = outer.MultipleDerivedInstance4
+
+im1 = outer.MultipleDerivedInstance1
+im2 = outer.MultipleDerivedInstance2
+im3 = outer.MultipleDerivedInstance3
+im4 = outer.MultipleDerivedInstance4
+
+mat1 = outer.makeInnerMultipleAnonTypedef1
+mat2 = outer.makeInnerMultipleAnonTypedef2
+mat3 = outer.makeInnerMultipleAnonTypedef3
+
+mnt = outer.makeInnerMultipleNamedTypedef
+mnt1 = outer.makeInnerMultipleNamedTypedef1
+mnt2 = outer.makeInnerMultipleNamedTypedef2
+mnt3 = outer.makeInnerMultipleNamedTypedef3
+
+isn = outer.makeInnerSameName
diff --git a/Examples/test-suite/ruby/nested_directors_runme.rb b/Examples/test-suite/ruby/nested_directors_runme.rb
new file mode 100644
index 000000000..b2020b3d4
--- /dev/null
+++ b/Examples/test-suite/ruby/nested_directors_runme.rb
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its C# counterpart.
+#
+
+require 'swig_assert'
+require 'nested_directors'
+
+# nested classes not yet supported
+#class CNested < Nested_directors::Base::Nest
+# def GetValue
+# true
+# end
+#end
+
+class CSub < Nested_directors::Sub
+ def GetValue
+ super
+ end
+ def Test
+ GetValue()
+ end
+end
+
+#n = CNested.new
+#swig_assert('n.GetValue()', binding)
+
+s = CSub.new
+swig_assert('s.Test()', binding)
diff --git a/Examples/test-suite/ruby/nested_in_template_runme.rb b/Examples/test-suite/ruby/nested_in_template_runme.rb
new file mode 100644
index 000000000..4d3b721a1
--- /dev/null
+++ b/Examples/test-suite/ruby/nested_in_template_runme.rb
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'swig_assert'
+require 'nested_in_template'
+
+
+cd = Nested_in_template::ConcreteDerived.new(88)
+swig_assert_equal('cd.m_value', '88', binding, 'ConcreteDerived not created correctly')
diff --git a/Examples/test-suite/ruby/nested_scope_flat_runme.rb b/Examples/test-suite/ruby/nested_scope_flat_runme.rb
new file mode 100644
index 000000000..bd7ee7c91
--- /dev/null
+++ b/Examples/test-suite/ruby/nested_scope_flat_runme.rb
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+#
+# Check the availability of expected classes and their member variables.
+#
+
+require 'swig_assert'
+require 'nested_scope_flat'
+
+Nested_scope_flat::Global_.new
+Nested_scope_flat::Outer1.new
+nested2 = Nested_scope_flat::Nested2.new
+nested2.data = 42
+swig_assert_equal("nested2.data", "42", binding)
+Nested_scope_flat::Klass.new
+
+Nested_scope_flat::Abstract_int
+cannot_instantiate = false
+begin
+ Nested_scope_flat::Abstract_int.new
+rescue TypeError
+ cannot_instantiate = true
+end
+swig_assert_simple(cannot_instantiate)
+
+Nested_scope_flat::Real.new.Method()
diff --git a/Examples/test-suite/ruby/nested_template_base_runme.rb b/Examples/test-suite/ruby/nested_template_base_runme.rb
new file mode 100644
index 000000000..a4f293365
--- /dev/null
+++ b/Examples/test-suite/ruby/nested_template_base_runme.rb
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'swig_assert'
+require 'nested_template_base'
+
+ois = Nested_template_base::InnerS.new(123)
+oic = Nested_template_base::InnerC.new
+
+# Check base method is available
+swig_assert_equal('oic.outer(ois).val', '123', binding, 'Wrong value calling outer')
+
+# Check non-derived class using base class
+swig_assert_equal('oic.innerc().outer(ois).val', '123', binding, 'Wrong value calling innerc')
diff --git a/Examples/test-suite/ruby/nested_workaround_runme.rb b/Examples/test-suite/ruby/nested_workaround_runme.rb
new file mode 100644
index 000000000..645bdd321
--- /dev/null
+++ b/Examples/test-suite/ruby/nested_workaround_runme.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is derived from its Java counterpart.
+#
+
+require 'swig_assert'
+require 'nested_workaround'
+
+begin
+ inner = Nested_workaround::Inner.new(5)
+ outer = Nested_workaround::Outer.new
+ newInner = outer.doubleInnerValue(inner)
+ swig_assert_equal("newInner.getValue", "10", binding)
+end
+
+begin
+ outer = Nested_workaround::Outer.new
+ inner = outer.createInner(3)
+ newInner = outer.doubleInnerValue(inner)
+ swig_assert_equal("outer.getInnerValue(newInner)", "6", binding)
+end
diff --git a/Examples/test-suite/ruby/newobject2_runme.rb b/Examples/test-suite/ruby/newobject2_runme.rb
index 04129f4aa..b7ebea097 100644
--- a/Examples/test-suite/ruby/newobject2_runme.rb
+++ b/Examples/test-suite/ruby/newobject2_runme.rb
@@ -18,10 +18,12 @@ require 'newobject2'
include Newobject2
GC.track_class = Foo
+GC.disable
GC.stats if $VERBOSE
100.times { foo1 = makeFoo }
GC.stats if $VERBOSE
swig_assert( 'fooCount == 100', nil, "but is #{fooCount}" )
+GC.enable
GC.start
swig_assert( 'fooCount <= 1', nil, "but is #{fooCount}" )
diff --git a/Examples/test-suite/ruby/preproc_runme.rb b/Examples/test-suite/ruby/preproc_runme.rb
new file mode 100644
index 000000000..4b4a9157d
--- /dev/null
+++ b/Examples/test-suite/ruby/preproc_runme.rb
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'swig_assert'
+
+# This extension to the Warning class is intended for suppressing expected
+# Ruby warning messages about invalid or redefined Ruby constants - basically
+# the equivalent of %warnfilter(SWIGWARN_RUBY_WRONG_NAME) but for the moment
+# the wrapper library is loaded by the Ruby interpreter.
+# Note: This only works for Ruby 2.4 and later
+if Object.const_defined?(:Warning) && Warning.respond_to?(:warn)
+ module CustomWarningFilter
+ def warn(*args)
+ msg = args[0]
+ if msg =~ /[Aa]lready initialized constant Preproc::A[56]/ ||
+ msg =~ /invalid name .?__GMP_HAVE_/
+ # ignore
+ else
+ super
+ end
+ end
+ end
+ Warning.extend CustomWarningFilter
+end
+
+require 'preproc'
+
+swig_assert_equal('Preproc::endif', '1', binding)
+swig_assert_equal('Preproc::define', '1', binding)
+swig_assert_equal('Preproc::ddefined', '1', binding)
+
+swig_assert_equal('2 * Preproc::One', 'Preproc::Two', binding)
+
+swig_assert_equal('Preproc::methodX(99)', '199', binding)
+
+t1 = Preproc::TcxMessageTest
+t2 = Preproc::TcxMessageBug
+
diff --git a/Examples/test-suite/ruby/ruby_global_immutable_vars_cpp_runme.rb b/Examples/test-suite/ruby/ruby_global_immutable_vars_cpp_runme.rb
new file mode 100644
index 000000000..5523b59f4
--- /dev/null
+++ b/Examples/test-suite/ruby/ruby_global_immutable_vars_cpp_runme.rb
@@ -0,0 +1,48 @@
+#!/usr/bin/env ruby
+#
+# C++ version of ruby_global_immutable_vars_runme.rb.
+#
+
+require 'swig_assert'
+
+require 'ruby_global_immutable_vars_cpp'
+
+# first check if all variables can be read
+swig_assert_each_line( < e
+ had_exception = true
+end
+swig_assert(had_exception, nil,
+ "$global_immutable_var is writable (expected to be immutable)")
+
+had_exception = false
+begin
+ $specific_immutable_var = 81
+rescue NameError => e
+ had_exception = true
+end
+swig_assert(had_exception, nil,
+ "$specific_immutable_var is writable (expected to be immutable)")
+
+swig_assert(check_values(80, 41, 82, 83, 44) == 1, nil, "Check values failed")
diff --git a/Examples/test-suite/ruby/ruby_global_immutable_vars_runme.rb b/Examples/test-suite/ruby/ruby_global_immutable_vars_runme.rb
new file mode 100644
index 000000000..45a8506ba
--- /dev/null
+++ b/Examples/test-suite/ruby/ruby_global_immutable_vars_runme.rb
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+#
+# This test program is similar to global_immutable_vars_runme.rb
+# with the difference that the global variables to check are also
+# Ruby global variables (SWIG Ruby option "-globalmodule").
+#
+# Immutable global variables shall throw a NameError exception.
+#
+
+require 'swig_assert'
+
+require 'ruby_global_immutable_vars'
+
+# first check if all variables can be read
+swig_assert_each_line( < e
+ had_exception = true
+end
+swig_assert(had_exception, nil,
+ "$global_immutable_var is writable (expected to be immutable)")
+
+had_exception = false
+begin
+ $specific_immutable_var = 81
+rescue NameError => e
+ had_exception = true
+end
+swig_assert(had_exception, nil,
+ "$specific_immutable_var is writable (expected to be immutable)")
+
+swig_assert(check_values(80, 41, 82, 83, 44) == 1, nil, "Check values failed")
diff --git a/Examples/test-suite/ruby/template_nested_flat_runme.rb b/Examples/test-suite/ruby/template_nested_flat_runme.rb
new file mode 100644
index 000000000..5d0907f80
--- /dev/null
+++ b/Examples/test-suite/ruby/template_nested_flat_runme.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Java counterpart.
+#
+
+require 'swig_assert'
+require 'template_nested_flat'
+
+Template_nested_flat::T_NormalTemplateNormalClass.new.tmethod(Template_nested_flat::NormalClass.new)
+Template_nested_flat::OuterClass.new.T_OuterTMethodNormalClass(Template_nested_flat::NormalClass.new)
+
+tf = Template_nested_flat::TemplateFuncs.new
+swig_assert_equal("tf.T_TemplateFuncs1Int(-10)", "-10", binding)
+swig_assert_equal("tf.T_TemplateFuncs2Double(-12.3)", "-12.3", binding)
+
+tn = Template_nested_flat::T_NestedOuterTemplateDouble.new
+swig_assert_equal("tn.hohum(-12.3)", "-12.3", binding)
+
+inner1 = Template_nested_flat::OuterClass.new.useInner1(Template_nested_flat::T_OuterClassInner1Int.new)
+inner2 = Template_nested_flat::T_OuterClassInner2NormalClass.new
+inner2.embeddedVar = 2
+inner22 = Template_nested_flat::OuterClass.new.useInner2Again(inner2)
+inner3 = Template_nested_flat::T_OuterClassInner1Double.new
diff --git a/Examples/test-suite/ruby/template_static_runme.rb b/Examples/test-suite/ruby/template_static_runme.rb
new file mode 100644
index 000000000..83c40e177
--- /dev/null
+++ b/Examples/test-suite/ruby/template_static_runme.rb
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+#
+# This test implementation is directly derived from its Python counterpart.
+#
+
+require 'template_static'
+
+Template_static::Foo_i.test
+Template_static::Foo_d.test
+Template_static::Foo::test
+Template_static::Foo::bar_double(1)
+
diff --git a/Examples/test-suite/ruby_global_immutable_vars.i b/Examples/test-suite/ruby_global_immutable_vars.i
new file mode 100644
index 000000000..6f067d269
--- /dev/null
+++ b/Examples/test-suite/ruby_global_immutable_vars.i
@@ -0,0 +1,34 @@
+%module ruby_global_immutable_vars
+
+// This copy of global_immutable_vars.i shall be compiled with the
+// SWIG Ruby option "-globalmodule" in order to check the code path
+// for registering global methods (in contrast to module methods).
+
+%inline %{
+ int default_mutable_var = 40;
+%}
+
+%immutable;
+%feature("immutable", "0") specific_mutable_var;
+
+%inline %{
+ int global_immutable_var = 41;
+ int specific_mutable_var = 42;
+%}
+
+%mutable;
+%immutable specific_immutable_var;
+%inline %{
+ int global_mutable_var = 43;
+ int specific_immutable_var = 44;
+
+ int check_values(int default_mutable, int global_immutable, int specific_mutable, int global_mutable, int specific_immutable) {
+ return
+ default_mutable == default_mutable_var &&
+ global_immutable == global_immutable_var &&
+ specific_mutable == specific_mutable_var &&
+ global_mutable == global_mutable_var &&
+ specific_immutable == specific_immutable_var;
+ }
+%}
+
diff --git a/Examples/test-suite/ruby_global_immutable_vars_cpp.i b/Examples/test-suite/ruby_global_immutable_vars_cpp.i
new file mode 100644
index 000000000..511390e20
--- /dev/null
+++ b/Examples/test-suite/ruby_global_immutable_vars_cpp.i
@@ -0,0 +1,32 @@
+%module ruby_global_immutable_vars_cpp
+
+// C++ version of ruby_global_immutable_vars.i
+
+%inline %{
+ int default_mutable_var = 40;
+%}
+
+%immutable;
+%feature("immutable", "0") specific_mutable_var;
+
+%inline %{
+ int global_immutable_var = 41;
+ int specific_mutable_var = 42;
+%}
+
+%mutable;
+%immutable specific_immutable_var;
+%inline %{
+ int global_mutable_var = 43;
+ int specific_immutable_var = 44;
+
+ int check_values(int default_mutable, int global_immutable, int specific_mutable, int global_mutable, int specific_immutable) {
+ return
+ default_mutable == default_mutable_var &&
+ global_immutable == global_immutable_var &&
+ specific_mutable == specific_mutable_var &&
+ global_mutable == global_mutable_var &&
+ specific_immutable == specific_immutable_var;
+ }
+%}
+
diff --git a/Examples/test-suite/schemerunme/li_typemaps.scm b/Examples/test-suite/schemerunme/li_typemaps.scm
index 161e803bb..a24bbdaf0 100644
--- a/Examples/test-suite/schemerunme/li_typemaps.scm
+++ b/Examples/test-suite/schemerunme/li_typemaps.scm
@@ -24,8 +24,8 @@
;(check "ulonglong" 6432 =)
;; The checking of inoutr-int2 and out-foo is done in the individual
-;; language runme scripts, since chicken returns multiple values
-;; and must be checked with call-with-values, while guile just returns a list
+;; language runme scripts, since how multiple values are returned
+;; differs between scheme variants.
;(call-with-values (lambda () (inoutr-int2 3 -2))
; (lambda (a b)
diff --git a/Examples/test-suite/schemerunme/li_typemaps_proxy.scm b/Examples/test-suite/schemerunme/li_typemaps_proxy.scm
index f61d4fee5..07bb8556f 100644
--- a/Examples/test-suite/schemerunme/li_typemaps_proxy.scm
+++ b/Examples/test-suite/schemerunme/li_typemaps_proxy.scm
@@ -24,8 +24,8 @@
(check "ulonglong" 6432 =)
;; The checking of inoutr-int2 and out-foo is done in the individual
-;; language runme scripts, since chicken returns multiple values
-;; and must be checked with call-with-values, while guile just returns a list
+;; language runme scripts, since how multiple values are returned
+;; differs between scheme variants.
;(call-with-values (lambda () (inoutr-int2 3 -2))
; (lambda (a b)
diff --git a/Examples/test-suite/sizet.i b/Examples/test-suite/sizet.i
index 537914155..6b70f680d 100644
--- a/Examples/test-suite/sizet.i
+++ b/Examples/test-suite/sizet.i
@@ -3,9 +3,7 @@
#include
%}
-#ifndef SWIGCHICKEN
%include "std_common.i"
-#endif
%inline
{
diff --git a/Examples/test-suite/template_default.i b/Examples/test-suite/template_default.i
index d771ef09e..83ffd5427 100644
--- a/Examples/test-suite/template_default.i
+++ b/Examples/test-suite/template_default.i
@@ -196,7 +196,6 @@ namespace ns1 {
%}
-#ifndef SWIGCHICKEN
%include std_vector.i
%{
@@ -211,6 +210,3 @@ void q(double = 0) {}
%constant void (*Bf)(std::vector *p = 0) = g;
%constant void (*Cf)(double = 0) = q;
-
-
-#endif
diff --git a/Examples/test-suite/template_nested.i b/Examples/test-suite/template_nested.i
index 67668fb1a..941ec9e3a 100644
--- a/Examples/test-suite/template_nested.i
+++ b/Examples/test-suite/template_nested.i
@@ -1,11 +1,11 @@
%module template_nested
-#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
-%feature ("flatnested");
-#endif
-
// Test nested templates - that is template classes and template methods within a class.
+#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
+#pragma SWIG nowarn=SWIGWARN_PARSE_NAMED_NESTED_CLASS
+#endif
+
namespace ns {
template struct ForwardTemplate;
}
diff --git a/Examples/test-suite/template_nested_flat.i b/Examples/test-suite/template_nested_flat.i
new file mode 100644
index 000000000..3c1d8bfef
--- /dev/null
+++ b/Examples/test-suite/template_nested_flat.i
@@ -0,0 +1,7 @@
+%module template_nested_flat
+
+// Test nested templates ("flatnested" version of template_nested.i)
+
+%feature ("flatnested");
+
+%include "template_nested.i"
diff --git a/Examples/test-suite/template_static.i b/Examples/test-suite/template_static.i
index bbca99490..dafb9ca5c 100644
--- a/Examples/test-suite/template_static.i
+++ b/Examples/test-suite/template_static.i
@@ -19,6 +19,7 @@ template int foo::test = 0;
namespace toto {
class Foo {
public:
+ static int test;
template
static double bar(int i) {
return 1.0;
@@ -28,6 +29,7 @@ namespace toto {
int i;
};
}
+int toto::Foo::test = 5;
%}
%template(bar_double) toto::Foo::bar;
diff --git a/Examples/test-suite/template_template_parameters.i b/Examples/test-suite/template_template_parameters.i
index 89197229e..53b18b0b0 100644
--- a/Examples/test-suite/template_template_parameters.i
+++ b/Examples/test-suite/template_template_parameters.i
@@ -2,6 +2,9 @@
%inline %{
+
+/* part 1 */
+
namespace pfc {
template class t_alloc> class array_t {};
template class alloc_fast {
@@ -16,7 +19,7 @@
class list_tt : public list_impl_t > {
public:
t_item item;
-// typename t_alloc::alloc_type allotype; // SWIG can't handle this yet
+ typename t_alloc::alloc_type allotype; // SWIG can handle this now
void xx() {
typename t_alloc::alloc_type atype; // this type is the same as t_item type
atype = true;
@@ -29,11 +32,42 @@ void TestInstantiations() {
(void) myArrayInt;
(void) myListImplInt;
}
+
+/* part 2 */
+
+template
+struct Container1 {
+ T x;
+};
+template
+struct Container2 {
+ U x;
+};
+template class TemplateTemplateT>
+struct TestStruct {
+ TemplateTemplateT x;
+};
+
+TestStruct TestStructContainer1Method(TestStruct ts1) {
+ ts1.x.x += 10;
+ return ts1;
+}
+
%}
+/* part 1 */
%template(ListImplFastBool) list_impl_t >;
%template(ListFastBool) list_tt;
%template(ListImplFastDouble) list_impl_t >;
%template(ListDefaultDouble) list_tt;
+%template(BoolAllocFast) pfc::alloc_fast;
+%template(DoubleAllocFast) pfc::alloc_fast;
+
+/* part 2 */
+%template(IntContainer1) Container1;
+%template(FloatContainer2) Container2;
+%template(IntTestStruct) TestStruct;
+%template(FloatTestStruct) TestStruct;
+
diff --git a/Examples/test-suite/typemap_template_parms.i b/Examples/test-suite/typemap_template_parms.i
index fd0f7f51a..90231e827 100644
--- a/Examples/test-suite/typemap_template_parms.i
+++ b/Examples/test-suite/typemap_template_parms.i
@@ -26,3 +26,16 @@ template struct X {
%}
%template(Xint) X;
+
+
+// The function name and parameter name are both 'labels'
+%inline %{
+template
+void labels(T labels) {}
+void voido(int vooo) {}
+%}
+
+// TODO: R has a problem with parameter names clashing with the function name
+#if !defined(SWIGR)
+%template(ShortLabels) labels;
+#endif
diff --git a/Examples/test-suite/types_directive.i b/Examples/test-suite/types_directive.i
index 26cb6aeeb..530c338ae 100644
--- a/Examples/test-suite/types_directive.i
+++ b/Examples/test-suite/types_directive.i
@@ -19,10 +19,11 @@ struct Date {
};
struct Time1 {
- Time1(unsigned int year, unsigned int month, unsigned int day, unsigned int seconds) : date(year, month, day), seconds(seconds) {}
+ Time1(unsigned int year, unsigned int month, unsigned int day, unsigned int seconds) : padding(), date(year, month, day), seconds(seconds) {}
Date &dateFromTime() {
return date;
}
+ unsigned int padding; // so that memory layout is not the same as Date
Date date;
unsigned int seconds;
};
diff --git a/Examples/test-suite/uffi/Makefile.in b/Examples/test-suite/uffi/Makefile.in
deleted file mode 100644
index 5d6dc110c..000000000
--- a/Examples/test-suite/uffi/Makefile.in
+++ /dev/null
@@ -1,51 +0,0 @@
-#######################################################################
-# Makefile for uffi test-suite
-#######################################################################
-
-LANGUAGE = uffi
-UFFI = @UFFIBIN@
-SCRIPTSUFFIX = _runme.lisp
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
-
-include $(srcdir)/../common.mk
-
-# Overridden variables here
-# no C++ tests for now
-CPP_TEST_CASES =
-#C_TEST_CASES +=
-
-# Custom tests - tests with additional commandline options
-# none!
-
-# Rules for the different types of tests
-%.cpptest:
- $(setup)
- +$(swig_and_compile_cpp)
- $(run_testcase)
-
-%.ctest:
- $(setup)
- +$(swig_and_compile_c)
- $(run_testcase)
-
-%.multicpptest:
- $(setup)
- +$(swig_and_compile_multi_cpp)
- $(run_testcase)
-
-# Runs the testcase. A testcase is only run if
-# a file is found which has _runme.lisp appended after the testcase name.
-run_testcase = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(UFFI) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
- fi
-
-# Clean: (does nothing, we dont generate extra uffi code)
-%.clean:
- @exit 0
-
-clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' uffi_clean
diff --git a/Examples/test-suite/varargs.i b/Examples/test-suite/varargs.i
index dd56cb073..68c7a1714 100644
--- a/Examples/test-suite/varargs.i
+++ b/Examples/test-suite/varargs.i
@@ -1,17 +1,31 @@
-// Tests SWIG's *default* handling of varargs (function varargs, not preprocessor varargs).
+// Tests SWIG's handling of varargs (function varargs, not preprocessor varargs).
// The default behavior is to simply ignore the varargs.
%module varargs
+// Default handling of varargs
+
+%inline %{
+char *test(const char *fmt, ...) {
+ return (char *) fmt;
+}
+
+struct VarargConstructor {
+ char *str;
+ VarargConstructor(const char *fmt, ...) {
+ str = new char[strlen(fmt) + 1];
+ strcpy(str, fmt);
+ }
+};
+%}
+
+// %varargs support
+
%varargs(int mode = 0) test_def;
%varargs(int mode = 0) Foo::Foo;
%varargs(int mode = 0) Foo::statictest(const char*fmt, ...);
%varargs(2, int mode = 0) test_plenty(const char*fmt, ...);
%inline %{
-char *test(const char *fmt, ...) {
- return (char *) fmt;
-}
-
const char *test_def(const char *fmt, ...) {
return fmt;
}
@@ -40,5 +54,4 @@ public:
const char *test_plenty(const char *fmt, ...) {
return fmt;
}
-
%}
diff --git a/Lib/allegrocl/allegrocl.swg b/Lib/allegrocl/allegrocl.swg
deleted file mode 100644
index 524aa7c11..000000000
--- a/Lib/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
-#include
-%}
diff --git a/Lib/allegrocl/inout_typemaps.i b/Lib/allegrocl/inout_typemaps.i
deleted file mode 100644
index d8d61feed..000000000
--- a/Lib/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/Lib/allegrocl/longlongs.i b/Lib/allegrocl/longlongs.i
deleted file mode 100644
index a15adcdda..000000000
--- a/Lib/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/Lib/allegrocl/std_list.i b/Lib/allegrocl/std_list.i
deleted file mode 100644
index a3660c9f7..000000000
--- a/Lib/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;
- * %template (floatlist) std::list;
- * ----------------------------------------------------------------------------- */
-
-%module std_list
-%warnfilter(468) std::list;
-
-%{
-#include
-#include
-%}
-
-
-namespace std{
- template 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 &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::iterator first = self->begin();
- int size = int(self->size());
- if (i<0) i += size;
- if (i>=0 && i::iterator first = self->begin();
- int size = int(self->size());
- if (i<0) i += size;
- if (i>=0 && i::iterator first = self->begin();
- int size = int(self->size());
- if (i<0) i += size;
- if (i>=0 && ierase(first);
- }
- else throw std::out_of_range("list index out of range");
- }
- std::list __getslice__(int i,int j)
- {
- std::list::iterator first = self->begin();
- std::list::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=0)
- {
- for (int k=0;k 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::iterator first = self->begin();
- std::list::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;kerase(first,end);
- }
- void __setslice__(int i,int j, const std::list& v)
- {
- std::list::iterator first = self->begin();
- std::list::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;kerase(first,end);
- if (i+1 <= int(self->size()))
- {
- first = self->begin();
- for (int k=0;kinsert(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/Lib/allegrocl/std_string.i b/Lib/allegrocl/std_string.i
deleted file mode 100644
index cbcd250a9..000000000
--- a/Lib/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
-%warnfilter(404) std::string;
-%warnfilter(404) std::wstring;
-
-%{
-#include
-%}
-
-// %include
-
-// %naturalvar std::string;
-// %naturalvar std::wstring;
-
-namespace std {
- typedef unsigned long size_t;
- typedef signed long ptrdiff_t;
-
- template 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 &operator = ( const basic_string &ws );
- basic_string &operator = ( const charT *str );
- basic_string &append( const basic_string &other );
- basic_string &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 &other ) const;
- int compare( const charT *str ) const;
- basic_string &insert( size_type pos,
- const basic_string &str );
- size_type find( const basic_string &other, int pos = 0 ) const;
- size_type find( charT c, int pos = 0 ) const;
- %extend {
- bool operator == ( const basic_string &other ) const {
- return self->compare( other ) == 0;
- }
- bool operator != ( const basic_string &other ) const {
- return self->compare( other ) != 0;
- }
- bool operator < ( const basic_string &other ) const {
- return self->compare( other ) == -1;
- }
- bool operator > ( const basic_string &other ) const {
- return self->compare( other ) == 1;
- }
- bool operator <= ( const basic_string &other ) const {
- return self->compare( other ) != 1;
- }
- bool operator >= ( const basic_string &other ) const {
- return self->compare( other ) != -1;
- }
-
- }
- };
-
- %template(string) basic_string;
- %template(wstring) basic_string;
-
- %apply char * { string };
- %apply wchar_t * { wstring };
-
- typedef basic_string string;
- typedef basic_string 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 &str_v );
-
-// %{
-// SWIGEXT char **c_charptr_array( const std::vector &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;
-
-// %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/Lib/allegrocl/typemaps.i b/Lib/allegrocl/typemaps.i
deleted file mode 100644
index 293d1cd34..000000000
--- a/Lib/allegrocl/typemaps.i
+++ /dev/null
@@ -1,4 +0,0 @@
-/* Unused for Allegro CL module */
-
-%include "inout_typemaps.i"
-%include "longlongs.i"
diff --git a/Lib/cdata.i b/Lib/cdata.i
index 3e16f31ec..602c59faf 100644
--- a/Lib/cdata.i
+++ b/Lib/cdata.i
@@ -43,7 +43,7 @@ typedef struct SWIGCDATA {
$2 = $input->len;
}
-#elif SWIGPHP7
+#elif SWIGPHP
%typemap(out) SWIGCDATA {
ZVAL_STRINGL($result, $1.data, $1.len);
diff --git a/Lib/chicken/chicken.swg b/Lib/chicken/chicken.swg
deleted file mode 100644
index 7df676754..000000000
--- a/Lib/chicken/chicken.swg
+++ /dev/null
@@ -1,809 +0,0 @@
-/* -----------------------------------------------------------------------------
- * chicken.swg
- *
- * CHICKEN configuration module.
- * ----------------------------------------------------------------------------- */
-
-/* chicken.h has to appear first. */
-
-%insert(runtime) %{
-#include
-#include
-%}
-
-%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 {
- $<ype 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
-
-/* 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/Lib/chicken/chickenkw.swg b/Lib/chicken/chickenkw.swg
deleted file mode 100644
index d2c26c74c..000000000
--- a/Lib/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/Lib/chicken/chickenrun.swg b/Lib/chicken/chickenrun.swg
deleted file mode 100644
index bb14b4bc9..000000000
--- a/Lib/chicken/chickenrun.swg
+++ /dev/null
@@ -1,375 +0,0 @@
-/* -----------------------------------------------------------------------------
- * chickenrun.swg
- * ----------------------------------------------------------------------------- */
-
-#include
-#include
-#include
-#include
-#include
-#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/Lib/chicken/extra-install.list b/Lib/chicken/extra-install.list
deleted file mode 100644
index 48721cee0..000000000
--- a/Lib/chicken/extra-install.list
+++ /dev/null
@@ -1,3 +0,0 @@
-swigclosprefix.scm
-multi-generic.scm
-tinyclos-multi-generic.patch
diff --git a/Lib/chicken/multi-generic.scm b/Lib/chicken/multi-generic.scm
deleted file mode 100644
index 9d2e31d34..000000000
--- a/Lib/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 (make
- 'name "multi-generic"
- 'direct-supers (list )
- '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 )
- (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 )
- (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 )
- (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 '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/Lib/chicken/std_string.i b/Lib/chicken/std_string.i
deleted file mode 100644
index fa77c1533..000000000
--- a/Lib/chicken/std_string.i
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -----------------------------------------------------------------------------
- * std_string.i
- *
- * SWIG typemaps for std::string
- * ----------------------------------------------------------------------------- */
-
-%{
-#include
-%}
-
-namespace std {
- %naturalvar string;
-
-
- %insert(closprefix) %{ (declare (hide )) %}
- %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/Lib/chicken/swigclosprefix.scm b/Lib/chicken/swigclosprefix.scm
deleted file mode 100644
index e4bd72b71..000000000
--- a/Lib/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 () (void))
-
-(define-method (compute-getter-and-setter (class ) 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/Lib/chicken/tinyclos-multi-generic.patch b/Lib/chicken/tinyclos-multi-generic.patch
deleted file mode 100644
index 2e585960e..000000000
--- a/Lib/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
-
---- 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 (make-primitive-class "structure"))
- (define (make-primitive-class "procedure" ))
- (define (make-primitive-class "end-of-file"))
--(define (make-primitive-class "environment" )) ; (Benedikt insisted on this)
-+(define (make-primitive-class "environment" ))
- (define (make-primitive-class "hash-table" ))
- (define (make-primitive-class "promise" ))
- (define (make-primitive-class "queue" ))
diff --git a/Lib/chicken/typemaps.i b/Lib/chicken/typemaps.i
deleted file mode 100644
index fd587fd68..000000000
--- a/Lib/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
- double fadd(double *INPUT, double *INPUT);
-
-or you can use the %apply directive :
-
- %include
- %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
- double modf(double x, double *OUTPUT);
-
-or you can use the %apply directive :
-
- %include
- %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
- void neg(double *INOUT);
-
-or you can use the %apply directive :
-
- %include
- %apply double *INOUT { double *x };
- void neg(double *x);
-
-As well, you can wrap variables with :
-
- %include
- %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/Lib/clisp/clisp.swg b/Lib/clisp/clisp.swg
deleted file mode 100644
index e1d330cb3..000000000
--- a/Lib/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/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg
index 832206386..0e180f576 100644
--- a/Lib/csharp/csharp.swg
+++ b/Lib/csharp/csharp.swg
@@ -875,6 +875,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 +894,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.
diff --git a/Lib/csharp/std_auto_ptr.i b/Lib/csharp/std_auto_ptr.i
index d7e5f167e..1d91c9872 100644
--- a/Lib/csharp/std_auto_ptr.i
+++ b/Lib/csharp/std_auto_ptr.i
@@ -1,5 +1,5 @@
/*
- The typemaps here allow to handle functions returning std::auto_ptr<>,
+ The typemaps here allow handling 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).
diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i
index 79fb5a8cf..1ece767da 100644
--- a/Lib/csharp/wchar.i
+++ b/Lib/csharp/wchar.i
@@ -53,7 +53,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
// wchar_t
%typemap(ctype) wchar_t "wchar_t"
-%typemap(imtype) wchar_t "char"
+%typemap(imtype) wchar_t "char" // Requires adding CharSet=CharSet.Unicode to the DllImport to correctly marshal Unicode characters
%typemap(cstype) wchar_t "char"
%typemap(csin) wchar_t "$csinput"
@@ -92,7 +92,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
} %}
%typemap(csvarout, excode=SWIGEXCODE2) wchar_t * %{
get {
- string ret = $imcall;$excode
+ string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
return ret;
} %}
diff --git a/Lib/d/wrapperloader.swg b/Lib/d/wrapperloader.swg
index b3c1d0dcf..67e03bfc8 100644
--- a/Lib/d/wrapperloader.swg
+++ b/Lib/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;
diff --git a/Lib/exception.i b/Lib/exception.i
index ee9ce9bc6..7508b409b 100644
--- a/Lib/exception.i
+++ b/Lib/exception.i
@@ -12,10 +12,20 @@
%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)
+#if PHP_MAJOR >= 8
+# define SWIG_HANDLE_VALUE_ERROR_FOR_PHP8 code == SWIG_ValueError ? zend_ce_value_error :
+#else
+# define SWIG_HANDLE_VALUE_ERROR_FOR_PHP8
+#endif
+#define SWIG_exception(code, msg) do { zend_throw_exception( \
+ code == SWIG_TypeError ? zend_ce_type_error : \
+ SWIG_HANDLE_VALUE_ERROR_FOR_PHP8 \
+ 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
diff --git a/Lib/go/goruntime.swg b/Lib/go/goruntime.swg
index 269a4eefd..c3401b1a8 100644
--- a/Lib/go/goruntime.swg
+++ b/Lib/go/goruntime.swg
@@ -23,46 +23,38 @@ static void* Swig_malloc(int c) {
%}
-#if SWIGGO_CGO
%insert(cgo_comment_typedefs) %{
#include
%}
-#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 +81,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 +88,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 +107,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")
diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i
index cfccced88..84a754d8b 100644
--- a/Lib/guile/typemaps.i
+++ b/Lib/guile/typemaps.i
@@ -378,26 +378,26 @@ typedef unsigned long SCM;
#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);
}
}
%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));
}
/* ------------------------------------------------------------
diff --git a/Lib/java/arrays_java.i b/Lib/java/arrays_java.i
index dd38438a3..a57da64b4 100644
--- a/Lib/java/arrays_java.i
+++ b/Lib/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[] */
diff --git a/Lib/java/director.swg b/Lib/java/director.swg
index d3bd162ec..e911a3da7 100644
--- a/Lib/java/director.swg
+++ b/Lib/java/director.swg
@@ -215,6 +215,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_;
@@ -238,6 +247,11 @@ namespace Swig {
}
}
+ jclass swig_new_global_ref(JNIEnv *jenv, const char *classname) {
+ jclass clz = jenv->FindClass(classname);
+ return clz ? (jclass)jenv->NewGlobalRef(clz) : 0;
+ }
+
public:
Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() {
/* Acquire the Java VM pointer */
diff --git a/Lib/java/java.swg b/Lib/java/java.swg
index e9309331a..8f95f3a3b 100644
--- a/Lib/java/java.swg
+++ b/Lib/java/java.swg
@@ -1196,6 +1196,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 */
diff --git a/Lib/java/javahead.swg b/Lib/java/javahead.swg
index 685bba198..1fc327909 100644
--- a/Lib/java/javahead.swg
+++ b/Lib/java/javahead.swg
@@ -5,7 +5,7 @@
* ----------------------------------------------------------------------------- */
-/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so
+/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so
* that the same typemaps can be used for generating code for both C and C++. The SWIG preprocessor can expand
* the macros thereby generating the correct calling convention. It is thus essential that all typemaps that
* use the macros are not within %{ %} brackets as they won't be run through the SWIG preprocessor. */
@@ -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
#include
#include
@@ -50,15 +38,16 @@
%insert(runtime) %{
/* Support for throwing Java exceptions */
typedef enum {
- SWIG_JavaOutOfMemoryError = 1,
- SWIG_JavaIOException,
- SWIG_JavaRuntimeException,
+ SWIG_JavaOutOfMemoryError = 1,
+ SWIG_JavaIOException,
+ SWIG_JavaRuntimeException,
SWIG_JavaIndexOutOfBoundsException,
SWIG_JavaArithmeticException,
SWIG_JavaIllegalArgumentException,
SWIG_JavaNullPointerException,
SWIG_JavaDirectorPureVirtual,
- SWIG_JavaUnknownError
+ SWIG_JavaUnknownError,
+ SWIG_JavaIllegalStateException,
} SWIG_JavaExceptionCodes;
typedef struct {
@@ -80,6 +69,7 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC
{ SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
{ SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
{ SWIG_JavaUnknownError, "java/lang/UnknownError" },
+ { SWIG_JavaIllegalStateException, "java/lang/IllegalStateException" },
{ (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" }
};
const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
diff --git a/Lib/java/std_auto_ptr.i b/Lib/java/std_auto_ptr.i
index 9b3cd7315..69ac2841f 100644
--- a/Lib/java/std_auto_ptr.i
+++ b/Lib/java/std_auto_ptr.i
@@ -1,5 +1,5 @@
/*
- The typemaps here allow to handle functions returning std::auto_ptr<>,
+ The typemaps here allow handling 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).
diff --git a/Lib/java/swiginterface.i b/Lib/java/swiginterface.i
index 334464157..0a0f7806a 100644
--- a/Lib/java/swiginterface.i
+++ b/Lib/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)"
diff --git a/Lib/javascript/jsc/arrays_javascript.i b/Lib/javascript/jsc/arrays_javascript.i
index b9199d86b..713b7ef23 100644
--- a/Lib/javascript/jsc/arrays_javascript.i
+++ b/Lib/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)) {}
-%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY]
- (int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
+%define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH)
+
+%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;
+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)
- $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutInt", int)
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutNumber", double)
- // Get each element from array
- for (i = 0; i < length; i++)
- {
- jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL);
-
- // Get primitive value from JSObject
- res = SWIG_AsVal(double)(jsvalue, &temp);
- if (!SWIG_IsOK(res))
- {
- SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
- }
- arg$argnum[i] = temp;
- }
-
- }
- else
- {
- SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
- }
-}
-
-%typemap(freearg) double[], double[ANY] {
- free($1);
-}
-
-%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0)
-{
- length = $1_dim0;
- JSValueRef values[length];
-
- for (i = 0; i < length; i++)
- {
- values[i] = SWIG_From(double)($1[i]);
- }
-
- $result = JSObjectMakeArray(context, length, values, NULL);
-}
diff --git a/Lib/javascript/jsc/ccomplex.i b/Lib/javascript/jsc/ccomplex.i
index 50f0f95fe..e58dbf719 100644
--- a/Lib/javascript/jsc/ccomplex.i
+++ b/Lib/javascript/jsc/ccomplex.i
@@ -12,15 +12,16 @@
#include
%}
+#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/Lib/javascript/jsc/javascriptcomplex.swg b/Lib/javascript/jsc/javascriptcomplex.swg
index 7be120b3b..dcc205dbd 100644
--- a/Lib/javascript/jsc/javascriptcomplex.swg
+++ b/Lib/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/Lib/javascript/jsc/javascriptinit.swg b/Lib/javascript/jsc/javascriptinit.swg
index a32ba336c..b0138b39a 100644
--- a/Lib/javascript/jsc/javascriptinit.swg
+++ b/Lib/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/Lib/javascript/jsc/javascriptrun.swg b/Lib/javascript/jsc/javascriptrun.swg
index 4a8fc5be5..d092ea4ab 100644
--- a/Lib/javascript/jsc/javascriptrun.swg
+++ b/Lib/javascript/jsc/javascriptrun.swg
@@ -117,27 +117,25 @@ 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 (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) {
+ if (flags & SWIG_POINTER_DISOWN) {
cdata->swigCMemOwn = false;
}
@@ -317,6 +315,30 @@ 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;
@@ -324,6 +346,8 @@ JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueR
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/Lib/javascript/jsc/javascriptruntime.swg b/Lib/javascript/jsc/javascriptruntime.swg
index 8f8390890..a626390cc 100644
--- a/Lib/javascript/jsc/javascriptruntime.swg
+++ b/Lib/javascript/jsc/javascriptruntime.swg
@@ -11,6 +11,7 @@
#include
#include
#include
+#include
%}
%insert(runtime) "swigrun.swg"; /* SWIG API */
diff --git a/Lib/javascript/v8/arrays_javascript.i b/Lib/javascript/v8/arrays_javascript.i
index 22b50be8f..6dc7e4b9b 100644
--- a/Lib/javascript/v8/arrays_javascript.i
+++ b/Lib/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)) {}
-%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY]
- (int length = 0, v8::Local array, v8::Local jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
- if ($input->IsArray())
- {
+%define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH)
+
+%typemap(in, fragment=NAME) CTYPE[ANY] {
+ if ($input->IsArray()) {
// Convert into Array
- array = v8::Local::Cast($input);
+ v8::Local array = v8::Local::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 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 array = v8::Array::New(length);
+%enddef
- for (i = 0; i < length; i++)
- {
- array->Set(i, SWIG_From(int)($1[i]));
+%define JAVASCRIPT_ARRAYS_OUT_DECL(NAME, CTYPE)
+
+%typemap(out, fragment=NAME) CTYPE[ANY] {
+ int length = $1_dim0;
+ v8::Local array = SWIGV8_ARRAY_NEW(length);
+
+ for (int i = 0; i < length; i++) {
+ SWIGV8_ARRAY_SET(array, i, SWIG_From(CTYPE)($1[i]));
}
-
$result = array;
}
-%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY]
- (int length = 0, v8::Local array, v8::Local jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
- if ($input->IsArray())
- {
- // Convert into Array
- array = v8::Local::Cast($input);
+%enddef
- length = $1_dim0;
+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)
- $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutInt", int)
+JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutNumber", double)
- // Get each element from array
- for (i = 0; i < length; i++)
- {
- jsvalue = array->Get(i);
-
- // Get primitive value from JSObject
- res = SWIG_AsVal(double)(jsvalue, &temp);
- if (!SWIG_IsOK(res))
- {
- SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
- }
- arg$argnum[i] = temp;
- }
-
- }
- else
- {
- SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
- }
-}
-
-%typemap(freearg) double[], double[ANY] {
- free($1);
-}
-
-%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0)
-{
- length = $1_dim0;
- v8::Local array = v8::Array::New(length);
-
- for (i = 0; i < length; i++)
- {
- array->Set(i, SWIG_From(double)($1[i]));
- }
-
-
- $result = array;
-}
diff --git a/Lib/javascript/v8/ccomplex.i b/Lib/javascript/v8/ccomplex.i
index 8eda920bb..e58dbf719 100644
--- a/Lib/javascript/v8/ccomplex.i
+++ b/Lib/javascript/v8/ccomplex.i
@@ -6,21 +6,22 @@
* ----------------------------------------------------------------------------- */
-%include
+%include
%{
#include
%}
+#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/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
index c4aaf3db0..2abed9488 100644
--- a/Lib/javascript/v8/javascriptcode.swg
+++ b/Lib/javascript/v8/javascriptcode.swg
@@ -10,9 +10,10 @@
%fragment("js_ctor", "templates") %{
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
-
- v8::Handle self = args.Holder();
+
+ SWIGV8_OBJECT self = args.Holder();
$jslocals
+ if(self->InternalFieldCount() < 1) SWIG_exception_fail(SWIG_ERROR, "Illegal call of constructor $jswrapper.");
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
@@ -53,7 +54,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
OverloadErrorHandler errorHandler;
- v8::Handle self;
+ SWIGV8_VALUE self;
// switch all cases by means of series of if-returns.
$jsdispatchcases
@@ -77,9 +78,10 @@ fail:
%fragment("js_overloaded_ctor", "templates") %{
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
SWIGV8_HANDLESCOPE();
-
- v8::Handle self = args.Holder();
+
+ SWIGV8_OBJECT self = args.Holder();
$jslocals
+ if(self->InternalFieldCount() < 1) SWIG_exception_fail(SWIG_ERROR, "Illegal call of constructor $jswrapper.");
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
@@ -226,7 +228,7 @@ static SwigV8ReturnValue $jswrapper(v8::Local property, const SwigV8Pr
#endif
SWIGV8_HANDLESCOPE();
- v8::Handle jsresult;
+ SWIGV8_VALUE jsresult;
$jslocals
$jscode
SWIGV8_RETURN_INFO(jsresult, info);
@@ -271,7 +273,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle jsresult;
+ SWIGV8_VALUE jsresult;
$jslocals
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
@@ -296,7 +298,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle jsresult;
+ SWIGV8_VALUE jsresult;
OverloadErrorHandler errorHandler;
$jscode
@@ -320,7 +322,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler
{
SWIGV8_HANDLESCOPE();
- v8::Handle jsresult;
+ SWIGV8_VALUE jsresult;
$jslocals
$jscode
SWIGV8_RETURN(jsresult);
@@ -374,7 +376,7 @@ fail:
%fragment("jsv8_define_class_template", "templates")
%{
/* Name: $jsmangledname, Type: $jsmangledtype, Dtor: $jsdtor */
- v8::Handle $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) {
@@ -420,11 +422,18 @@ fail:
%fragment("jsv8_create_class_instance", "templates")
%{
/* Class: $jsname ($jsmangledname) */
- v8::Handle $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 (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
$jsmangledname_class_0->SetHiddenPrototype(true);
v8::Handle $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+#elif (SWIG_V8_VERSION < 0x0704)
+ $jsmangledname_class_0->SetHiddenPrototype(true);
+ v8::Local $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+#else
+ v8::Local $jsmangledname_obj = $jsmangledname_class_0->GetFunction(context).ToLocalChecked();
+#endif
%}
/* -----------------------------------------------------------------------------
@@ -435,7 +444,12 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_class", "templates")
%{
+#if (V8_MAJOR_VERSION-0) < 5
$jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
+#else
+ SWIGV8_MAYBE_CHECK($jsparent_obj->Set(context, SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj));
+#endif
+
%}
/* -----------------------------------------------------------------------------
@@ -444,7 +458,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_create_namespace", "templates")
%{
- v8::Handle $jsmangledname_obj = SWIGV8_OBJECT_NEW();
+ SWIGV8_OBJECT $jsmangledname_obj = SWIGV8_OBJECT_NEW();
%}
/* -----------------------------------------------------------------------------
@@ -455,7 +469,11 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_namespace", "templates")
%{
+#if (V8_MAJOR_VERSION-0) < 5
$jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
+#else
+ SWIGV8_MAYBE_CHECK($jsparent_obj->Set(context, SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj));
+#endif
%}
/* -----------------------------------------------------------------------------
@@ -491,7 +509,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_static_function", "templates")
%{
- SWIGV8_AddStaticFunction($jsparent_obj, "$jsname", $jswrapper);
+ SWIGV8_AddStaticFunction($jsparent_obj, "$jsname", $jswrapper, context);
%}
/* -----------------------------------------------------------------------------
@@ -505,5 +523,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/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg
index d3b4aaffa..7b3c5547e 100644
--- a/Lib/javascript/v8/javascriptcomplex.swg
+++ b/Lib/javascript/v8/javascriptcomplex.swg
@@ -12,15 +12,15 @@
%fragment(SWIG_From_frag(Type),"header",
fragment=SWIG_From_frag(double))
{
-SWIGINTERNINLINE v8::Handle
+SWIGINTERNINLINE SWIGV8_VALUE
SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
{
SWIGV8_HANDLESCOPE_ESC();
- v8::Local vals = SWIGV8_ARRAY_NEW();
+ v8::Local 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 o, Type* val)
+SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
{
SWIGV8_HANDLESCOPE();
if (o->IsArray()) {
- v8::Handle array = v8::Handle::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 o, Type* val)
%fragment(SWIG_AsVal_frag(Type),"header",
fragment=SWIG_AsVal_frag(float)) {
SWIGINTERN int
-SWIG_AsVal_dec(Type) (v8::Handle o, Type* val)
+SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
{
SWIGV8_HANDLESCOPE();
if (o->IsArray()) {
- v8::Handle |