Mail Archives: djgpp-workers/2007/09/02/04:52:18
On Sun, 02 Sep 2007 00:15:49 -0400, DJ Delorie <dj AT delorie DOT com> wrote:
>Er, my question was "if we include the macro, but ignore it, what
>happens to programs that expect the macro, and expect it to actually
>do something?"
>
>I don't propose including a full locale support in djgpp; we've always
>used dummy functions.
ISTM that LC_MESSAGES is an extension to ISO C required by POSIX, so
leaving it undefined is the simplest option, as it was(/is?) not
supported by some BSDs.
If we define it, we need some support, and my reading of POSIX
(OpenGroup) implies at least adding support for locale category
LC_MESSAGES, header nltypes.h
http://www.opengroup.org/onlinepubs/009695399/basedefs/nl_types.h.html
which includes types nl_catd and nl_item, constants NL_SETD and
NL_CAT_LOCALE, and functions catopen(), catclose(), catgets(); and
header langinfo.h
http://www.opengroup.org/onlinepubs/009695399/basedefs/langinfo.h.html
which includes all constants identifying accessible data items, function
nl_langinfo(), variables for yesexpr and noexpr (possibly also yesstr
and nostr for backwards compatibility, but now removed from the
standard).
The function catgets() can be dummied to return its final argument,
catclose() can return 0, and catopen() can return a dummy non-NULL
value.
Function nl_langinfo() has to return the appropriate info for all
constants identifying data items in the POSIX locale, and modules
modified to use those values to keep the definitions consistent
including those containing setlocale(), strcoll(), strxfrm(), tolower(),
toupper(), is*(), printf(), scanf(), strtod(), strftime().
ISTM supporting nl_langinfo() could be simplified by defining a global
locale structure, pointing to a global POSIX locale structure,
containing an array of pointers to locale category structures, each of
whose members are named char ptrs to the appropriate string constants
for the POSIX locale.
Are there any compatibly-licensed definitions we could use as a base for
this level of support of LC_MESSAGES in glibc, CygWin, BSD, or other
freeware products?
I notice there is a DJGPP contrib/catdoc package that supports returning
the DOS code page as the charset/CODESET item, CygWin/glibc supports 13
locale categories, and various DJGPP gnu ports support locales.
--
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada
- Raw text -