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