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