X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=cop.h;h=5dd937e7d4a1b306dc8146c9b9b29ec3dcb319ba;hb=8c99d73ee7ce90de2561496f683f3850d1269e1d;hp=ede2fce591bf177cec85dc707f0bbfad712ce68f;hpb=146174a91a192983720a158796dc066226ad0e55;p=p5sagit%2Fp5-mst-13.2.git diff --git a/cop.h b/cop.h index ede2fce..5dd937e 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 { @@ -194,12 +199,12 @@ struct block_loop { : &GvSV((GV*)(c)->blk_loop.iterdata)) \ : (SV**)NULL) # define CX_ITERDATA_SET(cx,idata) \ - if (cx->blk_loop.iterdata = (idata)) \ + 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 +361,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 +375,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 */