tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] preparing libcurses for terminfo

On Mon, Jul 20, 2009 at 02:52:16PM +0100, Roy Marples wrote:
> Hi List.
> curses(3) currently uses termcap(3)
> I'm working on changing it to use my terminfo implementation instead, 
> and have come across some pitfalls.
> For whatever brain-dead reason, terminfo defines commonly used words as 
> macros, such as lines, columns and pad_char. There is also a macro 
> conflict with a NetBSD only extension, curses_color(3).

term.h's "always" done that: define symbols pointing into the struct
which correspond to the terminfo capability names. They're #define's
simply so CUR can be redefined to point to a different instance of
the struct.  (There are programs which rely on this behavior...).

For instance, Solaris' term.h has an ifdef to switch between two
choices for CUR:

#ifdef  SINGLE
#define CUR                     _first_term.
#define CUR                     cur_term->

On the other hand, its xpg4 header uses a different base:

#define __TERM cur_term->
> I've prepared a patch for libcurses to fix this - renaming **lines to 
> **alines in the __window struct and pad_char to padchar. I've renamed 
> the function no_color_video to no_color_attributes and added a strong 
> alias to that from no_color_video so we're still binary compatible.

While you're at it, perhaps you should remove this comment (adjacent
to your changes), since it's inaccurate (it's not a "bug" in xterm,
but a design choice - the other choices merely are worse ;-):

         * Work round an xterm bug where inserting lines causes all the
         * inserted lines to be covered with the background colour we
         * set on the first line (even if we unset it for subsequent
         * lines).

> This allows libcurses to compile using term.h, but retains everything 
> termcap. I'll be comitting this soonish, so any eyes or concerns should 
> be raised now.
> Thanks
> Roy

Thomas E. Dickey

Attachment: pgpX0aFF125vo.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index