Announcing ncurses 6.1

Last Updated on March 26, 2020

The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0 (SVr4), and more. It uses terminfo format, supports pads and color and multiple highlights and forms characters and function-key mapping, and has all the other SVr4-curses enhancements over BSD curses. SVr4 curses became the basis of X/Open Curses.

Release Notes

These notes are for ncurses 6.1, released January 27, 2018.

This release is designed to be source-compatible with ncurses 5.0 through 6.0; providing extensions to the application binary interface (ABI). Although the source can still be configured to support the ncurses 5 ABI, the intent of the release is to provide extensions to the ncurses 6 ABI:

  • improve integration of tput and tset
  • provide support for extended numeric capabilities.

There are, of course, numerous other improvements, listed in this announcement.

The release notes also mention some bug-fixes, but are focused on new features and improvements to existing features since ncurses 6.0 release.

Library improvements

New features

The improved integration of tput and tset made only small changes to the libraries. However, supporting extended numeric capabilities required a few changes:

  • The TERMINAL structure in <term.h> is now opaque. Doing that allowed making the structure larger, to hold the extended numeric data. A few applications required changes during development of ncurses 6.1 because those applications misused the members of that structure, e.g., directly modifying it rather than using def_prog_mode.
  • Having made TERMINAL opaque (and because none of the library functions use anything except a pointer to TERMINAL), it was possible to increase the size of the structure, adding to the end.Existing applications which were linked to the ncurses 6.0 high-level (ncurses, ncursesw) and low-level (tinfo, tinfo) libraries should not require re-linking since the binary interface did not change, nor did the structure offsets with TERMINAL change.A few applications use the inner TERMTYPE structure’s offsets to refer to terminfo capabilities within that structure. Again, those do not require modification because their offsets within TERMINAL did not change.
  • When configured for wide-characters, i.e., “ncursesw” the TERMINAL structure is extended.The new data in TERMINAL holds the same information as TERMTYPE, but with larger numbers (“int” versus “short”). It is named TERMTYPE2.The library uses this structure internally in preference to TERMTYPE, referring to TERMTYPE only to initialize it for applications that use the capabilities defined in <term.h>
  • When configured for 8-bit (narrow) characters, the TERMTYPE2 structure is not used.
  • The updated application binary interface is 6.1.20171230 (used for new versioned symbols), although the interface changes were developed several months previously.

The motivation for making this extension came from noticing that termcap applications could (though not realistically) use larger numbers than would fit in 16-bits, and the fact that the number of color pairs for a 256-color xterm could not be expressed in terminfo (i.e., 32767 versus 65536). Also, a few terminals support direct-colors, which could use the extension.

Generally speaking, applications that use internal details of a library are unsupported. There was exactly one exception for ncurses: the tack program used the internal details of TERMINAL, because it provides an ncurses-specific feature for interactively modifying a terminfo description and writing the updated description to a text-file. It was possible to not only separate tack from these internal details of ncurses, but to generalize it so that the program works with Unix curses (omitting the ncurses-specific feature). That was released as tack 1.08 in July 2017.

While making changes to tack to eliminate its dependency upon ncurses internals, the publicly-visible details of those internals were reviewed, and some symbols were moved to private header files, while others were marked explicitly as ncurses internals. Future releases of ncurses may eliminate some of those symbols (such as those used by tack 1.07) because they are neither part of the API or the ABI.

Using the TERMTYPE2 extended numeric capabilities, it is possible to support both color pair values and color values past 32767. Taking compatibility into account, developers readily understand that neither function signatures nor structure offsets change. Also, existing functions have to operate with the extended numbers. Most of that work is internal to the library. For the external interfaces, a hybrid approach was used:

  • X/Open Curses defined function prototypes such as wattr_set with an unused parameter, for “future” use. After 25 years, the future is here: ncurses uses the parameter to augment color pair values as described in the manual page.
  • Other functions such as those defining color pairs did not have a corresponding reserved parameter. For those, >ncurses defines extended versions such as init_extended_pair (versus init_pair), init_extended_color (versus init_color).


Read more

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments