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: 15 Feb 2005 16:16:47 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

Please try this patch, which is now posted to the errata page.

=============================================================================
diff -ru gcl/h/protoize.h gcl-2.6.6/h/protoize.h
--- gcl/h/protoize.h    2005-01-16 00:36:20.000000000 +0000
+++ gcl-2.6.6/h/protoize.h      2005-02-15 16:35:37.000000000 +0000
@@ -547,6 +547,7 @@
 
 
 /*  readline.d */
+extern int readline_on;
 void
 gcl_init_readline_function(void);
 
diff -ru gcl/o/file.d gcl-2.6.6/o/file.d
--- gcl/o/file.d        2004-05-07 21:48:58.000000000 +0000
+++ gcl-2.6.6/o/file.d  2005-02-15 17:52:20.000000000 +0000
@@ -39,6 +39,7 @@
 #include "include.h"
 
 #ifdef HAVE_READLINE
+#include <readline/readline.h>
 #define kclgetc(FP)            rl_getc_em(FP)
 #define kclungetc(C, FP)       rl_ungetc_em(C, FP)
 #define kclputc(C, FP)         rl_putc_em(C, FP)
@@ -1210,6 +1211,8 @@
        case smm_input:
        case smm_io:
 
+         if (readline_on && strm->sm.sm_fp==rl_instream)
+           return *rl_line_buffer ? TRUE : FALSE;
 
                if (strm->sm.sm_fp == NULL)
                        closed_stream(strm);
diff -ru gcl/o/gcl_readline.d gcl-2.6.6/o/gcl_readline.d
--- gcl/o/gcl_readline.d        2004-03-09 02:15:42.000000000 +0000
+++ gcl-2.6.6/o/gcl_readline.d  2005-02-15 17:51:56.000000000 +0000
@@ -51,7 +51,7 @@
 #include <history.h>
 #endif
 
-static int readline_on = 0;            /* On (1) or off (0) */
+int readline_on = 0;           /* On (1) or off (0) */
 static int rl_ungetc_em_char = -1;
 static unsigned char *rl_putc_em_line = NULL;
 
@@ -283,6 +283,7 @@
                free(line);
                line = NULL;
                linepos = 0;
+               *rl_line_buffer=0;
                return '\n';
        }
 
=============================================================================

Your test functions appear to work under readline with these installed
for me at least.

Take care,

James Amundson <address@hidden> writes:

> On Mon, 2005-02-14 at 10:04, Camm Maguire wrote:
> > Greetings!
> 
> Thanks for looking into this.
> 
> > I can't reproduce this, but rather get:
> 
> On my system, read-char-no-hang and listen always return nil. I attached
> my output from foo and foo2 to the end of this message. I'm afraid it
> must be a gcc and/or libc issue. Here are my versions:
> 
> |abacus3>gcc --version
> gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-42)
> Copyright (C) 2002 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is
> NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
> 
> |abacus3>/lib/libc.so.6 --version
> GNU C Library stable release version 2.3.2, by Roland McGrath et al.
> Copyright (C) 2003 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.
> There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
> PARTICULAR PURPOSE.
> Compiled by GNU CC version 3.2.3 20030502 (Red Hat Linux 3.2.3-42).
> Compiled on a Linux 2.4.20 system on 2004-12-20.
> Available extensions:
>         GNU libio by Per Bothner
>         crypt add-on version 2.1 by Michael Glad and others
>         linuxthreads-0.10 by Xavier Leroy
>         The C stubs add-on version 2.1.2.
>         BIND-8.2.3-T5B
>         NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
>         Glibc-2.0 compatibility add-on by Cristian Gafton
>         libthread_db work sponsored by Alpha Processor Inc
> Thread-local storage support included.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/libc/bugs.html>.
> 
> I'm not sure what debugging steps to try next. I tried to understand how
> read-char-no-hang and listen are implemented in the gcl source, but I
> couldn't see it. Any pointers?      
> 
> Thanks,
> Jim
> 
> P.S.
> 
> GCL (GNU Common Lisp)  2.6.6 ANSI    Feb 14 2005 21:03:12
> 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: '
> '
> abcde
> normal: 'a'
> no-hang: 'NIL'
> normal: 'b'
> "cde"
> NIL
> 
> >(defun foo2 ()
>   (do ()
>       ((not (listen)))
>     (read-char-no-hang))
>   (foo))
> 
> FOO2
> 
> >(foo2)
> normal: '
> '
> abcdef
> normal: 'a'
> no-hang: 'NIL'
> normal: 'b'
> "cdef"
> NIL
> 
> >
> 
> 
> 
> 
> 

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