xref: /PHP-7.3/ext/mbstring/oniguruma/src/sjis_prop.c (revision 1979c5d1)
1 /* ANSI-C code produced by gperf version 3.1 */
2 /* Command-line: gperf -pt -T -L ANSI-C -N onigenc_sjis_lookup_property_name --output-file gperf2.tmp sjis_prop.gperf  */
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 #line 1 "sjis_prop.gperf"
33 
34 #include <string.h>
35 #include "regenc.h"
36 
37 #define TOTAL_KEYWORDS 16
38 #define MIN_WORD_LENGTH 4
39 #define MAX_WORD_LENGTH 8
40 #define MIN_HASH_VALUE 4
41 #define MAX_HASH_VALUE 55
42 /* maximum key range = 52, duplicates = 0 */
43 
44 #ifdef __GNUC__
45 __inline
46 #else
47 #ifdef __cplusplus
48 inline
49 #endif
50 #endif
51 static unsigned int
hash(register const char * str,register size_t len)52 hash (register const char *str, register size_t len)
53 {
54   static unsigned char asso_values[] =
55     {
56       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
57       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
58       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
59       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
60       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
61       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
62       56, 56, 56, 56, 56,  0,  3, 10, 25, 56,
63       56, 30,  0, 56, 56,  0, 20, 56, 56, 56,
64       15, 56, 56, 20, 56, 30, 56,  0,  0, 56,
65       56, 56, 56, 56, 56, 56, 56, 15, 56, 56,
66       56, 56, 56, 25, 56, 10, 56, 56, 56, 56,
67        5, 56,  0, 56,  0, 56,  5, 56, 56, 20,
68       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
69       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
70       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
71       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
72       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
73       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
74       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
75       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
76       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
77       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
78       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
79       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
80       56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
81       56, 56, 56, 56, 56, 56
82     };
83   return (unsigned int )len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
84 }
85 
86 struct PropertyNameCtype *
onigenc_sjis_lookup_property_name(register const char * str,register size_t len)87 onigenc_sjis_lookup_property_name (register const char *str, register size_t len)
88 {
89   static struct PropertyNameCtype wordlist[] =
90     {
91       {""}, {""}, {""}, {""},
92 #line 23 "sjis_prop.gperf"
93       {"Word",     12},
94 #line 12 "sjis_prop.gperf"
95       {"Alpha",     1},
96       {""}, {""},
97 #line 26 "sjis_prop.gperf"
98       {"Hiragana", 15},
99       {""},
100 #line 24 "sjis_prop.gperf"
101       {"Alnum",    13},
102       {""}, {""},
103 #line 27 "sjis_prop.gperf"
104       {"Katakana", 16},
105       {""},
106 #line 25 "sjis_prop.gperf"
107       {"ASCII",    14},
108 #line 22 "sjis_prop.gperf"
109       {"XDigit",   11},
110       {""}, {""}, {""},
111 #line 14 "sjis_prop.gperf"
112       {"Cntrl",     3},
113       {""}, {""},
114 #line 13 "sjis_prop.gperf"
115       {"Blank",     2},
116       {""},
117 #line 19 "sjis_prop.gperf"
118       {"Punct",     8},
119       {""}, {""}, {""}, {""},
120 #line 18 "sjis_prop.gperf"
121       {"Print",     7},
122       {""}, {""}, {""}, {""},
123 #line 21 "sjis_prop.gperf"
124       {"Upper",    10},
125       {""}, {""}, {""}, {""},
126 #line 20 "sjis_prop.gperf"
127       {"Space",     9},
128       {""}, {""}, {""}, {""},
129 #line 17 "sjis_prop.gperf"
130       {"Lower",     6},
131       {""}, {""}, {""}, {""},
132 #line 16 "sjis_prop.gperf"
133       {"Graph",     5},
134       {""}, {""}, {""}, {""},
135 #line 15 "sjis_prop.gperf"
136       {"Digit",     4}
137     };
138 
139   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
140     {
141       register unsigned int key = hash (str, len);
142 
143       if (key <= MAX_HASH_VALUE)
144         {
145           register const char *s = wordlist[key].name;
146 
147           if (*str == *s && !strcmp (str + 1, s + 1))
148             return &wordlist[key];
149         }
150     }
151   return 0;
152 }
153