1: /*
2: * Character mapping generated 04/29/11 15:43:58
3: *
4: * This file contains the character classifications
5: * used by AutoGen and AutoOpts for identifying tokens.
6: * This file is part of AutoGen.
7: * AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
8: * AutoGen is free software: you can redistribute it and/or modify it under the
9: * terms of the GNU General Public License as published by the Free Software
10: * Foundation, either version 3 of the License, or (at your option) any later
11: * version.
12: * AutoGen is distributed in the hope that it will be useful, but WITHOUT ANY
13: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14: * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15: * You should have received a copy of the GNU General Public License along
16: * with this program. If not, see <http://www.gnu.org/licenses/>.
17: */
18: #ifndef AG_CHAR_MAP_H_GUARD
19: #define AG_CHAR_MAP_H_GUARD 1
20:
21: #ifdef HAVE_CONFIG_H
22: # if defined(HAVE_INTTYPES_H)
23: # include <inttypes.h>
24: # elif defined(HAVE_STDINT_H)
25: # include <stdint.h>
26:
27: # else
28: # ifndef HAVE_INT8_T
29: typedef signed char int8_t;
30: # endif
31: # ifndef HAVE_UINT8_T
32: typedef unsigned char uint8_t;
33: # endif
34: # ifndef HAVE_INT16_T
35: typedef signed short int16_t;
36: # endif
37: # ifndef HAVE_UINT16_T
38: typedef unsigned short uint16_t;
39: # endif
40: # ifndef HAVE_UINT_T
41: typedef unsigned int uint_t;
42: # endif
43:
44: # ifndef HAVE_INT32_T
45: # if SIZEOF_INT == 4
46: typedef signed int int32_t;
47: # elif SIZEOF_LONG == 4
48: typedef signed long int32_t;
49: # endif
50: # endif
51:
52: # ifndef HAVE_UINT32_T
53: # if SIZEOF_INT == 4
54: typedef unsigned int uint32_t;
55: # elif SIZEOF_LONG == 4
56: typedef unsigned long uint32_t;
57: # endif
58: # endif
59: # endif /* HAVE_*INT*_H header */
60:
61: #else /* not HAVE_CONFIG_H -- */
62: # ifdef __sun
63: # include <inttypes.h>
64: # else
65: # include <stdint.h>
66: # endif
67: #endif /* HAVE_CONFIG_H */
68:
69: #if 0 /* mapping specification source (from autogen.map) */
70: //
71: // %guard autoopts_internal
72: // %file ag-char-map.h
73: // %static-table option-char-category
74: //
75: // %comment
76: // This file contains the character classifications
77: // used by AutoGen and AutoOpts for identifying tokens.
78: //
79: // This file is part of AutoGen.
80: // AutoGen Copyright (c) 1992-2011 by Bruce Korb - all rights reserved
81: //
82: // AutoGen is free software: you can redistribute it and/or modify it under the
83: // terms of the GNU General Public License as published by the Free Software
84: // Foundation, either version 3 of the License, or (at your option) any later
85: // version.
86: //
87: // AutoGen is distributed in the hope that it will be useful, but WITHOUT ANY
88: // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
89: // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
90: //
91: // You should have received a copy of the GNU General Public License along
92: // with this program. If not, see <http://www.gnu.org/licenses/>.
93: // %
94: //
95: // lower-case "a-z"
96: // upper-case "A-Z"
97: // alphabetic +lower-case +upper-case
98: // oct-digit "0-7"
99: // dec-digit "89" +oct-digit
100: // hex-digit "a-fA-F" +dec-digit
101: // alphanumeric +alphabetic +dec-digit
102: // var-first "_" +alphabetic
103: // variable-name +var-first +dec-digit
104: // option-name "^-" +variable-name
105: // value-name ":" +option-name
106: // horiz-white "\t "
107: // compound-name "[.]" +value-name +horiz-white
108: // whitespace "\v\f\r\n\b" +horiz-white
109: // unquotable "!-~" -"\"#(),;<=>[\\]`{}?*'"
110: // end-xml-token "/>" +whitespace
111: // graphic "!-~"
112: // plus-n-space "+" +whitespace
113: // punctuation "!-~" -alphanumeric -"_"
114: // suffix "-._" +alphanumeric
115: // suffix-fmt "%/" +suffix
116: // false-type "nNfF0\x00"
117: // file-name "/" +suffix
118: // end-token "\x00" +whitespace
119: // end-list-entry "," +end-token
120: //
121: #endif /* 0 -- mapping spec. source */
122:
123: typedef uint32_t option_char_category_mask_t;
124: static option_char_category_mask_t const option_char_category[128];
125:
126: static inline int is_option_char_category_char(char ch, option_char_category_mask_t mask) {
127: unsigned int ix = (unsigned char)ch;
128: return ((ix < 128) && ((option_char_category[ix] & mask) != 0)); }
129:
130: #define IS_LOWER_CASE_CHAR(_c) is_option_char_category_char((_c), 0x000001)
131: #define IS_UPPER_CASE_CHAR(_c) is_option_char_category_char((_c), 0x000002)
132: #define IS_ALPHABETIC_CHAR(_c) is_option_char_category_char((_c), 0x000003)
133: #define IS_OCT_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x000004)
134: #define IS_DEC_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x00000C)
135: #define IS_HEX_DIGIT_CHAR(_c) is_option_char_category_char((_c), 0x00001C)
136: #define IS_ALPHANUMERIC_CHAR(_c) is_option_char_category_char((_c), 0x00000F)
137: #define IS_VAR_FIRST_CHAR(_c) is_option_char_category_char((_c), 0x000023)
138: #define IS_VARIABLE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x00002F)
139: #define IS_OPTION_NAME_CHAR(_c) is_option_char_category_char((_c), 0x00006F)
140: #define IS_VALUE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x0000EF)
141: #define IS_HORIZ_WHITE_CHAR(_c) is_option_char_category_char((_c), 0x000100)
142: #define IS_COMPOUND_NAME_CHAR(_c) is_option_char_category_char((_c), 0x0003EF)
143: #define IS_WHITESPACE_CHAR(_c) is_option_char_category_char((_c), 0x000500)
144: #define IS_UNQUOTABLE_CHAR(_c) is_option_char_category_char((_c), 0x000800)
145: #define IS_END_XML_TOKEN_CHAR(_c) is_option_char_category_char((_c), 0x001500)
146: #define IS_GRAPHIC_CHAR(_c) is_option_char_category_char((_c), 0x002000)
147: #define IS_PLUS_N_SPACE_CHAR(_c) is_option_char_category_char((_c), 0x004500)
148: #define IS_PUNCTUATION_CHAR(_c) is_option_char_category_char((_c), 0x008000)
149: #define IS_SUFFIX_CHAR(_c) is_option_char_category_char((_c), 0x01000F)
150: #define IS_SUFFIX_FMT_CHAR(_c) is_option_char_category_char((_c), 0x03000F)
151: #define IS_FALSE_TYPE_CHAR(_c) is_option_char_category_char((_c), 0x040000)
152: #define IS_FILE_NAME_CHAR(_c) is_option_char_category_char((_c), 0x09000F)
153: #define IS_END_TOKEN_CHAR(_c) is_option_char_category_char((_c), 0x100500)
154: #define IS_END_LIST_ENTRY_CHAR(_c) is_option_char_category_char((_c), 0x300500)
155:
156: #if 1 /* def AUTOOPTS_INTERNAL */
157: static option_char_category_mask_t const option_char_category[128] = {
158: /*x00*/ 0x140000, /*x01*/ 0x000000, /*x02*/ 0x000000, /*x03*/ 0x000000,
159: /*x04*/ 0x000000, /*x05*/ 0x000000, /*x06*/ 0x000000, /*\a */ 0x000000,
160: /*\b */ 0x000400, /*\t */ 0x000100, /*\n */ 0x000400, /*\v */ 0x000400,
161: /*\f */ 0x000400, /*\r */ 0x000400, /*x0E*/ 0x000000, /*x0F*/ 0x000000,
162: /*x10*/ 0x000000, /*x11*/ 0x000000, /*x12*/ 0x000000, /*x13*/ 0x000000,
163: /*x14*/ 0x000000, /*x15*/ 0x000000, /*x16*/ 0x000000, /*x17*/ 0x000000,
164: /*x18*/ 0x000000, /*x19*/ 0x000000, /*x1A*/ 0x000000, /*x1B*/ 0x000000,
165: /*x1C*/ 0x000000, /*x1D*/ 0x000000, /*x1E*/ 0x000000, /*x1F*/ 0x000000,
166: /* */ 0x000100, /* ! */ 0x00A800, /* " */ 0x00A000, /* # */ 0x00A000,
167: /* $ */ 0x00A800, /* % */ 0x02A800, /* & */ 0x00A800, /* ' */ 0x00A000,
168: /* ( */ 0x00A000, /* ) */ 0x00A000, /* * */ 0x00A000, /* + */ 0x00E800,
169: /* , */ 0x20A000, /* - */ 0x01A840, /* . */ 0x01AA00, /* / */ 0x0AB800,
170: /* 0 */ 0x042804, /* 1 */ 0x002804, /* 2 */ 0x002804, /* 3 */ 0x002804,
171: /* 4 */ 0x002804, /* 5 */ 0x002804, /* 6 */ 0x002804, /* 7 */ 0x002804,
172: /* 8 */ 0x002808, /* 9 */ 0x002808, /* : */ 0x00A880, /* ; */ 0x00A000,
173: /* < */ 0x00A000, /* = */ 0x00A000, /* > */ 0x00B000, /* ? */ 0x00A000,
174: /* @ */ 0x00A800, /* A */ 0x002812, /* B */ 0x002812, /* C */ 0x002812,
175: /* D */ 0x002812, /* E */ 0x002812, /* F */ 0x042812, /* G */ 0x002802,
176: /* H */ 0x002802, /* I */ 0x002802, /* J */ 0x002802, /* K */ 0x002802,
177: /* L */ 0x002802, /* M */ 0x002802, /* N */ 0x042802, /* O */ 0x002802,
178: /* P */ 0x002802, /* Q */ 0x002802, /* R */ 0x002802, /* S */ 0x002802,
179: /* T */ 0x002802, /* U */ 0x002802, /* V */ 0x002802, /* W */ 0x002802,
180: /* X */ 0x002802, /* Y */ 0x002802, /* Z */ 0x002802, /* [ */ 0x00A200,
181: /* \ */ 0x00A000, /* ] */ 0x00A200, /* ^ */ 0x00A840, /* _ */ 0x012820,
182: /* ` */ 0x00A000, /* a */ 0x002811, /* b */ 0x002811, /* c */ 0x002811,
183: /* d */ 0x002811, /* e */ 0x002811, /* f */ 0x042811, /* g */ 0x002801,
184: /* h */ 0x002801, /* i */ 0x002801, /* j */ 0x002801, /* k */ 0x002801,
185: /* l */ 0x002801, /* m */ 0x002801, /* n */ 0x042801, /* o */ 0x002801,
186: /* p */ 0x002801, /* q */ 0x002801, /* r */ 0x002801, /* s */ 0x002801,
187: /* t */ 0x002801, /* u */ 0x002801, /* v */ 0x002801, /* w */ 0x002801,
188: /* x */ 0x002801, /* y */ 0x002801, /* z */ 0x002801, /* { */ 0x00A000,
189: /* | */ 0x00A800, /* } */ 0x00A000, /* ~ */ 0x00A800, /*x7F*/ 0x000000
190: };
191: #endif /* AUTOOPTS_INTERNAL */
192: #endif /* AG_CHAR_MAP_H_GUARD */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>