-#define AMG_CALLbinL(left,right,meth) \
- amagic_call(left,right,CAT2(meth,_amg),AMGf_noright)
+#define AMG_CALLunary(sv,meth) \
+ amagic_call(sv,&PL_sv_undef, meth, AMGf_noright | AMGf_unary)
+
+/* No longer used in core. Use AMG_CALLunary instead */
+#define AMG_CALLun(sv,meth) AMG_CALLunary(sv, CAT2(meth,_amg))
+
+#define tryAMAGICunTARGETlist(meth, jump) \
+ STMT_START { \
+ dSP; \
+ SV *tmpsv; \
+ SV *arg= *sp; \
+ int gimme = GIMME_V; \
+ if (UNLIKELY(SvAMAGIC(arg) && \
+ (tmpsv = amagic_call(arg, &PL_sv_undef, meth, \
+ AMGf_want_list | AMGf_noright \
+ |AMGf_unary)))) \
+ { \
+ SPAGAIN; \
+ if (gimme == G_VOID) { \
+ NOOP; \
+ } \
+ else if (gimme == G_ARRAY) { \
+ SSize_t i; \
+ SSize_t len; \
+ assert(SvTYPE(tmpsv) == SVt_PVAV); \
+ len = av_tindex((AV *)tmpsv) + 1; \
+ (void)POPs; /* get rid of the arg */ \
+ EXTEND(sp, len); \
+ for (i = 0; i < len; ++i) \
+ PUSHs(av_shift((AV *)tmpsv)); \
+ } \
+ else { /* AMGf_want_scalar */ \
+ dATARGET; /* just use the arg's location */ \
+ sv_setsv(TARG, tmpsv); \
+ if (opASSIGN) \
+ sp--; \
+ SETTARG; \
+ } \
+ PUTBACK; \
+ if (jump) { \
+ OP *jump_o = NORMAL->op_next; \
+ while (jump_o->op_type == OP_NULL) \
+ jump_o = jump_o->op_next; \
+ assert(jump_o->op_type == OP_ENTERSUB); \
+ PL_markstack_ptr--; \
+ return jump_o->op_next; \
+ } \
+ return NORMAL; \
+ } \
+ } STMT_END