1/* 2 * Character mapping generated 11/08/09 08:41:19 3 * 4 * This file contains the character classifications 5 * used by AutoGen and AutoOpts for identifying tokens. 6 */ 7#ifndef AG_CHAR_MAP_H_GUARD 8#define AG_CHAR_MAP_H_GUARD 1 9 10#ifdef HAVE_CONFIG_H 11# if defined(HAVE_INTTYPES_H) 12# include <inttypes.h> 13# elif defined(HAVE_STDINT_H) 14# include <stdint.h> 15 16# else 17# ifndef HAVE_INT8_T 18 typedef signed char int8_t; 19# endif 20# ifndef HAVE_UINT8_T 21 typedef unsigned char uint8_t; 22# endif 23# ifndef HAVE_INT16_T 24 typedef signed short int16_t; 25# endif 26# ifndef HAVE_UINT16_T 27 typedef unsigned short uint16_t; 28# endif 29# ifndef HAVE_UINT_T 30 typedef unsigned int uint_t; 31# endif 32 33# ifndef HAVE_INT32_T 34# if SIZEOF_INT == 4 35 typedef signed int int32_t; 36# elif SIZEOF_LONG == 4 37 typedef signed long int32_t; 38# endif 39# endif 40 41# ifndef HAVE_UINT32_T 42# if SIZEOF_INT == 4 43 typedef unsigned int uint32_t; 44# elif SIZEOF_LONG == 4 45 typedef unsigned long uint32_t; 46# endif 47# endif 48# endif /* HAVE_*INT*_H header */ 49 50#else /* not HAVE_CONFIG_H -- */ 51# ifdef __sun 52# include <inttypes.h> 53# else 54# include <stdint.h> 55# endif 56#endif /* HAVE_CONFIG_H */ 57 58#if 0 /* mapping specification source (from autogen.map) */ 59// 60// %guard autoopts_internal 61// %file ag-char-map.h 62// %table opt-char-cat 63// 64// %comment 65// This file contains the character classifications 66// used by AutoGen and AutoOpts for identifying tokens. 67// % 68// 69// lower-case "a-z" 70// upper-case "A-Z" 71// alphabetic +lower-case +upper-case 72// oct-digit "0-7" 73// dec-digit "89" +oct-digit 74// hex-digit "a-fA-F" +dec-digit 75// alphanumeric +alphabetic +dec-digit 76// var-first "_" +alphabetic 77// variable-name +var-first +dec-digit 78// option-name "^-" +variable-name 79// value-name ":" +option-name 80// horiz-white "\t " 81// compound-name "[.]" +value-name +horiz-white 82// whitespace "\v\f\r\n\b" +horiz-white 83// unquotable "!-~" -"\"#(),;<=>[\\]`{}?*'" 84// end-xml-token "/>" +whitespace 85// graphic "!-~" 86// plus-n-space "+" +whitespace 87// punctuation "!-~" -alphanumeric -"_" 88// suffix "-._" +alphanumeric 89// suffix-fmt "%/" +suffix 90// false-type "nNfF0\x00" 91// 92#endif /* 0 -- mapping spec. source */ 93 94typedef uint32_t opt_char_cat_mask_t; 95extern opt_char_cat_mask_t const opt_char_cat[128]; 96 97static inline int is_opt_char_cat_char(char ch, opt_char_cat_mask_t mask) { 98 unsigned int ix = (unsigned char)ch; 99 return ((ix < 0x7F) && ((opt_char_cat[ix] & mask) != 0)); } 100 101#define IS_LOWER_CASE_CHAR(_c) is_opt_char_cat_char((_c), 0x00001) 102#define IS_UPPER_CASE_CHAR(_c) is_opt_char_cat_char((_c), 0x00002) 103#define IS_ALPHABETIC_CHAR(_c) is_opt_char_cat_char((_c), 0x00003) 104#define IS_OCT_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x00004) 105#define IS_DEC_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x0000C) 106#define IS_HEX_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x0001C) 107#define IS_ALPHANUMERIC_CHAR(_c) is_opt_char_cat_char((_c), 0x0000F) 108#define IS_VAR_FIRST_CHAR(_c) is_opt_char_cat_char((_c), 0x00023) 109#define IS_VARIABLE_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x0002F) 110#define IS_OPTION_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x0006F) 111#define IS_VALUE_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x000EF) 112#define IS_HORIZ_WHITE_CHAR(_c) is_opt_char_cat_char((_c), 0x00100) 113#define IS_COMPOUND_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x003EF) 114#define IS_WHITESPACE_CHAR(_c) is_opt_char_cat_char((_c), 0x00500) 115#define IS_UNQUOTABLE_CHAR(_c) is_opt_char_cat_char((_c), 0x00800) 116#define IS_END_XML_TOKEN_CHAR(_c) is_opt_char_cat_char((_c), 0x01500) 117#define IS_GRAPHIC_CHAR(_c) is_opt_char_cat_char((_c), 0x02000) 118#define IS_PLUS_N_SPACE_CHAR(_c) is_opt_char_cat_char((_c), 0x04500) 119#define IS_PUNCTUATION_CHAR(_c) is_opt_char_cat_char((_c), 0x08000) 120#define IS_SUFFIX_CHAR(_c) is_opt_char_cat_char((_c), 0x1000F) 121#define IS_SUFFIX_FMT_CHAR(_c) is_opt_char_cat_char((_c), 0x3000F) 122#define IS_FALSE_TYPE_CHAR(_c) is_opt_char_cat_char((_c), 0x40000) 123 124#ifdef AUTOOPTS_INTERNAL 125opt_char_cat_mask_t const opt_char_cat[128] = { 126 /*x00*/ 0x40000, /*x01*/ 0x00000, /*x02*/ 0x00000, /*x03*/ 0x00000, 127 /*x04*/ 0x00000, /*x05*/ 0x00000, /*x06*/ 0x00000, /*\a */ 0x00000, 128 /*\b */ 0x00400, /*\t */ 0x00100, /*\n */ 0x00400, /*\v */ 0x00400, 129 /*\f */ 0x00400, /*\r */ 0x00400, /*x0E*/ 0x00000, /*x0F*/ 0x00000, 130 /*x10*/ 0x00000, /*x11*/ 0x00000, /*x12*/ 0x00000, /*x13*/ 0x00000, 131 /*x14*/ 0x00000, /*x15*/ 0x00000, /*x16*/ 0x00000, /*x17*/ 0x00000, 132 /*x18*/ 0x00000, /*x19*/ 0x00000, /*x1A*/ 0x00000, /*x1B*/ 0x00000, 133 /*x1C*/ 0x00000, /*x1D*/ 0x00000, /*x1E*/ 0x00000, /*x1F*/ 0x00000, 134 /* */ 0x00100, /* ! */ 0x0A800, /* " */ 0x0A000, /* # */ 0x0A000, 135 /* $ */ 0x0A800, /* % */ 0x2A800, /* & */ 0x0A800, /* ' */ 0x0A000, 136 /* ( */ 0x0A000, /* ) */ 0x0A000, /* * */ 0x0A000, /* + */ 0x0E800, 137 /* , */ 0x0A000, /* - */ 0x1A840, /* . */ 0x1AA00, /* / */ 0x2B800, 138 /* 0 */ 0x42804, /* 1 */ 0x02804, /* 2 */ 0x02804, /* 3 */ 0x02804, 139 /* 4 */ 0x02804, /* 5 */ 0x02804, /* 6 */ 0x02804, /* 7 */ 0x02804, 140 /* 8 */ 0x02808, /* 9 */ 0x02808, /* : */ 0x0A880, /* ; */ 0x0A000, 141 /* < */ 0x0A000, /* = */ 0x0A000, /* > */ 0x0B000, /* ? */ 0x0A000, 142 /* @ */ 0x0A800, /* A */ 0x02812, /* B */ 0x02812, /* C */ 0x02812, 143 /* D */ 0x02812, /* E */ 0x02812, /* F */ 0x42812, /* G */ 0x02802, 144 /* H */ 0x02802, /* I */ 0x02802, /* J */ 0x02802, /* K */ 0x02802, 145 /* L */ 0x02802, /* M */ 0x02802, /* N */ 0x42802, /* O */ 0x02802, 146 /* P */ 0x02802, /* Q */ 0x02802, /* R */ 0x02802, /* S */ 0x02802, 147 /* T */ 0x02802, /* U */ 0x02802, /* V */ 0x02802, /* W */ 0x02802, 148 /* X */ 0x02802, /* Y */ 0x02802, /* Z */ 0x02802, /* [ */ 0x0A200, 149 /* \ */ 0x0A000, /* ] */ 0x0A200, /* ^ */ 0x0A840, /* _ */ 0x12820, 150 /* ` */ 0x0A000, /* a */ 0x02811, /* b */ 0x02811, /* c */ 0x02811, 151 /* d */ 0x02811, /* e */ 0x02811, /* f */ 0x42811, /* g */ 0x02801, 152 /* h */ 0x02801, /* i */ 0x02801, /* j */ 0x02801, /* k */ 0x02801, 153 /* l */ 0x02801, /* m */ 0x02801, /* n */ 0x42801, /* o */ 0x02801, 154 /* p */ 0x02801, /* q */ 0x02801, /* r */ 0x02801, /* s */ 0x02801, 155 /* t */ 0x02801, /* u */ 0x02801, /* v */ 0x02801, /* w */ 0x02801, 156 /* x */ 0x02801, /* y */ 0x02801, /* z */ 0x02801, /* { */ 0x0A000, 157 /* | */ 0x0A800, /* } */ 0x0A000, /* ~ */ 0x0A800, /*x7F*/ 0x00000 158}; 159#endif /* AUTOOPTS_INTERNAL */ 160#endif /* AG_CHAR_MAP_H_GUARD */ 161