]> granicus.if.org Git - onig/commitdiff
add OnigmatchParam access functions
authorK.Kosako <kosako@sofnec.co.jp>
Tue, 13 Feb 2018 04:41:04 +0000 (13:41 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Tue, 13 Feb 2018 04:41:04 +0000 (13:41 +0900)
src/oniguruma.h
src/regexec.c

index 8dacbe65e6353d3365033ba2c71d2174de907d82..c5a246f77e55b0c76968b085bf852642121f4c99 100644 (file)
@@ -810,9 +810,6 @@ ONIG_EXTERN
 int onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
 ONIG_EXTERN
 int onig_match_with_params P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp));
-ONIG_EXTERN
-void onig_initialize_match_params P_((OnigMatchParam* mp));
-
 ONIG_EXTERN
 OnigRegion* onig_region_new P_((void));
 ONIG_EXTERN
@@ -904,6 +901,18 @@ const char* onig_version P_((void));
 ONIG_EXTERN
 const char* onig_copyright P_((void));
 
+/* for OnigMatchParam */
+ONIG_EXTERN
+void onig_initialize_match_params P_((OnigMatchParam* mp));
+ONIG_EXTERN
+int onig_set_match_stack_limit_size_of_match_param P_((OnigMatchParam* param, unsigned int limit));
+ONIG_EXTERN
+int onig_set_retry_limit_in_match_of_match_param P_((OnigMatchParam* param, unsigned long limit));
+ONIG_EXTERN
+int onig_set_callout_of_code_of_match_param P_((OnigMatchParam* param, OnigCalloutFunc f));
+ONIG_EXTERN
+int onig_set_retraction_callout_of_code_of_match_param P_((OnigMatchParam* param, OnigCalloutFunc f));
+
 /* for callout functions */
 ONIG_EXTERN
 int onig_initialize_builtin_callouts P_((void));
index 6bb7a13cb1d85da037623554a1235edece65bc73..d83661a4096b968cf166ebf9c4d8e444fe6e3aba 100644 (file)
@@ -40,6 +40,7 @@
 
 #define CHECK_INTERRUPT_IN_MATCH
 
+
 struct OnigMatchParamStruct {
   unsigned int    match_stack_limit;
   unsigned long   retry_limit_in_match;
@@ -48,6 +49,39 @@ struct OnigMatchParamStruct {
   void*           callout_user_data;
 };
 
+extern int
+onig_set_match_stack_limit_size_of_match_param(OnigMatchParam* param,
+                                               unsigned int limit)
+{
+  param->match_stack_limit = limit;
+  return ONIG_NORMAL;
+}
+
+extern int
+onig_set_retry_limit_in_match_of_match_param(OnigMatchParam* param,
+                                             unsigned long limit)
+{
+  param->retry_limit_in_match = limit;
+  return ONIG_NORMAL;
+}
+
+extern int
+onig_set_callout_of_code_of_match_param(OnigMatchParam* param, OnigCalloutFunc f)
+{
+  param->callout_of_code = f;
+  return ONIG_NORMAL;
+}
+
+extern int
+onig_set_retraction_callout_of_code_of_match_param(OnigMatchParam* param,
+                                                   OnigCalloutFunc f)
+{
+  param->retraction_callout_of_code = f;
+  return ONIG_NORMAL;
+}
+
+
+
 typedef struct {
   void* stack_p;
   int   stack_n;