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,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))