This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix a2p translation of '{print "a" "b" "c"}'
[perl5.git] / scope.c
CommitLineData
a0d0e21e 1/* scope.c
79072805 2 *
a0d0e21e 3 * Copyright (c) 1991-1994, Larry Wall
79072805
LW
4 *
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
7 *
a0d0e21e
LW
8 */
9
10/*
11 * "For the fashion of Minas Tirith was such that it was built on seven
12 * levels..."
79072805
LW
13 */
14
15#include "EXTERN.h"
16#include "perl.h"
17
a0d0e21e
LW
18SV**
19stack_grow(sp, p, n)
20SV** sp;
21SV** p;
22int n;
23{
24 stack_sp = sp;
1f96a9ed 25 av_extend(curstack, (p - stack_base) + (n) + 128);
a0d0e21e
LW
26 return stack_sp;
27}
28
79072805
LW
29I32
30cxinc()
31{
32 cxstack_max = cxstack_max * 3 / 2;
a38d6535 33 Renew(cxstack, cxstack_max + 1, CONTEXT); /* XXX should fix CXINC macro */
79072805
LW
34 return cxstack_ix + 1;
35}
36
37void
38push_return(retop)
39OP *retop;
40{
41 if (retstack_ix == retstack_max) {
42 retstack_max = retstack_max * 3 / 2;
43 Renew(retstack, retstack_max, OP*);
44 }
45 retstack[retstack_ix++] = retop;
46}
47
48OP *
49pop_return()
50{
51 if (retstack_ix > 0)
52 return retstack[--retstack_ix];
53 else
54 return Nullop;
55}
56
57void
58push_scope()
59{
60 if (scopestack_ix == scopestack_max) {
61 scopestack_max = scopestack_max * 3 / 2;
62 Renew(scopestack, scopestack_max, I32);
63 }
64 scopestack[scopestack_ix++] = savestack_ix;
65
66}
67
68void
69pop_scope()
70{
71 I32 oldsave = scopestack[--scopestack_ix];
8990e307 72 LEAVE_SCOPE(oldsave);
79072805
LW
73}
74
75void
a0d0e21e
LW
76markstack_grow()
77{
78 I32 oldmax = markstack_max - markstack;
79 I32 newmax = oldmax * 3 / 2;
80
81 Renew(markstack, newmax, I32);
82 markstack_ptr = markstack + oldmax;
83 markstack_max = markstack + newmax;
84}
85
86void
79072805
LW
87savestack_grow()
88{
89 savestack_max = savestack_max * 3 / 2;
90 Renew(savestack, savestack_max, ANY);
91}
92
93void
94free_tmps()
95{
96 /* XXX should tmps_floor live in cxstack? */
97 I32 myfloor = tmps_floor;
98 while (tmps_ix > myfloor) { /* clean up after last statement */
99 SV* sv = tmps_stack[tmps_ix];
100 tmps_stack[tmps_ix--] = Nullsv;
463ee0b2
LW
101 if (sv) {
102#ifdef DEBUGGING
103 SvTEMP_off(sv);
104#endif
8990e307 105 SvREFCNT_dec(sv); /* note, can modify tmps_ix!!! */
463ee0b2 106 }
79072805
LW
107 }
108}
109
110SV *
111save_scalar(gv)
112GV *gv;
113{
114 register SV *sv;
115 SV *osv = GvSV(gv);
116
117 SSCHECK(3);
118 SSPUSHPTR(gv);
119 SSPUSHPTR(osv);
120 SSPUSHINT(SAVEt_SV);
121
122 sv = GvSV(gv) = NEWSV(0,0);
a0d0e21e 123 if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv) && SvTYPE(osv) != SVt_PVGV) {
79072805 124 sv_upgrade(sv, SvTYPE(osv));
a0d0e21e 125 if (SvGMAGICAL(osv)) {
748a9306
LW
126 MAGIC* mg;
127 bool oldtainted = tainted;
a0d0e21e 128 mg_get(osv);
748a9306
LW
129 if (tainting && tainted && (mg = mg_find(osv, 't'))) {
130 SAVESPTR(mg->mg_obj);
131 mg->mg_obj = osv;
132 }
a0d0e21e
LW
133 SvFLAGS(osv) |= (SvFLAGS(osv) &
134 (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
748a9306 135 tainted = oldtainted;
a0d0e21e 136 }
79072805 137 SvMAGIC(sv) = SvMAGIC(osv);
a0d0e21e 138 SvFLAGS(sv) |= SvMAGICAL(osv);
748a9306 139 localizing = 1;
79072805 140 SvSETMAGIC(sv);
748a9306 141 localizing = 0;
79072805
LW
142 }
143 return sv;
144}
145
146#ifdef INLINED_ELSEWHERE
147void
148save_gp(gv)
149GV *gv;
150{
151 register GP *gp;
152 GP *ogp = GvGP(gv);
153
154 SSCHECK(3);
4633a7c4 155 SSPUSHPTR(SvREFCNT_inc(gv));
79072805
LW
156 SSPUSHPTR(ogp);
157 SSPUSHINT(SAVEt_GP);
158
159 Newz(602,gp, 1, GP);
160 GvGP(gv) = gp;
161 GvREFCNT(gv) = 1;
162 GvSV(gv) = NEWSV(72,0);
163 GvLINE(gv) = curcop->cop_line;
164 GvEGV(gv) = gv;
165}
166#endif
167
168SV*
169save_svref(sptr)
170SV **sptr;
171{
172 register SV *sv;
173 SV *osv = *sptr;
174
175 SSCHECK(3);
176 SSPUSHPTR(*sptr);
177 SSPUSHPTR(sptr);
178 SSPUSHINT(SAVEt_SVREF);
179
180 sv = *sptr = NEWSV(0,0);
a0d0e21e 181 if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv) && SvTYPE(osv) != SVt_PVGV) {
79072805 182 sv_upgrade(sv, SvTYPE(osv));
a0d0e21e 183 if (SvGMAGICAL(osv)) {
748a9306
LW
184 MAGIC* mg;
185 bool oldtainted = tainted;
a0d0e21e 186 mg_get(osv);
748a9306
LW
187 if (tainting && tainted && (mg = mg_find(osv, 't'))) {
188 SAVESPTR(mg->mg_obj);
189 mg->mg_obj = osv;
190 }
a0d0e21e
LW
191 SvFLAGS(osv) |= (SvFLAGS(osv) &
192 (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
748a9306 193 tainted = oldtainted;
a0d0e21e 194 }
79072805 195 SvMAGIC(sv) = SvMAGIC(osv);
a0d0e21e 196 SvFLAGS(sv) |= SvMAGICAL(osv);
748a9306 197 localizing = 1;
79072805 198 SvSETMAGIC(sv);
748a9306 199 localizing = 0;
79072805
LW
200 }
201 return sv;
202}
203
204AV *
205save_ary(gv)
206GV *gv;
207{
208 SSCHECK(3);
209 SSPUSHPTR(gv);
210 SSPUSHPTR(GvAVn(gv));
211 SSPUSHINT(SAVEt_AV);
212
213 GvAV(gv) = Null(AV*);
214 return GvAVn(gv);
215}
216
217HV *
218save_hash(gv)
219GV *gv;
220{
221 SSCHECK(3);
222 SSPUSHPTR(gv);
223 SSPUSHPTR(GvHVn(gv));
224 SSPUSHINT(SAVEt_HV);
225
226 GvHV(gv) = Null(HV*);
227 return GvHVn(gv);
228}
229
230void
231save_item(item)
232register SV *item;
233{
234 register SV *sv;
235
236 SSCHECK(3);
237 SSPUSHPTR(item); /* remember the pointer */
238 sv = NEWSV(0,0);
239 sv_setsv(sv,item);
240 SSPUSHPTR(sv); /* remember the value */
241 SSPUSHINT(SAVEt_ITEM);
242}
243
244void
245save_int(intp)
246int *intp;
247{
248 SSCHECK(3);
249 SSPUSHINT(*intp);
250 SSPUSHPTR(intp);
251 SSPUSHINT(SAVEt_INT);
252}
253
254void
85e6fe83
LW
255save_long(longp)
256long *longp;
257{
258 SSCHECK(3);
259 SSPUSHLONG(*longp);
260 SSPUSHPTR(longp);
261 SSPUSHINT(SAVEt_LONG);
262}
263
264void
79072805
LW
265save_I32(intp)
266I32 *intp;
267{
268 SSCHECK(3);
269 SSPUSHINT(*intp);
270 SSPUSHPTR(intp);
271 SSPUSHINT(SAVEt_I32);
272}
273
a0d0e21e
LW
274void
275save_iv(ivp)
276IV *ivp;
277{
278 SSCHECK(3);
4aa0a1f7 279 SSPUSHIV(*ivp);
a0d0e21e
LW
280 SSPUSHPTR(ivp);
281 SSPUSHINT(SAVEt_IV);
282}
283
85e6fe83
LW
284/* Cannot use save_sptr() to store a char* since the SV** cast will
285 * force word-alignment and we'll miss the pointer.
286 */
287void
288save_pptr(pptr)
289char **pptr;
290{
291 SSCHECK(3);
292 SSPUSHPTR(*pptr);
293 SSPUSHPTR(pptr);
294 SSPUSHINT(SAVEt_PPTR);
295}
296
79072805
LW
297void
298save_sptr(sptr)
299SV **sptr;
300{
301 SSCHECK(3);
302 SSPUSHPTR(*sptr);
303 SSPUSHPTR(sptr);
304 SSPUSHINT(SAVEt_SPTR);
305}
306
307void
308save_nogv(gv)
309GV *gv;
310{
311 SSCHECK(2);
312 SSPUSHPTR(gv);
313 SSPUSHINT(SAVEt_NSTAB);
314}
315
316void
317save_hptr(hptr)
318HV **hptr;
319{
320 SSCHECK(3);
85e6fe83 321 SSPUSHPTR(*hptr);
79072805
LW
322 SSPUSHPTR(hptr);
323 SSPUSHINT(SAVEt_HPTR);
324}
325
326void
327save_aptr(aptr)
328AV **aptr;
329{
330 SSCHECK(3);
85e6fe83 331 SSPUSHPTR(*aptr);
79072805
LW
332 SSPUSHPTR(aptr);
333 SSPUSHINT(SAVEt_APTR);
334}
335
336void
8990e307
LW
337save_freesv(sv)
338SV *sv;
339{
340 SSCHECK(2);
341 SSPUSHPTR(sv);
342 SSPUSHINT(SAVEt_FREESV);
343}
344
345void
346save_freeop(op)
347OP *op;
348{
349 SSCHECK(2);
350 SSPUSHPTR(op);
351 SSPUSHINT(SAVEt_FREEOP);
352}
353
354void
355save_freepv(pv)
356char *pv;
357{
358 SSCHECK(2);
359 SSPUSHPTR(pv);
360 SSPUSHINT(SAVEt_FREEPV);
361}
362
363void
364save_clearsv(svp)
365SV** svp;
366{
367 SSCHECK(2);
4aa0a1f7 368 SSPUSHLONG((long)(svp-curpad));
8990e307
LW
369 SSPUSHINT(SAVEt_CLEARSV);
370}
371
372void
373save_delete(hv,key,klen)
374HV *hv;
375char *key;
376I32 klen;
377{
378 SSCHECK(4);
379 SSPUSHINT(klen);
380 SSPUSHPTR(key);
381 SSPUSHPTR(hv);
382 SSPUSHINT(SAVEt_DELETE);
383}
384
385void
79072805
LW
386save_list(sarg,maxsarg)
387register SV **sarg;
388I32 maxsarg;
389{
390 register SV *sv;
391 register I32 i;
392
393 SSCHECK(3 * maxsarg);
394 for (i = 1; i <= maxsarg; i++) {
395 SSPUSHPTR(sarg[i]); /* remember the pointer */
396 sv = NEWSV(0,0);
397 sv_setsv(sv,sarg[i]);
398 SSPUSHPTR(sv); /* remember the value */
399 SSPUSHINT(SAVEt_ITEM);
400 }
401}
402
403void
a0d0e21e
LW
404save_destructor(f,p)
405void (*f) _((void*));
406void* p;
407{
408 SSCHECK(3);
409 SSPUSHDPTR(f);
410 SSPUSHPTR(p);
411 SSPUSHINT(SAVEt_DESTRUCTOR);
412}
413
414void
79072805
LW
415leave_scope(base)
416I32 base;
417{
418 register SV *sv;
419 register SV *value;
420 register GV *gv;
421 register AV *av;
422 register HV *hv;
423 register void* ptr;
424
425 if (base < -1)
463ee0b2 426 croak("panic: corrupt saved stack index");
79072805
LW
427 while (savestack_ix > base) {
428 switch (SSPOPINT) {
429 case SAVEt_ITEM: /* normal string */
430 value = (SV*)SSPOPPTR;
431 sv = (SV*)SSPOPPTR;
432 sv_replace(sv,value);
748a9306 433 localizing = 2;
79072805 434 SvSETMAGIC(sv);
748a9306 435 localizing = 0;
79072805
LW
436 break;
437 case SAVEt_SV: /* scalar reference */
438 value = (SV*)SSPOPPTR;
439 gv = (GV*)SSPOPPTR;
440 sv = GvSV(gv);
748a9306
LW
441 if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv) &&
442 SvTYPE(sv) != SVt_PVGV)
443 {
a0d0e21e 444 (void)SvUPGRADE(value, SvTYPE(sv));
85e6fe83 445 SvMAGIC(value) = SvMAGIC(sv);
a0d0e21e
LW
446 SvFLAGS(value) |= SvMAGICAL(sv);
447 SvMAGICAL_off(sv);
79072805 448 SvMAGIC(sv) = 0;
85e6fe83 449 }
8990e307 450 SvREFCNT_dec(sv);
a0d0e21e 451 GvSV(gv) = value;
748a9306 452 localizing = 2;
a0d0e21e 453 SvSETMAGIC(value);
748a9306 454 localizing = 0;
79072805
LW
455 break;
456 case SAVEt_SVREF: /* scalar reference */
457 ptr = SSPOPPTR;
458 sv = *(SV**)ptr;
a0d0e21e 459 value = (SV*)SSPOPPTR;
748a9306
LW
460 if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv) &&
461 SvTYPE(sv) != SVt_PVGV)
462 {
a0d0e21e
LW
463 (void)SvUPGRADE(value, SvTYPE(sv));
464 SvMAGIC(value) = SvMAGIC(sv);
465 SvFLAGS(value) |= SvMAGICAL(sv);
466 SvMAGICAL_off(sv);
79072805 467 SvMAGIC(sv) = 0;
a0d0e21e 468 }
8990e307 469 SvREFCNT_dec(sv);
a0d0e21e 470 *(SV**)ptr = value;
748a9306 471 localizing = 2;
a0d0e21e 472 SvSETMAGIC(value);
748a9306 473 localizing = 0;
79072805
LW
474 break;
475 case SAVEt_AV: /* array reference */
476 av = (AV*)SSPOPPTR;
477 gv = (GV*)SSPOPPTR;
8990e307 478 SvREFCNT_dec(GvAV(gv));
79072805
LW
479 GvAV(gv) = av;
480 break;
481 case SAVEt_HV: /* hash reference */
482 hv = (HV*)SSPOPPTR;
483 gv = (GV*)SSPOPPTR;
8990e307 484 SvREFCNT_dec(GvHV(gv));
79072805
LW
485 GvHV(gv) = hv;
486 break;
487 case SAVEt_INT: /* int reference */
488 ptr = SSPOPPTR;
489 *(int*)ptr = (int)SSPOPINT;
490 break;
85e6fe83
LW
491 case SAVEt_LONG: /* long reference */
492 ptr = SSPOPPTR;
493 *(long*)ptr = (long)SSPOPLONG;
494 break;
79072805
LW
495 case SAVEt_I32: /* I32 reference */
496 ptr = SSPOPPTR;
497 *(I32*)ptr = (I32)SSPOPINT;
498 break;
a0d0e21e
LW
499 case SAVEt_IV: /* IV reference */
500 ptr = SSPOPPTR;
501 *(IV*)ptr = (IV)SSPOPIV;
502 break;
79072805
LW
503 case SAVEt_SPTR: /* SV* reference */
504 ptr = SSPOPPTR;
505 *(SV**)ptr = (SV*)SSPOPPTR;
506 break;
85e6fe83
LW
507 case SAVEt_PPTR: /* char* reference */
508 ptr = SSPOPPTR;
509 *(char**)ptr = (char*)SSPOPPTR;
510 break;
79072805
LW
511 case SAVEt_HPTR: /* HV* reference */
512 ptr = SSPOPPTR;
513 *(HV**)ptr = (HV*)SSPOPPTR;
514 break;
515 case SAVEt_APTR: /* AV* reference */
516 ptr = SSPOPPTR;
517 *(AV**)ptr = (AV*)SSPOPPTR;
518 break;
519 case SAVEt_NSTAB:
520 gv = (GV*)SSPOPPTR;
1f96a9ed 521 (void)sv_clear((SV*)gv);
79072805
LW
522 break;
523 case SAVEt_GP: /* scalar reference */
524 ptr = SSPOPPTR;
525 gv = (GV*)SSPOPPTR;
526 gp_free(gv);
527 GvGP(gv) = (GP*)ptr;
4633a7c4 528 SvREFCNT_dec(gv);
79072805 529 break;
8990e307
LW
530 case SAVEt_FREESV:
531 ptr = SSPOPPTR;
532 SvREFCNT_dec((SV*)ptr);
533 break;
534 case SAVEt_FREEOP:
535 ptr = SSPOPPTR;
536 curpad = AvARRAY(comppad);
537 op_free((OP*)ptr);
538 break;
539 case SAVEt_FREEPV:
540 ptr = SSPOPPTR;
541 Safefree((char*)ptr);
542 break;
543 case SAVEt_CLEARSV:
4aa0a1f7 544 ptr = (void*)&curpad[SSPOPLONG];
8990e307 545 sv = *(SV**)ptr;
a0d0e21e 546 if (SvREFCNT(sv) <= 1) { /* Can clear pad variable in place. */
8990e307
LW
547 if (SvTHINKFIRST(sv)) {
548 if (SvREADONLY(sv))
549 croak("panic: leave_scope clearsv");
550 if (SvROK(sv))
551 sv_unref(sv);
552 }
a0d0e21e
LW
553 if (SvMAGICAL(sv))
554 mg_free(sv);
8990e307
LW
555
556 switch (SvTYPE(sv)) {
557 case SVt_NULL:
558 break;
559 case SVt_PVAV:
560 av_clear((AV*)sv);
561 break;
562 case SVt_PVHV:
563 hv_clear((HV*)sv);
564 break;
565 case SVt_PVCV:
566 sub_generation++;
85e6fe83 567 cv_undef((CV*)sv);
8990e307
LW
568 break;
569 default:
570 if (SvPOK(sv) && SvLEN(sv))
a0d0e21e
LW
571 (void)SvOOK_off(sv);
572 (void)SvOK_off(sv);
8990e307
LW
573 break;
574 }
575 }
576 else { /* Someone has a claim on this, so abandon it. */
4aa0a1f7 577 U32 padflags = SvFLAGS(sv) & (SVs_PADBUSY|SVs_PADMY|SVs_PADTMP);
8990e307
LW
578 SvREFCNT_dec(sv); /* Cast current value to the winds. */
579 switch (SvTYPE(sv)) { /* Console ourselves with a new value */
580 case SVt_PVAV: *(SV**)ptr = (SV*)newAV(); break;
581 case SVt_PVHV: *(SV**)ptr = (SV*)newHV(); break;
582 default: *(SV**)ptr = NEWSV(0,0); break;
583 }
4aa0a1f7 584 SvFLAGS(*(SV**)ptr) |= padflags; /* preserve pad nature */
8990e307
LW
585 }
586 break;
587 case SAVEt_DELETE:
588 ptr = SSPOPPTR;
589 hv = (HV*)ptr;
590 ptr = SSPOPPTR;
748a9306 591 (void)hv_delete(hv, (char*)ptr, (U32)SSPOPINT, G_DISCARD);
adbc6bb1 592 Safefree(ptr);
8990e307 593 break;
a0d0e21e
LW
594 case SAVEt_DESTRUCTOR:
595 ptr = SSPOPPTR;
596 (*SSPOPDPTR)(ptr);
597 break;
598 case SAVEt_REGCONTEXT:
8e07c86e
AD
599 {
600 I32 delta = SSPOPINT;
601 savestack_ix -= delta; /* regexp must have croaked */
602 }
a0d0e21e 603 break;
79072805 604 default:
463ee0b2 605 croak("panic: leave_scope inconsistency");
79072805
LW
606 }
607 }
608}
8990e307
LW
609
610#ifdef DEBUGGING
1f96a9ed 611
8990e307
LW
612void
613cx_dump(cx)
614CONTEXT* cx;
615{
760ac839 616 PerlIO_printf(Perl_debug_log, "CX %d = %s\n", cx - cxstack, block_type[cx->cx_type]);
8990e307 617 if (cx->cx_type != CXt_SUBST) {
760ac839
LW
618 PerlIO_printf(Perl_debug_log, "BLK_OLDSP = %ld\n", (long)cx->blk_oldsp);
619 PerlIO_printf(Perl_debug_log, "BLK_OLDCOP = 0x%lx\n", (long)cx->blk_oldcop);
620 PerlIO_printf(Perl_debug_log, "BLK_OLDMARKSP = %ld\n", (long)cx->blk_oldmarksp);
621 PerlIO_printf(Perl_debug_log, "BLK_OLDSCOPESP = %ld\n", (long)cx->blk_oldscopesp);
622 PerlIO_printf(Perl_debug_log, "BLK_OLDRETSP = %ld\n", (long)cx->blk_oldretsp);
623 PerlIO_printf(Perl_debug_log, "BLK_OLDPM = 0x%lx\n", (long)cx->blk_oldpm);
624 PerlIO_printf(Perl_debug_log, "BLK_GIMME = %s\n", cx->blk_gimme ? "LIST" : "SCALAR");
8990e307
LW
625 }
626 switch (cx->cx_type) {
627 case CXt_NULL:
628 case CXt_BLOCK:
629 break;
630 case CXt_SUB:
760ac839 631 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%lx\n",
8990e307 632 (long)cx->blk_sub.cv);
760ac839 633 PerlIO_printf(Perl_debug_log, "BLK_SUB.GV = 0x%lx\n",
8990e307 634 (long)cx->blk_sub.gv);
760ac839 635 PerlIO_printf(Perl_debug_log, "BLK_SUB.DFOUTGV = 0x%lx\n",
8990e307 636 (long)cx->blk_sub.dfoutgv);
760ac839 637 PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n",
8990e307 638 (long)cx->blk_sub.olddepth);
760ac839 639 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
8990e307
LW
640 (int)cx->blk_sub.hasargs);
641 break;
642 case CXt_EVAL:
760ac839 643 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_IN_EVAL = %ld\n",
8990e307 644 (long)cx->blk_eval.old_in_eval);
760ac839 645 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_OP_TYPE = %s (%s)\n",
c07a80fd
PP
646 op_name[cx->blk_eval.old_op_type],
647 op_desc[cx->blk_eval.old_op_type]);
760ac839 648 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_NAME = %s\n",
8990e307 649 cx->blk_eval.old_name);
760ac839 650 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_EVAL_ROOT = 0x%lx\n",
8990e307
LW
651 (long)cx->blk_eval.old_eval_root);
652 break;
653
654 case CXt_LOOP:
760ac839 655 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LABEL = %s\n",
8990e307 656 cx->blk_loop.label);
760ac839 657 PerlIO_printf(Perl_debug_log, "BLK_LOOP.RESETSP = %ld\n",
8990e307 658 (long)cx->blk_loop.resetsp);
760ac839 659 PerlIO_printf(Perl_debug_log, "BLK_LOOP.REDO_OP = 0x%lx\n",
8990e307 660 (long)cx->blk_loop.redo_op);
760ac839 661 PerlIO_printf(Perl_debug_log, "BLK_LOOP.NEXT_OP = 0x%lx\n",
8990e307 662 (long)cx->blk_loop.next_op);
760ac839 663 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LAST_OP = 0x%lx\n",
8990e307 664 (long)cx->blk_loop.last_op);
760ac839 665 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERIX = %ld\n",
8990e307 666 (long)cx->blk_loop.iterix);
760ac839 667 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERARY = 0x%lx\n",
8990e307 668 (long)cx->blk_loop.iterary);
760ac839 669 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERVAR = 0x%lx\n",
8990e307
LW
670 (long)cx->blk_loop.itervar);
671 if (cx->blk_loop.itervar)
760ac839 672 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERSAVE = 0x%lx\n",
8990e307
LW
673 (long)cx->blk_loop.itersave);
674 break;
675
676 case CXt_SUBST:
760ac839 677 PerlIO_printf(Perl_debug_log, "SB_ITERS = %ld\n",
8990e307 678 (long)cx->sb_iters);
760ac839 679 PerlIO_printf(Perl_debug_log, "SB_MAXITERS = %ld\n",
8990e307 680 (long)cx->sb_maxiters);
760ac839 681 PerlIO_printf(Perl_debug_log, "SB_SAFEBASE = %ld\n",
8990e307 682 (long)cx->sb_safebase);
760ac839 683 PerlIO_printf(Perl_debug_log, "SB_ONCE = %ld\n",
8990e307 684 (long)cx->sb_once);
760ac839 685 PerlIO_printf(Perl_debug_log, "SB_ORIG = %s\n",
8990e307 686 cx->sb_orig);
760ac839 687 PerlIO_printf(Perl_debug_log, "SB_DSTR = 0x%lx\n",
8990e307 688 (long)cx->sb_dstr);
760ac839 689 PerlIO_printf(Perl_debug_log, "SB_TARG = 0x%lx\n",
8990e307 690 (long)cx->sb_targ);
760ac839 691 PerlIO_printf(Perl_debug_log, "SB_S = 0x%lx\n",
8990e307 692 (long)cx->sb_s);
760ac839 693 PerlIO_printf(Perl_debug_log, "SB_M = 0x%lx\n",
8990e307 694 (long)cx->sb_m);
760ac839 695 PerlIO_printf(Perl_debug_log, "SB_STREND = 0x%lx\n",
8990e307 696 (long)cx->sb_strend);
760ac839 697 PerlIO_printf(Perl_debug_log, "SB_SUBBASE = 0x%lx\n",
8990e307
LW
698 (long)cx->sb_subbase);
699 break;
700 }
701}
702#endif