Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Initial commit | 4dead000f30ed99ab1b174116d39047db435c858 | Sylvain BERTRAND | 2021-07-12 17:34:23 |
File ABBREVIATIONS added (mode: 100644) (index 0000000..5b72180) | |||
1 | kw KeyWord | ||
2 | kwl KeyWord_List | ||
3 | opts OPTionS | ||
4 | pos POSition | ||
5 | positer POSitionITERator | ||
6 | posrevit POSitionREVerseITerator | ||
7 | posstrp POSitionSTRingParser | ||
8 | t This |
File CODING_STYLE added (mode: 100644) (index 0000000..82ea1f8) | |||
1 | - keep an eye on ABBREVIATIONS file (t is "this") | ||
2 | - names of complex types are mixed case-ed | ||
3 | - Indentation is tabs of 8 spaces, and we "prefer" lines of 100 chars which is | ||
4 | not a hard limit due to the depth of some brutal functions here and there |
File README added (mode: 100644) (index 0000000..84b1a92) | |||
1 | You should not use gperf anymore, very probably. It "may" be still usefull in | ||
2 | use cases with _very_ intensive, time/memory critical, and massive, _really_ | ||
3 | massive, keyword lists. And even there, you should seriously consider | ||
4 | alternatives which are saner and semantically optimized to your use case. And | ||
5 | nowadays we know that c++ is never a good idea: the elephant in the room is the | ||
6 | obvious c++ compiler implementation cost, which is a significant detriment to | ||
7 | foster "working" alternative compilers, not to mention it is very prone to the | ||
8 | rube goldberg machine syndrome. | ||
9 | |||
10 | Don't be a masochist trying to reverse engineer the heuristics from the code | ||
11 | first hand: Read gperfp.pdf before anything else. | ||
12 | |||
13 | This is a "port to _simple_ C89 with benign bits of c99/c11". It is a properly | ||
14 | namespace-ized (then "reuse-able" in any other project), "one compilation unit" | ||
15 | project: just compile all.c and link it to your libc and libm the way you want. | ||
16 | Of course, bugs were introduced while porting. |
File all.c added (mode: 100644) (index 0000000..77a9cbb) | |||
1 | #include "positions.c" | ||
2 | #include "options.c" | ||
3 | #include "keyword.c" | ||
4 | #include "keyword_list.c" | ||
5 | #include "input.c" | ||
6 | #include "getline.c" | ||
7 | #include "search.c" | ||
8 | #include "hash-table.c" | ||
9 | #include "hash.c" | ||
10 | #include "bool-array.c" | ||
11 | #include "output.c" | ||
12 | #include "main.c" |
File bool-array.c added (mode: 100644) (index 0000000..88f3c5a) | |||
1 | #ifndef CGPERF_BOOL_ARRAY_C | ||
2 | #define CGPERF_BOOL_ARRAY_C | ||
3 | #include <stdbool.h> | ||
4 | #include <stdlib.h> | ||
5 | #include <string.h> | ||
6 | #include "c_fixing.h" | ||
7 | #include "globals.h" | ||
8 | #include "options.h" | ||
9 | #include "bool-array.h" | ||
10 | /*------------------------------------------------------------------------------------------------*/ | ||
11 | #include "namespace/globals.h" | ||
12 | #include "namespace/options.h" | ||
13 | #include "namespace/bool-array.h" | ||
14 | /*------------------------------------------------------------------------------------------------*/ | ||
15 | /*{{{ ba_new */ | ||
16 | static struct Bool_Array *ba_new(u32 size) | ||
17 | { | ||
18 | struct Bool_Array *t; | ||
19 | |||
20 | t = calloc(1, sizeof(*t)); | ||
21 | t->size = size; | ||
22 | t->iteration_number = 1; | ||
23 | t->storage_array = calloc(size, sizeof(*(t->storage_array))); | ||
24 | if (OPTS(DEBUG)) | ||
25 | fprintf (stderr, "\nbool array size = %d, total bytes = %d\n", t->size, (u32)(t->size * sizeof(t->storage_array[0]))); | ||
26 | return t; | ||
27 | }/*}}}*/ | ||
28 | /*{{{ ba_del */ | ||
29 | static void ba_del(struct Bool_Array *t) | ||
30 | { | ||
31 | if (OPTS(DEBUG)) | ||
32 | fprintf(stderr, "\ndumping boolean array information\nsize = %d\niteration number = %d\nend of array dump\n", t->size, t->iteration_number); | ||
33 | free(t->storage_array); | ||
34 | free(t); | ||
35 | }/*}}}*/ | ||
36 | /*{{{ ba_clear */ | ||
37 | /* resets all bits to zero */ | ||
38 | static void ba_clear(struct Bool_Array *t) | ||
39 | { | ||
40 | /* | ||
41 | * If we wrap around it's time to zero things out again! However, this only occurs once | ||
42 | * about every 2^32 iterations, so it will not happen more frequently than once per second. | ||
43 | */ | ||
44 | ++(t->iteration_number); | ||
45 | if (t->iteration_number == 0) { | ||
46 | t->iteration_number = 1; | ||
47 | memset(t->storage_array, 0, t->size * sizeof(*(t->storage_array))); | ||
48 | if (OPTS(DEBUG)) { | ||
49 | fprintf(stderr, "(re-initialized bool_array)\n"); | ||
50 | fflush(stderr); | ||
51 | } | ||
52 | } | ||
53 | }/*}}}*/ | ||
54 | /*{{{ ba_set_bit */ | ||
55 | /* | ||
56 | * Sets the specified bit to true. | ||
57 | * Returns its previous value (false or true). | ||
58 | */ | ||
59 | static bool ba_set_bit(struct Bool_Array *t, u32 index) | ||
60 | { | ||
61 | if (t->storage_array[index] == t->iteration_number) | ||
62 | /* the bit was set since the last clear() call */ | ||
63 | return true; | ||
64 | else { | ||
65 | /* the last operation on this bit was clear(). Set it now. */ | ||
66 | t->storage_array[index] = t->iteration_number; | ||
67 | return false; | ||
68 | } | ||
69 | }/*}}}*/ | ||
70 | /*------------------------------------------------------------------------------------------------*/ | ||
71 | #define EPILOG | ||
72 | #include "namespace/globals.h" | ||
73 | #include "namespace/options.h" | ||
74 | #include "namespace/bool-array.h" | ||
75 | #undef EPILOG | ||
76 | /*------------------------------------------------------------------------------------------------*/ | ||
77 | #endif |
File bool-array.h added (mode: 100644) (index 0000000..9558589) | |||
1 | #ifndef CGPERF_BOOL_ARRAY_H | ||
2 | #define CGPERF_BOOL_ARRAY_H | ||
3 | #include "c_fixing.h" | ||
4 | /*------------------------------------------------------------------------------------------------*/ | ||
5 | #include "namespace/bool-array.h" | ||
6 | /*------------------------------------------------------------------------------------------------*/ | ||
7 | /*{{{ constants and types */ | ||
8 | struct Bool_Array { | ||
9 | /*{{{ private */ | ||
10 | /* size of array */ | ||
11 | u32 size; | ||
12 | /* | ||
13 | * Current iteration number. Always nonzero. Starts out as 1, and is | ||
14 | * incremented each time clear() is called. | ||
15 | */ | ||
16 | u32 iteration_number; | ||
17 | /* | ||
18 | * for each index, we store in storage_array[index] the | ||
19 | * iteration_number at the time set_bit(index) was last called | ||
20 | */ | ||
21 | u32 *storage_array; | ||
22 | /*}}} private -- END */ | ||
23 | }; | ||
24 | /*}}} constants and types -- END */ | ||
25 | /*{{{ public static methods */ | ||
26 | static struct Bool_Array *ba_new(u32 size); | ||
27 | static void ba_del(struct Bool_Array *t); | ||
28 | static void ba_clear(struct Bool_Array *t); | ||
29 | static bool ba_set_bit(struct Bool_Array *t, u32 index); | ||
30 | /*}}} public static methods -- END */ | ||
31 | /*------------------------------------------------------------------------------------------------*/ | ||
32 | #define EPILOG | ||
33 | #include "namespace/bool-array.h" | ||
34 | #undef EPILOG | ||
35 | /*------------------------------------------------------------------------------------------------*/ | ||
36 | #endif |
File c_fixing.h added (mode: 100644) (index 0000000..a581cb0) | |||
1 | #ifndef C_FIXING_H | ||
2 | #define C_FIXING_H | ||
3 | #include <stdint.h> | ||
4 | #include <limits.h> | ||
5 | #define u8 uint8_t | ||
6 | #define u32 uint32_t | ||
7 | #define U32_MIN UINT_MIN | ||
8 | #define U32_MAX UINT_MAX | ||
9 | #define u64 uint64_t | ||
10 | #define s32 int32_t | ||
11 | #define S32_MIN INT_MIN | ||
12 | #define S32_MAX INT_MAX | ||
13 | #define f32 float | ||
14 | #define f64 double | ||
15 | #define loop for(;;) | ||
16 | #endif |
File getline.c added (mode: 100644) (index 0000000..cae84c9) | |||
1 | #ifndef CGPERF_GETLINE_C | ||
2 | #define CGPERF_GETLINE_C | ||
3 | #include <stdio.h> | ||
4 | #include <stdlib.h> | ||
5 | #include <string.h> | ||
6 | #include <assert.h> | ||
7 | #include "c_fixing.h" | ||
8 | #include "getline.h" | ||
9 | /*------------------------------------------------------------------------------------------------*/ | ||
10 | #include "namespace/getline.h" | ||
11 | /*------------------------------------------------------------------------------------------------*/ | ||
12 | /*{{{ get_delim */ | ||
13 | static s32 get_delim(u8 **lineptr, u32 *n, s32 delimiter, FILE *stream) | ||
14 | { | ||
15 | return getstr(lineptr, n, stream, delimiter, 0); | ||
16 | }/*}}}*/ | ||
17 | /*{{{ getstr */ | ||
18 | /* always add at least this many bytes when extending the buffer */ | ||
19 | #define MIN_CHUNK 64 | ||
20 | /* Reads up to (and including) a TERMINATOR from STREAM into *LINEPTR + OFFSET | ||
21 | (and null-terminate it). *LINEPTR is a pointer returned from new [] (or | ||
22 | NULL), pointing to *N characters of space. It is realloc'd as | ||
23 | necessary. Returns the number of characters read (not including the | ||
24 | null terminator), or -1 on error or immediate EOF. | ||
25 | NOTE: There is another getstr() function declared in <curses.h>. */ | ||
26 | static s32 getstr(u8 **lineptr, u32 *n, FILE *stream, u8 terminator, | ||
27 | u32 offset) | ||
28 | { | ||
29 | u32 nchars_avail; /* allocated but unused chars in *LINEPTR */ | ||
30 | u8 *read_pos; /* Where we're reading into *LINEPTR. */ | ||
31 | |||
32 | if (!lineptr || !n || !stream) | ||
33 | return -1; | ||
34 | if (!*lineptr) { | ||
35 | *n = MIN_CHUNK; | ||
36 | *lineptr = calloc(*n, sizeof(u8)); | ||
37 | } | ||
38 | nchars_avail = *n - offset; | ||
39 | read_pos = *lineptr + offset; | ||
40 | loop { | ||
41 | s32 c; | ||
42 | |||
43 | c = getc(stream); | ||
44 | /* | ||
45 | * we always want at least one char left in the buffer, since we always (unless we | ||
46 | * get an error while reading the first char) NUL-terminate the line buffer | ||
47 | */ | ||
48 | assert(*n - nchars_avail == (u32)(read_pos - *lineptr)); | ||
49 | if (nchars_avail < 2) { | ||
50 | u8 *new_line; | ||
51 | |||
52 | if (*n > MIN_CHUNK) | ||
53 | *n *= 2; | ||
54 | else | ||
55 | *n += MIN_CHUNK; | ||
56 | |||
57 | nchars_avail = *n + *lineptr - read_pos; | ||
58 | new_line = calloc(*n, sizeof(u8)); | ||
59 | if (*lineptr != 0) { | ||
60 | memcpy(new_line, *lineptr, read_pos - *lineptr); | ||
61 | free(*lineptr); | ||
62 | } | ||
63 | *lineptr = new_line; | ||
64 | read_pos = *n - nchars_avail + *lineptr; | ||
65 | assert(*n - nchars_avail == (u32)(read_pos - *lineptr)); | ||
66 | } | ||
67 | if (c == EOF || ferror(stream)) { | ||
68 | /* return partial line, if any */ | ||
69 | if (read_pos == *lineptr) | ||
70 | return -1; | ||
71 | else | ||
72 | break; | ||
73 | } | ||
74 | *read_pos++ = c; | ||
75 | nchars_avail--; | ||
76 | |||
77 | if (c == terminator) | ||
78 | /* return the line */ | ||
79 | break; | ||
80 | } | ||
81 | /* done - NUL terminate and return the number of chars read */ | ||
82 | *read_pos = '\0'; | ||
83 | return read_pos - (*lineptr + offset); | ||
84 | } | ||
85 | #undef MIN_CHUNK | ||
86 | /*}}}*/ | ||
87 | /*------------------------------------------------------------------------------------------------*/ | ||
88 | #define EPILOG | ||
89 | #include "namespace/getline.h" | ||
90 | #undef EPILOG | ||
91 | /*------------------------------------------------------------------------------------------------*/ | ||
92 | #endif | ||
93 |
File getline.h added (mode: 100644) (index 0000000..3b2e9fe) | |||
1 | #ifndef CGPERF_GETLINE_H | ||
2 | #define CGPERF_GETLINE_H | ||
3 | #include <stdio.h> | ||
4 | #include "c_fixing.h" | ||
5 | /*------------------------------------------------------------------------------------------------*/ | ||
6 | #include "namespace/getline.h" | ||
7 | /*------------------------------------------------------------------------------------------------*/ | ||
8 | /*{{{ local */ | ||
9 | static s32 getstr(u8 **lineptr, u32 *n, FILE *stream, u8 terminator, | ||
10 | u32 offset); | ||
11 | /*}}}*/ | ||
12 | /*{{{ public */ | ||
13 | static s32 get_delim(u8 **lineptr, u32 *n, s32 delimiter, FILE *stream); | ||
14 | /*}}}*/ | ||
15 | /*------------------------------------------------------------------------------------------------*/ | ||
16 | #define EPILOG | ||
17 | #include "namespace/getline.h" | ||
18 | #undef EPILOG | ||
19 | /*------------------------------------------------------------------------------------------------*/ | ||
20 | #endif |
File globals.h added (mode: 100644) (index 0000000..0e9eb2b) | |||
1 | #ifndef CGPERF_GLOBALS_H | ||
2 | #define CGPERF_GLOBALS_H | ||
3 | #include "options.h" | ||
4 | /*----------------------------------------------------------------------------*/ | ||
5 | #include "namespace/globals.h" | ||
6 | #include "namespace/options.h" | ||
7 | /*----------------------------------------------------------------------------*/ | ||
8 | static struct Options *options; | ||
9 | /*----------------------------------------------------------------------------*/ | ||
10 | #define EPILOG | ||
11 | #include "namespace/globals.h" | ||
12 | #include "namespace/options.h" | ||
13 | #undef EPILOG | ||
14 | /*----------------------------------------------------------------------------*/ | ||
15 | #endif |
File gperf.pdf added (mode: 100644) (index 0000000..0b67e08) |
File hash-table.c added (mode: 100644) (index 0000000..2df4f0b) | |||
1 | #ifndef CGPERF_HASH_TABLE_C | ||
2 | #define CGPERF_HASH_TABLE_C | ||
3 | #include <stdbool.h> | ||
4 | #include <stdlib.h> | ||
5 | #include <string.h> | ||
6 | #include <stdio.h> | ||
7 | #include "c_fixing.h" | ||
8 | #include "keyword.h" | ||
9 | #include "hash-table.h" | ||
10 | #include "hash.h" | ||
11 | /*------------------------------------------------------------------------------------------------*/ | ||
12 | #include "namespace/hash-table.h" | ||
13 | #include "namespace/keyword.h" | ||
14 | #include "namespace/hash.h" | ||
15 | /*------------------------------------------------------------------------------------------------*/ | ||
16 | /*{{{ ht_new */ | ||
17 | /* | ||
18 | * We make the size of the hash table a power of 2. This allows for two optimizations: It eliminates | ||
19 | * the modulo instruction, and allows for an easy secondary hashing function. | ||
20 | */ | ||
21 | static struct Hash_Table *ht_new(u32 size, bool ignore_length) | ||
22 | { | ||
23 | struct Hash_Table *t; | ||
24 | u32 shift; | ||
25 | |||
26 | t = calloc(1, sizeof(*t)); | ||
27 | t->ignore_length = ignore_length; | ||
28 | |||
29 | /* there need to be enough spare entries */ | ||
30 | size = size * (u32)ht_size_factor; | ||
31 | |||
32 | /* find smallest power of 2 that is >= size */ | ||
33 | shift = 0; | ||
34 | if ((size >> 16) > 0) { | ||
35 | size = size >> 16; | ||
36 | shift += 16; | ||
37 | } | ||
38 | if ((size >> 8) > 0) { | ||
39 | size = size >> 8; | ||
40 | shift += 8; | ||
41 | } | ||
42 | if ((size >> 4) > 0) { | ||
43 | size = size >> 4; | ||
44 | shift += 4; | ||
45 | } | ||
46 | if ((size >> 2) > 0) { | ||
47 | size = size >> 2; | ||
48 | shift += 2; | ||
49 | } | ||
50 | if ((size >> 1) > 0) { | ||
51 | size = size >> 1; | ||
52 | shift += 1; | ||
53 | } | ||
54 | t->log_size = shift; | ||
55 | t->size = 1 << shift; | ||
56 | |||
57 | t->table = calloc(t->size, sizeof(*(t->table))); | ||
58 | return t; | ||
59 | }/*}}}*/ | ||
60 | /*{{{ ht_del */ | ||
61 | static void ht_del(struct Hash_Table *t) | ||
62 | { | ||
63 | free(t->table); | ||
64 | free(t); | ||
65 | }/*}}}*/ | ||
66 | /*{{{ ht_insert */ | ||
67 | /* | ||
68 | * Attempts to insert ITEM in the table. If there is already an equal entry in it, returns it. | ||
69 | * Otherwise inserts ITEM and returns NULL. | ||
70 | */ | ||
71 | static struct Keyword *ht_insert(struct Hash_Table *t, struct Keyword *item) | ||
72 | { | ||
73 | u32 hash_val; | ||
74 | u32 probe; | ||
75 | u32 increment; | ||
76 | |||
77 | hash_val = hashpjw((u8*)item->selchars, item->selchars_length * sizeof(u32)); | ||
78 | probe = hash_val & (t->size - 1); | ||
79 | increment = (((hash_val >> t->log_size) ^ (t->ignore_length ? 0 : item->allchars_length)) | ||
80 | << 1) + 1; | ||
81 | /* | ||
82 | * note that because _size is a power of 2 and increment is odd, we have | ||
83 | * gcd(increment,_size) = 1, which guarantees that we'll find an empty entry during the loop | ||
84 | */ | ||
85 | loop { | ||
86 | if (t->table[probe] == 0) | ||
87 | break; | ||
88 | if (ht_equal(t, t->table[probe], item)) | ||
89 | return t->table[probe]; | ||
90 | ++(t->collisions); | ||
91 | probe = (probe + increment) & (t->size - 1); | ||
92 | } | ||
93 | t->table[probe] = item; | ||
94 | return 0; | ||
95 | }/*}}}*/ | ||
96 | /*{{{ ht_equal */ | ||
97 | static bool ht_equal(struct Hash_Table *t, struct Keyword *item1, struct Keyword *item2) | ||
98 | { | ||
99 | return item1->selchars_length == item2->selchars_length | ||
100 | && memcmp(item1->selchars, item2->selchars, item1->selchars_length * sizeof(u32)) | ||
101 | == 0 | ||
102 | && (t->ignore_length || item1->allchars_length == item2->allchars_length); | ||
103 | }/*}}}*/ | ||
104 | /*{{{ ht_dump */ | ||
105 | static void ht_dump(struct Hash_Table *t) | ||
106 | { | ||
107 | s32 field_width; | ||
108 | s32 i; | ||
109 | |||
110 | field_width = 0; | ||
111 | { | ||
112 | s32 i; | ||
113 | |||
114 | i = t->size - 1; | ||
115 | loop { | ||
116 | if (i < 0) | ||
117 | break; | ||
118 | if (t->table[i] != 0) | ||
119 | if (field_width < t->table[i]->selchars_length) | ||
120 | field_width = t->table[i]->selchars_length; | ||
121 | i--; | ||
122 | } | ||
123 | } | ||
124 | fprintf(stderr, "\ndumping the hash table\ntotal available table slots = %d, total bytes = %d, total collisions = %d\nlocation, %*s, keyword\n", t->size, t->size * (u32)(sizeof(*(t->table))), t->collisions, field_width, "keysig"); | ||
125 | |||
126 | i = t->size - 1; | ||
127 | loop { | ||
128 | if (i < 0) | ||
129 | break; | ||
130 | if (t->table[i] != 0) { | ||
131 | s32 j; | ||
132 | |||
133 | fprintf(stderr, "%8d, ", i); | ||
134 | if (field_width > t->table[i]->selchars_length) | ||
135 | fprintf(stderr, "%*s", field_width - t->table[i]->selchars_length, ""); | ||
136 | j = 0; | ||
137 | loop { | ||
138 | if (j >= t->table[i]->selchars_length) | ||
139 | break; | ||
140 | putc(t->table[i]->selchars[j], stderr); | ||
141 | ++j; | ||
142 | } | ||
143 | fprintf(stderr, ", %.*s\n", t->table[i]->allchars_length, t->table[i]->allchars); | ||
144 | } | ||
145 | i--; | ||
146 | } | ||
147 | fprintf(stderr, "\nend dumping hash table\n\n"); | ||
148 | }/*}}}*/ | ||
149 | /*------------------------------------------------------------------------------------------------*/ | ||
150 | #define EPILOG | ||
151 | #include "namespace/hash-table.h" | ||
152 | #include "namespace/keyword.h" | ||
153 | #include "namespace/hash.h" | ||
154 | #undef EPILOG | ||
155 | /*------------------------------------------------------------------------------------------------*/ | ||
156 | #endif |
File hash-table.h added (mode: 100644) (index 0000000..1fb95e3) | |||
1 | #ifndef CGPERF_HASH_TABLE_H | ||
2 | #define CGPERF_HASH_TABLE_H | ||
3 | #include <stdbool.h> | ||
4 | #include "c_fixing.h" | ||
5 | #include "keyword.h" | ||
6 | /*------------------------------------------------------------------------------------------------*/ | ||
7 | #include "namespace/hash-table.h" | ||
8 | #include "namespace/keyword.h" | ||
9 | /*------------------------------------------------------------------------------------------------*/ | ||
10 | /*{{{ constants and types */ | ||
11 | /* to make double hashing efficient, there need to be enough spare entries */ | ||
12 | enum { | ||
13 | ht_size_factor = 10 | ||
14 | }; | ||
15 | struct Hash_Table { | ||
16 | /*{{{ private */ | ||
17 | /* a detail of the comparison function */ | ||
18 | bool ignore_length; | ||
19 | /* Statistics: Number of collisions so far. */ | ||
20 | u32 collisions; | ||
21 | /* log2(_size). */ | ||
22 | u32 log_size; | ||
23 | /* size of the vector */ | ||
24 | u32 size; | ||
25 | /* vector of entries */ | ||
26 | struct Keyword **table; | ||
27 | /*}}} private -- END */ | ||
28 | }; | ||
29 | /*}}} constants and types -- END */ | ||
30 | /*{{{ public static methods */ | ||
31 | static struct Hash_Table *ht_new(u32 size, bool ignore_length); | ||
32 | static void ht_del(struct Hash_Table *t); | ||
33 | static struct Keyword *ht_insert(struct Hash_Table *t, struct Keyword *item); | ||
34 | static void ht_dump(struct Hash_Table *t); | ||
35 | /*}}} public static methods -- END */ | ||
36 | /*{{{ private static methods */ | ||
37 | static bool ht_equal(struct Hash_Table *t, struct Keyword *item1, struct Keyword *item2); | ||
38 | /*}}} private static methods -- END */ | ||
39 | /*------------------------------------------------------------------------------------------------*/ | ||
40 | #define EPILOG | ||
41 | #include "namespace/hash-table.h" | ||
42 | #include "namespace/keyword.h" | ||
43 | #undef EPILOG | ||
44 | /*------------------------------------------------------------------------------------------------*/ | ||
45 | #endif |
File hash.c added (mode: 100644) (index 0000000..74114ad) | |||
1 | #ifndef CGPERF_HASH_C | ||
2 | #define CGPERF_HASH_C | ||
3 | #include "c_fixing.h" | ||
4 | /*------------------------------------------------------------------------------------------------*/ | ||
5 | #include "namespace/hash.h" | ||
6 | /*------------------------------------------------------------------------------------------------*/ | ||
7 | /* | ||
8 | * Some useful hash function. | ||
9 | * It's not a particularly good hash function (<< 5 would be better than << 4), but people believe | ||
10 | * in it because it comes from Dragon book. | ||
11 | */ | ||
12 | static u32 hashpjw(u8 *x, u32 len) /* From Dragon book, p436 */ | ||
13 | { | ||
14 | u32 h; | ||
15 | u32 g; | ||
16 | |||
17 | h = 0; | ||
18 | loop { | ||
19 | if (len <= 0) | ||
20 | break; | ||
21 | h = (h << 4) + *x++; | ||
22 | g = h & 0xf0000000; | ||
23 | if (g != 0) | ||
24 | h = (h ^ (g >> 24)) ^ g; | ||
25 | len--; | ||
26 | } | ||
27 | return h; | ||
28 | } | ||
29 | /*------------------------------------------------------------------------------------------------*/ | ||
30 | #define EPILOG | ||
31 | #include "namespace/hash.h" | ||
32 | #undef EPILOG | ||
33 | /*------------------------------------------------------------------------------------------------*/ | ||
34 | #endif |
File hash.h added (mode: 100644) (index 0000000..add7a1a) | |||
1 | #ifndef CGPERF_HASH_H | ||
2 | #define CGPERF_HASH_H | ||
3 | #include "c_fixing.h" | ||
4 | /*------------------------------------------------------------------------------------------------*/ | ||
5 | #include "namespace/hash.h" | ||
6 | /*------------------------------------------------------------------------------------------------*/ | ||
7 | static u32 hashpjw(u8 *string, u32 len); | ||
8 | /*------------------------------------------------------------------------------------------------*/ | ||
9 | #define EPILOG | ||
10 | #include "namespace/hash.h" | ||
11 | #undef EPILOG | ||
12 | /*------------------------------------------------------------------------------------------------*/ | ||
13 | #endif |
File input.c added (mode: 100644) (index 0000000..a6784a0) | |||
1 | #ifndef CGPERF_INPUT_C | ||
2 | #define CGPERF_INPUT_C | ||
3 | #include <stdbool.h> | ||
4 | #include <stdio.h> | ||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | #include "globals.h" | ||
8 | #include "keyword.h" | ||
9 | #include "input.h" | ||
10 | #include "getline.h" | ||
11 | #include "options.h" | ||
12 | #include "keyword.h" | ||
13 | #include "keyword_list.h" | ||
14 | /*------------------------------------------------------------------------------------------------*/ | ||
15 | #include "namespace/globals.h" | ||
16 | #include "namespace/input.h" | ||
17 | #include "namespace/input.c" | ||
18 | #include "namespace/keyword.h" | ||
19 | #include "namespace/getline.h" | ||
20 | #include "namespace/options.h" | ||
21 | #include "namespace/keyword.h" | ||
22 | #include "namespace/keyword_list.h" | ||
23 | /*------------------------------------------------------------------------------------------------*/ | ||
24 | /*{{{ local */ | ||
25 | /*{{{ pretty_input_file_name */ | ||
26 | /* returns a pretty representation of the input file name, for error and warning messages */ | ||
27 | static u8 *pretty_input_file_name(void) | ||
28 | { | ||
29 | u8 *fn; | ||
30 | |||
31 | fn = options->input_file_name; | ||
32 | if (fn != 0) | ||
33 | return fn; | ||
34 | else | ||
35 | return "(standard input)"; | ||
36 | }/*}}}*/ | ||
37 | /*{{{ is_define_declaration */ | ||
38 | /* | ||
39 | * Tests if the given line contains a "%define DECL ARG" declaration. If yes, it sets *ARGP to the | ||
40 | * argument, and returns true. Otherwise, it returns false. | ||
41 | */ | ||
42 | static bool is_define_declaration(u8 *line, u8 *line_end, u32 lineno, u8 *decl, u8 **argp) | ||
43 | { | ||
44 | u8 *d; | ||
45 | u8 *arg; | ||
46 | u8 *p; | ||
47 | /* skip '%' */ | ||
48 | ++line; | ||
49 | /* skip "define" */ | ||
50 | { | ||
51 | u8 *d; | ||
52 | d = "define"; | ||
53 | loop { | ||
54 | if (*d == 0) | ||
55 | break; | ||
56 | if (!(line < line_end)) | ||
57 | return false; | ||
58 | if (!(*line == *d)) | ||
59 | return false; | ||
60 | ++line; | ||
61 | ++d; | ||
62 | } | ||
63 | if (!(line < line_end && (*line == ' ' || *line == '\t'))) | ||
64 | return false; | ||
65 | } | ||
66 | /* skip whitespace */ | ||
67 | loop { | ||
68 | if (line >= line_end || !(*line == ' ' || *line == '\t')) | ||
69 | break; | ||
70 | ++line; | ||
71 | } | ||
72 | /* skip DECL */ | ||
73 | d = decl; | ||
74 | loop { | ||
75 | if (*d == 0) | ||
76 | break; | ||
77 | if (!(line < line_end)) | ||
78 | return false; | ||
79 | if (!(*line == *d || (*d == '-' && *line == '_'))) | ||
80 | return false; | ||
81 | ++line; | ||
82 | ++d; | ||
83 | } | ||
84 | if (line < line_end | ||
85 | && ((*line >= 'A' && *line <= 'Z') | ||
86 | || (*line >= 'a' && *line <= 'z') | ||
87 | || *line == '-' || *line == '_')) | ||
88 | return false; | ||
89 | /* OK, found DECL */ | ||
90 | /* skip whitespace */ | ||
91 | if (!(line < line_end && (*line == ' ' || *line == '\t'))) { | ||
92 | fprintf (stderr, "%s:%u: missing argument in %%define %s ARG declaration.\n", pretty_input_file_name(), lineno, decl); | ||
93 | exit(1); | ||
94 | } | ||
95 | loop { | ||
96 | ++line; | ||
97 | if (line >= line_end || !(*line == ' ' || *line == '\t')) | ||
98 | break; | ||
99 | } | ||
100 | /* The next word is the argument */ | ||
101 | arg = calloc(line_end - line + 1, sizeof(u8)); | ||
102 | p = arg; | ||
103 | loop { | ||
104 | if (line >= line_end || (*line == ' ' || *line == '\t' || *line == '\n')) | ||
105 | break; | ||
106 | *p++ = *line++; | ||
107 | } | ||
108 | *p = '\0'; | ||
109 | /* skip whitespace */ | ||
110 | loop { | ||
111 | if (line >= line_end || !(*line == ' ' || *line == '\t')) | ||
112 | break; | ||
113 | ++line; | ||
114 | } | ||
115 | /* expect end of line */ | ||
116 | if (line < line_end && *line != '\n') { | ||
117 | fprintf(stderr, "%s:%u: junk after declaration\n", pretty_input_file_name(), lineno); | ||
118 | exit(1); | ||
119 | } | ||
120 | *argp = arg; | ||
121 | return true; | ||
122 | }/*}}}*/ | ||
123 | /*{{{ is_declaration */ | ||
124 | /* returns true if the given line contains a "%DECL" declaration */ | ||
125 | static bool is_declaration(u8 *line, u8 *line_end, u32 lineno, u8 *decl) | ||
126 | { | ||
127 | u8 *d; | ||
128 | /* skip '%' */ | ||
129 | ++line; | ||
130 | /* skip DECL */ | ||
131 | d = decl; | ||
132 | loop { | ||
133 | if (*d == 0) | ||
134 | break; | ||
135 | if (!(line < line_end)) | ||
136 | return false; | ||
137 | if (!(*line == *d || (*d == '-' && *line == '_'))) | ||
138 | return false; | ||
139 | ++line; | ||
140 | ++d; | ||
141 | } | ||
142 | if (line < line_end | ||
143 | && ((*line >= 'A' && *line <= 'Z') | ||
144 | || (*line >= 'a' && *line <= 'z') | ||
145 | || *line == '-' || *line == '_')) | ||
146 | return false; | ||
147 | /* OK, found DECL. */ | ||
148 | /* skip whitespace */ | ||
149 | loop { | ||
150 | if (line >= line_end || !(*line == ' ' || *line == '\t')) | ||
151 | break; | ||
152 | ++line; | ||
153 | } | ||
154 | /* expect end of line */ | ||
155 | if (line < line_end && *line != '\n') { | ||
156 | fprintf(stderr, "%s:%u: junk after declaration\n", pretty_input_file_name(), lineno); | ||
157 | exit(1); | ||
158 | } | ||
159 | return true; | ||
160 | }/*}}}*/ | ||
161 | /*{{{ is_declaration_with_arg */ | ||
162 | /* | ||
163 | * Tests if the given line contains a "%DECL=ARG" declaration. If yes, it sets *ARGP to the | ||
164 | * argument, and returns true. Otherwise, it returns false | ||
165 | */ | ||
166 | static bool is_declaration_with_arg(u8 *line, u8 *line_end, u32 lineno, u8 *decl, u8 **argp) | ||
167 | { | ||
168 | u8 *d; | ||
169 | u8 *arg; | ||
170 | u8 *p; | ||
171 | /* skip '%' */ | ||
172 | ++line; | ||
173 | |||
174 | /* skip DECL */ | ||
175 | d = decl; | ||
176 | loop { | ||
177 | if (*d == 0) | ||
178 | break; | ||
179 | if (!(line < line_end)) | ||
180 | return false; | ||
181 | if (!(*line == *d || (*d == '-' && *line == '_'))) | ||
182 | return false; | ||
183 | ++line; | ||
184 | ++d; | ||
185 | } | ||
186 | if (line < line_end | ||
187 | && ((*line >= 'A' && *line <= 'Z') | ||
188 | || (*line >= 'a' && *line <= 'z') | ||
189 | || *line == '-' || *line == '_')) | ||
190 | return false; | ||
191 | /* OK, found DECL */ | ||
192 | /* skip '=' */ | ||
193 | if (!(line < line_end && *line == '=')) { | ||
194 | fprintf(stderr, "%s:%u: missing argument in %%%s=ARG declaration.\n", pretty_input_file_name(), lineno, decl); | ||
195 | exit(1); | ||
196 | } | ||
197 | ++line; | ||
198 | /* the next word is the argument */ | ||
199 | arg = calloc(line_end - line + 1, sizeof(u8)); | ||
200 | p = arg; | ||
201 | loop { | ||
202 | if (line >= line_end || (*line == ' ' || *line == '\t' || *line == '\n')) | ||
203 | break; | ||
204 | *p++ = *line++; | ||
205 | } | ||
206 | *p = '\0'; | ||
207 | /* skip whitespace */ | ||
208 | loop { | ||
209 | if (line >= line_end || !(*line == ' ' || *line == '\t')) | ||
210 | break; | ||
211 | ++line; | ||
212 | } | ||
213 | /* expect end of line */ | ||
214 | if (line < line_end && *line != '\n') { | ||
215 | fprintf(stderr, "%s:%u: junk after declaration\n", pretty_input_file_name(), lineno); | ||
216 | exit(1); | ||
217 | } | ||
218 | *argp = arg; | ||
219 | return true; | ||
220 | }/*}}}*/ | ||
221 | /*}}} local -- END */ | ||
222 | /*{{{ input_new */ | ||
223 | static struct Input *input_new(FILE *stream) | ||
224 | { | ||
225 | struct Input *t; | ||
226 | |||
227 | t = calloc(1, sizeof(*t)); | ||
228 | t->stream = stream; | ||
229 | return t; | ||
230 | }/*}}}*/ | ||
231 | /*{{{ input_del */ | ||
232 | static void input_del(struct Input *t) | ||
233 | { | ||
234 | free(t->return_type); | ||
235 | free(t->struct_tag); | ||
236 | free(t->struct_decl); | ||
237 | free(t); | ||
238 | }/*}}}*/ | ||
239 | /*{{{ input_read_input */ | ||
240 | static void input_read(struct Input *t) | ||
241 | { | ||
242 | /*{{{ documentation | ||
243 | The input file has the following structure: | ||
244 | DECLARATIONS | ||
245 | %% | ||
246 | KEYWORDS | ||
247 | %% | ||
248 | ADDITIONAL_CODE | ||
249 | Since the DECLARATIONS and the ADDITIONAL_CODE sections are optional, | ||
250 | we have to read the entire file in the case there is only one %% | ||
251 | separator line, in order to determine whether the structure is | ||
252 | DECLARATIONS | ||
253 | %% | ||
254 | KEYWORDS | ||
255 | or | ||
256 | KEYWORDS | ||
257 | %% | ||
258 | ADDITIONAL_CODE | ||
259 | When the option -t is given or when the first section contains | ||
260 | declaration lines starting with %, we go for the first interpretation, | ||
261 | otherwise for the second interpretation. }}}*/ | ||
262 | u8 *input; | ||
263 | u32 input_size; | ||
264 | s32 input_length; | ||
265 | u8 *input_end; | ||
266 | |||
267 | u8 *declarations; | ||
268 | u8 *declarations_end; | ||
269 | u8 *keywords; | ||
270 | u8 *keywords_end; | ||
271 | u32 keywords_lineno; | ||
272 | |||
273 | input = 0; | ||
274 | input_size = 0; | ||
275 | input_length = get_delim(&input, &input_size, EOF, t->stream); | ||
276 | if (input_length < 0) { | ||
277 | if (ferror(t->stream)) | ||
278 | fprintf(stderr, "%s: error while reading input file\n", pretty_input_file_name()); | ||
279 | else | ||
280 | fprintf(stderr, "%s: The input file is empty!\n", pretty_input_file_name()); | ||
281 | exit(1); | ||
282 | } | ||
283 | /* | ||
284 | * Convert CR/LF line terminators (Windows) to LF line terminators (Unix). GCC 3.3 and | ||
285 | * newer support CR/LF line terminators in C sources on Unix, so we do the same. | ||
286 | * The so-called "text mode" in stdio on Windows translates CR/LF to \n automatically, but | ||
287 | * here we also need this conversion on Unix. As a side effect, on Windows we also parse | ||
288 | * CR/CR/LF into a single \n, but this is not a problem | ||
289 | */ | ||
290 | { | ||
291 | u8 *p; | ||
292 | u8 *p_end; | ||
293 | u8 *q; | ||
294 | |||
295 | p = input; | ||
296 | p_end = input + input_length; | ||
297 | /* converting the initial segment without CRs is a no-op */ | ||
298 | loop { | ||
299 | if (p >= p_end || *p == '\r') | ||
300 | break; | ||
301 | ++p; | ||
302 | } | ||
303 | /* then start the conversion for real */ | ||
304 | q = p; | ||
305 | loop { | ||
306 | if (p >= p_end) | ||
307 | break; | ||
308 | if (p[0] == '\r' && p + 1 < p_end && p[1] == '\n') | ||
309 | ++p; | ||
310 | *q++ = *p++; | ||
311 | } | ||
312 | input_length = (s32)(q - input); | ||
313 | } | ||
314 | /* | ||
315 | * We use input_end as a limit, in order to cope with NUL bytes in the input. But note that | ||
316 | * one trailing NUL byte has been added after input_end, for convenience | ||
317 | */ | ||
318 | input_end = input + input_length; | ||
319 | /* break up the input into the three sections */ | ||
320 | { | ||
321 | u8 *separator[2]; | ||
322 | u32 separator_lineno[2]; | ||
323 | s32 separators; | ||
324 | bool has_declarations; | ||
325 | |||
326 | separator[0] = 0; | ||
327 | separator[1] = 0; | ||
328 | separator_lineno[0] = 0; | ||
329 | separator_lineno[1] = 0; | ||
330 | separators = 0; | ||
331 | { | ||
332 | u32 lineno; | ||
333 | u8 *p; | ||
334 | |||
335 | lineno = 1; | ||
336 | p = input; | ||
337 | loop { | ||
338 | if (p >= input_end) | ||
339 | break; | ||
340 | if (p[0] == '%' && p[1] == '%') { | ||
341 | separator[separators] = p; | ||
342 | separator_lineno[separators] = lineno; | ||
343 | ++separators; | ||
344 | if (separators == 2) | ||
345 | break; | ||
346 | } | ||
347 | ++lineno; | ||
348 | p = (u8*)memchr(p, '\n', input_end - p); | ||
349 | if (p != 0) | ||
350 | ++p; | ||
351 | else | ||
352 | p = input_end; | ||
353 | } | ||
354 | } | ||
355 | if (separators == 1) { | ||
356 | if (OPTS(TYPE)) | ||
357 | has_declarations = true; | ||
358 | else { | ||
359 | u8 *p; | ||
360 | |||
361 | has_declarations = false; | ||
362 | p = input; | ||
363 | loop { | ||
364 | if (p >= separator[0]) | ||
365 | break; | ||
366 | if (p[0] == '%') { | ||
367 | has_declarations = true; | ||
368 | break; | ||
369 | } | ||
370 | p = (u8*)memchr(p, '\n', | ||
371 | separator[0] - p); | ||
372 | if (p != 0) | ||
373 | ++p; | ||
374 | else | ||
375 | p = separator[0]; | ||
376 | } | ||
377 | } | ||
378 | } else | ||
379 | has_declarations = (separators > 0); | ||
380 | if (has_declarations) { | ||
381 | bool nonempty_line; | ||
382 | u8 *p; | ||
383 | |||
384 | declarations = input; | ||
385 | declarations_end = separator[0]; | ||
386 | /* give a warning if the separator line is nonempty */ | ||
387 | nonempty_line = false; | ||
388 | p = declarations_end + 2; | ||
389 | loop { | ||
390 | if (p >= input_end) | ||
391 | break; | ||
392 | if (*p == '\n') { | ||
393 | ++p; | ||
394 | break; | ||
395 | } | ||
396 | if (!(*p == ' ' || *p == '\t')) | ||
397 | nonempty_line = true; | ||
398 | ++p; | ||
399 | } | ||
400 | if (nonempty_line) | ||
401 | fprintf(stderr, "%s:%u: warning: junk after %%%% is ignored\n", pretty_input_file_name(), separator_lineno[0]); | ||
402 | keywords = p; | ||
403 | keywords_lineno = separator_lineno[0] + 1; | ||
404 | } else { | ||
405 | declarations = 0; | ||
406 | declarations_end = 0; | ||
407 | keywords = input; | ||
408 | keywords_lineno = 1; | ||
409 | } | ||
410 | if (separators > (has_declarations ? 1 : 0)) { | ||
411 | keywords_end = separator[separators - 1]; | ||
412 | t->verbatim_code = separator[separators - 1] + 2; | ||
413 | t->verbatim_code_end = input_end; | ||
414 | t->verbatim_code_lineno = separator_lineno[separators - 1]; | ||
415 | } else { | ||
416 | keywords_end = input_end; | ||
417 | t->verbatim_code = 0; | ||
418 | t->verbatim_code_end = 0; | ||
419 | t->verbatim_code_lineno = 0; | ||
420 | } | ||
421 | } | ||
422 | /* parse the declarations section */ | ||
423 | t->verbatim_declarations = 0; | ||
424 | t->verbatim_declarations_end = 0; | ||
425 | t->verbatim_declarations_lineno = 0; | ||
426 | t->struct_decl = 0; | ||
427 | t->struct_decl_lineno = 0; | ||
428 | t->return_type = 0; | ||
429 | t->struct_tag = 0; | ||
430 | { | ||
431 | u32 lineno; | ||
432 | u8 *struct_decl; | ||
433 | u32 *struct_decl_linenos; | ||
434 | u32 struct_decl_linecount; | ||
435 | u8 *line; | ||
436 | |||
437 | lineno = 1; | ||
438 | struct_decl = NULL; | ||
439 | struct_decl_linenos = NULL; | ||
440 | struct_decl_linecount = 0; | ||
441 | |||
442 | line = declarations; | ||
443 | loop { | ||
444 | u8 *line_end; | ||
445 | |||
446 | if (line >= declarations_end) | ||
447 | break; | ||
448 | line_end = (u8*)memchr(line, '\n', declarations_end - line); | ||
449 | if (line_end != 0) | ||
450 | ++line_end; | ||
451 | else | ||
452 | line_end = declarations_end; | ||
453 | |||
454 | if (*line == '%') { | ||
455 | if (line[1] == '{') { | ||
456 | /* handle %{ */ | ||
457 | if (t->verbatim_declarations != 0) { | ||
458 | fprintf(stderr, "%s:%u:\n%s:%u:only one %%{...%%} section is allowed\n", pretty_input_file_name(), t->verbatim_declarations_lineno, pretty_input_file_name(), lineno); | ||
459 | exit(1); | ||
460 | } | ||
461 | t->verbatim_declarations = line + 2; | ||
462 | t->verbatim_declarations_lineno = lineno; | ||
463 | } else if (line[1] == '}') { | ||
464 | /* handle %} */ | ||
465 | bool nonempty_line; | ||
466 | u8 *q; | ||
467 | if (t->verbatim_declarations == 0) { | ||
468 | fprintf(stderr, "%s:%u: %%} outside of %%{...%%} section\n", pretty_input_file_name(), lineno); | ||
469 | exit(1); | ||
470 | } | ||
471 | if (t->verbatim_declarations_end != 0) { | ||
472 | fprintf(stderr, "%s:%u: %%{...%%} section already closed\n", pretty_input_file_name(), lineno); | ||
473 | exit(1); | ||
474 | } | ||
475 | t->verbatim_declarations_end = line; | ||
476 | /* give a warning if the rest of the line is nonempty */ | ||
477 | nonempty_line = false; | ||
478 | q = line + 2; | ||
479 | loop { | ||
480 | if (q >= line_end) | ||
481 | break; | ||
482 | if (*q == '\n') { | ||
483 | ++q; | ||
484 | break; | ||
485 | } | ||
486 | if (!(*q == ' ' || *q == '\t')) | ||
487 | nonempty_line = true; | ||
488 | ++q; | ||
489 | } | ||
490 | if (nonempty_line) | ||
491 | fprintf(stderr, "%s:%u: warning: junk after %%} is ignored\n", pretty_input_file_name(), lineno); | ||
492 | } else if (t->verbatim_declarations != 0 | ||
493 | && t->verbatim_declarations_end == 0) { | ||
494 | fprintf (stderr, "%s:%u: warning: %% directives are ignored" " inside the %%{...%%} section\n", pretty_input_file_name(), lineno); | ||
495 | } else { | ||
496 | u8 *arg; | ||
497 | |||
498 | #define OPT_SET(x) options->option_word |= OPTS_##x | ||
499 | if (is_declaration_with_arg(line, line_end, lineno, "delimiters", &arg)) | ||
500 | opts_set_delimiters(options, arg); | ||
501 | else | ||
502 | |||
503 | if (is_declaration(line, line_end, lineno, "struct-type")) | ||
504 | OPT_SET(TYPE); | ||
505 | else | ||
506 | |||
507 | if (is_declaration(line, line_end, lineno, "ignore-case")) | ||
508 | OPT_SET(UPPERLOWER); | ||
509 | else | ||
510 | |||
511 | if (is_declaration_with_arg(line, line_end, lineno, "language", &arg)) | ||
512 | opts_set_language(options, arg); | ||
513 | else | ||
514 | |||
515 | if (is_define_declaration(line, line_end, lineno, "slot-name", &arg)) | ||
516 | opts_set_slot_name(options, arg); | ||
517 | else | ||
518 | |||
519 | if (is_define_declaration(line, line_end, lineno, "initializer-suffix", &arg)) | ||
520 | opts_set_initializer_suffix(options, arg); | ||
521 | else | ||
522 | |||
523 | if (is_define_declaration(line, line_end, lineno, "hash-function-name", &arg)) | ||
524 | opts_set_hash_name(options, arg); | ||
525 | else | ||
526 | |||
527 | if (is_define_declaration(line, line_end, lineno, "lookup-function-name", &arg)) | ||
528 | opts_set_function_name(options, arg); | ||
529 | else | ||
530 | |||
531 | if (is_define_declaration(line, line_end, lineno, "class-name", &arg)) | ||
532 | opts_set_class_name(options, arg); | ||
533 | else | ||
534 | |||
535 | if (is_declaration(line, line_end, lineno, "7bit")) | ||
536 | OPT_SET(SEVENBIT); | ||
537 | else | ||
538 | |||
539 | if (is_declaration(line, line_end, lineno, "compare-lengths")) | ||
540 | OPT_SET(LENTABLE); | ||
541 | else | ||
542 | |||
543 | if (is_declaration (line, line_end, lineno, "compare-strncmp")) | ||
544 | OPT_SET(COMP); | ||
545 | else | ||
546 | |||
547 | if (is_declaration(line, line_end, lineno, "readonly-tables")) | ||
548 | OPT_SET(CONST); | ||
549 | else | ||
550 | |||
551 | if (is_declaration(line, line_end, lineno, "enum")) | ||
552 | OPT_SET(ENUM); | ||
553 | else | ||
554 | |||
555 | if (is_declaration(line, line_end, lineno, "includes")) | ||
556 | OPT_SET(INCLUDE); | ||
557 | else | ||
558 | |||
559 | if (is_declaration(line, line_end, lineno, "global-table")) | ||
560 | OPT_SET(GLOBAL); | ||
561 | else | ||
562 | |||
563 | if (is_declaration(line, line_end, lineno, "pic")) | ||
564 | OPT_SET(SHAREDLIB); | ||
565 | else | ||
566 | |||
567 | if (is_define_declaration(line, line_end, lineno, "string-pool-name", &arg)) | ||
568 | opts_set_stringpool_name(options, arg); | ||
569 | else | ||
570 | |||
571 | if (is_declaration(line, line_end, lineno, "null-strings")) | ||
572 | OPT_SET(NULLSTRINGS); | ||
573 | else | ||
574 | |||
575 | if (is_define_declaration(line, line_end, lineno, "constants-prefix", &arg)) | ||
576 | opts_set_constants_prefix(options, arg); | ||
577 | else | ||
578 | |||
579 | if (is_define_declaration(line, line_end, lineno, "word-array-name", &arg)) | ||
580 | opts_set_wordlist_name(options, arg); | ||
581 | else | ||
582 | |||
583 | if (is_define_declaration(line, line_end, lineno, "length-table-name", &arg)) | ||
584 | opts_set_lengthtable_name(options, arg); | ||
585 | else | ||
586 | |||
587 | if (is_declaration_with_arg(line, line_end, lineno, "switch", &arg)) { | ||
588 | opts_set_total_switches(options, atoi(arg)); | ||
589 | if (options->total_switches <= 0) { | ||
590 | fprintf (stderr, "%s:%u: number of switches %s must be a positive number\n", pretty_input_file_name(), lineno, arg); | ||
591 | exit(1); | ||
592 | } | ||
593 | } | ||
594 | else | ||
595 | |||
596 | if (is_declaration(line, line_end, lineno, "omit-struct-type")) | ||
597 | OPT_SET(NOTYPE); | ||
598 | else { | ||
599 | fprintf (stderr, "%s:%u: unrecognized %% directive\n", pretty_input_file_name(), lineno); | ||
600 | exit(1); | ||
601 | } | ||
602 | #undef OPT_SET | ||
603 | } | ||
604 | } else if (!(t->verbatim_declarations != 0 | ||
605 | && t->verbatim_declarations_end == 0)) { | ||
606 | /* append the line to struct_decl */ | ||
607 | u32 old_len; | ||
608 | u32 line_len; | ||
609 | u32 new_len; | ||
610 | u8 *new_struct_decl; | ||
611 | u32 *new_struct_decl_linenos; | ||
612 | |||
613 | old_len = (struct_decl ? strlen(struct_decl) : 0); | ||
614 | line_len = line_end - line; | ||
615 | new_len = old_len + line_len + 1; | ||
616 | new_struct_decl = calloc(new_len, sizeof(u8)); | ||
617 | if (old_len > 0) | ||
618 | memcpy(new_struct_decl, struct_decl, old_len); | ||
619 | memcpy(new_struct_decl + old_len, line, line_len); | ||
620 | new_struct_decl[old_len + line_len] = '\0'; | ||
621 | if (struct_decl != 0) | ||
622 | free(struct_decl); | ||
623 | struct_decl = new_struct_decl; | ||
624 | /* append the lineno to struct_decl_linenos */ | ||
625 | new_struct_decl_linenos = calloc(struct_decl_linecount + 1, | ||
626 | sizeof(u32)); | ||
627 | if (struct_decl_linecount > 0) | ||
628 | memcpy(new_struct_decl_linenos, struct_decl_linenos, | ||
629 | struct_decl_linecount * sizeof(u32)); | ||
630 | new_struct_decl_linenos[struct_decl_linecount] = lineno; | ||
631 | if (struct_decl_linenos) | ||
632 | free(struct_decl_linenos); | ||
633 | struct_decl_linenos = new_struct_decl_linenos; | ||
634 | /* increment struct_decl_linecount */ | ||
635 | ++struct_decl_linecount; | ||
636 | } | ||
637 | ++lineno; | ||
638 | line = line_end; | ||
639 | } | ||
640 | if (t->verbatim_declarations != 0 && t->verbatim_declarations_end == 0) { | ||
641 | fprintf(stderr, "%s:%u: unterminated %%{ section\n", pretty_input_file_name(), t->verbatim_declarations_lineno); | ||
642 | exit(1); | ||
643 | } | ||
644 | /* determine _struct_decl, _return_type, _struct_tag */ | ||
645 | if (OPTS(TYPE)) { | ||
646 | u8 *p; | ||
647 | u32 struct_tag_length; | ||
648 | u8 *struct_tag; | ||
649 | u8 *return_type; | ||
650 | |||
651 | if (struct_decl != 0) { | ||
652 | /* drop leading whitespace and comments */ | ||
653 | { | ||
654 | u8 *p; | ||
655 | u32 *l; | ||
656 | |||
657 | p = struct_decl; | ||
658 | l = struct_decl_linenos; | ||
659 | loop { | ||
660 | if (p[0] == ' ' || p[0] == '\t') { | ||
661 | ++p; | ||
662 | continue; | ||
663 | } | ||
664 | if (p[0] == '\n') { | ||
665 | ++l; | ||
666 | ++p; | ||
667 | continue; | ||
668 | } | ||
669 | if (p[0] == '/') { | ||
670 | if (p[1] == '*') { | ||
671 | /* skip over ANSI C style comment */ | ||
672 | p += 2; | ||
673 | loop { | ||
674 | if (p[0] == '\0') | ||
675 | break; | ||
676 | if (p[0] == '*' | ||
677 | && p[1] == '/') { | ||
678 | p += 2; | ||
679 | break; | ||
680 | } | ||
681 | if (p[0] == '\n') | ||
682 | ++l; | ||
683 | ++p; | ||
684 | } | ||
685 | continue; | ||
686 | } | ||
687 | if (p[1] == '/') { | ||
688 | /* skip over ISO C99 or C++ style comment */ | ||
689 | p += 2; | ||
690 | loop { | ||
691 | if (p[0] == '\0' | ||
692 | || p[0] == '\n') | ||
693 | break; | ||
694 | ++p; | ||
695 | } | ||
696 | if (p[0] == '\n') { | ||
697 | ++l; | ||
698 | ++p; | ||
699 | } | ||
700 | continue; | ||
701 | } | ||
702 | } | ||
703 | break; | ||
704 | } | ||
705 | if (p != struct_decl) { | ||
706 | u32 len; | ||
707 | u8 *new_struct_decl; | ||
708 | |||
709 | len = strlen(p); | ||
710 | new_struct_decl = calloc(len + 1, sizeof(u8)); | ||
711 | memcpy(new_struct_decl, p, len + 1); | ||
712 | free(struct_decl); | ||
713 | struct_decl = new_struct_decl; | ||
714 | } | ||
715 | t->struct_decl_lineno = *l; | ||
716 | } | ||
717 | /* drop trailing whitespace */ | ||
718 | p = struct_decl + strlen(struct_decl); | ||
719 | loop { | ||
720 | if (p <= struct_decl) | ||
721 | break; | ||
722 | if (p[-1] == '\n' || p[-1] == ' ' || p[-1] == '\t') | ||
723 | *--p = '\0'; | ||
724 | else | ||
725 | break; | ||
726 | } | ||
727 | } | ||
728 | if (struct_decl == 0 || struct_decl[0] == '\0') { | ||
729 | fprintf (stderr, "%s: missing struct declaration for option --struct-type\n", pretty_input_file_name()); | ||
730 | exit(1); | ||
731 | } | ||
732 | { | ||
733 | /* ensure trailing semicolon */ | ||
734 | u32 old_len; | ||
735 | |||
736 | old_len = strlen(struct_decl); | ||
737 | if (struct_decl[old_len - 1] != ';') { | ||
738 | u8 *new_struct_decl; | ||
739 | |||
740 | new_struct_decl = calloc(old_len + 2, sizeof(u8)); | ||
741 | memcpy(new_struct_decl, struct_decl, old_len); | ||
742 | new_struct_decl[old_len] = ';'; | ||
743 | new_struct_decl[old_len + 1] = '\0'; | ||
744 | free(struct_decl); | ||
745 | struct_decl = new_struct_decl; | ||
746 | } | ||
747 | } | ||
748 | /* set _struct_decl to the entire declaration */ | ||
749 | t->struct_decl = struct_decl; | ||
750 | /* set _struct_tag to the naked "struct something" */ | ||
751 | p = struct_decl; | ||
752 | loop { | ||
753 | if (*p == 0 || *p == '{' || *p == ';' || *p == '\n') | ||
754 | break; | ||
755 | ++p; | ||
756 | } | ||
757 | loop { | ||
758 | if (p <= struct_decl) | ||
759 | break; | ||
760 | if (p[-1] == '\n' || p[-1] == ' ' || p[-1] == '\t') | ||
761 | p--; | ||
762 | else | ||
763 | break; | ||
764 | } | ||
765 | struct_tag_length = p - struct_decl; | ||
766 | struct_tag = calloc(struct_tag_length + 1, sizeof(u8)); | ||
767 | memcpy(struct_tag, struct_decl, struct_tag_length); | ||
768 | struct_tag[struct_tag_length] = '\0'; | ||
769 | t->struct_tag = struct_tag; | ||
770 | /* | ||
771 | * The return type of the lookup function is "struct something *". No | ||
772 | * "const" here, because if !option[CONST], some user code might want to | ||
773 | * modify the structure. | ||
774 | */ | ||
775 | return_type = calloc(struct_tag_length + 3, sizeof(u8)); | ||
776 | memcpy(return_type, struct_decl, struct_tag_length); | ||
777 | return_type[struct_tag_length] = ' '; | ||
778 | return_type[struct_tag_length + 1] = '*'; | ||
779 | return_type[struct_tag_length + 2] = '\0'; | ||
780 | t->return_type = return_type; | ||
781 | } | ||
782 | if (struct_decl_linenos != 0) | ||
783 | free(struct_decl_linenos); | ||
784 | } | ||
785 | /* parse the keywords section */ | ||
786 | { | ||
787 | struct Keyword_List **list_tail; | ||
788 | u8 *delimiters; | ||
789 | u32 lineno; | ||
790 | bool charset_dependent; | ||
791 | u8 *line; | ||
792 | |||
793 | list_tail = &t->head; | ||
794 | delimiters = options->delimiters; | ||
795 | lineno = keywords_lineno; | ||
796 | charset_dependent = false; | ||
797 | line = keywords; | ||
798 | loop { | ||
799 | u8 *line_end; | ||
800 | |||
801 | if (line >= keywords_end) | ||
802 | break; | ||
803 | line_end = memchr(line, '\n', keywords_end - line); | ||
804 | if (line_end != 0) | ||
805 | ++line_end; | ||
806 | else | ||
807 | line_end = keywords_end; | ||
808 | if (line[0] == '#') | ||
809 | ; /* comment line */ | ||
810 | else if (line[0] == '%') { | ||
811 | fprintf(stderr, "%s:%u: declarations are not allowed in the keywords section.\nTo declare a keyword starting with %%, enclose it in double-quotes.\n", pretty_input_file_name(), lineno); | ||
812 | exit(1); | ||
813 | } else { | ||
814 | /* an input line carrying a keyword */ | ||
815 | u8 *keyword; | ||
816 | u32 keyword_length; | ||
817 | u8 *rest; | ||
818 | struct Keyword *new_kw; | ||
819 | |||
820 | if (line[0] == '"') { | ||
821 | /* parse a string in ANSI C syntax */ | ||
822 | u8 *kp; | ||
823 | u8 *lp; | ||
824 | |||
825 | kp = calloc(line_end - line, sizeof(u8)); | ||
826 | keyword = kp; | ||
827 | lp = line + 1; | ||
828 | loop { | ||
829 | u8 c; | ||
830 | |||
831 | if (lp == line_end) { | ||
832 | fprintf(stderr, "%s:%u: unterminated string\n", pretty_input_file_name(), lineno); | ||
833 | exit(1); | ||
834 | } | ||
835 | c = *lp; | ||
836 | if (c == '\\') { | ||
837 | c = *++lp; | ||
838 | switch (c) { | ||
839 | case '0': case '1': case '2': case '3': | ||
840 | case '4': case '5': case '6': case '7':{ | ||
841 | s32 code; | ||
842 | s32 count; | ||
843 | |||
844 | code = 0; | ||
845 | count = 0; | ||
846 | loop { | ||
847 | if (count >= 3 || *lp == '0' || *lp > '7') | ||
848 | break; | ||
849 | code = (code << 3) + (*lp - '0'); | ||
850 | ++lp; | ||
851 | ++count; | ||
852 | } | ||
853 | if (code > UCHAR_MAX) | ||
854 | fprintf(stderr, "%s:%u: octal escape out of range\n", pretty_input_file_name(), lineno); | ||
855 | *kp = (u8)code; | ||
856 | break;} | ||
857 | case 'x':{ | ||
858 | s32 code; | ||
859 | s32 count; | ||
860 | |||
861 | code = 0; | ||
862 | count = 0; | ||
863 | ++lp; | ||
864 | loop { | ||
865 | if (!(*lp >= '0' && *lp <= '9') || !(*lp >= 'A' && *lp <= 'F') || !(*lp >= 'a' && *lp <= 'f')) | ||
866 | break; | ||
867 | code = (code << 4) | ||
868 | + (*lp >= 'A' && *lp <= 'F' | ||
869 | ? *lp - 'A' + 10 : | ||
870 | *lp >= 'a' && *lp <= 'f' | ||
871 | ? *lp - 'a' + 10 : | ||
872 | *lp - '0'); | ||
873 | ++lp; | ||
874 | ++count; | ||
875 | } | ||
876 | if (count == 0) | ||
877 | fprintf(stderr, "%s:%u: hexadecimal escape without any hex digits\n", pretty_input_file_name(), lineno); | ||
878 | if (code > UCHAR_MAX) | ||
879 | fprintf(stderr, "%s:%u: hexadecimal escape out of range\n", pretty_input_file_name(), lineno); | ||
880 | *kp = (u8)code; | ||
881 | break;} | ||
882 | case '\\': case '\'': case '"': | ||
883 | *kp = c; | ||
884 | ++lp; | ||
885 | charset_dependent = true; | ||
886 | break; | ||
887 | case 'n': | ||
888 | *kp = '\n'; | ||
889 | ++lp; | ||
890 | charset_dependent = true; | ||
891 | break; | ||
892 | case 't': | ||
893 | *kp = '\t'; | ||
894 | ++lp; | ||
895 | charset_dependent = true; | ||
896 | break; | ||
897 | case 'r': | ||
898 | *kp = '\r'; | ||
899 | ++lp; | ||
900 | charset_dependent = true; | ||
901 | break; | ||
902 | case 'f': | ||
903 | *kp = '\f'; | ||
904 | ++lp; | ||
905 | charset_dependent = true; | ||
906 | break; | ||
907 | case 'b': | ||
908 | *kp = '\b'; | ||
909 | ++lp; | ||
910 | charset_dependent = true; | ||
911 | break; | ||
912 | case 'a': | ||
913 | *kp = '\a'; | ||
914 | ++lp; | ||
915 | charset_dependent = true; | ||
916 | break; | ||
917 | case 'v': | ||
918 | *kp = '\v'; | ||
919 | ++lp; | ||
920 | charset_dependent = true; | ||
921 | break; | ||
922 | default: | ||
923 | fprintf(stderr, "%s:%u: invalid escape sequence in string\n", pretty_input_file_name(), lineno); | ||
924 | exit (1); | ||
925 | } | ||
926 | } else if (c == '"') | ||
927 | break; | ||
928 | else { | ||
929 | *kp = c; | ||
930 | ++lp; | ||
931 | charset_dependent = true; | ||
932 | } | ||
933 | ++kp; | ||
934 | } | ||
935 | ++lp; | ||
936 | if (lp < line_end && *lp != '\n') { | ||
937 | if (strchr(delimiters, *lp) == 0) { | ||
938 | fprintf(stderr, "%s:%u: string not followed by delimiter\n", pretty_input_file_name(), lineno); | ||
939 | exit (1); | ||
940 | } | ||
941 | ++lp; | ||
942 | } | ||
943 | keyword_length = kp - keyword; | ||
944 | if (OPTS(TYPE)) { | ||
945 | u8 *line_rest; | ||
946 | |||
947 | line_rest = calloc(line_end - lp + 1, sizeof(u8)); | ||
948 | memcpy(line_rest, lp, line_end - lp ); | ||
949 | line_rest[line_end - lp - (line_end > lp && line_end[-1] == '\n' ? 1 : 0)] = '\0'; | ||
950 | rest = line_rest; | ||
951 | } else | ||
952 | rest = empty_string; | ||
953 | } else { | ||
954 | /* Not a string. Look for the delimiter. */ | ||
955 | u8 *lp; | ||
956 | |||
957 | lp = line; | ||
958 | loop { | ||
959 | if (!(lp < line_end && *lp != '\n')) { | ||
960 | keyword = line; | ||
961 | keyword_length = lp - line; | ||
962 | rest = empty_string; | ||
963 | break; | ||
964 | } | ||
965 | if (strchr(delimiters, *lp) != 0) { | ||
966 | keyword = line; | ||
967 | keyword_length = lp - line; | ||
968 | ++lp; | ||
969 | if ((cgperf_options->option_word & OPTS_TYPE) != 0) { | ||
970 | u8 *line_rest; | ||
971 | |||
972 | line_rest = calloc(line_end - lp + 1, sizeof(u8)); | ||
973 | memcpy(line_rest, lp, line_end - lp); | ||
974 | line_rest[line_end - lp - (line_end > lp && line_end[-1] == '\n' ? 1 : 0)] = '\0'; | ||
975 | rest = line_rest; | ||
976 | } else | ||
977 | rest = empty_string; | ||
978 | break; | ||
979 | } | ||
980 | ++lp; | ||
981 | } | ||
982 | if (keyword_length > 0) | ||
983 | charset_dependent = true; | ||
984 | } | ||
985 | /* allocate Keyword and add it to the list */ | ||
986 | new_kw = kw_new(keyword, keyword_length, rest, lineno); | ||
987 | *list_tail = kwl_new(new_kw); | ||
988 | list_tail = &(*list_tail)->next; | ||
989 | } | ||
990 | ++lineno; | ||
991 | line = line_end; | ||
992 | } | ||
993 | *list_tail = 0; | ||
994 | if (t->head == 0) { | ||
995 | fprintf (stderr, "%s: No keywords in input file!\n", pretty_input_file_name()); | ||
996 | exit(1); | ||
997 | } | ||
998 | t->charset_dependent = charset_dependent; | ||
999 | } | ||
1000 | /* to be freed in the destructor */ | ||
1001 | t->input = input; | ||
1002 | t->input_end = input_end; | ||
1003 | }/*}}}*/ | ||
1004 | /*------------------------------------------------------------------------------------------------*/ | ||
1005 | #define EPILOG | ||
1006 | #include "namespace/globals.h" | ||
1007 | #include "namespace/input.h" | ||
1008 | #include "namespace/input.c" | ||
1009 | #include "namespace/keyword.h" | ||
1010 | #include "namespace/getline.h" | ||
1011 | #include "namespace/options.h" | ||
1012 | #include "namespace/keyword.h" | ||
1013 | #include "namespace/keyword_list.h" | ||
1014 | #undef EPILOG | ||
1015 | /*------------------------------------------------------------------------------------------------*/ | ||
1016 | #endif |
File input.h added (mode: 100644) (index 0000000..1e14807) | |||
1 | #ifndef CGPERF_INPUT_H | ||
2 | #define CGPERF_INPUT_H | ||
3 | #include <stdbool.h> | ||
4 | #include <stdio.h> | ||
5 | #include "c_fixing.h" | ||
6 | /*------------------------------------------------------------------------------------------------*/ | ||
7 | #include "namespace/input.h" | ||
8 | #include "namespace/keyword.h" | ||
9 | #include "namespace/keyword_list.h" | ||
10 | /*------------------------------------------------------------------------------------------------*/ | ||
11 | /*{{{ types */ | ||
12 | struct Input { | ||
13 | /*{{{ public */ | ||
14 | /* memory block containing the entire input */ | ||
15 | u8 *input; | ||
16 | u8 *input_end; | ||
17 | /* the C code from the declarations section */ | ||
18 | u8 *verbatim_declarations; | ||
19 | u8 *verbatim_declarations_end; | ||
20 | u32 verbatim_declarations_lineno; | ||
21 | /* the C code from the end of the file */ | ||
22 | u8 *verbatim_code; | ||
23 | u8 *verbatim_code_end; | ||
24 | u32 verbatim_code_lineno; | ||
25 | /* declaration of struct type for a keyword and its attributes */ | ||
26 | u8 *struct_decl; | ||
27 | u32 struct_decl_lineno; | ||
28 | /* return type of the lookup function */ | ||
29 | u8 *return_type; | ||
30 | /* shorthand for user-defined struct tag type */ | ||
31 | u8 *struct_tag; | ||
32 | /* list of all keywords */ | ||
33 | struct Keyword_List *head; | ||
34 | /* whether the keyword chars would have different values in a different character set */ | ||
35 | bool charset_dependent; | ||
36 | /*}}} public -- END */ | ||
37 | /*{{{ private */ | ||
38 | FILE *stream; | ||
39 | /*}}} prived -- END */ | ||
40 | }; | ||
41 | /*}}} types -- END */ | ||
42 | /*{{{ public static methods */ | ||
43 | static struct Input *input_new(FILE *stream); | ||
44 | static void input_read(struct Input *t); | ||
45 | /*}}} public static methos -- END */ | ||
46 | /*------------------------------------------------------------------------------------------------*/ | ||
47 | #define EPILOG | ||
48 | #include "namespace/input.h" | ||
49 | #include "namespace/keyword.h" | ||
50 | #include "namespace/keyword_list.h" | ||
51 | #undef EPILOG | ||
52 | /*------------------------------------------------------------------------------------------------*/ | ||
53 | #endif |
File keyword.c added (mode: 100644) (index 0000000..d7caf4e) | |||
1 | #ifndef CGPERF_KEYWORD_C | ||
2 | #define CGPERF_KEYWORD_C | ||
3 | #include <stdlib.h> | ||
4 | #include "c_fixing.h" | ||
5 | #include "keyword.h" | ||
6 | #include "positions.h" | ||
7 | /*------------------------------------------------------------------------------------------------*/ | ||
8 | #include "namespace/keyword.h" | ||
9 | #include "namespace/positions.h" | ||
10 | /*------------------------------------------------------------------------------------------------*/ | ||
11 | /*{{{ sort_char_set */ | ||
12 | /* sort a small set of 'unsigned int', base[0..len-1], in place */ | ||
13 | static void sort_char_set(u32 *base, s32 len) | ||
14 | { | ||
15 | s32 i; | ||
16 | |||
17 | /* bubble sort is sufficient here */ | ||
18 | i = 1; | ||
19 | loop { | ||
20 | s32 j; | ||
21 | u32 tmp; | ||
22 | |||
23 | if (i >= len) | ||
24 | break; | ||
25 | j = i; | ||
26 | tmp = base[j]; | ||
27 | loop { | ||
28 | if (j <= 0 || tmp >= base[j - 1]) | ||
29 | break; | ||
30 | base[j] = base[j - 1]; | ||
31 | j--; | ||
32 | } | ||
33 | base[j] = tmp; | ||
34 | ++i; | ||
35 | } | ||
36 | }/*}}}*/ | ||
37 | /*{{{ kw_new */ | ||
38 | static struct Keyword *kw_new(u8 *allchars, s32 allchars_length, u8 *rest, u32 lineno) | ||
39 | { | ||
40 | struct Keyword *t; | ||
41 | |||
42 | t = calloc(1, sizeof(*t)); | ||
43 | t->allchars = allchars; | ||
44 | t->allchars_length = allchars_length; | ||
45 | t->rest = rest; | ||
46 | t->lineno = lineno; | ||
47 | t->final_index = -1; | ||
48 | return t; | ||
49 | }/*}}}*/ | ||
50 | /*{{{ kw_init_selchars_low */ | ||
51 | /* Initializes selchars and selchars_length. | ||
52 | |||
53 | General idea: | ||
54 | The hash function will be computed as | ||
55 | asso_values[allchars[key_pos[0]]] + | ||
56 | asso_values[allchars[key_pos[1]]] + ... | ||
57 | We compute selchars as the multiset | ||
58 | { allchars[key_pos[0]], allchars[key_pos[1]], ... } | ||
59 | so that the hash function becomes | ||
60 | asso_values[selchars[0]] + asso_values[selchars[1]] + ... | ||
61 | Furthermore we sort the selchars array, to ease detection of duplicates | ||
62 | later. | ||
63 | |||
64 | More in detail: The arguments alpha_unify (used for case-insensitive | ||
65 | hash functions) and alpha_inc (used to disambiguate permutations) | ||
66 | apply slight modifications. The hash function will be computed as | ||
67 | sum (j=0,1,...: k = key_pos[j]: | ||
68 | asso_values[alpha_unify[allchars[k]+alpha_inc[k]]]) | ||
69 | + (allchars_length if !option[NOLENGTH], 0 otherwise). | ||
70 | We compute selchars as the multiset | ||
71 | { alpha_unify[allchars[k]+alpha_inc[k]] : j=0,1,..., k = key_pos[j] } | ||
72 | so that the hash function becomes | ||
73 | asso_values[selchars[0]] + asso_values[selchars[1]] + ... | ||
74 | + (allchars_length if !option[NOLENGTH], 0 otherwise). | ||
75 | */ | ||
76 | static u32 *kw_init_selchars_low(struct Keyword *t, struct Positions *positions, u32 *alpha_unify, | ||
77 | u32 *alpha_inc) | ||
78 | { | ||
79 | /* iterate through the list of positions, initializing selchars(via ptr) */ | ||
80 | struct PositionIterator *iter; | ||
81 | u32 *key_set; | ||
82 | u32 *ptr; | ||
83 | |||
84 | iter = pos_iterator(positions, t->allchars_length); | ||
85 | key_set = calloc(positer_remaining(iter), sizeof(*key_set)); | ||
86 | ptr = key_set; | ||
87 | |||
88 | loop { | ||
89 | s32 i; | ||
90 | u32 c; | ||
91 | |||
92 | i = positer_next(iter); | ||
93 | if (i == POSITER_EOS) | ||
94 | break; | ||
95 | |||
96 | if (i == POS_LASTCHAR) | ||
97 | /* special notation for last KEY position, i.e. '$' */ | ||
98 | c = (u8)(t->allchars[t->allchars_length - 1]); | ||
99 | else if (i < t->allchars_length) { | ||
100 | /* within range of KEY length, so we'll keep it */ | ||
101 | c = (u8)(t->allchars[i]); | ||
102 | if (alpha_inc != 0) | ||
103 | c += alpha_inc[i]; | ||
104 | } else | ||
105 | /* | ||
106 | * out of range of KEY length, the iterator should not | ||
107 | * have produced this | ||
108 | */ | ||
109 | abort(); | ||
110 | if (alpha_unify != 0) | ||
111 | c = alpha_unify[c]; | ||
112 | *ptr = c; | ||
113 | ++ptr; | ||
114 | } | ||
115 | t->selchars = key_set; | ||
116 | t->selchars_length = ptr - key_set; | ||
117 | positer_del(iter); | ||
118 | return key_set; | ||
119 | }/*}}}*/ | ||
120 | /*{{{ kw_init_selchars_tuple */ | ||
121 | static void kw_init_selchars_tuple(struct Keyword *t, struct Positions *positions, | ||
122 | u32 *alpha_unify) | ||
123 | { | ||
124 | kw_init_selchars_low(t, positions, alpha_unify, 0); | ||
125 | }/*}}}*/ | ||
126 | /*{{{ kw_delete_selchars */ | ||
127 | static void kw_delete_selchars(struct Keyword *t) | ||
128 | { | ||
129 | free(t->selchars); | ||
130 | }/*}}}*/ | ||
131 | /*{{{ kw_init_selchars_multiset */ | ||
132 | /* initializes selchars and selchars_length, with reordering */ | ||
133 | static void kw_init_selchars_multiset(struct Keyword *t, struct Positions *positions, | ||
134 | u32 *alpha_unify, u32 *alpha_inc) | ||
135 | { | ||
136 | u32 *selchars; | ||
137 | |||
138 | selchars = kw_init_selchars_low(t, positions, alpha_unify, alpha_inc); | ||
139 | /* sort the selchars elements alphabetically */ | ||
140 | sort_char_set(selchars, t->selchars_length); | ||
141 | }/*}}}*/ | ||
142 | /*------------------------------------------------------------------------------------------------*/ | ||
143 | #define EPILOG | ||
144 | #include "namespace/keyword.h" | ||
145 | #include "namespace/positions.h" | ||
146 | #undef EPILOG | ||
147 | /*------------------------------------------------------------------------------------------------*/ | ||
148 | #endif |
File keyword.h added (mode: 100644) (index 0000000..b4cbb4e) | |||
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 */ | ||
30 | /* | ||
31 | * the selected characters that participate for the hash function, | ||
32 | * selected according to the keyposition list, as a canonically | ||
33 | * reordered multiset | ||
34 | */ | ||
35 | u32 *selchars; | ||
36 | s32 selchars_length; | ||
37 | /* | ||
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 | ||
41 | */ | ||
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; | ||
47 | }; | ||
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 |
File keyword_list.c added (mode: 100644) (index 0000000..d636828) | |||
1 | #ifndef CGPERF_KEYWORD_LIST_C | ||
2 | #define CGPERF_KEYWORD_LIST_C | ||
3 | #include <stdlib.h> | ||
4 | |||
5 | #include "keyword.h" | ||
6 | #include "keyword_list.h" | ||
7 | /*------------------------------------------------------------------------------------------------*/ | ||
8 | #include "namespace/keyword.h" | ||
9 | #include "namespace/keyword_list.h" | ||
10 | /*------------------------------------------------------------------------------------------------*/ | ||
11 | /*{{{ kwl_new */ | ||
12 | static struct Keyword_List *kwl_new(struct Keyword *kw) | ||
13 | { | ||
14 | struct Keyword_List *t; | ||
15 | |||
16 | t = calloc(1, sizeof(*t)); | ||
17 | t->kw = kw; | ||
18 | return t; | ||
19 | }/*}}}*/ | ||
20 | /*{{{ kwextl_del */ | ||
21 | static void kwl_del(struct Keyword_List *t) | ||
22 | { | ||
23 | free(t); | ||
24 | }/*}}}*/ | ||
25 | /*{{{ delete_list */ | ||
26 | static void delete_list(struct Keyword_List *list) | ||
27 | { | ||
28 | loop { | ||
29 | struct Keyword_List *next; | ||
30 | |||
31 | if (list == 0) | ||
32 | break; | ||
33 | next = list->next; | ||
34 | kwl_del(list); | ||
35 | list = next; | ||
36 | } | ||
37 | }/*}}}*/ | ||
38 | /*{{{ copy_list_ext */ | ||
39 | static struct Keyword_List *copy_list(struct Keyword_List *list) | ||
40 | { | ||
41 | struct Keyword_List *result; | ||
42 | struct Keyword_List **lastp; | ||
43 | |||
44 | lastp = &result; | ||
45 | loop { | ||
46 | struct Keyword_List *new_cons; | ||
47 | |||
48 | if (list == 0) | ||
49 | break; | ||
50 | new_cons = kwl_new(list->kw); | ||
51 | *lastp = new_cons; | ||
52 | lastp = &new_cons->next; | ||
53 | list = list->next; | ||
54 | } | ||
55 | *lastp = 0; | ||
56 | return result; | ||
57 | }/*}}}*/ | ||
58 | /*{{{ mergesort_list */ | ||
59 | /* | ||
60 | * Sorts a linear list, given a comparison function. | ||
61 | * Note: This uses a variant of mergesort that is *not* a stable sorting algorithm. | ||
62 | */ | ||
63 | static struct Keyword_List *mergesort_list(struct Keyword_List *list, bool (*less)( | ||
64 | struct Keyword *kw1, struct Keyword *kw2)) | ||
65 | { | ||
66 | struct Keyword_List *middle; | ||
67 | struct Keyword_List *tmp; | ||
68 | struct Keyword_List *right_half; | ||
69 | |||
70 | if (list == 0 || list->next == 0) | ||
71 | /* List of length 0 or 1. Nothing to do. */ | ||
72 | return list; | ||
73 | middle = list; | ||
74 | tmp = list->next; | ||
75 | loop { | ||
76 | tmp = tmp->next; | ||
77 | if (tmp == 0) | ||
78 | break; | ||
79 | tmp = tmp->next; | ||
80 | middle = middle->next;; | ||
81 | if (tmp == 0) | ||
82 | break; | ||
83 | } | ||
84 | /* | ||
85 | * Cut the list into two halves. | ||
86 | * If the list has n elements, the left half has ceiling(n/2) elements and the right half | ||
87 | * has floor(n/2) elements. | ||
88 | */ | ||
89 | right_half = middle->next; | ||
90 | middle->next = 0; | ||
91 | return merge(mergesort_list(list, less), mergesort_list(right_half, less), less); | ||
92 | }/*}}}*/ | ||
93 | /*{{{ merge */ | ||
94 | static struct Keyword_List *merge(struct Keyword_List *list1, struct Keyword_List *list2, bool | ||
95 | (*less)(struct Keyword *kw1, struct Keyword *kw2)) | ||
96 | { | ||
97 | struct Keyword_List *result; | ||
98 | struct Keyword_List **resultp; | ||
99 | |||
100 | resultp = &result; | ||
101 | loop { | ||
102 | if (list1 == 0) { | ||
103 | *resultp = list2; | ||
104 | break; | ||
105 | } | ||
106 | if (list2 == 0) { | ||
107 | *resultp = list1; | ||
108 | break; | ||
109 | } | ||
110 | if (less(list2->kw, list1->kw)) { | ||
111 | *resultp = list2; | ||
112 | resultp = &list2->next; | ||
113 | /* | ||
114 | * We would have a stable sorting if the next line would read: list2 = | ||
115 | * *resultp; | ||
116 | */ | ||
117 | list2 = list1; | ||
118 | list2 = *resultp; | ||
119 | } else { | ||
120 | *resultp = list1; | ||
121 | resultp = &list1->next; | ||
122 | list1 = *resultp; | ||
123 | } | ||
124 | } | ||
125 | return result; | ||
126 | }/*}}}*/ | ||
127 | /*------------------------------------------------------------------------------------------------*/ | ||
128 | #define EPILOG | ||
129 | #include "namespace/keyword.h" | ||
130 | #include "namespace/keyword_list.h" | ||
131 | #undef EPILOG | ||
132 | /*------------------------------------------------------------------------------------------------*/ | ||
133 | #endif |
File keyword_list.h added (mode: 100644) (index 0000000..8ab4483) | |||
1 | #ifndef CGPERF_KEYWORD_LIST_H | ||
2 | #define CGPERF_KEYWORD_LIST_H | ||
3 | #include <stdbool.h> | ||
4 | |||
5 | #include "keyword.h" | ||
6 | /*------------------------------------------------------------------------------------------------*/ | ||
7 | #include "namespace/keyword.h" | ||
8 | #include "namespace/keyword_list.h" | ||
9 | /*------------------------------------------------------------------------------------------------*/ | ||
10 | /*{{{ Keyword_List */ | ||
11 | /*{{{ constants and types */ | ||
12 | struct Keyword_List { | ||
13 | struct Keyword *kw; | ||
14 | struct Keyword_List *next; | ||
15 | }; | ||
16 | /*}}} constants and types -- END */ | ||
17 | /*{{{ public static methods */ | ||
18 | static struct Keyword_List *kwl_new(struct Keyword *kw); | ||
19 | static void kwl_del(struct Keyword_List *t); | ||
20 | /*}}} public static methods -- END */ | ||
21 | /*{{{ global utils */ | ||
22 | static void delete_list(struct Keyword_List *list); | ||
23 | static struct Keyword_List *copy_list(struct Keyword_List *list); | ||
24 | static struct Keyword_List *mergesort_list(struct Keyword_List *list, bool (*less)( | ||
25 | struct Keyword *kw1, struct Keyword *kw2)); | ||
26 | static struct Keyword_List *merge(struct Keyword_List *list1, struct Keyword_List *list2, bool | ||
27 | (*less)(struct Keyword *kw1, struct Keyword *kw2)); | ||
28 | /*}}} global utils -- END */ | ||
29 | /*}}} Keyword_List -- END */ | ||
30 | /*------------------------------------------------------------------------------------------------*/ | ||
31 | #define EPILOG | ||
32 | #include "namespace/keyword.h" | ||
33 | #include "namespace/keyword_list.h" | ||
34 | #undef EPILOG | ||
35 | /*------------------------------------------------------------------------------------------------*/ | ||
36 | #endif |
File main.c added (mode: 100644) (index 0000000..a612045) | |||
1 | #ifndef CGPERF_MAIN_C | ||
2 | #define CGPERF_MAIN_C | ||
3 | #include <stdlib.h> | ||
4 | #include <string.h> | ||
5 | #include "globals.h" | ||
6 | #include "options.h" | ||
7 | #include "keyword.h" | ||
8 | #include "keyword_list.h" | ||
9 | #include "input.h" | ||
10 | #include "search.h" | ||
11 | #include "output.h" | ||
12 | /*------------------------------------------------------------------------------------------------*/ | ||
13 | #include "namespace/globals.h" | ||
14 | #include "namespace/options.h" | ||
15 | #include "namespace/keyword.h" | ||
16 | #include "namespace/keyword_list.h" | ||
17 | #include "namespace/input.h" | ||
18 | #include "namespace/search.h" | ||
19 | #include "namespace/output.h" | ||
20 | /*------------------------------------------------------------------------------------------------*/ | ||
21 | static void cgperf_init_once(void) | ||
22 | { | ||
23 | options = opts_new(); | ||
24 | } | ||
25 | static void cgperf_main_deinit_once(void) | ||
26 | { | ||
27 | opts_del(options); | ||
28 | } | ||
29 | int main(int argc, char **argv) | ||
30 | { | ||
31 | int exitcode; | ||
32 | |||
33 | cgperf_init_once(); | ||
34 | /* Set the Options. Open the input file and assign stdin to it. */ | ||
35 | opts_parse_options(options, (u32)argc, (u8**)argv); | ||
36 | |||
37 | /* open the input file */ | ||
38 | if (options->input_file_name != 0) | ||
39 | if (!freopen(options->input_file_name, "r", stdin)) { | ||
40 | fprintf(stderr, "Cannot open input file '%s'\n", options->input_file_name); | ||
41 | exit(1); | ||
42 | } | ||
43 | { | ||
44 | /* initialize the keyword list */ | ||
45 | struct Input *inputter; | ||
46 | struct Keyword_List *list; | ||
47 | |||
48 | inputter = input_new(stdin); | ||
49 | input_read(inputter); | ||
50 | /* | ||
51 | * we can cast the keyword list to KeywordExt_List* because its list elements were | ||
52 | * created by KeywordExt_Factory | ||
53 | */ | ||
54 | list = inputter->head; | ||
55 | { | ||
56 | struct Search *searcher; | ||
57 | |||
58 | searcher = schr_new(list); | ||
59 | schr_optimize(searcher); | ||
60 | list = searcher->head; | ||
61 | /* open the output file */ | ||
62 | if (options->output_file_name != 0) | ||
63 | if (strcmp(options->output_file_name, "-") != 0) | ||
64 | if (freopen(options->output_file_name, "w", stdout) == 0) { | ||
65 | fprintf(stderr, "Cannot open output file '%s'\n", options->output_file_name); | ||
66 | exit(1); | ||
67 | } | ||
68 | { | ||
69 | /* output the hash function code */ | ||
70 | struct Output *outputter; | ||
71 | outputter = output_new( | ||
72 | searcher->head, | ||
73 | inputter->struct_decl, | ||
74 | inputter->struct_decl_lineno, | ||
75 | inputter->return_type, | ||
76 | inputter->struct_tag, | ||
77 | inputter->verbatim_declarations, | ||
78 | inputter->verbatim_declarations_end, | ||
79 | inputter->verbatim_declarations_lineno, | ||
80 | inputter->verbatim_code, | ||
81 | inputter->verbatim_code_end, | ||
82 | inputter->verbatim_code_lineno, | ||
83 | inputter->charset_dependent, | ||
84 | searcher->total_keys, | ||
85 | searcher->max_key_len, | ||
86 | searcher->min_key_len, | ||
87 | searcher->hash_includes_len, | ||
88 | searcher->key_positions, | ||
89 | searcher->alpha_inc, | ||
90 | searcher->total_duplicates, | ||
91 | searcher->alpha_size, | ||
92 | searcher->asso_values); | ||
93 | output_do(outputter); | ||
94 | exitcode = 0; | ||
95 | if (fflush (stdout) || ferror (stdout)) { | ||
96 | fprintf(stderr, "error while writing output file\n"); | ||
97 | exitcode = 1; | ||
98 | } | ||
99 | /* here we run the Output destructor */ | ||
100 | output_del(outputter); | ||
101 | } | ||
102 | schr_del(searcher); | ||
103 | } | ||
104 | //TODO | ||
105 | input_del(inputter); | ||
106 | } | ||
107 | /* don't use exit() here, it skips the destructors */ | ||
108 | cgperf_main_deinit_once(); | ||
109 | return exitcode; | ||
110 | } | ||
111 | /*----------------------------------------------------------------------------*/ | ||
112 | #define EPILOG | ||
113 | #include "namespace/globals.h" | ||
114 | #include "namespace/options.h" | ||
115 | #include "namespace/keyword.h" | ||
116 | #include "namespace/keyword_list.h" | ||
117 | #include "namespace/input.h" | ||
118 | #include "namespace/search.h" | ||
119 | #undef EPILOG | ||
120 | /*----------------------------------------------------------------------------*/ | ||
121 | #endif |
File namespace/bool-array.h added (mode: 100644) (index 0000000..5fe324b) | |||
1 | #ifndef EPILOG | ||
2 | #define ba_clear cgperf_Bool_Array_clean | ||
3 | #define ba_del cgperf_Bool_Array_del | ||
4 | #define ba_new cgperf_Bool_Array_new | ||
5 | #define ba_set_bit cgperf_Bool_Array_set_bit | ||
6 | #define Bool_Array cgperf_Bool_Array | ||
7 | /*############################################################################*/ | ||
8 | #else /* EPILOG */ | ||
9 | #undef ba_clear | ||
10 | #undef ba_del | ||
11 | #undef ba_new | ||
12 | #undef ba_set_bit | ||
13 | #undef Bool_Array | ||
14 | #endif |
File namespace/getline.h added (mode: 100644) (index 0000000..529e9fa) | |||
1 | #ifndef EPILOG | ||
2 | #define get_delim cgperf_get_delim | ||
3 | #define getstr cgperf_getstr | ||
4 | /*############################################################################*/ | ||
5 | #else /* EPILOG */ | ||
6 | #undef get_delim | ||
7 | #undef getstr | ||
8 | #endif |
File namespace/globals.h added (mode: 100644) (index 0000000..38ed1c3) | |||
1 | #ifndef EPILOG | ||
2 | #define OPTS(x) ((cgperf_options->option_word & cgperf_OPTIONS_##x) != 0) | ||
3 | /*----------------------------------------------------------------------------*/ | ||
4 | #define options cgperf_options | ||
5 | /*############################################################################*/ | ||
6 | #else /* EPILOG */ | ||
7 | #undef OPTS | ||
8 | /*----------------------------------------------------------------------------*/ | ||
9 | #undef options | ||
10 | #endif |
File namespace/hash-table.h added (mode: 100644) (index 0000000..c166470) | |||
1 | #ifndef EPILOG | ||
2 | #define Hash_Table cgperf_Hash_Table | ||
3 | #define ht_del cgperf_Hash_Table_del | ||
4 | #define ht_dump cgperf_Hash_Table_dump | ||
5 | #define ht_equal cgperf_Hash_Table_equal | ||
6 | #define ht_insert cgperf_Hash_Table_insert | ||
7 | #define ht_new cgperf_Hash_Table_new | ||
8 | #define ht_size_factor cgperf_Hash_Table_size_factor | ||
9 | /*############################################################################*/ | ||
10 | #else /* EPILOG */ | ||
11 | #undef Hash_Table | ||
12 | #undef ht_new | ||
13 | #undef ht_del | ||
14 | #undef ht_dump | ||
15 | #undef ht_equal | ||
16 | #undef ht_insert | ||
17 | #undef ht_size_factor | ||
18 | #endif |
File namespace/hash.h added (mode: 100644) (index 0000000..22c76c6) | |||
1 | #ifndef EPILOG | ||
2 | #define hashpjw cgperf_hashpjw | ||
3 | /*############################################################################*/ | ||
4 | #else /* EPILOG */ | ||
5 | #undef hashpjw | ||
6 | #endif |
File namespace/input.c added (mode: 100644) (index 0000000..1ea190d) | |||
1 | #ifndef EPILOG | ||
2 | #define is_declaration cgperf_is_declaration | ||
3 | #define is_declaration_with_arg cgperf_is_declaration_with_arg | ||
4 | #define is_define_declaration cgperf_is_define_declaration | ||
5 | #define pretty_input_file_name cgperf_pretty_input_file_name | ||
6 | #else /* EPILOG */ | ||
7 | #undef is_declaration | ||
8 | #undef is_declaration_with_arg | ||
9 | #undef is_define_declaration | ||
10 | #undef pretty_input_file_name | ||
11 | #endif | ||
12 |
File namespace/input.h added (mode: 100644) (index 0000000..7500ff4) | |||
1 | #ifndef EPILOG | ||
2 | #define input_del cgperf_Input_del | ||
3 | #define input_new cgperf_Input_new | ||
4 | #define input_read cgperf_Input_read | ||
5 | #define Input cgperf_Input | ||
6 | #else /* EPILOG */ | ||
7 | #undef input_del | ||
8 | #undef input_new | ||
9 | #undef input_read | ||
10 | #undef Input | ||
11 | #endif |
File namespace/keyword.h added (mode: 100644) (index 0000000..3b6dc32) | |||
1 | #ifndef EPILOG | ||
2 | #define empty_string cgperf_empty_string | ||
3 | #define Keyword cgperf_Keyword | ||
4 | #define kw_delete_selchars cgperf_Keyword_delete_selchars | ||
5 | #define kw_init_selchars_low cgperf_Keyword_init_selchars_low | ||
6 | #define kw_init_selchars_multiset cgperf_Keyword_init_selchars_multiset | ||
7 | #define kw_init_selchars_tuple cgperf_Keyword_init_selchars_tuple | ||
8 | #define kw_new cgperf_Keyword_new | ||
9 | #define sort_char_set cgperf_sort_char_set | ||
10 | /*############################################################################*/ | ||
11 | #else /* EPILOG */ | ||
12 | #undef empty_string | ||
13 | #undef Keyword | ||
14 | #undef kw_delete_selchars | ||
15 | #undef kw_init_selchars_low | ||
16 | #undef kw_init_selchars_multiset | ||
17 | #undef kw_init_selchars_tuple | ||
18 | #undef kw_new | ||
19 | #undef sort_char_set | ||
20 | #endif |
File namespace/keyword_list.h added (mode: 100644) (index 0000000..c7c613d) | |||
1 | #ifndef EPILOG | ||
2 | /* global util */ | ||
3 | #define copy_list cgperf_Keyword_List_copy_list | ||
4 | #define delete_list cgperf_Keyword_List_delete_list | ||
5 | #define merge cgperf_Keyword_List_merge | ||
6 | #define mergesort_list cgperf_Keyword_List_mergesort_list | ||
7 | /* global util -- END */ | ||
8 | #define Keyword_List cgperf_Keyword_List | ||
9 | #define kwl_del cgperf_Keyword_List_del | ||
10 | #define kwl_new cgperf_Keyword_List_new | ||
11 | /*############################################################################*/ | ||
12 | #else /* EPILOG */ | ||
13 | /* global util */ | ||
14 | #undef copy_list | ||
15 | #undef delete_list | ||
16 | #undef merge | ||
17 | #undef mergesort_list | ||
18 | /* global util -- END */ | ||
19 | #undef Keyword_List | ||
20 | #undef kwl_del | ||
21 | #undef kwl_new | ||
22 | #endif |
File namespace/options.h added (mode: 100644) (index 0000000..f58c99d) | |||
1 | #ifndef EPILOG | ||
2 | #define DEFAULT_CLASS_NAME cgperf_OPTIONS_DEFAULT_CLASS_NAME | ||
3 | #define DEFAULT_CONSTANTS_PREFIX cgperf_OPTIONS_DEFAULT_CONSTANTS_PREFIX | ||
4 | #define DEFAULT_DELIMITERS cgperf_OPTIONS_DEFAULT_DELIMITERS | ||
5 | #define DEFAULT_FUNCTION_NAME cgperf_OPTIONS_DEFAULT_FUNCTION_NAME | ||
6 | #define DEFAULT_HASH_NAME cgperf_OPTIONS_DEFAULT_HASH_NAME | ||
7 | #define DEFAULT_INITIALIZER_SUFFIX cgperf_OPTIONS_DEFAULT_INITIALIZER_SUFFIX | ||
8 | #define DEFAULT_LENGTHTABLE_NAME cgperf_OPTIONS_DEFAULT_LENGTHTABLE_NAME | ||
9 | #define DEFAULT_SLOT_NAME cgperf_OPTIONS_DEFAULT_SLOT_NAME | ||
10 | #define DEFAULT_STRINGPOOL_NAME cgperf_OPTIONS_DEFAULT_STRINGPOOL_NAME | ||
11 | #define DEFAULT_WORDLIST_NAME cgperf_OPTIONS_DEFAULT_WORDLIST_NAME | ||
12 | #define Options cgperf_Options | ||
13 | #define opts_del cgperf_Options_del | ||
14 | #define opts_long_options cgperf_Options_long_options | ||
15 | #define opts_long_usage cgperf_Options_long_usage | ||
16 | #define opts_new cgperf_Options_new | ||
17 | #define opts_parse_options cgperf_Options_parse_options | ||
18 | #define opts_print cgperf_Options_print | ||
19 | #define opts_program_name cgperf_Options_program_name | ||
20 | #define opts_set_class_name cgperf_Options_set_class_name | ||
21 | #define opts_set_constants_prefix cgperf_Options_set_constants_prefix | ||
22 | #define opts_set_delimiters cgperf_Options_set_delimiters | ||
23 | #define opts_set_function_name cgperf_Options_set_function_name | ||
24 | #define opts_set_hash_name cgperf_Options_set_hash_name | ||
25 | #define opts_set_initializer_suffix cgperf_Options_set_initializer_suffix | ||
26 | #define opts_set_language cgperf_Options_set_language | ||
27 | #define opts_set_lengthtable_name cgperf_Options_set_lengthtable_name | ||
28 | #define opts_set_slot_name cgperf_Options_set_slot_name | ||
29 | #define opts_set_stringpool_name cgperf_Options_set_stringpool_name | ||
30 | #define opts_set_total_switches cgperf_Options_set_total_switches | ||
31 | #define opts_set_wordlist_name cgperf_Options_set_wordlist_name | ||
32 | #define opts_short_usage cgperf_Options_short_usage | ||
33 | #define OPTS_ANSIC cgperf_OPTIONS_ANSIC | ||
34 | #define OPTS_C cgperf_OPTIONS_C | ||
35 | #define OPTS_COMP cgperf_OPTIONS_COMP | ||
36 | #define OPTS_CONST cgperf_OPTIONS_CONST | ||
37 | #define OPTS_CPLUSPLUS cgperf_OPTIONS_CPLUSPLUS | ||
38 | #define OPTS_DEBUG cgperf_OPTIONS_DEBUG | ||
39 | #define OPTS_DEFAULT_JUMP_VALUE cgperf_OPTIONS_DEFAULT_JUMP_VALUE | ||
40 | #define OPTS_DUP cgperf_OPTIONS_DUP | ||
41 | #define OPTS_ENUM cgperf_OPTIONS_ENUM | ||
42 | #define OPTS_GLOBAL cgperf_OPTIONS_GLOBAL | ||
43 | #define OPTS_INCLUDE cgperf_OPTIONS_INCLUDE | ||
44 | #define OPTS_KRC cgperf_OPTIONS_KRC | ||
45 | #define OPTS_LENTABLE cgperf_OPTIONS_LENTABLE | ||
46 | #define OPTS_NOLENGTH cgperf_OPTIONS_NOLENGTH | ||
47 | #define OPTS_NOTYPE cgperf_OPTIONS_NOTYPE | ||
48 | #define OPTS_NULLSTRINGS cgperf_OPTIONS_NULLSTRINGS | ||
49 | #define OPTS_POSITIONS cgperf_OPTIONS_POSITIONS | ||
50 | #define OPTS_RANDOM cgperf_OPTIONS_RANDOM | ||
51 | #define OPTS_SEVENBIT cgperf_OPTIONS_SEVENBIT | ||
52 | #define OPTS_SHAREDLIB cgperf_OPTIONS_SHAREDLIB | ||
53 | #define OPTS_SWITCH cgperf_OPTIONS_SWITCH | ||
54 | #define OPTS_TYPE cgperf_OPTIONS_TYPE | ||
55 | #define OPTS_UPPERLOWER cgperf_OPTIONS_UPPERLOWER | ||
56 | #define posstrp_del cgperf_PositionsStringParser_del | ||
57 | #define posstrp_new cgperf_PositionsStringParser_new | ||
58 | #define posstrp_nextPosition cgperf_PositionsStringParser_nextPosition | ||
59 | /*############################################################################*/ | ||
60 | #else /* EPILOG */ | ||
61 | #undef DEFAULT_CLASS_NAME | ||
62 | #undef DEFAULT_CONSTANTS_PREFIX | ||
63 | #undef DEFAULT_DELIMITERS | ||
64 | #undef DEFAULT_FUNCTION_NAME | ||
65 | #undef DEFAULT_HASH_NAME | ||
66 | #undef DEFAULT_INITIALIZER_SUFFIX | ||
67 | #undef DEFAULT_LENGTHTABLE_NAME | ||
68 | #undef DEFAULT_SLOT_NAME | ||
69 | #undef DEFAULT_STRINGPOOL_NAME | ||
70 | #undef DEFAULT_WORDLIST_NAME | ||
71 | #undef Options | ||
72 | #undef opts_del | ||
73 | #undef opts_long_options | ||
74 | #undef opts_long_usage | ||
75 | #undef opts_new | ||
76 | #undef opts_parse_options | ||
77 | #undef opts_print | ||
78 | #undef opts_program_name | ||
79 | #undef opts_set_class_name | ||
80 | #undef opts_set_constants_prefix | ||
81 | #undef opts_set_delimiters | ||
82 | #undef opts_set_function_name | ||
83 | #undef opts_set_hash_name | ||
84 | #undef opts_set_initializer_suffix | ||
85 | #undef opts_set_language | ||
86 | #undef opts_set_lengthtable_name | ||
87 | #undef opts_set_slot_name | ||
88 | #undef opts_set_stringpool_name | ||
89 | #undef opts_set_total_switches | ||
90 | #undef opts_set_wordlist_name | ||
91 | #undef opts_short_usage | ||
92 | #undef OPTIONS_ANSIC | ||
93 | #undef OPTIONS_C | ||
94 | #undef OPTIONS_COMP | ||
95 | #undef OPTIONS_CONST | ||
96 | #undef OPTIONS_CPLUSPLUS | ||
97 | #undef OPTIONS_DEBUG | ||
98 | #undef OPTIONS_DEFAULT_JUMP_VALUE | ||
99 | #undef OPTIONS_DUP | ||
100 | #undef OPTIONS_ENUM | ||
101 | #undef OPTIONS_GLOBAL | ||
102 | #undef OPTIONS_INCLUDE | ||
103 | #undef OPTIONS_KRC | ||
104 | #undef OPTIONS_LENTABLE | ||
105 | #undef OPTIONS_NOLENGTH | ||
106 | #undef OPTIONS_NOTYPE | ||
107 | #undef OPTIONS_NULLSTRINGS | ||
108 | #undef OPTIONS_POSITIONS | ||
109 | #undef OPTIONS_RANDOM | ||
110 | #undef OPTIONS_SEVENBIT | ||
111 | #undef OPTIONS_SHAREDLIB | ||
112 | #undef OPTIONS_SWITCH | ||
113 | #undef OPTIONS_TYPE | ||
114 | #undef OPTS_UPPERLOWER | ||
115 | #undef posstrp_del | ||
116 | #undef posstrp_new | ||
117 | #undef posstrp_nextPosition | ||
118 | #endif |
File namespace/output.c added (mode: 100644) (index 0000000..0204975) | |||
1 | #ifndef EPILOG | ||
2 | #define const_always cgperf_Output_always | ||
3 | #define const_for_struct cgperf_Output_const_for_struct | ||
4 | #define const_readonly_array cgperf_Output_readonly_array | ||
5 | #define Duplicate_Entry cgperf_Output_Duplicate_Entry | ||
6 | #define output_comparison_memcmp cgperf_output_comparison_memcmp | ||
7 | #define output_comparison_strncmp cgperf_output_comparison_strncmp | ||
8 | #define output_comparison_strcmp cgperf_output_comparison_strcmp | ||
9 | #define output_const_type cgperf_Output_const_type | ||
10 | #define output_constant_define cgperf_Output_output_constant_define | ||
11 | #define output_constant_enum cgperf_Output_output_constant_enum | ||
12 | #define output_firstchar_comparison cgperf_Output_output_firstchar_comparison | ||
13 | #define output_keyword_blank_entries cgperf_Output_output_keyword_blank_entries | ||
14 | #define output_keyword_entry cgperf_Output_output_keyword_entry | ||
15 | #define output_line_directive cgperf_Output_output_line_directive | ||
16 | #define output_string cgperf_Output_output_string | ||
17 | #define output_switches cgperf_Output_output_switches | ||
18 | #define output_switch_case cgperf_Output_output_switch_case | ||
19 | #define output_upperlower_memcmp cgperf_Output_upperlower_memcmp | ||
20 | #define output_upperlower_table cgperf_Output_output_upperlower_table | ||
21 | #define output_upperlower_strcmp cgperf_Output_outpt_upperlower_strcmp | ||
22 | #define output_upperlower_strncmp cgperf_Output_outpt_upperlower_strncmp | ||
23 | #define register_scs cgperf_Output_register_scs | ||
24 | #define smallest_integral_type cgperf_Output_smallest_integral_type | ||
25 | #define smallest_integral_type_2 cgperf_Output_smallest_integral_type_2 | ||
26 | #else /* EPILOG */ | ||
27 | #undef const_always | ||
28 | #undef const_for_struct | ||
29 | #undef const_readonly_array | ||
30 | #undef Duplicate_Entry | ||
31 | #undef output_comparison_memcmp | ||
32 | #undef output_comparison_strncmp | ||
33 | #undef output_comparison_strcmp | ||
34 | #undef output_const_type | ||
35 | #undef output_constant_define | ||
36 | #undef output_constant_enum | ||
37 | #undef output_firstchar_comparison | ||
38 | #undef output_keyword_blank_entries | ||
39 | #undef output_keyword_entry | ||
40 | #undef output_line_directive | ||
41 | #undef output_string | ||
42 | #undef output_switches | ||
43 | #undef output_switch_case | ||
44 | #undef output_upperlower_memcmp | ||
45 | #undef output_upperlower_table | ||
46 | #undef output_upperlower_strcmp | ||
47 | #undef output_upperlower_strncmp | ||
48 | #undef register_scs | ||
49 | #undef smallest_integral_type | ||
50 | #undef smallest_integral_type_2 | ||
51 | #endif |
File namespace/output.h added (mode: 100644) (index 0000000..d157a74) | |||
1 | #ifndef EPILOG | ||
2 | #define Output cgperf_Output | ||
3 | #define output_asso_values_index cgperf_Output_output_asso_values_index | ||
4 | #define output_asso_values_ref cgperf_Output_output_asso_values_ref | ||
5 | #define output_compute_min_max cgperf_Output_compute_min_max | ||
6 | #define output_constants_defines cgperf_Output_output_constants_defines | ||
7 | #define output_constants_enum cgperf_Output_output_constants_enum | ||
8 | #define output_del cgperf_Output_del | ||
9 | #define output_do cgperf_Output_output_do | ||
10 | #define output_hash_function cgperf_Output_output_hash_function | ||
11 | #define output_keylength_table cgperf_Output_output_keylength_table | ||
12 | #define output_keyword_table cgperf_Output_output_keyword_table | ||
13 | #define output_lookup_array cgperf_Output_output_lookup_array | ||
14 | #define output_lookup_function cgperf_Output_output_lookup_function | ||
15 | #define output_lookup_function_body cgperf_Output_output_lookup_function_body | ||
16 | #define output_lookup_pools cgperf_Output_output_lookup_pools | ||
17 | #define output_lookup_tables cgperf_Output_output_lookup_tables | ||
18 | #define output_new cgperf_Output_new | ||
19 | #define output_num_hash_values cgperf_Output_num_hash_values | ||
20 | #define output_string_pool cgperf_Output_string_pool | ||
21 | #else /* EPILOG */ | ||
22 | #undef output_num_hash_values | ||
23 | #undef Ouput | ||
24 | #undef output_asso_values_index | ||
25 | #undef output_asso_values_ref | ||
26 | #undef output_constants_defines | ||
27 | #undef output_constants_enum | ||
28 | #undef output_del | ||
29 | #undef output_do | ||
30 | #undef output_hash_function | ||
31 | #undef output_lookup_function_body | ||
32 | #undef output_keylength_table | ||
33 | #undef output_keyword_table | ||
34 | #undef output_lookup_array | ||
35 | #undef output_lookup_function | ||
36 | #undef output_lookup_pools | ||
37 | #undef output_lookup_tables | ||
38 | #undef output_new | ||
39 | #undef output_string_pool | ||
40 | #endif |
File namespace/positions.h added (mode: 100644) (index 0000000..65af641) | |||
1 | #ifndef EPILOG | ||
2 | #define pos_add cgperf_Positions_add | ||
3 | #define pos_contains cgperf_Positions_contains | ||
4 | #define pos_cpy cgperf_Positions_cpy | ||
5 | #define pos_del cgperf_Positions_del | ||
6 | #define pos_iterator cgperf_Positions_iterator | ||
7 | #define pos_iterator_all cgperf_Positions_iterator_all | ||
8 | #define POS_LASTCHAR cgperf_POSITIONS_LASTCHAR | ||
9 | #define POS_MAX_KEY_POS cgperf_POSITIONS_MAX_KEY_POS | ||
10 | #define POS_MAX_SIZE cgpeff_POSITIONS_MAX_SIZE | ||
11 | #define pos_new cgperf_Positions_new | ||
12 | #define pos_new_cpy cgperf_Positions_new_cpy | ||
13 | #define pos_print cgperf_Positions_print | ||
14 | #define pos_remove cgperf_Positions_remove | ||
15 | #define pos_reviterator cgperf_Positions_reviterator | ||
16 | #define pos_set_useall cgperf_Positions_set_useall | ||
17 | #define pos_sort cgperf_Positions_sort | ||
18 | #define positer_del cgperf_PositionsIterator_del | ||
19 | #define POSITER_EOS cgperf_POSITIONITERATOR_EOS | ||
20 | #define positer_new cgperf_PositionIterator_new | ||
21 | #define positer_new_all cgperf_PositionIterator_new_all | ||
22 | #define positer_next cgperf_PositionIterator_next | ||
23 | #define positer_remaining cgperf_PositionIterator_remaining | ||
24 | #define POSREVIT_EOS cgperf_POSITIONREVERSEITERATOR_EOS | ||
25 | #define Positions cgperf_Positions | ||
26 | #define PositionIterator cgperf_PositionIterator | ||
27 | #define PositionReverseIterator cgperf_PositionReverseIterator | ||
28 | #define posrevit_del cgperf_PositionReverseIterator_del | ||
29 | #define POSREVIT_EOS cgperf_POSITIONREVERSEITERATOR_EOS | ||
30 | #define posrevit_new cgperf_PositionReverseIterator_new | ||
31 | #define posrevit_next cgperf_PositionReverseIterator_next | ||
32 | /*############################################################################*/ | ||
33 | #else /* EPILOG */ | ||
34 | #undef pos_add | ||
35 | #undef pos_contains | ||
36 | #undef pos_cpy | ||
37 | #undef pos_del | ||
38 | #undef pos_iterator | ||
39 | #undef pos_iterator_all | ||
40 | #undef POS_LASTCHAR | ||
41 | #undef POS_MAX_KEY_POS | ||
42 | #undef POS_MAX_SIZE | ||
43 | #undef pos_new | ||
44 | #undef pos_new_cpy | ||
45 | #undef pos_print | ||
46 | #undef pos_remove | ||
47 | #undef pos_reviterator | ||
48 | #undef pos_set_useall | ||
49 | #undef pos_sort | ||
50 | #undef positer_del | ||
51 | #undef POSITER_EOS | ||
52 | #undef positer_new | ||
53 | #undef positer_new_all | ||
54 | #undef positer_next | ||
55 | #undef positer_remaining | ||
56 | #undef Positions | ||
57 | #undef PositionIterator | ||
58 | #undef posrevit_del | ||
59 | #undef POSREVIT_EOS | ||
60 | #undef posrevit_new | ||
61 | #undef posrevit_next | ||
62 | #endif |
File namespace/search.c added (mode: 100644) (index 0000000..9bd8241) | |||
1 | #ifndef EPILOG | ||
2 | #define delete_partition cgperf_Search_delete_partition | ||
3 | #define equals cgperf_Search_equals | ||
4 | #define EquivalenceClass cgperf_Search_EquivalenceClass | ||
5 | #define less_by_hash_value cgperf_Search_less_by_hash_value | ||
6 | #define Step cgperf_Search_Step | ||
7 | /*############################################################################*/ | ||
8 | #else /* EPILOG */ | ||
9 | #undef delete_partition | ||
10 | #undef equals | ||
11 | #undef EquivalenceClass | ||
12 | #undef less_by_hash_value | ||
13 | #undef Step | ||
14 | #endif |
File namespace/search.h added (mode: 100644) (index 0000000..e18bfb7) | |||
1 | #ifndef EPILOG | ||
2 | #define schr_compute_alpha_size cgperf_Search_compute_alpha_size | ||
3 | #define schr_compute_alpha_size_with_inc cgperf_Search_compute_alpha_size_with_inc | ||
4 | #define schr_compute_alpha_unify cgperf_Search_compute_alpha_unify | ||
5 | #define schr_compute_alpha_unify_with_inc cgperf_Search_compute_alpha_unify_with_inc | ||
6 | #define schr_compute_hash cgperf_Search_compute_hash | ||
7 | #define schr_compute_partition cgperf_Search_compute_partition | ||
8 | #define schr_count_duplicates_multiset cgperf_Search_count_duplicates_multiset | ||
9 | #define schr_count_duplicates_tuple cgperf_Search_count_duplicates_tuple | ||
10 | #define schr_count_duplicates_tuple_do cgperf_Search_count_duplicates_tuple_do | ||
11 | #define schr_count_possible_collisions cgperf_Search_count_possible_collisions | ||
12 | #define schr_del cgperf_Search_del | ||
13 | #define schr_delete_partition cgperf_Search_delete_partition | ||
14 | #define schr_delete_selchars cgperf_Search_delete_selchars | ||
15 | #define schr_find_alpha_inc cgperf_Search_find_alpha_inc | ||
16 | #define schr_find_asso_values cgperf_Serach_find_asso_values | ||
17 | #define schr_find_good_asso_values cgperf_Search_find_good_asso_values | ||
18 | #define schr_find_positions cgperf_Search_find_positions | ||
19 | #define schr_init_selchars_multiset cgperf_Search_init_selchars_multiset | ||
20 | #define schr_init_selchars_tuple cgperf_Search_init_selchars_tuple | ||
21 | #define schr_new cgperf_Search_new | ||
22 | #define schr_optimize cgperf_Search_optimize | ||
23 | #define schr_prepare cgperf_Search_prepare | ||
24 | #define schr_prepare_asso_values cgperf_Search_prepare_asso_values | ||
25 | #define schr_sort cgperf_Search_sort | ||
26 | #define schr_unchanged_partition cgperf_Search_unchanged_partition | ||
27 | #define Search cgperf_Search | ||
28 | /*############################################################################*/ | ||
29 | #else /* EPILOG */ | ||
30 | #undef schr_compute_alpha_size | ||
31 | #undef schr_compute_alpha_size_with_inc | ||
32 | #undef schr_compute_alpha_unify | ||
33 | #undef schr_compute_alpha_unify_with_inc | ||
34 | #undef schr_compute_hash | ||
35 | #undef schr_compute_partition | ||
36 | #undef schr_count_duplicates_multiset | ||
37 | #undef schr_count_duplicates_tuple | ||
38 | #undef schr_count_duplicates_tuple_do | ||
39 | #undef schr_count_possible_collisions | ||
40 | #undef schr_del | ||
41 | #undef schr_delete_partition | ||
42 | #undef schr_delete_selchars | ||
43 | #undef schr_find_alpha_inc | ||
44 | #undef schr_find_asso_values | ||
45 | #undef schr_find_good_asso_values | ||
46 | #undef schr_find_positions | ||
47 | #undef schr_init_selchars_multiset | ||
48 | #undef schr_init_selchars_tuple | ||
49 | #undef schr_new | ||
50 | #undef schr_optimize | ||
51 | #undef schr_prepare | ||
52 | #undef schr_prepare_asso_values | ||
53 | #undef schr_sort | ||
54 | #undef schr_unchanged_partition | ||
55 | #undef Search | ||
56 | #endif |
File options.c added (mode: 100644) (index 0000000..1fb9da3) | |||
1 | #ifndef GPERF_OPTIONS_C | ||
2 | #define GPERF_OPTIONS_C | ||
3 | #include <limits.h> | ||
4 | #include <stdio.h> | ||
5 | #include <stdlib.h> | ||
6 | #include <getopt.h> | ||
7 | #include <ctype.h> | ||
8 | #include <string.h> | ||
9 | |||
10 | #include "globals.h" | ||
11 | #include "options.h" | ||
12 | #include "version.h" | ||
13 | #include "positions.h" | ||
14 | /*------------------------------------------------------------------------------------------------*/ | ||
15 | #include "namespace/globals.h" | ||
16 | #include "namespace/options.h" | ||
17 | #include "namespace/positions.h" | ||
18 | /*------------------------------------------------------------------------------------------------*/ | ||
19 | /*{{{ defaults */ | ||
20 | /* default struct initializer suffix */ | ||
21 | static u8 *DEFAULT_INITIALIZER_SUFFIX = ""; | ||
22 | /* default name for the key component */ | ||
23 | static u8 *DEFAULT_SLOT_NAME = "name"; | ||
24 | /* default delimiters that separate keywords from their attributes */ | ||
25 | static u8 *DEFAULT_DELIMITERS = ","; | ||
26 | /* default name for generated hash function */ | ||
27 | static u8 *DEFAULT_HASH_NAME = "hash"; | ||
28 | /* default name for generated lookup function */ | ||
29 | static u8 *DEFAULT_FUNCTION_NAME = "in_word_set"; | ||
30 | /* default name for the generated class */ | ||
31 | static u8 *DEFAULT_CLASS_NAME = "Perfect_Hash"; | ||
32 | /* default name for string pool */ | ||
33 | static u8 *DEFAULT_STRINGPOOL_NAME = "stringpool"; | ||
34 | /* default prefix for constants */ | ||
35 | static u8 *DEFAULT_CONSTANTS_PREFIX = ""; | ||
36 | /* default name for generated hash table array */ | ||
37 | static u8 *DEFAULT_WORDLIST_NAME = "wordlist"; | ||
38 | /* default name for generated length table array */ | ||
39 | static u8 *DEFAULT_LENGTHTABLE_NAME = "lengthtable"; | ||
40 | /*}}} default -- END */ | ||
41 | /*{{{ opts_new */ | ||
42 | static struct Options *opts_new(void) | ||
43 | { | ||
44 | struct Options *t; | ||
45 | |||
46 | t = calloc(1, sizeof(*t)); | ||
47 | t->option_word = OPTS_ANSIC; | ||
48 | t->jump = OPTS_DEFAULT_JUMP_VALUE; | ||
49 | t->total_switches = 1; | ||
50 | t->size_multiple = 1; | ||
51 | t->function_name = DEFAULT_FUNCTION_NAME; | ||
52 | t->slot_name = DEFAULT_SLOT_NAME; | ||
53 | t->initializer_suffix = DEFAULT_INITIALIZER_SUFFIX; | ||
54 | t->class_name = DEFAULT_CLASS_NAME; | ||
55 | t->hash_name = DEFAULT_HASH_NAME; | ||
56 | t->wordlist_name = DEFAULT_WORDLIST_NAME; | ||
57 | t->lengthtable_name = DEFAULT_LENGTHTABLE_NAME; | ||
58 | t->stringpool_name = DEFAULT_STRINGPOOL_NAME; | ||
59 | t->constants_prefix = DEFAULT_CONSTANTS_PREFIX; | ||
60 | t->delimiters = DEFAULT_DELIMITERS; | ||
61 | t->key_positions = pos_new(); | ||
62 | return t; | ||
63 | }/*}}}*/ | ||
64 | /*{{{ opts_del */ | ||
65 | static void opts_del(struct Options *t) | ||
66 | { | ||
67 | if (OPTS(DEBUG)) { | ||
68 | struct PositionIterator *iter; | ||
69 | s32 pos; | ||
70 | |||
71 | fprintf(stderr, "\ndumping Options:" | ||
72 | "\nTYPE is........: %s" | ||
73 | "\nUPPERLOWER is..: %s" | ||
74 | "\nKRC is.........: %s" | ||
75 | "\nC is...........: %s" | ||
76 | "\nANSIC is.......: %s" | ||
77 | "\nCPLUSPLUS is...: %s" | ||
78 | "\nSEVENBIT is....: %s" | ||
79 | "\nLENTABLE is....: %s" | ||
80 | "\nCOMP is........: %s" | ||
81 | "\nCONST is.......: %s" | ||
82 | "\nENUM is........: %s" | ||
83 | "\nINCLUDE is.....: %s" | ||
84 | "\nGLOBAL is......: %s" | ||
85 | "\nNULLSTRINGS is.: %s" | ||
86 | "\nSHAREDLIB is...: %s" | ||
87 | "\nSWITCH is......: %s" | ||
88 | "\nNOTYPE is......: %s" | ||
89 | "\nDUP is.........: %s" | ||
90 | "\nNOLENGTH is....: %s" | ||
91 | "\nRANDOM is......: %s" | ||
92 | "\nDEBUG is.......: %s" | ||
93 | "\nlookup function name = %s" | ||
94 | "\nhash function name = %s" | ||
95 | "\nword list name = %s" | ||
96 | "\nlength table name = %s" | ||
97 | "\nstring pool name = %s" | ||
98 | "\nslot name = %s" | ||
99 | "\ninitializer suffix = %s" | ||
100 | "\nasso_values iterations = %d" | ||
101 | "\njump value = %d" | ||
102 | "\nhash table size multiplier = %g" | ||
103 | "\ninitial associated value = %d" | ||
104 | "\ndelimiters = %s" | ||
105 | "\nnumber of switch statements = %d\n", | ||
106 | OPTS(TYPE) ? "enabled" : "disabled", | ||
107 | OPTS(UPPERLOWER) ? "enabled" : "disabled", | ||
108 | OPTS(KRC) ? "enabled" : "disabled", | ||
109 | OPTS(C) ? "enabled" : "disabled", | ||
110 | OPTS(ANSIC) ? "enabled" : "disabled", | ||
111 | OPTS(CPLUSPLUS) ? "enabled" : "disabled", | ||
112 | OPTS(SEVENBIT) ? "enabled" : "disabled", | ||
113 | OPTS(LENTABLE) ? "enabled" : "disabled", | ||
114 | OPTS(COMP) ? "enabled" : "disabled", | ||
115 | OPTS(CONST) ? "enabled" : "disabled", | ||
116 | OPTS(ENUM) ? "enabled" : "disabled", | ||
117 | OPTS(INCLUDE) ? "enabled" : "disabled", | ||
118 | OPTS(GLOBAL) ? "enabled" : "disabled", | ||
119 | OPTS(NULLSTRINGS) ? "enabled" : "disabled", | ||
120 | OPTS(SHAREDLIB) ? "enabled" : "disabled", | ||
121 | OPTS(SWITCH) ? "enabled" : "disabled", | ||
122 | OPTS(NOTYPE) ? "enabled" : "disabled", | ||
123 | OPTS(DUP) ? "enabled" : "disabled", | ||
124 | OPTS(NOLENGTH) ? "enabled" : "disabled", | ||
125 | OPTS(RANDOM) ? "enabled" : "disabled", | ||
126 | OPTS(DEBUG) ? "enabled" : "disabled", | ||
127 | t->function_name, t->hash_name, t->wordlist_name, t->lengthtable_name, | ||
128 | t->stringpool_name, t->slot_name, t->initializer_suffix, | ||
129 | t->asso_iterations, t->jump, t->size_multiple, t->initial_asso_value, | ||
130 | t->delimiters, t->total_switches); | ||
131 | if (t->key_positions->useall) | ||
132 | fprintf(stderr, "all characters are used in the hash function\n"); | ||
133 | else { | ||
134 | fprintf(stderr, "maximum keysig size = %d\nkey positions are: \n", t->key_positions->size); | ||
135 | iter = pos_iterator_all(t->key_positions); | ||
136 | loop { | ||
137 | pos = positer_next(iter); | ||
138 | if (pos == POSITER_EOS) | ||
139 | break; | ||
140 | if (pos == POS_LASTCHAR) | ||
141 | fprintf(stderr, "$\n"); | ||
142 | else | ||
143 | fprintf(stderr, "%d\n", pos + 1); | ||
144 | |||
145 | } | ||
146 | } | ||
147 | fprintf (stderr, "finished dumping Options\n"); | ||
148 | } | ||
149 | pos_del(t->key_positions); | ||
150 | free(t); | ||
151 | }/*}}}*/ | ||
152 | /*{{{ opts_long_options | ||
153 | Parses the command line Options and sets appropriate flags in option_word. */ | ||
154 | static const struct option opts_long_options[] = | ||
155 | { | ||
156 | { "output-file", required_argument, NULL, CHAR_MAX + 1 }, | ||
157 | { "ignore-case", no_argument, NULL, CHAR_MAX + 2 }, | ||
158 | { "delimiters", required_argument, NULL, 'e' }, | ||
159 | { "struct-type", no_argument, NULL, 't' }, | ||
160 | { "language", required_argument, NULL, 'L' }, | ||
161 | { "slot-name", required_argument, NULL, 'K' }, | ||
162 | { "initializer-suffix", required_argument, NULL, 'F' }, | ||
163 | { "hash-fn-name", required_argument, NULL, 'H' }, /* backward compatibility */ | ||
164 | { "hash-function-name", required_argument, NULL, 'H' }, | ||
165 | { "lookup-fn-name", required_argument, NULL, 'N' }, /* backward compatibility */ | ||
166 | { "lookup-function-name", required_argument, NULL, 'N' }, | ||
167 | { "class-name", required_argument, NULL, 'Z' }, | ||
168 | { "seven-bit", no_argument, NULL, '7' }, | ||
169 | { "compare-strncmp", no_argument, NULL, 'c' }, | ||
170 | { "readonly-tables", no_argument, NULL, 'C' }, | ||
171 | { "enum", no_argument, NULL, 'E' }, | ||
172 | { "includes", no_argument, NULL, 'I' }, | ||
173 | { "global-table", no_argument, NULL, 'G' }, | ||
174 | { "constants-prefix", required_argument, NULL, CHAR_MAX + 5 }, | ||
175 | { "word-array-name", required_argument, NULL, 'W' }, | ||
176 | { "length-table-name", required_argument, NULL, CHAR_MAX + 4 }, | ||
177 | { "switch", required_argument, NULL, 'S' }, | ||
178 | { "omit-struct-type", no_argument, NULL, 'T' }, | ||
179 | { "key-positions", required_argument, NULL, 'k' }, | ||
180 | { "compare-strlen", no_argument, NULL, 'l' }, /* backward compatibility */ | ||
181 | { "compare-lengths", no_argument, NULL, 'l' }, | ||
182 | { "duplicates", no_argument, NULL, 'D' }, | ||
183 | { "fast", required_argument, NULL, 'f' }, | ||
184 | { "initial-asso", required_argument, NULL, 'i' }, | ||
185 | { "jump", required_argument, NULL, 'j' }, | ||
186 | { "multiple-iterations", required_argument, NULL, 'm' }, | ||
187 | { "no-strlen", no_argument, NULL, 'n' }, | ||
188 | { "occurrence-sort", no_argument, NULL, 'o' }, | ||
189 | { "optimized-collision-resolution", no_argument, NULL, 'O' }, | ||
190 | { "pic", no_argument, NULL, 'P' }, | ||
191 | { "string-pool-name", required_argument, NULL, 'Q' }, | ||
192 | { "null-strings", no_argument, NULL, CHAR_MAX + 3 }, | ||
193 | { "random", no_argument, NULL, 'r' }, | ||
194 | { "size-multiple", required_argument, NULL, 's' }, | ||
195 | { "help", no_argument, NULL, 'h' }, | ||
196 | { "version", no_argument, NULL, 'v' }, | ||
197 | { "debug", no_argument, NULL, 'd' }, | ||
198 | { NULL, no_argument, NULL, 0 } | ||
199 | };/*}}}*/ | ||
200 | /*{{{ opts_parse_options */ | ||
201 | static void opts_parse_options(struct Options *t, u32 argc, u8 **argv) | ||
202 | { | ||
203 | opts_program_name = (u8*)argv[0]; | ||
204 | t->argument_count = argc; | ||
205 | t->argument_vector = argv; | ||
206 | |||
207 | loop { | ||
208 | int option_char; | ||
209 | |||
210 | option_char = getopt_long(t->argument_count, t->argument_vector, | ||
211 | "acCdDe:Ef:F:gGhH:i:Ij:k:K:lL:m:nN:oOpPQ:rs:S:tTvW:Z:7", opts_long_options, | ||
212 | NULL); | ||
213 | if (option_char == -1) | ||
214 | break; | ||
215 | switch (option_char) { | ||
216 | case 'a': /* generated code uses the ANSI prototype format */ | ||
217 | break; /* This is now the default */ | ||
218 | case 'c': /* generate strncmp rather than strcmp */ | ||
219 | t->option_word |= OPTS_COMP; | ||
220 | break; | ||
221 | case 'C': /* make the generated tables readonly (const) */ | ||
222 | t->option_word |= OPTS_CONST; | ||
223 | break; | ||
224 | case 'd': /* enable debugging option */ | ||
225 | t->option_word |= OPTS_DEBUG; | ||
226 | fprintf(stderr, "Starting program %s, version %s, with debugging on.\n", opts_program_name, cgperf_version_string); | ||
227 | break; | ||
228 | case 'D': /* enable duplicate option */ | ||
229 | t->option_word |= OPTS_DUP; | ||
230 | break; | ||
231 | case 'e': /* specify keyword/attribute separator */ | ||
232 | t->delimiters = /*getopt*/(u8*)optarg; | ||
233 | break; | ||
234 | case 'E': | ||
235 | t->option_word |= OPTS_ENUM; | ||
236 | break; | ||
237 | case 'f': /* generate the hash table "fast" */ | ||
238 | break; /* Not needed any more */ | ||
239 | case 'F': | ||
240 | t->initializer_suffix = /*getopt*/(u8*)optarg; | ||
241 | break; | ||
242 | case 'g': /* use the 'inline' keyword for generated sub-routines, ifdef __GNUC__ */ | ||
243 | break; /* This is now the default */ | ||
244 | case 'G': /* make the keyword table a global variable */ | ||
245 | t->option_word |= OPTS_GLOBAL; | ||
246 | break; | ||
247 | case 'h': /* displays a list of helpful Options to the user */ | ||
248 | opts_long_usage(stdout); | ||
249 | exit(0); | ||
250 | case 'H': /* sets the name for the hash function */ | ||
251 | t->hash_name = /*getopt*/(u8*)optarg; | ||
252 | break; | ||
253 | case 'i': /* sets the initial value for the associated values array */ | ||
254 | t->initial_asso_value = atoi(/*getopt*/optarg); | ||
255 | if (t->initial_asso_value < 0) | ||
256 | fprintf(stderr, "Initial value %d should be non-zero, ignoring and continuing.\n", t->initial_asso_value); | ||
257 | if (OPTS(RANDOM)) | ||
258 | fprintf(stderr, "warning, -r option superceeds -i, ignoring -i option and continuing\n"); | ||
259 | break; | ||
260 | case 'I': /* enable #include statements */ | ||
261 | t->option_word |= OPTS_INCLUDE; | ||
262 | break; | ||
263 | case 'j': /* sets the jump value, must be odd for later algorithms */ | ||
264 | t->jump = atoi (/*getopt*/optarg); | ||
265 | if (t->jump < 0) { | ||
266 | fprintf(stderr, "Jump value %d must be a positive number.\n", t->jump); | ||
267 | opts_short_usage(stderr); | ||
268 | exit(1); | ||
269 | } else if ((t->jump != 0) && ((t->jump % 2) == 0)) | ||
270 | fprintf (stderr, "Jump value %d should be odd, adding 1 and continuing...\n", t->jump++); | ||
271 | break; | ||
272 | case 'k': { /* sets key positions used for hash function */ | ||
273 | t->option_word |= OPTS_POSITIONS; | ||
274 | s32 BAD_VALUE = -3; | ||
275 | s32 EOS = POSITER_EOS; | ||
276 | s32 value; | ||
277 | struct PositionStringParser *sparser; | ||
278 | |||
279 | sparser = posstrp_new(/*getopt*/(u8*)optarg, 1, | ||
280 | POS_MAX_KEY_POS, POS_LASTCHAR, BAD_VALUE, EOS); | ||
281 | |||
282 | if (/*getopt*/optarg[0] == '*') /* use all the characters for hashing!!!! */ | ||
283 | pos_set_useall(t->key_positions, true); | ||
284 | else { | ||
285 | s32 *key_positions; | ||
286 | s32 *key_pos; | ||
287 | u32 total_keysig_size; | ||
288 | |||
289 | pos_set_useall(t->key_positions, false); | ||
290 | key_positions = t->key_positions->positions; | ||
291 | |||
292 | key_pos = key_positions; | ||
293 | loop { | ||
294 | value = posstrp_nextPosition(sparser); | ||
295 | if (value == EOS) | ||
296 | break; | ||
297 | if (value == BAD_VALUE) { | ||
298 | fprintf(stderr, "Invalid position value or range, use 1,2,3-%d,'$' or '*'.\n", POS_MAX_KEY_POS); | ||
299 | opts_short_usage(stderr); | ||
300 | exit(1); | ||
301 | } | ||
302 | if ((key_pos - key_positions) == POS_MAX_SIZE) { | ||
303 | /* | ||
304 | * More than Positions_max_size key positions. | ||
305 | * Since all key positions are in the range | ||
306 | * 0..Positions_max_key_pos-1 or == Positions_lastchar, | ||
307 | * there must be duplicates. | ||
308 | */ | ||
309 | fprintf(stderr, "Duplicate key positions selected\n"); | ||
310 | opts_short_usage(stderr); | ||
311 | exit(1); | ||
312 | } | ||
313 | if (value != POS_LASTCHAR) | ||
314 | /* We use 0-based indices in the class Positions */ | ||
315 | value = value - 1; | ||
316 | *key_pos = value; | ||
317 | ++key_pos; | ||
318 | } | ||
319 | total_keysig_size = key_pos - key_positions; | ||
320 | if (total_keysig_size == 0) { | ||
321 | fprintf(stderr, "No key positions selected.\n"); | ||
322 | opts_short_usage(stderr); | ||
323 | exit(1); | ||
324 | } | ||
325 | t->key_positions->size = total_keysig_size; | ||
326 | /* | ||
327 | * Sorts the key positions *IN REVERSE ORDER!!* | ||
328 | * This makes further routines more efficient. | ||
329 | * Especially when generating code. | ||
330 | */ | ||
331 | if (!pos_sort(t->key_positions)) { | ||
332 | fprintf(stderr, "Duplicate key positions selected\n"); | ||
333 | opts_short_usage(stderr); | ||
334 | exit(1); | ||
335 | } | ||
336 | } | ||
337 | break;} | ||
338 | case 'K':/* make this the keyname for the keyword component field */ | ||
339 | t->slot_name = /*getopt*/optarg; | ||
340 | break; | ||
341 | case 'l':/* create length table to avoid extra string compares */ | ||
342 | t->option_word |= OPTS_LENTABLE; | ||
343 | break; | ||
344 | case 'L':/* deal with different generated languages */ | ||
345 | t->language = 0; | ||
346 | opts_set_language(t,/*getopt*/optarg); | ||
347 | break; | ||
348 | case 'm':/* multiple iterations for finding good asso_values */ | ||
349 | t->asso_iterations = atoi(/*getopt*/optarg); | ||
350 | if (t->asso_iterations < 0) { | ||
351 | fprintf(stderr, "asso_iterations value must not be negative, assuming 0\n"); | ||
352 | t->asso_iterations = 0; | ||
353 | } | ||
354 | break; | ||
355 | case 'n':/* don't include the length when computing hash function */ | ||
356 | t->option_word |= OPTS_NOLENGTH; | ||
357 | break; | ||
358 | case 'N':/* make generated lookup function name be optarg */ | ||
359 | t->function_name = /*getopt*/optarg; | ||
360 | break; | ||
361 | case 'o':/* order input by frequency of key set occurrence */ | ||
362 | break; /* not needed any more */ | ||
363 | case 'O':/* optimized choice during collision resolution */ | ||
364 | break; /* not needed any more */ | ||
365 | case 'p':/* generated lookup function a pointer instead of int */ | ||
366 | break; /* this is now the default */ | ||
367 | case 'P':/* optimize for position-independent code */ | ||
368 | t->option_word |= OPTS_SHAREDLIB; | ||
369 | break; | ||
370 | case 'Q':/* sets the name for the string pool */ | ||
371 | t->stringpool_name = /*getopt*/optarg; | ||
372 | break; | ||
373 | case 'r':/* utilize randomness to initialize the associated values table */ | ||
374 | t->option_word |= OPTS_RANDOM; | ||
375 | if (t->initial_asso_value != 0) | ||
376 | fprintf(stderr, "warning, -r option supersedes -i, disabling -i option and continuing\n"); | ||
377 | break; | ||
378 | case 's':{/* range of associated values, determines size of final table */ | ||
379 | f32 numerator; | ||
380 | f32 denominator; | ||
381 | bool invalid; | ||
382 | u8 *endptr; | ||
383 | |||
384 | denominator = 1; | ||
385 | invalid = false; | ||
386 | numerator = strtod(/*getopt*/optarg, &endptr); | ||
387 | if (endptr == /*getopt*/(u8*)optarg) | ||
388 | invalid = true; | ||
389 | else if (*endptr != '\0') { | ||
390 | if (*endptr == '/') { | ||
391 | u8 *denomptr; | ||
392 | |||
393 | denomptr = endptr + 1; | ||
394 | denominator = strtod(denomptr, &endptr); | ||
395 | if (endptr == denomptr || *endptr != '\0') | ||
396 | invalid = true; | ||
397 | } else | ||
398 | invalid = true; | ||
399 | } | ||
400 | if (invalid) { | ||
401 | fprintf(stderr, "Invalid value for option -s.\n"); | ||
402 | opts_short_usage(stderr); | ||
403 | exit (1); | ||
404 | } | ||
405 | t->size_multiple = numerator / denominator; | ||
406 | /* backward compatibility: -3 means 1/3 */ | ||
407 | if (t->size_multiple < 0) | ||
408 | t->size_multiple = 1 / (-t->size_multiple); | ||
409 | /* catch stupid users and port to C the c++ from stupid coders */ | ||
410 | if (t->size_multiple == 0) | ||
411 | t->size_multiple = 1; | ||
412 | /* warnings */ | ||
413 | if (t->size_multiple > 50) | ||
414 | fprintf(stderr, "Size multiple %g is excessive, did you really mean this?! (try '%s --help' for help)\n", t->size_multiple, opts_program_name); | ||
415 | else if (t->size_multiple < 0.01f) | ||
416 | fprintf(stderr, "Size multiple %g is extremely small, did you really mean this?! (try '%s --help' for help)\n", t->size_multiple, opts_program_name); | ||
417 | break;} | ||
418 | case 'S':/* generate switch statement output, rather than lookup table */ | ||
419 | t->option_word |= OPTS_SWITCH; | ||
420 | t->total_switches = atoi(/*getopt*/optarg); | ||
421 | if (t->total_switches <= 0) { | ||
422 | fprintf(stderr, "number of switches %s must be a positive number\n", /*getopt*/optarg); | ||
423 | opts_short_usage (stderr); | ||
424 | exit(1); | ||
425 | } | ||
426 | break; | ||
427 | case 't':/* enable the TYPE mode, allowing arbitrary user structures */ | ||
428 | t->option_word |= OPTS_TYPE; | ||
429 | break; | ||
430 | case 'T':/* don't print structure definition */ | ||
431 | t->option_word |= OPTS_NOTYPE; | ||
432 | break; | ||
433 | case 'v':/* print out the version and quit */ | ||
434 | fprintf(stdout, "GNU gperf %s\n", cgperf_version_string); | ||
435 | fprintf(stdout, "Copyright (C) %s Free Software Foundation, Inc.\n\ | ||
436 | License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>\n\ | ||
437 | This is free software: you are free to change and redistribute it.\n\ | ||
438 | There is NO WARRANTY, to the extent permitted by law.\n\ | ||
439 | ", | ||
440 | "1989-2018"); | ||
441 | fprintf(stdout, "Written by %s and %s. C89 with benign bits of C99/C11 port by Sylvain BERTRAND\n", "Douglas C. Schmidt", "Bruno Haible"); | ||
442 | exit(0); | ||
443 | case 'W':/* sets the name for the hash table array */ | ||
444 | t->wordlist_name = /*getopt*/optarg; | ||
445 | break; | ||
446 | case 'Z':/* set the class name */ | ||
447 | t->class_name = /*getopt*/optarg; | ||
448 | break; | ||
449 | case '7':/* assume 7-bit characters */ | ||
450 | t->option_word |= OPTS_SEVENBIT; | ||
451 | break; | ||
452 | case CHAR_MAX + 1:/* set the output file name */ | ||
453 | t->output_file_name = /*getopt*/optarg; | ||
454 | break; | ||
455 | case CHAR_MAX + 2:/* case insignificant */ | ||
456 | t->option_word |= OPTS_UPPERLOWER; | ||
457 | break; | ||
458 | case CHAR_MAX + 3:/* use NULL instead of "" */ | ||
459 | t->option_word |= OPTS_NULLSTRINGS; | ||
460 | break; | ||
461 | case CHAR_MAX + 4:/* sets the name for the length table array */ | ||
462 | t->lengthtable_name = /*getopt*/optarg; | ||
463 | break; | ||
464 | case CHAR_MAX + 5:/* sets the prefix for the constants */ | ||
465 | t->constants_prefix = /*getopt*/optarg; | ||
466 | break; | ||
467 | default: | ||
468 | opts_short_usage(stderr); | ||
469 | exit(1); | ||
470 | } | ||
471 | } | ||
472 | if (/*getopt*/optind < argc) | ||
473 | t->input_file_name = argv[/*getopt*/optind++]; | ||
474 | |||
475 | if (/*getopt*/optind < argc) { | ||
476 | fprintf(stderr, "Extra trailing arguments to %s.\n", opts_program_name); | ||
477 | opts_short_usage(stderr); | ||
478 | exit(1); | ||
479 | } | ||
480 | }/*}}}*/ | ||
481 | /*{{{ opts_short_usage */ | ||
482 | static void opts_short_usage(FILE * stream) | ||
483 | { | ||
484 | fprintf(stream, "Try '%s --help' for more information.\n", opts_program_name); | ||
485 | }/*}}}*/ | ||
486 | /*{{{ opts_long_usage */ | ||
487 | static void opts_long_usage(FILE * stream) | ||
488 | { | ||
489 | fprintf(stream, | ||
490 | "GNU 'gperf' generates perfect hash functions.\n"); | ||
491 | fprintf(stream, "\n"); | ||
492 | fprintf(stream, | ||
493 | "Usage: %s [OPTION]... [INPUT-FILE]\n", | ||
494 | opts_program_name); | ||
495 | fprintf(stream, "\n"); | ||
496 | fprintf(stream, | ||
497 | "If a long option shows an argument as mandatory, then it is mandatory\n" | ||
498 | "for the equivalent short option also.\n"); | ||
499 | fprintf(stream, "\n"); | ||
500 | fprintf(stream, | ||
501 | "Output file location:\n"); | ||
502 | fprintf(stream, | ||
503 | " --output-file=FILE Write output to specified file.\n"); | ||
504 | fprintf(stream, | ||
505 | "The results are written to standard output if no output file is specified\n" | ||
506 | "or if it is -.\n"); | ||
507 | fprintf(stream, "\n"); | ||
508 | fprintf(stream, | ||
509 | "Input file interpretation:\n"); | ||
510 | fprintf(stream, | ||
511 | " -e, --delimiters=DELIMITER-LIST\n" | ||
512 | " Allow user to provide a string containing delimiters\n" | ||
513 | " used to separate keywords from their attributes.\n" | ||
514 | " Default is \",\".\n"); | ||
515 | fprintf(stream, | ||
516 | " -t, --struct-type Allows the user to include a structured type\n" | ||
517 | " declaration for generated code. Any text before %%%%\n" | ||
518 | " is considered part of the type declaration. Key\n" | ||
519 | " words and additional fields may follow this, one\n" | ||
520 | " group of fields per line.\n"); | ||
521 | fprintf(stream, | ||
522 | " --ignore-case Consider upper and lower case ASCII characters as\n" | ||
523 | " equivalent. Note that locale dependent case mappings\n" | ||
524 | " are ignored.\n"); | ||
525 | fprintf(stream, "\n"); | ||
526 | fprintf(stream, | ||
527 | "Language for the output code:\n"); | ||
528 | fprintf(stream, | ||
529 | " -L, --language=LANGUAGE-NAME\n" | ||
530 | " Generates code in the specified language. Languages\n" | ||
531 | " handled are currently C++, ANSI-C, C, and KR-C. The\n" | ||
532 | " default is ANSI-C.\n"); | ||
533 | fprintf(stream, "\n"); | ||
534 | fprintf(stream, | ||
535 | "Details in the output code:\n"); | ||
536 | fprintf(stream, | ||
537 | " -K, --slot-name=NAME Select name of the keyword component in the keyword\n" | ||
538 | " structure.\n"); | ||
539 | fprintf(stream, | ||
540 | " -F, --initializer-suffix=INITIALIZERS\n" | ||
541 | " Initializers for additional components in the keyword\n" | ||
542 | " structure.\n"); | ||
543 | fprintf(stream, | ||
544 | " -H, --hash-function-name=NAME\n" | ||
545 | " Specify name of generated hash function. Default is\n" | ||
546 | " 'hash'.\n"); | ||
547 | fprintf(stream, | ||
548 | " -N, --lookup-function-name=NAME\n" | ||
549 | " Specify name of generated lookup function. Default\n" | ||
550 | " name is 'in_word_set'.\n"); | ||
551 | fprintf(stream, | ||
552 | " -Z, --class-name=NAME Specify name of generated C++ class. Default name is\n" | ||
553 | " 'Perfect_Hash'.\n"); | ||
554 | fprintf(stream, | ||
555 | " -7, --seven-bit Assume 7-bit characters.\n"); | ||
556 | fprintf(stream, | ||
557 | " -l, --compare-lengths Compare key lengths before trying a string\n" | ||
558 | " comparison. This is necessary if the keywords\n" | ||
559 | " contain NUL bytes. It also helps cut down on the\n" | ||
560 | " number of string comparisons made during the lookup.\n"); | ||
561 | fprintf(stream, | ||
562 | " -c, --compare-strncmp Generate comparison code using strncmp rather than\n" | ||
563 | " strcmp.\n"); | ||
564 | fprintf(stream, | ||
565 | " -C, --readonly-tables Make the contents of generated lookup tables\n" | ||
566 | " constant, i.e., readonly.\n"); | ||
567 | fprintf(stream, | ||
568 | " -E, --enum Define constant values using an enum local to the\n" | ||
569 | " lookup function rather than with defines.\n"); | ||
570 | fprintf(stream, | ||
571 | " -I, --includes Include the necessary system include file <string.h>\n" | ||
572 | " at the beginning of the code.\n"); | ||
573 | fprintf(stream, | ||
574 | " -G, --global-table Generate the static table of keywords as a static\n" | ||
575 | " global variable, rather than hiding it inside of the\n" | ||
576 | " lookup function (which is the default behavior).\n"); | ||
577 | fprintf(stream, | ||
578 | " -P, --pic Optimize the generated table for inclusion in shared\n" | ||
579 | " libraries. This reduces the startup time of programs\n" | ||
580 | " using a shared library containing the generated code.\n"); | ||
581 | fprintf(stream, | ||
582 | " -Q, --string-pool-name=NAME\n" | ||
583 | " Specify name of string pool generated by option --pic.\n" | ||
584 | " Default name is 'stringpool'.\n"); | ||
585 | fprintf(stream, | ||
586 | " --null-strings Use NULL strings instead of empty strings for empty\n" | ||
587 | " keyword table entries.\n"); | ||
588 | fprintf(stream, | ||
589 | " --constants-prefix=PREFIX\n" | ||
590 | " Specify prefix for the constants like TOTAL_KEYWORDS.\n"); | ||
591 | fprintf(stream, | ||
592 | " -W, --word-array-name=NAME\n" | ||
593 | " Specify name of word list array. Default name is\n" | ||
594 | " 'wordlist'.\n"); | ||
595 | fprintf(stream, | ||
596 | " --length-table-name=NAME\n" | ||
597 | " Specify name of length table array. Default name is\n" | ||
598 | " 'lengthtable'.\n"); | ||
599 | fprintf(stream, | ||
600 | " -S, --switch=COUNT Causes the generated C code to use a switch\n" | ||
601 | " statement scheme, rather than an array lookup table.\n" | ||
602 | " This can lead to a reduction in both time and space\n" | ||
603 | " requirements for some keyfiles. The COUNT argument\n" | ||
604 | " determines how many switch statements are generated.\n" | ||
605 | " A value of 1 generates 1 switch containing all the\n" | ||
606 | " elements, a value of 2 generates 2 tables with 1/2\n" | ||
607 | " the elements in each table, etc. If COUNT is very\n" | ||
608 | " large, say 1000000, the generated C code does a\n" | ||
609 | " binary search.\n"); | ||
610 | fprintf(stream, | ||
611 | " -T, --omit-struct-type\n" | ||
612 | " Prevents the transfer of the type declaration to the\n" | ||
613 | " output file. Use this option if the type is already\n" | ||
614 | " defined elsewhere.\n"); | ||
615 | fprintf(stream, "\n"); | ||
616 | fprintf(stream, | ||
617 | "Algorithm employed by gperf:\n"); | ||
618 | fprintf(stream, | ||
619 | " -k, --key-positions=KEYS\n" | ||
620 | " Select the key positions used in the hash function.\n" | ||
621 | " The allowable choices range between 1-%d, inclusive.\n" | ||
622 | " The positions are separated by commas, ranges may be\n" | ||
623 | " used, and key positions may occur in any order.\n" | ||
624 | " Also, the meta-character '*' causes the generated\n" | ||
625 | " hash function to consider ALL key positions, and $\n" | ||
626 | " indicates the \"final character\" of a key, e.g.,\n" | ||
627 | " $,1,2,4,6-10.\n", | ||
628 | POS_MAX_KEY_POS); | ||
629 | fprintf(stream, | ||
630 | " -D, --duplicates Handle keywords that hash to duplicate values. This\n" | ||
631 | " is useful for certain highly redundant keyword sets.\n"); | ||
632 | fprintf(stream, | ||
633 | " -m, --multiple-iterations=ITERATIONS\n" | ||
634 | " Perform multiple choices of the -i and -j values,\n" | ||
635 | " and choose the best results. This increases the\n" | ||
636 | " running time by a factor of ITERATIONS but does a\n" | ||
637 | " good job minimizing the generated table size.\n"); | ||
638 | fprintf(stream, | ||
639 | " -i, --initial-asso=N Provide an initial value for the associate values\n" | ||
640 | " array. Default is 0. Setting this value larger helps\n" | ||
641 | " inflate the size of the final table.\n"); | ||
642 | fprintf(stream, | ||
643 | " -j, --jump=JUMP-VALUE Affects the \"jump value\", i.e., how far to advance\n" | ||
644 | " the associated character value upon collisions. Must\n" | ||
645 | " be an odd number, default is %d.\n", | ||
646 | OPTS_DEFAULT_JUMP_VALUE); | ||
647 | fprintf(stream, | ||
648 | " -n, --no-strlen Do not include the length of the keyword when\n" | ||
649 | " computing the hash function.\n"); | ||
650 | fprintf(stream, | ||
651 | " -r, --random Utilizes randomness to initialize the associated\n" | ||
652 | " values table.\n"); | ||
653 | fprintf(stream, | ||
654 | " -s, --size-multiple=N Affects the size of the generated hash table. The\n" | ||
655 | " numeric argument N indicates \"how many times larger\n" | ||
656 | " or smaller\" the associated value range should be,\n" | ||
657 | " in relationship to the number of keys, e.g. a value\n" | ||
658 | " of 3 means \"allow the maximum associated value to\n" | ||
659 | " be about 3 times larger than the number of input\n" | ||
660 | " keys\". Conversely, a value of 1/3 means \"make the\n" | ||
661 | " maximum associated value about 3 times smaller than\n" | ||
662 | " the number of input keys\". A larger table should\n" | ||
663 | " decrease the time required for an unsuccessful\n" | ||
664 | " search, at the expense of extra table space. Default\n" | ||
665 | " value is 1.\n"); | ||
666 | fprintf(stream, "\n"); | ||
667 | fprintf(stream, | ||
668 | "Informative output:\n" | ||
669 | " -h, --help Print this message.\n" | ||
670 | " -v, --version Print the gperf version number.\n" | ||
671 | " -d, --debug Enables the debugging option (produces verbose\n" | ||
672 | " output to the standard error).\n"); | ||
673 | fprintf(stream, "\n"); | ||
674 | fprintf(stream, | ||
675 | "Report bugs to <bug-gperf@gnu.org>.\n"); | ||
676 | }/*}}}*/ | ||
677 | /*{{{ opts_set_language */ | ||
678 | /* Sets the output language, if not already set */ | ||
679 | void opts_set_language(struct Options *t, u8 *language) | ||
680 | { | ||
681 | if (t->language != 0) | ||
682 | return; | ||
683 | t->language = language; | ||
684 | t->option_word &= ~(OPTS_KRC | OPTS_C | OPTS_ANSIC | OPTS_CPLUSPLUS); | ||
685 | if (strcmp(language, "KR-C") == 0) | ||
686 | t->option_word |= OPTS_KRC; | ||
687 | else if (strcmp (language, "C") == 0) | ||
688 | t->option_word |= OPTS_C; | ||
689 | else if (strcmp (language, "ANSI-C") == 0) | ||
690 | t->option_word |= OPTS_ANSIC; | ||
691 | else if (strcmp (language, "C++") == 0) | ||
692 | t->option_word |= OPTS_CPLUSPLUS; | ||
693 | else { | ||
694 | fprintf(stderr, "unsupported language option %s, defaulting to ANSI-C\n", language); | ||
695 | t->option_word |= OPTS_ANSIC; | ||
696 | } | ||
697 | }/*}}}*/ | ||
698 | /*{{{ opts_set_delimiters */ | ||
699 | /* Sets the delimiters string, if not already set. */ | ||
700 | static void opts_set_delimiters(struct Options *t, u8 *delimiters) | ||
701 | { | ||
702 | if (t->delimiters == DEFAULT_DELIMITERS) | ||
703 | t->delimiters = delimiters; | ||
704 | }/*}}}*/ | ||
705 | /*{{{ opts_set_slot_name */ | ||
706 | /* sets the keyword key name, if not already set */ | ||
707 | static void opts_set_slot_name(struct Options *t, u8 *name) | ||
708 | { | ||
709 | if (t->slot_name == DEFAULT_SLOT_NAME) | ||
710 | t->slot_name = name; | ||
711 | }/*}}}*/ | ||
712 | /*{{{ opts_set_initializer_suffix */ | ||
713 | /* sets the struct initializer suffix, if not already set */ | ||
714 | static void opts_set_initializer_suffix(struct Options *t, u8 *initializers) | ||
715 | { | ||
716 | if (t->initializer_suffix == DEFAULT_INITIALIZER_SUFFIX) | ||
717 | t->initializer_suffix = initializers; | ||
718 | }/*}}}*/ | ||
719 | /*{{{ opts_set_hash_name */ | ||
720 | /* sets the hash function name, if not already set */ | ||
721 | static void opts_set_hash_name(struct Options *t, u8 *name) | ||
722 | { | ||
723 | if (t->hash_name == DEFAULT_HASH_NAME) | ||
724 | t->hash_name = name; | ||
725 | }/*}}}*/ | ||
726 | /*{{{ opts_set_function_name */ | ||
727 | /* sets the generated function name, if not already set */ | ||
728 | static void opts_set_function_name(struct Options *t, u8 *name) | ||
729 | { | ||
730 | if (t->function_name == DEFAULT_FUNCTION_NAME) | ||
731 | t->function_name = name; | ||
732 | }/*}}}*/ | ||
733 | /*{{{ opts_set_class_name */ | ||
734 | /* sets the generated class name, if not already set */ | ||
735 | static void opts_set_class_name(struct Options *t, u8 *name) | ||
736 | { | ||
737 | if (t->class_name == DEFAULT_CLASS_NAME) | ||
738 | t->class_name = name; | ||
739 | }/*}}}*/ | ||
740 | /*{{{ opts_set_stringpool_name */ | ||
741 | /* sets the string pool name, if not already set */ | ||
742 | static void opts_set_stringpool_name(struct Options *t, u8 *name) | ||
743 | { | ||
744 | if (t->stringpool_name == DEFAULT_STRINGPOOL_NAME) | ||
745 | t->stringpool_name = name; | ||
746 | }/*}}}*/ | ||
747 | /*{{{ opts_set_constants_prefix */ | ||
748 | /* sets the prefix for the constants, if not already set */ | ||
749 | static void opts_set_constants_prefix(struct Options *t, u8 *prefix) | ||
750 | { | ||
751 | if (t->constants_prefix == DEFAULT_CONSTANTS_PREFIX) | ||
752 | t->constants_prefix = prefix; | ||
753 | }/*}}}*/ | ||
754 | /*{{{ opts_set_wordlist_name */ | ||
755 | /* sets the hash table array name, if not already set */ | ||
756 | static void opts_set_wordlist_name(struct Options *t, u8 *name) | ||
757 | { | ||
758 | if (t->wordlist_name == DEFAULT_WORDLIST_NAME) | ||
759 | t->wordlist_name = name; | ||
760 | }/*}}}*/ | ||
761 | /*{{{ opts_set_lengthtable_name */ | ||
762 | /* sets the length table array name, if not already set */ | ||
763 | static void opts_set_lengthtable_name(struct Options *t, u8 *name) | ||
764 | { | ||
765 | if (t->lengthtable_name == DEFAULT_LENGTHTABLE_NAME) | ||
766 | t->lengthtable_name = name; | ||
767 | }/*}}}*/ | ||
768 | /*{{{ opts_set_total_switches */ | ||
769 | /* sets the total number of switch statements, if not already set */ | ||
770 | static void opts_set_total_switches(struct Options *t, s32 total_switches) | ||
771 | { | ||
772 | if (!OPTS(SWITCH)) { | ||
773 | t->option_word |= OPTS_SWITCH; | ||
774 | t->total_switches = total_switches; | ||
775 | } | ||
776 | }/*}}}*/ | ||
777 | /*{{{ posstrp_new */ | ||
778 | static struct PositionStringParser *posstrp_new(u8 *str, s32 low_bound, | ||
779 | s32 high_bound, s32 end_word_marker, s32 error_value, s32 end_marker) | ||
780 | { | ||
781 | struct PositionStringParser *t; | ||
782 | |||
783 | t = calloc(1, sizeof(*t)); | ||
784 | t->str = str; | ||
785 | t->low_bound = low_bound; | ||
786 | t->high_bound = high_bound; | ||
787 | t->end_word_marker = end_word_marker; | ||
788 | t->error_value = error_value; | ||
789 | t->end_marker = end_marker; | ||
790 | t->in_range = false; | ||
791 | return t; | ||
792 | } | ||
793 | /*}}}*/ | ||
794 | /*{{{ posstrp_del */ | ||
795 | static void posstrp_del(struct PositionStringParser *t) | ||
796 | { | ||
797 | free(t); | ||
798 | }/*}}}*/ | ||
799 | /*{{{ posstrp_nextPosition */ | ||
800 | /* Returns the next key position from the given string */ | ||
801 | static s32 posstrp_nextPosition(struct PositionStringParser *t) | ||
802 | { | ||
803 | if (t->in_range) { | ||
804 | /* We are inside a range. Return the next value from the range */ | ||
805 | if (++t->range_curr_value >= t->range_upper_bound) | ||
806 | t->in_range = false; | ||
807 | return t->range_curr_value; | ||
808 | } | ||
809 | /* we are not inside a range */ | ||
810 | /* Continue parsing the given string */ | ||
811 | loop { | ||
812 | if (t->str[0] == 0) | ||
813 | break; | ||
814 | switch (t->str[0]) { | ||
815 | case ',': | ||
816 | /* Skip the comma */ | ||
817 | ++(t->str); | ||
818 | break; | ||
819 | case '$': | ||
820 | /* Valid key position */ | ||
821 | ++(t->str); | ||
822 | return t->end_word_marker; | ||
823 | case '0': case '1': case '2': case '3': case '4': | ||
824 | case '5': case '6': case '7': case '8': case '9': { | ||
825 | /* Valid key position */ | ||
826 | s32 curr_value; | ||
827 | |||
828 | curr_value = 0; | ||
829 | loop { | ||
830 | if (!isdigit((int)(t->str[0]))) | ||
831 | break; | ||
832 | curr_value = curr_value * 10 + (t->str[0] - '0'); | ||
833 | ++(t->str); | ||
834 | } | ||
835 | if (t->str[0] == '-') { | ||
836 | ++(t->str); | ||
837 | /* starting a range of key positions */ | ||
838 | t->in_range = true; | ||
839 | |||
840 | t->range_upper_bound = 0; | ||
841 | loop { | ||
842 | if (!isdigit((int)(t->str[0]))) | ||
843 | break; | ||
844 | t->range_upper_bound = t->range_upper_bound * 10 | ||
845 | + (t->str[0] - '0'); | ||
846 | ++(t->str); | ||
847 | } | ||
848 | /* Verify range's upper bound */ | ||
849 | if (!(t->range_upper_bound > curr_value && t->range_upper_bound | ||
850 | <= t->high_bound)) | ||
851 | return t->error_value; | ||
852 | t->range_curr_value = curr_value; | ||
853 | } | ||
854 | /* Verify range's lower bound */ | ||
855 | if (!(curr_value >= t->low_bound && curr_value <= t->high_bound)) | ||
856 | return t->error_value; | ||
857 | return curr_value; | ||
858 | } | ||
859 | default: | ||
860 | /* Invalid syntax. */ | ||
861 | return t->error_value; | ||
862 | } | ||
863 | } | ||
864 | return t->end_marker; | ||
865 | }/*}}}*/ | ||
866 | /*{{{ opts_print */ | ||
867 | static void opts_print(struct Options *t) | ||
868 | { | ||
869 | s32 i; | ||
870 | |||
871 | printf("/* Command-line: "); | ||
872 | i = 0; | ||
873 | loop { | ||
874 | u8 *arg; | ||
875 | |||
876 | if (i >= t->argument_count) | ||
877 | break; | ||
878 | arg = t->argument_vector[i]; | ||
879 | /* escape arg if it contains shell metacharacters */ | ||
880 | if (*arg == '-') { | ||
881 | putchar(*arg); | ||
882 | ++arg; | ||
883 | if ((*arg >= 'A' && *arg <= 'Z') || (*arg >= 'a' && *arg <= 'z')) { | ||
884 | putchar(*arg); | ||
885 | ++arg; | ||
886 | } else if (*arg == '-') { | ||
887 | loop { | ||
888 | putchar(*arg); | ||
889 | ++arg; | ||
890 | if (!((*arg >= 'A' && *arg <= 'Z') || (*arg >= 'a' | ||
891 | && *arg <= 'z') || *arg == '-')) | ||
892 | break; | ||
893 | } | ||
894 | if (*arg == '=') { | ||
895 | putchar(*arg); | ||
896 | ++arg; | ||
897 | } | ||
898 | } | ||
899 | } | ||
900 | if (strpbrk(arg, "\t\n !\"#$&'()*;<>?[\\]`{|}~") != 0) { | ||
901 | if (strchr(arg, '\'') != 0) { | ||
902 | putchar('"'); | ||
903 | loop { | ||
904 | if (*arg == 0) | ||
905 | break; | ||
906 | if (*arg == '\"' || *arg == '\\' || *arg == '$' | ||
907 | || *arg == '`') | ||
908 | putchar('\\'); | ||
909 | putchar(*arg); | ||
910 | ++arg; | ||
911 | } | ||
912 | putchar('"'); | ||
913 | } else { | ||
914 | putchar('\''); | ||
915 | loop { | ||
916 | if (*arg == 0) | ||
917 | break; | ||
918 | if (*arg == '\\') | ||
919 | putchar('\\'); | ||
920 | putchar(*arg); | ||
921 | ++arg; | ||
922 | } | ||
923 | putchar('\''); | ||
924 | } | ||
925 | } else | ||
926 | printf("%s", arg); | ||
927 | printf(" "); | ||
928 | ++i; | ||
929 | } | ||
930 | printf(" */"); | ||
931 | } | ||
932 | /*}}}*/ | ||
933 | /*------------------------------------------------------------------------------------------------*/ | ||
934 | #define EPILOG | ||
935 | #include "namespace/globals.h" | ||
936 | #include "namespace/options.h" | ||
937 | #include "namespace/positions.h" | ||
938 | #undef EPILOG | ||
939 | /*------------------------------------------------------------------------------------------------*/ | ||
940 | #endif |
File options.h added (mode: 100644) (index 0000000..b7853ef) | |||
1 | #ifndef CGPERF_OPTIONS_H | ||
2 | #define CGPERF_OPTIONS_H | ||
3 | #include <stdbool.h> | ||
4 | #include <stdio.h> | ||
5 | #include "c_fixing.h" | ||
6 | /*------------------------------------------------------------------------------------------------*/ | ||
7 | #include "namespace/positions.h" | ||
8 | #include "namespace/options.h" | ||
9 | /*------------------------------------------------------------------------------------------------*/ | ||
10 | /*{{{ Options */ | ||
11 | /*{{{ globals */ | ||
12 | /* records the program name */ | ||
13 | static u8 *opts_program_name; | ||
14 | /*}}} globals -- END */ | ||
15 | /*{{{ constants */ | ||
16 | enum { | ||
17 | /* size to jump on a collision */ | ||
18 | OPTS_DEFAULT_JUMP_VALUE = 5, | ||
19 | /* enumeration of the possible boolean options */ | ||
20 | /* --- input file interpretation --- */ | ||
21 | /* handle user-defined type structured keyword input */ | ||
22 | OPTS_TYPE = 1 << 0, | ||
23 | /* ignore case of ASCII characters */ | ||
24 | OPTS_UPPERLOWER = 1 << 1, | ||
25 | /* --- language for the output code --- */ | ||
26 | /* generate K&R C code: no prototypes, no const */ | ||
27 | OPTS_KRC = 1 << 2, | ||
28 | /* generate C code: no prototypes, but const (user can #define it away) */ | ||
29 | OPTS_C = 1 << 3, | ||
30 | /* generate ISO/ANSI C code: prototypes and const, but no class */ | ||
31 | OPTS_ANSIC = 1 << 4, | ||
32 | /* generate C++ code: prototypes, const, class, inline, enum */ | ||
33 | OPTS_CPLUSPLUS = 1 << 5, | ||
34 | /* --- details in the output code --- */ | ||
35 | /* assume 7-bit, not 8-bit, characters */ | ||
36 | OPTS_SEVENBIT = 1 << 6, | ||
37 | /* generate a length table for string comparison */ | ||
38 | OPTS_LENTABLE = 1 << 7, | ||
39 | /* generate strncmp rather than strcmp */ | ||
40 | OPTS_COMP = 1 << 8, | ||
41 | /* make the generated tables readonly (const) */ | ||
42 | OPTS_CONST = 1 << 9, | ||
43 | /* use enum for constants */ | ||
44 | OPTS_ENUM = 1 << 10, | ||
45 | /* generate #include statements */ | ||
46 | OPTS_INCLUDE = 1 << 11, | ||
47 | /* make the keyword table a global variable */ | ||
48 | OPTS_GLOBAL = 1 << 12, | ||
49 | /* use NULL strings instead of empty strings for empty table entries */ | ||
50 | OPTS_NULLSTRINGS = 1 << 13, | ||
51 | /* optimize for position-independent code */ | ||
52 | OPTS_SHAREDLIB = 1 << 14, | ||
53 | /* generate switch output to save space */ | ||
54 | OPTS_SWITCH = 1 << 15, | ||
55 | /* don't include user-defined type definition in output -- it's already defined elsewhere */ | ||
56 | OPTS_NOTYPE = 1 << 16, | ||
57 | /* --- algorithm employed by gperf --- */ | ||
58 | /* use the given key positions */ | ||
59 | OPTS_POSITIONS = 1 << 17, | ||
60 | /* handle duplicate hash values for keywords */ | ||
61 | OPTS_DUP = 1 << 18, | ||
62 | /* don't include keyword length in hash computations */ | ||
63 | OPTS_NOLENGTH = 1 << 19, | ||
64 | /* randomly initialize the associated values table */ | ||
65 | OPTS_RANDOM = 1 << 20, | ||
66 | /* --- informative output --- */ | ||
67 | /* enable debugging (prints diagnostics to stderr) */ | ||
68 | OPTS_DEBUG = 1 << 21, | ||
69 | }; | ||
70 | /*}}} constants -- END */ | ||
71 | /*{{{ types */ | ||
72 | struct Options { | ||
73 | /* records count of command-line arguments */ | ||
74 | u32 argument_count; | ||
75 | /* stores a pointer to command-line argument vector */ | ||
76 | u8 **argument_vector; | ||
77 | /* holds the boolean options */ | ||
78 | u32 option_word; | ||
79 | /* separates keywords from other attributes */ | ||
80 | u8 *delimiters; | ||
81 | /* suffix for empty struct initializers */ | ||
82 | u8 *initializer_suffix; | ||
83 | /* name used for generated hash function */ | ||
84 | u8 *hash_name; | ||
85 | /* initial value for asso_values table */ | ||
86 | s32 initial_asso_value; | ||
87 | /* jump length when trying alternative values */ | ||
88 | s32 jump; | ||
89 | /* contains user-specified key choices */ | ||
90 | struct Positions *key_positions; | ||
91 | /* Name used for keyword key */ | ||
92 | u8 *slot_name; | ||
93 | /* the output language */ | ||
94 | u8 *language; | ||
95 | /* number of attempts at finding good asso_values */ | ||
96 | s32 asso_iterations; | ||
97 | /* names used for generated lookup function */ | ||
98 | u8 *function_name; | ||
99 | /* name used for the string pool */ | ||
100 | u8 *stringpool_name; | ||
101 | /* factor by which to multiply the generated table's size */ | ||
102 | f32 size_multiple; | ||
103 | /* number of switch statements to generate */ | ||
104 | s32 total_switches; | ||
105 | /* name used for hash table array */ | ||
106 | u8 *wordlist_name; | ||
107 | /* name used for generated C++ class */ | ||
108 | u8 *class_name; | ||
109 | /* name of output file */ | ||
110 | u8 *output_file_name; | ||
111 | /* name used for length table array */ | ||
112 | u8 *lengthtable_name; | ||
113 | /* prefix for the constants */ | ||
114 | u8 *constants_prefix; | ||
115 | /* name of input file */ | ||
116 | u8 *input_file_name; | ||
117 | }; | ||
118 | /*}}} types -- END */ | ||
119 | /*{{{ public static methods */ | ||
120 | static struct Options *opts_new(void); | ||
121 | static void opts_del(struct Options *t); | ||
122 | static void opts_parse_options(struct Options *t, u32 argc, u8 **argv); | ||
123 | static void opts_long_usage(FILE *stream); | ||
124 | static void opts_short_usage(FILE *stream); | ||
125 | static void opts_print(struct Options *t); | ||
126 | /*{{{ accessors */ | ||
127 | static void opts_set_delimiters(struct Options *t, u8 *delimiters); | ||
128 | static void opts_set_language(struct Options *t, u8 *language); | ||
129 | static void opts_set_slot_name(struct Options *t, u8 *name); | ||
130 | static void opts_set_initializer_suffix(struct Options *t, u8 *initializers); | ||
131 | static void opts_set_hash_name(struct Options *t, u8 *name); | ||
132 | static void opts_set_function_name(struct Options *t, u8 *name); | ||
133 | static void opts_set_class_name(struct Options *t, u8 *name); | ||
134 | static void opts_set_stringpool_name(struct Options *t, u8 *name); | ||
135 | static void opts_set_constants_prefix(struct Options *t, u8 *prefix); | ||
136 | static void opts_set_wordlist_name(struct Options *t, u8 *name); | ||
137 | static void opts_set_lengthtable_name(struct Options *t, u8 *name); | ||
138 | static void opts_set_total_switches(struct Options *t, s32 total_switches); | ||
139 | /*}}}*/ | ||
140 | /*}}} public static methods -- END */ | ||
141 | /*}}} Options -- END */ | ||
142 | /*{{{ PositionStringParser */ | ||
143 | /*{{{ constants and types */ | ||
144 | struct PositionStringParser { | ||
145 | /*{{{ private */ | ||
146 | /* A pointer to the string provided by the user */ | ||
147 | u8 *str; | ||
148 | /* Smallest possible value, inclusive */ | ||
149 | s32 low_bound; | ||
150 | /* Greatest possible value, inclusive */ | ||
151 | s32 high_bound; | ||
152 | /* A value marking the abstract "end of word" ( usually '$') */ | ||
153 | s32 end_word_marker; | ||
154 | /* Error value returned when input is syntactically erroneous */ | ||
155 | s32 error_value; | ||
156 | /* Value returned after last key is processed */ | ||
157 | s32 end_marker; | ||
158 | /* Intermediate state for producing a range of positions */ | ||
159 | bool in_range; /* True while producing a range of positions */ | ||
160 | s32 range_upper_bound; /* Upper bound (inclusive) of the range */ | ||
161 | s32 range_curr_value; /* Last value returned */ | ||
162 | /*}}} private -- END */ | ||
163 | }; | ||
164 | /*}}} constants and types -- END */ | ||
165 | /*{{{ public static methods */ | ||
166 | static struct PositionStringParser *posstrp_new(u8 *str, s32 low_bound, s32 high_bound, | ||
167 | s32 end_word_marker, s32 error_value, s32 end_marker); | ||
168 | static void posstrp_del(struct PositionStringParser *t); | ||
169 | static s32 posstrp_nextPosition(struct PositionStringParser *t); | ||
170 | /*}}} public static methods -- END */ | ||
171 | /*}}} PositionStringParser -- END */ | ||
172 | /*------------------------------------------------------------------------------------------------*/ | ||
173 | #define EPILOG | ||
174 | #include "namespace/positions.h" | ||
175 | #include "namespace/options.h" | ||
176 | #undef EPILOG | ||
177 | /*------------------------------------------------------------------------------------------------*/ | ||
178 | #endif |
File output.c added (mode: 100644) (index 0000000..ce76117) | |||
1 | #ifndef CGPERF_OUTPUT_C | ||
2 | #define CGPERF_OUTPUT_C | ||
3 | #include <stdbool.h> | ||
4 | #include "c_fixing.h" | ||
5 | #include "globals.h" | ||
6 | #include "options.h" | ||
7 | #include "output.h" | ||
8 | #include "keyword.h" | ||
9 | #include "keyword_list.h" | ||
10 | #include "positions.h" | ||
11 | /*------------------------------------------------------------------------------------------------*/ | ||
12 | #include "namespace/globals.h" | ||
13 | #include "namespace/options.h" | ||
14 | #include "namespace/output.h" | ||
15 | #include "namespace/output.c" | ||
16 | #include "namespace/keyword.h" | ||
17 | #include "namespace/keyword_list.h" | ||
18 | #include "namespace/positions.h" | ||
19 | /*------------------------------------------------------------------------------------------------*/ | ||
20 | /* We use a downcase table because when called repeatedly, the code gperf_downcase[c] | ||
21 | is faster than | ||
22 | if (c >= 'A' && c <= 'Z') | ||
23 | c += 'a' - 'A'; | ||
24 | */ | ||
25 | #define USE_DOWNCASE_TABLE 1 | ||
26 | /*------------------------------------------------------------------------------------------------*/ | ||
27 | /*{{{ local */ | ||
28 | /*{{{ types */ | ||
29 | /* | ||
30 | * because of the way output_keyword_table works, every duplicate set is | ||
31 | * stored contiguously in the wordlist array | ||
32 | */ | ||
33 | struct Duplicate_Entry | ||
34 | { | ||
35 | s32 hash_value; /* hash value for this particular duplicate set */ | ||
36 | s32 index; /* index into the main keyword storage array */ | ||
37 | s32 count; /* number of consecutive duplicates at this index */ | ||
38 | }; | ||
39 | /*}}}*/ | ||
40 | /*{{{ variables */ | ||
41 | /* the "register " storage-class specifier */ | ||
42 | static u8 *register_scs; | ||
43 | /* the "const " qualifier */ | ||
44 | static u8 *const_always; | ||
45 | /* the "const " qualifier, for read-only arrays */ | ||
46 | static u8 *const_readonly_array; | ||
47 | /* the "const " qualifier, for the array type */ | ||
48 | static u8 *const_for_struct; | ||
49 | /*}}} variables -- END */ | ||
50 | /*{{{ code */ | ||
51 | /*{{{ output_string */ | ||
52 | /* | ||
53 | * Outputs a keyword, as a string: enclosed in double quotes, escaping backslashes, double quote and | ||
54 | * unprintable characters | ||
55 | */ | ||
56 | static void output_string(u8 *key, s32 len) | ||
57 | { | ||
58 | putchar('"'); | ||
59 | loop { | ||
60 | u8 c; | ||
61 | |||
62 | if (len <= 0) | ||
63 | break; | ||
64 | c = (u8)(*key++); | ||
65 | if (isprint(c)) { | ||
66 | if (c == '"' || c == '\\') | ||
67 | putchar('\\'); | ||
68 | putchar(c); | ||
69 | } else { | ||
70 | /* | ||
71 | * Use octal escapes, not hexadecimal escapes, because some old C compilers | ||
72 | * didn't understand hexadecimal escapes, and because hexadecimal escapes | ||
73 | * are not limited to 2 digits, thus needing special care if the following | ||
74 | * character happens to be a digit. | ||
75 | */ | ||
76 | putchar('\\'); | ||
77 | putchar('0' + ((c >> 6) & 7)); | ||
78 | putchar('0' + ((c >> 3) & 7)); | ||
79 | putchar('0' + (c & 7)); | ||
80 | } | ||
81 | len--; | ||
82 | } | ||
83 | putchar('"'); | ||
84 | }/*}}}*/ | ||
85 | /*{{{ output_line_directive */ | ||
86 | /* outputs a #line directive, referring to the given line number */ | ||
87 | static void output_line_directive(u32 lineno) | ||
88 | { | ||
89 | u8 *file_name; | ||
90 | |||
91 | file_name = options->input_file_name; | ||
92 | if (file_name != 0) { | ||
93 | printf("#line %u ", lineno); | ||
94 | output_string(file_name, (s32)strlen(file_name)); | ||
95 | printf("\n"); | ||
96 | } | ||
97 | }/*}}}*/ | ||
98 | /*{{{ output_constant_define */ | ||
99 | static void output_constant_define(u8 *name, s32 value) | ||
100 | { | ||
101 | u8 *prefix; | ||
102 | u8 *combined_name; | ||
103 | |||
104 | prefix = options->constants_prefix; | ||
105 | combined_name = calloc(strlen(prefix) + strlen(name) + 1, sizeof(u8)); | ||
106 | strcpy(combined_name, prefix); | ||
107 | strcpy(combined_name + strlen(prefix), name); | ||
108 | printf("#define %s %d\n", combined_name, value); | ||
109 | free(combined_name); | ||
110 | }/*}}}*/ | ||
111 | /*{{{ output_constant_enum */ | ||
112 | static void output_constant_enum(u8 *name, s32 value, u8 *indentation, bool *pending_comma) | ||
113 | { | ||
114 | u8 *prefix; | ||
115 | u8 *combined_name; | ||
116 | |||
117 | prefix = options->constants_prefix; | ||
118 | combined_name = calloc(strlen(prefix) + strlen(name) + 1, sizeof(u8)); | ||
119 | strcpy(combined_name, prefix); | ||
120 | strcpy(combined_name + strlen(prefix), name); | ||
121 | if (*pending_comma) | ||
122 | printf (",\n"); | ||
123 | printf("%s %s = %d", indentation, combined_name, value); | ||
124 | *pending_comma = true; | ||
125 | free(combined_name); | ||
126 | }/*}}}*/ | ||
127 | /*{{{ ouput_upperlower_table */ | ||
128 | #if USE_DOWNCASE_TABLE | ||
129 | static void output_upperlower_table(void) | ||
130 | { | ||
131 | u32 c; | ||
132 | |||
133 | printf( | ||
134 | "#ifndef GPERF_DOWNCASE\n" | ||
135 | "#define GPERF_DOWNCASE 1\n" | ||
136 | "static %sunsigned char gperf_downcase[256] =\n" | ||
137 | " {", | ||
138 | const_readonly_array); | ||
139 | c = 0; | ||
140 | loop { | ||
141 | if (c >= 256) | ||
142 | break; | ||
143 | if ((c % 15) == 0) | ||
144 | printf("\n "); | ||
145 | printf(" %3d", c >= 'A' && c <= 'Z' ? c + 'a' - 'A' : c); | ||
146 | if (c < 255) | ||
147 | printf (","); | ||
148 | ++c; | ||
149 | } | ||
150 | printf("\n" | ||
151 | " };\n" | ||
152 | "#endif\n\n"); | ||
153 | } | ||
154 | #endif | ||
155 | /*}}}*/ | ||
156 | /*{{{ output_upperlower_memcmp */ | ||
157 | /* output gperf's ASCII-case insensitive memcmp replacement */ | ||
158 | static void output_upperlower_memcmp(void) | ||
159 | { | ||
160 | printf( | ||
161 | "#ifndef GPERF_CASE_MEMCMP\n" | ||
162 | "#define GPERF_CASE_MEMCMP 1\n" | ||
163 | "static int\n" | ||
164 | "gperf_case_memcmp "); | ||
165 | printf(OPTS(KRC) ? "(s1, s2, n)\n" | ||
166 | " %schar *s1;\n" | ||
167 | " %schar *s2;\n" | ||
168 | " %ssize_t n;\n" : | ||
169 | OPTS(C) ? "(s1, s2, n)\n" | ||
170 | " %sconst char *s1;\n" | ||
171 | " %sconst char *s2;\n" | ||
172 | " %ssize_t n;\n" : | ||
173 | OPTS(ANSIC) || OPTS(CPLUSPLUS) ? "(%sconst char *s1, %sconst char *s2, %ssize_t n)\n" : | ||
174 | "", register_scs, register_scs, register_scs); | ||
175 | #if USE_DOWNCASE_TABLE | ||
176 | printf( | ||
177 | "{\n" | ||
178 | " for (; n > 0;)\n" | ||
179 | " {\n" | ||
180 | " unsiGNED char c1 = gperf_downcase[(unsigned char)*s1++];\n" | ||
181 | " unsigned char c2 = gperf_downcase[(unsigned char)*s2++];\n" | ||
182 | " if (c1 == c2)\n" | ||
183 | " {\n" | ||
184 | " n--;\n" | ||
185 | " continue;\n" | ||
186 | " }\n" | ||
187 | " return (int)c1 - (int)c2;\n" | ||
188 | " }\n" | ||
189 | " return 0;\n" | ||
190 | "}\n"); | ||
191 | #else | ||
192 | printf( | ||
193 | "{\n" | ||
194 | " for (; n > 0;)\n" | ||
195 | " {\n" | ||
196 | " unsigned char c1 = *s1++;\n" | ||
197 | " unsigned char c2 = *s2++;\n" | ||
198 | " if (c1 >= 'A' && c1 <= 'Z')\n" | ||
199 | " c1 += 'a' - 'A';\n" | ||
200 | " if (c2 >= 'A' && c2 <= 'Z')\n" | ||
201 | " c2 += 'a' - 'A';\n" | ||
202 | " if (c1 == c2)\n" | ||
203 | " {\n" | ||
204 | " n--;\n" | ||
205 | " continue;\n" | ||
206 | " }\n" | ||
207 | " return (int)c1 - (int)c2;\n" | ||
208 | " }\n" | ||
209 | " return 0;\n" | ||
210 | "}\n"); | ||
211 | #endif | ||
212 | printf( | ||
213 | "#endif\n\n"); | ||
214 | }/*}}}*/ | ||
215 | /*{{{ output_upperlower_strncmp */ | ||
216 | /* output gperf's ASCII-case insensitive strncmp replacement */ | ||
217 | static void output_upperlower_strncmp(void) | ||
218 | { | ||
219 | printf( | ||
220 | "#ifndef GPERF_CASE_STRNCMP\n" | ||
221 | "#define GPERF_CASE_STRNCMP 1\n" | ||
222 | "static int\n" | ||
223 | "gperf_case_strncmp "); | ||
224 | printf(OPTS(KRC) ? "(s1, s2, n)\n" | ||
225 | " %schar *s1;\n" | ||
226 | " %schar *s2;\n" | ||
227 | " %ssize_t n;\n" : | ||
228 | OPTS(C) ? "(s1, s2, n)\n" | ||
229 | " %sconst char *s1;\n" | ||
230 | " %sconst char *s2;\n" | ||
231 | " %ssize_t n;\n" : | ||
232 | OPTS(ANSIC) || OPTS(CPLUSPLUS) ? "(%sconst char *s1, %sconst char *s2, %ssize_t n)\n" : | ||
233 | "", register_scs, register_scs, register_scs); | ||
234 | #if USE_DOWNCASE_TABLE | ||
235 | printf( | ||
236 | "{\n" | ||
237 | " for (; n > 0;)\n" | ||
238 | " {\n" | ||
239 | " unsigned char c1 = gperf_downcase[(unsigned char)*s1++];\n" | ||
240 | " unsigned char c2 = gperf_downcase[(unsigned char)*s2++];\n" | ||
241 | " if (c1 != 0 && c1 == c2)\n" | ||
242 | " {\n" | ||
243 | " n--;\n" | ||
244 | " continue;\n" | ||
245 | " }\n" | ||
246 | " return (int)c1 - (int)c2;\n" | ||
247 | " }\n" | ||
248 | " return 0;\n" | ||
249 | "}\n"); | ||
250 | #else | ||
251 | printf( | ||
252 | "{\n" | ||
253 | " for (; n > 0;)\n" | ||
254 | " {\n" | ||
255 | " unsigned char c1 = *s1++;\n" | ||
256 | " unsigned char c2 = *s2++;\n" | ||
257 | " if (c1 >= 'A' && c1 <= 'Z')\n" | ||
258 | " c1 += 'a' - 'A';\n" | ||
259 | " if (c2 >= 'A' && c2 <= 'Z')\n" | ||
260 | " c2 += 'a' - 'A';\n" | ||
261 | " if (c1 != 0 && c1 == c2)\n" | ||
262 | " {\n" | ||
263 | " n--;\n" | ||
264 | " continue;\n" | ||
265 | " }\n" | ||
266 | " return (int)c1 - (int)c2;\n" | ||
267 | " }\n" | ||
268 | " return 0;\n" | ||
269 | "}\n"); | ||
270 | #endif | ||
271 | printf( | ||
272 | "#endif\n\n"); | ||
273 | }/*}}}*/ | ||
274 | /*{{{ output_upperlower_strcmp */ | ||
275 | /* output gperf's ASCII-case insensitive strcmp replacement */ | ||
276 | static void output_upperlower_strcmp(void) | ||
277 | { | ||
278 | printf( | ||
279 | "#ifndef GPERF_CASE_STRCMP\n" | ||
280 | "#define GPERF_CASE_STRCMP 1\n" | ||
281 | "static int\n" | ||
282 | "gperf_case_strcmp "); | ||
283 | printf(OPTS(KRC) ? "(s1, s2)\n" | ||
284 | " %schar *s1;\n" | ||
285 | " %schar *s2;\n" : | ||
286 | OPTS(C) ? "(s1, s2)\n" | ||
287 | " %sconst char *s1;\n" | ||
288 | " %sconst char *s2;\n" : | ||
289 | OPTS(ANSIC) || OPTS(CPLUSPLUS) ? "(%sconst char *s1, %sconst char *s2)\n" : | ||
290 | "", register_scs, register_scs); | ||
291 | #if USE_DOWNCASE_TABLE | ||
292 | printf( | ||
293 | "{\n" | ||
294 | " for (;;)\n" | ||
295 | " {\n" | ||
296 | " unsigned char c1 = gperf_downcase[(unsigned char)*s1++];\n" | ||
297 | " unsigned char c2 = gperf_downcase[(unsigned char)*s2++];\n" | ||
298 | " if (c1 != 0 && c1 == c2)\n" | ||
299 | " continue;\n" | ||
300 | " return (int)c1 - (int)c2;\n" | ||
301 | " }\n" | ||
302 | "}\n"); | ||
303 | #else | ||
304 | printf( | ||
305 | "{\n" | ||
306 | " for (;;)\n" | ||
307 | " {\n" | ||
308 | " unsigned char c1 = *s1++;\n" | ||
309 | " unsigned char c2 = *s2++;\n" | ||
310 | " if (c1 >= 'A' && c1 <= 'Z')\n" | ||
311 | " c1 += 'a' - 'A';\n" | ||
312 | " if (c2 >= 'A' && c2 <= 'Z')\n" | ||
313 | " c2 += 'a' - 'A';\n" | ||
314 | " if (c1 != 0 && c1 == c2)\n" | ||
315 | " continue;\n" | ||
316 | " return (int)c1 - (int)c2;\n" | ||
317 | " }\n" | ||
318 | "}\n"); | ||
319 | #endif | ||
320 | printf | ||
321 | ("#endif\n\n"); | ||
322 | }/*}}}*/ | ||
323 | /*{{{ smallest_integral_type */ | ||
324 | /* returns the smallest unsigned C type capable of holding integers up to N */ | ||
325 | static u8 *smallest_integral_type(s32 n) | ||
326 | { | ||
327 | if (n <= UCHAR_MAX) return "unsigned char"; | ||
328 | if (n <= USHRT_MAX) return "unsigned short"; | ||
329 | return "unsigned int"; | ||
330 | }/*}}}*/ | ||
331 | /*{{{ smallest_integral_type_2 */ | ||
332 | /* returns the smallest signed C type capable of holding integers from MIN to MAX */ | ||
333 | static u8 *smallest_integral_type_2(s32 min, s32 max) | ||
334 | { | ||
335 | if (OPTS(ANSIC) || OPTS(CPLUSPLUS)) | ||
336 | if (min >= SCHAR_MIN && max <= SCHAR_MAX) return "signed char"; | ||
337 | if (min >= SHRT_MIN && max <= SHRT_MAX) return "short"; | ||
338 | return "int"; | ||
339 | }/*}}}*/ | ||
340 | /*{{{ output_const_type */ | ||
341 | /* | ||
342 | * Outputs a type and a const specifier (i.e. "const " or ""). | ||
343 | * The output is terminated with a space. | ||
344 | */ | ||
345 | static void output_const_type(u8 *const_string, u8 *type_string) | ||
346 | { | ||
347 | if (type_string[strlen(type_string) - 1] == '*') | ||
348 | /* for pointer types, put the 'const' after the type */ | ||
349 | printf( | ||
350 | "%s %s", type_string, const_string); | ||
351 | else | ||
352 | /* for scalar or struct types, put the 'const' before the type */ | ||
353 | printf( | ||
354 | "%s%s ", const_string, type_string); | ||
355 | }/*}}}*/ | ||
356 | /*{{{ output_keyword_blank_entries */ | ||
357 | static void output_keyword_blank_entries(s32 count, u8 *indent) | ||
358 | { | ||
359 | s32 columns; | ||
360 | s32 column; | ||
361 | s32 i; | ||
362 | |||
363 | if (OPTS(TYPE)) { | ||
364 | columns = 58 / (4 + (OPTS(SHAREDLIB) ? 2 : OPTS(NULLSTRINGS) ? 8 : 2) | ||
365 | + strlen(options->initializer_suffix)); | ||
366 | if (columns == 0) | ||
367 | columns = 1; | ||
368 | } else | ||
369 | columns = (OPTS(SHAREDLIB) ? 9 : OPTS(NULLSTRINGS) ? 4 : 9); | ||
370 | column = 0; | ||
371 | i = 0; | ||
372 | loop { | ||
373 | if (i >= count) | ||
374 | break; | ||
375 | if ((column % columns) == 0) { | ||
376 | if (i > 0) | ||
377 | printf( | ||
378 | ",\n"); | ||
379 | printf( | ||
380 | "%s ", indent); | ||
381 | } else if (i > 0) | ||
382 | printf(", "); | ||
383 | if (OPTS(TYPE)) | ||
384 | printf("{"); | ||
385 | if (OPTS(SHAREDLIB)) | ||
386 | printf("-1"); | ||
387 | else { | ||
388 | if (OPTS(NULLSTRINGS)) | ||
389 | printf("(char*)0"); | ||
390 | else | ||
391 | printf("\"\""); | ||
392 | } | ||
393 | if (OPTS(TYPE)) | ||
394 | printf( | ||
395 | "%s}", options->initializer_suffix); | ||
396 | ++column; | ||
397 | ++i; | ||
398 | } | ||
399 | }/*}}}*/ | ||
400 | /*{{{ output_keyword_entry */ | ||
401 | static void output_keyword_entry(struct Keyword *tmp, s32 stringpool_index, u8 *indent, | ||
402 | bool is_duplicate) | ||
403 | { | ||
404 | if (OPTS(TYPE)) | ||
405 | output_line_directive(tmp->lineno); | ||
406 | printf( | ||
407 | "%s ", indent); | ||
408 | if (OPTS(TYPE)) | ||
409 | printf("{"); | ||
410 | if (OPTS(SHAREDLIB)) | ||
411 | /* | ||
412 | * How to determine a certain offset in stringpool at compile time? | ||
413 | * - The standard way would be to use the 'offsetof' macro. But it is only | ||
414 | * defined in <stddef.h>, and <stddef.h> is not among the prerequisite | ||
415 | * header files that the user must #include. | ||
416 | * - The next best way would be to take the address and cast to 'intptr_t' | ||
417 | * or 'uintptr_t'. But these types are only defined in <stdint.h>, and | ||
418 | * <stdint.h> is not among the prerequisite header files that the user | ||
419 | * must #include. | ||
420 | * - The next best approximation of 'uintptr_t' is 'size_t'. It is defined | ||
421 | * in the prerequisite header <string.h>. | ||
422 | * - The types 'long' and 'unsigned long' do work as well, but on 64-bit | ||
423 | * native Windows platforms, they don't have the same size as pointers | ||
424 | * and therefore generate warnings. | ||
425 | */ | ||
426 | printf("(int)(size_t)&((struct %s_t *)0)->%s_str%d", | ||
427 | options->stringpool_name, options->stringpool_name, stringpool_index); | ||
428 | else | ||
429 | output_string(tmp->allchars, tmp->allchars_length); | ||
430 | if (OPTS(TYPE)) { | ||
431 | if (strlen(tmp->rest) > 0) | ||
432 | printf(",%s", tmp->rest); | ||
433 | printf("}"); | ||
434 | } | ||
435 | if (OPTS(DEBUG)) { | ||
436 | printf(" /* "); | ||
437 | if (is_duplicate) | ||
438 | printf("hash value duplicate, "); | ||
439 | else | ||
440 | printf("hash value = %d, ", tmp->hash_value); | ||
441 | printf("index = %d */", tmp->final_index); | ||
442 | } | ||
443 | |||
444 | }/*}}}*/ | ||
445 | /*{{{ output_switch_case */ | ||
446 | /* Output a single switch case (including duplicates). Advance list. */ | ||
447 | static struct Keyword_List *output_switch_case(struct Keyword_List *list, s32 indent, | ||
448 | s32 *jumps_away) | ||
449 | { | ||
450 | if (OPTS(DEBUG)) | ||
451 | printf( | ||
452 | "%*s/* hash value = %4d, keyword = \"%.*s\" */\n", indent, "", list->kw->hash_value, | ||
453 | list->kw->allchars_length, list->kw->allchars); | ||
454 | if (OPTS(DUP) && list->kw->duplicate_link) { | ||
455 | s32 count; | ||
456 | struct Keyword *links; | ||
457 | |||
458 | if (OPTS(LENTABLE)) | ||
459 | printf( | ||
460 | "%*slengthptr = &%s[%d];\n", indent, "", options->lengthtable_name, list->kw->final_index); | ||
461 | printf( | ||
462 | "%*swordptr = &%s[%d];\n", indent, "", options->wordlist_name, list->kw->final_index); | ||
463 | count = 0; | ||
464 | links = list->kw; | ||
465 | loop { | ||
466 | if (links == 0) | ||
467 | break; | ||
468 | ++count; | ||
469 | links = links->duplicate_link; | ||
470 | } | ||
471 | printf( | ||
472 | "%*swordendptr = wordptr + %d;\n" | ||
473 | "%*sgoto multicompare;\n", indent, "", count, indent, ""); | ||
474 | *jumps_away = 1; | ||
475 | } else { | ||
476 | if (OPTS(LENTABLE)) { | ||
477 | printf( | ||
478 | "%*sif (len == %d)\n" | ||
479 | "%*s {\n", indent, "", list->kw->allchars_length, indent, ""); | ||
480 | indent += 4; | ||
481 | } | ||
482 | printf("%*sresword = ", indent, ""); | ||
483 | if (OPTS(TYPE)) | ||
484 | printf("&%s[%d]", options->wordlist_name, list->kw->final_index); | ||
485 | else | ||
486 | output_string(list->kw->allchars, list->kw->allchars_length); | ||
487 | printf(";\n"); | ||
488 | printf( | ||
489 | "%*sgoto compare;\n", indent, ""); | ||
490 | if (OPTS(LENTABLE)) { | ||
491 | indent -= 4; | ||
492 | printf( | ||
493 | "%*s }\n", indent, ""); | ||
494 | } else | ||
495 | *jumps_away = 1; | ||
496 | } | ||
497 | return list->next; | ||
498 | }/*}}}*/ | ||
499 | /*{{{ output_switches */ | ||
500 | /* | ||
501 | * output a total of size cases, grouped into num_switches switch statements, where 0 < | ||
502 | * num_switches <= size | ||
503 | */ | ||
504 | static void output_switches(struct Keyword_List *list, s32 num_switches, s32 size, | ||
505 | s32 min_hash_value, s32 max_hash_value, s32 indent) | ||
506 | { | ||
507 | if (OPTS(DEBUG)) | ||
508 | printf( | ||
509 | "%*s/* know %d <= key <= %d, contains %d cases */\n", indent, "", min_hash_value, max_hash_value, | ||
510 | size); | ||
511 | if (num_switches > 1) { | ||
512 | s32 part1; | ||
513 | s32 part2; | ||
514 | s32 size1; | ||
515 | s32 size2; | ||
516 | struct Keyword_List *tmp; | ||
517 | s32 count; | ||
518 | |||
519 | part1 = num_switches / 2; | ||
520 | part2 = num_switches - part1; | ||
521 | size1 = (s32)((f64)(size) / (f64)(num_switches) * (f64)(part1) + 0.5); | ||
522 | size2 = size - size1; | ||
523 | |||
524 | tmp = list; | ||
525 | count = size1; | ||
526 | loop { | ||
527 | if (count <= 0) | ||
528 | break; | ||
529 | tmp = tmp->next; | ||
530 | count--; | ||
531 | } | ||
532 | printf( | ||
533 | "%*sif (key < %d)\n" | ||
534 | "%*s {\n", indent, "", tmp->kw->hash_value, indent, ""); | ||
535 | output_switches(list, part1, size1, min_hash_value, tmp->kw->hash_value - 1, | ||
536 | indent + 4); | ||
537 | printf( | ||
538 | "%*s }\n" | ||
539 | "%*selse\n" | ||
540 | "%*s {\n", indent, "", indent, "", indent, ""); | ||
541 | output_switches(tmp, part2, size2, tmp->kw->hash_value, max_hash_value, indent + 4); | ||
542 | printf( | ||
543 | "%*s }\n", indent, ""); | ||
544 | } else { | ||
545 | s32 lowest_case_value; | ||
546 | |||
547 | lowest_case_value = list->kw->hash_value; | ||
548 | if (size == 1) { | ||
549 | s32 jumps_away; | ||
550 | |||
551 | jumps_away = 0; | ||
552 | if (min_hash_value == max_hash_value) | ||
553 | output_switch_case(list, indent, &jumps_away); | ||
554 | else { | ||
555 | printf( | ||
556 | "%*sif (key == %d)\n" | ||
557 | "%*s {\n", indent, "", lowest_case_value, indent, ""); | ||
558 | output_switch_case(list, indent + 4, &jumps_away); | ||
559 | printf( | ||
560 | "%*s }\n", indent, ""); | ||
561 | } | ||
562 | } else { | ||
563 | if (lowest_case_value == 0) | ||
564 | printf( | ||
565 | "%*sswitch (key)\n", indent, ""); | ||
566 | else | ||
567 | printf( | ||
568 | "%*sswitch (key - %d)\n", indent, "", lowest_case_value); | ||
569 | printf( | ||
570 | "%*s {\n", indent, ""); | ||
571 | loop { | ||
572 | s32 jumps_away; | ||
573 | |||
574 | if (size <= 0) | ||
575 | break; | ||
576 | jumps_away = 0; | ||
577 | printf( | ||
578 | "%*s case %d:\n", indent, "", list->kw->hash_value - lowest_case_value); | ||
579 | list = output_switch_case(list, indent + 6, &jumps_away); | ||
580 | if (!jumps_away) | ||
581 | printf( | ||
582 | "%*s break;\n", indent, ""); | ||
583 | size--; | ||
584 | } | ||
585 | printf( | ||
586 | "%*s }\n", indent, ""); | ||
587 | } | ||
588 | } | ||
589 | }/*}}}*/ | ||
590 | /*{{{ output_firstchar_comparison */ | ||
591 | /* | ||
592 | * Outputs the comparison expression for the first byte. Returns true if the this comparison is | ||
593 | * complete. | ||
594 | */ | ||
595 | static bool output_firstchar_comparison(u8 *expr1, u8 *expr2) | ||
596 | { | ||
597 | /* | ||
598 | * First, we emit a comparison of the first byte of the two strings. This catches most | ||
599 | * cases where the string being looked up is not in the hash table but happens to have the | ||
600 | * same hash code as an element of the hash table. | ||
601 | */ | ||
602 | if (OPTS(UPPERLOWER)) { | ||
603 | /* incomplete comparison, just for speedup */ | ||
604 | printf("(((unsigned char)*"); | ||
605 | printf("%s", expr1); | ||
606 | printf(" ^ (unsigned char)*"); | ||
607 | printf("%s", expr2); | ||
608 | printf(") & ~32) == 0"); | ||
609 | return false; | ||
610 | } | ||
611 | /* Complete comparison. */ | ||
612 | printf("*"); | ||
613 | printf("%s", expr1); | ||
614 | printf(" == *"); | ||
615 | printf("%s", expr2); | ||
616 | return true; | ||
617 | }/*}}}*/ | ||
618 | /*------------------------------------------------------------------------------------------------*/ | ||
619 | /*{{{ output_comparison_X */ | ||
620 | /* | ||
621 | * Outputs the comparison expression. | ||
622 | * expr1 outputs a simple expression of type 'const char *' referring to the string being looked up. | ||
623 | * expr2 outputs a simple expression of type 'const char *' referring to the constant string stored | ||
624 | * in the gperf generated hash table. | ||
625 | */ | ||
626 | /*{{{ output_comparison_memcmp */ | ||
627 | static void output_comparison_memcmp(u8 *expr1, u8 *expr2) | ||
628 | { | ||
629 | bool firstchar_done; | ||
630 | |||
631 | firstchar_done = output_firstchar_comparison(expr1, expr2); | ||
632 | printf(" && !"); | ||
633 | if (OPTS(UPPERLOWER)) | ||
634 | printf("gperf_case_"); | ||
635 | printf("memcmp ("); | ||
636 | if (firstchar_done) { | ||
637 | printf("%s", expr1); | ||
638 | printf(" + 1, "); | ||
639 | printf("%s", expr2); | ||
640 | printf(" + 1, len - 1"); | ||
641 | } else { | ||
642 | printf("%s", expr1); | ||
643 | printf(", "); | ||
644 | printf("%s", expr2); | ||
645 | printf(", len"); | ||
646 | } | ||
647 | printf(")"); | ||
648 | }/*}}}*/ | ||
649 | /*{{{ output_comparison_strncmp */ | ||
650 | static void output_comparison_strncmp(u8 *expr1, u8 *expr2) | ||
651 | { | ||
652 | bool firstchar_done; | ||
653 | |||
654 | firstchar_done = output_firstchar_comparison(expr1, expr2); | ||
655 | printf(" && !"); | ||
656 | if (OPTS(UPPERLOWER)) | ||
657 | printf("gperf_case_"); | ||
658 | printf("strncmp ("); | ||
659 | if (firstchar_done) { | ||
660 | printf("%s", expr1); | ||
661 | printf(" + 1, "); | ||
662 | printf("%s", expr2); | ||
663 | printf(" + 1, len - 1"); | ||
664 | } else { | ||
665 | printf("%s", expr1); | ||
666 | printf(", "); | ||
667 | printf("%s", expr2); | ||
668 | printf(", len"); | ||
669 | } | ||
670 | printf(") && "); | ||
671 | printf("%s", expr2); | ||
672 | printf("[len] == '\\0'"); | ||
673 | }/*}}}*/ | ||
674 | /*{{{ output_comparison_strcmp */ | ||
675 | static void output_comparison_strcmp(u8 *expr1, u8 *expr2) | ||
676 | { | ||
677 | bool firstchar_done; | ||
678 | |||
679 | firstchar_done = output_firstchar_comparison(expr1, expr2); | ||
680 | printf(" && !"); | ||
681 | if (OPTS(UPPERLOWER)) | ||
682 | printf("gperf_case_"); | ||
683 | printf("strcmp ("); | ||
684 | if (firstchar_done) { | ||
685 | printf("%s", expr1); | ||
686 | printf(" + 1, "); | ||
687 | printf("%s", expr2); | ||
688 | printf(" + 1"); | ||
689 | } else { | ||
690 | printf("%s", expr1); | ||
691 | printf(", "); | ||
692 | printf("%s", expr2); | ||
693 | } | ||
694 | printf(")"); | ||
695 | }/*}}}*/ | ||
696 | /*}}} output_comparison_X -- END */ | ||
697 | /*------------------------------------------------------------------------------------------------*/ | ||
698 | /*}}} code -- END */ | ||
699 | /*}}} local -- END */ | ||
700 | /*------------------------------------------------------------------------------------------------*/ | ||
701 | /*{{{ output_new */ | ||
702 | /* Constructor. | ||
703 | Note about the keyword list starting at head: | ||
704 | - The list is ordered by increasing _hash_value. This has been achieved | ||
705 | by Search::sort(). | ||
706 | - Duplicates, i.e. keywords with the same _selchars set, are chained | ||
707 | through the _duplicate_link pointer. Only one representative per | ||
708 | duplicate equivalence class remains on the linear keyword list. | ||
709 | - Accidental duplicates, i.e. keywords for which the _asso_values[] search | ||
710 | couldn't achieve different hash values, cannot occur on the linear | ||
711 | keyword list. Search::optimize would catch this mistake. | ||
712 | */ | ||
713 | static struct Output *output_new(struct Keyword_List *head, u8 *struct_decl, | ||
714 | u32 struct_decl_lineno, u8 *return_type, | ||
715 | u8 *struct_tag, u8 *verbatim_declarations, | ||
716 | u8 *verbatim_declarations_end, | ||
717 | u32 verbatim_declarations_lineno, | ||
718 | u8 *verbatim_code, u8 *verbatim_code_end, | ||
719 | u32 verbatim_code_lineno, bool charset_dependent, | ||
720 | s32 total_keys, s32 max_key_len, s32 min_key_len, | ||
721 | bool hash_includes_len, struct Positions *positions, | ||
722 | u32 *alpha_inc, s32 total_duplicates, | ||
723 | u32 alpha_size, s32 *asso_values) | ||
724 | { | ||
725 | struct Output *t; | ||
726 | |||
727 | t = calloc(1, sizeof(*t)); | ||
728 | t->head = head; | ||
729 | t->struct_decl = struct_decl; | ||
730 | t->struct_decl_lineno = struct_decl_lineno; | ||
731 | t->return_type = return_type; | ||
732 | t->struct_tag = struct_tag; | ||
733 | t->verbatim_declarations = verbatim_declarations; | ||
734 | t->verbatim_declarations_end = verbatim_declarations_end; | ||
735 | t->verbatim_declarations_lineno = verbatim_declarations_lineno; | ||
736 | t->verbatim_code = verbatim_code; | ||
737 | t->verbatim_code_end = verbatim_code_end; | ||
738 | t->verbatim_code_lineno = verbatim_code_lineno; | ||
739 | t->charset_dependent = charset_dependent; | ||
740 | t->total_keys = total_keys; | ||
741 | t->max_key_len = max_key_len; | ||
742 | t->min_key_len = min_key_len; | ||
743 | t->hash_includes_len = hash_includes_len; | ||
744 | t->key_positions = pos_new_cpy(positions); | ||
745 | t->alpha_inc = alpha_inc; | ||
746 | t->total_duplicates = total_duplicates; | ||
747 | t->alpha_size = alpha_size; | ||
748 | t->asso_values = asso_values; | ||
749 | return t; | ||
750 | }/*}}}*/ | ||
751 | /*{{{ output_del */ | ||
752 | static void output_del(struct Output *t) | ||
753 | { | ||
754 | pos_del(t->key_positions); | ||
755 | free(t); | ||
756 | } | ||
757 | /*}}}*/ | ||
758 | /*{{{ output_do */ | ||
759 | /* generates the hash function and the key word recognizer function based upon the user's Options */ | ||
760 | static void output_do(struct Output *t) | ||
761 | { | ||
762 | output_compute_min_max(t); | ||
763 | if (OPTS(CPLUSPLUS)) /* yeah, we know nowadays that c++ is never a good idea anyway */ | ||
764 | /* | ||
765 | * The 'register' keyword is removed from C++17. See | ||
766 | * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4340 | ||
767 | */ | ||
768 | register_scs = ""; | ||
769 | else | ||
770 | register_scs = "register "; | ||
771 | if (OPTS(C) || OPTS(ANSIC) || OPTS(CPLUSPLUS)) { | ||
772 | const_always = "const "; | ||
773 | const_readonly_array = (OPTS(CONST) ? "const " : ""); | ||
774 | const_for_struct = ((OPTS(CONST) && OPTS(TYPE)) ? "const " : "" ); | ||
775 | } else { | ||
776 | const_always = ""; | ||
777 | const_readonly_array = ""; | ||
778 | const_for_struct = ""; | ||
779 | } | ||
780 | if (!OPTS(TYPE)) { | ||
781 | t->return_type = (const_always[0] != 0 ? "const char *" : "char *"); | ||
782 | t->struct_tag = (const_always[0] != 0 ? "const char *" : "char *"); | ||
783 | } | ||
784 | t->wordlist_eltype = (OPTS(SHAREDLIB) && !OPTS(TYPE) ? (u8*)"int" : t->struct_tag); | ||
785 | printf ("/* "); | ||
786 | if (OPTS(KRC)) | ||
787 | printf("KR-C"); | ||
788 | else if (OPTS(C)) | ||
789 | printf("C"); | ||
790 | else if (OPTS(ANSIC)) | ||
791 | printf("ANSI-C"); | ||
792 | else if (OPTS(CPLUSPLUS)) | ||
793 | printf("C++"); | ||
794 | printf(" code produced by gperf version %s */\n", cgperf_version_string); | ||
795 | opts_print(options); | ||
796 | printf("\n"); | ||
797 | if (!OPTS(POSITIONS)) { | ||
798 | printf ("/* Computed positions: -k'"); | ||
799 | pos_print(t->key_positions); | ||
800 | printf("' */\n"); | ||
801 | } | ||
802 | printf("\n"); | ||
803 | if (t->charset_dependent && (t->key_positions->size > 0 || OPTS(UPPERLOWER))) { | ||
804 | printf("#if !((' ' == 32) && ('!' == 33) && ('\"' == 34) && ('#' == 35) \\\n" | ||
805 | " && ('%%' == 37) && ('&' == 38) && ('\\'' == 39) && ('(' == 40) \\\n" | ||
806 | " && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \\\n" | ||
807 | " && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \\\n" | ||
808 | " && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \\\n" | ||
809 | " && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \\\n" | ||
810 | " && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \\\n" | ||
811 | " && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \\\n" | ||
812 | " && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \\\n" | ||
813 | " && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \\\n" | ||
814 | " && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \\\n" | ||
815 | " && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \\\n" | ||
816 | " && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \\\n" | ||
817 | " && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \\\n" | ||
818 | " && ('Z' == 90) && ('[' == 91) && ('\\\\' == 92) && (']' == 93) \\\n" | ||
819 | " && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \\\n" | ||
820 | " && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \\\n" | ||
821 | " && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \\\n" | ||
822 | " && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \\\n" | ||
823 | " && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \\\n" | ||
824 | " && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \\\n" | ||
825 | " && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \\\n" | ||
826 | " && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))\n" | ||
827 | "/* The character set is not based on ISO-646. */\n"); | ||
828 | printf("%s \"gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>.\"\n", OPTS(KRC) || OPTS(C) ? "error" : "#error"); | ||
829 | printf ("#endif\n\n"); | ||
830 | } | ||
831 | if (t->verbatim_declarations < t->verbatim_declarations_end) { | ||
832 | output_line_directive(t->verbatim_declarations_lineno); | ||
833 | fwrite(t->verbatim_declarations, 1, t->verbatim_declarations_end - | ||
834 | t->verbatim_declarations, stdout); | ||
835 | } | ||
836 | if (OPTS(TYPE) && !OPTS(NOTYPE)) { | ||
837 | /* output type declaration now, reference it later on.... */ | ||
838 | output_line_directive(t->struct_decl_lineno); | ||
839 | printf("%s\n", t->struct_decl); | ||
840 | } | ||
841 | if (OPTS(INCLUDE)) | ||
842 | printf("#include <string.h>\n"); /* declare strlen(), strcmp(), strncmp() */ | ||
843 | if (!OPTS(ENUM)) /* refactored: overzealous code factorization */ | ||
844 | output_constants_defines(t); | ||
845 | else if (OPTS(GLOBAL)) | ||
846 | output_constants_enum(t, ""); | ||
847 | printf("/* maximum key range = %d, duplicates = %d */\n\n", t->max_hash_value - t->min_hash_value + 1, t->total_duplicates); | ||
848 | if (OPTS(UPPERLOWER)) { | ||
849 | #if USE_DOWNCASE_TABLE | ||
850 | output_upperlower_table(); | ||
851 | #endif | ||
852 | if (OPTS(LENTABLE)) | ||
853 | output_upperlower_memcmp(); | ||
854 | else { | ||
855 | if (OPTS(COMP)) | ||
856 | output_upperlower_strncmp(); | ||
857 | else | ||
858 | output_upperlower_strcmp(); | ||
859 | } | ||
860 | } | ||
861 | if (OPTS(CPLUSPLUS)) | ||
862 | printf( | ||
863 | "class %s\n" | ||
864 | "{\n" | ||
865 | "private:\n" | ||
866 | " static inline unsigned int %s (const char *str, size_t len);\n" | ||
867 | "public:\n" | ||
868 | " static %s%s%s (const char *str, size_t len);\n" | ||
869 | "};\n" | ||
870 | "\n", options->class_name, options->hash_name, const_for_struct, t->return_type, | ||
871 | options->function_name); | ||
872 | output_hash_function(t); | ||
873 | if (OPTS(SHAREDLIB) && (OPTS(GLOBAL) || OPTS(TYPE))) | ||
874 | output_lookup_pools(t); | ||
875 | if (OPTS(GLOBAL)) | ||
876 | output_lookup_tables(t); | ||
877 | output_lookup_function(t); | ||
878 | if (t->verbatim_code < t->verbatim_code_end) { | ||
879 | output_line_directive(t->verbatim_code_lineno); | ||
880 | fwrite(t->verbatim_code, 1, t->verbatim_code_end - t->verbatim_code, stdout); | ||
881 | } | ||
882 | fflush(stdout); | ||
883 | }/*}}}*/ | ||
884 | /*{{{ output_compute_min_max */ | ||
885 | static void output_compute_min_max(struct Output *t) | ||
886 | { | ||
887 | struct Keyword_List *tmp; | ||
888 | /* | ||
889 | * since the list is already sorted by hash value all we need to do is to look at the first | ||
890 | * and the last element of the list | ||
891 | */ | ||
892 | t->min_hash_value = t->head->kw->hash_value; | ||
893 | tmp = t->head; | ||
894 | loop { | ||
895 | if (tmp->next == 0) | ||
896 | break; | ||
897 | tmp = tmp->next; | ||
898 | } | ||
899 | t->max_hash_value = tmp->kw->hash_value; | ||
900 | }/*}}}*/ | ||
901 | /*{{{ output_constants_defines */ | ||
902 | static void output_constants_defines(struct Output *t) | ||
903 | { | ||
904 | printf("\n"); | ||
905 | output_constant_define("TOTAL_KEYWORDS", t->total_keys); | ||
906 | output_constant_define("MIN_WORD_LENGTH", t->min_key_len); | ||
907 | output_constant_define("MAX_WORD_LENGTH", t->max_key_len); | ||
908 | output_constant_define("MIN_HASH_VALUE", t->min_hash_value); | ||
909 | output_constant_define("MAX_HASH_VALUE", t->max_hash_value); | ||
910 | }/*}}}*/ | ||
911 | /*{{{ output_constants_enum */ | ||
912 | static void output_constants_enum(struct Output *t, u8 *indentation) | ||
913 | { | ||
914 | bool pending_comma; | ||
915 | |||
916 | printf("%senum\n" | ||
917 | "%s {\n", indentation, indentation); | ||
918 | pending_comma = false; | ||
919 | output_constant_enum("TOTAL_KEYWORDS", t->total_keys, indentation, &pending_comma); | ||
920 | output_constant_enum("MIN_WORD_LENGTH", t->min_key_len, indentation, &pending_comma); | ||
921 | output_constant_enum("MAX_WORD_LENGTH", t->max_key_len, indentation, &pending_comma); | ||
922 | output_constant_enum("MIN_HASH_VALUE", t->min_hash_value, indentation, &pending_comma); | ||
923 | output_constant_enum("MAX_HASH_VALUE", t->max_hash_value, indentation, &pending_comma); | ||
924 | if (pending_comma) | ||
925 | printf("\n"); | ||
926 | printf("%s };\n\n", indentation); | ||
927 | }/*}}}*/ | ||
928 | /*{{{ output_hash_function */ | ||
929 | /* Generates C code for the hash function that returns the | ||
930 | proper encoding for each keyword. | ||
931 | The hash function has the signature | ||
932 | unsigned int <hash> (const char *str, size_t len). */ | ||
933 | static void output_hash_function(struct Output *t) | ||
934 | { | ||
935 | /* output the function's head */ | ||
936 | if (OPTS(CPLUSPLUS)) | ||
937 | printf("inline "); | ||
938 | else if (OPTS(KRC) || OPTS(C) || OPTS(ANSIC)) | ||
939 | printf( | ||
940 | "#ifdef __GNUC__\n" | ||
941 | "__inline\n" | ||
942 | "#else\n" | ||
943 | "#ifdef __cplusplus\n" | ||
944 | "inline\n" | ||
945 | "#endif\n" | ||
946 | "#endif\n"); | ||
947 | if (/* the function does not use the 'str' argument? */ | ||
948 | (t->key_positions->size == 0) | ||
949 | || /* the function uses 'str', but not the 'len' argument? */ | ||
950 | (!t->hash_includes_len | ||
951 | && t->key_positions->positions[0] < t->min_key_len) | ||
952 | && t->key_positions->positions[t->key_positions->size - 1] != POS_LASTCHAR) | ||
953 | /* pacify lint */ | ||
954 | printf("/*ARGSUSED*/\n"); | ||
955 | if (OPTS(KRC) || OPTS(C) || OPTS(ANSIC)) | ||
956 | printf("static "); | ||
957 | printf("unsigned int\n"); | ||
958 | if (OPTS(CPLUSPLUS)) | ||
959 | printf("%s::", options->class_name); | ||
960 | printf("%s ", options->hash_name); | ||
961 | printf(OPTS(KRC) ? | ||
962 | "(str, len)\n" | ||
963 | " %schar *str;\n" | ||
964 | " %ssize_t len;\n" : | ||
965 | OPTS(C) ? | ||
966 | "(str, len)\n" | ||
967 | " %sconst char *str;\n" | ||
968 | " %ssize_t len;\n" : | ||
969 | OPTS(ANSIC) || OPTS(CPLUSPLUS) ? | ||
970 | "(%sconst char *str, %ssize_t len)\n" : | ||
971 | "", register_scs, register_scs); | ||
972 | |||
973 | /* | ||
974 | * note that when the hash function is called, it has already been verified that | ||
975 | * min_key_len <= len <= max_key_len | ||
976 | */ | ||
977 | /* output the function's body */ | ||
978 | printf( | ||
979 | "{\n"); | ||
980 | /* first the asso_values array */ | ||
981 | if (t->key_positions->size > 0) { | ||
982 | s32 columns; | ||
983 | s32 field_width; | ||
984 | s32 trunc; | ||
985 | u32 count; | ||
986 | /* | ||
987 | * the values in the asso_values array are all unsigned integers <= MAX_HASH_VALUE + | ||
988 | * 1 | ||
989 | */ | ||
990 | printf( | ||
991 | " static %s%s asso_values[] =\n" | ||
992 | " {", const_readonly_array, smallest_integral_type(t->max_hash_value + 1)); | ||
993 | columns = 10; | ||
994 | /* calculate maximum number of digits required for MAX_HASH_VALUE + 1 */ | ||
995 | field_width = 2; | ||
996 | trunc = t->max_hash_value + 1; | ||
997 | loop { | ||
998 | trunc /= 10; | ||
999 | if (trunc <= 0) | ||
1000 | break; | ||
1001 | ++field_width; | ||
1002 | } | ||
1003 | count = 0; | ||
1004 | loop { | ||
1005 | if (count >= t->alpha_size) | ||
1006 | break; | ||
1007 | if (count > 0) | ||
1008 | printf(","); | ||
1009 | if ((count % columns) == 0) | ||
1010 | printf("\n "); | ||
1011 | printf("%*d", field_width, t->asso_values[count]); | ||
1012 | ++count; | ||
1013 | } | ||
1014 | printf( | ||
1015 | "\n" | ||
1016 | " };\n"); | ||
1017 | } | ||
1018 | if (t->key_positions->size == 0) { | ||
1019 | /* trivial case: No key positions at all */ | ||
1020 | printf( | ||
1021 | " return %s;\n", t->hash_includes_len ? "len" : "0"); | ||
1022 | } else { | ||
1023 | struct PositionIterator *iter; | ||
1024 | s32 key_pos; | ||
1025 | /* | ||
1026 | * Iterate through the key positions. Remember that Positions::sort() has sorted | ||
1027 | * them in decreasing order, with Positions::LASTCHAR coming last. | ||
1028 | */ | ||
1029 | iter = pos_iterator(t->key_positions, t->max_key_len); | ||
1030 | /* get the highest key position */ | ||
1031 | key_pos = positer_next(iter); | ||
1032 | if (key_pos == POS_LASTCHAR || key_pos < t->min_key_len) { | ||
1033 | /* | ||
1034 | * We can perform additional optimizations here: Write it out as a single | ||
1035 | * expression. Note that the values are added as 'int's even though the | ||
1036 | * asso_values array may contain 'unsigned char's or 'unsigned short's. | ||
1037 | */ | ||
1038 | printf( | ||
1039 | " return %s", t->hash_includes_len ? "len + " : ""); | ||
1040 | if (t->key_positions->size == 2 | ||
1041 | && t->key_positions->positions[0] == 0 | ||
1042 | && t->key_positions->positions[1] == POS_LASTCHAR) { | ||
1043 | /* optimize special case of "-k 1,$" */ | ||
1044 | output_asso_values_ref(t, POS_LASTCHAR); | ||
1045 | printf(" + "); | ||
1046 | output_asso_values_ref(t, 0); | ||
1047 | } else { | ||
1048 | loop { | ||
1049 | if (key_pos == POS_LASTCHAR) | ||
1050 | break; | ||
1051 | output_asso_values_ref(t, key_pos); | ||
1052 | key_pos = positer_next(iter); | ||
1053 | if (key_pos != POSITER_EOS) | ||
1054 | printf(" + "); | ||
1055 | else | ||
1056 | break; | ||
1057 | } | ||
1058 | if (key_pos == POS_LASTCHAR) | ||
1059 | output_asso_values_ref(t, POS_LASTCHAR); | ||
1060 | } | ||
1061 | printf(";\n"); | ||
1062 | } else { | ||
1063 | u8 *fallthrough_marker; | ||
1064 | /* we've got to use the correct, but brute force, technique */ | ||
1065 | /* | ||
1066 | * pseudo-statement or comment that avoids a compiler warning or lint | ||
1067 | * warning | ||
1068 | */ | ||
1069 | fallthrough_marker = | ||
1070 | "#if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3))\n" | ||
1071 | " [[fallthrough]];\n" | ||
1072 | "#elif defined __GNUC__ && __GNUC__ >= 7\n" | ||
1073 | " __attribute__ ((__fallthrough__));\n" | ||
1074 | "#endif\n" | ||
1075 | " /*FALLTHROUGH*/\n"; | ||
1076 | /* | ||
1077 | * it doesn't really matter whether hval is an 'int' or 'unsigned int', but | ||
1078 | * 'unsigned int' gives fewer warnings | ||
1079 | */ | ||
1080 | printf( | ||
1081 | " %sunsigned int hval = %s;\n\n" | ||
1082 | " switch (%s)\n" | ||
1083 | " {\n" | ||
1084 | " default:\n", register_scs, t->hash_includes_len ? "len" : "0", | ||
1085 | t->hash_includes_len ? "hval" : "len"); | ||
1086 | loop { | ||
1087 | if (key_pos == POS_LASTCHAR || key_pos < t->max_key_len) | ||
1088 | break; | ||
1089 | key_pos = positer_next(iter); | ||
1090 | if (key_pos == POSITER_EOS) | ||
1091 | break; | ||
1092 | } | ||
1093 | if (key_pos != POSITER_EOS && key_pos != POS_LASTCHAR) { | ||
1094 | s32 i; | ||
1095 | |||
1096 | i = key_pos; | ||
1097 | loop { | ||
1098 | if (i > key_pos) | ||
1099 | printf("%s", fallthrough_marker); | ||
1100 | loop { | ||
1101 | if (i <= key_pos) | ||
1102 | break; | ||
1103 | printf(" case %d:\n", i); | ||
1104 | i--; | ||
1105 | } | ||
1106 | printf(" hval += "); | ||
1107 | output_asso_values_ref(t, key_pos); | ||
1108 | printf(";\n"); | ||
1109 | key_pos = positer_next(iter); | ||
1110 | if (key_pos == POSITER_EOS || key_pos == POS_LASTCHAR) | ||
1111 | break; | ||
1112 | } | ||
1113 | if (i >= t->min_key_len) | ||
1114 | printf("%s", fallthrough_marker); | ||
1115 | loop { | ||
1116 | if (i < t->min_key_len) | ||
1117 | break; | ||
1118 | printf(" case %d:\n", i); | ||
1119 | i--; | ||
1120 | } | ||
1121 | } | ||
1122 | printf( | ||
1123 | " break;\n" | ||
1124 | " }\n" | ||
1125 | " return hval"); | ||
1126 | if (key_pos == POS_LASTCHAR) { | ||
1127 | printf(" + "); | ||
1128 | output_asso_values_ref(t, POS_LASTCHAR); | ||
1129 | } | ||
1130 | printf (";\n"); | ||
1131 | } | ||
1132 | positer_del(iter); | ||
1133 | } | ||
1134 | printf ("}\n\n"); | ||
1135 | }/*}}}*/ | ||
1136 | /*{{{ output_asso_values_ref */ | ||
1137 | /* Generates a C expression for an asso_values[] reference. */ | ||
1138 | static void output_asso_values_ref(struct Output *t, s32 pos) | ||
1139 | { | ||
1140 | printf("asso_values["); | ||
1141 | /* | ||
1142 | * Always cast to unsigned char. This is necessary when the alpha_inc is nonzero, and also | ||
1143 | * avoids a gcc warning "subscript has type 'char'". | ||
1144 | */ | ||
1145 | if (OPTS(CPLUSPLUS)) { | ||
1146 | /* | ||
1147 | * In C++, a C style cast may lead to a 'warning: use of old-style cast'. | ||
1148 | * Therefore prefer the C++ style cast syntax. | ||
1149 | */ | ||
1150 | printf("static_cast<unsigned char>("); | ||
1151 | output_asso_values_index(t, pos); | ||
1152 | printf(")"); | ||
1153 | } else { | ||
1154 | printf("(unsigned char)"); | ||
1155 | output_asso_values_index(t, pos); | ||
1156 | } | ||
1157 | printf("]"); | ||
1158 | }/*}}}*/ | ||
1159 | /*{{{ output_asso_values_index */ | ||
1160 | /* generates a C expression for an asso_values[] index */ | ||
1161 | static void output_asso_values_index(struct Output *t, s32 pos) | ||
1162 | { | ||
1163 | if (pos == POS_LASTCHAR) | ||
1164 | printf("str[len - 1]"); | ||
1165 | else { | ||
1166 | printf("str[%d]", pos); | ||
1167 | if (t->alpha_inc[pos]) | ||
1168 | printf("+%u", t->alpha_inc[pos]); | ||
1169 | } | ||
1170 | }/*}}}*/ | ||
1171 | /*{{{ output_lookup_pools */ | ||
1172 | /* generate all pools needed for the lookup function */ | ||
1173 | static void output_lookup_pools(struct Output *t) | ||
1174 | { | ||
1175 | if (OPTS(SWITCH)) { | ||
1176 | if (OPTS(TYPE) || (OPTS(DUP) && t->total_duplicates > 0)) | ||
1177 | output_string_pool(t); | ||
1178 | } else | ||
1179 | output_string_pool(t); | ||
1180 | }/*}}}*/ | ||
1181 | /*{{{ output_string_pool */ | ||
1182 | /* | ||
1183 | * Prints out the string pool, containing the strings of the keyword table. | ||
1184 | * Only called if option[SHAREDLIB] | ||
1185 | */ | ||
1186 | static void output_string_pool(struct Output *t) | ||
1187 | { | ||
1188 | u8 *indent; | ||
1189 | s32 index; | ||
1190 | struct Keyword_List *tmp; | ||
1191 | |||
1192 | indent = OPTS(TYPE) || OPTS(GLOBAL) ? "" : " "; | ||
1193 | |||
1194 | printf( | ||
1195 | "%sstruct %s_t\n" | ||
1196 | "%s {\n", indent, options->stringpool_name, indent); | ||
1197 | tmp = t->head; | ||
1198 | index = 0; | ||
1199 | loop { | ||
1200 | struct Keyword *kw; | ||
1201 | |||
1202 | if (tmp == 0) | ||
1203 | break; | ||
1204 | kw = tmp->kw; | ||
1205 | /* | ||
1206 | * If generating a switch statement, and there is no user defined type, we generate | ||
1207 | * non-duplicates directly in the code. Only duplicates go into the table. | ||
1208 | */ | ||
1209 | if (OPTS(SWITCH) && !OPTS(TYPE) && kw->duplicate_link == 0) | ||
1210 | continue; | ||
1211 | if (!OPTS(SWITCH) && !OPTS(DUP)) | ||
1212 | index = kw->hash_value; | ||
1213 | printf("%s char %s_str%d[sizeof(", indent, options->stringpool_name, index); | ||
1214 | output_string(kw->allchars, kw->allchars_length); | ||
1215 | printf(")];\n"); | ||
1216 | /* deal with duplicates specially */ | ||
1217 | if (kw->duplicate_link) {/* implies option[DUP] */ | ||
1218 | struct Keyword *links; | ||
1219 | |||
1220 | links = kw->duplicate_link; | ||
1221 | loop { | ||
1222 | if (links == 0) | ||
1223 | break; | ||
1224 | if (!(links->allchars_length == kw->allchars_length | ||
1225 | && memcmp(links->allchars, kw->allchars, | ||
1226 | kw->allchars_length) == 0)) { | ||
1227 | ++index; | ||
1228 | printf("%s char %s_str%d[sizeof(", indent, | ||
1229 | options->stringpool_name, index); | ||
1230 | output_string(links->allchars, links->allchars_length); | ||
1231 | printf(")];\n"); | ||
1232 | } | ||
1233 | links = links->duplicate_link; | ||
1234 | } | ||
1235 | } | ||
1236 | ++index; | ||
1237 | tmp = tmp->next; | ||
1238 | } | ||
1239 | printf( | ||
1240 | "%s };\n", indent); | ||
1241 | printf( | ||
1242 | "%sstatic %sstruct %s_t %s_contents =\n" | ||
1243 | "%s {\n", indent, const_readonly_array, options->stringpool_name, options->stringpool_name, | ||
1244 | indent); | ||
1245 | tmp = t->head; | ||
1246 | index = 0; | ||
1247 | loop { | ||
1248 | struct Keyword *kw; | ||
1249 | |||
1250 | if (tmp == 0) | ||
1251 | break; | ||
1252 | kw = tmp->kw; | ||
1253 | /* | ||
1254 | * If generating a switch statement, and there is no user defined type, we generate | ||
1255 | * non-duplicates directly in the code. Only duplicates go into the table. | ||
1256 | */ | ||
1257 | if (OPTS(SWITCH) && !OPTS(TYPE) && kw->duplicate_link == 0) | ||
1258 | continue; | ||
1259 | if (index > 0) | ||
1260 | printf(",\n"); | ||
1261 | |||
1262 | if (!OPTS(SWITCH) && !OPTS(DUP)) | ||
1263 | index = kw->hash_value; | ||
1264 | printf( | ||
1265 | "%s ", indent); | ||
1266 | output_string(kw->allchars, kw->allchars_length); | ||
1267 | /* deal with duplicates specially */ | ||
1268 | if (kw->duplicate_link != 0) {/* implies option[DUP] */ | ||
1269 | struct Keyword *links; | ||
1270 | |||
1271 | links = kw->duplicate_link; | ||
1272 | loop { | ||
1273 | if (links == 0) | ||
1274 | break; | ||
1275 | if (!(links->allchars_length == kw->allchars_length | ||
1276 | && memcmp(links->allchars, kw->allchars, | ||
1277 | kw->allchars_length) == 0)) { | ||
1278 | ++index; | ||
1279 | printf(",\n"); | ||
1280 | printf( | ||
1281 | "%s ", indent); | ||
1282 | output_string(links->allchars, links->allchars_length); | ||
1283 | } | ||
1284 | links = links->duplicate_link; | ||
1285 | } | ||
1286 | } | ||
1287 | ++index; | ||
1288 | tmp = tmp->next; | ||
1289 | } | ||
1290 | if (index > 0) | ||
1291 | printf("\n"); | ||
1292 | printf( | ||
1293 | "%s };\n", indent); | ||
1294 | printf( | ||
1295 | "%s#define %s ((%schar *) &%s_contents)\n", indent, options->stringpool_name, const_always, | ||
1296 | options->stringpool_name); | ||
1297 | if (OPTS(GLOBAL)) | ||
1298 | printf( | ||
1299 | "\n"); | ||
1300 | }/*}}}*/ | ||
1301 | /*{{{ output_lookup_tables */ | ||
1302 | /* generate all the tables needed for the lookup function */ | ||
1303 | static void output_lookup_tables(struct Output *t) | ||
1304 | { | ||
1305 | if (OPTS(SWITCH)) { | ||
1306 | /* use the switch in place of lookup table */ | ||
1307 | if (OPTS(LENTABLE) && (OPTS(DUP) && t->total_duplicates > 0)) | ||
1308 | output_keylength_table(t); | ||
1309 | if (OPTS(TYPE) || (OPTS(DUP) && t->total_duplicates > 0)) | ||
1310 | output_keyword_table(t); | ||
1311 | } else { | ||
1312 | /* use the lookup table, in place of switch */ | ||
1313 | if (OPTS(LENTABLE)) | ||
1314 | output_keylength_table(t); | ||
1315 | output_keyword_table(t); | ||
1316 | output_lookup_array(t); | ||
1317 | } | ||
1318 | }/*}}}*/ | ||
1319 | /*{{{ output_keylength_table */ | ||
1320 | /* | ||
1321 | * Prints out a table of keyword lengths, for use with the comparison code in generated function | ||
1322 | * 'in_word_set'. Only called if option[LENTABLE]. | ||
1323 | */ | ||
1324 | static void output_keylength_table(struct Output *t) | ||
1325 | { | ||
1326 | s32 columns; | ||
1327 | u8 *indent; | ||
1328 | s32 index; | ||
1329 | s32 column; | ||
1330 | struct Keyword_List *tmp; | ||
1331 | |||
1332 | columns = 14; | ||
1333 | indent = OPTS(GLOBAL) ? "" : " "; | ||
1334 | |||
1335 | printf( | ||
1336 | "%sstatic %s%s %s[] =\n" | ||
1337 | "%s {", indent, const_readonly_array, smallest_integral_type(t->max_key_len), | ||
1338 | options->lengthtable_name, indent); | ||
1339 | column = 0; | ||
1340 | tmp = t->head; | ||
1341 | index = 0; | ||
1342 | loop { | ||
1343 | struct Keyword *kw; | ||
1344 | |||
1345 | if (tmp == 0) | ||
1346 | break; | ||
1347 | kw = tmp->kw; | ||
1348 | /* | ||
1349 | * If generating a switch statement, and there is no user defined type, we generate | ||
1350 | * non-duplicates directly in the code. Only duplicates go into the table. | ||
1351 | */ | ||
1352 | if (OPTS(SWITCH) && !OPTS(TYPE) && kw->duplicate_link == 0) | ||
1353 | continue; | ||
1354 | if (index < kw->hash_value && !OPTS(SWITCH) && !OPTS(DUP)) { | ||
1355 | /* some blank entries */ | ||
1356 | loop { | ||
1357 | if (index >= kw->hash_value) | ||
1358 | break; | ||
1359 | if (index > 0) | ||
1360 | printf(","); | ||
1361 | if ((column % columns) == 0) | ||
1362 | printf( | ||
1363 | "\n%s ", indent); | ||
1364 | ++column; | ||
1365 | printf("%3d", 0); | ||
1366 | ++index; | ||
1367 | } | ||
1368 | } | ||
1369 | if (index > 0) | ||
1370 | printf(","); | ||
1371 | if ((column % columns) == 0) | ||
1372 | printf( | ||
1373 | "\n%s ", indent); | ||
1374 | ++column; | ||
1375 | printf("%3d", kw->allchars_length); | ||
1376 | ++index; | ||
1377 | /* deal with duplicates specially */ | ||
1378 | if (kw->duplicate_link != 0) { | ||
1379 | struct Keyword *links; | ||
1380 | |||
1381 | links = kw->duplicate_link; | ||
1382 | loop { | ||
1383 | if (links == 0) | ||
1384 | break; | ||
1385 | printf(","); | ||
1386 | if ((column % columns) == 0) | ||
1387 | printf( | ||
1388 | "\n%s ", indent); | ||
1389 | ++column; | ||
1390 | printf("%3d", links->allchars_length); | ||
1391 | ++index; | ||
1392 | links = links->duplicate_link; | ||
1393 | } | ||
1394 | } | ||
1395 | tmp = tmp->next; | ||
1396 | } | ||
1397 | printf( | ||
1398 | "\n%s };\n", indent); | ||
1399 | if (OPTS(GLOBAL)) | ||
1400 | printf( | ||
1401 | "\n"); | ||
1402 | }/*}}}*/ | ||
1403 | /*{{{ output_keyword_table */ | ||
1404 | /* prints out the array containing the keywords for the hash function */ | ||
1405 | static void output_keyword_table(struct Output *t) | ||
1406 | { | ||
1407 | u8 *indent; | ||
1408 | s32 index; | ||
1409 | struct Keyword_List *tmp; | ||
1410 | |||
1411 | indent = OPTS(GLOBAL) ? "" : " "; | ||
1412 | printf( | ||
1413 | "%sstatic ", indent); | ||
1414 | output_const_type(const_readonly_array, t->wordlist_eltype); | ||
1415 | printf("%s[] =\n" | ||
1416 | "%s {\n", options->wordlist_name, indent); | ||
1417 | /* generate an array of reserved words at appropriate locations */ | ||
1418 | tmp = t->head; | ||
1419 | index = 0; | ||
1420 | loop { | ||
1421 | struct Keyword *kw; | ||
1422 | |||
1423 | if (tmp == 0) | ||
1424 | break; | ||
1425 | kw = tmp->kw; | ||
1426 | /* | ||
1427 | * If generating a switch statement, and there is no user defined type, we generate | ||
1428 | * non-duplicates directly in the code. Only duplicates go into the table. | ||
1429 | */ | ||
1430 | if (OPTS(SWITCH) && !OPTS(TYPE) && kw->duplicate_link == 0) | ||
1431 | continue; | ||
1432 | if (index > 0) | ||
1433 | printf(",\n"); | ||
1434 | if (index < kw->hash_value && !OPTS(SWITCH) && !OPTS(DUP)) { | ||
1435 | /* some blank entries */ | ||
1436 | output_keyword_blank_entries(kw->hash_value - index, indent); | ||
1437 | printf(",\n"); | ||
1438 | index = kw->hash_value; | ||
1439 | } | ||
1440 | kw->final_index = index; | ||
1441 | output_keyword_entry(kw, index, indent, false); | ||
1442 | /* deal with duplicates specially */ | ||
1443 | if (kw->duplicate_link != 0) { /* implies option[DUP] */ | ||
1444 | struct Keyword *links; | ||
1445 | |||
1446 | links = kw->duplicate_link; | ||
1447 | loop { | ||
1448 | s32 stringpool_index; | ||
1449 | |||
1450 | if (links == 0) | ||
1451 | break; | ||
1452 | ++index; | ||
1453 | links->final_index = index; | ||
1454 | printf(",\n"); | ||
1455 | stringpool_index = | ||
1456 | (links->allchars_length == kw->allchars_length | ||
1457 | && memcmp(links->allchars, kw->allchars, | ||
1458 | kw->allchars_length) == 0 | ||
1459 | ? kw->final_index : links->final_index); | ||
1460 | output_keyword_entry(links, stringpool_index, indent, true); | ||
1461 | links = links->duplicate_link; | ||
1462 | } | ||
1463 | } | ||
1464 | ++index; | ||
1465 | tmp = tmp->next; | ||
1466 | } | ||
1467 | if (index > 0) | ||
1468 | printf("\n"); | ||
1469 | printf( | ||
1470 | "%s };\n\n", indent); | ||
1471 | }/*}}}*/ | ||
1472 | /*{{{ output_lookup_array */ | ||
1473 | /* | ||
1474 | * generates the large, sparse table that maps hash values into the smaller, contiguous range of the | ||
1475 | * keyword table | ||
1476 | */ | ||
1477 | static void output_lookup_array(struct Output *t) | ||
1478 | { | ||
1479 | s32 DEFAULT_VALUE; | ||
1480 | struct Duplicate_Entry *duplicates; | ||
1481 | s32 *lookup_array; | ||
1482 | s32 lookup_array_size; | ||
1483 | struct Duplicate_Entry *dup_ptr; | ||
1484 | s32 *lookup_ptr; | ||
1485 | struct Keyword_List *tmp; | ||
1486 | s32 min; | ||
1487 | s32 max; | ||
1488 | u8 *indent; | ||
1489 | s32 field_width; | ||
1490 | s32 columns; | ||
1491 | s32 column; | ||
1492 | s32 i; | ||
1493 | if (!OPTS(DUP)) | ||
1494 | return; | ||
1495 | |||
1496 | DEFAULT_VALUE = -1; | ||
1497 | |||
1498 | duplicates = calloc(t->total_duplicates, sizeof(*duplicates)); | ||
1499 | lookup_array = calloc(t->max_hash_value + 1 + 2 * t->total_duplicates, | ||
1500 | sizeof(*lookup_array)); | ||
1501 | lookup_array_size = t->max_hash_value + 1; | ||
1502 | dup_ptr = &duplicates[0]; | ||
1503 | lookup_ptr = &lookup_array[t->max_hash_value + 1 + 2 * t->total_duplicates]; | ||
1504 | |||
1505 | loop { | ||
1506 | if (lookup_ptr <= lookup_array) | ||
1507 | break; | ||
1508 | *--lookup_ptr = DEFAULT_VALUE; | ||
1509 | } | ||
1510 | /* now dup_ptr = &duplicates[0] and lookup_ptr = &lookup_array[0] */ | ||
1511 | tmp = t->head; | ||
1512 | loop { | ||
1513 | s32 hash_value; | ||
1514 | |||
1515 | if (tmp == 0) | ||
1516 | break; | ||
1517 | hash_value = tmp->kw->hash_value; | ||
1518 | lookup_array[hash_value] = tmp->kw->final_index; | ||
1519 | if (OPTS(DEBUG)) | ||
1520 | fprintf(stderr, "keyword = %.*s, index = %d\n", tmp->kw->allchars_length, tmp->kw->allchars, tmp->kw->final_index); | ||
1521 | if (tmp->kw->duplicate_link != 0) { | ||
1522 | struct Keyword *ptr; | ||
1523 | |||
1524 | /* start a duplicate entry */ | ||
1525 | dup_ptr->hash_value = hash_value; | ||
1526 | dup_ptr->index = tmp->kw->final_index; | ||
1527 | dup_ptr->count = 1; | ||
1528 | |||
1529 | ptr = tmp->kw->duplicate_link; | ||
1530 | loop { | ||
1531 | if (ptr != 0) | ||
1532 | break; | ||
1533 | ++(dup_ptr->count); | ||
1534 | if (OPTS(DEBUG)) | ||
1535 | fprintf(stderr, "static linked keyword = %.*s, index = %d\n", ptr->allchars_length, ptr->allchars, ptr->final_index); | ||
1536 | ptr = ptr->duplicate_link; | ||
1537 | } | ||
1538 | ++dup_ptr; | ||
1539 | } | ||
1540 | tmp = tmp->next; | ||
1541 | } | ||
1542 | loop { | ||
1543 | s32 i; | ||
1544 | |||
1545 | if (dup_ptr <= duplicates) | ||
1546 | break; | ||
1547 | dup_ptr--; | ||
1548 | if (OPTS(DEBUG)) | ||
1549 | fprintf(stderr, "dup_ptr[%lu]: hash_value = %d, index = %d, count = %d\n", (unsigned long)(dup_ptr - duplicates), dup_ptr->hash_value, dup_ptr->index, dup_ptr->count); | ||
1550 | /* | ||
1551 | * start searching for available space towards the right part of the lookup | ||
1552 | * array | ||
1553 | */ | ||
1554 | i = dup_ptr->hash_value; | ||
1555 | loop { | ||
1556 | if (i >= lookup_array_size - 1) | ||
1557 | break; | ||
1558 | if (lookup_array[i] == DEFAULT_VALUE && lookup_array[i + 1] | ||
1559 | == DEFAULT_VALUE) | ||
1560 | goto found_i; | ||
1561 | ++i; | ||
1562 | } | ||
1563 | /* if we didn't find it to the right look to the left instead... */ | ||
1564 | i = dup_ptr->hash_value - 1; | ||
1565 | loop { | ||
1566 | if (i < 0) | ||
1567 | break; | ||
1568 | if (lookup_array[i] == DEFAULT_VALUE && lookup_array[i + 1] | ||
1569 | == DEFAULT_VALUE) | ||
1570 | goto found_i; | ||
1571 | i--; | ||
1572 | } | ||
1573 | /* append to the end of lookup_array */ | ||
1574 | i = lookup_array_size; | ||
1575 | lookup_array_size += 2; | ||
1576 | found_i: | ||
1577 | /* | ||
1578 | * Put in an indirection from dup_ptr->_hash_value to i. | ||
1579 | * At i and i+1 store dup_ptr->_final_index and dup_ptr->count. | ||
1580 | */ | ||
1581 | lookup_array[dup_ptr->hash_value] = - 1 - t->total_keys - i; | ||
1582 | lookup_array[i] = - t->total_keys + dup_ptr->index; | ||
1583 | lookup_array[i + 1] = - dup_ptr->count; | ||
1584 | /* All these three values are <= -2, distinct from DEFAULT_VALUE */ | ||
1585 | } | ||
1586 | /* the values of the lookup array are now known */ | ||
1587 | min = S32_MAX; | ||
1588 | max = S32_MIN; | ||
1589 | lookup_ptr = lookup_array + lookup_array_size; | ||
1590 | loop { | ||
1591 | s32 val; | ||
1592 | |||
1593 | if (lookup_ptr <= lookup_array) | ||
1594 | break; | ||
1595 | val = *--lookup_ptr; | ||
1596 | if (min > val) | ||
1597 | min = val; | ||
1598 | if (max < val) | ||
1599 | max = val; | ||
1600 | } | ||
1601 | indent = OPTS(GLOBAL) ? "" : " "; | ||
1602 | printf( | ||
1603 | "%sstatic %s%s lookup[] =\n" | ||
1604 | "%s {", indent, const_readonly_array, smallest_integral_type_2(min, max), indent); | ||
1605 | /* calculate maximum number of digits required for MIN..MAX */ | ||
1606 | { | ||
1607 | s32 trunc; | ||
1608 | |||
1609 | field_width = 2; | ||
1610 | trunc = max; | ||
1611 | loop { | ||
1612 | trunc /= 10; | ||
1613 | if (trunc <= 0) | ||
1614 | break; | ||
1615 | ++field_width; | ||
1616 | } | ||
1617 | } | ||
1618 | if (min < 0) { | ||
1619 | s32 neg_field_width; | ||
1620 | s32 trunc; | ||
1621 | |||
1622 | neg_field_width = 2; | ||
1623 | trunc = -min; | ||
1624 | loop { | ||
1625 | trunc /= 10; | ||
1626 | if (trunc <= 0) | ||
1627 | break; | ||
1628 | ++neg_field_width; | ||
1629 | } | ||
1630 | ++neg_field_width; /* account for the minus sign */ | ||
1631 | if (field_width < neg_field_width) | ||
1632 | field_width = neg_field_width; | ||
1633 | } | ||
1634 | columns = 42 / field_width; | ||
1635 | column = 0; | ||
1636 | i = 0; | ||
1637 | loop { | ||
1638 | if (i >= lookup_array_size) | ||
1639 | break; | ||
1640 | if (i > 0) | ||
1641 | printf(","); | ||
1642 | if ((column % columns) == 0) | ||
1643 | printf("\n%s ", indent); | ||
1644 | ++column; | ||
1645 | printf("%*d", field_width, lookup_array[i]); | ||
1646 | ++i; | ||
1647 | } | ||
1648 | printf( | ||
1649 | "\n%s };\n\n", indent); | ||
1650 | free(duplicates); | ||
1651 | free(lookup_array); | ||
1652 | }/*}}}*/ | ||
1653 | /*{{{ output_lookup_function */ | ||
1654 | /* generates C code for the lookup function */ | ||
1655 | static void output_lookup_function(struct Output *t) | ||
1656 | { | ||
1657 | /* output the function's head */ | ||
1658 | /* | ||
1659 | * We don't declare the lookup function 'static' because we cannot make assumptions about | ||
1660 | * the compilation units of the user. | ||
1661 | * Since we don't make it 'static', it makes no sense to declare it 'inline', because | ||
1662 | * non-static inline functions must not reference static functions or variables, see ISO C | ||
1663 | * 99 section 6.7.4.(3). | ||
1664 | */ | ||
1665 | printf( | ||
1666 | "%s%s\n", const_for_struct, t->return_type); | ||
1667 | if (OPTS(CPLUSPLUS)) | ||
1668 | printf( | ||
1669 | "%s::", options->class_name); | ||
1670 | printf("%s ", options->function_name); | ||
1671 | printf( | ||
1672 | OPTS(KRC) ? "(str, len)\n" | ||
1673 | " %schar *str;\n" | ||
1674 | " %ssize_t len;\n" : | ||
1675 | OPTS(C) ? "(str, len)\n" | ||
1676 | " %sconst char *str;\n" | ||
1677 | " %ssize_t len;\n" : | ||
1678 | OPTS(ANSIC) || OPTS(CPLUSPLUS) ? "(%sconst char *str, %ssize_t len)\n" : | ||
1679 | "", register_scs, register_scs); | ||
1680 | |||
1681 | /* output the function's body */ | ||
1682 | printf( | ||
1683 | "{\n"); | ||
1684 | if (OPTS(ENUM) && !OPTS(GLOBAL)) | ||
1685 | output_constants_enum(t, " "); | ||
1686 | if (OPTS(SHAREDLIB) && !(OPTS(GLOBAL) || OPTS(TYPE))) | ||
1687 | output_lookup_pools(t); | ||
1688 | if (!OPTS(GLOBAL)) | ||
1689 | output_lookup_tables(t); | ||
1690 | if (OPTS(LENTABLE)) | ||
1691 | output_lookup_function_body(t, output_comparison_memcmp); | ||
1692 | else { | ||
1693 | if (OPTS(COMP)) | ||
1694 | output_lookup_function_body(t, output_comparison_strncmp); | ||
1695 | else | ||
1696 | output_lookup_function_body(t, output_comparison_strcmp); | ||
1697 | } | ||
1698 | printf( | ||
1699 | "}\n"); | ||
1700 | }/*}}}*/ | ||
1701 | /*{{{ output_lookup_function_body */ | ||
1702 | static void output_lookup_function_body(struct Output *t, | ||
1703 | void (*output_comparison)(u8 *expr1, u8 *expr2)) | ||
1704 | { | ||
1705 | printf( | ||
1706 | " if (len <= %sMAX_WORD_LENGTH && len >= %sMIN_WORD_LENGTH)\n" | ||
1707 | " {\n" | ||
1708 | " %sunsigned int key = %s (str, len);\n\n", options->constants_prefix, | ||
1709 | options->constants_prefix, register_scs, options->hash_name); | ||
1710 | if (OPTS(SWITCH)) { | ||
1711 | s32 switch_size; | ||
1712 | s32 num_switches; | ||
1713 | |||
1714 | switch_size = output_num_hash_values(t); | ||
1715 | num_switches = options->total_switches; | ||
1716 | if (num_switches > switch_size) | ||
1717 | num_switches = switch_size; | ||
1718 | printf( | ||
1719 | " if (key <= %sMAX_HASH_VALUE", options->constants_prefix); | ||
1720 | if (t->min_hash_value > 0) | ||
1721 | printf( | ||
1722 | " && key >= %sMIN_HASH_VALUE", options->constants_prefix); | ||
1723 | printf ( | ||
1724 | ")\n" | ||
1725 | " {\n"); | ||
1726 | if (OPTS(DUP) && t->total_duplicates > 0) { | ||
1727 | if (OPTS(LENTABLE)) | ||
1728 | printf( | ||
1729 | " %s%s%s *lengthptr;\n", register_scs, const_always, smallest_integral_type( | ||
1730 | t->max_key_len)); | ||
1731 | printf( | ||
1732 | " %s", register_scs); | ||
1733 | output_const_type(const_readonly_array, t->wordlist_eltype); | ||
1734 | printf("*wordptr;\n"); | ||
1735 | printf( | ||
1736 | " %s", register_scs); | ||
1737 | output_const_type(const_readonly_array, t->wordlist_eltype); | ||
1738 | printf("*wordendptr;\n"); | ||
1739 | } | ||
1740 | if (OPTS(TYPE)) { | ||
1741 | printf( | ||
1742 | " %s", register_scs); | ||
1743 | output_const_type(const_readonly_array, t->struct_tag); | ||
1744 | printf("*resword;\n\n"); | ||
1745 | } else | ||
1746 | printf( | ||
1747 | " %s%sresword;\n\n", register_scs, t->struct_tag); | ||
1748 | output_switches(t->head, num_switches, switch_size, t->min_hash_value, | ||
1749 | t->max_hash_value, 10); | ||
1750 | printf( | ||
1751 | " return 0;\n"); | ||
1752 | if (OPTS(DUP) && t->total_duplicates > 0) { | ||
1753 | s32 indent; | ||
1754 | |||
1755 | indent = 8; | ||
1756 | printf( | ||
1757 | "%*smulticompare:\n" | ||
1758 | "%*s while (wordptr < wordendptr)\n" | ||
1759 | "%*s {\n", indent, "", indent, "", indent, ""); | ||
1760 | if (OPTS(LENTABLE)) { | ||
1761 | printf( | ||
1762 | "%*s if (len == *lengthptr)\n" | ||
1763 | "%*s {\n", indent, "", indent, ""); | ||
1764 | indent += 4; | ||
1765 | } | ||
1766 | printf( | ||
1767 | "%*s %s%schar *s = ", indent, "", register_scs, const_always); | ||
1768 | if (OPTS(TYPE)) | ||
1769 | printf("wordptr->%s", options->slot_name); | ||
1770 | else | ||
1771 | printf("*wordptr"); | ||
1772 | if (OPTS(SHAREDLIB)) | ||
1773 | printf(" + %s", options->stringpool_name); | ||
1774 | printf(";\n\n" | ||
1775 | "%*s if (", indent, ""); | ||
1776 | output_comparison("str", "s"); | ||
1777 | printf(")\n" | ||
1778 | "%*s return %s;\n", indent, "", OPTS(TYPE) ? "wordptr" : "s"); | ||
1779 | if (OPTS(LENTABLE)) { | ||
1780 | indent -= 4; | ||
1781 | printf( | ||
1782 | "%*s }\n", indent, ""); | ||
1783 | } | ||
1784 | if (OPTS(LENTABLE)) | ||
1785 | printf( | ||
1786 | "%*s lengthptr++;\n", indent, ""); | ||
1787 | printf( | ||
1788 | "%*s wordptr++;\n" | ||
1789 | "%*s }\n" | ||
1790 | "%*s return 0;\n", indent, "", indent, "", indent, ""); | ||
1791 | } | ||
1792 | printf( | ||
1793 | " compare:\n"); | ||
1794 | if (OPTS(TYPE)) { | ||
1795 | printf( | ||
1796 | " {\n" | ||
1797 | " %s%schar *s = resword->%s", register_scs, const_always, options->slot_name); | ||
1798 | if (OPTS(SHAREDLIB)) | ||
1799 | printf(" + %s", options->stringpool_name); | ||
1800 | printf(";\n\n" | ||
1801 | " if ("); | ||
1802 | output_comparison("str", "s"); | ||
1803 | printf( | ||
1804 | ")\n" | ||
1805 | " return resword;\n" | ||
1806 | " }\n"); | ||
1807 | } else { | ||
1808 | output_comparison("str", "resword"); | ||
1809 | printf( | ||
1810 | ")\n" | ||
1811 | " return resword;\n"); | ||
1812 | } | ||
1813 | printf( | ||
1814 | " }\n"); | ||
1815 | } else { | ||
1816 | printf( | ||
1817 | " if (key <= %sMAX_HASH_VALUE)\n", options->constants_prefix); | ||
1818 | if (OPTS(DUP)) { | ||
1819 | s32 indent; | ||
1820 | |||
1821 | indent = 8; | ||
1822 | printf( | ||
1823 | "%*s{\n" | ||
1824 | "%*s %sint index = lookup[key];\n\n" | ||
1825 | "%*s if (index >= 0)\n", indent, "", indent, "", register_scs, indent, ""); | ||
1826 | if (OPTS(LENTABLE)) { | ||
1827 | printf( | ||
1828 | "%*s {\n" | ||
1829 | "%*s if (len == %s[index])\n", indent, "", indent, "", options->lengthtable_name); | ||
1830 | indent += 4; | ||
1831 | } | ||
1832 | printf( | ||
1833 | "%*s {\n" | ||
1834 | "%*s %s%schar *s = %s[index]", indent, "", indent, "", register_scs, const_always, | ||
1835 | options->wordlist_name); | ||
1836 | if (OPTS(TYPE)) | ||
1837 | printf(".%s", options->slot_name); | ||
1838 | if (OPTS(SHAREDLIB)) | ||
1839 | printf (" + %s", options->stringpool_name); | ||
1840 | printf(";\n\n" | ||
1841 | "%*s if (", indent, ""); | ||
1842 | output_comparison("str", "s"); | ||
1843 | printf (")\n" | ||
1844 | "%*s return ", indent, ""); | ||
1845 | if (OPTS(TYPE)) | ||
1846 | printf("&%s[index]", options->wordlist_name); | ||
1847 | else | ||
1848 | printf("s"); | ||
1849 | printf(";\n" | ||
1850 | "%*s }\n", indent, ""); | ||
1851 | if (OPTS(LENTABLE)) { | ||
1852 | indent -= 4; | ||
1853 | printf( | ||
1854 | "%*s }\n", indent, ""); | ||
1855 | } | ||
1856 | if (t->total_duplicates > 0) { | ||
1857 | printf( | ||
1858 | "%*s else if (index < -%sTOTAL_KEYWORDS)\n" | ||
1859 | "%*s {\n" | ||
1860 | "%*s %sint offset = - 1 - %sTOTAL_KEYWORDS - index;\n", indent, "", options->constants_prefix, | ||
1861 | indent, "", indent, "", register_scs, | ||
1862 | options->constants_prefix); | ||
1863 | if (OPTS(LENTABLE)) | ||
1864 | printf( | ||
1865 | "%*s %s%s%s *lengthptr = &%s[%sTOTAL_KEYWORDS + lookup[offset]];\n", indent, "", | ||
1866 | register_scs, const_always, | ||
1867 | smallest_integral_type(t->max_key_len), | ||
1868 | options->lengthtable_name, | ||
1869 | options->constants_prefix); | ||
1870 | printf( | ||
1871 | "%*s %s", indent, "", register_scs); | ||
1872 | output_const_type(const_readonly_array, t->wordlist_eltype); | ||
1873 | printf("*wordptr = &%s[%sTOTAL_KEYWORDS + lookup[offset]];\n", | ||
1874 | options->wordlist_name, options->constants_prefix); | ||
1875 | printf( | ||
1876 | "%*s %s", indent, "", register_scs); | ||
1877 | output_const_type(const_readonly_array, t->wordlist_eltype); | ||
1878 | printf("*wordendptr = wordptr + -lookup[offset + 1];\n\n"); | ||
1879 | printf( | ||
1880 | "%*s while (wordptr < wordendptr)\n" | ||
1881 | "%*s {\n", indent, "", indent, ""); | ||
1882 | if (OPTS(LENTABLE)) { | ||
1883 | printf( | ||
1884 | "%*s if (len == *lengthptr)\n" | ||
1885 | "%*s {\n", indent, "", indent, ""); | ||
1886 | indent += 4; | ||
1887 | } | ||
1888 | printf( | ||
1889 | "%*s %s%schar *s = ", indent, "", register_scs, const_always); | ||
1890 | if (OPTS(TYPE)) | ||
1891 | printf("wordptr->%s", options->slot_name); | ||
1892 | else | ||
1893 | printf("*wordptr"); | ||
1894 | if (OPTS(SHAREDLIB)) | ||
1895 | printf(" + %s", options->stringpool_name); | ||
1896 | printf (";\n\n" | ||
1897 | "%*s if (", indent, ""); | ||
1898 | output_comparison("str", "s"); | ||
1899 | printf (")\n" | ||
1900 | "%*s return %s;\n", indent, "", OPTS(TYPE) ? "wordptr" : "s"); | ||
1901 | if (OPTS(LENTABLE)) { | ||
1902 | indent -= 4; | ||
1903 | printf( | ||
1904 | "%*s }\n", indent, ""); | ||
1905 | } | ||
1906 | if (OPTS(LENTABLE)) | ||
1907 | printf( | ||
1908 | "%*s lengthptr++;\n", indent, ""); | ||
1909 | printf( | ||
1910 | "%*s wordptr++;\n" | ||
1911 | "%*s }\n" | ||
1912 | "%*s }\n", indent, "", indent, "", indent, ""); | ||
1913 | } | ||
1914 | printf( | ||
1915 | "%*s}\n", indent, ""); | ||
1916 | } else { | ||
1917 | s32 indent; | ||
1918 | |||
1919 | indent = 8; | ||
1920 | if (OPTS(LENTABLE)) { | ||
1921 | printf( | ||
1922 | "%*sif (len == %s[key])\n", indent, "", options->lengthtable_name); | ||
1923 | indent += 2; | ||
1924 | } | ||
1925 | if (OPTS(SHAREDLIB)) { | ||
1926 | if (!OPTS(LENTABLE)) { | ||
1927 | printf( | ||
1928 | "%*s{\n" | ||
1929 | "%*s %sint o = %s[key]", indent, "", indent, "", register_scs, | ||
1930 | options->wordlist_name); | ||
1931 | if (OPTS(TYPE)) | ||
1932 | printf(".%s", options->slot_name); | ||
1933 | printf (";\n" | ||
1934 | "%*s if (o >= 0)\n" | ||
1935 | "%*s {\n", indent, "", indent, ""); | ||
1936 | indent += 4; | ||
1937 | printf( | ||
1938 | "%*s %s%schar *s = o", indent, "", register_scs, const_always); | ||
1939 | } else { | ||
1940 | /* | ||
1941 | * no need for the (o >= 0) test, because the | ||
1942 | * (len == lengthtable[key]) test already guarantees that | ||
1943 | * key points to nonempty table entry | ||
1944 | */ | ||
1945 | printf ( | ||
1946 | "%*s{\n" | ||
1947 | "%*s %s%schar *s = %s[key]", indent, "", indent, "", register_scs, const_always, | ||
1948 | options->wordlist_name); | ||
1949 | if (OPTS(TYPE)) | ||
1950 | printf(".%s", options->slot_name); | ||
1951 | } | ||
1952 | printf (" + %s", options->stringpool_name); | ||
1953 | } else { | ||
1954 | printf( | ||
1955 | "%*s{\n" | ||
1956 | "%*s %s%schar *s = %s[key]", indent, "", indent, "", register_scs, const_always, | ||
1957 | options->wordlist_name); | ||
1958 | if (OPTS(TYPE)) | ||
1959 | printf(".%s", options->slot_name); | ||
1960 | } | ||
1961 | printf (";\n\n" | ||
1962 | "%*s if (", indent, ""); | ||
1963 | if (!OPTS(SHAREDLIB) && OPTS(NULLSTRINGS)) | ||
1964 | printf ("s && "); | ||
1965 | output_comparison("str", "s"); | ||
1966 | printf (")\n" | ||
1967 | "%*s return ", indent, ""); | ||
1968 | if (OPTS(TYPE)) | ||
1969 | printf("&%s[key]", options->wordlist_name); | ||
1970 | else | ||
1971 | printf("s"); | ||
1972 | printf(";\n"); | ||
1973 | if (OPTS(SHAREDLIB) && !OPTS(LENTABLE)) { | ||
1974 | indent -= 4; | ||
1975 | printf( | ||
1976 | "%*s }\n", indent, ""); | ||
1977 | } | ||
1978 | printf( | ||
1979 | "%*s}\n", indent, ""); | ||
1980 | } | ||
1981 | } | ||
1982 | printf( | ||
1983 | " }\n" | ||
1984 | " return 0;\n"); | ||
1985 | }/*}}}*/ | ||
1986 | /*{{{ output_num_hash_values */ | ||
1987 | /* Returns the number of different hash values. */ | ||
1988 | static s32 output_num_hash_values(struct Output *t) | ||
1989 | { | ||
1990 | s32 count; | ||
1991 | struct Keyword_List *tmp; | ||
1992 | /* | ||
1993 | * since the list is already sorted by hash value and doesn't contain duplicates, we can | ||
1994 | * simply count the number of keywords on the list | ||
1995 | */ | ||
1996 | count = 0; | ||
1997 | tmp = t->head; | ||
1998 | loop { | ||
1999 | if (tmp == 0) | ||
2000 | break; | ||
2001 | ++count; | ||
2002 | tmp = tmp->next; | ||
2003 | } | ||
2004 | return count; | ||
2005 | }/*}}}*/ | ||
2006 | /*------------------------------------------------------------------------------------------------*/ | ||
2007 | #undef USE_DOWNCASE_TABLE | ||
2008 | /*------------------------------------------------------------------------------------------------*/ | ||
2009 | #define EPILOG | ||
2010 | #include "namespace/globals.h" | ||
2011 | #include "namespace/options.h" | ||
2012 | #include "namespace/output.h" | ||
2013 | #include "namespace/output.c" | ||
2014 | #include "namespace/keyword.h" | ||
2015 | #include "namespace/keyword_list.h" | ||
2016 | #include "namespace/positions.h" | ||
2017 | #undef EPILOG | ||
2018 | /*------------------------------------------------------------------------------------------------*/ | ||
2019 | #endif |
File output.h added (mode: 100644) (index 0000000..f0221f3) | |||
1 | #ifndef CGPERF_OUTPUT_H | ||
2 | #define CGPERF_OUTPUT_H | ||
3 | #include <stdbool.h> | ||
4 | #include "c_fixing.h" | ||
5 | #include "keyword_list.h" | ||
6 | #include "positions.h" | ||
7 | /*------------------------------------------------------------------------------------------------*/ | ||
8 | #include "namespace/globals.h" | ||
9 | #include "namespace/options.h" | ||
10 | #include "namespace/output.h" | ||
11 | #include "namespace/keyword_list.h" | ||
12 | #include "namespace/positions.h" | ||
13 | /*------------------------------------------------------------------------------------------------*/ | ||
14 | /*{{{ types */ | ||
15 | struct Output { | ||
16 | /*{{{ private */ | ||
17 | /* linked list of keywords */ | ||
18 | struct Keyword_List *head; | ||
19 | /* declaration of struct type for a keyword and its attributes */ | ||
20 | u8 *struct_decl; | ||
21 | u32 struct_decl_lineno; | ||
22 | /* pointer to return type for lookup function */ | ||
23 | u8 *return_type; | ||
24 | /* shorthand for user-defined struct tag type */ | ||
25 | u8 *struct_tag; | ||
26 | /* the C code from the declarations section */ | ||
27 | u8 *verbatim_declarations; | ||
28 | u8 *verbatim_declarations_end; | ||
29 | u32 verbatim_declarations_lineno; | ||
30 | /* the C code from the end of the file */ | ||
31 | u8 *verbatim_code; | ||
32 | u8 *verbatim_code_end; | ||
33 | u32 verbatim_code_lineno; | ||
34 | /* whether the keyword chars would have different values in a different character set */ | ||
35 | bool charset_dependent; | ||
36 | /* total number of keys, counting duplicates */ | ||
37 | s32 total_keys; | ||
38 | /* maximum length of the longest keyword */ | ||
39 | s32 max_key_len; | ||
40 | /* minimum length of the shortest keyword */ | ||
41 | s32 min_key_len; | ||
42 | /* whether the hash function includes the length */ | ||
43 | bool hash_includes_len; | ||
44 | /* key positions */ | ||
45 | struct Positions *key_positions; | ||
46 | /* adjustments to add to bytes add specific key positions */ | ||
47 | u32 *alpha_inc; | ||
48 | /* total number of duplicate hash values */ | ||
49 | s32 total_duplicates; | ||
50 | /* size of alphabet */ | ||
51 | u32 alpha_size; | ||
52 | /* value associated with each character */ | ||
53 | s32 *asso_values; | ||
54 | /* minimum hash value for all keywords */ | ||
55 | s32 min_hash_value; | ||
56 | /* maximum hash value for all keywords */ | ||
57 | s32 max_hash_value; | ||
58 | /* element type of keyword array */ | ||
59 | u8 *wordlist_eltype; | ||
60 | /*}}} private -- END */ | ||
61 | }; | ||
62 | /*}}} types -- END */ | ||
63 | /*{{{ public static methods */ | ||
64 | static struct Output *output_new(struct Keyword_List *head, u8 *struct_decl, | ||
65 | u32 struct_decl_lineno, u8 *return_type, | ||
66 | u8 *struct_tag, u8 *verbatim_declarations, | ||
67 | u8 *verbatim_declarations_end, | ||
68 | u32 verbatim_declarations_lineno, | ||
69 | u8 *verbatim_code, u8 *verbatim_code_end, | ||
70 | u32 verbatim_code_lineno, bool charset_dependent, | ||
71 | s32 total_keys, s32 max_key_len, s32 min_key_len, | ||
72 | bool hash_includes_len, struct Positions *positions, | ||
73 | u32 *alpha_inc, s32 total_duplicates, | ||
74 | u32 alpha_size, s32 *asso_values); | ||
75 | static void output_do(struct Output *t); | ||
76 | static void output_compute_min_max(struct Output *t); | ||
77 | /*}}} public static methods -- END */ | ||
78 | /*{{{ private static methods */ | ||
79 | static void output_constants_defines(struct Output *t); | ||
80 | static void output_constants_enum(struct Output *t, u8 *indentation); | ||
81 | static void output_hash_function(struct Output *t); | ||
82 | static void output_asso_values_ref(struct Output *t, s32 pos); | ||
83 | static void output_asso_values_index(struct Output *t, s32 pos); | ||
84 | static void output_lookup_pools(struct Output *t); | ||
85 | static void output_string_pool(struct Output *t); | ||
86 | static void output_lookup_tables(struct Output *t); | ||
87 | static void output_keylength_table(struct Output *t); | ||
88 | static void output_keyword_table(struct Output *t); | ||
89 | static void output_lookup_array(struct Output *t); | ||
90 | static void output_lookup_function(struct Output *t); | ||
91 | static void output_lookup_function_body(struct Output *t, | ||
92 | void (*output_comparison)(u8 *expr1, u8 *expr2)); | ||
93 | static s32 output_num_hash_values(struct Output *t); | ||
94 | /*}}} private static methods -- END */ | ||
95 | /*------------------------------------------------------------------------------------------------*/ | ||
96 | #define EPILOG | ||
97 | #include "namespace/globals.h" | ||
98 | #include "namespace/options.h" | ||
99 | #include "namespace/output.h" | ||
100 | #include "namespace/keyword_list.h" | ||
101 | #include "namespace/positions.h" | ||
102 | #undef EPILOG | ||
103 | /*------------------------------------------------------------------------------------------------*/ | ||
104 | #endif | ||
105 |
File positions.c added (mode: 100644) (index 0000000..84b2564) | |||
1 | #ifndef CGPERF_POSITIONS_C | ||
2 | #define CGPERF_POSITIONS_C | ||
3 | #include <stdbool.h> | ||
4 | #include <stdlib.h> | ||
5 | #include <stdio.h> | ||
6 | #include <string.h> | ||
7 | #include "c_fixing.h" | ||
8 | #include "positions.h" | ||
9 | /*------------------------------------------------------------------------------------------------*/ | ||
10 | #include "namespace/positions.h" | ||
11 | /*------------------------------------------------------------------------------------------------*/ | ||
12 | /*{{{ pos_new */ | ||
13 | static struct Positions *pos_new(void) | ||
14 | { | ||
15 | struct Positions *t; | ||
16 | |||
17 | t = calloc(1, sizeof(*t)); | ||
18 | t->useall = false; | ||
19 | t->size = 0; | ||
20 | return t; | ||
21 | }/*}}}*/ | ||
22 | /*{{{ pos_new_cpy */ | ||
23 | /* the copy constructor */ | ||
24 | static struct Positions *pos_new_cpy(struct Positions *src) | ||
25 | { | ||
26 | struct Positions *t; | ||
27 | |||
28 | t = malloc(sizeof(*t)); | ||
29 | memcpy(t, src, sizeof(struct Positions)); | ||
30 | return t; | ||
31 | }/*}}}*/ | ||
32 | /*{{{ pos_del */ | ||
33 | static void pos_del(struct Positions *t) | ||
34 | { | ||
35 | free(t); | ||
36 | }/*}}}*/ | ||
37 | /*{{{ pos_set_useall */ | ||
38 | static void pos_set_useall(struct Positions *t, bool useall) | ||
39 | { | ||
40 | t->useall = useall; | ||
41 | if (useall) { | ||
42 | s32 *ptr; | ||
43 | s32 i; | ||
44 | /* The positions are 0, 1, ..., Positions_max_key_pos-1, in descending order */ | ||
45 | t->size = POS_MAX_KEY_POS; | ||
46 | ptr = t->positions; | ||
47 | i = POS_MAX_KEY_POS - 1; | ||
48 | loop { | ||
49 | if (i < 0) | ||
50 | break; | ||
51 | *ptr++ = i; | ||
52 | i--; | ||
53 | } | ||
54 | } | ||
55 | }/*}}}*/ | ||
56 | /*{{{ pos_sort */ | ||
57 | static bool pos_sort(struct Positions *t) | ||
58 | { | ||
59 | /* | ||
60 | * Sorts the array in reverse order. Returns true if there are no duplicates, false | ||
61 | * otherwise | ||
62 | */ | ||
63 | bool duplicate_free; | ||
64 | s32 *base; | ||
65 | u32 len; | ||
66 | u32 i; | ||
67 | |||
68 | if (t->useall) | ||
69 | return true; | ||
70 | /* bubble sort */ | ||
71 | duplicate_free = true; | ||
72 | base = t->positions; | ||
73 | len = t->size; | ||
74 | |||
75 | i = 1; | ||
76 | loop { | ||
77 | u32 j; | ||
78 | s32 tmp; | ||
79 | |||
80 | if (i >= len) | ||
81 | break; | ||
82 | j = i; | ||
83 | tmp = base[j]; | ||
84 | loop { | ||
85 | if ((j == 0) || (tmp < base[j - 1])) | ||
86 | break; | ||
87 | base[j] = base[j - 1]; | ||
88 | if (base[j] == tmp) /* oh no, a duplicate!!! */ | ||
89 | duplicate_free = false; | ||
90 | j--; | ||
91 | } | ||
92 | base[j] = tmp; | ||
93 | ++i; | ||
94 | } | ||
95 | return duplicate_free; | ||
96 | }/*}}}*/ | ||
97 | /*{{{ pos_contains */ | ||
98 | /* assumes the array is in reverse order */ | ||
99 | static bool pos_contains(struct Positions *t, s32 pos) | ||
100 | { | ||
101 | u32 count; | ||
102 | s32 *p; | ||
103 | |||
104 | count = t->size; | ||
105 | p = t->positions + t->size - 1; | ||
106 | loop { | ||
107 | if (count == 0) | ||
108 | break; | ||
109 | if (*p == pos) | ||
110 | return true; | ||
111 | if (*p > pos) | ||
112 | break; | ||
113 | p--; | ||
114 | count--; | ||
115 | } | ||
116 | return false; | ||
117 | }/*}}}*/ | ||
118 | /*{{{ pos_remove */ | ||
119 | static void pos_remove(struct Positions *t, s32 pos) | ||
120 | { | ||
121 | u32 count; | ||
122 | |||
123 | pos_set_useall(t, false); | ||
124 | count = t->size; | ||
125 | if (count > 0) { | ||
126 | s32 *p; | ||
127 | |||
128 | p = t->positions + t->size - 1; | ||
129 | if (*p == pos) { | ||
130 | (t->size)--; | ||
131 | return; | ||
132 | } | ||
133 | if (*p < pos) { | ||
134 | s32 prev; | ||
135 | |||
136 | prev = *p; | ||
137 | loop { | ||
138 | s32 curr; | ||
139 | |||
140 | p--; | ||
141 | count--; | ||
142 | if (count == 0) | ||
143 | break; | ||
144 | if (*p == pos) { | ||
145 | *p = prev; | ||
146 | (t->size)--; | ||
147 | return; | ||
148 | } | ||
149 | if (*p > pos) | ||
150 | break; | ||
151 | curr = *p; | ||
152 | *p = prev; | ||
153 | prev = curr; | ||
154 | } | ||
155 | } | ||
156 | } | ||
157 | fprintf(stderr, "Positions::remove internal error: not found\n"); | ||
158 | exit(1); | ||
159 | }/*}}}*/ | ||
160 | /*{{{ pos_add */ | ||
161 | /* assumes the array is in reverse order */ | ||
162 | static void pos_add(struct Positions *t, s32 pos) | ||
163 | { | ||
164 | u32 count; | ||
165 | s32 *p; | ||
166 | |||
167 | pos_set_useall(t, false); | ||
168 | |||
169 | count = t->size; | ||
170 | if (count == POS_MAX_SIZE) { | ||
171 | fprintf(stderr, "Positions_add internal error: overflow\n"); | ||
172 | exit(1); | ||
173 | } | ||
174 | p = t->positions + t->size - 1; | ||
175 | loop { | ||
176 | if (count == 0) | ||
177 | break; | ||
178 | if (*p == pos) { | ||
179 | fprintf(stderr, "Positions_add internal error: duplicate\n"); | ||
180 | exit(1); | ||
181 | } | ||
182 | if (*p > pos) | ||
183 | break; | ||
184 | p[1] = p[0]; | ||
185 | p--; | ||
186 | count--; | ||
187 | } | ||
188 | p[1] = pos; | ||
189 | ++(t->size); | ||
190 | }/*}}}*/ | ||
191 | /*{{{ pos_iterator */ | ||
192 | /* | ||
193 | * creates an iterator, returning the positions in descending order, that apply to strings of length | ||
194 | * <= maxlen. | ||
195 | */ | ||
196 | static struct PositionIterator *pos_iterator(struct Positions *t, s32 maxlen) | ||
197 | { | ||
198 | return positer_new(t, maxlen); | ||
199 | }/*}}}*/ | ||
200 | /*{{{ pos_iterator_all */ | ||
201 | /* creates an iterator, returning the positions in descending order */ | ||
202 | static struct PositionIterator *pos_iterator_all(struct Positions *t) | ||
203 | { | ||
204 | return positer_new_all(t); | ||
205 | }/*}}}*/ | ||
206 | /*{{{ pos_reviterator */ | ||
207 | /* creates an iterator, returning the positions in ascending order */ | ||
208 | static struct PositionReverseIterator *pos_reviterator(struct Positions *t) | ||
209 | { | ||
210 | return posrevit_new(t); | ||
211 | }/*}}}*/ | ||
212 | /*{{{ positer_new */ | ||
213 | /* initializes an iterator through POSITIONS, ignoring positions >= maxlen */ | ||
214 | static struct PositionIterator *positer_new(struct Positions *positions, s32 maxlen) | ||
215 | { | ||
216 | struct PositionIterator *t; | ||
217 | |||
218 | t = calloc(1, sizeof(*t)); | ||
219 | t->set = positions; | ||
220 | |||
221 | if (positions->useall) { | ||
222 | t->index = (maxlen <= (s32)POS_MAX_KEY_POS ? (s32)POS_MAX_KEY_POS - maxlen : 0); | ||
223 | } else { | ||
224 | u32 index; | ||
225 | |||
226 | index = 0; | ||
227 | loop { | ||
228 | if (index >= positions->size || positions->positions[index] < maxlen) | ||
229 | break; | ||
230 | ++index; | ||
231 | } | ||
232 | t->index = index; | ||
233 | } | ||
234 | return t; | ||
235 | }/*}}}*/ | ||
236 | /*{{{ positer_new_all */ | ||
237 | /* initializes an iterator through POSITIONS */ | ||
238 | static struct PositionIterator *positer_new_all(struct Positions *positions) | ||
239 | { | ||
240 | struct PositionIterator *t; | ||
241 | |||
242 | t = calloc(1, sizeof(*t)); | ||
243 | t->set = positions; | ||
244 | return t; | ||
245 | }/*}}}*/ | ||
246 | /*{{{ positer_remaining */ | ||
247 | /* returns the number of remaining positions, i.e. how often next() will return a value != EOS */ | ||
248 | static u32 positer_remaining(struct PositionIterator *t) | ||
249 | { | ||
250 | return t->set->size - t->index; | ||
251 | }/*}}}*/ | ||
252 | /*{{{ positer_next */ | ||
253 | /* retrieves the next position, or EOS past the end */ | ||
254 | static s32 positer_next(struct PositionIterator *t) | ||
255 | { | ||
256 | s32 r; | ||
257 | |||
258 | r = t->index < t->set->size ? t->set->positions[t->index] : POSITER_EOS; | ||
259 | ++(t->index); | ||
260 | return r; | ||
261 | }/*}}}*/ | ||
262 | /*{{{ positer_del */ | ||
263 | static void positer_del(struct PositionIterator *t) | ||
264 | { | ||
265 | free(t); | ||
266 | }/*}}}*/ | ||
267 | /*{{{ posrevit_new */ | ||
268 | static struct PositionReverseIterator *posrevit_new(struct Positions *positions) | ||
269 | { | ||
270 | struct PositionReverseIterator *t; | ||
271 | |||
272 | t = calloc(1, sizeof(*t)); | ||
273 | t->set = positions; | ||
274 | t->index = t->set->size; | ||
275 | return t; | ||
276 | }/*}}}*/ | ||
277 | /*{{{ posrevit_del */ | ||
278 | static void posrevit_del(struct PositionReverseIterator *t) | ||
279 | { | ||
280 | free(t); | ||
281 | }/*}}}*/ | ||
282 | /*{{{ posrevit_next */ | ||
283 | /* retrieves the next position, or EOS past the end */ | ||
284 | static s32 posrevit_next(struct PositionReverseIterator *t) | ||
285 | { | ||
286 | s32 r; | ||
287 | |||
288 | (t->index)--; | ||
289 | r = (t->index > t->minindex ? t->set->positions[t->index] : POSREVIT_EOS); | ||
290 | return r; | ||
291 | } | ||
292 | /*}}}*/ | ||
293 | /*{{{ pos_cpy */ | ||
294 | /* _NOT_ the copy constructor */ | ||
295 | static void pos_cpy(struct Positions *d, struct Positions *s) | ||
296 | { | ||
297 | memcpy(d, s, sizeof(struct Positions)); | ||
298 | }/*}}}*/ | ||
299 | /*{{{ pos_print */ | ||
300 | static void pos_print(struct Positions *t) | ||
301 | { | ||
302 | bool first; | ||
303 | bool seen_LASTCHAR; | ||
304 | u32 count; | ||
305 | s32 *p; | ||
306 | |||
307 | if (t->useall) { | ||
308 | printf ("*"); | ||
309 | return; | ||
310 | } | ||
311 | first = true; | ||
312 | seen_LASTCHAR = false; | ||
313 | count = t->size; | ||
314 | p = t->positions + t->size - 1; | ||
315 | loop { | ||
316 | if (count == 0) | ||
317 | break; | ||
318 | count--; | ||
319 | if (*p == POS_LASTCHAR) | ||
320 | seen_LASTCHAR = true; | ||
321 | else { | ||
322 | if (!first) | ||
323 | printf(","); | ||
324 | printf("%d", *p + 1); | ||
325 | if (count > 0 && p[-1] == *p + 1) { | ||
326 | printf("-"); | ||
327 | loop { | ||
328 | p--; | ||
329 | count--; | ||
330 | if (!(count > 0 && p[-1] == *p + 1)) | ||
331 | break; | ||
332 | } | ||
333 | printf("%d", *p + 1); | ||
334 | } | ||
335 | first = false; | ||
336 | } | ||
337 | p--; | ||
338 | } | ||
339 | if (seen_LASTCHAR) { | ||
340 | if (!first) | ||
341 | printf(","); | ||
342 | printf("$"); | ||
343 | } | ||
344 | }/*}}}*/ | ||
345 | /*------------------------------------------------------------------------------------------------*/ | ||
346 | #define EPILOG | ||
347 | #include "namespace/positions.h" | ||
348 | #undef EPILOG | ||
349 | /*------------------------------------------------------------------------------------------------*/ | ||
350 | #endif |
File positions.h added (mode: 100644) (index 0000000..7e1698c) | |||
1 | #ifndef CGPERF_POSITIONS_H | ||
2 | #define CGPERF_POSITIONS_H | ||
3 | #include <stdbool.h> | ||
4 | #include "c_fixing.h" | ||
5 | /*------------------------------------------------------------------------------------------------*/ | ||
6 | #include "namespace/positions.h" | ||
7 | /*------------------------------------------------------------------------------------------------*/ | ||
8 | /*{{{ Positions */ | ||
9 | struct PositionIterator; | ||
10 | struct PositionReverseIterator; | ||
11 | /*{{{ constants */ | ||
12 | enum { | ||
13 | /* | ||
14 | * Maximum key position specifiable by the user, 1-based. Note that max_key_pos-1 must fit | ||
15 | * into the element type of positions[], below. | ||
16 | */ | ||
17 | POS_MAX_KEY_POS = 255, | ||
18 | /* Denotes the last char of a keyword, depending on the keyword's length */ | ||
19 | POS_LASTCHAR = -1, | ||
20 | /* | ||
21 | * Maximum possible size. Since duplicates are eliminated and the possible 0-based positions | ||
22 | * are -1..max_key_pos-1, this is: | ||
23 | */ | ||
24 | POS_MAX_SIZE = POS_MAX_KEY_POS + 1, | ||
25 | }; | ||
26 | /*}}} constants -- END */ | ||
27 | /*{{{ types */ | ||
28 | struct Positions { | ||
29 | /*{{{ public */ | ||
30 | /* | ||
31 | * array of positions. 0 for the first char, 1 for the second char etc., lastchar for the | ||
32 | * last char | ||
33 | */ | ||
34 | s32 positions[POS_MAX_SIZE]; | ||
35 | /* number of positions */ | ||
36 | u32 size; | ||
37 | /*}}} public -- END */ | ||
38 | /*{{{ private */ | ||
39 | /* The special case denoted by '*' */ | ||
40 | bool useall; | ||
41 | /*}}} private -- END */ | ||
42 | }; | ||
43 | /*}}} types -- END */ | ||
44 | /*{{{ public static methods */ | ||
45 | static struct Positions *pos_new(void); | ||
46 | static struct Positions *pos_new_cpy(struct Positions *src); | ||
47 | static void pos_print(struct Positions *t); | ||
48 | static void pos_del(struct Positions *t); | ||
49 | static bool pos_contains(struct Positions *t, s32 pos); | ||
50 | static void pos_add(struct Positions *t, s32 pos); | ||
51 | static void pos_remove(struct Positions *t, s32 pos); | ||
52 | /* Write access */ | ||
53 | static void pos_set_useall(struct Positions *t, bool useall); | ||
54 | static bool pos_sort(struct Positions *t); | ||
55 | static struct PositionIterator *pos_iterator(struct Positions *t, s32 maxlen); | ||
56 | static struct PositionIterator *pos_iterator_all(struct Positions *t); | ||
57 | static struct PositionReverseIterator *pos_reviterator(struct Positions *t); | ||
58 | static void pos_cpy(struct Positions *d, struct Positions *s); | ||
59 | /*}}} public static methods -- END */ | ||
60 | /*}}} Position -- END */ | ||
61 | /*{{{ PositionIterator */ | ||
62 | /*{{{ constants */ | ||
63 | enum { | ||
64 | /* end of iteration marker */ | ||
65 | POSITER_EOS = -2, | ||
66 | }; | ||
67 | /*}}} constants -- END */ | ||
68 | /*{{{ types */ | ||
69 | struct PositionIterator { | ||
70 | /*{{{ private */ | ||
71 | struct Positions *set; | ||
72 | u32 index; | ||
73 | /*}}}*/ | ||
74 | }; | ||
75 | /*}}} types -- END */ | ||
76 | /*{{{ public static methods */ | ||
77 | static struct PositionIterator *positer_new(struct Positions *positions, s32 maxlen); | ||
78 | static struct PositionIterator *positer_new_all(struct Positions *positions); | ||
79 | static void positer_del(struct PositionIterator *t); | ||
80 | static u32 positer_remaining(struct PositionIterator *t); | ||
81 | static s32 positer_next(struct PositionIterator *t); | ||
82 | /*}}} public static methods -- END */ | ||
83 | /*}}} PositionIterator -- END */ | ||
84 | /*{{{ PositionReverseIterator */ | ||
85 | /*{{{ constants and types */ | ||
86 | enum { | ||
87 | /* end of iteration marker */ | ||
88 | POSREVIT_EOS = -2, | ||
89 | }; | ||
90 | struct PositionReverseIterator { | ||
91 | /*{{{ private */ | ||
92 | struct Positions *set; | ||
93 | u32 index; | ||
94 | u32 minindex; | ||
95 | /*}}} private -- END */ | ||
96 | }; | ||
97 | /*}}} constants and types -- END */ | ||
98 | /*{{{ public static methods */ | ||
99 | static struct PositionReverseIterator *posrevit_new(struct Positions *positions); | ||
100 | static void posrevit_del(struct PositionReverseIterator *t); | ||
101 | static s32 posrevit_next(struct PositionReverseIterator *t); | ||
102 | /*}}} public static methods -- END */ | ||
103 | /*}}} PositionReverseIterator -- END */ | ||
104 | /*------------------------------------------------------------------------------------------------*/ | ||
105 | #define EPILOG | ||
106 | #include "namespace/positions.h" | ||
107 | #undef EPILOG | ||
108 | /*------------------------------------------------------------------------------------------------*/ | ||
109 | #endif |
File search.c added (mode: 100644) (index 0000000..294deac) | |||
1 | #ifndef CGPERF_SEARCH_C | ||
2 | #define CGPERF_SEARCH_C | ||
3 | #include <stdlib.h> | ||
4 | #include <string.h> | ||
5 | #include <time.h> | ||
6 | #include <math.h> | ||
7 | #include "c_fixing.h" | ||
8 | #include "globals.h" | ||
9 | #include "search.h" | ||
10 | #include "keyword.h" | ||
11 | #include "keyword_list.h" | ||
12 | #include "options.h" | ||
13 | #include "positions.h" | ||
14 | #include "hash-table.h" | ||
15 | #include "bool-array.h" | ||
16 | /*------------------------------------------------------------------------------------------------*/ | ||
17 | #include "namespace/globals.h" | ||
18 | #include "namespace/search.h" | ||
19 | #include "namespace/keyword.h" | ||
20 | #include "namespace/keyword_list.h" | ||
21 | #include "namespace/options.h" | ||
22 | #include "namespace/positions.h" | ||
23 | #include "namespace/hash-table.h" | ||
24 | #include "namespace/bool-array.h" | ||
25 | #include "namespace/search.c" | ||
26 | /*------------------------------------------------------------------------------------------------*/ | ||
27 | /*{{{ THEORY */ | ||
28 | /* The general form of the hash function is | ||
29 | |||
30 | hash (keyword) = sum (asso_values[keyword[i] + alpha_inc[i]] : i in Pos) | ||
31 | + len (keyword) | ||
32 | |||
33 | where Pos is a set of byte positions, | ||
34 | each alpha_inc[i] is a nonnegative integer, | ||
35 | each asso_values[c] is a nonnegative integer, | ||
36 | len (keyword) is the keyword's length if _hash_includes_len, or 0 otherwise. | ||
37 | |||
38 | Theorem 1: If all keywords are different, there is a set Pos such that | ||
39 | all tuples (keyword[i] : i in Pos) are different. | ||
40 | |||
41 | Theorem 2: If all tuples (keyword[i] : i in Pos) are different, there | ||
42 | are nonnegative integers alpha_inc[i] such that all multisets | ||
43 | {keyword[i] + alpha_inc[i] : i in Pos} are different. | ||
44 | |||
45 | Define selchars[keyword] := {keyword[i] + alpha_inc[i] : i in Pos}. | ||
46 | |||
47 | Theorem 3: If all multisets selchars[keyword] are different, there are | ||
48 | nonnegative integers asso_values[c] such that all hash values | ||
49 | sum (asso_values[c] : c in selchars[keyword]) are different. | ||
50 | |||
51 | Based on these three facts, we find the hash function in three steps: | ||
52 | |||
53 | Step 1 (Finding good byte positions): | ||
54 | Find a set Pos, as small as possible, such that all tuples | ||
55 | (keyword[i] : i in Pos) are different. | ||
56 | |||
57 | Step 2 (Finding good alpha increments): | ||
58 | Find nonnegative integers alpha_inc[i], as many of them as possible being | ||
59 | zero, and the others being as small as possible, such that all multisets | ||
60 | {keyword[i] + alpha_inc[i] : i in Pos} are different. | ||
61 | |||
62 | Step 3 (Finding good asso_values): | ||
63 | Find asso_values[c] such that all hash (keyword) are different. | ||
64 | |||
65 | In other words, each step finds a projection that is injective on the | ||
66 | given finite set: | ||
67 | proj1 : String --> Map (Pos --> N) | ||
68 | proj2 : Map (Pos --> N) --> Map (Pos --> N) / S(Pos) | ||
69 | proj3 : Map (Pos --> N) / S(Pos) --> N | ||
70 | where | ||
71 | N denotes the set of nonnegative integers, | ||
72 | Map (A --> B) := Hom_Set (A, B) is the set of maps from A to B, and | ||
73 | S(Pos) is the symmetric group over Pos. | ||
74 | |||
75 | This was the theory for !_hash_includes_len; if _hash_includes_len, slight | ||
76 | modifications apply: | ||
77 | proj1 : String --> Map (Pos --> N) x N | ||
78 | proj2 : Map (Pos --> N) x N --> Map (Pos --> N) / S(Pos) x N | ||
79 | proj3 : Map (Pos --> N) / S(Pos) x N --> N | ||
80 | |||
81 | For a case-insensitive hash function, the general form is | ||
82 | |||
83 | hash (keyword) = | ||
84 | sum (asso_values[alpha_unify[keyword[i] + alpha_inc[i]]] : i in Pos) | ||
85 | + len (keyword) | ||
86 | |||
87 | where alpha_unify[c] is chosen so that an upper/lower case change in | ||
88 | keyword[i] doesn't change alpha_unify[keyword[i] + alpha_inc[i]]. | ||
89 | *//*}}} THEORY -- END */ | ||
90 | /*{{{ finding asso_values[] that fit | ||
91 | The idea is to choose the _asso_values[] one by one, in a way that | ||
92 | a choice that has been made never needs to be undone later. This | ||
93 | means that we split the work into several steps. Each step chooses | ||
94 | one or more _asso_values[c]. The result of choosing one or more | ||
95 | _asso_values[c] is that the partitioning of the keyword set gets | ||
96 | broader. | ||
97 | Look at this partitioning: After every step, the _asso_values[] of a | ||
98 | certain set C of characters are undetermined. (At the beginning, C | ||
99 | is the set of characters c with _occurrences[c] > 0. At the end, C | ||
100 | is empty.) To each keyword K, we associate the multiset of _selchars | ||
101 | for which the _asso_values[] are undetermined: | ||
102 | K --> K->_selchars intersect C. | ||
103 | Consider two keywords equivalent if their value under this mapping is | ||
104 | the same. This introduces an equivalence relation on the set of | ||
105 | keywords. The equivalence classes partition the keyword set. (At the | ||
106 | beginning, the partition is the finest possible: each K is an equivalence | ||
107 | class by itself, because all K have a different _selchars. At the end, | ||
108 | all K have been merged into a single equivalence class.) | ||
109 | The partition before a step is always a refinement of the partition | ||
110 | after the step. | ||
111 | We choose the steps in such a way that the partition really becomes | ||
112 | broader at each step. (A step that only chooses an _asso_values[c] | ||
113 | without changing the partition is better merged with the previous step, | ||
114 | to avoid useless backtracking.) }}}*/ | ||
115 | /*------------------------------------------------------------------------------------------------*/ | ||
116 | /*{{{ local */ | ||
117 | /*{{{ types */ | ||
118 | struct EquivalenceClass | ||
119 | { | ||
120 | /* the keywords in this equivalence class */ | ||
121 | struct Keyword_List *keywords; | ||
122 | struct Keyword_List *keywords_last; | ||
123 | /* the number of keywords in this equivalence class */ | ||
124 | u32 cardinality; | ||
125 | /* | ||
126 | * the undetermined selected characters for the keywords in this equivalence class, as a | ||
127 | * canonically reordered multiset | ||
128 | */ | ||
129 | u32 *undetermined_chars; | ||
130 | u32 undetermined_chars_length; | ||
131 | |||
132 | struct EquivalenceClass *next; | ||
133 | }; | ||
134 | |||
135 | struct Step | ||
136 | { | ||
137 | /* the characters whose values are being determined in this step */ | ||
138 | u32 changing_count; | ||
139 | u32 *changing; | ||
140 | /* | ||
141 | * Exclusive upper bound for the _asso_values[c] of this step. A power | ||
142 | * of 2. | ||
143 | */ | ||
144 | u32 asso_value_max; | ||
145 | /* the characters whose values will be determined after this step */ | ||
146 | bool *undetermined; | ||
147 | /* the keyword set partition after this step */ | ||
148 | struct EquivalenceClass *partition; | ||
149 | /* the expected number of iterations in this step */ | ||
150 | f64 expected_lower; | ||
151 | f64 expected_upper; | ||
152 | |||
153 | struct Step *next; | ||
154 | }; | ||
155 | /*}}} types -- END */ | ||
156 | /*{{{ code */ | ||
157 | /*{{{ equals */ | ||
158 | static bool equals(u32 *ptr1, u32 *ptr2, u32 len) | ||
159 | { | ||
160 | loop { | ||
161 | if (len == 0) | ||
162 | break; | ||
163 | if (*ptr1 != *ptr2) | ||
164 | return false; | ||
165 | ++ptr1; | ||
166 | ++ptr2; | ||
167 | len--; | ||
168 | } | ||
169 | return true; | ||
170 | }/*}}}*/ | ||
171 | static void delete_partition(struct EquivalenceClass *partition) | ||
172 | { | ||
173 | loop { | ||
174 | struct EquivalenceClass *equclass; | ||
175 | |||
176 | if (partition == 0) | ||
177 | break; | ||
178 | equclass = partition; | ||
179 | partition = equclass->next; | ||
180 | delete_list(equclass->keywords); | ||
181 | free(equclass); | ||
182 | } | ||
183 | } | ||
184 | static bool less_by_hash_value(struct Keyword *kw1, struct Keyword *kw2) | ||
185 | { | ||
186 | return kw1->hash_value < kw2->hash_value; | ||
187 | } | ||
188 | /*}}} code -- END */ | ||
189 | /*}}} local -- END */ | ||
190 | /*------------------------------------------------------------------------------------------------*/ | ||
191 | /*{{{ schr_new */ | ||
192 | static struct Search *schr_new(struct Keyword_List *list) | ||
193 | { | ||
194 | struct Search *t; | ||
195 | |||
196 | t = calloc(1, sizeof(*t)); | ||
197 | t->head = list; | ||
198 | t->key_positions = pos_new(); | ||
199 | return t; | ||
200 | }/*}}}*/ | ||
201 | /*{{{ schr_del */ | ||
202 | static void schr_del(struct Search *t) | ||
203 | { | ||
204 | ba_del(t->collision_detector); | ||
205 | if (OPTS(DEBUG)) { | ||
206 | u32 i; | ||
207 | s32 field_width; | ||
208 | struct Keyword_List *ptr; | ||
209 | |||
210 | fprintf(stderr, "\ndumping occurrence and associated values tables\n"); | ||
211 | i = 0; | ||
212 | loop { | ||
213 | if (i >= t->alpha_size) | ||
214 | break; | ||
215 | if (t->occurrences[i]) | ||
216 | fprintf (stderr, "asso_values[%c] = %6d, occurrences[%c] = %6d\n", i, t->asso_values[i], i, t->occurrences[i]); | ||
217 | ++i; | ||
218 | } | ||
219 | fprintf(stderr, "end table dumping\n"); | ||
220 | fprintf(stderr, "\nDumping key list information:\ntotal non-static linked keywords = %d\ntotal keywords = %d\ntotal duplicates = %d\nmaximum key length = %d\n", t->list_len, t->total_keys, t->total_duplicates, t->max_key_len); | ||
221 | field_width = t->max_selchars_length; | ||
222 | fprintf(stderr, "\nList contents are:\n(hash value, key length, index, %*s, keyword):\n", field_width, "selchars"); | ||
223 | ptr = t->head; | ||
224 | loop { | ||
225 | s32 j; | ||
226 | |||
227 | if (ptr == 0) | ||
228 | break; | ||
229 | fprintf(stderr, "%11d,%11d,%6d, ", ptr->kw->hash_value, ptr->kw->allchars_length, ptr->kw->final_index); | ||
230 | if (field_width > ptr->kw->selchars_length) | ||
231 | fprintf(stderr, "%*s", field_width - ptr->kw->selchars_length, ""); | ||
232 | j = 0; | ||
233 | loop { | ||
234 | if (j >= ptr->kw->selchars_length) | ||
235 | break; | ||
236 | putc(ptr->kw->selchars[j], stderr); | ||
237 | ++j; | ||
238 | } | ||
239 | fprintf(stderr, ", %.*s\n", ptr->kw->allchars_length, ptr->kw->allchars); | ||
240 | ptr = ptr->next; | ||
241 | } | ||
242 | fprintf(stderr, "End dumping list.\n\n"); | ||
243 | } | ||
244 | pos_del(t->key_positions); | ||
245 | free(t->asso_values); | ||
246 | free(t->occurrences); | ||
247 | free(t->alpha_unify); | ||
248 | free(t->alpha_inc); | ||
249 | free(t); | ||
250 | }/*}}}*/ | ||
251 | /*{{{ schr_optimize */ | ||
252 | static void schr_optimize(struct Search *t) | ||
253 | { | ||
254 | struct Keyword_List *curr_ptr; | ||
255 | s32 max_hash_value; | ||
256 | u32 c; | ||
257 | |||
258 | /* preparations */ | ||
259 | schr_prepare(t); | ||
260 | |||
261 | /* Step 1: Finding good byte positions. */ | ||
262 | schr_find_positions(t); | ||
263 | |||
264 | /* Step 2: Finding good alpha increments. */ | ||
265 | schr_find_alpha_inc(t); | ||
266 | |||
267 | /* Step 3: Finding good asso_values. */ | ||
268 | schr_find_good_asso_values(t); | ||
269 | /* Make one final check, just to make sure nothing weird happened.... */ | ||
270 | ba_clear(t->collision_detector); | ||
271 | curr_ptr = t->head; | ||
272 | loop { | ||
273 | struct Keyword *curr; | ||
274 | u32 hashcode; | ||
275 | |||
276 | if (curr_ptr == 0) | ||
277 | break; | ||
278 | curr = curr_ptr->kw; | ||
279 | hashcode = schr_compute_hash(t, curr); | ||
280 | if (ba_set_bit(t->collision_detector, hashcode)) { | ||
281 | /* | ||
282 | * This shouldn't happen. proj1, proj2, proj3 must have been computed to be | ||
283 | * injective on the given keyword set. | ||
284 | */ | ||
285 | fprintf(stderr, "\nInternal error, unexpected duplicate hash code\n"); | ||
286 | if (OPTS(POSITIONS)) | ||
287 | fprintf(stderr, "try options -m or -r, or use new key positions.\n\n"); | ||
288 | else | ||
289 | fprintf(stderr, "try options -m or -r.\n\n"); | ||
290 | exit(1); | ||
291 | } | ||
292 | curr_ptr = curr_ptr->next; | ||
293 | } | ||
294 | /* sorts the keyword list by hash value */ | ||
295 | schr_sort(t); | ||
296 | /* | ||
297 | * Set unused asso_values[c] to max_hash_value + 1. This is not absolutely necessary, but | ||
298 | * speeds up the lookup function in many cases of lookup failure: no string comparison is | ||
299 | * needed once the hash value of a string is larger than the hash value of any keyword. | ||
300 | */ | ||
301 | { | ||
302 | struct Keyword_List *tmp; | ||
303 | |||
304 | tmp = t->head; | ||
305 | loop { | ||
306 | if (tmp->next == 0) | ||
307 | break; | ||
308 | tmp = tmp->next; | ||
309 | } | ||
310 | max_hash_value = tmp->kw->hash_value; | ||
311 | } | ||
312 | c = 0; | ||
313 | loop { | ||
314 | if (c >= t->alpha_size) | ||
315 | break; | ||
316 | if (t->occurrences[c] == 0) | ||
317 | t->asso_values[c] = max_hash_value + 1; | ||
318 | ++c; | ||
319 | } | ||
320 | /* propagate unified asso_values */ | ||
321 | if (t->alpha_unify) { | ||
322 | u32 c; | ||
323 | |||
324 | c = 0; | ||
325 | loop { | ||
326 | if (c >= t->alpha_size) | ||
327 | break; | ||
328 | if (t->alpha_unify[c] != c) | ||
329 | t->asso_values[c] = t->asso_values[t->alpha_unify[c]]; | ||
330 | ++c; | ||
331 | } | ||
332 | } | ||
333 | }/*}}}*/ | ||
334 | /*{{{ schr_prepare */ | ||
335 | static void schr_prepare(struct Search *t) | ||
336 | { | ||
337 | struct Keyword_List *tmp; | ||
338 | |||
339 | t->total_keys = 0; | ||
340 | tmp = t->head; | ||
341 | loop { | ||
342 | if (tmp == 0) | ||
343 | break; | ||
344 | ++(t->total_keys); | ||
345 | tmp = tmp->next; | ||
346 | } | ||
347 | /* compute the minimum and maximum keyword length */ | ||
348 | t->max_key_len = S32_MIN; | ||
349 | t->min_key_len = S32_MAX; | ||
350 | tmp = t->head; | ||
351 | loop { | ||
352 | struct Keyword *kw; | ||
353 | |||
354 | if (tmp == 0) | ||
355 | break; | ||
356 | kw = tmp->kw; | ||
357 | if (t->max_key_len < kw->allchars_length) | ||
358 | t->max_key_len = kw->allchars_length; | ||
359 | if (t->min_key_len > kw->allchars_length) | ||
360 | t->min_key_len = kw->allchars_length; | ||
361 | tmp = tmp->next; | ||
362 | } | ||
363 | /* | ||
364 | * exit program if an empty string is used as keyword, since the comparison expressions | ||
365 | * don't work correctly for looking up an empty string | ||
366 | */ | ||
367 | if (t->min_key_len == 0) { | ||
368 | fprintf (stderr, "Empty input keyword is not allowed.\nTo recognize an empty input keyword, your code should check for\nlen == 0 before calling the gperf generated lookup function.\n"); | ||
369 | exit(1); | ||
370 | } | ||
371 | /* exit program if the characters in the keywords are not in the required range */ | ||
372 | if (OPTS(SEVENBIT)) { | ||
373 | tmp = t->head; | ||
374 | loop { | ||
375 | struct Keyword *kw; | ||
376 | u8 *k; | ||
377 | s32 i; | ||
378 | |||
379 | if (tmp == 0) | ||
380 | break; | ||
381 | kw = tmp->kw; | ||
382 | k = kw->allchars; | ||
383 | i = kw->allchars_length; | ||
384 | loop { | ||
385 | if (i <= 0) | ||
386 | break; | ||
387 | if (!(*k < 128)) { | ||
388 | fprintf(stderr, "Option --seven-bit has been specified,\nbut keyword \"%.*s\" contains non-ASCII characters.\nTry removing option --seven-bit.\n", kw->allchars_length, kw->allchars); | ||
389 | exit(1); | ||
390 | } | ||
391 | i--; | ||
392 | ++k; | ||
393 | } | ||
394 | tmp = tmp->next; | ||
395 | } | ||
396 | } | ||
397 | /* determine whether the hash function shall include the length */ | ||
398 | t->hash_includes_len = !(OPTS(NOLENGTH) || (t->min_key_len == t->max_key_len)); | ||
399 | }/*}}}*/ | ||
400 | /*{{{ schr_find_positions */ | ||
401 | /* find good key positions */ | ||
402 | static void schr_find_positions(struct Search *t) | ||
403 | { | ||
404 | u32 *alpha_unify; | ||
405 | s32 imax; | ||
406 | struct Positions *mandatory; | ||
407 | struct Positions *current; | ||
408 | u32 current_duplicates_count; | ||
409 | /* if the user gave the key positions, we use them */ | ||
410 | if (OPTS(POSITIONS)) { | ||
411 | pos_cpy(t->key_positions, options->key_positions); | ||
412 | return; | ||
413 | } | ||
414 | /* compute preliminary alpha_unify table */ | ||
415 | alpha_unify = schr_compute_alpha_unify(t); | ||
416 | |||
417 | /* 1. find positions that must occur in order to distinguish duplicates */ | ||
418 | mandatory = pos_new(); | ||
419 | if (!OPTS(DUP)) { | ||
420 | struct Keyword_List *l1; | ||
421 | |||
422 | l1 = t->head; | ||
423 | loop { | ||
424 | struct Keyword *kw1; | ||
425 | struct Keyword_List *l2; | ||
426 | |||
427 | if (l1 == 0 || l1->next == 0) | ||
428 | break; | ||
429 | kw1 = l1->kw; | ||
430 | l2 = l1->next; | ||
431 | loop { | ||
432 | struct Keyword *kw2; | ||
433 | |||
434 | if (l2 == 0) | ||
435 | break; | ||
436 | kw2 = l2->kw; | ||
437 | /* | ||
438 | * if keyword1 and keyword2 have the same length and differ | ||
439 | * in just one position, and it is not the last character, | ||
440 | * this position is mandatory | ||
441 | */ | ||
442 | if (kw1->allchars_length == kw2->allchars_length) { | ||
443 | s32 n; | ||
444 | s32 i; | ||
445 | |||
446 | n = kw1->allchars_length; | ||
447 | i = 0; | ||
448 | loop { | ||
449 | u32 c1; | ||
450 | u32 c2; | ||
451 | |||
452 | if (i >= (n - 1)) | ||
453 | break; | ||
454 | c1 = kw1->allchars[i]; | ||
455 | c2 = kw2->allchars[i]; | ||
456 | if (OPTS(UPPERLOWER)) { | ||
457 | if (c1 >= 'A' && c1 <= 'Z') | ||
458 | c1 += 'a' - 'A'; | ||
459 | if (c2 >= 'A' && c2 <= 'Z') | ||
460 | c2 += 'a' - 'A'; | ||
461 | } | ||
462 | if (c1 != c2) | ||
463 | break; | ||
464 | ++i; | ||
465 | } | ||
466 | if (i < (n - 1)) { | ||
467 | s32 j; | ||
468 | |||
469 | j = i + 1; | ||
470 | loop { | ||
471 | u32 c1; | ||
472 | u32 c2; | ||
473 | |||
474 | if (j >= n) | ||
475 | break; | ||
476 | c1 = kw1->allchars[j]; | ||
477 | c2 = kw2->allchars[j]; | ||
478 | if (OPTS(UPPERLOWER)) { | ||
479 | if (c1 >= 'A' && c1 <= 'Z') | ||
480 | c1 += 'a' - 'A'; | ||
481 | if (c2 >= 'A' && c2 <= 'Z') | ||
482 | c2 += 'a' - 'A'; | ||
483 | } | ||
484 | if (c1 != c2) | ||
485 | break; | ||
486 | ++j; | ||
487 | } | ||
488 | if (j >= n) { | ||
489 | /* position i is mandatory */ | ||
490 | if (!pos_contains(mandatory, i)) | ||
491 | pos_add(mandatory, i); | ||
492 | } | ||
493 | } | ||
494 | } | ||
495 | l2 = l2->next; | ||
496 | } | ||
497 | l1 = l1->next; | ||
498 | } | ||
499 | } | ||
500 | /* 2. add positions, as long as this decreases the duplicates count */ | ||
501 | imax = (t->max_key_len - 1 < (s32)POS_MAX_KEY_POS - 1 ? t->max_key_len - 1 | ||
502 | : (s32)POS_MAX_KEY_POS - 1); | ||
503 | current = pos_new(); | ||
504 | pos_cpy(current, mandatory); | ||
505 | current_duplicates_count = schr_count_duplicates_tuple_do(t, current, alpha_unify); | ||
506 | loop { | ||
507 | struct Positions *best; | ||
508 | u32 best_duplicates_count; | ||
509 | s32 i; | ||
510 | |||
511 | best = pos_new(); | ||
512 | best_duplicates_count = U32_MAX; | ||
513 | i = imax; | ||
514 | loop { | ||
515 | if (i < -1) | ||
516 | break; | ||
517 | if (!pos_contains(current, i)) { | ||
518 | struct Positions *tryal; | ||
519 | u32 try_duplicates_count; | ||
520 | |||
521 | tryal = pos_new(); | ||
522 | pos_cpy(tryal, current); | ||
523 | pos_add(tryal, i); | ||
524 | try_duplicates_count = schr_count_duplicates_tuple_do(t, tryal, | ||
525 | alpha_unify); | ||
526 | /* | ||
527 | * We prefer 'try' to 'best' if it produces less duplicates, or if | ||
528 | * it produces the same number of duplicates but with a more | ||
529 | * efficient hash function. | ||
530 | */ | ||
531 | if (try_duplicates_count < best_duplicates_count | ||
532 | || (try_duplicates_count == best_duplicates_count | ||
533 | && i >=0)) { | ||
534 | pos_cpy(best, tryal); | ||
535 | best_duplicates_count = try_duplicates_count; | ||
536 | } | ||
537 | pos_del(tryal); | ||
538 | } | ||
539 | i--; | ||
540 | } | ||
541 | /* stop adding positions when it gives no improvement */ | ||
542 | if (best_duplicates_count >= current_duplicates_count) | ||
543 | break; | ||
544 | pos_cpy(current, best); | ||
545 | pos_del(best); | ||
546 | current_duplicates_count = best_duplicates_count; | ||
547 | } | ||
548 | /* 3. remove positions, as long as this doesn't increase the duplicates count */ | ||
549 | loop { | ||
550 | struct Positions *best; | ||
551 | u32 best_duplicates_count; | ||
552 | s32 i; | ||
553 | |||
554 | best = pos_new(); | ||
555 | best_duplicates_count = U32_MAX; | ||
556 | i = imax; | ||
557 | loop { | ||
558 | if (i < -1) | ||
559 | break; | ||
560 | if (pos_contains(current, i) && !pos_contains(mandatory, i)) { | ||
561 | struct Positions *tryal; | ||
562 | u32 try_duplicates_count; | ||
563 | |||
564 | tryal = pos_new(); | ||
565 | pos_cpy(tryal, current); | ||
566 | pos_remove(tryal, i); | ||
567 | try_duplicates_count = schr_count_duplicates_tuple_do(t, tryal, | ||
568 | alpha_unify); | ||
569 | /* | ||
570 | * We prefer 'try' to 'best' if it produces less duplicates, or if | ||
571 | * it produces the same number of duplicates but with a more | ||
572 | * efficient hash function. | ||
573 | */ | ||
574 | if (try_duplicates_count < best_duplicates_count | ||
575 | || (try_duplicates_count == best_duplicates_count | ||
576 | && i == -1)) { | ||
577 | pos_cpy(best, tryal); | ||
578 | best_duplicates_count = try_duplicates_count; | ||
579 | } | ||
580 | } | ||
581 | i--; | ||
582 | } | ||
583 | /* stop removing positions when it gives no improvement */ | ||
584 | if (best_duplicates_count > current_duplicates_count) | ||
585 | break; | ||
586 | pos_cpy(current, best); | ||
587 | pos_del(best); | ||
588 | current_duplicates_count = best_duplicates_count; | ||
589 | } | ||
590 | /* 4. replace two positions by one, as long as this doesn't increase the duplicates count */ | ||
591 | loop { | ||
592 | struct Positions *best; | ||
593 | u32 best_duplicates_count; | ||
594 | s32 i1; | ||
595 | |||
596 | best = pos_new(); | ||
597 | best_duplicates_count = U32_MAX; | ||
598 | /* | ||
599 | * Loop over all pairs { i1, i2 } of currently selected positions. W.l.o.g. we can | ||
600 | * assume i1 > i2. | ||
601 | */ | ||
602 | i1 = imax; | ||
603 | loop { | ||
604 | if (i1 < -1) | ||
605 | break; | ||
606 | if (pos_contains(current, i1) && !pos_contains(mandatory, i1)) { | ||
607 | s32 i2; | ||
608 | |||
609 | i2 = i1 - 1; | ||
610 | loop { | ||
611 | if (i2 < -1) | ||
612 | break; | ||
613 | if (pos_contains(current, i2) && !pos_contains(mandatory, i2)) { | ||
614 | s32 i3; | ||
615 | |||
616 | i3 = imax; | ||
617 | loop { | ||
618 | if (i3 < -1) | ||
619 | break; | ||
620 | if (!pos_contains(current, i3)) { | ||
621 | struct Positions *tryal; | ||
622 | u32 try_duplicates_count; | ||
623 | |||
624 | tryal = pos_new(); | ||
625 | pos_cpy(tryal, current); | ||
626 | pos_remove(tryal, i1); | ||
627 | pos_remove(tryal, i2); | ||
628 | pos_add(tryal, i3); | ||
629 | try_duplicates_count = schr_count_duplicates_tuple_do(t, tryal, alpha_unify); | ||
630 | /* | ||
631 | * We prefer 'try' to 'best' if it produces less | ||
632 | * duplicates, or if it produces the same number | ||
633 | * of duplicates but with a more efficient hash | ||
634 | * function. | ||
635 | */ | ||
636 | if (try_duplicates_count < best_duplicates_count | ||
637 | || (try_duplicates_count == best_duplicates_count | ||
638 | && (i1 == -1 || i2 == -1) && i3 >= 0)) { | ||
639 | pos_cpy(best, tryal); | ||
640 | best_duplicates_count = try_duplicates_count; | ||
641 | } | ||
642 | pos_del(tryal); | ||
643 | } | ||
644 | i3--; | ||
645 | } | ||
646 | } | ||
647 | i2--; | ||
648 | } | ||
649 | } | ||
650 | i1--; | ||
651 | } | ||
652 | /* stop removing positions when it gives no improvement */ | ||
653 | if (best_duplicates_count > current_duplicates_count) | ||
654 | break; | ||
655 | pos_cpy(current, best); | ||
656 | current_duplicates_count = best_duplicates_count; | ||
657 | pos_del(best); | ||
658 | } | ||
659 | /* That's it. Hope it's good enough. */ | ||
660 | pos_cpy(t->key_positions, current); | ||
661 | if (OPTS(DEBUG)) { | ||
662 | struct PositionReverseIterator *iter; | ||
663 | bool seen_lastchar; | ||
664 | bool first; | ||
665 | s32 i; | ||
666 | /* Print the result. */ | ||
667 | fprintf(stderr, "\nComputed positions: "); | ||
668 | iter = pos_reviterator(t->key_positions); | ||
669 | seen_lastchar = false; | ||
670 | first = true; | ||
671 | loop { | ||
672 | i = posrevit_next(iter); | ||
673 | if (i == POSREVIT_EOS) | ||
674 | break; | ||
675 | if (!first) | ||
676 | fprintf(stderr, ", "); | ||
677 | if (i == POS_LASTCHAR) | ||
678 | seen_lastchar = true; | ||
679 | else { | ||
680 | fprintf(stderr, "%d", i + 1); | ||
681 | first = false; | ||
682 | } | ||
683 | } | ||
684 | if (seen_lastchar) { | ||
685 | if (!first) | ||
686 | fprintf(stderr, ", "); | ||
687 | fprintf(stderr, "$"); | ||
688 | } | ||
689 | fprintf(stderr, "\n"); | ||
690 | posrevit_del(iter); | ||
691 | } | ||
692 | pos_del(current); | ||
693 | pos_del(mandatory); | ||
694 | free(alpha_unify); | ||
695 | }/*}}}*/ | ||
696 | /*{{{ schr_compute_alpha_size */ | ||
697 | /* computes the upper bound on the indices passed to asso_values[], assuming no alpha_increments */ | ||
698 | static u32 schr_compute_alpha_size(void) | ||
699 | { | ||
700 | return (OPTS(SEVENBIT) ? 128 : 256); | ||
701 | }/*}}}*/ | ||
702 | /*{{{ schr_compute_alpha_unify */ | ||
703 | static u32 *schr_compute_alpha_unify(struct Search *t) | ||
704 | { | ||
705 | if (OPTS(UPPERLOWER)) { | ||
706 | /* uppercase to lowercase mapping */ | ||
707 | u32 alpha_size; | ||
708 | u32 *alpha_unify; | ||
709 | u32 c; | ||
710 | |||
711 | alpha_size = schr_compute_alpha_size(); | ||
712 | alpha_unify = calloc(alpha_size, sizeof(*alpha_unify)); | ||
713 | c = 0; | ||
714 | loop { | ||
715 | if (c >= alpha_size) | ||
716 | break; | ||
717 | alpha_unify[c] = c; | ||
718 | ++c; | ||
719 | } | ||
720 | c = 'A'; | ||
721 | loop { | ||
722 | if (c > 'Z') | ||
723 | break; | ||
724 | alpha_unify[c] = c + ('a' - 'A'); | ||
725 | ++c; | ||
726 | } | ||
727 | return alpha_unify; | ||
728 | } else | ||
729 | /* identity mapping */ | ||
730 | return 0; | ||
731 | }/*}}}*/ | ||
732 | /*{{{ schr_find_alpha_inc */ | ||
733 | /* find good alpha_inc[] */ | ||
734 | static void schr_find_alpha_inc(struct Search *t) | ||
735 | { | ||
736 | /* | ||
737 | * The goal is to choose _alpha_inc[] such that it doesn't introduce artificial duplicates. | ||
738 | * In other words, the goal is: # proj2 (proj1 (K)) = # proj1 (K). | ||
739 | */ | ||
740 | u32 duplicates_goal; | ||
741 | u32 *current; | ||
742 | s32 i; | ||
743 | u32 current_duplicates_count; | ||
744 | |||
745 | duplicates_goal = schr_count_duplicates_tuple(t); | ||
746 | current = calloc(t->max_key_len, sizeof(*current)); | ||
747 | i = 0; | ||
748 | loop { | ||
749 | if (i >= t->max_key_len) | ||
750 | break; | ||
751 | current[i] = 0; | ||
752 | ++i; | ||
753 | } | ||
754 | current_duplicates_count = schr_count_duplicates_multiset(t, current); | ||
755 | if (current_duplicates_count > duplicates_goal) { | ||
756 | /* look which _alpha_inc[i] we are free to increment */ | ||
757 | u32 nindices; | ||
758 | u32 *indices; | ||
759 | u32 *best; | ||
760 | u32 *tryal; | ||
761 | { | ||
762 | struct PositionIterator *iter; | ||
763 | |||
764 | nindices = 0; | ||
765 | iter = pos_iterator(t->key_positions, t->max_key_len); | ||
766 | loop { | ||
767 | s32 key_pos; | ||
768 | |||
769 | key_pos = positer_next(iter); | ||
770 | if (key_pos == POSITER_EOS) | ||
771 | break; | ||
772 | if (key_pos != POS_LASTCHAR) | ||
773 | ++nindices; | ||
774 | } | ||
775 | positer_del(iter); | ||
776 | } | ||
777 | indices = calloc(nindices, sizeof(*indices)); | ||
778 | { | ||
779 | u32 j; | ||
780 | struct PositionIterator *iter; | ||
781 | |||
782 | j = 0; | ||
783 | iter = pos_iterator(t->key_positions, t->max_key_len); | ||
784 | loop { | ||
785 | s32 key_pos; | ||
786 | |||
787 | key_pos = positer_next(iter); | ||
788 | if (key_pos == POSITER_EOS) | ||
789 | break; | ||
790 | if (key_pos != POS_LASTCHAR) { | ||
791 | indices[j] = key_pos; | ||
792 | ++j; | ||
793 | } | ||
794 | } | ||
795 | if (!(j == nindices)) | ||
796 | abort(); | ||
797 | positer_del(iter); | ||
798 | } | ||
799 | /* | ||
800 | * Perform several rounds of searching for a good alpha increment. Each round | ||
801 | * reduces the number of artificial collisions by adding an increment in a single | ||
802 | * key position. | ||
803 | */ | ||
804 | best = calloc(t->max_key_len, sizeof(*best)); | ||
805 | tryal = calloc(t->max_key_len, sizeof(*best)); | ||
806 | loop { | ||
807 | u32 inc; | ||
808 | /* An increment of 1 is not always enough. Try higher increments also. */ | ||
809 | inc = 1; | ||
810 | loop { | ||
811 | u32 best_duplicates_count; | ||
812 | u32 j; | ||
813 | |||
814 | best_duplicates_count = U32_MAX; | ||
815 | j = 0; | ||
816 | loop { | ||
817 | u32 try_duplicates_count; | ||
818 | |||
819 | if (j >= nindices) | ||
820 | break; | ||
821 | memcpy(tryal, current, t->max_key_len * sizeof(u32)); | ||
822 | tryal[indices[j]] += inc; | ||
823 | try_duplicates_count = schr_count_duplicates_multiset(t, | ||
824 | tryal); | ||
825 | /* we prefer 'try' to 'best' if it produces less duplicates */ | ||
826 | if (try_duplicates_count < best_duplicates_count) { | ||
827 | memcpy(best, tryal, t->max_key_len * sizeof(u32)); | ||
828 | best_duplicates_count = try_duplicates_count; | ||
829 | } | ||
830 | ++j; | ||
831 | } | ||
832 | /* stop this round when we got an improvement */ | ||
833 | if (best_duplicates_count < current_duplicates_count) { | ||
834 | memcpy(current, best, t->max_key_len * sizeof(u32)); | ||
835 | current_duplicates_count = best_duplicates_count; | ||
836 | break; | ||
837 | } | ||
838 | ++inc; | ||
839 | } | ||
840 | if (current_duplicates_count <= duplicates_goal) | ||
841 | break; | ||
842 | } | ||
843 | free(tryal); | ||
844 | free(best); | ||
845 | |||
846 | if (OPTS(DEBUG)) { | ||
847 | bool first; | ||
848 | u32 j; | ||
849 | /* print the result */ | ||
850 | fprintf(stderr, "\nComputed alpha increments: "); | ||
851 | first = true; | ||
852 | j = nindices; | ||
853 | loop { | ||
854 | if (j <= 0) | ||
855 | break; | ||
856 | j--; | ||
857 | if (current[indices[j]] != 0) { | ||
858 | if (!first) | ||
859 | fprintf(stderr, ", "); | ||
860 | fprintf(stderr, "%u:+%u", indices[j] + 1, current[indices[j]]); | ||
861 | first = false; | ||
862 | } | ||
863 | } | ||
864 | fprintf(stderr, "\n"); | ||
865 | } | ||
866 | free(indices); | ||
867 | } | ||
868 | t->alpha_inc = current; | ||
869 | t->alpha_size = schr_compute_alpha_size_with_inc(t, t->alpha_inc); | ||
870 | t->alpha_unify = schr_compute_alpha_unify_with_inc(t, t->key_positions, t->alpha_inc); | ||
871 | }/*}}}*/ | ||
872 | /*{{{ schr_count_duplicates_tuple_do */ | ||
873 | /* | ||
874 | * Count the duplicate keywords that occur with a given set of positions. In other words, it | ||
875 | * returns the difference # K - # proj1 (K) where K is the multiset of given keywords. | ||
876 | */ | ||
877 | static u32 schr_count_duplicates_tuple_do(struct Search *t, struct Positions *positions, | ||
878 | u32 *alpha_unify) | ||
879 | { | ||
880 | u32 count; | ||
881 | /* | ||
882 | * Run through the keyword list and count the duplicates incrementally. The result does not | ||
883 | * depend on the order of the keyword list, thanks to the formula above. | ||
884 | */ | ||
885 | schr_init_selchars_tuple(t, positions, alpha_unify); | ||
886 | count = 0; | ||
887 | { | ||
888 | struct Hash_Table *representatives; | ||
889 | struct Keyword_List *tmp; | ||
890 | |||
891 | representatives = ht_new(t->total_keys, !t->hash_includes_len); | ||
892 | tmp = t->head; | ||
893 | loop { | ||
894 | struct Keyword *kw; | ||
895 | |||
896 | if (tmp == 0) | ||
897 | break; | ||
898 | kw = tmp->kw; | ||
899 | if (ht_insert(representatives, kw)) | ||
900 | ++count; | ||
901 | tmp = tmp->next; | ||
902 | } | ||
903 | ht_del(representatives); | ||
904 | } | ||
905 | schr_delete_selchars(t); | ||
906 | return count; | ||
907 | }/*}}}*/ | ||
908 | /*{{{ schr_init_selchars_tuple */ | ||
909 | static void schr_init_selchars_tuple(struct Search *t, struct Positions *positions, | ||
910 | u32 *alpha_unify) | ||
911 | { | ||
912 | struct Keyword_List *tmp; | ||
913 | |||
914 | tmp = t->head; | ||
915 | loop { | ||
916 | if (tmp == 0) | ||
917 | break; | ||
918 | kw_init_selchars_tuple(tmp->kw, positions, alpha_unify); | ||
919 | tmp = tmp->next; | ||
920 | } | ||
921 | }/*}}}*/ | ||
922 | /*{{{ schr_delete_selchars */ | ||
923 | static void schr_delete_selchars(struct Search *t) | ||
924 | { | ||
925 | struct Keyword_List *tmp; | ||
926 | |||
927 | tmp = t->head; | ||
928 | loop { | ||
929 | if (tmp == 0) | ||
930 | break; | ||
931 | kw_delete_selchars(tmp->kw); | ||
932 | tmp = tmp->next; | ||
933 | } | ||
934 | }/*}}}*/ | ||
935 | /*{{{ schr_count_duplicates_tuple */ | ||
936 | /* | ||
937 | * Count the duplicate keywords that occur with the found set of positions. In other words, it | ||
938 | * returns the difference # K - # proj1 (K) where K is the multiset of given keywords. | ||
939 | */ | ||
940 | static u32 schr_count_duplicates_tuple(struct Search *t) | ||
941 | { | ||
942 | u32 *alpha_unify; | ||
943 | u32 count; | ||
944 | |||
945 | alpha_unify = schr_compute_alpha_unify(t); | ||
946 | count = schr_count_duplicates_tuple_do(t, t->key_positions, alpha_unify); | ||
947 | free(alpha_unify); | ||
948 | return count; | ||
949 | }/*}}}*/ | ||
950 | /*{{{ schr_count_duplicates_multiset */ | ||
951 | /* | ||
952 | * Count the duplicate keywords that occur with the given set of positions and a given alpha_inc[] | ||
953 | * array. | ||
954 | * In other words, it returns the difference | ||
955 | * # K - # proj2 (proj1 (K)) | ||
956 | * where K is the multiset of given keywords. | ||
957 | */ | ||
958 | static u32 schr_count_duplicates_multiset(struct Search *t, u32 *alpha_inc) | ||
959 | { | ||
960 | /* | ||
961 | * Run through the keyword list and count the duplicates incrementally. The result does not | ||
962 | * depend on the order of the keyword list, thanks to the formula above. | ||
963 | */ | ||
964 | u32 *alpha_unify; | ||
965 | u32 count; | ||
966 | |||
967 | alpha_unify = schr_compute_alpha_unify_with_inc(t, t->key_positions, alpha_inc); | ||
968 | schr_init_selchars_multiset(t, t->key_positions, alpha_unify, alpha_inc); | ||
969 | count = 0; | ||
970 | { | ||
971 | struct Hash_Table *representatives; | ||
972 | struct Keyword_List *tmp; | ||
973 | |||
974 | representatives = ht_new(t->total_keys, !t->hash_includes_len); | ||
975 | tmp = t->head; | ||
976 | loop { | ||
977 | struct Keyword *kw; | ||
978 | |||
979 | if (tmp == 0) | ||
980 | break; | ||
981 | kw = tmp->kw; | ||
982 | if (ht_insert(representatives, kw)) | ||
983 | ++count; | ||
984 | tmp = tmp->next; | ||
985 | } | ||
986 | ht_del(representatives); | ||
987 | } | ||
988 | schr_delete_selchars(t); | ||
989 | free(alpha_unify); | ||
990 | return count; | ||
991 | }/*}}}*/ | ||
992 | /*{{{ schr_compute_alpha_unify_with_inc */ | ||
993 | /* computes the unification rules between different asso_values[c] */ | ||
994 | static u32 *schr_compute_alpha_unify_with_inc(struct Search *t, struct Positions *positions, | ||
995 | u32 *alpha_inc) | ||
996 | { | ||
997 | if (OPTS(UPPERLOWER)) { | ||
998 | /* | ||
999 | * Without alpha increments, we would simply unify | ||
1000 | * 'A' -> 'a', ..., 'Z' -> 'z'. | ||
1001 | * But when a keyword contains at position i a character c, | ||
1002 | * we have the constraint | ||
1003 | * asso_values[tolower(c) + alpha_inc[i]] == | ||
1004 | * asso_values[toupper(c) + alpha_inc[i]]. | ||
1005 | * This introduces a unification | ||
1006 | * toupper(c) + alpha_inc[i] -> tolower(c) + alpha_inc[i]. | ||
1007 | * Note that this unification can extend outside the range of | ||
1008 | * ASCII letters! But still every unified character pair is at | ||
1009 | * a distance of 'a'-'A' = 32, or (after chained unification) | ||
1010 | * at a multiple of 32. So in the end the alpha_unify vector | ||
1011 | * has the form c -> c + 32 * f(c) where f(c) is a | ||
1012 | * nonnegative integer. | ||
1013 | */ | ||
1014 | u32 alpha_size; | ||
1015 | u32 *alpha_unify; | ||
1016 | u32 c; | ||
1017 | struct Keyword_List *tmp; | ||
1018 | |||
1019 | alpha_size = schr_compute_alpha_size_with_inc(t, alpha_inc); | ||
1020 | alpha_unify = calloc(alpha_size, sizeof(*alpha_unify)); | ||
1021 | c = 0; | ||
1022 | loop { | ||
1023 | if (c >= alpha_size) | ||
1024 | break; | ||
1025 | alpha_unify[c] = c; | ||
1026 | ++c; | ||
1027 | } | ||
1028 | tmp = t->head; | ||
1029 | loop { | ||
1030 | struct Keyword *kw; | ||
1031 | struct PositionIterator *iter; | ||
1032 | s32 i; | ||
1033 | |||
1034 | if (tmp == 0) | ||
1035 | break; | ||
1036 | kw = tmp->kw; | ||
1037 | iter = pos_iterator(positions, kw->allchars_length); | ||
1038 | loop { | ||
1039 | u32 c; | ||
1040 | |||
1041 | i = positer_next(iter); | ||
1042 | if (i == POSITER_EOS) | ||
1043 | break; | ||
1044 | if (i == POS_LASTCHAR) | ||
1045 | c = (u8)(kw->allchars[kw->allchars_length - 1]); | ||
1046 | else if (i < kw->allchars_length) | ||
1047 | c = (u8)(kw->allchars[i]); | ||
1048 | else | ||
1049 | abort(); | ||
1050 | if (c >= 'A' && c <= 'Z') | ||
1051 | c += 'a' - 'A'; | ||
1052 | if (c >= 'a' && c <= 'z') { | ||
1053 | u32 d; | ||
1054 | u32 b; | ||
1055 | s32 a; | ||
1056 | |||
1057 | if (i != POS_LASTCHAR) | ||
1058 | c += alpha_inc[i]; | ||
1059 | /* unify c with c - ('a'-'A') */ | ||
1060 | d = alpha_unify[c]; | ||
1061 | b = c - ('a' - 'A'); | ||
1062 | a = b; | ||
1063 | loop { | ||
1064 | if (a < 0 || alpha_unify[a] != b) | ||
1065 | break; | ||
1066 | alpha_unify[a] = d; | ||
1067 | a -= ('a' - 'A'); | ||
1068 | } | ||
1069 | } | ||
1070 | } | ||
1071 | positer_del(iter); | ||
1072 | tmp = tmp->next; | ||
1073 | } | ||
1074 | return alpha_unify; | ||
1075 | } else | ||
1076 | /* identity mapping */ | ||
1077 | return 0; | ||
1078 | }/*}}}*/ | ||
1079 | /*{{{ schr_compute_alpha_size_with_inc */ | ||
1080 | /* computes the upper bound on the indices passed to asso_values[] */ | ||
1081 | static u32 schr_compute_alpha_size_with_inc(struct Search *t, u32 *alpha_inc) | ||
1082 | { | ||
1083 | u32 max_alpha_inc; | ||
1084 | s32 i; | ||
1085 | |||
1086 | max_alpha_inc = 0; | ||
1087 | i = 0; | ||
1088 | loop { | ||
1089 | if (i >= t->max_key_len) | ||
1090 | break; | ||
1091 | if (max_alpha_inc < alpha_inc[i]) | ||
1092 | max_alpha_inc = alpha_inc[i]; | ||
1093 | ++i; | ||
1094 | } | ||
1095 | return (OPTS(SEVENBIT) ? 128 : 256) + max_alpha_inc; | ||
1096 | }/*}}}*/ | ||
1097 | /*{{{ schr_init_selchars_multiset */ | ||
1098 | static void schr_init_selchars_multiset(struct Search *t, struct Positions *positions, | ||
1099 | u32 *alpha_unify, u32 *alpha_inc) | ||
1100 | { | ||
1101 | struct Keyword_List *tmp; | ||
1102 | |||
1103 | tmp = t->head; | ||
1104 | loop { | ||
1105 | if (tmp == 0) | ||
1106 | break; | ||
1107 | kw_init_selchars_multiset(tmp->kw, positions, alpha_unify, alpha_inc); | ||
1108 | tmp = tmp->next; | ||
1109 | } | ||
1110 | }/*}}}*/ | ||
1111 | /*{{{ schr_find_good_asso_values */ | ||
1112 | /* finds good _asso_values[] */ | ||
1113 | static void schr_find_good_asso_values(struct Search *t) | ||
1114 | { | ||
1115 | s32 asso_iterations; | ||
1116 | struct Keyword_List *saved_head; | ||
1117 | s32 best_initial_asso_value; | ||
1118 | s32 best_jump; | ||
1119 | s32 *best_asso_values; | ||
1120 | s32 best_collisions; | ||
1121 | s32 best_max_hash_value; | ||
1122 | |||
1123 | schr_prepare_asso_values(t); | ||
1124 | |||
1125 | /* search for good _asso_values[] */ | ||
1126 | asso_iterations = options->asso_iterations; | ||
1127 | if (asso_iterations == 0) { | ||
1128 | schr_find_asso_values(t); | ||
1129 | return; | ||
1130 | } | ||
1131 | /* | ||
1132 | * Try different pairs of _initial_asso_value and _jump, in the | ||
1133 | * following order: | ||
1134 | * (0, 1) | ||
1135 | * (1, 1) | ||
1136 | * (2, 1) (0, 3) | ||
1137 | * (3, 1) (1, 3) | ||
1138 | * (4, 1) (2, 3) (0, 5) | ||
1139 | * (5, 1) (3, 3) (1, 5) | ||
1140 | *..... | ||
1141 | */ | ||
1142 | saved_head = t->head; | ||
1143 | best_initial_asso_value = 0; | ||
1144 | best_jump = 1; | ||
1145 | best_asso_values = calloc(t->alpha_size, sizeof(*best_asso_values)); | ||
1146 | best_collisions = S32_MAX; | ||
1147 | best_max_hash_value = S32_MAX; | ||
1148 | |||
1149 | t->initial_asso_value = 0; | ||
1150 | t->jump = 1; | ||
1151 | loop { | ||
1152 | s32 collisions; | ||
1153 | s32 max_hash_value; | ||
1154 | struct Keyword_List *ptr; | ||
1155 | /* restore the keyword list in its original order */ | ||
1156 | t->head = copy_list(saved_head); | ||
1157 | /* find good _asso_values[] */ | ||
1158 | schr_find_asso_values(t); | ||
1159 | /* test whether it is the best solution so far */ | ||
1160 | collisions = 0; | ||
1161 | max_hash_value = S32_MIN; | ||
1162 | ba_clear(t->collision_detector); | ||
1163 | ptr = t->head; | ||
1164 | loop { | ||
1165 | struct Keyword *kw; | ||
1166 | s32 hashcode; | ||
1167 | |||
1168 | if (ptr == 0) | ||
1169 | break; | ||
1170 | kw = ptr->kw; | ||
1171 | hashcode = schr_compute_hash(t, kw); | ||
1172 | if (max_hash_value < hashcode) | ||
1173 | max_hash_value = hashcode; | ||
1174 | if (ba_set_bit(t->collision_detector, hashcode)) | ||
1175 | ++collisions; | ||
1176 | ptr = ptr->next; | ||
1177 | } | ||
1178 | if (collisions < best_collisions || (collisions == best_collisions | ||
1179 | && max_hash_value < best_max_hash_value)) { | ||
1180 | memcpy(best_asso_values, t->asso_values, t->alpha_size | ||
1181 | * sizeof(*(t->asso_values))); | ||
1182 | best_collisions = collisions; | ||
1183 | best_max_hash_value = max_hash_value; | ||
1184 | } | ||
1185 | /* delete the copied keyword list */ | ||
1186 | delete_list(t->head); | ||
1187 | |||
1188 | asso_iterations--; | ||
1189 | if (asso_iterations == 0) | ||
1190 | break; | ||
1191 | /* prepare for next iteration */ | ||
1192 | if (t->initial_asso_value >= 2) { | ||
1193 | t->initial_asso_value -= 2; | ||
1194 | t->jump += 2; | ||
1195 | } else { | ||
1196 | t->initial_asso_value += t->jump; | ||
1197 | t->jump = 1; | ||
1198 | } | ||
1199 | } | ||
1200 | t->head = saved_head; | ||
1201 | /* install the best found asso_values */ | ||
1202 | t->initial_asso_value = best_initial_asso_value; | ||
1203 | t->jump = best_jump; | ||
1204 | memcpy(t->asso_values, best_asso_values, t->alpha_size * sizeof(*(t->asso_values))); | ||
1205 | free(best_asso_values); | ||
1206 | }/*}}}*/ | ||
1207 | /*{{{ schr_find_asso_values */ | ||
1208 | static void schr_find_asso_values(struct Search *t) | ||
1209 | { | ||
1210 | struct Step *steps; | ||
1211 | struct Step *step; | ||
1212 | u32 stepno; | ||
1213 | |||
1214 | /* determine the steps, starting with the last one */ | ||
1215 | { | ||
1216 | bool *undetermined; | ||
1217 | bool *determined; | ||
1218 | s32 c; | ||
1219 | |||
1220 | steps = 0; | ||
1221 | |||
1222 | undetermined = calloc(t->alpha_size, sizeof(*undetermined)); | ||
1223 | c = 0; | ||
1224 | loop { | ||
1225 | if (c >= t->alpha_size) | ||
1226 | break; | ||
1227 | undetermined[c] = false; | ||
1228 | ++c; | ||
1229 | } | ||
1230 | determined = calloc(t->alpha_size, sizeof(*determined)); | ||
1231 | c = 0; | ||
1232 | loop { | ||
1233 | if (c >= t->alpha_size) | ||
1234 | break; | ||
1235 | determined[c] = true; | ||
1236 | ++c; | ||
1237 | } | ||
1238 | loop { | ||
1239 | /* compute the partition that needs to be refined */ | ||
1240 | struct EquivalenceClass *partition; | ||
1241 | u32 chosen_c; | ||
1242 | u32 chosen_possible_collisions; | ||
1243 | struct Step *step; | ||
1244 | u32 c; | ||
1245 | u32 *changing; | ||
1246 | u32 changing_count; | ||
1247 | |||
1248 | partition = schr_compute_partition(t, undetermined); | ||
1249 | /* | ||
1250 | * Determine the main character to be chosen in this step. Choosing such a | ||
1251 | * character c has the effect of splitting every equivalence class | ||
1252 | * (according the the frequency of occurrence of c). We choose the c with | ||
1253 | * the minimum number of possible collisions, so that characters which lead | ||
1254 | * to a large number of collisions get handled early during the search. | ||
1255 | */ | ||
1256 | { | ||
1257 | u32 best_c; | ||
1258 | u32 best_possible_collisions; | ||
1259 | u32 c; | ||
1260 | |||
1261 | best_c = 0; | ||
1262 | best_possible_collisions = U32_MAX; | ||
1263 | c = 0; | ||
1264 | loop { | ||
1265 | if (c >= t->alpha_size) | ||
1266 | break; | ||
1267 | if (t->occurrences[c] > 0 && determined[c]) { | ||
1268 | u32 possible_collisions; | ||
1269 | |||
1270 | possible_collisions = | ||
1271 | schr_count_possible_collisions(t, | ||
1272 | partition, c); | ||
1273 | if (possible_collisions | ||
1274 | < best_possible_collisions) { | ||
1275 | best_c = c; | ||
1276 | best_possible_collisions = | ||
1277 | possible_collisions; | ||
1278 | } | ||
1279 | } | ||
1280 | ++c; | ||
1281 | } | ||
1282 | if (best_possible_collisions == U32_MAX) { | ||
1283 | /* | ||
1284 | * All c with occurrences[c] > 0 are undetermined. We are | ||
1285 | * are the starting situation and don't need any more step. | ||
1286 | */ | ||
1287 | delete_partition(partition); | ||
1288 | break; | ||
1289 | } | ||
1290 | chosen_c = best_c; | ||
1291 | chosen_possible_collisions = best_possible_collisions; | ||
1292 | } | ||
1293 | /* we need one more step */ | ||
1294 | step = calloc(1, sizeof(*step)); | ||
1295 | |||
1296 | step->undetermined = calloc(t->alpha_size, | ||
1297 | sizeof(*(step->undetermined))); | ||
1298 | memcpy(step->undetermined, undetermined, t->alpha_size | ||
1299 | * sizeof(*(step->undetermined))); | ||
1300 | step->partition = partition; | ||
1301 | /* now determine how the equivalence classes will be before this step */ | ||
1302 | undetermined[chosen_c] = true; | ||
1303 | partition = schr_compute_partition(t, undetermined); | ||
1304 | /* | ||
1305 | * Now determine which other characters should be determined in this step, | ||
1306 | * because they will not change the equivalence classes at this point. It | ||
1307 | * is the set of all c which, for all equivalence classes, have the same | ||
1308 | * frequency of occurrence in every keyword of the equivalence class. | ||
1309 | */ | ||
1310 | c = 0; | ||
1311 | loop { | ||
1312 | if (c >= t->alpha_size) | ||
1313 | break; | ||
1314 | if (t->occurrences[c] > 0 && determined[c] | ||
1315 | && schr_unchanged_partition(t, partition, c)) { | ||
1316 | undetermined[c] = true; | ||
1317 | determined[c] = false; | ||
1318 | } | ||
1319 | ++c; | ||
1320 | } | ||
1321 | /* main_c must be one of these */ | ||
1322 | if (determined[chosen_c]) | ||
1323 | abort(); | ||
1324 | /* now the set of changing characters of this step */ | ||
1325 | changing_count = 0; | ||
1326 | c = 0; | ||
1327 | loop { | ||
1328 | if (c >= t->alpha_size) | ||
1329 | break; | ||
1330 | if (undetermined[c] && !step->undetermined[c]) | ||
1331 | ++changing_count; | ||
1332 | ++c; | ||
1333 | } | ||
1334 | changing = calloc(changing_count, sizeof(*changing)); | ||
1335 | changing_count = 0; | ||
1336 | c = 0; | ||
1337 | loop { | ||
1338 | if (c >= t->alpha_size) | ||
1339 | break; | ||
1340 | if (undetermined[c] && !step->undetermined[c]) { | ||
1341 | changing[changing_count] = c; | ||
1342 | ++changing_count; | ||
1343 | } | ||
1344 | ++c; | ||
1345 | } | ||
1346 | step->changing = changing; | ||
1347 | step->changing_count = changing_count; | ||
1348 | step->asso_value_max = t->asso_value_max; | ||
1349 | step->expected_lower = exp((f64)(chosen_possible_collisions) | ||
1350 | / (f64)(t->max_hash_value)); | ||
1351 | step->expected_upper = exp((f64)(chosen_possible_collisions) | ||
1352 | / (f64)(t->asso_value_max)); | ||
1353 | delete_partition(partition); | ||
1354 | step->next = steps; | ||
1355 | steps = step; | ||
1356 | } | ||
1357 | free(determined); | ||
1358 | free(undetermined); | ||
1359 | } | ||
1360 | if (OPTS(DEBUG)) { | ||
1361 | u32 stepno; | ||
1362 | struct Step *step; | ||
1363 | |||
1364 | stepno = 0; | ||
1365 | step = steps; | ||
1366 | loop { | ||
1367 | u32 i; | ||
1368 | struct EquivalenceClass *cls; | ||
1369 | |||
1370 | if (step == 0) | ||
1371 | break; | ||
1372 | ++stepno; | ||
1373 | fprintf(stderr, "Step %u chooses _asso_values[", stepno); | ||
1374 | i = 0; | ||
1375 | loop { | ||
1376 | if (i >= step->changing_count) | ||
1377 | break; | ||
1378 | if (i > 0) | ||
1379 | fprintf(stderr, ","); | ||
1380 | fprintf(stderr, "'%c'", step->changing[i]); | ||
1381 | ++i; | ||
1382 | } | ||
1383 | fprintf(stderr, "], expected number of iterations between %g and %g.\n", step->expected_lower, step->expected_upper); | ||
1384 | fprintf(stderr, "Keyword equivalence classes:\n"); | ||
1385 | cls = step->partition; | ||
1386 | loop { | ||
1387 | struct Keyword_List *tmp; | ||
1388 | |||
1389 | if (cls == 0) | ||
1390 | break; | ||
1391 | fprintf (stderr, "\n"); | ||
1392 | tmp = cls->keywords; | ||
1393 | loop { | ||
1394 | struct Keyword *kw; | ||
1395 | |||
1396 | if (tmp == 0) | ||
1397 | break; | ||
1398 | kw = tmp->kw; | ||
1399 | fprintf(stderr, " %.*s\n", kw->allchars_length, kw->allchars); | ||
1400 | tmp = tmp->next; | ||
1401 | } | ||
1402 | cls = cls->next; | ||
1403 | } | ||
1404 | fprintf(stderr, "\n"); | ||
1405 | step = step->next; | ||
1406 | } | ||
1407 | } | ||
1408 | /* | ||
1409 | * Initialize _asso_values[]. (The value given here matters only for those c which occur in | ||
1410 | * all keywords with equal multiplicity.) | ||
1411 | */ | ||
1412 | memset(t->asso_values, 0, t->alpha_size * sizeof(*t->asso_values)); | ||
1413 | stepno = 0; | ||
1414 | step = steps; | ||
1415 | loop { | ||
1416 | u32 k; | ||
1417 | u32 i; | ||
1418 | u32 iterations; | ||
1419 | u32 *iter; | ||
1420 | u32 ii; | ||
1421 | |||
1422 | if (step == 0) | ||
1423 | break; | ||
1424 | ++stepno; | ||
1425 | /* initialize the asso_values[] */ | ||
1426 | k = step->changing_count; | ||
1427 | i = 0; | ||
1428 | loop { | ||
1429 | u32 c; | ||
1430 | |||
1431 | if (i >= k) | ||
1432 | break; | ||
1433 | c = step->changing[i]; | ||
1434 | t->asso_values[c] = (t->initial_asso_value < 0 ? rand() | ||
1435 | : t->initial_asso_value) & (step->asso_value_max - 1); | ||
1436 | ++i; | ||
1437 | } | ||
1438 | iterations = 0; | ||
1439 | iter = calloc(k, sizeof(*iter)); | ||
1440 | ii = (t->jump != 0 ? k - 1 : 0); | ||
1441 | loop { | ||
1442 | bool has_collision; | ||
1443 | struct EquivalenceClass *cls; | ||
1444 | /* | ||
1445 | * test whether these asso_values[] lead to collisions among the equivalence | ||
1446 | * classes that should be collision-free | ||
1447 | */ | ||
1448 | has_collision = false; | ||
1449 | cls = step->partition; | ||
1450 | loop { | ||
1451 | struct Keyword_List *ptr; | ||
1452 | |||
1453 | if (cls == 0) | ||
1454 | break; | ||
1455 | /* Iteration Number array is a win, O(1) initialization time! */ | ||
1456 | ba_clear(t->collision_detector); | ||
1457 | ptr = cls->keywords; | ||
1458 | loop { | ||
1459 | struct Keyword *kw; | ||
1460 | s32 hashcode; | ||
1461 | |||
1462 | if (ptr == 0) | ||
1463 | break; | ||
1464 | kw = ptr->kw; | ||
1465 | /* | ||
1466 | * compute the new hash code for the keyword, leaving apart | ||
1467 | * the yet undetermined asso_values[]. | ||
1468 | */ | ||
1469 | { | ||
1470 | s32 sum; | ||
1471 | u32 *p; | ||
1472 | s32 i; | ||
1473 | |||
1474 | sum = t->hash_includes_len ? kw->allchars_length | ||
1475 | : 0; | ||
1476 | p = kw->selchars; | ||
1477 | i = kw->selchars_length; | ||
1478 | loop { | ||
1479 | if (i <= 0) | ||
1480 | break; | ||
1481 | if (!step->undetermined[*p]) | ||
1482 | sum += t->asso_values[*p]; | ||
1483 | ++p; | ||
1484 | i--; | ||
1485 | } | ||
1486 | hashcode = sum; | ||
1487 | } | ||
1488 | /* | ||
1489 | * See whether it collides with another keyword's hash code, | ||
1490 | * from the same equivalence class | ||
1491 | */ | ||
1492 | if (ba_set_bit(t->collision_detector, hashcode)) { | ||
1493 | has_collision = true; | ||
1494 | break; | ||
1495 | } | ||
1496 | ptr = ptr->next; | ||
1497 | } | ||
1498 | /* | ||
1499 | * don't need to continue looking at the other equivalence classes | ||
1500 | * if we already have found a collision | ||
1501 | */ | ||
1502 | if (has_collision) | ||
1503 | break; | ||
1504 | cls = cls->next; | ||
1505 | } | ||
1506 | ++iterations; | ||
1507 | if (!has_collision) | ||
1508 | break; | ||
1509 | /* try other asso_values[] */ | ||
1510 | if (t->jump != 0) { | ||
1511 | /* | ||
1512 | * The way we try various values for | ||
1513 | * asso_values[step->_changing[0],...step->_changing[k-1]] | ||
1514 | * is like this: | ||
1515 | * for (bound = 0,1,...) | ||
1516 | * for (ii = 0,...,k-1) | ||
1517 | * iter[ii] := bound | ||
1518 | * iter[0..ii-1] := values <= bound | ||
1519 | * iter[ii+1..k-1] := values < bound | ||
1520 | * and | ||
1521 | * asso_values[step->_changing[i]] = | ||
1522 | * _initial_asso_value + iter[i] * _jump. | ||
1523 | * This makes it more likely to find small asso_values[]. | ||
1524 | */ | ||
1525 | u32 bound; | ||
1526 | s32 i; | ||
1527 | |||
1528 | bound = iter[ii]; | ||
1529 | i = 0; | ||
1530 | loop { | ||
1531 | u32 c; | ||
1532 | |||
1533 | if (i >= ii) | ||
1534 | break; | ||
1535 | c = step->changing[i]; | ||
1536 | ++(iter[i]); | ||
1537 | t->asso_values[c] = (t->asso_values[c] + t->jump) | ||
1538 | & (step->asso_value_max - 1); | ||
1539 | if (iter[i] <= bound) | ||
1540 | goto found_next; | ||
1541 | t->asso_values[c] = (t->asso_values[c] - iter[i] * t->jump) | ||
1542 | & (step->asso_value_max - 1); | ||
1543 | iter[i] = 0; | ||
1544 | ++i; | ||
1545 | } | ||
1546 | i = ii + 1; | ||
1547 | loop { | ||
1548 | u32 c; | ||
1549 | |||
1550 | if (i >= k) | ||
1551 | break; | ||
1552 | c = step->changing[i]; | ||
1553 | ++(iter[i]); | ||
1554 | t->asso_values[c] = (t->asso_values[c] + t->jump) | ||
1555 | & (step->asso_value_max - 1); | ||
1556 | if (iter[i] < bound) | ||
1557 | goto found_next; | ||
1558 | t->asso_values[c] = (t->asso_values[c] - iter[i] * t->jump) | ||
1559 | & (step->asso_value_max - 1); | ||
1560 | iter[i] = 0; | ||
1561 | ++i; | ||
1562 | } | ||
1563 | /* switch from one ii to the next */ | ||
1564 | { | ||
1565 | u32 c; | ||
1566 | |||
1567 | c = step->changing[ii]; | ||
1568 | t->asso_values[c] = (t->asso_values[c] - bound * t->jump) | ||
1569 | & (step->asso_value_max - 1); | ||
1570 | iter[ii] = 0; | ||
1571 | } | ||
1572 | /* here all iter[i] == 0 */ | ||
1573 | ++ii; | ||
1574 | if (ii == k) { | ||
1575 | ii = 0; | ||
1576 | ++bound; | ||
1577 | if (bound == step->asso_value_max) { | ||
1578 | /* | ||
1579 | * Out of search space! We can either backtrack, or | ||
1580 | * increase the available search space of this step. | ||
1581 | * It seems simpler to choose the latter solution. | ||
1582 | */ | ||
1583 | step->asso_value_max = 2 * step->asso_value_max; | ||
1584 | if (step->asso_value_max > t->asso_value_max) { | ||
1585 | t->asso_value_max = step->asso_value_max; | ||
1586 | /* reinitialize _max_hash_value */ | ||
1587 | t->max_hash_value = (t->hash_includes_len ? t->max_key_len : 0) | ||
1588 | + (t->asso_value_max - 1) * t->max_selchars_length; | ||
1589 | /* reinitialize _collision_detector */ | ||
1590 | free(t->collision_detector); | ||
1591 | t->collision_detector = ba_new( | ||
1592 | t->max_hash_value + 1); | ||
1593 | } | ||
1594 | } | ||
1595 | } | ||
1596 | { | ||
1597 | u32 c; | ||
1598 | |||
1599 | c = step->changing[ii]; | ||
1600 | iter[ii] = bound; | ||
1601 | t->asso_values[c] = (t->asso_values[c] + bound * t->jump) | ||
1602 | & (step->asso_value_max - 1); | ||
1603 | } | ||
1604 | found_next: ; | ||
1605 | } else { | ||
1606 | /* random */ | ||
1607 | u32 c; | ||
1608 | |||
1609 | c = step->changing[ii]; | ||
1610 | t->asso_values[c] = (t->asso_values[c] + rand()) | ||
1611 | & (step->asso_value_max - 1); | ||
1612 | /* next time, change the next c */ | ||
1613 | ++ii; | ||
1614 | if (ii == k) | ||
1615 | ii = 0; | ||
1616 | } | ||
1617 | } | ||
1618 | free(iter); | ||
1619 | if (OPTS(DEBUG)) { | ||
1620 | u32 i; | ||
1621 | |||
1622 | fprintf(stderr, "Step %u chose _asso_values[", stepno); | ||
1623 | i = 0; | ||
1624 | loop { | ||
1625 | if (i >= step->changing_count) | ||
1626 | break; | ||
1627 | if (i > 0) | ||
1628 | fprintf(stderr, ","); | ||
1629 | fprintf(stderr, "'%c'", step->changing[i]); | ||
1630 | ++i; | ||
1631 | } | ||
1632 | fprintf (stderr, "] in %u iterations.\n", iterations); | ||
1633 | } | ||
1634 | step = step->next; | ||
1635 | } | ||
1636 | /* free allocated memory */ | ||
1637 | loop { | ||
1638 | struct Step *step; | ||
1639 | |||
1640 | if (steps == 0) | ||
1641 | break; | ||
1642 | step = steps; | ||
1643 | steps = step->next; | ||
1644 | free(step->changing); | ||
1645 | free(step->undetermined); | ||
1646 | delete_partition(step->partition); | ||
1647 | free(step); | ||
1648 | } | ||
1649 | }/*}}}*/ | ||
1650 | /*{{{ chr_count_possible_collisions */ | ||
1651 | /* | ||
1652 | * compute the possible number of collisions when asso_values[c] is chosen, leading to the given | ||
1653 | * partition | ||
1654 | */ | ||
1655 | static u32 schr_count_possible_collisions(struct Search *t, | ||
1656 | struct EquivalenceClass *partition, u32 c) | ||
1657 | { | ||
1658 | /* | ||
1659 | * Every equivalence class p is split according to the frequency of occurrence of c, leading | ||
1660 | * to equivalence classes p1, p2, ... | ||
1661 | * This leads to (|p|^2 - |p1|^2 - |p2|^2 - ...)/2 possible collisions. | ||
1662 | * Return the sum of this expression over all equivalence classes. | ||
1663 | */ | ||
1664 | u32 sum; | ||
1665 | u32 m; | ||
1666 | u32 *split_cardinalities; | ||
1667 | struct EquivalenceClass *cls; | ||
1668 | |||
1669 | sum = 0; | ||
1670 | m = t->max_selchars_length; | ||
1671 | split_cardinalities = calloc(m + 1, sizeof(*split_cardinalities)); | ||
1672 | cls = partition; | ||
1673 | loop { | ||
1674 | u32 i; | ||
1675 | struct Keyword_List *tmp; | ||
1676 | |||
1677 | if (cls == 0) | ||
1678 | break; | ||
1679 | memset(split_cardinalities, 0, (m + 1) * sizeof(*split_cardinalities)); | ||
1680 | tmp = cls->keywords; | ||
1681 | loop { | ||
1682 | struct Keyword *kw; | ||
1683 | u32 count; | ||
1684 | s32 i; | ||
1685 | |||
1686 | if (tmp == 0) | ||
1687 | break; | ||
1688 | kw = tmp->kw; | ||
1689 | count = 0; | ||
1690 | i = 0; | ||
1691 | loop { | ||
1692 | if (i >= kw->selchars_length) | ||
1693 | break; | ||
1694 | if (kw->selchars[i] == c) | ||
1695 | ++count; | ||
1696 | ++i; | ||
1697 | } | ||
1698 | ++(split_cardinalities[count]); | ||
1699 | tmp = tmp->next; | ||
1700 | } | ||
1701 | sum += cls->cardinality * cls->cardinality; | ||
1702 | i = 0; | ||
1703 | loop { | ||
1704 | if (i > m) | ||
1705 | break; | ||
1706 | sum -= split_cardinalities[i] * split_cardinalities[i]; | ||
1707 | ++i; | ||
1708 | } | ||
1709 | cls = cls->next; | ||
1710 | } | ||
1711 | free(split_cardinalities); | ||
1712 | return sum; | ||
1713 | } | ||
1714 | /*}}}*/ | ||
1715 | /*{{{ schr_compute_partition */ | ||
1716 | static struct EquivalenceClass *schr_compute_partition(struct Search *t, bool *undetermined) | ||
1717 | { | ||
1718 | struct EquivalenceClass *partition; | ||
1719 | struct EquivalenceClass *partition_last; | ||
1720 | struct Keyword_List *tmp; | ||
1721 | struct EquivalenceClass *cls; | ||
1722 | |||
1723 | partition = 0; | ||
1724 | partition_last = 0; | ||
1725 | tmp = t->head; | ||
1726 | loop { | ||
1727 | struct Keyword *kw; | ||
1728 | u32 *undetermined_chars; | ||
1729 | u32 undetermined_chars_length; | ||
1730 | s32 i; | ||
1731 | struct EquivalenceClass *equclass; | ||
1732 | struct Keyword_List *cons; | ||
1733 | |||
1734 | if (tmp == 0) | ||
1735 | break; | ||
1736 | kw = tmp->kw; | ||
1737 | undetermined_chars = calloc(kw->selchars_length, sizeof(*undetermined_chars)); | ||
1738 | undetermined_chars_length = 0; | ||
1739 | i = 0; | ||
1740 | loop { | ||
1741 | if (i >= kw->selchars_length) | ||
1742 | break; | ||
1743 | if (undetermined[kw->selchars[i]] != 0) { | ||
1744 | undetermined_chars[undetermined_chars_length] = kw->selchars[i]; | ||
1745 | ++undetermined_chars_length; | ||
1746 | } | ||
1747 | ++i; | ||
1748 | } | ||
1749 | /* look up the equivalence class to which this keyword belongs */ | ||
1750 | equclass = partition; | ||
1751 | loop { | ||
1752 | if (equclass == 0) | ||
1753 | break; | ||
1754 | if (equclass->undetermined_chars_length == undetermined_chars_length | ||
1755 | && equals(equclass->undetermined_chars, undetermined_chars, | ||
1756 | undetermined_chars_length)) | ||
1757 | break; | ||
1758 | equclass = equclass->next; | ||
1759 | } | ||
1760 | if (equclass == 0) { | ||
1761 | equclass = calloc(1, sizeof(*equclass)); | ||
1762 | equclass->undetermined_chars = undetermined_chars; | ||
1763 | equclass->undetermined_chars_length = undetermined_chars_length; | ||
1764 | if (partition != 0) | ||
1765 | partition_last->next = equclass; | ||
1766 | else | ||
1767 | partition = equclass; | ||
1768 | partition_last = equclass; | ||
1769 | } else | ||
1770 | free(undetermined_chars); | ||
1771 | /* add the keyword to the equivalence class */ | ||
1772 | cons = kwl_new(kw); | ||
1773 | if (equclass->keywords != 0) | ||
1774 | equclass->keywords_last->next = cons; | ||
1775 | else | ||
1776 | equclass->keywords = cons; | ||
1777 | equclass->keywords_last = cons; | ||
1778 | ++(equclass->cardinality); | ||
1779 | tmp = tmp->next; | ||
1780 | } | ||
1781 | /* Free some of the allocated memory. The caller doesn't need it. */ | ||
1782 | cls = partition; | ||
1783 | loop { | ||
1784 | if (cls == 0) | ||
1785 | break; | ||
1786 | free(cls->undetermined_chars); | ||
1787 | cls = cls->next; | ||
1788 | } | ||
1789 | return partition; | ||
1790 | }/*}}}*/ | ||
1791 | /*{{{ schr_prepare_asso_values */ | ||
1792 | /* initializes the asso_values[] related parameters */ | ||
1793 | static void schr_prepare_asso_values(struct Search *t) | ||
1794 | { | ||
1795 | struct Keyword_List *tmp; | ||
1796 | struct PositionIterator *iter; | ||
1797 | s32 non_linked_length; | ||
1798 | u32 asso_value_max; | ||
1799 | |||
1800 | /* initialize each keyword's _selchars array */ | ||
1801 | schr_init_selchars_multiset(t, t->key_positions, t->alpha_unify, t->alpha_inc); | ||
1802 | /* compute the maximum _selchars_length over all keywords */ | ||
1803 | iter = pos_iterator(t->key_positions, t->max_key_len); | ||
1804 | t->max_selchars_length = positer_remaining(iter); | ||
1805 | positer_del(iter); | ||
1806 | /* | ||
1807 | * Check for duplicates, i.e. keywords with the same _selchars array (and - if | ||
1808 | * _hash_includes_len - also the same length). We deal with these by building an | ||
1809 | * equivalence class, so that only 1 keyword is representative of the entire collection. | ||
1810 | * Only this representative remains in the keyword list; the others are accessible through | ||
1811 | * the _duplicate_link chain, starting at the representative. This *greatly* simplifies | ||
1812 | * processing during later stages of the program. Set _total_duplicates and _list_len = | ||
1813 | * _total_keys - _total_duplicates. | ||
1814 | */ | ||
1815 | { | ||
1816 | struct Hash_Table *representatives; | ||
1817 | struct Keyword_List *prev; | ||
1818 | |||
1819 | t->list_len = t->total_keys; | ||
1820 | t->total_duplicates = 0; | ||
1821 | |||
1822 | representatives = ht_new(t->list_len, !t->hash_includes_len); | ||
1823 | prev = 0; /* list node before temp */ | ||
1824 | tmp = t->head; | ||
1825 | loop { | ||
1826 | struct Keyword *kw; | ||
1827 | struct Keyword *other_kw; | ||
1828 | struct Keyword_List *garbage; | ||
1829 | |||
1830 | if (tmp == 0) | ||
1831 | break; | ||
1832 | kw = tmp->kw; | ||
1833 | other_kw = ht_insert(representatives, kw); | ||
1834 | garbage = 0; | ||
1835 | if (other_kw != 0) { | ||
1836 | ++(t->total_duplicates); | ||
1837 | (t->list_len)--; | ||
1838 | /* remove keyword from the main list */ | ||
1839 | prev->next = tmp->next; | ||
1840 | garbage = tmp; | ||
1841 | /* and insert it on other_keyword's duplicate list */ | ||
1842 | kw->duplicate_link = other_kw->duplicate_link; | ||
1843 | other_kw->duplicate_link = kw; | ||
1844 | /* complain if user hasn't enabled the duplicate option */ | ||
1845 | if (!OPTS(DUP) || OPTS(DEBUG)) { | ||
1846 | s32 j; | ||
1847 | |||
1848 | fprintf(stderr, "Key link: \"%.*s\" = \"%.*s\", with key set \"", kw->allchars_length, kw->allchars, other_kw->allchars_length, other_kw->allchars); | ||
1849 | j = 0; | ||
1850 | loop { | ||
1851 | if (j >= kw->selchars_length) | ||
1852 | break; | ||
1853 | putc(kw->selchars[j], stderr); | ||
1854 | ++j; | ||
1855 | } | ||
1856 | fprintf(stderr, "\".\n"); | ||
1857 | } | ||
1858 | } else { | ||
1859 | kw->duplicate_link = 0; | ||
1860 | prev = tmp; | ||
1861 | } | ||
1862 | tmp = tmp->next; | ||
1863 | if (garbage != 0) | ||
1864 | kwl_del(garbage); | ||
1865 | } | ||
1866 | if (OPTS(DEBUG)) | ||
1867 | ht_dump(representatives); | ||
1868 | ht_del(representatives); | ||
1869 | } | ||
1870 | /* | ||
1871 | * Exit program if duplicates exists and option[DUP] not set, since we don't want to | ||
1872 | * continue in this case. (We don't want to turn on option[DUP] implicitly, because the | ||
1873 | * generated code is usually much slower. | ||
1874 | */ | ||
1875 | if (t->total_duplicates != 0) { | ||
1876 | if (OPTS(DUP)) | ||
1877 | fprintf(stderr, "%d input keys have identical hash values, examine output carefully...\n", t->total_duplicates); | ||
1878 | else { | ||
1879 | fprintf(stderr, "%d input keys have identical hash values,\n", t->total_duplicates); | ||
1880 | if (OPTS(POSITIONS)) | ||
1881 | fprintf(stderr, "try different key positions or use option -D.\n"); | ||
1882 | else | ||
1883 | fprintf(stderr, "use option -D.\n"); | ||
1884 | exit(1); | ||
1885 | } | ||
1886 | } | ||
1887 | /* compute the occurrences of each character in the alphabet */ | ||
1888 | t->occurrences = calloc(t->alpha_size, sizeof(*(t->occurrences))); | ||
1889 | tmp = t->head; | ||
1890 | loop { | ||
1891 | struct Keyword *kw; | ||
1892 | u32 *ptr; | ||
1893 | s32 count; | ||
1894 | |||
1895 | if (tmp == 0) | ||
1896 | break; | ||
1897 | kw = tmp->kw; | ||
1898 | ptr = kw->selchars; | ||
1899 | count = kw->selchars_length; | ||
1900 | loop { | ||
1901 | if (count <= 0) | ||
1902 | break; | ||
1903 | ++(t->occurrences[*ptr]); | ||
1904 | ++ptr; | ||
1905 | count--; | ||
1906 | } | ||
1907 | tmp = tmp->next; | ||
1908 | } | ||
1909 | /* memory allocation */ | ||
1910 | t->asso_values = calloc(t->alpha_size, sizeof(*(t->asso_values))); | ||
1911 | non_linked_length = t->list_len; | ||
1912 | asso_value_max = (u32)(non_linked_length * options->size_multiple); | ||
1913 | /* | ||
1914 | * Round up to the next power of two. This makes it easy to ensure an _asso_value[c] is >= 0 | ||
1915 | * and < asso_value_max. Also, the jump value being odd, it guarantees that | ||
1916 | * Search::try_asso_value() will iterate through different values for _asso_value[c]. | ||
1917 | */ | ||
1918 | if (asso_value_max == 0) | ||
1919 | asso_value_max = 1; | ||
1920 | asso_value_max |= asso_value_max >> 1; | ||
1921 | asso_value_max |= asso_value_max >> 2; | ||
1922 | asso_value_max |= asso_value_max >> 4; | ||
1923 | asso_value_max |= asso_value_max >> 8; | ||
1924 | asso_value_max |= asso_value_max >> 16; | ||
1925 | ++asso_value_max; | ||
1926 | t->asso_value_max = asso_value_max; | ||
1927 | /* | ||
1928 | * given the bound for _asso_values[c], we have a bound for the possible hash values, as | ||
1929 | * computed in compute_hash() | ||
1930 | */ | ||
1931 | t->max_hash_value = (t->hash_includes_len ? t->max_key_len : 0) + (t->asso_value_max - 1) | ||
1932 | * t->max_selchars_length; | ||
1933 | /* allocate a sparse bit vector for detection of collisions of hash values */ | ||
1934 | t->collision_detector = ba_new(t->max_hash_value + 1); | ||
1935 | if (OPTS(DEBUG)) { | ||
1936 | s32 field_width; | ||
1937 | s32 i; | ||
1938 | |||
1939 | fprintf (stderr, "total non-linked keys = %d\nmaximum associated value is %d\nmaximum size of generated hash table is %d\n", non_linked_length, asso_value_max, t->max_hash_value); | ||
1940 | field_width = 0; | ||
1941 | { | ||
1942 | struct Keyword_List *tmp; | ||
1943 | |||
1944 | tmp = t->head; | ||
1945 | loop { | ||
1946 | struct Keyword *kw; | ||
1947 | |||
1948 | if (tmp == 0) | ||
1949 | break; | ||
1950 | kw = tmp->kw; | ||
1951 | if (field_width < kw->selchars_length) | ||
1952 | field_width = kw->selchars_length; | ||
1953 | tmp = tmp->next; | ||
1954 | } | ||
1955 | } | ||
1956 | fprintf (stderr, "\ndumping the keyword list without duplicates\n"); | ||
1957 | fprintf (stderr, "keyword #, %*s, keyword\n", field_width, "keysig"); | ||
1958 | i = 0; | ||
1959 | tmp = t->head; | ||
1960 | loop { | ||
1961 | struct Keyword *kw; | ||
1962 | s32 j; | ||
1963 | |||
1964 | if (tmp == 0) | ||
1965 | break; | ||
1966 | kw = tmp->kw; | ||
1967 | ++i; | ||
1968 | fprintf(stderr, "%9d, ", i); | ||
1969 | if (field_width > kw->selchars_length) | ||
1970 | fprintf(stderr, "%*s", field_width - kw->selchars_length, ""); | ||
1971 | j = 0; | ||
1972 | loop { | ||
1973 | if (j >= kw->selchars_length) | ||
1974 | break; | ||
1975 | putc(kw->selchars[j], stderr); | ||
1976 | ++j; | ||
1977 | } | ||
1978 | fprintf(stderr, ", %.*s\n", kw->allchars_length, kw->allchars); | ||
1979 | tmp = tmp->next; | ||
1980 | } | ||
1981 | fprintf(stderr, "\nend of keyword list\n\n"); | ||
1982 | } | ||
1983 | if (OPTS(RANDOM) || options->jump == 0) | ||
1984 | srand((long)time(0)); | ||
1985 | t->initial_asso_value = (OPTS(RANDOM) ? -1 : options->initial_asso_value); | ||
1986 | t->jump = options->jump; | ||
1987 | }/*}}}*/ | ||
1988 | /*{{{ schr_unchanged_partition */ | ||
1989 | /* Test whether adding c to the undetermined characters changes the given partition. */ | ||
1990 | static bool schr_unchanged_partition(struct Search *t, struct EquivalenceClass *partition, u32 c) | ||
1991 | { | ||
1992 | struct EquivalenceClass *cls; | ||
1993 | |||
1994 | cls = partition; | ||
1995 | loop { | ||
1996 | u32 first_count; | ||
1997 | struct Keyword_List *tmp; | ||
1998 | |||
1999 | if (cls == 0) | ||
2000 | break; | ||
2001 | first_count = U32_MAX; | ||
2002 | tmp = cls->keywords; | ||
2003 | loop { | ||
2004 | struct Keyword *kw; | ||
2005 | u32 count; | ||
2006 | s32 i; | ||
2007 | |||
2008 | if (tmp == 0) | ||
2009 | break; | ||
2010 | kw = tmp->kw; | ||
2011 | count = 0; | ||
2012 | i = 0; | ||
2013 | loop { | ||
2014 | if (i >= kw->selchars_length) | ||
2015 | break; | ||
2016 | if (kw->selchars[i] == c) | ||
2017 | ++count; | ||
2018 | ++i; | ||
2019 | } | ||
2020 | if (tmp == cls->keywords) | ||
2021 | first_count = count; | ||
2022 | else if (count != first_count) | ||
2023 | /* c would split this equivalence class */ | ||
2024 | return false; | ||
2025 | tmp = tmp->next; | ||
2026 | } | ||
2027 | cls = cls->next; | ||
2028 | } | ||
2029 | return true; | ||
2030 | } | ||
2031 | /*}}}*/ | ||
2032 | /*{{{ schr_compute_hash */ | ||
2033 | /* | ||
2034 | * computes a keyword's hash value, relative to the current _asso_values[], and stores it in | ||
2035 | * keyword->_hash_value | ||
2036 | */ | ||
2037 | static s32 schr_compute_hash(struct Search *t, struct Keyword *kw) | ||
2038 | { | ||
2039 | s32 sum; | ||
2040 | u32 *p; | ||
2041 | s32 i; | ||
2042 | |||
2043 | sum = t->hash_includes_len ? kw->allchars_length : 0; | ||
2044 | p = kw->selchars; | ||
2045 | i = kw->selchars_length; | ||
2046 | loop { | ||
2047 | if (i <= 0) | ||
2048 | break; | ||
2049 | sum += t->asso_values[*p]; | ||
2050 | ++p; | ||
2051 | i--; | ||
2052 | } | ||
2053 | kw->hash_value = sum; | ||
2054 | return sum; | ||
2055 | }/*}}}*/ | ||
2056 | /*{{{ schr_sort */ | ||
2057 | static void schr_sort(struct Search *t) | ||
2058 | { | ||
2059 | t->head = mergesort_list(t->head, less_by_hash_value); | ||
2060 | } | ||
2061 | /*}}}*/ | ||
2062 | /*------------------------------------------------------------------------------------------------*/ | ||
2063 | #define EPILOG | ||
2064 | #include "namespace/globals.h" | ||
2065 | #include "namespace/search.h" | ||
2066 | #include "namespace/keyword.h" | ||
2067 | #include "namespace/keyword_list.h" | ||
2068 | #include "namespace/options.h" | ||
2069 | #include "namespace/positions.h" | ||
2070 | #include "namespace/hash-table.h" | ||
2071 | #include "namespace/bool-array.h" | ||
2072 | #include "namespace/search.c" | ||
2073 | #undef EPILOG | ||
2074 | /*------------------------------------------------------------------------------------------------*/ | ||
2075 | #endif |
File search.h added (mode: 100644) (index 0000000..2356686) | |||
1 | #ifndef CGPERF_SEARCH_H | ||
2 | #define CGPERF_SEARCH_H | ||
3 | #include <stdbool.h> | ||
4 | #include "c_fixing.h" | ||
5 | #include "keyword_list.h" | ||
6 | #include "positions.h" | ||
7 | #include "bool-array.h" | ||
8 | /*------------------------------------------------------------------------------------------------*/ | ||
9 | #include "namespace/search.h" | ||
10 | #include "namespace/keyword.h" | ||
11 | #include "namespace/keyword_list.h" | ||
12 | #include "namespace/positions.h" | ||
13 | #include "namespace/bool-array.h" | ||
14 | /* for the Search local types */ | ||
15 | #include "namespace/search.c" | ||
16 | /*---------------------------i--------------------------------------------------------------------*/ | ||
17 | /*{{{ types */ | ||
18 | struct Search { | ||
19 | /*{{{ public */ | ||
20 | struct Keyword_List *head; | ||
21 | /* total number of keywords, counting duplicates */ | ||
22 | s32 total_keys; | ||
23 | /* maximum length of the longest keyword */ | ||
24 | s32 max_key_len; | ||
25 | /* minimum length of the shortest keyword */ | ||
26 | s32 min_key_len; | ||
27 | /* whether the hash function includes the length */ | ||
28 | bool hash_includes_len; | ||
29 | /* user-specified or computed key positions */ | ||
30 | struct Positions *key_positions; | ||
31 | /* adjustments to add to bytes add specific key positions */ | ||
32 | u32 *alpha_inc; | ||
33 | /* size of alphabet */ | ||
34 | u32 alpha_size; | ||
35 | /* | ||
36 | * alphabet character unification, either the identity or a mapping from upper case | ||
37 | * characters to lower case characters (and maybe more) | ||
38 | */ | ||
39 | u32 *alpha_unify; | ||
40 | /* maximum _selchars_length over all keywords */ | ||
41 | u32 max_selchars_length; | ||
42 | /* | ||
43 | * total number of duplicates that have been moved to _duplicate_link lists (not counting | ||
44 | * their representatives which stay on the main list) | ||
45 | */ | ||
46 | s32 total_duplicates; | ||
47 | /* | ||
48 | * Counts occurrences of each key set character. occurrences[c] is the number of times that | ||
49 | * c occurs among the _selchars of a keyword. | ||
50 | */ | ||
51 | s32 *occurrences; | ||
52 | /* value associated with each character */ | ||
53 | s32 *asso_values; | ||
54 | /*}}} public -- END */ | ||
55 | /*{{{ private */ | ||
56 | /* maximal possible hash value */ | ||
57 | s32 max_hash_value; | ||
58 | /* exclusive upper bound for every _asso_values[c]. A power of 2. */ | ||
59 | u32 asso_value_max; | ||
60 | /* Initial value for asso_values table. -1 means random. */ | ||
61 | s32 initial_asso_value; | ||
62 | /* Jump length when trying alternative values. 0 means random. */ | ||
63 | s32 jump; | ||
64 | /* Length of _head list. Number of keywords, not counting duplicates. */ | ||
65 | s32 list_len; | ||
66 | /* sparse bit vector for collision detection */ | ||
67 | struct Bool_Array *collision_detector; | ||
68 | /*}}} private -- END */ | ||
69 | }; | ||
70 | /*}}} types -- END */ | ||
71 | /*{{{ public static methods */ | ||
72 | static struct Search *schr_new(struct Keyword_List *list); | ||
73 | static void schr_del(struct Search *t); | ||
74 | static void schr_optimize(struct Search *t); | ||
75 | /*}}} public static methods -- END */ | ||
76 | /*{{{ private static methods */ | ||
77 | static void schr_prepare(struct Search *t); | ||
78 | static void schr_find_good_asso_values(struct Search *t); | ||
79 | static u32 schr_count_duplicates_tuple(struct Search *t); | ||
80 | static u32 schr_count_duplicates_tuple_do(struct Search *t, struct Positions *positions, | ||
81 | u32 *alpha_unify); | ||
82 | static void schr_find_positions(struct Search *t); | ||
83 | static void schr_find_alpha_inc(struct Search *t); | ||
84 | static u32 *schr_compute_alpha_unify(struct Search *t); | ||
85 | static u32 *schr_compute_alpha_unify_with_inc(struct Search *t, struct Positions *positions, | ||
86 | u32 *alpha_inc); | ||
87 | static u32 schr_compute_alpha_size(void); | ||
88 | static u32 schr_compute_alpha_size_with_inc(struct Search *t, u32 *alpha_inc); | ||
89 | static void schr_init_selchars_tuple(struct Search *t, struct Positions *positions, | ||
90 | u32 *alpha_unify); | ||
91 | static void schr_delete_selchars(struct Search *t); | ||
92 | static u32 schr_count_duplicates_multiset(struct Search *t, u32 *alpha_inc); | ||
93 | static void schr_init_selchars_multiset(struct Search *t, struct Positions *positions, | ||
94 | u32 *alpha_unify, u32 *alpha_inc); | ||
95 | static void schr_prepare_asso_values(struct Search *t); | ||
96 | static void schr_find_asso_values(struct Search *t); | ||
97 | struct EquivalenceClass; | ||
98 | static struct EquivalenceClass *schr_compute_partition(struct Search *t, bool *undetermined); | ||
99 | static u32 schr_count_possible_collisions(struct Search *t, struct EquivalenceClass *partition, | ||
100 | u32 c); | ||
101 | static bool schr_unchanged_partition(struct Search *t, struct EquivalenceClass *partition, u32 c); | ||
102 | static s32 schr_compute_hash(struct Search *t, struct Keyword *kw); | ||
103 | static void schr_sort(struct Search *t); | ||
104 | /*}}} private static methods -- END */ | ||
105 | /*------------------------------------------------------------------------------------------------*/ | ||
106 | #define EPILOG | ||
107 | #include "namespace/search.h" | ||
108 | #include "namespace/keyword.h" | ||
109 | #include "namespace/keyword_list.h" | ||
110 | #include "namespace/positions.h" | ||
111 | #include "namespace/bool-array.h" | ||
112 | /* for the Search local types */ | ||
113 | #include "namespace/search.c" | ||
114 | #undef EPILOG | ||
115 | /*------------------------------------------------------------------------------------------------*/ | ||
116 | #endif |
File tests/.gitignore added (mode: 100644) (index 0000000..a432aaf) | |||
1 | # Files generated by the autotools: | ||
2 | /configure | ||
3 |
File tests/ada-pred.exp added (mode: 100644) (index 0000000..33caaa3) | |||
1 | in word set boolean | ||
2 | in word set character | ||
3 | in word set constraint_error | ||
4 | in word set false | ||
5 | in word set float | ||
6 | in word set integer | ||
7 | in word set natural | ||
8 | in word set numeric_error | ||
9 | in word set positive | ||
10 | in word set program_error | ||
11 | in word set storage_error | ||
12 | in word set string | ||
13 | in word set tasking_error | ||
14 | in word set true | ||
15 | in word set address | ||
16 | in word set aft | ||
17 | in word set base | ||
18 | in word set callable | ||
19 | in word set constrained | ||
20 | in word set count | ||
21 | in word set delta | ||
22 | in word set digits | ||
23 | in word set emax | ||
24 | in word set epsilon | ||
25 | in word set first | ||
26 | in word set firstbit | ||
27 | in word set fore | ||
28 | in word set image | ||
29 | in word set large | ||
30 | in word set last | ||
31 | in word set lastbit | ||
32 | in word set length | ||
33 | in word set machine_emax | ||
34 | in word set machine_emin | ||
35 | in word set machine_mantissa | ||
36 | in word set machine_overflows | ||
37 | in word set machine_radix | ||
38 | in word set machine_rounds | ||
39 | in word set mantissa | ||
40 | in word set pos | ||
41 | in word set position | ||
42 | in word set pred | ||
43 | in word set range | ||
44 | in word set safe_emax | ||
45 | in word set safe_large | ||
46 | in word set safe_small | ||
47 | in word set size | ||
48 | in word set small | ||
49 | in word set storage_size | ||
50 | in word set succ | ||
51 | in word set terminated | ||
52 | in word set val | ||
53 | in word set value | ||
54 | in word set width |
File tests/ada-res.exp added (mode: 100644) (index 0000000..8134fe8) | |||
1 | in word set else | ||
2 | in word set exit | ||
3 | in word set terminate | ||
4 | in word set type | ||
5 | in word set raise | ||
6 | in word set range | ||
7 | in word set reverse | ||
8 | in word set declare | ||
9 | in word set end | ||
10 | in word set record | ||
11 | in word set exception | ||
12 | in word set not | ||
13 | in word set then | ||
14 | in word set return | ||
15 | in word set separate | ||
16 | in word set select | ||
17 | in word set digits | ||
18 | in word set renames | ||
19 | in word set subtype | ||
20 | in word set elsif | ||
21 | in word set function | ||
22 | in word set for | ||
23 | in word set package | ||
24 | in word set procedure | ||
25 | in word set private | ||
26 | in word set while | ||
27 | in word set when | ||
28 | in word set new | ||
29 | in word set entry | ||
30 | in word set delay | ||
31 | in word set case | ||
32 | in word set constant | ||
33 | in word set at | ||
34 | in word set abort | ||
35 | in word set accept | ||
36 | in word set and | ||
37 | in word set delta | ||
38 | in word set access | ||
39 | in word set abs | ||
40 | in word set pragma | ||
41 | in word set array | ||
42 | in word set use | ||
43 | in word set out | ||
44 | in word set do | ||
45 | in word set others | ||
46 | in word set of | ||
47 | in word set or | ||
48 | in word set all | ||
49 | in word set limited | ||
50 | in word set loop | ||
51 | in word set null | ||
52 | in word set task | ||
53 | in word set in | ||
54 | in word set is | ||
55 | in word set if | ||
56 | in word set rem | ||
57 | in word set mod | ||
58 | in word set begin | ||
59 | in word set body | ||
60 | in word set xor | ||
61 | in word set goto | ||
62 | in word set generic | ||
63 | in word set with |
File tests/ada.gperf added (mode: 100644) (index 0000000..332bdc7) | |||
1 | else | ||
2 | exit | ||
3 | terminate | ||
4 | type | ||
5 | raise | ||
6 | range | ||
7 | reverse | ||
8 | declare | ||
9 | end | ||
10 | record | ||
11 | exception | ||
12 | not | ||
13 | then | ||
14 | return | ||
15 | separate | ||
16 | select | ||
17 | digits | ||
18 | renames | ||
19 | subtype | ||
20 | elsif | ||
21 | function | ||
22 | for | ||
23 | package | ||
24 | procedure | ||
25 | private | ||
26 | while | ||
27 | when | ||
28 | new | ||
29 | entry | ||
30 | delay | ||
31 | case | ||
32 | constant | ||
33 | at | ||
34 | abort | ||
35 | accept | ||
36 | and | ||
37 | delta | ||
38 | access | ||
39 | abs | ||
40 | pragma | ||
41 | array | ||
42 | use | ||
43 | out | ||
44 | do | ||
45 | others | ||
46 | of | ||
47 | or | ||
48 | all | ||
49 | limited | ||
50 | loop | ||
51 | null | ||
52 | task | ||
53 | in | ||
54 | is | ||
55 | if | ||
56 | rem | ||
57 | mod | ||
58 | begin | ||
59 | body | ||
60 | xor | ||
61 | goto | ||
62 | generic | ||
63 | with |
File tests/adadefs.gperf added (mode: 100644) (index 0000000..875be69) | |||
1 | boolean | ||
2 | character | ||
3 | constraint_error | ||
4 | false | ||
5 | float | ||
6 | integer | ||
7 | natural | ||
8 | numeric_error | ||
9 | positive | ||
10 | program_error | ||
11 | storage_error | ||
12 | string | ||
13 | tasking_error | ||
14 | true | ||
15 | address | ||
16 | aft | ||
17 | base | ||
18 | callable | ||
19 | constrained | ||
20 | count | ||
21 | delta | ||
22 | digits | ||
23 | emax | ||
24 | epsilon | ||
25 | first | ||
26 | firstbit | ||
27 | fore | ||
28 | image | ||
29 | large | ||
30 | last | ||
31 | lastbit | ||
32 | length | ||
33 | machine_emax | ||
34 | machine_emin | ||
35 | machine_mantissa | ||
36 | machine_overflows | ||
37 | machine_radix | ||
38 | machine_rounds | ||
39 | mantissa | ||
40 | pos | ||
41 | position | ||
42 | pred | ||
43 | range | ||
44 | safe_emax | ||
45 | safe_large | ||
46 | safe_small | ||
47 | size | ||
48 | small | ||
49 | storage_size | ||
50 | succ | ||
51 | terminated | ||
52 | val | ||
53 | value | ||
54 | width |
File tests/c++.gperf added (mode: 100644) (index 0000000..650d32d) | |||
1 | asm | ||
2 | auto | ||
3 | break | ||
4 | case | ||
5 | catch | ||
6 | char | ||
7 | class | ||
8 | const | ||
9 | continue | ||
10 | default | ||
11 | delete | ||
12 | do | ||
13 | double | ||
14 | else | ||
15 | enum | ||
16 | extern | ||
17 | float | ||
18 | for | ||
19 | friend | ||
20 | goto | ||
21 | if | ||
22 | inline | ||
23 | int | ||
24 | long | ||
25 | new | ||
26 | operator | ||
27 | overload | ||
28 | private | ||
29 | protected | ||
30 | public | ||
31 | register | ||
32 | return | ||
33 | short | ||
34 | signed | ||
35 | sizeof | ||
36 | static | ||
37 | struct | ||
38 | switch | ||
39 | template | ||
40 | this | ||
41 | typedef | ||
42 | union | ||
43 | unsigned | ||
44 | virtual | ||
45 | void | ||
46 | volatile | ||
47 | while |
File tests/c-parse.exp added (mode: 100644) (index 0000000..9294294) | |||
1 | /* C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -L C -F ', 0, 0' -j1 -i 1 -g -o -t -G -N is_reserved_word -k'1,3,$' */ | ||
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-gperf@gnu.org>." | ||
29 | #endif | ||
30 | |||
31 | |||
32 | /* Command-line: gperf -L KR-C -F ', 0, 0' -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ | ||
33 | struct resword { const char *name; short token; enum rid rid; }; | ||
34 | |||
35 | #define TOTAL_KEYWORDS 83 | ||
36 | #define MIN_WORD_LENGTH 2 | ||
37 | #define MAX_WORD_LENGTH 20 | ||
38 | #define MIN_HASH_VALUE 12 | ||
39 | #define MAX_HASH_VALUE 125 | ||
40 | /* maximum key range = 114, duplicates = 0 */ | ||
41 | |||
42 | #ifdef __GNUC__ | ||
43 | __inline | ||
44 | #else | ||
45 | #ifdef __cplusplus | ||
46 | inline | ||
47 | #endif | ||
48 | #endif | ||
49 | static unsigned int | ||
50 | hash (str, len) | ||
51 | register const char *str; | ||
52 | register size_t len; | ||
53 | { | ||
54 | static unsigned char asso_values[] = | ||
55 | { | ||
56 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
57 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
58 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
59 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
60 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
61 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
62 | 126, 126, 126, 126, 19, 126, 126, 126, 126, 126, | ||
63 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
64 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
65 | 126, 126, 126, 126, 126, 1, 126, 12, 50, 17, | ||
66 | 22, 18, 51, 37, 5, 10, 126, 15, 35, 49, | ||
67 | 27, 40, 28, 126, 2, 20, 1, 33, 64, 7, | ||
68 | 11, 4, 7, 126, 126, 126, 126, 126, 126, 126, | ||
69 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
70 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
71 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
72 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
73 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
74 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
75 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
76 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
77 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
78 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
79 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
80 | 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, | ||
81 | 126, 126, 126, 126, 126, 126 | ||
82 | }; | ||
83 | register unsigned int hval = len; | ||
84 | |||
85 | switch (hval) | ||
86 | { | ||
87 | default: | ||
88 | hval += asso_values[(unsigned char)str[2]]; | ||
89 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
90 | [[fallthrough]]; | ||
91 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
92 | __attribute__ ((__fallthrough__)); | ||
93 | #endif | ||
94 | /*FALLTHROUGH*/ | ||
95 | case 2: | ||
96 | case 1: | ||
97 | hval += asso_values[(unsigned char)str[0]]; | ||
98 | break; | ||
99 | } | ||
100 | return hval + asso_values[(unsigned char)str[len - 1]]; | ||
101 | } | ||
102 | |||
103 | static struct resword wordlist[] = | ||
104 | { | ||
105 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
106 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
107 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
108 | {"__real__", REALPART, NORID}, | ||
109 | {"__typeof__", TYPEOF, NORID}, | ||
110 | {"__restrict", TYPE_QUAL, RID_RESTRICT}, | ||
111 | {"int", TYPESPEC, RID_INT}, | ||
112 | {"__restrict__", TYPE_QUAL, RID_RESTRICT}, | ||
113 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
114 | {"__imag__", IMAGPART, NORID}, | ||
115 | {"__asm__", ASM_KEYWORD, NORID}, | ||
116 | {"__inline__", SCSPEC, RID_INLINE}, | ||
117 | {"__iterator", SCSPEC, RID_ITERATOR}, | ||
118 | {"__iterator__", SCSPEC, RID_ITERATOR}, | ||
119 | {"__alignof__", ALIGNOF, NORID}, | ||
120 | {"__const", TYPE_QUAL, RID_CONST}, | ||
121 | {"__attribute__", ATTRIBUTE, NORID}, | ||
122 | {"__const__", TYPE_QUAL, RID_CONST}, | ||
123 | {"struct", STRUCT, NORID}, | ||
124 | {"__complex__", TYPESPEC, RID_COMPLEX}, | ||
125 | {"restrict", TYPE_QUAL, RID_RESTRICT}, | ||
126 | {"__signed__", TYPESPEC, RID_SIGNED}, | ||
127 | {"__extension__", EXTENSION, NORID}, | ||
128 | {"id", OBJECTNAME, RID_ID}, | ||
129 | {"char", TYPESPEC, RID_CHAR}, | ||
130 | {"return", RETURN, NORID}, | ||
131 | {"__inline", SCSPEC, RID_INLINE}, | ||
132 | {"__complex", TYPESPEC, RID_COMPLEX}, | ||
133 | {"in", TYPE_QUAL, RID_IN}, | ||
134 | {"while", WHILE, NORID}, | ||
135 | {"switch", SWITCH, NORID}, | ||
136 | {"__attribute", ATTRIBUTE, NORID}, | ||
137 | {"", 0, 0}, | ||
138 | {"__real", REALPART, NORID}, | ||
139 | {"out", TYPE_QUAL, RID_OUT}, | ||
140 | {"__label__", LABEL, NORID}, | ||
141 | {"@private", PRIVATE, NORID}, | ||
142 | {"@selector", SELECTOR, NORID}, | ||
143 | {"register", SCSPEC, RID_REGISTER}, | ||
144 | {"const", TYPE_QUAL, RID_CONST}, | ||
145 | {"__signed", TYPESPEC, RID_SIGNED}, | ||
146 | {"extern", SCSPEC, RID_EXTERN}, | ||
147 | {"@protected", PROTECTED, NORID}, | ||
148 | {"__imag", IMAGPART, NORID}, | ||
149 | {"static", SCSPEC, RID_STATIC}, | ||
150 | {"inout", TYPE_QUAL, RID_INOUT}, | ||
151 | {"auto", SCSPEC, RID_AUTO}, | ||
152 | {"for", FOR, NORID}, | ||
153 | {"case", CASE, NORID}, | ||
154 | {"else", ELSE, NORID}, | ||
155 | {"__typeof", TYPEOF, NORID}, | ||
156 | {"@defs", DEFS, NORID}, | ||
157 | {"if", IF, NORID}, | ||
158 | {"do", DO, NORID}, | ||
159 | {"@protocol", PROTOCOL, NORID}, | ||
160 | {"short", TYPESPEC, RID_SHORT}, | ||
161 | {"__asm", ASM_KEYWORD, NORID}, | ||
162 | {"oneway", TYPE_QUAL, RID_ONEWAY}, | ||
163 | {"inline", SCSPEC, RID_INLINE}, | ||
164 | {"continue", CONTINUE, NORID}, | ||
165 | {"@encode", ENCODE, NORID}, | ||
166 | {"@end", END, NORID}, | ||
167 | {"__alignof", ALIGNOF, NORID}, | ||
168 | {"@interface", INTERFACE, NORID}, | ||
169 | {"union", UNION, NORID}, | ||
170 | {"@public", PUBLIC, NORID}, | ||
171 | {"bycopy", TYPE_QUAL, RID_BYCOPY}, | ||
172 | {"__volatile__", TYPE_QUAL, RID_VOLATILE}, | ||
173 | {"double", TYPESPEC, RID_DOUBLE}, | ||
174 | {"@class", CLASS, NORID}, | ||
175 | {"default", DEFAULT, NORID}, | ||
176 | {"goto", GOTO, NORID}, | ||
177 | {"unsigned", TYPESPEC, RID_UNSIGNED}, | ||
178 | {"sizeof", SIZEOF, NORID}, | ||
179 | {"signed", TYPESPEC, RID_SIGNED}, | ||
180 | {"typeof", TYPEOF, NORID}, | ||
181 | {"typedef", SCSPEC, RID_TYPEDEF}, | ||
182 | {"break", BREAK, NORID}, | ||
183 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
184 | {"__volatile", TYPE_QUAL, RID_VOLATILE}, | ||
185 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
186 | {"float", TYPESPEC, RID_FLOAT}, | ||
187 | {"", 0, 0}, | ||
188 | {"@compatibility_alias", ALIAS, NORID}, | ||
189 | {"void", TYPESPEC, RID_VOID}, | ||
190 | {"", 0, 0}, {"", 0, 0}, | ||
191 | {"long", TYPESPEC, RID_LONG}, | ||
192 | {"enum", ENUM, NORID}, | ||
193 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
194 | {"byref", TYPE_QUAL, RID_BYREF}, | ||
195 | {"", 0, 0}, | ||
196 | {"@implementation", IMPLEMENTATION, NORID}, | ||
197 | {"", 0, 0}, {"", 0, 0}, | ||
198 | {"asm", ASM_KEYWORD, NORID}, | ||
199 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
200 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
201 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
202 | {"volatile", TYPE_QUAL, RID_VOLATILE} | ||
203 | }; | ||
204 | |||
205 | struct resword * | ||
206 | is_reserved_word (str, len) | ||
207 | register const char *str; | ||
208 | register size_t len; | ||
209 | { | ||
210 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
211 | { | ||
212 | register unsigned int key = hash (str, len); | ||
213 | |||
214 | if (key <= MAX_HASH_VALUE) | ||
215 | { | ||
216 | register const char *s = wordlist[key].name; | ||
217 | |||
218 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
219 | return &wordlist[key]; | ||
220 | } | ||
221 | } | ||
222 | return 0; | ||
223 | } |
File tests/c-parse.gperf added (mode: 100644) (index 0000000..efedfb9) | |||
1 | %{ | ||
2 | /* Command-line: gperf -L KR-C -F ', 0, 0' -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ | ||
3 | %} | ||
4 | struct resword { const char *name; short token; enum rid rid; }; | ||
5 | %% | ||
6 | @class, CLASS, NORID | ||
7 | @compatibility_alias, ALIAS, NORID | ||
8 | @defs, DEFS, NORID | ||
9 | @encode, ENCODE, NORID | ||
10 | @end, END, NORID | ||
11 | @implementation, IMPLEMENTATION, NORID | ||
12 | @interface, INTERFACE, NORID | ||
13 | @private, PRIVATE, NORID | ||
14 | @protected, PROTECTED, NORID | ||
15 | @protocol, PROTOCOL, NORID | ||
16 | @public, PUBLIC, NORID | ||
17 | @selector, SELECTOR, NORID | ||
18 | __alignof, ALIGNOF, NORID | ||
19 | __alignof__, ALIGNOF, NORID | ||
20 | __asm, ASM_KEYWORD, NORID | ||
21 | __asm__, ASM_KEYWORD, NORID | ||
22 | __attribute, ATTRIBUTE, NORID | ||
23 | __attribute__, ATTRIBUTE, NORID | ||
24 | __complex, TYPESPEC, RID_COMPLEX | ||
25 | __complex__, TYPESPEC, RID_COMPLEX | ||
26 | __const, TYPE_QUAL, RID_CONST | ||
27 | __const__, TYPE_QUAL, RID_CONST | ||
28 | __extension__, EXTENSION, NORID | ||
29 | __imag, IMAGPART, NORID | ||
30 | __imag__, IMAGPART, NORID | ||
31 | __inline, SCSPEC, RID_INLINE | ||
32 | __inline__, SCSPEC, RID_INLINE | ||
33 | __iterator, SCSPEC, RID_ITERATOR | ||
34 | __iterator__, SCSPEC, RID_ITERATOR | ||
35 | __label__, LABEL, NORID | ||
36 | __real, REALPART, NORID | ||
37 | __real__, REALPART, NORID | ||
38 | __restrict, TYPE_QUAL, RID_RESTRICT | ||
39 | __restrict__, TYPE_QUAL, RID_RESTRICT | ||
40 | __signed, TYPESPEC, RID_SIGNED | ||
41 | __signed__, TYPESPEC, RID_SIGNED | ||
42 | __typeof, TYPEOF, NORID | ||
43 | __typeof__, TYPEOF, NORID | ||
44 | __volatile, TYPE_QUAL, RID_VOLATILE | ||
45 | __volatile__, TYPE_QUAL, RID_VOLATILE | ||
46 | asm, ASM_KEYWORD, NORID | ||
47 | auto, SCSPEC, RID_AUTO | ||
48 | break, BREAK, NORID | ||
49 | bycopy, TYPE_QUAL, RID_BYCOPY | ||
50 | byref, TYPE_QUAL, RID_BYREF | ||
51 | case, CASE, NORID | ||
52 | char, TYPESPEC, RID_CHAR | ||
53 | const, TYPE_QUAL, RID_CONST | ||
54 | continue, CONTINUE, NORID | ||
55 | default, DEFAULT, NORID | ||
56 | do, DO, NORID | ||
57 | double, TYPESPEC, RID_DOUBLE | ||
58 | else, ELSE, NORID | ||
59 | enum, ENUM, NORID | ||
60 | extern, SCSPEC, RID_EXTERN | ||
61 | float, TYPESPEC, RID_FLOAT | ||
62 | for, FOR, NORID | ||
63 | goto, GOTO, NORID | ||
64 | id, OBJECTNAME, RID_ID | ||
65 | if, IF, NORID | ||
66 | in, TYPE_QUAL, RID_IN | ||
67 | inout, TYPE_QUAL, RID_INOUT | ||
68 | inline, SCSPEC, RID_INLINE | ||
69 | int, TYPESPEC, RID_INT | ||
70 | long, TYPESPEC, RID_LONG | ||
71 | oneway, TYPE_QUAL, RID_ONEWAY | ||
72 | out, TYPE_QUAL, RID_OUT | ||
73 | register, SCSPEC, RID_REGISTER | ||
74 | restrict, TYPE_QUAL, RID_RESTRICT | ||
75 | return, RETURN, NORID | ||
76 | short, TYPESPEC, RID_SHORT | ||
77 | signed, TYPESPEC, RID_SIGNED | ||
78 | sizeof, SIZEOF, NORID | ||
79 | static, SCSPEC, RID_STATIC | ||
80 | struct, STRUCT, NORID | ||
81 | switch, SWITCH, NORID | ||
82 | typedef, SCSPEC, RID_TYPEDEF | ||
83 | typeof, TYPEOF, NORID | ||
84 | union, UNION, NORID | ||
85 | unsigned, TYPESPEC, RID_UNSIGNED | ||
86 | void, TYPESPEC, RID_VOID | ||
87 | volatile, TYPE_QUAL, RID_VOLATILE | ||
88 | while, WHILE, NORID |
File tests/c.exp added (mode: 100644) (index 0000000..10c8b7f) | |||
1 | in word set if | ||
2 | in word set do | ||
3 | in word set int | ||
4 | in word set for | ||
5 | in word set case | ||
6 | in word set char | ||
7 | in word set auto | ||
8 | in word set goto | ||
9 | in word set else | ||
10 | in word set long | ||
11 | in word set void | ||
12 | in word set enum | ||
13 | in word set float | ||
14 | in word set short | ||
15 | in word set union | ||
16 | in word set break | ||
17 | in word set while | ||
18 | in word set const | ||
19 | in word set double | ||
20 | in word set static | ||
21 | in word set extern | ||
22 | in word set struct | ||
23 | in word set return | ||
24 | in word set sizeof | ||
25 | in word set switch | ||
26 | in word set signed | ||
27 | in word set typedef | ||
28 | in word set default | ||
29 | in word set unsigned | ||
30 | in word set continue | ||
31 | in word set register | ||
32 | in word set volatile |
File tests/c.gperf added (mode: 100644) (index 0000000..8672d6c) | |||
1 | if | ||
2 | do | ||
3 | int | ||
4 | for | ||
5 | case | ||
6 | char | ||
7 | auto | ||
8 | goto | ||
9 | else | ||
10 | long | ||
11 | void | ||
12 | enum | ||
13 | float | ||
14 | short | ||
15 | union | ||
16 | break | ||
17 | while | ||
18 | const | ||
19 | double | ||
20 | static | ||
21 | extern | ||
22 | struct | ||
23 | return | ||
24 | sizeof | ||
25 | switch | ||
26 | signed | ||
27 | typedef | ||
28 | default | ||
29 | unsigned | ||
30 | continue | ||
31 | register | ||
32 | volatile |
File tests/charsets.exp added (mode: 100644) (index 0000000..aa1f813) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -C -E -G -I -t */ | ||
3 | /* Computed positions: -k'1-11,22,$' */ | ||
4 | |||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
28 | /* The character set is not based on ISO-646. */ | ||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>." | ||
30 | #endif | ||
31 | |||
32 | |||
33 | /* Generated from IANA charset data from https://www.iana.org/assignments/character-sets by charsets.awk */ | ||
34 | /* last updated 2002-06-14 */ | ||
35 | /* process with: | ||
36 | gperf -CDEGTlot -H charset_hash -K name -L ANSI-C -N charset_entry | ||
37 | */ | ||
38 | struct charset { const char *name; /* name or alias */ int mib; /* MIBenum for name, -1 * MIBenum for alias */ }; | ||
39 | #include <string.h> | ||
40 | enum | ||
41 | { | ||
42 | TOTAL_KEYWORDS = 790, | ||
43 | MIN_WORD_LENGTH = 2, | ||
44 | MAX_WORD_LENGTH = 45, | ||
45 | MIN_HASH_VALUE = 29, | ||
46 | MAX_HASH_VALUE = 5045 | ||
47 | }; | ||
48 | |||
49 | /* maximum key range = 5017, duplicates = 0 */ | ||
50 | |||
51 | #ifdef __GNUC__ | ||
52 | __inline | ||
53 | #else | ||
54 | #ifdef __cplusplus | ||
55 | inline | ||
56 | #endif | ||
57 | #endif | ||
58 | static unsigned int | ||
59 | hash (register const char *str, register size_t len) | ||
60 | { | ||
61 | static const unsigned short asso_values[] = | ||
62 | { | ||
63 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
64 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
65 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
66 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
67 | 5046, 0, 5046, 5046, 5046, 0, 930, 70, 90, 20, | ||
68 | 15, 500, 40, 5, 0, 120, 85, 300, 906, 1334, | ||
69 | 140, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
70 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
71 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
72 | 5046, 5046, 5046, 5046, 5046, 515, 0, 190, 210, 15, | ||
73 | 175, 15, 415, 330, 775, 0, 70, 795, 155, 10, | ||
74 | 545, 0, 750, 205, 5, 75, 5, 510, 963, 745, | ||
75 | 845, 15, 80, 0, 0, 5046, 5046, 5046, 5046, 5046, | ||
76 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
77 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
78 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
79 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
80 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
81 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
82 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
83 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
84 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
85 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
86 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
87 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, | ||
88 | 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046 | ||
89 | }; | ||
90 | register unsigned int hval = len; | ||
91 | |||
92 | switch (hval) | ||
93 | { | ||
94 | default: | ||
95 | hval += asso_values[(unsigned char)str[21]]; | ||
96 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
97 | [[fallthrough]]; | ||
98 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
99 | __attribute__ ((__fallthrough__)); | ||
100 | #endif | ||
101 | /*FALLTHROUGH*/ | ||
102 | case 21: | ||
103 | case 20: | ||
104 | case 19: | ||
105 | case 18: | ||
106 | case 17: | ||
107 | case 16: | ||
108 | case 15: | ||
109 | case 14: | ||
110 | case 13: | ||
111 | case 12: | ||
112 | case 11: | ||
113 | hval += asso_values[(unsigned char)str[10]+1]; | ||
114 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
115 | [[fallthrough]]; | ||
116 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
117 | __attribute__ ((__fallthrough__)); | ||
118 | #endif | ||
119 | /*FALLTHROUGH*/ | ||
120 | case 10: | ||
121 | hval += asso_values[(unsigned char)str[9]]; | ||
122 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
123 | [[fallthrough]]; | ||
124 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
125 | __attribute__ ((__fallthrough__)); | ||
126 | #endif | ||
127 | /*FALLTHROUGH*/ | ||
128 | case 9: | ||
129 | hval += asso_values[(unsigned char)str[8]+1]; | ||
130 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
131 | [[fallthrough]]; | ||
132 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
133 | __attribute__ ((__fallthrough__)); | ||
134 | #endif | ||
135 | /*FALLTHROUGH*/ | ||
136 | case 8: | ||
137 | hval += asso_values[(unsigned char)str[7]+3]; | ||
138 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
139 | [[fallthrough]]; | ||
140 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
141 | __attribute__ ((__fallthrough__)); | ||
142 | #endif | ||
143 | /*FALLTHROUGH*/ | ||
144 | case 7: | ||
145 | hval += asso_values[(unsigned char)str[6]]; | ||
146 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
147 | [[fallthrough]]; | ||
148 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
149 | __attribute__ ((__fallthrough__)); | ||
150 | #endif | ||
151 | /*FALLTHROUGH*/ | ||
152 | case 6: | ||
153 | hval += asso_values[(unsigned char)str[5]]; | ||
154 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
155 | [[fallthrough]]; | ||
156 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
157 | __attribute__ ((__fallthrough__)); | ||
158 | #endif | ||
159 | /*FALLTHROUGH*/ | ||
160 | case 5: | ||
161 | hval += asso_values[(unsigned char)str[4]]; | ||
162 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
163 | [[fallthrough]]; | ||
164 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
165 | __attribute__ ((__fallthrough__)); | ||
166 | #endif | ||
167 | /*FALLTHROUGH*/ | ||
168 | case 4: | ||
169 | hval += asso_values[(unsigned char)str[3]]; | ||
170 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
171 | [[fallthrough]]; | ||
172 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
173 | __attribute__ ((__fallthrough__)); | ||
174 | #endif | ||
175 | /*FALLTHROUGH*/ | ||
176 | case 3: | ||
177 | hval += asso_values[(unsigned char)str[2]]; | ||
178 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
179 | [[fallthrough]]; | ||
180 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
181 | __attribute__ ((__fallthrough__)); | ||
182 | #endif | ||
183 | /*FALLTHROUGH*/ | ||
184 | case 2: | ||
185 | hval += asso_values[(unsigned char)str[1]+1]; | ||
186 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
187 | [[fallthrough]]; | ||
188 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
189 | __attribute__ ((__fallthrough__)); | ||
190 | #endif | ||
191 | /*FALLTHROUGH*/ | ||
192 | case 1: | ||
193 | hval += asso_values[(unsigned char)str[0]]; | ||
194 | break; | ||
195 | } | ||
196 | return hval + asso_values[(unsigned char)str[len - 1]]; | ||
197 | } | ||
198 | |||
199 | static const struct charset wordlist[] = | ||
200 | { | ||
201 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
202 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
203 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
204 | {""}, {""}, | ||
205 | {"iso-ir-25", -46}, | ||
206 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
207 | {"iso-ir-2", -30}, | ||
208 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
209 | {""}, | ||
210 | {"mnem", 2081}, | ||
211 | {""}, {""}, {""}, | ||
212 | {"es2", 61}, | ||
213 | {""}, {""}, {""}, {""}, {""}, | ||
214 | {"iso-ir-21", -24}, | ||
215 | {""}, {""}, {""}, {""}, | ||
216 | {"iso-ir-15", -22}, | ||
217 | {"iso-ir-146", -89}, | ||
218 | {""}, {""}, {""}, {""}, | ||
219 | {"iso-ir-155", -96}, | ||
220 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
221 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
222 | {""}, | ||
223 | {"iso-ir-152", -93}, | ||
224 | {""}, {""}, {""}, | ||
225 | {"iso-ir-11", -21}, | ||
226 | {"iso-ir-142", -14}, | ||
227 | {""}, | ||
228 | {"es", 23}, | ||
229 | {"855", -2046}, | ||
230 | {""}, | ||
231 | {"iso-ir-151", -92}, | ||
232 | {""}, {""}, {""}, | ||
233 | {"iso-ir-14", -42}, | ||
234 | {"iso-ir-141", -87}, | ||
235 | {""}, {""}, {""}, | ||
236 | {"iso-ir-55", -55}, | ||
237 | {"iso-ir-102", -75}, | ||
238 | {""}, {""}, {""}, {""}, | ||
239 | {"iso-ir-111", -77}, | ||
240 | {"ibm866", 2086}, | ||
241 | {""}, | ||
242 | {"852", -2010}, | ||
243 | {"t.61", -76}, | ||
244 | {"iso-ir-101", -5}, | ||
245 | {""}, {""}, {""}, | ||
246 | {"iso646-fi", -35}, | ||
247 | {""}, | ||
248 | {"ibm865", 2052}, | ||
249 | {""}, | ||
250 | {"851", -2045}, | ||
251 | {""}, {""}, | ||
252 | {"ibm855", 2046}, | ||
253 | {""}, {""}, | ||
254 | {"iso646-fr", -26}, | ||
255 | {""}, {""}, {""}, {""}, | ||
256 | {"iso-ir-51", -53}, | ||
257 | {"iso-ir-154", -95}, | ||
258 | {"ibm285", 2038}, | ||
259 | {""}, {""}, {""}, | ||
260 | {"iso-ir-144", -8}, | ||
261 | {"ibm862", 2013}, | ||
262 | {""}, {""}, | ||
263 | {"iso-ir-54", -54}, | ||
264 | {""}, | ||
265 | {"ibm852", 2010}, | ||
266 | {"js", -87}, | ||
267 | {""}, | ||
268 | {"inis", 51}, | ||
269 | {""}, | ||
270 | {"ibm861", 2049}, | ||
271 | {"ibm1026", 2063}, | ||
272 | {""}, {""}, {""}, | ||
273 | {"ibm851", 2045}, | ||
274 | {"l5", -12}, | ||
275 | {""}, | ||
276 | {"iso-ir-95", -71}, | ||
277 | {""}, | ||
278 | {"ibm424", 2043}, | ||
279 | {""}, {""}, | ||
280 | {"iso-ir-10", -35}, | ||
281 | {"iso646-fr1", -46}, | ||
282 | {"ibm281", 2036}, | ||
283 | {""}, {""}, {""}, {""}, | ||
284 | {"ibm275", 2032}, | ||
285 | {""}, | ||
286 | {"iso-ir-4", -20}, | ||
287 | {"iso-ir-16", -43}, | ||
288 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
289 | {""}, {""}, {""}, | ||
290 | {"l1", -4}, | ||
291 | {""}, | ||
292 | {"iso-ir-91", -67}, | ||
293 | {""}, | ||
294 | {"ibm864", 2051}, | ||
295 | {""}, {""}, {""}, {""}, {""}, | ||
296 | {"l4", -7}, | ||
297 | {""}, | ||
298 | {"iso-ir-94", -70}, | ||
299 | {""}, {""}, {""}, | ||
300 | {"866", -2086}, | ||
301 | {""}, {""}, | ||
302 | {"ibm284", 2037}, | ||
303 | {""}, {""}, | ||
304 | {"iso-ir-50", -52}, | ||
305 | {"ascii", -3}, | ||
306 | {""}, {""}, | ||
307 | {"865", -2052}, | ||
308 | {""}, {""}, {""}, {""}, | ||
309 | {"ibm01142", 2093}, | ||
310 | {"iso-ir-37", -48}, | ||
311 | {""}, {""}, {""}, {""}, | ||
312 | {"iso-ir-27", -47}, | ||
313 | {"iso-ir-158", -97}, | ||
314 | {""}, {""}, {""}, {""}, | ||
315 | {"iso-ir-148", -12}, | ||
316 | {""}, {""}, | ||
317 | {"862", -2013}, | ||
318 | {""}, | ||
319 | {"iso-ir-150", -91}, | ||
320 | {""}, {""}, {""}, {""}, {""}, | ||
321 | {"ibm274", 2031}, | ||
322 | {""}, | ||
323 | {"861", -2049}, | ||
324 | {""}, {""}, | ||
325 | {"inis-8", 52}, | ||
326 | {""}, | ||
327 | {"mac", -2027}, | ||
328 | {""}, | ||
329 | {"iso-ir-110", -7}, | ||
330 | {""}, {""}, {""}, {""}, | ||
331 | {"iso-ir-100", -4}, | ||
332 | {""}, {""}, | ||
333 | {"ibm01141", 2092}, | ||
334 | {"iso-ir-17", -23}, | ||
335 | {""}, | ||
336 | {"ibm420", 2041}, | ||
337 | {""}, | ||
338 | {"850", -2009}, | ||
339 | {"iso-ir-90", 66}, | ||
340 | {"iso-ir-138", -11}, | ||
341 | {""}, {""}, {""}, {""}, {""}, | ||
342 | {"ibm871", 2056}, | ||
343 | {"l6", -13}, | ||
344 | {""}, | ||
345 | {"iso-ir-96", -72}, | ||
346 | {""}, | ||
347 | {"ibm775", 2087}, | ||
348 | {""}, {""}, {""}, {""}, | ||
349 | {"ibm868", 2053}, | ||
350 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
351 | {"ibm01145", 2096}, | ||
352 | {""}, {""}, | ||
353 | {"ibm860", 2048}, | ||
354 | {""}, {""}, {""}, | ||
355 | {"iso-ir-157", -13}, | ||
356 | {"ibm850", 2009}, | ||
357 | {""}, {""}, {""}, | ||
358 | {"iso-ir-147", -90}, | ||
359 | {"ibm500", 2044}, | ||
360 | {"csascii", -3}, | ||
361 | {""}, | ||
362 | {"iso-ir-57", -56}, | ||
363 | {"cp866", -2086}, | ||
364 | {"ibm280", 2035}, | ||
365 | {""}, {""}, | ||
366 | {"csiso51iniscyrillic", -53}, | ||
367 | {""}, {""}, {""}, | ||
368 | {"iso-ir-6", -3}, | ||
369 | {""}, | ||
370 | {"cp865", -2052}, | ||
371 | {""}, {""}, | ||
372 | {"437", -2011}, | ||
373 | {"ebcdic-fr", 2071}, | ||
374 | {"cp855", -2046}, | ||
375 | {""}, {""}, | ||
376 | {"857", -2047}, | ||
377 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
378 | {"cp285", -2038}, | ||
379 | {"ibm278", 2034}, | ||
380 | {"ebcdic-fi-se", 2069}, | ||
381 | {""}, | ||
382 | {"ebcdic-br", -2032}, | ||
383 | {"cp862", -2013}, | ||
384 | {""}, {""}, {""}, | ||
385 | {"iso-ir-47", -50}, | ||
386 | {"cp852", -2010}, | ||
387 | {""}, {""}, {""}, | ||
388 | {"iso646-gb", -20}, | ||
389 | {"cp861", -2049}, | ||
390 | {"cp1026", -2063}, | ||
391 | {"tis-620", 2259}, | ||
392 | {""}, | ||
393 | {"iso-ir-61", -58}, | ||
394 | {"cp851", -2045}, | ||
395 | {""}, | ||
396 | {"csiso5427cyrillic", -48}, | ||
397 | {""}, {""}, | ||
398 | {"cp424", -2043}, | ||
399 | {"ibm857", 2047}, | ||
400 | {""}, | ||
401 | {"ibm01144", 2095}, | ||
402 | {"iso-10646", -1003}, | ||
403 | {"cp281", -2036}, | ||
404 | {"csa7-2", -79}, | ||
405 | {""}, {""}, {""}, | ||
406 | {"cp275", -2032}, | ||
407 | {""}, {""}, {""}, {""}, | ||
408 | {"cp-is", -2049}, | ||
409 | {"csa7-1", -78}, | ||
410 | {""}, {""}, {""}, {""}, | ||
411 | {"ibm880", 2057}, | ||
412 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
413 | {"860", -2048}, | ||
414 | {""}, | ||
415 | {"cp864", -2051}, | ||
416 | {""}, | ||
417 | {"r8", -2004}, | ||
418 | {"csibm861", -2049}, | ||
419 | {""}, {""}, {""}, | ||
420 | {"cp01146", -2097}, | ||
421 | {"csibm851", -2045}, | ||
422 | {""}, {""}, {""}, {""}, | ||
423 | {"904", -2060}, | ||
424 | {""}, | ||
425 | {"cp284", -2037}, | ||
426 | {"ibm277", 2033}, | ||
427 | {"cp01145", -2096}, | ||
428 | {"csibm281", -2036}, | ||
429 | {""}, | ||
430 | {"ebcdic-int", -2029}, | ||
431 | {""}, {""}, {""}, {""}, {""}, | ||
432 | {"ibm870", 2055}, | ||
433 | {"ca", -78}, | ||
434 | {""}, {""}, {""}, {""}, {""}, | ||
435 | {"csibm865", -2052}, | ||
436 | {""}, | ||
437 | {"cp-ar", -2053}, | ||
438 | {""}, | ||
439 | {"cp01142", -2093}, | ||
440 | {"csibm855", -2046}, | ||
441 | {"iso-ir-60", -25}, | ||
442 | {"csiso58gb231280", -57}, | ||
443 | {"ibm905", 2061}, | ||
444 | {""}, {""}, {""}, {""}, {""}, | ||
445 | {"cp01141", -2092}, | ||
446 | {"csibm285", -2038}, | ||
447 | {""}, | ||
448 | {"cp274", -2031}, | ||
449 | {""}, {""}, {""}, | ||
450 | {"iso-ir-18", -44}, | ||
451 | {""}, {""}, | ||
452 | {"csiso50inis8", -52}, | ||
453 | {""}, {""}, | ||
454 | {"csiso143iecp271", -88}, | ||
455 | {""}, {""}, {""}, {""}, {""}, | ||
456 | {"ibm891", 2058}, | ||
457 | {""}, {""}, {""}, | ||
458 | {"cp420", -2041}, | ||
459 | {""}, {""}, | ||
460 | {"csibm424", -2043}, | ||
461 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
462 | {"cp871", -2056}, | ||
463 | {""}, {""}, | ||
464 | {"csibm275", -2032}, | ||
465 | {""}, | ||
466 | {"cp775", -2087}, | ||
467 | {""}, | ||
468 | {"cp01144", -2095}, | ||
469 | {""}, {""}, | ||
470 | {"cp868", -2053}, | ||
471 | {""}, {""}, {""}, | ||
472 | {"csibm1026", -2063}, | ||
473 | {""}, {""}, | ||
474 | {"fi", -35}, | ||
475 | {""}, | ||
476 | {"iso-ir-58", -57}, | ||
477 | {"cp860", -2048}, | ||
478 | {""}, {""}, | ||
479 | {"csibm864", -2051}, | ||
480 | {""}, | ||
481 | {"cp850", -2009}, | ||
482 | {""}, | ||
483 | {"fr", -26}, | ||
484 | {""}, {""}, | ||
485 | {"cp500", -2044}, | ||
486 | {"ibm904", 2060}, | ||
487 | {"csiso14jisc6220ro", -42}, | ||
488 | {"ibm01146", 2097}, | ||
489 | {""}, | ||
490 | {"cp280", -2035}, | ||
491 | {""}, | ||
492 | {"se", -35}, | ||
493 | {"csibm284", -2037}, | ||
494 | {""}, {""}, {""}, {""}, | ||
495 | {"csibm871", -2056}, | ||
496 | {"ebcdic-fi-se-a", 2070}, | ||
497 | {""}, {""}, | ||
498 | {"it", 22}, | ||
499 | {""}, {""}, {""}, | ||
500 | {"ibm918", 2062}, | ||
501 | {""}, | ||
502 | {"se2", -21}, | ||
503 | {""}, {""}, | ||
504 | {"ibm290", 2039}, | ||
505 | {""}, | ||
506 | {"jp-ocr-b", -68}, | ||
507 | {""}, | ||
508 | {"cp278", -2034}, | ||
509 | {""}, | ||
510 | {"csiso122canadian2", -79}, | ||
511 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
512 | {"ebcdic-latin9--euro", -2090}, | ||
513 | {""}, {""}, | ||
514 | {"l8", -110}, | ||
515 | {"csibm274", -2031}, | ||
516 | {"iso-ir-98", -73}, | ||
517 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
518 | {"csiso27latingreek1", -47}, | ||
519 | {""}, | ||
520 | {"cp857", -2047}, | ||
521 | {""}, | ||
522 | {"gb", -20}, | ||
523 | {""}, {""}, | ||
524 | {"iso-ir-126", -10}, | ||
525 | {""}, | ||
526 | {"cn", -56}, | ||
527 | {"t.101-g2", 83}, | ||
528 | {""}, | ||
529 | {"cp-gr", -2054}, | ||
530 | {""}, | ||
531 | {"cp01148", -2099}, | ||
532 | {""}, {""}, | ||
533 | {"csiso87jisx0208", -63}, | ||
534 | {""}, | ||
535 | {"csiso121canadian1", -78}, | ||
536 | {""}, {""}, | ||
537 | {"cp880", -2057}, | ||
538 | {"csbig5", -2026}, | ||
539 | {"cp01140", -2091}, | ||
540 | {""}, {""}, {""}, {""}, | ||
541 | {"csiso90", -66}, | ||
542 | {""}, | ||
543 | {"csiso42jisc62261978", -49}, | ||
544 | {""}, | ||
545 | {"ibm297", 2040}, | ||
546 | {""}, {""}, {""}, | ||
547 | {"iso-ir-122", -79}, | ||
548 | {""}, | ||
549 | {"us", -3}, | ||
550 | {""}, {""}, {""}, {""}, {""}, | ||
551 | {"ecma-114", -9}, | ||
552 | {"iso-ir-13", -41}, | ||
553 | {"iso-ir-121", -78}, | ||
554 | {""}, {""}, {""}, {""}, | ||
555 | {"ccsid01146", -2097}, | ||
556 | {""}, | ||
557 | {"de", -24}, | ||
558 | {""}, {""}, | ||
559 | {"cp870", -2055}, | ||
560 | {""}, {""}, {""}, {""}, | ||
561 | {"ccsid01145", -2096}, | ||
562 | {"csmnem", -2081}, | ||
563 | {""}, {""}, {""}, {""}, {""}, | ||
564 | {"csiso123csaz24341985gr", -80}, | ||
565 | {"dec", -2008}, | ||
566 | {"big5", 2026}, | ||
567 | {"cp905", -2061}, | ||
568 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
569 | {"csibm866", -2086}, | ||
570 | {""}, | ||
571 | {"ccsid01142", -2093}, | ||
572 | {""}, | ||
573 | {"cp01147", -2098}, | ||
574 | {""}, {""}, {""}, {""}, {""}, | ||
575 | {"ibm01149", 2100}, | ||
576 | {"iso646-pt", -43}, | ||
577 | {"ccsid01141", -2092}, | ||
578 | {""}, {""}, {""}, {""}, | ||
579 | {"cp891", -2058}, | ||
580 | {""}, {""}, {""}, | ||
581 | {"iso-ir-42", -49}, | ||
582 | {""}, {""}, {""}, {""}, {""}, | ||
583 | {"iso-ir-159", -98}, | ||
584 | {""}, {""}, {""}, {""}, | ||
585 | {"iso-ir-149", -36}, | ||
586 | {""}, | ||
587 | {"cp00858", -2089}, | ||
588 | {"jp-ocr-a", -67}, | ||
589 | {""}, | ||
590 | {"iso646-pt2", -60}, | ||
591 | {""}, | ||
592 | {"l2", -5}, | ||
593 | {""}, | ||
594 | {"iso-ir-92", -68}, | ||
595 | {""}, {""}, {""}, {""}, | ||
596 | {"iso646-kr", -102}, | ||
597 | {"iso-ir-109", -6}, | ||
598 | {"csiso49inis", -51}, | ||
599 | {""}, {""}, {""}, | ||
600 | {"ccsid01144", -2095}, | ||
601 | {""}, | ||
602 | {"chinese", -57}, | ||
603 | {"ibm00924", 2090}, | ||
604 | {"ebcdic-be", -2031}, | ||
605 | {""}, {""}, {""}, | ||
606 | {"csibm891", -2058}, | ||
607 | {""}, | ||
608 | {"cp904", -2060}, | ||
609 | {""}, | ||
610 | {"l3", -6}, | ||
611 | {""}, | ||
612 | {"iso-ir-93", -69}, | ||
613 | {"iso-ir-139", -86}, | ||
614 | {"arabic", -9}, | ||
615 | {""}, | ||
616 | {"ibm01143", 2094}, | ||
617 | {""}, {""}, | ||
618 | {"csucs4", -1001}, | ||
619 | {""}, {""}, {""}, | ||
620 | {"iso646-ca2", -79}, | ||
621 | {""}, {""}, | ||
622 | {"ebcdic-is-871+euro", -2100}, | ||
623 | {""}, | ||
624 | {"cp918", -2062}, | ||
625 | {"ibm869", 2054}, | ||
626 | {""}, | ||
627 | {"csiso150", -91}, | ||
628 | {""}, | ||
629 | {"cp290", -2039}, | ||
630 | {""}, {""}, {""}, | ||
631 | {"iso646-it", -22}, | ||
632 | {""}, {""}, {""}, | ||
633 | {"csibm905", -2061}, | ||
634 | {""}, | ||
635 | {"iso-ir-128", -83}, | ||
636 | {""}, | ||
637 | {"ebcdic-dk-no", 2067}, | ||
638 | {""}, {""}, {""}, | ||
639 | {"ibm819", -4}, | ||
640 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
641 | {""}, {""}, {""}, | ||
642 | {"csiso2033", -73}, | ||
643 | {"csiso103t618bit", -76}, | ||
644 | {""}, {""}, {""}, {""}, | ||
645 | {"csiso102t617bit", -75}, | ||
646 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
647 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
648 | {"ibm367", -3}, | ||
649 | {""}, | ||
650 | {"csibm869", -2054}, | ||
651 | {""}, | ||
652 | {"ccsid01148", -2099}, | ||
653 | {""}, {""}, {""}, {""}, | ||
654 | {"cp297", -2040}, | ||
655 | {""}, {""}, {""}, {""}, | ||
656 | {"ccsid01140", -2091}, | ||
657 | {""}, | ||
658 | {"dec-mcs", 2008}, | ||
659 | {""}, {""}, {""}, | ||
660 | {"ibm038", 2029}, | ||
661 | {""}, | ||
662 | {"ibm01140", 2091}, | ||
663 | {"iso5427cyrillic1981", -54}, | ||
664 | {""}, {""}, {""}, {""}, {""}, | ||
665 | {"iso-ir-127", -9}, | ||
666 | {""}, | ||
667 | {"cp00924", -2090}, | ||
668 | {"csibm423", -2042}, | ||
669 | {""}, {""}, {""}, {""}, | ||
670 | {"869", -2054}, | ||
671 | {"ebcdic-jp-kana", -2039}, | ||
672 | {""}, | ||
673 | {"ibm437", 2011}, | ||
674 | {""}, {""}, | ||
675 | {"iso646-de", -24}, | ||
676 | {""}, {""}, | ||
677 | {"jis_c6220-1969-ro", 42}, | ||
678 | {""}, {""}, | ||
679 | {"ms936", -113}, | ||
680 | {""}, {""}, | ||
681 | {"ebcdic-fi-278+euro", -2094}, | ||
682 | {""}, {""}, {""}, {""}, | ||
683 | {"ebcdic-fr-297+euro", -2098}, | ||
684 | {""}, {""}, {""}, {""}, | ||
685 | {"csibm863", -2050}, | ||
686 | {"ebcdic-pt", 2073}, | ||
687 | {"ebcdic-cyrillic", -2057}, | ||
688 | {""}, {""}, | ||
689 | {"ebcdic-gb-285+euro", -2097}, | ||
690 | {""}, {""}, {""}, {""}, {""}, | ||
691 | {"ebcdic-international-500+euro", -2099}, | ||
692 | {"ccsid01147", -2098}, | ||
693 | {""}, {""}, | ||
694 | {"cyrillic", -8}, | ||
695 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
696 | {""}, {""}, {""}, | ||
697 | {"ibm037", 2028}, | ||
698 | {""}, {""}, {""}, | ||
699 | {"iso646-es2", -61}, | ||
700 | {"unicode-1-1", 1010}, | ||
701 | {"ebcdic-cp-no", -2033}, | ||
702 | {""}, | ||
703 | {"iso646-ca", -78}, | ||
704 | {""}, {""}, | ||
705 | {"csiso6937add", -93}, | ||
706 | {""}, {""}, {""}, {""}, {""}, | ||
707 | {"inis-cyrillic", 53}, | ||
708 | {""}, {""}, {""}, | ||
709 | {"ebcdic-cp-he", -2043}, | ||
710 | {"csibm273", -2030}, | ||
711 | {""}, {""}, {""}, | ||
712 | {"ebcdic-cp-se", -2034}, | ||
713 | {""}, {""}, {""}, | ||
714 | {"ebcdic-jp-e", -2036}, | ||
715 | {""}, | ||
716 | {"csibm420", -2041}, | ||
717 | {""}, {""}, {""}, | ||
718 | {"ebcdic-cp-be", -2044}, | ||
719 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
720 | {""}, {""}, | ||
721 | {"iso646-es", -23}, | ||
722 | {"cp869", -2054}, | ||
723 | {""}, {""}, {""}, | ||
724 | {"ebcdic-it", 2072}, | ||
725 | {"csmnemonic", -2080}, | ||
726 | {"gb2312", 2025}, | ||
727 | {"cskoi8r", -2084}, | ||
728 | {""}, {""}, {""}, | ||
729 | {"latin6", -13}, | ||
730 | {""}, | ||
731 | {"csibm860", -2048}, | ||
732 | {"ebcdic-dk-no-a", 2068}, | ||
733 | {""}, {""}, | ||
734 | {"arabic7", -65}, | ||
735 | {""}, {""}, | ||
736 | {"cp819", -4}, | ||
737 | {"latin5", -12}, | ||
738 | {""}, | ||
739 | {"csibm500", -2044}, | ||
740 | {""}, | ||
741 | {"x0212", -98}, | ||
742 | {""}, {""}, | ||
743 | {"csibm280", -2035}, | ||
744 | {""}, | ||
745 | {"csebcdicit", -2072}, | ||
746 | {""}, | ||
747 | {"ebcdic-cp-it", -2035}, | ||
748 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
749 | {"latin2", -5}, | ||
750 | {""}, {""}, | ||
751 | {"e13b", -73}, | ||
752 | {"csiso91jisc62291984a", -67}, | ||
753 | {""}, {""}, | ||
754 | {"us-ascii", -3}, | ||
755 | {"csiso153gost1976874", -94}, | ||
756 | {"ebcdic-cp-roece", -2055}, | ||
757 | {"latin1", -4}, | ||
758 | {"ebcdic-at-de", 2064}, | ||
759 | {""}, {""}, | ||
760 | {"cp367", -3}, | ||
761 | {"csiso18greek7old", -44}, | ||
762 | {""}, {""}, {""}, | ||
763 | {"csiso92jisc62991984b", -68}, | ||
764 | {""}, | ||
765 | {"unicode-1-1-utf-7", 103}, | ||
766 | {"csiso88greek7", -64}, | ||
767 | {""}, {""}, | ||
768 | {"ds2089", -99}, | ||
769 | {""}, {""}, | ||
770 | {"iso646-us", -3}, | ||
771 | {""}, {""}, {""}, {""}, {""}, | ||
772 | {"cp038", -2029}, | ||
773 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
774 | {"csiso25french", -46}, | ||
775 | {""}, | ||
776 | {"dk-us", 101}, | ||
777 | {""}, | ||
778 | {"cp01149", -2100}, | ||
779 | {""}, | ||
780 | {"jis_c6226-1978", 49}, | ||
781 | {""}, | ||
782 | {"latin4", -7}, | ||
783 | {""}, {""}, | ||
784 | {"nats-sefi", 31}, | ||
785 | {"cp437", -2011}, | ||
786 | {""}, | ||
787 | {"csiso2022jp2", -40}, | ||
788 | {"csibm880", -2057}, | ||
789 | {"iso646-no", -25}, | ||
790 | {""}, {""}, | ||
791 | {"ebcdic-cp-is", -2056}, | ||
792 | {""}, | ||
793 | {"iso646-cn", -56}, | ||
794 | {"x0201", -15}, | ||
795 | {""}, {""}, | ||
796 | {"mnemonic", 2080}, | ||
797 | {"iso646-jp", -42}, | ||
798 | {"csiso70videotexsupp1", -59}, | ||
799 | {""}, | ||
800 | {"ebcdic-cp-nl", -2028}, | ||
801 | {""}, {""}, | ||
802 | {"cp936", -113}, | ||
803 | {""}, | ||
804 | {"jp", -42}, | ||
805 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
806 | {"iso-ir-70", -59}, | ||
807 | {""}, {""}, {""}, | ||
808 | {"csksc5636", -102}, | ||
809 | {"iso646-no2", -58}, | ||
810 | {""}, {""}, | ||
811 | {"csibm870", -2055}, | ||
812 | {""}, | ||
813 | {"iso-celtic", -110}, | ||
814 | {""}, {""}, {""}, {""}, | ||
815 | {"csiso95jis62291984handadd", -71}, | ||
816 | {""}, {""}, {""}, {""}, | ||
817 | {"cp037", -2028}, | ||
818 | {""}, {""}, {""}, {""}, | ||
819 | {"iso-ir-153", -94}, | ||
820 | {""}, | ||
821 | {"csiso151cuba", -92}, | ||
822 | {""}, {""}, | ||
823 | {"iso-ir-143", -88}, | ||
824 | {""}, {""}, {""}, | ||
825 | {"t.61-8bit", 76}, | ||
826 | {""}, {""}, {""}, {""}, {""}, | ||
827 | {"csebcdicpt", -2073}, | ||
828 | {""}, {""}, {""}, {""}, | ||
829 | {"iso-ir-103", -76}, | ||
830 | {""}, | ||
831 | {"csiso94jis62291984hand", -70}, | ||
832 | {""}, {""}, {""}, | ||
833 | {"ibm423", 2042}, | ||
834 | {""}, {""}, {""}, {""}, | ||
835 | {"latin8", -110}, | ||
836 | {""}, | ||
837 | {"ebcdic-cp-ar2", -2062}, | ||
838 | {""}, | ||
839 | {"iso-2022-cn-ext", 105}, | ||
840 | {""}, {""}, | ||
841 | {"ebcdic-cp-ar1", -2041}, | ||
842 | {"ebcdic-es", 2074}, | ||
843 | {"csibmebcdicatde", -2064}, | ||
844 | {""}, {""}, {""}, | ||
845 | {"t.61-7bit", 75}, | ||
846 | {""}, | ||
847 | {"ebcdic-es-s", 2076}, | ||
848 | {""}, {""}, {""}, | ||
849 | {"csiso146serbian", -89}, | ||
850 | {""}, {""}, {""}, | ||
851 | {"jis_c6220-1969", -41}, | ||
852 | {""}, | ||
853 | {"ibm863", 2050}, | ||
854 | {""}, {""}, {""}, | ||
855 | {"iso-ir-9-2", -34}, | ||
856 | {""}, {""}, | ||
857 | {"csgb2312", -2025}, | ||
858 | {""}, {""}, {""}, | ||
859 | {"dk", -99}, | ||
860 | {""}, | ||
861 | {"viscii", 2082}, | ||
862 | {"iso-ir-9-1", -33}, | ||
863 | {""}, {""}, {""}, {""}, {""}, | ||
864 | {"ibm-symbols", 2015}, | ||
865 | {""}, | ||
866 | {"csibm903", -2059}, | ||
867 | {"ebcdic-at-de-a", 2065}, | ||
868 | {""}, {""}, | ||
869 | {"ebcdic-us-37+euro", -2091}, | ||
870 | {""}, {""}, | ||
871 | {"x0208", -63}, | ||
872 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
873 | {"csibm290", -2039}, | ||
874 | {""}, {""}, {""}, {""}, | ||
875 | {"ibm-thai", 2016}, | ||
876 | {""}, {""}, {""}, | ||
877 | {"csiso646basic1983", -28}, | ||
878 | {""}, {""}, {""}, | ||
879 | {"ibm273", 2030}, | ||
880 | {""}, {""}, | ||
881 | {"ebcdic-us", 2078}, | ||
882 | {"csiso159jisx02121990", -98}, | ||
883 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
884 | {""}, {""}, {""}, | ||
885 | {"iso-10646-j-1", 0}, | ||
886 | {""}, | ||
887 | {"csiso111ecmacyrillic", -77}, | ||
888 | {""}, {""}, {""}, {""}, {""}, | ||
889 | {"cesu-8", 1016}, | ||
890 | {"csibmsymbols", -2015}, | ||
891 | {"ecma-cyrillic", 77}, | ||
892 | {""}, | ||
893 | {"csnatsdano", -33}, | ||
894 | {""}, | ||
895 | {"ebcdic-cp-fi", -2034}, | ||
896 | {""}, {""}, | ||
897 | {"csebcdicfr", -2071}, | ||
898 | {""}, | ||
899 | {"ebcdic-cp-fr", -2040}, | ||
900 | {""}, | ||
901 | {"csviqr", -2083}, | ||
902 | {"ccsid01149", -2100}, | ||
903 | {""}, | ||
904 | {"ebcdic-ca-fr", 2066}, | ||
905 | {"863", -2050}, | ||
906 | {""}, {""}, {""}, | ||
907 | {"csebcdicfise", -2069}, | ||
908 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
909 | {""}, {""}, {""}, {""}, {""}, | ||
910 | {"gb18030", 114}, | ||
911 | {""}, | ||
912 | {"ibm01147", 2098}, | ||
913 | {""}, {""}, | ||
914 | {"ebcdic-cp-ca", -2028}, | ||
915 | {""}, {""}, | ||
916 | {"iso646-jp-ocr-b", -68}, | ||
917 | {"csviscii", -2082}, | ||
918 | {"x0201-7", -41}, | ||
919 | {"ebcdic-dk-277+euro", -2093}, | ||
920 | {""}, | ||
921 | {"microsoft-publishing", 2023}, | ||
922 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
923 | {"asmo_449", 65}, | ||
924 | {""}, {""}, {""}, | ||
925 | {"viqr", 2083}, | ||
926 | {"ref", -28}, | ||
927 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
928 | {"iso-8859-6", -9}, | ||
929 | {""}, {""}, {""}, {""}, | ||
930 | {"iso-ir-19", -45}, | ||
931 | {""}, | ||
932 | {"pt", 43}, | ||
933 | {""}, | ||
934 | {"ns_4551-1", 25}, | ||
935 | {"iso-8859-5", -8}, | ||
936 | {""}, {""}, | ||
937 | {"csiso69french", -26}, | ||
938 | {"csibmthai", -2016}, | ||
939 | {""}, {""}, {""}, {""}, {""}, | ||
940 | {"cp423", -2042}, | ||
941 | {""}, {""}, | ||
942 | {"csebcdicatdea", -2065}, | ||
943 | {""}, {""}, | ||
944 | {"iso-8859-15", 111}, | ||
945 | {""}, {""}, {""}, | ||
946 | {"iso-8859-2", -5}, | ||
947 | {""}, {""}, | ||
948 | {"pt2", 60}, | ||
949 | {""}, {""}, | ||
950 | {"csdecmcs", -2008}, | ||
951 | {"no", -25}, | ||
952 | {""}, {""}, | ||
953 | {"iso-8859-1", -4}, | ||
954 | {""}, {""}, {""}, | ||
955 | {"csibbm904", -2060}, | ||
956 | {""}, {""}, {""}, | ||
957 | {"iso_646.basic:1983", 28}, | ||
958 | {""}, | ||
959 | {"cp863", -2050}, | ||
960 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
961 | {"csiso10367box", -96}, | ||
962 | {""}, {""}, {""}, {""}, {""}, | ||
963 | {"shift_jis", 17}, | ||
964 | {""}, | ||
965 | {"iso-8859-14", 110}, | ||
966 | {"ksc5636", 102}, | ||
967 | {"no2", -58}, | ||
968 | {"csiso57gb1988", -56}, | ||
969 | {""}, {""}, {""}, {""}, | ||
970 | {"iso646-dk", -99}, | ||
971 | {""}, {""}, | ||
972 | {"csiso88596i", -82}, | ||
973 | {""}, {""}, | ||
974 | {"iso-8859-4", -7}, | ||
975 | {""}, {""}, {""}, {""}, | ||
976 | {"iso-ir-49", -51}, | ||
977 | {""}, {""}, | ||
978 | {"iso-10646-ucs-2", 1000}, | ||
979 | {"scsu", 1011}, | ||
980 | {"ccsid00924", -2090}, | ||
981 | {""}, | ||
982 | {"iso-10646-ucs-basic", 1002}, | ||
983 | {"iso-10646-utf-1", 27}, | ||
984 | {""}, {""}, {""}, | ||
985 | {"ebcdic-cp-es", -2037}, | ||
986 | {"iso-ir-85", -61}, | ||
987 | {""}, | ||
988 | {"cp273", -2030}, | ||
989 | {""}, | ||
990 | {"iso-10646-unicode-latin1", 1003}, | ||
991 | {"iso-2022-jp-2", 40}, | ||
992 | {"csibm857", -2047}, | ||
993 | {"iso-ir-99", -74}, | ||
994 | {""}, {""}, {""}, | ||
995 | {"csiso4unitedkingdom", -20}, | ||
996 | {""}, {""}, | ||
997 | {"cseuckr", -38}, | ||
998 | {"iso-10646-ucs-4", 1001}, | ||
999 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1000 | {"ebcdic-cp-tr", -2061}, | ||
1001 | {""}, {""}, | ||
1002 | {"hz-gb-2312", 2085}, | ||
1003 | {""}, {""}, | ||
1004 | {"csebcdicfisea", -2070}, | ||
1005 | {""}, {""}, | ||
1006 | {"iso-8859-10", 13}, | ||
1007 | {""}, | ||
1008 | {"nats-sefi-add", 32}, | ||
1009 | {""}, {""}, {""}, | ||
1010 | {"cp01143", -2094}, | ||
1011 | {"iso-ir-84", -60}, | ||
1012 | {""}, {""}, | ||
1013 | {"iso-8859-16", 112}, | ||
1014 | {""}, {""}, {""}, {""}, | ||
1015 | {"greek8", -10}, | ||
1016 | {""}, {""}, | ||
1017 | {"csibm277", -2033}, | ||
1018 | {""}, {""}, {""}, | ||
1019 | {"csisotextcomm", -14}, | ||
1020 | {"jis_c6226-1983", 63}, | ||
1021 | {""}, {""}, {""}, | ||
1022 | {"ebcdic-it-280+euro", -2095}, | ||
1023 | {""}, {""}, | ||
1024 | {"ibm903", 2059}, | ||
1025 | {"csiso88598i", -85}, | ||
1026 | {""}, {""}, | ||
1027 | {"csebcdices", -2074}, | ||
1028 | {"ebcdic-es-a", 2075}, | ||
1029 | {""}, {""}, | ||
1030 | {"csiso646danish", -99}, | ||
1031 | {"iso-8859-8", -11}, | ||
1032 | {"csebcdicess", -2076}, | ||
1033 | {""}, {""}, {""}, {""}, | ||
1034 | {"iso_646.irv:1991", -3}, | ||
1035 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1036 | {""}, | ||
1037 | {"iso646-se", -35}, | ||
1038 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1039 | {"ebcdic-cp-yu", -2055}, | ||
1040 | {""}, {""}, {""}, | ||
1041 | {"utf-16", 1015}, | ||
1042 | {"uk", -20}, | ||
1043 | {"iso646-se2", -21}, | ||
1044 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1045 | {"iso-ir-86", -62}, | ||
1046 | {""}, {""}, | ||
1047 | {"greek7", 64}, | ||
1048 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1049 | {"csiso96jisc62291984kana", -72}, | ||
1050 | {""}, {""}, {""}, | ||
1051 | {"csiso16portuguese", -43}, | ||
1052 | {""}, {""}, | ||
1053 | {"yu", -87}, | ||
1054 | {""}, | ||
1055 | {"ds_2089", 99}, | ||
1056 | {"ksc_5601", -36}, | ||
1057 | {""}, {""}, {""}, {""}, | ||
1058 | {"ebcdic-de-273+euro", -2092}, | ||
1059 | {""}, | ||
1060 | {"iso-8859-7", -10}, | ||
1061 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1062 | {"csiso10646utf1", -27}, | ||
1063 | {""}, {""}, {""}, {""}, | ||
1064 | {"csiso19latingreek", -45}, | ||
1065 | {""}, {""}, | ||
1066 | {"csiso47bsviewdata", -50}, | ||
1067 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1068 | {"csiso139csn369103", -86}, | ||
1069 | {""}, {""}, | ||
1070 | {"iso-ir-69", -26}, | ||
1071 | {""}, | ||
1072 | {"iso646-yu", -87}, | ||
1073 | {""}, {""}, | ||
1074 | {"csshiftjis", -17}, | ||
1075 | {""}, {""}, | ||
1076 | {"ebcdic-es-284+euro", -2096}, | ||
1077 | {""}, {""}, {""}, | ||
1078 | {"csiso141jusib1002", -87}, | ||
1079 | {""}, {""}, {""}, {""}, | ||
1080 | {"csiso93jis62291984badd", -69}, | ||
1081 | {""}, | ||
1082 | {"csiso15italian", -22}, | ||
1083 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1084 | {""}, {""}, {""}, {""}, | ||
1085 | {"iso-ir-87", -63}, | ||
1086 | {""}, | ||
1087 | {"iso-ir-123", -80}, | ||
1088 | {""}, | ||
1089 | {"csebcdiccafr", -2066}, | ||
1090 | {""}, {""}, {""}, | ||
1091 | {"iso-ir-199", -110}, | ||
1092 | {"jis_c6220-1969-jp", 41}, | ||
1093 | {""}, {""}, {""}, {""}, | ||
1094 | {"cuba", -92}, | ||
1095 | {"csiso85spanish2", -61}, | ||
1096 | {""}, {""}, {""}, | ||
1097 | {"bs_4730", 20}, | ||
1098 | {""}, {""}, {""}, {""}, {""}, | ||
1099 | {"csnatsdanoadd", -34}, | ||
1100 | {""}, {""}, {""}, {""}, {""}, | ||
1101 | {"csibm297", -2040}, | ||
1102 | {""}, | ||
1103 | {"csiso2022kr", -37}, | ||
1104 | {""}, | ||
1105 | {"csiso84portuguese2", -60}, | ||
1106 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1107 | {""}, {""}, | ||
1108 | {"ccsid01143", -2094}, | ||
1109 | {""}, {""}, {""}, {""}, | ||
1110 | {"utf-8", 106}, | ||
1111 | {""}, {""}, {""}, | ||
1112 | {"iso_5427", 48}, | ||
1113 | {"cp903", -2059}, | ||
1114 | {""}, {""}, {""}, {""}, | ||
1115 | {"csiso2intlrefversion", -30}, | ||
1116 | {""}, | ||
1117 | {"ibm01148", 2099}, | ||
1118 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1119 | {"iso-2022-cn", 104}, | ||
1120 | {"jp-ocr-b-add", -69}, | ||
1121 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1122 | {""}, {""}, {""}, {""}, | ||
1123 | {"koi8-r", 2084}, | ||
1124 | {"ebcdic-cp-gr", -2042}, | ||
1125 | {""}, {""}, {""}, {""}, {""}, | ||
1126 | {"cspcp852", -2010}, | ||
1127 | {""}, {""}, | ||
1128 | {"csdkus", -101}, | ||
1129 | {""}, {""}, | ||
1130 | {"csiso5428greek", -55}, | ||
1131 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1132 | {"jis_encoding", 16}, | ||
1133 | {""}, {""}, {""}, {""}, | ||
1134 | {"csebcdicdkno", -2067}, | ||
1135 | {""}, {""}, {""}, | ||
1136 | {"roman8", -2004}, | ||
1137 | {"ebcdic-cp-dk", -2033}, | ||
1138 | {""}, {""}, | ||
1139 | {"utf-7", 1012}, | ||
1140 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1141 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1142 | {"csiso88596e", -81}, | ||
1143 | {""}, {""}, | ||
1144 | {"extended_unix_code_packed_format_for_japanese", 18}, | ||
1145 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1146 | {"ebcdic-no-277+euro", -2093}, | ||
1147 | {""}, {""}, {""}, | ||
1148 | {"csiso13jisc6220jp", -41}, | ||
1149 | {""}, {""}, {""}, {""}, | ||
1150 | {"ebcdic-cp-wt", -2028}, | ||
1151 | {"iso_9036", -65}, | ||
1152 | {""}, {""}, {""}, | ||
1153 | {"ibm00858", 2089}, | ||
1154 | {"csiso21german", -24}, | ||
1155 | {""}, | ||
1156 | {"greek7-old", 44}, | ||
1157 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1158 | {"csiso89asmo449", -65}, | ||
1159 | {""}, {""}, {""}, | ||
1160 | {"iso-ir-88", -64}, | ||
1161 | {""}, {""}, | ||
1162 | {"csiso2022jp", -39}, | ||
1163 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1164 | {"ns_4551-2", 58}, | ||
1165 | {""}, | ||
1166 | {"csebcdicesa", -2075}, | ||
1167 | {"csibm868", -2053}, | ||
1168 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1169 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1170 | {""}, {""}, {""}, {""}, | ||
1171 | {"iso_8859-6", -9}, | ||
1172 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1173 | {"csiso88598e", -84}, | ||
1174 | {""}, | ||
1175 | {"hp-roman8", 2004}, | ||
1176 | {"iso_8859-5", -8}, | ||
1177 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1178 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1179 | {"iso_8859-15", -111}, | ||
1180 | {"csibm278", -2034}, | ||
1181 | {""}, | ||
1182 | {"euc-kr", 38}, | ||
1183 | {"iso_8859-2", -5}, | ||
1184 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1185 | {"iso_8859-1", -4}, | ||
1186 | {"csisolatin5", -12}, | ||
1187 | {"ebcdic-cp-ch", -2044}, | ||
1188 | {""}, {""}, {""}, | ||
1189 | {"iso-8859-13", 109}, | ||
1190 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1191 | {""}, {""}, | ||
1192 | {"hp-legal", 2017}, | ||
1193 | {""}, {""}, | ||
1194 | {"iso_8859-10:1992", -13}, | ||
1195 | {""}, | ||
1196 | {"csiso150greekccitt", -91}, | ||
1197 | {""}, {""}, | ||
1198 | {"iso_8859-14", -110}, | ||
1199 | {"asmo-708", -9}, | ||
1200 | {""}, {""}, {""}, | ||
1201 | {"csisolatin1", -4}, | ||
1202 | {""}, {""}, {""}, {""}, {""}, | ||
1203 | {"ebcdic-cp-gb", -2038}, | ||
1204 | {""}, {""}, | ||
1205 | {"iso_8859-4", -7}, | ||
1206 | {"csisolatin4", -7}, | ||
1207 | {"ecma-118", -10}, | ||
1208 | {""}, | ||
1209 | {"csunicode", -1000}, | ||
1210 | {"iso-8859-9", -12}, | ||
1211 | {""}, {""}, | ||
1212 | {"csebcdicdknoa", -2068}, | ||
1213 | {"csibm037", -2028}, | ||
1214 | {""}, | ||
1215 | {"csunicodeibm1276", -1007}, | ||
1216 | {""}, | ||
1217 | {"lap", -97}, | ||
1218 | {"cseucfixwidjapanese", -19}, | ||
1219 | {""}, | ||
1220 | {"csunicodeibm1265", -1009}, | ||
1221 | {"sen_850200_c", 21}, | ||
1222 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1223 | {"jis_c6229-1984-hand", 70}, | ||
1224 | {"jis_c6229-1984-b-add", 69}, | ||
1225 | {""}, {""}, {""}, {""}, | ||
1226 | {"csunicodeibm1261", -1005}, | ||
1227 | {""}, {""}, {""}, | ||
1228 | {"latin1-2-5", -95}, | ||
1229 | {"iso_8859-14:1998", -110}, | ||
1230 | {"jis_c6229-1984-a", 67}, | ||
1231 | {""}, {""}, | ||
1232 | {"jis_c6229-1984-kana", 72}, | ||
1233 | {""}, {""}, {""}, {""}, {""}, | ||
1234 | {"csunicode11", -1010}, | ||
1235 | {""}, {""}, {""}, | ||
1236 | {"ebcdic-cp-us", -2028}, | ||
1237 | {"csunicodeibm1264", -1008}, | ||
1238 | {""}, {""}, {""}, {""}, {""}, | ||
1239 | {"jis_c6229-1984-b", 68}, | ||
1240 | {""}, {""}, | ||
1241 | {"cshproman8", -2004}, | ||
1242 | {"iso_646.irv:1983", 30}, | ||
1243 | {""}, {""}, {""}, {""}, | ||
1244 | {"latin3", -6}, | ||
1245 | {""}, | ||
1246 | {"csa_z243.4-1985-gr", 80}, | ||
1247 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1248 | {"gb_1988-80", 56}, | ||
1249 | {"csisolatin6", -13}, | ||
1250 | {"csa_z243.4-1985-2", 79}, | ||
1251 | {"cspc862latinhebrew", -2013}, | ||
1252 | {""}, {""}, {""}, | ||
1253 | {"csa_z243.4-1985-1", 78}, | ||
1254 | {"gbk", 113}, | ||
1255 | {""}, {""}, {""}, | ||
1256 | {"iso646-cu", -92}, | ||
1257 | {""}, {""}, | ||
1258 | {"iso_8859-8", -11}, | ||
1259 | {"iso-2022-kr", 37}, | ||
1260 | {""}, | ||
1261 | {"cspc775baltic", -2087}, | ||
1262 | {""}, {""}, | ||
1263 | {"csunicodeibm1268", -1006}, | ||
1264 | {"csiso61norwegian2", -58}, | ||
1265 | {""}, {""}, {""}, {""}, {""}, | ||
1266 | {"csiso99naplps", -74}, | ||
1267 | {""}, {""}, {""}, {""}, {""}, | ||
1268 | {"iec_p27-1", 88}, | ||
1269 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1270 | {"utf-32", 1017}, | ||
1271 | {""}, | ||
1272 | {"csebcdicus", -2078}, | ||
1273 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1274 | {""}, {""}, {""}, {""}, | ||
1275 | {"csibm918", -2062}, | ||
1276 | {""}, {""}, | ||
1277 | {"gb_2312-80", 57}, | ||
1278 | {""}, | ||
1279 | {"serbian", -89}, | ||
1280 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1281 | {""}, {""}, | ||
1282 | {"irv", -30}, | ||
1283 | {"csunicode11utf7", -103}, | ||
1284 | {""}, {""}, | ||
1285 | {"csisolatincyrillic", -8}, | ||
1286 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1287 | {"iso_8859-7", -10}, | ||
1288 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1289 | {"csnatssefi", -31}, | ||
1290 | {""}, | ||
1291 | {"csiso60norwegian1", -25}, | ||
1292 | {""}, {""}, | ||
1293 | {"greek", -10}, | ||
1294 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1295 | {"ebcdic-uk", 2077}, | ||
1296 | {""}, | ||
1297 | {"csisolatinarabic", -9}, | ||
1298 | {""}, | ||
1299 | {"csiso128t101g2", -83}, | ||
1300 | {"csunicodeascii", -1002}, | ||
1301 | {""}, | ||
1302 | {"jp-ocr-hand", -70}, | ||
1303 | {""}, {""}, {""}, | ||
1304 | {"jp-ocr-hand-add", -71}, | ||
1305 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1306 | {"jis_c6229-1984-hand-add", 71}, | ||
1307 | {""}, {""}, | ||
1308 | {"cscesu-8", -1016}, | ||
1309 | {""}, {""}, {""}, {""}, | ||
1310 | {"sen_850200_b", 35}, | ||
1311 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1312 | {"invariant", 29}, | ||
1313 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1314 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1315 | {"iso-2022-jp", 39}, | ||
1316 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1317 | {""}, | ||
1318 | {"cswindows31latin5", -2003}, | ||
1319 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1320 | {"cswindows31latin2", -2002}, | ||
1321 | {""}, {""}, {""}, {""}, | ||
1322 | {"cswindows31latin1", -2001}, | ||
1323 | {""}, {""}, {""}, {""}, | ||
1324 | {"cswindows30latin1", -2000}, | ||
1325 | {""}, {""}, {""}, | ||
1326 | {"ebcdic-se-278+euro", -2094}, | ||
1327 | {""}, {""}, | ||
1328 | {"ccsid00858", -2089}, | ||
1329 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1330 | {""}, | ||
1331 | {"csiso11swedishfornames", -21}, | ||
1332 | {""}, {""}, {""}, {""}, | ||
1333 | {"cspc8danishnorwegian", -2012}, | ||
1334 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1335 | {""}, {""}, {""}, {""}, | ||
1336 | {"nats-dano", 33}, | ||
1337 | {""}, {""}, | ||
1338 | {"cswindows31j", -2024}, | ||
1339 | {"nf_z_62-010_(1973)", 46}, | ||
1340 | {""}, | ||
1341 | {"hp-pi-font", 2018}, | ||
1342 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1343 | {"ansi_x3.4-1986", -3}, | ||
1344 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1345 | {""}, {""}, {""}, | ||
1346 | {"iso-8859-6-i", -82}, | ||
1347 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1348 | {""}, {""}, {""}, {""}, {""}, | ||
1349 | {"iso-8859-6-e", -81}, | ||
1350 | {""}, | ||
1351 | {"latin-lap", 97}, | ||
1352 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1353 | {""}, {""}, {""}, {""}, {""}, | ||
1354 | {"jis_x0201", 15}, | ||
1355 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1356 | {""}, | ||
1357 | {"csunicodelatin1", -1003}, | ||
1358 | {""}, {""}, {""}, {""}, {""}, | ||
1359 | {"iso-8859-2-windows-latin-2", 2002}, | ||
1360 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1361 | {"hu", -62}, | ||
1362 | {"nf_z_62-010", 26}, | ||
1363 | {""}, {""}, {""}, {""}, {""}, | ||
1364 | {"csibm038", -2029}, | ||
1365 | {""}, {""}, | ||
1366 | {"iso-8859-3", -6}, | ||
1367 | {"greek-ccitt", 91}, | ||
1368 | {""}, {""}, | ||
1369 | {"ansi_x3.4-1968", 3}, | ||
1370 | {""}, {""}, {""}, {""}, {""}, | ||
1371 | {"iso-8859-1-windows-3.1-latin-1", 2001}, | ||
1372 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1373 | {"iso-8859-8-i", -85}, | ||
1374 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1375 | {"us-dk", 100}, | ||
1376 | {""}, | ||
1377 | {"elot_928", -10}, | ||
1378 | {""}, {""}, {""}, {""}, | ||
1379 | {"iso-8859-8-e", -84}, | ||
1380 | {"ms_kanji", -17}, | ||
1381 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1382 | {""}, | ||
1383 | {"pc-multilingual-850+euro", -2089}, | ||
1384 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1385 | {"iso-ir-8-2", -32}, | ||
1386 | {"msz_7795.3", 62}, | ||
1387 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1388 | {"iso646-hu", -62}, | ||
1389 | {""}, | ||
1390 | {"iso-ir-8-1", -31}, | ||
1391 | {""}, | ||
1392 | {"csisolatin2", -5}, | ||
1393 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1394 | {""}, {""}, {""}, | ||
1395 | {"jis_x0212-1990", 98}, | ||
1396 | {"iso-8859-1-windows-3.0-latin-1", 2000}, | ||
1397 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1398 | {""}, | ||
1399 | {"csisolatin3", -6}, | ||
1400 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1401 | {"adobe-symbol-encoding", 2020}, | ||
1402 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1403 | {""}, {""}, | ||
1404 | {"latin-greek-1", 47}, | ||
1405 | {""}, | ||
1406 | {"iso_8859-9", -12}, | ||
1407 | {"csusdk", -100}, | ||
1408 | {""}, {""}, {""}, {""}, {""}, | ||
1409 | {"csiso17spanish", -23}, | ||
1410 | {""}, {""}, {""}, {""}, {""}, | ||
1411 | {"iso_10367-box", 96}, | ||
1412 | {""}, {""}, {""}, {""}, {""}, | ||
1413 | {"cshplegal", -2017}, | ||
1414 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1415 | {""}, {""}, {""}, {""}, | ||
1416 | {"utf-16le", 1014}, | ||
1417 | {""}, {""}, {""}, {""}, | ||
1418 | {"csnatssefiadd", -32}, | ||
1419 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1420 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1421 | {""}, {""}, {""}, | ||
1422 | {"macedonian", -90}, | ||
1423 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1424 | {"din_66003", 24}, | ||
1425 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1426 | {"csiso60danishnorwegian", -25}, | ||
1427 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1428 | {""}, | ||
1429 | {"utf-16be", 1013}, | ||
1430 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1431 | {""}, {""}, {""}, {""}, {""}, | ||
1432 | {"csjisencoding", -16}, | ||
1433 | {""}, {""}, {""}, {""}, {""}, | ||
1434 | {"csksc56011987", -36}, | ||
1435 | {""}, {""}, | ||
1436 | {"windows-1256", 2256}, | ||
1437 | {""}, {""}, {""}, {""}, | ||
1438 | {"windows-1255", 2255}, | ||
1439 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1440 | {"windows-1252", 2252}, | ||
1441 | {""}, {""}, {""}, {""}, | ||
1442 | {"windows-1251", 2251}, | ||
1443 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1444 | {"ks_c_5601-1987", 36}, | ||
1445 | {""}, | ||
1446 | {"iso-8859-9-windows-latin-5", 2003}, | ||
1447 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1448 | {""}, | ||
1449 | {"windows-1254", 2254}, | ||
1450 | {"extended_unix_code_fixed_width_for_japanese", 19}, | ||
1451 | {""}, {""}, {""}, | ||
1452 | {"macintosh", 2027}, | ||
1453 | {""}, | ||
1454 | {"csiso147macedonian", -90}, | ||
1455 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1456 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1457 | {"nats-dano-add", 34}, | ||
1458 | {""}, {""}, {""}, {""}, {""}, | ||
1459 | {"iso-ir-89", -65}, | ||
1460 | {""}, | ||
1461 | {"csisolatinhebrew", -11}, | ||
1462 | {""}, {""}, {""}, {""}, | ||
1463 | {"naplps", -74}, | ||
1464 | {""}, {""}, | ||
1465 | {"euc-jp", -18}, | ||
1466 | {""}, {""}, | ||
1467 | {"windows-1258", 2258}, | ||
1468 | {""}, {""}, {""}, {""}, | ||
1469 | {"windows-1250", 2250}, | ||
1470 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1471 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1472 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1473 | {""}, {""}, | ||
1474 | {"windows-1257", 2257}, | ||
1475 | {""}, {""}, {""}, {""}, {""}, | ||
1476 | {"csunknown8bit", -2079}, | ||
1477 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1478 | {"csiso158lap", -97}, | ||
1479 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1480 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1481 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1482 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1483 | {"koi8-u", 2088}, | ||
1484 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1485 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1486 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1487 | {"cshalfwidthkatakana", -15}, | ||
1488 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1489 | {"ks_c_5601-1989", -36}, | ||
1490 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1491 | {""}, {""}, {""}, | ||
1492 | {"iso_8859-6-i", 82}, | ||
1493 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1494 | {"ansi_x3.110-1983", 74}, | ||
1495 | {""}, {""}, {""}, {""}, {""}, | ||
1496 | {"iso_8859-6-e", 81}, | ||
1497 | {""}, {""}, {""}, | ||
1498 | {"cspc8codepage437", -2011}, | ||
1499 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1500 | {"cshppifont", -2018}, | ||
1501 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1502 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1503 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1504 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1505 | {""}, {""}, {""}, | ||
1506 | {"iso_8859-3", -6}, | ||
1507 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1508 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1509 | {"iso_8859-8-i", 85}, | ||
1510 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1511 | {""}, {""}, {""}, {""}, {""}, | ||
1512 | {"iso_8859-8-e", 84}, | ||
1513 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1514 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1515 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1516 | {"csiso10swedish", -35}, | ||
1517 | {""}, {""}, | ||
1518 | {"iso-unicode-ibm-1276", 1007}, | ||
1519 | {""}, {""}, {""}, {""}, | ||
1520 | {"iso-unicode-ibm-1265", 1009}, | ||
1521 | {""}, | ||
1522 | {"cspc8turkish", -2014}, | ||
1523 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1524 | {"korean", -36}, | ||
1525 | {""}, {""}, {""}, | ||
1526 | {"iso-unicode-ibm-1261", 1005}, | ||
1527 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1528 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1529 | {""}, | ||
1530 | {"iso-unicode-ibm-1264", 1008}, | ||
1531 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1532 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1533 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1534 | {"utf-32le", 1019}, | ||
1535 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1536 | {""}, {""}, {""}, | ||
1537 | {"hebrew", -11}, | ||
1538 | {""}, | ||
1539 | {"adobe-standard-encoding", 2005}, | ||
1540 | {""}, | ||
1541 | {"iso-unicode-ibm-1268", 1006}, | ||
1542 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1543 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1544 | {"cshpmath8", -2019}, | ||
1545 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1546 | {""}, | ||
1547 | {"csn_369103", 86}, | ||
1548 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1549 | {"utf-32be", 1018}, | ||
1550 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1551 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1552 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1553 | {""}, | ||
1554 | {"windows-1253", 2253}, | ||
1555 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1556 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1557 | {"pc8-turkish", 2014}, | ||
1558 | {""}, {""}, | ||
1559 | {"jis_x0208-1983", -63}, | ||
1560 | {"jus_i.b1.002", 87}, | ||
1561 | {""}, {""}, {""}, | ||
1562 | {"jus_i.b1.003-mac", 90}, | ||
1563 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1564 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1565 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1566 | {"csmicrosoftpublishing", -2023}, | ||
1567 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1568 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1569 | {"csiso8859supp", -95}, | ||
1570 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1571 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1572 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1573 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1574 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1575 | {"katakana", -41}, | ||
1576 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1577 | {"csventurainternational", -2007}, | ||
1578 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1579 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1580 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1581 | {"csmacintosh", -2027}, | ||
1582 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1583 | {"latin-greek", 45}, | ||
1584 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1585 | {""}, {""}, {""}, | ||
1586 | {"csinvariant", -29}, | ||
1587 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1588 | {""}, {""}, | ||
1589 | {"csadobestandardencoding", -2005}, | ||
1590 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1591 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1592 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1593 | {""}, {""}, {""}, {""}, {""}, | ||
1594 | {"iso_8859-5:1988", 8}, | ||
1595 | {""}, {""}, {""}, {""}, {""}, | ||
1596 | {"jus_i.b1.003-serb", 89}, | ||
1597 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1598 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1599 | {""}, {""}, {""}, {""}, {""}, | ||
1600 | {"iso_8859-6:1987", 9}, | ||
1601 | {""}, {""}, {""}, {""}, | ||
1602 | {"iso_8859-4:1988", 7}, | ||
1603 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1604 | {"iso_8859-2:1987", 5}, | ||
1605 | {""}, {""}, {""}, {""}, | ||
1606 | {"iso_8859-1:1987", 4}, | ||
1607 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1608 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1609 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1610 | {""}, {""}, | ||
1611 | {"iso_8859-8:1988", 11}, | ||
1612 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1613 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1614 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1615 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1616 | {"cseucpkdfmtjapanese", -18}, | ||
1617 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1618 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1619 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1620 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1621 | {"iso_8859-7:1987", 10}, | ||
1622 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1623 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1624 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1625 | {"csventuraus", -2006}, | ||
1626 | {"videotex-suppl", 59}, | ||
1627 | {"windows-31j", 2024}, | ||
1628 | {""}, {""}, {""}, | ||
1629 | {"csisolatingreek", -10}, | ||
1630 | {""}, | ||
1631 | {"hp-math8", 2019}, | ||
1632 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1633 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1634 | {""}, {""}, {""}, | ||
1635 | {"bs_viewdata", 50}, | ||
1636 | {""}, {""}, {""}, | ||
1637 | {"csebcdicuk", -2077}, | ||
1638 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1639 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1640 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1641 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1642 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1643 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1644 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1645 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1646 | {"big5-hkscs", 2101}, | ||
1647 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1648 | {""}, | ||
1649 | {"iso_2033-1983", 73}, | ||
1650 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1651 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1652 | {""}, {""}, {""}, {""}, | ||
1653 | {"cspc850multilingual", -2009}, | ||
1654 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1655 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1656 | {""}, | ||
1657 | {"nc_nc00-10:81", 92}, | ||
1658 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1659 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1660 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1661 | {""}, | ||
1662 | {"iso_8859-supp", 95}, | ||
1663 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1664 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1665 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1666 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1667 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1668 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1669 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1670 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1671 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1672 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1673 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1674 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1675 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1676 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1677 | {""}, | ||
1678 | {"csa_t500-1983", -74}, | ||
1679 | {""}, {""}, {""}, {""}, | ||
1680 | {"iso_8859-3:1988", 6}, | ||
1681 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1682 | {""}, {""}, {""}, {""}, {""}, | ||
1683 | {"iso_8859-9:1989", 12}, | ||
1684 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1685 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1686 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1687 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1688 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1689 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1690 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1691 | {""}, | ||
1692 | {"iso_5427:1981", 54}, | ||
1693 | {""}, | ||
1694 | {"st_sev_358-88", -94}, | ||
1695 | {""}, {""}, {""}, {""}, | ||
1696 | {"csventuramath", -2022}, | ||
1697 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1698 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1699 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1700 | {""}, {""}, {""}, {""}, {""}, | ||
1701 | {"csiso86hungarian", -62}, | ||
1702 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1703 | {"unknown-8bit", 2079}, | ||
1704 | {""}, {""}, {""}, | ||
1705 | {"cshpdesktop", -2021}, | ||
1706 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1707 | {""}, {""}, {""}, {""}, {""}, | ||
1708 | {"ventura-us", 2006}, | ||
1709 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1710 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1711 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1712 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1713 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1714 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1715 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1716 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1717 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1718 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1719 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1720 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1721 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1722 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1723 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1724 | {"windows-936", -113}, | ||
1725 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1726 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1727 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1728 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1729 | {""}, {""}, {""}, {""}, {""}, | ||
1730 | {"ventura-international", 2007}, | ||
1731 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1732 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1733 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1734 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1735 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1736 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1737 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1738 | {""}, | ||
1739 | {"gost_19768-74", 94}, | ||
1740 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1741 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1742 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1743 | {""}, {""}, | ||
1744 | {"iso_6937-2-25", 93}, | ||
1745 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1746 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1747 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1748 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1749 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1750 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1751 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1752 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1753 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1754 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1755 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1756 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1757 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1758 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1759 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1760 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1761 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1762 | {""}, {""}, {""}, {""}, | ||
1763 | {"iso_5428:1980", 55}, | ||
1764 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1765 | {""}, {""}, {""}, | ||
1766 | {"iso_6937-2-add", 14}, | ||
1767 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1768 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1769 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1770 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1771 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1772 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1773 | {""}, {""}, {""}, {""}, {""}, | ||
1774 | {"pc8-danish-norwegian", 2012}, | ||
1775 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1776 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1777 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1778 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1779 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1780 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1781 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1782 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1783 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1784 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1785 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1786 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1787 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1788 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1789 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1790 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1791 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1792 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1793 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1794 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1795 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1796 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1797 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1798 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1799 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1800 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1801 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1802 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1803 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1804 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1805 | {""}, {""}, {""}, {""}, | ||
1806 | {"cshppsmath", -2020}, | ||
1807 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1808 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1809 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1810 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1811 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1812 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1813 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1814 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1815 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1816 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1817 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1818 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1819 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1820 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1821 | {""}, {""}, {""}, | ||
1822 | {"ventura-math", 2022}, | ||
1823 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1824 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1825 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1826 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1827 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1828 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1829 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1830 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1831 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1832 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1833 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1834 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1835 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1836 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1837 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1838 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1839 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1840 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1841 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1842 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1843 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1844 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1845 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1846 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1847 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1848 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1849 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1850 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1851 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1852 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1853 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1854 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1855 | {""}, | ||
1856 | {"hp-desktop", 2021} | ||
1857 | }; | ||
1858 | |||
1859 | const struct charset * | ||
1860 | in_word_set (register const char *str, register size_t len) | ||
1861 | { | ||
1862 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
1863 | { | ||
1864 | register unsigned int key = hash (str, len); | ||
1865 | |||
1866 | if (key <= MAX_HASH_VALUE) | ||
1867 | { | ||
1868 | register const char *s = wordlist[key].name; | ||
1869 | |||
1870 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
1871 | return &wordlist[key]; | ||
1872 | } | ||
1873 | } | ||
1874 | return 0; | ||
1875 | } | ||
1876 |
File tests/charsets.gperf added (mode: 100644) (index 0000000..4adac57) | |||
1 | %{ | ||
2 | /* Generated from IANA charset data from https://www.iana.org/assignments/character-sets by charsets.awk */ | ||
3 | /* last updated 2002-06-14 */ | ||
4 | /* process with: | ||
5 | gperf -CDEGTlot -H charset_hash -K name -L ANSI-C -N charset_entry | ||
6 | */ | ||
7 | %} | ||
8 | struct charset { const char *name; /* name or alias */ int mib; /* MIBenum for name, -1 * MIBenum for alias */ }; | ||
9 | %% | ||
10 | 437, -2011 | ||
11 | 850, -2009 | ||
12 | 851, -2045 | ||
13 | 852, -2010 | ||
14 | 855, -2046 | ||
15 | 857, -2047 | ||
16 | 860, -2048 | ||
17 | 861, -2049 | ||
18 | 862, -2013 | ||
19 | 863, -2050 | ||
20 | 865, -2052 | ||
21 | 866, -2086 | ||
22 | 869, -2054 | ||
23 | 904, -2060 | ||
24 | adobe-standard-encoding, 2005 | ||
25 | adobe-symbol-encoding, 2020 | ||
26 | ansi_x3.110-1983, 74 | ||
27 | ansi_x3.4-1968, 3 | ||
28 | ansi_x3.4-1986, -3 | ||
29 | arabic, -9 | ||
30 | arabic7, -65 | ||
31 | ascii, -3 | ||
32 | asmo-708, -9 | ||
33 | asmo_449, 65 | ||
34 | big5, 2026 | ||
35 | big5-hkscs, 2101 | ||
36 | bs_4730, 20 | ||
37 | bs_viewdata, 50 | ||
38 | ca, -78 | ||
39 | ccsid00858, -2089 | ||
40 | ccsid00924, -2090 | ||
41 | ccsid01140, -2091 | ||
42 | ccsid01141, -2092 | ||
43 | ccsid01142, -2093 | ||
44 | ccsid01143, -2094 | ||
45 | ccsid01144, -2095 | ||
46 | ccsid01145, -2096 | ||
47 | ccsid01146, -2097 | ||
48 | ccsid01147, -2098 | ||
49 | ccsid01148, -2099 | ||
50 | ccsid01149, -2100 | ||
51 | cesu-8, 1016 | ||
52 | chinese, -57 | ||
53 | cn, -56 | ||
54 | cp-ar, -2053 | ||
55 | cp-gr, -2054 | ||
56 | cp-is, -2049 | ||
57 | cp00858, -2089 | ||
58 | cp00924, -2090 | ||
59 | cp01140, -2091 | ||
60 | cp01141, -2092 | ||
61 | cp01142, -2093 | ||
62 | cp01143, -2094 | ||
63 | cp01144, -2095 | ||
64 | cp01145, -2096 | ||
65 | cp01146, -2097 | ||
66 | cp01147, -2098 | ||
67 | cp01148, -2099 | ||
68 | cp01149, -2100 | ||
69 | cp037, -2028 | ||
70 | cp038, -2029 | ||
71 | cp1026, -2063 | ||
72 | cp273, -2030 | ||
73 | cp274, -2031 | ||
74 | cp275, -2032 | ||
75 | cp278, -2034 | ||
76 | cp280, -2035 | ||
77 | cp281, -2036 | ||
78 | cp284, -2037 | ||
79 | cp285, -2038 | ||
80 | cp290, -2039 | ||
81 | cp297, -2040 | ||
82 | cp367, -3 | ||
83 | cp420, -2041 | ||
84 | cp423, -2042 | ||
85 | cp424, -2043 | ||
86 | cp437, -2011 | ||
87 | cp500, -2044 | ||
88 | cp775, -2087 | ||
89 | cp819, -4 | ||
90 | cp850, -2009 | ||
91 | cp851, -2045 | ||
92 | cp852, -2010 | ||
93 | cp855, -2046 | ||
94 | cp857, -2047 | ||
95 | cp860, -2048 | ||
96 | cp861, -2049 | ||
97 | cp862, -2013 | ||
98 | cp863, -2050 | ||
99 | cp864, -2051 | ||
100 | cp865, -2052 | ||
101 | cp866, -2086 | ||
102 | cp868, -2053 | ||
103 | cp869, -2054 | ||
104 | cp870, -2055 | ||
105 | cp871, -2056 | ||
106 | cp880, -2057 | ||
107 | cp891, -2058 | ||
108 | cp903, -2059 | ||
109 | cp904, -2060 | ||
110 | cp905, -2061 | ||
111 | cp918, -2062 | ||
112 | cp936, -113 | ||
113 | csa7-1, -78 | ||
114 | csa7-2, -79 | ||
115 | csa_t500-1983, -74 | ||
116 | csa_z243.4-1985-1, 78 | ||
117 | csa_z243.4-1985-2, 79 | ||
118 | csa_z243.4-1985-gr, 80 | ||
119 | csadobestandardencoding, -2005 | ||
120 | csascii, -3 | ||
121 | csbig5, -2026 | ||
122 | cscesu-8, -1016 | ||
123 | csdecmcs, -2008 | ||
124 | csdkus, -101 | ||
125 | csebcdicatdea, -2065 | ||
126 | csebcdiccafr, -2066 | ||
127 | csebcdicdkno, -2067 | ||
128 | csebcdicdknoa, -2068 | ||
129 | csebcdices, -2074 | ||
130 | csebcdicesa, -2075 | ||
131 | csebcdicess, -2076 | ||
132 | csebcdicfise, -2069 | ||
133 | csebcdicfisea, -2070 | ||
134 | csebcdicfr, -2071 | ||
135 | csebcdicit, -2072 | ||
136 | csebcdicpt, -2073 | ||
137 | csebcdicuk, -2077 | ||
138 | csebcdicus, -2078 | ||
139 | cseucfixwidjapanese, -19 | ||
140 | cseuckr, -38 | ||
141 | cseucpkdfmtjapanese, -18 | ||
142 | csgb2312, -2025 | ||
143 | cshalfwidthkatakana, -15 | ||
144 | cshpdesktop, -2021 | ||
145 | cshplegal, -2017 | ||
146 | cshpmath8, -2019 | ||
147 | cshppifont, -2018 | ||
148 | cshppsmath, -2020 | ||
149 | cshproman8, -2004 | ||
150 | csibbm904, -2060 | ||
151 | csibm037, -2028 | ||
152 | csibm038, -2029 | ||
153 | csibm1026, -2063 | ||
154 | csibm273, -2030 | ||
155 | csibm274, -2031 | ||
156 | csibm275, -2032 | ||
157 | csibm277, -2033 | ||
158 | csibm278, -2034 | ||
159 | csibm280, -2035 | ||
160 | csibm281, -2036 | ||
161 | csibm284, -2037 | ||
162 | csibm285, -2038 | ||
163 | csibm290, -2039 | ||
164 | csibm297, -2040 | ||
165 | csibm420, -2041 | ||
166 | csibm423, -2042 | ||
167 | csibm424, -2043 | ||
168 | csibm500, -2044 | ||
169 | csibm851, -2045 | ||
170 | csibm855, -2046 | ||
171 | csibm857, -2047 | ||
172 | csibm860, -2048 | ||
173 | csibm861, -2049 | ||
174 | csibm863, -2050 | ||
175 | csibm864, -2051 | ||
176 | csibm865, -2052 | ||
177 | csibm866, -2086 | ||
178 | csibm868, -2053 | ||
179 | csibm869, -2054 | ||
180 | csibm870, -2055 | ||
181 | csibm871, -2056 | ||
182 | csibm880, -2057 | ||
183 | csibm891, -2058 | ||
184 | csibm903, -2059 | ||
185 | csibm905, -2061 | ||
186 | csibm918, -2062 | ||
187 | csibmebcdicatde, -2064 | ||
188 | csibmsymbols, -2015 | ||
189 | csibmthai, -2016 | ||
190 | csinvariant, -29 | ||
191 | csiso102t617bit, -75 | ||
192 | csiso10367box, -96 | ||
193 | csiso103t618bit, -76 | ||
194 | csiso10646utf1, -27 | ||
195 | csiso10swedish, -35 | ||
196 | csiso111ecmacyrillic, -77 | ||
197 | csiso11swedishfornames, -21 | ||
198 | csiso121canadian1, -78 | ||
199 | csiso122canadian2, -79 | ||
200 | csiso123csaz24341985gr, -80 | ||
201 | csiso128t101g2, -83 | ||
202 | csiso139csn369103, -86 | ||
203 | csiso13jisc6220jp, -41 | ||
204 | csiso141jusib1002, -87 | ||
205 | csiso143iecp271, -88 | ||
206 | csiso146serbian, -89 | ||
207 | csiso147macedonian, -90 | ||
208 | csiso14jisc6220ro, -42 | ||
209 | csiso150, -91 | ||
210 | csiso150greekccitt, -91 | ||
211 | csiso151cuba, -92 | ||
212 | csiso153gost1976874, -94 | ||
213 | csiso158lap, -97 | ||
214 | csiso159jisx02121990, -98 | ||
215 | csiso15italian, -22 | ||
216 | csiso16portuguese, -43 | ||
217 | csiso17spanish, -23 | ||
218 | csiso18greek7old, -44 | ||
219 | csiso19latingreek, -45 | ||
220 | csiso2022jp, -39 | ||
221 | csiso2022jp2, -40 | ||
222 | csiso2022kr, -37 | ||
223 | csiso2033, -73 | ||
224 | csiso21german, -24 | ||
225 | csiso25french, -46 | ||
226 | csiso27latingreek1, -47 | ||
227 | csiso2intlrefversion, -30 | ||
228 | csiso42jisc62261978, -49 | ||
229 | csiso47bsviewdata, -50 | ||
230 | csiso49inis, -51 | ||
231 | csiso4unitedkingdom, -20 | ||
232 | csiso50inis8, -52 | ||
233 | csiso51iniscyrillic, -53 | ||
234 | csiso5427cyrillic, -48 | ||
235 | csiso5428greek, -55 | ||
236 | csiso57gb1988, -56 | ||
237 | csiso58gb231280, -57 | ||
238 | csiso60danishnorwegian, -25 | ||
239 | csiso60norwegian1, -25 | ||
240 | csiso61norwegian2, -58 | ||
241 | csiso646basic1983, -28 | ||
242 | csiso646danish, -99 | ||
243 | csiso6937add, -93 | ||
244 | csiso69french, -26 | ||
245 | csiso70videotexsupp1, -59 | ||
246 | csiso84portuguese2, -60 | ||
247 | csiso85spanish2, -61 | ||
248 | csiso86hungarian, -62 | ||
249 | csiso87jisx0208, -63 | ||
250 | csiso88596e, -81 | ||
251 | csiso88596i, -82 | ||
252 | csiso88598e, -84 | ||
253 | csiso88598i, -85 | ||
254 | csiso8859supp, -95 | ||
255 | csiso88greek7, -64 | ||
256 | csiso89asmo449, -65 | ||
257 | csiso90, -66 | ||
258 | csiso91jisc62291984a, -67 | ||
259 | csiso92jisc62991984b, -68 | ||
260 | csiso93jis62291984badd, -69 | ||
261 | csiso94jis62291984hand, -70 | ||
262 | csiso95jis62291984handadd, -71 | ||
263 | csiso96jisc62291984kana, -72 | ||
264 | csiso99naplps, -74 | ||
265 | csisolatin1, -4 | ||
266 | csisolatin2, -5 | ||
267 | csisolatin3, -6 | ||
268 | csisolatin4, -7 | ||
269 | csisolatin5, -12 | ||
270 | csisolatin6, -13 | ||
271 | csisolatinarabic, -9 | ||
272 | csisolatincyrillic, -8 | ||
273 | csisolatingreek, -10 | ||
274 | csisolatinhebrew, -11 | ||
275 | csisotextcomm, -14 | ||
276 | csjisencoding, -16 | ||
277 | cskoi8r, -2084 | ||
278 | csksc56011987, -36 | ||
279 | csksc5636, -102 | ||
280 | csmacintosh, -2027 | ||
281 | csmicrosoftpublishing, -2023 | ||
282 | csmnem, -2081 | ||
283 | csmnemonic, -2080 | ||
284 | csn_369103, 86 | ||
285 | csnatsdano, -33 | ||
286 | csnatsdanoadd, -34 | ||
287 | csnatssefi, -31 | ||
288 | csnatssefiadd, -32 | ||
289 | cspc775baltic, -2087 | ||
290 | cspc850multilingual, -2009 | ||
291 | cspc862latinhebrew, -2013 | ||
292 | cspc8codepage437, -2011 | ||
293 | cspc8danishnorwegian, -2012 | ||
294 | cspc8turkish, -2014 | ||
295 | cspcp852, -2010 | ||
296 | csshiftjis, -17 | ||
297 | csucs4, -1001 | ||
298 | csunicode, -1000 | ||
299 | csunicode11, -1010 | ||
300 | csunicode11utf7, -103 | ||
301 | csunicodeascii, -1002 | ||
302 | csunicodeibm1261, -1005 | ||
303 | csunicodeibm1264, -1008 | ||
304 | csunicodeibm1265, -1009 | ||
305 | csunicodeibm1268, -1006 | ||
306 | csunicodeibm1276, -1007 | ||
307 | csunicodelatin1, -1003 | ||
308 | csunknown8bit, -2079 | ||
309 | csusdk, -100 | ||
310 | csventurainternational, -2007 | ||
311 | csventuramath, -2022 | ||
312 | csventuraus, -2006 | ||
313 | csviqr, -2083 | ||
314 | csviscii, -2082 | ||
315 | cswindows30latin1, -2000 | ||
316 | cswindows31j, -2024 | ||
317 | cswindows31latin1, -2001 | ||
318 | cswindows31latin2, -2002 | ||
319 | cswindows31latin5, -2003 | ||
320 | cuba, -92 | ||
321 | cyrillic, -8 | ||
322 | de, -24 | ||
323 | dec, -2008 | ||
324 | dec-mcs, 2008 | ||
325 | din_66003, 24 | ||
326 | dk, -99 | ||
327 | dk-us, 101 | ||
328 | ds2089, -99 | ||
329 | ds_2089, 99 | ||
330 | e13b, -73 | ||
331 | ebcdic-at-de, 2064 | ||
332 | ebcdic-at-de-a, 2065 | ||
333 | ebcdic-be, -2031 | ||
334 | ebcdic-br, -2032 | ||
335 | ebcdic-ca-fr, 2066 | ||
336 | ebcdic-cp-ar1, -2041 | ||
337 | ebcdic-cp-ar2, -2062 | ||
338 | ebcdic-cp-be, -2044 | ||
339 | ebcdic-cp-ca, -2028 | ||
340 | ebcdic-cp-ch, -2044 | ||
341 | ebcdic-cp-dk, -2033 | ||
342 | ebcdic-cp-es, -2037 | ||
343 | ebcdic-cp-fi, -2034 | ||
344 | ebcdic-cp-fr, -2040 | ||
345 | ebcdic-cp-gb, -2038 | ||
346 | ebcdic-cp-gr, -2042 | ||
347 | ebcdic-cp-he, -2043 | ||
348 | ebcdic-cp-is, -2056 | ||
349 | ebcdic-cp-it, -2035 | ||
350 | ebcdic-cp-nl, -2028 | ||
351 | ebcdic-cp-no, -2033 | ||
352 | ebcdic-cp-roece, -2055 | ||
353 | ebcdic-cp-se, -2034 | ||
354 | ebcdic-cp-tr, -2061 | ||
355 | ebcdic-cp-us, -2028 | ||
356 | ebcdic-cp-wt, -2028 | ||
357 | ebcdic-cp-yu, -2055 | ||
358 | ebcdic-cyrillic, -2057 | ||
359 | ebcdic-de-273+euro, -2092 | ||
360 | ebcdic-dk-277+euro, -2093 | ||
361 | ebcdic-dk-no, 2067 | ||
362 | ebcdic-dk-no-a, 2068 | ||
363 | ebcdic-es, 2074 | ||
364 | ebcdic-es-284+euro, -2096 | ||
365 | ebcdic-es-a, 2075 | ||
366 | ebcdic-es-s, 2076 | ||
367 | ebcdic-fi-278+euro, -2094 | ||
368 | ebcdic-fi-se, 2069 | ||
369 | ebcdic-fi-se-a, 2070 | ||
370 | ebcdic-fr, 2071 | ||
371 | ebcdic-fr-297+euro, -2098 | ||
372 | ebcdic-gb-285+euro, -2097 | ||
373 | ebcdic-int, -2029 | ||
374 | ebcdic-international-500+euro, -2099 | ||
375 | ebcdic-is-871+euro, -2100 | ||
376 | ebcdic-it, 2072 | ||
377 | ebcdic-it-280+euro, -2095 | ||
378 | ebcdic-jp-e, -2036 | ||
379 | ebcdic-jp-kana, -2039 | ||
380 | ebcdic-latin9--euro, -2090 | ||
381 | ebcdic-no-277+euro, -2093 | ||
382 | ebcdic-pt, 2073 | ||
383 | ebcdic-se-278+euro, -2094 | ||
384 | ebcdic-uk, 2077 | ||
385 | ebcdic-us, 2078 | ||
386 | ebcdic-us-37+euro, -2091 | ||
387 | ecma-114, -9 | ||
388 | ecma-118, -10 | ||
389 | ecma-cyrillic, 77 | ||
390 | elot_928, -10 | ||
391 | es, 23 | ||
392 | es2, 61 | ||
393 | euc-jp, -18 | ||
394 | euc-kr, 38 | ||
395 | extended_unix_code_fixed_width_for_japanese, 19 | ||
396 | extended_unix_code_packed_format_for_japanese, 18 | ||
397 | fi, -35 | ||
398 | fr, -26 | ||
399 | gb, -20 | ||
400 | gb18030, 114 | ||
401 | gb2312, 2025 | ||
402 | gb_1988-80, 56 | ||
403 | gb_2312-80, 57 | ||
404 | gbk, 113 | ||
405 | gost_19768-74, 94 | ||
406 | greek, -10 | ||
407 | greek-ccitt, 91 | ||
408 | greek7, 64 | ||
409 | greek7-old, 44 | ||
410 | greek8, -10 | ||
411 | hebrew, -11 | ||
412 | hp-desktop, 2021 | ||
413 | hp-legal, 2017 | ||
414 | hp-math8, 2019 | ||
415 | hp-pi-font, 2018 | ||
416 | hp-roman8, 2004 | ||
417 | hu, -62 | ||
418 | hz-gb-2312, 2085 | ||
419 | ibm-symbols, 2015 | ||
420 | ibm-thai, 2016 | ||
421 | ibm00858, 2089 | ||
422 | ibm00924, 2090 | ||
423 | ibm01140, 2091 | ||
424 | ibm01141, 2092 | ||
425 | ibm01142, 2093 | ||
426 | ibm01143, 2094 | ||
427 | ibm01144, 2095 | ||
428 | ibm01145, 2096 | ||
429 | ibm01146, 2097 | ||
430 | ibm01147, 2098 | ||
431 | ibm01148, 2099 | ||
432 | ibm01149, 2100 | ||
433 | ibm037, 2028 | ||
434 | ibm038, 2029 | ||
435 | ibm1026, 2063 | ||
436 | ibm273, 2030 | ||
437 | ibm274, 2031 | ||
438 | ibm275, 2032 | ||
439 | ibm277, 2033 | ||
440 | ibm278, 2034 | ||
441 | ibm280, 2035 | ||
442 | ibm281, 2036 | ||
443 | ibm284, 2037 | ||
444 | ibm285, 2038 | ||
445 | ibm290, 2039 | ||
446 | ibm297, 2040 | ||
447 | ibm367, -3 | ||
448 | ibm420, 2041 | ||
449 | ibm423, 2042 | ||
450 | ibm424, 2043 | ||
451 | ibm437, 2011 | ||
452 | ibm500, 2044 | ||
453 | ibm775, 2087 | ||
454 | ibm819, -4 | ||
455 | ibm850, 2009 | ||
456 | ibm851, 2045 | ||
457 | ibm852, 2010 | ||
458 | ibm855, 2046 | ||
459 | ibm857, 2047 | ||
460 | ibm860, 2048 | ||
461 | ibm861, 2049 | ||
462 | ibm862, 2013 | ||
463 | ibm863, 2050 | ||
464 | ibm864, 2051 | ||
465 | ibm865, 2052 | ||
466 | ibm866, 2086 | ||
467 | ibm868, 2053 | ||
468 | ibm869, 2054 | ||
469 | ibm870, 2055 | ||
470 | ibm871, 2056 | ||
471 | ibm880, 2057 | ||
472 | ibm891, 2058 | ||
473 | ibm903, 2059 | ||
474 | ibm904, 2060 | ||
475 | ibm905, 2061 | ||
476 | ibm918, 2062 | ||
477 | iec_p27-1, 88 | ||
478 | inis, 51 | ||
479 | inis-8, 52 | ||
480 | inis-cyrillic, 53 | ||
481 | invariant, 29 | ||
482 | irv, -30 | ||
483 | iso-10646, -1003 | ||
484 | iso-10646-j-1, 0 | ||
485 | iso-10646-ucs-2, 1000 | ||
486 | iso-10646-ucs-4, 1001 | ||
487 | iso-10646-ucs-basic, 1002 | ||
488 | iso-10646-unicode-latin1, 1003 | ||
489 | iso-10646-utf-1, 27 | ||
490 | iso-2022-cn, 104 | ||
491 | iso-2022-cn-ext, 105 | ||
492 | iso-2022-jp, 39 | ||
493 | iso-2022-jp-2, 40 | ||
494 | iso-2022-kr, 37 | ||
495 | iso-8859-1, -4 | ||
496 | iso-8859-1-windows-3.0-latin-1, 2000 | ||
497 | iso-8859-1-windows-3.1-latin-1, 2001 | ||
498 | iso-8859-10, 13 | ||
499 | iso-8859-13, 109 | ||
500 | iso-8859-14, 110 | ||
501 | iso-8859-15, 111 | ||
502 | iso-8859-16, 112 | ||
503 | iso-8859-2, -5 | ||
504 | iso-8859-2-windows-latin-2, 2002 | ||
505 | iso-8859-3, -6 | ||
506 | iso-8859-4, -7 | ||
507 | iso-8859-5, -8 | ||
508 | iso-8859-6, -9 | ||
509 | iso-8859-6-e, -81 | ||
510 | iso-8859-6-i, -82 | ||
511 | iso-8859-7, -10 | ||
512 | iso-8859-8, -11 | ||
513 | iso-8859-8-e, -84 | ||
514 | iso-8859-8-i, -85 | ||
515 | iso-8859-9, -12 | ||
516 | iso-8859-9-windows-latin-5, 2003 | ||
517 | iso-celtic, -110 | ||
518 | iso-ir-10, -35 | ||
519 | iso-ir-100, -4 | ||
520 | iso-ir-101, -5 | ||
521 | iso-ir-102, -75 | ||
522 | iso-ir-103, -76 | ||
523 | iso-ir-109, -6 | ||
524 | iso-ir-11, -21 | ||
525 | iso-ir-110, -7 | ||
526 | iso-ir-111, -77 | ||
527 | iso-ir-121, -78 | ||
528 | iso-ir-122, -79 | ||
529 | iso-ir-123, -80 | ||
530 | iso-ir-126, -10 | ||
531 | iso-ir-127, -9 | ||
532 | iso-ir-128, -83 | ||
533 | iso-ir-13, -41 | ||
534 | iso-ir-138, -11 | ||
535 | iso-ir-139, -86 | ||
536 | iso-ir-14, -42 | ||
537 | iso-ir-141, -87 | ||
538 | iso-ir-142, -14 | ||
539 | iso-ir-143, -88 | ||
540 | iso-ir-144, -8 | ||
541 | iso-ir-146, -89 | ||
542 | iso-ir-147, -90 | ||
543 | iso-ir-148, -12 | ||
544 | iso-ir-149, -36 | ||
545 | iso-ir-15, -22 | ||
546 | iso-ir-150, -91 | ||
547 | iso-ir-151, -92 | ||
548 | iso-ir-152, -93 | ||
549 | iso-ir-153, -94 | ||
550 | iso-ir-154, -95 | ||
551 | iso-ir-155, -96 | ||
552 | iso-ir-157, -13 | ||
553 | iso-ir-158, -97 | ||
554 | iso-ir-159, -98 | ||
555 | iso-ir-16, -43 | ||
556 | iso-ir-17, -23 | ||
557 | iso-ir-18, -44 | ||
558 | iso-ir-19, -45 | ||
559 | iso-ir-199, -110 | ||
560 | iso-ir-2, -30 | ||
561 | iso-ir-21, -24 | ||
562 | iso-ir-25, -46 | ||
563 | iso-ir-27, -47 | ||
564 | iso-ir-37, -48 | ||
565 | iso-ir-4, -20 | ||
566 | iso-ir-42, -49 | ||
567 | iso-ir-47, -50 | ||
568 | iso-ir-49, -51 | ||
569 | iso-ir-50, -52 | ||
570 | iso-ir-51, -53 | ||
571 | iso-ir-54, -54 | ||
572 | iso-ir-55, -55 | ||
573 | iso-ir-57, -56 | ||
574 | iso-ir-58, -57 | ||
575 | iso-ir-6, -3 | ||
576 | iso-ir-60, -25 | ||
577 | iso-ir-61, -58 | ||
578 | iso-ir-69, -26 | ||
579 | iso-ir-70, -59 | ||
580 | iso-ir-8-1, -31 | ||
581 | iso-ir-8-2, -32 | ||
582 | iso-ir-84, -60 | ||
583 | iso-ir-85, -61 | ||
584 | iso-ir-86, -62 | ||
585 | iso-ir-87, -63 | ||
586 | iso-ir-88, -64 | ||
587 | iso-ir-89, -65 | ||
588 | iso-ir-9-1, -33 | ||
589 | iso-ir-9-2, -34 | ||
590 | iso-ir-90, 66 | ||
591 | iso-ir-91, -67 | ||
592 | iso-ir-92, -68 | ||
593 | iso-ir-93, -69 | ||
594 | iso-ir-94, -70 | ||
595 | iso-ir-95, -71 | ||
596 | iso-ir-96, -72 | ||
597 | iso-ir-98, -73 | ||
598 | iso-ir-99, -74 | ||
599 | iso-unicode-ibm-1261, 1005 | ||
600 | iso-unicode-ibm-1264, 1008 | ||
601 | iso-unicode-ibm-1265, 1009 | ||
602 | iso-unicode-ibm-1268, 1006 | ||
603 | iso-unicode-ibm-1276, 1007 | ||
604 | iso5427cyrillic1981, -54 | ||
605 | iso646-ca, -78 | ||
606 | iso646-ca2, -79 | ||
607 | iso646-cn, -56 | ||
608 | iso646-cu, -92 | ||
609 | iso646-de, -24 | ||
610 | iso646-dk, -99 | ||
611 | iso646-es, -23 | ||
612 | iso646-es2, -61 | ||
613 | iso646-fi, -35 | ||
614 | iso646-fr, -26 | ||
615 | iso646-fr1, -46 | ||
616 | iso646-gb, -20 | ||
617 | iso646-hu, -62 | ||
618 | iso646-it, -22 | ||
619 | iso646-jp, -42 | ||
620 | iso646-jp-ocr-b, -68 | ||
621 | iso646-kr, -102 | ||
622 | iso646-no, -25 | ||
623 | iso646-no2, -58 | ||
624 | iso646-pt, -43 | ||
625 | iso646-pt2, -60 | ||
626 | iso646-se, -35 | ||
627 | iso646-se2, -21 | ||
628 | iso646-us, -3 | ||
629 | iso646-yu, -87 | ||
630 | iso_10367-box, 96 | ||
631 | iso_2033-1983, 73 | ||
632 | iso_5427, 48 | ||
633 | iso_5427:1981, 54 | ||
634 | iso_5428:1980, 55 | ||
635 | iso_646.basic:1983, 28 | ||
636 | iso_646.irv:1983, 30 | ||
637 | iso_646.irv:1991, -3 | ||
638 | iso_6937-2-25, 93 | ||
639 | iso_6937-2-add, 14 | ||
640 | iso_8859-1, -4 | ||
641 | iso_8859-10:1992, -13 | ||
642 | iso_8859-14, -110 | ||
643 | iso_8859-14:1998, -110 | ||
644 | iso_8859-15, -111 | ||
645 | iso_8859-1:1987, 4 | ||
646 | iso_8859-2, -5 | ||
647 | iso_8859-2:1987, 5 | ||
648 | iso_8859-3, -6 | ||
649 | iso_8859-3:1988, 6 | ||
650 | iso_8859-4, -7 | ||
651 | iso_8859-4:1988, 7 | ||
652 | iso_8859-5, -8 | ||
653 | iso_8859-5:1988, 8 | ||
654 | iso_8859-6, -9 | ||
655 | iso_8859-6-e, 81 | ||
656 | iso_8859-6-i, 82 | ||
657 | iso_8859-6:1987, 9 | ||
658 | iso_8859-7, -10 | ||
659 | iso_8859-7:1987, 10 | ||
660 | iso_8859-8, -11 | ||
661 | iso_8859-8-e, 84 | ||
662 | iso_8859-8-i, 85 | ||
663 | iso_8859-8:1988, 11 | ||
664 | iso_8859-9, -12 | ||
665 | iso_8859-9:1989, 12 | ||
666 | iso_8859-supp, 95 | ||
667 | iso_9036, -65 | ||
668 | it, 22 | ||
669 | jis_c6220-1969, -41 | ||
670 | jis_c6220-1969-jp, 41 | ||
671 | jis_c6220-1969-ro, 42 | ||
672 | jis_c6226-1978, 49 | ||
673 | jis_c6226-1983, 63 | ||
674 | jis_c6229-1984-a, 67 | ||
675 | jis_c6229-1984-b, 68 | ||
676 | jis_c6229-1984-b-add, 69 | ||
677 | jis_c6229-1984-hand, 70 | ||
678 | jis_c6229-1984-hand-add, 71 | ||
679 | jis_c6229-1984-kana, 72 | ||
680 | jis_encoding, 16 | ||
681 | jis_x0201, 15 | ||
682 | jis_x0208-1983, -63 | ||
683 | jis_x0212-1990, 98 | ||
684 | jp, -42 | ||
685 | jp-ocr-a, -67 | ||
686 | jp-ocr-b, -68 | ||
687 | jp-ocr-b-add, -69 | ||
688 | jp-ocr-hand, -70 | ||
689 | jp-ocr-hand-add, -71 | ||
690 | js, -87 | ||
691 | jus_i.b1.002, 87 | ||
692 | jus_i.b1.003-mac, 90 | ||
693 | jus_i.b1.003-serb, 89 | ||
694 | katakana, -41 | ||
695 | koi8-r, 2084 | ||
696 | koi8-u, 2088 | ||
697 | korean, -36 | ||
698 | ks_c_5601-1987, 36 | ||
699 | ks_c_5601-1989, -36 | ||
700 | ksc5636, 102 | ||
701 | ksc_5601, -36 | ||
702 | l1, -4 | ||
703 | l2, -5 | ||
704 | l3, -6 | ||
705 | l4, -7 | ||
706 | l5, -12 | ||
707 | l6, -13 | ||
708 | l8, -110 | ||
709 | lap, -97 | ||
710 | latin-greek, 45 | ||
711 | latin-greek-1, 47 | ||
712 | latin-lap, 97 | ||
713 | latin1, -4 | ||
714 | latin1-2-5, -95 | ||
715 | latin2, -5 | ||
716 | latin3, -6 | ||
717 | latin4, -7 | ||
718 | latin5, -12 | ||
719 | latin6, -13 | ||
720 | latin8, -110 | ||
721 | mac, -2027 | ||
722 | macedonian, -90 | ||
723 | macintosh, 2027 | ||
724 | microsoft-publishing, 2023 | ||
725 | mnem, 2081 | ||
726 | mnemonic, 2080 | ||
727 | ms936, -113 | ||
728 | ms_kanji, -17 | ||
729 | msz_7795.3, 62 | ||
730 | naplps, -74 | ||
731 | nats-dano, 33 | ||
732 | nats-dano-add, 34 | ||
733 | nats-sefi, 31 | ||
734 | nats-sefi-add, 32 | ||
735 | nc_nc00-10:81, 92 | ||
736 | nf_z_62-010, 26 | ||
737 | nf_z_62-010_(1973), 46 | ||
738 | no, -25 | ||
739 | no2, -58 | ||
740 | ns_4551-1, 25 | ||
741 | ns_4551-2, 58 | ||
742 | pc-multilingual-850+euro, -2089 | ||
743 | pc8-danish-norwegian, 2012 | ||
744 | pc8-turkish, 2014 | ||
745 | pt, 43 | ||
746 | pt2, 60 | ||
747 | r8, -2004 | ||
748 | ref, -28 | ||
749 | roman8, -2004 | ||
750 | scsu, 1011 | ||
751 | se, -35 | ||
752 | se2, -21 | ||
753 | sen_850200_b, 35 | ||
754 | sen_850200_c, 21 | ||
755 | serbian, -89 | ||
756 | shift_jis, 17 | ||
757 | st_sev_358-88, -94 | ||
758 | t.101-g2, 83 | ||
759 | t.61, -76 | ||
760 | t.61-7bit, 75 | ||
761 | t.61-8bit, 76 | ||
762 | tis-620, 2259 | ||
763 | uk, -20 | ||
764 | unicode-1-1, 1010 | ||
765 | unicode-1-1-utf-7, 103 | ||
766 | unknown-8bit, 2079 | ||
767 | us, -3 | ||
768 | us-ascii, -3 | ||
769 | us-dk, 100 | ||
770 | utf-16, 1015 | ||
771 | utf-16be, 1013 | ||
772 | utf-16le, 1014 | ||
773 | utf-32, 1017 | ||
774 | utf-32be, 1018 | ||
775 | utf-32le, 1019 | ||
776 | utf-7, 1012 | ||
777 | utf-8, 106 | ||
778 | ventura-international, 2007 | ||
779 | ventura-math, 2022 | ||
780 | ventura-us, 2006 | ||
781 | videotex-suppl, 59 | ||
782 | viqr, 2083 | ||
783 | viscii, 2082 | ||
784 | windows-1250, 2250 | ||
785 | windows-1251, 2251 | ||
786 | windows-1252, 2252 | ||
787 | windows-1253, 2253 | ||
788 | windows-1254, 2254 | ||
789 | windows-1255, 2255 | ||
790 | windows-1256, 2256 | ||
791 | windows-1257, 2257 | ||
792 | windows-1258, 2258 | ||
793 | windows-31j, 2024 | ||
794 | windows-936, -113 | ||
795 | x0201, -15 | ||
796 | x0201-7, -41 | ||
797 | x0208, -63 | ||
798 | x0212, -98 | ||
799 | yu, -87 | ||
800 | %% |
File tests/chill.exp added (mode: 100644) (index 0000000..4f7e373) | |||
1 | /* C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -L C -F ', 0, 0, 0' -D -E -S1 -j1 -i 1 -g -o -t -k'*' */ | ||
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-gperf@gnu.org>." | ||
29 | #endif | ||
30 | |||
31 | struct resword { | ||
32 | const char *name; | ||
33 | short token; | ||
34 | enum rid rid; | ||
35 | enum toktype { RESERVED, DIRECTIVE, PREDEF } flags; | ||
36 | }; | ||
37 | extern tree ridpointers []; | ||
38 | /* maximum key range = 1046, duplicates = 0 */ | ||
39 | |||
40 | #ifdef __GNUC__ | ||
41 | __inline | ||
42 | #else | ||
43 | #ifdef __cplusplus | ||
44 | inline | ||
45 | #endif | ||
46 | #endif | ||
47 | static unsigned int | ||
48 | hash (str, len) | ||
49 | register const char *str; | ||
50 | register size_t len; | ||
51 | { | ||
52 | static unsigned short asso_values[] = | ||
53 | { | ||
54 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
55 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
56 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
57 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
58 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
59 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
60 | 1050, 1050, 1050, 1050, 1050, 40, 45, 59, 88, 61, | ||
61 | 11, 128, 5, 2, 199, 8, 102, 101, 8, 11, | ||
62 | 24, 33, 11, 13, 4, 34, 10, 105, 83, 75, | ||
63 | 155, 1050, 1050, 1050, 1050, 5, 1050, 10, 33, 19, | ||
64 | 43, 14, 4, 52, 1, 1, 232, 116, 28, 78, | ||
65 | 7, 2, 1, 63, 5, 3, 1, 10, 143, 186, | ||
66 | 244, 75, 139, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
67 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
68 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
69 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
70 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
71 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
72 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
73 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
74 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
75 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
76 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
77 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
78 | 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, | ||
79 | 1050, 1050, 1050, 1050, 1050, 1050, 1050 | ||
80 | }; | ||
81 | register unsigned int hval = len; | ||
82 | |||
83 | switch (hval) | ||
84 | { | ||
85 | default: | ||
86 | hval += asso_values[(unsigned char)str[29]]; | ||
87 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
88 | [[fallthrough]]; | ||
89 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
90 | __attribute__ ((__fallthrough__)); | ||
91 | #endif | ||
92 | /*FALLTHROUGH*/ | ||
93 | case 29: | ||
94 | hval += asso_values[(unsigned char)str[28]]; | ||
95 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
96 | [[fallthrough]]; | ||
97 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
98 | __attribute__ ((__fallthrough__)); | ||
99 | #endif | ||
100 | /*FALLTHROUGH*/ | ||
101 | case 28: | ||
102 | hval += asso_values[(unsigned char)str[27]]; | ||
103 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
104 | [[fallthrough]]; | ||
105 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
106 | __attribute__ ((__fallthrough__)); | ||
107 | #endif | ||
108 | /*FALLTHROUGH*/ | ||
109 | case 27: | ||
110 | hval += asso_values[(unsigned char)str[26]]; | ||
111 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
112 | [[fallthrough]]; | ||
113 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
114 | __attribute__ ((__fallthrough__)); | ||
115 | #endif | ||
116 | /*FALLTHROUGH*/ | ||
117 | case 26: | ||
118 | hval += asso_values[(unsigned char)str[25]]; | ||
119 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
120 | [[fallthrough]]; | ||
121 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
122 | __attribute__ ((__fallthrough__)); | ||
123 | #endif | ||
124 | /*FALLTHROUGH*/ | ||
125 | case 25: | ||
126 | hval += asso_values[(unsigned char)str[24]]; | ||
127 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
128 | [[fallthrough]]; | ||
129 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
130 | __attribute__ ((__fallthrough__)); | ||
131 | #endif | ||
132 | /*FALLTHROUGH*/ | ||
133 | case 24: | ||
134 | hval += asso_values[(unsigned char)str[23]]; | ||
135 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
136 | [[fallthrough]]; | ||
137 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
138 | __attribute__ ((__fallthrough__)); | ||
139 | #endif | ||
140 | /*FALLTHROUGH*/ | ||
141 | case 23: | ||
142 | hval += asso_values[(unsigned char)str[22]]; | ||
143 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
144 | [[fallthrough]]; | ||
145 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
146 | __attribute__ ((__fallthrough__)); | ||
147 | #endif | ||
148 | /*FALLTHROUGH*/ | ||
149 | case 22: | ||
150 | hval += asso_values[(unsigned char)str[21]]; | ||
151 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
152 | [[fallthrough]]; | ||
153 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
154 | __attribute__ ((__fallthrough__)); | ||
155 | #endif | ||
156 | /*FALLTHROUGH*/ | ||
157 | case 21: | ||
158 | hval += asso_values[(unsigned char)str[20]]; | ||
159 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
160 | [[fallthrough]]; | ||
161 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
162 | __attribute__ ((__fallthrough__)); | ||
163 | #endif | ||
164 | /*FALLTHROUGH*/ | ||
165 | case 20: | ||
166 | hval += asso_values[(unsigned char)str[19]]; | ||
167 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
168 | [[fallthrough]]; | ||
169 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
170 | __attribute__ ((__fallthrough__)); | ||
171 | #endif | ||
172 | /*FALLTHROUGH*/ | ||
173 | case 19: | ||
174 | hval += asso_values[(unsigned char)str[18]]; | ||
175 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
176 | [[fallthrough]]; | ||
177 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
178 | __attribute__ ((__fallthrough__)); | ||
179 | #endif | ||
180 | /*FALLTHROUGH*/ | ||
181 | case 18: | ||
182 | hval += asso_values[(unsigned char)str[17]]; | ||
183 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
184 | [[fallthrough]]; | ||
185 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
186 | __attribute__ ((__fallthrough__)); | ||
187 | #endif | ||
188 | /*FALLTHROUGH*/ | ||
189 | case 17: | ||
190 | hval += asso_values[(unsigned char)str[16]]; | ||
191 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
192 | [[fallthrough]]; | ||
193 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
194 | __attribute__ ((__fallthrough__)); | ||
195 | #endif | ||
196 | /*FALLTHROUGH*/ | ||
197 | case 16: | ||
198 | hval += asso_values[(unsigned char)str[15]]; | ||
199 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
200 | [[fallthrough]]; | ||
201 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
202 | __attribute__ ((__fallthrough__)); | ||
203 | #endif | ||
204 | /*FALLTHROUGH*/ | ||
205 | case 15: | ||
206 | hval += asso_values[(unsigned char)str[14]]; | ||
207 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
208 | [[fallthrough]]; | ||
209 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
210 | __attribute__ ((__fallthrough__)); | ||
211 | #endif | ||
212 | /*FALLTHROUGH*/ | ||
213 | case 14: | ||
214 | hval += asso_values[(unsigned char)str[13]]; | ||
215 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
216 | [[fallthrough]]; | ||
217 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
218 | __attribute__ ((__fallthrough__)); | ||
219 | #endif | ||
220 | /*FALLTHROUGH*/ | ||
221 | case 13: | ||
222 | hval += asso_values[(unsigned char)str[12]]; | ||
223 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
224 | [[fallthrough]]; | ||
225 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
226 | __attribute__ ((__fallthrough__)); | ||
227 | #endif | ||
228 | /*FALLTHROUGH*/ | ||
229 | case 12: | ||
230 | hval += asso_values[(unsigned char)str[11]]; | ||
231 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
232 | [[fallthrough]]; | ||
233 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
234 | __attribute__ ((__fallthrough__)); | ||
235 | #endif | ||
236 | /*FALLTHROUGH*/ | ||
237 | case 11: | ||
238 | hval += asso_values[(unsigned char)str[10]]; | ||
239 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
240 | [[fallthrough]]; | ||
241 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
242 | __attribute__ ((__fallthrough__)); | ||
243 | #endif | ||
244 | /*FALLTHROUGH*/ | ||
245 | case 10: | ||
246 | hval += asso_values[(unsigned char)str[9]]; | ||
247 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
248 | [[fallthrough]]; | ||
249 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
250 | __attribute__ ((__fallthrough__)); | ||
251 | #endif | ||
252 | /*FALLTHROUGH*/ | ||
253 | case 9: | ||
254 | hval += asso_values[(unsigned char)str[8]]; | ||
255 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
256 | [[fallthrough]]; | ||
257 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
258 | __attribute__ ((__fallthrough__)); | ||
259 | #endif | ||
260 | /*FALLTHROUGH*/ | ||
261 | case 8: | ||
262 | hval += asso_values[(unsigned char)str[7]]; | ||
263 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
264 | [[fallthrough]]; | ||
265 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
266 | __attribute__ ((__fallthrough__)); | ||
267 | #endif | ||
268 | /*FALLTHROUGH*/ | ||
269 | case 7: | ||
270 | hval += asso_values[(unsigned char)str[6]]; | ||
271 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
272 | [[fallthrough]]; | ||
273 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
274 | __attribute__ ((__fallthrough__)); | ||
275 | #endif | ||
276 | /*FALLTHROUGH*/ | ||
277 | case 6: | ||
278 | hval += asso_values[(unsigned char)str[5]]; | ||
279 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
280 | [[fallthrough]]; | ||
281 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
282 | __attribute__ ((__fallthrough__)); | ||
283 | #endif | ||
284 | /*FALLTHROUGH*/ | ||
285 | case 5: | ||
286 | hval += asso_values[(unsigned char)str[4]]; | ||
287 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
288 | [[fallthrough]]; | ||
289 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
290 | __attribute__ ((__fallthrough__)); | ||
291 | #endif | ||
292 | /*FALLTHROUGH*/ | ||
293 | case 4: | ||
294 | hval += asso_values[(unsigned char)str[3]]; | ||
295 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
296 | [[fallthrough]]; | ||
297 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
298 | __attribute__ ((__fallthrough__)); | ||
299 | #endif | ||
300 | /*FALLTHROUGH*/ | ||
301 | case 3: | ||
302 | hval += asso_values[(unsigned char)str[2]]; | ||
303 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
304 | [[fallthrough]]; | ||
305 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
306 | __attribute__ ((__fallthrough__)); | ||
307 | #endif | ||
308 | /*FALLTHROUGH*/ | ||
309 | case 2: | ||
310 | hval += asso_values[(unsigned char)str[1]+1]; | ||
311 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
312 | [[fallthrough]]; | ||
313 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
314 | __attribute__ ((__fallthrough__)); | ||
315 | #endif | ||
316 | /*FALLTHROUGH*/ | ||
317 | case 1: | ||
318 | hval += asso_values[(unsigned char)str[0]]; | ||
319 | break; | ||
320 | } | ||
321 | return hval; | ||
322 | } | ||
323 | |||
324 | struct resword * | ||
325 | in_word_set (str, len) | ||
326 | register const char *str; | ||
327 | register size_t len; | ||
328 | { | ||
329 | enum | ||
330 | { | ||
331 | TOTAL_KEYWORDS = 300, | ||
332 | MIN_WORD_LENGTH = 2, | ||
333 | MAX_WORD_LENGTH = 30, | ||
334 | MIN_HASH_VALUE = 4, | ||
335 | MAX_HASH_VALUE = 1049 | ||
336 | }; | ||
337 | |||
338 | static struct resword wordlist[] = | ||
339 | { | ||
340 | {"to", TO, NORID, RESERVED}, | ||
341 | {"in", IN, RID_IN, RESERVED}, | ||
342 | {"on", ON, NORID, RESERVED}, | ||
343 | {"or", OR, NORID, RESERVED}, | ||
344 | {"pos", POS, NORID, RESERVED}, | ||
345 | {"init", INIT, NORID, RESERVED}, | ||
346 | {"this", THIS, NORID, RESERVED}, | ||
347 | {"set", SET, NORID, RESERVED}, | ||
348 | {"not", NOT, NORID, RESERVED}, | ||
349 | {"for", FOR, NORID, RESERVED}, | ||
350 | {"orif", ORIF, NORID, RESERVED}, | ||
351 | {"IN", IN, RID_IN, RESERVED}, | ||
352 | {"ref", REF, NORID, RESERVED}, | ||
353 | {"od", OD, NORID, RESERVED}, | ||
354 | {"stop", STOP, NORID, RESERVED}, | ||
355 | {"inout", PARAMATTR, RID_INOUT, RESERVED}, | ||
356 | {"at", AT, NORID, RESERVED}, | ||
357 | {"INIT", INIT, NORID, RESERVED}, | ||
358 | {"ON", ON, NORID, RESERVED}, | ||
359 | {"THIS", THIS, NORID, RESERVED}, | ||
360 | {"OR", OR, NORID, RESERVED}, | ||
361 | {"then", THEN, NORID, RESERVED}, | ||
362 | {"OUT", PARAMATTR, RID_OUT, RESERVED}, | ||
363 | {"proc", PROC, NORID, RESERVED}, | ||
364 | {"TO", TO, NORID, RESERVED}, | ||
365 | {"SET", SET, NORID, RESERVED}, | ||
366 | {"step", STEP, NORID, RESERVED}, | ||
367 | {"start", START, NORID, RESERVED}, | ||
368 | {"REF", REF, NORID, RESERVED}, | ||
369 | {"return", RETURN, NORID, RESERVED}, | ||
370 | {"NOT", NOT, NORID, RESERVED}, | ||
371 | {"assert", ASSERT, NORID, RESERVED}, | ||
372 | {"ORIF", ORIF, NORID, RESERVED}, | ||
373 | {"returns", RETURNS, NORID, RESERVED}, | ||
374 | {"chars", CHARS, NORID, RESERVED}, | ||
375 | {"nonref", NONREF, NORID, RESERVED}, | ||
376 | {"far", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
377 | {"do", DO, NORID, RESERVED}, | ||
378 | {"nolist", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
379 | {"esac", ESAC, NORID, RESERVED}, | ||
380 | {"FOR", FOR, NORID, RESERVED}, | ||
381 | {"static", STATIC, NORID, RESERVED}, | ||
382 | {"loc", LOC, NORID, RESERVED}, | ||
383 | {"process", PROCESS, NORID, RESERVED}, | ||
384 | {"struct", STRUCT, NORID, RESERVED}, | ||
385 | {"if", IF, NORID, RESERVED}, | ||
386 | {"of", OF, NORID, RESERVED}, | ||
387 | {"result", RESULT, NORID, RESERVED}, | ||
388 | {"and", AND, NORID, RESERVED}, | ||
389 | {"inline", INLINE, RID_INLINE, RESERVED}, | ||
390 | {"goto", GOTO, NORID, RESERVED}, | ||
391 | {"send", SEND, NORID, RESERVED}, | ||
392 | {"end", END, NORID, RESERVED}, | ||
393 | {"reentrant", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
394 | {"POS", POS, NORID, RESERVED}, | ||
395 | {"andif", ANDIF, NORID, RESERVED}, | ||
396 | {"read", READ, RID_READ, RESERVED}, | ||
397 | {"INOUT", PARAMATTR, RID_INOUT, RESERVED}, | ||
398 | {"continue", CONTINUE, NORID, RESERVED}, | ||
399 | {"UP", UP, NORID, RESERVED}, | ||
400 | {"FAR", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
401 | {"bools", BOOLS, RID_BOOLS, RESERVED}, | ||
402 | {"case", CASE, NORID, RESERVED}, | ||
403 | {"OD", OD, NORID, RESERVED}, | ||
404 | {"up", UP, NORID, RESERVED}, | ||
405 | {"AT", AT, NORID, RESERVED}, | ||
406 | {"region", REGION, NORID, RESERVED}, | ||
407 | {"grant", GRANT, NORID, RESERVED}, | ||
408 | {"THEN", THEN, NORID, RESERVED}, | ||
409 | {"small", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
410 | {"ccitt_os", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
411 | {"cause", CAUSE, NORID, RESERVED}, | ||
412 | {"RETURN", RETURN, NORID, RESERVED}, | ||
413 | {"STOP", STOP, NORID, RESERVED}, | ||
414 | {"after", AFTER, NORID, RESERVED}, | ||
415 | {"rem", REM, NORID, RESERVED}, | ||
416 | {"asm", ASM_KEYWORD, NORID, RESERVED}, | ||
417 | {"forbid", FORBID, NORID, RESERVED}, | ||
418 | {"exit", EXIT, NORID, RESERVED}, | ||
419 | {"state_routine", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
420 | {"priority", PRIORITY, NORID, RESERVED}, | ||
421 | {"access", ACCESS, NORID, RESERVED}, | ||
422 | {"RETURNS", RETURNS, NORID, RESERVED}, | ||
423 | {"begin", BEGINTOKEN, NORID, RESERVED}, | ||
424 | {"spec", SPEC, NORID, RESERVED}, | ||
425 | {"page", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
426 | {"elsif", ELSIF, NORID, RESERVED}, | ||
427 | {"TEXT", TEXT, NORID, RESERVED}, | ||
428 | {"START", START, NORID, RESERVED}, | ||
429 | {"array", ARRAY, NORID, RESERVED}, | ||
430 | {"remote", REMOTE, NORID, RESERVED}, | ||
431 | {"PROC", PROC, NORID, RESERVED}, | ||
432 | {"call", CALL, NORID, RESERVED}, | ||
433 | {"else", ELSE, NORID, RESERVED}, | ||
434 | {"DO", DO, NORID, RESERVED}, | ||
435 | {"print_o_code", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
436 | {"range", RANGE, NORID, RESERVED}, | ||
437 | {"dcl", DCL, NORID, RESERVED}, | ||
438 | {"all", ALL, NORID, RESERVED}, | ||
439 | {"empty_on", EMPTY_ON, NORID, DIRECTIVE}, | ||
440 | {"XOR", XOR, NORID, RESERVED}, | ||
441 | {"empty_off", EMPTY_OFF, NORID, DIRECTIVE}, | ||
442 | {"SEND", SEND, NORID, RESERVED}, | ||
443 | {"mod", MOD, NORID, RESERVED}, | ||
444 | {"REM", REM, NORID, RESERVED}, | ||
445 | {"general", GENERAL, NORID, RESERVED}, | ||
446 | {"NONREF", NONREF, NORID, RESERVED}, | ||
447 | {"CHARS", CHARS, NORID, RESERVED}, | ||
448 | {"based", BASED, NORID, RESERVED}, | ||
449 | {"IF", IF, NORID, RESERVED}, | ||
450 | {"range_on", RANGE_ON, NORID, DIRECTIVE}, | ||
451 | {"range_off", RANGE_OFF, NORID, DIRECTIVE}, | ||
452 | {"STEP", STEP, NORID, RESERVED}, | ||
453 | {"large", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
454 | {"reentrant_all", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
455 | {"ASSERT", ASSERT, NORID, RESERVED}, | ||
456 | {"PACK", PACK, NORID, RESERVED}, | ||
457 | {"OF", OF, NORID, RESERVED}, | ||
458 | {"AND", AND, NORID, RESERVED}, | ||
459 | {"ROW", ROW, NORID, RESERVED}, | ||
460 | {"EXIT", EXIT, NORID, RESERVED}, | ||
461 | {"exceptions", EXCEPTIONS, NORID, RESERVED}, | ||
462 | {"ASM", ASM_KEYWORD, NORID, RESERVED}, | ||
463 | {"out", PARAMATTR, RID_OUT, RESERVED}, | ||
464 | {"PRIORITY", PRIORITY, NORID, RESERVED}, | ||
465 | {"short_pred_succ", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
466 | {"syn", SYN, NORID, RESERVED}, | ||
467 | {"process_type", PROCESS_TYPE_TOKEN, NORID, DIRECTIVE}, | ||
468 | {"READ", READ, RID_READ, RESERVED}, | ||
469 | {"BUFFER", BUFFER, NORID, RESERVED}, | ||
470 | {"body", BODY, NORID, RESERVED}, | ||
471 | {"ANDIF", ANDIF, NORID, RESERVED}, | ||
472 | {"STATIC", STATIC, NORID, RESERVED}, | ||
473 | {"NOLIST", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
474 | {"nopack", NOPACK, NORID, RESERVED}, | ||
475 | {"STRUCT", STRUCT, NORID, RESERVED}, | ||
476 | {"END", END, NORID, RESERVED}, | ||
477 | {"delay", DELAY, NORID, RESERVED}, | ||
478 | {"seize", SEIZE, NORID, RESERVED}, | ||
479 | {"REENTRANT", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
480 | {"ESAC", ESAC, NORID, RESERVED}, | ||
481 | {"NOPACK", NOPACK, NORID, RESERVED}, | ||
482 | {"SPEC", SPEC, NORID, RESERVED}, | ||
483 | {"GOTO", GOTO, NORID, RESERVED}, | ||
484 | {"pack", PACK, NORID, RESERVED}, | ||
485 | {"by", BY, NORID, RESERVED}, | ||
486 | {"REGION", REGION, NORID, RESERVED}, | ||
487 | {"SYN", SYN, NORID, RESERVED}, | ||
488 | {"module", MODULE, NORID, RESERVED}, | ||
489 | {"RESULT", RESULT, NORID, RESERVED}, | ||
490 | {"CASE", CASE, NORID, RESERVED}, | ||
491 | {"all_static_on", ALL_STATIC_ON, NORID, DIRECTIVE}, | ||
492 | {"ARRAY", ARRAY, NORID, RESERVED}, | ||
493 | {"all_static_off", ALL_STATIC_OFF, NORID, DIRECTIVE}, | ||
494 | {"FORBID", FORBID, NORID, RESERVED}, | ||
495 | {"LOC", LOC, NORID, RESERVED}, | ||
496 | {"INLINE", INLINE, RID_INLINE, RESERVED}, | ||
497 | {"ELSIF", ELSIF, NORID, RESERVED}, | ||
498 | {"CCITT_OS", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
499 | {"row", ROW, NORID, RESERVED}, | ||
500 | {"GRANT", GRANT, NORID, RESERVED}, | ||
501 | {"BEGIN", BEGINTOKEN, NORID, RESERVED}, | ||
502 | {"BOOLS", BOOLS, RID_BOOLS, RESERVED}, | ||
503 | {"PROCESS", PROCESS, NORID, RESERVED}, | ||
504 | {"BY", BY, NORID, RESERVED}, | ||
505 | {"EMPTY_ON", EMPTY_ON, NORID, DIRECTIVE}, | ||
506 | {"REMOTE", REMOTE, NORID, RESERVED}, | ||
507 | {"receive", RECEIVE, NORID, RESERVED}, | ||
508 | {"CONTINUE", CONTINUE, NORID, RESERVED}, | ||
509 | {"buffer", BUFFER, NORID, RESERVED}, | ||
510 | {"debug_lines", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
511 | {"FI", FI, NORID, RESERVED}, | ||
512 | {"recursive", RECURSIVE, NORID, RESERVED}, | ||
513 | {"MOD", MOD, NORID, RESERVED}, | ||
514 | {"CAUSE", CAUSE, NORID, RESERVED}, | ||
515 | {"EMPTY_OFF", EMPTY_OFF, NORID, DIRECTIVE}, | ||
516 | {"medium", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
517 | {"RECURSIVE", RECURSIVE, NORID, RESERVED}, | ||
518 | {"RECEIVE", RECEIVE, NORID, RESERVED}, | ||
519 | {"ever", EVER, NORID, RESERVED}, | ||
520 | {"cycle", CYCLE, NORID, RESERVED}, | ||
521 | {"even", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
522 | {"only_for_target", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
523 | {"event", EVENT, NORID, RESERVED}, | ||
524 | {"DOWN", DOWN, NORID, RESERVED}, | ||
525 | {"extra_const_seg", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
526 | {"powerset", POWERSET, NORID, RESERVED}, | ||
527 | {"while", WHILE, NORID, RESERVED}, | ||
528 | {"BODY", BODY, NORID, RESERVED}, | ||
529 | {"fi", FI, NORID, RESERVED}, | ||
530 | {"EVEN", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
531 | {"ELSE", ELSE, NORID, RESERVED}, | ||
532 | {"down", DOWN, NORID, RESERVED}, | ||
533 | {"EVER", EVER, NORID, RESERVED}, | ||
534 | {"EVENT", EVENT, NORID, RESERVED}, | ||
535 | {"ALL", ALL, NORID, RESERVED}, | ||
536 | {"SEIZE", SEIZE, NORID, RESERVED}, | ||
537 | {"AFTER", AFTER, NORID, RESERVED}, | ||
538 | {"CONTEXT", CONTEXT, NORID, RESERVED}, | ||
539 | {"BIT", BOOLS, RID_BOOLS, PREDEF}, | ||
540 | {"debug_types", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
541 | {"xor", XOR, NORID, RESERVED}, | ||
542 | {"text", TEXT, NORID, RESERVED}, | ||
543 | {"BIN", BIN, NORID, RESERVED}, | ||
544 | {"BASED", BASED, NORID, RESERVED}, | ||
545 | {"RANGE", RANGE, NORID, RESERVED}, | ||
546 | {"PAGE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
547 | {"generate_set_names", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
548 | {"use_seize_file", USE_SEIZE_FILE, NORID, DIRECTIVE}, | ||
549 | {"list", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
550 | {"bit", BOOLS, RID_BOOLS, PREDEF}, | ||
551 | {"SMALL", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
552 | {"bin", BIN, NORID, RESERVED}, | ||
553 | {"WHILE", WHILE, NORID, RESERVED}, | ||
554 | {"ACCESS", ACCESS, NORID, RESERVED}, | ||
555 | {"DCL", DCL, NORID, RESERVED}, | ||
556 | {"RANGE_ON", RANGE_ON, NORID, DIRECTIVE}, | ||
557 | {"VARYING", VARYING, NORID, RESERVED}, | ||
558 | {"only_for_simulation", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
559 | {"synmode", SYNMODE, NORID, RESERVED}, | ||
560 | {"context", CONTEXT, NORID, RESERVED}, | ||
561 | {"buffer_code", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
562 | {"RANGE_OFF", RANGE_OFF, NORID, DIRECTIVE}, | ||
563 | {"STATE_ROUTINE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
564 | {"grant_file_size", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
565 | {"PRINT_O_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
566 | {"dynamic", DYNAMIC, RID_DYNAMIC, RESERVED}, | ||
567 | {"optimize", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
568 | {"POWERSET", POWERSET, NORID, RESERVED}, | ||
569 | {"CALL", CALL, NORID, RESERVED}, | ||
570 | {"event_code", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
571 | {"WITH", WITH, NORID, RESERVED}, | ||
572 | {"DELAY", DELAY, NORID, RESERVED}, | ||
573 | {"LIST", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
574 | {"varying", VARYING, NORID, RESERVED}, | ||
575 | {"EXCEPTIONS", EXCEPTIONS, NORID, RESERVED}, | ||
576 | {"prefixed", PREFIXED, NORID, RESERVED}, | ||
577 | {"signal", SIGNAL, NORID, RESERVED}, | ||
578 | {"generate_all_set_names", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
579 | {"newmode", NEWMODE, NORID, RESERVED}, | ||
580 | {"MEDIUM", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
581 | {"timeout", TIMEOUT, NORID, RESERVED}, | ||
582 | {"print_symbol_table", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
583 | {"PREFIXED", PREFIXED, NORID, RESERVED}, | ||
584 | {"LARGE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
585 | {"simple", SIMPLE, NORID, RESERVED}, | ||
586 | {"GENERAL", GENERAL, NORID, RESERVED}, | ||
587 | {"send_buffer_default_priority", SEND_BUFFER_DEFAULT_PRIORITY, NORID, DIRECTIVE}, | ||
588 | {"PROCESS_TYPE", PROCESS_TYPE_TOKEN, NORID, DIRECTIVE}, | ||
589 | {"OPTIMIZE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
590 | {"debug_symbols", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
591 | {"BUFFER_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
592 | {"use_seize_file_restricted", USE_SEIZE_FILE_RESTRICTED, NORID, DIRECTIVE}, | ||
593 | {"NEWMODE", NEWMODE, NORID, RESERVED}, | ||
594 | {"send_signal_default_priority", SEND_SIGNAL_DEFAULT_PRIORITY, NORID, DIRECTIVE}, | ||
595 | {"no_overlap_check", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
596 | {"ALL_STATIC_ON", ALL_STATIC_ON, NORID, DIRECTIVE}, | ||
597 | {"support_causing_address", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
598 | {"SHORT_PRED_SUCC", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
599 | {"MODULE", MODULE, NORID, RESERVED}, | ||
600 | {"REENTRANT_ALL", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
601 | {"TIMEOUT", TIMEOUT, NORID, RESERVED}, | ||
602 | {"ALL_STATIC_OFF", ALL_STATIC_OFF, NORID, DIRECTIVE}, | ||
603 | {"with", WITH, NORID, RESERVED}, | ||
604 | {"signal_code", SIGNAL_CODE, NORID, DIRECTIVE}, | ||
605 | {"multiple_const_segs", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
606 | {"optimize_runtime", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
607 | {"CYCLE", CYCLE, NORID, RESERVED}, | ||
608 | {"SYNMODE", SYNMODE, NORID, RESERVED}, | ||
609 | {"multiple_data_segs", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
610 | {"DYNAMIC", DYNAMIC, RID_DYNAMIC, RESERVED}, | ||
611 | {"EVENT_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
612 | {"SIGNAL", SIGNAL, NORID, RESERVED}, | ||
613 | {"DEBUG_TYPES", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
614 | {"ONLY_FOR_TARGET", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
615 | {"SIMPLE", SIMPLE, NORID, RESERVED}, | ||
616 | {"DEBUG_LINES", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
617 | {"NO_OVERLAP_CHECK", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
618 | {"EXTRA_CONST_SEG", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
619 | {"ONLY_FOR_SIMULATION", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
620 | {"make_publics_for_discrete_syns", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
621 | {"USE_SEIZE_FILE", USE_SEIZE_FILE, NORID, DIRECTIVE}, | ||
622 | {"OPTIMIZE_RUNTIME", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
623 | {"GRANT_FILE_SIZE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
624 | {"GENERATE_SET_NAMES", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
625 | {"PRINT_SYMBOL_TABLE", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
626 | {"DEBUG_SYMBOLS", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
627 | {"OPTIMIZATION_WINDOW", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
628 | {"SIGNAL_CODE", SIGNAL_CODE, NORID, DIRECTIVE}, | ||
629 | {"SUPPORT_CAUSING_ADDRESS", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
630 | {"MULTIPLE_CONST_SEGS", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
631 | {"optimization_window", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
632 | {"signal_max_length", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
633 | {"SEND_BUFFER_DEFAULT_PRIORITY", SEND_BUFFER_DEFAULT_PRIORITY, NORID, DIRECTIVE}, | ||
634 | {"MULTIPLE_DATA_SEGS", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
635 | {"GENERATE_ALL_SET_NAMES", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
636 | {"USE_SEIZE_FILE_RESTRICTED", USE_SEIZE_FILE_RESTRICTED, NORID, DIRECTIVE}, | ||
637 | {"SEND_SIGNAL_DEFAULT_PRIORITY", SEND_SIGNAL_DEFAULT_PRIORITY, NORID, DIRECTIVE}, | ||
638 | {"MAKE_PUBLICS_FOR_DISCRETE_SYNS", IGNORED_DIRECTIVE, NORID, DIRECTIVE}, | ||
639 | {"SIGNAL_MAX_LENGTH", IGNORED_DIRECTIVE, NORID, DIRECTIVE} | ||
640 | }; | ||
641 | |||
642 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
643 | { | ||
644 | register unsigned int key = hash (str, len); | ||
645 | |||
646 | if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) | ||
647 | { | ||
648 | register struct resword *resword; | ||
649 | |||
650 | switch (key - 4) | ||
651 | { | ||
652 | case 0: | ||
653 | resword = &wordlist[0]; | ||
654 | goto compare; | ||
655 | case 1: | ||
656 | resword = &wordlist[1]; | ||
657 | goto compare; | ||
658 | case 2: | ||
659 | resword = &wordlist[2]; | ||
660 | goto compare; | ||
661 | case 3: | ||
662 | resword = &wordlist[3]; | ||
663 | goto compare; | ||
664 | case 4: | ||
665 | resword = &wordlist[4]; | ||
666 | goto compare; | ||
667 | case 5: | ||
668 | resword = &wordlist[5]; | ||
669 | goto compare; | ||
670 | case 6: | ||
671 | resword = &wordlist[6]; | ||
672 | goto compare; | ||
673 | case 7: | ||
674 | resword = &wordlist[7]; | ||
675 | goto compare; | ||
676 | case 8: | ||
677 | resword = &wordlist[8]; | ||
678 | goto compare; | ||
679 | case 9: | ||
680 | resword = &wordlist[9]; | ||
681 | goto compare; | ||
682 | case 10: | ||
683 | resword = &wordlist[10]; | ||
684 | goto compare; | ||
685 | case 11: | ||
686 | resword = &wordlist[11]; | ||
687 | goto compare; | ||
688 | case 12: | ||
689 | resword = &wordlist[12]; | ||
690 | goto compare; | ||
691 | case 14: | ||
692 | resword = &wordlist[13]; | ||
693 | goto compare; | ||
694 | case 16: | ||
695 | resword = &wordlist[14]; | ||
696 | goto compare; | ||
697 | case 17: | ||
698 | resword = &wordlist[15]; | ||
699 | goto compare; | ||
700 | case 18: | ||
701 | resword = &wordlist[16]; | ||
702 | goto compare; | ||
703 | case 19: | ||
704 | resword = &wordlist[17]; | ||
705 | goto compare; | ||
706 | case 20: | ||
707 | resword = &wordlist[18]; | ||
708 | goto compare; | ||
709 | case 21: | ||
710 | resword = &wordlist[19]; | ||
711 | goto compare; | ||
712 | case 22: | ||
713 | resword = &wordlist[20]; | ||
714 | goto compare; | ||
715 | case 23: | ||
716 | resword = &wordlist[21]; | ||
717 | goto compare; | ||
718 | case 24: | ||
719 | resword = &wordlist[22]; | ||
720 | goto compare; | ||
721 | case 25: | ||
722 | resword = &wordlist[23]; | ||
723 | goto compare; | ||
724 | case 26: | ||
725 | resword = &wordlist[24]; | ||
726 | goto compare; | ||
727 | case 27: | ||
728 | resword = &wordlist[25]; | ||
729 | goto compare; | ||
730 | case 28: | ||
731 | resword = &wordlist[26]; | ||
732 | goto compare; | ||
733 | case 30: | ||
734 | resword = &wordlist[27]; | ||
735 | goto compare; | ||
736 | case 32: | ||
737 | resword = &wordlist[28]; | ||
738 | goto compare; | ||
739 | case 34: | ||
740 | resword = &wordlist[29]; | ||
741 | goto compare; | ||
742 | case 35: | ||
743 | resword = &wordlist[30]; | ||
744 | goto compare; | ||
745 | case 36: | ||
746 | resword = &wordlist[31]; | ||
747 | goto compare; | ||
748 | case 37: | ||
749 | resword = &wordlist[32]; | ||
750 | goto compare; | ||
751 | case 38: | ||
752 | resword = &wordlist[33]; | ||
753 | goto compare; | ||
754 | case 39: | ||
755 | resword = &wordlist[34]; | ||
756 | goto compare; | ||
757 | case 40: | ||
758 | resword = &wordlist[35]; | ||
759 | goto compare; | ||
760 | case 41: | ||
761 | resword = &wordlist[36]; | ||
762 | goto compare; | ||
763 | case 42: | ||
764 | resword = &wordlist[37]; | ||
765 | goto compare; | ||
766 | case 43: | ||
767 | resword = &wordlist[38]; | ||
768 | goto compare; | ||
769 | case 44: | ||
770 | resword = &wordlist[39]; | ||
771 | goto compare; | ||
772 | case 45: | ||
773 | resword = &wordlist[40]; | ||
774 | goto compare; | ||
775 | case 46: | ||
776 | resword = &wordlist[41]; | ||
777 | goto compare; | ||
778 | case 47: | ||
779 | resword = &wordlist[42]; | ||
780 | goto compare; | ||
781 | case 48: | ||
782 | resword = &wordlist[43]; | ||
783 | goto compare; | ||
784 | case 50: | ||
785 | resword = &wordlist[44]; | ||
786 | goto compare; | ||
787 | case 51: | ||
788 | resword = &wordlist[45]; | ||
789 | goto compare; | ||
790 | case 52: | ||
791 | resword = &wordlist[46]; | ||
792 | goto compare; | ||
793 | case 53: | ||
794 | resword = &wordlist[47]; | ||
795 | goto compare; | ||
796 | case 54: | ||
797 | resword = &wordlist[48]; | ||
798 | goto compare; | ||
799 | case 55: | ||
800 | resword = &wordlist[49]; | ||
801 | goto compare; | ||
802 | case 56: | ||
803 | resword = &wordlist[50]; | ||
804 | goto compare; | ||
805 | case 57: | ||
806 | resword = &wordlist[51]; | ||
807 | goto compare; | ||
808 | case 58: | ||
809 | resword = &wordlist[52]; | ||
810 | goto compare; | ||
811 | case 59: | ||
812 | resword = &wordlist[53]; | ||
813 | goto compare; | ||
814 | case 60: | ||
815 | resword = &wordlist[54]; | ||
816 | goto compare; | ||
817 | case 61: | ||
818 | resword = &wordlist[55]; | ||
819 | goto compare; | ||
820 | case 62: | ||
821 | resword = &wordlist[56]; | ||
822 | goto compare; | ||
823 | case 63: | ||
824 | resword = &wordlist[57]; | ||
825 | goto compare; | ||
826 | case 64: | ||
827 | resword = &wordlist[58]; | ||
828 | goto compare; | ||
829 | case 65: | ||
830 | resword = &wordlist[59]; | ||
831 | goto compare; | ||
832 | case 66: | ||
833 | resword = &wordlist[60]; | ||
834 | goto compare; | ||
835 | case 68: | ||
836 | resword = &wordlist[61]; | ||
837 | goto compare; | ||
838 | case 69: | ||
839 | resword = &wordlist[62]; | ||
840 | goto compare; | ||
841 | case 70: | ||
842 | resword = &wordlist[63]; | ||
843 | goto compare; | ||
844 | case 71: | ||
845 | resword = &wordlist[64]; | ||
846 | goto compare; | ||
847 | case 72: | ||
848 | resword = &wordlist[65]; | ||
849 | goto compare; | ||
850 | case 73: | ||
851 | resword = &wordlist[66]; | ||
852 | goto compare; | ||
853 | case 74: | ||
854 | resword = &wordlist[67]; | ||
855 | goto compare; | ||
856 | case 75: | ||
857 | resword = &wordlist[68]; | ||
858 | goto compare; | ||
859 | case 77: | ||
860 | resword = &wordlist[69]; | ||
861 | goto compare; | ||
862 | case 79: | ||
863 | resword = &wordlist[70]; | ||
864 | goto compare; | ||
865 | case 80: | ||
866 | resword = &wordlist[71]; | ||
867 | goto compare; | ||
868 | case 81: | ||
869 | resword = &wordlist[72]; | ||
870 | goto compare; | ||
871 | case 82: | ||
872 | resword = &wordlist[73]; | ||
873 | goto compare; | ||
874 | case 83: | ||
875 | resword = &wordlist[74]; | ||
876 | goto compare; | ||
877 | case 86: | ||
878 | resword = &wordlist[75]; | ||
879 | goto compare; | ||
880 | case 88: | ||
881 | resword = &wordlist[76]; | ||
882 | goto compare; | ||
883 | case 89: | ||
884 | resword = &wordlist[77]; | ||
885 | goto compare; | ||
886 | case 91: | ||
887 | resword = &wordlist[78]; | ||
888 | goto compare; | ||
889 | case 92: | ||
890 | resword = &wordlist[79]; | ||
891 | goto compare; | ||
892 | case 93: | ||
893 | resword = &wordlist[80]; | ||
894 | goto compare; | ||
895 | case 94: | ||
896 | resword = &wordlist[81]; | ||
897 | goto compare; | ||
898 | case 95: | ||
899 | resword = &wordlist[82]; | ||
900 | goto compare; | ||
901 | case 98: | ||
902 | resword = &wordlist[83]; | ||
903 | goto compare; | ||
904 | case 99: | ||
905 | resword = &wordlist[84]; | ||
906 | goto compare; | ||
907 | case 100: | ||
908 | resword = &wordlist[85]; | ||
909 | goto compare; | ||
910 | case 101: | ||
911 | resword = &wordlist[86]; | ||
912 | goto compare; | ||
913 | case 102: | ||
914 | resword = &wordlist[87]; | ||
915 | goto compare; | ||
916 | case 103: | ||
917 | resword = &wordlist[88]; | ||
918 | goto compare; | ||
919 | case 104: | ||
920 | resword = &wordlist[89]; | ||
921 | goto compare; | ||
922 | case 106: | ||
923 | resword = &wordlist[90]; | ||
924 | goto compare; | ||
925 | case 107: | ||
926 | resword = &wordlist[91]; | ||
927 | goto compare; | ||
928 | case 108: | ||
929 | resword = &wordlist[92]; | ||
930 | goto compare; | ||
931 | case 109: | ||
932 | resword = &wordlist[93]; | ||
933 | goto compare; | ||
934 | case 110: | ||
935 | resword = &wordlist[94]; | ||
936 | goto compare; | ||
937 | case 111: | ||
938 | resword = &wordlist[95]; | ||
939 | goto compare; | ||
940 | case 112: | ||
941 | resword = &wordlist[96]; | ||
942 | goto compare; | ||
943 | case 113: | ||
944 | resword = &wordlist[97]; | ||
945 | goto compare; | ||
946 | case 115: | ||
947 | resword = &wordlist[98]; | ||
948 | goto compare; | ||
949 | case 116: | ||
950 | resword = &wordlist[99]; | ||
951 | goto compare; | ||
952 | case 117: | ||
953 | resword = &wordlist[100]; | ||
954 | goto compare; | ||
955 | case 118: | ||
956 | resword = &wordlist[101]; | ||
957 | goto compare; | ||
958 | case 120: | ||
959 | resword = &wordlist[102]; | ||
960 | goto compare; | ||
961 | case 121: | ||
962 | resword = &wordlist[103]; | ||
963 | goto compare; | ||
964 | case 122: | ||
965 | resword = &wordlist[104]; | ||
966 | goto compare; | ||
967 | case 123: | ||
968 | resword = &wordlist[105]; | ||
969 | goto compare; | ||
970 | case 125: | ||
971 | resword = &wordlist[106]; | ||
972 | goto compare; | ||
973 | case 126: | ||
974 | resword = &wordlist[107]; | ||
975 | goto compare; | ||
976 | case 127: | ||
977 | resword = &wordlist[108]; | ||
978 | goto compare; | ||
979 | case 128: | ||
980 | resword = &wordlist[109]; | ||
981 | goto compare; | ||
982 | case 129: | ||
983 | resword = &wordlist[110]; | ||
984 | goto compare; | ||
985 | case 131: | ||
986 | resword = &wordlist[111]; | ||
987 | goto compare; | ||
988 | case 132: | ||
989 | resword = &wordlist[112]; | ||
990 | goto compare; | ||
991 | case 133: | ||
992 | resword = &wordlist[113]; | ||
993 | goto compare; | ||
994 | case 134: | ||
995 | resword = &wordlist[114]; | ||
996 | goto compare; | ||
997 | case 135: | ||
998 | resword = &wordlist[115]; | ||
999 | goto compare; | ||
1000 | case 136: | ||
1001 | resword = &wordlist[116]; | ||
1002 | goto compare; | ||
1003 | case 137: | ||
1004 | resword = &wordlist[117]; | ||
1005 | goto compare; | ||
1006 | case 138: | ||
1007 | resword = &wordlist[118]; | ||
1008 | goto compare; | ||
1009 | case 139: | ||
1010 | resword = &wordlist[119]; | ||
1011 | goto compare; | ||
1012 | case 142: | ||
1013 | resword = &wordlist[120]; | ||
1014 | goto compare; | ||
1015 | case 143: | ||
1016 | resword = &wordlist[121]; | ||
1017 | goto compare; | ||
1018 | case 144: | ||
1019 | resword = &wordlist[122]; | ||
1020 | goto compare; | ||
1021 | case 145: | ||
1022 | resword = &wordlist[123]; | ||
1023 | goto compare; | ||
1024 | case 146: | ||
1025 | resword = &wordlist[124]; | ||
1026 | goto compare; | ||
1027 | case 147: | ||
1028 | resword = &wordlist[125]; | ||
1029 | goto compare; | ||
1030 | case 148: | ||
1031 | resword = &wordlist[126]; | ||
1032 | goto compare; | ||
1033 | case 149: | ||
1034 | resword = &wordlist[127]; | ||
1035 | goto compare; | ||
1036 | case 150: | ||
1037 | resword = &wordlist[128]; | ||
1038 | goto compare; | ||
1039 | case 151: | ||
1040 | resword = &wordlist[129]; | ||
1041 | goto compare; | ||
1042 | case 152: | ||
1043 | resword = &wordlist[130]; | ||
1044 | goto compare; | ||
1045 | case 153: | ||
1046 | resword = &wordlist[131]; | ||
1047 | goto compare; | ||
1048 | case 154: | ||
1049 | resword = &wordlist[132]; | ||
1050 | goto compare; | ||
1051 | case 155: | ||
1052 | resword = &wordlist[133]; | ||
1053 | goto compare; | ||
1054 | case 156: | ||
1055 | resword = &wordlist[134]; | ||
1056 | goto compare; | ||
1057 | case 157: | ||
1058 | resword = &wordlist[135]; | ||
1059 | goto compare; | ||
1060 | case 159: | ||
1061 | resword = &wordlist[136]; | ||
1062 | goto compare; | ||
1063 | case 161: | ||
1064 | resword = &wordlist[137]; | ||
1065 | goto compare; | ||
1066 | case 162: | ||
1067 | resword = &wordlist[138]; | ||
1068 | goto compare; | ||
1069 | case 163: | ||
1070 | resword = &wordlist[139]; | ||
1071 | goto compare; | ||
1072 | case 164: | ||
1073 | resword = &wordlist[140]; | ||
1074 | goto compare; | ||
1075 | case 165: | ||
1076 | resword = &wordlist[141]; | ||
1077 | goto compare; | ||
1078 | case 166: | ||
1079 | resword = &wordlist[142]; | ||
1080 | goto compare; | ||
1081 | case 167: | ||
1082 | resword = &wordlist[143]; | ||
1083 | goto compare; | ||
1084 | case 169: | ||
1085 | resword = &wordlist[144]; | ||
1086 | goto compare; | ||
1087 | case 170: | ||
1088 | resword = &wordlist[145]; | ||
1089 | goto compare; | ||
1090 | case 173: | ||
1091 | resword = &wordlist[146]; | ||
1092 | goto compare; | ||
1093 | case 175: | ||
1094 | resword = &wordlist[147]; | ||
1095 | goto compare; | ||
1096 | case 176: | ||
1097 | resword = &wordlist[148]; | ||
1098 | goto compare; | ||
1099 | case 177: | ||
1100 | resword = &wordlist[149]; | ||
1101 | goto compare; | ||
1102 | case 178: | ||
1103 | resword = &wordlist[150]; | ||
1104 | goto compare; | ||
1105 | case 179: | ||
1106 | resword = &wordlist[151]; | ||
1107 | goto compare; | ||
1108 | case 180: | ||
1109 | resword = &wordlist[152]; | ||
1110 | goto compare; | ||
1111 | case 181: | ||
1112 | resword = &wordlist[153]; | ||
1113 | goto compare; | ||
1114 | case 183: | ||
1115 | resword = &wordlist[154]; | ||
1116 | goto compare; | ||
1117 | case 184: | ||
1118 | resword = &wordlist[155]; | ||
1119 | goto compare; | ||
1120 | case 188: | ||
1121 | resword = &wordlist[156]; | ||
1122 | goto compare; | ||
1123 | case 189: | ||
1124 | resword = &wordlist[157]; | ||
1125 | goto compare; | ||
1126 | case 190: | ||
1127 | resword = &wordlist[158]; | ||
1128 | goto compare; | ||
1129 | case 191: | ||
1130 | resword = &wordlist[159]; | ||
1131 | goto compare; | ||
1132 | case 194: | ||
1133 | resword = &wordlist[160]; | ||
1134 | goto compare; | ||
1135 | case 195: | ||
1136 | resword = &wordlist[161]; | ||
1137 | goto compare; | ||
1138 | case 196: | ||
1139 | resword = &wordlist[162]; | ||
1140 | goto compare; | ||
1141 | case 197: | ||
1142 | resword = &wordlist[163]; | ||
1143 | goto compare; | ||
1144 | case 198: | ||
1145 | resword = &wordlist[164]; | ||
1146 | goto compare; | ||
1147 | case 200: | ||
1148 | resword = &wordlist[165]; | ||
1149 | goto compare; | ||
1150 | case 201: | ||
1151 | resword = &wordlist[166]; | ||
1152 | goto compare; | ||
1153 | case 203: | ||
1154 | resword = &wordlist[167]; | ||
1155 | goto compare; | ||
1156 | case 204: | ||
1157 | resword = &wordlist[168]; | ||
1158 | goto compare; | ||
1159 | case 205: | ||
1160 | resword = &wordlist[169]; | ||
1161 | goto compare; | ||
1162 | case 207: | ||
1163 | resword = &wordlist[170]; | ||
1164 | goto compare; | ||
1165 | case 208: | ||
1166 | resword = &wordlist[171]; | ||
1167 | goto compare; | ||
1168 | case 209: | ||
1169 | resword = &wordlist[172]; | ||
1170 | goto compare; | ||
1171 | case 212: | ||
1172 | resword = &wordlist[173]; | ||
1173 | goto compare; | ||
1174 | case 213: | ||
1175 | resword = &wordlist[174]; | ||
1176 | goto compare; | ||
1177 | case 215: | ||
1178 | resword = &wordlist[175]; | ||
1179 | goto compare; | ||
1180 | case 216: | ||
1181 | resword = &wordlist[176]; | ||
1182 | goto compare; | ||
1183 | case 217: | ||
1184 | resword = &wordlist[177]; | ||
1185 | goto compare; | ||
1186 | case 218: | ||
1187 | resword = &wordlist[178]; | ||
1188 | goto compare; | ||
1189 | case 219: | ||
1190 | resword = &wordlist[179]; | ||
1191 | goto compare; | ||
1192 | case 220: | ||
1193 | resword = &wordlist[180]; | ||
1194 | goto compare; | ||
1195 | case 221: | ||
1196 | resword = &wordlist[181]; | ||
1197 | goto compare; | ||
1198 | case 222: | ||
1199 | resword = &wordlist[182]; | ||
1200 | goto compare; | ||
1201 | case 223: | ||
1202 | resword = &wordlist[183]; | ||
1203 | goto compare; | ||
1204 | case 225: | ||
1205 | resword = &wordlist[184]; | ||
1206 | goto compare; | ||
1207 | case 227: | ||
1208 | resword = &wordlist[185]; | ||
1209 | goto compare; | ||
1210 | case 229: | ||
1211 | resword = &wordlist[186]; | ||
1212 | goto compare; | ||
1213 | case 231: | ||
1214 | resword = &wordlist[187]; | ||
1215 | goto compare; | ||
1216 | case 232: | ||
1217 | resword = &wordlist[188]; | ||
1218 | goto compare; | ||
1219 | case 234: | ||
1220 | resword = &wordlist[189]; | ||
1221 | goto compare; | ||
1222 | case 235: | ||
1223 | resword = &wordlist[190]; | ||
1224 | goto compare; | ||
1225 | case 236: | ||
1226 | resword = &wordlist[191]; | ||
1227 | goto compare; | ||
1228 | case 237: | ||
1229 | resword = &wordlist[192]; | ||
1230 | goto compare; | ||
1231 | case 238: | ||
1232 | resword = &wordlist[193]; | ||
1233 | goto compare; | ||
1234 | case 240: | ||
1235 | resword = &wordlist[194]; | ||
1236 | goto compare; | ||
1237 | case 242: | ||
1238 | resword = &wordlist[195]; | ||
1239 | goto compare; | ||
1240 | case 243: | ||
1241 | resword = &wordlist[196]; | ||
1242 | goto compare; | ||
1243 | case 245: | ||
1244 | resword = &wordlist[197]; | ||
1245 | goto compare; | ||
1246 | case 246: | ||
1247 | resword = &wordlist[198]; | ||
1248 | goto compare; | ||
1249 | case 247: | ||
1250 | resword = &wordlist[199]; | ||
1251 | goto compare; | ||
1252 | case 248: | ||
1253 | resword = &wordlist[200]; | ||
1254 | goto compare; | ||
1255 | case 249: | ||
1256 | resword = &wordlist[201]; | ||
1257 | goto compare; | ||
1258 | case 250: | ||
1259 | resword = &wordlist[202]; | ||
1260 | goto compare; | ||
1261 | case 251: | ||
1262 | resword = &wordlist[203]; | ||
1263 | goto compare; | ||
1264 | case 253: | ||
1265 | resword = &wordlist[204]; | ||
1266 | goto compare; | ||
1267 | case 254: | ||
1268 | resword = &wordlist[205]; | ||
1269 | goto compare; | ||
1270 | case 258: | ||
1271 | resword = &wordlist[206]; | ||
1272 | goto compare; | ||
1273 | case 261: | ||
1274 | resword = &wordlist[207]; | ||
1275 | goto compare; | ||
1276 | case 263: | ||
1277 | resword = &wordlist[208]; | ||
1278 | goto compare; | ||
1279 | case 264: | ||
1280 | resword = &wordlist[209]; | ||
1281 | goto compare; | ||
1282 | case 265: | ||
1283 | resword = &wordlist[210]; | ||
1284 | goto compare; | ||
1285 | case 266: | ||
1286 | resword = &wordlist[211]; | ||
1287 | goto compare; | ||
1288 | case 271: | ||
1289 | resword = &wordlist[212]; | ||
1290 | goto compare; | ||
1291 | case 273: | ||
1292 | resword = &wordlist[213]; | ||
1293 | goto compare; | ||
1294 | case 276: | ||
1295 | resword = &wordlist[214]; | ||
1296 | goto compare; | ||
1297 | case 277: | ||
1298 | resword = &wordlist[215]; | ||
1299 | goto compare; | ||
1300 | case 281: | ||
1301 | resword = &wordlist[216]; | ||
1302 | goto compare; | ||
1303 | case 282: | ||
1304 | resword = &wordlist[217]; | ||
1305 | goto compare; | ||
1306 | case 284: | ||
1307 | resword = &wordlist[218]; | ||
1308 | goto compare; | ||
1309 | case 289: | ||
1310 | resword = &wordlist[219]; | ||
1311 | goto compare; | ||
1312 | case 290: | ||
1313 | resword = &wordlist[220]; | ||
1314 | goto compare; | ||
1315 | case 293: | ||
1316 | resword = &wordlist[221]; | ||
1317 | goto compare; | ||
1318 | case 296: | ||
1319 | resword = &wordlist[222]; | ||
1320 | goto compare; | ||
1321 | case 297: | ||
1322 | resword = &wordlist[223]; | ||
1323 | goto compare; | ||
1324 | case 298: | ||
1325 | resword = &wordlist[224]; | ||
1326 | goto compare; | ||
1327 | case 299: | ||
1328 | resword = &wordlist[225]; | ||
1329 | goto compare; | ||
1330 | case 300: | ||
1331 | resword = &wordlist[226]; | ||
1332 | goto compare; | ||
1333 | case 303: | ||
1334 | resword = &wordlist[227]; | ||
1335 | goto compare; | ||
1336 | case 307: | ||
1337 | resword = &wordlist[228]; | ||
1338 | goto compare; | ||
1339 | case 308: | ||
1340 | resword = &wordlist[229]; | ||
1341 | goto compare; | ||
1342 | case 311: | ||
1343 | resword = &wordlist[230]; | ||
1344 | goto compare; | ||
1345 | case 313: | ||
1346 | resword = &wordlist[231]; | ||
1347 | goto compare; | ||
1348 | case 317: | ||
1349 | resword = &wordlist[232]; | ||
1350 | goto compare; | ||
1351 | case 318: | ||
1352 | resword = &wordlist[233]; | ||
1353 | goto compare; | ||
1354 | case 319: | ||
1355 | resword = &wordlist[234]; | ||
1356 | goto compare; | ||
1357 | case 324: | ||
1358 | resword = &wordlist[235]; | ||
1359 | goto compare; | ||
1360 | case 328: | ||
1361 | resword = &wordlist[236]; | ||
1362 | goto compare; | ||
1363 | case 334: | ||
1364 | resword = &wordlist[237]; | ||
1365 | goto compare; | ||
1366 | case 336: | ||
1367 | resword = &wordlist[238]; | ||
1368 | goto compare; | ||
1369 | case 337: | ||
1370 | resword = &wordlist[239]; | ||
1371 | goto compare; | ||
1372 | case 339: | ||
1373 | resword = &wordlist[240]; | ||
1374 | goto compare; | ||
1375 | case 341: | ||
1376 | resword = &wordlist[241]; | ||
1377 | goto compare; | ||
1378 | case 342: | ||
1379 | resword = &wordlist[242]; | ||
1380 | goto compare; | ||
1381 | case 347: | ||
1382 | resword = &wordlist[243]; | ||
1383 | goto compare; | ||
1384 | case 348: | ||
1385 | resword = &wordlist[244]; | ||
1386 | goto compare; | ||
1387 | case 358: | ||
1388 | resword = &wordlist[245]; | ||
1389 | goto compare; | ||
1390 | case 364: | ||
1391 | resword = &wordlist[246]; | ||
1392 | goto compare; | ||
1393 | case 367: | ||
1394 | resword = &wordlist[247]; | ||
1395 | goto compare; | ||
1396 | case 371: | ||
1397 | resword = &wordlist[248]; | ||
1398 | goto compare; | ||
1399 | case 373: | ||
1400 | resword = &wordlist[249]; | ||
1401 | goto compare; | ||
1402 | case 378: | ||
1403 | resword = &wordlist[250]; | ||
1404 | goto compare; | ||
1405 | case 380: | ||
1406 | resword = &wordlist[251]; | ||
1407 | goto compare; | ||
1408 | case 385: | ||
1409 | resword = &wordlist[252]; | ||
1410 | goto compare; | ||
1411 | case 388: | ||
1412 | resword = &wordlist[253]; | ||
1413 | goto compare; | ||
1414 | case 398: | ||
1415 | resword = &wordlist[254]; | ||
1416 | goto compare; | ||
1417 | case 402: | ||
1418 | resword = &wordlist[255]; | ||
1419 | goto compare; | ||
1420 | case 403: | ||
1421 | resword = &wordlist[256]; | ||
1422 | goto compare; | ||
1423 | case 408: | ||
1424 | resword = &wordlist[257]; | ||
1425 | goto compare; | ||
1426 | case 411: | ||
1427 | resword = &wordlist[258]; | ||
1428 | goto compare; | ||
1429 | case 412: | ||
1430 | resword = &wordlist[259]; | ||
1431 | goto compare; | ||
1432 | case 416: | ||
1433 | resword = &wordlist[260]; | ||
1434 | goto compare; | ||
1435 | case 417: | ||
1436 | resword = &wordlist[261]; | ||
1437 | goto compare; | ||
1438 | case 418: | ||
1439 | resword = &wordlist[262]; | ||
1440 | goto compare; | ||
1441 | case 420: | ||
1442 | resword = &wordlist[263]; | ||
1443 | goto compare; | ||
1444 | case 422: | ||
1445 | resword = &wordlist[264]; | ||
1446 | goto compare; | ||
1447 | case 423: | ||
1448 | resword = &wordlist[265]; | ||
1449 | goto compare; | ||
1450 | case 432: | ||
1451 | resword = &wordlist[266]; | ||
1452 | goto compare; | ||
1453 | case 437: | ||
1454 | resword = &wordlist[267]; | ||
1455 | goto compare; | ||
1456 | case 440: | ||
1457 | resword = &wordlist[268]; | ||
1458 | goto compare; | ||
1459 | case 454: | ||
1460 | resword = &wordlist[269]; | ||
1461 | goto compare; | ||
1462 | case 456: | ||
1463 | resword = &wordlist[270]; | ||
1464 | goto compare; | ||
1465 | case 469: | ||
1466 | resword = &wordlist[271]; | ||
1467 | goto compare; | ||
1468 | case 492: | ||
1469 | resword = &wordlist[272]; | ||
1470 | goto compare; | ||
1471 | case 495: | ||
1472 | resword = &wordlist[273]; | ||
1473 | goto compare; | ||
1474 | case 501: | ||
1475 | resword = &wordlist[274]; | ||
1476 | goto compare; | ||
1477 | case 502: | ||
1478 | resword = &wordlist[275]; | ||
1479 | goto compare; | ||
1480 | case 504: | ||
1481 | resword = &wordlist[276]; | ||
1482 | goto compare; | ||
1483 | case 505: | ||
1484 | resword = &wordlist[277]; | ||
1485 | goto compare; | ||
1486 | case 509: | ||
1487 | resword = &wordlist[278]; | ||
1488 | goto compare; | ||
1489 | case 574: | ||
1490 | resword = &wordlist[279]; | ||
1491 | goto compare; | ||
1492 | case 581: | ||
1493 | resword = &wordlist[280]; | ||
1494 | goto compare; | ||
1495 | case 587: | ||
1496 | resword = &wordlist[281]; | ||
1497 | goto compare; | ||
1498 | case 607: | ||
1499 | resword = &wordlist[282]; | ||
1500 | goto compare; | ||
1501 | case 621: | ||
1502 | resword = &wordlist[283]; | ||
1503 | goto compare; | ||
1504 | case 649: | ||
1505 | resword = &wordlist[284]; | ||
1506 | goto compare; | ||
1507 | case 674: | ||
1508 | resword = &wordlist[285]; | ||
1509 | goto compare; | ||
1510 | case 680: | ||
1511 | resword = &wordlist[286]; | ||
1512 | goto compare; | ||
1513 | case 712: | ||
1514 | resword = &wordlist[287]; | ||
1515 | goto compare; | ||
1516 | case 721: | ||
1517 | resword = &wordlist[288]; | ||
1518 | goto compare; | ||
1519 | case 724: | ||
1520 | resword = &wordlist[289]; | ||
1521 | goto compare; | ||
1522 | case 741: | ||
1523 | resword = &wordlist[290]; | ||
1524 | goto compare; | ||
1525 | case 751: | ||
1526 | resword = &wordlist[291]; | ||
1527 | goto compare; | ||
1528 | case 790: | ||
1529 | resword = &wordlist[292]; | ||
1530 | goto compare; | ||
1531 | case 812: | ||
1532 | resword = &wordlist[293]; | ||
1533 | goto compare; | ||
1534 | case 817: | ||
1535 | resword = &wordlist[294]; | ||
1536 | goto compare; | ||
1537 | case 902: | ||
1538 | resword = &wordlist[295]; | ||
1539 | goto compare; | ||
1540 | case 917: | ||
1541 | resword = &wordlist[296]; | ||
1542 | goto compare; | ||
1543 | case 932: | ||
1544 | resword = &wordlist[297]; | ||
1545 | goto compare; | ||
1546 | case 981: | ||
1547 | resword = &wordlist[298]; | ||
1548 | goto compare; | ||
1549 | case 1045: | ||
1550 | resword = &wordlist[299]; | ||
1551 | goto compare; | ||
1552 | } | ||
1553 | return 0; | ||
1554 | compare: | ||
1555 | { | ||
1556 | register const char *s = resword->name; | ||
1557 | |||
1558 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
1559 | return resword; | ||
1560 | } | ||
1561 | } | ||
1562 | } | ||
1563 | return 0; | ||
1564 | } |
File tests/chill.gperf added (mode: 100644) (index 0000000..4461bdf) | |||
1 | struct resword { | ||
2 | const char *name; | ||
3 | short token; | ||
4 | enum rid rid; | ||
5 | enum toktype { RESERVED, DIRECTIVE, PREDEF } flags; | ||
6 | }; | ||
7 | extern tree ridpointers []; | ||
8 | %% | ||
9 | access, ACCESS, NORID, RESERVED | ||
10 | after, AFTER, NORID, RESERVED | ||
11 | all, ALL, NORID, RESERVED | ||
12 | all_static_off, ALL_STATIC_OFF, NORID, DIRECTIVE | ||
13 | all_static_on, ALL_STATIC_ON, NORID, DIRECTIVE | ||
14 | and, AND, NORID, RESERVED | ||
15 | andif, ANDIF, NORID, RESERVED | ||
16 | array, ARRAY, NORID, RESERVED | ||
17 | asm, ASM_KEYWORD, NORID, RESERVED | ||
18 | assert, ASSERT, NORID, RESERVED | ||
19 | at, AT, NORID, RESERVED | ||
20 | based, BASED, NORID, RESERVED | ||
21 | begin, BEGINTOKEN, NORID, RESERVED | ||
22 | bin, BIN, NORID, RESERVED | ||
23 | bit, BOOLS, RID_BOOLS, PREDEF | ||
24 | body, BODY, NORID, RESERVED | ||
25 | bools, BOOLS, RID_BOOLS, RESERVED | ||
26 | buffer, BUFFER, NORID, RESERVED | ||
27 | buffer_code, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
28 | by, BY, NORID, RESERVED | ||
29 | call, CALL, NORID, RESERVED | ||
30 | case, CASE, NORID, RESERVED | ||
31 | cause, CAUSE, NORID, RESERVED | ||
32 | ccitt_os, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
33 | chars, CHARS, NORID, RESERVED | ||
34 | context, CONTEXT, NORID, RESERVED | ||
35 | continue, CONTINUE, NORID, RESERVED | ||
36 | cycle, CYCLE, NORID, RESERVED | ||
37 | dcl, DCL, NORID, RESERVED | ||
38 | debug_lines, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
39 | debug_symbols, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
40 | debug_types, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
41 | delay, DELAY, NORID, RESERVED | ||
42 | do, DO, NORID, RESERVED | ||
43 | down, DOWN, NORID, RESERVED | ||
44 | dynamic, DYNAMIC, RID_DYNAMIC, RESERVED | ||
45 | else, ELSE, NORID, RESERVED | ||
46 | elsif, ELSIF, NORID, RESERVED | ||
47 | empty_off, EMPTY_OFF, NORID, DIRECTIVE | ||
48 | empty_on, EMPTY_ON, NORID, DIRECTIVE | ||
49 | end, END, NORID, RESERVED | ||
50 | esac, ESAC, NORID, RESERVED | ||
51 | even, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
52 | event, EVENT, NORID, RESERVED | ||
53 | event_code, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
54 | ever, EVER, NORID, RESERVED | ||
55 | exceptions, EXCEPTIONS, NORID, RESERVED | ||
56 | exit, EXIT, NORID, RESERVED | ||
57 | extra_const_seg, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
58 | far, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
59 | fi, FI, NORID, RESERVED | ||
60 | for, FOR, NORID, RESERVED | ||
61 | forbid, FORBID, NORID, RESERVED | ||
62 | general, GENERAL, NORID, RESERVED | ||
63 | generate_all_set_names, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
64 | generate_set_names, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
65 | goto, GOTO, NORID, RESERVED | ||
66 | grant, GRANT, NORID, RESERVED | ||
67 | grant_file_size, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
68 | if, IF, NORID, RESERVED | ||
69 | in, IN, RID_IN, RESERVED | ||
70 | init, INIT, NORID, RESERVED | ||
71 | inline, INLINE, RID_INLINE, RESERVED | ||
72 | inout, PARAMATTR, RID_INOUT, RESERVED | ||
73 | large, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
74 | list, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
75 | loc, LOC, NORID, RESERVED | ||
76 | make_publics_for_discrete_syns, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
77 | medium, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
78 | mod, MOD, NORID, RESERVED | ||
79 | module, MODULE, NORID, RESERVED | ||
80 | multiple_const_segs, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
81 | multiple_data_segs, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
82 | newmode, NEWMODE, NORID, RESERVED | ||
83 | nolist, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
84 | no_overlap_check, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
85 | nonref, NONREF, NORID, RESERVED | ||
86 | nopack, NOPACK, NORID, RESERVED | ||
87 | not, NOT, NORID, RESERVED | ||
88 | od, OD, NORID, RESERVED | ||
89 | of, OF, NORID, RESERVED | ||
90 | on, ON, NORID, RESERVED | ||
91 | only_for_simulation, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
92 | only_for_target, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
93 | optimize, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
94 | optimize_runtime, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
95 | optimization_window, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
96 | or, OR, NORID, RESERVED | ||
97 | orif, ORIF, NORID, RESERVED | ||
98 | out, PARAMATTR, RID_OUT, RESERVED | ||
99 | pack, PACK, NORID, RESERVED | ||
100 | page, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
101 | pos, POS, NORID, RESERVED | ||
102 | powerset, POWERSET, NORID, RESERVED | ||
103 | prefixed, PREFIXED, NORID, RESERVED | ||
104 | print_o_code, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
105 | print_symbol_table, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
106 | priority, PRIORITY, NORID, RESERVED | ||
107 | proc, PROC, NORID, RESERVED | ||
108 | process, PROCESS, NORID, RESERVED | ||
109 | process_type, PROCESS_TYPE_TOKEN, NORID, DIRECTIVE | ||
110 | range, RANGE, NORID, RESERVED | ||
111 | range_off, RANGE_OFF, NORID, DIRECTIVE | ||
112 | range_on, RANGE_ON, NORID, DIRECTIVE | ||
113 | read, READ, RID_READ, RESERVED | ||
114 | receive, RECEIVE, NORID, RESERVED | ||
115 | recursive, RECURSIVE, NORID, RESERVED | ||
116 | reentrant, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
117 | reentrant_all, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
118 | ref, REF, NORID, RESERVED | ||
119 | region, REGION, NORID, RESERVED | ||
120 | rem, REM, NORID, RESERVED | ||
121 | remote, REMOTE, NORID, RESERVED | ||
122 | result, RESULT, NORID, RESERVED | ||
123 | return, RETURN, NORID, RESERVED | ||
124 | returns, RETURNS, NORID, RESERVED | ||
125 | row, ROW, NORID, RESERVED | ||
126 | seize, SEIZE, NORID, RESERVED | ||
127 | send, SEND, NORID, RESERVED | ||
128 | send_buffer_default_priority, SEND_BUFFER_DEFAULT_PRIORITY, NORID, DIRECTIVE | ||
129 | send_signal_default_priority, SEND_SIGNAL_DEFAULT_PRIORITY, NORID, DIRECTIVE | ||
130 | set, SET, NORID, RESERVED | ||
131 | short_pred_succ, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
132 | signal, SIGNAL, NORID, RESERVED | ||
133 | signal_code, SIGNAL_CODE, NORID, DIRECTIVE | ||
134 | signal_max_length, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
135 | simple, SIMPLE, NORID, RESERVED | ||
136 | small, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
137 | spec, SPEC, NORID, RESERVED | ||
138 | start, START, NORID, RESERVED | ||
139 | state_routine, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
140 | static, STATIC, NORID, RESERVED | ||
141 | step, STEP, NORID, RESERVED | ||
142 | stop, STOP, NORID, RESERVED | ||
143 | struct, STRUCT, NORID, RESERVED | ||
144 | support_causing_address, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
145 | syn, SYN, NORID, RESERVED | ||
146 | synmode, SYNMODE, NORID, RESERVED | ||
147 | text, TEXT, NORID, RESERVED | ||
148 | then, THEN, NORID, RESERVED | ||
149 | this, THIS, NORID, RESERVED | ||
150 | timeout, TIMEOUT, NORID, RESERVED | ||
151 | to, TO, NORID, RESERVED | ||
152 | up, UP, NORID, RESERVED | ||
153 | use_seize_file, USE_SEIZE_FILE, NORID, DIRECTIVE | ||
154 | use_seize_file_restricted, USE_SEIZE_FILE_RESTRICTED, NORID, DIRECTIVE | ||
155 | varying, VARYING, NORID, RESERVED | ||
156 | while, WHILE, NORID, RESERVED | ||
157 | with, WITH, NORID, RESERVED | ||
158 | xor, XOR, NORID, RESERVED | ||
159 | ACCESS, ACCESS, NORID, RESERVED | ||
160 | AFTER, AFTER, NORID, RESERVED | ||
161 | ALL, ALL, NORID, RESERVED | ||
162 | ALL_STATIC_OFF, ALL_STATIC_OFF, NORID, DIRECTIVE | ||
163 | ALL_STATIC_ON, ALL_STATIC_ON, NORID, DIRECTIVE | ||
164 | AND, AND, NORID, RESERVED | ||
165 | ANDIF, ANDIF, NORID, RESERVED | ||
166 | ARRAY, ARRAY, NORID, RESERVED | ||
167 | ASM, ASM_KEYWORD, NORID, RESERVED | ||
168 | ASSERT, ASSERT, NORID, RESERVED | ||
169 | AT, AT, NORID, RESERVED | ||
170 | BASED, BASED, NORID, RESERVED | ||
171 | BEGIN, BEGINTOKEN, NORID, RESERVED | ||
172 | BIN, BIN, NORID, RESERVED | ||
173 | BIT, BOOLS, RID_BOOLS, PREDEF | ||
174 | BODY, BODY, NORID, RESERVED | ||
175 | BOOLS, BOOLS, RID_BOOLS, RESERVED | ||
176 | BUFFER, BUFFER, NORID, RESERVED | ||
177 | BUFFER_CODE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
178 | BY, BY, NORID, RESERVED | ||
179 | CALL, CALL, NORID, RESERVED | ||
180 | CASE, CASE, NORID, RESERVED | ||
181 | CAUSE, CAUSE, NORID, RESERVED | ||
182 | CCITT_OS, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
183 | CHARS, CHARS, NORID, RESERVED | ||
184 | CONTEXT, CONTEXT, NORID, RESERVED | ||
185 | CONTINUE, CONTINUE, NORID, RESERVED | ||
186 | CYCLE, CYCLE, NORID, RESERVED | ||
187 | DCL, DCL, NORID, RESERVED | ||
188 | DEBUG_LINES, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
189 | DEBUG_SYMBOLS, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
190 | DEBUG_TYPES, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
191 | DELAY, DELAY, NORID, RESERVED | ||
192 | DO, DO, NORID, RESERVED | ||
193 | DOWN, DOWN, NORID, RESERVED | ||
194 | DYNAMIC, DYNAMIC, RID_DYNAMIC, RESERVED | ||
195 | ELSE, ELSE, NORID, RESERVED | ||
196 | ELSIF, ELSIF, NORID, RESERVED | ||
197 | EMPTY_OFF, EMPTY_OFF, NORID, DIRECTIVE | ||
198 | EMPTY_ON, EMPTY_ON, NORID, DIRECTIVE | ||
199 | END, END, NORID, RESERVED | ||
200 | ESAC, ESAC, NORID, RESERVED | ||
201 | EVEN, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
202 | EVENT, EVENT, NORID, RESERVED | ||
203 | EVENT_CODE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
204 | EVER, EVER, NORID, RESERVED | ||
205 | EXCEPTIONS, EXCEPTIONS, NORID, RESERVED | ||
206 | EXIT, EXIT, NORID, RESERVED | ||
207 | EXTRA_CONST_SEG, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
208 | FAR, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
209 | FI, FI, NORID, RESERVED | ||
210 | FOR, FOR, NORID, RESERVED | ||
211 | FORBID, FORBID, NORID, RESERVED | ||
212 | GENERAL, GENERAL, NORID, RESERVED | ||
213 | GENERATE_ALL_SET_NAMES, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
214 | GENERATE_SET_NAMES, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
215 | GOTO, GOTO, NORID, RESERVED | ||
216 | GRANT, GRANT, NORID, RESERVED | ||
217 | GRANT_FILE_SIZE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
218 | IF, IF, NORID, RESERVED | ||
219 | IN, IN, RID_IN, RESERVED | ||
220 | INIT, INIT, NORID, RESERVED | ||
221 | INLINE, INLINE, RID_INLINE, RESERVED | ||
222 | INOUT, PARAMATTR, RID_INOUT, RESERVED | ||
223 | LARGE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
224 | LIST, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
225 | LOC, LOC, NORID, RESERVED | ||
226 | MAKE_PUBLICS_FOR_DISCRETE_SYNS, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
227 | MEDIUM, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
228 | MOD, MOD, NORID, RESERVED | ||
229 | MODULE, MODULE, NORID, RESERVED | ||
230 | MULTIPLE_CONST_SEGS, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
231 | MULTIPLE_DATA_SEGS, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
232 | NEWMODE, NEWMODE, NORID, RESERVED | ||
233 | NOLIST, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
234 | NO_OVERLAP_CHECK, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
235 | NONREF, NONREF, NORID, RESERVED | ||
236 | NOPACK, NOPACK, NORID, RESERVED | ||
237 | NOT, NOT, NORID, RESERVED | ||
238 | OD, OD, NORID, RESERVED | ||
239 | OF, OF, NORID, RESERVED | ||
240 | ON, ON, NORID, RESERVED | ||
241 | ONLY_FOR_SIMULATION, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
242 | ONLY_FOR_TARGET, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
243 | OPTIMIZE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
244 | OPTIMIZE_RUNTIME, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
245 | OPTIMIZATION_WINDOW, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
246 | OR, OR, NORID, RESERVED | ||
247 | ORIF, ORIF, NORID, RESERVED | ||
248 | OUT, PARAMATTR, RID_OUT, RESERVED | ||
249 | PACK, PACK, NORID, RESERVED | ||
250 | PAGE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
251 | POS, POS, NORID, RESERVED | ||
252 | POWERSET, POWERSET, NORID, RESERVED | ||
253 | PREFIXED, PREFIXED, NORID, RESERVED | ||
254 | PRINT_O_CODE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
255 | PRINT_SYMBOL_TABLE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
256 | PRIORITY, PRIORITY, NORID, RESERVED | ||
257 | PROC, PROC, NORID, RESERVED | ||
258 | PROCESS, PROCESS, NORID, RESERVED | ||
259 | PROCESS_TYPE, PROCESS_TYPE_TOKEN, NORID, DIRECTIVE | ||
260 | RANGE, RANGE, NORID, RESERVED | ||
261 | RANGE_OFF, RANGE_OFF, NORID, DIRECTIVE | ||
262 | RANGE_ON, RANGE_ON, NORID, DIRECTIVE | ||
263 | READ, READ, RID_READ, RESERVED | ||
264 | RECEIVE, RECEIVE, NORID, RESERVED | ||
265 | RECURSIVE, RECURSIVE, NORID, RESERVED | ||
266 | REENTRANT, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
267 | REENTRANT_ALL, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
268 | REF, REF, NORID, RESERVED | ||
269 | REGION, REGION, NORID, RESERVED | ||
270 | REM, REM, NORID, RESERVED | ||
271 | REMOTE, REMOTE, NORID, RESERVED | ||
272 | RESULT, RESULT, NORID, RESERVED | ||
273 | RETURN, RETURN, NORID, RESERVED | ||
274 | RETURNS, RETURNS, NORID, RESERVED | ||
275 | ROW, ROW, NORID, RESERVED | ||
276 | SEIZE, SEIZE, NORID, RESERVED | ||
277 | SEND, SEND, NORID, RESERVED | ||
278 | SEND_BUFFER_DEFAULT_PRIORITY, SEND_BUFFER_DEFAULT_PRIORITY, NORID, DIRECTIVE | ||
279 | SEND_SIGNAL_DEFAULT_PRIORITY, SEND_SIGNAL_DEFAULT_PRIORITY, NORID, DIRECTIVE | ||
280 | SET, SET, NORID, RESERVED | ||
281 | SHORT_PRED_SUCC, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
282 | SIGNAL, SIGNAL, NORID, RESERVED | ||
283 | SIGNAL_CODE, SIGNAL_CODE, NORID, DIRECTIVE | ||
284 | SIGNAL_MAX_LENGTH, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
285 | SIMPLE, SIMPLE, NORID, RESERVED | ||
286 | SMALL, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
287 | SPEC, SPEC, NORID, RESERVED | ||
288 | START, START, NORID, RESERVED | ||
289 | STATE_ROUTINE, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
290 | STATIC, STATIC, NORID, RESERVED | ||
291 | STEP, STEP, NORID, RESERVED | ||
292 | STOP, STOP, NORID, RESERVED | ||
293 | STRUCT, STRUCT, NORID, RESERVED | ||
294 | SUPPORT_CAUSING_ADDRESS, IGNORED_DIRECTIVE, NORID, DIRECTIVE | ||
295 | SYN, SYN, NORID, RESERVED | ||
296 | SYNMODE, SYNMODE, NORID, RESERVED | ||
297 | TEXT, TEXT, NORID, RESERVED | ||
298 | THEN, THEN, NORID, RESERVED | ||
299 | THIS, THIS, NORID, RESERVED | ||
300 | TIMEOUT, TIMEOUT, NORID, RESERVED | ||
301 | TO, TO, NORID, RESERVED | ||
302 | UP, UP, NORID, RESERVED | ||
303 | USE_SEIZE_FILE, USE_SEIZE_FILE, NORID, DIRECTIVE | ||
304 | USE_SEIZE_FILE_RESTRICTED, USE_SEIZE_FILE_RESTRICTED, NORID, DIRECTIVE | ||
305 | VARYING, VARYING, NORID, RESERVED | ||
306 | WHILE, WHILE, NORID, RESERVED | ||
307 | WITH, WITH, NORID, RESERVED | ||
308 | XOR, XOR, NORID, RESERVED |
File tests/cplusplus.exp added (mode: 100644) (index 0000000..3e4f181) | |||
1 | /* C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -L C -F ', 0, 0' -j1 -g -o -t -N is_reserved_word -k'1,4,7,$' */ | ||
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-gperf@gnu.org>." | ||
29 | #endif | ||
30 | |||
31 | |||
32 | /* Command-line: gperf -L KR-C -F ', 0, 0' -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */ | ||
33 | struct resword { const char *name; short token; enum rid rid;}; | ||
34 | |||
35 | #define TOTAL_KEYWORDS 106 | ||
36 | #define MIN_WORD_LENGTH 2 | ||
37 | #define MAX_WORD_LENGTH 16 | ||
38 | #define MIN_HASH_VALUE 4 | ||
39 | #define MAX_HASH_VALUE 163 | ||
40 | /* maximum key range = 160, duplicates = 0 */ | ||
41 | |||
42 | #ifdef __GNUC__ | ||
43 | __inline | ||
44 | #else | ||
45 | #ifdef __cplusplus | ||
46 | inline | ||
47 | #endif | ||
48 | #endif | ||
49 | static unsigned int | ||
50 | hash (str, len) | ||
51 | register const char *str; | ||
52 | register size_t len; | ||
53 | { | ||
54 | static unsigned char asso_values[] = | ||
55 | { | ||
56 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
57 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
58 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
59 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
60 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
61 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
62 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
63 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
64 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
65 | 164, 164, 164, 164, 164, 0, 164, 44, 58, 15, | ||
66 | 55, 0, 24, 23, 25, 2, 164, 4, 26, 75, | ||
67 | 36, 11, 40, 74, 14, 23, 1, 45, 45, 90, | ||
68 | 50, 50, 164, 164, 164, 164, 164, 164, 164, 164, | ||
69 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
70 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
71 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
72 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
73 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
74 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
75 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
76 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
77 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
78 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
79 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
80 | 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, | ||
81 | 164, 164, 164, 164, 164, 164 | ||
82 | }; | ||
83 | register unsigned int hval = len; | ||
84 | |||
85 | switch (hval) | ||
86 | { | ||
87 | default: | ||
88 | hval += asso_values[(unsigned char)str[6]]; | ||
89 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
90 | [[fallthrough]]; | ||
91 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
92 | __attribute__ ((__fallthrough__)); | ||
93 | #endif | ||
94 | /*FALLTHROUGH*/ | ||
95 | case 6: | ||
96 | case 5: | ||
97 | case 4: | ||
98 | hval += asso_values[(unsigned char)str[3]]; | ||
99 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
100 | [[fallthrough]]; | ||
101 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
102 | __attribute__ ((__fallthrough__)); | ||
103 | #endif | ||
104 | /*FALLTHROUGH*/ | ||
105 | case 3: | ||
106 | case 2: | ||
107 | case 1: | ||
108 | hval += asso_values[(unsigned char)str[0]]; | ||
109 | break; | ||
110 | } | ||
111 | return hval + asso_values[(unsigned char)str[len - 1]]; | ||
112 | } | ||
113 | |||
114 | struct resword * | ||
115 | is_reserved_word (str, len) | ||
116 | register const char *str; | ||
117 | register size_t len; | ||
118 | { | ||
119 | static struct resword wordlist[] = | ||
120 | { | ||
121 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
122 | {"else", ELSE, NORID,}, | ||
123 | {"true", CXX_TRUE, NORID,}, | ||
124 | {"int", TYPESPEC, RID_INT,}, | ||
125 | {"", 0, 0}, | ||
126 | {"__real__", REALPART, NORID}, | ||
127 | {"", 0, 0}, | ||
128 | {"inline", SCSPEC, RID_INLINE,}, | ||
129 | {"", 0, 0}, | ||
130 | {"__signed__", TYPESPEC, RID_SIGNED}, | ||
131 | {"", 0, 0}, | ||
132 | {"__attribute", ATTRIBUTE, NORID}, | ||
133 | {"", 0, 0}, | ||
134 | {"__attribute__", ATTRIBUTE, NORID}, | ||
135 | {"", 0, 0}, | ||
136 | {"export", SCSPEC, RID_EXPORT,}, | ||
137 | {"case", CASE, NORID,}, | ||
138 | {"__const", CV_QUALIFIER, RID_CONST}, | ||
139 | {"__const__", CV_QUALIFIER, RID_CONST}, | ||
140 | {"__volatile", CV_QUALIFIER, RID_VOLATILE}, | ||
141 | {"", 0, 0}, | ||
142 | {"__volatile__", CV_QUALIFIER, RID_VOLATILE}, | ||
143 | {"__restrict", CV_QUALIFIER, RID_RESTRICT}, | ||
144 | {"__restrict__", CV_QUALIFIER, RID_RESTRICT}, | ||
145 | {"or", OROR, NORID,}, | ||
146 | {"if", IF, NORID,}, | ||
147 | {"", 0, 0}, | ||
148 | {"__asm__", ASM_KEYWORD, NORID}, | ||
149 | {"typeof", TYPEOF, NORID,}, | ||
150 | {"__real", REALPART, NORID}, | ||
151 | {"", 0, 0}, {"", 0, 0}, | ||
152 | {"__sigof__", SIGOF, NORID /* Extension */,}, | ||
153 | {"static_cast", STATIC_CAST, NORID,}, | ||
154 | {"explicit", SCSPEC, RID_EXPLICIT,}, | ||
155 | {"register", SCSPEC, RID_REGISTER,}, | ||
156 | {"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,}, | ||
157 | {"not", '!', NORID,}, | ||
158 | {"for", FOR, NORID,}, | ||
159 | {"extern", SCSPEC, RID_EXTERN,}, | ||
160 | {"short", TYPESPEC, RID_SHORT,}, | ||
161 | {"const", CV_QUALIFIER, RID_CONST,}, | ||
162 | {"static", SCSPEC, RID_STATIC,}, | ||
163 | {"", 0, 0}, | ||
164 | {"char", TYPESPEC, RID_CHAR,}, | ||
165 | {"__complex__", TYPESPEC, RID_COMPLEX}, | ||
166 | {"goto", GOTO, NORID,}, | ||
167 | {"template", TEMPLATE, RID_TEMPLATE,}, | ||
168 | {"this", THIS, NORID,}, | ||
169 | {"false", CXX_FALSE, NORID,}, | ||
170 | {"sizeof", SIZEOF, NORID,}, | ||
171 | {"try", TRY, NORID,}, | ||
172 | {"switch", SWITCH, NORID,}, | ||
173 | {"typedef", SCSPEC, RID_TYPEDEF,}, | ||
174 | {"", 0, 0}, | ||
175 | {"operator", OPERATOR, NORID,}, | ||
176 | {"__signature__", AGGR, RID_SIGNATURE /* Extension */,}, | ||
177 | {"catch", CATCH, NORID,}, | ||
178 | {"delete", DELETE, NORID,}, | ||
179 | {"typeid", TYPEID, NORID,}, | ||
180 | {"sigof", SIGOF, NORID /* Extension */,}, | ||
181 | {"const_cast", CONST_CAST, NORID,}, | ||
182 | {"__signed", TYPESPEC, RID_SIGNED}, | ||
183 | {"class", AGGR, RID_CLASS,}, | ||
184 | {"xor", '^', NORID,}, | ||
185 | {"do", DO, NORID,}, | ||
186 | {"continue", CONTINUE, NORID,}, | ||
187 | {"auto", SCSPEC, RID_AUTO,}, | ||
188 | {"__typeof__", TYPEOF, NORID}, | ||
189 | {"", 0, 0}, | ||
190 | {"__alignof__", ALIGNOF, NORID}, | ||
191 | {"float", TYPESPEC, RID_FLOAT,}, | ||
192 | {"struct", AGGR, RID_RECORD,}, | ||
193 | {"long", TYPESPEC, RID_LONG,}, | ||
194 | {"__null", CONSTANT, RID_NULL}, | ||
195 | {"", 0, 0}, | ||
196 | {"__label__", LABEL, NORID}, | ||
197 | {"__inline", SCSPEC, RID_INLINE}, | ||
198 | {"reinterpret_cast", REINTERPRET_CAST, NORID,}, | ||
199 | {"__inline__", SCSPEC, RID_INLINE}, | ||
200 | {"__imag__", IMAGPART, NORID}, | ||
201 | {"typename", TYPENAME_KEYWORD, NORID,}, | ||
202 | {"friend", SCSPEC, RID_FRIEND,}, | ||
203 | {"compl", '~', NORID,}, | ||
204 | {"public", VISSPEC, RID_PUBLIC,}, | ||
205 | {"bitor", '|', NORID,}, | ||
206 | {"namespace", NAMESPACE, NORID,}, | ||
207 | {"or_eq", ASSIGN, NORID,}, | ||
208 | {"", 0, 0}, | ||
209 | {"private", VISSPEC, RID_PRIVATE,}, | ||
210 | {"__typeof", TYPEOF, NORID}, | ||
211 | {"", 0, 0}, | ||
212 | {"__alignof", ALIGNOF, NORID}, | ||
213 | {"__complex", TYPESPEC, RID_COMPLEX}, | ||
214 | {"union", AGGR, RID_UNION,}, | ||
215 | {"", 0, 0}, | ||
216 | {"__extension__", EXTENSION, NORID}, | ||
217 | {"", 0, 0}, | ||
218 | {"return", RETURN_KEYWORD, NORID,}, | ||
219 | {"and", ANDAND, NORID,}, | ||
220 | {"__asm", ASM_KEYWORD, NORID}, | ||
221 | {"__imag", IMAGPART, NORID}, | ||
222 | {"virtual", SCSPEC, RID_VIRTUAL,}, | ||
223 | {"protected", VISSPEC, RID_PROTECTED,}, | ||
224 | {"throw", THROW, NORID,}, | ||
225 | {"default", DEFAULT, NORID,}, | ||
226 | {"using", USING, NORID,}, | ||
227 | {"unsigned", TYPESPEC, RID_UNSIGNED,}, | ||
228 | {"break", BREAK, NORID,}, | ||
229 | {"", 0, 0}, | ||
230 | {"signature", AGGR, RID_SIGNATURE /* Extension */,}, | ||
231 | {"bool", TYPESPEC, RID_BOOL,}, | ||
232 | {"", 0, 0}, | ||
233 | {"not_eq", EQCOMPARE, NORID,}, | ||
234 | {"", 0, 0}, {"", 0, 0}, | ||
235 | {"double", TYPESPEC, RID_DOUBLE,}, | ||
236 | {"signed", TYPESPEC, RID_SIGNED,}, | ||
237 | {"while", WHILE, NORID,}, | ||
238 | {"asm", ASM_KEYWORD, NORID,}, | ||
239 | {"volatile", CV_QUALIFIER, RID_VOLATILE,}, | ||
240 | {"and_eq", ASSIGN, NORID,}, | ||
241 | {"", 0, 0}, | ||
242 | {"mutable", SCSPEC, RID_MUTABLE,}, | ||
243 | {"dynamic_cast", DYNAMIC_CAST, NORID,}, | ||
244 | {"", 0, 0}, | ||
245 | {"new", NEW, NORID,}, | ||
246 | {"xor_eq", ASSIGN, NORID,}, | ||
247 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
248 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
249 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
250 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
251 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
252 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
253 | {"enum", ENUM, NORID,}, | ||
254 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
255 | {"void", TYPESPEC, RID_VOID,}, | ||
256 | {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, | ||
257 | {"bitand", '&', NORID,} | ||
258 | }; | ||
259 | |||
260 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
261 | { | ||
262 | register unsigned int key = hash (str, len); | ||
263 | |||
264 | if (key <= MAX_HASH_VALUE) | ||
265 | { | ||
266 | register const char *s = wordlist[key].name; | ||
267 | |||
268 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
269 | return &wordlist[key]; | ||
270 | } | ||
271 | } | ||
272 | return 0; | ||
273 | } |
File tests/cplusplus.gperf added (mode: 100644) (index 0000000..8139e28) | |||
1 | %{ | ||
2 | /* Command-line: gperf -L KR-C -F ', 0, 0' -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */ | ||
3 | %} | ||
4 | struct resword { const char *name; short token; enum rid rid;}; | ||
5 | %% | ||
6 | __alignof, ALIGNOF, NORID | ||
7 | __alignof__, ALIGNOF, NORID | ||
8 | __asm, ASM_KEYWORD, NORID | ||
9 | __asm__, ASM_KEYWORD, NORID | ||
10 | __attribute, ATTRIBUTE, NORID | ||
11 | __attribute__, ATTRIBUTE, NORID | ||
12 | __complex, TYPESPEC, RID_COMPLEX | ||
13 | __complex__, TYPESPEC, RID_COMPLEX | ||
14 | __const, CV_QUALIFIER, RID_CONST | ||
15 | __const__, CV_QUALIFIER, RID_CONST | ||
16 | __extension__, EXTENSION, NORID | ||
17 | __imag, IMAGPART, NORID | ||
18 | __imag__, IMAGPART, NORID | ||
19 | __inline, SCSPEC, RID_INLINE | ||
20 | __inline__, SCSPEC, RID_INLINE | ||
21 | __label__, LABEL, NORID | ||
22 | __null, CONSTANT, RID_NULL | ||
23 | __real, REALPART, NORID | ||
24 | __real__, REALPART, NORID | ||
25 | __restrict, CV_QUALIFIER, RID_RESTRICT | ||
26 | __restrict__, CV_QUALIFIER, RID_RESTRICT | ||
27 | __signature__, AGGR, RID_SIGNATURE /* Extension */, | ||
28 | __signed, TYPESPEC, RID_SIGNED | ||
29 | __signed__, TYPESPEC, RID_SIGNED | ||
30 | __sigof__, SIGOF, NORID /* Extension */, | ||
31 | __typeof, TYPEOF, NORID | ||
32 | __typeof__, TYPEOF, NORID | ||
33 | __volatile, CV_QUALIFIER, RID_VOLATILE | ||
34 | __volatile__, CV_QUALIFIER, RID_VOLATILE | ||
35 | __wchar_t, TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */, | ||
36 | asm, ASM_KEYWORD, NORID, | ||
37 | and, ANDAND, NORID, | ||
38 | and_eq, ASSIGN, NORID, | ||
39 | auto, SCSPEC, RID_AUTO, | ||
40 | bitand, '&', NORID, | ||
41 | bitor, '|', NORID, | ||
42 | bool, TYPESPEC, RID_BOOL, | ||
43 | break, BREAK, NORID, | ||
44 | case, CASE, NORID, | ||
45 | catch, CATCH, NORID, | ||
46 | char, TYPESPEC, RID_CHAR, | ||
47 | class, AGGR, RID_CLASS, | ||
48 | compl, '~', NORID, | ||
49 | const, CV_QUALIFIER, RID_CONST, | ||
50 | const_cast, CONST_CAST, NORID, | ||
51 | continue, CONTINUE, NORID, | ||
52 | default, DEFAULT, NORID, | ||
53 | delete, DELETE, NORID, | ||
54 | do, DO, NORID, | ||
55 | double, TYPESPEC, RID_DOUBLE, | ||
56 | dynamic_cast, DYNAMIC_CAST, NORID, | ||
57 | else, ELSE, NORID, | ||
58 | enum, ENUM, NORID, | ||
59 | explicit, SCSPEC, RID_EXPLICIT, | ||
60 | export, SCSPEC, RID_EXPORT, | ||
61 | extern, SCSPEC, RID_EXTERN, | ||
62 | false, CXX_FALSE, NORID, | ||
63 | float, TYPESPEC, RID_FLOAT, | ||
64 | for, FOR, NORID, | ||
65 | friend, SCSPEC, RID_FRIEND, | ||
66 | goto, GOTO, NORID, | ||
67 | if, IF, NORID, | ||
68 | inline, SCSPEC, RID_INLINE, | ||
69 | int, TYPESPEC, RID_INT, | ||
70 | long, TYPESPEC, RID_LONG, | ||
71 | mutable, SCSPEC, RID_MUTABLE, | ||
72 | namespace, NAMESPACE, NORID, | ||
73 | new, NEW, NORID, | ||
74 | not, '!', NORID, | ||
75 | not_eq, EQCOMPARE, NORID, | ||
76 | operator, OPERATOR, NORID, | ||
77 | or, OROR, NORID, | ||
78 | or_eq, ASSIGN, NORID, | ||
79 | private, VISSPEC, RID_PRIVATE, | ||
80 | protected, VISSPEC, RID_PROTECTED, | ||
81 | public, VISSPEC, RID_PUBLIC, | ||
82 | register, SCSPEC, RID_REGISTER, | ||
83 | reinterpret_cast, REINTERPRET_CAST, NORID, | ||
84 | return, RETURN_KEYWORD, NORID, | ||
85 | short, TYPESPEC, RID_SHORT, | ||
86 | signature, AGGR, RID_SIGNATURE /* Extension */, | ||
87 | signed, TYPESPEC, RID_SIGNED, | ||
88 | sigof, SIGOF, NORID /* Extension */, | ||
89 | sizeof, SIZEOF, NORID, | ||
90 | static, SCSPEC, RID_STATIC, | ||
91 | static_cast, STATIC_CAST, NORID, | ||
92 | struct, AGGR, RID_RECORD, | ||
93 | switch, SWITCH, NORID, | ||
94 | template, TEMPLATE, RID_TEMPLATE, | ||
95 | this, THIS, NORID, | ||
96 | throw, THROW, NORID, | ||
97 | true, CXX_TRUE, NORID, | ||
98 | try, TRY, NORID, | ||
99 | typedef, SCSPEC, RID_TYPEDEF, | ||
100 | typename, TYPENAME_KEYWORD, NORID, | ||
101 | typeid, TYPEID, NORID, | ||
102 | typeof, TYPEOF, NORID, | ||
103 | union, AGGR, RID_UNION, | ||
104 | unsigned, TYPESPEC, RID_UNSIGNED, | ||
105 | using, USING, NORID, | ||
106 | virtual, SCSPEC, RID_VIRTUAL, | ||
107 | void, TYPESPEC, RID_VOID, | ||
108 | volatile, CV_QUALIFIER, RID_VOLATILE, | ||
109 | while, WHILE, NORID, | ||
110 | xor, '^', NORID, | ||
111 | xor_eq, ASSIGN, NORID, |
File tests/gpc.exp added (mode: 100644) (index 0000000..63ba8b8) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -g -o -j1 -t -N is_reserved_word */ | ||
3 | /* Computed positions: -k'1,$' */ | ||
4 | |||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
28 | /* The character set is not based on ISO-646. */ | ||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>." | ||
30 | #endif | ||
31 | |||
32 | |||
33 | /* ISO Pascal 7185 reserved words. | ||
34 | * | ||
35 | * For GNU Pascal compiler (GPC) by jtv@hut.fi | ||
36 | * | ||
37 | * run this through the Doug Schmidt's gperf program | ||
38 | * with command | ||
39 | * gperf -g -o -j1 -t -p -N is_reserved_word | ||
40 | * | ||
41 | */ | ||
42 | struct resword { char *name; short token; short iclass;}; | ||
43 | |||
44 | #define TOTAL_KEYWORDS 35 | ||
45 | #define MIN_WORD_LENGTH 2 | ||
46 | #define MAX_WORD_LENGTH 9 | ||
47 | #define MIN_HASH_VALUE 2 | ||
48 | #define MAX_HASH_VALUE 37 | ||
49 | /* maximum key range = 36, duplicates = 0 */ | ||
50 | |||
51 | #ifdef __GNUC__ | ||
52 | __inline | ||
53 | #else | ||
54 | #ifdef __cplusplus | ||
55 | inline | ||
56 | #endif | ||
57 | #endif | ||
58 | static unsigned int | ||
59 | hash (register const char *str, register size_t len) | ||
60 | { | ||
61 | static unsigned char asso_values[] = | ||
62 | { | ||
63 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
64 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
65 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
66 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
67 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
68 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
69 | 38, 38, 38, 38, 38, 14, 32, 16, 13, 9, | ||
70 | 1, 32, 38, 9, 38, 38, 22, 26, 16, 3, | ||
71 | 2, 38, 7, 23, 0, 19, 25, 23, 38, 38, | ||
72 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
73 | 5, 1, 5, 38, 3, 38, 38, 38, 8, 16, | ||
74 | 0, 0, 38, 38, 3, 38, 7, 38, 8, 38, | ||
75 | 38, 4, 38, 38, 38, 38, 38, 38, 38, 38, | ||
76 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
77 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
78 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
79 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
80 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
81 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
82 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
83 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
84 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
85 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
86 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
87 | 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, | ||
88 | 38, 38, 38, 38, 38, 38 | ||
89 | }; | ||
90 | return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; | ||
91 | } | ||
92 | |||
93 | struct resword * | ||
94 | is_reserved_word (register const char *str, register size_t len) | ||
95 | { | ||
96 | static struct resword wordlist[] = | ||
97 | { | ||
98 | {""}, {""}, | ||
99 | {"To", TO, PASCAL_ISO}, | ||
100 | {""}, | ||
101 | {"Then", THEN, PASCAL_ISO}, | ||
102 | {"Type", TYPE, PASCAL_ISO}, | ||
103 | {"File", FILE_, PASCAL_ISO}, | ||
104 | {"For", FOR, PASCAL_ISO}, | ||
105 | {"Or", OR, PASCAL_ISO}, | ||
106 | {"Function", FUNCTION, PASCAL_ISO}, | ||
107 | {"Of", OF, PASCAL_ISO}, | ||
108 | {"In", IN, PASCAL_ISO}, | ||
109 | {"Procedure", PROCEDURE, PASCAL_ISO}, | ||
110 | {"Packed", PACKED, PASCAL_ISO}, | ||
111 | {"Else", ELSE, PASCAL_ISO}, | ||
112 | {"Do", DO, PASCAL_ISO}, | ||
113 | {"If", IF, PASCAL_ISO}, | ||
114 | {"End", END, PASCAL_ISO}, | ||
115 | {"Record", RECORD, PASCAL_ISO}, | ||
116 | {"Downto", DOWNTO, PASCAL_ISO}, | ||
117 | {"Repeat", REPEAT, PASCAL_ISO}, | ||
118 | {"Case", CASE, PASCAL_ISO}, | ||
119 | {"And", AND, PASCAL_ISO}, | ||
120 | {"Array", ARRAY, PASCAL_ISO}, | ||
121 | {"Div", DIV, PASCAL_ISO}, | ||
122 | {"Program",PROGRAM,PASCAL_ISO}, | ||
123 | {"Not", NOT, PASCAL_ISO}, | ||
124 | {"Nil", NIL, PASCAL_ISO}, | ||
125 | {"Const", CONST, PASCAL_ISO}, | ||
126 | {"While", WHILE, PASCAL_ISO}, | ||
127 | {"With", WITH, PASCAL_ISO}, | ||
128 | {"Var", VAR, PASCAL_ISO}, | ||
129 | {"Until", UNTIL, PASCAL_ISO}, | ||
130 | {"Set", SET, PASCAL_ISO}, | ||
131 | {"Mod", MOD, PASCAL_ISO}, | ||
132 | {"Label", LABEL, PASCAL_ISO}, | ||
133 | {"Goto", GOTO, PASCAL_ISO}, | ||
134 | {"Begin", BEGIN_, PASCAL_ISO} | ||
135 | }; | ||
136 | |||
137 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
138 | { | ||
139 | register unsigned int key = hash (str, len); | ||
140 | |||
141 | if (key <= MAX_HASH_VALUE) | ||
142 | { | ||
143 | register const char *s = wordlist[key].name; | ||
144 | |||
145 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
146 | return &wordlist[key]; | ||
147 | } | ||
148 | } | ||
149 | return 0; | ||
150 | } |
File tests/gpc.gperf added (mode: 100644) (index 0000000..8fb469e) | |||
1 | %{ | ||
2 | /* ISO Pascal 7185 reserved words. | ||
3 | * | ||
4 | * For GNU Pascal compiler (GPC) by jtv@hut.fi | ||
5 | * | ||
6 | * run this through the Doug Schmidt's gperf program | ||
7 | * with command | ||
8 | * gperf -g -o -j1 -t -p -N is_reserved_word | ||
9 | * | ||
10 | */ | ||
11 | %} | ||
12 | struct resword { char *name; short token; short iclass;}; | ||
13 | %% | ||
14 | And, AND, PASCAL_ISO | ||
15 | Array, ARRAY, PASCAL_ISO | ||
16 | Begin, BEGIN_, PASCAL_ISO | ||
17 | Case, CASE, PASCAL_ISO | ||
18 | Const, CONST, PASCAL_ISO | ||
19 | Div, DIV, PASCAL_ISO | ||
20 | Do, DO, PASCAL_ISO | ||
21 | Downto, DOWNTO, PASCAL_ISO | ||
22 | Else, ELSE, PASCAL_ISO | ||
23 | End, END, PASCAL_ISO | ||
24 | File, FILE_, PASCAL_ISO | ||
25 | For, FOR, PASCAL_ISO | ||
26 | Function, FUNCTION, PASCAL_ISO | ||
27 | Goto, GOTO, PASCAL_ISO | ||
28 | If, IF, PASCAL_ISO | ||
29 | In, IN, PASCAL_ISO | ||
30 | Label, LABEL, PASCAL_ISO | ||
31 | Mod, MOD, PASCAL_ISO | ||
32 | Nil, NIL, PASCAL_ISO | ||
33 | Not, NOT, PASCAL_ISO | ||
34 | Of, OF, PASCAL_ISO | ||
35 | Or, OR, PASCAL_ISO | ||
36 | Packed, PACKED, PASCAL_ISO | ||
37 | Procedure, PROCEDURE, PASCAL_ISO | ||
38 | Program,PROGRAM,PASCAL_ISO | ||
39 | Record, RECORD, PASCAL_ISO | ||
40 | Repeat, REPEAT, PASCAL_ISO | ||
41 | Set, SET, PASCAL_ISO | ||
42 | Then, THEN, PASCAL_ISO | ||
43 | To, TO, PASCAL_ISO | ||
44 | Type, TYPE, PASCAL_ISO | ||
45 | Until, UNTIL, PASCAL_ISO | ||
46 | Var, VAR, PASCAL_ISO | ||
47 | While, WHILE, PASCAL_ISO | ||
48 | With, WITH, PASCAL_ISO |
File tests/incomplete.exp added (mode: 100644) (index 0000000..e4dd037) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -t */ | ||
3 | /* Computed positions: -k'1,3' */ | ||
4 | |||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
28 | /* The character set is not based on ISO-646. */ | ||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>." | ||
30 | #endif | ||
31 | |||
32 | struct month; | ||
33 | |||
34 | #define TOTAL_KEYWORDS 12 | ||
35 | #define MIN_WORD_LENGTH 3 | ||
36 | #define MAX_WORD_LENGTH 9 | ||
37 | #define MIN_HASH_VALUE 3 | ||
38 | #define MAX_HASH_VALUE 18 | ||
39 | /* maximum key range = 16, duplicates = 0 */ | ||
40 | |||
41 | #ifdef __GNUC__ | ||
42 | __inline | ||
43 | #else | ||
44 | #ifdef __cplusplus | ||
45 | inline | ||
46 | #endif | ||
47 | #endif | ||
48 | static unsigned int | ||
49 | hash (register const char *str, register size_t len) | ||
50 | { | ||
51 | static unsigned char asso_values[] = | ||
52 | { | ||
53 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
54 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
55 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
56 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
57 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
58 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
59 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
60 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
61 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
62 | 19, 19, 19, 19, 19, 19, 19, 5, 5, 5, | ||
63 | 0, 19, 5, 0, 19, 19, 0, 19, 10, 0, | ||
64 | 0, 5, 0, 19, 0, 0, 0, 19, 0, 19, | ||
65 | 19, 0, 19, 19, 19, 19, 19, 19, 19, 19, | ||
66 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
67 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
68 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
69 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
70 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
71 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
72 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
73 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
74 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
75 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
76 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
77 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | ||
78 | 19, 19, 19, 19, 19, 19 | ||
79 | }; | ||
80 | return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]]; | ||
81 | } | ||
82 | |||
83 | struct month * | ||
84 | in_word_set (register const char *str, register size_t len) | ||
85 | { | ||
86 | static struct month wordlist[] = | ||
87 | { | ||
88 | {""}, {""}, {""}, | ||
89 | {"may", 5, 31, 31}, | ||
90 | {"june", 6, 30, 30}, | ||
91 | {"march", 3, 31, 31}, | ||
92 | {""}, | ||
93 | {"january", 1, 31, 31}, | ||
94 | {"november", 11, 30, 30}, | ||
95 | {"september", 9, 30, 30}, | ||
96 | {"april", 4, 30, 30}, | ||
97 | {"august", 8, 31, 31}, | ||
98 | {"october", 10, 31, 31}, | ||
99 | {"december", 12, 31, 31}, | ||
100 | {"july", 7, 31, 31}, | ||
101 | {""}, {""}, {""}, | ||
102 | {"february", 2, 28, 29} | ||
103 | }; | ||
104 | |||
105 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
106 | { | ||
107 | register unsigned int key = hash (str, len); | ||
108 | |||
109 | if (key <= MAX_HASH_VALUE) | ||
110 | { | ||
111 | register const char *s = wordlist[key].name; | ||
112 | |||
113 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
114 | return &wordlist[key]; | ||
115 | } | ||
116 | } | ||
117 | return 0; | ||
118 | } |
File tests/incomplete.gperf added (mode: 100644) (index 0000000..f5296b1) | |||
1 | struct month; | ||
2 | %% | ||
3 | january, 1, 31, 31 | ||
4 | february, 2, 28, 29 | ||
5 | march, 3, 31, 31 | ||
6 | april, 4, 30, 30 | ||
7 | may, 5, 31, 31 | ||
8 | june, 6, 30, 30 | ||
9 | july, 7, 31, 31 | ||
10 | august, 8, 31, 31 | ||
11 | september, 9, 30, 30 | ||
12 | october, 10, 31, 31 | ||
13 | november, 11, 30, 30 | ||
14 | december, 12, 31, 31 |
File tests/irc.gperf added (mode: 100644) (index 0000000..afe53c5) | |||
1 | %{ | ||
2 | extern int m_text(), m_private(), m_who(), m_whois(), m_user(), m_list(); | ||
3 | extern int m_topic(), m_invite(), m_channel(), m_version(), m_quit(); | ||
4 | extern int m_server(), m_kill(), m_info(), m_links(), m_summon(), m_stats(); | ||
5 | extern int m_users(), m_nick(), m_error(), m_help(), m_whoreply(); | ||
6 | extern int m_squit(), m_restart(), m_away(), m_die(), m_connect(); | ||
7 | extern int m_ping(), m_pong(), m_oper(), m_pass(), m_wall(), m_trace(); | ||
8 | extern int m_time(), m_rehash(), m_names(), m_namreply(), m_admin(); | ||
9 | extern int m_linreply(), m_notice(), m_lusers(), m_voice(), m_grph(); | ||
10 | extern int m_xtra(), m_motd(); | ||
11 | %} | ||
12 | struct Message { | ||
13 | char *cmd; | ||
14 | int (* func)(); | ||
15 | int count; | ||
16 | int parameters; | ||
17 | }; | ||
18 | %% | ||
19 | NICK, m_nick, 0, 1 | ||
20 | MSG, m_text, 0, 1 | ||
21 | PRIVMSG, m_private, 0, 2 | ||
22 | WHO, m_who, 0, 1 | ||
23 | WHOIS, m_whois, 0, 4 | ||
24 | USER, m_user, 0, 4 | ||
25 | SERVER, m_server, 0, 2 | ||
26 | LIST, m_list, 0, 1 | ||
27 | TOPIC, m_topic, 0, 1 | ||
28 | INVITE, m_invite, 0, 2 | ||
29 | CHANNEL, m_channel, 0, 1 | ||
30 | VERSION, m_version, 0, 1 | ||
31 | QUIT, m_quit, 0, 2 | ||
32 | SQUIT, m_squit, 0, 2 | ||
33 | KILL, m_kill, 0, 2 | ||
34 | INFO, m_info, 0, 1 | ||
35 | LINKS, m_links, 0, 1 | ||
36 | SUMMON, m_summon, 0, 1 | ||
37 | STATS, m_stats, 0, 1 | ||
38 | USERS, m_users, 0, 1 | ||
39 | RESTART, m_restart, 0, 1 | ||
40 | WHOREPLY,m_whoreply, 0, 7 | ||
41 | HELP, m_help, 0, 2 | ||
42 | ERROR, m_error, 0, 1 | ||
43 | AWAY, m_away, 0, 1 | ||
44 | DIE, m_die, 0, 1 | ||
45 | CONNECT, m_connect, 0, 3 | ||
46 | PING, m_ping, 0, 2 | ||
47 | PONG, m_pong, 0, 3 | ||
48 | OPER, m_oper, 0, 3 | ||
49 | PASS, m_pass, 0, 2 | ||
50 | WALL, m_wall, 0, 1 | ||
51 | TIME, m_time, 0, 1 | ||
52 | REHASH, m_rehash, 0, 1 | ||
53 | NAMES, m_names, 0, 1 | ||
54 | NAMREPLY,m_namreply, 0, 3 | ||
55 | ADMIN, m_admin, 0, 1 | ||
56 | TRACE, m_trace, 0, 1 | ||
57 | LINREPLY,m_linreply, 0, 2 | ||
58 | NOTICE, m_notice, 0, 2 | ||
59 | LUSERS, m_lusers, 0, 1 | ||
60 | VOICE, m_voice, 0, 2 | ||
61 | GRPH, m_grph, 0, 2 | ||
62 | XTRA, m_xtra, 0, 2 | ||
63 | MOTD, m_motd, 0, 2 |
File tests/java.exp added (mode: 100644) (index 0000000..bce452b) | |||
1 | /* C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -L C -F ', 0' -t -j1 -i 1 -g -o -N java_keyword -k'1,3,$' */ | ||
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-gperf@gnu.org>." | ||
29 | #endif | ||
30 | |||
31 | |||
32 | /* Keyword definition for the GNU compiler for the Java(TM) language. | ||
33 | Copyright (C) 1997, 1998 Free Software Foundation, Inc. | ||
34 | Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com) | ||
35 | |||
36 | This file is part of GNU CC. | ||
37 | |||
38 | GNU CC is free software; you can redistribute it and/or modify | ||
39 | it under the terms of the GNU General Public License as published by | ||
40 | the Free Software Foundation; either version 2, or (at your option) | ||
41 | any later version. | ||
42 | |||
43 | GNU CC is distributed in the hope that it will be useful, | ||
44 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
45 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
46 | GNU General Public License for more details. | ||
47 | |||
48 | You should have received a copy of the GNU General Public License | ||
49 | along with GNU CC; see the file COPYING. If not, write to | ||
50 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, | ||
51 | MA 02110-1301, USA. | ||
52 | |||
53 | Java and all Java-based marks are trademarks or registered trademarks | ||
54 | of Sun Microsystems, Inc. in the United States and other countries. | ||
55 | The Free Software Foundation is independent of Sun Microsystems, Inc. */ | ||
56 | |||
57 | struct java_keyword { const char *name; int token; }; | ||
58 | |||
59 | #define TOTAL_KEYWORDS 50 | ||
60 | #define MIN_WORD_LENGTH 2 | ||
61 | #define MAX_WORD_LENGTH 12 | ||
62 | #define MIN_HASH_VALUE 7 | ||
63 | #define MAX_HASH_VALUE 76 | ||
64 | /* maximum key range = 70, duplicates = 0 */ | ||
65 | |||
66 | #ifdef __GNUC__ | ||
67 | __inline | ||
68 | #else | ||
69 | #ifdef __cplusplus | ||
70 | inline | ||
71 | #endif | ||
72 | #endif | ||
73 | static unsigned int | ||
74 | hash (str, len) | ||
75 | register const char *str; | ||
76 | register size_t len; | ||
77 | { | ||
78 | static unsigned char asso_values[] = | ||
79 | { | ||
80 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
81 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
82 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
83 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
84 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
85 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
86 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
87 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
88 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
89 | 77, 77, 77, 77, 77, 77, 77, 7, 30, 7, | ||
90 | 12, 1, 14, 28, 41, 3, 77, 16, 11, 77, | ||
91 | 16, 23, 1, 77, 15, 1, 1, 34, 30, 18, | ||
92 | 77, 11, 77, 77, 77, 77, 77, 77, 77, 77, | ||
93 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
94 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
95 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
96 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
97 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
98 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
99 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
100 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
101 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
102 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
103 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
104 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
105 | 77, 77, 77, 77, 77, 77 | ||
106 | }; | ||
107 | register unsigned int hval = len; | ||
108 | |||
109 | switch (hval) | ||
110 | { | ||
111 | default: | ||
112 | hval += asso_values[(unsigned char)str[2]]; | ||
113 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
114 | [[fallthrough]]; | ||
115 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
116 | __attribute__ ((__fallthrough__)); | ||
117 | #endif | ||
118 | /*FALLTHROUGH*/ | ||
119 | case 2: | ||
120 | case 1: | ||
121 | hval += asso_values[(unsigned char)str[0]]; | ||
122 | break; | ||
123 | } | ||
124 | return hval + asso_values[(unsigned char)str[len - 1]]; | ||
125 | } | ||
126 | |||
127 | struct java_keyword * | ||
128 | java_keyword (str, len) | ||
129 | register const char *str; | ||
130 | register size_t len; | ||
131 | { | ||
132 | static struct java_keyword wordlist[] = | ||
133 | { | ||
134 | {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, | ||
135 | {"", 0}, | ||
136 | {"else", ELSE_TK}, | ||
137 | {"int", INT_TK}, | ||
138 | {"this", THIS_TK}, | ||
139 | {"extends", EXTENDS_TK}, | ||
140 | {"import", IMPORT_TK}, | ||
141 | {"private", PRIVATE_TK}, | ||
142 | {"case", CASE_TK}, | ||
143 | {"interface", INTERFACE_TK}, | ||
144 | {"implements", IMPLEMENTS_TK}, | ||
145 | {"package", PACKAGE_TK}, | ||
146 | {"abstract", ABSTRACT_TK}, | ||
147 | {"transient", TRANSIENT_TK}, | ||
148 | {"if", IF_TK}, | ||
149 | {"class", CLASS_TK}, | ||
150 | {"static", STATIC_TK}, | ||
151 | {"super", SUPER_TK}, | ||
152 | {"throws", THROWS_TK}, | ||
153 | {"native", NATIVE_TK}, | ||
154 | {"", 0}, | ||
155 | {"try", TRY_TK}, | ||
156 | {"while", WHILE_TK}, | ||
157 | {"instanceof", INSTANCEOF_TK}, | ||
158 | {"const", CONST_TK}, | ||
159 | {"short", SHORT_TK}, | ||
160 | {"false", FALSE_TK}, | ||
161 | {"continue", CONTINUE_TK}, | ||
162 | {"char", CHAR_TK}, | ||
163 | {"default", DEFAULT_TK}, | ||
164 | {"", 0}, | ||
165 | {"byte", BYTE_TK}, | ||
166 | {"do", DO_TK}, | ||
167 | {"return", RETURN_TK}, | ||
168 | {"throw", THROW_TK}, | ||
169 | {"true", TRUE_TK}, | ||
170 | {"synchronized", SYNCHRONIZED_TK}, | ||
171 | {"null", NULL_TK}, | ||
172 | {"float", FLOAT_TK}, | ||
173 | {"public", PUBLIC_TK}, | ||
174 | {"protected", PROTECTED_TK}, | ||
175 | {"final", FINAL_TK}, | ||
176 | {"for", FOR_TK}, | ||
177 | {"finally", FINALLY_TK}, | ||
178 | {"void", VOID_TK}, | ||
179 | {"volatile", VOLATILE_TK}, | ||
180 | {"switch", SWITCH_TK}, | ||
181 | {"break", BREAK_TK}, | ||
182 | {"double", DOUBLE_TK}, | ||
183 | {"catch", CATCH_TK}, | ||
184 | {"new", NEW_TK}, | ||
185 | {"goto", GOTO_TK}, | ||
186 | {"", 0}, {"", 0}, | ||
187 | {"long", LONG_TK}, | ||
188 | {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, | ||
189 | {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, | ||
190 | {"", 0}, {"", 0}, {"", 0}, {"", 0}, | ||
191 | {"boolean", BOOLEAN_TK} | ||
192 | }; | ||
193 | |||
194 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
195 | { | ||
196 | register unsigned int key = hash (str, len); | ||
197 | |||
198 | if (key <= MAX_HASH_VALUE) | ||
199 | { | ||
200 | register const char *s = wordlist[key].name; | ||
201 | |||
202 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
203 | return &wordlist[key]; | ||
204 | } | ||
205 | } | ||
206 | return 0; | ||
207 | } |
File tests/java.gperf added (mode: 100644) (index 0000000..2e79332) | |||
1 | %{ | ||
2 | /* Keyword definition for the GNU compiler for the Java(TM) language. | ||
3 | Copyright (C) 1997, 1998 Free Software Foundation, Inc. | ||
4 | Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com) | ||
5 | |||
6 | This file is part of GNU CC. | ||
7 | |||
8 | GNU CC is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation; either version 2, or (at your option) | ||
11 | any later version. | ||
12 | |||
13 | GNU CC is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with GNU CC; see the file COPYING. If not, write to | ||
20 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, | ||
21 | MA 02110-1301, USA. | ||
22 | |||
23 | Java and all Java-based marks are trademarks or registered trademarks | ||
24 | of Sun Microsystems, Inc. in the United States and other countries. | ||
25 | The Free Software Foundation is independent of Sun Microsystems, Inc. */ | ||
26 | |||
27 | %} | ||
28 | struct java_keyword { const char *name; int token; }; | ||
29 | %% | ||
30 | abstract, ABSTRACT_TK | ||
31 | default, DEFAULT_TK | ||
32 | if, IF_TK | ||
33 | private, PRIVATE_TK | ||
34 | throw, THROW_TK | ||
35 | boolean, BOOLEAN_TK | ||
36 | do, DO_TK | ||
37 | implements, IMPLEMENTS_TK | ||
38 | protected, PROTECTED_TK | ||
39 | throws, THROWS_TK | ||
40 | break, BREAK_TK | ||
41 | double, DOUBLE_TK | ||
42 | import, IMPORT_TK | ||
43 | public, PUBLIC_TK | ||
44 | transient, TRANSIENT_TK | ||
45 | byte, BYTE_TK | ||
46 | else, ELSE_TK | ||
47 | instanceof, INSTANCEOF_TK | ||
48 | return, RETURN_TK | ||
49 | try, TRY_TK | ||
50 | case, CASE_TK | ||
51 | extends, EXTENDS_TK | ||
52 | int, INT_TK | ||
53 | short, SHORT_TK | ||
54 | void, VOID_TK | ||
55 | catch, CATCH_TK | ||
56 | final, FINAL_TK | ||
57 | interface, INTERFACE_TK | ||
58 | static, STATIC_TK | ||
59 | volatile, VOLATILE_TK | ||
60 | char, CHAR_TK | ||
61 | finally, FINALLY_TK | ||
62 | long, LONG_TK | ||
63 | super, SUPER_TK | ||
64 | while, WHILE_TK | ||
65 | class, CLASS_TK | ||
66 | float, FLOAT_TK | ||
67 | native, NATIVE_TK | ||
68 | switch, SWITCH_TK | ||
69 | const, CONST_TK | ||
70 | for, FOR_TK | ||
71 | new, NEW_TK | ||
72 | synchronized, SYNCHRONIZED_TK | ||
73 | continue, CONTINUE_TK | ||
74 | goto, GOTO_TK | ||
75 | package, PACKAGE_TK | ||
76 | this, THIS_TK | ||
77 | # true, false and null aren't keyword. But we match them easily this way | ||
78 | true, TRUE_TK | ||
79 | false, FALSE_TK | ||
80 | null, NULL_TK |
File tests/jscript.gperf added (mode: 100644) (index 0000000..6f420d8) | |||
1 | %{ | ||
2 | /* Command-line: gperf -k'1,2,$' -t -p -K 'name' -H 'js_kw_hash' -N 'js_kw_lookup' -a -g jscript.gperf */ | ||
3 | %} | ||
4 | struct js_keyword { | ||
5 | char * name; | ||
6 | int token; | ||
7 | } | ||
8 | |||
9 | %% | ||
10 | # Javascript reserved words, see "keywords.html" | ||
11 | abstract, TK_ABSTRACT | ||
12 | boolean, TK_BOOLEAN | ||
13 | break, TK_BREAK | ||
14 | byte, TK_BYTE | ||
15 | case, TK_CASE | ||
16 | catch, TK_CATCH | ||
17 | char, TK_CHAR | ||
18 | class, TK_CLASS | ||
19 | const, TK_CONST | ||
20 | continue, TK_CONTINUE | ||
21 | default, TK_DEFAULT | ||
22 | do, TK_DO | ||
23 | double, TK_DOUBLE | ||
24 | else, TK_ELSE | ||
25 | extends, TK_EXTENDS | ||
26 | false, TK_FALSE | ||
27 | final, TK_FINAL | ||
28 | finally, TK_FINALLY | ||
29 | float, TK_FLOAT | ||
30 | for, TK_FOR | ||
31 | function, TK_FUNCTION | ||
32 | goto, TK_GOTO | ||
33 | if, TK_IF | ||
34 | implements, TK_IMPLEMENTS | ||
35 | import, TK_IMPORT | ||
36 | in, TK_IN | ||
37 | instanceof, TK_INSTANCEOF | ||
38 | int, TK_INT | ||
39 | interface, TK_INTERFACE | ||
40 | long, TK_LONG | ||
41 | native, TK_NATIVE | ||
42 | new, TK_NEW | ||
43 | null, TK_NULL | ||
44 | package, TK_PACKAGE | ||
45 | private, TK_PRIVATE | ||
46 | protected, TK_PROTECTED | ||
47 | public, TK_PUBLIC | ||
48 | return, TK_RETURN | ||
49 | short, TK_SHORT | ||
50 | static, TK_STATIC | ||
51 | super, TK_SUPER | ||
52 | switch, TK_SWITCH | ||
53 | synchronized, TK_SYNCHRONIZED | ||
54 | this, TK_THIS | ||
55 | throw, TK_THROW | ||
56 | throws, TK_THROWS | ||
57 | transient, TK_TRANSIENT | ||
58 | true, TK_TRUE | ||
59 | try, TK_TRY | ||
60 | var, TK_VAR | ||
61 | void, TK_VOID | ||
62 | while, TK_WHILE | ||
63 | with, TK_WITH | ||
64 | %% | ||
65 | |||
66 | int js_keyword_lookup (register const char *str, register int len) | ||
67 | { | ||
68 | struct js_keyword * keyword = js_kw_lookup(str,len); | ||
69 | if (keyword) | ||
70 | return keyword->token; | ||
71 | else | ||
72 | return TK_IDENT; | ||
73 | } |
File tests/jstest1.gperf added (mode: 100644) (index 0000000..7358f3d) | |||
1 | abstract | ||
2 | boolean | ||
3 | break | ||
4 | byte | ||
5 | case | ||
6 | catch | ||
7 | char | ||
8 | class | ||
9 | const | ||
10 | continue | ||
11 | default | ||
12 | do | ||
13 | double | ||
14 | else | ||
15 | extends | ||
16 | false | ||
17 | final | ||
18 | finally | ||
19 | float | ||
20 | for | ||
21 | function | ||
22 | goto | ||
23 | if | ||
24 | implements | ||
25 | import | ||
26 | in | ||
27 | instanceof | ||
28 | int | ||
29 | interface | ||
30 | long | ||
31 | native | ||
32 | new | ||
33 | null | ||
34 | package | ||
35 | private | ||
36 | protected | ||
37 | public | ||
38 | return | ||
39 | short | ||
40 | static | ||
41 | super | ||
42 | switch | ||
43 | synchronized | ||
44 | this | ||
45 | throw | ||
46 | throws | ||
47 | transient | ||
48 | true | ||
49 | try | ||
50 | var | ||
51 | void | ||
52 | while | ||
53 | with | ||
54 | %% | ||
55 | #include <stdlib.h> | ||
56 | #include <string.h> | ||
57 | static const char* testdata[] = { | ||
58 | "bogus", | ||
59 | "abstract", | ||
60 | "boolean", | ||
61 | "break", | ||
62 | "byte", | ||
63 | "case", | ||
64 | "catch", | ||
65 | "char", | ||
66 | "class", | ||
67 | "const", | ||
68 | "continue", | ||
69 | "default", | ||
70 | "do", | ||
71 | "double", | ||
72 | "else", | ||
73 | "extends", | ||
74 | "false", | ||
75 | "final", | ||
76 | "finally", | ||
77 | "float", | ||
78 | "for", | ||
79 | "function", | ||
80 | "goto", | ||
81 | "if", | ||
82 | "implements", | ||
83 | "import", | ||
84 | "in", | ||
85 | "instanceof", | ||
86 | "int", | ||
87 | "interface", | ||
88 | "long", | ||
89 | "native", | ||
90 | "new", | ||
91 | "null", | ||
92 | "package", | ||
93 | "private", | ||
94 | "protected", | ||
95 | "public", | ||
96 | "return", | ||
97 | "short", | ||
98 | "static", | ||
99 | "super", | ||
100 | "switch", | ||
101 | "synchronized", | ||
102 | "this", | ||
103 | "throw", | ||
104 | "throws", | ||
105 | "transient", | ||
106 | "true", | ||
107 | "try", | ||
108 | "var", | ||
109 | "void", | ||
110 | "while", | ||
111 | "with" | ||
112 | }; | ||
113 | int main () | ||
114 | { | ||
115 | int i; | ||
116 | for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++) | ||
117 | { | ||
118 | #ifdef CPLUSPLUS_TEST | ||
119 | const char * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i])); | ||
120 | #else | ||
121 | const char * resword = in_word_set(testdata[i],strlen(testdata[i])); | ||
122 | #endif | ||
123 | if (i > 0) | ||
124 | { | ||
125 | if (!resword) | ||
126 | exit (1); | ||
127 | if (strcmp(testdata[i],resword)) | ||
128 | exit (1); | ||
129 | } | ||
130 | else | ||
131 | { | ||
132 | if (resword) | ||
133 | exit (1); | ||
134 | } | ||
135 | } | ||
136 | return 0; | ||
137 | } |
File tests/jstest2.gperf added (mode: 100644) (index 0000000..68553c3) | |||
1 | struct js_keyword { | ||
2 | char * name; | ||
3 | int token; | ||
4 | } | ||
5 | %% | ||
6 | abstract, 1 | ||
7 | boolean, 2 | ||
8 | break, 3 | ||
9 | byte, 4 | ||
10 | case, 5 | ||
11 | catch, 6 | ||
12 | char, 7 | ||
13 | class, 8 | ||
14 | const, 9 | ||
15 | continue, 10 | ||
16 | default, 11 | ||
17 | do, 12 | ||
18 | double, 13 | ||
19 | else, 14 | ||
20 | extends, 15 | ||
21 | false, 16 | ||
22 | final, 17 | ||
23 | finally, 18 | ||
24 | float, 19 | ||
25 | for, 20 | ||
26 | function, 21 | ||
27 | goto, 22 | ||
28 | if, 23 | ||
29 | implements, 24 | ||
30 | import, 25 | ||
31 | in, 26 | ||
32 | instanceof, 27 | ||
33 | int, 28 | ||
34 | interface, 29 | ||
35 | long, 30 | ||
36 | native, 31 | ||
37 | new, 32 | ||
38 | null, 33 | ||
39 | package, 34 | ||
40 | private, 35 | ||
41 | protected, 36 | ||
42 | public, 37 | ||
43 | return, 38 | ||
44 | short, 39 | ||
45 | static, 40 | ||
46 | super, 41 | ||
47 | switch, 42 | ||
48 | synchronized, 43 | ||
49 | this, 44 | ||
50 | throw, 45 | ||
51 | throws, 46 | ||
52 | transient, 47 | ||
53 | true, 48 | ||
54 | try, 49 | ||
55 | var, 50 | ||
56 | void, 51 | ||
57 | while, 52 | ||
58 | with, 53 | ||
59 | %% | ||
60 | #include <stdlib.h> | ||
61 | #include <string.h> | ||
62 | static const char* testdata[] = { | ||
63 | "bogus", | ||
64 | "abstract", | ||
65 | "boolean", | ||
66 | "break", | ||
67 | "byte", | ||
68 | "case", | ||
69 | "catch", | ||
70 | "char", | ||
71 | "class", | ||
72 | "const", | ||
73 | "continue", | ||
74 | "default", | ||
75 | "do", | ||
76 | "double", | ||
77 | "else", | ||
78 | "extends", | ||
79 | "false", | ||
80 | "final", | ||
81 | "finally", | ||
82 | "float", | ||
83 | "for", | ||
84 | "function", | ||
85 | "goto", | ||
86 | "if", | ||
87 | "implements", | ||
88 | "import", | ||
89 | "in", | ||
90 | "instanceof", | ||
91 | "int", | ||
92 | "interface", | ||
93 | "long", | ||
94 | "native", | ||
95 | "new", | ||
96 | "null", | ||
97 | "package", | ||
98 | "private", | ||
99 | "protected", | ||
100 | "public", | ||
101 | "return", | ||
102 | "short", | ||
103 | "static", | ||
104 | "super", | ||
105 | "switch", | ||
106 | "synchronized", | ||
107 | "this", | ||
108 | "throw", | ||
109 | "throws", | ||
110 | "transient", | ||
111 | "true", | ||
112 | "try", | ||
113 | "var", | ||
114 | "void", | ||
115 | "while", | ||
116 | "with" | ||
117 | }; | ||
118 | int main () | ||
119 | { | ||
120 | int i; | ||
121 | for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++) | ||
122 | { | ||
123 | #ifdef CPLUSPLUS_TEST | ||
124 | const struct js_keyword * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i])); | ||
125 | #else | ||
126 | const struct js_keyword * resword = in_word_set(testdata[i],strlen(testdata[i])); | ||
127 | #endif | ||
128 | if (i > 0) | ||
129 | { | ||
130 | if (!resword) | ||
131 | exit (1); | ||
132 | if (strcmp(testdata[i],resword->name)) | ||
133 | exit (1); | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | if (resword) | ||
138 | exit (1); | ||
139 | } | ||
140 | } | ||
141 | return 0; | ||
142 | } |
File tests/jstest3.gperf added (mode: 100644) (index 0000000..4c23eb6) | |||
1 | struct js_keyword { | ||
2 | const char * name; | ||
3 | int token; | ||
4 | } | ||
5 | %% | ||
6 | abstract, 1 | ||
7 | boolean, 2 | ||
8 | break, 3 | ||
9 | byte, 4 | ||
10 | case, 5 | ||
11 | catch, 6 | ||
12 | char, 7 | ||
13 | class, 8 | ||
14 | const, 9 | ||
15 | continue, 10 | ||
16 | default, 11 | ||
17 | do, 12 | ||
18 | double, 13 | ||
19 | else, 14 | ||
20 | extends, 15 | ||
21 | false, 16 | ||
22 | final, 17 | ||
23 | finally, 18 | ||
24 | float, 19 | ||
25 | for, 20 | ||
26 | function, 21 | ||
27 | goto, 22 | ||
28 | if, 23 | ||
29 | implements, 24 | ||
30 | import, 25 | ||
31 | in, 26 | ||
32 | instanceof, 27 | ||
33 | int, 28 | ||
34 | interface, 29 | ||
35 | long, 30 | ||
36 | native, 31 | ||
37 | new, 32 | ||
38 | null, 33 | ||
39 | package, 34 | ||
40 | private, 35 | ||
41 | protected, 36 | ||
42 | public, 37 | ||
43 | return, 38 | ||
44 | short, 39 | ||
45 | static, 40 | ||
46 | super, 41 | ||
47 | switch, 42 | ||
48 | synchronized, 43 | ||
49 | this, 44 | ||
50 | throw, 45 | ||
51 | throws, 46 | ||
52 | transient, 47 | ||
53 | true, 48 | ||
54 | try, 49 | ||
55 | var, 50 | ||
56 | void, 51 | ||
57 | while, 52 | ||
58 | with, 53 | ||
59 | %% | ||
60 | #include <stdlib.h> | ||
61 | #include <string.h> | ||
62 | static const char* testdata[] = { | ||
63 | "bogus", | ||
64 | "abstract", | ||
65 | "boolean", | ||
66 | "break", | ||
67 | "byte", | ||
68 | "case", | ||
69 | "catch", | ||
70 | "char", | ||
71 | "class", | ||
72 | "const", | ||
73 | "continue", | ||
74 | "default", | ||
75 | "do", | ||
76 | "double", | ||
77 | "else", | ||
78 | "extends", | ||
79 | "false", | ||
80 | "final", | ||
81 | "finally", | ||
82 | "float", | ||
83 | "for", | ||
84 | "function", | ||
85 | "goto", | ||
86 | "if", | ||
87 | "implements", | ||
88 | "import", | ||
89 | "in", | ||
90 | "instanceof", | ||
91 | "int", | ||
92 | "interface", | ||
93 | "long", | ||
94 | "native", | ||
95 | "new", | ||
96 | "null", | ||
97 | "package", | ||
98 | "private", | ||
99 | "protected", | ||
100 | "public", | ||
101 | "return", | ||
102 | "short", | ||
103 | "static", | ||
104 | "super", | ||
105 | "switch", | ||
106 | "synchronized", | ||
107 | "this", | ||
108 | "throw", | ||
109 | "throws", | ||
110 | "transient", | ||
111 | "true", | ||
112 | "try", | ||
113 | "var", | ||
114 | "void", | ||
115 | "while", | ||
116 | "with" | ||
117 | }; | ||
118 | int main () | ||
119 | { | ||
120 | int i; | ||
121 | for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++) | ||
122 | { | ||
123 | #ifdef CPLUSPLUS_TEST | ||
124 | const struct js_keyword * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i])); | ||
125 | #else | ||
126 | const struct js_keyword * resword = in_word_set(testdata[i],strlen(testdata[i])); | ||
127 | #endif | ||
128 | if (i > 0) | ||
129 | { | ||
130 | if (!resword) | ||
131 | exit (1); | ||
132 | if (strcmp(testdata[i],resword->name)) | ||
133 | exit (1); | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | if (resword) | ||
138 | exit (1); | ||
139 | } | ||
140 | } | ||
141 | return 0; | ||
142 | } |
File tests/jstest4.gperf added (mode: 100644) (index 0000000..6b30ac3) | |||
1 | struct js_keyword { | ||
2 | int name; | ||
3 | int token; | ||
4 | } | ||
5 | %% | ||
6 | abstract, 1 | ||
7 | boolean, 2 | ||
8 | break, 3 | ||
9 | byte, 4 | ||
10 | case, 5 | ||
11 | catch, 6 | ||
12 | char, 7 | ||
13 | class, 8 | ||
14 | const, 9 | ||
15 | continue, 10 | ||
16 | default, 11 | ||
17 | do, 12 | ||
18 | double, 13 | ||
19 | else, 14 | ||
20 | extends, 15 | ||
21 | false, 16 | ||
22 | final, 17 | ||
23 | finally, 18 | ||
24 | float, 19 | ||
25 | for, 20 | ||
26 | function, 21 | ||
27 | goto, 22 | ||
28 | if, 23 | ||
29 | implements, 24 | ||
30 | import, 25 | ||
31 | in, 26 | ||
32 | instanceof, 27 | ||
33 | int, 28 | ||
34 | interface, 29 | ||
35 | long, 30 | ||
36 | native, 31 | ||
37 | new, 32 | ||
38 | null, 33 | ||
39 | package, 34 | ||
40 | private, 35 | ||
41 | protected, 36 | ||
42 | public, 37 | ||
43 | return, 38 | ||
44 | short, 39 | ||
45 | static, 40 | ||
46 | super, 41 | ||
47 | switch, 42 | ||
48 | synchronized, 43 | ||
49 | this, 44 | ||
50 | throw, 45 | ||
51 | throws, 46 | ||
52 | transient, 47 | ||
53 | true, 48 | ||
54 | try, 49 | ||
55 | var, 50 | ||
56 | void, 51 | ||
57 | while, 52 | ||
58 | with, 53 | ||
59 | %% | ||
60 | #include <stdlib.h> | ||
61 | #include <string.h> | ||
62 | static const char* testdata[] = { | ||
63 | "bogus", | ||
64 | "abstract", | ||
65 | "boolean", | ||
66 | "break", | ||
67 | "byte", | ||
68 | "case", | ||
69 | "catch", | ||
70 | "char", | ||
71 | "class", | ||
72 | "const", | ||
73 | "continue", | ||
74 | "default", | ||
75 | "do", | ||
76 | "double", | ||
77 | "else", | ||
78 | "extends", | ||
79 | "false", | ||
80 | "final", | ||
81 | "finally", | ||
82 | "float", | ||
83 | "for", | ||
84 | "function", | ||
85 | "goto", | ||
86 | "if", | ||
87 | "implements", | ||
88 | "import", | ||
89 | "in", | ||
90 | "instanceof", | ||
91 | "int", | ||
92 | "interface", | ||
93 | "long", | ||
94 | "native", | ||
95 | "new", | ||
96 | "null", | ||
97 | "package", | ||
98 | "private", | ||
99 | "protected", | ||
100 | "public", | ||
101 | "return", | ||
102 | "short", | ||
103 | "static", | ||
104 | "super", | ||
105 | "switch", | ||
106 | "synchronized", | ||
107 | "this", | ||
108 | "throw", | ||
109 | "throws", | ||
110 | "transient", | ||
111 | "true", | ||
112 | "try", | ||
113 | "var", | ||
114 | "void", | ||
115 | "while", | ||
116 | "with" | ||
117 | }; | ||
118 | int main () | ||
119 | { | ||
120 | int i; | ||
121 | for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++) | ||
122 | { | ||
123 | #ifdef CPLUSPLUS_TEST | ||
124 | const struct js_keyword * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i])); | ||
125 | #else | ||
126 | const struct js_keyword * resword = in_word_set(testdata[i],strlen(testdata[i])); | ||
127 | #endif | ||
128 | if (i > 0) | ||
129 | { | ||
130 | if (!resword) | ||
131 | exit (1); | ||
132 | if (strcmp(testdata[i],stringpool+resword->name)) | ||
133 | exit (1); | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | if (resword) | ||
138 | exit (1); | ||
139 | } | ||
140 | } | ||
141 | return 0; | ||
142 | } |
File tests/lang-ucs2.exp added (mode: 100644) (index 0000000..8404846) | |||
1 | in word set: 12A0 121B 122D 129B | ||
2 | in word set: 010D 0065 0073 006B 0079 | ||
3 | in word set: 0044 0061 006E 0073 006B | ||
4 | in word set: 0045 006E 0067 006C 0069 0073 0068 | ||
5 | in word set: 0053 0075 006F 006D 0069 | ||
6 | in word set: 0046 0072 0061 006E 00E7 0061 0069 0073 | ||
7 | in word set: 0044 0065 0075 0074 0073 0063 0068 | ||
8 | in word set: 0395 03BB 03BB 03B7 03BD 03B9 03BA 03AC | ||
9 | in word set: 05E2 05D1 05E8 05D9 05EA | ||
10 | in word set: 0049 0074 0061 006C 0069 0061 006E 006F | ||
11 | in word set: 004E 006F 0072 0073 006B | ||
12 | in word set: 0420 0443 0441 0441 043A 0438 0439 | ||
13 | in word set: 0045 0073 0070 0061 00F1 006F 006C | ||
14 | in word set: 0053 0076 0065 006E 0073 006B 0061 | ||
15 | in word set: 0E20 0E32 0E29 0E32 0E44 0E17 0E22 | ||
16 | in word set: 0054 00FC 0072 006B 00E7 0065 | ||
17 | in word set: 0054 0069 1EBF 006E 0067 0020 0056 0069 1EC7 0074 | ||
18 | in word set: 65E5 672C 8A9E | ||
19 | in word set: 4E2D 6587 | ||
20 | in word set: D55C AE00 |
File tests/lang-ucs2.gperf added (mode: 100644) (index 0000000..8f2ac9e) | |||
1 | struct language { | ||
2 | const char *foreign_name; | ||
3 | const char *english_name; | ||
4 | const char *locale; | ||
5 | }; | ||
6 | %% | ||
7 | "\x12\xA0\x12\x1B\x12\x2D\x12\x9B", "Amharic", NULL | ||
8 | "\x01\x0D\x00\x65\x00\x73\x00\x6B\x00\x79", "Czech", "cs_CZ.UTF-8" | ||
9 | "\x00\x44\x00\x61\x00\x6E\x00\x73\x00\x6B", "Danish", "da_DK.UTF-8" | ||
10 | "\x00\x45\x00\x6E\x00\x67\x00\x6C\x00\x69\x00\x73\x00\x68", "English", "en_GB.UTF-8" | ||
11 | "\x00\x53\x00\x75\x00\x6F\x00\x6D\x00\x69", "Finnish", "fi_FI.UTF-8" | ||
12 | "\x00\x46\x00\x72\x00\x61\x00\x6E\x00\xE7\x00\x61\x00\x69\x00\x73", "French", "fr_FR.UTF-8" | ||
13 | "\x00\x44\x00\x65\x00\x75\x00\x74\x00\x73\x00\x63\x00\x68", "German", "de_DE.UTF-8" | ||
14 | "\x03\x95\x03\xBB\x03\xBB\x03\xB7\x03\xBD\x03\xB9\x03\xBA\x03\xAC", "Greek", "el_GR.UTF-8" | ||
15 | "\x05\xE2\x05\xD1\x05\xE8\x05\xD9\x05\xEA", "Hebrew", "he_IL.UTF-8" | ||
16 | "\x00\x49\x00\x74\x00\x61\x00\x6C\x00\x69\x00\x61\x00\x6E\x00\x6F", "Italian", "it_IT.UTF-8" | ||
17 | "\x00\x4E\x00\x6F\x00\x72\x00\x73\x00\x6B", "Norwegian", "no_NO.UTF-8" | ||
18 | "\x04\x20\x04\x43\x04\x41\x04\x41\x04\x3A\x04\x38\x04\x39", "Russian", "ru_RU.UTF-8" | ||
19 | "\x00\x45\x00\x73\x00\x70\x00\x61\x00\xF1\x00\x6F\x00\x6C", "Spanish", "es_ES.UTF-8" | ||
20 | "\x00\x53\x00\x76\x00\x65\x00\x6E\x00\x73\x00\x6B\x00\x61", "Swedish", "sv_SE.UTF-8" | ||
21 | "\x0E\x20\x0E\x32\x0E\x29\x0E\x32\x0E\x44\x0E\x17\x0E\x22", "Thai", "th_TH.UTF-8" | ||
22 | "\x00\x54\x00\xFC\x00\x72\x00\x6B\x00\xE7\x00\x65", "Turkish", "tr_TR.UTF-8" | ||
23 | "\x00\x54\x00\x69\x1E\xBF\x00\x6E\x00\x67\x00\x20\x00\x56\x00\x69\x1E\xC7\x00\x74", "Vietnamese", "vi_VN.UTF-8" | ||
24 | "\x65\xE5\x67\x2C\x8A\x9E", "Japanese", "ja_JP.UTF-8" | ||
25 | "\x4E\x2D\x65\x87", "Chinese", "zh_CN.UTF-8" | ||
26 | "\xD5\x5C\xAE\x00", "Korean", "ko_KR.UTF-8" |
File tests/lang-ucs2.in added (mode: 100644) (index 0000000..4766a7d) |
File tests/lang-utf8.exp added (mode: 100644) (index 0000000..56d9572) | |||
1 | in word set አማርኛ | ||
2 | in word set česky | ||
3 | in word set Dansk | ||
4 | in word set English | ||
5 | in word set Suomi | ||
6 | in word set Français | ||
7 | in word set Deutsch | ||
8 | in word set Ελληνικά | ||
9 | in word set עברית | ||
10 | in word set Italiano | ||
11 | in word set Norsk | ||
12 | in word set Русский | ||
13 | in word set Español | ||
14 | in word set Svenska | ||
15 | in word set ภาษาไทย | ||
16 | in word set Türkçe | ||
17 | in word set Tiếng Việt | ||
18 | in word set 日本語 | ||
19 | in word set 中文 | ||
20 | in word set 한글 |
File tests/lang-utf8.gperf added (mode: 100644) (index 0000000..2beacdd) | |||
1 | struct language { | ||
2 | const char *foreign_name; | ||
3 | const char *english_name; | ||
4 | const char *locale; | ||
5 | }; | ||
6 | %% | ||
7 | አማርኛ, "Amharic", NULL | ||
8 | česky, "Czech", "cs_CZ.UTF-8" | ||
9 | Dansk, "Danish", "da_DK.UTF-8" | ||
10 | English, "English", "en_GB.UTF-8" | ||
11 | Suomi, "Finnish", "fi_FI.UTF-8" | ||
12 | Français, "French", "fr_FR.UTF-8" | ||
13 | Deutsch, "German", "de_DE.UTF-8" | ||
14 | Ελληνικά, "Greek", "el_GR.UTF-8" | ||
15 | עברית, "Hebrew", "he_IL.UTF-8" | ||
16 | Italiano, "Italian", "it_IT.UTF-8" | ||
17 | Norsk, "Norwegian", "no_NO.UTF-8" | ||
18 | Русский, "Russian", "ru_RU.UTF-8" | ||
19 | Español, "Spanish", "es_ES.UTF-8" | ||
20 | Svenska, "Swedish", "sv_SE.UTF-8" | ||
21 | ภาษาไทย, "Thai", "th_TH.UTF-8" | ||
22 | Türkçe, "Turkish", "tr_TR.UTF-8" | ||
23 | Tiếng Việt, "Vietnamese", "vi_VN.UTF-8" | ||
24 | 日本語, "Japanese", "ja_JP.UTF-8" | ||
25 | 中文, "Chinese", "zh_CN.UTF-8" | ||
26 | 한글, "Korean", "ko_KR.UTF-8" |
File tests/languages.exp added (mode: 100644) (index 0000000..22c58f5) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -C -E -G -I -t */ | ||
3 | /* Computed positions: -k'1-3,5,$' */ | ||
4 | |||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
28 | /* The character set is not based on ISO-646. */ | ||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>." | ||
30 | #endif | ||
31 | |||
32 | |||
33 | /* gperf -CDEGTlot -H language_hash -K code -L ANSI-C -N language_entry */ | ||
34 | /* Generated from ISO 639 language data from http://lcweb.loc.gov/standards/iso639-2/langhome.html | ||
35 | and from IANA registry at https://www.iana.org/assignments/language-tags | ||
36 | by %M% | ||
37 | */ | ||
38 | /* englangn.html Updated: August 14, 2002 */ | ||
39 | /* frenchlangn.html Updated: August 14, 2002 */ | ||
40 | /* language-tags last updated 2001-07-17 */ | ||
41 | struct language { const char *code; const char *name_en; int num_en; const char *name_fr; int num_fr; }; | ||
42 | #include <string.h> | ||
43 | enum | ||
44 | { | ||
45 | TOTAL_KEYWORDS = 685, | ||
46 | MIN_WORD_LENGTH = 2, | ||
47 | MAX_WORD_LENGTH = 11, | ||
48 | MIN_HASH_VALUE = 28, | ||
49 | MAX_HASH_VALUE = 3860 | ||
50 | }; | ||
51 | |||
52 | /* maximum key range = 3833, duplicates = 0 */ | ||
53 | |||
54 | #ifdef __GNUC__ | ||
55 | __inline | ||
56 | #else | ||
57 | #ifdef __cplusplus | ||
58 | inline | ||
59 | #endif | ||
60 | #endif | ||
61 | static unsigned int | ||
62 | hash (register const char *str, register size_t len) | ||
63 | { | ||
64 | static const unsigned short asso_values[] = | ||
65 | { | ||
66 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
67 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
68 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
69 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
70 | 3861, 3861, 3861, 3861, 3861, 115, 3861, 3861, 3861, 25, | ||
71 | 3861, 3861, 3861, 3861, 55, 3861, 3861, 3861, 0, 3861, | ||
72 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
73 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
74 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
75 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 180, 520, 1021, | ||
76 | 77, 1006, 757, 660, 146, 950, 155, 25, 220, 20, | ||
77 | 5, 775, 745, 331, 60, 0, 85, 895, 351, 447, | ||
78 | 965, 866, 585, 87, 877, 480, 670, 1015, 100, 3861, | ||
79 | 261, 60, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
80 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
81 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
82 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
83 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
84 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
85 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
86 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
87 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
88 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
89 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
90 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
91 | 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, | ||
92 | 3861, 3861, 3861, 3861, 3861 | ||
93 | }; | ||
94 | register unsigned int hval = len; | ||
95 | |||
96 | switch (hval) | ||
97 | { | ||
98 | default: | ||
99 | hval += asso_values[(unsigned char)str[4]+1]; | ||
100 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
101 | [[fallthrough]]; | ||
102 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
103 | __attribute__ ((__fallthrough__)); | ||
104 | #endif | ||
105 | /*FALLTHROUGH*/ | ||
106 | case 4: | ||
107 | case 3: | ||
108 | hval += asso_values[(unsigned char)str[2]]; | ||
109 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
110 | [[fallthrough]]; | ||
111 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
112 | __attribute__ ((__fallthrough__)); | ||
113 | #endif | ||
114 | /*FALLTHROUGH*/ | ||
115 | case 2: | ||
116 | hval += asso_values[(unsigned char)str[1]+9]; | ||
117 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
118 | [[fallthrough]]; | ||
119 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
120 | __attribute__ ((__fallthrough__)); | ||
121 | #endif | ||
122 | /*FALLTHROUGH*/ | ||
123 | case 1: | ||
124 | hval += asso_values[(unsigned char)str[0]]; | ||
125 | break; | ||
126 | } | ||
127 | return hval + asso_values[(unsigned char)str[len - 1]]; | ||
128 | } | ||
129 | |||
130 | static const struct language wordlist[] = | ||
131 | { | ||
132 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
133 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
134 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
135 | {""}, | ||
136 | {"nds", "Low Saxon; Low German; Saxon, Low; German, Low", 240, "saxon, bas; allemand, bas; bas saxon; bas allemand", 363}, | ||
137 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
138 | {"men", "Mende", 272, "mend�", 269}, | ||
139 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
140 | {"sem", "Semitic (Other)", 362, "s�mitiques, autres langues", 365}, | ||
141 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
142 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
143 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
144 | {"sin", "Sinhalese", 371, "singhalais", 371}, | ||
145 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
146 | {"mis", "Miscellaneous languages", 275, "diverses, langues", 106}, | ||
147 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
148 | {"min", "Minangkabau", 274, "minangkabau", 271}, | ||
149 | {""}, | ||
150 | {"den", "Slave (Athapascan)", 375, "esclave (athapascan)", 118}, | ||
151 | {""}, {""}, | ||
152 | {"kin", "Kinyarwanda", 211, "rwanda", 347}, | ||
153 | {"sd", "Sindhi", 370, "sindhi", 370}, | ||
154 | {""}, {""}, {""}, {""}, | ||
155 | {"nd", "North Ndebele", 301, "nd�b�l� du Nord", 285}, | ||
156 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
157 | {"sk", "Slovak", 377, "slovaque", 375}, | ||
158 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
159 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
160 | {""}, | ||
161 | {"mk", "Macedonian", 250, "mac�donien", 244}, | ||
162 | {"tem", "Timne", 412, "temne", 402}, | ||
163 | {""}, {""}, {""}, | ||
164 | {"kk", "Kazakh", 204, "kazakh", 205}, | ||
165 | {"kik", "Kikuyu; Gikuyu", 209, "kikuyu", 210}, | ||
166 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
167 | {""}, | ||
168 | {"sr", "Serbian", 363, "serbe", 366}, | ||
169 | {"din", "Dinka", 100, "dinka", 104}, | ||
170 | {""}, {""}, {""}, | ||
171 | {"nr", "South Ndebele", 388, "nd�b�l� du Sud", 286}, | ||
172 | {""}, {""}, {""}, | ||
173 | {"sas", "Sasak", 358, "sasak", 362}, | ||
174 | {""}, {""}, {""}, {""}, | ||
175 | {"mdr", "Mandar", 260, "mandar", 256}, | ||
176 | {""}, {""}, {""}, {""}, | ||
177 | {"san", "Sanskrit", 355, "sanskrit", 359}, | ||
178 | {"mr", "Marathi", 266, "marathe", 263}, | ||
179 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
180 | {"mas", "Masai", 270, "massa�", 267}, | ||
181 | {""}, {""}, {""}, | ||
182 | {"kj", "Kwanyama, Kuanyama", 225, "kwanyama; kuanyama", 225}, | ||
183 | {"kas", "Kashmiri", 202, "kashmiri", 203}, | ||
184 | {""}, {""}, {""}, {""}, | ||
185 | {"man", "Mandingo", 261, "mandingue", 257}, | ||
186 | {""}, {""}, {""}, {""}, | ||
187 | {"kan", "Kannada", 198, "kannada", 199}, | ||
188 | {""}, {""}, {""}, | ||
189 | {"tk", "Turkmen", 426, "turkm�ne", 425}, | ||
190 | {"sam", "Samaritan Aramaic", 350, "samaritain", 349}, | ||
191 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
192 | {"kir", "Kirghiz", 212, "kirghize", 212}, | ||
193 | {""}, | ||
194 | {"srr", "Serer", 364, "s�r�re", 367}, | ||
195 | {""}, {""}, | ||
196 | {"ter", "Tereno", 406, "tereno", 403}, | ||
197 | {""}, {""}, {""}, | ||
198 | {"sid", "Sidamo", 367, "sidamo", 369}, | ||
199 | {""}, | ||
200 | {"hin", "Hindi", 165, "hindi", 165}, | ||
201 | {""}, {""}, {""}, | ||
202 | {"kam", "Kamba", 197, "kamba", 198}, | ||
203 | {""}, {""}, {""}, {""}, | ||
204 | {"mak", "Makasar", 254, "makassar", 248}, | ||
205 | {"de-1901", "German traditional orthography", 464, "German traditional orthography", 455}, | ||
206 | {""}, {""}, {""}, | ||
207 | {"sit", "Sino-Tibetan (Other)", 372, "sino-tib�taines, autres langues", 372}, | ||
208 | {"tr", "Turkish", 424, "turc", 423}, | ||
209 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
210 | {"mwr", "Marwari", 269, "marvari", 266}, | ||
211 | {"srd", "Sardinian", 357, "sarde", 361}, | ||
212 | {"dan", "Danish", 97, "danois", 101}, | ||
213 | {""}, {""}, {""}, | ||
214 | {"him", "Himachali", 164, "himachali", 164}, | ||
215 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
216 | {"abk", "Abkhazian", 1, "abkhaze", 1}, | ||
217 | {"de-1996", "German orthography of 1996", 465, "German orthography of 1996", 456}, | ||
218 | {""}, {""}, | ||
219 | {"mkd", "Macedonian", 250, "mac�donien", 244}, | ||
220 | {"tet", "Tetum", 407, "tetum", 404}, | ||
221 | {""}, {""}, {""}, {""}, | ||
222 | {"tir", "Tigrinya", 411, "tigrigna", 409}, | ||
223 | {""}, {""}, {""}, {""}, {""}, | ||
224 | {"her", "Herero", 162, "herero", 162}, | ||
225 | {""}, {""}, {""}, {""}, | ||
226 | {"nyn", "Nyankole", 308, "nyankol�", 303}, | ||
227 | {"arn", "Araucanian", 20, "araucan", 25}, | ||
228 | {""}, {""}, | ||
229 | {"tam", "Tamil", 403, "tamoul", 396}, | ||
230 | {""}, | ||
231 | {"dak", "Dakota", 96, "dakota", 100}, | ||
232 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
233 | {"lin", "Lingala", 237, "lingala", 234}, | ||
234 | {"myn", "Mayan languages", 271, "maya, langues", 268}, | ||
235 | {"hr", "Croatian", 93, "croate", 99}, | ||
236 | {""}, {""}, | ||
237 | {"mar", "Marathi", 266, "marathe", 263}, | ||
238 | {""}, {""}, {""}, {""}, | ||
239 | {"kar", "Karen", 201, "karen", 202}, | ||
240 | {""}, {""}, {""}, {""}, {""}, | ||
241 | {"nym", "Nyamwezi", 306, "nyamwezi", 301}, | ||
242 | {"arm", "Armenian", 22, "arm�nien", 27}, | ||
243 | {""}, | ||
244 | {"sad", "Sandawe", 353, "sandawe", 357}, | ||
245 | {""}, {""}, {""}, {""}, {""}, | ||
246 | {"akk", "Akkadian", 10, "akkadien", 10}, | ||
247 | {""}, {""}, {""}, {""}, | ||
248 | {"lim", "Limburgish; Limburger; Limburgan", 236, "limbourgeois", 233}, | ||
249 | {""}, {""}, {""}, {""}, | ||
250 | {"sat", "Santali", 356, "santal", 360}, | ||
251 | {"ar", "Arabic", 17, "arabe", 22}, | ||
252 | {""}, {""}, | ||
253 | {"mad", "Madurese", 251, "madourais", 245}, | ||
254 | {""}, {""}, {""}, {""}, | ||
255 | {"sa", "Sanskrit", 355, "sanskrit", 359}, | ||
256 | {"rar", "Rarotongan", 343, "rarotonga", 341}, | ||
257 | {""}, {""}, {""}, | ||
258 | {"na", "Nauru", 285, "nauruan", 283}, | ||
259 | {"scr", "Croatian", 93, "croate", 99}, | ||
260 | {"shn", "Shan", 365, "chan", 80}, | ||
261 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
262 | {"kat", "Georgian", 141, "g�orgien", 145}, | ||
263 | {"sms", "Skolt Sami", 374, "sami skolt", 355}, | ||
264 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
265 | {"ka", "Georgian", 141, "g�orgien", 145}, | ||
266 | {""}, | ||
267 | {"smn", "Inari Sami", 177, "sami d'Inari", 352}, | ||
268 | {""}, {""}, {""}, {""}, | ||
269 | {"ven", "Venda", 438, "venda", 431}, | ||
270 | {""}, {""}, {""}, | ||
271 | {"sm", "Samoan", 352, "samoan", 356}, | ||
272 | {""}, {""}, {""}, {""}, {""}, | ||
273 | {"hit", "Hittite", 167, "hittite", 167}, | ||
274 | {""}, {""}, {""}, {""}, | ||
275 | {"syr", "Syriac", 397, "syriaque", 391}, | ||
276 | {""}, {""}, | ||
277 | {"art-lojban", "Lojban", 462, "Lojban", 453}, | ||
278 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
279 | {""}, | ||
280 | {"km", "Khmer", 206, "khmer", 207}, | ||
281 | {"khm", "Khmer", 206, "khmer", 207}, | ||
282 | {"mkh", "Mon-Khmer (Other)", 278, "m�n-khmer, autres langues", 274}, | ||
283 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
284 | {""}, {""}, {""}, | ||
285 | {"tat", "Tatar", 404, "tatar", 397}, | ||
286 | {"da", "Danish", 97, "danois", 101}, | ||
287 | {""}, {""}, {""}, | ||
288 | {"lam", "Lamba", 228, "lamba", 227}, | ||
289 | {""}, {""}, {""}, | ||
290 | {"ta", "Tamil", 403, "tamoul", 396}, | ||
291 | {""}, {""}, {""}, {""}, {""}, | ||
292 | {"nia", "Nias", 294, "nias", 292}, | ||
293 | {""}, {""}, {""}, {""}, | ||
294 | {"rm", "Raeto-Romance", 340, "rh�to-roman", 342}, | ||
295 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
296 | {"art", "Artificial (Other)", 23, "artificielles, autres langues", 28}, | ||
297 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
298 | {"sel", "Selkup", 361, "selkoupe", 364}, | ||
299 | {""}, | ||
300 | {"sah", "Yakut", 450, "iakoute", 171}, | ||
301 | {""}, {""}, | ||
302 | {"lit", "Lithuanian", 238, "lituanien", 235}, | ||
303 | {"sn", "Shona", 366, "shona", 368}, | ||
304 | {"nah", "Nahuatl", 284, "nahuatl", 281}, | ||
305 | {""}, {""}, | ||
306 | {"aar", "Afar", 5, "afar", 5}, | ||
307 | {"nn", "Nynorsk, Norwegian; Norwegian Nynorsk", 309, "nynorsk, norv�gien; norv�gien nynorsk", 304}, | ||
308 | {""}, {""}, {""}, | ||
309 | {"swa", "Swahili", 394, "swahili", 389}, | ||
310 | {""}, | ||
311 | {"wen", "Sorbian languages", 383, "sorabes, langues", 381}, | ||
312 | {""}, {""}, {""}, {""}, | ||
313 | {"mah", "Marshallese", 268, "marshall", 265}, | ||
314 | {""}, {""}, | ||
315 | {"nbl", "South Ndebele", 388, "nd�b�l� du Sud", 286}, | ||
316 | {"mn", "Mongolian", 280, "mongol", 276}, | ||
317 | {""}, {""}, {""}, {""}, | ||
318 | {"kn", "Kannada", 198, "kannada", 199}, | ||
319 | {""}, {""}, {""}, | ||
320 | {"ha", "Hausa", 159, "haoussa", 159}, | ||
321 | {"aym", "Aymara", 32, "aymara", 36}, | ||
322 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
323 | {"ja", "Japanese", 190, "japonais", 191}, | ||
324 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
325 | {"mh", "Marshallese", 268, "marshall", 265}, | ||
326 | {"snk", "Soninke", 382, "sonink�", 380}, | ||
327 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
328 | {"hmn", "Hmong", 168, "hmong", 168}, | ||
329 | {""}, {""}, {""}, | ||
330 | {"rn", "Rundi", 347, "rundi", 345}, | ||
331 | {""}, {""}, | ||
332 | {"aa", "Afar", 5, "afar", 5}, | ||
333 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
334 | {"del", "Delaware", 99, "delaware", 103}, | ||
335 | {""}, | ||
336 | {"dra", "Dravidian (Other)", 104, "dravidiennes, autres langues", 111}, | ||
337 | {"raj", "Rajasthani", 341, "rajasthani", 339}, | ||
338 | {""}, {""}, {""}, | ||
339 | {"lad", "Ladino", 226, "jud�o-espagnol", 194}, | ||
340 | {"tel", "Telugu", 405, "t�lougou", 401}, | ||
341 | {""}, | ||
342 | {"tah", "Tahitian", 399, "tahitien", 394}, | ||
343 | {""}, {""}, | ||
344 | {"ben", "Bengali", 49, "bengali", 54}, | ||
345 | {"tn", "Tswana", 421, "tswana", 420}, | ||
346 | {""}, {""}, {""}, | ||
347 | {"kaa", "Kara-Kalpak", 200, "karakalpak", 201}, | ||
348 | {""}, {""}, {""}, {""}, | ||
349 | {"lat", "Latin", 230, "latin", 230}, | ||
350 | {"sw", "Swahili", 394, "swahili", 389}, | ||
351 | {""}, {""}, | ||
352 | {"nb", "Norwegian Bokm�l; Bokm�l, Norwegian", 303, "norv�gien bokm�l; bokm�l, norv�gien", 298}, | ||
353 | {"am", "Amharic", 15, "amharique", 17}, | ||
354 | {""}, {""}, {""}, | ||
355 | {"la", "Latin", 230, "latin", 230}, | ||
356 | {""}, {""}, {""}, {""}, {""}, | ||
357 | {"ada", "Adangme", 4, "adangme", 4}, | ||
358 | {"th", "Thai", 408, "tha�", 405}, | ||
359 | {""}, {""}, | ||
360 | {"st", "Sotho, Southern", 385, "sotho du Sud", 383}, | ||
361 | {"bem", "Bemba", 48, "bemba", 53}, | ||
362 | {""}, {""}, {""}, {""}, {""}, | ||
363 | {"kw", "Cornish", 88, "cornique", 94}, | ||
364 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
365 | {"bis", "Bislama", 55, "bichlamar", 57}, | ||
366 | {""}, {""}, {""}, | ||
367 | {"mt", "Maltese", 258, "maltais", 254}, | ||
368 | {""}, {""}, {""}, {""}, {""}, | ||
369 | {"bin", "Bini", 54, "bini", 61}, | ||
370 | {""}, {""}, {""}, {""}, | ||
371 | {"sal", "Salishan languages", 349, "salish, langues", 348}, | ||
372 | {""}, {""}, {""}, {""}, | ||
373 | {"zen", "Zenaga", 458, "zenaga", 449}, | ||
374 | {"snd", "Sindhi", 370, "sindhi", 370}, | ||
375 | {"was", "Washo", 446, "washo", 439}, | ||
376 | {""}, {""}, {""}, | ||
377 | {"rw", "Kinyarwanda", 211, "rwanda", 347}, | ||
378 | {""}, {""}, {""}, | ||
379 | {"tkl", "Tokelau", 416, "tokelau", 413}, | ||
380 | {""}, {""}, {""}, {""}, | ||
381 | {"mal", "Malayalam", 257, "malayalam", 250}, | ||
382 | {""}, {""}, {""}, {""}, | ||
383 | {"kal", "Kalaallisut", 196, "groenlandais", 154}, | ||
384 | {""}, {""}, {""}, {""}, | ||
385 | {"aka", "Akan", 9, "akan", 9}, | ||
386 | {"nya", "Nyanja; Chichewa; Chewa", 307, "nyanja; chichewa; chewa", 302}, | ||
387 | {"ara", "Arabic", 17, "arabe", 22}, | ||
388 | {""}, {""}, | ||
389 | {"bik", "Bikol", 53, "bikol", 60}, | ||
390 | {"tw", "Twi", 429, "twi", 427}, | ||
391 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
392 | {"awa", "Awadhi", 31, "awadhi", 35}, | ||
393 | {"mya", "Burmese", 63, "birman", 62}, | ||
394 | {""}, {""}, {""}, | ||
395 | {"ber", "Berber (Other)", 50, "berb�res, autres langues", 55}, | ||
396 | {"hil", "Hiligaynon", 163, "hiligaynon", 163}, | ||
397 | {""}, {""}, | ||
398 | {"tt", "Tatar", 404, "tatar", 397}, | ||
399 | {""}, {""}, | ||
400 | {"wak", "Wakashan languages", 442, "wakashennes, langues", 435}, | ||
401 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
402 | {"smj", "Lule Sami", 245, "sami de Lule", 351}, | ||
403 | {""}, {""}, {""}, {""}, | ||
404 | {"br", "Breton", 59, "breton", 68}, | ||
405 | {"lah", "Lahnda", 227, "lahnda", 226}, | ||
406 | {""}, {""}, | ||
407 | {"sus", "Susu", 393, "soussou", 385}, | ||
408 | {"ln", "Lingala", 237, "lingala", 234}, | ||
409 | {""}, {""}, {""}, | ||
410 | {"bas", "Basa", 42, "basa", 49}, | ||
411 | {""}, {""}, {""}, {""}, | ||
412 | {"sun", "Sundanese", 392, "soundanais", 384}, | ||
413 | {""}, {""}, {""}, {""}, | ||
414 | {"ban", "Balinese", 35, "balinais", 40}, | ||
415 | {""}, {""}, {""}, {""}, | ||
416 | {"mus", "Creek", 91, "muskogee", 280}, | ||
417 | {""}, | ||
418 | {"ach", "Acoli", 3, "acoli", 3}, | ||
419 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
420 | {"mun", "Munda languages", 283, "mounda, langues", 278}, | ||
421 | {""}, {""}, {""}, {""}, | ||
422 | {"gem", "Germanic (Other)", 146, "germaniques, autres langues", 146}, | ||
423 | {""}, {""}, {""}, {""}, {""}, | ||
424 | {"sma", "Southern Sami", 387, "sami du Sud", 354}, | ||
425 | {""}, {""}, {""}, | ||
426 | {"bam", "Bambara", 38, "bambara", 43}, | ||
427 | {"kha", "Khasi", 205, "khasi", 206}, | ||
428 | {""}, {""}, {""}, | ||
429 | {"suk", "Sukuma", 390, "sukuma", 387}, | ||
430 | {"dz", "Dzongkha", 109, "dzongkha", 112}, | ||
431 | {"war", "Waray", 445, "waray", 438}, | ||
432 | {""}, | ||
433 | {"ab", "Abkhazian", 1, "abkhaze", 1}, | ||
434 | {"bak", "Bashkir", 43, "bachkir", 39}, | ||
435 | {""}, {""}, | ||
436 | {"tmh", "Tamashek", 402, "tamacheq", 395}, | ||
437 | {""}, | ||
438 | {"rus", "Russian", 348, "russe", 346}, | ||
439 | {""}, {""}, {""}, {""}, | ||
440 | {"kum", "Kumyk", 221, "koumyk", 218}, | ||
441 | {""}, {""}, {""}, {""}, | ||
442 | {"run", "Rundi", 347, "rundi", 345}, | ||
443 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
444 | {""}, {""}, {""}, {""}, {""}, | ||
445 | {"sgn", "Sign languages", 368, "langues des signes", 228}, | ||
446 | {"gd", "Scottish Gaelic; Gaelic", 360, "ga�lique �cossais; ga�lique", 138}, | ||
447 | {"grn", "Guarani", 155, "guarani", 155}, | ||
448 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
449 | {"lb", "Luxembourgish; Letzeburgesch", 249, "luxembourgeois", 243}, | ||
450 | {""}, {""}, {""}, {""}, {""}, | ||
451 | {"rum", "Romanian", 345, "roumain", 344}, | ||
452 | {""}, {""}, {""}, {""}, {""}, | ||
453 | {"tha", "Thai", 408, "tha�", 405}, | ||
454 | {""}, {""}, {""}, {""}, | ||
455 | {"wa", "Walloon", 444, "wallon", 437}, | ||
456 | {""}, {""}, | ||
457 | {"lt", "Lithuanian", 238, "lituanien", 235}, | ||
458 | {"ger", "German", 142, "allemand", 14}, | ||
459 | {""}, | ||
460 | {"dum", "Dutch, Middle (ca. 1050-1350)", 107, "n�erlandais moyen (ca. 1050-1350)", 289}, | ||
461 | {""}, {""}, | ||
462 | {"hz", "Herero", 162, "herero", 162}, | ||
463 | {""}, {""}, {""}, {""}, | ||
464 | {"tum", "Tumbuka", 422, "tumbuka", 421}, | ||
465 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
466 | {"tuk", "Turkmen", 426, "turkm�ne", 425}, | ||
467 | {""}, | ||
468 | {"sna", "Shona", 366, "shona", 368}, | ||
469 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
470 | {"kur", "Kurdish", 222, "kurde", 222}, | ||
471 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
472 | {"amh", "Amharic", 15, "amharique", 17}, | ||
473 | {"az", "Azerbaijani", 33, "az�ri", 37}, | ||
474 | {""}, | ||
475 | {"hun", "Hungarian", 169, "hongrois", 169}, | ||
476 | {"fin", "Finnish", 125, "finnois", 129}, | ||
477 | {""}, | ||
478 | {"bad", "Banda", 40, "banda", 45}, | ||
479 | {""}, {""}, {""}, {""}, {""}, | ||
480 | {"bej", "Beja", 46, "bedja", 52}, | ||
481 | {""}, {""}, {""}, | ||
482 | {"div", "Divehi", 101, "maldivien", 252}, | ||
483 | {""}, {""}, {""}, {""}, {""}, | ||
484 | {"bat", "Baltic (Other)", 36, "baltiques, autres langues", 42}, | ||
485 | {""}, | ||
486 | {"tiv", "Tiv", 413, "tiv", 410}, | ||
487 | {""}, {""}, | ||
488 | {"aus", "Australian languages", 27, "australiennes, langues", 32}, | ||
489 | {""}, {""}, {""}, | ||
490 | {"ba", "Bashkir", 43, "bachkir", 39}, | ||
491 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
492 | {"nav", "Navajo; Navaho", 287, "navaho", 284}, | ||
493 | {""}, {""}, | ||
494 | {"kut", "Kutenai", 224, "kutenai", 224}, | ||
495 | {""}, {""}, {""}, {""}, | ||
496 | {"per", "Persian", 328, "persan", 327}, | ||
497 | {""}, | ||
498 | {"bih", "Bihari", 52, "bihari", 59}, | ||
499 | {""}, {""}, | ||
500 | {"tur", "Turkish", 424, "turc", 423}, | ||
501 | {"ss", "Swati", 395, "swati", 390}, | ||
502 | {""}, {""}, {""}, | ||
503 | {"tgk", "Tajik", 401, "tadjik", 392}, | ||
504 | {""}, {""}, {""}, | ||
505 | {"frm", "French, Middle (ca.1400-1600)", 129, "fran�ais moyen (1400-1600)", 133}, | ||
506 | {""}, {""}, {""}, {""}, {""}, | ||
507 | {"lus", "Lushai", 248, "lushai", 242}, | ||
508 | {""}, | ||
509 | {"wel", "Welsh", 447, "gallois", 141}, | ||
510 | {""}, {""}, {""}, | ||
511 | {"ms", "Malay", 256, "malais", 249}, | ||
512 | {""}, {""}, {""}, | ||
513 | {"lun", "Lunda", 246, "lunda", 240}, | ||
514 | {"ks", "Kashmiri", 202, "kashmiri", 203}, | ||
515 | {"orm", "Oromo", 315, "galla", 140}, | ||
516 | {"fr", "French", 128, "fran�ais", 131}, | ||
517 | {"new", "Newari", 293, "newari", 291}, | ||
518 | {""}, {""}, {""}, {""}, {""}, | ||
519 | {"pan", "Panjabi", 325, "pendjabi", 326}, | ||
520 | {"fj", "Fijian", 124, "fidjien", 127}, | ||
521 | {"fas", "Persian", 328, "persan", 327}, | ||
522 | {""}, {""}, | ||
523 | {"sq", "Albanian", 11, "albanais", 11}, | ||
524 | {""}, | ||
525 | {"dut", "Dutch", 106, "n�erlandais", 288}, | ||
526 | {""}, | ||
527 | {"za", "Zhuang; Chuang", 459, "zhuang; chuang", 450}, | ||
528 | {""}, | ||
529 | {"or", "Oriya", 314, "oriya", 309}, | ||
530 | {"fan", "Fang", 121, "fang", 124}, | ||
531 | {""}, {""}, | ||
532 | {"tut", "Altaic (Other)", 14, "alta�ques, autres langues", 16}, | ||
533 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
534 | {"hrv", "Croatian", 93, "croate", 99}, | ||
535 | {""}, {""}, {""}, {""}, | ||
536 | {"pam", "Pampanga", 323, "pampangan", 322}, | ||
537 | {""}, | ||
538 | {"dgr", "Dogrib", 103, "dogrib", 109}, | ||
539 | {""}, {""}, | ||
540 | {"slk", "Slovak", 377, "slovaque", 375}, | ||
541 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
542 | {"ath", "Athapascan languages", 26, "athapascanes, langues", 31}, | ||
543 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
544 | {"sgn-gr", "Greek Sign Language", 498, "Greek Sign Language", 489}, | ||
545 | {""}, | ||
546 | {"ts", "Tsonga", 420, "tsonga", 419}, | ||
547 | {""}, {""}, {""}, | ||
548 | {"bel", "Belarusian", 47, "bi�lorusse", 58}, | ||
549 | {""}, | ||
550 | {"bra", "Braj", 58, "braj", 67}, | ||
551 | {""}, {""}, {""}, | ||
552 | {"bn", "Bengali", 49, "bengali", 54}, | ||
553 | {"tsn", "Tswana", 421, "tswana", 420}, | ||
554 | {""}, {""}, | ||
555 | {"son", "Songhai", 381, "songhai", 379}, | ||
556 | {""}, {""}, {""}, {""}, | ||
557 | {"non", "Norse, Old", 298, "norrois, vieux", 296}, | ||
558 | {""}, {""}, {""}, {""}, | ||
559 | {"mos", "Mossi", 281, "mor�", 277}, | ||
560 | {"de-de-1901", "German German variant traditional orthography", 470, "German German variant traditional orthography", 461}, | ||
561 | {""}, {""}, {""}, | ||
562 | {"kos", "Kosraean", 217, "kosrae", 217}, | ||
563 | {""}, {""}, | ||
564 | {"sgn-it", "Italian Sign Language", 500, "Italian Sign Language", 491}, | ||
565 | {"ga", "Irish", 185, "irlandais", 185}, | ||
566 | {"mon", "Mongolian", 280, "mongol", 276}, | ||
567 | {"bh", "Bihari", 52, "bihari", 59}, | ||
568 | {""}, {""}, {""}, | ||
569 | {"kon", "Kongo", 214, "kongo", 215}, | ||
570 | {""}, {""}, {""}, | ||
571 | {"uk", "Ukrainian", 432, "ukrainien", 428}, | ||
572 | {"som", "Somali", 380, "somali", 378}, | ||
573 | {""}, {""}, {""}, | ||
574 | {"si", "Sinhalese", 371, "singhalais", 371}, | ||
575 | {"se", "Northern Sami", 300, "sami du Nord", 353}, | ||
576 | {""}, | ||
577 | {"jav", "Javanese", 191, "javanais", 192}, | ||
578 | {""}, {""}, | ||
579 | {"ne", "Nepali", 292, "n�palais", 290}, | ||
580 | {"de-de-1996", "German German variant orthography of 1996", 471, "German German variant orthography of 1996", 462}, | ||
581 | {""}, {""}, {""}, | ||
582 | {"sgn-za", "South African Sign Language", 509, "South African Sign Language", 500}, | ||
583 | {""}, {""}, {""}, {""}, {""}, | ||
584 | {"ces", "Czech", 95, "tch�que", 398}, | ||
585 | {""}, {""}, | ||
586 | {"mi", "Maori", 265, "maori", 262}, | ||
587 | {"kom", "Komi", 213, "komi", 214}, | ||
588 | {"jpn", "Japanese", 190, "japonais", 191}, | ||
589 | {""}, {""}, | ||
590 | {"ki", "Kikuyu; Gikuyu", 209, "kikuyu", 210}, | ||
591 | {"ron", "Romanian", 345, "roumain", 344}, | ||
592 | {""}, {""}, {""}, {""}, | ||
593 | {"kok", "Konkani", 215, "konkani", 216}, | ||
594 | {"ur", "Urdu", 435, "ourdou", 316}, | ||
595 | {"wal", "Walamo", 443, "walamo", 436}, | ||
596 | {""}, {""}, | ||
597 | {"gba", "Gbaya", 139, "gbaya", 144}, | ||
598 | {"id", "Indonesian", 180, "indon�sien", 180}, | ||
599 | {""}, | ||
600 | {"tyv", "Tuvinian", 428, "touva", 416}, | ||
601 | {""}, | ||
602 | {"btk", "Batak (Indonesia)", 45, "batak (Indon�sie)", 51}, | ||
603 | {""}, {""}, {""}, | ||
604 | {"nld", "Dutch", 106, "n�erlandais", 288}, | ||
605 | {"kua", "Kwanyama, Kuanyama", 225, "kwanyama; kuanyama", 225}, | ||
606 | {"as", "Assamese", 24, "assamais", 29}, | ||
607 | {""}, {""}, | ||
608 | {"ik", "Inupiaq", 183, "inupiaq", 183}, | ||
609 | {"ton", "Tonga (Tonga Islands)", 418, "tongan (�les Tonga)", 415}, | ||
610 | {"zh", "Chinese", 80, "chinois", 86}, | ||
611 | {""}, {""}, {""}, | ||
612 | {"rom", "Romany", 346, "tsigane", 417}, | ||
613 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
614 | {"kaw", "Kawi", 203, "kawi", 204}, | ||
615 | {"afr", "Afrikaans", 7, "afrikaans", 7}, | ||
616 | {""}, | ||
617 | {"lav", "Latvian", 231, "letton", 231}, | ||
618 | {""}, | ||
619 | {"pa", "Panjabi", 325, "pendjabi", 326}, | ||
620 | {"yid", "Yiddish", 453, "yiddish", 444}, | ||
621 | {""}, | ||
622 | {"fat", "Fanti", 122, "fanti", 125}, | ||
623 | {""}, {""}, | ||
624 | {"mlt", "Maltese", 258, "maltais", 254}, | ||
625 | {"phn", "Phoenician", 331, "ph�nicien", 330}, | ||
626 | {"de", "German", 142, "allemand", 14}, | ||
627 | {""}, {""}, | ||
628 | {"nor", "Norwegian", 302, "norv�gien", 297}, | ||
629 | {"fa", "Persian", 328, "persan", 327}, | ||
630 | {""}, {""}, | ||
631 | {"ti", "Tigrinya", 411, "tigrigna", 409}, | ||
632 | {"te", "Telugu", 405, "t�lougou", 401}, | ||
633 | {""}, | ||
634 | {"asm", "Assamese", 24, "assamais", 29}, | ||
635 | {""}, {""}, | ||
636 | {"ukr", "Ukrainian", 432, "ukrainien", 428}, | ||
637 | {""}, {""}, {""}, | ||
638 | {"sgn-us", "American Sign Language", 508, "American Sign Language", 499}, | ||
639 | {"sga", "Irish, Old (to 900)", 187, "irlandais ancien (jusqu'� 900)", 186}, | ||
640 | {""}, | ||
641 | {"dua", "Duala", 105, "douala", 110}, | ||
642 | {""}, {""}, | ||
643 | {"kor", "Korean", 216, "cor�en", 93}, | ||
644 | {"gn", "Guarani", 155, "guarani", 155}, | ||
645 | {""}, {""}, | ||
646 | {"sl", "Slovenian", 378, "slov�ne", 376}, | ||
647 | {"bal", "Baluchi", 37, "baloutchi", 41}, | ||
648 | {""}, {""}, {""}, | ||
649 | {"nl", "Dutch", 106, "n�erlandais", 288}, | ||
650 | {""}, {""}, {""}, {""}, | ||
651 | {"de-at-1901", "German Austrian variant traditional orthography", 466, "German Austrian variant traditional orthography", 457}, | ||
652 | {"mga", "Irish, Middle (900-1200)", 186, "irlandais moyen (900-1200)", 187}, | ||
653 | {""}, | ||
654 | {"fij", "Fijian", 124, "fidjien", 127}, | ||
655 | {""}, {""}, | ||
656 | {"mul", "Multiple languages", 282, "multilingue", 279}, | ||
657 | {"ny", "Nyanja; Chichewa; Chewa", 307, "nyanja; chichewa; chewa", 302}, | ||
658 | {""}, {""}, | ||
659 | {"ml", "Malayalam", 257, "malayalam", 250}, | ||
660 | {"sot", "Sotho, Southern", 385, "sotho du Sud", 383}, | ||
661 | {"urd", "Urdu", 435, "ourdou", 316}, | ||
662 | {"bnt", "Bantu (Other)", 41, "bantoues, autres langues", 46}, | ||
663 | {""}, | ||
664 | {"kl", "Kalaallisut", 196, "groenlandais", 154}, | ||
665 | {""}, | ||
666 | {"jpr", "Judeo-Persian", 193, "jud�o-persan", 195}, | ||
667 | {""}, {""}, {""}, | ||
668 | {"om", "Oromo", 315, "galla", 140}, | ||
669 | {"my", "Burmese", 63, "birman", 62}, | ||
670 | {""}, {""}, {""}, {""}, | ||
671 | {"ky", "Kirghiz", 212, "kirghize", 212}, | ||
672 | {""}, {""}, | ||
673 | {"de-at-1996", "German Austrian variant orthography of 1996", 467, "German Austrian variant orthography of 1996", 458}, | ||
674 | {"hi", "Hindi", 165, "hindi", 165}, | ||
675 | {"he", "Hebrew", 161, "h�breu", 161}, | ||
676 | {""}, {""}, {""}, | ||
677 | {"gil", "Gilbertese", 148, "kiribati", 213}, | ||
678 | {"arw", "Arawak", 21, "arawak", 26}, | ||
679 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
680 | {"sgn-pt", "Portuguese Sign Language", 506, "Portuguese Sign Language", 497}, | ||
681 | {""}, {""}, {""}, {""}, {""}, | ||
682 | {"gaa", "Ga", 134, "ga", 136}, | ||
683 | {""}, {""}, {""}, | ||
684 | {"de-ch-1901", "German Swiss variant traditional orthography", 468, "German Swiss variant traditional orthography", 459}, | ||
685 | {""}, {""}, {""}, {""}, {""}, | ||
686 | {"tib", "Tibetan", 409, "tib�tain", 407}, | ||
687 | {"znd", "Zande", 456, "zand�", 447}, | ||
688 | {""}, {""}, {""}, | ||
689 | {"ae", "Avestan", 30, "avestique", 34}, | ||
690 | {"heb", "Hebrew", 161, "h�breu", 161}, | ||
691 | {"pra", "Prakrit languages", 335, "pr�krit", 335}, | ||
692 | {""}, | ||
693 | {"zh-min", "Min Fuzhou Hokkien Amoy or Taiwanese", 513, "Min Fuzhou Hokkien Amoy or Taiwanese", 504}, | ||
694 | {"haw", "Hawaiian", 160, "hawa�en", 160}, | ||
695 | {"i-klingon", "Klingon", 478, "Klingon", 469}, | ||
696 | {""}, | ||
697 | {"zh-min-nan", "Minnan Hokkien Amoy Taiwanese Southern Min Southern Fujian Hoklo Southern Fukien Ho-lo", 514, "Minnan Hokkien Amoy Taiwanese Southern Min Southern Fujian Hoklo Southern Fukien Ho-lo", 505}, | ||
698 | {"tl", "Tagalog", 398, "tagalog", 393}, | ||
699 | {""}, {""}, {""}, {""}, | ||
700 | {"fra", "French", 128, "fran�ais", 131}, | ||
701 | {""}, {""}, {""}, {""}, | ||
702 | {"de-ch-1996", "German Swiss variant orthography of 1996", 469, "German Swiss variant orthography of 1996", 460}, | ||
703 | {""}, | ||
704 | {"ty", "Tahitian", 399, "tahitien", 394}, | ||
705 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
706 | {"kab", "Kabyle", 194, "kabyle", 196}, | ||
707 | {""}, {""}, {""}, {""}, {""}, | ||
708 | {"spa", "Spanish; Castilian", 389, "espagnol; castillan", 119}, | ||
709 | {"ast", "Bable; Asturian", 34, "bable; asturien", 38}, | ||
710 | {""}, | ||
711 | {"li", "Limburgish; Limburger; Limburgan", 236, "limbourgeois", 233}, | ||
712 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
713 | {"ssa", "Nilo-Saharan (Other)", 296, "nilo-sahariennes, autres langues", 294}, | ||
714 | {""}, {""}, | ||
715 | {"sc", "Sardinian", 357, "sarde", 361}, | ||
716 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
717 | {"afh", "Afrihili", 6, "afrihili", 6}, | ||
718 | {""}, {""}, | ||
719 | {"lua", "Luba-Lulua", 243, "luba-lulua", 238}, | ||
720 | {""}, {""}, {""}, {""}, | ||
721 | {"sla", "Slavic (Other)", 376, "slaves, autres langues", 374}, | ||
722 | {""}, | ||
723 | {"msa", "Malay", 256, "malais", 249}, | ||
724 | {""}, {""}, | ||
725 | {"paa", "Papuan (Other)", 327, "papoues, autres langues", 325}, | ||
726 | {""}, {""}, {""}, {""}, | ||
727 | {"zun", "Zuni", 461, "Zuni", 452}, | ||
728 | {""}, {""}, {""}, {""}, | ||
729 | {"tgl", "Tagalog", 398, "tagalog", 393}, | ||
730 | {""}, | ||
731 | {"hy", "Armenian", 22, "arm�nien", 27}, | ||
732 | {""}, {""}, {""}, | ||
733 | {"zha", "Zhuang; Chuang", 459, "zhuang; chuang", 450}, | ||
734 | {"moh", "Mohawk", 276, "mohawk", 272}, | ||
735 | {""}, {""}, {""}, {""}, | ||
736 | {"jrb", "Judeo-Arabic", 192, "jud�o-arabe", 193}, | ||
737 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
738 | {""}, {""}, {""}, {""}, | ||
739 | {"car", "Carib", 65, "caribe", 72}, | ||
740 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
741 | {"gmh", "German, Middle High (ca.1050-1500)", 144, "", 0}, | ||
742 | {""}, {""}, | ||
743 | {"ay", "Aymara", 32, "aymara", 36}, | ||
744 | {""}, {""}, | ||
745 | {"pt", "Portuguese", 334, "portugais", 334}, | ||
746 | {"bur", "Burmese", 63, "birman", 62}, | ||
747 | {""}, {""}, {""}, {""}, | ||
748 | {"afa", "Afro-Asiatic (Other)", 8, "afro-asiatiques, autres langues", 8}, | ||
749 | {""}, | ||
750 | {"roh", "Raeto-Romance", 340, "rh�to-roman", 342}, | ||
751 | {""}, {""}, {""}, {""}, | ||
752 | {"cym", "Welsh", 447, "gallois", 141}, | ||
753 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
754 | {"cad", "Caddo", 64, "caddo", 71}, | ||
755 | {""}, {""}, {""}, {""}, | ||
756 | {"iba", "Iban", 171, "iban", 172}, | ||
757 | {""}, | ||
758 | {"baq", "Basque", 44, "basque", 50}, | ||
759 | {""}, {""}, | ||
760 | {"pal", "Pahlavi", 320, "pahlavi", 319}, | ||
761 | {""}, {""}, {""}, {""}, {""}, | ||
762 | {"cat", "Catalan", 67, "catalan", 74}, | ||
763 | {""}, {""}, {""}, | ||
764 | {"kaz", "Kazakh", 204, "kazakh", 205}, | ||
765 | {""}, | ||
766 | {"wln", "Walloon", 444, "wallon", 437}, | ||
767 | {""}, {""}, | ||
768 | {"ca", "Catalan", 67, "catalan", 74}, | ||
769 | {""}, {""}, {""}, {""}, | ||
770 | {"vi", "Vietnamese", 439, "vietnamien", 432}, | ||
771 | {""}, | ||
772 | {"chn", "Chinook jargon", 81, "chinook, jargon", 87}, | ||
773 | {""}, {""}, | ||
774 | {"sv", "Swedish", 396, "su�dois", 386}, | ||
775 | {""}, {""}, {""}, {""}, | ||
776 | {"nv", "Navajo; Navaho", 287, "navaho", 284}, | ||
777 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
778 | {""}, {""}, {""}, {""}, {""}, | ||
779 | {"roa", "Romance (Other)", 344, "romanes, autres langues", 343}, | ||
780 | {""}, {""}, {""}, {""}, | ||
781 | {"kv", "Komi", 213, "komi", 214}, | ||
782 | {""}, | ||
783 | {"chm", "Mari", 267, "mari", 264}, | ||
784 | {""}, {""}, | ||
785 | {"lez", "Lezghian", 233, "lezghien", 232}, | ||
786 | {"bs", "Bosnian", 57, "bosniaque", 65}, | ||
787 | {"ira", "Iranian (Other)", 184, "iraniennes, autres langues", 184}, | ||
788 | {"i-hak", "Hakka Deprecated use IETF zh-hakka registered Jan. 102000", 477, "Hakka Deprecated use IETF zh-hakka registered Jan. 102000", 468}, | ||
789 | {""}, {""}, {""}, | ||
790 | {"chk", "Chuukese", 85, "chuuk", 91}, | ||
791 | {""}, | ||
792 | {"sg", "Sango", 354, "sango", 358}, | ||
793 | {""}, | ||
794 | {"apa", "Apache languages", 16, "apache", 21}, | ||
795 | {""}, {""}, | ||
796 | {"ng", "Ndonga", 290, "ndonga", 287}, | ||
797 | {""}, {""}, {""}, {""}, {""}, | ||
798 | {"pus", "Pushto", 338, "pachto", 318}, | ||
799 | {"kmb", "Kimbundu", 210, "kimbundu", 211}, | ||
800 | {""}, {""}, | ||
801 | {"sgn-gb", "British Sign Language", 497, "British Sign Language", 488}, | ||
802 | {""}, {""}, {""}, {""}, | ||
803 | {"mg", "Malagasy", 255, "malgache", 253}, | ||
804 | {"mol", "Moldavian", 277, "moldave", 273}, | ||
805 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
806 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
807 | {"xh", "Xhosa", 449, "xhosa", 441}, | ||
808 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
809 | {"eka", "Ekajuk", 112, "ekajuk", 116}, | ||
810 | {""}, {""}, {""}, {""}, {""}, | ||
811 | {"en", "English", 114, "anglais", 18}, | ||
812 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
813 | {"tig", "Tigre", 410, "tigr�", 408}, | ||
814 | {"cel", "Celtic (Other)", 70, "celtiques, autres langues", 77}, | ||
815 | {""}, {""}, {""}, {""}, {""}, | ||
816 | {"chr", "Cherokee", 75, "cherokee", 81}, | ||
817 | {"sgn-fr", "French Sign Language", 496, "French Sign Language", 487}, | ||
818 | {""}, | ||
819 | {"sag", "Sango", 354, "sango", 358}, | ||
820 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
821 | {"bos", "Bosnian", 57, "bosniaque", 65}, | ||
822 | {"vot", "Votic", 441, "vote", 434}, | ||
823 | {""}, {""}, | ||
824 | {"tg", "Tajik", 401, "tadjik", 392}, | ||
825 | {""}, {""}, {""}, | ||
826 | {"enm", "English, Middle (1100-1500)", 115, "anglais moyen (1100-1500)", 19}, | ||
827 | {""}, | ||
828 | {"mag", "Magahi", 252, "magahi", 246}, | ||
829 | {"und", "Undetermined", 434, "ind�termin�e", 177}, | ||
830 | {"ch", "Chamorro", 73, "chamorro", 79}, | ||
831 | {""}, {""}, | ||
832 | {"nep", "Nepali", 292, "n�palais", 290}, | ||
833 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
834 | {"sgn-es", "Spanish Sign Language", 495, "Spanish Sign Language", 486}, | ||
835 | {""}, {""}, {""}, | ||
836 | {"it", "Italian", 189, "italien", 190}, | ||
837 | {""}, {""}, {""}, {""}, {""}, | ||
838 | {"jv", "Javanese", 191, "javanais", 192}, | ||
839 | {""}, {""}, | ||
840 | {"sgn-jp", "Japanese Sign Language", 501, "Japanese Sign Language", 492}, | ||
841 | {""}, {""}, {""}, {""}, {""}, | ||
842 | {"bi", "Bislama", 55, "bichlamar", 57}, | ||
843 | {"be", "Belarusian", 47, "bi�lorusse", 58}, | ||
844 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
845 | {"uz", "Uzbek", 436, "ouszbek", 317}, | ||
846 | {"tvl", "Tuvalu", 427, "tuvalu", 426}, | ||
847 | {""}, {""}, {""}, {""}, {""}, | ||
848 | {"cel-gaulish", "Gaulish", 463, "Gaulish", 454}, | ||
849 | {"fur", "Friulian", 132, "frioulan", 134}, | ||
850 | {""}, {""}, | ||
851 | {"bua", "Buriat", 62, "bouriate", 66}, | ||
852 | {"ind", "Indonesian", 180, "indon�sien", 180}, | ||
853 | {""}, {""}, {""}, | ||
854 | {"ava", "Avaric", 29, "avar", 33}, | ||
855 | {""}, {""}, {""}, | ||
856 | {"zh-gan", "Kan or Gan", 510, "Kan or Gan", 501}, | ||
857 | {""}, {""}, {""}, {""}, | ||
858 | {"su", "Sundanese", 392, "soundanais", 384}, | ||
859 | {""}, {""}, {""}, {""}, {""}, | ||
860 | {"et", "Estonian", 118, "estonien", 121}, | ||
861 | {""}, {""}, {""}, {""}, | ||
862 | {"ndo", "Ndonga", 290, "ndonga", 287}, | ||
863 | {""}, | ||
864 | {"srp", "Serbian", 363, "serbe", 366}, | ||
865 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
866 | {"lv", "Latvian", 231, "letton", 231}, | ||
867 | {""}, {""}, {""}, | ||
868 | {"ku", "Kurdish", 222, "kurde", 222}, | ||
869 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
870 | {"slv", "Slovenian", 378, "slov�ne", 376}, | ||
871 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
872 | {"sgn-co", "Colombian Sign Language", 492, "Colombian Sign Language", 483}, | ||
873 | {""}, {""}, {""}, {""}, | ||
874 | {"sio", "Siouan languages", 373, "sioux, langues", 373}, | ||
875 | {""}, {""}, {""}, {""}, | ||
876 | {"ota", "Turkish, Ottoman (1500-1928)", 425, "turc ottoman (1500-1928)", 424}, | ||
877 | {""}, {""}, {""}, {""}, {""}, | ||
878 | {"ps", "Pushto", 338, "pachto", 318}, | ||
879 | {""}, {""}, | ||
880 | {"ru", "Russian", 348, "russe", 346}, | ||
881 | {"lol", "Mongo", 279, "mongo", 275}, | ||
882 | {""}, {""}, {""}, {""}, | ||
883 | {"bul", "Bulgarian", 61, "bulgare", 70}, | ||
884 | {""}, {""}, {""}, {""}, | ||
885 | {"gon", "Gondi", 149, "gond", 147}, | ||
886 | {""}, {""}, {""}, | ||
887 | {"bod", "Tibetan", 409, "tib�tain", 407}, | ||
888 | {"guj", "Gujarati", 156, "goudjrati", 150}, | ||
889 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
890 | {"nap", "Neapolitan", 291, "napolitain", 282}, | ||
891 | {"os", "Ossetic; Ossetian", 318, "oss�te", 312}, | ||
892 | {"oss", "Ossetic; Ossetian", 318, "oss�te", 312}, | ||
893 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
894 | {"kro", "Kru", 219, "krou", 220}, | ||
895 | {""}, {""}, | ||
896 | {"map", "Austronesian (Other)", 28, "malayo-polyn�siennes, autres langues", 251}, | ||
897 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
898 | {""}, | ||
899 | {"eus", "Basque", 44, "basque", 50}, | ||
900 | {""}, | ||
901 | {"no-nyn", "Norwegian New Norwegian Deprecated use ISO 639 nn registered Feb. 18 2000", 487, "Norwegian New Norwegian Deprecated use ISO 639 nn registered Feb. 18 2000", 478}, | ||
902 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
903 | {"dzo", "Dzongkha", 109, "dzongkha", 112}, | ||
904 | {""}, {""}, {""}, | ||
905 | {"cus", "Cushitic (Other)", 94, "couchitiques, autres langues", 96}, | ||
906 | {""}, {""}, {""}, | ||
907 | {"zul", "Zulu", 460, "zoulou", 451}, | ||
908 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
909 | {"rap", "Rapanui", 342, "rapanui", 340}, | ||
910 | {""}, {""}, {""}, {""}, | ||
911 | {"hu", "Hungarian", 169, "hongrois", 169}, | ||
912 | {"af", "Afrikaans", 7, "afrikaans", 7}, | ||
913 | {"cha", "Chamorro", 73, "chamorro", 79}, | ||
914 | {""}, {""}, | ||
915 | {"nub", "Nubian languages", 305, "nubiennes, langues", 300}, | ||
916 | {""}, {""}, {""}, {""}, | ||
917 | {"pon", "Pohnpeian", 332, "pohnpei", 332}, | ||
918 | {""}, {""}, | ||
919 | {"sgn-mx", "Mexican Sign Language", 502, "Mexican Sign Language", 493}, | ||
920 | {""}, | ||
921 | {"mao", "Maori", 265, "maori", 262}, | ||
922 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
923 | {"fon", "Fon", 127, "fon", 130}, | ||
924 | {""}, {""}, {""}, | ||
925 | {"zh-hakka", "Hakka", 512, "Hakka", 503}, | ||
926 | {""}, {""}, | ||
927 | {"so", "Somali", 380, "somali", 378}, | ||
928 | {""}, {""}, {""}, {""}, | ||
929 | {"no", "Norwegian", 302, "norv�gien", 297}, | ||
930 | {"gor", "Gorontalo", 150, "gorontalo", 148}, | ||
931 | {""}, {""}, | ||
932 | {"sgn-nl", "Dutch Sign Language", 504, "Dutch Sign Language", 495}, | ||
933 | {""}, {""}, {""}, {""}, {""}, | ||
934 | {"pi", "Pali", 322, "pali", 321}, | ||
935 | {""}, | ||
936 | {"vol", "Volap�k", 440, "volap�k", 433}, | ||
937 | {"arp", "Arapaho", 19, "arapaho", 24}, | ||
938 | {""}, | ||
939 | {"mo", "Moldavian", 277, "moldave", 273}, | ||
940 | {""}, {""}, {""}, {""}, | ||
941 | {"ko", "Korean", 216, "cor�en", 93}, | ||
942 | {""}, | ||
943 | {"fi", "Finnish", 125, "finnois", 129}, | ||
944 | {""}, {""}, {""}, | ||
945 | {"sco", "Scots", 359, "�cossais", 113}, | ||
946 | {"ssw", "Swati", 395, "swati", 390}, | ||
947 | {""}, {""}, | ||
948 | {"gl", "Gallegan", 136, "galicien", 139}, | ||
949 | {"bla", "Siksika", 369, "blackfoot", 63}, | ||
950 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
951 | {"ypk", "Yupik languages", 455, "yupik, langues", 446}, | ||
952 | {""}, | ||
953 | {"sgn-dk", "Danish Sign Language", 494, "Danish Sign Language", 485}, | ||
954 | {""}, {""}, | ||
955 | {"grb", "Grebo", 152, "grebo", 151}, | ||
956 | {""}, {""}, | ||
957 | {"ita", "Italian", 189, "italien", 190}, | ||
958 | {""}, {""}, {""}, {""}, | ||
959 | {"got", "Gothic", 151, "gothique", 149}, | ||
960 | {""}, {""}, {""}, | ||
961 | {"ro", "Romanian", 345, "roumain", 344}, | ||
962 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
963 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
964 | {"nyo", "Nyoro", 310, "nyoro", 305}, | ||
965 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
966 | {"to", "Tonga (Tonga Islands)", 418, "tongan (�les Tonga)", 415}, | ||
967 | {""}, | ||
968 | {"is", "Icelandic", 172, "islandais", 189}, | ||
969 | {""}, {""}, {""}, | ||
970 | {"por", "Portuguese", 334, "portugais", 334}, | ||
971 | {""}, {""}, | ||
972 | {"i-default", "Default Language Context", 475, "Default Language Context", 466}, | ||
973 | {"sgn-br", "Brazilian Sign Language", 490, "Brazilian Sign Language", 481}, | ||
974 | {"gez", "Geez", 140, "gu�ze", 156}, | ||
975 | {""}, | ||
976 | {"sgn-be-fr", "Belgian-French Sign Language", 488, "Belgian-French Sign Language", 479}, | ||
977 | {""}, | ||
978 | {"sgn-ch-de", "Swiss German Sign Language", 491, "Swiss German Sign Language", 482}, | ||
979 | {""}, {""}, {""}, {""}, | ||
980 | {"sgn-se", "Swedish Sign Language", 507, "Swedish Sign Language", 498}, | ||
981 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
982 | {"zh-xiang", "Xiang or Hunanese", 516, "Xiang or Hunanese", 507}, | ||
983 | {"wol", "Wolof", 448, "wolof", 440}, | ||
984 | {""}, {""}, | ||
985 | {"niu", "Niuean", 297, "niu�", 295}, | ||
986 | {""}, {""}, | ||
987 | {"no-bok", "Norwegian Book language Deprecated use ISO 639 nb registered Feb. 18 2000", 486, "Norwegian Book language Deprecated use ISO 639 nb registered Feb. 18 2000", 477}, | ||
988 | {"pl", "Polish", 333, "polonais", 333}, | ||
989 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
990 | {"ipk", "Inupiaq", 183, "inupiaq", 183}, | ||
991 | {"ful", "Fulah", 133, "peul", 329}, | ||
992 | {""}, {""}, | ||
993 | {"ltz", "Luxembourgish; Letzeburgesch", 249, "luxembourgeois", 243}, | ||
994 | {""}, | ||
995 | {"deu", "German", 142, "allemand", 14}, | ||
996 | {""}, {""}, | ||
997 | {"yi", "Yiddish", 453, "yiddish", 444}, | ||
998 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
999 | {"es", "Spanish; Castilian", 389, "espagnol; castillan", 119}, | ||
1000 | {"fy", "Frisian", 131, "frison", 135}, | ||
1001 | {""}, | ||
1002 | {"ho", "Hiri Motu", 166, "hiri motu", 166}, | ||
1003 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1004 | {"qu", "Quechua", 339, "quechua", 338}, | ||
1005 | {""}, | ||
1006 | {"cs", "Czech", 95, "tch�que", 398}, | ||
1007 | {""}, {""}, {""}, | ||
1008 | {"smo", "Samoan", 352, "samoan", 356}, | ||
1009 | {"kru", "Kurukh", 223, "kurukh", 223}, | ||
1010 | {""}, {""}, {""}, | ||
1011 | {"kho", "Khotanese", 208, "khotanais", 209}, | ||
1012 | {"may", "Malay", 256, "malais", 249}, | ||
1013 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1014 | {"sgn-ie", "Irish Sign Language", 499, "Irish Sign Language", 490}, | ||
1015 | {"gla", "Scottish Gaelic; Gaelic", 360, "ga�lique �cossais; ga�lique", 138}, | ||
1016 | {""}, | ||
1017 | {"goh", "German, Old High (ca.750-1050)", 145, "", 0}, | ||
1018 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1019 | {"bg", "Bulgarian", 61, "bulgare", 70}, | ||
1020 | {"lao", "Lao", 229, "lao", 229}, | ||
1021 | {""}, {""}, {""}, {""}, | ||
1022 | {"lub", "Luba-Katanga", 242, "luba-katanga", 237}, | ||
1023 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1024 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1025 | {"ang", "English, Old (ca.450-1100)", 116, "anglo-saxon (ca.450-1100)", 20}, | ||
1026 | {""}, {""}, | ||
1027 | {"nau", "Nauru", 285, "nauruan", 283}, | ||
1028 | {"yor", "Yoruba", 454, "yoruba", 445}, | ||
1029 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1030 | {"lo", "Lao", 229, "lao", 229}, | ||
1031 | {"ie", "Interlingue", 181, "interlingue", 181}, | ||
1032 | {""}, {""}, {""}, | ||
1033 | {"day", "Dayak", 98, "dayak", 102}, | ||
1034 | {"nzi", "Nzima", 311, "nzema", 306}, | ||
1035 | {""}, {""}, {""}, {""}, | ||
1036 | {"kau", "Kanuri", 199, "kanouri", 200}, | ||
1037 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1038 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1039 | {"cos", "Corsican", 89, "corse", 95}, | ||
1040 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1041 | {"uzb", "Uzbek", 436, "ouszbek", 317}, | ||
1042 | {""}, | ||
1043 | {"sgn-be-nl", "Belgian-Flemish Sign Language", 489, "Belgian-Flemish Sign Language", 480}, | ||
1044 | {""}, {""}, | ||
1045 | {"uga", "Ugaritic", 430, "ougaritique", 314}, | ||
1046 | {""}, | ||
1047 | {"nno", "Nynorsk, Norwegian; Norwegian Nynorsk", 309, "nynorsk, norv�gien; norv�gien nynorsk", 304}, | ||
1048 | {""}, {""}, {""}, {""}, | ||
1049 | {"mri", "Maori", 265, "maori", 262}, | ||
1050 | {""}, {""}, | ||
1051 | {"nob", "Norwegian Bokm�l; Bokm�l, Norwegian", 303, "norv�gien bokm�l; bokm�l, norv�gien", 298}, | ||
1052 | {""}, | ||
1053 | {"osa", "Osage", 316, "osage", 310}, | ||
1054 | {""}, {""}, | ||
1055 | {"oc", "Proven�al; Occitan (post 1500)", 336, "proven�al; occitan (apr�s 1500)", 336}, | ||
1056 | {""}, | ||
1057 | {"mno", "Manobo languages", 263, "manobo, langues", 260}, | ||
1058 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1059 | {"gv", "Manx", 264, "manx; mannois", 261}, | ||
1060 | {""}, {""}, {""}, {""}, {""}, | ||
1061 | {"ce", "Chechen", 74, "tch�tch�ne", 399}, | ||
1062 | {""}, {""}, {""}, {""}, {""}, | ||
1063 | {"nde", "North Ndebele", 301, "nd�b�l� du Nord", 285}, | ||
1064 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1065 | {"hmo", "Hiri Motu", 166, "hiri motu", 166}, | ||
1066 | {""}, {""}, {""}, {""}, {""}, | ||
1067 | {"est", "Estonian", 118, "estonien", 121}, | ||
1068 | {"chv", "Chuvash", 86, "tchouvache", 400}, | ||
1069 | {"sai", "South American Indian (Other)", 386, "", 0}, | ||
1070 | {""}, {""}, {""}, {""}, | ||
1071 | {"nai", "North American Indian (Other)", 299, "", 0}, | ||
1072 | {""}, {""}, {""}, {""}, {""}, | ||
1073 | {"ceb", "Cebuano", 69, "cebuano", 76}, | ||
1074 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1075 | {"mai", "Maithili", 253, "maithili", 247}, | ||
1076 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1077 | {"twi", "Twi", 429, "twi", 427}, | ||
1078 | {""}, {""}, {""}, {""}, | ||
1079 | {"vo", "Volap�k", 440, "volap�k", 433}, | ||
1080 | {"hau", "Hausa", 159, "haoussa", 159}, | ||
1081 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1082 | {""}, {""}, {""}, {""}, {""}, | ||
1083 | {"cor", "Cornish", 88, "cornique", 94}, | ||
1084 | {"nic", "Niger-Kordofanian (Other)", 295, "nig�ro-congolaises, autres langues", 293}, | ||
1085 | {""}, {""}, {""}, {""}, | ||
1086 | {"swe", "Swedish", 396, "su�dois", 386}, | ||
1087 | {""}, {""}, | ||
1088 | {"alb", "Albanian", 11, "albanais", 11}, | ||
1089 | {""}, {""}, {""}, {""}, | ||
1090 | {"el", "Greek, Modern (1453-)", 154, "grec moderne (apr�s 1453)", 153}, | ||
1091 | {""}, | ||
1092 | {"mic", "Micmac", 273, "micmac", 270}, | ||
1093 | {""}, {""}, {""}, {""}, {""}, | ||
1094 | {"dyu", "Dyula", 108, "dioula", 105}, | ||
1095 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1096 | {""}, {""}, | ||
1097 | {"tai", "Tai (Other)", 400, "tha�es, autres langues", 406}, | ||
1098 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1099 | {"cy", "Welsh", 447, "gallois", 141}, | ||
1100 | {""}, | ||
1101 | {"zu", "Zulu", 460, "zoulou", 451}, | ||
1102 | {"pol", "Polish", 333, "polonais", 333}, | ||
1103 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1104 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1105 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1106 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1107 | {"wo", "Wolof", 448, "wolof", 440}, | ||
1108 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1109 | {""}, {""}, {""}, {""}, {""}, | ||
1110 | {"hai", "Haida", 158, "haida", 158}, | ||
1111 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1112 | {"lug", "Ganda", 137, "ganda", 142}, | ||
1113 | {""}, {""}, {""}, {""}, | ||
1114 | {"geo", "Georgian", 141, "g�orgien", 145}, | ||
1115 | {""}, | ||
1116 | {"mac", "Macedonian", 250, "mac�donien", 244}, | ||
1117 | {""}, {""}, | ||
1118 | {"pag", "Pangasinan", 324, "pangasinan", 323}, | ||
1119 | {""}, | ||
1120 | {"kac", "Kachin", 195, "kachin", 197}, | ||
1121 | {""}, | ||
1122 | {"gu", "Gujarati", 156, "goudjrati", 150}, | ||
1123 | {""}, {""}, {""}, {""}, {""}, | ||
1124 | {"zap", "Zapotec", 457, "zapot�que", 448}, | ||
1125 | {""}, {""}, {""}, {""}, | ||
1126 | {"mlg", "Malagasy", 255, "malgache", 253}, | ||
1127 | {""}, | ||
1128 | {"i-navajo", "Navajo Deprecated use ISO 639 nv registered Feb. 18 2000", 481, "Navajo Deprecated use ISO 639 nv registered Feb. 18 2000", 472}, | ||
1129 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1130 | {"tup", "Tupi languages", 423, "tupi, langues", 422}, | ||
1131 | {""}, {""}, {""}, {""}, {""}, | ||
1132 | {"smi", "Sami languages (Other)", 351, "sami, autres langues", 350}, | ||
1133 | {"aze", "Azerbaijani", 33, "az�ri", 37}, | ||
1134 | {""}, {""}, {""}, | ||
1135 | {"khi", "Khoisan (Other)", 207, "khoisan, autres langues", 208}, | ||
1136 | {"glv", "Manx", 264, "manx; mannois", 261}, | ||
1137 | {""}, | ||
1138 | {"bo", "Tibetan", 409, "tib�tain", 407}, | ||
1139 | {""}, {""}, | ||
1140 | {"scc", "Serbian", 363, "serbe", 366}, | ||
1141 | {""}, {""}, {""}, {""}, | ||
1142 | {"isl", "Icelandic", 172, "islandais", 189}, | ||
1143 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1144 | {"uig", "Uighur", 431, "ou�gour", 315}, | ||
1145 | {""}, {""}, {""}, {""}, | ||
1146 | {"zh-wuu", "Shanghaiese or Wu", 515, "Shanghaiese or Wu", 506}, | ||
1147 | {""}, | ||
1148 | {"zh-guoyu", "Mandarin or Standard Chinese", 511, "Mandarin or Standard Chinese", 502}, | ||
1149 | {""}, {""}, | ||
1150 | {"sog", "Sogdian", 379, "sogdien", 377}, | ||
1151 | {"umb", "Umbundu", 433, "umbundu", 429}, | ||
1152 | {""}, {""}, {""}, {""}, {""}, | ||
1153 | {"i-ami", "Amis", 473, "Amis", 464}, | ||
1154 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1155 | {"ug", "Uighur", 431, "ou�gour", 315}, | ||
1156 | {"peo", "Persian, Old (ca.600-400 B.C.)", 329, "perse, vieux (ca. 600-400 av. J.-C.)", 328}, | ||
1157 | {""}, {""}, | ||
1158 | {"sgn-no", "Norwegian Sign Language", 505, "Norwegian Sign Language", 496}, | ||
1159 | {""}, {""}, | ||
1160 | {"hup", "Hupa", 170, "hupa", 170}, | ||
1161 | {"i-bnn", "Bunun", 474, "Bunun", 465}, | ||
1162 | {""}, | ||
1163 | {"arc", "Aramaic", 18, "aram�en", 23}, | ||
1164 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1165 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1166 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1167 | {""}, | ||
1168 | {"i-tsu", "Tsou", 485, "Tsou", 476}, | ||
1169 | {""}, {""}, | ||
1170 | {"ell", "Greek, Modern (1453-)", 154, "grec moderne (apr�s 1453)", 153}, | ||
1171 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1172 | {""}, {""}, {""}, {""}, | ||
1173 | {"loz", "Lozi", 241, "lozi", 236}, | ||
1174 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1175 | {"sme", "Northern Sami", 300, "sami du Nord", 353}, | ||
1176 | {""}, {""}, {""}, | ||
1177 | {"mni", "Manipuri", 262, "manipuri", 258}, | ||
1178 | {""}, {""}, | ||
1179 | {"tog", "Tonga (Nyasa)", 417, "tonga (Nyasa)", 414}, | ||
1180 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1181 | {""}, {""}, | ||
1182 | {"pro", "Proven�al, Old (to 1500)", 337, "proven�al ancien (jusqu'� 1500)", 337}, | ||
1183 | {""}, {""}, {""}, | ||
1184 | {"cv", "Chuvash", 86, "tchouvache", 400}, | ||
1185 | {""}, {""}, {""}, | ||
1186 | {"pap", "Papiamento", 326, "papiamento", 324}, | ||
1187 | {"zh-yue", "Cantonese", 517, "Cantonese", 508}, | ||
1188 | {"chb", "Chibcha", 78, "chibcha", 84}, | ||
1189 | {""}, | ||
1190 | {"fro", "French, Old (842-ca.1400)", 130, "fran�ais ancien (842-ca.1400)", 132}, | ||
1191 | {"alg", "Algonquian languages", 13, "algonquines, langues", 13}, | ||
1192 | {""}, {""}, {""}, {""}, {""}, | ||
1193 | {"bho", "Bhojpuri", 51, "bhojpuri", 56}, | ||
1194 | {""}, {""}, {""}, {""}, | ||
1195 | {"vai", "Vai", 437, "va�", 430}, | ||
1196 | {""}, {""}, {""}, {""}, {""}, | ||
1197 | {"ace", "Achinese", 2, "aceh", 2}, | ||
1198 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1199 | {"hye", "Armenian", 22, "arm�nien", 27}, | ||
1200 | {""}, {""}, {""}, | ||
1201 | {"vie", "Vietnamese", 439, "vietnamien", 432}, | ||
1202 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1203 | {"nso", "Sotho, Northern", 384, "sotho du Nord", 382}, | ||
1204 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1205 | {"luo", "Luo (Kenya and Tanzania)", 247, "luo (Kenya et Tanzanie)", 241}, | ||
1206 | {""}, {""}, {""}, {""}, | ||
1207 | {"slo", "Slovak", 377, "slovaque", 375}, | ||
1208 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1209 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1210 | {"fao", "Faroese", 123, "f�ro�en", 126}, | ||
1211 | {""}, {""}, {""}, | ||
1212 | {"zho", "Chinese", 80, "chinois", 86}, | ||
1213 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1214 | {""}, {""}, | ||
1215 | {"sgn-ni", "Nicaraguan Sign Language", 503, "Nicaraguan Sign Language", 494}, | ||
1216 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1217 | {"sqi", "Albanian", 11, "albanais", 11}, | ||
1218 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1219 | {""}, | ||
1220 | {"fo", "Faroese", 123, "f�ro�en", 126}, | ||
1221 | {""}, {""}, {""}, | ||
1222 | {"ijo", "Ijo", 175, "ijo", 175}, | ||
1223 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1224 | {"mnc", "Manchu", 259, "mandchou", 255}, | ||
1225 | {"bug", "Buginese", 60, "bugi", 69}, | ||
1226 | {"yap", "Yapese", 452, "yapois", 443}, | ||
1227 | {"tso", "Tsonga", 420, "tsonga", 419}, | ||
1228 | {""}, | ||
1229 | {"iu", "Inuktitut", 182, "inuktitut", 182}, | ||
1230 | {""}, {""}, {""}, {""}, {""}, | ||
1231 | {"ido", "Ido", 173, "ido", 173}, | ||
1232 | {""}, {""}, {""}, {""}, | ||
1233 | {"ibo", "Igbo", 174, "igbo", 174}, | ||
1234 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1235 | {"i-pwn", "Paiwan", 482, "Paiwan", 473}, | ||
1236 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1237 | {""}, | ||
1238 | {"i-tay", "Tayal", 484, "Tayal", 475}, | ||
1239 | {""}, {""}, {""}, | ||
1240 | {"gay", "Gayo", 138, "gayo", 143}, | ||
1241 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1242 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1243 | {""}, {""}, {""}, {""}, | ||
1244 | {"eu", "Basque", 44, "basque", 50}, | ||
1245 | {"yao", "Yao", 451, "yao", 442}, | ||
1246 | {""}, {""}, {""}, | ||
1247 | {"bai", "Bamileke languages", 39, "bamil�k�s, langues", 44}, | ||
1248 | {"fry", "Frisian", 131, "frison", 135}, | ||
1249 | {""}, {""}, | ||
1250 | {"i-mingo", "Mingo", 480, "Mingo", 471}, | ||
1251 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1252 | {"iro", "Iroquoian languages", 188, "iroquoises, langues (famille)", 188}, | ||
1253 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1254 | {""}, | ||
1255 | {"crp", "Creoles and pidgins (Other)", 92, "cr�oles et pidgins divers", 98}, | ||
1256 | {""}, | ||
1257 | {"sux", "Sumerian", 391, "sum�rien", 388}, | ||
1258 | {""}, {""}, {""}, {""}, | ||
1259 | {"yo", "Yoruba", 454, "yoruba", 445}, | ||
1260 | {""}, | ||
1261 | {"fiu", "Finno-Ugrian (Other)", 126, "finno-ougriennes, autres langues", 128}, | ||
1262 | {""}, {""}, {""}, {""}, | ||
1263 | {"i-tao", "Tao", 483, "Tao", 474}, | ||
1264 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1265 | {"bre", "Breton", 59, "breton", 68}, | ||
1266 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1267 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1268 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1269 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1270 | {"ewo", "Ewondo", 120, "�wondo", 123}, | ||
1271 | {"en-scouse", "English Liverpudlian dialect known as 'Scouse'", 472, "English Liverpudlian dialect known as 'Scouse'", 463}, | ||
1272 | {""}, {""}, | ||
1273 | {"gwi", "Gwich'in", 157, "gwich'in", 157}, | ||
1274 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1275 | {""}, {""}, | ||
1276 | {"chg", "Chagatai", 71, "djaghata�", 107}, | ||
1277 | {""}, {""}, | ||
1278 | {"oji", "Ojibwa", 313, "ojibwa", 308}, | ||
1279 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1280 | {""}, {""}, {""}, {""}, | ||
1281 | {"io", "Ido", 173, "ido", 173}, | ||
1282 | {"pau", "Palauan", 321, "palau", 320}, | ||
1283 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1284 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1285 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1286 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1287 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1288 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1289 | {"eo", "Esperanto", 117, "esp�ranto", 120}, | ||
1290 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1291 | {""}, {""}, {""}, {""}, | ||
1292 | {"gre", "Greek, Modern (1453-)", 154, "grec moderne (apr�s 1453)", 153}, | ||
1293 | {"co", "Corsican", 89, "corse", 95}, | ||
1294 | {""}, | ||
1295 | {"ori", "Oriya", 314, "oriya", 309}, | ||
1296 | {""}, {""}, | ||
1297 | {"sgn-de", "German Sign Language", 493, "German Sign Language", 484}, | ||
1298 | {""}, {""}, | ||
1299 | {"i-enochian", "Enochian", 476, "Enochian", 467}, | ||
1300 | {""}, {""}, {""}, {""}, | ||
1301 | {"eng", "English", 114, "anglais", 18}, | ||
1302 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1303 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1304 | {"grc", "Greek, Ancient (to 1453)", 153, "grec ancien (jusqu'� 1453)", 152}, | ||
1305 | {"lui", "Luiseno", 244, "luiseno", 239}, | ||
1306 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1307 | {""}, {""}, {""}, {""}, {""}, | ||
1308 | {"oto", "Otomian languages", 319, "otomangue, langues", 313}, | ||
1309 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1310 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1311 | {""}, | ||
1312 | {"iku", "Inuktitut", 182, "inuktitut", 182}, | ||
1313 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1314 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1315 | {"chp", "Chipewyan", 82, "chipewyan", 88}, | ||
1316 | {""}, {""}, {""}, | ||
1317 | {"xho", "Xhosa", 449, "xhosa", 441}, | ||
1318 | {""}, {""}, {""}, {""}, | ||
1319 | {"tpi", "Tok Pisin", 415, "tok pisin", 412}, | ||
1320 | {""}, {""}, {""}, {""}, | ||
1321 | {"fre", "French", 128, "fran�ais", 131}, | ||
1322 | {""}, {""}, {""}, {""}, {""}, | ||
1323 | {"tsi", "Tsimshian", 419, "tsimshian", 418}, | ||
1324 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1325 | {""}, {""}, {""}, | ||
1326 | {"glg", "Gallegan", 136, "galicien", 139}, | ||
1327 | {""}, {""}, {""}, {""}, | ||
1328 | {"tli", "Tlingit", 414, "tlingit", 411}, | ||
1329 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1330 | {""}, {""}, {""}, {""}, {""}, | ||
1331 | {"oci", "Proven�al; Occitan (post 1500)", 336, "proven�al; occitan (apr�s 1500)", 336}, | ||
1332 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1333 | {"cho", "Choctaw", 83, "choctaw", 89}, | ||
1334 | {"kpe", "Kpelle", 218, "kpell�", 219}, | ||
1335 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1336 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1337 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1338 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1339 | {""}, {""}, | ||
1340 | {"doi", "Dogri", 102, "dogri", 108}, | ||
1341 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1342 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1343 | {""}, {""}, {""}, {""}, {""}, | ||
1344 | {"cau", "Caucasian (Other)", 68, "caucasiennes, autres langues", 75}, | ||
1345 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1346 | {"phi", "Philippine (Other)", 330, "philippines, autres langues", 331}, | ||
1347 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1348 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1349 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1350 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1351 | {"que", "Quechua", 339, "quechua", 338}, | ||
1352 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1353 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1354 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1355 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1356 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1357 | {"i-lux", "Luxembourgish Deprecated use ISO 639 lb registered Sept. 9 1998", 479, "Luxembourgish Deprecated use ISO 639 lb registered Sept. 9 1998", 470}, | ||
1358 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1359 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1360 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1361 | {"chy", "Cheyenne", 77, "cheyenne", 83}, | ||
1362 | {""}, {""}, | ||
1363 | {"ale", "Aleut", 12, "al�oute", 12}, | ||
1364 | {""}, {""}, {""}, {""}, {""}, | ||
1365 | {"cze", "Czech", 95, "tch�que", 398}, | ||
1366 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1367 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1368 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1369 | {"ewe", "Ewe", 119, "�w�", 122}, | ||
1370 | {""}, | ||
1371 | {"cre", "Cree", 90, "cree", 97}, | ||
1372 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1373 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1374 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1375 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1376 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1377 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1378 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1379 | {"ice", "Icelandic", 172, "islandais", 189}, | ||
1380 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1381 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1382 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1383 | {"ave", "Avestan", 30, "avestique", 34}, | ||
1384 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1385 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1386 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1387 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1388 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1389 | {"chi", "Chinese", 80, "chinois", 86}, | ||
1390 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1391 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1392 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1393 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1394 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1395 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1396 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1397 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1398 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1399 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1400 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1401 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1402 | {""}, {""}, {""}, | ||
1403 | {"che", "Chechen", 74, "tch�tch�ne", 399}, | ||
1404 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1405 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1406 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1407 | {""}, {""}, {""}, | ||
1408 | {"ilo", "Iloko", 176, "ilocano", 176}, | ||
1409 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1410 | {""}, {""}, {""}, {""}, | ||
1411 | {"ine", "Indo-European (Other)", 179, "indo-europ�ennes, autres langues", 179}, | ||
1412 | {""}, {""}, {""}, {""}, | ||
1413 | {"cmc", "Chamic languages", 72, "chames, langues", 78}, | ||
1414 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1415 | {"epo", "Esperanto", 117, "esp�ranto", 120}, | ||
1416 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1417 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1418 | {"inc", "Indic (Other)", 178, "indo-aryennes, autres langues", 178}, | ||
1419 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1420 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1421 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1422 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1423 | {"cop", "Coptic", 87, "copte", 92}, | ||
1424 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
1425 | {"egy", "Egyptian (Ancient)", 111, "�gyptien", 115}, | ||
1426 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1427 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1428 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1429 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1430 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1431 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1432 | {""}, {""}, | ||
1433 | {"pli", "Pali", 322, "pali", 321}, | ||
1434 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1435 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1436 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1437 | {"gle", "Irish", 185, "irlandais", 185}, | ||
1438 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1439 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1440 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1441 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1442 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1443 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1444 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1445 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1446 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1447 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1448 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1449 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1450 | {""}, {""}, {""}, {""}, {""}, | ||
1451 | {"efi", "Efik", 110, "efik", 114}, | ||
1452 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1453 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1454 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1455 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1456 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1457 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1458 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1459 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1460 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1461 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1462 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1463 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1464 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1465 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1466 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1467 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1468 | {""}, {""}, {""}, {""}, {""}, | ||
1469 | {"elx", "Elamite", 113, "�lamite", 117}, | ||
1470 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1471 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1472 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
1473 | {"ile", "Interlingue", 181, "interlingue", 181} | ||
1474 | }; | ||
1475 | |||
1476 | const struct language * | ||
1477 | in_word_set (register const char *str, register size_t len) | ||
1478 | { | ||
1479 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
1480 | { | ||
1481 | register unsigned int key = hash (str, len); | ||
1482 | |||
1483 | if (key <= MAX_HASH_VALUE) | ||
1484 | { | ||
1485 | register const char *s = wordlist[key].name; | ||
1486 | |||
1487 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
1488 | return &wordlist[key]; | ||
1489 | } | ||
1490 | } | ||
1491 | return 0; | ||
1492 | } | ||
1493 | |||
1494 |
File tests/languages.gperf added (mode: 100644) (index 0000000..43dd4f9) | |||
1 | %{ | ||
2 | /* gperf -CDEGTlot -H language_hash -K code -L ANSI-C -N language_entry */ | ||
3 | /* Generated from ISO 639 language data from http://lcweb.loc.gov/standards/iso639-2/langhome.html | ||
4 | and from IANA registry at https://www.iana.org/assignments/language-tags | ||
5 | by %M% | ||
6 | */ | ||
7 | /* englangn.html Updated: August 14, 2002 */ | ||
8 | /* frenchlangn.html Updated: August 14, 2002 */ | ||
9 | /* language-tags last updated 2001-07-17 */ | ||
10 | %} | ||
11 | struct language { const char *code; const char *name_en; int num_en; const char *name_fr; int num_fr; }; | ||
12 | %% | ||
13 | cel-gaulish, "Gaulish", 463, "Gaulish", 454 | ||
14 | uig, "Uighur", 431, "ou�gour", 315 | ||
15 | ton, "Tonga (Tonga Islands)", 418, "tongan (�les Tonga)", 415 | ||
16 | rm, "Raeto-Romance", 340, "rh�to-roman", 342 | ||
17 | pt, "Portuguese", 334, "portugais", 334 | ||
18 | mri, "Maori", 265, "maori", 262 | ||
19 | ilo, "Iloko", 176, "ilocano", 176 | ||
20 | hrv, "Croatian", 93, "croate", 99 | ||
21 | i-navajo, "Navajo Deprecated use ISO 639 nv registered Feb. 18 2000", 481, "Navajo Deprecated use ISO 639 nv registered Feb. 18 2000", 472 | ||
22 | tg, "Tajik", 401, "tadjik", 392 | ||
23 | rn, "Rundi", 347, "rundi", 345 | ||
24 | kom, "Komi", 213, "komi", 214 | ||
25 | i-tao, "Tao", 483, "Tao", 474 | ||
26 | de-at-1901, "German Austrian variant traditional orthography", 466, "German Austrian variant traditional orthography", 457 | ||
27 | vai, "Vai", 437, "va�", 430 | ||
28 | th, "Thai", 408, "tha�", 405 | ||
29 | ro, "Romanian", 345, "roumain", 344 | ||
30 | mag, "Magahi", 252, "magahi", 246 | ||
31 | kon, "Kongo", 214, "kongo", 215 | ||
32 | nld, "Dutch", 106, "n�erlandais", 288 | ||
33 | ces, "Czech", 95, "tch�que", 398 | ||
34 | afh, "Afrihili", 6, "afrihili", 6 | ||
35 | aus, "Australian languages", 27, "australiennes, langues", 32 | ||
36 | sgn-pt, "Portuguese Sign Language", 506, "Portuguese Sign Language", 497 | ||
37 | ti, "Tigrinya", 411, "tigrigna", 409 | ||
38 | sux, "Sumerian", 391, "sum�rien", 388 | ||
39 | mah, "Marshallese", 268, "marshall", 265 | ||
40 | hau, "Hausa", 159, "haoussa", 159 | ||
41 | ce, "Chechen", 74, "tch�tch�ne", 399 | ||
42 | mai, "Maithili", 253, "maithili", 247 | ||
43 | gmh, "German, Middle High (ca.1050-1500)", 144, "", 0 | ||
44 | am, "Amharic", 15, "amharique", 17 | ||
45 | sgn-be-nl, "Belgian-Flemish Sign Language", 489, "Belgian-Flemish Sign Language", 480 | ||
46 | tk, "Turkmen", 426, "turkm�ne", 425 | ||
47 | haw, "Hawaiian", 160, "hawa�en", 160 | ||
48 | zen, "Zenaga", 458, "zenaga", 449 | ||
49 | tl, "Tagalog", 398, "tagalog", 393 | ||
50 | oss, "Ossetic; Ossetian", 318, "oss�te", 312 | ||
51 | mak, "Makasar", 254, "makassar", 248 | ||
52 | kor, "Korean", 216, "cor�en", 93 | ||
53 | ch, "Chamorro", 73, "chamorro", 79 | ||
54 | mal, "Malayalam", 257, "malayalam", 250 | ||
55 | lez, "Lezghian", 233, "lezghien", 232 | ||
56 | kos, "Kosraean", 217, "kosrae", 217 | ||
57 | ira, "Iranian (Other)", 184, "iraniennes, autres langues", 184 | ||
58 | zh-xiang, "Xiang or Hunanese", 516, "Xiang or Hunanese", 507 | ||
59 | tn, "Tswana", 421, "tswana", 420 | ||
60 | ru, "Russian", 348, "russe", 346 | ||
61 | lim, "Limburgish; Limburger; Limburgan", 236, "limbourgeois", 233 | ||
62 | ful, "Fulah", 133, "peul", 329 | ||
63 | dak, "Dakota", 96, "dakota", 100 | ||
64 | umb, "Umbundu", 433, "umbundu", 429 | ||
65 | tsi, "Tsimshian", 419, "tsimshian", 418 | ||
66 | to, "Tonga (Tonga Islands)", 418, "tongan (�les Tonga)", 415 | ||
67 | man, "Mandingo", 261, "mandingue", 257 | ||
68 | lin, "Lingala", 237, "lingala", 234 | ||
69 | ar, "Arabic", 17, "arabe", 22 | ||
70 | bos, "Bosnian", 57, "bosniaque", 65 | ||
71 | wln, "Walloon", 444, "wallon", 437 | ||
72 | vi, "Vietnamese", 439, "vietnamien", 432 | ||
73 | mao, "Maori", 265, "maori", 262 | ||
74 | kua, "Kwanyama, Kuanyama", 225, "kwanyama; kuanyama", 225 | ||
75 | rw, "Kinyarwanda", 211, "rwanda", 347 | ||
76 | ipk, "Inupiaq", 183, "inupiaq", 183 | ||
77 | as, "Assamese", 24, "assamais", 29 | ||
78 | aym, "Aymara", 32, "aymara", 36 | ||
79 | syr, "Syriac", 397, "syriaque", 391 | ||
80 | shn, "Shan", 365, "chan", 80 | ||
81 | goh, "German, Old High (ca.750-1050)", 145, "", 0 | ||
82 | dan, "Danish", 97, "danois", 101 | ||
83 | map, "Austronesian (Other)", 28, "malayo-polyn�siennes, autres langues", 251 | ||
84 | i-tay, "Tayal", 484, "Tayal", 475 | ||
85 | tr, "Turkish", 424, "turc", 423 | ||
86 | sla, "Slavic (Other)", 376, "slaves, autres langues", 374 | ||
87 | ell, "Greek, Modern (1453-)", 154, "grec moderne (apr�s 1453)", 153 | ||
88 | afr, "Afrikaans", 7, "afrikaans", 7 | ||
89 | bua, "Buriat", 62, "bouriate", 66 | ||
90 | ts, "Tsonga", 420, "tsonga", 419 | ||
91 | pol, "Polish", 333, "polonais", 333 | ||
92 | mar, "Marathi", 266, "marathe", 263 | ||
93 | ga, "Irish", 185, "irlandais", 185 | ||
94 | co, "Corsican", 89, "corse", 95 | ||
95 | i-ami, "Amis", 473, "Amis", 464 | ||
96 | tsn, "Tswana", 421, "tswana", 420 | ||
97 | tt, "Tatar", 404, "tatar", 397 | ||
98 | mas, "Masai", 270, "massa�", 267 | ||
99 | ita, "Italian", 189, "italien", 190 | ||
100 | her, "Herero", 162, "herero", 162 | ||
101 | fur, "Friulian", 132, "frioulan", 134 | ||
102 | eng, "English", 114, "anglais", 18 | ||
103 | cmc, "Chamic languages", 72, "chames, langues", 78 | ||
104 | tso, "Tsonga", 420, "tsonga", 419 | ||
105 | pon, "Pohnpeian", 332, "pohnpei", 332 | ||
106 | lit, "Lithuanian", 238, "lituanien", 235 | ||
107 | sgn-co, "Colombian Sign Language", 492, "Colombian Sign Language", 483 | ||
108 | de-1901, "German traditional orthography", 464, "German traditional orthography", 455 | ||
109 | xh, "Xhosa", 449, "xhosa", 441 | ||
110 | vo, "Volap�k", 440, "volap�k", 433 | ||
111 | gd, "Scottish Gaelic; Gaelic", 360, "ga�lique �cossais; ga�lique", 138 | ||
112 | za, "Zhuang; Chuang", 459, "zhuang; chuang", 450 | ||
113 | ay, "Aymara", 32, "aymara", 36 | ||
114 | sgn-gb, "British Sign Language", 497, "British Sign Language", 488 | ||
115 | yor, "Yoruba", 454, "yoruba", 445 | ||
116 | tw, "Twi", 429, "twi", 427 | ||
117 | mga, "Irish, Middle (900-1200)", 186, "irlandais moyen (900-1200)", 187 | ||
118 | el, "Greek, Modern (1453-)", 154, "grec moderne (apr�s 1453)", 153 | ||
119 | gon, "Gondi", 149, "gond", 147 | ||
120 | az, "Azerbaijani", 33, "az�ri", 37 | ||
121 | cs, "Czech", 95, "tch�que", 398 | ||
122 | alb, "Albanian", 11, "albanais", 11 | ||
123 | ukr, "Ukrainian", 432, "ukrainien", 428 | ||
124 | tuk, "Turkmen", 426, "turkm�ne", 425 | ||
125 | raj, "Rajasthani", 341, "rajasthani", 339 | ||
126 | bug, "Buginese", 60, "bugi", 69 | ||
127 | sgn-za, "South African Sign Language", 509, "South African Sign Language", 500 | ||
128 | ty, "Tahitian", 399, "tahitien", 394 | ||
129 | sna, "Shona", 366, "shona", 368 | ||
130 | por, "Portuguese", 334, "portugais", 334 | ||
131 | en, "English", 114, "anglais", 18 | ||
132 | tum, "Tumbuka", 422, "tumbuka", 421 | ||
133 | nno, "Nynorsk, Norwegian; Norwegian Nynorsk", 309, "nynorsk, norv�gien; norv�gien nynorsk", 304 | ||
134 | may, "Malay", 256, "malais", 249 | ||
135 | eo, "Esperanto", 117, "esp�ranto", 120 | ||
136 | enm, "English, Middle (1100-1500)", 115, "anglais moyen (1100-1500)", 19 | ||
137 | cv, "Chuvash", 86, "tchouvache", 400 | ||
138 | ale, "Aleut", 12, "al�oute", 12 | ||
139 | ven, "Venda", 438, "venda", 431 | ||
140 | iro, "Iroquoian languages", 188, "iroquoises, langues (famille)", 188 | ||
141 | gor, "Gorontalo", 150, "gorontalo", 148 | ||
142 | slk, "Slovak", 377, "slovaque", 375 | ||
143 | snd, "Sindhi", 370, "sindhi", 370 | ||
144 | kum, "Kumyk", 221, "koumyk", 218 | ||
145 | ice, "Icelandic", 172, "islandais", 189 | ||
146 | hil, "Hiligaynon", 163, "hiligaynon", 163 | ||
147 | gba, "Gbaya", 139, "gbaya", 144 | ||
148 | alg, "Algonquian languages", 13, "algonquines, langues", 13 | ||
149 | day, "Dayak", 98, "dayak", 102 | ||
150 | cy, "Welsh", 447, "gallois", 141 | ||
151 | twi, "Twi", 429, "twi", 427 | ||
152 | tup, "Tupi languages", 423, "tupi, langues", 422 | ||
153 | men, "Mende", 272, "mend�", 269 | ||
154 | id, "Indonesian", 180, "indon�sien", 180 | ||
155 | him, "Himachali", 164, "himachali", 164 | ||
156 | got, "Gothic", 151, "gothique", 149 | ||
157 | del, "Delaware", 99, "delaware", 103 | ||
158 | zh, "Chinese", 80, "chinois", 86 | ||
159 | bul, "Bulgarian", 61, "bulgare", 70 | ||
160 | rap, "Rapanui", 342, "rapanui", 340 | ||
161 | ie, "Interlingue", 181, "interlingue", 181 | ||
162 | hin, "Hindi", 165, "hindi", 165 | ||
163 | gl, "Gallegan", 136, "galicien", 139 | ||
164 | elx, "Elamite", 113, "�lamite", 117 | ||
165 | es, "Spanish; Castilian", 389, "espagnol; castillan", 119 | ||
166 | zh-yue, "Cantonese", 517, "Cantonese", 508 | ||
167 | xho, "Xhosa", 449, "xhosa", 441 | ||
168 | tur, "Turkish", 424, "turc", 423 | ||
169 | den, "Slave (Athapascan)", 375, "esclave (athapascan)", 118 | ||
170 | et, "Estonian", 118, "estonien", 121 | ||
171 | vie, "Vietnamese", 439, "vietnamien", 432 | ||
172 | tha, "Thai", 408, "tha�", 405 | ||
173 | slo, "Slovak", 377, "slovaque", 375 | ||
174 | rar, "Rarotongan", 343, "rarotonga", 341 | ||
175 | mic, "Micmac", 273, "micmac", 270 | ||
176 | gn, "Guarani", 155, "guarani", 155 | ||
177 | eu, "Basque", 44, "basque", 50 | ||
178 | spa, "Spanish; Castilian", 389, "espagnol; castillan", 119 | ||
179 | sgn-ie, "Irish Sign Language", 499, "Irish Sign Language", 490 | ||
180 | sgn-es, "Spanish Sign Language", 495, "Spanish Sign Language", 486 | ||
181 | kur, "Kurdish", 222, "kurde", 222 | ||
182 | ka, "Georgian", 141, "g�orgien", 145 | ||
183 | tut, "Altaic (Other)", 14, "alta�ques, autres langues", 16 | ||
184 | oji, "Ojibwa", 313, "ojibwa", 308 | ||
185 | lol, "Mongo", 279, "mongo", 275 | ||
186 | kha, "Khasi", 205, "khasi", 206 | ||
187 | snk, "Soninke", 382, "sonink�", 380 | ||
188 | kut, "Kutenai", 224, "kutenai", 224 | ||
189 | epo, "Esperanto", 117, "esp�ranto", 120 | ||
190 | ang, "English, Old (ca.450-1100)", 116, "anglo-saxon (ca.450-1100)", 20 | ||
191 | bur, "Burmese", 63, "birman", 62 | ||
192 | ik, "Inupiaq", 183, "inupiaq", 183 | ||
193 | hit, "Hittite", 167, "hittite", 167 | ||
194 | apa, "Apache languages", 16, "apache", 21 | ||
195 | nah, "Nahuatl", 284, "nahuatl", 281 | ||
196 | wak, "Wakashan languages", 442, "wakashennes, langues", 435 | ||
197 | nai, "North American Indian (Other)", 299, "", 0 | ||
198 | deu, "German", 142, "allemand", 14 | ||
199 | sgn-gr, "Greek Sign Language", 498, "Greek Sign Language", 489 | ||
200 | wal, "Walamo", 443, "walamo", 436 | ||
201 | slv, "Slovenian", 378, "slov�ne", 376 | ||
202 | gu, "Gujarati", 156, "goudjrati", 150 | ||
203 | de-ch-1996, "German Swiss variant orthography of 1996", 469, "German Swiss variant orthography of 1996", 460 | ||
204 | gv, "Manx", 264, "manx; mannois", 261 | ||
205 | mkd, "Macedonian", 250, "mac�donien", 244 | ||
206 | io, "Ido", 173, "ido", 173 | ||
207 | guj, "Gujarati", 156, "goudjrati", 150 | ||
208 | cop, "Coptic", 87, "copte", 92 | ||
209 | ki, "Kikuyu; Gikuyu", 209, "kikuyu", 210 | ||
210 | zu, "Zulu", 460, "zoulou", 451 | ||
211 | srd, "Sardinian", 357, "sarde", 361 | ||
212 | kj, "Kwanyama, Kuanyama", 225, "kwanyama; kuanyama", 225 | ||
213 | khi, "Khoisan (Other)", 207, "khoisan, autres langues", 208 | ||
214 | jrb, "Judeo-Arabic", 192, "jud�o-arabe", 193 | ||
215 | dzo, "Dzongkha", 109, "dzongkha", 112 | ||
216 | dgr, "Dogrib", 103, "dogrib", 109 | ||
217 | cor, "Cornish", 88, "cornique", 94 | ||
218 | zh-min, "Min Fuzhou Hokkien Amoy or Taiwanese", 513, "Min Fuzhou Hokkien Amoy or Taiwanese", 504 | ||
219 | min, "Minangkabau", 274, "minangkabau", 271 | ||
220 | kk, "Kazakh", 204, "kazakh", 205 | ||
221 | ara, "Arabic", 17, "arabe", 22 | ||
222 | cos, "Corsican", 89, "corse", 95 | ||
223 | mkh, "Mon-Khmer (Other)", 278, "m�n-khmer, autres langues", 274 | ||
224 | lua, "Luba-Lulua", 243, "luba-lulua", 238 | ||
225 | kl, "Kalaallisut", 196, "groenlandais", 154 | ||
226 | is, "Icelandic", 172, "islandais", 189 | ||
227 | hmn, "Hmong", 168, "hmong", 168 | ||
228 | war, "Waray", 445, "waray", 438 | ||
229 | nap, "Neapolitan", 291, "napolitain", 282 | ||
230 | lub, "Luba-Katanga", 242, "luba-katanga", 237 | ||
231 | km, "Khmer", 206, "khmer", 207 | ||
232 | it, "Italian", 189, "italien", 190 | ||
233 | hmo, "Hiri Motu", 166, "hiri motu", 166 | ||
234 | arc, "Aramaic", 18, "aram�en", 23 | ||
235 | din, "Dinka", 100, "dinka", 104 | ||
236 | was, "Washo", 446, "washo", 439 | ||
237 | sad, "Sandawe", 353, "sandawe", 357 | ||
238 | mg, "Malagasy", 255, "malgache", 253 | ||
239 | khm, "Khmer", 206, "khmer", 207 | ||
240 | kn, "Kannada", 198, "kannada", 199 | ||
241 | iu, "Inuktitut", 182, "inuktitut", 182 | ||
242 | gwi, "Gwich'in", 157, "gwich'in", 157 | ||
243 | de-de-1996, "German German variant orthography of 1996", 471, "German German variant orthography of 1996", 462 | ||
244 | pus, "Pushto", 338, "pachto", 318 | ||
245 | mh, "Marshallese", 268, "marshall", 265 | ||
246 | ko, "Korean", 216, "cor�en", 93 | ||
247 | jpn, "Japanese", 190, "japonais", 191 | ||
248 | sgn-it, "Italian Sign Language", 500, "Italian Sign Language", 491 | ||
249 | mis, "Miscellaneous languages", 275, "diverses, langues", 106 | ||
250 | mi, "Maori", 265, "maori", 262 | ||
251 | loz, "Lozi", 241, "lozi", 236 | ||
252 | kho, "Khotanese", 208, "khotanais", 209 | ||
253 | i-hak, "Hakka Deprecated use IETF zh-hakka registered Jan. 102000", 477, "Hakka Deprecated use IETF zh-hakka registered Jan. 102000", 468 | ||
254 | tyv, "Tuvinian", 428, "touva", 416 | ||
255 | sag, "Sango", 354, "sango", 358 | ||
256 | oc, "Proven�al; Occitan (post 1500)", 336, "proven�al; occitan (apr�s 1500)", 336 | ||
257 | sah, "Yakut", 450, "iakoute", 171 | ||
258 | bla, "Siksika", 369, "blackfoot", 63 | ||
259 | nau, "Nauru", 285, "nauruan", 283 | ||
260 | mk, "Macedonian", 250, "mac�donien", 244 | ||
261 | lug, "Ganda", 137, "ganda", 142 | ||
262 | bho, "Bhojpuri", 51, "bhojpuri", 56 | ||
263 | sai, "South American Indian (Other)", 386, "", 0 | ||
264 | nav, "Navajo; Navaho", 287, "navaho", 284 | ||
265 | ml, "Malayalam", 257, "malayalam", 250 | ||
266 | ks, "Kashmiri", 202, "kashmiri", 203 | ||
267 | jpr, "Judeo-Persian", 193, "jud�o-persan", 195 | ||
268 | scc, "Serbian", 363, "serbe", 366 | ||
269 | lui, "Luiseno", 244, "luiseno", 239 | ||
270 | zh-min-nan, "Minnan Hokkien Amoy Taiwanese Southern Min Southern Fujian Hoklo Southern Fukien Ho-lo", 514, "Minnan Hokkien Amoy Taiwanese Southern Min Southern Fujian Hoklo Southern Fukien Ho-lo", 505 | ||
271 | wel, "Welsh", 447, "gallois", 141 | ||
272 | mn, "Mongolian", 280, "mongol", 276 | ||
273 | ku, "Kurdish", 222, "kurde", 222 | ||
274 | div, "Divehi", 101, "maldivien", 252 | ||
275 | tli, "Tlingit", 414, "tlingit", 411 | ||
276 | srp, "Serbian", 363, "serbe", 366 | ||
277 | sal, "Salishan languages", 349, "salish, langues", 348 | ||
278 | mo, "Moldavian", 277, "moldave", 273 | ||
279 | kv, "Komi", 213, "komi", 214 | ||
280 | no-nyn, "Norwegian New Norwegian Deprecated use ISO 639 nn registered Feb. 18 2000", 487, "Norwegian New Norwegian Deprecated use ISO 639 nn registered Feb. 18 2000", 478 | ||
281 | wen, "Sorbian languages", 383, "sorabes, langues", 381 | ||
282 | sam, "Samaritan Aramaic", 350, "samaritain", 349 | ||
283 | phi, "Philippine (Other)", 330, "philippines, autres langues", 331 | ||
284 | arm, "Armenian", 22, "arm�nien", 27 | ||
285 | kw, "Cornish", 88, "cornique", 94 | ||
286 | srr, "Serer", 364, "s�r�re", 367 | ||
287 | san, "Sanskrit", 355, "sanskrit", 359 | ||
288 | fra, "French", 128, "fran�ais", 131 | ||
289 | arn, "Araucanian", 20, "araucan", 25 | ||
290 | mr, "Marathi", 266, "marathe", 263 | ||
291 | lun, "Lunda", 246, "lunda", 240 | ||
292 | ky, "Kirghiz", 212, "kirghize", 212 | ||
293 | ava, "Avaric", 29, "avar", 33 | ||
294 | ath, "Athapascan languages", 26, "athapascanes, langues", 31 | ||
295 | zh-guoyu, "Mandarin or Standard Chinese", 511, "Mandarin or Standard Chinese", 502 | ||
296 | i-enochian, "Enochian", 476, "Enochian", 467 | ||
297 | nia, "Nias", 294, "nias", 292 | ||
298 | moh, "Mohawk", 276, "mohawk", 272 | ||
299 | ms, "Malay", 256, "malais", 249 | ||
300 | luo, "Luo (Kenya and Tanzania)", 247, "luo (Kenya et Tanzanie)", 241 | ||
301 | ace, "Achinese", 2, "aceh", 2 | ||
302 | arp, "Arapaho", 19, "arapaho", 24 | ||
303 | om, "Oromo", 315, "galla", 140 | ||
304 | nep, "Nepali", 292, "n�palais", 290 | ||
305 | mt, "Maltese", 258, "maltais", 254 | ||
306 | vol, "Volap�k", 440, "volap�k", 433 | ||
307 | phn, "Phoenician", 331, "ph�nicien", 330 | ||
308 | nic, "Niger-Kordofanian (Other)", 295, "nig�ro-congolaises, autres langues", 293 | ||
309 | fre, "French", 128, "fran�ais", 131 | ||
310 | sgn-ch-de, "Swiss German Sign Language", 491, "Swiss German Sign Language", 482 | ||
311 | ota, "Turkish, Ottoman (1500-1928)", 425, "turc ottoman (1500-1928)", 424 | ||
312 | sas, "Sasak", 358, "sasak", 362 | ||
313 | sa, "Sanskrit", 355, "sanskrit", 359 | ||
314 | que, "Quechua", 339, "quechua", 338 | ||
315 | ach, "Acoli", 3, "acoli", 3 | ||
316 | ave, "Avestan", 30, "avestique", 34 | ||
317 | doi, "Dogri", 102, "dogri", 108 | ||
318 | no-bok, "Norwegian Book language Deprecated use ISO 639 nb registered Feb. 18 2000", 486, "Norwegian Book language Deprecated use ISO 639 nb registered Feb. 18 2000", 477 | ||
319 | sat, "Santali", 356, "santal", 360 | ||
320 | ori, "Oriya", 314, "oriya", 309 | ||
321 | nzi, "Nzima", 311, "nzema", 306 | ||
322 | mol, "Moldavian", 277, "moldave", 273 | ||
323 | lus, "Lushai", 248, "lushai", 242 | ||
324 | art, "Artificial (Other)", 23, "artificielles, autres langues", 28 | ||
325 | sc, "Sardinian", 357, "sarde", 361 | ||
326 | gla, "Scottish Gaelic; Gaelic", 360, "ga�lique �cossais; ga�lique", 138 | ||
327 | sd, "Sindhi", 370, "sindhi", 370 | ||
328 | sco, "Scots", 359, "�cossais", 113 | ||
329 | roa, "Romance (Other)", 344, "romanes, autres langues", 343 | ||
330 | or, "Oriya", 314, "oriya", 309 | ||
331 | mon, "Mongolian", 280, "mongol", 276 | ||
332 | sga, "Irish, Old (to 900)", 187, "irlandais ancien (jusqu'� 900)", 186 | ||
333 | cus, "Cushitic (Other)", 94, "couchitiques, autres langues", 96 | ||
334 | my, "Burmese", 63, "birman", 62 | ||
335 | aar, "Afar", 5, "afar", 5 | ||
336 | cha, "Chamorro", 73, "chamorro", 79 | ||
337 | os, "Ossetic; Ossetian", 318, "oss�te", 312 | ||
338 | se, "Northern Sami", 300, "sami du Nord", 353 | ||
339 | msa, "Malay", 256, "malais", 249 | ||
340 | chb, "Chibcha", 78, "chibcha", 84 | ||
341 | arw, "Arawak", 21, "arawak", 26 | ||
342 | ba, "Bashkir", 43, "bachkir", 39 | ||
343 | sgn-mx, "Mexican Sign Language", 502, "Mexican Sign Language", 493 | ||
344 | i-klingon, "Klingon", 478, "Klingon", 469 | ||
345 | zul, "Zulu", 460, "zoulou", 451 | ||
346 | orm, "Oromo", 315, "galla", 140 | ||
347 | new, "Newari", 293, "newari", 291 | ||
348 | kpe, "Kpelle", 218, "kpell�", 219 | ||
349 | jav, "Javanese", 191, "javanais", 192 | ||
350 | de-ch-1901, "German Swiss variant traditional orthography", 468, "German Swiss variant traditional orthography", 459 | ||
351 | sg, "Sango", 354, "sango", 358 | ||
352 | gle, "Irish", 185, "irlandais", 185 | ||
353 | eka, "Ekajuk", 112, "ekajuk", 116 | ||
354 | scr, "Croatian", 93, "croate", 99 | ||
355 | sgn-se, "Swedish Sign Language", 507, "Swedish Sign Language", 498 | ||
356 | zun, "Zuni", 461, "Zuni", 452 | ||
357 | vot, "Votic", 441, "vote", 434 | ||
358 | tpi, "Tok Pisin", 415, "tok pisin", 412 | ||
359 | sel, "Selkup", 361, "selkoupe", 364 | ||
360 | frm, "French, Middle (ca.1400-1600)", 129, "fran�ais moyen (1400-1600)", 133 | ||
361 | che, "Chechen", 74, "tch�tch�ne", 399 | ||
362 | si, "Sinhalese", 371, "singhalais", 371 | ||
363 | sem, "Semitic (Other)", 362, "s�mitiques, autres langues", 365 | ||
364 | pli, "Pali", 322, "pali", 321 | ||
365 | mos, "Mossi", 281, "mor�", 277 | ||
366 | glg, "Gallegan", 136, "galicien", 139 | ||
367 | be, "Belarusian", 47, "bi�lorusse", 58 | ||
368 | fro, "French, Old (842-ca.1400)", 130, "fran�ais ancien (842-ca.1400)", 132 | ||
369 | chg, "Chagatai", 71, "djaghata�", 107 | ||
370 | sk, "Slovak", 377, "slovaque", 375 | ||
371 | roh, "Raeto-Romance", 340, "rh�to-roman", 342 | ||
372 | bra, "Braj", 58, "braj", 67 | ||
373 | bg, "Bulgarian", 61, "bulgare", 70 | ||
374 | cym, "Welsh", 447, "gallois", 141 | ||
375 | sl, "Slovenian", 378, "slov�ne", 376 | ||
376 | iku, "Inuktitut", 182, "inuktitut", 182 | ||
377 | hun, "Hungarian", 169, "hongrois", 169 | ||
378 | bh, "Bihari", 52, "bihari", 59 | ||
379 | chi, "Chinese", 80, "chinois", 86 | ||
380 | da, "Danish", 97, "danois", 101 | ||
381 | sm, "Samoan", 352, "samoan", 356 | ||
382 | oci, "Proven�al; Occitan (post 1500)", 336, "proven�al; occitan (apr�s 1500)", 336 | ||
383 | kaa, "Kara-Kalpak", 200, "karakalpak", 201 | ||
384 | fan, "Fang", 121, "fang", 124 | ||
385 | bi, "Bislama", 55, "bichlamar", 57 | ||
386 | zha, "Zhuang; Chuang", 459, "zhuang; chuang", 450 | ||
387 | de-de-1901, "German German variant traditional orthography", 470, "German German variant traditional orthography", 461 | ||
388 | ug, "Uighur", 431, "ou�gour", 315 | ||
389 | sid, "Sidamo", 367, "sidamo", 369 | ||
390 | sn, "Shona", 366, "shona", 368 | ||
391 | qu, "Quechua", 339, "quechua", 338 | ||
392 | kab, "Kabyle", 194, "kabyle", 196 | ||
393 | hup, "Hupa", 170, "hupa", 170 | ||
394 | fao, "Faroese", 123, "f�ro�en", 126 | ||
395 | dua, "Duala", 105, "douala", 110 | ||
396 | chk, "Chuukese", 85, "chuuk", 91 | ||
397 | wa, "Walloon", 444, "wallon", 437 | ||
398 | so, "Somali", 380, "somali", 378 | ||
399 | oto, "Otomian languages", 319, "otomangue, langues", 313 | ||
400 | kac, "Kachin", 195, "kachin", 197 | ||
401 | aze, "Azerbaijani", 33, "az�ri", 37 | ||
402 | bre, "Breton", 59, "breton", 68 | ||
403 | rom, "Romany", 346, "tsigane", 417 | ||
404 | chm, "Mari", 267, "mari", 264 | ||
405 | de, "German", 142, "allemand", 14 | ||
406 | bnt, "Bantu (Other)", 41, "bantoues, autres langues", 46 | ||
407 | i-tsu, "Tsou", 485, "Tsou", 476 | ||
408 | sgn, "Sign languages", 368, "langues des signes", 228 | ||
409 | ron, "Romanian", 345, "roumain", 344 | ||
410 | egy, "Egyptian (Ancient)", 111, "�gyptien", 115 | ||
411 | sq, "Albanian", 11, "albanais", 11 | ||
412 | chn, "Chinook jargon", 81, "chinook, jargon", 87 | ||
413 | hye, "Armenian", 22, "arm�nien", 27 | ||
414 | zh-hakka, "Hakka", 512, "Hakka", 503 | ||
415 | uk, "Ukrainian", 432, "ukrainien", 428 | ||
416 | tah, "Tahitian", 399, "tahitien", 394 | ||
417 | sr, "Serbian", 363, "serbe", 366 | ||
418 | fas, "Persian", 328, "persan", 327 | ||
419 | niu, "Niuean", 297, "niu�", 295 | ||
420 | bad, "Banda", 40, "banda", 45 | ||
421 | cho, "Choctaw", 83, "choctaw", 89 | ||
422 | bn, "Bengali", 49, "bengali", 54 | ||
423 | sgn-de, "German Sign Language", 493, "German Sign Language", 484 | ||
424 | bo, "Tibetan", 409, "tib�tain", 407 | ||
425 | tai, "Tai (Other)", 400, "tha�es, autres langues", 406 | ||
426 | ss, "Swati", 395, "swati", 390 | ||
427 | fa, "Persian", 328, "persan", 327 | ||
428 | fat, "Fanti", 122, "fanti", 125 | ||
429 | chp, "Chipewyan", 82, "chipewyan", 88 | ||
430 | st, "Sotho, Southern", 385, "sotho du Sud", 383 | ||
431 | fry, "Frisian", 131, "frison", 135 | ||
432 | nob, "Norwegian Bokm�l; Bokm�l, Norwegian", 303, "norv�gien bokm�l; bokm�l, norv�gien", 298 | ||
433 | su, "Sundanese", 392, "soundanais", 384 | ||
434 | chr, "Cherokee", 75, "cherokee", 81 | ||
435 | sv, "Swedish", 396, "su�dois", 386 | ||
436 | pra, "Prakrit languages", 335, "pr�krit", 335 | ||
437 | br, "Breton", 59, "breton", 68 | ||
438 | aka, "Akan", 9, "akan", 9 | ||
439 | i-default, "Default Language Context", 475, "Default Language Context", 466 | ||
440 | ypk, "Yupik languages", 455, "yupik, langues", 446 | ||
441 | tam, "Tamil", 403, "tamoul", 396 | ||
442 | sw, "Swahili", 394, "swahili", 389 | ||
443 | mul, "Multiple languages", 282, "multilingue", 279 | ||
444 | kro, "Kru", 219, "krou", 220 | ||
445 | bs, "Bosnian", 57, "bosniaque", 65 | ||
446 | bai, "Bamileke languages", 39, "bamil�k�s, langues", 44 | ||
447 | und, "Undetermined", 434, "ind�termin�e", 177 | ||
448 | sin, "Sinhalese", 371, "singhalais", 371 | ||
449 | glv, "Manx", 264, "manx; mannois", 261 | ||
450 | kal, "Kalaallisut", 196, "groenlandais", 154 | ||
451 | iba, "Iban", 171, "iban", 172 | ||
452 | sgn-dk, "Danish Sign Language", 494, "Danish Sign Language", 485 | ||
453 | sgn-br, "Brazilian Sign Language", 490, "Brazilian Sign Language", 481 | ||
454 | ur, "Urdu", 435, "ourdou", 316 | ||
455 | sma, "Southern Sami", 387, "sami du Sud", 354 | ||
456 | sio, "Siouan languages", 373, "sioux, langues", 373 | ||
457 | mun, "Munda languages", 283, "mounda, langues", 278 | ||
458 | kam, "Kamba", 197, "kamba", 198 | ||
459 | grb, "Grebo", 152, "grebo", 151 | ||
460 | bak, "Bashkir", 43, "bachkir", 39 | ||
461 | chv, "Chuvash", 86, "tchouvache", 400 | ||
462 | paa, "Papuan (Other)", 327, "papoues, autres langues", 325 | ||
463 | kan, "Kannada", 198, "kannada", 199 | ||
464 | ha, "Hausa", 159, "haoussa", 159 | ||
465 | grc, "Greek, Ancient (to 1453)", 153, "grec ancien (jusqu'� 1453)", 152 | ||
466 | dum, "Dutch, Middle (ca. 1050-1350)", 107, "n�erlandais moyen (ca. 1050-1350)", 289 | ||
467 | mya, "Burmese", 63, "birman", 62 | ||
468 | bal, "Baluchi", 37, "baloutchi", 41 | ||
469 | fi, "Finnish", 125, "finnois", 129 | ||
470 | bam, "Bambara", 38, "bambara", 43 | ||
471 | zho, "Chinese", 80, "chinois", 86 | ||
472 | wol, "Wolof", 448, "wolof", 440 | ||
473 | gre, "Greek, Modern (1453-)", 154, "grec moderne (apr�s 1453)", 153 | ||
474 | gaa, "Ga", 134, "ga", 136 | ||
475 | fj, "Fijian", 124, "fidjien", 127 | ||
476 | btk, "Batak (Indonesia)", 45, "batak (Indon�sie)", 51 | ||
477 | ban, "Balinese", 35, "balinais", 40 | ||
478 | chy, "Cheyenne", 77, "cheyenne", 83 | ||
479 | sgn-us, "American Sign Language", 508, "American Sign Language", 499 | ||
480 | wo, "Wolof", 448, "wolof", 440 | ||
481 | sme, "Northern Sami", 300, "sami du Nord", 353 | ||
482 | kru, "Kurukh", 223, "kurukh", 223 | ||
483 | yi, "Yiddish", 453, "yiddish", 444 | ||
484 | tat, "Tatar", 404, "tatar", 397 | ||
485 | sit, "Sino-Tibetan (Other)", 372, "sino-tib�taines, autres langues", 372 | ||
486 | kar, "Karen", 201, "karen", 202 | ||
487 | he, "Hebrew", 161, "h�breu", 161 | ||
488 | mus, "Creek", 91, "muskogee", 280 | ||
489 | kas, "Kashmiri", 202, "kashmiri", 203 | ||
490 | isl, "Icelandic", 172, "islandais", 189 | ||
491 | baq, "Basque", 44, "basque", 50 | ||
492 | tvl, "Tuvalu", 427, "tuvalu", 426 | ||
493 | pag, "Pangasinan", 324, "pangasinan", 323 | ||
494 | non, "Norse, Old", 298, "norrois, vieux", 296 | ||
495 | kat, "Georgian", 141, "g�orgien", 145 | ||
496 | akk, "Akkadian", 10, "akkadien", 10 | ||
497 | i-mingo, "Mingo", 480, "Mingo", 471 | ||
498 | en-scouse, "English Liverpudlian dialect known as 'Scouse'", 472, "English Liverpudlian dialect known as 'Scouse'", 463 | ||
499 | uz, "Uzbek", 436, "ouszbek", 317 | ||
500 | smi, "Sami languages (Other)", 351, "sami, autres langues", 350 | ||
501 | mdr, "Mandar", 260, "mandar", 256 | ||
502 | kau, "Kanuri", 199, "kanouri", 200 | ||
503 | ja, "Japanese", 190, "japonais", 191 | ||
504 | fo, "Faroese", 123, "f�ro�en", 126 | ||
505 | dut, "Dutch", 106, "n�erlandais", 288 | ||
506 | bas, "Basa", 42, "basa", 49 | ||
507 | smj, "Lule Sami", 245, "sami de Lule", 351 | ||
508 | hi, "Hindi", 165, "hindi", 165 | ||
509 | bat, "Baltic (Other)", 36, "baltiques, autres langues", 42 | ||
510 | kaw, "Kawi", 203, "kawi", 204 | ||
511 | yo, "Yoruba", 454, "yoruba", 445 | ||
512 | tel, "Telugu", 405, "t�lougou", 401 | ||
513 | pro, "Proven�al, Old (to 1500)", 337, "proven�al ancien (jusqu'� 1500)", 337 | ||
514 | nor, "Norwegian", 302, "norv�gien", 297 | ||
515 | mwr, "Marwari", 269, "marvari", 266 | ||
516 | fr, "French", 128, "fran�ais", 131 | ||
517 | amh, "Amharic", 15, "amharique", 17 | ||
518 | znd, "Zande", 456, "zand�", 447 | ||
519 | tem, "Timne", 412, "temne", 402 | ||
520 | rum, "Romanian", 345, "roumain", 344 | ||
521 | pal, "Pahlavi", 320, "pahlavi", 319 | ||
522 | grn, "Guarani", 155, "guarani", 155 | ||
523 | fij, "Fijian", 124, "fidjien", 127 | ||
524 | dz, "Dzongkha", 109, "dzongkha", 112 | ||
525 | yao, "Yao", 451, "yao", 442 | ||
526 | urd, "Urdu", 435, "ourdou", 316 | ||
527 | sog, "Sogdian", 379, "sogdien", 377 | ||
528 | run, "Rundi", 347, "rundi", 345 | ||
529 | pam, "Pampanga", 323, "pampangan", 322 | ||
530 | kaz, "Kazakh", 204, "kazakh", 205 | ||
531 | smn, "Inari Sami", 177, "sami d'Inari", 352 | ||
532 | ibo, "Igbo", 174, "igbo", 174 | ||
533 | bej, "Beja", 46, "bedja", 52 | ||
534 | sgn-fr, "French Sign Language", 496, "French Sign Language", 487 | ||
535 | i-pwn, "Paiwan", 482, "Paiwan", 473 | ||
536 | yap, "Yapese", 452, "yapois", 443 | ||
537 | smo, "Samoan", 352, "samoan", 356 | ||
538 | pan, "Panjabi", 325, "pendjabi", 326 | ||
539 | myn, "Mayan languages", 271, "maya, langues", 268 | ||
540 | tib, "Tibetan", 409, "tib�tain", 407 | ||
541 | la, "Latin", 230, "latin", 230 | ||
542 | ho, "Hiri Motu", 166, "hiri motu", 166 | ||
543 | bel, "Belarusian", 47, "bi�lorusse", 58 | ||
544 | zh-gan, "Kan or Gan", 510, "Kan or Gan", 501 | ||
545 | pap, "Papiamento", 326, "papiamento", 324 | ||
546 | nub, "Nubian languages", 305, "nubiennes, langues", 300 | ||
547 | lb, "Luxembourgish; Letzeburgesch", 249, "luxembourgeois", 243 | ||
548 | fin, "Finnish", 125, "finnois", 129 | ||
549 | bem, "Bemba", 48, "bemba", 53 | ||
550 | art-lojban, "Lojban", 462, "Lojban", 453 | ||
551 | ter, "Tereno", 406, "tereno", 403 | ||
552 | tgk, "Tajik", 401, "tadjik", 392 | ||
553 | ben, "Bengali", 49, "bengali", 54 | ||
554 | tgl, "Tagalog", 398, "tagalog", 393 | ||
555 | sms, "Skolt Sami", 374, "sami skolt", 355 | ||
556 | rus, "Russian", 348, "russe", 346 | ||
557 | fy, "Frisian", 131, "frison", 135 | ||
558 | hr, "Croatian", 93, "croate", 99 | ||
559 | cre, "Cree", 90, "cree", 97 | ||
560 | tet, "Tetum", 407, "tetum", 404 | ||
561 | som, "Somali", 380, "somali", 378 | ||
562 | lad, "Ladino", 226, "jud�o-espagnol", 194 | ||
563 | tig, "Tigre", 410, "tigr�", 408 | ||
564 | son, "Songhai", 381, "songhai", 379 | ||
565 | ido, "Ido", 173, "ido", 173 | ||
566 | pau, "Palauan", 321, "palau", 320 | ||
567 | ssa, "Nilo-Saharan (Other)", 296, "nilo-sahariennes, autres langues", 294 | ||
568 | hu, "Hungarian", 169, "hongrois", 169 | ||
569 | ber, "Berber (Other)", 50, "berb�res, autres langues", 55 | ||
570 | cad, "Caddo", 64, "caddo", 71 | ||
571 | nso, "Sotho, Northern", 384, "sotho du Nord", 382 | ||
572 | na, "Nauru", 285, "nauruan", 283 | ||
573 | sqi, "Albanian", 11, "albanais", 11 | ||
574 | de-at-1996, "German Austrian variant orthography of 1996", 467, "German Austrian variant orthography of 1996", 458 | ||
575 | nbl, "South Ndebele", 388, "nd�b�l� du Sud", 286 | ||
576 | nde, "North Ndebele", 301, "nd�b�l� du Nord", 285 | ||
577 | li, "Limburgish; Limburger; Limburgan", 236, "limbourgeois", 233 | ||
578 | lah, "Lahnda", 227, "lahnda", 226 | ||
579 | fiu, "Finno-Ugrian (Other)", 126, "finno-ougriennes, autres langues", 128 | ||
580 | dyu, "Dyula", 108, "dioula", 105 | ||
581 | nb, "Norwegian Bokm�l; Bokm�l, Norwegian", 303, "norv�gien bokm�l; bokm�l, norv�gien", 298 | ||
582 | nd, "North Ndebele", 301, "nd�b�l� du Nord", 285 | ||
583 | mlg, "Malagasy", 255, "malgache", 253 | ||
584 | bih, "Bihari", 52, "bihari", 59 | ||
585 | hy, "Armenian", 22, "arm�nien", 27 | ||
586 | sgn-jp, "Japanese Sign Language", 501, "Japanese Sign Language", 492 | ||
587 | sot, "Sotho, Southern", 385, "sotho du Sud", 383 | ||
588 | ne, "Nepali", 292, "n�palais", 290 | ||
589 | hz, "Herero", 162, "herero", 162 | ||
590 | kik, "Kikuyu; Gikuyu", 209, "kikuyu", 210 | ||
591 | gay, "Gayo", 138, "gayo", 143 | ||
592 | ng, "Ndonga", 290, "ndonga", 287 | ||
593 | mnc, "Manchu", 259, "mandchou", 255 | ||
594 | ln, "Lingala", 237, "lingala", 234 | ||
595 | lam, "Lamba", 228, "lamba", 227 | ||
596 | ewe, "Ewe", 119, "�w�", 122 | ||
597 | bik, "Bikol", 53, "bikol", 60 | ||
598 | peo, "Persian, Old (ca.600-400 B.C.)", 329, "perse, vieux (ca. 600-400 av. J.-C.)", 328 | ||
599 | pa, "Panjabi", 325, "pendjabi", 326 | ||
600 | lo, "Lao", 229, "lao", 229 | ||
601 | kin, "Kinyarwanda", 211, "rwanda", 347 | ||
602 | jv, "Javanese", 191, "javanais", 192 | ||
603 | gem, "Germanic (Other)", 146, "germaniques, autres langues", 146 | ||
604 | est, "Estonian", 118, "estonien", 121 | ||
605 | crp, "Creoles and pidgins (Other)", 92, "cr�oles et pidgins divers", 98 | ||
606 | nya, "Nyanja; Chichewa; Chewa", 307, "nyanja; chichewa; chewa", 302 | ||
607 | yid, "Yiddish", 453, "yiddish", 444 | ||
608 | lao, "Lao", 229, "lao", 229 | ||
609 | sgn-be-fr, "Belgian-French Sign Language", 488, "Belgian-French Sign Language", 479 | ||
610 | tir, "Tigrinya", 411, "tigrigna", 409 | ||
611 | kmb, "Kimbundu", 210, "kimbundu", 211 | ||
612 | geo, "Georgian", 141, "g�orgien", 145 | ||
613 | bin, "Bini", 54, "bini", 61 | ||
614 | i-lux, "Luxembourgish Deprecated use ISO 639 lb registered Sept. 9 1998", 479, "Luxembourgish Deprecated use ISO 639 lb registered Sept. 9 1998", 470 | ||
615 | tkl, "Tokelau", 416, "tokelau", 413 | ||
616 | per, "Persian", 328, "persan", 327 | ||
617 | zh-wuu, "Shanghaiese or Wu", 515, "Shanghaiese or Wu", 506 | ||
618 | sgn-ni, "Nicaraguan Sign Language", 503, "Nicaraguan Sign Language", 494 | ||
619 | ndo, "Ndonga", 290, "ndonga", 287 | ||
620 | kir, "Kirghiz", 212, "kirghize", 212 | ||
621 | nl, "Dutch", 106, "n�erlandais", 288 | ||
622 | ceb, "Cebuano", 69, "cebuano", 76 | ||
623 | mni, "Manipuri", 262, "manipuri", 258 | ||
624 | lt, "Lithuanian", 238, "lituanien", 235 | ||
625 | ger, "German", 142, "allemand", 14 | ||
626 | i-bnn, "Bunun", 474, "Bunun", 465 | ||
627 | uga, "Ugaritic", 430, "ougaritique", 314 | ||
628 | tiv, "Tiv", 413, "tiv", 410 | ||
629 | tmh, "Tamashek", 402, "tamacheq", 395 | ||
630 | swa, "Swahili", 394, "swahili", 389 | ||
631 | nn, "Nynorsk, Norwegian; Norwegian Nynorsk", 309, "nynorsk, norv�gien; norv�gien nynorsk", 304 | ||
632 | lat, "Latin", 230, "latin", 230 | ||
633 | eus, "Basque", 44, "basque", 50 | ||
634 | car, "Carib", 65, "caribe", 72 | ||
635 | sgn-nl, "Dutch Sign Language", 504, "Dutch Sign Language", 495 | ||
636 | osa, "Osage", 316, "osage", 310 | ||
637 | no, "Norwegian", 302, "norv�gien", 297 | ||
638 | lv, "Latvian", 231, "letton", 231 | ||
639 | efi, "Efik", 110, "efik", 114 | ||
640 | bis, "Bislama", 55, "bichlamar", 57 | ||
641 | ada, "Adangme", 4, "adangme", 4 | ||
642 | de-1996, "German orthography of 1996", 465, "German orthography of 1996", 456 | ||
643 | pi, "Pali", 322, "pali", 321 | ||
644 | lav, "Latvian", 231, "letton", 231 | ||
645 | nds, "Low Saxon; Low German; Saxon, Low; German, Low", 240, "saxon, bas; allemand, bas; bas saxon; bas allemand", 363 | ||
646 | fon, "Fon", 127, "fon", 130 | ||
647 | asm, "Assamese", 24, "assamais", 29 | ||
648 | cat, "Catalan", 67, "catalan", 74 | ||
649 | suk, "Sukuma", 390, "sukuma", 387 | ||
650 | mlt, "Maltese", 258, "maltais", 254 | ||
651 | ile, "Interlingue", 181, "interlingue", 181 | ||
652 | ewo, "Ewondo", 120, "�wondo", 123 | ||
653 | cau, "Caucasian (Other)", 68, "caucasiennes, autres langues", 75 | ||
654 | sgn-no, "Norwegian Sign Language", 505, "Norwegian Sign Language", 496 | ||
655 | uzb, "Uzbek", 436, "ouszbek", 317 | ||
656 | swe, "Swedish", 396, "su�dois", 386 | ||
657 | nr, "South Ndebele", 388, "nd�b�l� du Sud", 286 | ||
658 | hai, "Haida", 158, "haida", 158 | ||
659 | awa, "Awadhi", 31, "awadhi", 35 | ||
660 | abk, "Abkhazian", 1, "abkhaze", 1 | ||
661 | pl, "Polish", 333, "polonais", 333 | ||
662 | mno, "Manobo languages", 263, "manobo, langues", 260 | ||
663 | aa, "Afar", 5, "afar", 5 | ||
664 | tog, "Tonga (Nyasa)", 417, "tonga (Nyasa)", 414 | ||
665 | sun, "Sundanese", 392, "soundanais", 384 | ||
666 | nym, "Nyamwezi", 306, "nyamwezi", 301 | ||
667 | ijo, "Ijo", 175, "ijo", 175 | ||
668 | ab, "Abkhazian", 1, "abkhaze", 1 | ||
669 | zap, "Zapotec", 457, "zapot�que", 448 | ||
670 | bod, "Tibetan", 409, "tib�tain", 407 | ||
671 | nyn, "Nyankole", 308, "nyankol�", 303 | ||
672 | gil, "Gilbertese", 148, "kiribati", 213 | ||
673 | gez, "Geez", 140, "gu�ze", 156 | ||
674 | dra, "Dravidian (Other)", 104, "dravidiennes, autres langues", 111 | ||
675 | ta, "Tamil", 403, "tamoul", 396 | ||
676 | ssw, "Swati", 395, "swati", 390 | ||
677 | nyo, "Nyoro", 310, "nyoro", 305 | ||
678 | nv, "Navajo; Navaho", 287, "navaho", 284 | ||
679 | inc, "Indic (Other)", 178, "indo-aryennes, autres langues", 178 | ||
680 | afa, "Afro-Asiatic (Other)", 8, "afro-asiatiques, autres langues", 8 | ||
681 | cel, "Celtic (Other)", 70, "celtiques, autres langues", 77 | ||
682 | ltz, "Luxembourgish; Letzeburgesch", 249, "luxembourgeois", 243 | ||
683 | ind, "Indonesian", 180, "indon�sien", 180 | ||
684 | ae, "Avestan", 30, "avestique", 34 | ||
685 | ast, "Bable; Asturian", 34, "bable; asturien", 38 | ||
686 | ine, "Indo-European (Other)", 179, "indo-europ�ennes, autres langues", 179 | ||
687 | af, "Afrikaans", 7, "afrikaans", 7 | ||
688 | sus, "Susu", 393, "soussou", 385 | ||
689 | mac, "Macedonian", 250, "mac�donien", 244 | ||
690 | heb, "Hebrew", 161, "h�breu", 161 | ||
691 | ny, "Nyanja; Chichewa; Chewa", 307, "nyanja; chichewa; chewa", 302 | ||
692 | cze, "Czech", 95, "tch�que", 398 | ||
693 | te, "Telugu", 405, "t�lougou", 401 | ||
694 | ps, "Pushto", 338, "pachto", 318 | ||
695 | mad, "Madurese", 251, "madourais", 245 | ||
696 | kok, "Konkani", 215, "konkani", 216 | ||
697 | ca, "Catalan", 67, "catalan", 74 | ||
698 | %% | ||
699 |
File tests/makeinfo.gperf added (mode: 100644) (index 0000000..1488b8e) | |||
1 | COMMAND; | ||
2 | %% | ||
3 | !, cm_force_sentence_end, false | ||
4 | ', insert_self, false | ||
5 | *, cm_asterisk, false | ||
6 | ., cm_force_sentence_end, false | ||
7 | :, cm_force_abbreviated_whitespace, false | ||
8 | ?, cm_force_sentence_end, false | ||
9 | @, insert_self, false | ||
10 | TeX, cm_TeX, true | ||
11 | `, insert_self, false | ||
12 | appendix, cm_appendix, false | ||
13 | appendixsec, cm_appendixsec, false | ||
14 | appendixsubsec, cm_appendixsubsec, false | ||
15 | asis, cm_asis, true | ||
16 | b, cm_bold, true | ||
17 | br, cm_br, false | ||
18 | bullet, cm_bullet, true | ||
19 | bye, cm_bye, false | ||
20 | c, cm_comment, false | ||
21 | center, cm_center, false | ||
22 | chapter, cm_chapter, false | ||
23 | cindex, cm_cindex, false | ||
24 | cite, cm_cite, true | ||
25 | code, cm_code, true | ||
26 | comment, cm_comment, false | ||
27 | contents, do_nothing, false | ||
28 | copyright, cm_copyright, true | ||
29 | ctrl, cm_ctrl, true | ||
30 | defcodeindex, cm_defindex, false | ||
31 | defindex, cm_defindex, false | ||
32 | dfn, cm_dfn, true | ||
33 | display, cm_display, false | ||
34 | dots, cm_dots, true | ||
35 | emph, cm_emph, true | ||
36 | end, cm_end, false | ||
37 | enumerate, cm_enumerate, false | ||
38 | equiv, cm_equiv, true | ||
39 | error, cm_error, true | ||
40 | example, cm_example, false | ||
41 | exdent, cm_exdent, false | ||
42 | expansion, cm_expansion, true | ||
43 | file, cm_file, true | ||
44 | findex, cm_findex, false | ||
45 | format, cm_format, false | ||
46 | group, cm_group, false | ||
47 | i, cm_italic, true | ||
48 | iappendix, cm_appendix, false | ||
49 | iappendixsec, cm_appendixsec, false | ||
50 | iappendixsubsec, cm_appendixsubsec, false | ||
51 | ichapter, cm_chapter, false | ||
52 | ifinfo, cm_ifinfo, false | ||
53 | iftex, cm_iftex, false | ||
54 | ignore, cm_ignore, false | ||
55 | include, cm_include, false | ||
56 | inforef, cm_inforef, true | ||
57 | input, cm_include, false | ||
58 | isection, cm_section, false | ||
59 | isubsection, cm_subsection, false | ||
60 | isubsubsection, cm_subsubsection, false | ||
61 | item, cm_item, false | ||
62 | itemize, cm_itemize, false | ||
63 | itemx, cm_itemx, false | ||
64 | iunnumbered, cm_unnumbered, false | ||
65 | iunnumberedsec, cm_unnumberedsec, false | ||
66 | iunnumberedsubsec, cm_unnumberedsubsec, false | ||
67 | kbd, cm_kbd, true | ||
68 | key, cm_key, true | ||
69 | kindex, cm_kindex, false | ||
70 | lisp, cm_lisp, false | ||
71 | menu, cm_menu | ||
72 | minus, cm_minus, true | ||
73 | need, cm_need, false | ||
74 | node, cm_node, false | ||
75 | noindent, cm_noindent, false | ||
76 | page, do_nothing, false | ||
77 | pindex, cm_pindex, false | ||
78 | point, cm_point, true | ||
79 | print, cm_print, true | ||
80 | printindex, cm_printindex, false | ||
81 | pxref, cm_pxref, true | ||
82 | quotation, cm_quotation, false | ||
83 | r, cm_roman, true | ||
84 | ref, cm_xref, true | ||
85 | refill, cm_refill, false | ||
86 | result, cm_result, true | ||
87 | samp, cm_samp, true | ||
88 | sc, cm_sc, true | ||
89 | section, cm_section, false | ||
90 | setchapternewpage, cm_setchapternewpage, false | ||
91 | setfilename, cm_setfilename, false | ||
92 | settitle, cm_settitle, false | ||
93 | smallexample, cm_smallexample, false | ||
94 | sp, cm_sp, false | ||
95 | strong, cm_strong, true | ||
96 | subsection, cm_subsection, false | ||
97 | subsubsection, cm_subsubsection, false | ||
98 | summarycontents, do_nothing, false | ||
99 | syncodeindex, cm_synindex, false | ||
100 | synindex, cm_synindex, false | ||
101 | t, cm_title, true | ||
102 | table, cm_table, false | ||
103 | tex, cm_tex, false | ||
104 | tindex, cm_tindex, false | ||
105 | titlepage, cm_titlepage, false | ||
106 | unnumbered, cm_unnumbered, false | ||
107 | unnumberedsec, cm_unnumberedsec, false | ||
108 | unnumberedsubsec, cm_unnumberedsubsec, false | ||
109 | var, cm_var, true | ||
110 | vindex, cm_vindex, false | ||
111 | w, cm_w, true | ||
112 | xref, cm_xref, true | ||
113 | {, insert_self, false | ||
114 | }, insert_self, false | ||
115 | infoinclude, cm_infoinclude, false | ||
116 | footnote, cm_footnote, false |
File tests/modula.exp added (mode: 100644) (index 0000000..cef7d5a) | |||
1 | in word set AND | ||
2 | in word set ARRAY | ||
3 | in word set BEGIN | ||
4 | in word set BITS | ||
5 | in word set BY | ||
6 | in word set CASE | ||
7 | in word set CONST | ||
8 | in word set DIV | ||
9 | in word set DO | ||
10 | in word set ELSE | ||
11 | in word set ELSIF | ||
12 | in word set END | ||
13 | in word set EVAL | ||
14 | in word set EXCEPT | ||
15 | in word set EXCEPTION | ||
16 | in word set EXIT | ||
17 | in word set EXPORTS | ||
18 | in word set FINALLY | ||
19 | in word set FOR | ||
20 | in word set FROM | ||
21 | in word set IF | ||
22 | in word set IMPORT | ||
23 | in word set INTERFACE | ||
24 | in word set IN | ||
25 | in word set INLINE | ||
26 | in word set LOCK | ||
27 | in word set METHODS | ||
28 | in word set MOD | ||
29 | in word set MODULE | ||
30 | in word set NOT | ||
31 | in word set OBJECT | ||
32 | in word set OF | ||
33 | in word set OR | ||
34 | in word set PROCEDURE | ||
35 | in word set RAISES | ||
36 | in word set READONLY | ||
37 | in word set RECORD | ||
38 | in word set REF | ||
39 | in word set REPEAT | ||
40 | in word set RETURN | ||
41 | in word set SET | ||
42 | in word set THEN | ||
43 | in word set TO | ||
44 | in word set TRY | ||
45 | in word set TYPE | ||
46 | in word set TYPECASE | ||
47 | in word set UNSAFE | ||
48 | in word set UNTIL | ||
49 | in word set UNTRACED | ||
50 | in word set VALUE | ||
51 | in word set VAR | ||
52 | in word set WHILE | ||
53 | in word set WITH | ||
54 | in word set and | ||
55 | in word set array | ||
56 | in word set begin | ||
57 | in word set bits | ||
58 | in word set by | ||
59 | in word set case | ||
60 | in word set const | ||
61 | in word set div | ||
62 | in word set do | ||
63 | in word set else | ||
64 | in word set elsif | ||
65 | in word set end | ||
66 | in word set eval | ||
67 | in word set except | ||
68 | in word set exception | ||
69 | in word set exit | ||
70 | in word set exports | ||
71 | in word set finally | ||
72 | in word set for | ||
73 | in word set from | ||
74 | in word set if | ||
75 | in word set import | ||
76 | in word set interface | ||
77 | in word set in | ||
78 | in word set inline | ||
79 | in word set lock | ||
80 | in word set methods | ||
81 | in word set mod | ||
82 | in word set module | ||
83 | in word set not | ||
84 | in word set object | ||
85 | in word set of | ||
86 | in word set or | ||
87 | in word set procedure | ||
88 | in word set raises | ||
89 | in word set readonly | ||
90 | in word set record | ||
91 | in word set ref | ||
92 | in word set repeat | ||
93 | in word set return | ||
94 | in word set set | ||
95 | in word set then | ||
96 | in word set to | ||
97 | in word set try | ||
98 | in word set type | ||
99 | in word set typecase | ||
100 | in word set unsafe | ||
101 | in word set until | ||
102 | in word set untraced | ||
103 | in word set value | ||
104 | in word set var | ||
105 | in word set while | ||
106 | in word set with |
File tests/modula2.exp added (mode: 100644) (index 0000000..4a622fd) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -n -k1-8 -l */ | ||
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-gperf@gnu.org>." | ||
29 | #endif | ||
30 | |||
31 | |||
32 | #define TOTAL_KEYWORDS 40 | ||
33 | #define MIN_WORD_LENGTH 2 | ||
34 | #define MAX_WORD_LENGTH 14 | ||
35 | #define MIN_HASH_VALUE 1 | ||
36 | #define MAX_HASH_VALUE 155 | ||
37 | /* maximum key range = 155, duplicates = 0 */ | ||
38 | |||
39 | #ifdef __GNUC__ | ||
40 | __inline | ||
41 | #else | ||
42 | #ifdef __cplusplus | ||
43 | inline | ||
44 | #endif | ||
45 | #endif | ||
46 | static unsigned int | ||
47 | hash (register const char *str, register size_t len) | ||
48 | { | ||
49 | static unsigned char asso_values[] = | ||
50 | { | ||
51 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
52 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
53 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
54 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
55 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
56 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
57 | 156, 156, 156, 156, 156, 1, 10, 30, 25, 0, | ||
58 | 10, 55, 6, 0, 156, 156, 15, 15, 35, 15, | ||
59 | 30, 0, 5, 1, 0, 45, 21, 45, 6, 1, | ||
60 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
61 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
62 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
63 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
64 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
65 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
66 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
67 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
68 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
69 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
70 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
71 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
72 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
73 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
74 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
75 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, | ||
76 | 156, 156, 156, 156, 156, 156 | ||
77 | }; | ||
78 | register unsigned int hval = 0; | ||
79 | |||
80 | switch (len) | ||
81 | { | ||
82 | default: | ||
83 | hval += asso_values[(unsigned char)str[7]]; | ||
84 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
85 | [[fallthrough]]; | ||
86 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
87 | __attribute__ ((__fallthrough__)); | ||
88 | #endif | ||
89 | /*FALLTHROUGH*/ | ||
90 | case 7: | ||
91 | hval += asso_values[(unsigned char)str[6]]; | ||
92 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
93 | [[fallthrough]]; | ||
94 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
95 | __attribute__ ((__fallthrough__)); | ||
96 | #endif | ||
97 | /*FALLTHROUGH*/ | ||
98 | case 6: | ||
99 | hval += asso_values[(unsigned char)str[5]]; | ||
100 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
101 | [[fallthrough]]; | ||
102 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
103 | __attribute__ ((__fallthrough__)); | ||
104 | #endif | ||
105 | /*FALLTHROUGH*/ | ||
106 | case 5: | ||
107 | hval += asso_values[(unsigned char)str[4]]; | ||
108 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
109 | [[fallthrough]]; | ||
110 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
111 | __attribute__ ((__fallthrough__)); | ||
112 | #endif | ||
113 | /*FALLTHROUGH*/ | ||
114 | case 4: | ||
115 | hval += asso_values[(unsigned char)str[3]]; | ||
116 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
117 | [[fallthrough]]; | ||
118 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
119 | __attribute__ ((__fallthrough__)); | ||
120 | #endif | ||
121 | /*FALLTHROUGH*/ | ||
122 | case 3: | ||
123 | hval += asso_values[(unsigned char)str[2]]; | ||
124 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
125 | [[fallthrough]]; | ||
126 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
127 | __attribute__ ((__fallthrough__)); | ||
128 | #endif | ||
129 | /*FALLTHROUGH*/ | ||
130 | case 2: | ||
131 | hval += asso_values[(unsigned char)str[1]]; | ||
132 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
133 | [[fallthrough]]; | ||
134 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
135 | __attribute__ ((__fallthrough__)); | ||
136 | #endif | ||
137 | /*FALLTHROUGH*/ | ||
138 | case 1: | ||
139 | hval += asso_values[(unsigned char)str[0]]; | ||
140 | break; | ||
141 | } | ||
142 | return hval; | ||
143 | } | ||
144 | |||
145 | const char * | ||
146 | in_word_set (register const char *str, register size_t len) | ||
147 | { | ||
148 | static unsigned char lengthtable[] = | ||
149 | { | ||
150 | 0, 3, 0, 0, 0, 0, 4, 0, 0, 0, 2, 2, 0, 5, | ||
151 | 0, 2, 4, 0, 0, 0, 2, 0, 0, 0, 0, 2, 5, 3, | ||
152 | 0, 0, 3, 4, 4, 0, 0, 2, 6, 0, 0, 0, 2, 4, | ||
153 | 0, 0, 0, 4, 3, 0, 0, 0, 3, 4, 0, 0, 0, 3, | ||
154 | 6, 0, 0, 0, 3, 3, 0, 0, 0, 6, 5, 0, 0, 0, | ||
155 | 10, 9, 0, 0, 0, 4, 0, 0, 0, 0, 6, 5, 0, 0, | ||
156 | 0, 7, 0, 0, 0, 0, 6, 0, 0, 0, 0, 5, 0, 0, | ||
157 | 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, | ||
158 | 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
159 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
160 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
161 | 0, 9 | ||
162 | }; | ||
163 | static const char * wordlist[] = | ||
164 | { | ||
165 | "", | ||
166 | "SET", | ||
167 | "", "", "", "", | ||
168 | "EXIT", | ||
169 | "", "", "", | ||
170 | "IF", | ||
171 | "BY", | ||
172 | "", | ||
173 | "ARRAY", | ||
174 | "", | ||
175 | "TO", | ||
176 | "ELSE", | ||
177 | "", "", "", | ||
178 | "OR", | ||
179 | "", "", "", "", | ||
180 | "OF", | ||
181 | "ELSIF", | ||
182 | "VAR", | ||
183 | "", "", | ||
184 | "FOR", | ||
185 | "TYPE", | ||
186 | "CASE", | ||
187 | "", "", | ||
188 | "IN", | ||
189 | "REPEAT", | ||
190 | "", "", "", | ||
191 | "DO", | ||
192 | "THEN", | ||
193 | "", "", "", | ||
194 | "FROM", | ||
195 | "DIV", | ||
196 | "", "", "", | ||
197 | "NOT", | ||
198 | "WITH", | ||
199 | "", "", "", | ||
200 | "MOD", | ||
201 | "EXPORT", | ||
202 | "", "", "", | ||
203 | "END", | ||
204 | "AND", | ||
205 | "", "", "", | ||
206 | "IMPORT", | ||
207 | "WHILE", | ||
208 | "", "", "", | ||
209 | "DEFINITION", | ||
210 | "QUALIFIED", | ||
211 | "", "", "", | ||
212 | "LOOP", | ||
213 | "", "", "", "", | ||
214 | "RECORD", | ||
215 | "CONST", | ||
216 | "", "", "", | ||
217 | "POINTER", | ||
218 | "", "", "", "", | ||
219 | "RETURN", | ||
220 | "", "", "", "", | ||
221 | "UNTIL", | ||
222 | "", "", "", "", | ||
223 | "BEGIN", | ||
224 | "", "", "", "", "", "", "", "", "", | ||
225 | "IMPLEMENTATION", | ||
226 | "", "", "", "", | ||
227 | "MODULE", | ||
228 | "", "", "", "", "", "", "", "", "", | ||
229 | "", "", "", "", "", "", "", "", "", | ||
230 | "", "", "", "", "", "", "", "", "", | ||
231 | "", "", "", "", "", "", "", "", "", | ||
232 | "", "", "", | ||
233 | "PROCEDURE" | ||
234 | }; | ||
235 | |||
236 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
237 | { | ||
238 | register unsigned int key = hash (str, len); | ||
239 | |||
240 | if (key <= MAX_HASH_VALUE) | ||
241 | if (len == lengthtable[key]) | ||
242 | { | ||
243 | register const char *s = wordlist[key]; | ||
244 | |||
245 | if (*str == *s && !memcmp (str + 1, s + 1, len - 1)) | ||
246 | return s; | ||
247 | } | ||
248 | } | ||
249 | return 0; | ||
250 | } |
File tests/modula2.gperf added (mode: 100644) (index 0000000..5ef9c75) | |||
1 | AND | ||
2 | ARRAY | ||
3 | BEGIN | ||
4 | BY | ||
5 | CASE | ||
6 | CONST | ||
7 | DEFINITION | ||
8 | DIV | ||
9 | DO | ||
10 | ELSE | ||
11 | ELSIF | ||
12 | END | ||
13 | EXIT | ||
14 | EXPORT | ||
15 | FOR | ||
16 | FROM | ||
17 | IF | ||
18 | IMPLEMENTATION | ||
19 | IMPORT | ||
20 | IN | ||
21 | LOOP | ||
22 | MOD | ||
23 | MODULE | ||
24 | NOT | ||
25 | OF | ||
26 | OR | ||
27 | POINTER | ||
28 | PROCEDURE | ||
29 | QUALIFIED | ||
30 | RECORD | ||
31 | REPEAT | ||
32 | RETURN | ||
33 | SET | ||
34 | THEN | ||
35 | TO | ||
36 | TYPE | ||
37 | UNTIL | ||
38 | VAR | ||
39 | WHILE | ||
40 | WITH |
File tests/modula3.gperf added (mode: 100644) (index 0000000..d024346) | |||
1 | AND | ||
2 | ARRAY | ||
3 | BEGIN | ||
4 | BITS | ||
5 | BY | ||
6 | CASE | ||
7 | CONST | ||
8 | DIV | ||
9 | DO | ||
10 | ELSE | ||
11 | ELSIF | ||
12 | END | ||
13 | EVAL | ||
14 | EXCEPT | ||
15 | EXCEPTION | ||
16 | EXIT | ||
17 | EXPORTS | ||
18 | FINALLY | ||
19 | FOR | ||
20 | FROM | ||
21 | IF | ||
22 | IMPORT | ||
23 | INTERFACE | ||
24 | IN | ||
25 | INLINE | ||
26 | LOCK | ||
27 | METHODS | ||
28 | MOD | ||
29 | MODULE | ||
30 | NOT | ||
31 | OBJECT | ||
32 | OF | ||
33 | OR | ||
34 | PROCEDURE | ||
35 | RAISES | ||
36 | READONLY | ||
37 | RECORD | ||
38 | REF | ||
39 | REPEAT | ||
40 | RETURN | ||
41 | SET | ||
42 | THEN | ||
43 | TO | ||
44 | TRY | ||
45 | TYPE | ||
46 | TYPECASE | ||
47 | UNSAFE | ||
48 | UNTIL | ||
49 | UNTRACED | ||
50 | VALUE | ||
51 | VAR | ||
52 | WHILE | ||
53 | WITH | ||
54 | and | ||
55 | array | ||
56 | begin | ||
57 | bits | ||
58 | by | ||
59 | case | ||
60 | const | ||
61 | div | ||
62 | do | ||
63 | else | ||
64 | elsif | ||
65 | end | ||
66 | eval | ||
67 | except | ||
68 | exception | ||
69 | exit | ||
70 | exports | ||
71 | finally | ||
72 | for | ||
73 | from | ||
74 | if | ||
75 | import | ||
76 | interface | ||
77 | in | ||
78 | inline | ||
79 | lock | ||
80 | methods | ||
81 | mod | ||
82 | module | ||
83 | not | ||
84 | object | ||
85 | of | ||
86 | or | ||
87 | procedure | ||
88 | raises | ||
89 | readonly | ||
90 | record | ||
91 | ref | ||
92 | repeat | ||
93 | return | ||
94 | set | ||
95 | then | ||
96 | to | ||
97 | try | ||
98 | type | ||
99 | typecase | ||
100 | unsafe | ||
101 | until | ||
102 | untraced | ||
103 | value | ||
104 | var | ||
105 | while | ||
106 | with |
File tests/objc.exp added (mode: 100644) (index 0000000..3d7b16c) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -j1 -i 1 -g -o -t -N is_reserved_word -k'1,3,$' */ | ||
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-gperf@gnu.org>." | ||
29 | #endif | ||
30 | |||
31 | |||
32 | /* Command-line: gperf -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ objc.gperf */ | ||
33 | struct resword { char *name; short token; enum rid rid; }; | ||
34 | |||
35 | #define TOTAL_KEYWORDS 59 | ||
36 | #define MIN_WORD_LENGTH 2 | ||
37 | #define MAX_WORD_LENGTH 15 | ||
38 | #define MIN_HASH_VALUE 8 | ||
39 | #define MAX_HASH_VALUE 95 | ||
40 | /* maximum key range = 88, duplicates = 0 */ | ||
41 | |||
42 | #ifdef __GNUC__ | ||
43 | __inline | ||
44 | #else | ||
45 | #ifdef __cplusplus | ||
46 | inline | ||
47 | #endif | ||
48 | #endif | ||
49 | static unsigned int | ||
50 | hash (register const char *str, register size_t len) | ||
51 | { | ||
52 | static unsigned char asso_values[] = | ||
53 | { | ||
54 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
55 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
56 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
57 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
58 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
59 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
60 | 96, 96, 96, 96, 19, 96, 96, 96, 96, 96, | ||
61 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
62 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
63 | 96, 96, 96, 96, 96, 2, 96, 2, 1, 10, | ||
64 | 26, 1, 23, 27, 27, 24, 96, 1, 25, 36, | ||
65 | 10, 34, 23, 96, 10, 6, 8, 11, 41, 2, | ||
66 | 96, 96, 23, 96, 96, 96, 96, 96, 96, 96, | ||
67 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
68 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
69 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
70 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
71 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
72 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
73 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
74 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
75 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
76 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
77 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
78 | 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, | ||
79 | 96, 96, 96, 96, 96, 96 | ||
80 | }; | ||
81 | register unsigned int hval = len; | ||
82 | |||
83 | switch (hval) | ||
84 | { | ||
85 | default: | ||
86 | hval += asso_values[(unsigned char)str[2]]; | ||
87 | #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3)) | ||
88 | [[fallthrough]]; | ||
89 | #elif defined __GNUC__ && __GNUC__ >= 7 | ||
90 | __attribute__ ((__fallthrough__)); | ||
91 | #endif | ||
92 | /*FALLTHROUGH*/ | ||
93 | case 2: | ||
94 | case 1: | ||
95 | hval += asso_values[(unsigned char)str[0]]; | ||
96 | break; | ||
97 | } | ||
98 | return hval + asso_values[(unsigned char)str[len - 1]]; | ||
99 | } | ||
100 | |||
101 | struct resword * | ||
102 | is_reserved_word (register const char *str, register size_t len) | ||
103 | { | ||
104 | static struct resword wordlist[] = | ||
105 | { | ||
106 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
107 | {"break", BREAK, NORID}, | ||
108 | {""}, {""}, {""}, | ||
109 | {"else", ELSE, NORID}, | ||
110 | {"__asm__", ASM, NORID}, | ||
111 | {""}, {""}, | ||
112 | {"__attribute", ATTRIBUTE, NORID}, | ||
113 | {"__alignof__", ALIGNOF, NORID}, | ||
114 | {"__extension__", EXTENSION, NORID}, | ||
115 | {"__attribute__", ATTRIBUTE, NORID}, | ||
116 | {"__signed__", TYPESPEC, RID_SIGNED}, | ||
117 | {"case", CASE, NORID}, | ||
118 | {"__typeof__", TYPEOF, NORID}, | ||
119 | {"__const__", TYPE_QUAL, RID_CONST}, | ||
120 | {"static", SCSPEC, RID_STATIC}, | ||
121 | {"extern", SCSPEC, RID_EXTERN}, | ||
122 | {"char", TYPESPEC, RID_CHAR}, | ||
123 | {"__const", TYPE_QUAL, RID_CONST}, | ||
124 | {""}, | ||
125 | {"continue", CONTINUE, NORID}, | ||
126 | {"struct", STRUCT, NORID}, | ||
127 | {"@defs", DEFS, NORID}, | ||
128 | {"while", WHILE, NORID}, | ||
129 | {"const", TYPE_QUAL, RID_CONST}, | ||
130 | {"return", RETURN, NORID}, | ||
131 | {"__inline", SCSPEC, RID_INLINE}, | ||
132 | {"__alignof", ALIGNOF, NORID}, | ||
133 | {"@encode", ENCODE, NORID}, | ||
134 | {"__inline__", SCSPEC, RID_INLINE}, | ||
135 | {"@selector", SELECTOR, NORID}, | ||
136 | {"@interface", INTERFACE, NORID}, | ||
137 | {"__typeof", TYPEOF, NORID}, | ||
138 | {"__signed", TYPESPEC, RID_SIGNED}, | ||
139 | {"int", TYPESPEC, RID_INT}, | ||
140 | {"double", TYPESPEC, RID_DOUBLE}, | ||
141 | {"__asm", ASM, NORID}, | ||
142 | {"for", FOR, NORID}, | ||
143 | {"@public", PUBLIC, NORID}, | ||
144 | {"auto", SCSPEC, RID_AUTO}, | ||
145 | {"if", IF, NORID}, | ||
146 | {"union", UNION, NORID}, | ||
147 | {"unsigned", TYPESPEC, RID_UNSIGNED}, | ||
148 | {"enum", ENUM, NORID}, | ||
149 | {"short", TYPESPEC, RID_SHORT}, | ||
150 | {"__volatile", TYPE_QUAL, RID_VOLATILE}, | ||
151 | {"register", SCSPEC, RID_REGISTER}, | ||
152 | {"inline", SCSPEC, RID_INLINE}, | ||
153 | {"__volatile__", TYPE_QUAL, RID_VOLATILE}, | ||
154 | {"sizeof", SIZEOF, NORID}, | ||
155 | {"@end", END, NORID}, | ||
156 | {"typeof", TYPEOF, NORID}, | ||
157 | {"typedef", SCSPEC, RID_TYPEDEF}, | ||
158 | {"do", DO, NORID}, | ||
159 | {"switch", SWITCH, NORID}, | ||
160 | {"default", DEFAULT, NORID}, | ||
161 | {"signed", TYPESPEC, RID_SIGNED}, | ||
162 | {"long", TYPESPEC, RID_LONG}, | ||
163 | {""}, {""}, {""}, | ||
164 | {"float", TYPESPEC, RID_FLOAT}, | ||
165 | {""}, {""}, | ||
166 | {"goto", GOTO, NORID}, | ||
167 | {""}, | ||
168 | {"volatile", TYPE_QUAL, RID_VOLATILE}, | ||
169 | {""}, | ||
170 | {"asm", ASM, NORID}, | ||
171 | {""}, {""}, | ||
172 | {"@implementation", IMPLEMENTATION, NORID}, | ||
173 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
174 | {""}, {""}, {""}, {""}, {""}, | ||
175 | {"void", TYPESPEC, RID_VOID} | ||
176 | }; | ||
177 | |||
178 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
179 | { | ||
180 | register unsigned int key = hash (str, len); | ||
181 | |||
182 | if (key <= MAX_HASH_VALUE) | ||
183 | { | ||
184 | register const char *s = wordlist[key].name; | ||
185 | |||
186 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
187 | return &wordlist[key]; | ||
188 | } | ||
189 | } | ||
190 | return 0; | ||
191 | } |
File tests/objc.gperf added (mode: 100644) (index 0000000..f0e3290) | |||
1 | %{ | ||
2 | /* Command-line: gperf -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ objc.gperf */ | ||
3 | %} | ||
4 | struct resword { char *name; short token; enum rid rid; }; | ||
5 | %% | ||
6 | @defs, DEFS, NORID | ||
7 | @encode, ENCODE, NORID | ||
8 | @end, END, NORID | ||
9 | @implementation, IMPLEMENTATION, NORID | ||
10 | @interface, INTERFACE, NORID | ||
11 | @public, PUBLIC, NORID | ||
12 | @selector, SELECTOR, NORID | ||
13 | __alignof, ALIGNOF, NORID | ||
14 | __alignof__, ALIGNOF, NORID | ||
15 | __asm, ASM, NORID | ||
16 | __asm__, ASM, NORID | ||
17 | __attribute, ATTRIBUTE, NORID | ||
18 | __attribute__, ATTRIBUTE, NORID | ||
19 | __const, TYPE_QUAL, RID_CONST | ||
20 | __const__, TYPE_QUAL, RID_CONST | ||
21 | __extension__, EXTENSION, NORID | ||
22 | __inline, SCSPEC, RID_INLINE | ||
23 | __inline__, SCSPEC, RID_INLINE | ||
24 | __signed, TYPESPEC, RID_SIGNED | ||
25 | __signed__, TYPESPEC, RID_SIGNED | ||
26 | __typeof, TYPEOF, NORID | ||
27 | __typeof__, TYPEOF, NORID | ||
28 | __volatile, TYPE_QUAL, RID_VOLATILE | ||
29 | __volatile__, TYPE_QUAL, RID_VOLATILE | ||
30 | asm, ASM, NORID | ||
31 | auto, SCSPEC, RID_AUTO | ||
32 | break, BREAK, NORID | ||
33 | case, CASE, NORID | ||
34 | char, TYPESPEC, RID_CHAR | ||
35 | const, TYPE_QUAL, RID_CONST | ||
36 | continue, CONTINUE, NORID | ||
37 | default, DEFAULT, NORID | ||
38 | do, DO, NORID | ||
39 | double, TYPESPEC, RID_DOUBLE | ||
40 | else, ELSE, NORID | ||
41 | enum, ENUM, NORID | ||
42 | extern, SCSPEC, RID_EXTERN | ||
43 | float, TYPESPEC, RID_FLOAT | ||
44 | for, FOR, NORID | ||
45 | goto, GOTO, NORID | ||
46 | if, IF, NORID | ||
47 | inline, SCSPEC, RID_INLINE | ||
48 | int, TYPESPEC, RID_INT | ||
49 | long, TYPESPEC, RID_LONG | ||
50 | register, SCSPEC, RID_REGISTER | ||
51 | return, RETURN, NORID | ||
52 | short, TYPESPEC, RID_SHORT | ||
53 | signed, TYPESPEC, RID_SIGNED | ||
54 | sizeof, SIZEOF, NORID | ||
55 | static, SCSPEC, RID_STATIC | ||
56 | struct, STRUCT, NORID | ||
57 | switch, SWITCH, NORID | ||
58 | typedef, SCSPEC, RID_TYPEDEF | ||
59 | typeof, TYPEOF, NORID | ||
60 | union, UNION, NORID | ||
61 | unsigned, TYPESPEC, RID_UNSIGNED | ||
62 | void, TYPESPEC, RID_VOID | ||
63 | volatile, TYPE_QUAL, RID_VOLATILE | ||
64 | while, WHILE, NORID |
File tests/pascal.exp added (mode: 100644) (index 0000000..765e44c) | |||
1 | in word set with | ||
2 | in word set array | ||
3 | in word set and | ||
4 | in word set function | ||
5 | in word set case | ||
6 | in word set var | ||
7 | in word set const | ||
8 | in word set until | ||
9 | in word set then | ||
10 | in word set set | ||
11 | in word set record | ||
12 | in word set program | ||
13 | in word set procedure | ||
14 | in word set or | ||
15 | in word set packed | ||
16 | in word set not | ||
17 | in word set nil | ||
18 | in word set label | ||
19 | in word set in | ||
20 | in word set repeat | ||
21 | in word set of | ||
22 | in word set goto | ||
23 | in word set forward | ||
24 | in word set for | ||
25 | in word set while | ||
26 | in word set file | ||
27 | in word set else | ||
28 | in word set downto | ||
29 | in word set do | ||
30 | in word set div | ||
31 | in word set to | ||
32 | in word set type | ||
33 | in word set end | ||
34 | in word set mod | ||
35 | in word set begin | ||
36 | in word set if |
File tests/pascal.gperf added (mode: 100644) (index 0000000..fed3fbb) | |||
1 | with | ||
2 | array | ||
3 | and | ||
4 | function | ||
5 | case | ||
6 | var | ||
7 | const | ||
8 | until | ||
9 | then | ||
10 | set | ||
11 | record | ||
12 | program | ||
13 | procedure | ||
14 | or | ||
15 | packed | ||
16 | not | ||
17 | nil | ||
18 | label | ||
19 | in | ||
20 | repeat | ||
21 | of | ||
22 | goto | ||
23 | forward | ||
24 | for | ||
25 | while | ||
26 | file | ||
27 | else | ||
28 | downto | ||
29 | do | ||
30 | div | ||
31 | to | ||
32 | type | ||
33 | end | ||
34 | mod | ||
35 | begin | ||
36 | if |
File tests/permut2.exp added (mode: 100644) (index 0000000..93e677b) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -m5 */ | ||
3 | /* Computed positions: -k'1-2' */ | ||
4 | |||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
28 | /* The character set is not based on ISO-646. */ | ||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>." | ||
30 | #endif | ||
31 | |||
32 | |||
33 | #define TOTAL_KEYWORDS 4 | ||
34 | #define MIN_WORD_LENGTH 2 | ||
35 | #define MAX_WORD_LENGTH 2 | ||
36 | #define MIN_HASH_VALUE 0 | ||
37 | #define MAX_HASH_VALUE 3 | ||
38 | /* maximum key range = 4, duplicates = 0 */ | ||
39 | |||
40 | #ifdef __GNUC__ | ||
41 | __inline | ||
42 | #else | ||
43 | #ifdef __cplusplus | ||
44 | inline | ||
45 | #endif | ||
46 | #endif | ||
47 | /*ARGSUSED*/ | ||
48 | static unsigned int | ||
49 | hash (register const char *str, register size_t len) | ||
50 | { | ||
51 | static unsigned char asso_values[] = | ||
52 | { | ||
53 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
54 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
55 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
56 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
57 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
58 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
59 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
60 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
61 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
62 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
63 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
64 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
65 | 0, 1, 0, 3, 4, 4, 4, 4, 4, 4, | ||
66 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
67 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
68 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
69 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
70 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
71 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
72 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
73 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
74 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
75 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
76 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
77 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
78 | 4, 4, 4, 4, 4, 4, 4 | ||
79 | }; | ||
80 | return asso_values[(unsigned char)str[1]+1] + asso_values[(unsigned char)str[0]]; | ||
81 | } | ||
82 | |||
83 | const char * | ||
84 | in_word_set (register const char *str, register size_t len) | ||
85 | { | ||
86 | static const char * wordlist[] = | ||
87 | { | ||
88 | "xy", | ||
89 | "zx", | ||
90 | "yx", | ||
91 | "xz" | ||
92 | }; | ||
93 | |||
94 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
95 | { | ||
96 | register unsigned int key = hash (str, len); | ||
97 | |||
98 | if (key <= MAX_HASH_VALUE) | ||
99 | { | ||
100 | register const char *s = wordlist[key]; | ||
101 | |||
102 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
103 | return s; | ||
104 | } | ||
105 | } | ||
106 | return 0; | ||
107 | } |
File tests/permut2.gperf added (mode: 100644) (index 0000000..6f01527) | |||
1 | xy | ||
2 | yx | ||
3 | xz | ||
4 | zx |
File tests/permut3.exp added (mode: 100644) (index 0000000..83e8564) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -m5 */ | ||
3 | /* Computed positions: -k'1-2' */ | ||
4 | |||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
28 | /* The character set is not based on ISO-646. */ | ||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>." | ||
30 | #endif | ||
31 | |||
32 | |||
33 | #define TOTAL_KEYWORDS 4 | ||
34 | #define MIN_WORD_LENGTH 3 | ||
35 | #define MAX_WORD_LENGTH 3 | ||
36 | #define MIN_HASH_VALUE 0 | ||
37 | #define MAX_HASH_VALUE 3 | ||
38 | /* maximum key range = 4, duplicates = 0 */ | ||
39 | |||
40 | #ifdef __GNUC__ | ||
41 | __inline | ||
42 | #else | ||
43 | #ifdef __cplusplus | ||
44 | inline | ||
45 | #endif | ||
46 | #endif | ||
47 | /*ARGSUSED*/ | ||
48 | static unsigned int | ||
49 | hash (register const char *str, register size_t len) | ||
50 | { | ||
51 | static unsigned char asso_values[] = | ||
52 | { | ||
53 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
54 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
55 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
56 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
57 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
58 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
59 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
60 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
61 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
62 | 4, 4, 4, 4, 4, 4, 4, 2, 0, 1, | ||
63 | 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
64 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
65 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
66 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
67 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
68 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
69 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
70 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
71 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
72 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
73 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
74 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
75 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
76 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
77 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
78 | 4, 4, 4, 4, 4, 4, 4 | ||
79 | }; | ||
80 | return asso_values[(unsigned char)str[1]+1] + asso_values[(unsigned char)str[0]]; | ||
81 | } | ||
82 | |||
83 | const char * | ||
84 | in_word_set (register const char *str, register size_t len) | ||
85 | { | ||
86 | static const char * wordlist[] = | ||
87 | { | ||
88 | "bca", | ||
89 | "cab", | ||
90 | "acb", | ||
91 | "abc" | ||
92 | }; | ||
93 | |||
94 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
95 | { | ||
96 | register unsigned int key = hash (str, len); | ||
97 | |||
98 | if (key <= MAX_HASH_VALUE) | ||
99 | { | ||
100 | register const char *s = wordlist[key]; | ||
101 | |||
102 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
103 | return s; | ||
104 | } | ||
105 | } | ||
106 | return 0; | ||
107 | } |
File tests/permut3.gperf added (mode: 100644) (index 0000000..f33d272) | |||
1 | abc | ||
2 | acb | ||
3 | bca | ||
4 | cab |
File tests/permutc2.exp added (mode: 100644) (index 0000000..32aff6b) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -m5 --ignore-case */ | ||
3 | /* Computed positions: -k'1-2' */ | ||
4 | |||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
28 | /* The character set is not based on ISO-646. */ | ||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>." | ||
30 | #endif | ||
31 | |||
32 | |||
33 | /* Test of a hash function which has to deal with permutation and | ||
34 | case-independence. Without case-independence, the alpha_inc is 1. | ||
35 | With case-independence, the alpha_inc is 3. */ | ||
36 | |||
37 | #define TOTAL_KEYWORDS 8 | ||
38 | #define MIN_WORD_LENGTH 2 | ||
39 | #define MAX_WORD_LENGTH 2 | ||
40 | #define MIN_HASH_VALUE 0 | ||
41 | #define MAX_HASH_VALUE 7 | ||
42 | /* maximum key range = 8, duplicates = 0 */ | ||
43 | |||
44 | #ifndef GPERF_DOWNCASE | ||
45 | #define GPERF_DOWNCASE 1 | ||
46 | static unsigned char gperf_downcase[256] = | ||
47 | { | ||
48 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
49 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, | ||
50 | 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, | ||
51 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, | ||
52 | 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, | ||
53 | 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, | ||
54 | 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, | ||
55 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, | ||
56 | 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, | ||
57 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, | ||
58 | 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, | ||
59 | 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, | ||
60 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, | ||
61 | 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, | ||
62 | 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, | ||
63 | 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, | ||
64 | 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, | ||
65 | 255 | ||
66 | }; | ||
67 | #endif | ||
68 | |||
69 | #ifndef GPERF_CASE_STRCMP | ||
70 | #define GPERF_CASE_STRCMP 1 | ||
71 | static int | ||
72 | gperf_case_strcmp (register const char *s1, register const char *s2) | ||
73 | { | ||
74 | for (;;) | ||
75 | { | ||
76 | unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; | ||
77 | unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; | ||
78 | if (c1 != 0 && c1 == c2) | ||
79 | continue; | ||
80 | return (int)c1 - (int)c2; | ||
81 | } | ||
82 | } | ||
83 | #endif | ||
84 | |||
85 | #ifdef __GNUC__ | ||
86 | __inline | ||
87 | #else | ||
88 | #ifdef __cplusplus | ||
89 | inline | ||
90 | #endif | ||
91 | #endif | ||
92 | /*ARGSUSED*/ | ||
93 | static unsigned int | ||
94 | hash (register const char *str, register size_t len) | ||
95 | { | ||
96 | static unsigned char asso_values[] = | ||
97 | { | ||
98 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
99 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
100 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
101 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
102 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
103 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
104 | 8, 8, 8, 8, 8, 1, 8, 8, 3, 8, | ||
105 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
106 | 8, 8, 8, 8, 8, 8, 8, 8, 3, 1, | ||
107 | 0, 7, 1, 0, 3, 8, 8, 1, 8, 8, | ||
108 | 3, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
109 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
110 | 3, 1, 0, 0, 1, 0, 2, 8, 8, 8, | ||
111 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
112 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
113 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
114 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
115 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
116 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
117 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
118 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
119 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
120 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
121 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
122 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
123 | 8, 8, 8, 8, 8, 8, 8, 8, 8 | ||
124 | }; | ||
125 | return asso_values[(unsigned char)str[1]+3] + asso_values[(unsigned char)str[0]]; | ||
126 | } | ||
127 | |||
128 | const char * | ||
129 | in_word_set (register const char *str, register size_t len) | ||
130 | { | ||
131 | static const char * wordlist[] = | ||
132 | { | ||
133 | "{w", | ||
134 | "az", | ||
135 | "ay", | ||
136 | "za", | ||
137 | "ya", | ||
138 | "x{", | ||
139 | "x[", | ||
140 | "[w" | ||
141 | }; | ||
142 | |||
143 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
144 | { | ||
145 | register unsigned int key = hash (str, len); | ||
146 | |||
147 | if (key <= MAX_HASH_VALUE) | ||
148 | { | ||
149 | register const char *s = wordlist[key]; | ||
150 | |||
151 | if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strcmp (str, s)) | ||
152 | return s; | ||
153 | } | ||
154 | } | ||
155 | return 0; | ||
156 | } |
File tests/permutc2.gperf added (mode: 100644) (index 0000000..223a193) | |||
1 | %{ | ||
2 | /* Test of a hash function which has to deal with permutation and | ||
3 | case-independence. Without case-independence, the alpha_inc is 1. | ||
4 | With case-independence, the alpha_inc is 3. */ | ||
5 | %} | ||
6 | %% | ||
7 | az | ||
8 | za | ||
9 | ay | ||
10 | ya | ||
11 | x{ | ||
12 | x[ | ||
13 | {w | ||
14 | [w |
File tests/smtp.gperf added (mode: 100644) (index 0000000..da6ec7d) | |||
1 | %{ | ||
2 | /* gperf --struct-type --readonly-table --enum --global -K field_name -N header_entry --ignore-case */ | ||
3 | /* Contributed by Bruce Lilly | ||
4 | derived from http://users.erols.com/blilly/mailparse/fields.gperf */ | ||
5 | |||
6 | #include <string.h> | ||
7 | |||
8 | %} | ||
9 | struct header_state { const char *field_name; }; | ||
10 | %% | ||
11 | Accept-Language | ||
12 | Action | ||
13 | Alternate-Recipient | ||
14 | Approved | ||
15 | Archive | ||
16 | Arrival-Date | ||
17 | Autoforwarded | ||
18 | Autosubmitted | ||
19 | Bcc | ||
20 | Cc | ||
21 | Comments | ||
22 | Complaints-To | ||
23 | Content-alternative | ||
24 | Content-Base | ||
25 | Content-Description | ||
26 | Content-Disposition | ||
27 | Content-Duration | ||
28 | Content-Features | ||
29 | Content-ID | ||
30 | Content-Language | ||
31 | Content-Location | ||
32 | Content-MD5 | ||
33 | Content-Transfer-Encoding | ||
34 | Content-Type | ||
35 | Control | ||
36 | Conversion | ||
37 | Conversion-With-Loss | ||
38 | DL-Expansion-History | ||
39 | DSN-Gateway | ||
40 | Date | ||
41 | Deferred-Delivery | ||
42 | Delivery-Date | ||
43 | Diagnostic-Code | ||
44 | Discarded-X400-IPMS-Extensions | ||
45 | Discarded-X400-MTS-Extensions | ||
46 | Disclose-Recipients | ||
47 | Disposition | ||
48 | Disposition-Notification-Options | ||
49 | Disposition-Notification-To | ||
50 | Distribution | ||
51 | Encrypted | ||
52 | Error | ||
53 | Expires | ||
54 | Failure | ||
55 | Final-Log-ID | ||
56 | Final-Recipient | ||
57 | Followup-To | ||
58 | From | ||
59 | Generate-Delivery-Report | ||
60 | Importance | ||
61 | In-Reply-To | ||
62 | Incomplete-Copy | ||
63 | Injector-Info | ||
64 | Keywords | ||
65 | Last-Attempt-Date | ||
66 | Latest-Delivery-Time | ||
67 | Lines | ||
68 | List-Archive | ||
69 | List-Help | ||
70 | List-ID | ||
71 | List-Post | ||
72 | List-Owner | ||
73 | List-Subscribe | ||
74 | List-Unsubscribe | ||
75 | MDN-Gateway | ||
76 | Media-Accept-Features | ||
77 | MIME-Version | ||
78 | Mail-Copies-To | ||
79 | Message-ID | ||
80 | Message-Type | ||
81 | Newsgroups | ||
82 | Organization | ||
83 | Original-Encoded-Information-Types | ||
84 | Original-Envelope-ID | ||
85 | Original-Message-ID | ||
86 | Original-Recipient | ||
87 | Originator-Return-Address | ||
88 | Path | ||
89 | Posted-And-Mailed | ||
90 | Prevent-Nondelivery-Report | ||
91 | Priority | ||
92 | Received | ||
93 | Received-content-MIC | ||
94 | Received-From-MTA | ||
95 | References | ||
96 | Remote-MTA | ||
97 | Reply-By | ||
98 | Reply-To | ||
99 | Reporting-MTA | ||
100 | Reporting-UA | ||
101 | Return-Path | ||
102 | Sender | ||
103 | Sensitivity | ||
104 | Status | ||
105 | Subject | ||
106 | Summary | ||
107 | Supersedes | ||
108 | To | ||
109 | User-Agent | ||
110 | Warning | ||
111 | Will-Retry-Until | ||
112 | X400-Content-Identifier | ||
113 | X400-Content-Return | ||
114 | X400-Content-Type | ||
115 | X400-MTS-Identifier | ||
116 | X400-Originator | ||
117 | X400-Received | ||
118 | X400-Recipients | ||
119 | Xref | ||
120 | %% | ||
121 | |||
122 | #include <stdio.h> | ||
123 | #include <stdlib.h> | ||
124 | #include <ctype.h> | ||
125 | |||
126 | static int | ||
127 | my_case_strcmp (s1, s2) | ||
128 | register const char *s1; | ||
129 | register const char *s2; | ||
130 | { | ||
131 | for (;;) | ||
132 | { | ||
133 | unsigned char c1 = *s1++; | ||
134 | unsigned char c2 = *s2++; | ||
135 | if (c1 >= 'A' && c1 <= 'Z') | ||
136 | c1 += 'a' - 'A'; | ||
137 | if (c2 >= 'A' && c2 <= 'Z') | ||
138 | c2 += 'a' - 'A'; | ||
139 | if (c1 != 0 && c1 == c2) | ||
140 | continue; | ||
141 | return (int)c1 - (int)c2; | ||
142 | } | ||
143 | } | ||
144 | |||
145 | int | ||
146 | main (argc, argv) | ||
147 | int argc; | ||
148 | char *argv[]; | ||
149 | { | ||
150 | int i, j, k, n, exitcode; | ||
151 | size_t len; | ||
152 | const struct header_state *hs; | ||
153 | |||
154 | n = 1; | ||
155 | if (argc > 1) | ||
156 | n = atoi (argv[1]); | ||
157 | if (n < 1) | ||
158 | n = 1; | ||
159 | |||
160 | exitcode = 0; | ||
161 | for (i = 0; i < n; i++) | ||
162 | { | ||
163 | for (j = 0; j <= MAX_HASH_VALUE; j++) | ||
164 | { | ||
165 | const char *s = wordlist[j].field_name; | ||
166 | len = strlen (s); | ||
167 | if (len) | ||
168 | { | ||
169 | hs = header_entry (s, len); | ||
170 | if (!(hs && strcmp (hs->field_name, s) == 0)) | ||
171 | { | ||
172 | fprintf (stderr, "%s != %s\n", s, hs ? hs->field_name : "(null)"); | ||
173 | exitcode = 1; | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | for (j = 0; j <= MAX_HASH_VALUE; j++) | ||
178 | { | ||
179 | char s[MAX_WORD_LENGTH+1]; | ||
180 | /* expensive copy with case conversion (for testing) */ | ||
181 | strcpy (s, wordlist[j].field_name); | ||
182 | len = strlen (s); | ||
183 | if (len) | ||
184 | { | ||
185 | for (k = 0; k < len; k++) | ||
186 | if (isupper ((unsigned char) s[k])) | ||
187 | s[k] = tolower ((unsigned char) s[k]); | ||
188 | else if (islower ((unsigned char) s[k])) | ||
189 | s[k] = toupper ((unsigned char) s[k]); | ||
190 | hs = header_entry (s, len); | ||
191 | if (!(hs && my_case_strcmp (hs->field_name, s) == 0)) | ||
192 | { | ||
193 | fprintf (stderr, "%s != %s\n", s, hs ? hs->field_name : "(null)"); | ||
194 | exitcode = 1; | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | hs = header_entry ("Dave", 4); | ||
199 | if (hs) | ||
200 | { | ||
201 | fprintf (stderr, "Dave == %s\n", hs->field_name); | ||
202 | exitcode = 1; | ||
203 | } | ||
204 | } | ||
205 | return exitcode; | ||
206 | } |
File tests/test-4.exp added (mode: 100644) (index 0000000..af0a237) | |||
1 | /* ANSI-C code produced by gperf version 3.1 */ | ||
2 | /* Command-line: ../src/gperf -D -t -k'1,$' */ | ||
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-gperf@gnu.org>." | ||
29 | #endif | ||
30 | |||
31 | |||
32 | /* Command-line: gperf -L KR-C -F ', 0, 0' -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ | ||
33 | struct resword { const char *name; short token; enum rid rid; }; | ||
34 | |||
35 | #define TOTAL_KEYWORDS 83 | ||
36 | #define MIN_WORD_LENGTH 2 | ||
37 | #define MAX_WORD_LENGTH 20 | ||
38 | #define MIN_HASH_VALUE 4 | ||
39 | #define MAX_HASH_VALUE 127 | ||
40 | /* maximum key range = 124, duplicates = 8 */ | ||
41 | |||
42 | #ifdef __GNUC__ | ||
43 | __inline | ||
44 | #else | ||
45 | #ifdef __cplusplus | ||
46 | inline | ||
47 | #endif | ||
48 | #endif | ||
49 | static unsigned int | ||
50 | hash (register const char *str, register size_t len) | ||
51 | { | ||
52 | static unsigned char asso_values[] = | ||
53 | { | ||
54 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
55 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
56 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
57 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
58 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
59 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
60 | 128, 128, 128, 128, 0, 128, 128, 128, 128, 128, | ||
61 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
62 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
63 | 128, 128, 128, 128, 128, 5, 128, 0, 15, 50, | ||
64 | 55, 0, 15, 35, 65, 60, 128, 40, 0, 60, | ||
65 | 65, 10, 128, 128, 15, 20, 30, 20, 40, 0, | ||
66 | 20, 15, 128, 128, 128, 128, 128, 128, 128, 128, | ||
67 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
68 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
69 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
70 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
71 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
72 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
73 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
74 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
75 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
76 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
77 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
78 | 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | ||
79 | 128, 128, 128, 128, 128, 128 | ||
80 | }; | ||
81 | return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; | ||
82 | } | ||
83 | |||
84 | struct resword * | ||
85 | in_word_set (register const char *str, register size_t len) | ||
86 | { | ||
87 | static struct resword wordlist[] = | ||
88 | { | ||
89 | {"else", ELSE, NORID}, | ||
90 | {"while", WHILE, NORID}, | ||
91 | {"@encode", ENCODE, NORID}, | ||
92 | {"@private", PRIVATE, NORID}, | ||
93 | {"@protocol", PROTOCOL, NORID}, | ||
94 | {"@interface", INTERFACE, NORID}, | ||
95 | {"__real", REALPART, NORID}, | ||
96 | {"__inline", SCSPEC, RID_INLINE}, | ||
97 | {"auto", SCSPEC, RID_AUTO}, | ||
98 | {"__volatile", TYPE_QUAL, RID_VOLATILE}, | ||
99 | {"__attribute", ATTRIBUTE, NORID}, | ||
100 | {"__asm__", ASM_KEYWORD, NORID}, | ||
101 | {"__imag__", IMAGPART, NORID}, | ||
102 | {"__real__", REALPART, NORID}, | ||
103 | {"__const__", TYPE_QUAL, RID_CONST}, | ||
104 | {"__label__", LABEL, NORID}, | ||
105 | {"__inline__", SCSPEC, RID_INLINE}, | ||
106 | {"__typeof__", TYPEOF, NORID}, | ||
107 | {"__signed__", TYPESPEC, RID_SIGNED}, | ||
108 | {"__alignof__", ALIGNOF, NORID}, | ||
109 | {"__complex__", TYPESPEC, RID_COMPLEX}, | ||
110 | {"__iterator__", SCSPEC, RID_ITERATOR}, | ||
111 | {"__volatile__", TYPE_QUAL, RID_VOLATILE}, | ||
112 | {"__restrict__", TYPE_QUAL, RID_RESTRICT}, | ||
113 | {"__attribute__", ATTRIBUTE, NORID}, | ||
114 | {"__extension__", EXTENSION, NORID}, | ||
115 | {"@selector", SELECTOR, NORID}, | ||
116 | {"@defs", DEFS, NORID}, | ||
117 | {"@class", CLASS, NORID}, | ||
118 | {"__typeof", TYPEOF, NORID}, | ||
119 | {"__alignof", ALIGNOF, NORID}, | ||
120 | {"__iterator", SCSPEC, RID_ITERATOR}, | ||
121 | {"oneway", TYPE_QUAL, RID_ONEWAY}, | ||
122 | {"for", FOR, NORID}, | ||
123 | {"__complex", TYPESPEC, RID_COMPLEX}, | ||
124 | {"byref", TYPE_QUAL, RID_BYREF}, | ||
125 | {"bycopy", TYPE_QUAL, RID_BYCOPY}, | ||
126 | {"register", SCSPEC, RID_REGISTER}, | ||
127 | {"long", TYPESPEC, RID_LONG}, | ||
128 | {"@compatibility_alias", ALIAS, NORID}, | ||
129 | {"sizeof", SIZEOF, NORID}, | ||
130 | {"__const", TYPE_QUAL, RID_CONST}, | ||
131 | {"out", TYPE_QUAL, RID_OUT}, | ||
132 | {"__restrict", TYPE_QUAL, RID_RESTRICT}, | ||
133 | {"__imag", IMAGPART, NORID}, | ||
134 | {"volatile", TYPE_QUAL, RID_VOLATILE}, | ||
135 | {"goto", GOTO, NORID}, | ||
136 | {"float", TYPESPEC, RID_FLOAT}, | ||
137 | {"typeof", TYPEOF, NORID}, | ||
138 | {"typedef", SCSPEC, RID_TYPEDEF}, | ||
139 | {"restrict", TYPE_QUAL, RID_RESTRICT}, | ||
140 | {"case", CASE, NORID}, | ||
141 | {"short", TYPESPEC, RID_SHORT}, | ||
142 | {"struct", STRUCT, NORID}, | ||
143 | {"@public", PUBLIC, NORID}, | ||
144 | {"continue", CONTINUE, NORID}, | ||
145 | {"@end", END, NORID}, | ||
146 | {"break", BREAK, NORID}, | ||
147 | {"double", TYPESPEC, RID_DOUBLE}, | ||
148 | {"asm", ASM_KEYWORD, NORID}, | ||
149 | {"enum", ENUM, NORID}, | ||
150 | {"@protected", PROTECTED, NORID}, | ||
151 | {"inline", SCSPEC, RID_INLINE}, | ||
152 | {"do", DO, NORID}, | ||
153 | {"__signed", TYPESPEC, RID_SIGNED}, | ||
154 | {"char", TYPESPEC, RID_CHAR}, | ||
155 | {"__asm", ASM_KEYWORD, NORID}, | ||
156 | {"extern", SCSPEC, RID_EXTERN}, | ||
157 | {"static", SCSPEC, RID_STATIC}, | ||
158 | {"if", IF, NORID}, | ||
159 | {"@implementation", IMPLEMENTATION, NORID}, | ||
160 | {"signed", TYPESPEC, RID_SIGNED}, | ||
161 | {"unsigned", TYPESPEC, RID_UNSIGNED}, | ||
162 | {"const", TYPE_QUAL, RID_CONST}, | ||
163 | {"return", RETURN, NORID}, | ||
164 | {"union", UNION, NORID}, | ||
165 | {"switch", SWITCH, NORID}, | ||
166 | {"default", DEFAULT, NORID}, | ||
167 | {"int", TYPESPEC, RID_INT}, | ||
168 | {"inout", TYPE_QUAL, RID_INOUT}, | ||
169 | {"void", TYPESPEC, RID_VOID}, | ||
170 | {"id", OBJECTNAME, RID_ID}, | ||
171 | {"in", TYPE_QUAL, RID_IN} | ||
172 | }; | ||
173 | |||
174 | static short lookup[] = | ||
175 | { | ||
176 | -1, -1, -1, -1, 0, 1, -1, 2, | ||
177 | 3, 4, 5, 6, -1, 7, 8, 9, | ||
178 | 10, 11, -184, -180, -171, -162, -158, -156, | ||
179 | 26, 27, 28, -1, 29, 30, 31, 32, | ||
180 | -1, 33, 34, 35, 36, -1, 37, 38, | ||
181 | 39, 40, 41, 42, -1, 43, 44, -1, | ||
182 | 45, 46, 47, 48, 49, 50, 51, 52, | ||
183 | 53, 54, 55, 56, 57, 58, -1, 59, | ||
184 | 60, 61, 62, 63, 64, 65, 66, 67, | ||
185 | -59, -2, -62, -3, 68, 69, -64, -2, | ||
186 | 70, 71, -1, 72, -1, 73, 74, -67, | ||
187 | -3, -1, 75, 76, 77, 78, -1, 79, | ||
188 | -69, -2, -1, 80, -71, -2, -1, -1, | ||
189 | -1, -1, -1, -1, -1, -1, -1, -1, | ||
190 | -1, -1, -1, -1, -1, 81, -1, -1, | ||
191 | -1, -1, -1, -1, -1, -1, -1, 82 | ||
192 | }; | ||
193 | |||
194 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
195 | { | ||
196 | register unsigned int key = hash (str, len); | ||
197 | |||
198 | if (key <= MAX_HASH_VALUE) | ||
199 | { | ||
200 | register int index = lookup[key]; | ||
201 | |||
202 | if (index >= 0) | ||
203 | { | ||
204 | register const char *s = wordlist[index].name; | ||
205 | |||
206 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
207 | return &wordlist[index]; | ||
208 | } | ||
209 | else if (index < -TOTAL_KEYWORDS) | ||
210 | { | ||
211 | register int offset = - 1 - TOTAL_KEYWORDS - index; | ||
212 | register struct resword *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]]; | ||
213 | register struct resword *wordendptr = wordptr + -lookup[offset + 1]; | ||
214 | |||
215 | while (wordptr < wordendptr) | ||
216 | { | ||
217 | register const char *s = wordptr->name; | ||
218 | |||
219 | if (*str == *s && !strcmp (str + 1, s + 1)) | ||
220 | return wordptr; | ||
221 | wordptr++; | ||
222 | } | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | return 0; | ||
227 | } |
File tests/test-6.exp added (mode: 100644) (index 0000000..dd6ea72) | |||
1 | GNU 'gperf' generates perfect hash functions. | ||
2 | |||
3 | Usage: ../src/gperf [OPTION]... [INPUT-FILE] | ||
4 | |||
5 | If a long option shows an argument as mandatory, then it is mandatory | ||
6 | for the equivalent short option also. | ||
7 | |||
8 | Output file location: | ||
9 | --output-file=FILE Write output to specified file. | ||
10 | The results are written to standard output if no output file is specified | ||
11 | or if it is -. | ||
12 | |||
13 | Input file interpretation: | ||
14 | -e, --delimiters=DELIMITER-LIST | ||
15 | Allow user to provide a string containing delimiters | ||
16 | used to separate keywords from their attributes. | ||
17 | Default is ",". | ||
18 | -t, --struct-type Allows the user to include a structured type | ||
19 | declaration for generated code. Any text before %% | ||
20 | is considered part of the type declaration. Key | ||
21 | words and additional fields may follow this, one | ||
22 | group of fields per line. | ||
23 | --ignore-case Consider upper and lower case ASCII characters as | ||
24 | equivalent. Note that locale dependent case mappings | ||
25 | are ignored. | ||
26 | |||
27 | Language for the output code: | ||
28 | -L, --language=LANGUAGE-NAME | ||
29 | Generates code in the specified language. Languages | ||
30 | handled are currently C++, ANSI-C, C, and KR-C. The | ||
31 | default is ANSI-C. | ||
32 | |||
33 | Details in the output code: | ||
34 | -K, --slot-name=NAME Select name of the keyword component in the keyword | ||
35 | structure. | ||
36 | -F, --initializer-suffix=INITIALIZERS | ||
37 | Initializers for additional components in the keyword | ||
38 | structure. | ||
39 | -H, --hash-function-name=NAME | ||
40 | Specify name of generated hash function. Default is | ||
41 | 'hash'. | ||
42 | -N, --lookup-function-name=NAME | ||
43 | Specify name of generated lookup function. Default | ||
44 | name is 'in_word_set'. | ||
45 | -Z, --class-name=NAME Specify name of generated C++ class. Default name is | ||
46 | 'Perfect_Hash'. | ||
47 | -7, --seven-bit Assume 7-bit characters. | ||
48 | -l, --compare-lengths Compare key lengths before trying a string | ||
49 | comparison. This is necessary if the keywords | ||
50 | contain NUL bytes. It also helps cut down on the | ||
51 | number of string comparisons made during the lookup. | ||
52 | -c, --compare-strncmp Generate comparison code using strncmp rather than | ||
53 | strcmp. | ||
54 | -C, --readonly-tables Make the contents of generated lookup tables | ||
55 | constant, i.e., readonly. | ||
56 | -E, --enum Define constant values using an enum local to the | ||
57 | lookup function rather than with defines. | ||
58 | -I, --includes Include the necessary system include file <string.h> | ||
59 | at the beginning of the code. | ||
60 | -G, --global-table Generate the static table of keywords as a static | ||
61 | global variable, rather than hiding it inside of the | ||
62 | lookup function (which is the default behavior). | ||
63 | -P, --pic Optimize the generated table for inclusion in shared | ||
64 | libraries. This reduces the startup time of programs | ||
65 | using a shared library containing the generated code. | ||
66 | -Q, --string-pool-name=NAME | ||
67 | Specify name of string pool generated by option --pic. | ||
68 | Default name is 'stringpool'. | ||
69 | --null-strings Use NULL strings instead of empty strings for empty | ||
70 | keyword table entries. | ||
71 | --constants-prefix=PREFIX | ||
72 | Specify prefix for the constants like TOTAL_KEYWORDS. | ||
73 | -W, --word-array-name=NAME | ||
74 | Specify name of word list array. Default name is | ||
75 | 'wordlist'. | ||
76 | --length-table-name=NAME | ||
77 | Specify name of length table array. Default name is | ||
78 | 'lengthtable'. | ||
79 | -S, --switch=COUNT Causes the generated C code to use a switch | ||
80 | statement scheme, rather than an array lookup table. | ||
81 | This can lead to a reduction in both time and space | ||
82 | requirements for some keyfiles. The COUNT argument | ||
83 | determines how many switch statements are generated. | ||
84 | A value of 1 generates 1 switch containing all the | ||
85 | elements, a value of 2 generates 2 tables with 1/2 | ||
86 | the elements in each table, etc. If COUNT is very | ||
87 | large, say 1000000, the generated C code does a | ||
88 | binary search. | ||
89 | -T, --omit-struct-type | ||
90 | Prevents the transfer of the type declaration to the | ||
91 | output file. Use this option if the type is already | ||
92 | defined elsewhere. | ||
93 | |||
94 | Algorithm employed by gperf: | ||
95 | -k, --key-positions=KEYS | ||
96 | Select the key positions used in the hash function. | ||
97 | The allowable choices range between 1-255, inclusive. | ||
98 | The positions are separated by commas, ranges may be | ||
99 | used, and key positions may occur in any order. | ||
100 | Also, the meta-character '*' causes the generated | ||
101 | hash function to consider ALL key positions, and $ | ||
102 | indicates the "final character" of a key, e.g., | ||
103 | $,1,2,4,6-10. | ||
104 | -D, --duplicates Handle keywords that hash to duplicate values. This | ||
105 | is useful for certain highly redundant keyword sets. | ||
106 | -m, --multiple-iterations=ITERATIONS | ||
107 | Perform multiple choices of the -i and -j values, | ||
108 | and choose the best results. This increases the | ||
109 | running time by a factor of ITERATIONS but does a | ||
110 | good job minimizing the generated table size. | ||
111 | -i, --initial-asso=N Provide an initial value for the associate values | ||
112 | array. Default is 0. Setting this value larger helps | ||
113 | inflate the size of the final table. | ||
114 | -j, --jump=JUMP-VALUE Affects the "jump value", i.e., how far to advance | ||
115 | the associated character value upon collisions. Must | ||
116 | be an odd number, default is 5. | ||
117 | -n, --no-strlen Do not include the length of the keyword when | ||
118 | computing the hash function. | ||
119 | -r, --random Utilizes randomness to initialize the associated | ||
120 | values table. | ||
121 | -s, --size-multiple=N Affects the size of the generated hash table. The | ||
122 | numeric argument N indicates "how many times larger | ||
123 | or smaller" the associated value range should be, | ||
124 | in relationship to the number of keys, e.g. a value | ||
125 | of 3 means "allow the maximum associated value to | ||
126 | be about 3 times larger than the number of input | ||
127 | keys". Conversely, a value of 1/3 means "make the | ||
128 | maximum associated value about 3 times smaller than | ||
129 | the number of input keys". A larger table should | ||
130 | decrease the time required for an unsuccessful | ||
131 | search, at the expense of extra table space. Default | ||
132 | value is 1. | ||
133 | |||
134 | Informative output: | ||
135 | -h, --help Print this message. | ||
136 | -v, --version Print the gperf version number. | ||
137 | -d, --debug Enables the debugging option (produces verbose | ||
138 | output to the standard error). | ||
139 | |||
140 | Report bugs to <bug-gperf@gnu.org>. |
File tests/test-7.exp added (mode: 100644) (index 0000000..c5c942c) | |||
1 | in word set if | ||
2 | in word set do | ||
3 | NOT in word set int | ||
4 | in word set for | ||
5 | in word set case | ||
6 | NOT in word set char | ||
7 | NOT in word set auto | ||
8 | in word set goto | ||
9 | in word set else | ||
10 | NOT in word set long | ||
11 | NOT in word set void | ||
12 | NOT in word set enum | ||
13 | NOT in word set float | ||
14 | NOT in word set short | ||
15 | NOT in word set union | ||
16 | NOT in word set break | ||
17 | in word set while | ||
18 | NOT in word set const | ||
19 | NOT in word set double | ||
20 | NOT in word set static | ||
21 | NOT in word set extern | ||
22 | NOT in word set struct | ||
23 | in word set return | ||
24 | NOT in word set sizeof | ||
25 | NOT in word set switch | ||
26 | NOT in word set signed | ||
27 | NOT in word set typedef | ||
28 | NOT in word set default | ||
29 | NOT in word set unsigned | ||
30 | NOT in word set continue | ||
31 | NOT in word set register | ||
32 | NOT in word set volatile |
File tests/test.c added (mode: 100644) (index 0000000..52d41d8) | |||
1 | /* | ||
2 | Tests the generated perfect hash function. | ||
3 | The -v option prints diagnostics as to whether a word is in | ||
4 | the set or not. Without -v the program is useful for timing. | ||
5 | */ | ||
6 | |||
7 | #include <stdio.h> | ||
8 | #include <string.h> | ||
9 | |||
10 | extern const char * in_word_set (const char *, size_t); | ||
11 | |||
12 | #define MAX_LEN 80 | ||
13 | |||
14 | int | ||
15 | main (int argc, char *argv[]) | ||
16 | { | ||
17 | int verbose = argc > 1 ? 1 : 0; | ||
18 | char buf[MAX_LEN]; | ||
19 | |||
20 | while (fgets (buf, MAX_LEN, stdin)) | ||
21 | { | ||
22 | if (strlen (buf) > 0 && buf[strlen (buf) - 1] == '\n') | ||
23 | buf[strlen (buf) - 1] = '\0'; | ||
24 | |||
25 | if (in_word_set (buf, strlen (buf))) | ||
26 | { | ||
27 | if (verbose) | ||
28 | printf ("in word set %s\n", buf); | ||
29 | } | ||
30 | else | ||
31 | { | ||
32 | if (verbose) | ||
33 | printf ("NOT in word set %s\n", buf); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | return 0; | ||
38 | } |
File tests/test2.c added (mode: 100644) (index 0000000..c1c08cc) | |||
1 | /* | ||
2 | Tests the generated perfect hash function. | ||
3 | The -v option prints diagnostics as to whether a word is in | ||
4 | the set or not. Without -v the program is useful for timing. | ||
5 | */ | ||
6 | |||
7 | #include <stdio.h> | ||
8 | |||
9 | /* Support for SET_BINARY. */ | ||
10 | #include <fcntl.h> | ||
11 | #if !defined O_BINARY && defined _O_BINARY | ||
12 | # define O_BINARY _O_BINARY | ||
13 | #endif | ||
14 | #ifdef __BEOS__ | ||
15 | # undef O_BINARY | ||
16 | #endif | ||
17 | #if O_BINARY | ||
18 | # include <io.h> | ||
19 | # if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ | ||
20 | # define SET_BINARY(f) setmode (f, O_BINARY) | ||
21 | # else | ||
22 | # define SET_BINARY(f) _setmode (f, O_BINARY) | ||
23 | # endif | ||
24 | #else | ||
25 | # define SET_BINARY(f) (void)0 | ||
26 | #endif | ||
27 | |||
28 | extern struct language * in_word_set (const char *, size_t); | ||
29 | |||
30 | #define MAX_LEN 80 | ||
31 | |||
32 | int | ||
33 | main (int argc, char *argv[]) | ||
34 | { | ||
35 | int verbose = argc > 1 ? 1 : 0; | ||
36 | char buf[2*MAX_LEN]; | ||
37 | int buflen; | ||
38 | |||
39 | /* We need to read stdin in binary mode. */ | ||
40 | SET_BINARY (0); | ||
41 | |||
42 | for (;;) | ||
43 | { | ||
44 | /* Simulate gets(buf) with 2 bytes per character. */ | ||
45 | char *p = buf; | ||
46 | while (fread (p, 2, 1, stdin) == 1) | ||
47 | { | ||
48 | if ((p[0] << 8) + p[1] == '\n') | ||
49 | break; | ||
50 | p += 2; | ||
51 | } | ||
52 | buflen = p - buf; | ||
53 | |||
54 | if (buflen == 0) | ||
55 | break; | ||
56 | |||
57 | if (in_word_set (buf, buflen)) | ||
58 | { | ||
59 | if (verbose) | ||
60 | printf ("in word set:"); | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | if (verbose) | ||
65 | printf ("NOT in word set:"); | ||
66 | } | ||
67 | |||
68 | for (p = buf; p < buf + buflen; p += 2) | ||
69 | printf (" %02X%02X", (unsigned char) p[0], (unsigned char) p[1]); | ||
70 | printf("\n"); | ||
71 | } | ||
72 | |||
73 | return 0; | ||
74 | } |
File version.h added (mode: 100644) (index 0000000..e4da099) | |||
1 | #ifndef CGPERF_VERSION_H | ||
2 | #define CGPERF_VERSION_H | ||
3 | static u8 *cgperf_version_string = "3.1"; | ||
4 | #endif |