.sh 1 "Cursor Motion Optimization: Standing Alone"
It is possible to use the cursor optimization functions of this screen package
without the overhead and additional size of the screen updating functions.
The screen updating functions are designed for uses
where parts of the screen are changed,
but the overall image remains the same.
This includes such programs as
actually uses these functions,
will find it difficult to use these functions in this manner
without considerable unnecessary program overhead.
.q "\fIcrt hacks\fR\|" \**
Graphics programs designed to run on character-oriented terminals.
so the list would be quickly out of date.
Recently, there have been programs such as
all that is needed is the motion optimizations.
This, therefore, is a description
of what some of what goes on at the lower levels of this screen package.
The descriptions assume a certain amount of familiarity
with programming problems and some finer points of C.
None of it is terribly difficult,
but you should be forewarned.
.sh 2 "Terminal Information"
In order to use a terminal's
features to the best of a program's abilities,
it must first know what they are\**.
If this comes as any surprise to you,
there's this tower in Paris they're thinking of junking
that I can let you have for a song.
The \*(tc \*(db describes these,
but a certain amount of decoding is necessary,
and there are, of course,
both efficient and inefficient ways of reading them in.
The algorithm that the uses is taken from
and is hideously efficient.
whose names are two uppercase letters with some mnemonic value.
is a string which moves the cursor to the "home" position\**.
These names are identical to those variables
\*(db to describe each capability.
See Appendix A for a complete list of those read,
As there are two types of variables involving ttys,
sets some variables based upon the tty modes accessed by
a larger task by reading in the descriptions from the \*(tc \*(db.
This is the way these routines are used by
\*fif\fP (sp=getenv("TERM"))
checks to see if file descriptor 0 is a terminal\**.
is defined in the default C library function routines.
on the descriptor and checks the return value.
sets the terminal description modes from a
is then called to get the name of the terminal,
and that value (if there is one) is passed to
which reads in the variables from \*(tc
associated with that terminal.
returns a pointer to a string containing the name of the terminal,
which we save in the character pointer
sequences initialize the terminal
.sh 2 "Movement Optimizations, or, Getting Over Yonder"
Now that we have all this useful information,
it would be nice to do something with it\**.
be emotionally fulfilling just to get the information.
This is usually only true, however,
if you have the social life of a kumquat.
The most difficult thing to do properly is motion optimization.
When you consider how many different features various terminals have
(tabs, backtabs, non-destructive space, home sequences, absolute tabs, .....)
you can see that deciding how to get from here to there
can be a decidedly non-trivial task.
uses many of these features,
and the routines it uses to do this take up many pages of code.
Fortunately, I was able to liberate them with the author's permission,
to get the terminal descriptions,
you simply tell it where you are now and where you want to go.
mvcur(0\*,0\*,LINES/2\*,COLS/2)
would move the cursor from the home position (0\*,0)
to the middle of the screen.
If you wish to force absolute addressing,
that you are impossibly far away,
to absolutely address the lower left hand corner of the screen
just claim that you are in the upper right hand corner:
mvcur(0\*,COLS\-1\*,LINES\-1\*,0)