]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3_key.c
MdeModulePkg RegularExpressionDxe: Update Oniguruma to 6.9.0
[mirror_edk2.git] / MdeModulePkg / Universal / RegularExpressionDxe / Oniguruma / unicode_fold3_key.c
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3_key.c b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3_key.c
new file mode 100644 (file)
index 0000000..9c4415a
--- /dev/null
@@ -0,0 +1,139 @@
+/* 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_fold3_key unicode_fold3_key.gperf  */\r
+/* Computed positions: -k'3,6,9' */\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 14\r
+#define MIN_WORD_LENGTH 9\r
+#define MAX_WORD_LENGTH 9\r
+#define MIN_HASH_VALUE 0\r
+#define MAX_HASH_VALUE 13\r
+/* maximum key range = 14, 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
+       6,  3, 14, 14, 14, 14, 14, 14,  1, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14,  0,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14,  0, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14,  4, 14, 14,  5, 14, 14,  4, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 10, 14, 14,\r
+      14, 14, 14,  9, 14,  1, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14,  0, 14, 14,\r
+      14,  8, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\r
+      14, 14, 14, 14, 14, 14\r
+    };\r
+  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
+}\r
+\r
+int\r
+onigenc_unicode_fold3_key(OnigCodePoint codes[])\r
+{\r
+  static const short int wordlist[] =\r
+    {\r
+\r
+      62,\r
+\r
+      47,\r
+\r
+      31,\r
+\r
+      57,\r
+\r
+      41,\r
+\r
+      25,\r
+\r
+      52,\r
+\r
+      36,\r
+\r
+      20,\r
+\r
+      67,\r
+\r
+      15,\r
+\r
+      10,\r
+\r
+      5,\r
+\r
+      0\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, OnigUnicodeFolds3 + index, 3) == 0)\r
+            return index;\r
+        }\r
+    }\r
+  return -1;\r
+}\r
+\r
+\r