Kent M Pitman <pitman@world.std.com> wrote:
+---------------
| Ola Rinta-Koski <ola@karakara.hut.fi> writes:
| > You'll want to abstract away the actual strings anyway and use them
| > only in one place in your code. E.g. (ansi-gotoxy 0 0) instead of
| > (format t "~CF;0;0" #\Escape) wherever you need it (the actual control
| > code is something different, but that's the idea).
|
| At the least, yes.
| If possible, a second layer of abstraction atop that which doesn't presuppose
| an ansi model is also desirable:
| (defclass ansi-control () ())
| (defmethod move-cursor (x y) (ansi-gotoxy 0 0))
+---------------
And then you're well on your way to inventing a Common Lisp binding for
the "curses" library (which in turn uses the "termcap" database for *lots*
of terminals [not just ANSI], commonly supplied on Unix & other operating
systems), though be sure to check with the documentation for the version
of Lisp you're using to see whether such as thing might already exist,
such as the SCREEN package in CLISP:
<URL:http://clisp.sourceforge.net/impnotes.html#screen>
...
(screen:make-window) ==> window-stream
(screen:with-window . body)
...
(screen:clear-window window-stream)
(screen:set-window-cursor-position window-stream line column)
...
And while you're reading, watch out for anything else your implementation
might do special with the built-in *TERMINAL-IO* stream, such as CLISP's
LISP:WITH-KEYBOARD form:
<URL:http://clisp.sourceforge.net/impnotes.html#streams>
<URL:http://clisp.sourceforge.net/impnotes.html#screen>
-Rob
-----
Rob Warnock, 31-2-510 rpw3@sgi.com
SGI Network Engineering http://reality.sgi.com/rpw3/
1600 Amphitheatre Pkwy. Phone: 650-933-1673
Mountain View, CA 94043 PP-ASEL-IA