From: Taylor R Campbell Date: Wed, 2 Jan 2019 05:50:16 +0000 (+0000) Subject: Implement position for string input ports. X-Git-Tag: mit-scheme-pucked-10.1.9~3^2~40^2~1 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6b7e17dcf25dc182f0e49f52db230881a077acae;p=mit-scheme.git Implement position for string input ports. --- diff --git a/src/runtime/string-io.scm b/src/runtime/string-io.scm index dac7183ed..7db4e54e1 100644 --- a/src/runtime/string-io.scm +++ b/src/runtime/string-io.scm @@ -59,6 +59,7 @@ USA. (eof? ,string-in/eof?) (input-line ,string-in/input-line) (peek-char ,string-in/peek-char) + (position ,string-in/position) (read-char ,string-in/read-char) (read-substring ,string-in/read-substring) (unread-char ,string-in/unread-char) @@ -73,6 +74,10 @@ USA. (let ((ss (textual-port-state port))) (not (fix:< (istate-next ss) (istate-end ss))))) +(define (string-in/position port) + (let ((ss (textual-port-state port))) + (istate-next ss))) + (define (string-in/peek-char port) (let ((ss (textual-port-state port))) (if (fix:< (istate-next ss) (istate-end ss))