1 /* This file was converted by gperf_fold_key_conv.py
2       from gperf output file. */
3 /* ANSI-C code produced by gperf version 3.0.4 */
4 /* Command-line: gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N unicode_fold3_key unicode_fold3_key.gperf  */
5 /* Computed positions: -k'3,6,9' */
6 
7 
8 
9 /* This gperf source file was generated by make_unicode_fold_data.py */
10 #include <string.h>
11 #include "regenc.h"
12 
13 #define TOTAL_KEYWORDS 14
14 #define MIN_WORD_LENGTH 9
15 #define MAX_WORD_LENGTH 9
16 #define MIN_HASH_VALUE 0
17 #define MAX_HASH_VALUE 13
18 /* maximum key range = 14, duplicates = 0 */
19 
20 #ifdef __GNUC__
21 __inline
22 #else
23 #ifdef __cplusplus
24 inline
25 #endif
26 #endif
27 /*ARGSUSED*/
28 static unsigned int
hash(OnigCodePoint codes[])29 hash(OnigCodePoint codes[])
30 {
31   static const unsigned char asso_values[] =
32     {
33        6,  3, 14, 14, 14, 14, 14, 14,  1, 14,
34       14, 14, 14, 14, 14, 14, 14, 14, 14,  0,
35       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
36       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
37       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
38       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
39       14, 14, 14, 14, 14, 14,  0, 14, 14, 14,
40       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
41       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
42       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
43       14, 14,  4, 14, 14,  5, 14, 14,  4, 14,
44       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
45       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
46       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
47       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
48       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
49       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
50       14, 14, 14, 14, 14, 14, 14, 10, 14, 14,
51       14, 14, 14,  9, 14,  1, 14, 14, 14, 14,
52       14, 14, 14, 14, 14, 14, 14,  0, 14, 14,
53       14,  8, 14, 14, 14, 14, 14, 14, 14, 14,
54       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
55       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
56       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
57       14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
58       14, 14, 14, 14, 14, 14
59     };
60   return asso_values[(unsigned char)onig_codes_byte_at(codes, 8)] + asso_values[(unsigned char)onig_codes_byte_at(codes, 5)] + asso_values[(unsigned char)onig_codes_byte_at(codes, 2)];
61 }
62 
63 #ifdef __GNUC__
64 __inline
65 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
66 __attribute__ ((__gnu_inline__))
67 #endif
68 #endif
69 int
unicode_fold3_key(OnigCodePoint codes[])70 unicode_fold3_key(OnigCodePoint codes[])
71 {
72   static const int wordlist[] =
73     {
74 
75       62,
76 
77       47,
78 
79       31,
80 
81       57,
82 
83       41,
84 
85       25,
86 
87       52,
88 
89       36,
90 
91       20,
92 
93       67,
94 
95       15,
96 
97       10,
98 
99       5,
100 
101       0
102     };
103 
104   if (0 == 0)
105     {
106       int key = hash(codes);
107 
108       if (key <= MAX_HASH_VALUE && key >= 0)
109         {
110           int index = wordlist[key];
111 
112           if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds3 + index, 3) == 0)
113             return index;
114         }
115     }
116   return -1;
117 }
118 
119 
120