Rewrite chicken example and test-suite building code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5948 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
68fff144a9
commit
42afd931c7
35 changed files with 315 additions and 844 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")))
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
;; This file demonstrates the overloading capabilities of SWIG
|
||||
|
||||
(declare (uses example))
|
||||
(declare (uses tinyclos))
|
||||
|
||||
;; Low level
|
||||
;; ---------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue