/* subroutine context */
struct block_sub {
CV * cv;
- GV * gv;
- GV * dfoutgv;
+ OP * retop; /* op to execute on exit from sub */
+ U8 hasargs;
+ U8 lval; /* XXX merge lval and hasargs? */
+ /* Above here is the same for sub and format. */
AV * savearray;
AV * argarray;
I32 olddepth;
- U8 hasargs;
- U8 lval; /* XXX merge lval and hasargs? */
PAD *oldcomppad;
+};
+
+
+/* format context */
+struct block_format {
+ CV * cv;
OP * retop; /* op to execute on exit from sub */
+ U8 hasargs;
+ U8 lval; /* XXX merge lval and hasargs? */
+ /* Above here is the same for sub and format. */
+ GV * gv;
+ GV * dfoutgv;
};
/* base for the next two macros. Don't use directly.
#define PUSHFORMAT(cx, retop) \
- cx->blk_sub.cv = cv; \
- cx->blk_sub.gv = gv; \
- cx->blk_sub.retop = (retop); \
- cx->blk_sub.hasargs = 0; \
- cx->blk_sub.dfoutgv = PL_defoutgv; \
- SvREFCNT_inc_void(cx->blk_sub.dfoutgv)
+ cx->blk_format.cv = cv; \
+ cx->blk_format.gv = gv; \
+ cx->blk_format.retop = (retop); \
+ cx->blk_format.hasargs = 0; \
+ cx->blk_format.dfoutgv = PL_defoutgv; \
+ SvREFCNT_inc_void(cx->blk_format.dfoutgv)
#define POP_SAVEARRAY() \
STMT_START { \
} STMT_END
#define POPFORMAT(cx) \
- setdefout(cx->blk_sub.dfoutgv); \
- SvREFCNT_dec(cx->blk_sub.dfoutgv);
+ setdefout(cx->blk_format.dfoutgv); \
+ SvREFCNT_dec(cx->blk_format.dfoutgv);
/* eval context */
struct block_eval {
union {
struct block_sub blku_sub;
+ struct block_format blku_format;
struct block_eval blku_eval;
struct block_loop blku_loop;
struct block_givwhen blku_givwhen;
#define blk_oldpm cx_u.cx_blk.blku_oldpm
#define blk_gimme cx_u.cx_blk.blku_gimme
#define blk_sub cx_u.cx_blk.blk_u.blku_sub
+#define blk_format cx_u.cx_blk.blk_u.blku_format
#define blk_eval cx_u.cx_blk.blk_u.blku_eval
#define blk_loop cx_u.cx_blk.blk_u.blku_loop
#define blk_givwhen cx_u.cx_blk.blk_u.blku_givwhen
PP(pp_leavewrite)
{
dVAR; dSP;
- GV * const gv = cxstack[cxstack_ix].blk_sub.gv;
+ GV * const gv = cxstack[cxstack_ix].blk_format.gv;
register IO * const io = GvIOp(gv);
PerlIO *ofp;
PerlIO *fp;
case CXt_BLOCK:
break;
case CXt_FORMAT:
- PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
- PTR2UV(cx->blk_sub.cv));
- PerlIO_printf(Perl_debug_log, "BLK_SUB.GV = 0x%"UVxf"\n",
- PTR2UV(cx->blk_sub.gv));
- PerlIO_printf(Perl_debug_log, "BLK_SUB.DFOUTGV = 0x%"UVxf"\n",
- PTR2UV(cx->blk_sub.dfoutgv));
- PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
- (int)cx->blk_sub.hasargs);
- PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n",
- PTR2UV(cx->blk_sub.retop));
+ PerlIO_printf(Perl_debug_log, "BLK_FORMAT.CV = 0x%"UVxf"\n",
+ PTR2UV(cx->blk_format.cv));
+ PerlIO_printf(Perl_debug_log, "BLK_FORMAT.GV = 0x%"UVxf"\n",
+ PTR2UV(cx->blk_format.gv));
+ PerlIO_printf(Perl_debug_log, "BLK_FORMAT.DFOUTGV = 0x%"UVxf"\n",
+ PTR2UV(cx->blk_format.dfoutgv));
+ PerlIO_printf(Perl_debug_log, "BLK_FORMAT.HASARGS = %d\n",
+ (int)cx->blk_format.hasargs);
+ PerlIO_printf(Perl_debug_log, "BLK_FORMAT.RETOP = 0x%"UVxf"\n",
+ PTR2UV(cx->blk_format.retop));
break;
case CXt_SUB:
PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
param);
break;
case CXt_FORMAT:
- ncx->blk_sub.cv = cv_dup(ncx->blk_sub.cv, param);
- ncx->blk_sub.gv = gv_dup(ncx->blk_sub.gv, param);
- ncx->blk_sub.dfoutgv = gv_dup_inc(ncx->blk_sub.dfoutgv,
+ ncx->blk_format.cv = cv_dup(ncx->blk_format.cv, param);
+ ncx->blk_format.gv = gv_dup(ncx->blk_format.gv, param);
+ ncx->blk_format.dfoutgv = gv_dup_inc(ncx->blk_format.dfoutgv,
param);
break;
case CXt_BLOCK: