guile: fix matrix example

- add missing library in link phase
- empty true path () for if is not allowed
This commit is contained in:
Geert Janssens 2013-04-26 16:52:38 +02:00
commit 7b9c302fa1
3 changed files with 20 additions and 14 deletions

View file

@ -7,6 +7,7 @@ SWIG = ../$(top_srcdir)/preinst-swig
CC = @CC@
CXX = @CXX@
CFLAGS = @PLATFLAGS@
LIBS =
GUILE_CFLAGS = @GUILE_CFLAGS@
GUILE_LIBS = @GUILE_LIBS@
SWIGOPT =
@ -31,10 +32,10 @@ guile_clean:
sub-all:
$(SWIG) -guile $(SWIGOPT) $(IFILE)
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(WRAP) $(GUILE_CFLAGS) $(GUILE_LIBS)
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(WRAP) $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS)
sub-all-cxx:
$(SWIG) -c++ -guile $(SWIGOPT) $(IFILE)
$(CXX) $(CFLAGS) -o $(TARGET) $(SRCS) $(CXXWRAP) $(GUILE_CFLAGS) $(GUILE_LIBS)
$(CXX) $(CFLAGS) -o $(TARGET) $(SRCS) $(CXXWRAP) $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS)
# Makefile ends here

View file

@ -12,6 +12,7 @@ build:
TARGET=$(TARGET) \
IFILE=$(IFILE) \
MODULE=$(MODULE) \
LIBS="-lm" \
sub-all
clean:

View file

@ -138,24 +138,28 @@
(set-m m1 i j (+ (get-m m1 i j) (get-m m2 i j)))
(add-two m1 m2 i (+ j 1)))
(add-two m1 m2 (+ i 1) 0))))
(if (null? ML) () (begin
(add-two M (car ML) 0 0)
(add-mat M (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(add-two M (car ML) 0 0)
(add-mat M (cdr ML)))))
(define (cleanup ML)
(if (null? ML) () (begin
(destroy-matrix (car ML))
(cleanup (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(destroy-matrix (car ML))
(cleanup (cdr ML)))))
(define (make-random ML) ; Put random values in them
(if (null? ML) () (begin
(randmat (car ML))
(make-random (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(randmat (car ML))
(make-random (cdr ML)))))
(define (mul-mat m ML)
(if (null? ML) () (begin
(mat-mult m (car ML) m)
(mul-mat m (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(mat-mult m (car ML) m)
(mul-mat m (cdr ML)))))
;;; Now we'll hammer on things a little bit just to make
;;; sure everything works.