diff options
author | Dave Beazley <dave-swig@dabeaz.com> | 2002-12-03 19:23:40 +0000 |
---|---|---|
committer | Dave Beazley <dave-swig@dabeaz.com> | 2002-12-03 19:23:40 +0000 |
commit | 5de5df32629ce46ed3a6e5cb57f79a309e045d67 (patch) | |
tree | 161c7e35908396f0f22c4f5ebed63e0e52f39724 | |
parent | 9b3f0ae9b042f0d6b4f9253f18a727a643aa5d71 (diff) | |
download | swig-5de5df32629ce46ed3a6e5cb57f79a309e045d67.tar.gz |
*** empty log message ***
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4146 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r-- | CHANGES | 234 | ||||
-rw-r--r-- | CHANGES.current | 234 | ||||
-rw-r--r-- | Examples/C++/Java/Makefile | 20 | ||||
-rw-r--r-- | Examples/C++/Python/Makefile | 16 | ||||
-rw-r--r-- | Examples/C++/class/cpptest.H | 34 | ||||
-rw-r--r-- | Examples/C++/common.mk | 28 | ||||
-rw-r--r-- | Examples/C++/interface/cpptest.i | 28 | ||||
-rw-r--r-- | Examples/C++/test_conf.py.in | 15 | ||||
-rw-r--r-- | Examples/C++/test_repo/constructor.py | 8 | ||||
-rw-r--r-- | Examples/C++/test_repo/constructor_user_type.py | 8 | ||||
-rw-r--r-- | Examples/C++/test_repo/inheritence_map_to_base_class.py | 12 | ||||
-rw-r--r-- | Examples/C++/test_repo/object_method.py | 10 | ||||
-rw-r--r-- | Examples/C++/test_repo/object_method_user_type.py | 9 | ||||
-rw-r--r-- | Examples/C++/test_repo/primitive_method.py | 10 | ||||
-rw-r--r-- | Examples/C++/test_repo/primitive_method_user_type.py | 10 | ||||
-rw-r--r-- | Examples/C++/typemaps/MyString_typemap.i | 61 |
16 files changed, 237 insertions, 500 deletions
@@ -10,13 +10,245 @@ to the language modules take place, starting from the stable release Eventually this branch will be merged back to the trunk of the CVS tree (maybe). -Version 1.3.17 (In progress) +Version 1.3.18 (In progress) ============================ Due to the size of the CHANGES file, please add change entries to the file CHANGES.current. It will be merged into this file before release. -- Dave +Version 1.3.17 (November 22, 2002) +================================== +11/19/2002: beazley + Fixed [ 613922 ] preprocessor errors with HAVE_LONG_LONG. + +11/19/2002: beazley + Fixed [ 615480 ] mzscheme SWIG_MustGetPtr_. + +11/19/2002: beazley + Fixed [ 635119 ] SWIG_croak causes compiler warning. + +11/16/2002: cheetah (William Fulton) + [Java] Added typemaps for pointers to class members. + +11/15/2002: cheetah (William Fulton) + [Java] Bug fix: Overloaded C++ functions which cannot be overloaded in Java + once again issue a warning. + +11/14/2002: cheetah (William Fulton) + [Java] Handling of NULL pointers is improved. A java null object will now + be translated to and from a NULL C/C++ pointer by default. Previously when + wrapping: + + class SomeClass {...}; + void foo(SomeClass *s); + + and it was called from Java with null: + + modulename.foo(null) + + a Java NullPointerException was thrown. Extra typemaps had to be written in + order to obtain a NULL pointer to pass to functions like this one. Now the + default wrapping will detect 'null' and translate it into a NULL pointer. + Also if a function returns a NULL pointer, eg: + + SomeClass *bar() { return NULL; } + + Then this used to be wrapped with a SomeClass proxy class holding a NULL + pointer. Now null is returned instead. These changes are subtle but useful. + The original behaviour can be obtained by using the original typemaps: + + %typemap(javaout) SWIGTYPE { + return new $&javaclassname($jnicall, true); + } + %typemap(javaout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { + return new $javaclassname($jnicall, $owner); + } + %typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{ + protected static long getCPtr($javaclassname obj) { + return obj.swigCPtr; + } + %} + + *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** + + +11/12/2002: beazley + Fixed problem with abstract methods and signatures. For example: + + class abstract_foo { + public: + virtual int meth(int meth_param) = 0; + }; + + + class abstract_bar : public abstract_foo { + public: + int meth(int meth_param_1, int meth_param_2) { return 0; } + }; + + In this case, abstract_bar is still abstract. + + Fixes [ 628438 ] Derived abstract class not abstract. + Reported and patched by Scott Michel. + +11/11/2002: beazley + Fixed a matching problem with typemaps and array dimensions. For example, if you + had this: + + typedef char blah[20]; + + and a typemap: + + %typemap() char [ANY] { + ... $1_dim0 ... + } + + then $1_dim* variables weren't be expanded properly. It should work now. + Problem reported by Pankaj Kumar Goel. + +11/07/2002: mkoeppe + Added an experimental new module that dumps SWIG's parse + tree as (Common) Lisp s-expressions. The module is + invoked with SWIG's -sexp command-line switch. The output + can be read into Common Lisp. There is (prototype) + example Lisp code that generates Foreign Function Interface + definitions for use with Kevin Rosenberg's UFFI. + + *** EXPERIMENTAL NEW FEATURE *** + +11/07/2002: mkoeppe + Removed duplicate declaration of "cpp_template_decl" in + parser.y; bison 1.75 complained. + +11/06/2002: cheetah (William Fulton) + [Java] Default primitive array handling has changed like arrays of classes. + C primitive arrays are no longer wrapped by a Java array but with a pointer + (type wrapper class). Again the changes have been made for efficiency reasons. + The original typemaps have been moved into arrays_java.i, so the original + behaviour can be obtained merely including this file: + + %include "arrays_java.i" + + The array support functions are no longer generated by default. They are only + generated when including this file, thus this often unused code is only + generated when specifically requiring this type of array support. + + *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** + +11/05/2002: ljohnson (Lyle Johnson) + [Ruby] Added support for nested module declarations (as was + previously added for the Perl module). So a %module directive + of the form: + + %module "Outer::Inner::Foo" + + will nest everything as (in Ruby code): + + module Outer + module Inner + module Foo + # stuff goes here + end + end + end + +11/05/2002: mkoeppe + [MzScheme] Add an argument (-declaremodule) that generates + code to correctly declare a primitive module extension. + Patch submitted by Bruce Butterfield. + +11/02/2002: cheetah (William Fulton) + [Java] Added patch submitted by Michael Cahill to remove unused parameter + warnings for the jenv and cls parameters. This patch also also allows one + to use "void" in the jni typemap for any type without code being generated + attempting to return a value. + +10/29/2002: cheetah (William Fulton) + [Java] Array handling is different. Arrays of classes are no longer wrapped + with proxy arrays, eg wrapping + + class X {...}; + X foo[10]; + + used to be wrapped with these Java getters and setters: + + public static void setFoo(X[] value) {...} + public static X[] getFoo() {...} + + This approach is very inefficient as the entire array is copied numerous + times on each invocation of the getter or setter. These arrays are now + wrapped with a pointer so it is only possible to access the first array element + using a proxy class: + + public static void setFoo(X value) {...} + public static X getFoo() {...} + + Arrays of enums have also been similarly changed. This behaviour is now like the + other SWIG language's implementation and the array library should be used to + access the other elements. The original behaviour can be achieved using the + macros and typemaps in arrays_java.i, for example: + + %include "arrays_java.i" + JAVA_ARRAYSOFCLASSES(X) + class X {...}; + X foo[10]; + + *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** + +10/29/2002: cheetah (William Fulton) + [Java] Two new typemaps javain and javaout for generating the proxy class + and type wrapper class method calls to the JNI class. The new typemaps are + really used for transforming the jstype (used in proxy class and type wrapper + classes) to the jtype (used in the JNI class) and visa versa. A javain typemap + is required whenever an in typemap is written and similarly javaout for an out + typemap. An example is probably best to show them working: + + %typemap(javain) Class "Class.getCPtr($javainput)" + %typemap(javain) unsigned short "$javainput" + %typemap(javaout) Class * { + return new Class($jnicall, $owner); + } + + %inline %{ + class Class {}; + Class * bar(Class cls, unsigned short ush) { return new Class(); }; + %} + + The generated proxy code is then: + + public static Class bar(Class cls, int ush) { + return new Class(exampleJNI.bar(Class.getCPtr(cls), ush), false); + } + + + Some new special variables have been introduced in order to use these typemaps. + Here $javainput has been replaced by 'cls' and 'ush'. $jnicall has been replaced by + the native method call, 'exampleJNI.bar(...)' and $owner has been replaced by 'false'. + $javainput is analogous to the $input special variable. It is replaced by the parameter name. + $jnicall is analogous to $action in %exception. It is replaced by the call to the native + method in the JNI class. + $owner is replaced by either true if %newobject has been used otherwise false. + + The java.swg file contains default javain and javout typemaps which will produce the same code + as previously. This change is only of concern to those who have written their own typemaps as + you will then most likely have to write your own javain and javaout typemaps. + + The javaout typemap also makes it possible to use a Java downcast to be used on abstract + proxy base classes. See the Java documentation on dynamic_cast. + + *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** + +10/24/2002: ttn + [Methodology] Upgaded to libtool 1.4.3, presumably w/ better + support for newish platforms (like MacOS X). + +10/21/2002: ttn + Fixed Runtime/Makefile.in bug -- thanks to Richard Calmbach. + +10/18/2002: ttn + Fixed typo in doh.h -- thanks to Max Horn. + Version 1.3.16 (October 14, 2002) ================================= diff --git a/CHANGES.current b/CHANGES.current index 6d1b6b357..92b9a6bc6 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,232 +1,6 @@ -Version 1.3.17 (November 22, 2002) -================================== -11/19/2002: beazley - Fixed [ 613922 ] preprocessor errors with HAVE_LONG_LONG. - -11/19/2002: beazley - Fixed [ 615480 ] mzscheme SWIG_MustGetPtr_. - -11/19/2002: beazley - Fixed [ 635119 ] SWIG_croak causes compiler warning. - -11/16/2002: cheetah (William Fulton) - [Java] Added typemaps for pointers to class members. - -11/15/2002: cheetah (William Fulton) - [Java] Bug fix: Overloaded C++ functions which cannot be overloaded in Java - once again issue a warning. - -11/14/2002: cheetah (William Fulton) - [Java] Handling of NULL pointers is improved. A java null object will now - be translated to and from a NULL C/C++ pointer by default. Previously when - wrapping: - - class SomeClass {...}; - void foo(SomeClass *s); - - and it was called from Java with null: - - modulename.foo(null) - - a Java NullPointerException was thrown. Extra typemaps had to be written in - order to obtain a NULL pointer to pass to functions like this one. Now the - default wrapping will detect 'null' and translate it into a NULL pointer. - Also if a function returns a NULL pointer, eg: - - SomeClass *bar() { return NULL; } - - Then this used to be wrapped with a SomeClass proxy class holding a NULL - pointer. Now null is returned instead. These changes are subtle but useful. - The original behaviour can be obtained by using the original typemaps: - - %typemap(javaout) SWIGTYPE { - return new $&javaclassname($jnicall, true); - } - %typemap(javaout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { - return new $javaclassname($jnicall, $owner); - } - %typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{ - protected static long getCPtr($javaclassname obj) { - return obj.swigCPtr; - } - %} - - *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** - - -11/12/2002: beazley - Fixed problem with abstract methods and signatures. For example: - - class abstract_foo { - public: - virtual int meth(int meth_param) = 0; - }; - - - class abstract_bar : public abstract_foo { - public: - int meth(int meth_param_1, int meth_param_2) { return 0; } - }; - - In this case, abstract_bar is still abstract. - - Fixes [ 628438 ] Derived abstract class not abstract. - Reported and patched by Scott Michel. - -11/11/2002: beazley - Fixed a matching problem with typemaps and array dimensions. For example, if you - had this: - - typedef char blah[20]; - - and a typemap: - - %typemap() char [ANY] { - ... $1_dim0 ... - } - - then $1_dim* variables weren't be expanded properly. It should work now. - Problem reported by Pankaj Kumar Goel. - -11/07/2002: mkoeppe - Added an experimental new module that dumps SWIG's parse - tree as (Common) Lisp s-expressions. The module is - invoked with SWIG's -sexp command-line switch. The output - can be read into Common Lisp. There is (prototype) - example Lisp code that generates Foreign Function Interface - definitions for use with Kevin Rosenberg's UFFI. - - *** EXPERIMENTAL NEW FEATURE *** - -11/07/2002: mkoeppe - Removed duplicate declaration of "cpp_template_decl" in - parser.y; bison 1.75 complained. - -11/06/2002: cheetah (William Fulton) - [Java] Default primitive array handling has changed like arrays of classes. - C primitive arrays are no longer wrapped by a Java array but with a pointer - (type wrapper class). Again the changes have been made for efficiency reasons. - The original typemaps have been moved into arrays_java.i, so the original - behaviour can be obtained merely including this file: - - %include "arrays_java.i" - - The array support functions are no longer generated by default. They are only - generated when including this file, thus this often unused code is only - generated when specifically requiring this type of array support. - - *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** - -11/05/2002: ljohnson (Lyle Johnson) - [Ruby] Added support for nested module declarations (as was - previously added for the Perl module). So a %module directive - of the form: - - %module "Outer::Inner::Foo" - - will nest everything as (in Ruby code): - - module Outer - module Inner - module Foo - # stuff goes here - end - end - end +Version 1.3.18 (In progress) +============================ +12/02/2002: beazley + SWIG 'rel-1-3' CVS branch merged back into the main branch. -11/05/2002: mkoeppe - [MzScheme] Add an argument (-declaremodule) that generates - code to correctly declare a primitive module extension. - Patch submitted by Bruce Butterfield. - -11/02/2002: cheetah (William Fulton) - [Java] Added patch submitted by Michael Cahill to remove unused parameter - warnings for the jenv and cls parameters. This patch also also allows one - to use "void" in the jni typemap for any type without code being generated - attempting to return a value. - -10/29/2002: cheetah (William Fulton) - [Java] Array handling is different. Arrays of classes are no longer wrapped - with proxy arrays, eg wrapping - - class X {...}; - X foo[10]; - - used to be wrapped with these Java getters and setters: - - public static void setFoo(X[] value) {...} - public static X[] getFoo() {...} - - This approach is very inefficient as the entire array is copied numerous - times on each invocation of the getter or setter. These arrays are now - wrapped with a pointer so it is only possible to access the first array element - using a proxy class: - - public static void setFoo(X value) {...} - public static X getFoo() {...} - - Arrays of enums have also been similarly changed. This behaviour is now like the - other SWIG language's implementation and the array library should be used to - access the other elements. The original behaviour can be achieved using the - macros and typemaps in arrays_java.i, for example: - - %include "arrays_java.i" - JAVA_ARRAYSOFCLASSES(X) - class X {...}; - X foo[10]; - - *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** - -10/29/2002: cheetah (William Fulton) - [Java] Two new typemaps javain and javaout for generating the proxy class - and type wrapper class method calls to the JNI class. The new typemaps are - really used for transforming the jstype (used in proxy class and type wrapper - classes) to the jtype (used in the JNI class) and visa versa. A javain typemap - is required whenever an in typemap is written and similarly javaout for an out - typemap. An example is probably best to show them working: - - %typemap(javain) Class "Class.getCPtr($javainput)" - %typemap(javain) unsigned short "$javainput" - %typemap(javaout) Class * { - return new Class($jnicall, $owner); - } - - %inline %{ - class Class {}; - Class * bar(Class cls, unsigned short ush) { return new Class(); }; - %} - - The generated proxy code is then: - - public static Class bar(Class cls, int ush) { - return new Class(exampleJNI.bar(Class.getCPtr(cls), ush), false); - } - - - Some new special variables have been introduced in order to use these typemaps. - Here $javainput has been replaced by 'cls' and 'ush'. $jnicall has been replaced by - the native method call, 'exampleJNI.bar(...)' and $owner has been replaced by 'false'. - $javainput is analogous to the $input special variable. It is replaced by the parameter name. - $jnicall is analogous to $action in %exception. It is replaced by the call to the native - method in the JNI class. - $owner is replaced by either true if %newobject has been used otherwise false. - - The java.swg file contains default javain and javout typemaps which will produce the same code - as previously. This change is only of concern to those who have written their own typemaps as - you will then most likely have to write your own javain and javaout typemaps. - - The javaout typemap also makes it possible to use a Java downcast to be used on abstract - proxy base classes. See the Java documentation on dynamic_cast. - - *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** - -10/24/2002: ttn - [Methodology] Upgaded to libtool 1.4.3, presumably w/ better - support for newish platforms (like MacOS X). - -10/21/2002: ttn - Fixed Runtime/Makefile.in bug -- thanks to Richard Calmbach. - -10/18/2002: ttn - Fixed typo in doh.h -- thanks to Max Horn. diff --git a/Examples/C++/Java/Makefile b/Examples/C++/Java/Makefile deleted file mode 100644 index c41ac5d58..000000000 --- a/Examples/C++/Java/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -TARGETS = java_cpp $(JAR) -JAR = cpptest.jar - -include ../common.mk - -PACKAGE = cpptest -SWIGOPT = -o cpptest_wrap.c -package $(PACKAGE) -shadow $(INCLUDE) -SRCS = -TARGET = libcpptest -INTERFACE = ../interface/cpptest.i -JAR_FILES = cpptestJava.java cpptest.java cpptest_base.java cpptest_empty.java - -clean:: - rm -f *_wrap* *.o *~ .~* core *.so *.sl so_locations - rm -f $(JAR_FILES) $(JAR) - rm -rf class - -PYTHON = jpython - -TESTS = $(wildcard ../test_repo/*.py) diff --git a/Examples/C++/Python/Makefile b/Examples/C++/Python/Makefile deleted file mode 100644 index ecbbdb8bc..000000000 --- a/Examples/C++/Python/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -TARGETS = python_cpp - -include ../common.mk - -SWIGOPT = -o cpptest_wrap.c -shadow $(INCLUDE) -SRCS = -TARGET = cpptestc -INTERFACE = ../interface/cpptest.i - - -clean: - rm -f *_wrap* *.py *.pyc *.o *~ .~* core *.so *.sl so_locations - -PYTHON = python - -TESTS = $(wildcard ../test_repo/*.py) diff --git a/Examples/C++/class/cpptest.H b/Examples/C++/class/cpptest.H deleted file mode 100644 index 36a62f214..000000000 --- a/Examples/C++/class/cpptest.H +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2000 Tal Shalif - -class cpptest_base -{ - MyString str; -public: - cpptest_base(const MyString &s) : str(s) {} - const MyString &get() const {return str;} - void set(const MyString &s) {str = s;} -}; - -class cpptest_empty -{ -public: - cpptest_empty() {} -}; - -class cpptest : public cpptest_base -{ - MyString str; - cpptest_base base; -public: - cpptest(const MyString &s) : cpptest_base(s), base(s) {} - int getInt() const {return 1;} - const char *getString() const {return "string";} - const char *getMyString(const MyString &s) const {return s.c_str();} - cpptest &getObject() {return *this;} - cpptest &getObject2(const char *s) {return *this;} - cpptest &getObject3(const MyString &s) {return *this;} - cpptest_base &outBaseClass() {return *this;} - const MyString &inBaseClass(const cpptest_base &e) {return e.get();} -}; - -// cpptest.H ends here diff --git a/Examples/C++/common.mk b/Examples/C++/common.mk deleted file mode 100644 index 8a8903bf3..000000000 --- a/Examples/C++/common.mk +++ /dev/null @@ -1,28 +0,0 @@ -TOP =../.. - -all:: $(TARGETS) - -include $(TOP)/Makefile - -SWIG = $(TOP)/../swig - -ISRCS = $(notdir $(INTERFACE:.i=_wrap.c)) - -$(JAR): $(JAR_FILES) - rm -rf class - mkdir class - javac -d class $(JAR_FILES) - cd class && jar cvf ../$@ * - -INCLUDE = -I$(TOP)/../Lib -I../class -I../typemaps -I$(TOP)/../Lib - -check:: all - bad_status="" ; \ - for i in $(TESTS); do \ - LD_LIBRARY_PATH=. PYTHONPATH=. CLASSPATH=./$(JAR) ; \ - ( $(PYTHON) $$i && echo "$$i: PASSED" ) || echo "$$i: FAILED"; \ - done - -.PHONY: check - -# common.mk ends here diff --git a/Examples/C++/interface/cpptest.i b/Examples/C++/interface/cpptest.i deleted file mode 100644 index a0d1c1697..000000000 --- a/Examples/C++/interface/cpptest.i +++ /dev/null @@ -1,28 +0,0 @@ -// -*-c++-*- -// Copyright (C) 2000 Tal Shalif - -/* File : cpptest.i */ -#ifdef SWIGJAVA -%module cpptestJava -#else -%module cpptest -#endif - -%include MyString_typemap.i - -%{ -#define MyString string -#include <string> -#include "cpptest.H" -%} - -%include "cpptest.H" - -#ifdef SWIGJAVA -%pragma(java) module=" -static { - System.loadLibrary(\"cpptest\"); -}"; -#endif - -// cpptest.i ends here diff --git a/Examples/C++/test_conf.py.in b/Examples/C++/test_conf.py.in deleted file mode 100644 index 370b894b0..000000000 --- a/Examples/C++/test_conf.py.in +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2000 Tal Shalif -# The path hack is by ttn, who doesn't really grok Python... - -import sys -# print '(1) sys.path = ', sys.path -a = ['@ROOT_DIR@/Examples/C++/Python'] -a.extend (sys.path) -sys.path = a -# print '(2) sys.path = ', sys.path - -from cpptest import * -#import sys -import types - -# test_conf.py ends here diff --git a/Examples/C++/test_repo/constructor.py b/Examples/C++/test_repo/constructor.py deleted file mode 100644 index c7183f71a..000000000 --- a/Examples/C++/test_repo/constructor.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (C) 2000 Tal Shalif - -execfile('../test_conf.py') -obj = cpptest_empty() -if not type(obj) is types.InstanceType: - raise "failed" - -# constructor.py ends here diff --git a/Examples/C++/test_repo/constructor_user_type.py b/Examples/C++/test_repo/constructor_user_type.py deleted file mode 100644 index f03941a5a..000000000 --- a/Examples/C++/test_repo/constructor_user_type.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (C) 2000 Tal Shalif - -execfile('../test_conf.py') -obj = cpptest("MyString") -if not type(obj) is types.InstanceType: - raise "failed" - -# constructor_user_type.py ends here diff --git a/Examples/C++/test_repo/inheritence_map_to_base_class.py b/Examples/C++/test_repo/inheritence_map_to_base_class.py deleted file mode 100644 index 777c12b3a..000000000 --- a/Examples/C++/test_repo/inheritence_map_to_base_class.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (C) 2000 Tal Shalif - -execfile('../test_conf.py') -obj1 = cpptest("obj1") -obj2 = cpptest_base("obj2") -res1 = obj1.inBaseClass(obj1) -res2 = obj1.inBaseClass(obj2) - -if res1 != "obj1" or res2 != "obj2": - raise "failed" - -# inheritence_map_to_base_class.py ends here diff --git a/Examples/C++/test_repo/object_method.py b/Examples/C++/test_repo/object_method.py deleted file mode 100644 index ee353bbf8..000000000 --- a/Examples/C++/test_repo/object_method.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (C) 2000 Tal Shalif - -execfile('../test_conf.py') -obj = cpptest("") -obj2 = obj.getObject() -obj3 = obj.getObject2("string") -if not type(obj2) is types.InstanceType or not type(obj3) is types.InstanceType: - raise "failed" - -# object_method.py ends here diff --git a/Examples/C++/test_repo/object_method_user_type.py b/Examples/C++/test_repo/object_method_user_type.py deleted file mode 100644 index 65eda3969..000000000 --- a/Examples/C++/test_repo/object_method_user_type.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) 2000 Tal Shalif - -execfile('../test_conf.py') -obj = cpptest("") -obj2 = obj.getObject3("MyString") -if not type(obj2) is types.InstanceType: - raise "failed" - -# object_method_user_type.py ends here diff --git a/Examples/C++/test_repo/primitive_method.py b/Examples/C++/test_repo/primitive_method.py deleted file mode 100644 index 88ac24dc3..000000000 --- a/Examples/C++/test_repo/primitive_method.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (C) 2000 Tal Shalif - -execfile('../test_conf.py') -obj = cpptest("") -if not type(obj.getInt()) is types.IntType: - raise "failed" -if not type(obj.getString()) is types.StringType: - raise "failed" - -# primitive_method.py ends here diff --git a/Examples/C++/test_repo/primitive_method_user_type.py b/Examples/C++/test_repo/primitive_method_user_type.py deleted file mode 100644 index 8e0bc688c..000000000 --- a/Examples/C++/test_repo/primitive_method_user_type.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (C) 2000 Tal Shalif - -execfile('../test_conf.py') -obj = cpptest("") - -res = obj.getMyString("string") -if not type(res) is types.StringType or not "string" == res: - raise "failed" - -# primitive_method_user_type.py ends here diff --git a/Examples/C++/typemaps/MyString_typemap.i b/Examples/C++/typemaps/MyString_typemap.i deleted file mode 100644 index 2f73c59f4..000000000 --- a/Examples/C++/typemaps/MyString_typemap.i +++ /dev/null @@ -1,61 +0,0 @@ -/* - * typemaps for standard C++ string - * Copyright (C) 2000 Tal Shalif <tal@slt.atr.co.jp> - */ -/* what type to use in java source code */ -%typemap(java,jtype) const MyString & {String} - -/* what is the corresponding jni type */ -%typemap(java,jni) const MyString & {jstring} - -/* how to convert the c++ type to the java type */ -%typemap(java,out) const MyString & { - $target = JCALL(NewStringUTF, jenv) $source->c_str()); -} - -/* how to convert java type to requested c++ type */ -%typemap(java,in) const MyString & { - $target = NULL; - if($source != NULL) { - /* get the String from the StringBuffer */ - char *p = (char *)jenv->GetStringUTFChars($source, 0); - $target = new string(p); - /* free(p); HdH assuming string constructor makes a copy */ - JCALL(ReleaseStringUTFChars, jenv) $source, p); - } -} -/* free resource once finished using */ -%typemap(java,freearg) const MyString & { - delete $target; -} - -%typemap(java,jtype) MyString & = const MyString &; -%typemap(java,jni) MyString & = const MyString &; -%typemap(java,in) MyString & = const MyString &; -%typemap(java,out) MyString & = const MyString &; -%typemap(java,freearg) MyString & = const MyString &; - - -%typemap(python,in) const MyString & { - if (PyString_Check ($source)) - { - $target = new string((char *)PyString_AsString($source)); - } - else - { - PyErr_SetString (PyExc_TypeError, "not a string"); - return NULL; - } -} -%typemap(python,out) const MyString & { - $target = PyString_FromString($source->c_str()); -} -%typemap (python, freearg) const MyString & { - delete $source; -} - -%typemap(python,in) MyString & = const MyString &; -%typemap(python,out) MyString & = const MyString &; -%typemap(python,freearg) MyString & = const MyString &; - -/* MyString_typemap.i ends here */ |