1: /* ANSI-C code produced by gperf version 3.0.4 */
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:
22: typedef 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
35: inline static unsigned int
36: xat_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:
70: static 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: #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
86: __attribute__ ((__gnu_inline__))
87: #endif
88: #endif
89: static inline const xat_attribute_map_t *
90: find_xat_attribute_name (register const char *str, register unsigned int len)
91: {
92: if (len <= 8 && len >= 4)
93: {
94: register int key = xat_attribute_hash (str, len);
95:
96: if (key <= 12 && key >= 0)
97: {
98: register const char *s = xat_attribute_table[key].xat_name;
99:
100: if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
101: return &xat_attribute_table[key];
102: }
103: }
104: return 0;
105: }
106:
107:
108: xat_attribute_enum_t
109: find_xat_attribute_id(char const * str, unsigned int len)
110: {
111: const xat_attribute_map_t * p =
112: find_xat_attribute_name(str, len);
113: return (p == 0) ? XAT_KWD_INVALID : p->xat_id;
114: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>