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