support optional crypt() with PERL_OBJECT
[p5sagit/p5-mst-13.2.git] / pp_ctl.c
index 81b4281..8d4b7f7 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -26,7 +26,7 @@
 #define DOCATCH(o) ((CATCH_GET == TRUE) ? docatch(o) : (o))
 
 #ifdef PERL_OBJECT
-#define CALLOP this->*op
+#define CALLOP this->*PL_op
 #else
 #define CALLOP *PL_op
 static OP *docatch _((OP *o));
@@ -856,7 +856,7 @@ PP(pp_flop)
            char *tmps = SvPV(final, len);
 
            sv = sv_mortalcopy(left);
-           SvPV_force(sv,na);
+           SvPV_force(sv,PL_na);
            while (!SvNIOKp(sv) && SvCUR(sv) <= len) {
                XPUSHs(sv);
                if (strEQ(SvPVX(sv),tmps))
@@ -2090,7 +2090,7 @@ PP(pp_goto)
 
     if (do_dump) {
 #ifdef VMS
-       if (!retop) retop = main_start;
+       if (!retop) retop = PL_main_start;
 #endif
        PL_restartop = retop;
        PL_do_undump = TRUE;
@@ -2144,8 +2144,8 @@ PP(pp_nswitch)
        match = 0;
     else if (match > cCOP->uop.scop.scop_max)
        match = cCOP->uop.scop.scop_max;
-    op = cCOP->uop.scop.scop_next[match];
-    RETURNOP(op);
+    PL_op = cCOP->uop.scop.scop_next[match];
+    RETURNOP(PL_op);
 }
 
 PP(pp_cswitch)
@@ -2153,18 +2153,18 @@ PP(pp_cswitch)
     djSP;
     register I32 match;
 
-    if (multiline)
-       op = op->op_next;                       /* can't assume anything */
+    if (PL_multiline)
+       PL_op = PL_op->op_next;                 /* can't assume anything */
     else {
-       match = *(SvPVx(GvSV(cCOP->cop_gv), na)) & 255;
+       match = *(SvPVx(GvSV(cCOP->cop_gv), PL_na)) & 255;
        match -= cCOP->uop.scop.scop_offset;
        if (match < 0)
            match = 0;
        else if (match > cCOP->uop.scop.scop_max)
            match = cCOP->uop.scop.scop_max;
-       op = cCOP->uop.scop.scop_next[match];
+       PL_op = cCOP->uop.scop.scop_next[match];
     }
-    RETURNOP(op);
+    RETURNOP(PL_op);
 }
 #endif
 
@@ -2252,6 +2252,10 @@ sv_compile_2op(SV *sv, OP** startop, char *code, AV** avp)
     SAVETMPS;
     /* switch to eval mode */
 
+    if (PL_curcop == &PL_compiling) {
+       SAVESPTR(PL_compiling.cop_stash);
+       PL_compiling.cop_stash = PL_curstash;
+    }
     SAVESPTR(PL_compiling.cop_filegv);
     SAVEI16(PL_compiling.cop_line);
     sprintf(tmpbuf, "_<(%.10s_eval %lu)", code, (unsigned long)++PL_evalseq);
@@ -2266,7 +2270,7 @@ sv_compile_2op(SV *sv, OP** startop, char *code, AV** avp)
     SAVEDELETE(PL_defstash, safestr, strlen(safestr));
     SAVEHINTS();
 #ifdef OP_IN_REGISTER
-    opsave = op;
+    PL_opsave = op;
 #else
     SAVEPPTR(PL_op);
 #endif
@@ -2276,7 +2280,7 @@ sv_compile_2op(SV *sv, OP** startop, char *code, AV** avp)
     PL_op->op_type = 0;                        /* Avoid uninit warning. */
     PL_op->op_flags = 0;                       /* Avoid uninit warning. */
     PUSHBLOCK(cx, CXt_EVAL, SP);
-    PUSHEVAL(cx, 0, compiling.cop_filegv);
+    PUSHEVAL(cx, 0, PL_compiling.cop_filegv);
     rop = doeval(G_SCALAR, startop);
     POPBLOCK(cx,PL_curpm);
     POPEVAL(cx);
@@ -2287,7 +2291,7 @@ sv_compile_2op(SV *sv, OP** startop, char *code, AV** avp)
     *avp = (AV*)SvREFCNT_inc(PL_comppad);
     LEAVE;
 #ifdef OP_IN_REGISTER
-    op = opsave;
+    op = PL_opsave;
 #endif
     return rop;
 }
@@ -2318,7 +2322,7 @@ doeval(int gimme, OP** startop)
     SAVEI32(PL_max_intro_pending);
 
     caller = PL_compcv;
-    for (i = cxstack_ix - 1; i >= 0; i--) {
+    for (i = cxstack_ix; i >= 0; i--) {
        PERL_CONTEXT *cx = &cxstack[i];
        if (cx->cx_type == CXt_EVAL)
            break;
@@ -2599,7 +2603,7 @@ PP(pp_require)
 
     push_return(PL_op->op_next);
     PUSHBLOCK(cx, CXt_EVAL, SP);
-    PUSHEVAL(cx, name, compiling.cop_filegv);
+    PUSHEVAL(cx, name, PL_compiling.cop_filegv);
 
     PL_compiling.cop_line = 0;
 
@@ -2657,7 +2661,7 @@ PP(pp_entereval)
 
     push_return(PL_op->op_next);
     PUSHBLOCK(cx, CXt_EVAL, SP);
-    PUSHEVAL(cx, 0, compiling.cop_filegv);
+    PUSHEVAL(cx, 0, PL_compiling.cop_filegv);
 
     /* prepare to compile string */