Screen colors & terminfo trivia

Rich Braun rbraun at spdcc.COM
Fri May 31 10:34:31 AEST 1991


staceyc at sco.COM (Stacey Campbell) writes:
>You might consider using curses level routines instead of the
>lower level terminfo routines.  It sounds like your DOS app does
>its own screen handling and you are hoping to plug in terminfo
>calls for the output.  In the long run you will probably get
>better screen optimizations using curses.  curses also knows
>how to deal with terminals that don't have certain attributes
>or features, using curses would mean not duplicating that (very
>tedious) work in your own app.

I could use some better doc on the distinction between curses and
terminfo.  I immediately saw that terminfo would be superior to
just termcap (which an older port of some Kronos software used,
to the detriment of the guys handling service calls {-;), but I'm
not too up on curses.

>Both curses and terminfo deal with color.  Check the setf, setb, op,
>ccc, (et. al.) terminfo capabilities.  At the curses level check
>start_color(), COLOR_PAIR(), init_pair(), A_COLOR, etc. routines
>and macros.

A co-worker pointed me at these routines, and I'm happy to say I
got my application running reasonably well on the console (a VGA card).
Nowhere near as fast as the direct-video output under DOS, but probably
good enough.

>  Terminals cannot be accessed
>as memory mapped devices via terminfo or curses; that is, you cannot
>directly tweak some bit in memory that the video hardware...

As a first approximation, I implemented my "set_attr" function by
fetching characters out of terminfo's screen image via the winch()
function and tacking on the new attribute bits.  Slow but it works.

>>Any suggestions or sample code?
>
>I can send some demo color curses code.  I have never written a
>terminal-generalized color terminfo application, that is potentially
>a very painful task.

Would appreciate the demo code (by e-mail).  I'm especially interested
in figuring out reasonable ways of mapping color attributes to
"traditional" attributes like underscore, blink, bold, and inverse, so
the application looks like it does under DOS if you're on a color
terminal but also looks OK if you're on a VT100-class terminal (which is
probably what a lot of our customers have).

By the way, someone pointed me to the screen(HW) man page provided by
SCO.  This describes some (not all) of the ANSI-style escape sequences
provided by the ANSI interpreter, and also tells how to do direct
memory-mapped I/O to graphics cards under UNIX.  Since I've already
got functional DOS code for managing the hardware memory map, it shouldn't
be too difficult to put run-time conditionals into similar Unix code for
making VGA console output run really well.  (I'd encourage other 386-
Unix developers to take advantage of this feature, which may very well
be implemented as a standard V.3 feature and not just SCO.)

-rich



More information about the Comp.unix.sysv386 mailing list