From d3aaeebeda6aae6e1ac713c41c500c2d9509aa6c 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 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)) -- 2.25.1