[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question: How does ncurses store and handle "wide" characters?
From: |
Thomas Dickey |
Subject: |
Re: Question: How does ncurses store and handle "wide" characters? |
Date: |
Thu, 3 Jun 2021 19:49:21 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Thu, Jun 03, 2021 at 01:11:08PM -0400, Bill Gray wrote:
> Hi Peter, all,
>
> Just a note : the PDCursesMod documentation is almost
> entirely from the contributors to PDCurses, not me. The
> bit about "standing on the shoulders of giants" applies.
>
> In this case, you really _are_ reading the C headers;
> it's just that MANUAL.md is extracted from them (and the
> C source). I hadn't really thought about it much (it was
> that way when I got here), but I think that when I'm trying
> to look something up in PDCurses/PDCursesMod, I usually
> look in the headers or source. However, there have been
> times when just searching MANUAL.md made more sense.
>
> I should also note that I have a foot on Thomas' shoulders
> as well. My knowledge of Curses standards is quite minimal.
> I mostly just figure that if ncurses does something in a
> particular way, it'll either be the standard way or will
> be documented as "warning, this is non-standard", and
> it'll be the way most people are expecting it to work.
>
> At this point, given the "market share" of ncurses,
> it's become a de facto standard. When PDCursesMod doesn't
> behave as ncurses does, I generally think there ought to
> be a good reason. Sometimes, there is (as with PDCurses'
> implementation of full RGB colors). Usually not, though.
>
> Which leads me to ask, Thomas, about this comment :
>
> "...actually you're telling me that PDCurses has an
> unnecessary deviation from X/Open Curses."
I was misreading his comment about NCURSES_WIDECHAR.
Actually he was referring to the comment-header in PDCurses
which tries to show the symbols that a user might want to use to
turn on features.
Looking at the 3.4 headers (on Linux...), 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).
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
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net
signature.asc
Description: PGP signature