diff options
Diffstat (limited to 'Examples/modula3')
22 files changed, 0 insertions, 718 deletions
diff --git a/Examples/modula3/check.list b/Examples/modula3/check.list deleted file mode 100644 index 37ac8c105..000000000 --- a/Examples/modula3/check.list +++ /dev/null @@ -1,7 +0,0 @@ -# see top-level Makefile.in -class -enum -exception -reference -simple -typemap diff --git a/Examples/modula3/class/Makefile b/Examples/modula3/class/Makefile deleted file mode 100644 index b25f636c3..000000000 --- a/Examples/modula3/class/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -SRCS = -TARGET = example -PLATFORM = LINUXLIBC6 -INTERFACE = example.i -SWIGOPT = -c++ -MODULA3SRCS = *.[im]3 - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 - m3ppinplace $(MODULA3SRCS) -# compilation of example_wrap.cxx is started by cm3 -# $(CXX) -c $(TARGET)_wrap.cxx - mv example_wrap.cxx m3makefile $(MODULA3SRCS) src/ - ln -sf ../example.h src/example.h - cm3 - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/class/example.cxx b/Examples/modula3/class/example.cxx deleted file mode 100644 index 046304519..000000000 --- a/Examples/modula3/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/modula3/class/example.h b/Examples/modula3/class/example.h deleted file mode 100644 index 0dff185b2..000000000 --- a/Examples/modula3/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/modula3/class/example.i b/Examples/modula3/class/example.i deleted file mode 100644 index 2fafadbd6..000000000 --- a/Examples/modula3/class/example.i +++ /dev/null @@ -1,32 +0,0 @@ -/* File : example.i */ -%module Example - -%{ -#include "example.h" -%} - -%insert(m3makefile) %{template("../swig") -cxx_source("example_wrap")%} - -%typemap(m3rawinmode) Shape *, Circle *, Square * "" -%typemap(m3rawrettype) Shape *, Circle *, Square * "$1_basetype" - -%typemap(m3wrapinmode) Shape *, Circle *, Square * "" -%typemap(m3wrapargraw) Shape *, Circle *, Square * "self.cxxObj" - -%typemap(m3wrapretvar) Circle *, Square * "cxxObj : ExampleRaw.$1_basetype;" -%typemap(m3wrapretraw) Circle *, Square * "cxxObj" -%typemap(m3wrapretconv) Circle *, Square * "NEW($1_basetype,cxxObj:=cxxObj)" -%typemap(m3wraprettype) Circle *, Square * "$1_basetype" - -/* Should work with and without renaming -%rename(M3Shape) Shape; -%rename(M3Circle) Circle; -%rename(M3Square) Square; -%typemap(m3wrapintype) Shape *, Circle *, Square * "M3$1_basetype" -%typemap(m3wraprettype) Shape *, Circle *, Square * "M3$1_basetype" -%typemap(m3wrapretconv) Circle *, Square * "NEW(M3$1_basetype,cxxObj:=cxxObj)" -*/ - -/* Let's just grab the original header file here */ -%include "example.h" diff --git a/Examples/modula3/class/swig.tmpl b/Examples/modula3/class/swig.tmpl deleted file mode 100644 index e3e9bf178..000000000 --- a/Examples/modula3/class/swig.tmpl +++ /dev/null @@ -1,11 +0,0 @@ - -readonly proc cxx_source (X) is - local cxxfile = X&".cxx" - local objfile = X&".o" - %exec("echo $PWD") - if stale(objfile,cxxfile) - exec("cd",path(),"; g++ -I.. -c -o",objfile,cxxfile) - end - import_obj(X) - %unlink_file(path()&SL&objfile) -end diff --git a/Examples/modula3/enum/Makefile b/Examples/modula3/enum/Makefile deleted file mode 100644 index 2c5c9b0a5..000000000 --- a/Examples/modula3/enum/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -SRCS = -TARGET = example -INTERFACE = example.i -CONSTNUMERIC = example_const -SWIGOPT = -c++ -MODULA3SRCS = *.[im]3 - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run - -build: - $(SWIGEXE) -modula3 $(SWIGOPT) -module Example -generateconst $(CONSTNUMERIC) $(TARGET).h - $(CXX) -Wall $(CONSTNUMERIC).c -o $(CONSTNUMERIC) - $(CONSTNUMERIC) >$(CONSTNUMERIC).i - - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 - m3ppinplace $(MODULA3SRCS) - mv m3makefile $(MODULA3SRCS) src/ - cm3 - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/enum/example.cxx b/Examples/modula3/enum/example.cxx deleted file mode 100644 index bd808ff7c..000000000 --- a/Examples/modula3/enum/example.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/* File : example.cxx */ - -#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 if (s == HYPER) { - printf("HYPER 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!, "); - } - Foo obj; - obj.enum_test(s); -} diff --git a/Examples/modula3/enum/example.h b/Examples/modula3/enum/example.h deleted file mode 100644 index 2f44a6ccf..000000000 --- a/Examples/modula3/enum/example.h +++ /dev/null @@ -1,83 +0,0 @@ -/* File : example.h */ - -#define PI 3.141 - -#define DAY_MONDAY 0 -#define DAY_TUESDAY 1 -#define DAY_WEDNESDAY 2 -#define DAY_THURSDAY 3 -#define DAY_FRIDAY 4 -#define DAY_SATURDAY 5 -#define DAY_SUNDAY 6 - -enum color { BLUE, RED, GREEN }; - -#define CLB_BLACK 0 -#define CLB_BLUE 1 -#define CLB_RED 2 -#define CLB_MAGENTA 3 -#define CLB_GREEN 4 -#define CLB_CYAN 5 -#define CLB_YELLOW 6 -#define CLB_WHITE 7 - -/* Using this would be good style - which cannot be expected for general C header files. - Instead I want to demonstrate how to live without it. -enum month { - MTHF_JANUARY, - MTHF_FEBRUARY, - MTHF_MARCH, - MTHF_APRIL, - MTHF_MAY, - MTHF_JUNE, - MTHF_JULY, - MTHF_AUGUST, - MTHF_SEPTEMBER, - MTHF_OCTOBER, - MTHF_NOVEMBER, - MTHF_DECEMBER, -} -*/ - -/* Since there are no compile time constants in C / C++ - it is a common abuse - to declare bit set (flag) constants - as enumerations. */ -enum calendar { - MTHB_JANUARY = 1 << 0, /* 1 << MTHF_JANUARY, */ - MTHB_FEBRUARY = 1 << 1, /* 1 << MTHF_FEBRUARY, */ - MTHB_MARCH = 1 << 2, /* 1 << MTHF_MARCH, */ - MTHB_APRIL = 1 << 3, /* 1 << MTHF_APRIL, */ - MTHB_MAY = 1 << 4, /* 1 << MTHF_MAY, */ - MTHB_JUNE = 1 << 5, /* 1 << MTHF_JUNE, */ - MTHB_JULY = 1 << 6, /* 1 << MTHF_JULY, */ - MTHB_AUGUST = 1 << 7, /* 1 << MTHF_AUGUST, */ - MTHB_SEPTEMBER = 1 << 8, /* 1 << MTHF_SEPTEMBER, */ - MTHB_OCTOBER = 1 << 9, /* 1 << MTHF_OCTOBER, */ - MTHB_NOVEMBER = 1 << 10, /* 1 << MTHF_NOVEMBER, */ - MTHB_DECEMBER = 1 << 11, /* 1 << MTHF_DECEMBER, */ - - MTHB_SPRING = MTHB_MARCH | MTHB_APRIL | MTHB_MAY, - MTHB_SUMMER = MTHB_JUNE | MTHB_JULY | MTHB_AUGUST, - MTHB_AUTUMN = MTHB_SEPTEMBER | MTHB_OCTOBER | MTHB_NOVEMBER, - MTHB_WINTER = MTHB_DECEMBER | MTHB_JANUARY | MTHB_FEBRUARY, -}; - - -namespace Answer { - enum { - UNIVERSE_AND_EVERYTHING = 42, - SEVENTEEN_AND_FOUR = 21, - TWOHUNDRED_PERCENT_OF_NOTHING = 0, - }; - - class Foo { - public: - Foo() { } - enum speed { IMPULSE = -2, WARP = 0, HYPER, LUDICROUS = 3}; - void enum_test(speed s); - }; -}; - -void enum_test(color c, Answer::Foo::speed s); diff --git a/Examples/modula3/enum/example.i b/Examples/modula3/enum/example.i deleted file mode 100644 index f5947b3bc..000000000 --- a/Examples/modula3/enum/example.i +++ /dev/null @@ -1,72 +0,0 @@ -/* File : example.i */ -%module Example - -%{ -#include "example.h" -%} - -%include "example_const.i" - -// such features are generated by the following pragmas -#if 0 -%feature("modula3:enumitem:enum","Days") DAY_MONDAY; -%feature("modula3:enumitem:name","monday") DAY_MONDAY; -%feature("modula3:enumitem:conv","int:int") DAY_MONDAY; - -%feature("modula3:enumitem:enum","Month") MTHB_JANUARY; -%feature("modula3:enumitem:name","january") MTHB_JANUARY; -%feature("modula3:enumitem:conv","set:int") MTHB_JANUARY; -//%feature("modula3:constset:type","MonthSet") MTHB_JANUARY; /*type in the constant definition*/ -%feature("modula3:constset:set", "MonthSet") MTHB_JANUARY; /*remarks that the 'type' is a set type*/ -%feature("modula3:constset:base","Month") MTHB_JANUARY; -%feature("modula3:constset:name","monthsJanuary") MTHB_JANUARY; -%feature("modula3:constset:conv","set:set") MTHB_JANUARY; /*conversion of the bit pattern: no change*/ - -%feature("modula3:enumitem:enum","Color") BLUE; -%feature("modula3:enumitem:name","blue") BLUE; -%feature("modula3:enumitem:conv","int:int") BLUE; - -%feature("modula3:constint:type","INTEGER") Foo::IMPULSE; -%feature("modula3:constint:name","impulse") Foo::IMPULSE; -%feature("modula3:constint:conv","int:int") Foo::IMPULSE; -#endif - -%rename(pi) PI; - -%pragma(modula3) enumitem="prefix=DAY_;int;srcstyle=underscore;Day"; - -%pragma(modula3) enumitem="enum=color;int;srcstyle=underscore;Color"; -%pragma(modula3) makesetofenum="Color"; -%pragma(modula3) constset="prefix=CLB_;set;srcstyle=underscore,prefix=clb;ColorSet,Color"; - -%pragma(modula3) enumitem="prefix=MTHB_,enum=calendar;set;srcstyle=underscore;Month"; -%pragma(modula3) makesetofenum="Month"; -%pragma(modula3) constset="prefix=MTHB_,enum=calendar;set;srcstyle=underscore,prefix=monthset;MonthSet,Month"; - -%pragma(modula3) constint="prefix=Answer::Foo::,enum=Answer::Foo::speed;int;srcstyle=underscore,prefix=speed;INTEGER"; - -%pragma(modula3) constint="prefix=Answer::,enum=Answer::;int;srcstyle=underscore,prefix=answer;CARDINAL"; - -%rename(AnswerFoo) Answer::Foo; -%typemap("m3rawrettype") Answer::Foo * %{AnswerFoo%} -%typemap("m3rawintype") Answer::Foo * %{AnswerFoo%} -%typemap("m3rawinmode") Answer::Foo * %{%} -%typemap("m3wraprettype") Answer::Foo * %{AnswerFoo%} -%typemap("m3wrapintype") Answer::Foo * %{AnswerFoo%} -%typemap("m3wrapinmode") Answer::Foo * %{%} -%typemap("m3wrapargraw") Answer::Foo * %{self.cxxObj%} - -%typemap("m3wrapretvar") Answer::Foo * %{cxxObj : ExampleRaw.AnswerFoo;%} -%typemap("m3wrapretraw") Answer::Foo * %{cxxObj%} -%typemap("m3wrapretconv") Answer::Foo * %{NEW(AnswerFoo,cxxObj:=cxxObj)%} - - -%typemap("m3rawintype") Answer::Foo::speed %{C.int%}; -%typemap("m3rawintype:import") Answer::Foo::speed %{Ctypes AS C%}; -%typemap("m3wrapintype") Answer::Foo::speed %{[-2..3]%}; - -%typemap("m3wrapintype") color %{Color%}; -%typemap("m3wrapargraw") color %{ORD($1_name)%}; - -/* Let's just grab the original header file here */ -%include "example.h" diff --git a/Examples/modula3/exception/Makefile b/Examples/modula3/exception/Makefile deleted file mode 100644 index 8d12ef19e..000000000 --- a/Examples/modula3/exception/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../.. -SWIGEXE = $(TOP)/../swig -SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -SWIGOPT = -MODULA3SRCS = *.[im]3 -MODULA3FLAGS= -o runme - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3_cpp -# $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MODULA3SRCS='$(MODULA3SRCS)' MODULA3FLAGS='$(MODULA3FLAGS)' modula3_compile - m3ppinplace $(MODULA3SRCS) - mv m3makefile $(MODULA3SRCS) src/ - cm3 - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/exception/example.h b/Examples/modula3/exception/example.h deleted file mode 100644 index 0e9e0e81d..000000000 --- a/Examples/modula3/exception/example.h +++ /dev/null @@ -1,18 +0,0 @@ -/* File : example.h */ - -enum error {OK, OVERFLOW, DIVISION_BY_ZERO, NEGATIVE_RADICAND, NEGATIVE_BASE}; -typedef error errorstate; /* just to separate the typemaps */ - -error acc_add (double &x, double y); -error acc_sub (double &x, double y); -error acc_mul (double &x, double y); -error acc_div (double &x, double y); - -double op_add (double x, double y, errorstate &err); -double op_sub (double x, double y, errorstate &err); -double op_mul (double x, double y, errorstate &err); -double op_div (double x, double y, errorstate &err); -double op_sqrt (double x, errorstate &err); -double op_pow (double x, double y, errorstate &err); - -double op_noexc (double x, double y); diff --git a/Examples/modula3/exception/example.i b/Examples/modula3/exception/example.i deleted file mode 100644 index 92a716fae..000000000 --- a/Examples/modula3/exception/example.i +++ /dev/null @@ -1,43 +0,0 @@ -/* File : example.i */ -%module Example - -%{ -#include "example.h" -%} - -%insert(m3wrapintf) %{ -EXCEPTION E(Error); -%} -%insert(m3wrapimpl) %{ -IMPORT Ctypes AS C; -%} - -%pragma(modula3) enumitem="enum=error;int;srcstyle=underscore;Error"; - -%typemap("m3rawintype") double & %{C.double%}; -%typemap("m3wrapintype") double & %{LONGREAL%}; - -%typemap("m3wraprettype") error "" -%typemap("m3wrapretvar") error "rawerr: C.int;" -%typemap("m3wrapretraw") error "rawerr" -%typemap("m3wrapretcheck:throws") error "E" -%typemap("m3wrapretcheck") error -%{VAR err := VAL(rawerr, Error); -BEGIN -IF err # Error.ok THEN -RAISE E(err); -END; -END;%} - -%typemap("m3rawintype") errorstate & %{C.int%}; -%typemap("m3wrapintype",numinputs=0) errorstate & %{%}; -%typemap("m3wrapargvar") errorstate & %{err:C.int:=ORD(Error.ok);%}; -%typemap("m3wrapoutcheck:throws") errorstate & "E"; -%typemap("m3wrapoutcheck") errorstate & -%{IF VAL(err,Error) # Error.ok THEN -RAISE E(VAL(err,Error)); -END;%} - -/* Let's just grab the original header file here */ - -%include "example.h" diff --git a/Examples/modula3/reference/Makefile b/Examples/modula3/reference/Makefile deleted file mode 100644 index eaceceb1f..000000000 --- a/Examples/modula3/reference/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 -SWIGOPT = -c++ -MODULA3SRCS = *.[im]3 - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 - m3ppinplace $(MODULA3SRCS) - mv m3makefile $(MODULA3SRCS) src/ - cm3 - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/reference/example.cxx b/Examples/modula3/reference/example.cxx deleted file mode 100644 index 9dbaed2ee..000000000 --- a/Examples/modula3/reference/example.cxx +++ /dev/null @@ -1,46 +0,0 @@ -/* File : example.cxx */ - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -#include "example.h" -#include <stdio.h> -#include <stdlib.h> - -Vector operator+(const Vector &a, const Vector &b) { - Vector r; - r.x = a.x + b.x; - r.y = a.y + b.y; - r.z = a.z + b.z; - return r; -} - -char *Vector::print() { - static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); - return temp; -} - -VectorArray::VectorArray(int size) { - items = new Vector[size]; - maxsize = size; -} - -VectorArray::~VectorArray() { - delete [] items; -} - -Vector &VectorArray::operator[](int index) { - if ((index < 0) || (index >= maxsize)) { - printf("Panic! Array index out of bounds.\n"); - exit(1); - } - return items[index]; -} - -int VectorArray::size() { - return maxsize; -} - diff --git a/Examples/modula3/reference/example.h b/Examples/modula3/reference/example.h deleted file mode 100644 index 7b4ba8fb8..000000000 --- a/Examples/modula3/reference/example.h +++ /dev/null @@ -1,22 +0,0 @@ -/* File : example.h */ - -struct Vector { -private: - double x,y,z; -public: - Vector() : x(0), y(0), z(0) { } - Vector(double x, double y, double z) : x(x), y(y), z(z) { } - Vector operator+(const Vector &b) const; - char *print(); -}; - -struct VectorArray { -private: - Vector *items; - int maxsize; -public: - VectorArray(int maxsize); - ~VectorArray(); - Vector &operator[](int); - int size(); -}; diff --git a/Examples/modula3/reference/example.i b/Examples/modula3/reference/example.i deleted file mode 100644 index 002090918..000000000 --- a/Examples/modula3/reference/example.i +++ /dev/null @@ -1,32 +0,0 @@ -/* File : example.i */ - -/* This file has a few "typical" uses of C++ references. */ - -%module Example - -%{ -#include "example.h" -%} - -%pragma(modula3) unsafe="1"; - -%insert(m3wrapintf) %{FROM ExampleRaw IMPORT Vector, VectorArray;%} -%insert(m3wrapimpl) %{FROM ExampleRaw IMPORT Vector, VectorArray;%} - -%typemap(m3wrapretvar) Vector %{vec: UNTRACED REF Vector;%} -%typemap(m3wrapretraw) Vector %{vec%} -%typemap(m3wrapretconv) Vector %{vec^%} - - -/* This helper function calls an overloaded operator */ -%inline %{ -Vector addv(const Vector &a, const Vector &b) { - return a+b; -} -%} - -%rename(Vector_Clear) Vector::Vector(); -%rename(Add) Vector::operator+; -%rename(GetItem) VectorArray::operator[]; - -%include "example.h" diff --git a/Examples/modula3/simple/Makefile b/Examples/modula3/simple/Makefile deleted file mode 100644 index 3ba35d18b..000000000 --- a/Examples/modula3/simple/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 -SWIGOPT = -MODULA3SRCS = *.[im]3 - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 - m3ppinplace $(MODULA3SRCS) - mv m3makefile $(MODULA3SRCS) src/ - cm3 - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/simple/example.c b/Examples/modula3/simple/example.c deleted file mode 100644 index 1c2af789c..000000000 --- a/Examples/modula3/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/modula3/simple/example.i b/Examples/modula3/simple/example.i deleted file mode 100644 index 1694e6dbe..000000000 --- a/Examples/modula3/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/modula3/typemap/Makefile b/Examples/modula3/typemap/Makefile deleted file mode 100644 index 3ba35d18b..000000000 --- a/Examples/modula3/typemap/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 -SWIGOPT = -MODULA3SRCS = *.[im]3 - -check: build - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 - m3ppinplace $(MODULA3SRCS) - mv m3makefile $(MODULA3SRCS) src/ - cm3 - -clean: - $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/typemap/example.i b/Examples/modula3/typemap/example.i deleted file mode 100644 index 2f454eff3..000000000 --- a/Examples/modula3/typemap/example.i +++ /dev/null @@ -1,90 +0,0 @@ -/* File : example.i */ -%module Example - -%pragma(modula3) unsafe="true"; - -%insert(m3wrapintf) %{FROM ExampleRaw IMPORT Window, Point; -%} -%insert(m3wrapimpl) %{FROM ExampleRaw IMPORT Window, Point; -IMPORT M3toC; -IMPORT Ctypes AS C; -%} - -/* Typemap applied to patterns of multiple arguments */ - -%typemap(m3rawinmode) (char *outstr) %{VAR%} -%typemap(m3rawintype) (char *outstr) %{CHAR%} -%typemap(m3wrapinmode) (char *outstr, int size) %{VAR%} -%typemap(m3wrapintype) (char *outstr, int size) %{ARRAY OF CHAR%} -%typemap(m3wrapargraw) (char *outstr, int size) %{$1_name[0], NUMBER($1_name)%} - - -%typemap(m3rawinmode) (const struct Window *) %{READONLY%} -%typemap(m3wrapinmode) (const struct Window *) %{READONLY%} -%typemap(m3rawintype) ( struct Window *) %{Window%} -%typemap(m3wrapintype) ( struct Window *) %{Window%} - -%typemap(m3rawinmode) (const char *str []) %{READONLY%} -%typemap(m3wrapinmode) (const char *str []) %{READONLY%} -%typemap(m3rawintype) (const char *str []) %{(*ARRAY OF*) C.char_star%} -%typemap(m3wrapintype) (const char *str []) %{ARRAY OF TEXT%} -%typemap(m3wrapargvar) (const char *str []) %{$1: REF ARRAY OF C.char_star;%} -%typemap(m3wrapargraw) (const char *str []) %{$1[0]%} -%typemap(m3wrapinconv) (const char *str []) %{$1:= NEW(REF ARRAY OF C.char_star,NUMBER($1_name)); -FOR i:=FIRST($1_name) TO LAST($1_name) DO -$1[i]:=M3toC.SharedTtoS($1_name[i]); -END;%} -%typemap(m3wrapfreearg) (const char *str []) -%{FOR i:=FIRST($1_name) TO LAST($1_name) DO -M3toC.FreeSharedS($1_name[i],$1[i]); -END;%} - -%typemap(m3wraprettype) char * %{TEXT%} -%typemap(m3wrapretvar) char * %{result_string: C.char_star;%} -%typemap(m3wrapretraw) char * %{result_string%} -%typemap(m3wrapretconv) char * %{M3toC.CopyStoT(result_string)%} - -struct Window { - char *label; - int left,top,width,height; -}; - - -%typemap(m3wrapinname) (int x, int y) %{p%} -%typemap(m3wrapinmode) (int x, int y) %{READONLY%} -%typemap(m3wrapintype) (int x, int y) %{Point%} -%typemap(m3wrapargraw) (int x, int y) %{p.$1_name, p.$2_name%} - -%typemap(m3wrapargraw) (int &x, int &y) %{p.$1_name, p.$2_name%} -%typemap(m3wrapintype) (int &x, int &y) %{Point%} -%typemap(m3wrapoutname) (int &x, int &y) %{p%} -%typemap(m3wrapouttype) (int &x, int &y) %{Point%} -%typemap(m3wrapargdir) (int &x, int &y) "out" - - -%typemap(m3wrapargvar) int &left, int &top, int &width, int &height "$1:C.int;" -%typemap(m3wrapargraw) int &left, int &top, int &width, int &height "$1" -%typemap(m3wrapoutconv) int &left, int &top, int &width, int &height "$1" - -%typemap(m3wrapargdir) int &left, int &top "out" - -%typemap(m3wrapouttype) int &width, int &height "CARDINAL" -%typemap(m3wrapargdir) int &width, int &height "out" - -struct Point { - int x,y; -}; - -%m3multiretval get_box; - -void set_label ( struct Window *win, const char *str, bool activate); -void set_multi_label ( struct Window *win, const char *str []); -void write_label (const struct Window *win, char *outstr, int size); -int get_label (const struct Window *win, char *outstr, int size); -char *get_label_ptr (const struct Window *win); -void move(struct Window *win, int x, int y); -int get_area(const struct Window *win); -void get_box(const struct Window *win, int &left, int &top, int &width, int &height); -void get_left(const struct Window *win, int &left); -void get_mouse(const struct Window *win, int &x, int &y); -int get_attached_data(const struct Window *win, const char *id); |