--text follows this line--
I have a problem:
Whenever I use read-line in a function in lucid, running under ilisp
the read-line returns immediately. I am able to get around this
problem by first generating a dummy call to read-line: ie. if I need
to get some user input, I need to do:
(read-line)
(setf input (read-line))
Of course the above is not portable, if run under lisp directly
without ilisp, the above is clearly wrong. Is there a fix to this problem?
Thanks,
--Raman
--
T. V. Raman <·····@cs.cornell.edu>Tel: (607)255-9202 R 272-3649
Office: 4116 Upson Hall,
Department of Computer Science, Cornell University Ithaca NY 14853-6201
Res: 226 Bryant Avenue Ithaca NY 14850
In article <·····················@cs.cornell.edu> ·····@cs.cornell.edu (T. V. Raman) writes:
>Whenever I use read-line in a function in lucid, running under ilisp
>the read-line returns immediately.
When input is coming from a terminal, Lucid ignores the newline that's used
to terminate a form typed to the read-eval-print loop. I suspect ilisp
uses a pipe or socket to communicate between Emacs and Lisp, so this
doesn't happen. Therefore, the first read-line is seeing the remainder of
the line after the close parenthesis, which is empty.
A solution I've used is to preced an input function with a call to
CLEAR-INPUT. This will flush any buffered input left from the r-e-p loop.
--
Barry Margolin
System Manager, Thinking Machines Corp.
······@think.com {uunet,harvard}!think!barmar
In article <············@early-bird.think.com> ······@think.com (Barry Margolin) writes:
>
>A solution I've used is to preced an input function with a call to
>CLEAR-INPUT. This will flush any buffered input left from the r-e-p loop.
I've tried this and it doesn't work for me. For example, if I do
the following:
(defun test ()
(clear-input)
(read-line))
> (test)
""
when (test) is executed, it immediately returns with "". I've tried
clear-input and it doesn't work for me. So, I just use the double
read-line method.
Erik Eilerts
University of Texas at Austin
·······@cs.utexas.edu
I finally decided to use the following quick fix, but I still hope
someone out there has a cleaner solution.
;;; Created: Sun May 16 14:50:55 EDT 1993
;;;
;;; ilisp has a bug which forces read-line to behave weirdly:
;;; If read-line is used inside a function for the first time, it
;;; returns the empty string without waiting for user input. This
;;; means that read-line has to be called twice.
;;; Introducing a variable *buggy-ilisp-read-line*
;;; If T then call read-line twice, discarding the initial empty
;;; string.
;;; Variable: *BUGGY-ILISP-READ-LINE* Author: raman
;;; Created: Sun May 16 14:52:44 1993
(defvar *buggy-ilisp-read-line* t
"Determine if read-line called twice to fix ilisp input problem")
;;; Function: FIX-READ-LINE Author: raman
;;; Created: Sun May 16 14:54:17 1993
(proclaim '(inline fix-read-line))
(defun fix-read-line (&rest args)
"Fix read line to work under ilisp:"
(when *buggy-ilisp-read-line* (read-line)) ; discarded
(apply #'read-line args)
)
Thanks,
-Raman
--
T. V. Raman <·····@cs.cornell.edu>Tel: (607)255-9202 R 272-3649
Office: 4116 Upson Hall,
Department of Computer Science, Cornell University Ithaca NY 14853-6201
Res: 226 Bryant Avenue Ithaca NY 14850
Barry Margolin (······@think.com) wrote:
: In article <·····················@cs.cornell.edu> ·····@cs.cornell.edu (T. V. Raman) writes:
: >Whenever I use read-line in a function in lucid, running under ilisp
: >the read-line returns immediately.
: When input is coming from a terminal, Lucid ignores the newline that's used
: to terminate a form typed to the read-eval-print loop. I suspect ilisp
: uses a pipe or socket to communicate between Emacs and Lisp, so this
: doesn't happen. Therefore, the first read-line is seeing the remainder of
: the line after the close parenthesis, which is empty.
: A solution I've used is to preced an input function with a call to
: CLEAR-INPUT. This will flush any buffered input left from the r-e-p loop.
: --
: Barry Margolin
: System Manager, Thinking Machines Corp.
: ······@think.com {uunet,harvard}!think!barmar
I've been having the same problem. I tried clear-input and it had no
effect. I wound up using:
(when (listen)
(read-char))
I'm not sure if the problem involves running ilisp or just running Lucid
in an EMACS buffer. Anyone know what's actually happening here?
Ted Rees ·····@pitt.edu