From: <je...@us...> - 2008-05-20 20:58:07
|
Revision: 10476 http://swig.svn.sourceforge.net/swig/?rev=10476&view=rev Author: jezabek Date: 2008-05-20 12:59:13 -0700 (Tue, 20 May 2008) Log Message: ----------- Merged revisions 10418:10475 from trunk. Modified Paths: -------------- branches/gsoc2008-jezabek/CHANGES.current branches/gsoc2008-jezabek/Doc/Manual/Contents.html branches/gsoc2008-jezabek/Doc/Manual/Typemaps.html branches/gsoc2008-jezabek/Doc/Manual/Warnings.html branches/gsoc2008-jezabek/Examples/Makefile.in branches/gsoc2008-jezabek/Examples/test-suite/allprotected.i branches/gsoc2008-jezabek/Examples/test-suite/common.mk branches/gsoc2008-jezabek/Examples/test-suite/contract.i branches/gsoc2008-jezabek/Examples/test-suite/csharp/allprotected_runme.cs branches/gsoc2008-jezabek/Examples/test-suite/fvirtual.i branches/gsoc2008-jezabek/Examples/test-suite/intermediary_classname.i branches/gsoc2008-jezabek/Examples/test-suite/java/allprotected_runme.java branches/gsoc2008-jezabek/Examples/test-suite/php4/abstract_inherit_ok_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/abstract_inherit_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/add_link_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_global_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_global_twodim_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_scope_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/casts_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/class_ignore_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_namespace_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_ns_template_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/cpp_static_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/enum_scope_template_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_ns_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_prop_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/extend_template_ns_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/extend_template_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/li_carrays_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/rename_scope_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/smart_pointer_rename_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/template_arg_typename_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/template_construct_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/php4/valuewrapper_base_runme.php4 branches/gsoc2008-jezabek/Examples/test-suite/preproc.i branches/gsoc2008-jezabek/Examples/test-suite/wrapmacro.i branches/gsoc2008-jezabek/Lib/allegrocl/allegrocl.swg branches/gsoc2008-jezabek/Lib/cffi/cffi.swg branches/gsoc2008-jezabek/Lib/chicken/chicken.swg branches/gsoc2008-jezabek/Lib/csharp/csharp.swg branches/gsoc2008-jezabek/Lib/guile/typemaps.i branches/gsoc2008-jezabek/Lib/java/java.swg branches/gsoc2008-jezabek/Lib/lua/luatypemaps.swg branches/gsoc2008-jezabek/Lib/modula3/modula3.swg branches/gsoc2008-jezabek/Lib/ocaml/typemaps.i branches/gsoc2008-jezabek/Lib/octave/boost_shared_ptr.i branches/gsoc2008-jezabek/Lib/octave/octrun.swg branches/gsoc2008-jezabek/Lib/octave/octruntime.swg branches/gsoc2008-jezabek/Lib/php4/globalvar.i branches/gsoc2008-jezabek/Lib/php4/php4.swg branches/gsoc2008-jezabek/Lib/pike/pike.swg branches/gsoc2008-jezabek/Lib/python/README branches/gsoc2008-jezabek/Lib/python/pycontainer.swg branches/gsoc2008-jezabek/Lib/python/pyruntime.swg branches/gsoc2008-jezabek/Lib/python/std_multiset.i branches/gsoc2008-jezabek/Lib/python/std_set.i branches/gsoc2008-jezabek/Lib/r/rfragments.swg branches/gsoc2008-jezabek/Lib/r/rrun.swg branches/gsoc2008-jezabek/Lib/r/rtype.swg branches/gsoc2008-jezabek/Lib/ruby/rubycontainer.swg branches/gsoc2008-jezabek/Lib/ruby/std_multiset.i branches/gsoc2008-jezabek/Lib/ruby/std_set.i branches/gsoc2008-jezabek/Lib/std/std_common.i branches/gsoc2008-jezabek/Lib/swigwarnings.swg branches/gsoc2008-jezabek/Lib/typemaps/primtypes.swg branches/gsoc2008-jezabek/Lib/typemaps/swigmacros.swg branches/gsoc2008-jezabek/Lib/typemaps/traits.swg branches/gsoc2008-jezabek/Source/Include/swigwarn.h branches/gsoc2008-jezabek/Source/Modules/allegrocl.cxx branches/gsoc2008-jezabek/Source/Modules/cffi.cxx branches/gsoc2008-jezabek/Source/Modules/chicken.cxx branches/gsoc2008-jezabek/Source/Modules/contract.cxx branches/gsoc2008-jezabek/Source/Modules/csharp.cxx branches/gsoc2008-jezabek/Source/Modules/directors.cxx branches/gsoc2008-jezabek/Source/Modules/emit.cxx branches/gsoc2008-jezabek/Source/Modules/guile.cxx branches/gsoc2008-jezabek/Source/Modules/java.cxx branches/gsoc2008-jezabek/Source/Modules/lang.cxx branches/gsoc2008-jezabek/Source/Modules/lua.cxx branches/gsoc2008-jezabek/Source/Modules/modula3.cxx branches/gsoc2008-jezabek/Source/Modules/mzscheme.cxx branches/gsoc2008-jezabek/Source/Modules/ocaml.cxx branches/gsoc2008-jezabek/Source/Modules/octave.cxx branches/gsoc2008-jezabek/Source/Modules/perl5.cxx branches/gsoc2008-jezabek/Source/Modules/php4.cxx branches/gsoc2008-jezabek/Source/Modules/pike.cxx branches/gsoc2008-jezabek/Source/Modules/python.cxx branches/gsoc2008-jezabek/Source/Modules/r.cxx branches/gsoc2008-jezabek/Source/Modules/ruby.cxx branches/gsoc2008-jezabek/Source/Modules/swigmod.h branches/gsoc2008-jezabek/Source/Modules/tcl8.cxx branches/gsoc2008-jezabek/Source/Modules/utils.cxx branches/gsoc2008-jezabek/Source/Swig/swig.h branches/gsoc2008-jezabek/Source/Swig/typemap.c branches/gsoc2008-jezabek/configure.in branches/gsoc2008-jezabek/preinst-swig.in Added Paths: ----------- branches/gsoc2008-jezabek/Examples/test-suite/packageoption.h branches/gsoc2008-jezabek/Examples/test-suite/packageoption.list branches/gsoc2008-jezabek/Examples/test-suite/packageoption_a.i branches/gsoc2008-jezabek/Examples/test-suite/packageoption_b.i branches/gsoc2008-jezabek/Examples/test-suite/perl5/packageoption_runme.pl Removed Paths: ------------- branches/gsoc2008-jezabek/Examples/test-suite/package.h branches/gsoc2008-jezabek/Examples/test-suite/package.list branches/gsoc2008-jezabek/Examples/test-suite/package_a.i branches/gsoc2008-jezabek/Examples/test-suite/package_b.i branches/gsoc2008-jezabek/Examples/test-suite/perl5/package_runme.pl Property Changed: ---------------- branches/gsoc2008-jezabek/ Property changes on: branches/gsoc2008-jezabek ___________________________________________________________________ Name: svnmerge-integrated + /trunk:1-10417 Modified: branches/gsoc2008-jezabek/CHANGES.current =================================================================== --- branches/gsoc2008-jezabek/CHANGES.current 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/CHANGES.current 2008-05-20 19:59:13 UTC (rev 10476) @@ -1,6 +1,53 @@ Version 1.3.36 (in progress) ============================= +05/19/2008: drjoe + [R] Fixed define that was breaking pre-2.7. Checked in + patch from Soren Sonnenburg that creates strings in + version independent way + +05/15/2008: wsfulton + [Java] Fix variable name clash in directors - SF #1963316 reported by Tristan. + +05/14/2008: wsfulton + Add an optimisation for functions that return objects by value, reducing + the number of copies of the object that are made. Implemented using an + optional attribute in the "out" typemap called "optimal". Details in + Typemaps.html. + +05/11/2008: olly + [PHP] Check for %feature("notabstract") when generating PHP5 class + wrapper. + +05/11/2008: wsfulton + Fix SF #1943608 - $self substitution in %contract, patch submitted by + Toon Verstraelen. + +05/09/2008: olly + [PHP] Fix char * typemaps to work when applied to signed char * and + unsigned char * (uncovered by testcase apply_strings). + +05/09/2008: wsfulton + Fix wrapping of char * member variables when using allprotected mode. + Bug reported by Warren Wang. + +05/09/2008: olly + [PHP] Fix bad PHP code generated when wrapping an enum in a + namespace (uncovered by testcase arrays_scope). + +05/09/2008: olly + [PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4 + is essentially obsolete now, so we care much more about solid PHP5 + support. + +05/07/2008: wsfulton + STL fixes when using %import rather than %include and the Solaris Workshop + compiler and the Roguewave STL. + +05/07/2008: wsfulton + Fix wrapping of overloaded protected methods when using allprotected mode. + Bug reported by Warren Wang. + 05/03/2008: wsfulton Commit patch #1956607 to add -MT support from Richard Boulton. This patch mirrors the gcc -MT option which allows one to change the default Modified: branches/gsoc2008-jezabek/Doc/Manual/Contents.html =================================================================== --- branches/gsoc2008-jezabek/Doc/Manual/Contents.html 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Doc/Manual/Contents.html 2008-05-20 19:59:13 UTC (rev 10476) @@ -379,6 +379,7 @@ <li><a href="Typemaps.html#Typemaps_nn41">Implementing constraints with typemaps</a> </ul> <li><a href="Typemaps.html#Typemaps_nn43">Typemaps for multiple languages</a> +<li><a href="Typemaps.html#Typemaps_optimal">Optimal code generation when returning by value</a> <li><a href="Typemaps.html#Typemaps_nn42">Multi-argument typemaps</a> <li><a href="Typemaps.html#runtime_type_checker">The run-time type checker</a> <ul> @@ -761,7 +762,7 @@ <li><a href="Java.html#typeunsafe_enums_classes">Type unsafe enum classes</a> </ul> </ul> -<li><a href="Java.html#java_directors">Cross language polymorphism using directors (experimental)</a> +<li><a href="Java.html#java_directors">Cross language polymorphism using directors</a> <ul> <li><a href="Java.html#java_enabling_directors">Enabling directors</a> <li><a href="Java.html#java_directors_classes">Director classes</a> Modified: branches/gsoc2008-jezabek/Doc/Manual/Typemaps.html =================================================================== --- branches/gsoc2008-jezabek/Doc/Manual/Typemaps.html 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Doc/Manual/Typemaps.html 2008-05-20 19:59:13 UTC (rev 10476) @@ -64,6 +64,7 @@ <li><a href="#Typemaps_nn41">Implementing constraints with typemaps</a> </ul> <li><a href="#Typemaps_nn43">Typemaps for multiple languages</a> +<li><a href="#Typemaps_optimal">Optimal code generation when returning by value</a> <li><a href="#Typemaps_nn42">Multi-argument typemaps</a> <li><a href="#runtime_type_checker">The run-time type checker</a> <ul> @@ -2006,6 +2007,10 @@ </pre> </div> +<p> +The "out" typemap supports an optional attribute flag called "optimal". This is for code optimisation and is detailed in the <a href="#Typemaps_optimal">Optimal code generation when returning by value</a> section. +</p> + <H3><a name="Typemaps_nn29"></a>10.5.4 "arginit" typemap</H3> @@ -2619,10 +2624,197 @@ <tt>%typemap(ruby,in) int "$1 = NUM2INT($input);"</tt>. </p> -<H2><a name="Typemaps_nn42"></a>10.8 Multi-argument typemaps</H2> +<H2><a name="Typemaps_optimal"></a>10.8 Optimal code generation when returning by value</H2> <p> +The "out" typemap is the main typemap for return types. +This typemap supports an optional attribute flag called "optimal", which is for reducing +temporary variables and the amount of generated code. +It only really makes a difference when returning objects by value and it cannot always be used, +as explained later on. +<p> + +<p> +When a function returns an object by value, SWIG generates code that instantiates the default +type on the stack then assigns the value returned by the function call to it. +A copy of this object is then made on the heap and this is what is ultimately stored and +used from the target language. +This will be clearer considering an example. +Consider running the following code through SWIG: +</p> + +<div class="code"> +<pre> +%typemap(out) SWIGTYPE %{ + $result = new $1_ltype((const $1_ltype &)$1); +%} + +%inline %{ +#include <iostream> +using namespace std; + +struct XX { + XX() { cout << "XX()" << endl; } + XX(int i) { cout << "XX(" << i << ")" << endl; } + XX(const XX &other) { cout << "XX(const XX &)" << endl; } + XX & operator =(const XX &other) { cout << "operator=(const XX &)" << endl; return *this; } + ~XX() { cout << "~XX()" << endl; } + static XX create() { + return XX(0); + } +}; +%} +</pre> +</div> + +<p> +The "out" typemap shown is the default typemap for C# when returning by objects by value. +When making a call to <tt>XX::create()</tt> from C#, the output is as follows: +</p> + +<div class="targetlang"> +<pre> +XX() +XX(0) +operator=(const XX &) +~XX() +XX(const XX &) +~XX() +~XX() +</pre> +</div> + +<p> +Note that three objects are being created as well as an assignment. +Wouldn't it be great if the <tt>XX::create()</tt> method was the only time a constructor was called? +As the method returns by value, this is asking a lot and the code that SWIG generates by default +makes it impossible for the compiler to make this type of optimisation. +However, this is where the "optimal" attribute in the "out" typemap can help out. +If the typemap code is kept the same and just the "optimal" attribute specified like this: +</p> + +<div class="code"> +<pre> +%typemap(out, optimal="1") SWIGTYPE %{ + $result = new $1_ltype((const $1_ltype &)$1); +%} +</pre> +</div> + +<p> +then when the code is run again, the output is simply: +</P> + +<div class="targetlang"> +<pre> +XX(0) +~XX() +</pre> +</div> + +<p> +How the "optimal" attribute works is best explained using the generated code. +Without "optimal", the generated code is: +</p> + +<div class="code"> +<pre> +SWIGEXPORT void * SWIGSTDCALL CSharp_XX_create() { + void * jresult ; + XX result; + result = XX::create(); + jresult = new XX((const XX &)result); + return jresult; +} + +</pre> +</div> + +<p> +With the "optimal" attribute, the code is: +</p> + +<div class="code"> +<pre> +SWIGEXPORT void * SWIGSTDCALL CSharp_XX_create() { + void * jresult ; + jresult = new XX((const XX &)XX::create()); + return jresult; +} +</pre> +</div> + +<p> +The major difference is the <tt>result</tt> temporary variable holding the value returned from <tt>XX::create()</tt> is no longer generated and instead the copy constructor call is made directly from +the value returned by <tt>XX::create()</tt>. +With modern compiler optimisations turned on, the copy is not actually done, in fact the object is never created +on the stack in <tt>XX::create()</tt> at all, it is simply created directly on the heap. +In the first instance, the <tt>$1</tt> special variable in the typemap is expanded into <tt>result</tt>. +In the second instance, <tt>$1</tt> is expanded into <tt>XX::create()</tt> and this is essentially +what the "optimal" attribute is telling SWIG to do. +</p> + +<p> +This kind of optimisation is not turned on by default as it has a number of restrictions. +Firstly, some code cannot be condensed into a simple call for passing into the copy constructor. +One common occurrence is when <a href="Customization.html#exception">%exception</a> is used. +Consider adding the following <tt>%exception</tt> to the example: +</p> + +<div class="code"> +<pre> +%exception XX::create() %{ +try { + $action +} catch(const std::exception &e) { + cout << e.what() << endl; +} +%} +</pre> +</div> + +<p> +SWIG can detect when the "optimal" attribute cannot be used and will ignore it and in this case will issue the following warning: +</p> + +<div class="targetlang"> +<pre> +example.i:28: Warning(474): Method XX::create() usage of the optimal attribute in the out +typemap at example.i:14 ignored as the following cannot be used to generate optimal code: +try { + result = XX::create(); +} catch(const std::exception &e) { + cout << e.what() << endl; +} +</pre> +</div> + +<p> +It should be clear that the above code cannot be used as the argument to the copy constructor call, ie for the <tt>$1</tt> substitution. +<p> + +<p> +Secondly, if the typemaps uses <tt>$1</tt> more than once, then multiple calls to the wrapped function +will be made. Obviously that is not very optimal. +In fact SWIG attempts to detect this and will issue a warning something like: +</p> + +<div class="targetlang"> +<pre> +example.i:21: Warning(475): Multiple calls to XX::create() might be generated due to +optimal attribute usage in the out typemap at example.i:7. +</pre> +</div> + +<p> +However, it doesn't always get it right, for example when <tt>$1</tt> is within some commented out code. +</p> + +<H2><a name="Typemaps_nn42"></a>10.9 Multi-argument typemaps</H2> + + +<p> So far, the typemaps presented have focused on the problem of dealing with single values. For example, converting a single input object to a single argument in a function call. However, certain conversion problems are difficult to handle @@ -2884,7 +3076,7 @@ ordering (and perform conversions if needed). </p> -<H2><a name="runtime_type_checker"></a>10.9 The run-time type checker</H2> +<H2><a name="runtime_type_checker"></a>10.10 The run-time type checker</H2> <p> @@ -2910,7 +3102,7 @@ <li>Modules can be unloaded from the type system.</li> </ul> -<H3><a name="Typemaps_nn45"></a>10.9.1 Implementation</H3> +<H3><a name="Typemaps_nn45"></a>10.10.1 Implementation</H3> <p> @@ -3096,7 +3288,7 @@ structures are chained together in a circularly linked list. </p> -<H3><a name="Typemaps_nn46"></a>10.9.2 Usage</H3> +<H3><a name="Typemaps_nn46"></a>10.10.2 Usage</H3> <p>This section covers how to use these functions from typemaps. To learn how to @@ -3190,7 +3382,7 @@ managed. </p> -<H2><a name="Typemaps_overloading"></a>10.10 Typemaps and overloading</H2> +<H2><a name="Typemaps_overloading"></a>10.11 Typemaps and overloading</H2> <p> @@ -3499,7 +3691,7 @@ </li> </ul> -<H2><a name="Typemaps_nn48"></a>10.11 More about <tt>%apply</tt> and <tt>%clear</tt></H2> +<H2><a name="Typemaps_nn48"></a>10.12 More about <tt>%apply</tt> and <tt>%clear</tt></H2> <p> @@ -3584,7 +3776,7 @@ </pre> </div> -<H2><a name="Typemaps_nn49"></a>10.12 Reducing wrapper code size</H2> +<H2><a name="Typemaps_nn49"></a>10.13 Reducing wrapper code size</H2> <p> @@ -3665,7 +3857,7 @@ </pre> </div> -<H2><a name="Typemaps_nn47"></a>10.13 Passing data between typemaps</H2> +<H2><a name="Typemaps_nn47"></a>10.14 Passing data between typemaps</H2> <p> @@ -3702,7 +3894,7 @@ </p> -<H2><a name="Typemaps_nn51"></a>10.14 Where to go for more information?</H2> +<H2><a name="Typemaps_nn51"></a>10.15 Where to go for more information?</H2> <p> Modified: branches/gsoc2008-jezabek/Doc/Manual/Warnings.html =================================================================== --- branches/gsoc2008-jezabek/Doc/Manual/Warnings.html 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Doc/Manual/Warnings.html 2008-05-20 19:59:13 UTC (rev 10476) @@ -482,8 +482,12 @@ <li>469. No or improper directorin typemap defined for <em>type</em> <li>470. Thread/reentrant unsafe wrapping, consider returning by value instead. <li>471. Unable to use return type <em>type</em> in director method +<li>474. Method <em>method</em> usage of the optimal attribute in the out typemap at <em>file</em>:<em>line</em> ignored as the following cannot be used to generate optimal code: <em>code</em> +<li>475. Multiple calls to <em>method</em> might be generated due to optimal attribute usage in the out typemap at <em>file</em>:<em>line</em>. </ul> + + <H3><a name="Warnings_nn14"></a>14.9.5 Code generation (500-599)</H3> Modified: branches/gsoc2008-jezabek/Examples/Makefile.in =================================================================== --- branches/gsoc2008-jezabek/Examples/Makefile.in 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/Makefile.in 2008-05-20 19:59:13 UTC (rev 10476) @@ -705,7 +705,7 @@ PHP4_SO = @PHP4_SO@ php4: $(SRCS) - $(SWIG) -php4 $(SWIGOPT) $(INTERFACE) + $(SWIG) -php5 $(SWIGOPT) $(INTERFACE) $(CC) -c $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(PHP4_INCLUDE) $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP4_SO) @@ -714,7 +714,7 @@ # -------------------------------------------------------------------- php4_cpp: $(SRCS) - $(SWIG) -php4 -cppext cxx -c++ $(SWIGOPT) $(INTERFACE) + $(SWIG) -php5 -cppext cxx -c++ $(SWIGOPT) $(INTERFACE) $(CXX) -c $(CCSHARED) $(CFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP4_INCLUDE) $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP4_SO) @@ -726,7 +726,7 @@ SCRIPT ?= runme.php4 php4_run: - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(PHP4) -q -d extension_dir=. $(SCRIPT) + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(PHP4) -n -q -d extension_dir=. $(SCRIPT) # ----------------------------------------------------------------- # Cleaning the PHP4 examples Modified: branches/gsoc2008-jezabek/Examples/test-suite/allprotected.i =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/allprotected.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/allprotected.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -28,15 +28,20 @@ public: enum AnEnum { EnumVal1, EnumVal2 }; public: - PublicBase(const char* s): str(s) {} + PublicBase(const char* s): str(s), instanceMemberVariable(0), anEnum(EnumVal1), stringMember(0) {} virtual ~PublicBase() { } virtual std::string virtualMethod() const { return "PublicBase"; } Klass instanceMethod(Klass k) const { return k; } + Klass *instanceOverloaded(Klass *k) const { return k; } + Klass *instanceOverloaded(Klass *k, std::string name) const { return new Klass(name); } static Klass staticMethod(Klass k) { return k; } + static Klass *staticOverloaded(Klass *k) { return k; } + static Klass *staticOverloaded(Klass *k, std::string name) { return new Klass(name); } int instanceMemberVariable; static int staticMemberVariable; static const int staticConstMemberVariable = 20; AnEnum anEnum; + char *stringMember; }; int PublicBase::staticMemberVariable = 10; @@ -46,15 +51,20 @@ enum AnEnum { EnumVal1, EnumVal2 }; std::string getName() { return str; } protected: - ProtectedBase(const char* s): str(s) {} + ProtectedBase(const char* s): str(s), instanceMemberVariable(0), anEnum(EnumVal1), stringMember(0), protectedenum(ProtEnumVal1) {} virtual ~ProtectedBase() { } virtual std::string virtualMethod() const { return "ProtectedBase"; } Klass instanceMethod(Klass k) const { return k; } + Klass *instanceOverloaded(Klass *k) const { return k; } + Klass *instanceOverloaded(Klass *k, std::string name) const { return new Klass(name); } static Klass staticMethod(Klass k) { return k; } + static Klass *staticOverloaded(Klass *k) { return k; } + static Klass *staticOverloaded(Klass *k, std::string name) { return new Klass(name); } int instanceMemberVariable; static int staticMemberVariable; static const int staticConstMemberVariable = 20; AnEnum anEnum; + char *stringMember; // unsupported: types defined with protected access and thus methods/variables which use them enum ProtectedEnum { ProtEnumVal1, ProtEnumVal2 }; Modified: branches/gsoc2008-jezabek/Examples/test-suite/common.mk =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/common.mk 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/common.mk 2008-05-20 19:59:13 UTC (rev 10476) @@ -422,7 +422,7 @@ MULTI_CPP_TEST_CASES += \ clientdata_prop \ imports \ - package \ + packageoption \ mod \ template_typedef_import \ multi_import Modified: branches/gsoc2008-jezabek/Examples/test-suite/contract.i =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/contract.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/contract.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -176,7 +176,6 @@ }; class D : public C { - public: public: virtual int foo(int a, int b, int c, int d, int e) { return C::foo(a,b,c,d,e); @@ -187,3 +186,18 @@ }; %} +%extend E { + %contract manipulate_i(int i) { + require: + i <= $self->m_i; + } +} + +%inline %{ +struct E { + int m_i; + void manipulate_i(int i) { + } +}; +%} + Modified: branches/gsoc2008-jezabek/Examples/test-suite/csharp/allprotected_runme.cs =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/csharp/allprotected_runme.cs 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/csharp/allprotected_runme.cs 2008-05-20 19:59:13 UTC (rev 10476) @@ -29,10 +29,26 @@ if (k.getName() != "xyz") throw new Exception("Failed"); - k = staticMethod(new Klass("abc")); + k = instanceOverloaded(new Klass("xyz")); + if (k.getName() != "xyz") + throw new Exception("Failed"); + + k = instanceOverloaded(new Klass("xyz"), "abc"); if (k.getName() != "abc") throw new Exception("Failed"); + k = ProtectedBase.staticMethod(new Klass("abc")); + if (k.getName() != "abc") + throw new Exception("Failed"); + + k = ProtectedBase.staticOverloaded(new Klass("xyz")); + if (k.getName() != "xyz") + throw new Exception("Failed"); + + k = ProtectedBase.staticOverloaded(new Klass("xyz"), "abc"); + if (k.getName() != "abc") + throw new Exception("Failed"); + instanceMemberVariable = 30; int i = instanceMemberVariable; if (i != 30) Modified: branches/gsoc2008-jezabek/Examples/test-suite/fvirtual.i =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/fvirtual.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/fvirtual.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -1,4 +1,4 @@ -// This testcase is tests corner cases for the -fvirtual optimisation flag. +// This testcase tests corner cases for the -fvirtual optimisation flag. // Note that the test-suite does not actually run with -fvirtual at any point, but this can be tested using the SWIG_FEATURES=-fvirtual env variable. %module fvirtual Modified: branches/gsoc2008-jezabek/Examples/test-suite/intermediary_classname.i =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/intermediary_classname.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/intermediary_classname.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -11,6 +11,14 @@ %feature("director") Base; %feature("director") Derived; +// Test the throws attribute in these typemaps +%typemap(javadirectorout, throws="RuntimeException/*javadirectorout Base&*/") Base& + "$javaclassname.getCPtr($javacall)/* XYZ& typemap directorout*/" +%typemap(javadirectorin, throws="Throwable/*javadirectorin Base&*/") Base& + "new $javaclassname($jniinput, false)/*javadirectorin*/" +%typemap(out, throws="IllegalAccessException/*out Base&*/") Base& { + // XYZ& typemap out +} %inline %{ template<class T> T maximum(const T a, const T b) { return a>b ? a : b; } @@ -42,6 +50,7 @@ Base(Base *b) : mVectInt(0) {} virtual ~Base() {} virtual Base& m1(Base &b) { return b; } + virtual Base& m1out() { static Base b; return b; } virtual Base* m2(Base *b) { return b; } // virtual Base m3(Base b) { return b; } vector<int> mVectInt; Modified: branches/gsoc2008-jezabek/Examples/test-suite/java/allprotected_runme.java =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/java/allprotected_runme.java 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/java/allprotected_runme.java 2008-05-20 19:59:13 UTC (rev 10476) @@ -31,10 +31,26 @@ if (!k.getName().equals("xyz")) throw new RuntimeException("Failed"); - k = staticMethod(new Klass("abc")); + k = instanceOverloaded(new Klass("xyz")); + if (!k.getName().equals("xyz")) + throw new RuntimeException("Failed"); + + k = instanceOverloaded(new Klass("xyz"), "abc"); if (!k.getName().equals("abc")) throw new RuntimeException("Failed"); + k = ProtectedBase.staticMethod(new Klass("abc")); + if (!k.getName().equals("abc")) + throw new RuntimeException("Failed"); + + k = ProtectedBase.staticOverloaded(new Klass("xyz")); + if (!k.getName().equals("xyz")) + throw new RuntimeException("Failed"); + + k = ProtectedBase.staticOverloaded(new Klass("xyz"), "abc"); + if (!k.getName().equals("abc")) + throw new RuntimeException("Failed"); + setInstanceMemberVariable(30); int i = getInstanceMemberVariable(); if (i != 30) Deleted: branches/gsoc2008-jezabek/Examples/test-suite/package.h =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/package.h 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/package.h 2008-05-20 19:59:13 UTC (rev 10476) @@ -1,5 +0,0 @@ -class A -{ - public: - int testInt() { return 2;} -}; Deleted: branches/gsoc2008-jezabek/Examples/test-suite/package.list =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/package.list 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/package.list 2008-05-20 19:59:13 UTC (rev 10476) @@ -1,2 +0,0 @@ -package_a -package_b \ No newline at end of file Deleted: branches/gsoc2008-jezabek/Examples/test-suite/package_a.i =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/package_a.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/package_a.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -1,10 +0,0 @@ -%module(package="C") "package_a"; - -%inline %{ -class A -{ - public: - int testInt() { return 2;} -}; - -%} \ No newline at end of file Deleted: branches/gsoc2008-jezabek/Examples/test-suite/package_b.i =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/package_b.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/package_b.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -1,10 +0,0 @@ -%module(package="C") "package_b"; - -%inline %{ -class B -{ - public: - int testInt() { return 4; } -}; - -%} \ No newline at end of file Copied: branches/gsoc2008-jezabek/Examples/test-suite/packageoption.h (from rev 10475, trunk/Examples/test-suite/packageoption.h) =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/packageoption.h (rev 0) +++ branches/gsoc2008-jezabek/Examples/test-suite/packageoption.h 2008-05-20 19:59:13 UTC (rev 10476) @@ -0,0 +1,5 @@ +class A +{ + public: + int testInt() { return 2;} +}; Copied: branches/gsoc2008-jezabek/Examples/test-suite/packageoption.list (from rev 10475, trunk/Examples/test-suite/packageoption.list) =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/packageoption.list (rev 0) +++ branches/gsoc2008-jezabek/Examples/test-suite/packageoption.list 2008-05-20 19:59:13 UTC (rev 10476) @@ -0,0 +1,2 @@ +packageoption_a +packageoption_b Copied: branches/gsoc2008-jezabek/Examples/test-suite/packageoption_a.i (from rev 10475, trunk/Examples/test-suite/packageoption_a.i) =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/packageoption_a.i (rev 0) +++ branches/gsoc2008-jezabek/Examples/test-suite/packageoption_a.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -0,0 +1,10 @@ +%module(package="C") "packageoption_a"; + +%inline %{ +class A +{ + public: + int testInt() { return 2;} +}; + +%} Copied: branches/gsoc2008-jezabek/Examples/test-suite/packageoption_b.i (from rev 10475, trunk/Examples/test-suite/packageoption_b.i) =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/packageoption_b.i (rev 0) +++ branches/gsoc2008-jezabek/Examples/test-suite/packageoption_b.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -0,0 +1,10 @@ +%module(package="C") "packageoption_b"; + +%inline %{ +class B +{ + public: + int testInt() { return 4; } +}; + +%} Deleted: branches/gsoc2008-jezabek/Examples/test-suite/perl5/package_runme.pl =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/perl5/package_runme.pl 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/perl5/package_runme.pl 2008-05-20 19:59:13 UTC (rev 10476) @@ -1,24 +0,0 @@ -#!/usr/bin/perl -w -use strict; -use Test::More tests => 4; - -BEGIN { use_ok('package_a'); } -BEGIN { use_ok('package_b'); } - -# Workaround for -# ok( not (expression) , "test description" ); -# does not working in older versions of Perl, eg 5.004_04 -sub ok_not ($;$) { - my($test, $name) = @_; - $test = not $test; - ok($test, $name); -} - -my $a = C::A->new(); - -isa_ok($a, 'C::A'); - -my $b = C::B->new(); - -isa_ok($b, 'C::B'); - Copied: branches/gsoc2008-jezabek/Examples/test-suite/perl5/packageoption_runme.pl (from rev 10475, trunk/Examples/test-suite/perl5/packageoption_runme.pl) =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/perl5/packageoption_runme.pl (rev 0) +++ branches/gsoc2008-jezabek/Examples/test-suite/perl5/packageoption_runme.pl 2008-05-20 19:59:13 UTC (rev 10476) @@ -0,0 +1,24 @@ +#!/usr/bin/perl -w +use strict; +use Test::More tests => 4; + +BEGIN { use_ok('packageoption_a'); } +BEGIN { use_ok('packageoption_b'); } + +# Workaround for +# ok( not (expression) , "test description" ); +# does not working in older versions of Perl, eg 5.004_04 +sub ok_not ($;$) { + my($test, $name) = @_; + $test = not $test; + ok($test, $name); +} + +my $a = C::A->new(); + +isa_ok($a, 'C::A'); + +my $b = C::B->new(); + +isa_ok($b, 'C::B'); + Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/abstract_inherit_ok_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/abstract_inherit_ok_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/abstract_inherit_ok_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -3,7 +3,7 @@ require "tests.php4"; require "abstract_inherit_ok.php"; -check::classes(array(foo,spam)); +check::classes(array(Foo,Spam)); $spam=new Spam(); check::equal(0,$spam->blah(),"spam object method"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/abstract_inherit_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/abstract_inherit_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/abstract_inherit_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -3,7 +3,7 @@ require "tests.php4"; require "abstract_inherit.php"; -check::classes(array(foo,bar,spam,nrfilter_i,nrrcfilter_i,nrrcfilterpro_i,nrrcfilterpri_i)); +check::classes(array(Foo,Bar,Spam,NRFilter_i,NRRCFilter_i,NRRCFilterpro_i,NRRCFilterpri_i)); // This constructor attempt should fail as there isn't one //$spam=new Spam(); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/add_link_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/add_link_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/add_link_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,11 +4,11 @@ require "tests.php4"; require "add_link.php"; -// No new functions -check::functions(array()); -// No new classes -check::classes(array(foo)); +// No new functions, except the flat functions +check::functions(array(new_foo,foo_blah)); +check::classes(array(Foo)); + $foo=new foo(); check::is_a($foo,foo); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_global_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_global_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_global_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,8 +4,8 @@ require "tests.php4"; require "arrays_global.php"; -check::functions(array(test_a,test_b)); -check::classes(array(simplestruct,material)); +check::functions(array(test_a,test_b,new_simplestruct,new_material)); +check::classes(array(arrays_global,SimpleStruct,Material)); check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i,beginstring_fix44a,beginstring_fix44b,beginstring_fix44c,beginstring_fix44d,beginstring_fix44e,beginstring_fix44f,chitmat,hitmat_val,hitmat)); check::set(array_c,"hac"); check::equal("ha",check::get(array_c,"ha"),"set array_c"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_global_twodim_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_global_twodim_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_global_twodim_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,8 +4,8 @@ require "tests.php4"; require "arrays_global_twodim.php"; -check::functions(array(fn_taking_arrays,get_2d_array)); -check::classes(array(simplestruct,material)); +check::functions(array(fn_taking_arrays,get_2d_array,new_simplestruct,new_material)); +check::classes(array(arrays_global_twodim,SimpleStruct,Material)); check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i,chitmat,hitmat_val,hitmat)); $a1=array(10,11,12,13); $a2=array(14,15,16,17); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "arrays.php"; check::functions(array(fn_taking_arrays,newintpointer,setintfrompointer,getintfrompointer,array_pointer_func)); -check::classes(array(simplestruct,arraystruct,cartposedata_t)); +check::classes(array(arrays,SimpleStruct,ArrayStruct,CartPoseData_t)); // No new vars check::globals(array()); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_scope_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_scope_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/arrays_scope_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -5,9 +5,9 @@ require "arrays_scope.php"; // No new functions -check::functions(array()); +check::functions(array(new_bar,bar_blah)); // No new classes -check::classes(array(bar)); +check::classes(array(arrays_scope,Bar)); // now new vars check::globals(array()); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/casts_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/casts_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/casts_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -5,9 +5,9 @@ require "casts.php"; // No new functions -check::functions(array()); +check::functions(array(new_a,a_hello,new_b)); // No new classes -check::classes(array(a,b)); +check::classes(array(A,B)); // now new vars check::globals(array()); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/class_ignore_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/class_ignore_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/class_ignore_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,8 +4,8 @@ require "tests.php4"; require "class_ignore.php"; -check::functions(array(do_blah)); -check::classes(array(bar,boo,far,hoo)); +check::functions(array(do_blah,new_bar,bar_blah,new_boo,boo_away,new_far,new_hoo)); +check::classes(array(class_ignore,Bar,Boo,Far,Hoo)); // No new vars check::globals(array()); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_namespace_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_namespace_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_namespace_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "conversion_namespace.php"; -check::classes(array("foo","bar")); +check::classes(array("Foo","Bar")); $bar=new Bar; check::classname("bar",$bar); $foo=$bar->toFoo(); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_ns_template_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_ns_template_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_ns_template_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -3,7 +3,7 @@ require "tests.php4"; require "conversion_ns_template.php"; -check::classes(array("foo_one","bar_one","hi")); +check::classes(array("conversion_ns_template","Foo_One","Bar_One","Hi")); // this is too hard, I'm not sure what to test for, check::done(); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/conversion_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "conversion.php"; -check::classes(array("foo","bar")); +check::classes(array("Foo","Bar")); $bar=new Bar; check::classname("bar",$bar); $foo=$bar->toFoo(); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/cpp_static_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/cpp_static_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/cpp_static_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -7,7 +7,7 @@ // No new functions check::functions(array()); // No new classes -check::classes(array(staticmembertest,staticfunctiontest)); +check::classes(array(StaticMemberTest,StaticFunctionTest)); // now new vars check::globals(array()); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/enum_scope_template_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/enum_scope_template_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/enum_scope_template_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "enum_scope_template.php"; -check::classes("treeint"); +check::classes(array("enum_scope_template", "TreeInt")); check::functions("chops"); check::equal(0,TreeInt_Oak,"0==TreeInt_Oak"); check::equal(1,TreeInt_Fir,"0==TreeInt_Fir"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_ns_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_ns_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_ns_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "evil_diamond_ns.php"; -check::classes(array("foo","bar","baz","spam")); +check::classes(array("evil_diamond_ns","foo","bar","baz","spam")); check::functions("test"); check::is_a("bar","foo"); check::is_a("baz","foo"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_prop_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_prop_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_prop_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "evil_diamond_prop.php"; -check::classes(array("foo","bar","baz","spam")); +check::classes(array("evil_diamond_prop","foo","bar","baz","spam")); check::functions("test"); check::is_a("bar","foo"); check::is_a("baz","foo"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/evil_diamond_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "evil_diamond.php"; -check::classes(array("foo","bar","baz","spam")); +check::classes(array("evil_diamond","foo","bar","baz","spam")); check::functions("test"); check::is_a("bar","foo"); check::is_a("baz","foo"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/extend_template_ns_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/extend_template_ns_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/extend_template_ns_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "extend_template_ns.php"; -check::classes(array("foo_one")); +check::classes(array("extend_template_ns","Foo_One")); $foo=new Foo_One(); check::equal(2,$foo->test1(2),"test1"); check::equal(3,$foo->test2(3),"test2"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/extend_template_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/extend_template_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/extend_template_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "extend_template.php"; -check::classes(array("foo_0")); +check::classes(array("Foo_0")); $foo=new Foo_0(); check::equal(2,$foo->test1(2),"test1"); check::equal(3,$foo->test2(3),"test2"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/li_carrays_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/li_carrays_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/li_carrays_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -7,7 +7,7 @@ // No new functions check::functions(array(new_intarray,delete_intarray,intarray_getitem,intarray_setitem)); // No new classes -check::classes(array(doublearray)); +check::classes(array(doubleArray)); // now new vars check::globals(array()); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/rename_scope_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/rename_scope_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/rename_scope_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "rename_scope.php"; -check::classes(array("interface_up","interface_bp","natural_up","natural_bp")); +check::classes(array("rename_scope","Interface_UP","Interface_BP","Natural_UP","Natural_BP","Bucket")); check::classmethods("Interface_UP",array("interface_up")); check::classmethods("Interface_BP",array("interface_bp")); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/smart_pointer_rename_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/smart_pointer_rename_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/smart_pointer_rename_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "smart_pointer_rename.php"; -check::classes(array("foo","bar")); +check::classes(array("Foo","Bar")); check::classmethods("foo",array("foo","ftest1","ftest2")); check::classmethods("bar",array("__deref__","bar","test","ftest1","ftest2")); $foo=new foo(); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/template_arg_typename_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/template_arg_typename_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/template_arg_typename_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -7,7 +7,7 @@ // No new functions check::functions(array()); // No new classes -check::classes(array(unaryfunction_bool_bool,boolunaryfunction_bool)); +check::classes(array(UnaryFunction_bool_bool,BoolUnaryFunction_bool)); $ufbb=new unaryfunction_bool_bool(); check::is_a($ufbb,"unaryfunction_bool_bool"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/template_construct_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/template_construct_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/template_construct_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -3,7 +3,7 @@ require "tests.php4"; require "template_construct.php"; -check::classes(array(foo_int)); +check::classes(array(Foo_int)); $foo_int=new foo_int(3); check::is_a($foo_int,"foo_int","Made a foo_int"); Modified: branches/gsoc2008-jezabek/Examples/test-suite/php4/valuewrapper_base_runme.php4 =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/php4/valuewrapper_base_runme.php4 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/php4/valuewrapper_base_runme.php4 2008-05-20 19:59:13 UTC (rev 10476) @@ -4,7 +4,7 @@ require "tests.php4"; require "valuewrapper_base.php"; -check::classes(array("base","interface_bp")); +check::classes(array("valuewrapper_base","Base","Interface_BP")); check::functions("make_interface_bp"); $ibp=make_interface_bp(); Modified: branches/gsoc2008-jezabek/Examples/test-suite/preproc.i =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/preproc.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/preproc.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -228,15 +228,14 @@ -#ifndef SWIGOCTAVE #ifdef __cplusplus -#define %mangle(...) #@__VA_ARGS__ -#define %mangle_str(...) ##@__VA_ARGS__ +#define %mangle_macro(...) #@__VA_ARGS__ +#define %mangle_macro_str(...) ##@__VA_ARGS__ %define my_func(...) -inline const char* mangle ## #@__VA_ARGS__ () { - return %mangle_str(__VA_ARGS__); +inline const char* mangle_macro ## #@__VA_ARGS__ () { + return %mangle_macro_str(__VA_ARGS__); } %enddef @@ -246,7 +245,6 @@ } #endif -#endif #if defined (__cplusplus) \ Modified: branches/gsoc2008-jezabek/Examples/test-suite/wrapmacro.i =================================================================== --- branches/gsoc2008-jezabek/Examples/test-suite/wrapmacro.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Examples/test-suite/wrapmacro.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -26,7 +26,7 @@ %} -/* Here, the auxiliar macro to wrap a macro */ +/* Here, the auxiliary macro to wrap a macro */ %define %wrapmacro(type, name, lparams, lnames) %rename(name) SWIGMACRO_##name; %inline %{ @@ -45,7 +45,7 @@ %wrapmacro(double, max, PLIST(double a, double b), PLIST(a, b)); -/* Maybe in the future, a swig directive will do this easier: +/* Maybe in the future, a swig directive will make this easier: #define max(a,b) ((a) > (b) ? (a) : (b)) Modified: branches/gsoc2008-jezabek/Lib/allegrocl/allegrocl.swg =================================================================== --- branches/gsoc2008-jezabek/Lib/allegrocl/allegrocl.swg 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Lib/allegrocl/allegrocl.swg 2008-05-20 19:59:13 UTC (rev 10476) @@ -137,12 +137,13 @@ %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 *, void, + float, double, long double, char *, void *, enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[ANY], SWIGTYPE & "$result = $1;"; #ifdef __cplusplus Modified: branches/gsoc2008-jezabek/Lib/cffi/cffi.swg =================================================================== --- branches/gsoc2008-jezabek/Lib/cffi/cffi.swg 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Lib/cffi/cffi.swg 2008-05-20 19:59:13 UTC (rev 10476) @@ -80,12 +80,13 @@ SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;"; %typemap(in) SWIGTYPE "$1 = *$input;"; +%typemap(out) void ""; %typemap(out) bool "$result = (int)$1;"; %typemap(out) char, unsigned char, signed char, short, signed short, unsigned short, int, signed int, unsigned int, long, signed long, unsigned long, - float, double, long double, char *, void *, void, + float, double, long double, char *, void * enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[ANY], SWIGTYPE & "$result = $1;"; #ifdef __cplusplus Modified: branches/gsoc2008-jezabek/Lib/chicken/chicken.swg =================================================================== --- branches/gsoc2008-jezabek/Lib/chicken/chicken.swg 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Lib/chicken/chicken.swg 2008-05-20 19:59:13 UTC (rev 10476) @@ -330,7 +330,7 @@ { $&1_ltype resultptr; C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER); - resultptr = new $1_ltype(($1_ltype &) $1); + resultptr = new $1_ltype((const $1_ltype &) $1); $result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 1); } #else @@ -348,7 +348,7 @@ { $&1_ltype resultptr; C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER); - resultptr = new $1_ltype(($1_ltype&) $1); + resultptr = new $1_ltype((const $1_ltype&) $1); $result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 0); } #else Modified: branches/gsoc2008-jezabek/Lib/csharp/csharp.swg =================================================================== --- branches/gsoc2008-jezabek/Lib/csharp/csharp.swg 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Lib/csharp/csharp.swg 2008-05-20 19:59:13 UTC (rev 10476) @@ -376,7 +376,7 @@ %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ $result = new $1_ltype(($1_ltype &)$1); %} +%{ $result = new $1_ltype((const $1_ltype &)$1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); Modified: branches/gsoc2008-jezabek/Lib/guile/typemaps.i =================================================================== --- branches/gsoc2008-jezabek/Lib/guile/typemaps.i 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Lib/guile/typemaps.i 2008-05-20 19:59:13 UTC (rev 10476) @@ -119,7 +119,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype(($1_ltype &) $1); + resultptr = new $1_ltype((const $1_ltype &) $1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1); } #else @@ -135,7 +135,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype(($1_ltype&) $1); + resultptr = new $1_ltype((const $1_ltype&) $1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0); } #else Modified: branches/gsoc2008-jezabek/Lib/java/java.swg =================================================================== --- branches/gsoc2008-jezabek/Lib/java/java.swg 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Lib/java/java.swg 2008-05-20 19:59:13 UTC (rev 10476) @@ -579,7 +579,7 @@ %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ *($&1_ltype*)&$result = new $1_ltype(($1_ltype &)$1); %} +%{ *($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); Modified: branches/gsoc2008-jezabek/Lib/lua/luatypemaps.swg =================================================================== --- branches/gsoc2008-jezabek/Lib/lua/luatypemaps.swg 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Lib/lua/luatypemaps.swg 2008-05-20 19:59:13 UTC (rev 10476) @@ -189,7 +189,7 @@ #ifdef __cplusplus %typemap(out) SWIGTYPE { - $&1_ltype resultptr = new $1_ltype(($1_ltype &) $1); + $&1_ltype resultptr = new $1_ltype((const $1_ltype &) $1); SWIG_NewPointerObj(L,(void *) resultptr,$&1_descriptor,1); SWIG_arg++; } #else Modified: branches/gsoc2008-jezabek/Lib/modula3/modula3.swg =================================================================== --- branches/gsoc2008-jezabek/Lib/modula3/modula3.swg 2008-05-20 16:44:13 UTC (rev 10475) +++ branches/gsoc2008-jezabek/Lib/modula3/modula3.swg 2008-05-20 19:59:13 UTC (rev 10476) @@ -455,7 +455,7 @@ $1 = *argp; %} %typemap(out) SWIGTYPE #ifdef __cplusplus ... [truncated message content] |