timevar: import from Bison.
[gnulib.git] / lib / localeinfo.h
blobfcd5311e616d77048a6d1fd6bc57ec18581ed2ef
1 /* locale information
3 Copyright 2016-2018 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 <stdbool.h>
24 #include <wchar.h>
26 struct localeinfo
28 /* MB_CUR_MAX > 1. */
29 bool multibyte;
31 /* The locale uses UTF-8. */
32 bool using_utf8;
34 /* An array indexed by byte values B that contains 1 if B is a
35 single-byte character, -1 if B is an encoding error, and -2 if B
36 is the leading byte of a multibyte character that contains more
37 than one byte. */
38 signed char sbclen[UCHAR_MAX + 1];
40 /* An array indexed by byte values B that contains the corresponding
41 wide character (if any) for B if sbclen[B] == 1. WEOF means the
42 byte is not a valid single-byte character, i.e., sbclen[B] == -1
43 or -2. */
44 wint_t sbctowc[UCHAR_MAX + 1];
47 extern void init_localeinfo (struct localeinfo *);
49 /* Maximum number of characters that can be the case-folded
50 counterparts of a single character, not counting the character
51 itself. This is a generous upper bound. */
52 enum { CASE_FOLDED_BUFSIZE = 32 };
54 extern int case_folded_counterparts (wint_t, wchar_t[CASE_FOLDED_BUFSIZE]);