diff options
Diffstat (limited to 'Examples/mzscheme')
-rw-r--r-- | Examples/mzscheme/std_vector/Makefile | 11 | ||||
-rw-r--r-- | Examples/mzscheme/std_vector/runme.scm | 30 |
2 files changed, 19 insertions, 22 deletions
diff --git a/Examples/mzscheme/std_vector/Makefile b/Examples/mzscheme/std_vector/Makefile index 96f5e80cf..4cf839a08 100644 --- a/Examples/mzscheme/std_vector/Makefile +++ b/Examples/mzscheme/std_vector/Makefile @@ -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='$(CXXSRCDIR)' 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 diff --git a/Examples/mzscheme/std_vector/runme.scm b/Examples/mzscheme/std_vector/runme.scm index 67351f128..7af9d168e 100644 --- a/Examples/mzscheme/std_vector/runme.scm +++ b/Examples/mzscheme/std_vector/runme.scm @@ -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) |