1/* ANSI-C code produced by gperf version 3.0.2 */ 2 3 4#if 0 /* gperf build options: */ 5// %struct-type 6// %language=ANSI-C 7// %includes 8// %global-table 9// %omit-struct-type 10// %readonly-tables 11// %compare-strncmp 12// 13// %define slot-name xat_name 14// %define hash-function-name xat_attribute_hash 15// %define lookup-function-name find_xat_attribute_name 16// %define word-array-name xat_attribute_table 17// %define initializer-suffix ,XAT_COUNT_KWD 18#endif /* gperf build options: */ 19 20#include "xat-attribute.h" 21 22typedef struct { 23 char const * xat_name; 24 xat_attribute_enum_t xat_id; 25} xat_attribute_map_t; 26#include <string.h> 27 28/* maximum key range = 9, duplicates = 0 */ 29 30#ifdef __GNUC__ 31#else 32#ifdef __cplusplus 33#endif 34#endif 35inline static unsigned int 36xat_attribute_hash (register const char *str, register unsigned int len) 37{ 38 static const unsigned char asso_values[] = 39 { 40 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 41 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 42 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 43 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 44 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 45 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 46 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 47 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 48 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 49 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, 50 13, 13, 13, 13, 13, 5, 13, 5, 13, 0, 51 13, 13, 13, 13, 13, 13, 0, 0, 13, 0, 52 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 53 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 54 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 55 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 56 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 57 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 58 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 59 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 60 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 61 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 62 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 63 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 64 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 65 13, 13, 13, 13, 13, 13 66 }; 67 return len + asso_values[(unsigned char)str[0]]; 68} 69 70static const xat_attribute_map_t xat_attribute_table[] = 71 { 72 {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD}, 73 {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD}, 74 {"type", XAT_KWD_TYPE}, 75 {"words", XAT_KWD_WORDS}, 76 {"cooked", XAT_KWD_COOKED}, 77 {"members", XAT_KWD_MEMBERS}, 78 {"uncooked", XAT_KWD_UNCOOKED}, 79 {"keep", XAT_KWD_KEEP}, 80 {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD}, 81 {"invalid", XAT_KWD_INVALID} 82 }; 83 84#ifdef __GNUC__ 85#endif 86static inline const xat_attribute_map_t * 87find_xat_attribute_name (register const char *str, register unsigned int len) 88{ 89 if (len <= 8 && len >= 4) 90 { 91 register int key = xat_attribute_hash (str, len); 92 93 if (key <= 12 && key >= 0) 94 { 95 register const char *s = xat_attribute_table[key].xat_name; 96 97 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') 98 return &xat_attribute_table[key]; 99 } 100 } 101 return 0; 102} 103 104 105xat_attribute_enum_t 106find_xat_attribute_id(char const * str, unsigned int len) 107{ 108 const xat_attribute_map_t * p = 109 find_xat_attribute_name(str, len); 110 return (p == 0) ? XAT_KWD_INVALID : p->xat_id; 111} 112