summaryrefslogtreecommitdiff
path: root/src/ascii.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/ascii.c
parent5587db012cd0e8f69f811e8959a861112904136a (diff)
parent38848ee931202f14ff21b07de1033e6fcd17f079 (diff)
Merge branch 'release/6.8.1-1'6.8.1-1
Diffstat (limited to 'src/ascii.c')
-rw-r--r--src/ascii.c67
1 files changed, 60 insertions, 7 deletions
diff --git a/src/ascii.c b/src/ascii.c
index b21878d..7efaa26 100644
--- a/src/ascii.c
+++ b/src/ascii.c
@@ -2,7 +2,7 @@
ascii.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
@@ -27,7 +27,59 @@
* SUCH DAMAGE.
*/
-#include "regenc.h"
+#include "regint.h" /* for USE_CALLOUT */
+
+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_ASCII;
+ t_long = ONIG_TYPE_LONG;
+
+ name = "FAIL"; BC0_P(name, fail);
+ name = "MISMATCH"; BC0_P(name, mismatch);
+ name = "MAX"; BC_B(name, max, 1, &t_long);
+
+ name = "ERROR";
+ args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT;
+ BC_P_O(name, error, 1, args, 1, opts);
+
+ name = "COUNT";
+ args[0] = ONIG_TYPE_CHAR; opts[0].c = '>';
+ BC_B_O(name, count, 1, args, 1, opts);
+
+ name = "TOTAL_COUNT";
+ args[0] = ONIG_TYPE_CHAR; opts[0].c = '>';
+ BC_B_O(name, total_count, 1, args, 1, opts);
+
+ name = "CMP";
+ 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;
+}
+
+#if 0
+static int
+is_initialized(void)
+{
+ /* Don't use this function */
+ /* can't answer, because builtin callout entries removed in onig_end() */
+ return 0;
+}
+#endif
static int
ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype)
@@ -41,8 +93,8 @@ ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype)
OnigEncodingType OnigEncodingASCII = {
onigenc_single_byte_mbc_enc_len,
"US-ASCII", /* name */
- 1, /* max byte length */
- 1, /* min byte length */
+ 1, /* max enc length */
+ 1, /* min enc length */
onigenc_is_mbc_newline_0x0a,
onigenc_single_byte_mbc_to_code,
onigenc_single_byte_code_to_mbclen,
@@ -55,7 +107,8 @@ OnigEncodingType OnigEncodingASCII = {
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
onigenc_always_true_is_allowed_reverse_match,
- NULL, /* init */
- NULL, /* is_initialized */
- onigenc_always_true_is_valid_mbc_string
+ init,
+ 0, /* is_initialized */
+ onigenc_always_true_is_valid_mbc_string,
+ 0, 0, 0
};