Implement position for string input ports.
authorTaylor R Campbell <campbell@mumble.net>
Wed, 2 Jan 2019 05:50:16 +0000 (05:50 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Wed, 2 Jan 2019 05:50:19 +0000 (05:50 +0000)
src/runtime/string-io.scm

index dac7183ed309ebda2efe439c1baade1069251968..7db4e54e1954332651e1760bec127afbc1404cb9 100644 (file)
@@ -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))