1 /* Multibyte character data type.
2 Copyright (C) 2001, 2005-2007, 2009-2010 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program 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
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>. */
22 #if defined (HANDLE_MULTIBYTE)
26 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
28 BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
36 /* is_basic(c) tests whether the single-byte character c is in the
37 ISO C "basic character set". */
39 #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
40 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
41 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
42 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
43 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
44 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
45 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
46 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
47 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
48 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
49 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
50 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
51 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
52 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
53 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
54 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
55 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
56 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
57 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
58 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
59 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
60 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
61 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
62 /* The character set is ISO-646, not EBCDIC. */
63 # define IS_BASIC_ASCII 1
65 extern const unsigned int is_basic_table
[];
70 return (is_basic_table
[(unsigned char) c
>> 5] >> ((unsigned char) c
& 31))
81 case '\b': case '\r': case '\n':
82 case '\t': case '\v': case '\f':
83 case ' ': case '!': case '"': case '#': case '%':
84 case '&': case '\'': case '(': case ')': case '*':
85 case '+': case ',': case '-': case '.': case '/':
86 case '0': case '1': case '2': case '3': case '4':
87 case '5': case '6': case '7': case '8': case '9':
88 case ':': case ';': case '<': case '=': case '>':
90 case 'A': case 'B': case 'C': case 'D': case 'E':
91 case 'F': case 'G': case 'H': case 'I': case 'J':
92 case 'K': case 'L': case 'M': case 'N': case 'O':
93 case 'P': case 'Q': case 'R': case 'S': case 'T':
94 case 'U': case 'V': case 'W': case 'X': case 'Y':
96 case '[': case '\\': case ']': case '^': case '_':
97 case 'a': case 'b': case 'c': case 'd': case 'e':
98 case 'f': case 'g': case 'h': case 'i': case 'j':
99 case 'k': case 'l': case 'm': case 'n': case 'o':
100 case 'p': case 'q': case 'r': case 's': case 't':
101 case 'u': case 'v': case 'w': case 'x': case 'y':
102 case 'z': case '{': case '|': case '}': case '~':
111 #endif /* HANDLE_MULTIBYTE */
112 #endif /* _SHMBCHAR_H */