From: Nicholas Clark Date: Sat, 5 Nov 2005 12:57:40 +0000 (+0000) Subject: Allow passing of the full enum name into the tryAMAGICbin family of X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eb87d5ef4f3abe7f9c4c2c1f62f9acb7cae8b335;p=p5sagit%2Fp5-mst-13.2.git Allow passing of the full enum name into the tryAMAGICbin family of macros, to avoid needing C pre-processor string concatenation within the lowest level expansion. p4raw-id: //depot/perl@26015 --- diff --git a/pp.c b/pp.c index 63bc8ed..c3d9d2b 100644 --- a/pp.c +++ b/pp.c @@ -2093,7 +2093,7 @@ PP(pp_ncmp) PP(pp_slt) { - dSP; tryAMAGICbinSET(slt,0); + dSP; tryAMAGICbinSET_var(slt_amg,0); { dPOPTOPssrl; const int cmp = (IN_LOCALE_RUNTIME @@ -2106,7 +2106,7 @@ PP(pp_slt) PP(pp_sgt) { - dSP; tryAMAGICbinSET(sgt,0); + dSP; tryAMAGICbinSET_var(sgt_amg,0); { dPOPTOPssrl; const int cmp = (IN_LOCALE_RUNTIME @@ -2119,7 +2119,7 @@ PP(pp_sgt) PP(pp_sle) { - dSP; tryAMAGICbinSET(sle,0); + dSP; tryAMAGICbinSET_var(sle_amg,0); { dPOPTOPssrl; const int cmp = (IN_LOCALE_RUNTIME @@ -2132,7 +2132,7 @@ PP(pp_sle) PP(pp_sge) { - dSP; tryAMAGICbinSET(sge,0); + dSP; tryAMAGICbinSET_var(sge_amg,0); { dPOPTOPssrl; const int cmp = (IN_LOCALE_RUNTIME diff --git a/pp.h b/pp.h index 1f426e7..21d3c9d 100644 --- a/pp.h +++ b/pp.h @@ -397,23 +397,29 @@ and C. #define AMGf_assign 4 #define AMGf_unary 8 -#define tryAMAGICbinW(meth,assign,set) STMT_START { \ +#define tryAMAGICbinW_var(meth_enum,assign,set) STMT_START { \ if (PL_amagic_generation) { \ SV* tmpsv; \ SV* const right= *(sp); SV* const left= *(sp-1);\ if ((SvAMAGIC(left)||SvAMAGIC(right))&&\ (tmpsv=amagic_call(left, \ right, \ - CAT2(meth,_amg), \ + meth_enum, \ (assign)? AMGf_assign: 0))) {\ SPAGAIN; \ (void)POPs; set(tmpsv); RETURN; } \ } \ } STMT_END +#define tryAMAGICbinW(meth,assign,set) \ + tryAMAGICbinW_var(CAT2(meth,_amg),assign,set) + #define tryAMAGICbin(meth,assign) tryAMAGICbinW(meth,assign,SETsv) #define tryAMAGICbinSET(meth,assign) tryAMAGICbinW(meth,assign,SETs) +#define tryAMAGICbinSET_var(meth_enum,assign) \ + tryAMAGICbinW_var(meth_enum,assign,SETs) + #define AMG_CALLun(sv,meth) amagic_call(sv,&PL_sv_undef, \ CAT2(meth,_amg),AMGf_noright | AMGf_unary) #define AMG_CALLbinL(left,right,meth) \