Thu Nov 2 19:24:37 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / locale / lc-ctype.c
blob2384d17a39503983b9f70748d0a4c0c984cbdb85
1 /* Define current locale data for LC_CTYPE category.
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
20 #include "localeinfo.h"
21 #include <ctype.h>
22 #include <endian.h>
24 _NL_CURRENT_DEFINE (LC_CTYPE);
26 /* We are called after loading LC_CTYPE data to load it into
27 the variables used by the ctype.h macros.
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. */
33 void
34 _nl_postload_ctype (void)
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
43 #define paste(a,b) paste1(a,b)
44 #define paste1(a,b) a##b
46 #define current(unsigned,x) \
47 ((const unsigned int *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) \
48 + 128)
50 __ctype_b = current (unsigned short, CLASS);
51 __ctype_toupper = current (, bo (TOUPPER));
52 __ctype_tolower = current (, bo (TOLOWER));