1 /* C code produced by gperf version 3.0.3 */ 2 /* Command-line: gperf -G -l -H type_hash -t -F ', 0' -N in_type_list -k '1,$' -W types type_hash.gperf */ 3 4 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ 5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ 6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ 7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ 8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ 9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ 10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ 11 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ 12 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ 13 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ 14 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ 15 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ 16 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ 17 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ 18 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ 19 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ 20 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ 21 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ 22 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ 23 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ 24 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ 25 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ 26 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) 27 /* The character set is not based on ISO-646. */ 28 error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." 29 #endif 30 31 #line 1 "type_hash.gperf" 32 33 /* Recognizes metric types. 34 * Build with: gperf -G -l -H type_hash -t -F ', 0' -N in_type_list -k 1,$ \ 35 * -W types ./type_hash.gperf > type_hash.c 36 */ 37 #include <gmetad.h> 38 #line 9 "type_hash.gperf" 39 struct type_tag; 40 41 #define TOTAL_KEYWORDS 10 42 #define MIN_WORD_LENGTH 4 43 #define MAX_WORD_LENGTH 9 44 #define MIN_HASH_VALUE 4 45 #define MAX_HASH_VALUE 21 46 /* maximum key range = 18, duplicates = 0 */ 47 48 #ifdef __GNUC__ 49 __inline 50 #else 51 #ifdef __cplusplus 52 inline 53 #endif 54 #endif 55 static unsigned int 56 type_hash (str, len) 57 register const char *str; 58 register unsigned int len; 59 { 60 static unsigned char asso_values[] = 61 { 62 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 63 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 64 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 65 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 66 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 67 10, 22, 22, 22, 5, 22, 0, 22, 22, 22, 68 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 69 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 70 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 71 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 72 10, 5, 15, 0, 22, 0, 22, 22, 22, 22, 73 22, 22, 0, 22, 22, 0, 0, 0, 22, 22, 74 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 75 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 76 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 77 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 78 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 79 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 80 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 81 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 82 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 83 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 84 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 85 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 86 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 87 22, 22, 22, 22, 22, 22 88 }; 89 return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; 90 } 91 92 static unsigned char lengthtable[] = 93 { 94 0, 0, 0, 0, 4, 5, 6, 0, 0, 9, 5, 6, 0, 0, 95 0, 5, 6, 0, 0, 0, 5, 6 96 }; 97 98 static struct type_tag types[] = 99 { 100 {"", 0}, {"", 0}, {"", 0}, {"", 0}, 101 #line 11 "type_hash.gperf" 102 {"int8", INT}, 103 #line 12 "type_hash.gperf" 104 {"uint8", UINT}, 105 #line 20 "type_hash.gperf" 106 {"string", STRING}, 107 {"", 0}, {"", 0}, 108 #line 19 "type_hash.gperf" 109 {"timestamp", TIMESTAMP}, 110 #line 13 "type_hash.gperf" 111 {"int16", INT}, 112 #line 14 "type_hash.gperf" 113 {"uint16", UINT}, 114 {"", 0}, {"", 0}, {"", 0}, 115 #line 15 "type_hash.gperf" 116 {"int32", INT}, 117 #line 16 "type_hash.gperf" 118 {"uint32", UINT}, 119 {"", 0}, {"", 0}, {"", 0}, 120 #line 17 "type_hash.gperf" 121 {"float", FLOAT}, 122 #line 18 "type_hash.gperf" 123 {"double", FLOAT} 124 }; 125 126 #ifdef __GNUC__ 127 __inline 128 #ifdef __GNUC_STDC_INLINE__ 129 __attribute__ ((__gnu_inline__)) 130 #endif 131 #endif 132 struct type_tag * 133 in_type_list (str, len) 134 register const char *str; 135 register unsigned int len; 136 { 137 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 138 { 139 register int key = type_hash (str, len); 140 141 if (key <= MAX_HASH_VALUE && key >= 0) 142 if (len == lengthtable[key]) 143 { 144 register const char *s = types[key].name; 145 146 if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) 147 return &types[key]; 148 } 149 } 150 return 0; 151 } 152