summaryrefslogtreecommitdiff
path: root/src/utf16_le.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-05-01 09:43:15 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-05-01 09:43:15 +0200
commit031a61b81318d9df626b2a332713eb1effa997a1 (patch)
tree085e531ee4e07594d904106413989fa5fdf14be8 /src/utf16_le.c
parent5587db012cd0e8f69f811e8959a861112904136a (diff)
parent38848ee931202f14ff21b07de1033e6fcd17f079 (diff)
Merge branch 'release/6.8.1-1'6.8.1-1
Diffstat (limited to 'src/utf16_le.c')
-rw-r--r--src/utf16_le.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/src/utf16_le.c b/src/utf16_le.c
index 89bc72f..dc0d3f1 100644
--- a/src/utf16_le.c
+++ b/src/utf16_le.c
@@ -2,7 +2,7 @@
utf16_le.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,8 +26,49 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+#include "regint.h" /* for USE_CALLOUT */
-#include "regenc.h"
+static int
+init(void)
+{
+#ifdef USE_CALLOUT
+
+ int id;
+ OnigEncoding enc;
+ char* name;
+ unsigned int t_long;
+ unsigned int args[4];
+ OnigValue opts[4];
+
+ enc = ONIG_ENCODING_UTF16_LE;
+ t_long = ONIG_TYPE_LONG;
+
+ name = "F\000A\000I\000L\000\000\000"; BC0_P(name, fail);
+ name = "M\000I\000S\000M\000A\000T\000C\000H\000\000\000"; BC0_P(name, mismatch);
+ name = "M\000A\000X\000\000\000"; BC_B(name, max, 1, &t_long);
+
+ name = "E\000R\000R\000O\000R\000\000\000";
+ args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT;
+ BC_P_O(name, error, 1, args, 1, opts);
+
+ name = "C\000O\000U\000N\000T\000\000\000";
+ args[0] = ONIG_TYPE_CHAR; opts[0].c = '>';
+ BC_B_O(name, count, 1, args, 1, opts);
+
+ name = "T\000O\000T\000A\000L\000_\000C\000O\000U\000N\000T\000\000\000";
+ args[0] = ONIG_TYPE_CHAR; opts[0].c = '>';
+ BC_B_O(name, total_count, 1, args, 1, opts);
+
+ name = "C\000M\000P\000\000\000";
+ args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
+ args[1] = ONIG_TYPE_STRING;
+ args[2] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
+ BC_P(name, cmp, 3, args);
+
+#endif /* USE_CALLOUT */
+
+ return ONIG_NORMAL;
+}
static const int EncLen_UTF16[] = {
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -225,8 +266,8 @@ utf16le_get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncodingType OnigEncodingUTF16_LE = {
utf16le_mbc_enc_len,
"UTF-16LE", /* name */
- 4, /* max byte length */
- 2, /* min byte length */
+ 4, /* max enc length */
+ 2, /* min enc length */
utf16le_is_mbc_newline,
utf16le_mbc_to_code,
utf16le_code_to_mbclen,
@@ -239,7 +280,7 @@ OnigEncodingType OnigEncodingUTF16_LE = {
onigenc_utf16_32_get_ctype_code_range,
utf16le_left_adjust_char_head,
onigenc_always_false_is_allowed_reverse_match,
- NULL, /* init */
- NULL, /* is_initialized */
+ init,
+ 0, /* is_initialized */
is_valid_mbc_string
};