summaryrefslogtreecommitdiff
path: root/Examples/java
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2007-08-09 23:47:13 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2007-08-09 23:47:13 +0000
commitf5bdd056f704e53a3cf8525dd8becc5926db45a5 (patch)
tree4582617598db83ab8daa827c3b7b5da42f734d77 /Examples/java
parent665917ebae5d12d9d806b9ebe10e33872ee1c93c (diff)
downloadswig-f5bdd056f704e53a3cf8525dd8becc5926db45a5.tar.gz
Remove obscure mpointer example and replace with member_pointer.i testcase and runtime examples
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9887 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/java')
-rw-r--r--Examples/java/check.list1
-rw-r--r--Examples/java/mpointer/Makefile18
-rw-r--r--Examples/java/mpointer/example.cxx48
-rw-r--r--Examples/java/mpointer/example.h50
-rw-r--r--Examples/java/mpointer/example.i16
-rw-r--r--Examples/java/mpointer/main.java61
6 files changed, 0 insertions, 194 deletions
diff --git a/Examples/java/check.list b/Examples/java/check.list
index 4a50f4861..9728342f2 100644
--- a/Examples/java/check.list
+++ b/Examples/java/check.list
@@ -5,7 +5,6 @@ constants
enum
extend
funcptr
-mpointer
multimap
native
pointer
diff --git a/Examples/java/mpointer/Makefile b/Examples/java/mpointer/Makefile
deleted file mode 100644
index 14c301703..000000000
--- a/Examples/java/mpointer/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS = example.cxx
-TARGET = example
-INTERFACE = example.i
-SWIGOPT =
-
-all:: java
-
-java::
- $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
- javac *.java
-
-clean::
- $(MAKE) -f $(TOP)/Makefile java_clean
-
-check: all
diff --git a/Examples/java/mpointer/example.cxx b/Examples/java/mpointer/example.cxx
deleted file mode 100644
index 80d95f618..000000000
--- a/Examples/java/mpointer/example.cxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/* File : example.c */
-
-#include "example.h"
-#include <math.h>
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
- x += dx;
- y += dy;
-}
-
-int Shape::nshapes = 0;
-
-double Circle::area(void) {
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter(void) {
- return 2*M_PI*radius;
-}
-
-double Square::area(void) {
- return width*width;
-}
-
-double Square::perimeter(void) {
- return 4*width;
-}
-
-double do_op(Shape *s, double (Shape::*m)(void)) {
- return (s->*m)();
-}
-
-double (Shape::*areapt())(void) {
- return &Shape::area;
-}
-
-double (Shape::*perimeterpt())(void) {
- return &Shape::perimeter;
-}
-
-/* Member pointer variables */
-double (Shape::*areavar)(void) = &Shape::area;
-double (Shape::*perimetervar)(void) = &Shape::perimeter;
-
diff --git a/Examples/java/mpointer/example.h b/Examples/java/mpointer/example.h
deleted file mode 100644
index 110fe91c1..000000000
--- a/Examples/java/mpointer/example.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* File : example.h */
-
-class Shape {
-public:
- Shape() {
- nshapes++;
- }
- virtual ~Shape() {
- nshapes--;
- };
- double x, y;
- double *z;
-
- void move(double dx, double dy);
- virtual double area(void) = 0;
- virtual double perimeter(void) = 0;
- static int nshapes;
-};
-
-class Circle : public Shape {
-private:
- double radius;
-public:
- Circle(double r) : radius(r) { };
- virtual double area(void);
- virtual double perimeter(void);
-};
-
-class Square : public Shape {
-private:
- double width;
-public:
- Square(double w) : width(w) { };
- virtual double area(void);
- virtual double perimeter(void);
-};
-
-extern double do_op(Shape *s, double (Shape::*m)(void));
-
-/* Functions that return member pointers */
-
-extern double (Shape::*areapt())(void);
-extern double (Shape::*perimeterpt())(void);
-
-/* Global variables that are member pointers */
-extern double (Shape::*areavar)(void);
-extern double (Shape::*perimetervar)(void);
-
-
-
diff --git a/Examples/java/mpointer/example.i b/Examples/java/mpointer/example.i
deleted file mode 100644
index 238792be8..000000000
--- a/Examples/java/mpointer/example.i
+++ /dev/null
@@ -1,16 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/* Let's just grab the original header file here */
-%include "example.h"
-
-/* Some constants */
-
-%constant double (Shape::*AREAPT)(void) = &Shape::area;
-%constant double (Shape::*PERIMPT)(void) = &Shape::perimeter;
-%constant double (Shape::*NULLPT)(void) = 0;
-
diff --git a/Examples/java/mpointer/main.java b/Examples/java/mpointer/main.java
deleted file mode 100644
index ab6cdf159..000000000
--- a/Examples/java/mpointer/main.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// Example using pointers to member functions
-
-public class main {
- static {
- try {
- System.loadLibrary("example");
- } catch (UnsatisfiedLinkError e) {
- System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
- System.exit(1);
- }
- }
-
- public static void main(String argv[])
- {
- // Get the pointers
-
- SWIGTYPE_m_Shape__f_void__double area_pt = example.areapt();
- SWIGTYPE_m_Shape__f_void__double perim_pt = example.perimeterpt();
-
- System.out.println( "area_pt =" + area_pt );
- System.out.println( "perim_pt = " + perim_pt );
-
- // Create some objects
-
- Circle c = new Circle(4);
- Square s = new Square(10);
-
- // Do some calculations
-
- System.out.println( "Circle area = " + example.do_op(c,area_pt) );
- System.out.println( "Circle perim = " + example.do_op(c,perim_pt) );
- System.out.println( "Square area = " + example.do_op(s,area_pt) );
- System.out.println( "Square perim = " + example.do_op(s,perim_pt) );
-
- System.out.println( "areavar = " + example.getAreavar() );
- System.out.println( "perimetervar = " + example.getPerimetervar() );
-
- // Try the variables
- System.out.println( "Circle area = " + example.do_op(c,example.getAreavar()) );
- System.out.println( "Circle perim = " + example.do_op(c,example.getPerimetervar()) );
- System.out.println( "Square area = " + example.do_op(s,example.getAreavar()) );
- System.out.println( "Square perim = " + example.do_op(s,example.getPerimetervar()) );
-
- // Modify one of the variables
- example.setAreavar(perim_pt);
-
- System.out.println( "Circle perimeter = " + example.do_op(c,example.getAreavar()) );
-
- // Try the constants
-
- System.out.println( "example.AREAPT =" + example.AREAPT );
- System.out.println( "example.PERIMPT=" + example.PERIMPT );
- System.out.println( "example.NULLPT =" + example.NULLPT );
-
- System.out.println( "Circle area = " + example.do_op(c,example.AREAPT) );
- System.out.println( "Circle perim = " + example.do_op(c,example.PERIMPT) );
- System.out.println( "Square area = " + example.do_op(s,example.AREAPT) );
- System.out.println( "Square perim = " + example.do_op(s,example.PERIMPT) );
-
- }
-}