OnigCaseFoldType case_fold_flag;
} OnigCompileInfo;
+
+typedef struct {
+ OnigUChar* content;
+ OnigUChar* name;
+ regex_t* reg;
+ const UChar* str;
+ const UChar* end;
+ UChar* right_range;
+ const UChar* sstart;
+ UChar* s; // current matching position
+ unsigned long try_in_match_counter;
+} OnigCalloutArgs;
+
+typedef int (*OnigCalloutFunc)(OnigCalloutArgs* args, void* user_data);
+
typedef struct {
- unsigned int match_stack_limit;
- unsigned long try_in_match_limit;
+ unsigned int match_stack_limit;
+ unsigned long try_in_match_limit;
+ OnigCalloutFunc callout;
+ OnigCalloutFunc retraction_callout;
+ void* callout_user_data;
} OnigMatchParams;
/* Oniguruma Native API */
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, OnigMatchParams* mp));
+ONIG_EXTERN
+void onig_initialize_match_params P_((OnigMatchParams* mp));
+
ONIG_EXTERN
OnigRegion* onig_region_new P_((void));
ONIG_EXTERN
#endif
}
+extern void
+onig_initialize_match_params(OnigMatchParams* mp)
+{
+ mp->match_stack_limit = MatchStackLimit;
+#ifdef USE_TRY_IN_MATCH_LIMIT
+ mp->try_in_match_limit = TryInMatchLimit;
+#endif
+ mp->callout = 0;
+ mp->retraction_callout = 0;
+ mp->callout_user_data = 0;
+}
+
static int
stack_double(int is_alloca, char** arg_alloc_base,
{
OnigMatchParams mp;
- mp.match_stack_limit = MatchStackLimit;
-#ifdef USE_TRY_IN_MATCH_LIMIT
- mp.try_in_match_limit = TryInMatchLimit;
-#endif
-
+ onig_initialize_match_params(&mp);
return onig_match_with_params(reg, str, end, at, region, option, &mp);
}
{
OnigMatchParams mp;
- mp.match_stack_limit = MatchStackLimit;
-#ifdef USE_TRY_IN_MATCH_LIMIT
- mp.try_in_match_limit = TryInMatchLimit;
-#endif
-
+ onig_initialize_match_params(&mp);
return onig_search_with_params(reg, str, end, start, range, region, option, &mp);
}