From 12c91b86a5d05b64f119c57e5b6689471ac61b16 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Sat, 2 Sep 2017 18:49:41 -0400 Subject: [PATCH] Issue #217 --- scheme/base.sld | 5 +++++ scheme/cyclone/primitives.sld | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/scheme/base.sld b/scheme/base.sld index 144d11b2..cb5774e1 100644 --- a/scheme/base.sld +++ b/scheme/base.sld @@ -129,6 +129,7 @@ write-char write-string flush-output-port + read-char read-line read-string input-port? @@ -627,6 +628,10 @@ (if (null? lst) end (func (car lst) (foldr func end (cdr lst))))) + (define (read-char . port) + (if (null? port) + (Cyc-read-char (current-input-port)) + (Cyc-read-char (car port)))) (define (read-line . port) (if (null? port) (Cyc-read-line (current-input-port)) diff --git a/scheme/cyclone/primitives.sld b/scheme/cyclone/primitives.sld index b72691a5..267f9140 100644 --- a/scheme/cyclone/primitives.sld +++ b/scheme/cyclone/primitives.sld @@ -186,7 +186,7 @@ Cyc-flush-output-port file-exists? delete-file - read-char + Cyc-read-char peek-char Cyc-read-line Cyc-write-char @@ -347,7 +347,7 @@ (Cyc-flush-output-port 1 1) (file-exists? 1 1) (delete-file 1 1) - (read-char 1 1) + (Cyc-read-char 1 1) (peek-char 1 1) (Cyc-read-line 1 1) (Cyc-write-char 1 2) @@ -428,7 +428,7 @@ ; Cyc-flush-output-port ; file-exists? ; delete-file -; read-char +; Cyc-read-char ; peek-char ; Cyc-read-line ; Cyc-write-char @@ -498,7 +498,7 @@ ((eq? p 'Cyc-flush-output-port) "Cyc_io_flush_output_port") ((eq? p 'file-exists?) "Cyc_io_file_exists") ((eq? p 'delete-file) "Cyc_io_delete_file") - ((eq? p 'read-char) "Cyc_io_read_char") + ((eq? p 'Cyc-read-char) "Cyc_io_read_char") ((eq? p 'peek-char) "Cyc_io_peek_char") ((eq? p 'Cyc-read-line) "Cyc_io_read_line") ((eq? p 'Cyc-display) "Cyc_display_va") @@ -652,7 +652,7 @@ Cyc-write file-exists? delete-file - read-char + Cyc-read-char peek-char Cyc-read-line Cyc-write-char @@ -744,7 +744,7 @@ ((eq? p 'string-append) "object") ((eq? p 'apply) "object") ((eq? p 'Cyc-read-line) "object") - ((eq? p 'read-char) "object") + ((eq? p 'Cyc-read-char) "object") ((eq? p 'peek-char) "object") ((eq? p 'command-line-arguments) "object") ((eq? p 'number->string) "object") @@ -805,7 +805,7 @@ = > < >= <= command-line-arguments Cyc-read-line - read-char peek-char + Cyc-read-char peek-char cons cell)) (member exp *udf-prims*)))) @@ -816,7 +816,7 @@ + - * / = > < >= <= Cyc-list - read-char peek-char + Cyc-read-char peek-char symbol->string list->string substring string-append string->number make-bytevector bytevector-append