diff options
Diffstat (limited to 'Examples/pike')
28 files changed, 0 insertions, 815 deletions
diff --git a/Examples/pike/check.list b/Examples/pike/check.list deleted file mode 100644 index d6c8e2e7b..000000000 --- a/Examples/pike/check.list +++ /dev/null @@ -1,7 +0,0 @@ -# see top-level Makefile.in -class -constants -enum -overload -simple -template diff --git a/Examples/pike/class/Makefile b/Examples/pike/class/Makefile deleted file mode 100644 index e5319dbe2..000000000 --- a/Examples/pike/class/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -LIBS = -lm - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp - -static: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/class/example.cxx b/Examples/pike/class/example.cxx deleted file mode 100644 index 046304519..000000000 --- a/Examples/pike/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/pike/class/example.h b/Examples/pike/class/example.h deleted file mode 100644 index 0dff185b2..000000000 --- a/Examples/pike/class/example.h +++ /dev/null @@ -1,34 +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; -}; - -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/pike/class/example.i b/Examples/pike/class/example.i deleted file mode 100644 index fbdf7249f..000000000 --- a/Examples/pike/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/pike/class/runme.pike b/Examples/pike/class/runme.pike deleted file mode 100644 index a6377600e..000000000 --- a/Examples/pike/class/runme.pike +++ /dev/null @@ -1,53 +0,0 @@ -import .example; - -int main() -{ - // ----- Object creation ----- - - write("Creating some objects:\n"); - Circle c = Circle(10.0); - write(" Created circle.\n"); - Square s = Square(10.0); - write(" Created square.\n"); - - // ----- Access a static member ----- - - write("\nA total of " + Shape_nshapes_get() + " shapes were created\n"); - - // ----- Member data access ----- - - // Set the location of the object - - c->x_set(20.0); - c->y_set(30.0); - - s->x_set(-10.0); - s->y_set(5.0); - - write("\nHere is their current position:\n"); - write(" Circle = (%f, %f)\n", c->x_get(), c->y_get()); - write(" Square = (%f, %f)\n", s->x_get(), s->y_get()); - - // ----- Call some methods ----- - - write("\nHere are some properties of the shapes:\n"); - write(" The circle:\n"); - write(" area = %f.\n", c->area()); - write(" perimeter = %f.\n", c->perimeter()); - write(" The square:\n"); - write(" area = %f.\n", s->area()); - write(" perimeter = %f.\n", s->perimeter()); - - write("\nGuess I'll clean up now\n"); - - /* See if we can force 's' to be garbage-collected */ - s = 0; - - /* Now we should be down to only 1 shape */ - write("%d shapes remain\n", Shape_nshapes_get()); - - /* Done */ - write("Goodbye\n"); - - return 0; -} diff --git a/Examples/pike/constants/Makefile b/Examples/pike/constants/Makefile deleted file mode 100644 index 45da7d269..000000000 --- a/Examples/pike/constants/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -SRCS = -TARGET = example -INTERFACE = example.i - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike - -static: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/constants/example.i b/Examples/pike/constants/example.i deleted file mode 100644 index 4f7b1a4d7..000000000 --- a/Examples/pike/constants/example.i +++ /dev/null @@ -1,27 +0,0 @@ -/* File : example.i */ -%module example - -/* A few preprocessor macros */ - -#define ICONST 42 -#define FCONST 2.1828 -#define CCONST 'x' -#define CCONST2 '\n' -#define SCONST "Hello World" -#define SCONST2 "\"Hello World\"" - -/* This should work just fine */ -#define EXPR ICONST + 3*(FCONST) - -/* This shouldn't do anything */ -#define EXTERN extern - -/* Neither should this (BAR isn't defined) */ -#define FOO (ICONST + BAR) - -/* The following directives also produce constants */ - -%constant int iconst = 37; -%constant double fconst = 3.14; - - diff --git a/Examples/pike/constants/runme.pike b/Examples/pike/constants/runme.pike deleted file mode 100644 index a8d9f944f..000000000 --- a/Examples/pike/constants/runme.pike +++ /dev/null @@ -1,24 +0,0 @@ -int main() -{ - write("ICONST = %d (should be 42)\n", .example.ICONST); - write("FCONST = %f (should be 2.1828)\n", .example.FCONST); - write("CCONST = %c (should be 'x')\n", .example.CCONST); - write("CCONST2 = %c (this should be on a new line)\n", .example.CCONST2); - write("SCONST = %s (should be 'Hello World')\n", .example.SCONST); - write("SCONST2 = %s (should be '\"Hello World\"')\n", .example.SCONST2); - write("EXPR = %f (should be 48.5484)\n", .example.EXPR); - write("iconst = %d (should be 37)\n", .example.iconst); - write("fconst = %f (should be 3.14)\n", .example.fconst); - - if (search(indices(.example), "EXTERN") == -1) - write("EXTERN isn't defined (good)\n"); - else - write("EXTERN is defined (bad)\n"); - - if (search(indices(.example), "FOO") == -1) - write("FOO isn't defined (good)\n"); - else - write("FOO is defined (bad)\n"); - - return 0; -} diff --git a/Examples/pike/enum/Makefile b/Examples/pike/enum/Makefile deleted file mode 100644 index e5319dbe2..000000000 --- a/Examples/pike/enum/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -LIBS = -lm - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp - -static: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/enum/README b/Examples/pike/enum/README deleted file mode 100644 index 055aa9fce..000000000 --- a/Examples/pike/enum/README +++ /dev/null @@ -1,13 +0,0 @@ -This example will not compile with Pike versions 7.4.20 unless you first -patch the Pike sources. The problem is for line 91 of Pike's "stralloc.h" -(usually installed as /usr/local/pike/7.4.10/include/pike/stralloc.h). That -line reads: - - tmp.ptr=ptr; - -but should be patched to read: - - tmp.ptr=(p_wchar0 *) ptr; - -This bug has been reported to the Pike developers. - diff --git a/Examples/pike/enum/example.cxx b/Examples/pike/enum/example.cxx deleted file mode 100644 index 6785e57ac..000000000 --- a/Examples/pike/enum/example.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/* File : example.c */ - -#include "example.h" -#include <stdio.h> - -void Foo::enum_test(speed s) { - if (s == IMPULSE) { - printf("IMPULSE speed\n"); - } else if (s == WARP) { - printf("WARP speed\n"); - } else if (s == LUDICROUS) { - printf("LUDICROUS speed\n"); - } else { - printf("Unknown speed\n"); - } -} - -void enum_test(color c, Foo::speed s) { - if (c == RED) { - printf("color = RED, "); - } else if (c == BLUE) { - printf("color = BLUE, "); - } else if (c == GREEN) { - printf("color = GREEN, "); - } else { - printf("color = Unknown color!, "); - } - if (s == Foo::IMPULSE) { - printf("speed = IMPULSE speed\n"); - } else if (s == Foo::WARP) { - printf("speed = WARP speed\n"); - } else if (s == Foo::LUDICROUS) { - printf("speed = LUDICROUS speed\n"); - } else { - printf("speed = Unknown speed!\n"); - } -} diff --git a/Examples/pike/enum/example.h b/Examples/pike/enum/example.h deleted file mode 100644 index 525d62afc..000000000 --- a/Examples/pike/enum/example.h +++ /dev/null @@ -1,13 +0,0 @@ -/* File : example.h */ - -enum color { RED, BLUE, GREEN }; - -class Foo { - public: - Foo() { } - enum speed { IMPULSE, WARP, LUDICROUS }; - void enum_test(speed s); -}; - -void enum_test(color c, Foo::speed s); - diff --git a/Examples/pike/enum/example.i b/Examples/pike/enum/example.i deleted file mode 100644 index 23ee8a822..000000000 --- a/Examples/pike/enum/example.i +++ /dev/null @@ -1,11 +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/pike/enum/runme.pike b/Examples/pike/enum/runme.pike deleted file mode 100644 index 4846356b3..000000000 --- a/Examples/pike/enum/runme.pike +++ /dev/null @@ -1,28 +0,0 @@ -int main() -{ - write("*** color ***\n"); - write(" RED = " + .example.RED + "\n"); - write(" BLUE = " + .example.BLUE + "\n"); - write(" GREEN = " + .example.GREEN + "\n"); - - write("\n*** Foo::speed ***\n"); - write(" Foo_IMPULSE = " + .example.Foo.IMPULSE + "\n"); - write(" Foo_WARP = " + .example.Foo.WARP + "\n"); - write(" Foo_LUDICROUS = " + .example.Foo.LUDICROUS + "\n"); - - write("\nTesting use of enums with functions\n\n"); - - .example.enum_test(.example.RED, .example.Foo.IMPULSE); - .example.enum_test(.example.BLUE, .example.Foo.WARP); - .example.enum_test(.example.GREEN, .example.Foo.LUDICROUS); - .example.enum_test(1234, 5678); - - write("\nTesting use of enum with class method\n"); - .example.Foo f = .example.Foo(); - - f->enum_test(.example.Foo.IMPULSE); - f->enum_test(.example.Foo.WARP); - f->enum_test(.example.Foo.LUDICROUS); - - return 0; -} diff --git a/Examples/pike/overload/Makefile b/Examples/pike/overload/Makefile deleted file mode 100644 index 5e5fe669b..000000000 --- a/Examples/pike/overload/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -LIBS = -lstdc++ -lm - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp - -static: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/overload/example.cxx b/Examples/pike/overload/example.cxx deleted file mode 100644 index 3760fdd49..000000000 --- a/Examples/pike/overload/example.cxx +++ /dev/null @@ -1,115 +0,0 @@ -#include <iostream> - -#include "example.h" - -// Overloaded constructors for class Bar -Bar::Bar() { - std::cout << "Called Bar::Bar()" << std::endl; -} - -Bar::Bar(const Bar&) { - std::cout << "Called Bar::Bar(const Bar&)" << std::endl; -} - -Bar::Bar(double x) { - std::cout << "Called Bar::Bar(double) with x = " << x << std::endl; -} - -Bar::Bar(double x, char *y) { - std::cout << "Called Bar::Bar(double, char *) with x, y = " << x << ", \"" << y << "\"" << std::endl; -} - -Bar::Bar(int x, int y) { - std::cout << "Called Bar::Bar(int, int) with x, y = " << x << ", " << y << std::endl; -} - -Bar::Bar(char *x) { - std::cout << "Called Bar::Bar(char *) with x = \"" << x << "\"" << std::endl; -} - -Bar::Bar(int x) { - std::cout << "Called Bar::Bar(int) with x = " << x << std::endl; -} - -Bar::Bar(long x) { - std::cout << "Called Bar::Bar(long) with x = " << x << std::endl; -} - -Bar::Bar(Bar *x) { - std::cout << "Called Bar::Bar(Bar *) with x = " << x << std::endl; -} - -// Overloaded member functions -void Bar::foo(const Bar& x) { - std::cout << "Called Bar::foo(const Bar&) with &x = " << &x << std::endl; -} - -void Bar::foo(double x) { - std::cout << "Called Bar::foo(double) with x = " << x << std::endl; -} - -void Bar::foo(double x, char *y) { - std::cout << "Called Bar::foo(double, char *) with x, y = " << x << ", \"" << y << "\"" << std::endl; -} - -void Bar::foo(int x, int y) { - std::cout << "Called Bar::foo(int, int) with x, y = " << x << ", " << y << std::endl; -} - -void Bar::foo(char *x) { - std::cout << "Called Bar::foo(char *) with x = \"" << x << "\"" << std::endl; -} - -void Bar::foo(int x) { - std::cout << "Called Bar::foo(int) with x = " << x << std::endl; -} - -void Bar::foo(long x) { - std::cout << "Called Bar::foo(long) with x = " << x << std::endl; -} - -void Bar::foo(Bar *x) { - std::cout << "Called Bar::foo(Bar *) with x = " << x << std::endl; -} - -void Bar::spam(int x, int y, int z) { - std::cout << "Called Bar::spam(int, int, int) with x, y, z = " << x << ", " << y << ", " << z << std::endl; -} - -void Bar::spam(double x, int y, int z) { - std::cout << "Called Bar::spam(double, int, int) with x, y, z = " << x << ", " << y << ", " << z << std::endl; -} - -// Overloaded global methods -void foo(const Bar& x) { - std::cout << "Called foo(const Bar& x) with &x = " << &x << std::endl; -} - -void foo(double x) { - std::cout << "Called foo(double) with x = " << x << std::endl; -} - -void foo(double x, char *y) { - std::cout << "Called foo(double, char *) with x, y = " << x << ", \"" << y << "\"" << std::endl; -} - -void foo(int x, int y) { - std::cout << "Called foo(int, int) with x, y = " << x << ", " << y << std::endl; -} - -void foo(char *x) { - std::cout << "Called foo(char *) with x = \"" << x << "\"" << std::endl; -} - -void foo(int x) { - std::cout << "Called foo(int) with x = " << x << std::endl; -} - -void foo(long x) { - std::cout << "Called foo(long) with x = " << x << std::endl; -} - -void foo(Bar *x) { - std::cout << "Called foo(Bar *) with x = " << x << std::endl; -} - diff --git a/Examples/pike/overload/example.h b/Examples/pike/overload/example.h deleted file mode 100644 index e47a122ee..000000000 --- a/Examples/pike/overload/example.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef EXAMPLE_H -#define EXAMPLE_H - -class Bar { -public: - Bar(); - Bar(const Bar&); - Bar(double); - Bar(double, char *); - Bar(int, int); - Bar(char *); - Bar(long); - Bar(int); - Bar(Bar *); - - void foo(const Bar&); - void foo(double); - void foo(double, char *); - void foo(int, int); - void foo(char *); - void foo(long); - void foo(int); - void foo(Bar *); - - void spam(int x, int y=2, int z=3); - void spam(double x, int y=2, int z=3); -}; - -void foo(const Bar&); -void foo(double); -void foo(double, char *); -void foo(int, int); -void foo(char *); -void foo(int); -void foo(long); -void foo(Bar *); - -void spam(int x, int y=2, int z=3); -void spam(double x, int y=2, int z=3); - -#endif diff --git a/Examples/pike/overload/example.i b/Examples/pike/overload/example.i deleted file mode 100644 index ddcd006be..000000000 --- a/Examples/pike/overload/example.i +++ /dev/null @@ -1,28 +0,0 @@ -/* File : example.i */ -%module example - -%{ -#include "example.h" -%} - -/** - * These overloaded declarations conflict with other overloads (as far as - * SWIG's Ruby module's implementation for overloaded methods is concerned). - * One option is use the %rename directive to rename the conflicting methods; - * here, we're just using %ignore to avoid wrapping some of the overloaded - * functions altogether. - */ - -%ignore Bar; - -%ignore Bar::Bar(Bar *); -%ignore Bar::Bar(long); - -%ignore Bar::foo(const Bar&); -%ignore Bar::foo(long); - -%ignore ::foo(const Bar&); -%ignore ::foo(int); - -/* Let's just grab the original header file here */ -%include "example.h" diff --git a/Examples/pike/overload/runme.pike b/Examples/pike/overload/runme.pike deleted file mode 100644 index d30e947b3..000000000 --- a/Examples/pike/overload/runme.pike +++ /dev/null @@ -1,83 +0,0 @@ -// import .example; - -int main() -{ - // This should invoke foo(double) - .example.foo(3.14159); - - // This should invoke foo(double, char *) - .example.foo(3.14159, "Pi"); - - // This should invoke foo(int, int) - .example.foo(3, 4); - - // This should invoke foo(char *) - .example.foo("This is a test"); - - // This should invoke foo(long) - .example.foo(42); - - /* - // This should invoke Bar::Bar() followed by foo(Bar *) - foo(Bar.new); - - // Skip a line - write("\n"); - - // This should invoke Bar::Bar(double) - Bar.new(3.14159); - - // This should invoke Bar::Bar(double, char *) - Bar.new(3.14159, "Pi"); - - // This should invoke Bar::Bar(int, int) - Bar.new(3, 4); - - // This should invoke Bar::Bar(char *) - Bar.new("This is a test"); - - // This should invoke Bar::Bar(int) - Bar.new(42); - - // This should invoke Bar::Bar() for the input argument, - // followed by Bar::Bar(const Bar&). - Bar.new(Bar.new); - - // Skip a line - write("\n"); - */ - - // Construct a new Bar instance (invokes Bar::Bar()) - /* - bar = Bar.new; - - // This should invoke Bar::foo(double) - bar.foo(3.14159); - - // This should invoke Bar::foo(double, char *) - bar.foo(3.14159, "Pi"); - - // This should invoke Bar::foo(int, int) - bar.foo(3, 4); - - // This should invoke Bar::foo(char *) - bar.foo("This is a test"); - - // This should invoke Bar::foo(int) - bar.foo(42); - - // This should invoke Bar::Bar() to construct the input - // argument, followed by Bar::foo(Bar *). - bar.foo(Example::Bar.new); - - // This should invoke Bar::spam(int x, int y, int z) - bar.spam(1); - - // This should invoke Bar::spam(double x, int y, int z) - bar.spam(3.14159); - */ - - write("Goodbye\n"); - - return 0; -} diff --git a/Examples/pike/simple/Makefile b/Examples/pike/simple/Makefile deleted file mode 100644 index 8b49b4ea5..000000000 --- a/Examples/pike/simple/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -SRCS = example.c -TARGET = example -INTERFACE = example.i - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike - -static: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/simple/example.c b/Examples/pike/simple/example.c deleted file mode 100644 index 1c2af789c..000000000 --- a/Examples/pike/simple/example.c +++ /dev/null @@ -1,18 +0,0 @@ -/* File : example.c */ - -/* A global variable */ -double Foo = 3.0; - -/* Compute the greatest common divisor of positive integers */ -int gcd(int x, int y) { - int g; - g = y; - while (x > 0) { - g = x; - x = y % x; - y = g; - } - return g; -} - - diff --git a/Examples/pike/simple/example.i b/Examples/pike/simple/example.i deleted file mode 100644 index 24093b9bf..000000000 --- a/Examples/pike/simple/example.i +++ /dev/null @@ -1,7 +0,0 @@ -/* File : example.i */ -%module example - -%inline %{ -extern int gcd(int x, int y); -extern double Foo; -%} diff --git a/Examples/pike/simple/runme.pike b/Examples/pike/simple/runme.pike deleted file mode 100644 index a6a78e9e7..000000000 --- a/Examples/pike/simple/runme.pike +++ /dev/null @@ -1,20 +0,0 @@ -int main() -{ - /* Call our gcd() function */ - int x = 42; - int y = 105; - int g = .example.gcd(x, y); - write("The gcd of %d and %d is %d\n", x, y, g); - - /* Manipulate the Foo global variable */ - /* Output its current value */ - write("Foo = %f\n", .example->Foo_get()); - - /* Change its value */ - .example->Foo_set(3.1415926); - - /* See if the change took effect */ - write("Foo = %f\n", .example->Foo_get()); - - return 0; -} diff --git a/Examples/pike/template/Makefile b/Examples/pike/template/Makefile deleted file mode 100644 index 513dc3b4b..000000000 --- a/Examples/pike/template/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -CXXSRCS = -TARGET = example -INTERFACE = example.i -LIBS = -lm -SWIGOPT = - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp - -static: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/template/example.h b/Examples/pike/template/example.h deleted file mode 100644 index 7401df650..000000000 --- a/Examples/pike/template/example.h +++ /dev/null @@ -1,32 +0,0 @@ -/* File : example.h */ - -// Some template definitions - -template<class T> T max(T a, T b) { return a>b ? a : b; } - -template<class T> class vector { - T *v; - int sz; - public: - vector(int _sz) { - v = new T[_sz]; - sz = _sz; - } - T &get(int index) { - return v[index]; - } - void set(int index, T &val) { - v[index] = val; - } -#ifdef SWIG - %extend { - T getitem(int index) { - return $self->get(index); - } - void setitem(int index, T val) { - $self->set(index,val); - } - } -#endif -}; - diff --git a/Examples/pike/template/example.i b/Examples/pike/template/example.i deleted file mode 100644 index 8f94c4da1..000000000 --- a/Examples/pike/template/example.i +++ /dev/null @@ -1,17 +0,0 @@ -/* File : example.i */ -%module example - -%{ -#include "example.h" -%} - -/* Let's just grab the original header file here */ -%include "example.h" - -/* Now instantiate some specific template declarations */ - -%template(maxint) max<int>; -%template(maxdouble) max<double>; -%template(vecint) vector<int>; -%template(vecdouble) vector<double>; - diff --git a/Examples/pike/template/runme.pike b/Examples/pike/template/runme.pike deleted file mode 100644 index 36825c3e3..000000000 --- a/Examples/pike/template/runme.pike +++ /dev/null @@ -1,33 +0,0 @@ -int main() -{ - // Call some templated functions - write(sprintf("%d\n", .example.maxint(3, 7))); - write(sprintf("%f\n", .example.maxdouble(3.14, 2.18))); - - // Create some objects - .example.vecint iv = .example.vecint(100); - .example.vecdouble dv = .example.vecdouble(1000); - - for (int i = 0; i < 100; i++) { - iv->setitem(i, 2*i); - } - - for (int i = 0; i < 1000; i++) { - dv->setitem(i, 1.0/(i+1)); - } - - int isum = 0; - for (int i = 0; i < 100; i++) { - isum += iv->getitem(i); - } - - write(sprintf("%d\n", isum)); - - float fsum = 0.0; - for (int i = 0; i < 1000; i++) { - fsum += dv->getitem(i); - } - write(sprintf("%f\n", fsum)); - - return 0; -} |