minor fix to string-input-ports
This commit is contained in:
parent
1ecadc0ce5
commit
921999a3a2
|
@ -761,7 +761,7 @@
|
||||||
(let ([n (read! str 0 (string-length str))])
|
(let ([n (read! str 0 (string-length str))])
|
||||||
(unless (fixnum? n)
|
(unless (fixnum? n)
|
||||||
(error who "invalid return value from read!" n))
|
(error who "invalid return value from read!" n))
|
||||||
(unless (<= 0 n (fxsub1 (string-length str)))
|
(unless (<= 0 n (string-length str))
|
||||||
(error who "return value from read! is out of range" n))
|
(error who "return value from read! is out of range" n))
|
||||||
($set-port-index! p 0)
|
($set-port-index! p 0)
|
||||||
($set-port-size! p n)
|
($set-port-size! p n)
|
||||||
|
@ -811,7 +811,7 @@
|
||||||
(let ([n (read! str 0 (string-length str))])
|
(let ([n (read! str 0 (string-length str))])
|
||||||
(unless (fixnum? n)
|
(unless (fixnum? n)
|
||||||
(error who "invalid return value from read!" n))
|
(error who "invalid return value from read!" n))
|
||||||
(unless (<= 0 n (fxsub1 (string-length str)))
|
(unless (<= 0 n (string-length str))
|
||||||
(error who "return value from read! is out of range" n))
|
(error who "return value from read! is out of range" n))
|
||||||
($set-port-size! p n)
|
($set-port-size! p n)
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1205
|
1207
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
(library (F)
|
|
||||||
(export f)
|
|
||||||
(import (ikarus))
|
|
||||||
(define f
|
|
||||||
(lambda (x) 12))
|
|
||||||
(printf "F invoked\n"))
|
|
||||||
|
|
||||||
(library (G)
|
|
||||||
(export)
|
|
||||||
(import (ikarus) (F))
|
|
||||||
(define-syntax t f)
|
|
||||||
(printf "G invoked: f=~s\n" t))
|
|
||||||
|
|
||||||
(library (Q)
|
|
||||||
(export foo)
|
|
||||||
(import (ikarus))
|
|
||||||
(define-record foo (bar baz)))
|
|
||||||
|
|
||||||
(library (R)
|
|
||||||
(export)
|
|
||||||
(import (ikarus) (Q))
|
|
||||||
(printf "RTD=~s\n" (type-descriptor foo)))
|
|
||||||
|
|
||||||
(invoke (R))
|
|
||||||
|
|
||||||
(library (F0)
|
|
||||||
(export f)
|
|
||||||
(import (ikarus))
|
|
||||||
(define g 17)
|
|
||||||
(define-syntax f
|
|
||||||
(lambda (x) #'h))
|
|
||||||
(define-syntax h
|
|
||||||
(lambda (x) #'g))
|
|
||||||
(printf "F0 invoked\n"))
|
|
||||||
|
|
||||||
;(library (F0 client)
|
|
||||||
; (export)
|
|
||||||
; (import (ikarus) (F0))
|
|
||||||
; (unless (= (f) 17)
|
|
||||||
; (error #f "F0 client"))
|
|
||||||
; (printf "F0 client ok\n"))
|
|
||||||
|
|
||||||
|
|
||||||
(library (F0 client)
|
|
||||||
(export)
|
|
||||||
(import (ikarus) (F0))
|
|
||||||
(f))
|
|
||||||
|
|
||||||
(invoke (F0 client))
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
(define (test1 x prefix radix)
|
(define (test1 x prefix radix)
|
||||||
(let ([s (string-append prefix
|
(let ([s (string-append prefix
|
||||||
(number->string x radix))])
|
(number->string x radix))])
|
||||||
(assert (equal? x (read (open-input-string s))))))
|
(assert (equal? x (read (open-string-input-port s))))))
|
||||||
(test1 x "#x" 16)
|
(test1 x "#x" 16)
|
||||||
(test1 x "#o" 8)
|
(test1 x "#o" 8)
|
||||||
(test1 x "#b" 2))
|
(test1 x "#b" 2))
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
(define-tests test-input-ports
|
(define-tests test-input-ports
|
||||||
[eof-object?
|
[eof-object?
|
||||||
(get-line (open-input-string ""))]
|
(get-line (open-string-input-port ""))]
|
||||||
[(lambda (x) (equal? x "abcd"))
|
[(lambda (x) (equal? x "abcd"))
|
||||||
(get-line (open-input-string "abcd"))]
|
(get-line (open-string-input-port "abcd"))]
|
||||||
[(lambda (x) (equal? x ""))
|
[(lambda (x) (equal? x ""))
|
||||||
(get-line (open-input-string "\nabcd"))]
|
(get-line (open-string-input-port "\nabcd"))]
|
||||||
[(lambda (x) (equal? x "abcd"))
|
[(lambda (x) (equal? x "abcd"))
|
||||||
(get-line (open-input-string "abcd\nefg"))]))
|
(get-line (open-string-input-port "abcd\nefg"))]))
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
(lambda (str)
|
(lambda (str)
|
||||||
(lambda (n?)
|
(lambda (n?)
|
||||||
(and (number? n?)
|
(and (number? n?)
|
||||||
(= (with-input-from-string str read) n?)))))
|
(= (read (open-string-input-port str)) n?)))))
|
||||||
|
|
||||||
(define-syntax reader-tests
|
(define-syntax reader-tests
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
|
@ -75,29 +75,29 @@
|
||||||
|
|
||||||
(define-tests test-char-syntax
|
(define-tests test-char-syntax
|
||||||
[(lambda (x) (= (char->integer x) #x0))
|
[(lambda (x) (= (char->integer x) #x0))
|
||||||
(read (open-input-string "#\\nul"))]
|
(read (open-string-input-port "#\\nul"))]
|
||||||
[(lambda (x) (= (char->integer x) #x7))
|
[(lambda (x) (= (char->integer x) #x7))
|
||||||
(read (open-input-string "#\\alarm"))]
|
(read (open-string-input-port "#\\alarm"))]
|
||||||
[(lambda (x) (= (char->integer x) #x8))
|
[(lambda (x) (= (char->integer x) #x8))
|
||||||
(read (open-input-string "#\\backspace"))]
|
(read (open-string-input-port "#\\backspace"))]
|
||||||
[(lambda (x) (= (char->integer x) #x9))
|
[(lambda (x) (= (char->integer x) #x9))
|
||||||
(read (open-input-string "#\\tab"))]
|
(read (open-string-input-port "#\\tab"))]
|
||||||
[(lambda (x) (= (char->integer x) #xA))
|
[(lambda (x) (= (char->integer x) #xA))
|
||||||
(read (open-input-string "#\\linefeed"))]
|
(read (open-string-input-port "#\\linefeed"))]
|
||||||
[(lambda (x) (= (char->integer x) #xA))
|
[(lambda (x) (= (char->integer x) #xA))
|
||||||
(read (open-input-string "#\\newline"))]
|
(read (open-string-input-port "#\\newline"))]
|
||||||
[(lambda (x) (= (char->integer x) #xB))
|
[(lambda (x) (= (char->integer x) #xB))
|
||||||
(read (open-input-string "#\\vtab"))]
|
(read (open-string-input-port "#\\vtab"))]
|
||||||
[(lambda (x) (= (char->integer x) #xC))
|
[(lambda (x) (= (char->integer x) #xC))
|
||||||
(read (open-input-string "#\\page"))]
|
(read (open-string-input-port "#\\page"))]
|
||||||
[(lambda (x) (= (char->integer x) #xD))
|
[(lambda (x) (= (char->integer x) #xD))
|
||||||
(read (open-input-string "#\\return"))]
|
(read (open-string-input-port "#\\return"))]
|
||||||
[(lambda (x) (= (char->integer x) #x1B))
|
[(lambda (x) (= (char->integer x) #x1B))
|
||||||
(read (open-input-string "#\\esc"))]
|
(read (open-string-input-port "#\\esc"))]
|
||||||
[(lambda (x) (= (char->integer x) #x20))
|
[(lambda (x) (= (char->integer x) #x20))
|
||||||
(read (open-input-string "#\\space"))]
|
(read (open-string-input-port "#\\space"))]
|
||||||
[(lambda (x) (= (char->integer x) #x7F))
|
[(lambda (x) (= (char->integer x) #x7F))
|
||||||
(read (open-input-string "#\\delete"))])
|
(read (open-string-input-port "#\\delete"))])
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue