Alternate character modes on magic_cookie_glitch terminals (long)

Jim Balter jim at segue.segue.com
Thu Mar 7 08:04:17 AEST 1991


In article <10513 at scolex.sco.COM> staceyc at sco.COM (Stacey Campbell) writes:
>The guy who wrote System V.3.2 curses claims that it deals
>with magic cookies correctly (he posts occasionally to Usenet),

There are a couple of significant bugs related to magic cookies.
One is that, after clearing to end of line it drops a cookie at the beginning
of the cleared area but forgets it did so due to bad parenthesization.
Another is that any change video attributes also forces changing color
attributes, which isn't necessary, at least on HP terminals (which are the
only cookie terminals supporting color that I know of).  curses forgets
that the color cookie was dropped, due largely to bad code organization.

>though I have yet to see a scrap of documentation that explains
>what is required of the terminfo file

Other than setting xmc appropriately, what should be required?

>and the curses program

I don't think curses programs need to know anything, other than that the output
may look horrible on xmc#1 terminals.

>I am somewhat confused by the 0 in xmc#0, the manual says the numeric
>value to xmc is the "number of blank characters left by smso or
>rmso".  If this value is zero then it would seem that there is no
>magic cookie required, therefore xmc should be removed.  Perhaps
>the 0 is special.

xmc#0 means that cookies take no space but that the terminal is still
magic-cookie-like.  For xmc terminals, setting an attribute affects the current
cursor location and all locations to the right of it up to the next magic
cookie.  For xmc#1 terminals, the magic cookie actually takes up a screen
location.  For non-xmc terminals, setting an attribute sets a state which
affects all subsequent output until the next attribute setting.

>The curses source implements 
>in a number of places;
>
>	if (! magic_cookie_glitch)
>		turn_off_attributes();

Actually, the test is usually magic_cookie_glitch >= 0; magic_cookie_glitch is
< 0 if it wasn't specified in the terminfo file.

This is understandable from the above.  If !xmc, turning off attributes turns
them off for subsequent output.  If xmc, this would turn them off at the
current cursor location, which not what is wanted.  It turns out that there
are other glitches in the code where this distinction for xmc terminals isn't
made, because the magic cookie stuff was obviously grafted onto (rather than
integrated into) some already badly organized code. 



More information about the Comp.unix.programmer mailing list