exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / localeinfo.h
blobc75d75f8366cc9ee3ffa3fdf6cde695789a9250f
1 /* locale information
3 Copyright 2016-2024 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
18 02110-1301, USA. */
20 /* Written by Paul Eggert. */
22 #include <limits.h>
23 #include <wchar.h>
24 #if GAWK
25 /* Use ISO C 99 API. */
26 # define char32_t wchar_t
27 #else
28 /* Use ISO C 11 + gnulib API. */
29 # include <uchar.h>
30 #endif
32 struct localeinfo
34 /* MB_CUR_MAX > 1. */
35 bool multibyte;
37 /* The locale is simple, like the C locale. These locales can be
38 processed more efficiently, as they are single-byte, their native
39 character set is in collating-sequence order, and they do not
40 have multi-character collating elements. */
41 bool simple;
43 /* The locale uses UTF-8. */
44 bool using_utf8;
46 /* An array indexed by byte values B that contains 1 if B is a
47 single-byte character, -1 if B is an encoding error, and -2 if B
48 is the leading byte of a multibyte character that contains more
49 than one byte. */
50 signed char sbclen[UCHAR_MAX + 1];
52 /* An array indexed by byte values B that contains the corresponding
53 32-bit wide character (if any) for B if sbclen[B] == 1. WEOF means
54 the byte is not a valid single-byte character, i.e., sbclen[B] == -1
55 or -2. */
56 wint_t sbctowc[UCHAR_MAX + 1];
59 extern void init_localeinfo (struct localeinfo *);
61 /* Maximum number of characters that can be the case-folded
62 counterparts of a single character, not counting the character
63 itself. This is a generous upper bound. */
64 enum { CASE_FOLDED_BUFSIZE = 32 };
66 extern int case_folded_counterparts (wint_t, char32_t[CASE_FOLDED_BUFSIZE]);