]>
Commit | Line | Data |
---|---|---|
933e73fa | 1 | /* Define current locale data for LC_CTYPE category. |
19bc17a9 | 2 | Copyright (C) 1995, 1996 Free Software Foundation, Inc. |
933e73fa RM |
3 | This file is part of the GNU C Library. |
4 | ||
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. | |
9 | ||
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. | |
14 | ||
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. */ | |
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 | ||
33 | void | |
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 | } |