Rewrite chicken example and test-suite building code

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5948 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2004-05-30 07:11:26 +00:00
commit acd0b021b1
35 changed files with 315 additions and 844 deletions

View file

@ -1,6 +1,12 @@
Version 1.3.22 (in progress)
==================================
05/30/2004: wuzzeb (John Lenz)
[Chicken]
- Update how examples and the test suite are built.
- Symbol names are no longer converted to lower case
- Added union_runme.ss, which was copied and modified from the guile module
05/26/2004: lballabio (Luigi Ballabio)
Committed on behalf of Marcelo (who still has problems with
the SourceForge CVS.)

View file

@ -1,48 +1,28 @@
TOP = ../../..
SWIG = $(TOP)/../swig
CHICKSRCS = precsi.c ogifplot.c
SRCS = gifplot_wrap.c
CXXSRCS =
CHICKGEN = $(CHICKSRCS) csi.c gifplot_wrap.c
TARGET = gifplot
INCLUDE = -I. -I../../Include
LIBS = -L../.. -lgifplot -lm
SWIGOPT = -I../../Include
TOP = ../../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = gifplot.i
SRCS =
CXXSRCS =
TARGET = gifplot
INCLUDE = -I. -I../../Include
SWIGOPT = -I../../Include
CFLAGS =
VARIANT =
LIBS = -L../.. -lgifplot -lm
# comment the following two lines to build a dynamic so file
CHICKEN_MAIN = test-gifplot.scm
VARIANT = _static
all:: $(TARGET)
csi.c:
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
INTERFACE='precsi' chicken_csi
precsi.c: precsi.scm
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
INTERFACE='$<' chicken
gifplot_wrap.c gifplot.scm: gifplot.i
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
INCLUDE='$(INCLUDE)' INTERFACE='gifplot.i' chicken_c
ogifplot.c: gifplot.scm
$(MAKE) -f $(TOP)/Makefile TARGET='ogifplot.c' \
INTERFACE='$<' chicken
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile LIBS='$(LIBS)' \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile LIBS='$(LIBS)' \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f $(CHICKGEN)
rm -f gifplot.scm
rm -f $(TARGET) image.gif
check:: all
rm -f gifplot.scm image.gif
rm -f $(TARGET)

View file

