From: K.Kosako Date: Mon, 26 Feb 2018 02:04:07 +0000 (+0900) Subject: add (*FAIL_COUNT) X-Git-Tag: v6.8.0~160 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23b2881233f7aa49b7b87eef5018b033be051e11;p=onig add (*FAIL_COUNT) --- diff --git a/sample/count.c b/sample/count.c index c49972e..e0ac8b1 100644 --- a/sample/count.c +++ b/sample/count.c @@ -94,6 +94,7 @@ extern int main(int argc, char* argv[]) test("abc(.(*COUNT[x]))*(*FAIL)", "abcdefg"); test("abc(.(*COUNT[_any_]))*(.(*COUNT[x]))*d", "abcdefg"); + test("abc(.(*FAIL_COUNT[x]))*f", "abcdefg"); onig_end(); return 0; diff --git a/src/regexec.c b/src/regexec.c index ab8c6a7..6366277 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -5281,6 +5281,14 @@ onig_initialize_builtin_callouts(void) if (id < 0) return id;\ } while(0) +#define BS0_RETRACTION(name, func) do {\ + id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ + (UChar* )#name, (UChar* )(#name + strlen(#name)), \ + ONIG_CALLOUT_IN_RETRACTION,\ + onig_builtin_ ## func, 0, 0, 0, 0, 0);\ + if (id < 0) return id;\ +} while(0) + #define BS1(name, func, ts) do {\ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ (UChar* )#name, (UChar* )(#name + strlen(#name)), \ @@ -5301,6 +5309,7 @@ onig_initialize_builtin_callouts(void) BS0(ABORT, abort); BS1(ERROR, error, &t_int); BS0(COUNT, count); + BS0_RETRACTION(FAIL_COUNT, count); return ONIG_NORMAL; #endif /* USE_CALLOUT */