Updated to fedora-glibc-20041124T0741
[glibc.git] / sysdeps / unix / common / glue-ctype.c
blob2e065a77c93a16e93b0f2f703fdb271ce7ffe196
1 /* Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 /* Different systems have different names for the array.
20 This order is important for some systems. */
22 #if !defined(TABLE) && defined(HAVE__LOCP)
23 /* OSF/1 has the name _ctype defined as a macro, which points down into
24 the _locp structure. Jesus. We'll hope this works. We need to
25 check for LOCP first, since there is no symbol actually named _ctype
26 in their library. */
27 #include <sys/types.h> /* for wchar_t used by localdef.h */
28 #include <sys/localedef.h>
29 extern loc_t *_locp;
30 #define TABLE (_locp->lc_chrtbl)->lc_ctype
31 #undef _ctype
32 #define TABLE_NAME _ctype
33 #endif
34 #ifdef HAVE__CTYPE__
35 #define TABLE _ctype__
36 #endif
37 #if !defined(TABLE) && defined(HAVE__CTYPE)
38 #define TABLE _ctype
39 #endif
40 #if !defined(TABLE) && defined(HAVE__CTYPE_)
41 #define TABLE _ctype_
42 #endif
43 #if !defined(TABLE) && defined(HAVE___CTYPE_)
44 #define TABLE __ctype_
45 #endif
46 #if !defined(TABLE) && defined(HAVE___CTYPE)
47 #define TABLE __ctype
48 #endif
50 #if defined (__STDC__) && __STDC__
51 #define STRINGIFY(arg) #arg
52 #else
53 #define STRINGIFY(arg) "arg"
54 #endif
56 #define EVALLED_STRINGIFY(x) STRINGIFY (x)
58 int
59 main ()
61 #ifdef TABLE
63 int i;
65 #ifndef HAVE__LOCP
66 /* This won't work for the define to look into _locp. */
67 extern unsigned char TABLE[];
68 #endif
70 #ifdef TABLE_NAME
71 printf ("const unsigned char %s[] =\n {\n", EVALLED_STRINGIFY (TABLE_NAME));
72 #else
73 printf ("const unsigned char %s[] =\n {\n", EVALLED_STRINGIFY (TABLE));
74 #endif
76 for (i = -1; i < 256; ++i)
77 printf (" %d,\n", (int) ((TABLE+1)[i]));
79 puts (" };");
81 #else
83 puts ("/* I don't know what the ctype table is called on this system.");
84 puts (" If there is a table, and you want the ctype glue to work,");
85 puts (" edit configure.in and glue-ctype.c in sysdeps/unix/common/");
86 puts (" to check for the right name. */");
88 #endif
90 exit (0);