Subject: Re: special chars in string constant
From: (Rob Warnock)
Date: 5 Jan 2001 05:25:34 GMT
Newsgroups: comp.lang.lisp
Message-ID: <933lse$krhmv$>
Kent M Pitman  <> wrote:
| Ola Rinta-Koski <> 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:

	(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



Rob Warnock, 31-2-510
SGI Network Engineering
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA