Initial commit
[cgperf.git] / keyword.h
blobb4cbb4e55cbb4b30581207239cdb60deb29e3bed
1 #ifndef GPERF_KEYWORD_C
2 #define GPERF_KEYWORD_C
3 #include "c_fixing.h"
4 /*------------------------------------------------------------------------------------------------*/
5 #include "namespace/keyword.h"
6 #include "namespace/positions.h"
7 /*------------------------------------------------------------------------------------------------*/
8 /*{{{ global */
9 static u8 *empty_string = "";
10 /*}}} globals -- END */
11 /*------------------------------------------------------------------------------------------------*/
12 /*{{{ local */
13 static void sort_char_set(u32 *base, s32 len);
14 /*}}} local -- END */
15 /*------------------------------------------------------------------------------------------------*/
16 /*{{{ Keyword class */
17 /*{{{ constants and types */
18 struct Keyword {
19 /*----------------------------------------------------------------------------------------*/
20 /* data members defined immediately by the input file */
21 /* the keyword as a string, possibly containing NUL bytes */
22 u8 *allchars;
23 s32 allchars_length;
24 /* additional stuff seen on the same line of the input file */
25 u8 *rest;
26 /* line number of this keyword in the input file */
27 u32 lineno;
28 /*----------------------------------------------------------------------------------------*/
29 /* Ext: data members depending on the keyposition list */
31 * the selected characters that participate for the hash function,
32 * selected according to the keyposition list, as a canonically
33 * reordered multiset
35 u32 *selchars;
36 s32 selchars_length;
38 * Chained list of keywords having the same _selchars and
39 * - if !option[NOLENGTH] - also the same _allchars_length.
40 * Note that these duplicates are not members of the main keyword list
42 struct Keyword *duplicate_link;
43 /* data members used by the algorithm */
44 s32 hash_value; /* hash value for the keyword */
45 /* data members used by the output routines */
46 s32 final_index;
48 /*}}} constants and types -- END */
49 /*{{{ private static methods */
50 static u32 *kw_init_selchars_low(struct Keyword *t, struct Positions *positions, u32 *alpha_unify,
51 u32 *alpha_inc);
52 /*}}} private static methods */
53 /*{{{ public static methods */
54 static struct Keyword *kw_new(u8 *allchars, s32 allchars_length, u8 *rest, u32 lineno);
55 /* methods depending on the keyposition list */
56 static void kw_init_selchars_tuple(struct Keyword *t, struct Positions *positions,
57 u32 *alpha_unify);
58 static void kw_init_selchars_multiset(struct Keyword *t, struct Positions *positions,
59 u32 *alpha_unify, u32 *alpha_inc);
60 static void kw_delete_selchars(struct Keyword *t);
61 /*}}} public static methods -- END */
62 /*}}} Keyword class -- END */
63 #define EPILOG
64 #include "namespace/keyword.h"
65 #include "namespace/positions.h"
66 #undef EPILOG
67 /*------------------------------------------------------------------------------------------------*/
68 #endif