[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A couple of I/O questions
- To: clisp-list, firstname.lastname@example.org
- Subject: A couple of I/O questions
- From: haible (Bruno Haible)
- Date: Fri, 30 Apr 93 11:10:44 +0200
Peter Dudey asks:
> How do I turn the string "13" into the fixnum 13?
Use READ-FROM-STRING or PARSE-INTEGER.
> Is there any way to move the cursor around the screen ... ?
CLISP contains a fairly portable mini-curses like screen access package.
Here is a documentation of it. (It mentions windows, but only one window
is possible now: the full (virtual) screen.)
99.2. Random Screen Access
returns a "window stream". As long as this stream is open, the terminal
is in cbreak/noecho mode. *TERMINAL-IO* shouldn't be used for input or
output during this time. (Use WITH-KEYBOARD and *KEYBOARD-INPUT* instead.)
returns the window's size, as two values:
height (= Ymax+1) and width (= Xmax+1).
returns the position of the cursor in the window, as two values:
line (>=0, <=Ymax, 0 means top), column (>=0, <=Xmax, 0 means left margin).
(SYSTEM::SET-WINDOW-CURSOR-POSITION window-stream line column)
sets the position of the cursor in the window.
clears the window's contents and puts the cursor in the upper left corner.
clears the window's contents from the cursor position to the end of window.
clears the window's contents from the cursor position to the end of line.
removes the cursor's line, moves the lines below it up by one line and
clears the window's last line.
inserts a line at the cursor's line, moving the lines below it down by
switches highlighted output on.
switches highlighted output off.
makes the cursor visible, a cursor block in most implementations.
makes the cursor invisible, in implementations where this is possible.
I suggest a macro like
(defmacro with-window (&body body)
`(LET ((*WINDOW* (SYS::MAKE-WINDOW)))
(UNWIND-PROTECT (PROGN ,@body) (CLOSE *WINDOW*))
to ensure that the window stream is closed in all cases.