Implement position for string input ports.
authorTaylor R Campbell <campbell@mumble.net>
Wed, 2 Jan 2019 05:50:16 +0000 (05:50 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sun, 6 Jan 2019 07:30:15 +0000 (23:30 -0800)
src/runtime/string-io.scm

index fb111276e45ac28bb48dbcd24691c1236410c9a6..4c7e0f38c8fdbab19b423e1f6e6559f8c0550a12 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))