bug-ncurses
[Top][All Lists]
Advanced

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

Re: Trouble with wattr_set()


From: Bryan Christ
Subject: Re: Trouble with wattr_set()
Date: Sat, 26 Jan 2019 18:28:58 -0600

Thomas,

I saw that chunk of code in the stable 6.1 tarball which is what prompted this question.  I've used NCURSES_EXT_COLOR as a precompiler conditional in my code, so it sounds like that's the best I can do.

On a related noted, I think Bionic 18.04 *might* come with ABI 5, but 18.04.1 is most definitely 6.1 *and* the conditional #if 0 is used not #if 1.

On Sat, Jan 26, 2019 at 10:28 AM Thomas Dickey <address@hidden> wrote:
On Sat, Jan 26, 2019 at 02:54:12PM +1100, Timothy Allen wrote:
> On Fri, 2019-01-25 at 15:08 -0600, Bryan Christ wrote:
> > I discovered that on Bionic, NCURSES_EXT_COLORS is not defined, but
> > on Fedora 29 it is.  Would that matter?  I wouldn't see why it should
> > since pair 766 (in my example) fits well within a short.  Or is
> > NCURSES_EXT_COLORS is somehow relevant for anything greater than 8
> > bits?
>
> I'm not sure, myself.
>
> The only mention of NCURSES_EXT_COLORS I can find in documentation is
> in the NEWS file, where it just says that it means "extended colors"
> are available:
>
> https://github.com/ThomasDickey/ncurses-snapshots/blob/a9b714f69879e6e8313c116eeee474998e0583fe/NEWS#L5225
>
> Searching for "extended colors" finds a paragraph in the INSTALL file,
> which says that "extended colors" means supporting 88-colour or 256-
> colour terminals, and is part of ABI 6:
>
> https://github.com/ThomasDickey/ncurses-snapshots/blob/master/INSTALL#L1709
>
> This confuses me, because I've definitely been using the xterm-256color
> terminfo entry for a lot longer than Debian has used ABI 6.

The terminfo entry's been there, but you wouldn't have used the full
range of colors except directly via low-level terminfo functions.

Compare the definition of cchar_t in curses.h

ABI 5 (Debian 8, <ncursesw/curses.h>
--------------------------------------------------------------------------------
/*
 * cchar_t stores an array of CCHARW_MAX wide characters.  The first is
 * normally a spacing character.  The others are non-spacing.  If those
 * (spacing and nonspacing) do not fill the array, a null L'\0' follows.
 * Otherwise, a null is assumed to follow when extracting via getcchar().
 */
#define CCHARW_MAX      5
typedef struct
{
    attr_t      attr;
    wchar_t     chars[CCHARW_MAX];
#if 0
#undef NCURSES_EXT_COLORS
#define NCURSES_EXT_COLORS 20140913
    int         ext_color;      /* color pair, must be more than 16-bits */
#endif
}
cchar_t;

ABI 6 (my current code, <ncursesw6/curses.h>
--------------------------------------------------------------------------------
/*
 * cchar_t stores an array of CCHARW_MAX wide characters.  The first is
 * normally a spacing character.  The others are non-spacing.  If those
 * (spacing and nonspacing) do not fill the array, a null L'\0' follows.
 * Otherwise, a null is assumed to follow when extracting via getcchar().
 */
#define CCHARW_MAX      5
typedef struct
{
    attr_t      attr;
    wchar_t     chars[CCHARW_MAX];
#if 1
#undef NCURSES_EXT_COLORS
#define NCURSES_EXT_COLORS 20190121
    int         ext_color;      /* color pair, must be more than 16-bits */
#endif
}
cchar_t;

--------------------------------------------------------------------------------
Without that ifdef'd chunk, all of the color-pair information is stored
in 8 bits in the "attr" member.

Ubuntu 18.04 has the former: ABI 5, and does not support extended colors.

Since Ubuntu doesn't do much more than copy Debian (and not immediately),
it'll pick up Debian's incorporation of the ABI 6 changes in a later update
(someone mentioned 18.10, for instance).

--
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net


--
Bryan
<><

reply via email to

[Prev in Thread] Current Thread [Next in Thread]