Make guile switchable in GNUmakefile.

* GNUmakefile (GUILE): New variable.  Update users.
* guile/mes-0.scm (mes?, guile-1.8?, guile-2?): New variables.
* module/mes/base.mes (guile?): Remove.
* module/mes/base-0.mes (effective-version, mes?, guile?, guile-1.8?,
  guile-2?): New variables.
* tests/cwv.test: Support Guile 1.8.
This commit is contained in:
Jan Nieuwenhuizen 2016-12-21 17:08:36 +01:00
parent d4dc29c498
commit f3c464d07b
5 changed files with 16 additions and 7 deletions

View file

@ -85,7 +85,7 @@ dump: module/mes/read-0.mo
guile-check:
set -e; for i in $(TESTS); do\
guile -s <(cat $(MES-0) module/mes/test.mes $$i);\
$(GUILE) -s <(cat $(MES-0) module/mes/test.mes $$i);\
done
MAIN_C:=doc/examples/main.c

View file

@ -27,5 +27,9 @@
(define-macro (mes-use-module . rest) #t)
(define builtin? procedure?) ; not strictly true, but ok for tests/*.test
(define mes? (pair? (current-module)))
(define guile? (not (pair? (current-module))))
(define guile-1.8? (equal? (effective-version) "1.8"))
(define guile-2? (and (not mes?) (not guile-1.8?)))
(if guile-1.8? (use-modules (ice-9 syncase)))
(define EOF (if #f #f))

View file

@ -26,7 +26,11 @@
;;; Code:
#f ;; FIXME -- needed for --dump, then --load
(define (effective-version) "0.3")
(define mes? #t)
(define guile? #f)
(define guile-1.8? #f)
(define guile-2? #f)
(define (primitive-eval e) (eval-env e (current-module)))
(define eval eval-env)

View file

@ -52,8 +52,6 @@
(equal? (vector->list a) (vector->list b))
(eq? a b))))))
(define guile? (not (pair? (current-module))))
(define (list? x)
(or (null? x)
(and (pair? x) (list? (cdr x)))))

View file

@ -28,9 +28,12 @@ exit $?
(mes-use-module (mes scm))
(mes-use-module (mes test))
(pass-if "values" (seq? (values 0 1) 0))
(pass-if "values 2" (seq? ((lambda (x) x) (values 1 2 3)) 1))
(pass-if "values 3" (seq? 1 ((lambda (x) x) (values 1 2 3))))
(if (not guile-1.8?)
(pass-if "values" (seq? (values 0 1) 0)))
(if (not guile-1.8?)
(pass-if "values 2" (seq? ((lambda (x) x) (values 1 2 3)) 1)))
(if (not guile-1.8?)
(pass-if "values 3" (seq? 1 ((lambda (x) x) (values 1 2 3)))))
(pass-if "call-with-values" (seq? (call-with-values (lambda () (values 1 2 3))
(lambda (a b c) (+ a b c)))
6))