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: Camm Maguire
Subject: Re: [Gcl-devel] read-char-no-hang
Date: 14 Feb 2005 11:04:44 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

I can't reproduce this, but rather get:

GCL (GNU Common Lisp)  2.6.6 ANSI    Jan 18 2005 00:15:57
Source License: LGPL(gcl,gmp), GPL(unexec,bfd)
Binary License:  GPL due to GPL'ed components: (READLINE BFD UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.

>(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))

FOO

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

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

FOO2

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

>(by)


Am I missing something?

Take care,

Peter Wood <address@hidden> writes:

> 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
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gcl-devel
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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