[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] humble q? about 'listen'
From: |
Peter Wood |
Subject: |
[Gcl-devel] humble q? about 'listen' |
Date: |
Mon, 16 Sep 2002 22:00:44 +0200 |
User-agent: |
Mutt/1.4i |
Hi
The 'humble' in the subject line is because of my stupid 'bug' report
about #'sleep :-)
Anyway -
My question is: Is #'listen reliable on x86 Gnu/Linux?
In the following if #'prep-term and #'deprep-term put the terminal
into and out of cbreak, and (|u7|) sends a cursor position request to
the terminal: (on an xterm this is the chars #\^[ #\[ #\6 #\n). The
format of the return is like a scanf format 'u6=\E[%i%d;%dR' where %i
means decrement the 2 numbers signified by %d, and the other chars are
literals ie #\^[ #\[ 'decf 'number #\; 'number #\R ...
(defun test-3 ()
(prep-term)
(|u7|)
(unwind-protect
(do ((ret nil (push (read-char) ret)))
((char= (peek-char) #\R) (progn (read-char) (nreverse ret))))
(deprep-term)))
(defun test-4 ()
(prep-term)
(|u7|)
(unwind-protect
(do ((ret nil (push (read-char) ret)))
((not (listen)) (nreverse ret)))
(deprep-term)))
It appears that #'test-4 unpredictably sometimes returns only a list
containing the first char of the terminal response (actually
#\Newline, since that is waiting in the input) and sometimes returns
the correct list of (eg: (#\Newline #\^[ #\[ #\2 #\4 #\; #\1 #\R) )
#'test-3 appears to be reliable and returns eg (#\Newline #\^[ #\[ #\4
#\9 #\; #\1) - obviously the numbers will vary.
>(term::test-4)
(#\Newline #\^[ #\[ #\1 #\3 #\; #\1 #\R)
>(term::test-4)
(#\Newline #\^[ #\[ #\1 #\7 #\; #\1 #\R)
>(term::test-4)
(#\Newline #\^[ #\[ #\2 #\1 #\; #\1 #\R)
>(term::test-4)
(#\Newline #\^[ #\[ #\2 #\5 #\; #\1 #\R)
>(term::test-4)
(#\Newline #\^[ #\[ #\2 #\9 #\; #\1 #\R)
>(term::test-4)
(#\Newline)
>^[[33;1R
#'test-3 can run for a long time without problems (100000 invocations
where the cursor gets sent to a random position on the screen and a
cursor-position-request is issued. Maybe more, I got bored :-))
Is it a problem with #'listen? The docs say it might not work on some
platforms due to lack of support in the OS. Is Gnu/Linux amongst
those? Maybe my usage is incorrect?
Regards,
Peter
(and sorry about the long post)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gcl-devel] humble q? about 'listen',
Peter Wood <=