X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=cop.h;h=e588675012abf4a2fa6782d4162517b95168e7a2;hb=83bb2f05018534d7d0cc69340baccd0359dfcdf2;hp=ede2fce591bf177cec85dc707f0bbfad712ce68f;hpb=146174a91a192983720a158796dc066226ad0e55;p=p5sagit%2Fp5-mst-13.2.git diff --git a/cop.h b/cop.h index ede2fce..e588675 100644 --- a/cop.h +++ b/cop.h @@ -1,6 +1,6 @@ /* cop.h * - * Copyright (c) 1991-1999, Larry Wall + * Copyright (c) 1991-2000, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -149,23 +149,28 @@ struct block_sub { struct block_eval { I32 old_in_eval; I32 old_op_type; - char * old_name; + SV * old_namesv; OP * old_eval_root; SV * cur_text; }; #define PUSHEVAL(cx,n,fgv) \ + STMT_START { \ cx->blk_eval.old_in_eval = PL_in_eval; \ cx->blk_eval.old_op_type = PL_op->op_type; \ - cx->blk_eval.old_name = (n ? savepv(n) : Nullch); \ + cx->blk_eval.old_namesv = (n ? newSVpv(n,0) : Nullsv); \ cx->blk_eval.old_eval_root = PL_eval_root; \ - cx->blk_eval.cur_text = PL_linestr; + cx->blk_eval.cur_text = PL_linestr; \ + } STMT_END #define POPEVAL(cx) \ + STMT_START { \ PL_in_eval = cx->blk_eval.old_in_eval; \ optype = cx->blk_eval.old_op_type; \ PL_eval_root = cx->blk_eval.old_eval_root; \ - Safefree(cx->blk_eval.old_name); + if (cx->blk_eval.old_namesv) \ + sv_2mortal(cx->blk_eval.old_namesv); \ + } STMT_END /* loop context */ struct block_loop { @@ -176,6 +181,7 @@ struct block_loop { OP * last_op; #ifdef USE_ITHREADS void * iterdata; + SV ** oldcurpad; #else SV ** itervar; #endif @@ -190,16 +196,17 @@ struct block_loop { # define CxITERVAR(c) \ ((c)->blk_loop.iterdata \ ? (CxPADLOOP(cx) \ - ? &PL_curpad[(PADOFFSET)(c)->blk_loop.iterdata] \ + ? &((c)->blk_loop.oldcurpad)[(PADOFFSET)(c)->blk_loop.iterdata] \ : &GvSV((GV*)(c)->blk_loop.iterdata)) \ : (SV**)NULL) # define CX_ITERDATA_SET(cx,idata) \ - if (cx->blk_loop.iterdata = (idata)) \ + cx->blk_loop.oldcurpad = PL_curpad; \ + if ((cx->blk_loop.iterdata = (idata))) \ cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); #else # define CxITERVAR(c) ((c)->blk_loop.itervar) # define CX_ITERDATA_SET(cx,ivar) \ - if (cx->blk_loop.itervar = (SV**)(ivar)) \ + if ((cx->blk_loop.itervar = (SV**)(ivar))) \ cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); #endif @@ -356,6 +363,7 @@ struct context { /* private flags for CXt_EVAL */ #define CXp_REAL 0x00000100 /* truly eval'', not a lookalike */ +#define CXp_TRYBLOCK 0x00000200 /* eval{}, not eval'' or similar */ #ifdef USE_ITHREADS /* private flags for CXt_LOOP */ @@ -369,10 +377,42 @@ struct context { #define CxTYPE(c) ((c)->cx_type & CXTYPEMASK) #define CxREALEVAL(c) (((c)->cx_type & (CXt_EVAL|CXp_REAL)) \ == (CXt_EVAL|CXp_REAL)) +#define CxTRYBLOCK(c) (((c)->cx_type & (CXt_EVAL|CXp_TRYBLOCK)) \ + == (CXt_EVAL|CXp_TRYBLOCK)) #define CXINC (cxstack_ix < cxstack_max ? ++cxstack_ix : (cxstack_ix = cxinc())) /* "gimme" values */ + +/* +=for apidoc AmU||G_SCALAR +Used to indicate scalar context. See C, C, and +L. + +=for apidoc AmU||G_ARRAY +Used to indicate array context. See C, C and +L. + +=for apidoc AmU||G_VOID +Used to indicate void context. See C and L. + +=for apidoc AmU||G_DISCARD +Indicates that arguments returned from a callback should be discarded. See +L. + +=for apidoc AmU||G_EVAL + +Used to force a Perl C wrapper around a callback. See +L. + +=for apidoc AmU||G_NOARGS + +Indicates that no arguments are being sent to a callback. See +L. + +=cut +*/ + #define G_SCALAR 0 #define G_ARRAY 1 #define G_VOID 128 /* skip this bit when adding flags below */