summaryrefslogtreecommitdiff
path: root/Examples/C++
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/C++')
-rw-r--r--Examples/C++/Java/Makefile20
-rw-r--r--Examples/C++/Python/Makefile16
-rw-r--r--Examples/C++/class/cpptest.H34
-rw-r--r--Examples/C++/common.mk28
-rw-r--r--Examples/C++/interface/cpptest.i28
-rw-r--r--Examples/C++/test_conf.py.in15
-rw-r--r--Examples/C++/test_repo/constructor.py8
-rw-r--r--Examples/C++/test_repo/constructor_user_type.py8
-rw-r--r--Examples/C++/test_repo/inheritence_map_to_base_class.py12
-rw-r--r--Examples/C++/test_repo/object_method.py10
-rw-r--r--Examples/C++/test_repo/object_method_user_type.py9
-rw-r--r--Examples/C++/test_repo/primitive_method.py10
-rw-r--r--Examples/C++/test_repo/primitive_method_user_type.py10
-rw-r--r--Examples/C++/typemaps/MyString_typemap.i61
14 files changed, 0 insertions, 269 deletions
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 */