]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3_key.c
MdeModulePkg/Oniguruma: Remove redundant IF statement
[mirror_edk2.git] / MdeModulePkg / Universal / RegularExpressionDxe / Oniguruma / unicode_fold3_key.c
CommitLineData
b602265d
DG
1/* This file was converted by gperf_fold_key_conv.py\r
2 from gperf output file. */\r
3/* ANSI-C code produced by gperf version 3.1 */\r
b26691c4 4/* Command-line: /usr/local/bin/gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold3_key unicode_fold3_key.gperf */\r
b602265d
DG
5/* Computed positions: -k'3,6,9' */\r
6\r
7\r
8\r
9/* This gperf source file was generated by make_unicode_fold_data.py */\r
10\r
11/*-\r
12 * Copyright (c) 2017-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>\r
13 * All rights reserved.\r
14 *\r
15 * Redistribution and use in source and binary forms, with or without\r
16 * modification, are permitted provided that the following conditions\r
17 * are met:\r
18 * 1. Redistributions of source code must retain the above copyright\r
19 * notice, this list of conditions and the following disclaimer.\r
20 * 2. Redistributions in binary form must reproduce the above copyright\r
21 * notice, this list of conditions and the following disclaimer in the\r
22 * documentation and/or other materials provided with the distribution.\r
23 *\r
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
34 * SUCH DAMAGE.\r
35 */\r
36//#include <string.h>\r
37#include "regenc.h"\r
38\r
39#define TOTAL_KEYWORDS 14\r
40#define MIN_WORD_LENGTH 9\r
41#define MAX_WORD_LENGTH 9\r
42#define MIN_HASH_VALUE 0\r
43#define MAX_HASH_VALUE 13\r
44/* maximum key range = 14, duplicates = 0 */\r
45\r
46#ifdef __GNUC__\r
47__inline\r
48#else\r
49#ifdef __cplusplus\r
50inline\r
51#endif\r
52#endif\r
53/*ARGSUSED*/\r
54static unsigned int\r
55hash(OnigCodePoint codes[])\r
56{\r
57 static const unsigned char asso_values[] =\r
58 {\r
59 6, 3, 14, 14, 14, 14, 14, 14, 1, 14,\r
60 14, 14, 14, 14, 14, 14, 14, 14, 14, 0,\r
61 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
62 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
63 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
64 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
65 14, 14, 14, 14, 14, 14, 0, 14, 14, 14,\r
66 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
67 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
68 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
69 14, 14, 4, 14, 14, 5, 14, 14, 4, 14,\r
70 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
71 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
72 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
73 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
74 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
75 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
76 14, 14, 14, 14, 14, 14, 14, 10, 14, 14,\r
77 14, 14, 14, 9, 14, 1, 14, 14, 14, 14,\r
78 14, 14, 14, 14, 14, 14, 14, 0, 14, 14,\r
79 14, 8, 14, 14, 14, 14, 14, 14, 14, 14,\r
80 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
81 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
82 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
83 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
84 14, 14, 14, 14, 14, 14\r
85 };\r
86 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)];\r
87}\r
88\r
89int\r
90onigenc_unicode_fold3_key(OnigCodePoint codes[])\r
91{\r
92 static const short int wordlist[] =\r
93 {\r
94\r
95 62,\r
96\r
97 47,\r
98\r
99 31,\r
100\r
101 57,\r
102\r
103 41,\r
104\r
105 25,\r
106\r
107 52,\r
108\r
109 36,\r
110\r
111 20,\r
112\r
113 67,\r
114\r
115 15,\r
116\r
117 10,\r
118\r
119 5,\r
120\r
121 0\r
122 };\r
123\r
2b23beb0
SZ
124 int key = hash(codes);\r
125 if (key <= MAX_HASH_VALUE) {\r
126 int index = wordlist[key];\r
127 if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds3 + index, 3) == 0) {\r
128 return index;\r
129 }\r
b602265d 130 }\r
2b23beb0 131\r
b602265d
DG
132 return -1;\r
133}\r