[comp.sys.apple2] Curses explained

fadden@cory.Berkeley.EDU (Andy McFadden) (01/31/91)

In article <430@generic.UUCP> taob@pnet91.cts.com (Brian Tao) writes:
>    For us non-UNIX types, could you tell us what exactly is "curses"???

A formalized way of dealing with programs that refuse to work.

Ahem.

UNIX systems don't have mappable displays; they just send a stream of
bytes to the screen.  The terminal interprets some of these characters
as special, doing things like clearing the screen or moving the cursor
to a different position.  Terminal emulators in programs like Kermit or
ProTERM do as their name implies: emulate hardware terminals.

Suppose you want to write an interactive full-screen text editor.  You
have to use the escape codes, but they're different for every terminal,
so what do you do?

VI (vee-eye, not vy), a VIsual text editor, was written before the curses
library was available; it reads the TERMCAP variable, which has an encoded
form of all the terminal capabilities.  If TERMCAP isn't defined, it scans
/etc/termcap for the terminal type in the TERM variable.  If TERM is
undefined, it punts and goes into line-oriented (ex) mode.

This is a pain, so one fine day a clever BSD type pieced together
the curses library, a set of routines for performing basic operations on
the text screen.  It (in conjunction with the termcap library) handles
all the nasty terminal characteristic determination stuff, plus does
cursor motion optimization (how to get from x0,y0 to x1,y1 with the fewest
escape codes) and text windowing.  Most everything you'd want to do with
a terminal can be done with the primitives provided.

Why do we want this on the //gs?  After all, the screen is directly
addressable.  The problem is that UNIX games like rogue and moria (which
have already been ported, actually) use curses, and anyone who wants to
convert them to the //gs has to deal with the curses calls they make,
either by writing their own curses routines or changing the way the program
accesses the screen.

There are free versions of some very interesting games, like sokoban and
wanderer, which would work well on a //gs.  Some of the larger games, such
as NetHack and ULarn, could be ported but not without difficulty; having a
curses library would make it just that much easier.

Does that answer your question?

>Brian T. Tao  {taob@pnet91.cts.com} ||  Computer guru?  Someone who got

-- 
fadden@cory.berkeley.edu (Andy McFadden)
..!ucbvax!cory!fadden
fadden@hermes.berkeley.edu (when cory throws up)

taob@pnet91.cts.com (Brian Tao) (02/01/91)

From fadden@cory.Berkeley.EDU (Andy McFadden):

>In article <430@generic.UUCP> taob@pnet91.cts.com (Brian Tao) writes:
>>    For us non-UNIX types, could you tell us what exactly is "curses"???
>
> A formalized way of dealing with programs that refuse to work.
>
> Ahem.
>
[nice detailed explanation deleted...]
>
> Does that answer your question?
>

    Yes, thank you very much, Andy.  I guess I'll direct all my future UNIX
questions at you instead of Unknown...  ;)

Brian T. Tao  {taob@pnet91.cts.com} ||  Computer guru?  Someone who got
University of Metro Toronto         ||  their computer a couple of weeks
Scarberia, ON, MIC 3A8         *B-) ||  before you did.  (Alvin Toffler)