@ -3,17 +3,4 @@ any changes. The Scheme program 'test-gifplot.scm' does something a
little more interesting. You'll have to go look at the header file to
get a complete listing of the functions.
`make' will build a version of the CHICKEN interpreter which defines
an additional unit (gifplot). Run `./simple test-gifplot.scm' to test
it.
** If you have a platform that supports dynamic linking (most UNIXes
** and Win32), then you can run "make module". This will create a
** dynamic module called module.dll/module.so/module.shl (depending on
** your platform), which you can use with the following:
(load-library 'precsi "module.dll")
or
(load-library 'gifplot "module.dll")
`make' will build a static binary. Run ./gifplot to test it.

View file

@ -1,8 +0,0 @@
(declare (unit precsi))
(declare (uses gifplot))
;; display prelude to csi
(display "full\n\n")
(display " A SWIG GIFPlot example for the CHICKEN compiler\n")
(display " Author: Jonah Beckford, December 2002\n\n")

View file

@ -1,5 +1,7 @@
;;; Plot a 3D function
(declare (uses gifplot))
;; Here is the function to plot
(define (func x y)
(* 5

View file

@ -1,48 +1,28 @@
TOP = ../../..
SWIG = $(TOP)/../swig
CHICKSRCS = precsi.c osimple.c
SRCS = simple_wrap.c
CXXSRCS =
CHICKGEN = $(CHICKSRCS) csi.c simple_wrap.c
TARGET = simple
INCLUDE = -I. -I../../Include
LIBS = -L../.. -lgifplot -lm
SWIGOPT = -I../../Include
TOP = ../../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = simple.i
SRCS =
CXXSRCS =
TARGET = simple
INCLUDE = -I. -I../../Include
SWIGOPT = -I../../Include
CFLAGS =
VARIANT =
LIBS = -L../.. -lgifplot -lm
# comment the following two lines to build a dynamic so file
CHICKEN_MAIN = test-simple.scm
VARIANT = _static
all:: $(TARGET)
csi.c:
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
INTERFACE='precsi' chicken_csi
precsi.c: precsi.scm
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
INTERFACE='$<' chicken
simple_wrap.c simple.scm: simple.i
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
INCLUDE='$(INCLUDE)' INTERFACE='simple.i' chicken_c
osimple.c: simple.scm
$(MAKE) -f $(TOP)/Makefile TARGET='osimple.c' \
INTERFACE='$<' chicken
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile LIBS='$(LIBS)' \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile LIBS='$(LIBS)' \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f $(CHICKGEN)
rm -f simple.scm
rm -f $(TARGET) image.gif
check:: all
rm -f simple.scm image.gif
rm -f $(TARGET)

View file

@ -2,17 +2,4 @@ This is a very minimalistic example in which just a few functions
and constants from library are wrapped and used to draw some simple
shapes.
`make' will build a version of the CHICKEN interpreter which defines
an additional unit (simple). Run `./simple test-simple.scm' to test
it.
** If you have a platform that supports dynamic linking (most UNIXes
** and Win32), then you can run "make module". This will create a
** dynamic module called module.dll/module.so/module.shl (depending on
** your platform), which you can use with the following:
(load-library 'precsi "module.dll")
or
(load-library 'simple "module.dll")
`make' will build an exe. Run ./simple to test it.

View file

@ -1,8 +0,0 @@
(declare (unit precsi))
(declare (uses simple))
;; display prelude to csi
(display "simple\n\n")
(display " A SWIG GIFPlot example for the CHICKEN compiler\n")
(display " Author: Jonah Beckford, December 2002\n\n")

View file

@ -1,5 +1,7 @@
;;; Draw some simple shapes
(declare (uses simple))
(display "Drawing some basic shapes\n")
(define cmap (simple:new-ColorMap #f))

View file

@ -909,86 +909,51 @@ pike_clean:
rm -f *.@OBJEXT@ *$(SO) *_wrap* *~ .~* core @EXTRA_CLEAN@ mypike@EXEEXT@
# -----------------------------------------------------------------
# Compile a CHICKEN Scheme file to C.
#
# -----------------------------------------------------------------
##################################################################
##### Chicken ######
##################################################################
CHICKEN = @CHICKEN@
CHICKEN_CSC = @CHICKEN_CSC@
CHICKEN_LIBOPTS = @CHICKENLIB@ $(SYSLIBS)
CHICKEN_SHAREDLIBOPTS = @CHICKENSHAREDLIB@ $(SYSLIBS)
CHICKEN_CFLAGS = @CHICKENOPTS@
CHICKEN_SHAREDCFLAGS = @CHICKENSHAREDOPTS@
CHICKENOPTS = -optimize-level 3 -quiet
CHICKENOPTS = -quiet
CHICKEN_MAIN =
# SWIG produces $(ISRCS) (the C wrapper file)
# and $(CHICKEN_GENERATED_SCHEME) (the Scheme wrapper file):
CHICKEN_GENERATED_SCHEME = `echo $(INTERFACE:.i=.scm) | sed 's/_/-/g'`
# Chicken compiles the Scheme wrapper file into this:
CHICKEN_COMPILED_SCHEME = $(INTERFACE:.i=_chicken.c)
CHICKEN_COMPILED_OBJECT = $(CHICKEN_COMPILED_SCHEME:.c=.@OBJEXT@)
chicken_chicken: $(INTERFACE)
$(CHICKEN) $(INTERFACE) $(CHICKENOPTS) -explicit-use \
-output-file $(TARGET)
chicken_swig_c:
$(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE)
chicken_swig_cpp:
$(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE)
chicken_compile: $(INTERFACE)
$(CC) $(CFLAGS) $(INCLUDE) -c $(INTERFACE) -o $(TARGET)
chicken_cxxcompile: $(INTERFACE)
$(CXX) $(CFLAGS) $(INCLUDE) -c $(INTERFACE) -o $(TARGET)
chicken_csi:
X=`pwd` && cd @CHICKENHOME@ && \
$(CHICKEN) @CHICKENHOME@/src/csi.scm $(CHICKENOPTS) \
-include-path @CHICKENHOME@/src \
-prologue @CHICKENHOME@/src/build.scm \
-prelude "(declare (uses posix $(INTERFACE)))" \
-output-file $$X/$(TARGET)
chicken_clean:
rm -f *.@OBJEXT@ *@SO@ *_wrap* *~ .~* core @EXTRA_CLEAN@ STACKTRACE
rm -f *.exe module$(SO)
# flags for the main chicken sources (only used when compiling staticly)
CHICKEN_COMPILED_MAIN = $(CHICKEN_MAIN:.scm=_chicken.c)
CHICKEN_COMPILED_MAIN_OBJECT = $(CHICKEN_COMPILED_MAIN:.c=.@OBJEXT@)
# -----------------------------------------------------------------
# Build a CHICKEN dynamically loadable module
# -----------------------------------------------------------------
chicken_module: $(SRCS) $(CHICKSRCS)
chicken: $(SRCS)
$(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE)
$(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) -explicit-use \
$(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \
-dynamic -feature chicken-compile-shared \
-output-file $(CHICKEN_COMPILED_SCHEME)
test x = "x$(CHICKSRCS)" || \
$(CC) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_SHAREDCFLAGS) $(INCLUDE) \
$(CHICKEN_INCLUDE) $(CHICKSRCS)
test x = "x$(SRCS)$(ISRCS)" || \
$(CC) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_SHAREDCFLAGS) \
$(INCLUDE) $(CHICKEN_INCLUDE) \
$(ISRCS) $(SRCS)
$(LDSHARED) $(SRCS:.c=.@OBJEXT@) $(CHICKSRCS:.c=.@OBJEXT@) \
$(LIBS) $(CHICKEN_SHAREDLIBOPTS) \
-o $(TARGET)$(SO)
$(CC) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_CFLAGS) \
$(INCLUDE) $(CHICKEN_INCLUDE) $(ISRCS) $(SRCS) $(CHICKEN_COMPILED_SCHEME)
$(LDSHARED) $(CHICKEN_COMPILED_OBJECT) $(OBJS) $(IOBJS) \
$(LIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(TARGET)$(SO)
chicken_module_cpp: $(CXXSRCS) $(CHICKSRCS)
chicken_cpp: $(CXXSRCS) $(CHICKSRCS)
$(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE)
$(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) -explicit-use \
$(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \
-dynamic -feature chicken-compile-shared \
-output-file $(CHICKEN_COMPILED_SCHEME)
test x = "x$(CHICKSRCS)" || \
$(CC) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_SHAREDCFLAGS) $(INCLUDE) \
$(CHICKEN_INCLUDE) $(CHICKSRCS)
test x = "x$(CXXSRCS)$(ICXXSRCS)" || \
$(CXX) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_SHAREDCFLAGS) \
$(INCLUDE) $(CHICKEN_INCLUDE) \
$(ICXXSRCS) $(CXXSRCS)
$(CXXSHARED) $(CXXSRCS:.cxx=.@OBJEXT@) $(CHICKSRCS:.c=.@OBJEXT@) \
$(LIBS) $(CHICKEN_SHAREDLIBOPTS) \
-o $(TARGET)$(SO)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_CFLAGS) \
$(INCLUDE) $(CHICKEN_INCLUDE) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(CHICKEN_COMPILED_SCHEME)
$(CXXSHARED) $(CHICKEN_COMPILED_OBJECT) $(OBJS) $(IOBJS) \
$(LIBS) $(CPP_DLLIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(TARGET)$(SO)
# -----------------------------------------------------------------
# Build statically linked CHICKEN interpreter
@ -997,33 +962,42 @@ chicken_module_cpp: $(CXXSRCS) $(CHICKSRCS)
# The following two targets are also used by the test suite
chicken_static: $(SRCS) $(CHICKSRCS)
$(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE)
$(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) -explicit-use \
$(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \
-output-file $(CHICKEN_COMPILED_SCHEME)
test x = "x$(CHICKSRCS)$(CHICKEN_COMPILED_SCHEME)" || \
$(CC) -c $(CFLAGS) $(CHICKEN_CFLAGS) $(INCLUDE) \
$(CHICKEN_INCLUDE) $(CHICKSRCS) $(CHICKEN_COMPILED_SCHEME)
test x = "x$(SRCS)$(ISRCS)" || \
$(CC) -c $(CFLAGS) $(INCLUDE) $(CHICKEN_INCLUDE) \
$(CHICKEN_CFLAGS) $(ISRCS) $(SRCS)
$(CC) $(SRCS:.c=.@OBJEXT@) $(ISRCS:.c=.@OBJEXT@) \
$(CHICKEN_COMPILED_SCHEME:.c=.@OBJEXT@) $(CHICKSRCS:.c=.@OBJEXT@) \
$(LIBS) $(CHICKEN_LIBOPTS) \
-o $(TARGET)
$(CHICKEN) $(CHICKEN_MAIN) $(CHICKENOPTS) \
-output-file $(CHICKEN_MAIN:.scm=_chicken.c)
$(CC) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_CFLAGS) \
$(INCLUDE) $(CHICKEN_INCLUDE) $(ISRCS) $(SRCS) \
$(CHICKEN_COMPILED_SCHEME) $(CHICKEN_COMPILED_MAIN)
$(CC) $(CHICKEN_COMPILED_OBJECT) $(CHICKEN_COMPILED_MAIN_OBJECT) \
$(OBJS) $(IOBJS) $(LIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(TARGET)
chicken_static_cpp: $(CXXSRCS) $(CHICKSRCS)
$(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE)
$(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) -explicit-use \
$(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \
-output-file $(CHICKEN_COMPILED_SCHEME)
test x = "x$(CHICKSRCS)$(CHICKEN_COMPILED_SCHEME)" || \
$(CC) -c $(CFLAGS) $(CHICKEN_CFLAGS) $(INCLUDE) \
$(CHICKEN_INCLUDE) $(CHICKSRCS) $(CHICKEN_COMPILED_SCHEME)
test x = "x$(CXXSRCS)$(ICXXSRCS)" || \
$(CXX) -c $(CFLAGS) $(INCLUDE) $(CHICKEN_INCLUDE) \
$(CHICKEN_CFLAGS) $(ICXXSRCS) $(CXXSRCS)
$(CXX) $(CXXSRCS:.cxx=.@OBJEXT@) $(ICXXSRCS:.cxx=.@OBJEXT@) \
$(CHICKEN_COMPILED_SCHEME:.c=.@OBJEXT@) $(CHICKSRCS:.c=.@OBJEXT@) \
$(LIBS) $(CHICKEN_LIBOPTS) \
-o $(TARGET)
$(CHICKEN) $(CHICKEN_MAIN) $(CHICKENOPTS) \
-output-file $(CHICKEN_MAIN:.scm=_chicken.c)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_CFLAGS) \
$(INCLUDE) $(CHICKEN_INCLUDE) $(ICXXSRCS) $(SRCS) $(CXXSRCS) \
$(CHICKEN_COMPILED_SCHEME) $(CHICKEN_COMPILED_MAIN)
$(CXX) $(CHICKEN_COMPILED_OBJECT) $(CHICKEN_COMPILED_MAIN_OBJECT) \
$(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(TARGET)
# ----------------------------------------------------------------
# Build a shared library using csc
# ----------------------------------------------------------------
chicken_csc:
$(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE)
$(CHICKEN_CSC) -sv $(CHICKEN_GENERATED_SCHEME) $(SRCS) $(ISRCS) -o $(TARGET)$(SO)
chicken_csc_cpp:
$(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE)
$(CHICKEN_CSC) -sv $(CHICKEN_GENERATED_SCHEME) $(SRCS) $(ICXXSRCS) $(CXXSRCS) -o $(TARGET)$(SO)
chicken_clean:
rm -f *.@OBJEXT@ *$(SO) *_wrap* *~ .~* core @EXTRA_CLEAN@ *_chicken*
##################################################################
##### CSHARP ######

View file

@ -7,19 +7,7 @@ overload -- C++ function overloading
simple -- the simple example from the user manual
zlib -- a wrapping of the zlib compression library
Note that the examples in this directory build a special version of
the CHICKEN interpreter (statically linked) which includes the wrapped
functions in the top-level module. Just run "make" in any example
directory.
You should be able to run make in each of the examples. By default, a shared
library will be built. Run make check to execute the test.
** If you have a platform that supports dynamic linking (most UNIXes
** and Win32), then you can run "make module" in any example
** directory. This will create a dynamic module called
** module.dll/module.so/module.shl (depending on your platform), which
** you can use with the following:
(load-library 'precsi "module.dll")
or
(load-library 'example "module.dll")
You can uncomment a few lines in the Makefile to build a static test exe.

View file

@ -1,49 +1,31 @@
TOP = ../..
SWIG = $(TOP)/../swig
INTERFACE = example.i
CHICKSRCS = precsi.c oexample.c
SRCS =
CXXSRCS = example_wrap.cxx example.cxx
CHICKGEN = $(CHICKSRCS) csi.c example_wrap.cxx
TARGET = class
INCLUDE =
SWIGOPT =
CFLAGS =
TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS =
CXXSRCS = example.cxx
TARGET = class
INCLUDE =
SWIGOPT =
CFLAGS =
VARIANT =
all:: $(TARGET) example-generic.scm example-clos.scm
# uncomment the following lines to build a static exe (only pick one of the CHICKEN_MAIN lines)
#CHICKEN_MAIN = test-lowlevel-class.scm
#CHICKEN_MAIN = test-tinyclos-class.scm
#VARIANT = _static
csi.c:
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
INTERFACE='precsi' chicken_csi
all:: $(TARGET)
precsi.c: precsi.scm
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
INTERFACE='$<' chicken_chicken
example_wrap.cxx example.scm example-generic.scm example-clos.scm: example.i
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_swig_cpp
oexample.c: example.scm
$(MAKE) -f $(TOP)/Makefile TARGET='oexample.c' \
INTERFACE='$<' chicken_chicken
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static_cpp
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module_cpp
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
clean::
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f $(CHICKGEN)
rm -f example.scm example-generic.scm example-clos.scm
rm -f $(TARGET)
check:: module
check::
csi -batch $(TARGET).so test-lowlevel-class.scm test-tinyclos-class.scm

View file

@ -1,105 +0,0 @@
(declare (unit precsi))
(declare (uses example))
(if (not (member "-quiet" (cdr (argv))))
(begin
;; display prelude to csi
(display "class\n\n")
(display " A SWIG example for the CHICKEN compiler\n")
(display " Author: Jonah Beckford, December 2002\n\n")
(display "C++ Interface\n")
(display "-------------\n")
(display "
class Shape {
public:
Shape();
virtual ~Shape();
double x, y;
void move(double dx, double dy);
virtual double area(void) = 0;
virtual double perimeter(void) = 0;
static int nshapes;
enum SomeEnum {
First = 0,
Second,
Third,
Last = 1000
};
};
class Circle : public Shape {
private:
double radius;
public:
Circle(double r);
virtual double area(void);
virtual double perimeter(void);
};
class Square : public Shape {
private:
double width;
public:
Square(double w);
virtual double area(void);
virtual double perimeter(void);
};
")
(display "\n")
(display "CHICKEN Low-Level Procedures\n")
(display "----------------------------\n")
(display "
(define A-CIRCLE-SHAPE (example:new-Circle %radius))
(example:Circle-area %circle)
(example:Circle-perimeter %circle)
(example:delete-Circle %circle)
(define A-SQUARE-SHAPE (example:new-Square %width))
(example:Square-area %square)
(example:Square-perimeter %square)
(example:delete-Square %square)
(example:delete-Shape %shape)
(example:Shape-x-set %shape %x)
(example:Shape-x-get %shape)
(example:Shape-y-set %shape %y)
(example:Shape-y-get %shape)
(example:Shape-move %shape %dx %dy)
(example:Shape-area %shape)
(example:Shape-perimeter %shape)
(example:Shape-nshapes)
(example:Shape-nshapes %nshapes-int)
(example:Shape-First)
(example:Shape-Second)
(example:Shape-Third)
(example:Shape-Last)
")
(display "\n")
(display "TinyCLOS Classes\n")
(display "----------------\n")
(display "
;; ALL generic methods must be included first
(include \"example-generic\")
;; After generic methods are defined, can include TinyCLOS code
(include \"example-clos\")
(define A-CIRCLE-SHAPE (make <example:Circle> %radius))
(-get-x- %shapeObject)
(-set-x!- %shapeObject %x)
(-get-y- %shapeObject)
(-set-y!- %shapeObject %y)
(-move!- %shapeObject %dx %dy)
(-area- %shapeObject)
(-perimeter- %shapeObject)
(+example:Shape-nshapes+)
(+example:Shape-nshapes+ %nshapes-int)
;; do not use (example:delete-Shape (slot-ref %shapeObject 'this))
;; as %shapeObject is always garbage-collected
")
(display "\n")))

View file

@ -1,6 +1,8 @@
;; This file illustrates the low-level C++ interface generated
;; by SWIG.
(declare (uses example))
;; ----- Object creation -----
(display "Creating some objects:\n")

View file

@ -1,6 +1,9 @@
;; This file illustrates the shadow C++ interface generated
;; by SWIG.
(declare (uses example))
(declare (uses tinyclos))
;; All generic methods must be included first
(include "example-generic")

View file

@ -1,49 +1,30 @@
TOP = ../..
SWIG = $(TOP)/../swig
INTERFACE = example.i
CHICKSRCS = precsi.c oexample.c
SRCS = example_wrap.c
CXXSRCS =
CHICKGEN = $(CHICKSRCS) csi.c example_wrap.c
TARGET = constants
INCLUDE =
SWIGOPT =
CFLAGS =
TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS =
CXXSRCS =
TARGET = constants
INCLUDE =
SWIGOPT =
CFLAGS =
VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = test-constants.scm
#VARIANT = _static
all:: $(TARGET)
csi.c:
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
INTERFACE='precsi' chicken_csi
precsi.c: precsi.scm
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
INTERFACE='$<' chicken_chicken
example_wrap.c example.scm: example.i
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_swig_c
oexample.c: example.scm
$(MAKE) -f $(TOP)/Makefile TARGET='oexample.c' \
INTERFACE='$<' chicken_chicken
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f $(CHICKGEN)
rm -f example.scm example-generic.scm example-clos.scm
rm -f $(TARGET)
check:: module
check::
csi -batch $(TARGET).so test-constants.scm

View file

@ -1,42 +0,0 @@
(declare (unit precsi))
(declare (uses example))
;; display prelude to csi
(display "constants\n\n")
(display " A SWIG example for the CHICKEN compiler\n")
(display " Author: Jonah Beckford, December 2002\n\n")
(display "C Procedures:\n")
(display " #define ICONST 42\n")
(display " #define FCONST 2.1828\n")
(display " #define CCONST 'x'\n")
(display " #define CCONST2 '\n'\n")
(display " #define SCONST \"Hello World\"\n")
(display " #define SCONST2 \"\\\"Hello World\\\"\"\n")
(display " /* This should work just fine */\n")
(display " #define EXPR ICONST + 3*(FCONST)\n")
(display " /* This shouldn't do anything */\n")
(display " #define EXTERN extern\n")
(display " /* Neither should this (BAR isn't defined) */\n")
(display " #define FOO (ICONST + BAR)\n")
(display " /* The following directives also produce constants. Remember that\n")
(display " CHICKEN is normally case-insensitive, so don't rely on differing\n")
(display " case to differentiate variable names */\n")
(display " %constant int iconstX = 37;\n")
(display " %constant double fconstX = 3.14;\n")
(display "\n")
(display "Scheme Procedures:\n")
(display " (example:ICONST)\n")
(display " (example:FCONST)\n")
(display " (example:CCONST)\n")
(display " (example:CCONST2)\n")
(display " (example:SCONST)\n")
(display " (example:SCONST2)\n")
(display " (example:EXPR)\n")
(display " (example:EXTERN)\n")
(display " (example:FOO)\n")
(display " (example:iconstX)\n")
(display " (example:fconstX)\n")
(display "\n")

View file

@ -1,6 +1,8 @@
;; run with './constants test-constants.scm'
;; feel free to uncomment and comment sections
(declare (uses example))
(display "starting test ... you will see 'finished' if successful.\n")
(or (= (example:ICONST) 42) (exit 1))
(or (< (abs (- (example:FCONST) 2.1828)) 0.00001) (exit 1))

View file

@ -1,49 +1,30 @@
TOP = ../..
SWIG = $(TOP)/../swig
INTERFACE = example.i
CHICKSRCS = precsi.c oexample.c
SRCS = example.c example_wrap.c
CXXSRCS =
CHICKGEN = $(CHICKSRCS) csi.c example_wrap.c
TARGET = multimap
INCLUDE =
SWIGOPT =
CFLAGS =
TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS = example.c
CXXSRCS =
TARGET = multimap
INCLUDE =
SWIGOPT =
CFLAGS =
VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = test-multimap.scm
#VARIANT = _static
all:: $(TARGET)
csi.c:
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
INTERFACE='precsi' chicken_csi
precsi.c: precsi.scm
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
INTERFACE='$<' chicken_chicken
example_wrap.c example.scm: example.i
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_swig_c
oexample.c: example.scm
$(MAKE) -f $(TOP)/Makefile TARGET='oexample.c' \
INTERFACE='$<' chicken_chicken
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS) csi.c' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f $(CHICKGEN)
rm -f example.scm example-generic.scm example-clos.scm
rm -f $(TARGET)
check:: module
check::
csi -batch $(TARGET).so test-multimap.scm

View file

@ -1,24 +0,0 @@
(declare (unit precsi))
(declare (uses example))
;; display prelude to csi
(display "multimap\n\n")
(display " A SWIG example for the CHICKEN compiler\n")
(display " Author: Jonah Beckford, November 2002\n\n")
(display "C Procedures:\n")
(display " int gcd (int n, int m);\n")
(display " int gcdmain (int argc, char *argv[]);")
(display " int count (char *bytes, int len, char c);")
(display " void capitalize (char *str, int len);")
(display " void circle (double x, double y);")
(display "\n")
(display "Scheme Procedures:\n")
(display " (example:gcd %n %m)\n")
(display " (example:gcdmain '(%string %string ...))\n")
(display " (example:count %string %character)\n")
(display " (example:capitalize %string)\n")
(display " (example:circle %x %y)\n")
(display "\n")

View file

@ -1,6 +1,8 @@
;; run with './multimap test-multimap.scm'
;; feel free to uncomment and comment sections
(declare (uses example))
(display "(example:gcd 90 12): ")
(display (example:gcd 90 12))
(display "\n")
@ -50,5 +52,5 @@
(display "\n")
(display "(example:squarecubed 3: ")
(display (example:squarecubed 3))
(display (example:squareCubed 3))
(display "\n")

View file

@ -1,49 +1,30 @@
TOP = ../..
SWIG = $(TOP)/../swig
INTERFACE = example.i
CHICKSRCS = precsi.c oexample.c
SRCS =
CXXSRCS = example_wrap.cxx example.cxx
CHICKGEN = $(CHICKSRCS) csi.c example_wrap.cxx
TARGET = overload
INCLUDE =
SWIGOPT =
CFLAGS =
TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS =
CXXSRCS = example.cxx
TARGET = overload
INCLUDE =
SWIGOPT =
CFLAGS =
VARIANT =
all:: $(TARGET) example-generic.scm example-clos.scm
# uncomment the following lines to build a static exe
#CHICKEN_MAIN = test-overload.scm
#VARIANT = _static
csi.c:
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
INTERFACE='precsi' chicken_csi
all:: $(TARGET)
precsi.c: precsi.scm
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
INTERFACE='$<' chicken_chicken
example_wrap.cxx example.scm example-generic.scm example-clos.scm: example.i
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_swig_cpp
oexample.c: example.scm
$(MAKE) -f $(TOP)/Makefile TARGET='oexample.c' \
INTERFACE='$<' chicken_chicken
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static_cpp
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module_cpp
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
clean::
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f $(CHICKGEN)
rm -f example.scm example-generic.scm example-clos.scm
rm -f $(TARGET)
check:: module
check::
csi -batch $(TARGET).so test-overload.scm

View file

@ -1,57 +0,0 @@
(declare (unit precsi))
(declare (uses example))
(if (not (member "-quiet" (cdr (argv))))
(begin
;; display prelude to csi
(display "overload\n\n")
(display " A SWIG example for the CHICKEN compiler\n")
(display " Author: Jonah Beckford, December 2002\n\n")
(display "C++ Interface\n")
(display "-------------\n")
(display "
extern void foo (int x);
extern void foo (char *x);
class Foo {
public:
Foo();
Foo(const Foo &); // Copy constructor
void bar(int x);
void bar(char *s, int y);
};
")
(display "\n")
(display "CHICKEN Low-Level Procedures\n")
(display "----------------------------\n")
(display "
(example:foo %x-int)
(example:foo %x-string)
(define A-FOO (example:new-Foo))
(define ANOTHER-FOO (example:new-Foo %foo)) ;; copy constructor
(example:Foo-bar %foo %x-int)
(example:Foo-bar %foo %s-string %y-int)
")
(display "\n")
(display "TinyCLOS Classes\n")
(display "----------------\n")
(display "
;; ALL generic methods must be included first
(include \"example-generic\")
;; After generic methods are defined, can include TinyCLOS code
(include \"example-clos\")
(+example:foo+ %x-int)
(+example:foo+ %x-string)
(define A-FOO (make <example:Foo>))
(define ANOTHER-FOO (make <example:Foo> %fooObject)) ;; copy constructor
(-bar- %fooObject %x-int)
(-bar- %fooObject %s-string %y-int)
")
(display "\n")))

View file

@ -1,5 +1,8 @@
;; This file demonstrates the overloading capabilities of SWIG
(declare (uses example))
(declare (uses tinyclos))
;; Low level
;; ---------

View file

@ -1,49 +1,30 @@
TOP = ../..
SWIG = $(TOP)/../swig
INTERFACE = example.i
CHICKSRCS = precsi.c oexample.c
SRCS = example.c example_wrap.c
CXXSRCS =
CHICKGEN = $(CHICKSRCS) csi.c example_wrap.c
TARGET = simple
INCLUDE =
SWIGOPT =
CFLAGS =
TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS = example.c
CXXSRCS =
TARGET = simple
INCLUDE =
SWIGOPT =
CFLAGS =
VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = test-simple.scm
#VARIANT = _static
all:: $(TARGET)
csi.c:
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
INTERFACE='precsi' chicken_csi
precsi.c: precsi.scm
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
INTERFACE='$<' chicken_chicken
example_wrap.c example.scm: example.i
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_swig_c
oexample.c: example.scm
$(MAKE) -f $(TOP)/Makefile TARGET='oexample.c' \
INTERFACE='$<' chicken_chicken
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f $(CHICKGEN)
rm -f example.scm example-generic.scm example-clos.scm
rm -f $(TARGET)
check:: module
check::
csi -batch simple.so test-simple.scm

View file

@ -1,25 +0,0 @@
(declare (unit precsi))
(declare (uses example))
;; display prelude to csi
(display "simple\n\n")
(display " A SWIG example for the CHICKEN compiler\n")
(display " Author: Jonah Beckford, December 2002\n\n")
(display "C Procedures:\n")
(display " double My_variable;\n")
(display " int fact(int);\n")
(display " %name(mod) int my_mod(int n, int m);\n")
(display " int my_mod(int n, int m);\n")
(display " char *get_time();\n")
(display "\n")
(display "Scheme Procedures:\n")
(display " (example:My-variable) or (example:My-variable %x)\n");
(display " (example:fact %n)\n")
(display " (example:mod %n %m)\n")
(display " (example:my-mod %n %m)\n")
(display " (example:get-time)\n")
(display "\n")

View file

@ -1,5 +1,5 @@
;; run with './simple test-simple.scm'
;; feel free to uncomment and comment sections
(declare (uses example))
(display "(example:My-variable): ")
(display (example:My-variable))

View file

@ -1,49 +1,31 @@
TOP = ../..
SWIG = $(TOP)/../swig
INTERFACE = example.i
CHICKSRCS = precsi.c oexample.c
SRCS = example_wrap.c
CXXSRCS =
CHICKGEN = $(CHICKSRCS) csi.c example_wrap.c
TARGET = zlib
INCLUDE = -I.
LIBS = -lz
SWIGOPT = -prefix zlib -mixed -I/usr/include
TOP = ../..
SWIG = $(TOP)/../preinst-swig
INTERFACE = example.i
SRCS =
CXXSRCS =
TARGET = zlib
INCLUDE =
SWIGOPT = -I/usr/include -mixed -prefix zlib
CFLAGS =
VARIANT =
LIBS = -lz
# comment out the following two lines to build a dynamic exe
CHICKEN_MAIN = test-zlib.scm
VARIANT = _static
all:: $(TARGET)
csi.c:
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
INTERFACE='precsi' chicken_csi
precsi.c: precsi.scm
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
INTERFACE='$<' chicken_chicken
example_wrap.c example.scm: example.i
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_swig_c
oexample.c: example.scm
$(MAKE) -f $(TOP)/Makefile TARGET='oexample.c' \
INTERFACE='$<' chicken_chicken
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile LIBS='$(LIBS)' \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
$(MAKE) -f $(TOP)/Makefile LIBS='$(LIBS)' \
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f $(CHICKGEN)
rm -f example.scm example-generic.scm example-clos.scm
rm -f $(TARGET)
check:: module
check::
csi -batch simple.so test-zlib.scm

View file

@ -1,123 +0,0 @@
(declare (unit precsi))
(declare (uses example))
;; display prelude to csi
(display "zlib\n\n")
(display " A SWIG example for the CHICKEN compiler\n")
(display " Author: Jonah Beckford, February 2003\n\n")
(display "Scheme Procedures:\n")
(display "
zlib:max-mem-level
zlib:max-wbits
zlib:seek-set
zlib:seek-cur
zlib:seek-end
zlib:version
zlib:z-stream-next-in-set
zlib:z-stream-next-in-get
zlib:z-stream-avail-in-set
zlib:z-stream-avail-in-get
zlib:z-stream-total-in-set
zlib:z-stream-total-in-get
zlib:z-stream-next-out-set
zlib:z-stream-next-out-get
zlib:z-stream-avail-out-set
zlib:z-stream-avail-out-get
zlib:z-stream-total-out-set
zlib:z-stream-total-out-get
zlib:z-stream-msg-set
zlib:z-stream-msg-get
zlib:z-stream-state-set
zlib:z-stream-state-get
zlib:z-stream-zalloc-set
zlib:z-stream-zalloc-get
zlib:z-stream-zfree-set
zlib:z-stream-zfree-get
zlib:z-stream-opaque-set
zlib:z-stream-opaque-get
zlib:z-stream-data-type-set
zlib:z-stream-data-type-get
zlib:z-stream-adler-set
zlib:z-stream-adler-get
zlib:z-stream-reserved-set
zlib:z-stream-reserved-get
zlib:new-z-stream
zlib:delete-z-stream
zlib:z-no-flush
zlib:z-partial-flush
zlib:z-sync-flush
zlib:z-full-flush
zlib:z-finish
zlib:z-ok
zlib:z-stream-end
zlib:z-need-dict
zlib:z-errno
zlib:z-stream-error
zlib:z-data-error
zlib:z-mem-error
zlib:z-buf-error
zlib:z-version-error
zlib:z-no-compression
zlib:z-best-speed
zlib:z-best-compression
zlib:z-default-compression
zlib:z-filtered
zlib:z-huffman-only
zlib:z-default-strategy
zlib:z-binary
zlib:z-ascii
zlib:z-unknown
zlib:z-deflated
zlib:z-null
zlib:version
zlib:deflate
zlib:deflate-end
zlib:inflate
zlib:inflate-end
zlib:deflate-set-dictionary
zlib:deflate-copy
zlib:deflate-reset
zlib:deflate-params
zlib:inflate-set-dictionary
zlib:inflate-sync
zlib:inflate-reset
zlib:compress
zlib:compress2
zlib:uncompress
zlib:gzopen
zlib:gzdopen
zlib:gzsetparams
zlib:gzread
zlib:gzwrite
zlib:gzprintf
zlib:gzputs
zlib:gzgets
zlib:gzputc
zlib:gzgetc
zlib:gzflush
zlib:gzseek
zlib:gzrewind
zlib:gztell
zlib:gzeof
zlib:gzclose
zlib:gzerror
zlib:adler32
zlib:crc32
zlib:deflate-init-
zlib:inflate-init-
zlib:deflate-init2-
zlib:inflate-init2-
zlib:internal-state-dummy-set
zlib:internal-state-dummy-get
zlib:new-internal-state
zlib:delete-internal-state
zlib:z-error
zlib:inflate-sync-point
zlib:get-crc-table
zlib:deflate-init
zlib:inflate-init
zlib:z-stream-save-next-out
zlib:z-stream-get-next-chunk
")

View file

@ -1,5 +1,8 @@
;; run with './zlib test-zlib.scm'
(declare (uses example))
(declare (uses format))
;; Init zstream
(define s (zlib:new-z-stream))
(zlib:z-stream-zalloc-set s #f)

View file

@ -4,11 +4,13 @@
#######################################################################
LANGUAGE = chicken
VARIANT = _module
SCRIPTSUFFIX = _runme.scm
VARIANT =
SCRIPTSUFFIX = _runme.ss
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
CHICKEN_CSI = @CHICKEN_CSI@
SO = @SO@
#C_TEST_CASES = long_long list_vector pointer_in_out multivalue
@ -37,7 +39,7 @@ include $(srcdir)/../common.mk
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH ./$* $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH $(CHICKEN_CSI) $*$(SO) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
# Clean
@ -45,3 +47,4 @@ run_testcase = \
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile chicken_clean
rm -f *.scm

View file

@ -1,4 +1,7 @@
See ../README for common README file.
Any testcases which have _runme.scm appended after the testcase name will be detected and run.
Any testcases which have _runme.ss appended after the testcase name will be detected and run.
NOTE: I had to use _runme.ss becuase otherwise it would be hard to implement make clean
Since when SWIG runs it generates an example.scm file for every test, to clean those files
I needed to add a rm -f *.scm to make clean. But we don't want the runme scripts to
dissappear as well!

View file

@ -0,0 +1,36 @@
;;; This is the union runtime testcase. It ensures that values within a
;;; union embedded within a struct can be set and read correctly.
;; Create new instances of SmallStruct and BigStruct for later use
(define small (unions:new-SmallStruct))
(unions:SmallStruct-jill-set small 200)
(define big (unions:new-BigStruct))
(unions:BigStruct-smallstruct-set big small)
(unions:BigStruct-jack-set big 300)
;; Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
;; Ensure values in EmbeddedUnionTest are set correctly for each.
(define eut (unions:new-EmbeddedUnionTest))
;; First check the SmallStruct in EmbeddedUnionTest
(unions:EmbeddedUnionTest-number-set eut 1)
(unions:EmbeddedUnionTest-uni-small-set (unions:EmbeddedUnionTest-uni-get eut)
small)
(let ((Jill1 (unions:SmallStruct-jill-get
(unions:EmbeddedUnionTest-uni-small-get
(unions:EmbeddedUnionTest-uni-get eut)))))
(if (not (= Jill1 200))
(begin
(display "Runtime test 1 failed.")
(exit 1))))
(let ((Num1 (unions:EmbeddedUnionTest-number-get eut)))
(if (not (= Num1 1))
(begin
(display "Runtime test 2 failed.")
(exit 1))))
;; that should do
(exit 0)

View file

@ -1674,15 +1674,9 @@ void
CHICKEN::addMethod(String *, String *scheme_name, String *function)
{
#ifndef BINDING
/* unless Chicken is run in case-sensitive mode, all symbols need
to be lowercase. Also, the symbols need the prefix. */
/* The symbols need the prefix. */
String *sym = NewString(prefix);
Append(sym, scheme_name);
char *s = Char(sym);
const int L = Len(sym);
for (int i=0; i < L; i++, s++) {
*s = tolower(*s);
}
/* add symbol to Chicken internal symbol table */
Printf(f_sym_size, "+C_SIZEOF_INTERNED_SYMBOL(%d)", Len(sym));

View file

@ -1213,6 +1213,22 @@ else
CHICKEN="$CHICKEN"
fi
AC_ARG_WITH(chickencsc,[ --with-chickencsc=path Set location of csc executable],[ CHICKEN_CSC="$withval"], [CHICKEN_CSC=])
if test -z "$CHICKEN_CSC"; then
AC_CHECK_PROGS(CHICKEN_CSC, csc)
else
CHICKEN_CSC="$CHICKEN_CSC"
fi
AC_ARG_WITH(chickencsi,[ --with-chickencsi=path Set location of csi executable],[ CHICKEN_CSI="$withval"], [CHICKEN_CSI=])
if test -z "$CHICKEN_CSI"; then
AC_CHECK_PROGS(CHICKEN_CSI, csi)
else
CHICKEN_CSI="$CHICKEN_CSI"
fi
AC_ARG_WITH(chickencfg,[ --with-chickencfg=path Set location of chicken-config],[ CHICKEN_CONFIG="$withval"], [CHICKEN_CONFIG=])
if test -z "$CHICKEN_CONFIG"; then
@ -1302,6 +1318,8 @@ if test -n "$CHICKEN_CONFIG" ; then
fi # have CHICKEN_CONFIG
AC_SUBST(CHICKEN)
AC_SUBST(CHICKEN_CSC)
AC_SUBST(CHICKEN_CSI)
AC_SUBST(CHICKEN_CONFIG)
AC_SUBST(CHICKENHOME)
AC_SUBST(CHICKENOPTS)