xref: /haiku/src/system/libroot/posix/glibc/locale/global-locale.c (revision 97f11716bfaa0f385eb0e28a52bf56a5023b9e99)
1*d338200eSTrung Nguyen /* Locale object representing the global locale controlled by setlocale.
2*d338200eSTrung Nguyen    Copyright (C) 2002-2019 Free Software Foundation, Inc.
3*d338200eSTrung Nguyen    This file is part of the GNU C Library.
4*d338200eSTrung Nguyen 
5*d338200eSTrung Nguyen    The GNU C Library is free software; you can redistribute it and/or
6*d338200eSTrung Nguyen    modify it under the terms of the GNU Lesser General Public
7*d338200eSTrung Nguyen    License as published by the Free Software Foundation; either
8*d338200eSTrung Nguyen    version 2.1 of the License, or (at your option) any later version.
9*d338200eSTrung Nguyen 
10*d338200eSTrung Nguyen    The GNU C Library is distributed in the hope that it will be useful,
11*d338200eSTrung Nguyen    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*d338200eSTrung Nguyen    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*d338200eSTrung Nguyen    Lesser General Public License for more details.
14*d338200eSTrung Nguyen 
15*d338200eSTrung Nguyen    You should have received a copy of the GNU Lesser General Public
16*d338200eSTrung Nguyen    License along with the GNU C Library; if not, see
17*d338200eSTrung Nguyen    <http://www.gnu.org/licenses/>.  */
18*d338200eSTrung Nguyen 
19*d338200eSTrung Nguyen #include <locale.h>
20*d338200eSTrung Nguyen #include "localeinfo.h"
21*d338200eSTrung Nguyen 
22*d338200eSTrung Nguyen #define DEFINE_CATEGORY(category, category_name, items, a) \
23*d338200eSTrung Nguyen extern struct locale_data _nl_C_##category;
24*d338200eSTrung Nguyen #include "categories.def"
25*d338200eSTrung Nguyen #undef        DEFINE_CATEGORY
26*d338200eSTrung Nguyen 
27*d338200eSTrung Nguyen /* Defined in locale/C-ctype.c.  */
28*d338200eSTrung Nguyen extern const char _nl_C_LC_CTYPE_class[];
29*d338200eSTrung Nguyen extern const char _nl_C_LC_CTYPE_toupper[];
30*d338200eSTrung Nguyen extern const char _nl_C_LC_CTYPE_tolower[];
31*d338200eSTrung Nguyen 
32*d338200eSTrung Nguyen /* Here we define the locale object maintained by setlocale.
33*d338200eSTrung Nguyen    The references in the initializer are weak, so the parts of
34*d338200eSTrung Nguyen    the structure that are never referred to will be zero.  */
35*d338200eSTrung Nguyen 
36*d338200eSTrung Nguyen struct __locale_struct _nl_global_locale =
37*d338200eSTrung Nguyen   {
38*d338200eSTrung Nguyen     .__locales =
39*d338200eSTrung Nguyen     {
40*d338200eSTrung Nguyen #define DEFINE_CATEGORY(category, category_name, items, a) \
41*d338200eSTrung Nguyen       [category] = &_nl_C_##category,
42*d338200eSTrung Nguyen #include "categories.def"
43*d338200eSTrung Nguyen #undef        DEFINE_CATEGORY
44*d338200eSTrung Nguyen     },
45*d338200eSTrung Nguyen     .__ctype_b = (const unsigned short int *) _nl_C_LC_CTYPE_class + 128,
46*d338200eSTrung Nguyen     .__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
47*d338200eSTrung Nguyen     .__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
48*d338200eSTrung Nguyen   };
49