3 * Copyright (c) 1991-1997, Larry Wall
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.
11 * Now far ahead the Road has gone,
12 * And I must follow, if I can,
13 * Pursuing it with eager feet,
14 * Until it joins some larger way
15 * Where many paths and errands meet.
16 * And whither then? I cannot say.
23 #define WORD_ALIGN sizeof(U16)
26 #define DOCATCH(o) ((CATCH_GET == TRUE) ? docatch(o) : (o))
28 static OP *docatch _((OP *o));
29 static OP *doeval _((int gimme));
30 static OP *dofindlabel _((OP *op, char *label, OP **opstack, OP **oplimit));
31 static void doparseform _((SV *sv));
32 static I32 dopoptoeval _((I32 startingblock));
33 static I32 dopoptolabel _((char *label));
34 static I32 dopoptoloop _((I32 startingblock));
35 static I32 dopoptosub _((I32 startingblock));
36 static void save_lines _((AV *array, SV *sv));
37 static int sortcv _((const void *, const void *));
38 static int sortcmp _((const void *, const void *));
39 static int sortcmp_locale _((const void *, const void *));
49 cxix = dopoptosub(cxstack_ix);
53 switch (cxstack[cxix].blk_gimme) {
70 register PMOP *pm = (PMOP*)cLOGOP->op_other;
76 t = SvPV(tmpstr, len);
78 /* JMR: Check against the last compiled regexp */
79 if ( ! pm->op_pmregexp || ! pm->op_pmregexp->precomp
80 || strnNE(pm->op_pmregexp->precomp, t, len)
81 || pm->op_pmregexp->precomp[len]) {
82 if (pm->op_pmregexp) {
83 pregfree(pm->op_pmregexp);
84 pm->op_pmregexp = Null(REGEXP*); /* crucial if regcomp aborts */
87 pm->op_pmflags = pm->op_pmpermflags; /* reset case sensitivity */
88 pm->op_pmregexp = pregcomp(t, t + len, pm);
91 if (!pm->op_pmregexp->prelen && curpm)
93 else if (strEQ("\\s+", pm->op_pmregexp->precomp))
94 pm->op_pmflags |= PMf_WHITE;
96 if (pm->op_pmflags & PMf_KEEP) {
97 pm->op_private &= ~OPpRUNTIME; /* no point compiling again */
99 cLOGOP->op_first->op_next = op->op_next;
107 register PMOP *pm = (PMOP*) cLOGOP->op_other;
108 register CONTEXT *cx = &cxstack[cxstack_ix];
109 register SV *dstr = cx->sb_dstr;
110 register char *s = cx->sb_s;
111 register char *m = cx->sb_m;
112 char *orig = cx->sb_orig;
113 register REGEXP *rx = cx->sb_rx;
115 rxres_restore(&cx->sb_rxres, rx);
117 if (cx->sb_iters++) {
118 if (cx->sb_iters > cx->sb_maxiters)
119 DIE("Substitution loop");
121 if (!cx->sb_rxtainted)
122 cx->sb_rxtainted = SvTAINTED(TOPs);
123 sv_catsv(dstr, POPs);
126 if (cx->sb_once || !pregexec(rx, s, cx->sb_strend, orig,
127 s == m, Nullsv, cx->sb_safebase))
129 SV *targ = cx->sb_targ;
130 sv_catpvn(dstr, s, cx->sb_strend - s);
132 TAINT_IF(cx->sb_rxtainted || rx->exec_tainted);
134 (void)SvOOK_off(targ);
135 Safefree(SvPVX(targ));
136 SvPVX(targ) = SvPVX(dstr);
137 SvCUR_set(targ, SvCUR(dstr));
138 SvLEN_set(targ, SvLEN(dstr));
141 (void)SvPOK_only(targ);
145 PUSHs(sv_2mortal(newSViv((I32)cx->sb_iters - 1)));
146 LEAVE_SCOPE(cx->sb_oldsave);
148 RETURNOP(pm->op_next);
151 if (rx->subbase && rx->subbase != orig) {
154 cx->sb_orig = orig = rx->subbase;
156 cx->sb_strend = s + (cx->sb_strend - m);
158 cx->sb_m = m = rx->startp[0];
159 sv_catpvn(dstr, s, m-s);
160 cx->sb_s = rx->endp[0];
161 cx->sb_rxtainted |= rx->exec_tainted;
162 rxres_save(&cx->sb_rxres, rx);
163 RETURNOP(pm->op_pmreplstart);
174 if (!p || p[1] < rx->nparens) {
175 i = 6 + rx->nparens * 2;
183 *p++ = (UV)rx->subbase;
184 rx->subbase = Nullch;
188 *p++ = (UV)rx->subbeg;
189 *p++ = (UV)rx->subend;
190 for (i = 0; i <= rx->nparens; ++i) {
191 *p++ = (UV)rx->startp[i];
192 *p++ = (UV)rx->endp[i];
197 rxres_restore(rsp, rx)
204 Safefree(rx->subbase);
205 rx->subbase = (char*)(*p);
210 rx->subbeg = (char*)(*p++);
211 rx->subend = (char*)(*p++);
212 for (i = 0; i <= rx->nparens; ++i) {
213 rx->startp[i] = (char*)(*p++);
214 rx->endp[i] = (char*)(*p++);
225 Safefree((char*)(*p));
233 dSP; dMARK; dORIGMARK;
234 register SV *form = *++MARK;
246 bool chopspace = (strchr(chopset, ' ') != Nullch);
253 if (!SvMAGICAL(form) || !SvCOMPILED(form)) {
254 SvREADONLY_off(form);
258 SvPV_force(formtarget, len);
259 t = SvGROW(formtarget, len + SvCUR(form) + 1); /* XXX SvCUR bad */
262 /* need to jump to the next word */
263 s = f + len + WORD_ALIGN - SvCUR(form) % WORD_ALIGN;
272 case FF_LITERAL: arg = fpc[1]; name = "LITERAL"; break;
273 case FF_BLANK: arg = fpc[1]; name = "BLANK"; break;
274 case FF_SKIP: arg = fpc[1]; name = "SKIP"; break;
275 case FF_FETCH: arg = fpc[1]; name = "FETCH"; break;
276 case FF_DECIMAL: arg = fpc[1]; name = "DECIMAL"; break;
278 case FF_CHECKNL: name = "CHECKNL"; break;
279 case FF_CHECKCHOP: name = "CHECKCHOP"; break;
280 case FF_SPACE: name = "SPACE"; break;
281 case FF_HALFSPACE: name = "HALFSPACE"; break;
282 case FF_ITEM: name = "ITEM"; break;
283 case FF_CHOP: name = "CHOP"; break;
284 case FF_LINEGLOB: name = "LINEGLOB"; break;
285 case FF_NEWLINE: name = "NEWLINE"; break;
286 case FF_MORE: name = "MORE"; break;
287 case FF_LINEMARK: name = "LINEMARK"; break;
288 case FF_END: name = "END"; break;
291 PerlIO_printf(PerlIO_stderr(), "%-16s%ld\n", name, (long) arg);
293 PerlIO_printf(PerlIO_stderr(), "%-16s\n", name);
322 warn("Not enough format arguments");
327 item = s = SvPV(sv, len);
329 if (itemsize > fieldsize)
330 itemsize = fieldsize;
331 send = chophere = s + itemsize;
343 item = s = SvPV(sv, len);
345 if (itemsize <= fieldsize) {
346 send = chophere = s + itemsize;
357 itemsize = fieldsize;
358 send = chophere = s + itemsize;
359 while (s < send || (s == send && isSPACE(*s))) {
369 if (strchr(chopset, *s))
374 itemsize = chophere - item;
379 arg = fieldsize - itemsize;
388 arg = fieldsize - itemsize;
402 int ch = *t++ = *s++;
406 if ( !((*t++ = *s++) & ~31) )
416 while (*s && isSPACE(*s))
423 item = s = SvPV(sv, len);
436 SvCUR_set(formtarget, t - SvPVX(formtarget));
437 sv_catpvn(formtarget, item, itemsize);
438 SvGROW(formtarget, SvCUR(formtarget) + SvCUR(form) + 1);
439 t = SvPVX(formtarget) + SvCUR(formtarget);
444 /* If the field is marked with ^ and the value is undefined,
447 if ((arg & 512) && !SvOK(sv)) {
455 /* Formats aren't yet marked for locales, so assume "yes". */
458 sprintf(t, "%#*.*f", (int) fieldsize, (int) arg & 255, value);
460 sprintf(t, "%*.0f", (int) fieldsize, value);
467 while (t-- > linemark && *t == ' ') ;
475 if (arg) { /* repeat until fields exhausted? */
477 SvCUR_set(formtarget, t - SvPVX(formtarget));
478 lines += FmLINES(formtarget);
481 if (strnEQ(linemark, linemark - arg, arg))
482 DIE("Runaway format");
484 FmLINES(formtarget) = lines;
486 RETURNOP(cLISTOP->op_first);
497 arg = fieldsize - itemsize;
504 if (strnEQ(s," ",3)) {
505 while (s > SvPVX(formtarget) && isSPACE(s[-1]))
516 SvCUR_set(formtarget, t - SvPVX(formtarget));
517 FmLINES(formtarget) += lines;
529 if (stack_base + *markstack_ptr == sp) {
531 if (GIMME_V == G_SCALAR)
533 RETURNOP(op->op_next->op_next);
535 stack_sp = stack_base + *markstack_ptr + 1;
536 pp_pushmark(); /* push dst */
537 pp_pushmark(); /* push src */
538 ENTER; /* enter outer scope */
541 SAVESPTR(GvSV(defgv));
543 ENTER; /* enter inner scope */
546 src = stack_base[*markstack_ptr];
551 if (op->op_type == OP_MAPSTART)
552 pp_pushmark(); /* push top */
553 return ((LOGOP*)op->op_next)->op_other;
558 DIE("panic: mapstart"); /* uses grepstart */
564 I32 diff = (sp - stack_base) - *markstack_ptr;
572 if (diff > markstack_ptr[-1] - markstack_ptr[-2]) {
573 shift = diff - (markstack_ptr[-1] - markstack_ptr[-2]);
574 count = (sp - stack_base) - markstack_ptr[-1] + 2;
579 markstack_ptr[-1] += shift;
580 *markstack_ptr += shift;
584 dst = stack_base + (markstack_ptr[-2] += diff) - 1;
587 *dst-- = SvTEMP(TOPs) ? POPs : sv_mortalcopy(POPs);
589 LEAVE; /* exit inner scope */
592 if (markstack_ptr[-1] > *markstack_ptr) {
596 (void)POPMARK; /* pop top */
597 LEAVE; /* exit outer scope */
598 (void)POPMARK; /* pop src */
599 items = --*markstack_ptr - markstack_ptr[-1];
600 (void)POPMARK; /* pop dst */
601 SP = stack_base + POPMARK; /* pop original mark */
602 if (gimme == G_SCALAR) {
606 else if (gimme == G_ARRAY)
613 ENTER; /* enter inner scope */
616 src = stack_base[markstack_ptr[-1]];
620 RETURNOP(cLOGOP->op_other);
627 dSP; dMARK; dORIGMARK;
629 SV **myorigmark = ORIGMARK;
635 OP* nextop = op->op_next;
637 if (gimme != G_ARRAY) {
642 if (op->op_flags & OPf_STACKED) {
644 if (op->op_flags & OPf_SPECIAL) {
645 OP *kid = cLISTOP->op_first->op_sibling; /* pass pushmark */
646 kid = kUNOP->op_first; /* pass rv2gv */
647 kid = kUNOP->op_first; /* pass leave */
648 sortcop = kid->op_next;
649 stash = curcop->cop_stash;
652 cv = sv_2cv(*++MARK, &stash, &gv, 0);
653 if (!(cv && CvROOT(cv))) {
655 SV *tmpstr = sv_newmortal();
656 gv_efullname3(tmpstr, gv, Nullch);
657 if (cv && CvXSUB(cv))
658 DIE("Xsub \"%s\" called in sort", SvPVX(tmpstr));
659 DIE("Undefined sort subroutine \"%s\" called",
664 DIE("Xsub called in sort");
665 DIE("Undefined subroutine in sort");
667 DIE("Not a CODE reference in sort");
669 sortcop = CvSTART(cv);
670 SAVESPTR(CvROOT(cv)->op_ppaddr);
671 CvROOT(cv)->op_ppaddr = ppaddr[OP_NULL];
674 curpad = AvARRAY((AV*)AvARRAY(CvPADLIST(cv))[1]);
679 stash = curcop->cop_stash;
683 while (MARK < SP) { /* This may or may not shift down one here. */
685 if (*up = *++MARK) { /* Weed out nulls. */
687 if (!sortcop && !SvPOK(*up))
688 (void)sv_2pv(*up, &na);
692 max = --up - myorigmark;
698 bool oldcatch = CATCH_GET;
706 AvREAL_off(sortstack);
707 av_extend(sortstack, 32);
710 SWITCHSTACK(curstack, sortstack);
711 if (sortstash != stash) {
712 firstgv = gv_fetchpv("a", TRUE, SVt_PV);
713 secondgv = gv_fetchpv("b", TRUE, SVt_PV);
717 SAVESPTR(GvSV(firstgv));
718 SAVESPTR(GvSV(secondgv));
720 PUSHBLOCK(cx, CXt_NULL, stack_base);
721 if (!(op->op_flags & OPf_SPECIAL)) {
722 bool hasargs = FALSE;
723 cx->cx_type = CXt_SUB;
724 cx->blk_gimme = G_SCALAR;
727 (void)SvREFCNT_inc(cv); /* in preparation for POPSUB */
729 sortcxix = cxstack_ix;
731 qsort((char*)(myorigmark+1), max, sizeof(SV*), sortcv);
734 SWITCHSTACK(sortstack, oldstack);
741 MEXTEND(SP, 20); /* Can't afford stack realloc on signal. */
742 qsort((char*)(ORIGMARK+1), max, sizeof(SV*),
743 (op->op_private & OPpLOCALE) ? sortcmp_locale : sortcmp);
746 stack_sp = ORIGMARK + max;
754 if (GIMME == G_ARRAY)
755 return cCONDOP->op_true;
756 return SvTRUEx(PAD_SV(op->op_targ)) ? cCONDOP->op_false : cCONDOP->op_true;
763 if (GIMME == G_ARRAY) {
764 RETURNOP(((CONDOP*)cUNOP->op_first)->op_false);
768 SV *targ = PAD_SV(op->op_targ);
770 if ((op->op_private & OPpFLIP_LINENUM)
771 ? last_in_gv && SvIV(sv) == IoLINES(GvIOp(last_in_gv))
773 sv_setiv(PAD_SV(cUNOP->op_first->op_targ), 1);
774 if (op->op_flags & OPf_SPECIAL) {
782 RETURNOP(((CONDOP*)cUNOP->op_first)->op_false);
795 if (GIMME == G_ARRAY) {
801 if (SvNIOKp(left) || !SvPOKp(left) ||
802 (looks_like_number(left) && *SvPVX(left) != '0') )
807 EXTEND_MORTAL(max - i + 1);
808 EXTEND(SP, max - i + 1);
811 sv = sv_2mortal(newSViv(i++));
816 SV *final = sv_mortalcopy(right);
818 char *tmps = SvPV(final, len);
820 sv = sv_mortalcopy(left);
821 while (!SvNIOKp(sv) && SvCUR(sv) <= len &&
822 strNE(SvPVX(sv),tmps) ) {
824 sv = sv_2mortal(newSVsv(sv));
827 if (strEQ(SvPVX(sv),tmps))
833 SV *targ = PAD_SV(cUNOP->op_first->op_targ);
835 if ((op->op_private & OPpFLIP_LINENUM)
836 ? last_in_gv && SvIV(sv) == IoLINES(GvIOp(last_in_gv))
838 sv_setiv(PAD_SV(((UNOP*)cUNOP->op_first)->op_first->op_targ), 0);
839 sv_catpv(targ, "E0");
854 register CONTEXT *cx;
856 for (i = cxstack_ix; i >= 0; i--) {
858 switch (cx->cx_type) {
861 warn("Exiting substitution via %s", op_name[op->op_type]);
865 warn("Exiting subroutine via %s", op_name[op->op_type]);
869 warn("Exiting eval via %s", op_name[op->op_type]);
873 warn("Exiting pseudo-block via %s", op_name[op->op_type]);
876 if (!cx->blk_loop.label ||
877 strNE(label, cx->blk_loop.label) ) {
878 DEBUG_l(deb("(Skipping label #%ld %s)\n",
879 (long)i, cx->blk_loop.label));
882 DEBUG_l( deb("(Found label #%ld %s)\n", (long)i, label));
892 I32 gimme = block_gimme();
893 return (gimme == G_VOID) ? G_SCALAR : gimme;
901 cxix = dopoptosub(cxstack_ix);
905 switch (cxstack[cxix].blk_gimme) {
913 croak("panic: bad gimme: %d\n", cxstack[cxix].blk_gimme);
918 dopoptosub(startingblock)
922 register CONTEXT *cx;
923 for (i = startingblock; i >= 0; i--) {
925 switch (cx->cx_type) {
930 DEBUG_l( deb("(Found sub #%ld)\n", (long)i));
938 dopoptoeval(startingblock)
942 register CONTEXT *cx;
943 for (i = startingblock; i >= 0; i--) {
945 switch (cx->cx_type) {
949 DEBUG_l( deb("(Found eval #%ld)\n", (long)i));
957 dopoptoloop(startingblock)
961 register CONTEXT *cx;
962 for (i = startingblock; i >= 0; i--) {
964 switch (cx->cx_type) {
967 warn("Exiting substitution via %s", op_name[op->op_type]);
971 warn("Exiting subroutine via %s", op_name[op->op_type]);
975 warn("Exiting eval via %s", op_name[op->op_type]);
979 warn("Exiting pseudo-block via %s", op_name[op->op_type]);
982 DEBUG_l( deb("(Found loop #%ld)\n", (long)i));
993 register CONTEXT *cx;
997 while (cxstack_ix > cxix) {
998 cx = &cxstack[cxstack_ix];
999 DEBUG_l(PerlIO_printf(Perl_debug_log, "Unwinding block %ld, type %s\n",
1000 (long) cxstack_ix+1, block_type[cx->cx_type]));
1001 /* Note: we don't need to restore the base context info till the end. */
1002 switch (cx->cx_type) {
1005 continue; /* not break */
1028 register CONTEXT *cx;
1034 STRLEN klen = strlen(message);
1036 svp = hv_fetch(GvHV(errgv), message, klen, TRUE);
1039 static char prefix[] = "\t(in cleanup) ";
1040 sv_upgrade(*svp, SVt_IV);
1041 (void)SvIOK_only(*svp);
1042 SvGROW(GvSV(errgv), SvCUR(GvSV(errgv))+sizeof(prefix)+klen);
1043 sv_catpvn(GvSV(errgv), prefix, sizeof(prefix)-1);
1044 sv_catpvn(GvSV(errgv), message, klen);
1050 sv_setpv(GvSV(errgv), message);
1052 cxix = dopoptoeval(cxstack_ix);
1056 if (cxix < cxstack_ix)
1060 if (cx->cx_type != CXt_EVAL) {
1061 PerlIO_printf(PerlIO_stderr(), "panic: die %s", message);
1066 if (gimme == G_SCALAR)
1067 *++newsp = &sv_undef;
1072 if (optype == OP_REQUIRE) {
1073 char* msg = SvPVx(GvSV(errgv), na);
1074 DIE("%s", *msg ? msg : "Compilation failed in require");
1076 return pop_return();
1079 PerlIO_printf(PerlIO_stderr(), "%s",message);
1080 PerlIO_flush(PerlIO_stderr());
1089 if (SvTRUE(left) != SvTRUE(right))
1101 RETURNOP(cLOGOP->op_other);
1110 RETURNOP(cLOGOP->op_other);
1117 SV** mark = (stack_base + *markstack_ptr + 1);
1119 while (mark < sp) { /* emulate old interface */
1124 return pp_entersub();
1131 register I32 cxix = dopoptosub(cxstack_ix);
1132 register CONTEXT *cx;
1143 if (GIMME != G_ARRAY)
1147 if (DBsub && cxix >= 0 &&
1148 cxstack[cxix].blk_sub.cv == GvCV(DBsub))
1152 cxix = dopoptosub(cxix - 1);
1154 cx = &cxstack[cxix];
1155 if (cxstack[cxix].cx_type == CXt_SUB) {
1156 dbcxix = dopoptosub(cxix - 1);
1157 /* We expect that cxstack[dbcxix] is CXt_SUB, anyway, the
1158 field below is defined for any cx. */
1159 if (DBsub && dbcxix >= 0 && cxstack[dbcxix].blk_sub.cv == GvCV(DBsub))
1160 cx = &cxstack[dbcxix];
1163 if (GIMME != G_ARRAY) {
1166 sv_setpv(TARG, HvNAME(cx->blk_oldcop->cop_stash));
1171 PUSHs(sv_2mortal(newSVpv(HvNAME(cx->blk_oldcop->cop_stash), 0)));
1172 PUSHs(sv_2mortal(newSVpv(SvPVX(GvSV(cx->blk_oldcop->cop_filegv)), 0)));
1173 PUSHs(sv_2mortal(newSViv((I32)cx->blk_oldcop->cop_line)));
1176 if (cx->cx_type == CXt_SUB) { /* So is cxstack[dbcxix]. */
1178 gv_efullname3(sv, CvGV(cxstack[cxix].blk_sub.cv), Nullch);
1179 PUSHs(sv_2mortal(sv));
1180 PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs)));
1183 PUSHs(sv_2mortal(newSVpv("(eval)",0)));
1184 PUSHs(sv_2mortal(newSViv(0)));
1186 gimme = (I32)cx->blk_gimme;
1187 if (gimme == G_VOID)
1190 PUSHs(sv_2mortal(newSViv(gimme & G_ARRAY)));
1191 if (cx->cx_type == CXt_EVAL) {
1192 if (cx->blk_eval.old_op_type == OP_ENTEREVAL) {
1193 PUSHs(cx->blk_eval.cur_text);
1196 else if (cx->blk_eval.old_name) { /* Try blocks have old_name == 0. */
1197 /* Require, put the name. */
1198 PUSHs(sv_2mortal(newSVpv(cx->blk_eval.old_name, 0)));
1202 else if (cx->cx_type == CXt_SUB &&
1203 cx->blk_sub.hasargs &&
1204 curcop->cop_stash == debstash)
1206 AV *ary = cx->blk_sub.argarray;
1207 int off = AvARRAY(ary) - AvALLOC(ary);
1211 dbargs = GvAV(gv_AVadd(tmpgv = gv_fetchpv("DB::args", TRUE,
1214 AvREAL_off(dbargs); /* XXX Should be REIFY */
1217 if (AvMAX(dbargs) < AvFILL(ary) + off)
1218 av_extend(dbargs, AvFILL(ary) + off);
1219 Copy(AvALLOC(ary), AvARRAY(dbargs), AvFILL(ary) + 1 + off, SV*);
1220 AvFILL(dbargs) = AvFILL(ary) + off;
1230 SV * const *str1 = (SV * const *)a;
1231 SV * const *str2 = (SV * const *)b;
1232 I32 oldsaveix = savestack_ix;
1233 I32 oldscopeix = scopestack_ix;
1235 GvSV(firstgv) = *str1;
1236 GvSV(secondgv) = *str2;
1237 stack_sp = stack_base;
1240 if (stack_sp != stack_base + 1)
1241 croak("Sort subroutine didn't return single value");
1242 if (!SvNIOKp(*stack_sp))
1243 croak("Sort subroutine didn't return a numeric value");
1244 result = SvIV(*stack_sp);
1245 while (scopestack_ix > oldscopeix) {
1248 leave_scope(oldsaveix);
1257 return sv_cmp(*(SV * const *)a, *(SV * const *)b);
1261 sortcmp_locale(a, b)
1265 return sv_cmp_locale(*(SV * const *)a, *(SV * const *)b);
1277 sv_reset(tmps, curcop->cop_stash);
1290 TAINT_NOT; /* Each statement is presumed innocent */
1291 stack_sp = stack_base + cxstack[cxstack_ix].blk_oldsp;
1294 if (op->op_private || SvIV(DBsingle) || SvIV(DBsignal) || SvIV(DBtrace))
1298 register CONTEXT *cx;
1299 I32 gimme = G_ARRAY;
1306 DIE("No DB::DB routine defined");
1308 if (CvDEPTH(cv) >= 1 && !(debug & (1<<30))) /* don't do recursive DB::DB call */
1320 push_return(op->op_next);
1321 PUSHBLOCK(cx, CXt_SUB, sp);
1324 (void)SvREFCNT_inc(cv);
1326 curpad = AvARRAY((AV*)*av_fetch(CvPADLIST(cv),1,FALSE));
1327 RETURNOP(CvSTART(cv));
1341 register CONTEXT *cx;
1342 I32 gimme = GIMME_V;
1349 svp = &curpad[op->op_targ]; /* "my" variable */
1351 svp = &GvSV((GV*)POPs); /* symbol table variable */
1357 PUSHBLOCK(cx, CXt_LOOP, SP);
1358 PUSHLOOP(cx, svp, MARK);
1359 if (op->op_flags & OPf_STACKED)
1360 cx->blk_loop.iterary = (AV*)SvREFCNT_inc(POPs);
1362 cx->blk_loop.iterary = curstack;
1363 AvFILL(curstack) = sp - stack_base;
1364 cx->blk_loop.iterix = MARK - stack_base;
1373 register CONTEXT *cx;
1374 I32 gimme = GIMME_V;
1380 PUSHBLOCK(cx, CXt_LOOP, SP);
1381 PUSHLOOP(cx, 0, SP);
1389 register CONTEXT *cx;
1390 struct block_loop cxloop;
1398 POPLOOP1(cx); /* Delay POPLOOP2 until stack values are safe */
1401 if (gimme == G_VOID)
1403 else if (gimme == G_SCALAR) {
1405 *++newsp = sv_mortalcopy(*SP);
1407 *++newsp = &sv_undef;
1411 *++newsp = sv_mortalcopy(*++mark);
1412 TAINT_NOT; /* Each item is independent */
1418 POPLOOP2(); /* Stack values are safe: release loop vars ... */
1419 curpm = newpm; /* ... and pop $1 et al */
1431 register CONTEXT *cx;
1432 struct block_sub cxsub;
1433 bool popsub2 = FALSE;
1439 if (curstack == sortstack) {
1440 if (cxstack_ix == sortcxix || dopoptosub(cxstack_ix) <= sortcxix) {
1441 if (cxstack_ix > sortcxix)
1443 AvARRAY(curstack)[1] = *SP;
1444 stack_sp = stack_base + 1;
1449 cxix = dopoptosub(cxstack_ix);
1451 DIE("Can't return outside a subroutine");
1452 if (cxix < cxstack_ix)
1456 switch (cx->cx_type) {
1458 POPSUB1(cx); /* Delay POPSUB2 until stack values are safe */
1463 if (optype == OP_REQUIRE &&
1464 (MARK == SP || (gimme == G_SCALAR && !SvTRUE(*SP))) )
1466 /* Unassume the success we assumed earlier. */
1467 char *name = cx->blk_eval.old_name;
1468 (void)hv_delete(GvHVn(incgv), name, strlen(name), G_DISCARD);
1469 DIE("%s did not return a true value", name);
1473 DIE("panic: return");
1477 if (gimme == G_SCALAR) {
1479 *++newsp = (popsub2 && SvTEMP(*SP))
1480 ? *SP : sv_mortalcopy(*SP);
1482 *++newsp = &sv_undef;
1484 else if (gimme == G_ARRAY) {
1485 while (++MARK <= SP) {
1486 *++newsp = (popsub2 && SvTEMP(*MARK))
1487 ? *MARK : sv_mortalcopy(*MARK);
1488 TAINT_NOT; /* Each item is independent */
1493 /* Stack values are safe: */
1495 POPSUB2(); /* release CV and @_ ... */
1497 curpm = newpm; /* ... and pop $1 et al */
1500 return pop_return();
1507 register CONTEXT *cx;
1508 struct block_loop cxloop;
1509 struct block_sub cxsub;
1516 SV **mark = stack_base + cxstack[cxstack_ix].blk_oldsp;
1518 if (op->op_flags & OPf_SPECIAL) {
1519 cxix = dopoptoloop(cxstack_ix);
1521 DIE("Can't \"last\" outside a block");
1524 cxix = dopoptolabel(cPVOP->op_pv);
1526 DIE("Label not found for \"last %s\"", cPVOP->op_pv);
1528 if (cxix < cxstack_ix)
1532 switch (cx->cx_type) {
1534 POPLOOP1(cx); /* Delay POPLOOP2 until stack values are safe */
1536 nextop = cxloop.last_op->op_next;
1539 POPSUB1(cx); /* Delay POPSUB2 until stack values are safe */
1541 nextop = pop_return();
1545 nextop = pop_return();
1552 if (gimme == G_SCALAR) {
1554 *++newsp = ((pop2 == CXt_SUB) && SvTEMP(*SP))
1555 ? *SP : sv_mortalcopy(*SP);
1557 *++newsp = &sv_undef;
1559 else if (gimme == G_ARRAY) {
1560 while (++MARK <= SP) {
1561 *++newsp = ((pop2 == CXt_SUB) && SvTEMP(*MARK))
1562 ? *MARK : sv_mortalcopy(*MARK);
1563 TAINT_NOT; /* Each item is independent */
1569 /* Stack values are safe: */
1572 POPLOOP2(); /* release loop vars ... */
1576 POPSUB2(); /* release CV and @_ ... */
1579 curpm = newpm; /* ... and pop $1 et al */
1588 register CONTEXT *cx;
1591 if (op->op_flags & OPf_SPECIAL) {
1592 cxix = dopoptoloop(cxstack_ix);
1594 DIE("Can't \"next\" outside a block");
1597 cxix = dopoptolabel(cPVOP->op_pv);
1599 DIE("Label not found for \"next %s\"", cPVOP->op_pv);
1601 if (cxix < cxstack_ix)
1605 oldsave = scopestack[scopestack_ix - 1];
1606 LEAVE_SCOPE(oldsave);
1607 return cx->blk_loop.next_op;
1613 register CONTEXT *cx;
1616 if (op->op_flags & OPf_SPECIAL) {
1617 cxix = dopoptoloop(cxstack_ix);
1619 DIE("Can't \"redo\" outside a block");
1622 cxix = dopoptolabel(cPVOP->op_pv);
1624 DIE("Label not found for \"redo %s\"", cPVOP->op_pv);
1626 if (cxix < cxstack_ix)
1630 oldsave = scopestack[scopestack_ix - 1];
1631 LEAVE_SCOPE(oldsave);
1632 return cx->blk_loop.redo_op;
1635 static OP* lastgotoprobe;
1638 dofindlabel(op,label,opstack,oplimit)
1646 static char too_deep[] = "Target of goto is too deeply nested";
1650 if (op->op_type == OP_LEAVE ||
1651 op->op_type == OP_SCOPE ||
1652 op->op_type == OP_LEAVELOOP ||
1653 op->op_type == OP_LEAVETRY)
1655 *ops++ = cUNOP->op_first;
1660 if (op->op_flags & OPf_KIDS) {
1661 /* First try all the kids at this level, since that's likeliest. */
1662 for (kid = cUNOP->op_first; kid; kid = kid->op_sibling) {
1663 if ((kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) &&
1664 kCOP->cop_label && strEQ(kCOP->cop_label, label))
1667 for (kid = cUNOP->op_first; kid; kid = kid->op_sibling) {
1668 if (kid == lastgotoprobe)
1670 if ((kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) &&
1672 (ops[-1]->op_type != OP_NEXTSTATE &&
1673 ops[-1]->op_type != OP_DBSTATE)))
1675 if (op = dofindlabel(kid, label, ops, oplimit))
1685 return pp_goto(ARGS);
1694 register CONTEXT *cx;
1695 #define GOTO_DEPTH 64
1696 OP *enterops[GOTO_DEPTH];
1698 int do_dump = (op->op_type == OP_DUMP);
1701 if (op->op_flags & OPf_STACKED) {
1704 /* This egregious kludge implements goto &subroutine */
1705 if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVCV) {
1707 register CONTEXT *cx;
1708 CV* cv = (CV*)SvRV(sv);
1713 if (!CvROOT(cv) && !CvXSUB(cv)) {
1715 SV *tmpstr = sv_newmortal();
1716 gv_efullname3(tmpstr, CvGV(cv), Nullch);
1717 DIE("Goto undefined subroutine &%s",SvPVX(tmpstr));
1719 DIE("Goto undefined subroutine");
1722 /* First do some returnish stuff. */
1723 cxix = dopoptosub(cxstack_ix);
1725 DIE("Can't goto subroutine outside a subroutine");
1726 if (cxix < cxstack_ix)
1730 if (cx->blk_sub.hasargs) { /* put @_ back onto stack */
1731 AV* av = cx->blk_sub.argarray;
1733 items = AvFILL(av) + 1;
1735 EXTEND(stack_sp, items); /* @_ could have been extended. */
1736 Copy(AvARRAY(av), stack_sp, items, SV*);
1738 SvREFCNT_dec(GvAV(defgv));
1739 GvAV(defgv) = cx->blk_sub.savearray;
1743 if (!(CvDEPTH(cx->blk_sub.cv) = cx->blk_sub.olddepth))
1744 SvREFCNT_dec(cx->blk_sub.cv);
1745 oldsave = scopestack[scopestack_ix - 1];
1746 LEAVE_SCOPE(oldsave);
1748 /* Now do some callish stuff. */
1751 if (CvOLDSTYLE(cv)) {
1752 I32 (*fp3)_((int,int,int));
1757 fp3 = (I32(*)_((int,int,int)))CvXSUB(cv);
1758 items = (*fp3)(CvXSUBANY(cv).any_i32,
1759 mark - stack_base + 1,
1761 sp = stack_base + items;
1764 stack_sp--; /* There is no cv arg. */
1765 (void)(*CvXSUB(cv))(cv);
1768 return pop_return();
1771 AV* padlist = CvPADLIST(cv);
1772 SV** svp = AvARRAY(padlist);
1773 cx->blk_sub.cv = cv;
1774 cx->blk_sub.olddepth = CvDEPTH(cv);
1776 if (CvDEPTH(cv) < 2)
1777 (void)SvREFCNT_inc(cv);
1778 else { /* save temporaries on recursion? */
1779 if (CvDEPTH(cv) == 100 && dowarn)
1780 sub_crush_depth(cv);
1781 if (CvDEPTH(cv) > AvFILL(padlist)) {
1782 AV *newpad = newAV();
1783 SV **oldpad = AvARRAY(svp[CvDEPTH(cv)-1]);
1784 I32 ix = AvFILL((AV*)svp[1]);
1785 svp = AvARRAY(svp[0]);
1786 for ( ;ix > 0; ix--) {
1787 if (svp[ix] != &sv_undef) {
1788 char *name = SvPVX(svp[ix]);
1789 if ((SvFLAGS(svp[ix]) & SVf_FAKE)
1792 /* outer lexical or anon code */
1793 av_store(newpad, ix,
1794 SvREFCNT_inc(oldpad[ix]) );
1796 else { /* our own lexical */
1798 av_store(newpad, ix, sv = (SV*)newAV());
1799 else if (*name == '%')
1800 av_store(newpad, ix, sv = (SV*)newHV());
1802 av_store(newpad, ix, sv = NEWSV(0,0));
1807 av_store(newpad, ix, sv = NEWSV(0,0));
1811 if (cx->blk_sub.hasargs) {
1814 av_store(newpad, 0, (SV*)av);
1815 AvFLAGS(av) = AVf_REIFY;
1817 av_store(padlist, CvDEPTH(cv), (SV*)newpad);
1818 AvFILL(padlist) = CvDEPTH(cv);
1819 svp = AvARRAY(padlist);
1823 curpad = AvARRAY((AV*)svp[CvDEPTH(cv)]);
1824 if (cx->blk_sub.hasargs) {
1825 AV* av = (AV*)curpad[0];
1828 cx->blk_sub.savearray = GvAV(defgv);
1829 cx->blk_sub.argarray = av;
1830 GvAV(defgv) = (AV*)SvREFCNT_inc(av);
1833 if (items >= AvMAX(av) + 1) {
1835 if (AvARRAY(av) != ary) {
1836 AvMAX(av) += AvARRAY(av) - AvALLOC(av);
1837 SvPVX(av) = (char*)ary;
1839 if (items >= AvMAX(av) + 1) {
1840 AvMAX(av) = items - 1;
1841 Renew(ary,items+1,SV*);
1843 SvPVX(av) = (char*)ary;
1846 Copy(mark,AvARRAY(av),items,SV*);
1847 AvFILL(av) = items - 1;
1855 if (perldb && curstash != debstash) {
1857 * We do not care about using sv to call CV;
1858 * it's for informational purposes only.
1860 SV *sv = GvSV(DBsub);
1862 gv_efullname3(sv, CvGV(cv), Nullch);
1864 RETURNOP(CvSTART(cv));
1868 label = SvPV(sv,na);
1870 else if (op->op_flags & OPf_SPECIAL) {
1872 DIE("goto must have label");
1875 label = cPVOP->op_pv;
1877 if (label && *label) {
1884 for (ix = cxstack_ix; ix >= 0; ix--) {
1886 switch (cx->cx_type) {
1888 gotoprobe = eval_root; /* XXX not good for nested eval */
1891 gotoprobe = cx->blk_oldcop->op_sibling;
1897 gotoprobe = cx->blk_oldcop->op_sibling;
1899 gotoprobe = main_root;
1902 if (CvDEPTH(cx->blk_sub.cv)) {
1903 gotoprobe = CvROOT(cx->blk_sub.cv);
1908 DIE("Can't \"goto\" outside a block");
1912 gotoprobe = main_root;
1915 retop = dofindlabel(gotoprobe, label,
1916 enterops, enterops + GOTO_DEPTH);
1919 lastgotoprobe = gotoprobe;
1922 DIE("Can't find label %s", label);
1924 /* pop unwanted frames */
1926 if (ix < cxstack_ix) {
1933 oldsave = scopestack[scopestack_ix];
1934 LEAVE_SCOPE(oldsave);
1937 /* push wanted frames */
1939 if (*enterops && enterops[1]) {
1941 for (ix = 1; enterops[ix]; ix++) {
1951 if (!retop) retop = main_start;
1958 restartop = 0; /* hmm, must be GNU unexec().. */
1962 if (curstack == signalstack) {
1980 if (anum == 1 && VMSISH_EXIT)
1993 double value = SvNVx(GvSV(cCOP->cop_gv));
1994 register I32 match = I_32(value);
1997 if (((double)match) > value)
1998 --match; /* was fractional--truncate other way */
2000 match -= cCOP->uop.scop.scop_offset;
2003 else if (match > cCOP->uop.scop.scop_max)
2004 match = cCOP->uop.scop.scop_max;
2005 op = cCOP->uop.scop.scop_next[match];
2015 op = op->op_next; /* can't assume anything */
2017 match = *(SvPVx(GvSV(cCOP->cop_gv), na)) & 255;
2018 match -= cCOP->uop.scop.scop_offset;
2021 else if (match > cCOP->uop.scop.scop_max)
2022 match = cCOP->uop.scop.scop_max;
2023 op = cCOP->uop.scop.scop_next[match];
2032 save_lines(array, sv)
2036 register char *s = SvPVX(sv);
2037 register char *send = SvPVX(sv) + SvCUR(sv);
2039 register I32 line = 1;
2041 while (s && s < send) {
2042 SV *tmpstr = NEWSV(85,0);
2044 sv_upgrade(tmpstr, SVt_PVMG);
2045 t = strchr(s, '\n');
2051 sv_setpvn(tmpstr, s, t - s);
2052 av_store(array, line++, tmpstr);
2062 I32 oldrunlevel = runlevel;
2068 assert(CATCH_GET == TRUE);
2069 DEBUG_l(deb("(Setting up local jumplevel, runlevel = %ld)\n", (long)runlevel+1));
2073 default: /* topmost level handles it */
2075 runlevel = oldrunlevel;
2081 PerlIO_printf(PerlIO_stderr(), "panic: restartop\n");
2092 runlevel = oldrunlevel;
2111 /* set up a scratch pad */
2116 SAVESPTR(comppad_name);
2117 SAVEI32(comppad_name_fill);
2118 SAVEI32(min_intro_pending);
2119 SAVEI32(max_intro_pending);
2123 compcv = (CV*)NEWSV(1104,0);
2124 sv_upgrade((SV *)compcv, SVt_PVCV);
2125 CvUNIQUE_on(compcv);
2128 comppad_name = newAV();
2129 comppad_name_fill = 0;
2130 min_intro_pending = 0;
2131 av_push(comppad, Nullsv);
2132 curpad = AvARRAY(comppad);
2135 comppadlist = newAV();
2136 AvREAL_off(comppadlist);
2137 av_store(comppadlist, 0, (SV*)comppad_name);
2138 av_store(comppadlist, 1, (SV*)comppad);
2139 CvPADLIST(compcv) = comppadlist;
2141 if (saveop->op_type != OP_REQUIRE)
2142 CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc(caller);
2146 /* make sure we compile in the right package */
2148 newstash = curcop->cop_stash;
2149 if (curstash != newstash) {
2151 curstash = newstash;
2155 SAVEFREESV(beginav);
2157 /* try to compile it */
2161 curcop = &compiling;
2162 curcop->cop_arybase = 0;
2164 rs = newSVpv("\n", 1);
2165 if (saveop->op_flags & OPf_SPECIAL)
2168 sv_setpv(GvSV(errgv),"");
2169 if (yyparse() || error_count || !eval_root) {
2180 SP = stack_base + POPMARK; /* pop original mark */
2186 if (optype == OP_REQUIRE) {
2187 char* msg = SvPVx(GvSV(errgv), na);
2188 DIE("%s", *msg ? msg : "Compilation failed in require");
2191 rs = SvREFCNT_inc(nrs);
2195 rs = SvREFCNT_inc(nrs);
2196 compiling.cop_line = 0;
2197 SAVEFREEOP(eval_root);
2199 scalarvoid(eval_root);
2200 else if (gimme & G_ARRAY)
2205 DEBUG_x(dump_eval());
2207 /* Register with debugger: */
2208 if (perldb && saveop->op_type == OP_REQUIRE) {
2209 CV *cv = perl_get_cv("DB::postponed", FALSE);
2213 XPUSHs((SV*)compiling.cop_filegv);
2215 perl_call_sv((SV*)cv, G_DISCARD);
2219 /* compiled okay, so do it */
2221 CvDEPTH(compcv) = 1;
2223 SP = stack_base + POPMARK; /* pop original mark */
2224 RETURNOP(eval_start);
2230 register CONTEXT *cx;
2234 SV *namesv = Nullsv;
2236 I32 gimme = G_SCALAR;
2237 PerlIO *tryrsfp = 0;
2240 if (SvNIOKp(sv) && !SvPOKp(sv)) {
2241 SET_NUMERIC_STANDARD();
2242 if (atof(patchlevel) + 0.00000999 < SvNV(sv))
2243 DIE("Perl %s required--this is only version %s, stopped",
2244 SvPV(sv,na),patchlevel);
2247 name = SvPV(sv, na);
2249 DIE("Null filename used");
2250 TAINT_PROPER("require");
2251 if (op->op_type == OP_REQUIRE &&
2252 (svp = hv_fetch(GvHVn(incgv), name, SvCUR(sv), 0)) &&
2256 /* prepare to compile file */
2261 (name[1] == '.' && name[2] == '/')))
2263 || (name[0] && name[1] == ':')
2266 || (strchr(name,':') || ((*name == '[' || *name == '<') &&
2267 (isALNUM(name[1]) || strchr("$-_]>",name[1]))))
2272 tryrsfp = PerlIO_open(name,"r");
2275 AV *ar = GvAVn(incgv);
2279 if ((unixname = tounixspec(name, Nullch)) != Nullch)
2282 namesv = NEWSV(806, 0);
2283 for (i = 0; i <= AvFILL(ar); i++) {
2284 char *dir = SvPVx(*av_fetch(ar, i, TRUE), na);
2287 if ((unixdir = tounixpath(dir, Nullch)) == Nullch)
2289 sv_setpv(namesv, unixdir);
2290 sv_catpv(namesv, unixname);
2292 sv_setpvf(namesv, "%s/%s", dir, name);
2294 tryname = SvPVX(namesv);
2295 tryrsfp = PerlIO_open(tryname, "r");
2297 if (tryname[0] == '.' && tryname[1] == '/')
2304 SAVESPTR(compiling.cop_filegv);
2305 compiling.cop_filegv = gv_fetchfile(tryrsfp ? tryname : name);
2306 SvREFCNT_dec(namesv);
2308 if (op->op_type == OP_REQUIRE) {
2309 SV *msg = sv_2mortal(newSVpvf("Can't locate %s in @INC", name));
2310 SV *dirmsgsv = NEWSV(0, 0);
2311 AV *ar = GvAVn(incgv);
2313 if (instr(SvPVX(msg), ".h "))
2314 sv_catpv(msg, " (change .h to .ph maybe?)");
2315 if (instr(SvPVX(msg), ".ph "))
2316 sv_catpv(msg, " (did you run h2ph?)");
2317 sv_catpv(msg, " (@INC contains:");
2318 for (i = 0; i <= AvFILL(ar); i++) {
2319 char *dir = SvPVx(*av_fetch(ar, i, TRUE), na);
2320 sv_setpvf(dirmsgsv, " %s", dir);
2321 sv_catsv(msg, dirmsgsv);
2323 sv_catpvn(msg, ")", 1);
2324 SvREFCNT_dec(dirmsgsv);
2331 /* Assume success here to prevent recursive requirement. */
2332 (void)hv_store(GvHVn(incgv), name, strlen(name),
2333 newSVsv(GvSV(compiling.cop_filegv)), 0 );
2337 lex_start(sv_2mortal(newSVpv("",0)));
2339 save_aptr(&rsfp_filters);
2340 rsfp_filters = NULL;
2344 name = savepv(name);
2349 /* switch to eval mode */
2351 push_return(op->op_next);
2352 PUSHBLOCK(cx, CXt_EVAL, SP);
2353 PUSHEVAL(cx, name, compiling.cop_filegv);
2355 compiling.cop_line = 0;
2358 return DOCATCH(doeval(G_SCALAR));
2363 return pp_require(ARGS);
2369 register CONTEXT *cx;
2371 I32 gimme = GIMME_V, was = sub_generation;
2372 char tmpbuf[TYPE_DIGITS(long) + 12];
2377 if (!SvPV(sv,len) || !len)
2379 TAINT_PROPER("eval");
2385 /* switch to eval mode */
2387 SAVESPTR(compiling.cop_filegv);
2388 sprintf(tmpbuf, "_<(eval %lu)", (unsigned long)++evalseq);
2389 compiling.cop_filegv = gv_fetchfile(tmpbuf+2);
2390 compiling.cop_line = 1;
2391 /* XXX For C<eval "...">s within BEGIN {} blocks, this ends up
2392 deleting the eval's FILEGV from the stash before gv_check() runs
2393 (i.e. before run-time proper). To work around the coredump that
2394 ensues, we always turn GvMULTI_on for any globals that were
2395 introduced within evals. See force_ident(). GSAR 96-10-12 */
2396 safestr = savepv(tmpbuf);
2397 SAVEDELETE(defstash, safestr, strlen(safestr));
2399 hints = op->op_targ;
2401 push_return(op->op_next);
2402 PUSHBLOCK(cx, CXt_EVAL, SP);
2403 PUSHEVAL(cx, 0, compiling.cop_filegv);
2405 /* prepare to compile string */
2407 if (perldb && curstash != debstash)
2408 save_lines(GvAV(compiling.cop_filegv), linestr);
2410 ret = doeval(gimme);
2411 if (perldb && was != sub_generation) { /* Some subs defined here. */
2412 strcpy(safestr, "_<(eval )"); /* Anything fake and short. */
2414 return DOCATCH(ret);
2424 register CONTEXT *cx;
2426 U8 save_flags = op -> op_flags;
2431 retop = pop_return();
2434 if (gimme == G_VOID)
2436 else if (gimme == G_SCALAR) {
2439 if (SvFLAGS(TOPs) & SVs_TEMP)
2442 *MARK = sv_mortalcopy(TOPs);
2450 /* in case LEAVE wipes old return values */
2451 for (mark = newsp + 1; mark <= SP; mark++) {
2452 if (!(SvFLAGS(*mark) & SVs_TEMP)) {
2453 *mark = sv_mortalcopy(*mark);
2454 TAINT_NOT; /* Each item is independent */
2458 curpm = newpm; /* Don't pop $1 et al till now */
2461 assert(CvDEPTH(compcv) == 1);
2463 CvDEPTH(compcv) = 0;
2465 if (optype == OP_REQUIRE &&
2466 !(gimme == G_SCALAR ? SvTRUE(*sp) : sp > newsp))
2468 /* Unassume the success we assumed earlier. */
2469 char *name = cx->blk_eval.old_name;
2470 (void)hv_delete(GvHVn(incgv), name, strlen(name), G_DISCARD);
2471 retop = die("%s did not return a true value", name);
2477 if (!(save_flags & OPf_SPECIAL))
2478 sv_setpv(GvSV(errgv),"");
2486 register CONTEXT *cx;
2487 I32 gimme = GIMME_V;
2492 push_return(cLOGOP->op_other->op_next);
2493 PUSHBLOCK(cx, CXt_EVAL, SP);
2495 eval_root = op; /* Only needed so that goto works right. */
2498 sv_setpv(GvSV(errgv),"");
2500 return DOCATCH(op->op_next);
2510 register CONTEXT *cx;
2518 if (gimme == G_VOID)
2520 else if (gimme == G_SCALAR) {
2523 if (SvFLAGS(TOPs) & (SVs_PADTMP|SVs_TEMP))
2526 *MARK = sv_mortalcopy(TOPs);
2535 /* in case LEAVE wipes old return values */
2536 for (mark = newsp + 1; mark <= SP; mark++) {
2537 if (!(SvFLAGS(*mark) & (SVs_PADTMP|SVs_TEMP))) {
2538 *mark = sv_mortalcopy(*mark);
2539 TAINT_NOT; /* Each item is independent */
2543 curpm = newpm; /* Don't pop $1 et al till now */
2546 sv_setpv(GvSV(errgv),"");
2555 register char *s = SvPV_force(sv, len);
2556 register char *send = s + len;
2557 register char *base;
2558 register I32 skipspaces = 0;
2561 bool postspace = FALSE;
2569 croak("Null picture in formline");
2571 New(804, fops, (send - s)*3+10, U16); /* Almost certainly too long... */
2576 *fpc++ = FF_LINEMARK;
2577 noblank = repeat = FALSE;
2595 case ' ': case '\t':
2606 *fpc++ = FF_LITERAL;
2614 *fpc++ = skipspaces;
2618 *fpc++ = FF_NEWLINE;
2622 arg = fpc - linepc + 1;
2629 *fpc++ = FF_LINEMARK;
2630 noblank = repeat = FALSE;
2639 ischop = s[-1] == '^';
2645 arg = (s - base) - 1;
2647 *fpc++ = FF_LITERAL;
2656 *fpc++ = FF_LINEGLOB;
2658 else if (*s == '#' || (*s == '.' && s[1] == '#')) {
2659 arg = ischop ? 512 : 0;
2669 arg |= 256 + (s - f);
2671 *fpc++ = s - base; /* fieldsize for FETCH */
2672 *fpc++ = FF_DECIMAL;
2677 bool ismore = FALSE;
2680 while (*++s == '>') ;
2681 prespace = FF_SPACE;
2683 else if (*s == '|') {
2684 while (*++s == '|') ;
2685 prespace = FF_HALFSPACE;
2690 while (*++s == '<') ;
2693 if (*s == '.' && s[1] == '.' && s[2] == '.') {
2697 *fpc++ = s - base; /* fieldsize for FETCH */
2699 *fpc++ = ischop ? FF_CHECKCHOP : FF_CHECKNL;
2717 { /* need to jump to the next word */
2719 z = WORD_ALIGN - SvCUR(sv) % WORD_ALIGN;
2720 SvGROW(sv, SvCUR(sv) + z + arg * sizeof(U16) + 4);
2721 s = SvPVX(sv) + SvCUR(sv) + z;
2723 Copy(fops, s, arg, U16);
2725 sv_magic(sv, Nullsv, 'f', Nullch, 0);