From 7b9c302fa10d30cbef1784b09df81492ba5f86f6 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Fri, 26 Apr 2013 16:52:38 +0200 Subject: [PATCH] guile: fix matrix example - add missing library in link phase - empty true path () for if is not allowed --- Examples/guile/Makefile.in | 5 +++-- Examples/guile/matrix/Makefile | 1 + Examples/guile/matrix/matrix.scm | 28 ++++++++++++++++------------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Examples/guile/Makefile.in b/Examples/guile/Makefile.in index 3110ac994..69c7bb696 100644 --- a/Examples/guile/Makefile.in +++ b/Examples/guile/Makefile.in @@ -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 diff --git a/Examples/guile/matrix/Makefile b/Examples/guile/matrix/Makefile index e8466e5fc..988a0ee5c 100644 --- a/Examples/guile/matrix/Makefile +++ b/Examples/guile/matrix/Makefile @@ -12,6 +12,7 @@ build: TARGET=$(TARGET) \ IFILE=$(IFILE) \ MODULE=$(MODULE) \ + LIBS="-lm" \ sub-all clean: diff --git a/Examples/guile/matrix/matrix.scm b/Examples/guile/matrix/matrix.scm index 18e52842d..d7cab84f4 100644 --- a/Examples/guile/matrix/matrix.scm +++ b/Examples/guile/matrix/matrix.scm @@ -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.