From 6b7e17dcf25dc182f0e49f52db230881a077acae Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 2 Jan 2019 05:50:16 +0000 Subject: [PATCH] Implement position for string input ports. --- src/runtime/string-io.scm | 5 +++++ 1 file changed, 5 insertions(+) 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)) -- 2.25.1