get-line doesn't accept custom textual input port.

Create issue
Issue #148 resolved
Takashi Kato repo owner created an issue

This is a valid R6RS script:

(import (rnrs) (rnrs mutable-strings))

(define (string-copy! src spos dst dpos size)
  (do ((i 0 (+ i 1)) (spos spos (+ spos 1)) (dpos dpos (+ dpos 1)))
      ((= i size) size)
    (string-set! dst dpos (string-ref src spos))))

(let ()
  (define (make-input s)
    (define pos 0)
    (define str-len (string-length s))
    (define (read! out start size)
      (if (>= pos str-len)
          0
          (let ((size (min (- str-len pos) size)))
            (string-copy! s pos out start size)
            (set! pos (+ pos size))
            size)))
    (define (close) #f)
    (make-custom-textual-input-port "input" read! #f #f close))
  (let ((in (make-input "abcde")))
    (get-line in)))

But got an error.

Comments (1)

  1. Log in to comment