]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2_key.c
MdeModulePkg RegularExpressionDxe: Update Oniguruma to 6.9.0
[mirror_edk2.git] / MdeModulePkg / Universal / RegularExpressionDxe / Oniguruma / unicode_fold2_key.c
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2_key.c b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2_key.c
new file mode 100644 (file)
index 0000000..1926b25
--- /dev/null
@@ -0,0 +1,229 @@
+/* This file was converted by gperf_fold_key_conv.py\r
+      from gperf output file. */\r
+/* ANSI-C code produced by gperf version 3.1 */\r
+/* Command-line: /usr/bin/gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold2_key unicode_fold2_key.gperf  */\r
+/* Computed positions: -k'3,6' */\r
+\r
+\r
+\r
+/* This gperf source file was generated by make_unicode_fold_data.py */\r
+\r
+/*-\r
+ * Copyright (c) 2017-2018  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp>\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ *    notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the\r
+ *    documentation and/or other materials provided with the distribution.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ */\r
+//#include <string.h>\r
+#include "regenc.h"\r
+\r
+#define TOTAL_KEYWORDS 59\r
+#define MIN_WORD_LENGTH 6\r
+#define MAX_WORD_LENGTH 6\r
+#define MIN_HASH_VALUE 0\r
+#define MAX_HASH_VALUE 58\r
+/* maximum key range = 59, duplicates = 0 */\r
+\r
+#ifdef __GNUC__\r
+__inline\r
+#else\r
+#ifdef __cplusplus\r
+inline\r
+#endif\r
+#endif\r
+/*ARGSUSED*/\r
+static unsigned int\r
+hash(OnigCodePoint codes[])\r
+{\r
+  static const unsigned char asso_values[] =\r
+    {\r
+      58, 57, 56, 55, 54, 53, 52, 16, 50, 59,\r
+      15, 59, 25, 59, 59, 59, 59, 59, 59,  3,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 49, 48, 47, 46, 45, 44, 43, 42,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 21,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59,  2, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 40, 20, 39, 38,\r
+      37, 14,  5, 36, 20,  7, 25, 34, 29, 32,\r
+      16, 59, 31, 59, 59,  2,  1, 59, 25, 15,\r
+      59, 14, 59, 59, 28, 59,  2, 59, 59, 59,\r
+      11, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 24, 59, 22, 59, 59, 11, 59, 59,\r
+      59, 59, 59,  7, 59,  0, 59, 59, 16, 59,\r
+       1, 59, 59, 16, 59, 59, 59, 15, 59, 59,\r
+      59,  6, 59, 59, 59, 59,  0, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
+      59, 59, 59, 59, 59, 59\r
+    };\r
+  return asso_values[(unsigned char)onig_codes_byte_at(codes, 5)] + asso_values[(unsigned char)onig_codes_byte_at(codes, 2)];\r
+}\r
+\r
+int\r
+onigenc_unicode_fold2_key(OnigCodePoint codes[])\r
+{\r
+  static const short int wordlist[] =\r
+    {\r
+\r
+      101,\r
+\r
+      253,\r
+\r
+      76,\r
+\r
+      29,\r
+\r
+      24,\r
+\r
+      239,\r
+\r
+      96,\r
+\r
+      71,\r
+\r
+      92,\r
+\r
+      67,\r
+\r
+      4,\r
+\r
+      62,\r
+\r
+      8,\r
+\r
+      58,\r
+\r
+      234,\r
+\r
+      109,\r
+\r
+      164,\r
+\r
+      88,\r
+\r
+      84,\r
+\r
+      80,\r
+\r
+      214,\r
+\r
+      0,\r
+\r
+      54,\r
+\r
+      261,\r
+\r
+      50,\r
+\r
+      105,\r
+\r
+      121,\r
+\r
+      125,\r
+\r
+      257,\r
+\r
+      42,\r
+\r
+      38,\r
+\r
+      249,\r
+\r
+      46,\r
+\r
+      117,\r
+\r
+      12,\r
+\r
+      113,\r
+\r
+      244,\r
+\r
+      229,\r
+\r
+      224,\r
+\r
+      219,\r
+\r
+      209,\r
+\r
+      16,\r
+\r
+      204,\r
+\r
+      199,\r
+\r
+      194,\r
+\r
+      189,\r
+\r
+      184,\r
+\r
+      179,\r
+\r
+      174,\r
+\r
+      169,\r
+\r
+      20,\r
+\r
+      34,\r
+\r
+      159,\r
+\r
+      154,\r
+\r
+      149,\r
+\r
+      144,\r
+\r
+      139,\r
+\r
+      134,\r
+\r
+      129\r
+    };\r
+\r
+  if (0 == 0)\r
+    {\r
+      int key = hash(codes);\r
+\r
+      if (key <= MAX_HASH_VALUE)\r
+        {\r
+          int index = wordlist[key];\r
+\r
+          if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds2 + index, 2) == 0)\r
+            return index;\r
+        }\r
+    }\r
+  return -1;\r
+}\r
+\r
+\r