curses and line graphics

Martin Weitzel martin at mwtech.UUCP
Wed Jul 25 08:36:44 AEST 1990


In article <426 at sigma21.oz> peter at sigma21.oz (Peter Farrell) writes:
>I am running on a Convergent Technologies Server/PC,  an SVR3 based
>system.  I've an application which uses curses and now I
>want to draw boxes in a window and outline these boxes with VT100
>style line graphics. The curses library uses terminfo and the
>terminal's terminfo entry contains definitions for 'acsc', 'smacs' and
>'rmacs'.

First of all I fear 'smacs' and 'emacs' are only applicable where
the 'sgr'-machinery is not set up. The latter is more powerful and
unavoidable for terminals which only support "absolute attribut
setting" (not differential). I don't know about the VT100, but when
`sgr' is set in your terminfo-entry, IMHO you should look for the
correct evaluation of %p9 (it's often *not* treated corectly in this
capability, because the ACS_-stuff is relatively new and it was
not required before that.)

>There is a "box" function in the curses library. According to the
>doc., this uses the ACS_VLINE and ACS_HLINE characters. My trivial
>test program displays the box, but the outline characters are those
>from the acsc string (without the terminal being put into the
>alternate character set mode).

Again, check the `sgr' capability for %p9, it should work then.

There's another glitch with the box-function I described in a
posting about two or three weeks ago: It's not correctly implemented
for delimiter characters other than 0.

BTW: You *must* use box(win, 0, 0) to draw with ACS_-characters;
box(win, '|','-') will not use the special characters, but as you write
the unchanged outline characters from the `ascs'-string were drawn, so
this could not have been the problem.

>Does anyone know if the fact that curses doesn't go into graphics is a
>bug in any other versions of curses? Are there any obvious things I
>should do as well as calling box().

If the terminfo-entry is correct, nothing alse should be required to
make the ACS_-defined characters work.

>I wrote my own box routine. It uses the ACS_ defined characters. This
>time the trivial test prog sends the 'enacs' string up front and
>everything in the window is displayed using the graphics set.

You should send nothing to the terminal which the curses functions
don't know of. Any output which doesn't go thru the appropriate curses
functions may sooner or later yield unexpected results.

>Frustration. Does anyone know how to draw boxes within curses windows?

Normally `box' should work right. From looking thru <curses.h>, it seems
that there is an improved version ob `box', named `wborder'; the only
fault with this seems that it has not made it into the manual ... :-(
(But if `box' doesn't work, also `wborder' will not and vice versa.)
-- 
Martin Weitzel, email: martin at mwtech.UUCP, voice: 49-(0)6151-6 56 83



More information about the Comp.unix.i386 mailing list