/* * 1 bit character mapping generated 04/16/12 10:12:44 * * char-mapper Character Classifications */ #ifndef TIMER_MAP_H_GUARD #define TIMER_MAP_H_GUARD 1 #ifdef HAVE_CONFIG_H # if defined(HAVE_INTTYPES_H) # include # elif defined(HAVE_STDINT_H) # include # elif !defined(HAVE_UINT8_T) typedef unsigned char uint8_t; # endif /* HAVE_*INT*_H header */ #else /* not HAVE_CONFIG_H -- */ # include #endif /* HAVE_CONFIG_H */ #if 0 /* mapping specification source (from timer-map.map) */ // // %guard // %file timer-map.h // %backup // // hash "#~" // #endif /* 0 -- mapping spec. source */ typedef uint8_t timer_map_mask_t; #define IS_HASH_CHAR( _c) is_timer_map_char((char)( _c), 0x01) #define SPN_HASH_CHARS(_s) spn_timer_map_chars((char *)_s, 0x01) #define BRK_HASH_CHARS(_s) brk_timer_map_chars((char *)_s, 0x01) #define SPN_HASH_BACK(s,e) spn_timer_map_back((char *)s, (char *)e, 0x01) #define BRK_HASH_BACK(s,e) brk_timer_map_back((char *)s, (char *)e, 0x01) static timer_map_mask_t const timer_map_table[128] = { /*NUL*/ 0x00, /*x01*/ 0x00, /*x02*/ 0x00, /*x03*/ 0x00, /*x04*/ 0x00, /*x05*/ 0x00, /*x06*/ 0x00, /*BEL*/ 0x00, /* BS*/ 0x00, /* HT*/ 0x00, /* NL*/ 0x00, /* VT*/ 0x00, /* FF*/ 0x00, /* CR*/ 0x00, /*x0E*/ 0x00, /*x0F*/ 0x00, /*x10*/ 0x00, /*x11*/ 0x00, /*x12*/ 0x00, /*x13*/ 0x00, /*x14*/ 0x00, /*x15*/ 0x00, /*x16*/ 0x00, /*x17*/ 0x00, /*x18*/ 0x00, /*x19*/ 0x00, /*x1A*/ 0x00, /*ESC*/ 0x00, /*x1C*/ 0x00, /*x1D*/ 0x00, /*x1E*/ 0x00, /*x1F*/ 0x00, /* */ 0x00, /* ! */ 0x00, /* " */ 0x00, /* # */ 0x01, /* $ */ 0x00, /* % */ 0x00, /* & */ 0x00, /* ' */ 0x00, /* ( */ 0x00, /* ) */ 0x00, /* * */ 0x00, /* + */ 0x00, /* , */ 0x00, /* - */ 0x00, /* . */ 0x00, /* / */ 0x00, /* 0 */ 0x00, /* 1 */ 0x00, /* 2 */ 0x00, /* 3 */ 0x00, /* 4 */ 0x00, /* 5 */ 0x00, /* 6 */ 0x00, /* 7 */ 0x00, /* 8 */ 0x00, /* 9 */ 0x00, /* : */ 0x00, /* ; */ 0x00, /* < */ 0x00, /* = */ 0x00, /* > */ 0x00, /* ? */ 0x00, /* @ */ 0x00, /* A */ 0x00, /* B */ 0x00, /* C */ 0x00, /* D */ 0x00, /* E */ 0x00, /* F */ 0x00, /* G */ 0x00, /* H */ 0x00, /* I */ 0x00, /* J */ 0x00, /* K */ 0x00, /* L */ 0x00, /* M */ 0x00, /* N */ 0x00, /* O */ 0x00, /* P */ 0x00, /* Q */ 0x00, /* R */ 0x00, /* S */ 0x00, /* T */ 0x00, /* U */ 0x00, /* V */ 0x00, /* W */ 0x00, /* X */ 0x00, /* Y */ 0x00, /* Z */ 0x00, /* [ */ 0x00, /* \ */ 0x00, /* ] */ 0x00, /* ^ */ 0x00, /* _ */ 0x00, /* ` */ 0x00, /* a */ 0x00, /* b */ 0x00, /* c */ 0x00, /* d */ 0x00, /* e */ 0x00, /* f */ 0x00, /* g */ 0x00, /* h */ 0x00, /* i */ 0x00, /* j */ 0x00, /* k */ 0x00, /* l */ 0x00, /* m */ 0x00, /* n */ 0x00, /* o */ 0x00, /* p */ 0x00, /* q */ 0x00, /* r */ 0x00, /* s */ 0x00, /* t */ 0x00, /* u */ 0x00, /* v */ 0x00, /* w */ 0x00, /* x */ 0x00, /* y */ 0x00, /* z */ 0x00, /* { */ 0x00, /* | */ 0x00, /* } */ 0x00, /* ~ */ 0x01, /*x7F*/ 0x00 }; static inline int is_timer_map_char(char ch, timer_map_mask_t mask) { unsigned int ix = (unsigned char)ch; return ((ix < 128) && ((timer_map_table[ix] & mask) != 0)); } static inline char * spn_timer_map_chars(char * p, timer_map_mask_t mask) { while ((*p != '\0') && is_timer_map_char(*p, mask)) p++; return p; } static inline char * brk_timer_map_chars(char * p, timer_map_mask_t mask) { while ((*p != '\0') && (! is_timer_map_char(*p, mask))) p++; return p; } static inline char * spn_timer_map_back(char * s, char * e, timer_map_mask_t mask) { if (s == e) e += strlen(e); while ((e > s) && is_timer_map_char(e[-1], mask)) e--; return e; } static inline char * brk_timer_map_back(char * s, char * e, timer_map_mask_t mask) { if (s == e) e += strlen(e); while ((e > s) && (! is_timer_map_char(e[-1], mask))) e--; return e; } #endif /* TIMER_MAP_H_GUARD */