int id;
OnigEncoding enc;
char* name;
- unsigned int t_long;
unsigned int args[4];
OnigValue opts[4];
enc = ONIG_ENCODING_ASCII;
- t_long = ONIG_TYPE_LONG;
name = "FAIL"; BC0_P(name, fail);
name = "MISMATCH"; BC0_P(name, mismatch);
- name = "MAX"; BC_B(name, max, 1, &t_long);
+
+ name = "MAX";
+ args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
+ BC_B(name, max, 1, args);
name = "ERROR";
args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT;
{
int r;
int slot;
+ long max_val;
OnigType type;
OnigValue val;
OnigValue aval;
r = onig_get_arg_by_callout_args(args, 0, &type, &aval);
if (r != ONIG_NORMAL) return r;
+ if (type == ONIG_TYPE_TAG) {
+ r = onig_get_callout_data_by_callout_args(args, aval.tag, 0, &type, &aval);
+ if (r < ONIG_NORMAL) return r;
+ else if (r > ONIG_NORMAL)
+ max_val = 0L;
+ else
+ max_val = aval.l;
+ }
+ else { /* LONG */
+ max_val = aval.l;
+ }
if (args->in == ONIG_CALLOUT_IN_RETRACTION) {
val.l--;
}
else {
- if (val.l >= aval.l) return ONIG_CALLOUT_FAIL;
+ if (val.l >= max_val) return ONIG_CALLOUT_FAIL;
val.l++;
}
int id;
OnigEncoding enc;
char* name;
- unsigned int t_long;
unsigned int args[4];
OnigValue opts[4];
enc = ONIG_ENCODING_UTF16_BE;
- t_long = ONIG_TYPE_LONG;
name = "\000F\000A\000I\000L\000\000"; BC0_P(name, fail);
name = "\000M\000I\000S\000M\000A\000T\000C\000H\000\000"; BC0_P(name, mismatch);
- name = "\000M\000A\000X\000\000"; BC_B(name, max, 1, &t_long);
+ name = "\000M\000A\000X\000\000";
+ args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
+ BC_B(name, max, 1, args);
name = "\000E\000R\000R\000O\000R\000\000";
args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT;
int id;
OnigEncoding enc;
char* name;
- unsigned int t_long;
unsigned int args[4];
OnigValue opts[4];
enc = ONIG_ENCODING_UTF16_LE;
- t_long = ONIG_TYPE_LONG;
name = "F\000A\000I\000L\000\000\000"; BC0_P(name, fail);
name = "M\000I\000S\000M\000A\000T\000C\000H\000\000\000"; BC0_P(name, mismatch);
- name = "M\000A\000X\000\000\000"; BC_B(name, max, 1, &t_long);
+
+ name = "M\000A\000X\000\000\000";
+ args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
+ BC_B(name, max, 1, args);
name = "E\000R\000R\000O\000R\000\000\000";
args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT;