Merge branch 'mzscheme-experimental'
* mzscheme-experimental: Fix mzscheme name and unions testcases Terminology correction in html docs Suppress experimental language warning when running the test-suite Mark MzScheme as an experimental language Add mzscheme to Travis testing Format mzscheme help output Mzscheme out of source examples fixes Standardise Mzscheme simple example Standardise Guile simple example Fix mzscheme static variable wrappers MzScheme missing destructor added in, std_vector example fixed Fix mzscheme simple example Fix mzscheme multimap example Skip failing MzScheme tests
This commit is contained in:
commit
a8f927dd50
30 changed files with 330 additions and 129 deletions
11
.travis.yml
11
.travis.yml
|
|
@ -94,6 +94,11 @@ matrix:
|
|||
env: SWIGLANG=lua VER=5.3
|
||||
sudo: required
|
||||
dist: trusty
|
||||
- compiler: gcc
|
||||
os: linux
|
||||
env: SWIGLANG=mzscheme
|
||||
sudo: required
|
||||
dist: trusty
|
||||
- compiler: gcc
|
||||
os: linux
|
||||
env: SWIGLANG=ocaml
|
||||
|
|
@ -384,6 +389,12 @@ matrix:
|
|||
env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.4 CPP11=1
|
||||
sudo: required
|
||||
dist: trusty
|
||||
# Experimental languages
|
||||
- compiler: gcc
|
||||
os: linux
|
||||
env: SWIGLANG=mzscheme
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
before_install:
|
||||
- date -u
|
||||
|
|
|
|||
|
|
@ -3626,7 +3626,7 @@ A target language is given the 'Experimental' status when
|
|||
|
||||
<ul>
|
||||
<li>
|
||||
It is of sub-standard quality, failing to meet the above 'Standard' status.
|
||||
It is of sub-standard quality, failing to meet the above 'Supported' status.
|
||||
</li>
|
||||
<li>
|
||||
It is somewhere between the mid to mature stage of development.
|
||||
|
|
@ -3652,7 +3652,7 @@ Some minimum requirements and notes about languages with the 'Experimental' stat
|
|||
Have fully functional examples of basic functionality (the simple and class examples).
|
||||
</li>
|
||||
<li>
|
||||
The test-suite must be implemented and include some runtime tests for wrapped C and C++ tests.
|
||||
The test-suite must be implemented and include a few runtime tests for both C and C++ test cases.
|
||||
</li>
|
||||
<li>
|
||||
Failing tests must be put into one of the FAILING_CPP_TESTS or FAILING_C_TESTS lists in the test-suite.
|
||||
|
|
@ -3668,7 +3668,7 @@ Some minimum requirements and notes about languages with the 'Experimental' stat
|
|||
Any new failed tests will be fixed on a 'best effort' basis by core developers with no promises made.
|
||||
</li>
|
||||
<li>
|
||||
If a language module has an official maintainer, then the maintainer will be requested to focus on fixing test-suite regressions and commit to migrating the module to become a 'Standard' module.
|
||||
If a language module has an official maintainer, then the maintainer will be requested to focus on fixing test-suite regressions and commit to migrating the module to become a 'Supported' module.
|
||||
</li>
|
||||
<li>
|
||||
If a module does not have an official maintainer, then, as maintenance will be on a 'best efforts' basis by the core maintainers, no guarantees will be provided from one release to the next and regressions may creep in.
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ Supported Target Language Options
|
|||
-java - Generate Java wrappers
|
||||
-javascript - Generate Javascript wrappers
|
||||
-lua - Generate Lua wrappers
|
||||
-mzscheme - Generate Mzscheme wrappers
|
||||
-ocaml - Generate Ocaml wrappers
|
||||
-octave - Generate Octave wrappers
|
||||
-perl5 - Generate Perl 5 wrappers
|
||||
|
|
@ -138,6 +137,7 @@ Supported Target Language Options
|
|||
-xml - Generate XML wrappers
|
||||
|
||||
Experimental Target Language Options
|
||||
-mzscheme - Generate MzScheme/Racket wrappers
|
||||
|
||||
General Options
|
||||
-addextern - Add extra extern declarations
|
||||
|
|
|
|||
|
|
@ -813,7 +813,7 @@ MZSCHEME = mzscheme
|
|||
MZC = @MZC@
|
||||
MZDYNOBJ = @MZDYNOBJ@
|
||||
MZSCHEME_SO = @MZSCHEME_SO@
|
||||
MZSCHEME_SCRIPT = $(RUNME).scm
|
||||
MZSCHEME_SCRIPT = $(SRCDIR)$(RUNME).scm
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Build a C/C++ dynamically loadable module
|
||||
|
|
@ -821,12 +821,12 @@ MZSCHEME_SCRIPT = $(RUNME).scm
|
|||
|
||||
mzscheme: $(SRCDIR_SRCS)
|
||||
$(SWIG) -mzscheme $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
|
||||
$(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ISRCS) $(SRCDIR_SRCS)
|
||||
$(COMPILETOOL) $(MZC) `echo $(CPPFLAGS) $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ISRCS) $(SRCDIR_SRCS)
|
||||
$(COMPILETOOL) $(MZC) --ld $(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS)
|
||||
|
||||
mzscheme_cpp: $(SRCDIR_SRCS)
|
||||
$(SWIG) -mzscheme -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
$(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
|
||||
$(COMPILETOOL) $(MZC) `echo $(CPPFLAGS) $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
|
||||
$(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(LIBPREFIX)$(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS) $(MZDYNOBJ) $(CPP_DLLIBS)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,21 +1,18 @@
|
|||
/* Simple example from documentation */
|
||||
/* File : example.c */
|
||||
|
||||
#include <time.h>
|
||||
/* A global variable */
|
||||
double Foo = 3.0;
|
||||
|
||||
double My_variable = 3.0;
|
||||
|
||||
int fact(int n) {
|
||||
if (n <= 1) return 1;
|
||||
else return n*fact(n-1);
|
||||
/* 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;
|
||||
}
|
||||
|
||||
int mod(int n, int m) {
|
||||
return (n % m);
|
||||
}
|
||||
|
||||
char *get_time() {
|
||||
long ltime;
|
||||
time(<ime);
|
||||
return ctime(<ime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,8 @@
|
|||
%}
|
||||
|
||||
%inline %{
|
||||
extern double My_variable;
|
||||
extern int fact(int);
|
||||
extern int mod(int n, int m);
|
||||
extern char *get_time();
|
||||
extern int gcd(int x, int y);
|
||||
extern double Foo;
|
||||
%}
|
||||
|
||||
%include guile/guilemain.i
|
||||
|
|
|
|||
|
|
@ -3,24 +3,20 @@
|
|||
(for-each display args)
|
||||
(newline))
|
||||
|
||||
(mdisplay-newline (get-time) "My variable = " (My-variable))
|
||||
; Call our gcd() function
|
||||
|
||||
(do ((i 0 (1+ i)))
|
||||
((= 14 i))
|
||||
(mdisplay-newline i " factorial is " (fact i)))
|
||||
(define x 42)
|
||||
(define y 105)
|
||||
(define g (gcd x y))
|
||||
(mdisplay-newline "The gcd of " x " and " y " is " g)
|
||||
|
||||
(define (mods i imax j jmax)
|
||||
(if (< i imax)
|
||||
(if (< j jmax)
|
||||
(begin
|
||||
(My-variable (+ (My-variable) (mod i j)))
|
||||
(mods i imax (+ j 1) jmax))
|
||||
(mods (+ i 1) imax 1 jmax))))
|
||||
; Manipulate the Foo global variable
|
||||
|
||||
(mods 1 150 1 150)
|
||||
; Output its current value
|
||||
(mdisplay-newline "Foo = " (Foo))
|
||||
|
||||
(mdisplay-newline "My-variable = " (My-variable))
|
||||
|
||||
(exit (and (= 1932053504 (fact 13))
|
||||
(= 745470.0 (My-variable))))
|
||||
; Change its value
|
||||
(Foo 3.1415926)
|
||||
|
||||
; See if the change took effect
|
||||
(mdisplay-newline "Foo = " (Foo))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# see top-level Makefile.in
|
||||
class
|
||||
multimap
|
||||
simple
|
||||
std_vector
|
||||
|
|
|
|||
18
Examples/mzscheme/class/Makefile
Normal file
18
Examples/mzscheme/class/Makefile
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
CXXSRCS = example.cxx
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
SWIGOPT =
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme_cpp
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
|
||||
28
Examples/mzscheme/class/example.cxx
Normal file
28
Examples/mzscheme/class/example.cxx
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* 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;
|
||||
}
|
||||
34
Examples/mzscheme/class/example.h
Normal file
34
Examples/mzscheme/class/example.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* 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();
|
||||
};
|
||||
9
Examples/mzscheme/class/example.i
Normal file
9
Examples/mzscheme/class/example.i
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
/* Let's just grab the original header file here */
|
||||
%include "example.h"
|
||||
60
Examples/mzscheme/class/runme.scm
Normal file
60
Examples/mzscheme/class/runme.scm
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
; file: runme.scm
|
||||
|
||||
; This file illustrates the proxy class C++ interface generated
|
||||
; by SWIG.
|
||||
|
||||
(load-extension "example.so")
|
||||
|
||||
; Convenience wrapper around the display function
|
||||
; (which only accepts one argument at the time)
|
||||
|
||||
(define (mdisplay-newline . args)
|
||||
(for-each display args)
|
||||
(newline))
|
||||
|
||||
; ----- Object creation -----
|
||||
|
||||
(mdisplay-newline "Creating some objects:")
|
||||
(define c (new-Circle 10))
|
||||
(mdisplay-newline " Created circle " c)
|
||||
(define s (new-Square 10))
|
||||
(mdisplay-newline " Created square " s)
|
||||
|
||||
; ----- Access a static member -----
|
||||
|
||||
(mdisplay-newline "\nA total of " (Shape-nshapes) " shapes were created")
|
||||
|
||||
; ----- Member data access -----
|
||||
|
||||
; Set the location of the object
|
||||
|
||||
(Shape-x-set c 20)
|
||||
(Shape-y-set c 30)
|
||||
|
||||
(Shape-x-set s -10)
|
||||
(Shape-y-set s 5)
|
||||
|
||||
(mdisplay-newline "\nHere is their current position:")
|
||||
(mdisplay-newline " Circle = (" (Shape-x-get c) "," (Shape-y-get c) ")")
|
||||
(mdisplay-newline " Square = (" (Shape-x-get s) "," (Shape-y-get s) ")")
|
||||
|
||||
; ----- Call some methods -----
|
||||
|
||||
(mdisplay-newline "\nHere are some properties of the shapes:")
|
||||
(define (shape-props o)
|
||||
(mdisplay-newline " " o)
|
||||
(mdisplay-newline " area = " (Shape-area o))
|
||||
(mdisplay-newline " perimeter = " (Shape-perimeter o)))
|
||||
(for-each shape-props (list c s))
|
||||
|
||||
(mdisplay-newline "\nGuess I'll clean up now")
|
||||
|
||||
; Note: this invokes the virtual destructor
|
||||
(delete-Shape c)
|
||||
(delete-Shape s)
|
||||
|
||||
(define s 3)
|
||||
(mdisplay-newline (Shape-nshapes) " shapes remain")
|
||||
(mdisplay-newline "Goodbye")
|
||||
|
||||
(exit 0)
|
||||
|
|
@ -13,5 +13,6 @@ build:
|
|||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ int gcdmain(int argc, char *argv[]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int count(char *bytes, int len, char c) {
|
||||
int charcount(char *bytes, int len, char c) {
|
||||
int i;
|
||||
int count = 0;
|
||||
for (i = 0; i < len; i++) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
%{
|
||||
extern int gcd(int x, int y);
|
||||
extern int gcdmain(int argc, char *argv[]);
|
||||
extern int count(char *bytes, int len, char c);
|
||||
extern int charcount(char *bytes, int len, char c);
|
||||
extern void capitalize (char *str, int len);
|
||||
extern void circle (double cx, double cy);
|
||||
extern int squareCubed (int n, int *OUTPUT);
|
||||
|
|
@ -50,7 +50,7 @@ extern int gcdmain(int argc, char *argv[]);
|
|||
$2 = SCHEME_STRLEN_VAL($input);
|
||||
}
|
||||
|
||||
extern int count(char *bytes, int len, char c);
|
||||
extern int charcount(char *bytes, int len, char c);
|
||||
|
||||
|
||||
/* This example shows how to wrap a function that mutates a string */
|
||||
|
|
@ -68,7 +68,7 @@ extern int count(char *bytes, int len, char c);
|
|||
|
||||
%typemap(argout) (char *str, int len) {
|
||||
Scheme_Object *s;
|
||||
s = scheme_make_sized_string($1,$2,1);
|
||||
s = scheme_make_sized_string($1,$2);
|
||||
SWIG_APPEND_VALUE(s);
|
||||
free($1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
(gcdmain #("gcdmain" "42" "105"))
|
||||
|
||||
|
||||
(display (count "Hello World" #\l))
|
||||
(display (charcount "Hello World" #\l))
|
||||
(newline)
|
||||
|
||||
(display (capitalize "hello world"))
|
||||
|
|
|
|||
|
|
@ -13,5 +13,6 @@ build:
|
|||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Simple example from users manual.
|
||||
|
|
@ -1,24 +1,18 @@
|
|||
/* Simple example from documentation */
|
||||
/* File : example.c */
|
||||
|
||||
#include <time.h>
|
||||
/* A global variable */
|
||||
double Foo = 3.0;
|
||||
|
||||
double My_variable = 3.0;
|
||||
|
||||
/* Compute factorial of n */
|
||||
int fact(int n) {
|
||||
if (n <= 1) return 1;
|
||||
else return n*fact(n-1);
|
||||
}
|
||||
|
||||
/* Compute n mod m */
|
||||
int my_mod(int n, int m) {
|
||||
return (n % m);
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
char *get_time() {
|
||||
long ltime;
|
||||
time(<ime);
|
||||
return ctime(<ime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
%{
|
||||
/* Put headers and other declarations here */
|
||||
%}
|
||||
|
||||
%include typemaps.i
|
||||
|
||||
%rename(mod) my_mod;
|
||||
|
||||
%inline %{
|
||||
extern double My_variable;
|
||||
extern int fact(int);
|
||||
extern int my_mod(int n, int m);
|
||||
extern char *get_time();
|
||||
extern int gcd(int x, int y);
|
||||
extern double Foo;
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -2,23 +2,30 @@
|
|||
|
||||
(load-extension "example.so")
|
||||
|
||||
(display (get-time))
|
||||
; Call our gcd() function
|
||||
|
||||
(printf "My-variable = ~a~n" (my-variable))
|
||||
(define x 42)
|
||||
(define y 105)
|
||||
(define g (gcd x y))
|
||||
(display "The gcd of ")
|
||||
(display x)
|
||||
(display " and ")
|
||||
(display y)
|
||||
(display " is ")
|
||||
(display g)
|
||||
(newline)
|
||||
|
||||
(let loop ((i 0))
|
||||
(when (< i 14) (begin (display i)
|
||||
(display " factorial is ")
|
||||
(display (fact i))
|
||||
(newline)
|
||||
(loop (+ i 1)))))
|
||||
; Manipulate the Foo global variable
|
||||
|
||||
(let loop ((i 1))
|
||||
(when (< i 250)
|
||||
(begin
|
||||
(let loopi ((j 1))
|
||||
(when (< j 250) (begin (my-variable (+ (my-variable) (mod i j)))
|
||||
(loopi (+ j 1)))))
|
||||
(loop (+ i 1)))))
|
||||
; Output its current value
|
||||
(display "Foo = ")
|
||||
(display (Foo))
|
||||
(newline)
|
||||
|
||||
(printf "My-variable = ~a~n" (my-variable))
|
||||
; Change its value
|
||||
(Foo 3.1415926)
|
||||
|
||||
; See if the change took effect
|
||||
(display "Foo = ")
|
||||
(display (Foo))
|
||||
(newline)
|
||||
|
|
|
|||
|
|
@ -1,21 +1,18 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS =
|
||||
CXXSRCS =
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
SWIGOPT =
|
||||
|
||||
GPP = `which g++`
|
||||
MZC = test -n "/usr/bin/mzc" && /usr/bin/mzc
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run
|
||||
|
||||
build:
|
||||
$(SWIGEXE) -mzscheme -c++ $(SWIGOPT) $(INTERFACE)
|
||||
$(MZC) --compiler $(GPP) ++ccf "-I." --cc example_wrap.cxx
|
||||
$(MZC) --linker $(GPP) --ld $(TARGET).so example_wrap.o
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme_cpp
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
|
||||
|
|
|
|||
|
|
@ -9,16 +9,17 @@
|
|||
(if (< i size)
|
||||
(begin
|
||||
(proc v i)
|
||||
(with-vector-item v (+ i 1)))))
|
||||
(with-vector-item v (+ i 1)))
|
||||
(void)))
|
||||
(with-vector-item v 0)))
|
||||
|
||||
(define (with-intvector v proc)
|
||||
(with-vector v proc intvector-length))
|
||||
(define (with-doublevector v proc)
|
||||
(with-vector v proc doublevector-length))
|
||||
(define (with-IntVector v proc)
|
||||
(with-vector v proc IntVector-length))
|
||||
(define (with-DoubleVector v proc)
|
||||
(with-vector v proc DoubleVector-length))
|
||||
|
||||
(define (print-doublevector v)
|
||||
(with-doublevector v (lambda (v i) (display (doublevector-ref v i))
|
||||
(define (print-DoubleVector v)
|
||||
(with-DoubleVector v (lambda (v i) (display (DoubleVector-ref v i))
|
||||
(display " ")))
|
||||
(newline))
|
||||
|
||||
|
|
@ -29,11 +30,11 @@
|
|||
(newline)
|
||||
|
||||
; ... or a wrapped std::vector<int>
|
||||
(define v (new-intvector 4))
|
||||
(with-intvector v (lambda (v i) (intvector-set! v i (+ i 1))))
|
||||
(define v (new-IntVector 4))
|
||||
(with-IntVector v (lambda (v i) (IntVector-set! v i (+ i 1))))
|
||||
(display (average v))
|
||||
(newline)
|
||||
(delete-intvector v)
|
||||
(delete-IntVector v)
|
||||
|
||||
; half will return a Scheme vector.
|
||||
; Call it with a Scheme vector...
|
||||
|
|
@ -42,13 +43,12 @@
|
|||
(newline)
|
||||
|
||||
; ... or a wrapped std::vector<double>
|
||||
(define v (new-doublevector))
|
||||
(map (lambda (i) (doublevector-push! v i)) '(1 2 3 4))
|
||||
(define v (new-DoubleVector))
|
||||
(map (lambda (i) (DoubleVector-push! v i)) '(1 2 3 4))
|
||||
(display (half v))
|
||||
(newline)
|
||||
|
||||
; now halve a wrapped std::vector<double> in place
|
||||
(halve-in-place v)
|
||||
(print-doublevector v)
|
||||
(delete-doublevector v)
|
||||
|
||||
(print-DoubleVector v)
|
||||
(delete-DoubleVector v)
|
||||
|
|
|
|||
|
|
@ -10,10 +10,67 @@ srcdir = @srcdir@
|
|||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
FAILING_CPP_TESTS = \
|
||||
allowexcept \
|
||||
apply_strings \
|
||||
arrays_dimensionless \
|
||||
arrays_global \
|
||||
char_strings \
|
||||
class_scope_weird \
|
||||
constant_pointers \
|
||||
cpp_basic \
|
||||
cpp_enum \
|
||||
curiously_recurring_template_pattern \
|
||||
default_arg_expressions \
|
||||
default_constructor \
|
||||
derived_nested \
|
||||
director_ignore \
|
||||
enum_thorough \
|
||||
extend \
|
||||
friends \
|
||||
global_scope_types \
|
||||
inherit_member \
|
||||
li_attribute \
|
||||
li_attribute_template \
|
||||
li_boost_shared_ptr \
|
||||
li_std_combinations \
|
||||
li_std_map \
|
||||
li_std_pair \
|
||||
li_std_pair_using \
|
||||
li_std_string \
|
||||
li_std_vector \
|
||||
li_windows \
|
||||
member_funcptr_galore \
|
||||
member_pointer \
|
||||
member_pointer_const \
|
||||
memberin_extend \
|
||||
namespace_spaces \
|
||||
naturalvar \
|
||||
naturalvar_more \
|
||||
nested_class \
|
||||
nested_template_base \
|
||||
ordering \
|
||||
preproc_constants \
|
||||
samename \
|
||||
template_default2 \
|
||||
template_specialization_defarg \
|
||||
template_typemaps \
|
||||
typemap_variables \
|
||||
valuewrapper_opaque \
|
||||
|
||||
FAILING_C_TESTS = \
|
||||
enums \
|
||||
integers \
|
||||
preproc_constants_c \
|
||||
preproc_line_file \
|
||||
|
||||
FAILING_MULTI_CPP_TESTS = \
|
||||
multi_import \
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
# none!
|
||||
SWIGOPT += -w524 # Suppress SWIGWARN_LANG_EXPERIMENTAL warning
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
|
||||
;; Guile modules (namespaces) but simply put all the bindings into the
|
||||
;; current module. That's enough for such a simple test.
|
||||
(load-extension "./name.so")
|
||||
(load-extension "name.so")
|
||||
|
||||
(foo-2)
|
||||
bar-2
|
||||
|
|
|
|||
|
|
@ -25,13 +25,15 @@
|
|||
(if (not (= Jill1 200))
|
||||
(begin
|
||||
(display "Runtime test 1 failed.")
|
||||
(exit 1))))
|
||||
(exit 1))
|
||||
(void)))
|
||||
|
||||
(let ((Num1 (EmbeddedUnionTest-number-get eut)))
|
||||
(if (not (= Num1 1))
|
||||
(begin
|
||||
(display "Runtime test 2 failed.")
|
||||
(exit 1))))
|
||||
(exit 1))
|
||||
(void)))
|
||||
|
||||
;; that should do
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,10 @@
|
|||
|
||||
static const char *usage = "\
|
||||
Mzscheme Options (available with -mzscheme)\n\
|
||||
-declaremodule - Create extension that declares a module\n\
|
||||
-dynamic-load <library>,[library,...] - Do not link with these libraries, dynamic load\n\
|
||||
them\n\
|
||||
-noinit - Do not emit scheme_initialize, scheme_reload,\n\
|
||||
scheme_module_name functions\n\
|
||||
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
|
||||
-declaremodule - Create extension that declares a module\n\
|
||||
-dynamic-load <lib>,[lib,...] - Do not link with these libraries, dynamic load them\n\
|
||||
-noinit - Do not emit module initialization code\n\
|
||||
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
|
||||
";
|
||||
|
||||
static String *fieldnames_tab = 0;
|
||||
|
|
@ -439,9 +437,8 @@ public:
|
|||
sprintf(temp, "%d", numargs);
|
||||
if (exporting_destructor) {
|
||||
Printf(init_func_def, "SWIG_TypeClientData(SWIGTYPE%s, (void *) %s);\n", swigtype_ptr, wname);
|
||||
} else {
|
||||
Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, wname, proc_name, numreq, numargs);
|
||||
}
|
||||
Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, wname, proc_name, numreq, numargs);
|
||||
} else {
|
||||
if (!Getattr(n, "sym:nextSibling")) {
|
||||
/* Emit overloading dispatch function */
|
||||
|
|
@ -528,7 +525,7 @@ public:
|
|||
Replaceall(tm, "$source", "argv[0]");
|
||||
Replaceall(tm, "$target", name);
|
||||
Replaceall(tm, "$input", "argv[0]");
|
||||
/* Printv(f->code, tm, "\n",NIL); */
|
||||
Replaceall(tm, "$argnum", "1");
|
||||
emit_action_code(n, f->code, tm);
|
||||
} else {
|
||||
throw_unhandled_mzscheme_type_error(t);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static TargetLanguageModule modules[] = {
|
|||
{"-javascript", swig_javascript, "Javascript", Supported},
|
||||
{"-lua", swig_lua, "Lua", Supported},
|
||||
{"-modula3", NULL, "Modula 3", Disabled},
|
||||
{"-mzscheme", swig_mzscheme, "Mzscheme", Supported},
|
||||
{"-mzscheme", swig_mzscheme, "MzScheme/Racket", Experimental},
|
||||
{"-ocaml", swig_ocaml, "Ocaml", Supported},
|
||||
{"-octave", swig_octave, "Octave", Supported},
|
||||
{"-perl", swig_perl5, NULL, Supported},
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ case "$SWIGLANG" in
|
|||
travis_retry sudo apt-get -qq install lua${VER} liblua${VER}-dev
|
||||
fi
|
||||
;;
|
||||
"mzscheme")
|
||||
travis_retry sudo apt-get -qq install racket
|
||||
;;
|
||||
"ocaml")
|
||||
# configure also looks for ocamldlgen, but this isn't packaged. But it isn't used by default so this doesn't matter.
|
||||
travis_retry sudo apt-get -qq install ocaml ocaml-findlib
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue