mes: Support optional port on read.

* mes/module/mes/scm.mes (read): Support optional port on read.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2019-05-16 00:05:47 +02:00 committed by Jan Nieuwenhuizen
parent e0eee55bf3
commit b969c08205
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 6 additions and 0 deletions

View File

@ -85,6 +85,12 @@
(define integer? number?)
(define (read . port)
(if (null? port) (read-env (current-module))
(let* ((prev (set-current-input-port (car port)))
(result (read-env (current-module))))
result)))
(if (not (defined? 'peek-char))
(define (peek-char)
(integer->char (peek-byte))))