From c34bcb0e017cd1273ad56e7d0ea4f7381af1d0ea Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Tue, 20 Feb 2018 14:55:00 +0900 Subject: [PATCH] add type member into CalloutFuncListEntry --- src/regint.h | 3 ++- src/regparse.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/regint.h b/src/regint.h index c721f80..16fbf79 100644 --- a/src/regint.h +++ b/src/regint.h @@ -799,9 +799,10 @@ typedef enum { CALLOUT_TYPE_START_MARK_END_CALL = 3, } CalloutType; +extern CalloutType onig_get_callout_type_from_name_id(int name_id); extern OnigCalloutFunc onig_get_callout_start_func_from_name_id(int id); extern OnigCalloutFunc onig_get_callout_end_func_from_name_id(int id); -extern int onig_callout_tag_table_free(void* table); +extern int onig_callout_tag_table_free(void* table); #endif /* strend hash */ diff --git a/src/regparse.c b/src/regparse.c index 9331474..b2a96fa 100644 --- a/src/regparse.c +++ b/src/regparse.c @@ -1105,6 +1105,7 @@ onig_noname_group_capture_is_active(regex_t* reg) #ifdef USE_CALLOUT typedef struct { + CalloutType type; int in; OnigCalloutFunc start_func; OnigCalloutFunc end_func; @@ -1404,6 +1405,7 @@ is_allowed_callout_name(UChar* name, UChar* name_end) static int set_callout_of_name_with_enc(OnigEncoding enc, UChar* name, UChar* name_end, + CalloutType type, int in, OnigCalloutFunc start_func, OnigCalloutFunc end_func, @@ -1467,6 +1469,7 @@ set_callout_of_name_with_enc(OnigEncoding enc, UChar* name, UChar* name_end, } fe = CalloutNameFuncList->v + id; + fe->type = type; fe->in = in; fe->start_func = start_func; fe->end_func = end_func; @@ -1495,7 +1498,9 @@ onig_set_callout_of_name(OnigUChar* name, OnigUChar* name_end, int arg_num, OnigType arg_types[], int opt_arg_num, OnigValue opt_defaults[]) { - return set_callout_of_name_with_enc(0, name, name_end, in, callout, 0, + return set_callout_of_name_with_enc(0, name, name_end, + CALLOUT_TYPE_SINGLE, + in, callout, 0, arg_num, arg_types, opt_arg_num, opt_defaults); } @@ -1535,6 +1540,13 @@ onig_get_callout_id_from_name(OnigEncoding enc, UChar* name, UChar* name_end, return r; } + +extern CalloutType +onig_get_callout_type_from_name_id(int name_id) +{ + return CalloutNameFuncList->v[name_id].type; +} + extern OnigCalloutFunc onig_get_callout_start_func_from_name_id(int name_id) { -- 2.40.0