]> git.ipfire.org Git - thirdparty/glibc.git/blame - locale/lc-ctype.c
Thu Mar 28 03:25:10 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
[thirdparty/glibc.git] / locale / lc-ctype.c
CommitLineData
933e73fa 1/* Define current locale data for LC_CTYPE category.
19bc17a9 2Copyright (C) 1995, 1996 Free Software Foundation, Inc.
933e73fa
RM
3This file is part of the GNU C Library.
4
5The GNU C Library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Library General Public License as
7published by the Free Software Foundation; either version 2 of the
8License, or (at your option) any later version.
9
10The GNU C Library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13Library General Public License for more details.
14
15You should have received a copy of the GNU Library General Public
16License along with the GNU C Library; see the file COPYING.LIB. If
17not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18Cambridge, MA 02139, USA. */
19
20#include "localeinfo.h"
21#include <ctype.h>
22#include <endian.h>
23
24_NL_CURRENT_DEFINE (LC_CTYPE);
25
26/* We are called after loading LC_CTYPE data to load it into
27 the variables used by the ctype.h macros.
28
29 There are three arrays of short ints which need to be indexable
30 from -128 to 255 inclusive. Stored in the locale data file are
31 a copy of each for each byte order. */
32
33void
34_nl_postload_ctype (void)
35{
36#if BYTE_ORDER == BIG_ENDIAN
37#define bo(x) x##_EB
38#elif BYTE_ORDER == LITTLE_ENDIAN
39#define bo(x) x##_EL
40#else
41#error bizarre byte order
42#endif
d8cc5f0c
RM
43#define paste(a,b) paste1(a,b)
44#define paste1(a,b) a##b
933e73fa
RM
45
46#define current(unsigned,x) \
d8cc5f0c 47 ((const unsigned int *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) \
933e73fa
RM
48 + 128)
49
19bc17a9
RM
50 extern const unsigned int *__ctype_names;
51
6c2f0507
RM
52 __ctype_b = current (unsigned short, CLASS);
53 __ctype_toupper = current (, bo (TOUPPER));
54 __ctype_tolower = current (, bo (TOLOWER));
19bc17a9 55 __ctype_names = current (unsigned, bo (NAMES));
933e73fa 56}