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: Tue, 15 Feb 2005 10:58:49 +0100
User-agent: Mutt/1.4i

Hi

On Mon, Feb 14, 2005 at 11:04:44AM -0500, Camm Maguire wrote:
> Greetings!
> 
> I can't reproduce this, but rather get:

I can confirm this LISTEN bug on 2.7.0 (from CVS an hour or so ago)
plus a broken READ-CHAR-NO-HANG (though not the same bug Jim
reported).


bash-2.04$ ./unixport/saved_ansi_gcl
GCL (GNU Common Lisp)  2.7.0 ANSI    Feb 15 2005 09:48:27
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.

>(listen)

NIL

>(read-char-no-hang)

Error in EVAL [or a callee]: Unexpected end of file on #<synonym stream to 
*TERMINAL-IO*>.

Fast links are on: do (use-fast-links nil) for debugging
Broken at READ-CHAR-NO-HANG.  Type :H for Help.
 1 (Continue) Return to top level.
dbl:>>

This is what I get on my old GCL:

bash-2.04$ gcl
GCL (GNU Common Lisp)  Version(2.5.0) Thu Jun 20 12:08:15 CEST 2002
Licensed under GNU Library General Public License
Contains Enhancements by W. Schelter

>(listen)

T

>(read-char-no-hang)

#\Newline

Which is the (traditionally) correct behaviour for GCL

Regards,

Peter


> 
> 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]