int used_num;
int used_bytes;
OnigCalloutIn in;
- OnigCalloutOf of;
int name_id;
UChar* contents;
const UChar* acontents;
regex_t* regex;
in = onig_get_callout_in_by_callout_args(args);
- of = onig_get_callout_of_by_callout_args(args);
name_id = onig_get_name_id_by_callout_args(args);
start = onig_get_start_by_callout_args(args);
current = onig_get_current_by_callout_args(args);
regex = onig_get_regex_by_callout_args(args);
contents = 0;
- if (of == ONIG_CALLOUT_OF_CONTENTS) {
- acontents = onig_get_contents_by_callout_args(args);
+ acontents = onig_get_contents_by_callout_args(args);
+ if (acontents != 0) {
+ OnigEncoding enc = onig_get_encoding(regex);
acontents_end = onig_get_contents_end_by_callout_args(args);
- if (acontents != 0) {
- OnigEncoding enc = onig_get_encoding(regex);
- contents = onigenc_strdup(enc, acontents, acontents_end);
- }
+ contents = onigenc_strdup(enc, acontents, acontents_end);
}
if (name_id != ONIG_NON_NAME_ID) {
}
fprintf(stdout,
"%s %s: contents: \"%s\", start: \"%s\", current: \"%s\"\n",
- of == ONIG_CALLOUT_OF_CONTENTS ? "CONTENTS" : "NAME",
+ contents != 0 ? "CONTENTS" : "NAME",
in == ONIG_CALLOUT_IN_PROGRESS ? "PROGRESS" : "RETRACTION",
contents, start, current);
}
#ifdef USE_CALLOUT
-#define CALLOUT_BODY(func, ain, aof, aname_id, anum, user, args, result) do { \
+#define CALLOUT_BODY(func, ain, aname_id, anum, user, args, result) do { \
args.in = (ain);\
- args.of = (aof);\
args.name_id = (aname_id);\
args.num = anum;\
args.regex = reg;\
result = (func)(&args, user);\
} while (0)
-#define RETRACTION_CALLOUT(func, aof, aname_id, anum, user) do {\
+#define RETRACTION_CALLOUT(func, aname_id, anum, user) do {\
int result;\
OnigCalloutArgs args;\
- CALLOUT_BODY(func, ONIG_CALLOUT_IN_RETRACTION, aof, aname_id, anum, user, args, result);\
+ CALLOUT_BODY(func, ONIG_CALLOUT_IN_RETRACTION, aname_id, anum, user, args, result);\
switch (result) {\
case ONIG_CALLOUT_FAIL:\
goto fail;\
struct OnigCalloutArgsStruct {
OnigCalloutIn in;
- OnigCalloutOf of;
int name_id; /* name id or ONIG_NON_NAME_ID */
int num;
OnigRegex regex;
#ifdef USE_CALLOUT
#define POP_CALLOUT_CASE \
else if (stk->type == STK_CALLOUT) {\
- int aof;\
- if (stk->zid < 0) {\
- aof = ONIG_CALLOUT_OF_CONTENTS;\
- }\
- else {\
- aof = ONIG_CALLOUT_OF_NAME;\
- }\
- RETRACTION_CALLOUT(stk->u.callout.func, aof, stk->zid, stk->u.callout.num, msa->mp->callout_user_data);\
+ RETRACTION_CALLOUT(stk->u.callout.func, stk->zid, stk->u.callout.num, msa->mp->callout_user_data);\
}
#else
#define POP_CALLOUT_CASE
}
if (IS_NOT_NULL(func) && (in & ONIG_CALLOUT_IN_PROGRESS) != 0) {
- CALLOUT_BODY(func, ONIG_CALLOUT_IN_PROGRESS, of, name_id,
+ CALLOUT_BODY(func, ONIG_CALLOUT_IN_PROGRESS, name_id,
num, msa->mp->callout_user_data, args, call_result);
switch (call_result) {
case ONIG_CALLOUT_FAIL:
return args->in;
}
-extern OnigCalloutOf
-onig_get_callout_of_by_callout_args(OnigCalloutArgs* args)
-{
- return args->of;
-}
-
extern int
onig_get_name_id_by_callout_args(OnigCalloutArgs* args)
{