stage 1 of new input IO is almost complete.
This commit is contained in:
@@ -15,14 +15,32 @@
|
||||
|
||||
|
||||
(library (ikarus io-primitives)
|
||||
(export read-char peek-char write-char write-byte
|
||||
put-u8 put-char put-string put-bytevector
|
||||
get-char get-u8 lookahead-u8
|
||||
get-string-n get-string-n!
|
||||
get-bytevector-n get-bytevector-n!
|
||||
newline port-name input-port-name output-port-name
|
||||
close-input-port reset-input-port! close-port
|
||||
flush-output-port close-output-port get-line)
|
||||
(export read-char ; ok
|
||||
peek-char ; ok
|
||||
write-char
|
||||
write-byte
|
||||
put-u8
|
||||
put-char
|
||||
put-string
|
||||
put-bytevector
|
||||
get-char ; ok
|
||||
get-u8 ; ok
|
||||
lookahead-u8 ; ok
|
||||
get-string-n ; ok
|
||||
get-string-n! ; ok
|
||||
get-bytevector-n ; ok
|
||||
get-bytevector-n! ; ok
|
||||
newline ; ok
|
||||
port-name
|
||||
input-port-name
|
||||
output-port-name
|
||||
close-input-port
|
||||
reset-input-port!
|
||||
close-port
|
||||
flush-output-port
|
||||
close-output-port
|
||||
get-line ; ok
|
||||
)
|
||||
(import
|
||||
(ikarus system $io)
|
||||
(ikarus system $fx)
|
||||
|
||||
@@ -15,10 +15,17 @@
|
||||
|
||||
|
||||
(library (ikarus io-primitives unsafe)
|
||||
(export $write-char $write-byte $read-char $get-u8 $lookahead-u8
|
||||
(export $write-char
|
||||
$write-byte
|
||||
$read-char
|
||||
$get-u8
|
||||
$lookahead-u8
|
||||
$peek-char
|
||||
$reset-input-port! $flush-output-port
|
||||
$close-input-port $close-output-port)
|
||||
$reset-input-port!
|
||||
$flush-output-port
|
||||
$close-input-port
|
||||
$close-output-port
|
||||
)
|
||||
(import
|
||||
(ikarus)
|
||||
(ikarus system $ports)
|
||||
|
||||
@@ -15,8 +15,13 @@
|
||||
|
||||
|
||||
(library (ikarus io input-files)
|
||||
(export open-input-file current-input-port console-input-port
|
||||
standard-input-port with-input-from-file call-with-input-file)
|
||||
(export open-input-file
|
||||
current-input-port ; ok?
|
||||
console-input-port
|
||||
standard-input-port ; ok
|
||||
with-input-from-file
|
||||
call-with-input-file
|
||||
)
|
||||
(import
|
||||
(ikarus system $ports)
|
||||
(ikarus system $io)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
(library (ikarus io input-strings)
|
||||
(export open-input-string open-string-input-port with-input-from-string)
|
||||
(export open-string-input-port)
|
||||
(import
|
||||
(ikarus system $strings)
|
||||
(ikarus system $bytevectors)
|
||||
@@ -23,9 +23,7 @@
|
||||
(ikarus system $pairs)
|
||||
(ikarus system $ports)
|
||||
(ikarus system $io)
|
||||
(except (ikarus)
|
||||
open-input-string open-string-input-port
|
||||
with-input-from-string))
|
||||
(except (ikarus) open-string-input-port ))
|
||||
|
||||
(define-syntax message-case
|
||||
(syntax-rules (else)
|
||||
@@ -82,11 +80,11 @@
|
||||
'#vu8())])
|
||||
port))
|
||||
|
||||
(define open-input-string
|
||||
(lambda (str)
|
||||
(unless (string? str)
|
||||
(error 'open-input-string "not a string" str))
|
||||
($open-input-string str)))
|
||||
;(define open-input-string
|
||||
; (lambda (str)
|
||||
; (unless (string? str)
|
||||
; (error 'open-input-string "not a string" str))
|
||||
; ($open-input-string str)))
|
||||
|
||||
(define open-string-input-port
|
||||
(lambda (str)
|
||||
@@ -94,15 +92,15 @@
|
||||
(error 'open-string-input-port "not a string" str))
|
||||
($open-input-string str)))
|
||||
|
||||
(define with-input-from-string
|
||||
(lambda (str proc)
|
||||
(unless (string? str)
|
||||
(error 'with-input-from-string "not a string" str))
|
||||
(unless (procedure? proc)
|
||||
(error 'with-input-from-string "not a procedure" proc))
|
||||
(let ([p (open-input-string str)])
|
||||
(parameterize ([current-input-port p])
|
||||
(proc)))))
|
||||
;(define with-input-from-string
|
||||
; (lambda (str proc)
|
||||
; (unless (string? str)
|
||||
; (error 'with-input-from-string "not a string" str))
|
||||
; (unless (procedure? proc)
|
||||
; (error 'with-input-from-string "not a procedure" proc))
|
||||
; (let ([p ($open-input-string str)])
|
||||
; (parameterize ([current-input-port p])
|
||||
; (proc)))))
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
1201
|
||||
1202
|
||||
|
||||
+2
-2
@@ -342,10 +342,10 @@
|
||||
[output-port-name i]
|
||||
[port-mode i]
|
||||
[set-port-mode! i]
|
||||
[with-input-from-string i]
|
||||
;[with-input-from-string i]
|
||||
[open-output-string i]
|
||||
[open-output-bytevector i]
|
||||
[open-input-string i]
|
||||
;[open-input-string i]
|
||||
[get-output-string i]
|
||||
[get-output-bytevector i]
|
||||
[with-output-to-string i]
|
||||
|
||||
Reference in New Issue
Block a user