aboutsummaryrefslogtreecommitdiff
path: root/Examples/chicken/class
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/chicken/class')
-rw-r--r--Examples/chicken/class/Makefile40
-rw-r--r--Examples/chicken/class/example.cxx28
-rw-r--r--Examples/chicken/class/example.h41
-rw-r--r--Examples/chicken/class/example.i9
-rw-r--r--Examples/chicken/class/runme-lowlevel.scm76
-rw-r--r--Examples/chicken/class/runme-tinyclos.scm76
6 files changed, 0 insertions, 270 deletions
diff --git a/Examples/chicken/class/Makefile b/Examples/chicken/class/Makefile
deleted file mode 100644
index ea2d8b62e..000000000
--- a/Examples/chicken/class/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-TOP = ../..
-SWIGEXE = $(TOP)/../swig
-SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
-INTERFACE = example.i
-SRCS =
-CXXSRCS = example.cxx
-TARGET = class
-INCLUDE =
-SWIGOPT =
-VARIANT =
-
-# uncomment the following lines to build a static exe (only pick one of the CHICKEN_MAIN lines)
-#CHICKEN_MAIN = runme-lowlevel.scm
-#CHICKEN_MAIN = runme-tinyclos.scm
-#VARIANT = _static
-
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CHICKEN_SCRIPT='runme-lowlevel.scm' chicken_run
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CHICKEN_SCRIPT='runme-tinyclos.scm' chicken_run
-
-build: $(TARGET) $(TARGET)_proxy
-
-$(TARGET): $(INTERFACE) $(SRCS)
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
- SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
-
-$(TARGET)_proxy: $(INTERFACE) $(SRCS)
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
- SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
- SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
- INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT) -proxy' TARGET='$(TARGET)_proxy' \
- INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
- rm -f example.scm
- rm -f $(TARGET)
diff --git a/Examples/chicken/class/example.cxx b/Examples/chicken/class/example.cxx
deleted file mode 100644
index 046304519..000000000
--- a/Examples/chicken/class/example.cxx
+++ /dev/null
@@ -1,28 +0,0 @@
-/* File : example.cxx */
-
-#include "example.h"
-#define M_PI 3.14159265358979323846
-
-/* 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() {
- return M_PI*radius*radius;
-}
-
-double Circle::perimeter() {
- return 2*M_PI*radius;
-}
-
-double Square::area() {
- return width*width;
-}
-
-double Square::perimeter() {
- return 4*width;
-}
diff --git a/Examples/chicken/class/example.h b/Examples/chicken/class/example.h
deleted file mode 100644
index 5bad31693..000000000
--- a/Examples/chicken/class/example.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* File : example.h */
-
-class Shape {
-public:
- Shape() {
- nshapes++;
- }
- virtual ~Shape() {
- nshapes--;
- }
- double x, y;
- void move(double dx, double dy);
- virtual double area() = 0;
- virtual double perimeter() = 0;
- static int nshapes;
-
- enum SomeEnum {
- First = 0,
- Second,
- Third,
- Last = 1000
- };
-};
-
-class Circle : public Shape {
-private:
- double radius;
-public:
- Circle(double r) : radius(r) { }
- virtual double area();
- virtual double perimeter();
-};
-
-class Square : public Shape {
-private:
- double width;
-public:
- Square(double w) : width(w) { }
- virtual double area();
- virtual double perimeter();
-};
diff --git a/Examples/chicken/class/example.i b/Examples/chicken/class/example.i
deleted file mode 100644
index fbdf7249f..000000000
--- a/Examples/chicken/class/example.i
+++ /dev/null
@@ -1,9 +0,0 @@
-/* File : example.i */
-%module example
-
-%{
-#include "example.h"
-%}
-
-/* Let's just grab the original header file here */
-%include "example.h"
diff --git a/Examples/chicken/class/runme-lowlevel.scm b/Examples/chicken/class/runme-lowlevel.scm
deleted file mode 100644
index 7c59c0aaa..000000000
--- a/Examples/chicken/class/runme-lowlevel.scm
+++ /dev/null
@@ -1,76 +0,0 @@
-;; This file illustrates the low-level C++ interface generated
-;; by SWIG.
-
-(load-library 'example "class.so")
-(declare (uses example))
-
-;; ----- Object creation -----
-
-(display "Creating some objects:\n")
-(define c (new-Circle 10.0))
-(display " Created circle ")
-(display c)
-(display "\n")
-(define s (new-Square 10.0))
-(display " Created square ")
-(display s)
-(display "\n")
-
-;; ----- Access a static member -----
-
-(display "\nA total of ")
-(display (Shape-nshapes))
-(display " shapes were created\n")
-
-;; ----- Member data access -----
-
-;; Set the location of the object
-
-(Shape-x-set c 20.0)
-(Shape-y-set c 30.0)
-
-(Shape-x-set s -10.0)
-(Shape-y-set s 5.0)
-
-(display "\nHere is their current position:\n")
-(display " Circle = (")
-(display (Shape-x-get c))
-(display ", ")
-(display (Shape-y-get c))
-(display ")\n")
-(display " Square = (")
-(display (Shape-x-get s))
-(display ", ")
-(display (Shape-y-get s))
-(display ")\n")
-
-;; ----- Call some methods -----
-
-(display "\nHere are some properties of the shapes:\n")
-(let
- ((disp (lambda (o)
- (display " ")
- (display o)
- (display "\n")
- (display " area = ")
- (display (Shape-area o))
- (display "\n")
- (display " perimeter = ")
- (display (Shape-perimeter o))
- (display "\n"))))
- (disp c)
- (disp s))
-
-(display "\nGuess I'll clean up now\n")
-
-;; Note: this invokes the virtual destructor
-(set! c #f)
-(set! s #f)
-(gc #t)
-
-(set! s 3)
-(display (Shape-nshapes))
-(display " shapes remain\n")
-(display "Goodbye\n")
-
-(exit)
diff --git a/Examples/chicken/class/runme-tinyclos.scm b/Examples/chicken/class/runme-tinyclos.scm
deleted file mode 100644
index 5ba1d6adb..000000000
--- a/Examples/chicken/class/runme-tinyclos.scm
+++ /dev/null
@@ -1,76 +0,0 @@
-;; This file illustrates the proxy C++ interface generated
-;; by SWIG.
-
-(load-library 'example "class_proxy.so")
-(declare (uses example))
-(declare (uses tinyclos))
-
-;; ----- Object creation -----
-
-(display "Creating some objects:\n")
-(define c (make <Circle> 10.0))
-(display " Created circle ")
-(display c)
-(display "\n")
-(define s (make <Square> 10.0))
-(display " Created square ")
-(display s)
-(display "\n")
-
-;; ----- Access a static member -----
-
-(display "\nA total of ")
-(display (Shape-nshapes))
-(display " shapes were created\n")
-
-;; ----- Member data access -----
-
-;; Set the location of the object
-
-(slot-set! c 'x 20.0)
-(slot-set! c 'y 30.0)
-
-(slot-set! s 'x -10.0)
-(slot-set! s 'y 5.0)
-
-(display "\nHere is their current position:\n")
-(display " Circle = (")
-(display (slot-ref c 'x))
-(display ", ")
-(display (slot-ref c 'y))
-(display ")\n")
-(display " Square = (")
-(display (slot-ref s 'x))
-(display ", ")
-(display (slot-ref s 'y))
-(display ")\n")
-
-;; ----- Call some methods -----
-
-(display "\nHere are some properties of the shapes:\n")
-(let
- ((disp (lambda (o)
- (display " ")
- (display o)
- (display "\n")
- (display " area = ")
- (display (area o))
- (display "\n")
- (display " perimeter = ")
- (display (perimeter o))
- (display "\n"))))
- (disp c)
- (disp s))
-
-(display "\nGuess I'll clean up now\n")
-
-;; Note: Invoke the virtual destructors by forcing garbage collection
-(set! c 77)
-(set! s 88)
-(gc #t)
-
-(display (Shape-nshapes))
-(display " shapes remain\n")
-(display "Goodbye\n")
-
-(exit)