[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: <ncursesw/curses.h> and addnwstr
From: |
Thomas Dickey |
Subject: |
Re: <ncursesw/curses.h> and addnwstr |
Date: |
Wed, 26 Apr 2023 19:48:04 -0400 |
On Tue, Apr 25, 2023 at 05:13:55PM +0200, Florian Weimer wrote:
> * Thomas Dickey:
>
> > On Fri, Mar 17, 2023 at 07:15:26PM +0100, Florian Weimer wrote:
> >> ocaml-curses has a configure check like this
> >>
> >> AC_MSG_CHECKING(for wide character support in ncurses library)
> >> AC_TRY_LINK(
> >> [#include <wchar.h>
> >> #include CURSES_HEADER
> >> ],
> >> [wchar_t wch = 0;
> > ^^^^^^ this is declared via wchar.h, but the wide-character
> > curses.h
> > would include that, making the #include redundant.
>
> In theory, the header could use a private type like __wchar_t, I guess.
but only in theory, because the prototype is documented:
https://pubs.opengroup.org/onlinepubs/7908799/xcurses/addnwstr.html
> >> addnwstr(&wch, 1);],
> >> [AC_MSG_RESULT(yes)
> >> AC_DEFINE(HAVE_WIDE_CURSES, 1, [Defined if ncurses library includes
> >> wide character support])
> >> BOOL_WIDE_CURSES="true"],
> >> [AC_MSG_RESULT(no)])
> >>
> >> CURSES_HEADER in our builds is <ncursesw/curses.h>. But curiously, that
> >> does not declare define, only <curses.h> does. The symbol is defined in
> > ^^ not sure what you're indicating here
>
> I meant to write addnwstr.
>
> > But the wide-character features also (even for X/Open Curses) have
> > to have a symbol defined to declare them. There's a section in
> > the ncurses manpage mentioning that:
> >
> > • Alternatively, you can enable the feature by
> > defining
> > NCURSES_WIDECHAR with the caveat that some other header
> > file
> > than curses.h may require a specific value for
> > _XOPEN_SOURCE
> > (or a system-specific symbol).
> >
> > (actually, NetBSD doesn't require a symbol, but that's in the 60% which
> > it hasn't implemented yet :-)
yes... NetBSD has a few issues :-)
I have more notes than those on my webpage, but only so much time to document
them.
> Ahh, so I changed it to this:
>
> AC_TRY_LINK(
> [#include <wchar.h>
> #define NCURSES_WIDECHAR 1
> #include CURSES_HEADER
> ],
> [wchar_t wch = 0;
> addnwstr (&wch)],
> [AC_MSG_RESULT(yes)
> AC_DEFINE(HAVE_WIDE_CURSES, 1, [Defined if ncurses library includes
> wide character support])
> BOOL_WIDE_CURSES="true"],
> [AC_MSG_RESULT(no)])
>
> Just addding “#define NCURSES_WIDECHAR 1” (the 1 is significant). That
> seems to work—I now get a declaration of addnwstr.
>
> Thanks,
> Florian
>
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
signature.asc
Description: PGP signature