gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] read-char-no-hang


From: Peter Wood
Subject: Re: [Gcl-devel] read-char-no-hang
Date: Mon, 7 Feb 2005 08:19:57 +0100
User-agent: Mutt/1.4i

On my older GCL, I can get the behaviour you want (including
discarding the 'spurious' newline) like this:

(defun foo2 ()
  (do ()
      ((not (listen)))
    (read-char-no-hang))
  (foo))

>(foo2)
abcd
normal: 'a'
normal: 'b'
no-hang: 'c'
normal: 'd'
""
NIL

So it looks like a bug in the newer GCL's read-char-no-hang.
Traditionally, on GCL, (read-char-no-hang)<return> should always
return #\Newline, other lisps return NIL.

Regards,
Peter


On Sun, Feb 06, 2005 at 11:25:18AM -0600, James Amundson wrote:
> Hi,
> 
> As far as I can tell, the function read-char-no-hang always returns nil.
> For example, try this function:
> 
> (defun foo ()
>   (format t "normal: '~a'~%" (read-char))
>   (format t "normal: '~a'~%" (read-char))
>   (format t "no-hang: '~a'~%" (read-char-no-hang))
>   (format t "normal: '~a'~%" (read-char))
>   (read-line))
> 
> Execute (foo) and type 'abcd<return>'. With any other lisp, I get
> 
> * (foo)
> abcd
> normal: 'a'
> normal: 'b'
> no-hang: 'c'
> normal: 'd'
> ""
> NIL
> *
> 
> With GCL 2.6.5 ANSI, I get
> 
> >(foo)
> normal: '
> '
> abcd
> normal: 'a'
> no-hang: 'NIL'
> normal: 'b'
> "cd"
> NIL
> 
> > 
> 
> Notice that the first read-char returns a spurious newline. I can live
> with that. I don't know a way to check for available input without using
> read-char-no-hang, however. Any suggestions?
> 
> --Jim
> 
> P.S. If this problem is fixed in GCL 2.6.6, I apologize. I didn't see
> any relevant entries in the release notes.
> 
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gcl-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]