xref: /PHP-7.2/ext/mbstring/oniguruma/src/sjis_prop.c (revision 2a76d228)
1 /* ANSI-C code produced by gperf version 3.0.4 */
2 /* Command-line: gperf -pt -T -L ANSI-C -N sjis_lookup_property_name --output-file sjis_prop.c 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-gnu-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 unsigned int len)52 hash (register const char *str, register unsigned int 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 len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
84 }
85 
86 #ifdef __GNUC__
87 __inline
88 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
89 __attribute__ ((__gnu_inline__))
90 #endif
91 #endif
92 struct PropertyNameCtype *
sjis_lookup_property_name(register const char * str,register unsigned int len)93 sjis_lookup_property_name (register const char *str, register unsigned int len)
94 {
95   static struct PropertyNameCtype wordlist[] =
96     {
97       {""}, {""}, {""}, {""},
98 #line 23 "sjis_prop.gperf"
99       {"Word",     12},
100 #line 12 "sjis_prop.gperf"
101       {"Alpha",     1},
102       {""}, {""},
103 #line 26 "sjis_prop.gperf"
104       {"Hiragana", 15},
105       {""},
106 #line 24 "sjis_prop.gperf"
107       {"Alnum",    13},
108       {""}, {""},
109 #line 27 "sjis_prop.gperf"
110       {"Katakana", 16},
111       {""},
112 #line 25 "sjis_prop.gperf"
113       {"ASCII",    14},
114 #line 22 "sjis_prop.gperf"
115       {"XDigit",   11},
116       {""}, {""}, {""},
117 #line 14 "sjis_prop.gperf"
118       {"Cntrl",     3},
119       {""}, {""},
120 #line 13 "sjis_prop.gperf"
121       {"Blank",     2},
122       {""},
123 #line 19 "sjis_prop.gperf"
124       {"Punct",     8},
125       {""}, {""}, {""}, {""},
126 #line 18 "sjis_prop.gperf"
127       {"Print",     7},
128       {""}, {""}, {""}, {""},
129 #line 21 "sjis_prop.gperf"
130       {"Upper",    10},
131       {""}, {""}, {""}, {""},
132 #line 20 "sjis_prop.gperf"
133       {"Space",     9},
134       {""}, {""}, {""}, {""},
135 #line 17 "sjis_prop.gperf"
136       {"Lower",     6},
137       {""}, {""}, {""}, {""},
138 #line 16 "sjis_prop.gperf"
139       {"Graph",     5},
140       {""}, {""}, {""}, {""},
141 #line 15 "sjis_prop.gperf"
142       {"Digit",     4}
143     };
144 
145   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
146     {
147       register int key = hash (str, len);
148 
149       if (key <= MAX_HASH_VALUE && key >= 0)
150         {
151           register const char *s = wordlist[key].name;
152 
153           if (*str == *s && !strcmp (str + 1, s + 1))
154             return &wordlist[key];
155         }
156     }
157   return 0;
158 }
159