Subject: Re: Real time input

From: haible (Bruno Haible)
Date: Wed, 1 Feb 95 02:11:28 +0100

> I have a question about the listen and read-char-no-hang
> functions.  I'm trying to make a program which will read
> characters as they are typed, but do other things if they
> are not typed.  This is, as far as I can tell, the
> function of read-char-no-hang.

Sure.

Note 1: As per dpANS, "READ-CHAR-NO-HANG is exactly like READ-CHAR, except
that if it would be necessary to wait in order to get a character (as from
a keyboard), NIL is immediately returned without waiting." From this. it
can be concluded that READ-CHAR-NO-HANG has to echo the character if
READ-CHAR would do it.

Note 2: READ-CHAR-NO-HANG obviously cannot do the right thing if there is
some line buffering between your keyboard and clisp (e.g., you are using
an old terminal, telnetting through an ibm3090 or using Unix standard input).

> Is this all happening because of the read-eval-print loop?

No, the READ-EVAL-PRINT loop is unrelated to this. (At least in CLISP.)

> Is there a special variable which I need to set in order to
> tell clisp that I want each character put into the input
> buffer as it is read?

You probably want to use clisp's WITH-KEYBOARD macro and *KEYBOARD-INPUT*
stream instead of *STANDARD-INPUT*. See impnotes.txt for details.

>   1. How portable is the screen package?  Is it only portable across
>      common lisp, or is it a defined standard, a de facto standard,
>      or is it only implemented in clisp?

Only implemented in CLISP.

>   2. Because clisp doesn't compile to a machine-specific binary, is
>      there no way to make a stand alone executable?  Is there some
>      way to link clisp and my program into one binary file, and if
>      so, do I have to worry about licensing stuff etc?

You can't make stand-alone executables with clisp, but you can save memory
images via the SAVEINITMEM function. You thus have two files, not one; I hope
you can live with that.

Copyright issues are discussed in the COPYRIGHT file. Basically, if you
pass on .mem files to other people, you have to pass on the .fas files as well.

>   3. What x-windows packages are available for clisp? (clx, garnet,
>      etc.) and where can I get them?

CLX, CLUE and perhaps CLIO from ma2s2.mathematik.uni-karlsruhe.de:/pub/lisp/
clisp/packages/, as well as Garnet 2.2.
Garnet 3.0 as well, get it from the original site, but you may some encounter
some package conflict problems.
Of course there is also STDWIN in clisp itself, but you won't probably be
happy with it.

Anybody out there has written a Tcl/Tk interface for CLISP??

>   4. Eric Sauthier wrote that "One way to overcome this 'slowness'
>      would be to add a step to the compiler, specific to a particular
>      architexture, which would translate the intermediate language
>      representation into machine instructions."  I was wondering if
>      anyone was working on such an entity for linux.

I expect that this would result in much increased code size, which would
eliminate the speed gained from having machine code. Unless you have a
machine with 32 MB RAM or more. (But I haven't tested this, so I may be wrong.)

                    Bruno Haible
                    [email-masked]