[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug? in kcl for setting file column for two-way streams



We have found a line of code that we do not quite understand in the KCL Lisp
implementation. In the routine readc_stream in c/file.d, for a two-way stream,
the field sm_int1 of the stream structure is set to 0 after every read.

For *TERMINAL-IO* this is fine. After the user input, FRESH-LINE would then
not output an extra newline as shown in the KCL session below. I.e. if there
was an extra newline, the result of entering (+ 3 4) would be:

>(+ 3 4)

7

>

However, for the dribble session, the result is there would be no newline
between the input and output as shown in the dribble file.

It appears that setting sm_int1 to zero after every read is incorrect, since
it is not guaranteed that the column will not necessarily be set to zero after
every input. The patch would be to simply comment out the line.

Was this simply an effort to suppress the newline when entering data from
*TERMINAL-IO* ?

Aside: the extra newline between the prompt and the user input in the dribble
file is unavoidable since this is the newline that is left in the input queue
by the reader. Dribbling is done using an echo-stream, and thus the newline is
simply echoed when the reader gets around to reading the newline in the input
queue AFTER doing the read-eval-print loop.

********* KCL session *********************************************************

KCl (Kyoto Common Lisp)  June 3, 1987

>(+ 3 4)
7

>(dribble "/tmp/out.drb")
Starts dribbling to /tmp/out.drb (1988/3/18, 10:12:38).
NIL

>(+ 3 4)
7

>(+ 3 4)
7

>(dribble)
Finished dribbling to /tmp/out.drb.
NIL

>(bye)
Bye.

***** Output from dribble *****************************************************

Starts dribbling to /tmp/out.drb (1988/3/18, 10:12:38).
NIL

>
(+ 3 4)7

>
(+ 3 4)7

>
(dribble)

***** Patch *******************************************************************

*** newfile.d	Thu Mar 17 17:11:53 1988
--- file.d	Thu Jun  4 09:10:50 1987
***************
*** 597,601 ****
  			flush_stream(terminal_io->sm.sm_object1);	/**/
  #endif
! /*		strm->sm.sm_int1 = 0;*/
  		strm = strm->sm.sm_object0;
  		goto BEGIN;
--- 597,601 ----
  			flush_stream(terminal_io->sm.sm_object1);	/**/
  #endif
! 		strm->sm.sm_int1 = 0;
  		strm = strm->sm.sm_object0;
  		goto BEGIN;