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