diff options
author | Hugo van der Sanden <hv@crypt.org> | 1999-05-23 17:35:07 +0100 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-24 05:46:20 +0000 |
commit | faef01704ba77a858827d4e793b056731d6e6832 (patch) | |
tree | 291268218f13ed645fa5df363050cd6c4cf6e2da | |
parent | d49321e7b7c3f90e1fb44f947dddd8517579dd60 (diff) | |
download | perl-faef01704ba77a858827d4e793b056731d6e6832.tar.gz |
name PL_in_eval bits
Message-Id: <199905231535.QAA00032@crypt.compulink.co.uk>
p4raw-id: //depot/perl@3457
-rw-r--r-- | cop.h | 6 | ||||
-rw-r--r-- | op.c | 8 | ||||
-rw-r--r-- | perl.c | 4 | ||||
-rw-r--r-- | pp_ctl.c | 8 | ||||
-rw-r--r-- | toke.c | 6 | ||||
-rw-r--r-- | util.c | 2 |
6 files changed, 21 insertions, 13 deletions
@@ -298,6 +298,12 @@ struct context { #define G_KEEPERR 16 /* Append errors to $@, don't overwrite it */ #define G_NODEBUG 32 /* Disable debugging at toplevel. */ +/* flag bits for PL_in_eval */ +#define EVAL_NULL 0 /* not in an eval */ +#define EVAL_INEVAL 1 /* some enclosing scope is an eval */ +#define EVAL_WARNONLY 2 /* used by yywarn() when calling yyerror() */ +#define EVAL_KEEPERR 4 /* set by perl_call_sv if G_KEEPERR */ + /* Support for switching (stack and block) contexts. * This ensures magic doesn't invalidate local stack and cx pointers. */ @@ -136,7 +136,7 @@ assertref(OP *o) SV *msg = sv_2mortal( newSVpvf("(Did you mean $ or @ instead of %c?)\n", type == OP_ENTERSUB ? '&' : '%')); - if (PL_in_eval & 2) + if (PL_in_eval & EVAL_WARNONLY) warn("%_", msg); else if (PL_in_eval) sv_catsv(GvSV(PL_errgv), msg); @@ -1764,7 +1764,9 @@ newPROG(OP *o) if (PL_in_eval) { if (PL_eval_root) return; - PL_eval_root = newUNOP(OP_LEAVEEVAL, ((PL_in_eval & 4) ? OPf_SPECIAL : 0), o); + PL_eval_root = newUNOP(OP_LEAVEEVAL, + ((PL_in_eval & EVAL_KEEPERR) + ? OPf_SPECIAL : 0), o); PL_eval_start = linklist(PL_eval_root); PL_eval_root->op_next = 0; peep(PL_eval_start); @@ -3997,7 +3999,7 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block) if (strEQ(s, "BEGIN")) { char *not_safe = "BEGIN not safe after errors--compilation aborted"; - if (PL_in_eval & 4) + if (PL_in_eval & EVAL_KEEPERR) croak(not_safe); else { /* force display of errors found but not reported */ @@ -1315,9 +1315,9 @@ perl_call_sv(SV *sv, I32 flags) PUSHEVAL(cx, 0, 0); PL_eval_root = PL_op; /* Only needed so that goto works right. */ - PL_in_eval = 1; + PL_in_eval = EVAL_INEVAL; if (flags & G_KEEPERR) - PL_in_eval |= 4; + PL_in_eval |= EVAL_KEEPERR; else sv_setpv(ERRSV,""); } @@ -1335,7 +1335,7 @@ die_where(char *message, STRLEN msglen) SV **newsp; if (message) { - if (PL_in_eval & 4) { + if (PL_in_eval & EVAL_KEEPERR) { SV **svp; svp = hv_fetch(ERRHV, message, msglen, TRUE); @@ -2612,7 +2612,7 @@ doeval(int gimme, OP** startop) AV* comppadlist; I32 i; - PL_in_eval = 1; + PL_in_eval = EVAL_INEVAL; PUSHMARK(SP); @@ -2691,7 +2691,7 @@ doeval(int gimme, OP** startop) SvREFCNT_dec(PL_rs); PL_rs = newSVpvn("\n", 1); if (saveop && saveop->op_flags & OPf_SPECIAL) - PL_in_eval |= 4; + PL_in_eval |= EVAL_KEEPERR; else sv_setpv(ERRSV,""); if (yyparse() || PL_error_count || !PL_eval_root) { @@ -3145,7 +3145,7 @@ PP(pp_entertry) PUSHEVAL(cx, 0, 0); PL_eval_root = PL_op; /* Only needed so that goto works right. */ - PL_in_eval = 1; + PL_in_eval = EVAL_INEVAL; sv_setpv(ERRSV,""); PUTBACK; return DOCATCH(PL_op->op_next); @@ -6360,9 +6360,9 @@ yywarn(char *s) { dTHR; --PL_error_count; - PL_in_eval |= 2; + PL_in_eval |= EVAL_WARNONLY; yyerror(s); - PL_in_eval &= ~2; + PL_in_eval &= ~EVAL_WARNONLY; return 0; } @@ -6425,7 +6425,7 @@ yyerror(char *s) (int)PL_multi_open,(int)PL_multi_close,(long)PL_multi_start); PL_multi_end = 0; } - if (PL_in_eval & 2) + if (PL_in_eval & EVAL_WARNONLY) warn("%_", msg); else if (PL_in_eval) sv_catsv(ERRSV, msg); @@ -2959,7 +2959,7 @@ new_struct_thread(struct perl_thread *t) PL_start_env.je_mustcatch = TRUE; PL_top_env = &PL_start_env; - PL_in_eval = FALSE; + PL_in_eval = EVAL_NULL; /* ~(EVAL_INEVAL|EVAL_WARNONLY|EVAL_KEEPERR) */ PL_restartop = 0; PL_statname = NEWSV(66,0); |