#ifdef USE_CALLOUT
int id;
- OnigType t_int;
- OnigType t_long;
OnigEncoding enc;
char* name;
+ OnigType t_int;
+ OnigType t_long;
+ OnigValue opts[4];
enc = ONIG_ENCODING_ASCII;
t_int = ONIG_TYPE_INT;
name = "ERROR"; BC1_P(name, error, &t_int);
name = "COUNT"; BC0_P(name, count);
name = "FAIL_COUNT"; BC0_R(name, count);
- name = "ONLY"; BC1_B(name, only, &t_long);
+
+ name = "ONLY"; opts[0].l = 1L;
+ BC1_B_O(name, only, &t_long, opts);
#endif /* USE_CALLOUT */
if (id < 0) return id;\
} while(0)
+#define BC1_B_O(name, func, ts, opts) do {\
+ int len = onigenc_str_bytelen_null(enc, (UChar* )name);\
+ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\
+ (UChar* )(name), (UChar* )((name) + len),\
+ ONIG_CALLOUT_IN_BOTH,\
+ onig_builtin_ ## func, 0, 1, (ts), 1, opts);\
+ if (id < 0) return id;\
+} while(0)
+
#endif /* USE_CALLOUT */