]> granicus.if.org Git - onig/commitdiff
add type member into CalloutFuncListEntry
authorK.Kosako <kosako@sofnec.co.jp>
Tue, 20 Feb 2018 05:55:00 +0000 (14:55 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Wed, 21 Feb 2018 04:22:59 +0000 (13:22 +0900)
src/regint.h
src/regparse.c

index c721f80abae1bbbb328e63a7038c2cc16dd0e0ab..16fbf79d6a8e87fc1909fb4933ebb013065da477 100644 (file)
@@ -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 */
index 9331474e991bccc5108a4d3d0edba3e2afb67b28..b2a96faa77926aa93e6832c7dbb3a6aab632869d 100644 (file)
@@ -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)
 {