3 /* ANSI-C code produced by gperf version 3.0.2 */
6 #if 0 /* gperf build options: */
15 // %define slot-name xat_name
16 // %define hash-function-name xat_attribute_hash
17 // %define lookup-function-name find_xat_attribute_name
18 // %define word-array-name xat_attribute_table
19 // %define initializer-suffix ,XAT_COUNT_KWD
20 #endif /* gperf build options: */
22 #include "xat-attribute.h"
25 char const * xat_name
;
26 xat_attribute_enum_t xat_id
;
27 } xat_attribute_map_t
;
30 /* maximum key range = 9, duplicates = 0 */
37 inline static unsigned int
38 xat_attribute_hash (register const char *str
, register unsigned int len
)
40 static const unsigned char asso_values
[] =
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, 13,
50 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
51 13, 13, 13, 13, 13, 13, 13, 13, 13, 0,
52 13, 13, 13, 13, 13, 5, 13, 5, 13, 0,
53 13, 13, 13, 13, 13, 13, 0, 0, 13, 0,
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, 13, 13, 13, 13,
66 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
67 13, 13, 13, 13, 13, 13
69 return len
+ asso_values
[(unsigned char)str
[0]];
72 static const xat_attribute_map_t xat_attribute_table
[] =
74 {"",XAT_COUNT_KWD
}, {"",XAT_COUNT_KWD
},
75 {"",XAT_COUNT_KWD
}, {"",XAT_COUNT_KWD
},
76 {"type", XAT_KWD_TYPE
},
77 {"words", XAT_KWD_WORDS
},
78 {"cooked", XAT_KWD_COOKED
},
79 {"members", XAT_KWD_MEMBERS
},
80 {"uncooked", XAT_KWD_UNCOOKED
},
81 {"keep", XAT_KWD_KEEP
},
82 {"",XAT_COUNT_KWD
}, {"",XAT_COUNT_KWD
},
83 {"invalid", XAT_KWD_INVALID
}
88 static inline const xat_attribute_map_t
*
89 find_xat_attribute_name (register const char *str
, register unsigned int len
)
91 if (len
<= 8 && len
>= 4)
93 register int key
= xat_attribute_hash (str
, len
);
95 if (key
<= 12 && key
>= 0)
97 register const char *s
= xat_attribute_table
[key
].xat_name
;
99 if (*str
== *s
&& !strncmp (str
+ 1, s
+ 1, len
- 1) && s
[len
] == '\0')
100 return &xat_attribute_table
[key
];
108 find_xat_attribute_id(char const * str
, unsigned int len
)
110 const xat_attribute_map_t
* p
=
111 find_xat_attribute_name(str
, len
);
112 return (p
== 0) ? XAT_KWD_INVALID
: p
->xat_id
;