Desirable behavior of read-line procedure ?

From: Takahasi Mamoru <>
Date: 26 May 1998 05:18:32 +0900

Hi, folks.

I've been enjoying `Tutorial' package at the following URL with STk
3.99.1 on Solaris 2.6(Ultra 5).

When invoking `1-Dialog.stk' from menu, `Tutorial' system freeze and
does not accept any inputs. Investigating this problem I notice the
strange behavior of read-line procedure.

For example, preparing the following text file that does not have

  This line is not terminated by newline<EOF>

`<EOF>' is `end-of-file'. Next, name this file "read_test" and execute
the following code.

  (with-input-from-file "read_test"
    (lambda () (read-line)))

There is no outputs from STk ... But looking the implementation of
`read-line'(see the following code fragment), this result is proper.

STk-3.99.1/Src/port.c :
PRIMITIVE STk_read_line(SCM port)
    for (i = 0; ; i++) {
      switch (c = Getc(f)) {
        case EOF: if (i == 0) { free(buff); return STk_eof_object; }
        case '\r': i--; continue;
        case '\n': res = STk_makestrg(i, buff); free(buff); return res;
        default: if (i == size) {
               size += size / 2;
               buff = must_realloc(buff, size);

I think that `read-line' should consider the line that is not
terminated by newline too. What do you think about this ? Any comments
are welcome.

Best Regards
Received on Mon May 25 1998 - 21:12:03 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST