bug-ncurses
[Top][All Lists]
Advanced

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

Re: Question: How does ncurses store and handle "wide" characters?


From: Bill Gray
Subject: Re: Question: How does ncurses store and handle "wide" characters?
Date: Fri, 4 Jun 2021 13:34:14 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 6/3/21 7:49 PM, Thomas Dickey wrote:

Looking at the 3.4 headers (on Linux...),

   That's going back a ways,  but it's the same in the current 3.9
(and in PDCursesMod).  In each case,  there's only one curses.h,
used for all platforms (DOS, OS/2, Windows, Plan9,  etc.)

PDCurses has this:

     XCURSES         True if compiling for X11.
     PDC_RGB         True if you want to use RGB color definitions
                     (Red = 1, Green = 2, Blue = 4) instead of BGR.
     PDC_WIDE        True if building wide-character support.
     PDC_DLL_BUILD   True if building a Win32 DLL.
     NCURSES_MOUSE_VERSION   Use the ncurses mouse API instead
                             of PDCurses' traditional mouse API.

but the "XCURSES" is misplaced (it should be set by the implementation,
and PDC_DLL_BUILD is irrelevant on Linux).

   That list ought to also include (and this would apply to 3.4,  too)

       PDC_FORCE_UTF8   Force use of UTF8 instead of locale

   It does look as if XCURSES is a hangover no longer serving much
of a purpose on PDCurses/PDCursesMod.  We should probably rename it
to something like ENABLE_X11_FUNCS... except that would break some
existing systems.  As you say,  it's hard to drop things that others
might be using.

The others are set by the user.

In ncurses, there's no summary of set-by-the-user.  ncurses' curses.h is
more than twice as long as that for PDcurses, with 3-4 times as many "#if"
lines.  But most of that is for constants (settings done in the configure
script). Offhand, there's about as many symbols that the user might
define -- which might be better expressed in the manpage, since a one-line
comment doesn't help that much, to explain why a feature is compile-time
configurable.

Looking quickly, I see

        NCURSES_ATTR_T (normally not set by users)
        NCURSES_INTERNALS (normally not set by users)
        NCURSES_WATTR_MACROS
        NCURSES_REENTRANT
        NCURSES_WIDECHAR
        NCURSES_NOMACROS

Most of the other symbols are set by the configuration scripts.

(I'm reminded that I should get rid of "TRACE", which is very old,
e.g., replacing it with "NCURSES_TRACE",
but can't simply drop things that others might be using...)

Following up on the bit-layout, though: I use the symbols all the time,
and don't look at the hex/octal values of the mouse-masks or attributes.

    I'm a little lost here.  I gather you're thinking the
wide-character support in PDCurses is enabled by default?
It isn't;  you have to compile with PDC_WIDE enabled.  Omit
that,  and only eight of the 21 character bits actually
get used.  Or are you seeing some other deviation?

Thanks!    -- Bill




reply via email to

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