[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Clearing the screen and other such things.



    Date: Fri, 26 Jul 85 14:49 EDT
    From: Kent M Pitman <KMP at SCRC-STONY-BROOK.ARPA>

    As nearly as I can tell, Common Lisp offers no way to even clear the
    screen.  In the absence of a graphics standard, can we commit to even
    something so simple as a CLEAR-SCREEN function? 

I agree that Common Lisp should have better terminal support, but beyond
CLEAR-SCREEN, things are not so simple.  Some issues (and mere details)
need to be settled on before we extend the language in this direction:

 ERASE-REST-OF-SCREEN, ERASE-REST-OF-LINE, 
 INSERT-CHAR, DELETE-CHAR, INSERT-LINE, DELETE-LINE

Should these functions return T or NIL depending on whether there was any
effect on the screen?

 ERASE-CHAR-BACKWARD, ERASE-CHAR-FORWARD

Many terminals don't support these operations.  If we are trying to limit
ourselves to a set of essential primitives, I would suggest that these be
flushed, since they are merely abstractions for printing the sequences,
backspace-space-backspace and space-backspace, respectively.

 CURSOR-BACKWARD, CURSOR-FORWARD, CURSOR-DOWN, CURSOR-UP,
 CURSOR-HOME-UP, CURSOR-HOME-DOWN

Should these return the cursor position, or either T or NIL depending on
whether there was any effect (like the ERASE-xxx functions)?

 CHARACTER-POSITION

Should all Common Lisp implementations be required to accurately model the
the terminal's cursor position?  In the discussion of TERPRI, FRESH-LINE,
and FORMAT, in CLtL, it is stated explicitly that the implementation not be
required to do so.  This is a wise decision, because this is not always
possible, expecially if the operating system is allowed to randomly print
out notices without telling the Lisp.  Also, some terminals move the cursor
to the next line after printing in the last column, and some terminals
scroll the screen up one line after printing in the last column of the last
screen line!  This can be a source of problems.  (...and some terminals are
just plain spastic; remember how TTY's occasionally skipped spaces, etc?)

 (SETF (CHARACTER-POSITION) (VALUES x y))             

There should probably be a function SET-CHARACTER-POSITION which the above
SETF form expands into.  I would prefer the names CURSOR-POSITION and
SET-CURSOR-POSITION so as to be consistent with the names of the cursor
motion functions.

 SCREEN-SIZE-IN-CHARACTERS

Presumably this will return the page size for printing terminals too.
How about a more generic name like TERMINAL-SIZE-IN-CHARACTERS?

 SCREEN-TYPE

I would prefer the name TERMINAL-TYPE.

 SCREEN-OPERATION-HANDLED-P

Similarly, I would prefer TERMINAL-OPERATION-HANDLED-P

 [terminal-type]
    :OTHER	    The screen is of some type not adequately described by one
		    of these categories. SCREEN-OPERATION-HANDLED-P should be
		    used to determine specifically what type of terminal is 
                    involved.

This seems like an overly painful way of finding out the charateristics of
a terminal.  Perhaps TERMINAL-TYPE should return as a second value the list
of functions names the terminal it supports (something akin to the list
returned by a :WHICH-OPERATIONS method in Flavors).

	Tim McNerney

P.S. If these function were put into the language (white pages), Common
Lisp may be the first language standard to acknowledge the existence of
display terminals!