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