From: Taylor R Campbell Date: Wed, 2 Jan 2019 05:50:16 +0000 (+0000) Subject: Implement position for string input ports. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d3aaeebeda6aae6e1ac713c41c500c2d9509aa6c;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 fb111276e..4c7e0f38c 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))