This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
the monster cpp expression needs to be on one line to
[perl5.git] / cop.h
diff --git a/cop.h b/cop.h
index ede2fce..2f1f676 100644 (file)
--- 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
 
@@ -373,6 +378,36 @@ struct context {
 #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<GIMME_V>, C<GIMME>, and
+L<perlcall>.
+
+=for apidoc AmU||G_ARRAY
+Used to indicate array context.  See C<GIMME_V>, C<GIMME> and
+L<perlcall>.
+
+=for apidoc AmU||G_VOID
+Used to indicate void context.  See C<GIMME_V> and L<perlcall>.
+
+=for apidoc AmU||G_DISCARD
+Indicates that arguments returned from a callback should be discarded.  See
+L<perlcall>.
+
+=for apidoc AmU||G_EVAL
+
+Used to force a Perl C<eval> wrapper around a callback.  See
+L<perlcall>.
+
+=for apidoc AmU||G_NOARGS
+
+Indicates that no arguments are being sent to a callback.  See
+L<perlcall>.
+
+=cut
+*/
+
 #define G_SCALAR       0
 #define G_ARRAY                1
 #define G_VOID         128     /* skip this bit when adding flags below */