From: <spl...@us...> - 2009-08-17 16:29:51
|
Revision: 11627 http://swig.svn.sourceforge.net/swig/?rev=11627&view=rev Author: sploving Date: 2009-08-17 16:29:31 +0000 (Mon, 17 Aug 2009) Log Message: ----------- merge from trunk Modified Paths: -------------- branches/gsoc2009-sploving/CCache/Makefile.in branches/gsoc2009-sploving/CHANGES.current branches/gsoc2009-sploving/Doc/Manual/Perl5.html branches/gsoc2009-sploving/Doc/Manual/SWIG.html branches/gsoc2009-sploving/Examples/php/check.list branches/gsoc2009-sploving/Examples/php/class/Makefile branches/gsoc2009-sploving/Examples/php/class/runme.php branches/gsoc2009-sploving/Examples/php/reference/Makefile branches/gsoc2009-sploving/Examples/php/reference/example.cxx branches/gsoc2009-sploving/Examples/php/reference/example.h branches/gsoc2009-sploving/Examples/php/reference/example.i branches/gsoc2009-sploving/Examples/php/reference/runme.php branches/gsoc2009-sploving/Examples/test-suite/char_strings.i branches/gsoc2009-sploving/Examples/test-suite/common.mk branches/gsoc2009-sploving/Examples/test-suite/csharp/char_strings_runme.cs branches/gsoc2009-sploving/Examples/test-suite/csharp/overload_template_runme.cs branches/gsoc2009-sploving/Examples/test-suite/enums.i branches/gsoc2009-sploving/Examples/test-suite/java/char_strings_runme.java branches/gsoc2009-sploving/Examples/test-suite/java/java_throws_runme.java branches/gsoc2009-sploving/Examples/test-suite/java/overload_template_runme.java branches/gsoc2009-sploving/Examples/test-suite/java/template_methods_runme.java branches/gsoc2009-sploving/Examples/test-suite/java_throws.i branches/gsoc2009-sploving/Examples/test-suite/lextype.i branches/gsoc2009-sploving/Examples/test-suite/li_math.i branches/gsoc2009-sploving/Examples/test-suite/lua/overload_template_runme.lua branches/gsoc2009-sploving/Examples/test-suite/octave/empty_runme.m branches/gsoc2009-sploving/Examples/test-suite/octave/exception_order_runme.m branches/gsoc2009-sploving/Examples/test-suite/octave/imports_runme.m branches/gsoc2009-sploving/Examples/test-suite/octave/li_std_vector_runme.m branches/gsoc2009-sploving/Examples/test-suite/octave/multi_import_runme.m branches/gsoc2009-sploving/Examples/test-suite/octave/overload_template_runme.m branches/gsoc2009-sploving/Examples/test-suite/overload_template.i branches/gsoc2009-sploving/Examples/test-suite/php/add_link_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/arrayptr_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/arrays_global_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/arrays_global_twodim_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/arrays_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/arrays_scope_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/casts_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/class_ignore_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/conversion_namespace_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/conversion_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/cpp_static_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/director_nested_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/director_string_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/enum_scope_template_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/evil_diamond_ns_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/evil_diamond_prop_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/evil_diamond_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/extend_template_ns_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/extend_template_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/grouping_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/ignore_parameter_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/li_carrays_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/li_std_string_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/newobject1_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/prefix_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/rename_scope_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/smart_pointer_rename_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/sym_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/template_arg_typename_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/valuewrapper_base_runme.php branches/gsoc2009-sploving/Examples/test-suite/php_namewarn_rename.i branches/gsoc2009-sploving/Examples/test-suite/python/Makefile.in branches/gsoc2009-sploving/Examples/test-suite/python/overload_template_runme.py branches/gsoc2009-sploving/Examples/test-suite/rename_scope.i branches/gsoc2009-sploving/Examples/test-suite/ruby/li_std_vector_runme.rb branches/gsoc2009-sploving/Examples/test-suite/ruby/overload_template_runme.rb branches/gsoc2009-sploving/Examples/test-suite/template_default_qualify.i branches/gsoc2009-sploving/Examples/test-suite/template_enum_ns_inherit.i branches/gsoc2009-sploving/Examples/test-suite/template_enum_typedef.i branches/gsoc2009-sploving/Examples/test-suite/template_methods.i branches/gsoc2009-sploving/Examples/test-suite/template_ns4.i branches/gsoc2009-sploving/Examples/test-suite/valuewrapper_base.i branches/gsoc2009-sploving/Lib/exception.i branches/gsoc2009-sploving/Lib/octave/octrun.swg branches/gsoc2009-sploving/Lib/octave/octtypemaps.swg branches/gsoc2009-sploving/Lib/perl5/noembed.h branches/gsoc2009-sploving/Lib/perl5/perlrun.swg branches/gsoc2009-sploving/Lib/php/php.swg branches/gsoc2009-sploving/Lib/php/phpkw.swg branches/gsoc2009-sploving/Lib/php/phprun.swg branches/gsoc2009-sploving/Lib/php/std_vector.i branches/gsoc2009-sploving/Lib/php/utils.i branches/gsoc2009-sploving/Lib/python/pyrun.swg branches/gsoc2009-sploving/Lib/ruby/rubycontainer.swg branches/gsoc2009-sploving/Makefile.in branches/gsoc2009-sploving/README branches/gsoc2009-sploving/Source/CParse/parser.y branches/gsoc2009-sploving/Source/Modules/allocate.cxx branches/gsoc2009-sploving/Source/Modules/csharp.cxx branches/gsoc2009-sploving/Source/Modules/java.cxx branches/gsoc2009-sploving/Source/Modules/modula3.cxx branches/gsoc2009-sploving/Source/Modules/octave.cxx branches/gsoc2009-sploving/Source/Modules/php.cxx Added Paths: ----------- branches/gsoc2009-sploving/Examples/test-suite/catches.i branches/gsoc2009-sploving/Examples/test-suite/csharp/catches_runme.cs branches/gsoc2009-sploving/Examples/test-suite/csharp/exception_order_runme.cs branches/gsoc2009-sploving/Examples/test-suite/php/char_strings_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/pointer_reference_runme.php branches/gsoc2009-sploving/Examples/test-suite/php/primitive_ref_runme.php Removed Paths: ------------- branches/gsoc2009-sploving/Examples/test-suite/octave/director_exception_runme.m branches/gsoc2009-sploving/Examples/test-suite/octave/director_finalizer_runme.m Property Changed: ---------------- branches/gsoc2009-sploving/ branches/gsoc2009-sploving/Examples/php/extend/ Property changes on: branches/gsoc2009-sploving ___________________________________________________________________ Modified: svn:mergeinfo - /branches/swig-2.0:11085-11086,11088-11089 /trunk:11203-11523 + /branches/swig-2.0:11085-11086,11088-11089 /trunk:11203-11626 Modified: branches/gsoc2009-sploving/CCache/Makefile.in =================================================================== --- branches/gsoc2009-sploving/CCache/Makefile.in 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/CCache/Makefile.in 2009-08-17 16:29:31 UTC (rev 11627) @@ -53,7 +53,7 @@ clean: /bin/rm -f $(OBJS) *~ $(PACKAGE_NAME)$(EXEEXT) -clean-docs: +distclean-docs: rm -f $(PACKAGE_NAME).1 web/ccache-man.html check : test @@ -63,7 +63,7 @@ check: test -distclean: clean +distclean: clean distclean-docs /bin/rm -f Makefile config.h config.sub config.log build-stamp config.status configure config.h # FIXME: To fix this, test.sh needs to be able to take ccache from the Modified: branches/gsoc2009-sploving/CHANGES.current =================================================================== --- branches/gsoc2009-sploving/CHANGES.current 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/CHANGES.current 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,6 +1,57 @@ Version 1.3.40 (in progress) ============================ +2009-08-17: olly + [Perl] Add "#undef do_exec" to our clean up of Perl global + namespace pollution. + +2009-08-17: olly + [PHP] Fix to wrap a resource returned by __get() in a PHP object (SF#2549217). + +2009-08-17: wsfulton + Fix #2797485 After doing a 'make clean', install fails if yodl2man or yodl2html + is not available. + +2009-08-16: wsfulton + [Octave] Caught exceptions display the type of the C++ exception instead of the + generic "c++-side threw an exception" message. + +2009-08-16: wsfulton + [Java] When %catches is used, fix so that any classes specified in the "throws" + attribute of the "throws" typemap are generated into the Java method's throws clause. + +2009-08-16: wsfulton + [C#] Fix exception handling when %catches is used, reported by Juan Manuel Alvarez. + +2009-08-15: wsfulton + Fix %template seg fault on some cases of overloading the templated method. + Bug reported by Jan Kupec. + +2009-08-15: wsfulton + [Ruby] Add numerous missing wrapped methods for std::vector<bool> specialization + as reported by Youssef Jones. + +2009-08-14: wsfulton + [Perl] Add SWIG_ConvertPtrAndOwn() method into the runtime for smart pointer + memory ownership control. shared_ptr support still to be added. Patch from + David Fletcher. + +2009-08-14: olly + [PHP] PHP5 now wraps static member variables as documented. + +2009-08-14: olly + [PHP] Update the PHP "class" example to work with PHP5 and use + modern wrapping features. + +2009-08-13: wsfulton + [PHP] std::vector wrappers overhaul. They no longer require the + specialize_std_vector() macro. Added wrappers for capacity() and reserve(). + +2009-08-13: wsfulton + [PHP] Add const reference typemaps. const reference primitive types are + now passed by value rather than pointer like the other target languages. + Fixes SF#2524029. + 2009-08-08: wsfulton [Python] More user friendly AttributeError is raised when there are no constructors generated for the proxy class in the event that the @@ -81,6 +132,9 @@ different name to the class, as such constructors can still take parameters. +2009-07-12: xavier98 + [Octave] Add support for Octave 3.2 API + 2009-07-05: olly [PHP] Update the list of PHP keywords - "cfunction" is no longer a keyword in PHP5 and PHP 5.3 added "goto", "namespace", "__DIR__", @@ -100,8 +154,8 @@ Fix -Wallkw option as reported by Solomon Gibbs. 2009-07-02: wsfulton - Fix syntax error when a nested struct contains a comment containing a * followed eventually by a /. - Regression from 1.3.37, reported by Solomon Gibbs. + Fix syntax error when a nested struct contains a comment containing a * followed + eventually by a /. Regression from 1.3.37, reported by Solomon Gibbs. 2009-07-01: vmiklos [PHP] Unknown properties are no longer ignored in proxy Modified: branches/gsoc2009-sploving/Doc/Manual/Perl5.html =================================================================== --- branches/gsoc2009-sploving/Doc/Manual/Perl5.html 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Doc/Manual/Perl5.html 2009-08-17 16:29:31 UTC (rev 11627) @@ -2173,7 +2173,7 @@ }; myav = av_make(len,svs); free(svs); - $result = newRV((SV*)myav); + $result = newRV_noinc((SV*)myav); sv_2mortal($result); argvi++; } Modified: branches/gsoc2009-sploving/Doc/Manual/SWIG.html =================================================================== --- branches/gsoc2009-sploving/Doc/Manual/SWIG.html 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Doc/Manual/SWIG.html 2009-08-17 16:29:31 UTC (rev 11627) @@ -667,7 +667,6 @@ enum months {JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC}; %constant double BLAH = 42.37; -#define F_CONST (double) 5 // A floating pointer constant with cast #define PI_4 PI/4 #define FLAGS 0x04 | 0x08 | 0x40 @@ -706,8 +705,15 @@ <p> defines a constant because <tt>PI</tt> was already defined as a constant and the value is known. +However, for the same conservative reasons even a constant with a simple cast will be ignored, such as </p> +<div class="code"> +<pre> +#define F_CONST (double) 5 // A floating pointer constant with cast +</pre> +</div> + <p> 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 @@ -2382,6 +2388,10 @@ <p> Note the usage of the <tt>$self</tt> special variable. Its usage is identical to a C++ 'this' pointer and should be used whenever access to the struct instance is required. +Also note that C++ constructor and destructor syntax has been used to simulate a constructor and destructor, even for C code. +There is one subtle difference to a normal C++ constructor implementation though and that is although the constructor declaration +is as per a normal C++ constructor, the newly constructed object must be returned <b>as if</b> the constructor declaration +had a return value, a <tt>Vector *</tt> in this case. </p> <p> @@ -2706,6 +2716,10 @@ </p> <ul> +<li><b>Begin section</b>. <br> +A placeholder to put code at the beginning of the C/C++ wrapper file. +</li> + <li><b>Runtime code</b>. <br> This code is internal to SWIG and is used to include type-checking and other support functions that are used by the rest of the module. Modified: branches/gsoc2009-sploving/Examples/php/check.list =================================================================== --- branches/gsoc2009-sploving/Examples/php/check.list 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/php/check.list 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,16 +1,18 @@ # see top-level Makefile.in # (see also top-level configure.in kludge) +callback class constants cpointer disown enum +extend funcptr overloading pointer pragmas +proxy reference -proxy simple sync value Modified: branches/gsoc2009-sploving/Examples/php/class/Makefile =================================================================== --- branches/gsoc2009-sploving/Examples/php/class/Makefile 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/php/class/Makefile 2009-08-17 16:29:31 UTC (rev 11627) @@ -4,7 +4,7 @@ TARGET = example INTERFACE = example.i LIBS = -SWIGOPT = -noproxy +SWIGOPT = all:: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ Modified: branches/gsoc2009-sploving/Examples/php/class/runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/php/class/runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/php/class/runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,22 +1,20 @@ <?php -# This file illustrates the low-level C++ interface -# created by SWIG. In this case, all of our C++ classes -# get converted into function calls. +# This example illustrates how member variables are wrapped. require("example.php"); # ----- Object creation ----- print "Creating some objects:\n"; -$c = new_Circle(10); -print " Created circle $c\n"; -$s = new_Square(10); -print " Created square $s\n"; +$c = new Circle(10); +print " Created circle\n"; +$s = new Square(10); +print " Created square\n"; # ----- Access a static member ----- -print "\nA total of " . nshapes() . " shapes were created\n"; +print "\nA total of " . Shape::get_nshapes() . " shapes were created\n"; # ----- Member data access ----- @@ -24,14 +22,14 @@ # Note: methods in the base class Shape are used since # x and y are defined there. -Shape_x_set($c, 20); -Shape_y_set($c, 30); -Shape_x_set($s,-10); -Shape_y_set($s,5); +$c->x = 20; +$c->y = 30; +$s->x = -10; +$s->y = 5; print "\nHere is their current position:\n"; -print " Circle = (" . Shape_x_get($c) . "," . Shape_y_get($c) . ")\n"; -print " Square = (" . Shape_x_get($s) . "," . Shape_y_get($s) . ")\n"; +print " Circle = ({$c->x},{$c->y})\n"; +print " Square = ({$s->x},{$s->y})\n"; # ----- Call some methods ----- @@ -39,18 +37,16 @@ # invoke the appropriate virtual method on each object. print "\nHere are some properties of the shapes:\n"; foreach (array($c,$s) as $o) { - print " $o\n"; - print " area = " . Shape_area($o) . "\n"; - print " perimeter = " . Shape_perimeter($o) . "\n"; - } + print " ". get_class($o) . "\n"; + print " area = {$o->area()}\n"; + print " perimeter = {$o->perimeter()}\n"; +} # ----- Delete everything ----- print "\nGuess I'll clean up now\n"; # Note: this invokes the virtual destructor -#delete_Shape($c); -#delete_Shape($s); $c = NULL; $s = NULL; @@ -58,7 +54,7 @@ # the square. $o = NULL; -print nshapes() . " shapes remain\n"; +print Shape::get_nshapes() . " shapes remain\n"; print "Goodbye\n"; ?> Property changes on: branches/gsoc2009-sploving/Examples/php/extend ___________________________________________________________________ Added: svn:mergeinfo + /branches/swig-2.0/Examples/php/extend:11085-11086,11088-11089 /trunk/Examples/php/extend:11203-11488,11524-11626 Modified: branches/gsoc2009-sploving/Examples/php/reference/Makefile =================================================================== --- branches/gsoc2009-sploving/Examples/php/reference/Makefile 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/php/reference/Makefile 2009-08-17 16:29:31 UTC (rev 11627) @@ -4,7 +4,7 @@ TARGET = example INTERFACE = example.i LIBS = -SWIGOPT = -noproxy +SWIGOPT = all:: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ Modified: branches/gsoc2009-sploving/Examples/php/reference/example.cxx =================================================================== --- branches/gsoc2009-sploving/Examples/php/reference/example.cxx 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/php/reference/example.cxx 2009-08-17 16:29:31 UTC (rev 11627) @@ -17,7 +17,7 @@ return r; } -char *Vector::print() { +char *Vector::as_string() { static char temp[512]; sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); return temp; @@ -47,4 +47,3 @@ printf("VectorArray: size %d self=%p\n",maxsize,this); return maxsize; } - Modified: branches/gsoc2009-sploving/Examples/php/reference/example.h =================================================================== --- branches/gsoc2009-sploving/Examples/php/reference/example.h 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/php/reference/example.h 2009-08-17 16:29:31 UTC (rev 11627) @@ -7,7 +7,7 @@ Vector() : x(0), y(0), z(0) { }; Vector(double x, double y, double z) : x(x), y(y), z(z) { }; friend Vector operator+(const Vector &a, const Vector &b); - char *print(); + char *as_string(); }; class VectorArray { Modified: branches/gsoc2009-sploving/Examples/php/reference/example.i =================================================================== --- branches/gsoc2009-sploving/Examples/php/reference/example.i 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/php/reference/example.i 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,6 +1,10 @@ /* File : example.i */ -/* This file has a few "typical" uses of C++ references. */ +/* This example has nothing to do with references but the name is used by all + * the other languages so it's hard to rename to something more meaningful. + * + * Mostly it shows how to use %extend. + */ %module example @@ -12,7 +16,7 @@ public: Vector(double x, double y, double z); ~Vector(); - char *print(); + char *as_string(); }; /* This helper function calls an overloaded operator */ @@ -41,4 +45,3 @@ } } }; - Modified: branches/gsoc2009-sploving/Examples/php/reference/runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/php/reference/runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/php/reference/runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,18 +1,17 @@ <?php -# This file illustrates the manipulation of C++ references in Php. -# This uses the low-level interface. Proxy classes work differently. +# This file illustrates the manipulation of C++ references in PHP. require "example.php"; # ----- Object creation ----- print "Creating some objects:\n"; -$a = new_Vector(3,4,5); -$b = new_Vector(10,11,12); +$a = new Vector(3, 4, 5); +$b = new Vector(10, 11, 12); -print " Created a: $a " . Vector_print($a) . "\n"; -print " Created b: $b " . Vector_print($b) . "\n"; +print " Created a: {$a->as_string()}\n"; +print " Created b: {$b->as_string()}\n"; # ----- Call an overloaded operator ----- @@ -23,56 +22,28 @@ # It returns a new allocated object. print "Adding a+b\n"; -$c = addv($a,$b); -print " a+b =". Vector_print($c)."\n"; +$c = example::addv($a, $b); +print " a+b ={$c->as_string()}\n"; -# Note: Unless we free the result, a memory leak will occur -$c = None; - # ----- Create a vector array ----- -# Note: Using the high-level interface here print "Creating an array of vectors\n"; -$va = new_VectorArray(10); +$va = new VectorArray(10); -print " va: $va size=".VectorArray_size($va)."\n"; +print " va: size={$va->size()}\n"; # ----- Set some values in the array ----- # These operators copy the value of $a and $b to the vector array -VectorArray_set($va,0,$a); -VectorArray_set($va,1,$b); +$va->set(0, $a); +$va->set(1, $b); +$va->set(2, addv($a, $b)); -VectorArray_get($va,0); -# This will work, but it will cause a memory leak! - -VectorArray_set($va,2,addv($a,$b)); - -# The non-leaky way to do it - -$c = addv($a,$b); -VectorArray_set($va,3,$c); -$c = None; - # Get some values from the array print "Getting some array values\n"; for ($i = 0; $i < 5; $i++) { -print "do $i\n"; - print " va($i) = ". Vector_print(VectorArray_get($va,$i)). "\n"; + print " va[$i] = {$va->get($i)->as_string()}\n"; } -# Watch under resource meter to check on this -#print "Making sure we don't leak memory.\n"; -#for ($i = 0; $i < 1000000; $i++) { -# $c = VectorArray_get($va,$i % 10); -#} - -# ----- Clean up ----- -print "Cleaning up\n"; -# wants fixing FIXME -$va = None; -$a = None; -$b = None; - ?> Copied: branches/gsoc2009-sploving/Examples/test-suite/catches.i (from rev 11626, trunk/Examples/test-suite/catches.i) =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/catches.i (rev 0) +++ branches/gsoc2009-sploving/Examples/test-suite/catches.i 2009-08-17 16:29:31 UTC (rev 11627) @@ -0,0 +1,33 @@ +%module catches + +%{ +#if defined(_MSC_VER) + #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) +#endif +%} + +%include <exception.i> // for throws(...) typemap + +%catches(int, const char *, const ThreeException&) test_catches(int i); +%catches(int, ...) test_exception_specification(int i); // override the exception specification +%catches(...) test_catches_all(int i); + +%inline %{ +struct ThreeException {}; +void test_catches(int i) { + if (i == 1) { + throw int(1); + } else if (i == 2) { + throw (const char *)"two"; + } else if (i == 3) { + throw ThreeException(); + } +} +void test_exception_specification(int i) throw(int, const char *, const ThreeException&) { + test_catches(i); +} +void test_catches_all(int i) { + test_catches(i); +} +%} + Modified: branches/gsoc2009-sploving/Examples/test-suite/char_strings.i =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/char_strings.i 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/char_strings.i 2009-08-17 16:29:31 UTC (rev 11627) @@ -149,6 +149,18 @@ %inline %{ // char *& tests +char *&GetCharPointerRef() { + static char str[] = CPLUSPLUS_MSG; + static char *ptr = str; + return ptr; +} + +bool SetCharPointerRef(char *&str, unsigned int number) { + static char static_str[] = CPLUSPLUS_MSG; + strcpy(static_str, str); + return check(static_str, number); +} + const char *&GetConstCharPointerRef() { static const char str[] = CPLUSPLUS_MSG; static const char *ptr = str; Modified: branches/gsoc2009-sploving/Examples/test-suite/common.mk =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/common.mk 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/common.mk 2009-08-17 16:29:31 UTC (rev 11627) @@ -117,6 +117,7 @@ arrays_scope \ bloody_hell \ bools \ + catches \ cast_operator \ casts \ char_strings \ Copied: branches/gsoc2009-sploving/Examples/test-suite/csharp/catches_runme.cs (from rev 11626, trunk/Examples/test-suite/csharp/catches_runme.cs) =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/csharp/catches_runme.cs (rev 0) +++ branches/gsoc2009-sploving/Examples/test-suite/csharp/catches_runme.cs 2009-08-17 16:29:31 UTC (rev 11627) @@ -0,0 +1,66 @@ +using System; +using catchesNamespace; + +public class runme { + static void Main() { + // test_catches() + try { + catches.test_catches(1); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "C++ int exception thrown, value: 1") + throw new ApplicationException("bad exception order: " + e.Message); + } + + try { + catches.test_catches(2); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "two") + throw new ApplicationException("bad exception order: " + e.Message); + } + + try { + catches.test_catches(3); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "C++ ThreeException const & exception thrown") + throw new ApplicationException("bad exception order: " + e.Message); + } + + // test_exception_specification() + try { + catches.test_exception_specification(1); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "C++ int exception thrown, value: 1") + throw new ApplicationException("bad exception order: " + e.Message); + } + + try { + catches.test_exception_specification(2); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "unknown exception") + throw new ApplicationException("bad exception order: " + e.Message); + } + + try { + catches.test_exception_specification(3); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "unknown exception") + throw new ApplicationException("bad exception order: " + e.Message); + } + + // test_catches_all() + try { + catches.test_catches_all(1); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "unknown exception") + throw new ApplicationException("bad exception order: " + e.Message); + } + + } +} Modified: branches/gsoc2009-sploving/Examples/test-suite/csharp/char_strings_runme.cs =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/csharp/char_strings_runme.cs 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/csharp/char_strings_runme.cs 2009-08-17 16:29:31 UTC (rev 11627) @@ -120,15 +120,26 @@ // char *& tests for (i=0; i<count; i++) { - String str = char_strings.GetConstCharPointerRef(); + String str = char_strings.GetCharPointerRef(); if (str != CPLUSPLUS_MSG) throw new Exception("Test char pointer ref get failed, iteration " + i); } for (i=0; i<count; i++) { - if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i)) + if (!char_strings.SetCharPointerRef(OTHERLAND_MSG + i, i)) throw new Exception("Test char pointer ref set failed, iteration " + i); } + + for (i=0; i<count; i++) { + String str = char_strings.GetConstCharPointerRef(); + if (str != CPLUSPLUS_MSG) + throw new Exception("Test const char pointer ref get failed, iteration " + i); + } + + for (i=0; i<count; i++) { + if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i)) + throw new Exception("Test const char pointer ref set failed, iteration " + i); + } } } Copied: branches/gsoc2009-sploving/Examples/test-suite/csharp/exception_order_runme.cs (from rev 11626, trunk/Examples/test-suite/csharp/exception_order_runme.cs) =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/csharp/exception_order_runme.cs (rev 0) +++ branches/gsoc2009-sploving/Examples/test-suite/csharp/exception_order_runme.cs 2009-08-17 16:29:31 UTC (rev 11627) @@ -0,0 +1,48 @@ +using System; +using exception_orderNamespace; + +public class runme { + static void Main() { + A a = new A(); + + try { + a.foo(); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "C++ E1 exception thrown") + throw new ApplicationException("bad exception order: " + e.Message); + } + + try { + a.bar(); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "C++ E2 exception thrown") + throw new ApplicationException("bad exception order: " + e.Message); + } + + try { + a.foobar(); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "postcatch unknown") + throw new ApplicationException("bad exception order: " + e.Message); + } + + try { + a.barfoo(1); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "C++ E1 exception thrown") + throw new ApplicationException("bad exception order: " + e.Message); + } + + try { + a.barfoo(2); + throw new Exception("missed exception"); + } catch (ApplicationException e) { + if (e.Message != "C++ E2 * exception thrown") + throw new ApplicationException("bad exception order: " + e.Message); + } + } +} Modified: branches/gsoc2009-sploving/Examples/test-suite/csharp/overload_template_runme.cs =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/csharp/overload_template_runme.cs 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/csharp/overload_template_runme.cs 2009-08-17 16:29:31 UTC (rev 11627) @@ -7,8 +7,8 @@ { int f = overload_template.foo(); - f += overload_template.max(3,4); - double b = overload_template.max(3.4,5.2); + f += overload_template.maximum(3,4); + double b = overload_template.maximum(3.4,5.2); b++; // warning suppression // mix 1 Modified: branches/gsoc2009-sploving/Examples/test-suite/enums.i =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/enums.i 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/enums.i 2009-08-17 16:29:31 UTC (rev 11627) @@ -32,8 +32,14 @@ enum sad { boo, hoo = 5 }; +#ifdef __cplusplus /* For Octave and g++ which compiles C test code as C++ */ +extern "C" { +#endif /* Unnamed enum instance */ enum { globalinstance1, globalinstance2, globalinstance3 = 30 } GlobalInstance; +#ifdef __cplusplus +} +#endif /* Anonymous enum */ enum { AnonEnum1, AnonEnum2 = 100 }; Modified: branches/gsoc2009-sploving/Examples/test-suite/java/char_strings_runme.java =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/java/char_strings_runme.java 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/java/char_strings_runme.java 2009-08-17 16:29:31 UTC (rev 11627) @@ -127,15 +127,26 @@ // char *& tests for (i=0; i<count; i++) { - String str = char_strings.GetConstCharPointerRef(); + String str = char_strings.GetCharPointerRef(); if (!str.equals(CPLUSPLUS_MSG)) throw new RuntimeException("Test char pointer ref get failed, iteration " + i); } for (i=0; i<count; i++) { - if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i)) + if (!char_strings.SetCharPointerRef(OTHERLAND_MSG + i, i)) throw new RuntimeException("Test char pointer ref set failed, iteration " + i); } + + for (i=0; i<count; i++) { + String str = char_strings.GetConstCharPointerRef(); + if (!str.equals(CPLUSPLUS_MSG)) + throw new RuntimeException("Test const char pointer ref get failed, iteration " + i); + } + + for (i=0; i<count; i++) { + if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i)) + throw new RuntimeException("Test const char pointer ref set failed, iteration " + i); + } } } Modified: branches/gsoc2009-sploving/Examples/test-suite/java/java_throws_runme.java =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/java/java_throws_runme.java 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/java/java_throws_runme.java 2009-08-17 16:29:31 UTC (rev 11627) @@ -40,6 +40,16 @@ if (!pass) throw new RuntimeException("Test 2 failed"); + // Check the exception class is used with %catches + pass = false; + try { + java_throws.catches_function(100); + } + catch (IllegalAccessException e) { pass = true; } + + if (!pass) + throw new RuntimeException("Test 3 failed"); + // Check newfree typemap throws attribute try { TestClass tc = java_throws.makeTestClass(); Modified: branches/gsoc2009-sploving/Examples/test-suite/java/overload_template_runme.java =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/java/overload_template_runme.java 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/java/overload_template_runme.java 2009-08-17 16:29:31 UTC (rev 11627) @@ -16,8 +16,8 @@ public static void main(String argv[]) { int f = overload_template.foo(); - int a = overload_template.max(3,4); - double b = overload_template.max(3.4,5.2); + int a = overload_template.maximum(3,4); + double b = overload_template.maximum(3.4,5.2); // mix 1 if (overload_template.mix1("hi") != 101) Modified: branches/gsoc2009-sploving/Examples/test-suite/java/template_methods_runme.java =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/java/template_methods_runme.java 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/java/template_methods_runme.java 2009-08-17 16:29:31 UTC (rev 11627) @@ -32,6 +32,13 @@ k.KlassTMethodBool(); b = Klass.KlassStaticTMethodBoolRenamed(true); Klass.KlassStaticTMethodBool(); + + + // + ComponentProperties cp = new ComponentProperties(); + cp.adda("key1", "val1", "key2", 22.2); + cp.adda("key1", "val1", "key2", "val2", "key3", "val3"); + cp.adda("key1", 1, "key2", 2, "key3", 3); } } Modified: branches/gsoc2009-sploving/Examples/test-suite/java_throws.i =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/java_throws.i 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/java_throws.i 2009-08-17 16:29:31 UTC (rev 11627) @@ -42,12 +42,16 @@ #if defined(_MSC_VER) #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) #endif -void throw_spec_function(int value) throw (int) { throw (int)0; } +bool throw_spec_function(int value) throw (int) { throw (int)0; } #if defined(_MSC_VER) #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) #endif %} +%catches(int) catches_function(int value); +%inline %{ +bool catches_function(int value) { throw (int)0; } +%} // Check newfree typemap throws attribute %newobject makeTestClass; Modified: branches/gsoc2009-sploving/Examples/test-suite/lextype.i =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/lextype.i 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/lextype.i 2009-08-17 16:29:31 UTC (rev 11627) @@ -30,13 +30,13 @@ %typemap(in) Animal () { void *space_needed = malloc(HEIGHT_$1_lextype * WIDTH_$1_lextype); - $1 = space_needed; + $1 = ($1_ltype)space_needed; } %typemap(in) Animal[2] () { void *space_needed = malloc(2 * HEIGHT_$1_lextype * WIDTH_$1_lextype); - $1 = space_needed; + $1 = ($1_ltype)space_needed; } %inline %{ Modified: branches/gsoc2009-sploving/Examples/test-suite/li_math.i =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/li_math.i 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/li_math.i 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,2 +1,7 @@ %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 Modified: branches/gsoc2009-sploving/Examples/test-suite/lua/overload_template_runme.lua =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/lua/overload_template_runme.lua 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/lua/overload_template_runme.lua 2009-08-17 16:29:31 UTC (rev 11627) @@ -2,12 +2,12 @@ import("overload_template") -- import code for k,v in pairs(overload_template) do _G[k]=v end -- move to global --- lua has only one numeric type, so max(int,int) and max(double,double) are the same +-- lua has only one numeric type, so maximum(int,int) and maximum(double,double) are the same -- whichever one was wrapper first will be used (which is int) f = foo() -a = max(3,4) +a = maximum(3,4) -- mix 1 assert(mix1("hi") == 101) Deleted: branches/gsoc2009-sploving/Examples/test-suite/octave/director_exception_runme.m =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/octave/director_exception_runme.m 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/octave/director_exception_runme.m 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,57 +0,0 @@ -director_exception - -MyFoo=@() subclass(Foo(), - 'ping',@(self) raise(NotImplementedError("MyFoo::ping() EXCEPTION"))); - -MyFoo2=@() subclass(Foo(), - 'ping',@(self) true); - -ok = 0; - -a = MyFoo(); -b = launder(a); - -try - b.pong(); -catch - [etype,e]=raised(); - if (etype=="NotImplementedError") - ok=1; - endif -end_try_catch - -if (!ok) - error -endif - -ok = 0; - -a = MyFoo2(); -b = launder(a); - -try - b.pong(); -catch - ok = 1; -end_try_catch - -if (!ok) - error -endif - - -try - raise(Exception2()); -catch - if (!strcmp(raised,"Exception2")) - rethrow(lasterr); - endif -end_try_catch - -try - raise(Exception1()); -catch - if (!strcmp(raised,"Exception1")) - rethrow(lasterr); - endif -end_try_catch Deleted: branches/gsoc2009-sploving/Examples/test-suite/octave/director_finalizer_runme.m =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/octave/director_finalizer_runme.m 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/octave/director_finalizer_runme.m 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,56 +0,0 @@ -director_finalizer - -MyFoo=@() subclass(Foo(),'__del__',@delete_MyFoo); -function delete_MyFoo(self) - self.orStatus(2); - try - Foo.__del__(self); - catch - end_try_catch -endfunction - -resetStatus(); - -a = MyFoo(); -clear a; - -if (getStatus() != 3) - error -endif - -resetStatus(); - -a = MyFoo(); -launder(a); - -if (getStatus() != 0) - error -endif - -clear a; - -if (getStatus() != 3) - error -endif - -resetStatus(); - -a = MyFoo().__disown__(); -deleteFoo(a); - -if (getStatus() != 3) - error -endif - -resetStatus(); - -a = MyFoo().__disown__(); -deleteFoo(launder(a)); - -if (getStatus() != 3) - error -endif - -resetStatus(); - - Modified: branches/gsoc2009-sploving/Examples/test-suite/octave/empty_runme.m =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/octave/empty_runme.m 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/octave/empty_runme.m 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,17 +1,2 @@ empty -printf("begin\n"); -who global - -printf("after load\n"); -who global - -#clear -g -printf("after clear\n"); -who global - -#clear empty -printf("after clear specific\n"); -who global - -printf("before shutdown\n"); Modified: branches/gsoc2009-sploving/Examples/test-suite/octave/exception_order_runme.m =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/octave/exception_order_runme.m 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/octave/exception_order_runme.m 2009-08-17 16:29:31 UTC (rev 11627) @@ -6,40 +6,39 @@ try a.foo() catch - if (!strcmp(raised(),"E1")) - error, "bad exception order" + if (!strcmp(lasterror.message, "error: C++ side threw an exception of type E1\n")) + error("bad exception order") endif end_try_catch try a.bar() catch - if (!strcmp(raised(),"E2")) - error, "bad exception order" + if (!strcmp(lasterror.message, "error: C++ side threw an exception of type E2\n")) + error("bad exception order") endif end_try_catch try a.foobar() catch - [t,e]=raised(); - if (!strcmp(e.args(0),"postcatch unknown")) - error + if (!strcmp(lasterror.message, "error: postcatch unknown (SWIG_RuntimeError)\n")) + error("bad exception order") endif end_try_catch try a.barfoo(1) catch - if (!strcmp(raised(),"E1")) - error, "bad exception order" + if (!strcmp(lasterror.message, "error: C++ side threw an exception of type E1\n")) + error("bad exception order") endif end_try_catch try a.barfoo(2) catch - if (!strcmp(raised(),"E2")) - error, "bad exception order" + if (!strcmp(lasterror.message, "error: C++ side threw an exception of type E2 *\n")) + error("bad exception order") endif end_try_catch Modified: branches/gsoc2009-sploving/Examples/test-suite/octave/imports_runme.m =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/octave/imports_runme.m 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/octave/imports_runme.m 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,7 +1,7 @@ # This is the import runtime testcase. -imports_b -imports_a +imports_b; +imports_a; x = imports_b.B(); x.hello(); Modified: branches/gsoc2009-sploving/Examples/test-suite/octave/li_std_vector_runme.m =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/octave/li_std_vector_runme.m 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/octave/li_std_vector_runme.m 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,160 +1,11 @@ li_std_vector iv = IntVector(4); -for i=0:4, +for i=0:3, iv(i) = i; endfor - x = average(iv); -y = average([1,2,3,4]); -a = half([10,10.5,11,11.5]); - -dv = DoubleVector(10); -for i=0:10, - dv(i) = i/2.0; -endfor - -halve_in_place(dv); - - -bv = BoolVector(4); -bv(0)= 1; -bv(1)= 0; -bv(2)= 4; -bv(3)= 0; - -if (bv(0) != bv(2)) - error("bad std::vector<bool> mapping") +if (x != 1.5) + error("average failed"); endif - -b = B(5); -va = VecA([b,None,b,b]); - -if (va(0).f(1) != 6) - error("bad std::vector<A*> mapping") -endif - -if (vecAptr(va) != 6) - error("bad std::vector<A*> mapping") -endif - -b.val = 7; -if (va(3).f(1) != 8) - error("bad std::vector<A*> mapping") -endif - - -ip = PtrInt(); -ap = new_ArrInt(10); - -ArrInt_setitem(ip,0,123); -ArrInt_setitem(ap,2,123); - -vi = IntPtrVector((ip,ap,None)); -if (ArrInt_getitem(vi[0],0) != ArrInt_getitem(vi[1],2)) - error("bad std::vector<int*> mapping") -endif - -delete_ArrInt(ap); - - -a = halfs([10,8,4,3]); - -v = IntVector(); -v(0:2) = [1,2]; -if (v(0) != 1 || v[1] != 2) - error("bad setslice") -endif - -if (v(0:-1)(0) != 1) - error("bad getslice") -endif - -if (v(0:-2).size() != 0) - error("bad getslice") - -v(0:1) = [2]; -if (v(0) != 2) - error("bad setslice") -endif - -v(1:) = [3]; -if (v(1) != 3) - error("bad setslice") -endif - -v(2:) = [3] -if (v(2) != 3) - error("bad setslice") -endif - -if (v(0:)(0) != v(0)) - error("bad getslice") -endif - - -v.erase(:) -if (v.size() != 0) - error("bad getslice") -endif - -v.erase(:) -if (v.size() != 0) - error("bad getslice") -endif - - - -v = vecStr({"hello ", "world"}); -if (v(0) != 'hello world') - error,"bad std::string+std::vector" -endif - - -pv = pyvector({1, "hello", (1,2)}); - -if (pv(1) != "hello") - error -endif - - -iv = IntVector(5); -for i=0:5, - iv(i) = i -endif - -iv(1:3) = []; -if (iv(1) != 3) - error -endif - -# Overloading checks -if (overloaded1(iv) != "vector<int>") - error -endif - -if (overloaded1(dv) != "vector<double>") - error -endif - -if (overloaded2(iv) != "vector<int>") - error -endif - -if (overloaded2(dv) != "vector<double>") - error -endif - -if (overloaded3(iv) != "vector<int> *") - error -endif - -if (overloaded3(None) != "vector<int> *") - error -endif - -if (overloaded3(100) != "int") - error -endif - Modified: branches/gsoc2009-sploving/Examples/test-suite/octave/multi_import_runme.m =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/octave/multi_import_runme.m 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/octave/multi_import_runme.m 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,5 @@ -multi_import_a -multi_import_b +multi_import_a; +multi_import_b; x = multi_import_b.XXX(); if (x.testx() != 0) Modified: branches/gsoc2009-sploving/Examples/test-suite/octave/overload_template_runme.m =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/octave/overload_template_runme.m 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/octave/overload_template_runme.m 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,8 +1,8 @@ overload_template f = foo(); -a = max(3,4); -b = max(3.4,5.2); +a = maximum(3,4); +b = maximum(3.4,5.2); # mix 1 if (mix1("hi") != 101) Modified: branches/gsoc2009-sploving/Examples/test-suite/overload_template.i =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/overload_template.i 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/overload_template.i 2009-08-17 16:29:31 UTC (rev 11627) @@ -3,7 +3,7 @@ #ifdef SWIGLUA // lua only has one numeric type, so most of the overloads shadow each other creating warnings %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) foo; -%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) max; +%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) maximum; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) specialization; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) overload; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) space::nsoverload; @@ -11,12 +11,6 @@ %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) barT; #endif -%{ -#ifdef max -#undef max -#endif -%} - %inline %{ int foo() { @@ -29,15 +23,15 @@ } template<class T> - T max(T a, T b) { return (a > b) ? a : b; } + T maximum(T a, T b) { return (a > b) ? a : b; } %} %template(foo) foo<int>; %template(foo) foo<double>; -%template(max) max<int>; -%template(max) max<double>; +%template(maximum) maximum<int>; +%template(maximum) maximum<double>; // Mix template overloading with plain function overload // Mix 1 Modified: branches/gsoc2009-sploving/Examples/test-suite/php/add_link_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/add_link_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/add_link_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "add_link.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/arrayptr_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/arrayptr_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/arrayptr_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "arrayptr.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/arrays_global_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/arrays_global_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/arrays_global_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "arrays_global.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/arrays_global_twodim_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/arrays_global_twodim_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/arrays_global_twodim_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "arrays_global_twodim.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/arrays_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/arrays_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/arrays_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "arrays.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/arrays_scope_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/arrays_scope_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/arrays_scope_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "arrays_scope.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/casts_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/casts_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/casts_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "casts.php"; Copied: branches/gsoc2009-sploving/Examples/test-suite/php/char_strings_runme.php (from rev 11626, trunk/Examples/test-suite/php/char_strings_runme.php) =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/char_strings_runme.php (rev 0) +++ branches/gsoc2009-sploving/Examples/test-suite/php/char_strings_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -0,0 +1,43 @@ +<?php + +require "tests.php"; +require "char_strings.php"; + +$CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible."; +$OTHERLAND_MSG_10 = "Little message from the safe world.10"; + +check::equal(GetCharHeapString(), $CPLUSPLUS_MSG, "failed GetCharHeapString"); +check::equal(GetConstCharProgramCodeString(), $CPLUSPLUS_MSG, "failed GetConstCharProgramCodeString"); +check::equal(GetCharStaticString(), $CPLUSPLUS_MSG, "failed GetCharStaticString"); +check::equal(GetCharStaticStringFixed(), $CPLUSPLUS_MSG, "failed GetCharStaticStringFixed"); +check::equal(GetConstCharStaticStringFixed(), $CPLUSPLUS_MSG, "failed GetConstCharStaticStringFixed"); + +check::equal(SetCharHeapString($OTHERLAND_MSG_10, 10), true, "failed GetConstCharStaticStringFixed"); +check::equal(SetCharStaticString($OTHERLAND_MSG_10, 10), true, "failed SetCharStaticString"); +check::equal(SetCharArrayStaticString($OTHERLAND_MSG_10, 10), true, "failed SetCharArrayStaticString"); +check::equal(SetConstCharHeapString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharHeapString"); +check::equal(SetConstCharStaticString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharStaticString"); +check::equal(SetConstCharArrayStaticString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharArrayStaticString"); + +check::equal(CharPingPong($OTHERLAND_MSG_10), $OTHERLAND_MSG_10, "failed CharPingPong"); + +Global_char_set($OTHERLAND_MSG_10); +check::equal(Global_char_get(), $OTHERLAND_MSG_10, "failed Global_char_get"); + +Global_char_array1_set($OTHERLAND_MSG_10); +check::equal(Global_char_array1_get(), $OTHERLAND_MSG_10, "failed Global_char_array1_get"); + +Global_char_array2_set($OTHERLAND_MSG_10); +check::equal(Global_char_array2_get(), $OTHERLAND_MSG_10, "failed Global_char_array2_get"); + +check::equal(Global_const_char_get(), $CPLUSPLUS_MSG, "failed Global_const_char"); +check::equal(Global_const_char_array1_get(), $CPLUSPLUS_MSG, "failed Global_const_char_array1"); +check::equal(Global_const_char_array2_get(), $CPLUSPLUS_MSG, "failed Global_const_char_array2"); + +check::equal(GetCharPointerRef(), $CPLUSPLUS_MSG, "failed GetCharPointerRef"); +check::equal(SetCharPointerRef($OTHERLAND_MSG_10, 10), true, "failed SetCharPointerRef"); +check::equal(GetConstCharPointerRef(), $CPLUSPLUS_MSG, "failed GetConstCharPointerRef"); +check::equal(SetConstCharPointerRef($OTHERLAND_MSG_10, 10), true, "failed SetConstCharPointerRef"); + +check::done(); +?> Modified: branches/gsoc2009-sploving/Examples/test-suite/php/class_ignore_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/class_ignore_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/class_ignore_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "class_ignore.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/conversion_namespace_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/conversion_namespace_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/conversion_namespace_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "conversion_namespace.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/conversion_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/conversion_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/conversion_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "conversion.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/cpp_static_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/cpp_static_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/cpp_static_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "cpp_static.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/director_nested_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/director_nested_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/director_nested_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,5 +1,4 @@ <?php -// Sample test file require "tests.php"; require "director_nested.php"; Modified: branches/gsoc2009-sploving/Examples/test-suite/php/director_string_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/director_string_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/director_string_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -4,7 +4,7 @@ require "director_string.php"; // No new functions -check::functions(array(a_get_first,a_call_get_first,a_string_length,a_process_text,a_call_process_func,stringvector_size,stringvector_is_empty,stringvector_clear,stringvector_push,stringvector_pop)); +check::functions(array(a_get_first,a_call_get_first,a_string_length,a_process_text,a_call_process_func,stringvector_size,stringvector_is_empty,stringvector_clear,stringvector_push,stringvector_pop,stringvector_capacity,stringvector_reserve)); // No new classes check::classes(array(A,StringVector)); // now new vars Modified: branches/gsoc2009-sploving/Examples/test-suite/php/enum_scope_template_runme.php =================================================================== --- branches/gsoc2009-sploving/Examples/test-suite/php/enum_scope_template_runme.php 2009-08-17 15:35:09 UTC (rev 11626) +++ branches/gsoc2009-sploving/Examples/test-suite/php/enum_scope_template_runme.php 2009-08-17 16:29:31 UTC (rev 11627) @@ -1,14 +1,12 @@ <?php -// Sample test file - require "tests.php"; require "enum_scope_template.php"; check::classes(array("enum_scope_template", "TreeInt")); check::functions("c... [truncated message content] |