diff --git a/module/mes/display.mes b/module/mes/display.mes index 1dcbc4b2..e6831658 100644 --- a/module/mes/display.mes +++ b/module/mes/display.mes @@ -1,7 +1,7 @@ ;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017 Jan Nieuwenhuizen +;;; Copyright © 2016,2017,2018 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;; @@ -62,10 +62,11 @@ (define (d x cont? sep) (for-each (cut write-char <> port) (string->list sep)) (cond + ((eof-object? x) + (display "#" port)) ((char? x) (if (not write?) (write-char x port) - (let ((name (and=> (assq x '((#\*eof* . *eof*) - (#\nul . nul) + (let ((name (and=> (assq x '((#\nul . nul) (#\alarm . alarm) (#\backspace . backspace) (#\tab . tab) diff --git a/module/mes/scm.mes b/module/mes/scm.mes index 78f5e137..550ec6c6 100644 --- a/module/mes/scm.mes +++ b/module/mes/scm.mes @@ -82,10 +82,6 @@ (define integer? number?) -(define (eof-object? x) - (or (and (number? x) (= x -1)) - (and (char? x) (eof-object? (char->integer x))))) - (if (not (defined? 'peek-char)) (define (peek-char) (integer->char (peek-byte)))) @@ -96,7 +92,7 @@ (if (not (defined? 'unread-char)) (define (unread-char c) - (unread-byte (char->integer c)))) + (integer->char (unread-byte (char->integer c))))) (define (assq-set! alist key val) (let ((entry (assq key alist))) diff --git a/module/mes/type-0.mes b/module/mes/type-0.mes index 122fc261..6b709cfe 100644 --- a/module/mes/type-0.mes +++ b/module/mes/type-0.mes @@ -1,7 +1,7 @@ ;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017 Jan Nieuwenhuizen +;;; Copyright © 2016,2017,2018 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;; @@ -62,7 +62,12 @@ (cond ((assq (core:type x) cell:type-alist) => cdr))) (define (char? x) - (eq? (core:type x) )) + (and (eq? (core:type x) ) + (>= (char->integer x) 0))) + +(define (eof-object? x) + (and (eq? (core:type x) ) + (= (char->integer x) -1))) (define (closure? x) (eq? (core:type x) )) diff --git a/tests/base.test b/tests/base.test index fef26f56..784fe9c4 100755 --- a/tests/base.test +++ b/tests/base.test @@ -9,7 +9,7 @@ exit $? ;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software -;;; Copyright © 2016 Jan Nieuwenhuizen +;;; Copyright © 2016,2018 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;; @@ -110,4 +110,8 @@ exit $? (begin (set! seen? #t) (cont 2))))) +(if (not guile?) + (pass-if-not "#" + (char? (integer->char -1)))) + (result 'report)