[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Real time input
- To: clisp-list@ma2s2.mathematik.uni-karlsruhe.de, haible@ma2s2.mathematik.uni-karlsruhe.de
- Subject: Real time input
- From: haible (Bruno Haible)
- Date: Wed, 1 Feb 95 01:44:42 +0100
[Forwarded from Ed Loper <ed@syse>???.]
-------------------------------------------------------------------------------
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. However, clisp seems to
wait until a newline has been pressed before putting
typed characters into the buffer; thus, if a user types
"h", my program won't see it until he types a newline, at
which point it will see an "#\h" and a "#\Newline". clisp
also seems to echo each character to the screen when it is
typed; I would prefer if it would let me handle this. Is
this all happening because of the read-eval-print loop? 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? Or is there some other way in which
I should arrange for characters to be read as soon as they
are typed? I've looked through a lot of common lisp docs
and books with no success, so I thought that it might be
something particular to clisp.
In case it matters, I am running:
- A version of clisp that was copyrighted 1994 (I can't
figure out where the version number
is) on version
The operating system is:
- Version 1.1.73 of Linux (Slackware version 2.0)
A short function which demonstrates this problem is:
;;
;; This function creates a busy loop which echos characters
;; whenever it recieves them. When it recieves the character
;; #\q, it immediately exits.
;;
(defun read-characters ()
(let ((input nil)) ;Bind a var for input
(loop ;Loop until #\q is hit
(when (setf input (read-char-no-hang)) ;When a char is typed,
(write input) ; write that character
(format t "~%")) ;Write a newline
(when (equal input #\q) ;When the char is q,
(return t))))) ; exit and return t
I also had four less important questions:
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?
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?
3. What x-windows packages are available for clisp? (clx, garnet,
etc.) and where can I get them?
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 am neither
a linux guru nor a lisp guru, so I couldn't give much help, but
I would be interrested in such a project's progress. I was also
wondering whether it would in fact be easier to compile from
clisp binaries to linux binaries, or whether it would be easier
to compile directly from common lisp: are the binaries simpler
then the common lisp code? Do they only use a few commands? If
so, are they commands like first, rest, and list, or commands
like jump, copy-memory, and add?
Thanx in advance for any help you can give me...
Edward Loper