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 13:39:22 +0100
User-agent: Mutt/1.4i

Hi

I think its a readline (the library) issue:

I have now also tested it on GCL-2.6.6 with readline compiled in, and
can confirm that I get the same behaviour that Jim reported:  

bash-2.04$ ./unixport/saved_ansi_gcl 
GCL (GNU Common Lisp)  2.6.6 ANSI    Feb 15 2005 12:57:35
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)

NIL

>(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: 'NIL'
normal: 'b'
"cd"
NIL

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

FOO2

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

On 2.6.6 _without_ readline compiled in I get the correct behaviour.

>bash-2.04$ ./unixport/saved_ansi_gcl 
GCL (GNU Common Lisp)  2.6.6 ANSI    Feb 15 2005 13:24:35
Source License: LGPL(gcl,gmp), GPL(unexec,bfd)
Binary License:  GPL due to GPL'ed components: (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)

T

>(read-char-no-hang)

#\Newline

etc...


Regards,
Peter

On Mon, Feb 14, 2005 at 11:04:44AM -0500, Camm Maguire wrote:
> 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]