Implement stacked filetest operators (-f -w -x $file).
[p5sagit/p5-mst-13.2.git] / ext / B / B.xs
index cfe0079..3aac784 100644 (file)
@@ -427,11 +427,11 @@ oplist(pTHX_ OP *o, SV **SP)
             SP = oplist(aTHX_ cPMOPo->op_pmreplstart, SP);
             continue;
        case OP_SORT:
-           if (o->op_flags & (OPf_STACKED|OPf_SPECIAL)) {
+           if (o->op_flags & OPf_STACKED && o->op_flags & OPf_SPECIAL) {
                OP *kid = cLISTOPo->op_first->op_sibling;   /* pass pushmark */
                kid = kUNOP->op_first;                      /* pass rv2gv */
                kid = kUNOP->op_first;                      /* pass leave */
-               SP = oplist(aTHX_ kid, SP);
+               SP = oplist(aTHX_ kid->op_next, SP);
            }
            continue;
         }
@@ -1049,6 +1049,13 @@ U32
 SvTYPE(sv)
        B::SV   sv
 
+#define object_2svref(sv)      sv
+#define SVREF SV *
+       
+SVREF
+object_2svref(sv)
+       B::SV   sv
+
 MODULE = B     PACKAGE = B::SV         PREFIX = Sv
 
 U32
@@ -1518,6 +1525,17 @@ AvARRAY(av)
                XPUSHs(make_sv_object(aTHX_ sv_newmortal(), svp[i]));
        }
 
+void
+AvARRAYelt(av, idx)
+       B::AV   av
+       int     idx
+    PPCODE:
+       if (idx >= 0 && AvFILL(av) >= 0 && idx <= AvFILL(av))
+           XPUSHs(make_sv_object(aTHX_ sv_newmortal(), (AvARRAY(av)[idx])));
+       else
+           XPUSHs(make_sv_object(aTHX_ sv_newmortal(), NULL));
+
+                                  
 MODULE = B     PACKAGE = B::AV
 
 U8